The next patch makes the flowtable emit FLOW_ACTION_PRIORITY for flows with a non-zero skb->priority, which on IPv4 includes the priority ip_forward() derives from the TOS by default. mlx5 would reject these rules and stop offloading flows it offloads today.
The eswitch does not use skb->priority for these flows, so accept the action on flowtable flows and ignore it. tc flower rules with skbedit priority are still rejected. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Julius Bairaktaris <[email protected]> --- .../net/ethernet/mellanox/mlx5/core/Makefile | 2 +- .../mellanox/mlx5/core/en/tc/act/act.c | 1 + .../mellanox/mlx5/core/en/tc/act/act.h | 1 + .../mellanox/mlx5/core/en/tc/act/prio.c | 22 +++++++++++++++++++ 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/prio.c diff --git a/drivers/net/ethernet/mellanox/mlx5/core/Makefile b/drivers/net/ethernet/mellanox/mlx5/core/Makefile index 19e50f0d55af..8bd352e7f20d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/Makefile +++ b/drivers/net/ethernet/mellanox/mlx5/core/Makefile @@ -54,7 +54,7 @@ mlx5_core-$(CONFIG_MLX5_CLS_ACT) += en/tc/act/act.o en/tc/act/drop.o en/tc/a en/tc/act/accept.o en/tc/act/mark.o en/tc/act/goto.o \ en/tc/act/tun.o en/tc/act/csum.o en/tc/act/pedit.o \ en/tc/act/vlan.o en/tc/act/vlan_mangle.o en/tc/act/mpls.o \ - en/tc/act/mirred.o en/tc/act/mirred_nic.o \ + en/tc/act/mirred.o en/tc/act/mirred_nic.o en/tc/act/prio.o \ en/tc/act/ct.o en/tc/act/sample.o en/tc/act/ptype.o \ en/tc/act/redirect_ingress.o en/tc/act/police.o diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.c index 0380a04c3691..91a3bab5e498 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.c @@ -23,6 +23,7 @@ static struct mlx5e_tc_act *tc_acts_fdb[NUM_FLOW_ACTIONS] = { [FLOW_ACTION_ADD] = &mlx5e_tc_act_pedit, [FLOW_ACTION_CSUM] = &mlx5e_tc_act_csum, [FLOW_ACTION_PTYPE] = &mlx5e_tc_act_ptype, + [FLOW_ACTION_PRIORITY] = &mlx5e_tc_act_prio, [FLOW_ACTION_SAMPLE] = &mlx5e_tc_act_sample, [FLOW_ACTION_POLICE] = &mlx5e_tc_act_police, [FLOW_ACTION_CT] = &mlx5e_tc_act_ct, diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.h b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.h index 2e528b2c34d6..bacbc862970e 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.h @@ -81,6 +81,7 @@ extern struct mlx5e_tc_act mlx5e_tc_act_goto; extern struct mlx5e_tc_act mlx5e_tc_act_tun_encap; extern struct mlx5e_tc_act mlx5e_tc_act_tun_decap; extern struct mlx5e_tc_act mlx5e_tc_act_csum; +extern struct mlx5e_tc_act mlx5e_tc_act_prio; extern struct mlx5e_tc_act mlx5e_tc_act_pedit; extern struct mlx5e_tc_act mlx5e_tc_act_vlan; extern struct mlx5e_tc_act mlx5e_tc_act_vlan_mangle; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/prio.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/prio.c new file mode 100644 index 000000000000..2a047059574b --- /dev/null +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/prio.c @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB + +#include "act.h" +#include "en/tc_priv.h" + +static int +tc_act_parse_prio(struct mlx5e_tc_act_parse_state *parse_state, + const struct flow_action_entry *act, + struct mlx5e_priv *priv, + struct mlx5_flow_attr *attr) +{ + /* The eswitch does not apply skb->priority to flowtable flows. */ + if (mlx5e_is_ft_flow(parse_state->flow)) + return 0; + + NL_SET_ERR_MSG_MOD(parse_state->extack, "skbedit priority is not supported"); + return -EOPNOTSUPP; +} + +struct mlx5e_tc_act mlx5e_tc_act_prio = { + .parse_action = tc_act_parse_prio, +}; -- 2.53.0

