From patchwork Wed Feb 23 23:39:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 12757711 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8B71C4167D for ; Wed, 23 Feb 2022 23:40:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245093AbiBWXkg (ORCPT ); Wed, 23 Feb 2022 18:40:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244991AbiBWXkV (ORCPT ); Wed, 23 Feb 2022 18:40:21 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22F095B3EA; Wed, 23 Feb 2022 15:39:45 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 7461ECE1CEE; Wed, 23 Feb 2022 23:39:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47EFAC340F4; Wed, 23 Feb 2022 23:39:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645659581; bh=x9UKmK3BgZIxNfogmE7vYver6vDTrTChZ2LUN6NFRl0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SwzvnJe3RoWT2SmcMRttkpsvSGDJq2+kwDZkHHA3fnGigJDw0CN5/B6G1WBHMgXiu qSZTOEtWVkSJmYLDyHtAHhpbmTrNMSERITPlEZpHG/ov6ajV6myLGeTsHuvmBTdAxs bv83jWzGEGQWHrMrS3rCgbAfvZ9M/37vCZWd6v02DlW9VDBRMZRfYw/vtURKRD3tFF MmN//YQHi4rpds86aNzlJ2bwiRwnC4lNhdrnCg6Kj2X9VZSHY+7p3lsHH/dz1Qcb4v qB8ojQhuDivXjzmHXrQWL2iwFqE5XYdmCar13a8d2Q/WgmrQcBZOihp2tN7sZjMwuW mHk0avta87qtQ== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski , Jason Gunthorpe Cc: Leon Romanovsky , linux-rdma@vger.kernel.org, netdev@vger.kernel.org, Mark Bloch , Maor Gottlieb , Saeed Mahameed Subject: [for-next v2 07/17] net/mlx5: Lag, don't use magic numbers for ports Date: Wed, 23 Feb 2022 15:39:20 -0800 Message-Id: <20220223233930.319301-8-saeed@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220223233930.319301-1-saeed@kernel.org> References: <20220223233930.319301-1-saeed@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Mark Bloch Instead of using 1 & 2 as the ports numbers use an enum value. Signed-off-by: Mark Bloch Reviewed-by: Maor Gottlieb Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c b/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c index 0758a98a08d1..05e8cbece095 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c @@ -40,6 +40,11 @@ #include "lag.h" #include "mp.h" +enum { + MLX5_LAG_EGRESS_PORT_1 = 1, + MLX5_LAG_EGRESS_PORT_2, +}; + /* General purpose, use for short periods of time. * Beware of lock dependencies (preferably, no locks should be acquired * under it). @@ -193,15 +198,15 @@ static void mlx5_infer_tx_affinity_mapping(struct lag_tracker *tracker, p2en = tracker->netdev_state[MLX5_LAG_P2].tx_enabled && tracker->netdev_state[MLX5_LAG_P2].link_up; - *port1 = 1; - *port2 = 2; + *port1 = MLX5_LAG_EGRESS_PORT_1; + *port2 = MLX5_LAG_EGRESS_PORT_2; if ((!p1en && !p2en) || (p1en && p2en)) return; if (p1en) - *port2 = 1; + *port2 = MLX5_LAG_EGRESS_PORT_1; else - *port1 = 2; + *port1 = MLX5_LAG_EGRESS_PORT_2; } static int _mlx5_modify_lag(struct mlx5_lag *ldev, u8 v2p_port1, u8 v2p_port2)