Linux Documentation
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: acassen@corp.free.fr
Cc: saeedm@nvidia.com, leon@kernel.org, tariqt@nvidia.com,
	mbloch@nvidia.com, jhs@mojatatu.com, jiri@resnulli.us,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
	kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
	michael.chan@broadcom.com, pavan.chebbi@broadcom.com,
	bharat@chelsio.com, donald.hunter@gmail.com, corbet@lwn.net,
	skhan@linuxfoundation.org, rdunlap@infradead.org,
	dsahern@kernel.org, idosch@nvidia.com, shuah@kernel.org,
	netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
	linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org,
	oss-drivers@corigine.com
Subject: Re: [PATCH net-next 10/10] docs: networking: describe tunnel key partitioning in TC queue filtering
Date: Wed, 11 Nov 2026 19:12:16 +0000	[thread overview]
Message-ID: <179442433615.2199510.11200298531505956799@kernel.org> (raw)
In-Reply-To: <20261109131039.959438-11-acassen@corp.free.fr>

Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The new mlx5 paragraph in Documentation/networking/tc-queue-
  filters.rst (lines 54-56) says: "The filter therefore needs skip_sw.
- [Low] The commit message says the patch documents 'what enc_key_id
  means on a physical port of mlx5'.

--

docs: networking: describe tunnel key partitioning in TC queue filtering

This commit documents tunnel key partitioning in tc-queue-filters.rst, where
a mask on enc_key_id steers blocks of tunnel flows to RX queues. It adds a
GTP-U example and describes what enc_key_id means on an mlx5 physical port.
It also covers what happens to the filter when its target queue goes away.

> diff --git a/Documentation/networking/tc-queue-filters.rst b/Documentation/networking/tc-queue-filters.rst
> index 6b417092276f6..de54d43687c60 100644
> --- a/Documentation/networking/tc-queue-filters.rst
> +++ b/Documentation/networking/tc-queue-filters.rst
> @@ -35,3 +35,25 @@ queues and/or a single queue are supported as below:

[ ... ]

> +  # GTP-U TEIDs whose two top bits are 01 go to queue 1
> +  tc filter add dev eth0 ingress protocol ip flower skip_sw \
> +      ip_proto udp dst_port 2152 enc_key_id 0x40000000/0xc0000000 \
> +      action skbedit queue_mapping 1 skip_sw
> +
> +Not all drivers can program a partial mask.
> +
> +On mlx5 devices such a filter runs on a physical port where nothing
> +decapsulates the packet. All the keys describe the packet on the wire.
> +ip_proto and dst_port tell the hardware which tunnel header holds the key.

[Severity: Low]

The commit message says this documents "what enc_key_id means on a physical
port of mlx5". Should this paragraph also list the limits the driver
enforces? As written, the driver can refuse the GTP-U example above, and
small variations of it, for reasons the document does not mention.

First, the GTP-U example needs firmware flex parser support:

drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_gtp.c:mlx5e_tc_tun_parse_outer_key_gtp() {
    ...
	if (!(MLX5_CAP_GEN(priv->mdev, flex_parser_protocols) &
	      MLX5_FLEX_PARSER_GTPU_TEID_ENABLED)) {
		NL_SET_ERR_MSG_MOD(extack,
				   "Matching on GTP-U TEID is not supported");
		return -EOPNOTSUPP;
    ...
}

The commit "net/mlx5e: TC, match the tunnel key without a tunnel device"
says GTP-U needs flex parser profile 3, while GENEVE needs profile 0. Since
skip_sw is mandatory there is no software fallback. The documented command
therefore fails on a device that runs another profile.

Second, queue mapping is only offloaded in NIC mode. In en/tc/act/act.c,
FLOW_ACTION_RX_QUEUE_MAPPING is registered only in tc_acts_nic, and
mlx5e_tc_act_get() uses tc_acts_fdb for FDB flows. The action is refused on
the uplink representor in switchdev mode, which is also a physical port.

Third, ip_proto and dst_port only select a match register.
mlx5e_tc_tun_outer_lookup() accepts only ip_proto GRE or an exact UDP
dst_port of 2152, 4789 or 6081:

drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c:mlx5e_tc_tun_outer_lookup() {
    ...
	/* Only an exact port names a tunnel */
	if (ports.mask->dst != htons(U16_MAX))
		return NULL;

	switch (ntohs(ports.key->dst)) {
    ...
}

VXLAN on port 8472, or a masked port, is refused with "enc_key_id needs
ip_proto 0x2f or the exact dst_port of a supported tunnel".

Fourth, VXLAN and GENEVE keys are 24 bit VNIs.
mlx5e_tc_tun_parse_outer_key_vxlan() and
mlx5e_tc_tun_parse_outer_key_geneve() refuse a masked key that does not fit
in 24 bits ("Tunnel key does not fit the 24 bit VNI"). The top bits mask
from the example (0x40000000/0xc0000000) cannot be reused for those tunnels.

Fifth, mlx5e_tc_tun_parse_outer_key() also refuses decap actions.

The only caveat the document gives is "Not all drivers can program a
partial mask", which covers none of these limits.

> +The software datapath has no tunnel metadata on such a port. The filter
> +therefore needs skip_sw. Without it the filter stays in software, where
> +the port reads key zero.

[Severity: Low]

Is "Without it the filter stays in software" accurate for the queue_mapping
filters this document describes? Leaving out skip_sw does not seem to
install a software only filter.

If skip_sw is removed only from the filter, tcf_action_init() rejects the
skip_sw action:

net/sched/act_api.c:tcf_action_init() {
    ...
				if ((tc_act_skip_sw(act->tcfa_flags) && !skip_sw) ||
				    (tc_act_skip_hw(act->tcfa_flags) && !skip_hw)) {
					NL_SET_ERR_MSG(extack,
						       "Mismatch between action and filter offload flags");
					err = -EINVAL;
					goto err;
				}
    ...
}

If skip_sw is removed from the action, tcf_skbedit_init() refuses ingress
queue_mapping:

net/sched/act_skbedit.c:tcf_skbedit_init() {
    ...
		if (is_tcf_skbedit_ingress(act_flags) &&
		    !(act_flags & TCA_ACT_FLAGS_SKIP_SW)) {
			NL_SET_ERR_MSG_MOD(extack, "\"queue_mapping\" option on receive side is hardware only, use skip_sw");
			return -EOPNOTSUPP;
		}
    ...
}

The filter level skip_sw is not merged into the flags that the action init
sees, so this happens whatever the filter flags are. Both failures happen
before mlx5e_tc_tun_parse_outer_key() runs.

The "stays in software, reads key zero" behavior only seems to apply to
actions that can run in software, such as drop, mirred or mark. The text
looks like it was carried over from the commit message of "net/mlx5e: TC,
match the tunnel key without a tunnel device", which describes generic
actions.

Could this sentence say that the queue_mapping request is refused instead?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261109131039.959438-1-acassen%40corp.free.fr

      reply	other threads:[~2026-11-11 19:12 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09 13:10 [PATCH net-next 00/10] tc flower: tunnel key partitioning for RX queue steering Alexandre Cassen
2026-11-09 13:10 ` [PATCH net-next 01/10] bnxt_en: require an exact tunnel id in TC flows Alexandre Cassen
2026-11-09 13:10 ` [PATCH net-next 02/10] cxgb4: flower: refuse a tunnel key wider than the VNI Alexandre Cassen
2026-11-11 19:11   ` netdev-bot+sashiko
2026-11-09 13:10 ` [PATCH net-next 03/10] nfp: " Alexandre Cassen
2026-11-11 19:12   ` netdev-bot+sashiko
2026-11-09 13:10 ` [PATCH net-next 04/10] net/mlx5e: TC, " Alexandre Cassen
2026-11-11 19:12   ` netdev-bot+sashiko
2026-11-09 13:10 ` [PATCH net-next 05/10] net/mlx5e: TC, reject a partial tunnel key with tunnel mapping Alexandre Cassen
2026-11-11 19:12   ` netdev-bot+sashiko
2026-11-09 13:10 ` [PATCH net-next 06/10] net/sched: cls_flower: add enc_key_id mask Alexandre Cassen
2026-11-11 19:12   ` netdev-bot+sashiko
2026-11-09 13:10 ` [PATCH net-next 07/10] selftests: forwarding: tc_flower: test the " Alexandre Cassen
2026-11-11 19:12   ` netdev-bot+sashiko
2026-11-09 13:10 ` [PATCH net-next 08/10] net/mlx5e: TC, offload RX queue mapping in NIC flows Alexandre Cassen
2026-11-11 19:12   ` netdev-bot+sashiko
2026-11-09 13:10 ` [PATCH net-next 09/10] net/mlx5e: TC, match the tunnel key without a tunnel device Alexandre Cassen
2026-11-11 19:12   ` netdev-bot+sashiko
2026-11-09 13:10 ` [PATCH net-next 10/10] docs: networking: describe tunnel key partitioning in TC queue filtering Alexandre Cassen
2026-11-11 19:12   ` netdev-bot+sashiko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179442433615.2199510.11200298531505956799@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=acassen@corp.free.fr \
    --cc=andrew+netdev@lunn.ch \
    --cc=bharat@chelsio.com \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=dsahern@kernel.org \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mbloch@nvidia.com \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=oss-drivers@corigine.com \
    --cc=pabeni@redhat.com \
    --cc=pavan.chebbi@broadcom.com \
    --cc=rdunlap@infradead.org \
    --cc=saeedm@nvidia.com \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=tariqt@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox