[RFC,1/9] ethdev: add flex item modify field support
Checks
Commit Message
Add flex item as modify field destination.
Add "struct rte_flow_item_flex_handle *flex_handle" into
"struct rte_flow_action_modify_data" as union with existed
"level" member. This new member is dedicated for modifying
flex item.
Signed-off-by: Rongwei Liu <rongweil@nvidia.com>
---
doc/guides/prog_guide/rte_flow.rst | 36 ++++++++++++++------------
doc/guides/rel_notes/release_22_03.rst | 4 +++
lib/ethdev/rte_flow.h | 8 ++++--
3 files changed, 29 insertions(+), 19 deletions(-)
Comments
Hi Rongwei,
> -----Original Message-----
> From: Rongwei Liu <rongweil@nvidia.com>
> Sent: Wednesday, 21 December 2022 10:40
>
> Add flex item as modify field destination.
> Add "struct rte_flow_item_flex_handle *flex_handle" into
> "struct rte_flow_action_modify_data" as union with existed
> "level" member. This new member is dedicated for modifying
> flex item.
>
> Signed-off-by: Rongwei Liu <rongweil@nvidia.com>
> ---
> doc/guides/prog_guide/rte_flow.rst | 36 ++++++++++++++------------
> doc/guides/rel_notes/release_22_03.rst | 4 +++
> lib/ethdev/rte_flow.h | 8 ++++--
> 3 files changed, 29 insertions(+), 19 deletions(-)
>
> diff --git a/doc/guides/prog_guide/rte_flow.rst
> b/doc/guides/prog_guide/rte_flow.rst
> index 3e6242803d..ea20145224 100644
> --- a/doc/guides/prog_guide/rte_flow.rst
> +++ b/doc/guides/prog_guide/rte_flow.rst
> @@ -2952,23 +2952,25 @@ value as sequence of bytes {xxx, xxx, 0x85, xxx,
> xxx, xxx}.
>
> .. table:: destination/source field definition
>
> - +---------------+----------------------------------------------------------+
> - | Field | Value |
> -
> +===============+=========================================
> =================+
> - | ``field`` | ID: packet field, mark, meta, tag, immediate, pointer |
> - +---------------+----------------------------------------------------------+
> - | ``level`` | encapsulation level of a packet field or tag array index |
> - +---------------+----------------------------------------------------------+
> - | ``offset`` | number of bits to skip at the beginning |
> - +---------------+----------------------------------------------------------+
> - | ``value`` | immediate value buffer (source field only, not |
> - | | applicable to destination) for RTE_FLOW_FIELD_VALUE |
> - | | field type |
> - +---------------+----------------------------------------------------------+
> - | ``pvalue`` | pointer to immediate value data (source field only, not |
> - | | applicable to destination) for RTE_FLOW_FIELD_POINTER |
> - | | field type |
> - +---------------+----------------------------------------------------------+
> + +-----------------+----------------------------------------------------------+
> + | Field | Value |
> +
> +=================+=======================================
> ===================+
> + | ``field`` | ID: packet field, mark, meta, tag, immediate, pointer |
> + +-----------------+----------------------------------------------------------+
> + | ``level`` | encapsulation level of a packet field or tag array index |
> + +-----------------+----------------------------------------------------------+
> + | ``flex_handle`` | flex item handle of a packet field |
> + +-----------------+----------------------------------------------------------+
> + | ``offset`` | number of bits to skip at the beginning |
> + +-----------------+----------------------------------------------------------+
> + | ``value`` | immediate value buffer (source field only, not |
> + | | applicable to destination) for RTE_FLOW_FIELD_VALUE |
> + | | field type |
> + +-----------------+----------------------------------------------------------+
> + | ``pvalue`` | pointer to immediate value data (source field only, not |
> + | | applicable to destination) for RTE_FLOW_FIELD_POINTER |
> + | | field type |
> + +-----------------+----------------------------------------------------------+
>
> Action: ``CONNTRACK``
> ^^^^^^^^^^^^^^^^^^^^^
> diff --git a/doc/guides/rel_notes/release_22_03.rst
> b/doc/guides/rel_notes/release_22_03.rst
> index 0923707cb8..5fc5aff8a4 100644
> --- a/doc/guides/rel_notes/release_22_03.rst
> +++ b/doc/guides/rel_notes/release_22_03.rst
> @@ -207,6 +207,10 @@ API Changes
> * ethdev: Old public macros and enumeration constants without
> ``RTE_ETH_`` prefix,
> which are kept for backward compatibility, are marked as deprecated.
>
> +* ethdev: added a new field:
> +
> + - modify flex item: ``rte_flow_action_modify_data.flex_handle``
> +
> * cryptodev: The asymmetric session handling was modified to use a single
> mempool object. An API ``rte_cryptodev_asym_session_pool_create`` was
> added
> to create a mempool with element size big enough to hold the generic
> asymmetric
> diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
> index b60987db4b..d535722773 100644
> --- a/lib/ethdev/rte_flow.h
> +++ b/lib/ethdev/rte_flow.h
> @@ -3528,6 +3528,7 @@ enum rte_flow_field_id {
> RTE_FLOW_FIELD_IPV6_ECN, /**< IPv6 ECN. */
> RTE_FLOW_FIELD_GTP_PSC_QFI, /**< GTP QFI. */
> RTE_FLOW_FIELD_METER_COLOR, /**< Meter color marker. */
> + RTE_FLOW_FIELD_FLEX_ITEM, /**< Flex item. */
> };
>
> /**
> @@ -3541,8 +3542,11 @@ struct rte_flow_action_modify_data {
> RTE_STD_C11
> union {
> struct {
> - /** Encapsulation level or tag index. */
> - uint32_t level;
> + /**< Encapsulation level or tag index or flex item
> handle. */
> + union {
> + uint32_t level;
> + struct rte_flow_item_flex_handle
> *flex_handle;
> + };
> /** Number of bits to skip from a field. */
> uint32_t offset;
> };
> --
> 2.27.0
Acked-by: Ori Kam <orika@nvidia.com>
Thanks,
Ori
@@ -2952,23 +2952,25 @@ value as sequence of bytes {xxx, xxx, 0x85, xxx, xxx, xxx}.
.. table:: destination/source field definition
- +---------------+----------------------------------------------------------+
- | Field | Value |
- +===============+==========================================================+
- | ``field`` | ID: packet field, mark, meta, tag, immediate, pointer |
- +---------------+----------------------------------------------------------+
- | ``level`` | encapsulation level of a packet field or tag array index |
- +---------------+----------------------------------------------------------+
- | ``offset`` | number of bits to skip at the beginning |
- +---------------+----------------------------------------------------------+
- | ``value`` | immediate value buffer (source field only, not |
- | | applicable to destination) for RTE_FLOW_FIELD_VALUE |
- | | field type |
- +---------------+----------------------------------------------------------+
- | ``pvalue`` | pointer to immediate value data (source field only, not |
- | | applicable to destination) for RTE_FLOW_FIELD_POINTER |
- | | field type |
- +---------------+----------------------------------------------------------+
+ +-----------------+----------------------------------------------------------+
+ | Field | Value |
+ +=================+==========================================================+
+ | ``field`` | ID: packet field, mark, meta, tag, immediate, pointer |
+ +-----------------+----------------------------------------------------------+
+ | ``level`` | encapsulation level of a packet field or tag array index |
+ +-----------------+----------------------------------------------------------+
+ | ``flex_handle`` | flex item handle of a packet field |
+ +-----------------+----------------------------------------------------------+
+ | ``offset`` | number of bits to skip at the beginning |
+ +-----------------+----------------------------------------------------------+
+ | ``value`` | immediate value buffer (source field only, not |
+ | | applicable to destination) for RTE_FLOW_FIELD_VALUE |
+ | | field type |
+ +-----------------+----------------------------------------------------------+
+ | ``pvalue`` | pointer to immediate value data (source field only, not |
+ | | applicable to destination) for RTE_FLOW_FIELD_POINTER |
+ | | field type |
+ +-----------------+----------------------------------------------------------+
Action: ``CONNTRACK``
^^^^^^^^^^^^^^^^^^^^^
@@ -207,6 +207,10 @@ API Changes
* ethdev: Old public macros and enumeration constants without ``RTE_ETH_`` prefix,
which are kept for backward compatibility, are marked as deprecated.
+* ethdev: added a new field:
+
+ - modify flex item: ``rte_flow_action_modify_data.flex_handle``
+
* cryptodev: The asymmetric session handling was modified to use a single
mempool object. An API ``rte_cryptodev_asym_session_pool_create`` was added
to create a mempool with element size big enough to hold the generic asymmetric
@@ -3528,6 +3528,7 @@ enum rte_flow_field_id {
RTE_FLOW_FIELD_IPV6_ECN, /**< IPv6 ECN. */
RTE_FLOW_FIELD_GTP_PSC_QFI, /**< GTP QFI. */
RTE_FLOW_FIELD_METER_COLOR, /**< Meter color marker. */
+ RTE_FLOW_FIELD_FLEX_ITEM, /**< Flex item. */
};
/**
@@ -3541,8 +3542,11 @@ struct rte_flow_action_modify_data {
RTE_STD_C11
union {
struct {
- /** Encapsulation level or tag index. */
- uint32_t level;
+ /**< Encapsulation level or tag index or flex item handle. */
+ union {
+ uint32_t level;
+ struct rte_flow_item_flex_handle *flex_handle;
+ };
/** Number of bits to skip from a field. */
uint32_t offset;
};