]> git.dujemihanovic.xyz Git - linux.git/commitdiff
net/mlx5: Lag, change multipath and bonding to be mutually exclusive
authorMaor Dickman <maord@nvidia.com>
Thu, 7 Oct 2021 13:05:38 +0000 (16:05 +0300)
committerSaeed Mahameed <saeedm@nvidia.com>
Wed, 20 Oct 2021 17:42:49 +0000 (10:42 -0700)
Both multipath and bonding events are changing the HW LAG state
independently.
Handling one of the features events while the other is already
enabled can cause unwanted behavior, for example handling
bonding event while multipath enabled will disable the lag and
cause multipath to stop working.

Fix it by ignoring bonding event while in multipath and ignoring FIB
events while in bonding mode.

Fixes: 544fe7c2e654 ("net/mlx5e: Activate HW multipath and handle port affinity based on FIB events")
Signed-off-by: Maor Dickman <maord@nvidia.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
Reviewed-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
drivers/net/ethernet/mellanox/mlx5/core/lag.c
drivers/net/ethernet/mellanox/mlx5/core/lag_mp.c
drivers/net/ethernet/mellanox/mlx5/core/lag_mp.h
include/linux/mlx5/driver.h

index b4e98681879470a30f93346cb7dc66680228d9de..4a13ef561587d8797e08e52bdcb5e6cb4d9049a6 100644 (file)
@@ -10,6 +10,8 @@
 #include "en_tc.h"
 #include "rep/tc.h"
 #include "rep/neigh.h"
+#include "lag.h"
+#include "lag_mp.h"
 
 struct mlx5e_tc_tun_route_attr {
        struct net_device *out_dev;
index ba81647920167d9152fee996ddcd47a9872d62ab..129ff7e0d65cc4b04f1eb8ae96037958ce5cb80b 100644 (file)
@@ -67,6 +67,8 @@
 #include "lib/fs_chains.h"
 #include "diag/en_tc_tracepoint.h"
 #include <asm/div64.h>
+#include "lag.h"
+#include "lag_mp.h"
 
 #define nic_chains(priv) ((priv)->fs.tc.chains)
 #define MLX5_MH_ACT_SZ MLX5_UN_SZ_BYTES(set_add_copy_action_in_auto)
index ca5690b0a7abbf3628e7d56d96f9d9ee6233099a..d2105c1635c34f929f3323e5026482fbd562bf95 100644 (file)
@@ -442,6 +442,10 @@ static void mlx5_do_bond(struct mlx5_lag *ldev)
        if (!mlx5_lag_is_ready(ldev)) {
                do_bond = false;
        } else {
+               /* VF LAG is in multipath mode, ignore bond change requests */
+               if (mlx5_lag_is_multipath(dev0))
+                       return;
+
                tracker = ldev->tracker;
 
                do_bond = tracker.is_bonded && mlx5_lag_check_prereq(ldev);
index f239b352a58a1859a1cbfb7c2edb1e51dd361637..21fdaf708f1fe80acaa95acba0d754c92c262c06 100644 (file)
@@ -9,20 +9,23 @@
 #include "eswitch.h"
 #include "lib/mlx5.h"
 
+static bool __mlx5_lag_is_multipath(struct mlx5_lag *ldev)
+{
+       return !!(ldev->flags & MLX5_LAG_FLAG_MULTIPATH);
+}
+
 static bool mlx5_lag_multipath_check_prereq(struct mlx5_lag *ldev)
 {
        if (!mlx5_lag_is_ready(ldev))
                return false;
 
+       if (__mlx5_lag_is_active(ldev) && !__mlx5_lag_is_multipath(ldev))
+               return false;
+
        return mlx5_esw_multipath_prereq(ldev->pf[MLX5_LAG_P1].dev,
                                         ldev->pf[MLX5_LAG_P2].dev);
 }
 
-static bool __mlx5_lag_is_multipath(struct mlx5_lag *ldev)
-{
-       return !!(ldev->flags & MLX5_LAG_FLAG_MULTIPATH);
-}
-
 bool mlx5_lag_is_multipath(struct mlx5_core_dev *dev)
 {
        struct mlx5_lag *ldev;
index 729c839397a89f65e86d17df17186536288d0d68..dea199e79beda53c150de12e921d5554756d7e3c 100644 (file)
@@ -24,12 +24,14 @@ struct lag_mp {
 void mlx5_lag_mp_reset(struct mlx5_lag *ldev);
 int mlx5_lag_mp_init(struct mlx5_lag *ldev);
 void mlx5_lag_mp_cleanup(struct mlx5_lag *ldev);
+bool mlx5_lag_is_multipath(struct mlx5_core_dev *dev);
 
 #else /* CONFIG_MLX5_ESWITCH */
 
 static inline void mlx5_lag_mp_reset(struct mlx5_lag *ldev) {};
 static inline int mlx5_lag_mp_init(struct mlx5_lag *ldev) { return 0; }
 static inline void mlx5_lag_mp_cleanup(struct mlx5_lag *ldev) {}
+bool mlx5_lag_is_multipath(struct mlx5_core_dev *dev) { return false; }
 
 #endif /* CONFIG_MLX5_ESWITCH */
 #endif /* __MLX5_LAG_MP_H__ */
index e23417424373fc647d89e3df7d8ea2b51684ca43..f17d2101af7a0e28001946aea1363a0e6849638a 100644 (file)
@@ -1138,7 +1138,6 @@ int mlx5_cmd_create_vport_lag(struct mlx5_core_dev *dev);
 int mlx5_cmd_destroy_vport_lag(struct mlx5_core_dev *dev);
 bool mlx5_lag_is_roce(struct mlx5_core_dev *dev);
 bool mlx5_lag_is_sriov(struct mlx5_core_dev *dev);
-bool mlx5_lag_is_multipath(struct mlx5_core_dev *dev);
 bool mlx5_lag_is_active(struct mlx5_core_dev *dev);
 bool mlx5_lag_is_master(struct mlx5_core_dev *dev);
 bool mlx5_lag_is_shared_fdb(struct mlx5_core_dev *dev);