lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220510055743.118828-14-saeedm@nvidia.com>
Date:   Mon,  9 May 2022 22:57:41 -0700
From:   Saeed Mahameed <saeedm@...dia.com>
To:     "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>
Cc:     netdev@...r.kernel.org, Mark Bloch <mbloch@...dia.com>,
        Maor Gottlieb <maorg@...dia.com>,
        Saeed Mahameed <saeedm@...dia.com>
Subject: [net-next 13/15] net/mlx5: Lag, refactor dmesg print

From: Mark Bloch <mbloch@...dia.com>

Combine dmesg lag prints into a single function.

Signed-off-by: Mark Bloch <mbloch@...dia.com>
Reviewed-by: Maor Gottlieb <maorg@...dia.com>
Signed-off-by: Saeed Mahameed <saeedm@...dia.com>
---
 .../net/ethernet/mellanox/mlx5/core/lag/lag.c | 22 ++++++++++---------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c b/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
index 716e073c80d4..90056a3ca89d 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
@@ -107,6 +107,16 @@ int mlx5_cmd_destroy_vport_lag(struct mlx5_core_dev *dev)
 }
 EXPORT_SYMBOL(mlx5_cmd_destroy_vport_lag);
 
+static void mlx5_lag_print_mapping(struct mlx5_core_dev *dev,
+				   struct mlx5_lag *ldev)
+{
+	int i;
+
+	mlx5_core_info(dev, "lag map:\n");
+	for (i = 0; i < ldev->ports; i++)
+		mlx5_core_info(dev, "\tport %d:%d\n", i + 1, ldev->v2p_map[i]);
+}
+
 static int mlx5_lag_netdev_event(struct notifier_block *this,
 				 unsigned long event, void *ptr);
 static void mlx5_do_bond_work(struct work_struct *work);
@@ -311,7 +321,6 @@ void mlx5_modify_lag(struct mlx5_lag *ldev,
 	u8 ports[MLX5_MAX_PORTS] = {};
 	int err;
 	int i;
-	int j;
 
 	mlx5_infer_tx_affinity_mapping(tracker, ldev->ports, ports);
 
@@ -328,11 +337,7 @@ void mlx5_modify_lag(struct mlx5_lag *ldev,
 		memcpy(ldev->v2p_map, ports, sizeof(ports[0]) *
 		       ldev->ports);
 
-		mlx5_core_info(dev0, "modify lag map\n");
-		for (j = 0; j < ldev->ports; j++)
-			mlx5_core_info(dev0, "\tmap port %d:%d\n",
-				       j + 1,
-				       ldev->v2p_map[j]);
+		mlx5_lag_print_mapping(dev0, ldev);
 		break;
 	}
 
@@ -393,11 +398,8 @@ static int mlx5_create_lag(struct mlx5_lag *ldev,
 	struct mlx5_core_dev *dev1 = ldev->pf[MLX5_LAG_P2].dev;
 	u32 in[MLX5_ST_SZ_DW(destroy_lag_in)] = {};
 	int err;
-	int i;
 
-	mlx5_core_info(dev0, "lag map:\n");
-	for (i = 0; i < ldev->ports; i++)
-		mlx5_core_info(dev0, "\tport %d:%d\n", i + 1, ldev->v2p_map[i]);
+	mlx5_lag_print_mapping(dev0, ldev);
 	mlx5_core_info(dev0, "shared_fdb:%d mode:%s\n",
 		       shared_fdb, get_str_port_sel_mode(flags));
 
-- 
2.35.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ