Skip to content

Commit 2a6c01e

Browse files
author
Benjamin Poirier
committed
net/mlx5e: CT: Filter legacy rules that are unrelated to nic
JIRA: https://issues.redhat.com/browse/RHEL-72227 JIRA: https://issues.redhat.com/browse/RHEL-73520 Upstream-status: v6.15-rc1 commit 0fe2347 Author: Paul Blakey <paulb@nvidia.com> Date: Wed Mar 19 16:03:02 2025 +0200 net/mlx5e: CT: Filter legacy rules that are unrelated to nic In nic mode CT setup where we do hairpin between the two nics, both nics register to the same flow table (per zone), and try to offload all rules on it. Instead, filter the rules that originated from the relevant nic (so only one side is offloaded for each nic). Signed-off-by: Paul Blakey <paulb@nvidia.com> Reviewed-by: Jianbo Liu <jianbol@nvidia.com> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Link: https://patch.msgid.link/1742392983-153050-5-git-send-email-tariqt@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Benjamin Poirier <bpoirier@redhat.com>
1 parent 8f1ca9e commit 2a6c01e

File tree

1 file changed

+29
-0
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core/en

1 file changed

+29
-0
lines changed

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,6 +1349,32 @@ mlx5_tc_ct_block_flow_offload_stats(struct mlx5_ct_ft *ft,
13491349
return 0;
13501350
}
13511351

1352+
static bool
1353+
mlx5_tc_ct_filter_legacy_non_nic_flows(struct mlx5_ct_ft *ft,
1354+
struct flow_cls_offload *flow)
1355+
{
1356+
struct flow_rule *rule = flow_cls_offload_flow_rule(flow);
1357+
struct mlx5_tc_ct_priv *ct_priv = ft->ct_priv;
1358+
struct flow_match_meta match;
1359+
struct net_device *netdev;
1360+
bool same_dev = false;
1361+
1362+
if (!is_mdev_legacy_mode(ct_priv->dev) ||
1363+
!flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_META))
1364+
return true;
1365+
1366+
flow_rule_match_meta(rule, &match);
1367+
1368+
if (!(match.key->ingress_ifindex & match.mask->ingress_ifindex))
1369+
return true;
1370+
1371+
netdev = dev_get_by_index(&init_net, match.key->ingress_ifindex);
1372+
same_dev = ct_priv->netdev == netdev;
1373+
dev_put(netdev);
1374+
1375+
return same_dev;
1376+
}
1377+
13521378
static int
13531379
mlx5_tc_ct_block_flow_offload(enum tc_setup_type type, void *type_data,
13541380
void *cb_priv)
@@ -1361,6 +1387,9 @@ mlx5_tc_ct_block_flow_offload(enum tc_setup_type type, void *type_data,
13611387

13621388
switch (f->command) {
13631389
case FLOW_CLS_REPLACE:
1390+
if (!mlx5_tc_ct_filter_legacy_non_nic_flows(ft, f))
1391+
return -EOPNOTSUPP;
1392+
13641393
return mlx5_tc_ct_block_flow_offload_add(ft, f);
13651394
case FLOW_CLS_DESTROY:
13661395
return mlx5_tc_ct_block_flow_offload_del(ft, f);

0 commit comments

Comments
 (0)