Commit d2ff4fa5 authored by Saeed Mahameed's avatar Saeed Mahameed

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: default avatarSaeed Mahameed <saeedm@mellanox.com>
Reviewed-by: default avatarGal Pressman <galp@mellanox.com>
parent 02d92f79
...@@ -97,7 +97,7 @@ void mlx5_cq_completion(struct mlx5_eq *eq, u32 cqn) ...@@ -97,7 +97,7 @@ void mlx5_cq_completion(struct mlx5_eq *eq, u32 cqn)
refcount_inc(&cq->refcount); refcount_inc(&cq->refcount);
spin_unlock(&table->lock); spin_unlock(&table->lock);
if (!cq) { if (unlikely(!cq)) {
mlx5_core_warn(eq->dev, "Completion event for bogus CQ 0x%x\n", cqn); mlx5_core_warn(eq->dev, "Completion event for bogus CQ 0x%x\n", cqn);
return; return;
} }
...@@ -118,12 +118,12 @@ void mlx5_cq_event(struct mlx5_eq *eq, u32 cqn, int event_type) ...@@ -118,12 +118,12 @@ void mlx5_cq_event(struct mlx5_eq *eq, u32 cqn, int event_type)
spin_lock(&table->lock); spin_lock(&table->lock);
cq = radix_tree_lookup(&table->tree, cqn); cq = radix_tree_lookup(&table->tree, cqn);
if (cq) if (likely(cq))
refcount_inc(&cq->refcount); refcount_inc(&cq->refcount);
spin_unlock(&table->lock); spin_unlock(&table->lock);
if (!cq) { if (unlikely(!cq)) {
mlx5_core_warn(eq->dev, "Async event for bogus CQ 0x%x\n", cqn); mlx5_core_warn(eq->dev, "Async event for bogus CQ 0x%x\n", cqn);
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment