Skip to content

Commit d2ff4fa

Browse files
author
Saeed Mahameed
committed
net/mlx5: Add missing likely/unlikely hints to cq events
If a hardware event is targeting a CQ, that CQ should exist. Add unlikely to error handling flows. Signed-off-by: Saeed Mahameed <saeedm@mellanox.com> Reviewed-by: Gal Pressman <galp@mellanox.com>
1 parent 02d92f7 commit d2ff4fa

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

  • drivers/net/ethernet/mellanox/mlx5/core

‎drivers/net/ethernet/mellanox/mlx5/core/cq.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ void mlx5_cq_completion(struct mlx5_eq *eq, u32 cqn)
9797
refcount_inc(&cq->refcount);
9898
spin_unlock(&table->lock);
9999

100-
if (!cq) {
100+
if (unlikely(!cq)) {
101101
mlx5_core_warn(eq->dev, "Completion event for bogus CQ 0x%x\n", cqn);
102102
return;
103103
}
@@ -118,12 +118,12 @@ void mlx5_cq_event(struct mlx5_eq *eq, u32 cqn, int event_type)
118118
spin_lock(&table->lock);
119119

120120
cq = radix_tree_lookup(&table->tree, cqn);
121-
if (cq)
121+
if (likely(cq))
122122
refcount_inc(&cq->refcount);
123123

124124
spin_unlock(&table->lock);
125125

126-
if (!cq) {
126+
if (unlikely(!cq)) {
127127
mlx5_core_warn(eq->dev, "Async event for bogus CQ 0x%x\n", cqn);
128128
return;
129129
}

0 commit comments

Comments
 (0)