All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Anatoly Burakov <anatoly.burakov@intel.com>
Cc: dev@dpdk.org
Subject: Re: [PATCH v1 1/1] ethdev: add flow item structure size query
Date: Fri, 23 Oct 2026 09:04:17 -0700	[thread overview]
Message-ID: <20261023090417.219e1e91@phoenix.local> (raw)
In-Reply-To: <8fa05595f3596e9355dd90df7fc278b104beb20b.1792757739.git.anatoly.burakov@intel.com>

On Fri, 23 Oct 2026 13:15:46 +0100
Anatoly Burakov <anatoly.burakov@intel.com> wrote:

> Add RTE_FLOW_CONV_OP_ITEM_SIZE to retrieve the fixed specification
> structure size for a flow item type using the existing descriptor table.
> 
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---

I am not sure about the details AI is complaining about here,
but it does look like it has a point. Also it should be possible
to get some code coverage for this in a standalone test.

[PATCH v1 1/1] ethdev: add flow item structure size query

Warning

RTE_FLOW_ITEM_TYPE_MACSEC has no entry in rte_flow_desc_item[]. The
table uses designated initializers, so the MACSEC slot is zero filled.
With this patch a size query for MACSEC fails with EINVAL "unknown
item type", although it is a public item with a spec structure
(struct rte_flow_item_macsec). The doc comment says only unknown and
PMD-private types fail.

The hole predates this patch and hurts existing ops too:
 - RTE_FLOW_CONV_OP_ITEM_NAME on MACSEC calls strlcpy(dst, NULL, size);
   rte_flow_conv_name() has no NULL name check.
 - rte_flow_conv_copy() sees desc[type].size == 0, so rte_flow_copy()
   and RTE_FLOW_CONV_OP_PATTERN silently drop MACSEC spec/last/mask.

Please send a separate fix ahead of this patch, in rte_flow_desc_item[]:

	MK_FLOW_ITEM(MACSEC, sizeof(struct rte_flow_item_macsec)),

	Fixes: 0aaf097585a6 ("ethdev: add MACsec flow item")
	Cc: stable@dpdk.org

Missing release note. RTE_FLOW_CONV_OP_ITEM_DEFAULT_MASK_PTR, also new
in 26.11, has one. Extend that entry in release_26_11.rst:

	* **Added flow item default mask and size lookup.**

	  Added ``RTE_FLOW_CONV_OP_ITEM_DEFAULT_MASK_PTR`` and
	  ``RTE_FLOW_CONV_OP_ITEM_SIZE`` conversion operations
	  to ``rte_flow_conv()`` to retrieve the default mask
	  and the spec structure size of a flow item type.

No user and no test. The commit message does not say what needs this.
If the consumer is flow_graph or a driver parser, send it as part of
that series. app/test has no rte_flow_conv() coverage at all; a short
test checking END -> 0, ETH -> sizeof(struct rte_flow_item_eth),
MACSEC -> sizeof(struct rte_flow_item_macsec), a negative type ->
EINVAL, and size < sizeof(size_t) -> dst untouched would have caught
the MACSEC hole.

Info

The doc text "Writes the size of rte_flow_item_{name}" is wrong for
GRE_KEY (rte_be32_t), GTPC/GTPU (struct rte_flow_item_gtp) and
ICMP6_ECHO_REQUEST/REPLY (struct rte_flow_item_icmp6_echo). Suggest:

	 * Writes the size of the item specification structure to
	 * @p dst, or zero for known item types without one.

Every other op dispatches to a static helper. Move the braced case
block next to rte_flow_conv_item_default_mask():

	/** Retrieve the spec structure size of a flow item type. */
	static int
	rte_flow_conv_item_size(void *dst, const size_t size,
				const void *src,
				struct rte_flow_error *error)
	{
		unsigned int type = (uintptr_t)src;

		if (type >= RTE_DIM(rte_flow_desc_item) ||
		    rte_flow_desc_item[type].name == NULL)
			return rte_flow_error_set(error, EINVAL,
				RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
				"unknown item type to retrieve the size of");
		if (size >= sizeof(size_t))
			*(size_t *)dst = rte_flow_desc_item[type].size;
		return sizeof(size_t);
	}

	case RTE_FLOW_CONV_OP_ITEM_SIZE:
		ret = rte_flow_conv_item_size(dst, size, src, error);
		break;

The name == NULL check here is good; the same check belongs in
rte_flow_conv_name() and rte_flow_conv_item_default_mask().

  reply	other threads:[~2026-10-23 16:04 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-23 12:15 [PATCH v1 1/1] ethdev: add flow item structure size query Anatoly Burakov
2026-10-23 16:04 ` Stephen Hemminger [this message]
2026-10-24 12:04 ` [PATCH v2 1/4] ethdev: fix missing MACsec flow item descriptor Anatoly Burakov
2026-10-24 12:04   ` [PATCH v2 2/4] ethdev: fix missing flow action descriptors Anatoly Burakov
2026-10-24 12:04   ` [PATCH v2 3/4] test/ethdev: add flow conversion tests Anatoly Burakov
2026-10-24 12:04   ` [PATCH v2 4/4] ethdev: add flow item structure size query Anatoly Burakov
2026-10-24 13:50 ` [PATCH v3 1/5] ethdev: fix flow conversion with null buffer Anatoly Burakov
2026-10-24 13:50   ` [PATCH v3 2/5] ethdev: fix missing MACsec flow item descriptor Anatoly Burakov
2026-10-24 13:50   ` [PATCH v3 3/5] ethdev: fix missing flow action descriptors Anatoly Burakov
2026-10-24 13:50   ` [PATCH v3 4/5] test/ethdev: add flow conversion tests Anatoly Burakov
2026-10-24 13:50   ` [PATCH v3 5/5] ethdev: add flow item structure size query Anatoly Burakov
2026-10-26 16:51   ` [PATCH v3 1/5] ethdev: fix flow conversion with null buffer Stephen Hemminger
2026-10-27 10:56     ` Burakov, Anatoly
2026-10-27  9:50 ` [PATCH v4 1/6] " Anatoly Burakov
2026-10-27  9:50   ` [PATCH v4 2/6] ethdev: fix missing MACsec flow item descriptor Anatoly Burakov
2026-10-27  9:50   ` [PATCH v4 3/6] ethdev: fix missing flow action descriptors Anatoly Burakov
2026-10-27 13:59     ` Stephen Hemminger
2026-10-27  9:50   ` [PATCH v4 4/6] ethdev: fix indirect action conversion with short buffer Anatoly Burakov
2026-10-27  9:50   ` [PATCH v4 5/6] test/ethdev: add flow conversion tests Anatoly Burakov
2026-10-27  9:50   ` [PATCH v4 6/6] ethdev: add flow item structure size query Anatoly Burakov

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=20261023090417.219e1e91@phoenix.local \
    --to=stephen@networkplumber.org \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.