diff mbox series

[06/15] net/dpaa: support ESP packet type in packet parsing

Message ID 20220928052516.1279442-7-g.singh@nxp.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers show
Series DPAA and DPAA2 driver changes | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Gagandeep Singh Sept. 28, 2022, 5:25 a.m. UTC
Add support of ESP packet type in packet receive path.

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
 drivers/net/dpaa/dpaa_rxtx.c | 10 ++++++++++
 drivers/net/dpaa/dpaa_rxtx.h |  6 ++++++
 2 files changed, 16 insertions(+)

Comments

Ferruh Yigit Oct. 5, 2022, 2:20 p.m. UTC | #1
On 9/28/2022 6:25 AM, Gagandeep Singh wrote:
> Add support of ESP packet type in packet receive path.
> 
> Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
> ---
>   drivers/net/dpaa/dpaa_rxtx.c | 10 ++++++++++
>   drivers/net/dpaa/dpaa_rxtx.h |  6 ++++++
>   2 files changed, 16 insertions(+)
> 
> diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c
> index 20b75efb63..22205cec30 100644
> --- a/drivers/net/dpaa/dpaa_rxtx.c
> +++ b/drivers/net/dpaa/dpaa_rxtx.c
> @@ -178,6 +178,16 @@ static inline void dpaa_eth_packet_info(struct rte_mbuf *m, void *fd_virt_addr)
>   		m->packet_type = RTE_PTYPE_L2_ETHER |
>   			RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_UDP;
>   		break;
> +	case DPAA_PKT_TYPE_IPSEC_IPV4:
> +		if (*((uintptr_t *)&annot->parse) & DPAA_PARSE_ESP_MASK)
> +			m->packet_type = RTE_PTYPE_L2_ETHER |
> +				RTE_PTYPE_L3_IPV4 | RTE_PTYPE_TUNNEL_ESP;
> +		break;
> +	case DPAA_PKT_TYPE_IPSEC_IPV6:
> +		if (*((uintptr_t *)&annot->parse) & DPAA_PARSE_ESP_MASK)
> +			m->packet_type = RTE_PTYPE_L2_ETHER |
> +				RTE_PTYPE_L3_IPV6 | RTE_PTYPE_TUNNEL_ESP;
> +		break;
>   	case DPAA_PKT_TYPE_IPV4_EXT_UDP:
>   		m->packet_type = RTE_PTYPE_L2_ETHER |
>   			RTE_PTYPE_L3_IPV4_EXT | RTE_PTYPE_L4_UDP;

Shouldn't 'dpaa_supported_ptypes_get()' needs to be updated to notify 
host on the capability to report ESP types.

> diff --git a/drivers/net/dpaa/dpaa_rxtx.h b/drivers/net/dpaa/dpaa_rxtx.h
> index 99e09196e9..b2d7c0f2a3 100644
> --- a/drivers/net/dpaa/dpaa_rxtx.h
> +++ b/drivers/net/dpaa/dpaa_rxtx.h
> @@ -47,6 +47,7 @@
>    *	L4R 0xE0 -
>    *		0x20 - TCP
>    *		0x40 - UDP
> + *		0x60 - IPsec
>    *		0x80 - SCTP
>    *	L3R 0xEDC4 (in Big Endian) -
>    *		0x8000 - IPv4
> @@ -63,6 +64,7 @@
>    */
>   #define DPAA_PARSE_MASK			0x00F044EF00800000
>   #define DPAA_PARSE_VLAN_MASK		0x0000000000700000
> +#define DPAA_PARSE_ESP_MASK		0x0008000000000000
>   
>   /* Parsed values (Little Endian) */
>   #define DPAA_PKT_TYPE_NONE		0x0000000000000000
> @@ -137,6 +139,10 @@
>   			(0x0020000000000000 | DPAA_PKT_TYPE_TUNNEL_4_6)
>   #define DPAA_PKT_TYPE_TUNNEL_6_4_TCP \
>   			(0x0020000000000000 | DPAA_PKT_TYPE_TUNNEL_6_4)
> +#define DPAA_PKT_TYPE_IPSEC_IPV4 \
> +			(0x0060000000000000 | DPAA_PKT_TYPE_IPV4)
> +#define DPAA_PKT_TYPE_IPSEC_IPV6 \
> +			(0x0060000000000000 | DPAA_PKT_TYPE_IPV6)
>   
>   /* Checksum Errors */
>   #define DPAA_PKT_IP_CSUM_ERR		0x0000400200000000
Gagandeep Singh Oct. 6, 2022, 8:48 a.m. UTC | #2
Hi

> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@amd.com>
> Sent: Wednesday, October 5, 2022 7:51 PM
> To: Gagandeep Singh <G.Singh@nxp.com>
> Cc: dev@dpdk.org
> Subject: Re: [PATCH 06/15] net/dpaa: support ESP packet type in packet
> parsing
> 
> On 9/28/2022 6:25 AM, Gagandeep Singh wrote:
> > Add support of ESP packet type in packet receive path.
> >
> > Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
> > ---
> >   drivers/net/dpaa/dpaa_rxtx.c | 10 ++++++++++
> >   drivers/net/dpaa/dpaa_rxtx.h |  6 ++++++
> >   2 files changed, 16 insertions(+)
> >
> > diff --git a/drivers/net/dpaa/dpaa_rxtx.c
> > b/drivers/net/dpaa/dpaa_rxtx.c index 20b75efb63..22205cec30 100644
> > --- a/drivers/net/dpaa/dpaa_rxtx.c
> > +++ b/drivers/net/dpaa/dpaa_rxtx.c
> > @@ -178,6 +178,16 @@ static inline void dpaa_eth_packet_info(struct
> rte_mbuf *m, void *fd_virt_addr)
> >   		m->packet_type = RTE_PTYPE_L2_ETHER |
> >   			RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_UDP;
> >   		break;
> > +	case DPAA_PKT_TYPE_IPSEC_IPV4:
> > +		if (*((uintptr_t *)&annot->parse) & DPAA_PARSE_ESP_MASK)
> > +			m->packet_type = RTE_PTYPE_L2_ETHER |
> > +				RTE_PTYPE_L3_IPV4 |
> RTE_PTYPE_TUNNEL_ESP;
> > +		break;
> > +	case DPAA_PKT_TYPE_IPSEC_IPV6:
> > +		if (*((uintptr_t *)&annot->parse) & DPAA_PARSE_ESP_MASK)
> > +			m->packet_type = RTE_PTYPE_L2_ETHER |
> > +				RTE_PTYPE_L3_IPV6 |
> RTE_PTYPE_TUNNEL_ESP;
> > +		break;
> >   	case DPAA_PKT_TYPE_IPV4_EXT_UDP:
> >   		m->packet_type = RTE_PTYPE_L2_ETHER |
> >   			RTE_PTYPE_L3_IPV4_EXT | RTE_PTYPE_L4_UDP;
> 
> Shouldn't 'dpaa_supported_ptypes_get()' needs to be updated to notify host
> on the capability to report ESP types.

Yes, I will update it in next version.

> 
> > diff --git a/drivers/net/dpaa/dpaa_rxtx.h
> > b/drivers/net/dpaa/dpaa_rxtx.h index 99e09196e9..b2d7c0f2a3 100644
> > --- a/drivers/net/dpaa/dpaa_rxtx.h
> > +++ b/drivers/net/dpaa/dpaa_rxtx.h
> > @@ -47,6 +47,7 @@
> >    *	L4R 0xE0 -
> >    *		0x20 - TCP
> >    *		0x40 - UDP
> > + *		0x60 - IPsec
> >    *		0x80 - SCTP
> >    *	L3R 0xEDC4 (in Big Endian) -
> >    *		0x8000 - IPv4
> > @@ -63,6 +64,7 @@
> >    */
> >   #define DPAA_PARSE_MASK			0x00F044EF00800000
> >   #define DPAA_PARSE_VLAN_MASK		0x0000000000700000
> > +#define DPAA_PARSE_ESP_MASK		0x0008000000000000
> >
> >   /* Parsed values (Little Endian) */
> >   #define DPAA_PKT_TYPE_NONE		0x0000000000000000
> > @@ -137,6 +139,10 @@
> >   			(0x0020000000000000 |
> DPAA_PKT_TYPE_TUNNEL_4_6)
> >   #define DPAA_PKT_TYPE_TUNNEL_6_4_TCP \
> >   			(0x0020000000000000 |
> DPAA_PKT_TYPE_TUNNEL_6_4)
> > +#define DPAA_PKT_TYPE_IPSEC_IPV4 \
> > +			(0x0060000000000000 | DPAA_PKT_TYPE_IPV4)
> #define
> > +DPAA_PKT_TYPE_IPSEC_IPV6 \
> > +			(0x0060000000000000 | DPAA_PKT_TYPE_IPV6)
> >
> >   /* Checksum Errors */
> >   #define DPAA_PKT_IP_CSUM_ERR		0x0000400200000000
diff mbox series

Patch

diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c
index 20b75efb63..22205cec30 100644
--- a/drivers/net/dpaa/dpaa_rxtx.c
+++ b/drivers/net/dpaa/dpaa_rxtx.c
@@ -178,6 +178,16 @@  static inline void dpaa_eth_packet_info(struct rte_mbuf *m, void *fd_virt_addr)
 		m->packet_type = RTE_PTYPE_L2_ETHER |
 			RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_UDP;
 		break;
+	case DPAA_PKT_TYPE_IPSEC_IPV4:
+		if (*((uintptr_t *)&annot->parse) & DPAA_PARSE_ESP_MASK)
+			m->packet_type = RTE_PTYPE_L2_ETHER |
+				RTE_PTYPE_L3_IPV4 | RTE_PTYPE_TUNNEL_ESP;
+		break;
+	case DPAA_PKT_TYPE_IPSEC_IPV6:
+		if (*((uintptr_t *)&annot->parse) & DPAA_PARSE_ESP_MASK)
+			m->packet_type = RTE_PTYPE_L2_ETHER |
+				RTE_PTYPE_L3_IPV6 | RTE_PTYPE_TUNNEL_ESP;
+		break;
 	case DPAA_PKT_TYPE_IPV4_EXT_UDP:
 		m->packet_type = RTE_PTYPE_L2_ETHER |
 			RTE_PTYPE_L3_IPV4_EXT | RTE_PTYPE_L4_UDP;
diff --git a/drivers/net/dpaa/dpaa_rxtx.h b/drivers/net/dpaa/dpaa_rxtx.h
index 99e09196e9..b2d7c0f2a3 100644
--- a/drivers/net/dpaa/dpaa_rxtx.h
+++ b/drivers/net/dpaa/dpaa_rxtx.h
@@ -47,6 +47,7 @@ 
  *	L4R 0xE0 -
  *		0x20 - TCP
  *		0x40 - UDP
+ *		0x60 - IPsec
  *		0x80 - SCTP
  *	L3R 0xEDC4 (in Big Endian) -
  *		0x8000 - IPv4
@@ -63,6 +64,7 @@ 
  */
 #define DPAA_PARSE_MASK			0x00F044EF00800000
 #define DPAA_PARSE_VLAN_MASK		0x0000000000700000
+#define DPAA_PARSE_ESP_MASK		0x0008000000000000
 
 /* Parsed values (Little Endian) */
 #define DPAA_PKT_TYPE_NONE		0x0000000000000000
@@ -137,6 +139,10 @@ 
 			(0x0020000000000000 | DPAA_PKT_TYPE_TUNNEL_4_6)
 #define DPAA_PKT_TYPE_TUNNEL_6_4_TCP \
 			(0x0020000000000000 | DPAA_PKT_TYPE_TUNNEL_6_4)
+#define DPAA_PKT_TYPE_IPSEC_IPV4 \
+			(0x0060000000000000 | DPAA_PKT_TYPE_IPV4)
+#define DPAA_PKT_TYPE_IPSEC_IPV6 \
+			(0x0060000000000000 | DPAA_PKT_TYPE_IPV6)
 
 /* Checksum Errors */
 #define DPAA_PKT_IP_CSUM_ERR		0x0000400200000000