Skip to content

Commit 724b509

Browse files
roidayanSaeed Mahameed
authored andcommitted
net/mlx5: Add multipath mode
In order to offload ecmp-on-host scheme where next-hop routes are used, we will make use of HW LAG. Add accessor function to let upper layers in the driver to realize if the lag acts in multi-path mode. Signed-off-by: Roi Dayan <[email protected]> Reviewed-by: Or Gerlitz <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent e6ee5e7 commit 724b509

File tree

4 files changed

+28
-2
lines changed

4 files changed

+28
-2
lines changed

drivers/net/ethernet/mellanox/mlx5/core/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ mlx5_core-$(CONFIG_MLX5_CORE_EN) += en_main.o en_common.o en_fs.o en_ethtool.o \
3030
mlx5_core-$(CONFIG_MLX5_EN_ARFS) += en_arfs.o
3131
mlx5_core-$(CONFIG_MLX5_EN_RXNFC) += en_fs_ethtool.o
3232
mlx5_core-$(CONFIG_MLX5_CORE_EN_DCB) += en_dcbnl.o en/port_buffer.o
33-
mlx5_core-$(CONFIG_MLX5_ESWITCH) += en_rep.o en_tc.o en/tc_tun.o lib/port_tun.o
33+
mlx5_core-$(CONFIG_MLX5_ESWITCH) += en_rep.o en_tc.o en/tc_tun.o lib/port_tun.o lag_mp.o
3434

3535
#
3636
# Core extra

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@
99
enum {
1010
MLX5_LAG_FLAG_ROCE = 1 << 0,
1111
MLX5_LAG_FLAG_SRIOV = 1 << 1,
12+
MLX5_LAG_FLAG_MULTIPATH = 1 << 2,
1213
};
1314

14-
#define MLX5_LAG_MODE_FLAGS (MLX5_LAG_FLAG_ROCE | MLX5_LAG_FLAG_SRIOV)
15+
#define MLX5_LAG_MODE_FLAGS (MLX5_LAG_FLAG_ROCE | MLX5_LAG_FLAG_SRIOV |\
16+
MLX5_LAG_FLAG_MULTIPATH)
1517

1618
struct lag_func {
1719
struct mlx5_core_dev *dev;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
2+
/* Copyright (c) 2019 Mellanox Technologies. */
3+
4+
#include <linux/netdevice.h>
5+
#include "lag.h"
6+
#include "mlx5_core.h"
7+
#include "eswitch.h"
8+
9+
static bool __mlx5_lag_is_multipath(struct mlx5_lag *ldev)
10+
{
11+
return !!(ldev->flags & MLX5_LAG_FLAG_MULTIPATH);
12+
}
13+
14+
bool mlx5_lag_is_multipath(struct mlx5_core_dev *dev)
15+
{
16+
struct mlx5_lag *ldev;
17+
bool res;
18+
19+
ldev = mlx5_lag_dev_get(dev);
20+
res = ldev && __mlx5_lag_is_multipath(ldev);
21+
22+
return res;
23+
}

include/linux/mlx5/driver.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,6 +1041,7 @@ int mlx5_cmd_create_vport_lag(struct mlx5_core_dev *dev);
10411041
int mlx5_cmd_destroy_vport_lag(struct mlx5_core_dev *dev);
10421042
bool mlx5_lag_is_roce(struct mlx5_core_dev *dev);
10431043
bool mlx5_lag_is_sriov(struct mlx5_core_dev *dev);
1044+
bool mlx5_lag_is_multipath(struct mlx5_core_dev *dev);
10441045
bool mlx5_lag_is_active(struct mlx5_core_dev *dev);
10451046
struct net_device *mlx5_lag_get_roce_netdev(struct mlx5_core_dev *dev);
10461047
int mlx5_lag_query_cong_counters(struct mlx5_core_dev *dev,

0 commit comments

Comments
 (0)