Re: [PATCH net-next V5 5/7] net/mlx5e: psp: Move RX marker from ft_metadata to flow_tag
From: Cosmin Ratiu
Date: Tue Dec 01 2026 - 10:20:54 EST
On Mon, 2026-11-30 at 12:07 +0000, netdev-bot+sashiko@xxxxxxxxxx wrote:
> 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 layout comment in the new
> drivers/net/ethernet/mellanox/mlx5/core/en_accel/flow_tag.h splits
> the…
>
> --
>
> net/mlx5e: psp: Move RX marker from ft_metadata to flow_tag
>
> This patch moves the PSP RX marker out of ft_metadata, where a
> modify_hdr
> action wrote it, and into the flow_tag set in the flow_context of the
> PSP
> decrypt rule. It adds a new en_accel/flow_tag.h header that defines a
> shared accel flow_tag bit layout and helpers. mlx5e_psp_is_rx_flow()
> now
> reads the protocol ID from the CQE flow_tag.
>
> > diff --git
> > a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/flow_tag.h
> > b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/flow_tag.h
> > new file mode 100644
> > index 0000000000000..b6fcd4b630311
> > --- /dev/null
> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/flow_tag.h
>
> [ ... ]
>
> > +/* Unified accel flow_tag layout in CQE sop_drop_qpn [23:0]:
> > + *
> > + * [23:21] = protocol ID (3 bits):
> > + * 0 = none (default)
> > + * 3 = PSP (HW decrypted, PSP header present)
> > + * 1,2,4-7 = reserved
> > + * [20:16] = reserved
> > + * [15:0] = used by other subsystems (e.g. TC).
> > + */
>
> [Severity: Low]
> This isn't a bug, but could this comment be read as saying the accel
> protocol ID and a TC mark can be carried together in one packet's
> flow_tag?
>
> As far as I can tell, there is only one flow_tag per packet. Each FTE
> sets
> the whole value, and the last rule that sets it overwrites the
> earlier
> one. The "net/mlx5e: Generalize TC <-> IPsec mutual exclusion" patch
> in
> this series says the same thing.
>
> The PSP decrypt rule in accel_psp_fs_rx_decrypt_ft_create() writes
> the
> full tag, so bits [15:0] are zero:
>
> spec->flow_context.flags = FLOW_CONTEXT_HAS_TAG;
> spec->flow_context.flow_tag =
> FIELD_PREP(MLX5E_ACCEL_FLOW_TAG_PROTO_MASK,
> MLX5E_ACCEL_FLOW_TAG_PROTO_PSP);
>
> mlx5e_add_offloaded_nic_rule() in en_tc.c also always writes the
> whole
> tag:
>
> flow_context->flags |= FLOW_CONTEXT_HAS_TAG;
> flow_context->flow_tag = nic_attr->flow_tag;
>
> Both mlx5e_psp_is_rx_flow() and mlx5e_build_rx_skb() read this same
> field:
>
> skb->mark = be32_to_cpu(cqe->sop_drop_qpn) &
> MLX5E_TC_FLOW_ID_MASK;
>
> Today this works only because TC offload and accel RX offload are
> mutually
> exclusive. That comes from the earlier patches in the series, such as
> "net/mlx5e: psp: Block TC offload when PSP is enabled". This header
> does
> not mention that.
>
> The same comment stays at the end of the series, which only adds
> IPsec=1
> and MACsec=2.
>
> Would it help to say in this comment that each packet's flow_tag has
> one
> effective writer? It could also say that the [15:0] split only keeps
> the
> TC and accel value ranges from overlapping, and that TC offload and
> accel
> RX offload are mutually exclusive.
>
> > +#define MLX5E_ACCEL_FLOW_TAG_MASK GENMASK(23, 0)
> > +#define
> > MLX5E_ACCEL_FLOW_TAG_PROTO_MASK GENMASK(23, 21)
>
> [ ... ]
>
The ranges are intentionally exclusive so that in the future, when
perhaps it will be possible to write only some bits of the flow_tag,
the restriction between TC and accel protocols might be lifted without
having to rewrite all of these markers.
I guess a comment along these lines could be added, but unless there
are other suggestions to the series I'd prefer to avoid another
submission just for this extra comment.
Cosmin.