ethdev: add modify IPv4 next protocol field
PATCH v3 1/6 ethdev: add modify IPv4 next protocol field
Add IPv4 next protocol modify field definition.
--- doc/guides/rel_notes/release_24_03.rst | 4 ++++ lib/ethdev/rte_flow.h | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-)
doc/guides/rel_notes/release_24_03.rst +4 -0
@@ -65,6 +65,10 @@ New Features * Added ``RTE_FLOW_ITEM_TYPE_RANDOM`` to match random value. * Added ``RTE_FLOW_FIELD_RANDOM`` to represent it in field ID struct. +* **Added new field IDs in the experimental ``enum rte_flow_field_id``: + + * Added ``RTE_FLOW_FIELD_IPV4_PROTO`` to represent it in field ID struct. + * ** Support for getting the number of used descriptors of a Tx queue. ** * Added a fath path function ``rte_eth_tx_queue_count`` to get the number of used
lib/ethdev/rte_flow.h +2 -1
@@ -2421,7 +2421,8 @@ enum rte_flow_field_id {RTE_FLOW_FIELD_IPV4_IHL ,/**< IPv4 IHL. */ RTE_FLOW_FIELD_IPV4_TOTAL_LEN ,/**< IPv4 total length. */ RTE_FLOW_FIELD_IPV6_PAYLOAD_LEN ,/**< IPv6 payload length. */ - RTE_FLOW_FIELD_RANDOM /**< Random value. */ +RTE_FLOW_FIELD_RANDOM ,/**< Random value. */ + RTE_FLOW_FIELD_IPV4_PROTO /**< IPv4 next protocol. */ };/**
Signature · 1 line
2.18.1
PATCH v3 2/6 app/testpmd: add modify IPv4 next protocol command line
Add new modify field action type string: "ipv4_proto".
--- app/test-pmd/cmdline_flow.c | 1 + 1 file changed, 1 insertion(+)
app/test-pmd/cmdline_flow.c +1 -0
@@ -990,6 +990,7 @@ static const char *const flow_field_ids[] = {"geneve_opt_type" ,"geneve_opt_class" ,"geneve_opt_data" ,"mpls" ,"tcp_data_off" ,"ipv4_ihl" ,"ipv4_total_len" ,"ipv6_payload_len" ,"random" , +"ipv4_proto" ,NULL };
Signature · 1 line
2.18.1
Re: [PATCH v3 2/6] app/testpmd: add modify IPv4 next protocol command line
Quoted 6 lines · Viacheslav Ovsiienko
Add new modify field action type string: "
ipv4_proto".Signed-off-by Viacheslav Ovsiienko <[email protected]>Acked-by Ori Kam <[email protected]>
PATCH v3 3/6 net/mlx5: add modify IPv4 protocol implementation
In reply to Viacheslav OvsiienkoAdd modify IPv4 protocol implementation for mlx5 PMD.
--- doc/guides/rel_notes/release_24_03.rst | 1 + drivers/common/mlx5/mlx5_prm.h | 1 + drivers/net/mlx5/mlx5_flow_dv.c | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-)
doc/guides/rel_notes/release_24_03.rst +1 -0
@@ -108,6 +108,7 @@ New Features * Added HW steering support for modify field ``RTE_FLOW_FIELD_GENEVE_OPT_TYPE`` flow action. * Added HW steering support for modify field ``RTE_FLOW_FIELD_GENEVE_OPT_CLASS`` flow action. * Added HW steering support for modify field ``RTE_FLOW_FIELD_GENEVE_OPT_DATA`` flow action. + * Added HW steering support for modify field ``RTE_FLOW_FIELD_IPV4_PROTO`` flow action. Removed Items
drivers/common/mlx5/mlx5_prm.h +1 -0
@@ -839,6 +839,7 @@ enum mlx5_modification_field {MLX5_MODI_IN_MPLS_LABEL_2 ,MLX5_MODI_IN_MPLS_LABEL_3 ,MLX5_MODI_IN_MPLS_LABEL_4 , +MLX5_MODI_OUT_IP_PROTOCOL =0x4A ,MLX5_MODI_OUT_IPV6_NEXT_HDR =0x4A ,MLX5_MODI_META_REG_C_8 =0x8F , MLX5_MODI_META_REG_C_9 = 0x90,
drivers/net/mlx5/mlx5_flow_dv.c +3 -1
@@ -1384,6 +1384,7 @@ mlx5_flow_item_field_width(struct rte_eth_dev *dev,case RTE_FLOW_FIELD_IPV4_DSCP :return 6 ;case RTE_FLOW_FIELD_IPV4_TTL : +case RTE_FLOW_FIELD_IPV4_PROTO :return 8 ;case RTE_FLOW_FIELD_IPV4_SRC :case RTE_FLOW_FIELD_IPV4_DST :
@@ -2194,10 +2195,11 @@ mlx5_flow_field_id_to_modify_info info[idx].offset = data->offset; }break ; +case RTE_FLOW_FIELD_IPV4_PROTO :/* Fall-through. */ case RTE_FLOW_FIELD_IPV6_PROTO :MLX5_ASSERT (data->offset + width <=8 ); off_be =8 - (data->offset + width); - info[idx] = (struct field_modify_info ){1 ,0 ,MLX5_MODI_OUT_IPV6_NEXT_HDR }; + info[idx] = (struct field_modify_info ){1 ,0 ,MLX5_MODI_OUT_IP_PROTOCOL };if (mask) mask[idx] =flow_modify_info_mask_8 (width, off_be);else
Signature · 1 line
2.18.1
PATCH v3 4/6 ethdev: add modify action support for IPsec fields
In reply to Viacheslav OvsiienkoThe following IPsec related field definitions added:
- RTE_FLOW_FIELD_ESP_SPI - SPI value in IPsec header
- RTE_FLOW_FIELD_ESP_SEQ_NUM - sequence number in header
- RTE_FLOW_FIELD_ESP_PROTO - next protocol value in trailer
--- doc/guides/rel_notes/release_24_03.rst | 3 +++ lib/ethdev/rte_flow.h | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-)
doc/guides/rel_notes/release_24_03.rst +3 -0
@@ -68,6 +68,9 @@ New Features * **Added new field IDs in the experimental ``enum rte_flow_field_id``: * Added ``RTE_FLOW_FIELD_IPV4_PROTO`` to represent it in field ID struct. + * Added ``RTE_FLOW_FIELD_ESP_SPI`` to represent it in field ID struct. + * Added ``RTE_FLOW_FIELD_ESP_SEQ_NUM`` to represent it in field ID struct. + * Added ``RTE_FLOW_FIELD_ESP_PROTO`` to represent it in field ID struct. * ** Support for getting the number of used descriptors of a Tx queue. **
lib/ethdev/rte_flow.h +4 -1
@@ -2422,7 +2422,10 @@ enum rte_flow_field_id {RTE_FLOW_FIELD_IPV4_TOTAL_LEN ,/**< IPv4 total length. */ RTE_FLOW_FIELD_IPV6_PAYLOAD_LEN ,/**< IPv6 payload length. */ RTE_FLOW_FIELD_RANDOM ,/**< Random value. */ - RTE_FLOW_FIELD_IPV4_PROTO /**< IPv4 next protocol. */ +RTE_FLOW_FIELD_IPV4_PROTO ,/**< IPv4 next protocol. */ +RTE_FLOW_FIELD_ESP_SPI ,/**< ESP SPI. */ +RTE_FLOW_FIELD_ESP_SEQ_NUM ,/**< ESP Sequence Number. */ + RTE_FLOW_FIELD_ESP_PROTO /**< ESP next protocol value. */ };/**
Signature · 1 line
2.18.1
RE: [PATCH v3 4/6] ethdev: add modify action support for IPsec fields
Hi Slava
Quoted 49 lines
-----Original Message-----
From: Slava Ovsiienko <[email protected]>
Sent: Wednesday, February 7, 2024 2:29 PMThe following IPsec related field definitions added:
-
RTE_FLOW_FIELD_ESP_SPI- SPI value in IPsec header
-RTE_FLOW_FIELD_ESP_SEQ_NUM- sequence number in header
-RTE_FLOW_FIELD_ESP_PROTO- next protocol value in trailerSigned-off-by Viacheslav Ovsiienko <[email protected]>--- doc/guides/rel_notes/release_24_03.rst | 3 +++ lib/ethdev/rte_flow.h | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-)doc/guides/rel_notes/release_24_03.rst +2
-0@@ -68,6 +68,9 @@ New Features * **Added new field IDs in the experimental ``enum rte_flow_field_id``: * Added ``RTE_FLOW_FIELD_IPV4_PROTO`` to represent it in field ID struct. + * Added ``RTE_FLOW_FIELD_ESP_SPI`` to represent it in field ID struct. + * Added ``RTE_FLOW_FIELD_ESP_SEQ_NUM`` to represent it in field IDstruct.
doc/guides/rel_notes/release_24_03.rst +1
-0+ * Added ``RTE_FLOW_FIELD_ESP_PROTO`` to represent it in field ID struct. * ** Support for getting the number of used descriptors of a Tx queue. **lib/ethdev/rte_flow.h +4
-1@@ -2422,7 +2422,10 @@ enum rte_flow_field_id {RTE_FLOW_FIELD_IPV4_TOTAL_LEN ,/**< IPv4 total length. */ RTE_FLOW_FIELD_IPV6_PAYLOAD_LEN ,/**< IPv6 payload length. */ RTE_FLOW_FIELD_RANDOM ,/**< Random value. */ -RTE_FLOW_FIELD_IPV4_PROTO /**< IPv4 next protocol. */ +RTE_FLOW_FIELD_IPV4_PROTO ,/**< IPv4 next protocol. */ +RTE_FLOW_FIELD_ESP_SPI ,/**< ESP SPI. */ +RTE_FLOW_FIELD_ESP_SEQ_NUM ,/**< ESP Sequence Number. */ + RTE_FLOW_FIELD_ESP_PROTO /**< ESP next protocol value. */ };
Quoted 3 lines
/**
--
2.18.1
Best,
Ori
Re: [PATCH v3 4/6] ethdev: add modify action support for IPsec fields
In reply to Viacheslav OvsiienkoQuoted 9 lines · Viacheslav Ovsiienko
The following IPsec related field definitions added:
-
RTE_FLOW_FIELD_ESP_SPI- SPI value in IPsec header
-RTE_FLOW_FIELD_ESP_SEQ_NUM- sequence number in header
-RTE_FLOW_FIELD_ESP_PROTO- next protocol value in trailerSigned-off-by Viacheslav Ovsiienko <[email protected]>
PATCH v3 5/6 app/testpmd: add modify ESP related fields command line
In reply to Viacheslav OvsiienkoAdd new modify field destination type strings:
- "esp_spi", to modify Security Parameter Index field
- "esp_seq_num", to modify Sequence Number field
- "esp_proto", to modify next protocol field in ESP trailer
--- app/test-pmd/cmdline_flow.c | 1 + 1 file changed, 1 insertion(+)
app/test-pmd/cmdline_flow.c +1 -0
@@ -991,6 +991,7 @@ static const char *const flow_field_ids[] = {"tcp_data_off" ,"ipv4_ihl" ,"ipv4_total_len" ,"ipv6_payload_len" ,"random" ,"ipv4_proto" , +"esp_spi" ,"esp_seq_num" ,"esp_proto" ,NULL };
Signature · 1 line
2.18.1
Re: [PATCH v3 5/6] app/testpmd: add modify ESP related fields command line
Quoted 9 lines · Viacheslav Ovsiienko
Add new modify field destination type strings:
- "
esp_spi", to modify Security Parameter Index field
- "esp_seq_num", to modify Sequence Number field
- "esp_proto", to modify next protocol field in ESP trailerSigned-off-by Viacheslav Ovsiienko <[email protected]>
PATCH v3 6/6 net/mlx5: add modify field action IPsec support
In reply to Viacheslav OvsiienkoAdd mlx5 PMD support for the IPsec fields:
- RTE_FLOW_FIELD_ESP_SPI - SPI value in IPsec header
- RTE_FLOW_FIELD_ESP_SEQ_NUM - sequence number in header
- RTE_FLOW_FIELD_ESP_PROTO - next protocol value in trailer
--- doc/guides/rel_notes/release_24_03.rst | 3 +++ drivers/common/mlx5/mlx5_prm.h | 3 +++ drivers/net/mlx5/mlx5_flow_dv.c | 31 ++++++++++++++++++++++++++ 3 files changed, 37 insertions(+)
doc/guides/rel_notes/release_24_03.rst +3 -0
@@ -112,6 +112,9 @@ New Features * Added HW steering support for modify field ``RTE_FLOW_FIELD_GENEVE_OPT_CLASS`` flow action. * Added HW steering support for modify field ``RTE_FLOW_FIELD_GENEVE_OPT_DATA`` flow action. * Added HW steering support for modify field ``RTE_FLOW_FIELD_IPV4_PROTO`` flow action. + * Added HW steering support for modify field ``RTE_FLOW_FIELD_ESP_SPI`` flow action. + * Added HW steering support for modify field ``RTE_FLOW_FIELD_ESP_SEQ_NUM`` flow action. + * Added HW steering support for modify field ``RTE_FLOW_FIELD_ESP_PROTO`` flow action. Removed Items
drivers/common/mlx5/mlx5_prm.h +3 -0
@@ -854,6 +854,9 @@ enum mlx5_modification_field {MLX5_MODI_OUT_IPV6_PAYLOAD_LEN =0x11E ,MLX5_MODI_OUT_IPV4_IHL =0x11F ,MLX5_MODI_OUT_TCP_DATA_OFFSET =0x120 , +MLX5_MODI_OUT_ESP_SPI =0x5E , +MLX5_MODI_OUT_ESP_SEQ_NUM =0x82 , +MLX5_MODI_OUT_IPSEC_NEXT_HDR =0x126 , MLX5_MODI_INVALID = INT_MAX, };
drivers/net/mlx5/mlx5_flow_dv.c +31 -0
@@ -1414,7 +1414,11 @@ mlx5_flow_item_field_width(struct rte_eth_dev *dev,case RTE_FLOW_FIELD_GTP_TEID :case RTE_FLOW_FIELD_MPLS :case RTE_FLOW_FIELD_TAG : +case RTE_FLOW_FIELD_ESP_SPI : +case RTE_FLOW_FIELD_ESP_SEQ_NUM :return 32 ; +case RTE_FLOW_FIELD_ESP_PROTO : +return 8 ;case RTE_FLOW_FIELD_MARK :return rte_popcount32 (priv->sh->dv_mark_mask);case RTE_FLOW_FIELD_META :
@@ -2205,6 +2209,33 @@ mlx5_flow_field_id_to_modify_infoelse info[idx].offset = off_be;break ; +case RTE_FLOW_FIELD_ESP_PROTO : +MLX5_ASSERT (data->offset + width <=8 ); + off_be =8 - (data->offset + width); + info[idx] = (struct field_modify_info ){1 ,0 ,MLX5_MODI_OUT_IPSEC_NEXT_HDR }; +if (mask) + mask[idx] =flow_modify_info_mask_8 (width, off_be); +else + info[idx].offset = off_be; +break ; +case RTE_FLOW_FIELD_ESP_SPI : +MLX5_ASSERT (data->offset + width <=32 ); + off_be =32 - (data->offset + width); + info[idx] = (struct field_modify_info ){4 ,0 ,MLX5_MODI_OUT_ESP_SPI }; +if (mask) + mask[idx] =flow_modify_info_mask_32 (width, off_be); +else + info[idx].offset = off_be; +break ; +case RTE_FLOW_FIELD_ESP_SEQ_NUM : +MLX5_ASSERT (data->offset + width <=32 ); + off_be =32 - (data->offset + width); + info[idx] = (struct field_modify_info ){4 ,0 ,MLX5_MODI_OUT_ESP_SEQ_NUM }; +if (mask) + mask[idx] =flow_modify_info_mask_32 (width, off_be); +else + info[idx].offset = off_be; +break ;case RTE_FLOW_FIELD_FLEX_ITEM :MLX5_ASSERT (data->flex_handle !=NULL && !(data->offset &0x7 )); mlx5_modify_flex_item(dev, (const struct mlx5_flex_item *)data->flex_handle,
Signature · 1 line
2.18.1
Quoted 6 lines · Viacheslav Ovsiienko
Add IPv4 next protocol modify field definition.
Signed-off-by Viacheslav Ovsiienko <[email protected]>Acked-by Ori Kam <[email protected]>
Hi,
From: Slava Ovsiienko <[email protected]>
Sent: Wednesday, February 7, 2024 2:29 PM
To: [email protected] <[email protected]>
Cc: Matan Azrad <[email protected]>; Raslan Darawsheh <[email protected]>; Ori Kam <[email protected]>; Dariusz Sosnowski <[email protected]>
Subject: [PATCH v3 1/6] ethdev: add modify IPv4 next protocol field
Add IPv4 next protocol modify field definition.
Series applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh