Skip to content

Commit 1065e00

Browse files
maorgottliebSaeed Mahameed
authored andcommitted
net/mlx5: Lag, set LAG traffic type mapping
Generate a traffic type bitmap that will define which steering objects we need to create for the steering based LAG. Bits in this bitmap are set according to the LAG hash type. In addition, have a field that indicate if the lag is in encap mode or not. Signed-off-by: Maor Gottlieb <maorg@nvidia.com> Reviewed-by: Mark Bloch <mbloch@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
1 parent 3d67773 commit 1065e00

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include "mlx5_core.h"
88
#include "mp.h"
9+
#include "port_sel.h"
910

1011
enum {
1112
MLX5_LAG_P1,
@@ -49,6 +50,7 @@ struct mlx5_lag {
4950
struct delayed_work bond_work;
5051
struct notifier_block nb;
5152
struct lag_mp lag_mp;
53+
struct mlx5_lag_port_sel port_sel;
5254
};
5355

5456
static inline struct mlx5_lag *
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
2+
/* Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. */
3+
4+
#include <linux/netdevice.h>
5+
#include "lag.h"
6+
7+
static void set_tt_map(struct mlx5_lag_port_sel *port_sel,
8+
enum netdev_lag_hash hash)
9+
{
10+
port_sel->tunnel = false;
11+
12+
switch (hash) {
13+
case NETDEV_LAG_HASH_E34:
14+
port_sel->tunnel = true;
15+
fallthrough;
16+
case NETDEV_LAG_HASH_L34:
17+
set_bit(MLX5_TT_IPV4_TCP, port_sel->tt_map);
18+
set_bit(MLX5_TT_IPV4_UDP, port_sel->tt_map);
19+
set_bit(MLX5_TT_IPV6_TCP, port_sel->tt_map);
20+
set_bit(MLX5_TT_IPV6_UDP, port_sel->tt_map);
21+
set_bit(MLX5_TT_IPV4, port_sel->tt_map);
22+
set_bit(MLX5_TT_IPV6, port_sel->tt_map);
23+
set_bit(MLX5_TT_ANY, port_sel->tt_map);
24+
break;
25+
case NETDEV_LAG_HASH_E23:
26+
port_sel->tunnel = true;
27+
fallthrough;
28+
case NETDEV_LAG_HASH_L23:
29+
set_bit(MLX5_TT_IPV4, port_sel->tt_map);
30+
set_bit(MLX5_TT_IPV6, port_sel->tt_map);
31+
set_bit(MLX5_TT_ANY, port_sel->tt_map);
32+
break;
33+
default:
34+
set_bit(MLX5_TT_ANY, port_sel->tt_map);
35+
break;
36+
}
37+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2+
/* Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. */
3+
4+
#ifndef __MLX5_LAG_FS_H__
5+
#define __MLX5_LAG_FS_H__
6+
7+
#include "lib/fs_ttc.h"
8+
9+
struct mlx5_lag_port_sel {
10+
DECLARE_BITMAP(tt_map, MLX5_NUM_TT);
11+
bool tunnel;
12+
};
13+
14+
#endif /* __MLX5_LAG_FS_H__ */

0 commit comments

Comments
 (0)