aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaeed Mahameed <saeedm@mellanox.com>2018-02-07 23:48:43 -0500
committerSaeed Mahameed <saeedm@mellanox.com>2018-02-15 03:30:00 -0500
commitd2ff4fa575000058def5f5c602784e233211d4e7 (patch)
tree0b37d5dc6b52a0856f9bcb66cb29916a0c4e198f
parent02d92f7903647119e125b24f5470f96cee0d4b4b (diff)
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>
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/cq.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cq.c b/drivers/net/ethernet/mellanox/mlx5/core/cq.c
index dfbeeaa43276..9feeb555e937 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/cq.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/cq.c
@@ -97,7 +97,7 @@ void mlx5_cq_completion(struct mlx5_eq *eq, u32 cqn)
97 refcount_inc(&cq->refcount); 97 refcount_inc(&cq->refcount);
98 spin_unlock(&table->lock); 98 spin_unlock(&table->lock);
99 99
100 if (!cq) { 100 if (unlikely(!cq)) {
101 mlx5_core_warn(eq->dev, "Completion event for bogus CQ 0x%x\n", cqn); 101 mlx5_core_warn(eq->dev, "Completion event for bogus CQ 0x%x\n", cqn);
102 return; 102 return;
103 } 103 }
@@ -118,12 +118,12 @@ void mlx5_cq_event(struct mlx5_eq *eq, u32 cqn, int event_type)
118 spin_lock(&table->lock); 118 spin_lock(&table->lock);
119 119
120 cq = radix_tree_lookup(&table->tree, cqn); 120 cq = radix_tree_lookup(&table->tree, cqn);
121 if (cq) 121 if (likely(cq))
122 refcount_inc(&cq->refcount); 122 refcount_inc(&cq->refcount);
123 123
124 spin_unlock(&table->lock); 124 spin_unlock(&table->lock);
125 125
126 if (!cq) { 126 if (unlikely(!cq)) {
127 mlx5_core_warn(eq->dev, "Async event for bogus CQ 0x%x\n", cqn); 127 mlx5_core_warn(eq->dev, "Async event for bogus CQ 0x%x\n", cqn);
128 return; 128 return;
129 } 129 }