Skip to content

Commit efd89ff

Browse files
kliteynBrian Maly
authored andcommitted
net/mlx5e: TC, CT: Offload ct clear only once
Non-clear CT action causes a flow rule split, while CT clear action doesn't and is just a header-rewrite to the current flow rule. But ct offload is done in post_parse and is per ct action instance, so ct clear offload is parsed multiple times, while its deleted once. Fix this by post_parsing the ct action only once per flow attribute (which is per flow rule) by using a offloaded ct_attr flag. Fixes: 08fe94e ("net/mlx5e: TC, Remove special handling of CT action") Signed-off-by: Paul Blakey <[email protected]> Signed-off-by: Yevgeny Kliteynik <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]> Orabug: 35622106 (cherry picked from commit f7a4851) cherry-pick-repo=kernel/git/torvalds/linux.git unmodified-from-upstream: f7a4851 Signed-off-by: Mikhael Goikhman <[email protected]> Signed-off-by: Qing Huang <[email protected]> Reviewed-by: Devesh Sharma <[email protected]> Signed-off-by: Brian Maly <[email protected]>
1 parent 8719c20 commit efd89ff

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,7 +1545,8 @@ mlx5_tc_ct_parse_action(struct mlx5_tc_ct_priv *priv,
15451545

15461546
attr->ct_attr.ct_action |= act->ct.action; /* So we can have clear + ct */
15471547
attr->ct_attr.zone = act->ct.zone;
1548-
attr->ct_attr.nf_ft = act->ct.flow_table;
1548+
if (!(act->ct.action & TCA_CT_ACT_CLEAR))
1549+
attr->ct_attr.nf_ft = act->ct.flow_table;
15491550
attr->ct_attr.act_miss_cookie = act->miss_cookie;
15501551

15511552
return 0;
@@ -1990,6 +1991,9 @@ mlx5_tc_ct_flow_offload(struct mlx5_tc_ct_priv *priv, struct mlx5_flow_attr *att
19901991
if (!priv)
19911992
return -EOPNOTSUPP;
19921993

1994+
if (attr->ct_attr.offloaded)
1995+
return 0;
1996+
19931997
if (attr->ct_attr.ct_action & TCA_CT_ACT_CLEAR) {
19941998
err = mlx5_tc_ct_entry_set_registers(priv, &attr->parse_attr->mod_hdr_acts,
19951999
0, 0, 0, 0);
@@ -1999,11 +2003,15 @@ mlx5_tc_ct_flow_offload(struct mlx5_tc_ct_priv *priv, struct mlx5_flow_attr *att
19992003
attr->action |= MLX5_FLOW_CONTEXT_ACTION_MOD_HDR;
20002004
}
20012005

2002-
if (!attr->ct_attr.nf_ft) /* means only ct clear action, and not ct_clear,ct() */
2006+
if (!attr->ct_attr.nf_ft) { /* means only ct clear action, and not ct_clear,ct() */
2007+
attr->ct_attr.offloaded = true;
20032008
return 0;
2009+
}
20042010

20052011
mutex_lock(&priv->control_lock);
20062012
err = __mlx5_tc_ct_flow_offload(priv, attr);
2013+
if (!err)
2014+
attr->ct_attr.offloaded = true;
20072015
mutex_unlock(&priv->control_lock);
20082016

20092017
return err;
@@ -2021,7 +2029,7 @@ void
20212029
mlx5_tc_ct_delete_flow(struct mlx5_tc_ct_priv *priv,
20222030
struct mlx5_flow_attr *attr)
20232031
{
2024-
if (!attr->ct_attr.ft) /* no ct action, return */
2032+
if (!attr->ct_attr.offloaded) /* no ct action, return */
20252033
return;
20262034
if (!attr->ct_attr.nf_ft) /* means only ct clear action, and not ct_clear,ct() */
20272035
return;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ struct mlx5_ct_attr {
2929
u32 ct_labels_id;
3030
u32 act_miss_mapping;
3131
u64 act_miss_cookie;
32+
bool offloaded;
3233
struct mlx5_ct_ft *ft;
3334
};
3435

0 commit comments

Comments
 (0)