Skip to content

Commit 264348e

Browse files
author
Mohammad Kabat
committed
net/mlx5e: Offload rule only when all encaps are valid
Bugzilla: https://bugzilla.redhat.com/2112947 Upstream-status: v6.1-rc7 commit f377422 Author: Chris Mi <cmi@nvidia.com> Date: Thu Nov 17 07:45:45 2022 +0200 net/mlx5e: Offload rule only when all encaps are valid The cited commit adds a for loop to support multiple encapsulations. But it only checks if the last encap is valid. Fix it by setting slow path flag when one of the encap is invalid. Fixes: f493f15 ("net/mlx5e: Move flow attr reformat action bit to per dest flags") Signed-off-by: Chris Mi <cmi@nvidia.com> Reviewed-by: Roi Dayan <roid@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com> Signed-off-by: Mohammad Kabat <mkabat@redhat.com>
1 parent 446215a commit 264348e

File tree

3 files changed

+9
-17
lines changed

3 files changed

+9
-17
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -764,8 +764,7 @@ int mlx5e_attach_encap(struct mlx5e_priv *priv,
764764
struct net_device *mirred_dev,
765765
int out_index,
766766
struct netlink_ext_ack *extack,
767-
struct net_device **encap_dev,
768-
bool *encap_valid)
767+
struct net_device **encap_dev)
769768
{
770769
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
771770
struct mlx5e_tc_flow_parse_attr *parse_attr;
@@ -880,9 +879,8 @@ int mlx5e_attach_encap(struct mlx5e_priv *priv,
880879
if (e->flags & MLX5_ENCAP_ENTRY_VALID) {
881880
attr->esw_attr->dests[out_index].pkt_reformat = e->pkt_reformat;
882881
attr->esw_attr->dests[out_index].flags |= MLX5_ESW_DEST_ENCAP_VALID;
883-
*encap_valid = true;
884882
} else {
885-
*encap_valid = false;
883+
flow_flag_set(flow, SLOW);
886884
}
887885
mutex_unlock(&esw->offloads.encap_tbl_lock);
888886

drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ int mlx5e_attach_encap(struct mlx5e_priv *priv,
1717
struct net_device *mirred_dev,
1818
int out_index,
1919
struct netlink_ext_ack *extack,
20-
struct net_device **encap_dev,
21-
bool *encap_valid);
20+
struct net_device **encap_dev);
2221

2322
int mlx5e_attach_decap(struct mlx5e_priv *priv,
2423
struct mlx5e_tc_flow *flow,

drivers/net/ethernet/mellanox/mlx5/core/en_tc.c

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1620,7 +1620,6 @@ set_encap_dests(struct mlx5e_priv *priv,
16201620
struct mlx5e_tc_flow *flow,
16211621
struct mlx5_flow_attr *attr,
16221622
struct netlink_ext_ack *extack,
1623-
bool *encap_valid,
16241623
bool *vf_tun)
16251624
{
16261625
struct mlx5e_tc_flow_parse_attr *parse_attr;
@@ -1637,7 +1636,6 @@ set_encap_dests(struct mlx5e_priv *priv,
16371636
parse_attr = attr->parse_attr;
16381637
esw_attr = attr->esw_attr;
16391638
*vf_tun = false;
1640-
*encap_valid = true;
16411639

16421640
for (out_index = 0; out_index < MLX5_MAX_FLOW_FWD_VPORTS; out_index++) {
16431641
struct net_device *out_dev;
@@ -1654,7 +1652,7 @@ set_encap_dests(struct mlx5e_priv *priv,
16541652
goto out;
16551653
}
16561654
err = mlx5e_attach_encap(priv, flow, attr, out_dev, out_index,
1657-
extack, &encap_dev, encap_valid);
1655+
extack, &encap_dev);
16581656
dev_put(out_dev);
16591657
if (err)
16601658
goto out;
@@ -1718,8 +1716,8 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv,
17181716
struct mlx5e_tc_flow_parse_attr *parse_attr;
17191717
struct mlx5_flow_attr *attr = flow->attr;
17201718
struct mlx5_esw_flow_attr *esw_attr;
1721-
bool vf_tun, encap_valid;
17221719
u32 max_prio, max_chain;
1720+
bool vf_tun;
17231721
int err = 0;
17241722

17251723
parse_attr = attr->parse_attr;
@@ -1809,7 +1807,7 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv,
18091807
esw_attr->int_port = int_port;
18101808
}
18111809

1812-
err = set_encap_dests(priv, flow, attr, extack, &encap_valid, &vf_tun);
1810+
err = set_encap_dests(priv, flow, attr, extack, &vf_tun);
18131811
if (err)
18141812
goto err_out;
18151813

@@ -1839,7 +1837,7 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv,
18391837
* (1) there's no error
18401838
* (2) there's an encap action and we don't have valid neigh
18411839
*/
1842-
if (!encap_valid || flow_flag_test(flow, SLOW))
1840+
if (flow_flag_test(flow, SLOW))
18431841
flow->rule[0] = mlx5e_tc_offload_to_slow_path(esw, flow, &parse_attr->spec);
18441842
else
18451843
flow->rule[0] = mlx5e_tc_offload_fdb_rules(esw, flow, &parse_attr->spec, attr);
@@ -3741,7 +3739,7 @@ alloc_flow_post_acts(struct mlx5e_tc_flow *flow, struct netlink_ext_ack *extack)
37413739
struct mlx5e_post_act *post_act = get_post_action(flow->priv);
37423740
struct mlx5_flow_attr *attr, *next_attr = NULL;
37433741
struct mlx5e_post_act_handle *handle;
3744-
bool vf_tun, encap_valid = true;
3742+
bool vf_tun;
37453743
int err;
37463744

37473745
/* This is going in reverse order as needed.
@@ -3763,13 +3761,10 @@ alloc_flow_post_acts(struct mlx5e_tc_flow *flow, struct netlink_ext_ack *extack)
37633761
if (list_is_last(&attr->list, &flow->attrs))
37643762
break;
37653763

3766-
err = set_encap_dests(flow->priv, flow, attr, extack, &encap_valid, &vf_tun);
3764+
err = set_encap_dests(flow->priv, flow, attr, extack, &vf_tun);
37673765
if (err)
37683766
goto out_free;
37693767

3770-
if (!encap_valid)
3771-
flow_flag_set(flow, SLOW);
3772-
37733768
err = actions_prepare_mod_hdr_actions(flow->priv, flow, attr, extack);
37743769
if (err)
37753770
goto out_free;

0 commit comments

Comments
 (0)