Skip to content

Commit 4f45514

Browse files
mark-blochSaeed Mahameed
authored andcommitted
net/mlx5: Lag, don't use magic numbers for ports
Instead of using 1 & 2 as the ports numbers use an enum value. Signed-off-by: Mark Bloch <[email protected]> Reviewed-by: Maor Gottlieb <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 9278287 commit 4f45514

File tree

1 file changed

+9
-4
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core/lag

1 file changed

+9
-4
lines changed

drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@
4040
#include "lag.h"
4141
#include "mp.h"
4242

43+
enum {
44+
MLX5_LAG_EGRESS_PORT_1 = 1,
45+
MLX5_LAG_EGRESS_PORT_2,
46+
};
47+
4348
/* General purpose, use for short periods of time.
4449
* Beware of lock dependencies (preferably, no locks should be acquired
4550
* under it).
@@ -193,15 +198,15 @@ static void mlx5_infer_tx_affinity_mapping(struct lag_tracker *tracker,
193198
p2en = tracker->netdev_state[MLX5_LAG_P2].tx_enabled &&
194199
tracker->netdev_state[MLX5_LAG_P2].link_up;
195200

196-
*port1 = 1;
197-
*port2 = 2;
201+
*port1 = MLX5_LAG_EGRESS_PORT_1;
202+
*port2 = MLX5_LAG_EGRESS_PORT_2;
198203
if ((!p1en && !p2en) || (p1en && p2en))
199204
return;
200205

201206
if (p1en)
202-
*port2 = 1;
207+
*port2 = MLX5_LAG_EGRESS_PORT_1;
203208
else
204-
*port1 = 2;
209+
*port1 = MLX5_LAG_EGRESS_PORT_2;
205210
}
206211

207212
static int _mlx5_modify_lag(struct mlx5_lag *ldev, u8 v2p_port1, u8 v2p_port2)

0 commit comments

Comments
 (0)