net/mlx5: Lag, Update multiport eswitch check to log an error
authorRoi Dayan <roid@nvidia.com>
Mon, 28 Nov 2022 11:52:07 +0000 (13:52 +0200)
committerSaeed Mahameed <saeedm@nvidia.com>
Sat, 4 Feb 2023 10:07:02 +0000 (02:07 -0800)
Update the function to log an error to the user if failing to offload
the rule and while there add correct prefix for the function name.

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/en/tc/act/mirred.c
drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.c
drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.h

index 78c427b..c095a12 100644 (file)
@@ -232,9 +232,9 @@ parse_mirred(struct mlx5e_tc_act_parse_state *parse_state,
        parse_state->ifindexes[if_count] = out_dev->ifindex;
        parse_state->if_count++;
        is_uplink_rep = mlx5e_eswitch_uplink_rep(out_dev);
-       err = mlx5_lag_do_mirred(priv->mdev, out_dev);
-       if (err)
-               return err;
+
+       if (mlx5_lag_mpesw_do_mirred(priv->mdev, out_dev, extack))
+               return -EOPNOTSUPP;
 
        out_dev = get_fdb_out_dev(uplink_dev, out_dev);
        if (!out_dev)
index c17e8f1..d2f8408 100644 (file)
@@ -96,17 +96,20 @@ int mlx5_lag_add_mpesw_rule(struct mlx5_core_dev *dev)
        return mlx5_lag_mpesw_queue_work(dev, MLX5_MPESW_OP_ENABLE);
 }
 
-int mlx5_lag_do_mirred(struct mlx5_core_dev *mdev, struct net_device *out_dev)
+int mlx5_lag_mpesw_do_mirred(struct mlx5_core_dev *mdev,
+                            struct net_device *out_dev,
+                            struct netlink_ext_ack *extack)
 {
        struct mlx5_lag *ldev = mdev->priv.lag;
 
        if (!netif_is_bond_master(out_dev) || !ldev)
                return 0;
 
-       if (ldev->mode == MLX5_LAG_MODE_MPESW)
-               return -EOPNOTSUPP;
+       if (ldev->mode != MLX5_LAG_MODE_MPESW)
+               return 0;
 
-       return 0;
+       NL_SET_ERR_MSG_MOD(extack, "can't forward to bond in mpesw mode");
+       return -EOPNOTSUPP;
 }
 
 bool mlx5_lag_mpesw_is_activated(struct mlx5_core_dev *dev)
index 88e8daf..f88dc6e 100644 (file)
@@ -12,7 +12,9 @@ struct lag_mpesw {
        atomic_t mpesw_rule_count;
 };
 
-int mlx5_lag_do_mirred(struct mlx5_core_dev *mdev, struct net_device *out_dev);
+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);
 #if IS_ENABLED(CONFIG_MLX5_ESWITCH)
 void mlx5_lag_mpesw_init(struct mlx5_lag *ldev);