Return-Path: Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:37556 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751317AbeBUUO6 (ORCPT ); Wed, 21 Feb 2018 15:14:58 -0500 From: Saeed Mahameed To: "David S. Miller" , Doug Ledford Cc: Leon Romanovsky , Jason Gunthorpe , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, Saeed Mahameed Subject: [for-next 2/7] net/mlx5: Add missing likely/unlikely hints to cq events Date: Wed, 21 Feb 2018 12:13:49 -0800 Message-Id: <20180221201354.8802-3-saeedm@mellanox.com> In-Reply-To: <20180221201354.8802-1-saeedm@mellanox.com> References: <20180221201354.8802-1-saeedm@mellanox.com> Sender: netdev-owner@vger.kernel.org List-ID: If a hardware event is targeting a CQ, that CQ should exist. Add unlikely to error handling flows. Signed-off-by: Saeed Mahameed Reviewed-by: Gal Pressman --- drivers/net/ethernet/mellanox/mlx5/core/cq.c | 6 +++--- 1 file 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) 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; } -- 2.14.3