All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] ethdev: add flow item structure size query
@ 2026-10-23 12:15 Anatoly Burakov
  2026-10-23 16:04 ` Stephen Hemminger
                   ` (3 more replies)
  0 siblings, 4 replies; 20+ messages in thread
From: Anatoly Burakov @ 2026-10-23 12:15 UTC (permalink / raw)
  To: dev

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>
---
 lib/ethdev/rte_flow.c | 16 ++++++++++++++++
 lib/ethdev/rte_flow.h | 18 ++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
index 0ebf59165d4..1b2d263331a 100644
--- a/lib/ethdev/rte_flow.c
+++ b/lib/ethdev/rte_flow.c
@@ -1266,6 +1266,22 @@ rte_flow_conv(enum rte_flow_conv_op op,
 	case RTE_FLOW_CONV_OP_ITEM_DEFAULT_MASK_PTR:
 		ret = rte_flow_conv_item_default_mask(dst, size, src, error);
 		break;
+	case RTE_FLOW_CONV_OP_ITEM_SIZE:
+	{
+		uintptr_t type = (uintptr_t)src;
+
+		if (type >= RTE_DIM(rte_flow_desc_item) ||
+				rte_flow_desc_item[type].name == NULL) {
+			ret = rte_flow_error_set(error, EINVAL,
+					RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
+					"unknown item type to retrieve the size of");
+			break;
+		}
+		if (size >= sizeof(size_t))
+			*(size_t *)dst = rte_flow_desc_item[type].size;
+		ret = sizeof(size_t);
+		break;
+	}
 	default:
 		ret = rte_flow_error_set
 		(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
index df8101e4395..3d6a56f51e3 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -4426,6 +4426,24 @@ enum rte_flow_conv_op {
 	 *   @code const void ** @endcode
 	 */
 	RTE_FLOW_CONV_OP_ITEM_DEFAULT_MASK_PTR,
+
+	/**
+	 * Retrieve the fixed size of an item specification structure.
+	 *
+	 * Writes the size of rte_flow_item_{name} to @p dst, or zero for
+	 * known item types without a specification structure. Does not include
+	 * variable-length or externally referenced data (for example, RAW
+	 * pattern bytes). Unknown and PMD-private item types return an error.
+	 *
+	 * No output is written if @p size is smaller than sizeof(size_t).
+	 * The return value is sizeof(size_t), not the item structure size.
+	 *
+	 * - @p src type:
+	 *   @code (const void *)(uintptr_t)enum rte_flow_item_type @endcode
+	 * - @p dst type:
+	 *   @code size_t * @endcode
+	 */
+	RTE_FLOW_CONV_OP_ITEM_SIZE,
 };
 
 /**
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2026-10-27 14:00 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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.