net/mlx5: Add missing likely/unlikely hints to cq events
authorSaeed Mahameed <saeedm@mellanox.com>
Thu, 8 Feb 2018 04:48:43 +0000 (20:48 -0800)
committerSaeed Mahameed <saeedm@mellanox.com>
Thu, 15 Feb 2018 08:30:00 +0000 (00:30 -0800)
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>
drivers/net/ethernet/mellanox/mlx5/core/cq.c

index dfbeeaa432763ffdcd1e298a84843fbe20e071fc..9feeb555e93706d12fd6d9c5016dadc71115d1ec 100644 (file)
@@ -97,7 +97,7 @@ void mlx5_cq_completion(struct mlx5_eq *eq, u32 cqn)
                refcount_inc(&cq->refcount);
        spin_unlock(&table->lock);
 
-       if (!cq) {
+       if (unlikely(!cq)) {
                mlx5_core_warn(eq->dev, "Completion event for bogus CQ 0x%x\n", cqn);
                return;
        }
@@ -118,12 +118,12 @@ void mlx5_cq_event(struct mlx5_eq *eq, u32 cqn, int event_type)
        spin_lock(&table->lock);
 
        cq = radix_tree_lookup(&table->tree, cqn);
-       if (cq)
+       if (likely(cq))
                refcount_inc(&cq->refcount);
 
        spin_unlock(&table->lock);
 
-       if (!cq) {
+       if (unlikely(!cq)) {
                mlx5_core_warn(eq->dev, "Async event for bogus CQ 0x%x\n", cqn);
                return;
        }