[v1,2/4] ethdev: support GRE optional fields
Checks
Commit Message
Add flow pattern items and header format for matching optional fields
(checksum/key/sequence) in GRE header. And the flags in gre item should
be correspondingly set with the new added items.
Signed-off-by: Sean Zhang <xiazhang@nvidia.com>
---
doc/guides/prog_guide/rte_flow.rst | 17 +++++++++++++++++
lib/ethdev/rte_flow.c | 1 +
lib/ethdev/rte_flow.h | 19 +++++++++++++++++++
3 files changed, 37 insertions(+)
Comments
Hi Sean,
Please add this feature to the release note.
> -----Original Message-----
> From: Sean Zhang (Networking SW) <xiazhang@nvidia.com>
> Sent: Wednesday, January 26, 2022 10:44 AM
> Subject: [v1 2/4] ethdev: support GRE optional fields
>
> Add flow pattern items and header format for matching optional fields
> (checksum/key/sequence) in GRE header. And the flags in gre item should
> be correspondingly set with the new added items.
>
> Signed-off-by: Sean Zhang <xiazhang@nvidia.com>
> ---
> doc/guides/prog_guide/rte_flow.rst | 17 +++++++++++++++++
> lib/ethdev/rte_flow.c | 1 +
> lib/ethdev/rte_flow.h | 19 +++++++++++++++++++
> 3 files changed, 37 insertions(+)
>
> diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
> index b4aa9c4..0e47501 100644
> --- a/doc/guides/prog_guide/rte_flow.rst
> +++ b/doc/guides/prog_guide/rte_flow.rst
> @@ -1106,6 +1106,7 @@ Matches a GRE header.
>
> Item: ``GRE_KEY``
> ^^^^^^^^^^^^^^^^^
> +This action is deprecated. Consider `Item: GRE_OPTION`.
>
> Matches a GRE key field.
> This should be preceded by item ``GRE``.
> @@ -1113,6 +1114,22 @@ This should be preceded by item ``GRE``.
> - Value to be matched is a big-endian 32 bit integer.
> - When this item present it implicitly match K bit in default mask as "1"
>
> +Item: ``GRE_OPTION``
> +^^^^^^^^^^^^^^^^^^^^
> +
> +Matches a GRE optional fields (checksum/key/sequence).
> +This should be preceded by item ``GRE``.
> +
> +- ``checksum``: checksum.
> +- ``key``: key.
> +- ``sequence``: sequence.
> +- The items in GRE_OPTION do not change bit flags(c_bit/k_bit/s_bit) in GRE
> + item. The bit flags need be set with GRE item by application. When the items
> + present, the corresponding bits in GRE spec and mask should be set "1" by
> + application, it means to match specified value of the fields. When the items
> + no present, but the corresponding bits in GRE spec and mask is "1", it means
> + to match any value of the fields.
> +
> Item: ``FUZZY``
> ^^^^^^^^^^^^^^^
>
> diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
> index a93f68a..7f93900 100644
> --- a/lib/ethdev/rte_flow.c
> +++ b/lib/ethdev/rte_flow.c
> @@ -139,6 +139,7 @@ struct rte_flow_desc_data {
> MK_FLOW_ITEM(META, sizeof(struct rte_flow_item_meta)),
> MK_FLOW_ITEM(TAG, sizeof(struct rte_flow_item_tag)),
> MK_FLOW_ITEM(GRE_KEY, sizeof(rte_be32_t)),
> + MK_FLOW_ITEM(GRE_OPTION, sizeof(struct rte_flow_item_gre_opt)),
> MK_FLOW_ITEM(GTP_PSC, sizeof(struct rte_flow_item_gtp_psc)),
> MK_FLOW_ITEM(PPPOES, sizeof(struct rte_flow_item_pppoe)),
> MK_FLOW_ITEM(PPPOED, sizeof(struct rte_flow_item_pppoe)),
> diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
> index 1031fb2..db58b47 100644
> --- a/lib/ethdev/rte_flow.h
> +++ b/lib/ethdev/rte_flow.h
> @@ -37,6 +37,7 @@
> #include <rte_gtp.h>
> #include <rte_l2tpv2.h>
> #include <rte_ppp.h>
> +#include <rte_gre.h>
>
> #ifdef __cplusplus
> extern "C" {
> @@ -660,6 +661,13 @@ enum rte_flow_item_type {
> * See struct rte_flow_item_ppp.
> */
> RTE_FLOW_ITEM_TYPE_PPP,
> +
> + /**
> + * Matches GRE optional fields.
> + *
> + * See struct rte_flow_item_gre_opt.
> + */
> + RTE_FLOW_ITEM_TYPE_GRE_OPTION,
> };
>
> /**
> @@ -1196,6 +1204,17 @@ struct rte_flow_item_gre {
> #endif
>
> /**
> + * RTE_FLOW_ITEM_TYPE_GRE_OPTION.
> + *
> + * Matches GRE optional fields in header.
> + */
> +struct rte_flow_item_gre_opt {
> + struct rte_gre_hdr_opt_checksum checksum;
> + struct rte_gre_hdr_opt_key key;
> + struct rte_gre_hdr_opt_sequence sequence;
> +};
> +
> +/**
> * RTE_FLOW_ITEM_TYPE_FUZZY
> *
> * Fuzzy pattern match, expect faster than default.
> --
> 1.8.3.1
Best,
Ori
On 2/1/2022 12:57 PM, Ori Kam wrote:
> Hi Sean,
>
> Please add this feature to the release note.
>
Hi Sean,
Reminder of this change request, waiting for new version.
Also please remember to add the missing doc in mlx patch (4/4) in next version.
Thanks,
ferruh
>> -----Original Message-----
>> From: Sean Zhang (Networking SW) <xiazhang@nvidia.com>
>> Sent: Wednesday, January 26, 2022 10:44 AM
>> Subject: [v1 2/4] ethdev: support GRE optional fields
>>
>> Add flow pattern items and header format for matching optional fields
>> (checksum/key/sequence) in GRE header. And the flags in gre item should
>> be correspondingly set with the new added items.
>>
>> Signed-off-by: Sean Zhang <xiazhang@nvidia.com>
>> ---
>> doc/guides/prog_guide/rte_flow.rst | 17 +++++++++++++++++
>> lib/ethdev/rte_flow.c | 1 +
>> lib/ethdev/rte_flow.h | 19 +++++++++++++++++++
>> 3 files changed, 37 insertions(+)
>>
>> diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
>> index b4aa9c4..0e47501 100644
>> --- a/doc/guides/prog_guide/rte_flow.rst
>> +++ b/doc/guides/prog_guide/rte_flow.rst
>> @@ -1106,6 +1106,7 @@ Matches a GRE header.
>>
>> Item: ``GRE_KEY``
>> ^^^^^^^^^^^^^^^^^
>> +This action is deprecated. Consider `Item: GRE_OPTION`.
>>
>> Matches a GRE key field.
>> This should be preceded by item ``GRE``.
>> @@ -1113,6 +1114,22 @@ This should be preceded by item ``GRE``.
>> - Value to be matched is a big-endian 32 bit integer.
>> - When this item present it implicitly match K bit in default mask as "1"
>>
>> +Item: ``GRE_OPTION``
>> +^^^^^^^^^^^^^^^^^^^^
>> +
>> +Matches a GRE optional fields (checksum/key/sequence).
>> +This should be preceded by item ``GRE``.
>> +
>> +- ``checksum``: checksum.
>> +- ``key``: key.
>> +- ``sequence``: sequence.
>> +- The items in GRE_OPTION do not change bit flags(c_bit/k_bit/s_bit) in GRE
>> + item. The bit flags need be set with GRE item by application. When the items
>> + present, the corresponding bits in GRE spec and mask should be set "1" by
>> + application, it means to match specified value of the fields. When the items
>> + no present, but the corresponding bits in GRE spec and mask is "1", it means
>> + to match any value of the fields.
>> +
>> Item: ``FUZZY``
>> ^^^^^^^^^^^^^^^
>>
>> diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
>> index a93f68a..7f93900 100644
>> --- a/lib/ethdev/rte_flow.c
>> +++ b/lib/ethdev/rte_flow.c
>> @@ -139,6 +139,7 @@ struct rte_flow_desc_data {
>> MK_FLOW_ITEM(META, sizeof(struct rte_flow_item_meta)),
>> MK_FLOW_ITEM(TAG, sizeof(struct rte_flow_item_tag)),
>> MK_FLOW_ITEM(GRE_KEY, sizeof(rte_be32_t)),
>> + MK_FLOW_ITEM(GRE_OPTION, sizeof(struct rte_flow_item_gre_opt)),
>> MK_FLOW_ITEM(GTP_PSC, sizeof(struct rte_flow_item_gtp_psc)),
>> MK_FLOW_ITEM(PPPOES, sizeof(struct rte_flow_item_pppoe)),
>> MK_FLOW_ITEM(PPPOED, sizeof(struct rte_flow_item_pppoe)),
>> diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
>> index 1031fb2..db58b47 100644
>> --- a/lib/ethdev/rte_flow.h
>> +++ b/lib/ethdev/rte_flow.h
>> @@ -37,6 +37,7 @@
>> #include <rte_gtp.h>
>> #include <rte_l2tpv2.h>
>> #include <rte_ppp.h>
>> +#include <rte_gre.h>
>>
>> #ifdef __cplusplus
>> extern "C" {
>> @@ -660,6 +661,13 @@ enum rte_flow_item_type {
>> * See struct rte_flow_item_ppp.
>> */
>> RTE_FLOW_ITEM_TYPE_PPP,
>> +
>> + /**
>> + * Matches GRE optional fields.
>> + *
>> + * See struct rte_flow_item_gre_opt.
>> + */
>> + RTE_FLOW_ITEM_TYPE_GRE_OPTION,
>> };
>>
>> /**
>> @@ -1196,6 +1204,17 @@ struct rte_flow_item_gre {
>> #endif
>>
>> /**
>> + * RTE_FLOW_ITEM_TYPE_GRE_OPTION.
>> + *
>> + * Matches GRE optional fields in header.
>> + */
>> +struct rte_flow_item_gre_opt {
>> + struct rte_gre_hdr_opt_checksum checksum;
>> + struct rte_gre_hdr_opt_key key;
>> + struct rte_gre_hdr_opt_sequence sequence;
>> +};
>> +
>> +/**
>> * RTE_FLOW_ITEM_TYPE_FUZZY
>> *
>> * Fuzzy pattern match, expect faster than default.
>> --
>> 1.8.3.1
>
> Best,
> Ori
>
@@ -1106,6 +1106,7 @@ Matches a GRE header.
Item: ``GRE_KEY``
^^^^^^^^^^^^^^^^^
+This action is deprecated. Consider `Item: GRE_OPTION`.
Matches a GRE key field.
This should be preceded by item ``GRE``.
@@ -1113,6 +1114,22 @@ This should be preceded by item ``GRE``.
- Value to be matched is a big-endian 32 bit integer.
- When this item present it implicitly match K bit in default mask as "1"
+Item: ``GRE_OPTION``
+^^^^^^^^^^^^^^^^^^^^
+
+Matches a GRE optional fields (checksum/key/sequence).
+This should be preceded by item ``GRE``.
+
+- ``checksum``: checksum.
+- ``key``: key.
+- ``sequence``: sequence.
+- The items in GRE_OPTION do not change bit flags(c_bit/k_bit/s_bit) in GRE
+ item. The bit flags need be set with GRE item by application. When the items
+ present, the corresponding bits in GRE spec and mask should be set "1" by
+ application, it means to match specified value of the fields. When the items
+ no present, but the corresponding bits in GRE spec and mask is "1", it means
+ to match any value of the fields.
+
Item: ``FUZZY``
^^^^^^^^^^^^^^^
@@ -139,6 +139,7 @@ struct rte_flow_desc_data {
MK_FLOW_ITEM(META, sizeof(struct rte_flow_item_meta)),
MK_FLOW_ITEM(TAG, sizeof(struct rte_flow_item_tag)),
MK_FLOW_ITEM(GRE_KEY, sizeof(rte_be32_t)),
+ MK_FLOW_ITEM(GRE_OPTION, sizeof(struct rte_flow_item_gre_opt)),
MK_FLOW_ITEM(GTP_PSC, sizeof(struct rte_flow_item_gtp_psc)),
MK_FLOW_ITEM(PPPOES, sizeof(struct rte_flow_item_pppoe)),
MK_FLOW_ITEM(PPPOED, sizeof(struct rte_flow_item_pppoe)),
@@ -37,6 +37,7 @@
#include <rte_gtp.h>
#include <rte_l2tpv2.h>
#include <rte_ppp.h>
+#include <rte_gre.h>
#ifdef __cplusplus
extern "C" {
@@ -660,6 +661,13 @@ enum rte_flow_item_type {
* See struct rte_flow_item_ppp.
*/
RTE_FLOW_ITEM_TYPE_PPP,
+
+ /**
+ * Matches GRE optional fields.
+ *
+ * See struct rte_flow_item_gre_opt.
+ */
+ RTE_FLOW_ITEM_TYPE_GRE_OPTION,
};
/**
@@ -1196,6 +1204,17 @@ struct rte_flow_item_gre {
#endif
/**
+ * RTE_FLOW_ITEM_TYPE_GRE_OPTION.
+ *
+ * Matches GRE optional fields in header.
+ */
+struct rte_flow_item_gre_opt {
+ struct rte_gre_hdr_opt_checksum checksum;
+ struct rte_gre_hdr_opt_key key;
+ struct rte_gre_hdr_opt_sequence sequence;
+};
+
+/**
* RTE_FLOW_ITEM_TYPE_FUZZY
*
* Fuzzy pattern match, expect faster than default.