Skip to content

Commit b11bde5

Browse files
Jianbo Liukuba-moo
authored andcommitted
net/mlx5e: TC, Offload rewrite and mirror to both internal and external dests
Firmware has the limitation that it cannot offload a rule with rewrite and mirror to internal and external destinations simultaneously. This patch adds a workaround to this issue. Here the destination array is split again, just like what's done in previous commit, but after the action indexed by split_count - 1. An extra rule is added for the leftover destinations. Such rule can be offloaded, even there are destinations to both internal and external destinations, because the header rewrite is left in the original FTE. Signed-off-by: Jianbo Liu <jianbol@nvidia.com> Reviewed-by: Cosmin Ratiu <cratiu@nvidia.com> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Link: https://patch.msgid.link/20240808055927.2059700-5-tariqt@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 16bb8c6 commit b11bde5

File tree

1 file changed

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

1 file changed

+17
-0
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1742,12 +1742,17 @@ has_encap_dests(struct mlx5_flow_attr *attr)
17421742
static int
17431743
extra_split_attr_dests_needed(struct mlx5e_tc_flow *flow, struct mlx5_flow_attr *attr)
17441744
{
1745+
bool int_dest = false, ext_dest = false;
17451746
struct mlx5_esw_flow_attr *esw_attr;
1747+
int i;
17461748

17471749
if (flow->attr != attr ||
17481750
!list_is_first(&attr->list, &flow->attrs))
17491751
return 0;
17501752

1753+
if (flow_flag_test(flow, SLOW))
1754+
return 0;
1755+
17511756
esw_attr = attr->esw_attr;
17521757
if (!esw_attr->split_count ||
17531758
esw_attr->split_count == esw_attr->out_count - 1)
@@ -1758,6 +1763,18 @@ extra_split_attr_dests_needed(struct mlx5e_tc_flow *flow, struct mlx5_flow_attr
17581763
MLX5_ESW_DEST_CHAIN_WITH_SRC_PORT_CHANGE))
17591764
return esw_attr->split_count + 1;
17601765

1766+
for (i = esw_attr->split_count; i < esw_attr->out_count; i++) {
1767+
/* external dest with encap is considered as internal by firmware */
1768+
if (esw_attr->dests[i].vport == MLX5_VPORT_UPLINK &&
1769+
!(esw_attr->dests[i].flags & MLX5_ESW_DEST_ENCAP_VALID))
1770+
ext_dest = true;
1771+
else
1772+
int_dest = true;
1773+
1774+
if (ext_dest && int_dest)
1775+
return esw_attr->split_count;
1776+
}
1777+
17611778
return 0;
17621779
}
17631780

0 commit comments

Comments
 (0)