[v2,1/4] ethdev: fix integrity flow item

Message ID 20210429061634.3481-2-getelson@nvidia.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series net/mlx5: add integrity flow item support |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Gregory Etelson April 29, 2021, 6:16 a.m. UTC
  Add integrity item definition to the rte_flow_desc_item array.
The new entry allows to build RTE flow item from a data
stored in rte_flow_item_integrity type.

Add bitmasks to the integrity item value.
The masks allow to query multiple integrity filters in a single
compare operation.

Fixes: b10a421a1f3b ("ethdev: add packet integrity check flow rules")

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 lib/ethdev/rte_flow.c | 1 +
 lib/ethdev/rte_flow.h | 9 +++++++++
 2 files changed, 10 insertions(+)
  

Comments

Thomas Monjalon April 29, 2021, 7:57 a.m. UTC | #1
29/04/2021 08:16, Gregory Etelson:
> Add integrity item definition to the rte_flow_desc_item array.
> The new entry allows to build RTE flow item from a data
> stored in rte_flow_item_integrity type.
> 
> Add bitmasks to the integrity item value.
> The masks allow to query multiple integrity filters in a single
> compare operation.
> 
> Fixes: b10a421a1f3b ("ethdev: add packet integrity check flow rules")
> 
> Signed-off-by: Gregory Etelson <getelson@nvidia.com>
> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> ---
> --- a/lib/ethdev/rte_flow.h
> +++ b/lib/ethdev/rte_flow.h
> +#define RTE_FLOW_ITEM_INTEGRITY_PKT_OK       RTE_BIT64(0)
> +#define RTE_FLOW_ITEM_INTEGRITY_L2_OK        RTE_BIT64(1)
> +#define RTE_FLOW_ITEM_INTEGRITY_L3_OK        RTE_BIT64(2)
> +#define RTE_FLOW_ITEM_INTEGRITY_L4_OK        RTE_BIT64(3)
> +#define RTE_FLOW_ITEM_INTEGRITY_L2_CRC_OK    RTE_BIT64(4)
> +#define RTE_FLOW_ITEM_INTEGRITY_IPV4_CSUM_OK RTE_BIT64(5)
> +#define RTE_FLOW_ITEM_INTEGRITY_L4_CSUM_OK   RTE_BIT64(6)
> +#define RTE_FLOW_ITEM_INTEGRITY_L3_LEN_OK    RTE_BIT64(7)

I still have the same comment as in v1: we are missing
an API comment to reference the bits RTE_FLOW_ITEM_INTEGRITY_*
where it should be used.
  
Ori Kam April 29, 2021, 10:13 a.m. UTC | #2
Hi Gregory,

> -----Original Message-----
> From: Gregory Etelson <getelson@nvidia.com>
> Sent: Thursday, April 29, 2021 9:17 AM
> Subject: [PATCH v2 1/4] ethdev: fix integrity flow item
> 
> Add integrity item definition to the rte_flow_desc_item array.
> The new entry allows to build RTE flow item from a data stored in
> rte_flow_item_integrity type.
> 
> Add bitmasks to the integrity item value.
> The masks allow to query multiple integrity filters in a single compare
> operation.
> 
> Fixes: b10a421a1f3b ("ethdev: add packet integrity check flow rules")
> 
> Signed-off-by: Gregory Etelson <getelson@nvidia.com>
> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> ---
>  lib/ethdev/rte_flow.c | 1 +
>  lib/ethdev/rte_flow.h | 9 +++++++++
>  2 files changed, 10 insertions(+)
> 
> diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c index
> c7c7108933..8cb7a069c8 100644
> --- a/lib/ethdev/rte_flow.c
> +++ b/lib/ethdev/rte_flow.c
> @@ -98,6 +98,7 @@ static const struct rte_flow_desc_data
> rte_flow_desc_item[] = {
>  	MK_FLOW_ITEM(PFCP, sizeof(struct rte_flow_item_pfcp)),
>  	MK_FLOW_ITEM(ECPRI, sizeof(struct rte_flow_item_ecpri)),
>  	MK_FLOW_ITEM(GENEVE_OPT, sizeof(struct
> rte_flow_item_geneve_opt)),
> +	MK_FLOW_ITEM(INTEGRITY, sizeof(struct rte_flow_item_integrity)),
>  	MK_FLOW_ITEM(CONNTRACK, sizeof(uint32_t)),  };
> 
This fix is correct. 

> diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index
> 94c8c1ccc8..147fdefcae 100644
> --- a/lib/ethdev/rte_flow.h
> +++ b/lib/ethdev/rte_flow.h
> @@ -1738,6 +1738,15 @@ struct rte_flow_item_integrity {
>  	};
>  };
> 
> +#define RTE_FLOW_ITEM_INTEGRITY_PKT_OK       RTE_BIT64(0)
> +#define RTE_FLOW_ITEM_INTEGRITY_L2_OK        RTE_BIT64(1)
> +#define RTE_FLOW_ITEM_INTEGRITY_L3_OK        RTE_BIT64(2)
> +#define RTE_FLOW_ITEM_INTEGRITY_L4_OK        RTE_BIT64(3)
> +#define RTE_FLOW_ITEM_INTEGRITY_L2_CRC_OK    RTE_BIT64(4)
> +#define RTE_FLOW_ITEM_INTEGRITY_IPV4_CSUM_OK RTE_BIT64(5)
> +#define RTE_FLOW_ITEM_INTEGRITY_L4_CSUM_OK   RTE_BIT64(6)
> +#define RTE_FLOW_ITEM_INTEGRITY_L3_LEN_OK    RTE_BIT64(7)
> +

I don't think that we need those flags, this means two option for the same API,
I suggest that we remove the value from the struct.

In any case I think this should be in a different thread then the above fix.

>  #ifndef __cplusplus
>  static const struct rte_flow_item_integrity  rte_flow_item_integrity_mask =
> {
> --
> 2.31.1

Best,
Ori
  
Thomas Monjalon April 29, 2021, 11:37 a.m. UTC | #3
29/04/2021 12:13, Ori Kam:
> From: Gregory Etelson <getelson@nvidia.com>
> > 
> > Add integrity item definition to the rte_flow_desc_item array.
> > The new entry allows to build RTE flow item from a data stored in
> > rte_flow_item_integrity type.
> > 
> > Add bitmasks to the integrity item value.
> > The masks allow to query multiple integrity filters in a single compare
> > operation.
> > 
> > Fixes: b10a421a1f3b ("ethdev: add packet integrity check flow rules")
> > 
> > Signed-off-by: Gregory Etelson <getelson@nvidia.com>
> > Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> > ---
> >  lib/ethdev/rte_flow.c | 1 +
> >  lib/ethdev/rte_flow.h | 9 +++++++++
> >  2 files changed, 10 insertions(+)
> > 
> > diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c index
> > c7c7108933..8cb7a069c8 100644
> > --- a/lib/ethdev/rte_flow.c
> > +++ b/lib/ethdev/rte_flow.c
> > @@ -98,6 +98,7 @@ static const struct rte_flow_desc_data
> > rte_flow_desc_item[] = {
> >  	MK_FLOW_ITEM(PFCP, sizeof(struct rte_flow_item_pfcp)),
> >  	MK_FLOW_ITEM(ECPRI, sizeof(struct rte_flow_item_ecpri)),
> >  	MK_FLOW_ITEM(GENEVE_OPT, sizeof(struct
> > rte_flow_item_geneve_opt)),
> > +	MK_FLOW_ITEM(INTEGRITY, sizeof(struct rte_flow_item_integrity)),
> >  	MK_FLOW_ITEM(CONNTRACK, sizeof(uint32_t)),  };
> > 
> This fix is correct. 
> 
> > --- a/lib/ethdev/rte_flow.h
> > +++ b/lib/ethdev/rte_flow.h
> > +#define RTE_FLOW_ITEM_INTEGRITY_PKT_OK       RTE_BIT64(0)
> > +#define RTE_FLOW_ITEM_INTEGRITY_L2_OK        RTE_BIT64(1)
> > +#define RTE_FLOW_ITEM_INTEGRITY_L3_OK        RTE_BIT64(2)
> > +#define RTE_FLOW_ITEM_INTEGRITY_L4_OK        RTE_BIT64(3)
> > +#define RTE_FLOW_ITEM_INTEGRITY_L2_CRC_OK    RTE_BIT64(4)
> > +#define RTE_FLOW_ITEM_INTEGRITY_IPV4_CSUM_OK RTE_BIT64(5)
> > +#define RTE_FLOW_ITEM_INTEGRITY_L4_CSUM_OK   RTE_BIT64(6)
> > +#define RTE_FLOW_ITEM_INTEGRITY_L3_LEN_OK    RTE_BIT64(7)
> > +
> 
> I don't think that we need those flags, this means two option for the same API,
> I suggest that we remove the value from the struct.

To make it clear, these flags were for use with
rte_flow_item_integrity.value, but it seems we can just remove
the struct member "value" which was unioned with some bitfields.

> In any case I think this should be in a different thread then the above fix.

I am OK to have such fix, it looks better to remove the union
which leads to duplicate the API.
  

Patch

diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
index c7c7108933..8cb7a069c8 100644
--- a/lib/ethdev/rte_flow.c
+++ b/lib/ethdev/rte_flow.c
@@ -98,6 +98,7 @@  static const struct rte_flow_desc_data rte_flow_desc_item[] = {
 	MK_FLOW_ITEM(PFCP, sizeof(struct rte_flow_item_pfcp)),
 	MK_FLOW_ITEM(ECPRI, sizeof(struct rte_flow_item_ecpri)),
 	MK_FLOW_ITEM(GENEVE_OPT, sizeof(struct rte_flow_item_geneve_opt)),
+	MK_FLOW_ITEM(INTEGRITY, sizeof(struct rte_flow_item_integrity)),
 	MK_FLOW_ITEM(CONNTRACK, sizeof(uint32_t)),
 };
 
diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
index 94c8c1ccc8..147fdefcae 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -1738,6 +1738,15 @@  struct rte_flow_item_integrity {
 	};
 };
 
+#define RTE_FLOW_ITEM_INTEGRITY_PKT_OK       RTE_BIT64(0)
+#define RTE_FLOW_ITEM_INTEGRITY_L2_OK        RTE_BIT64(1)
+#define RTE_FLOW_ITEM_INTEGRITY_L3_OK        RTE_BIT64(2)
+#define RTE_FLOW_ITEM_INTEGRITY_L4_OK        RTE_BIT64(3)
+#define RTE_FLOW_ITEM_INTEGRITY_L2_CRC_OK    RTE_BIT64(4)
+#define RTE_FLOW_ITEM_INTEGRITY_IPV4_CSUM_OK RTE_BIT64(5)
+#define RTE_FLOW_ITEM_INTEGRITY_L4_CSUM_OK   RTE_BIT64(6)
+#define RTE_FLOW_ITEM_INTEGRITY_L3_LEN_OK    RTE_BIT64(7)
+
 #ifndef __cplusplus
 static const struct rte_flow_item_integrity
 rte_flow_item_integrity_mask = {