net/mlx5e: TC, Refactor mlx5e_tc_add_flow_mod_hdr() to get flow attr
authorRoi Dayan <roid@nvidia.com>
Thu, 25 Nov 2021 12:32:58 +0000 (14:32 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Jan 2023 10:59:12 +0000 (11:59 +0100)
[ Upstream commit ff99316700799b84e842f819a44db608557bae3e ]

In later commit we are going to instantiate multiple attr instances
for flow instead of single attr.
Make sure mlx5e_tc_add_flow_mod_hdr() use the correct attr and not flow->attr.

Signed-off-by: Roi Dayan <roid@nvidia.com>
Reviewed-by: Oz Shlomo <ozsh@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Stable-dep-of: 2951b2e142ec ("net/mlx5e: Always clear dest encap in neigh-update-del")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
drivers/net/ethernet/mellanox/mlx5/core/en_tc.h

index 700c463ea36791d4e05cb96351ea1b2d35d80dab..3b63d9c20580fb7b18990193c5b550bebbbf104e 100644 (file)
@@ -1342,7 +1342,7 @@ static void mlx5e_reoffload_encap(struct mlx5e_priv *priv,
                        continue;
                }
 
-               err = mlx5e_tc_add_flow_mod_hdr(priv, parse_attr, flow);
+               err = mlx5e_tc_add_flow_mod_hdr(priv, flow, attr);
                if (err) {
                        mlx5_core_warn(priv->mdev, "Failed to update flow mod_hdr err=%d",
                                       err);
index 843c8435387f36279e42ebf98723ab168314d84b..8f2f99689abacc3d97d88103a85e5b7af4cb7f02 100644 (file)
@@ -1342,10 +1342,10 @@ int mlx5e_tc_query_route_vport(struct net_device *out_dev, struct net_device *ro
 }
 
 int mlx5e_tc_add_flow_mod_hdr(struct mlx5e_priv *priv,
-                             struct mlx5e_tc_flow_parse_attr *parse_attr,
-                             struct mlx5e_tc_flow *flow)
+                             struct mlx5e_tc_flow *flow,
+                             struct mlx5_flow_attr *attr)
 {
-       struct mlx5e_tc_mod_hdr_acts *mod_hdr_acts = &parse_attr->mod_hdr_acts;
+       struct mlx5e_tc_mod_hdr_acts *mod_hdr_acts = &attr->parse_attr->mod_hdr_acts;
        struct mlx5_modify_hdr *mod_hdr;
 
        mod_hdr = mlx5_modify_header_alloc(priv->mdev,
@@ -1355,8 +1355,8 @@ int mlx5e_tc_add_flow_mod_hdr(struct mlx5e_priv *priv,
        if (IS_ERR(mod_hdr))
                return PTR_ERR(mod_hdr);
 
-       WARN_ON(flow->attr->modify_hdr);
-       flow->attr->modify_hdr = mod_hdr;
+       WARN_ON(attr->modify_hdr);
+       attr->modify_hdr = mod_hdr;
 
        return 0;
 }
@@ -1457,7 +1457,7 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv,
        if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR &&
            !(attr->ct_attr.ct_action & TCA_CT_ACT_CLEAR)) {
                if (vf_tun) {
-                       err = mlx5e_tc_add_flow_mod_hdr(priv, parse_attr, flow);
+                       err = mlx5e_tc_add_flow_mod_hdr(priv, flow, attr);
                        if (err)
                                goto err_out;
                } else {
index 1a4cd882f0fba27ae226a9db4db2fe5cfeeaf040..f48af82781f88f1ef1fc6939452c88a52205b5e6 100644 (file)
@@ -241,8 +241,8 @@ int mlx5e_tc_match_to_reg_set_and_get_id(struct mlx5_core_dev *mdev,
                                         u32 data);
 
 int mlx5e_tc_add_flow_mod_hdr(struct mlx5e_priv *priv,
-                             struct mlx5e_tc_flow_parse_attr *parse_attr,
-                             struct mlx5e_tc_flow *flow);
+                             struct mlx5e_tc_flow *flow,
+                             struct mlx5_flow_attr *attr);
 
 int alloc_mod_hdr_actions(struct mlx5_core_dev *mdev,
                          int namespace,