net/mlx5e: TC, Add peer flow in mpesw mode
authorRoi Dayan <roid@nvidia.com>
Thu, 1 Dec 2022 09:10:20 +0000 (11:10 +0200)
committerSaeed Mahameed <saeedm@nvidia.com>
Tue, 14 Feb 2023 22:08:24 +0000 (14:08 -0800)
While at it rename mlx5_lag_mpesw_is_activated() to mlx5_lag_is_mpesw() to
be consistent with checking if other lag modes are activated.

Signed-off-by: Roi Dayan <roid@nvidia.com>
Reviewed-by: Maor Dickman <maord@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/devlink.c
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/eswitch_offloads.c
drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.c
drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.h

index 4c9dde377e7dacebc36fde5c27079126917dab15..2d36123cc05ed833e6ebb4f80c54d4649b1290b1 100644 (file)
@@ -461,7 +461,7 @@ static int mlx5_devlink_esw_multiport_get(struct devlink *devlink, u32 id,
        if (!MLX5_ESWITCH_MANAGER(dev))
                return -EOPNOTSUPP;
 
-       ctx->val.vbool = mlx5_lag_mpesw_is_activated(dev);
+       ctx->val.vbool = mlx5_lag_is_mpesw(dev);
        return 0;
 }
 
index 83bb0811e77410dc557a806c1f9032babcbb6bef..684c0293a4d678540ae41247b6f2ad951580052c 100644 (file)
@@ -97,7 +97,8 @@ static int get_route_and_out_devs(struct mlx5e_priv *priv,
              mlx5e_is_uplink_rep(netdev_priv(*out_dev))))
                return -EOPNOTSUPP;
 
-       if (mlx5e_eswitch_uplink_rep(priv->netdev) && *out_dev != priv->netdev)
+       if (mlx5e_eswitch_uplink_rep(priv->netdev) && *out_dev != priv->netdev &&
+           !mlx5_lag_is_mpesw(priv->mdev))
                return -EOPNOTSUPP;
 
        return 0;
index dcfeb0077152a8177a1e41a47cc28caf3dc5ef81..fd2a0b431f3d68f39242e23802f240449033f9d4 100644 (file)
@@ -4311,7 +4311,7 @@ static bool is_lag_dev(struct mlx5e_priv *priv,
 
 static bool is_multiport_eligible(struct mlx5e_priv *priv, struct net_device *out_dev)
 {
-       return same_hw_reps(priv, out_dev) && mlx5_lag_mpesw_is_activated(priv->mdev);
+       return same_hw_reps(priv, out_dev) && mlx5_lag_is_mpesw(priv->mdev);
 }
 
 bool mlx5e_is_valid_eswitch_fwd_dev(struct mlx5e_priv *priv,
@@ -4482,6 +4482,9 @@ static bool is_peer_flow_needed(struct mlx5e_tc_flow *flow)
            (is_rep_ingress || act_is_encap))
                return true;
 
+       if (mlx5_lag_is_mpesw(esw_attr->in_mdev))
+               return true;
+
        return false;
 }
 
@@ -4687,8 +4690,10 @@ static int mlx5e_tc_add_fdb_peer_flow(struct flow_cls_offload *f,
         * So packets redirected to uplink use the same mdev of the
         * original flow and packets redirected from uplink use the
         * peer mdev.
+        * In multiport eswitch it's a special case that we need to
+        * keep the original mdev.
         */
-       if (attr->in_rep->vport == MLX5_VPORT_UPLINK)
+       if (attr->in_rep->vport == MLX5_VPORT_UPLINK && !mlx5_lag_is_mpesw(priv->mdev))
                in_mdev = peer_priv->mdev;
        else
                in_mdev = priv->mdev;
index 8fb09143e9e8412ca2434f25b61c02dbba028989..2a98375a0abf88af461e438ca75a3f1d51e3f6ab 100644 (file)
@@ -443,7 +443,7 @@ esw_setup_vport_dest(struct mlx5_flow_destination *dest, struct mlx5_flow_act *f
                        MLX5_CAP_GEN(esw_attr->dests[attr_idx].mdev, vhca_id);
                dest[dest_idx].vport.flags |= MLX5_FLOW_DEST_VPORT_VHCA_ID;
                if (dest[dest_idx].vport.num == MLX5_VPORT_UPLINK &&
-                   mlx5_lag_mpesw_is_activated(esw->dev))
+                   mlx5_lag_is_mpesw(esw->dev))
                        dest[dest_idx].type = MLX5_FLOW_DESTINATION_TYPE_UPLINK;
        }
        if (esw_attr->dests[attr_idx].flags & MLX5_ESW_DEST_ENCAP_VALID) {
index 3f8fc965cec6d4f5c76e748645031eacadcc76b0..dd3cb9aa06fd030e786151677d9210cd57f68b8b 100644 (file)
@@ -116,7 +116,7 @@ int mlx5_lag_mpesw_do_mirred(struct mlx5_core_dev *mdev,
        return -EOPNOTSUPP;
 }
 
-bool mlx5_lag_mpesw_is_activated(struct mlx5_core_dev *dev)
+bool mlx5_lag_is_mpesw(struct mlx5_core_dev *dev)
 {
        struct mlx5_lag *ldev = mlx5_lag_dev(dev);
 
index 571e4acf262e6500934745613484f8fc5995fe92..d857ea988bf2cd9353bcecf1ad807c07c84f43b1 100644 (file)
@@ -27,7 +27,7 @@ struct mlx5_mpesw_work_st {
 int mlx5_lag_mpesw_do_mirred(struct mlx5_core_dev *mdev,
                             struct net_device *out_dev,
                             struct netlink_ext_ack *extack);
-bool mlx5_lag_mpesw_is_activated(struct mlx5_core_dev *dev);
+bool mlx5_lag_is_mpesw(struct mlx5_core_dev *dev);
 void mlx5_lag_mpesw_disable(struct mlx5_core_dev *dev);
 int mlx5_lag_mpesw_enable(struct mlx5_core_dev *dev);