mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 02:19:51 +00:00
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>
This commit is contained in:
parent
3d677735d3
commit
1065e0015d
3 changed files with 53 additions and 0 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include "mlx5_core.h"
|
||||
#include "mp.h"
|
||||
#include "port_sel.h"
|
||||
|
||||
enum {
|
||||
MLX5_LAG_P1,
|
||||
|
@ -49,6 +50,7 @@ struct mlx5_lag {
|
|||
struct delayed_work bond_work;
|
||||
struct notifier_block nb;
|
||||
struct lag_mp lag_mp;
|
||||
struct mlx5_lag_port_sel port_sel;
|
||||
};
|
||||
|
||||
static inline struct mlx5_lag *
|
||||
|
|
37
drivers/net/ethernet/mellanox/mlx5/core/lag/port_sel.c
Normal file
37
drivers/net/ethernet/mellanox/mlx5/core/lag/port_sel.c
Normal file
|
@ -0,0 +1,37 @@
|
|||
// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
|
||||
/* Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. */
|
||||
|
||||
#include <linux/netdevice.h>
|
||||
#include "lag.h"
|
||||
|
||||
static void set_tt_map(struct mlx5_lag_port_sel *port_sel,
|
||||
enum netdev_lag_hash hash)
|
||||
{
|
||||
port_sel->tunnel = false;
|
||||
|
||||
switch (hash) {
|
||||
case NETDEV_LAG_HASH_E34:
|
||||
port_sel->tunnel = true;
|
||||
fallthrough;
|
||||
case NETDEV_LAG_HASH_L34:
|
||||
set_bit(MLX5_TT_IPV4_TCP, port_sel->tt_map);
|
||||
set_bit(MLX5_TT_IPV4_UDP, port_sel->tt_map);
|
||||
set_bit(MLX5_TT_IPV6_TCP, port_sel->tt_map);
|
||||
set_bit(MLX5_TT_IPV6_UDP, port_sel->tt_map);
|
||||
set_bit(MLX5_TT_IPV4, port_sel->tt_map);
|
||||
set_bit(MLX5_TT_IPV6, port_sel->tt_map);
|
||||
set_bit(MLX5_TT_ANY, port_sel->tt_map);
|
||||
break;
|
||||
case NETDEV_LAG_HASH_E23:
|
||||
port_sel->tunnel = true;
|
||||
fallthrough;
|
||||
case NETDEV_LAG_HASH_L23:
|
||||
set_bit(MLX5_TT_IPV4, port_sel->tt_map);
|
||||
set_bit(MLX5_TT_IPV6, port_sel->tt_map);
|
||||
set_bit(MLX5_TT_ANY, port_sel->tt_map);
|
||||
break;
|
||||
default:
|
||||
set_bit(MLX5_TT_ANY, port_sel->tt_map);
|
||||
break;
|
||||
}
|
||||
}
|
14
drivers/net/ethernet/mellanox/mlx5/core/lag/port_sel.h
Normal file
14
drivers/net/ethernet/mellanox/mlx5/core/lag/port_sel.h
Normal file
|
@ -0,0 +1,14 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
|
||||
/* Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. */
|
||||
|
||||
#ifndef __MLX5_LAG_FS_H__
|
||||
#define __MLX5_LAG_FS_H__
|
||||
|
||||
#include "lib/fs_ttc.h"
|
||||
|
||||
struct mlx5_lag_port_sel {
|
||||
DECLARE_BITMAP(tt_map, MLX5_NUM_TT);
|
||||
bool tunnel;
|
||||
};
|
||||
|
||||
#endif /* __MLX5_LAG_FS_H__ */
|
Loading…
Reference in a new issue