[7/8] vmxnet3: Set packet for fragmented packet

Message ID 20220503042257.15626-8-pagupta@vmware.com (mailing list archive)
State Changes Requested, archived
Delegated to: Andrew Rybchenko
Headers
Series vmxnet3 version V5 and V6 |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Pankaj Gupta May 3, 2022, 4:22 a.m. UTC
  The packet type is set even if it is a fragmented packet

Tested, using testpmd, for different hardware versions on
ESXi 7.0 Update 2.

Signed-off-by: Pankaj Gupta <pagupta@vmware.com>
---
 drivers/net/vmxnet3/vmxnet3_rxtx.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
  

Comments

Andrew Rybchenko May 4, 2022, 3:07 p.m. UTC | #1
On 5/3/22 07:22, Pankaj Gupta wrote:
> The packet type is set even if it is a fragmented packet

I'm wondering if is really IPv4/IPv6 fragmented packets or just
scattered on Rx across many Rx buffers.
I'm asking since fragmented sounds weird with TCP, since TCP
spec forbids fragmentation.

> 
> Tested, using testpmd, for different hardware versions on
> ESXi 7.0 Update 2.
> 
> Signed-off-by: Pankaj Gupta <pagupta@vmware.com>
> ---
>   drivers/net/vmxnet3/vmxnet3_rxtx.c | 17 +++++++++++++++++
>   1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c
> index a6665fbf70..5e177400c0 100644
> --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
> +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
> @@ -759,6 +759,23 @@ vmxnet3_rx_offload(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd,
>   		/* Check packet type, checksum errors, etc. */
>   		if (rcd->cnc) {
>   			ol_flags |= RTE_MBUF_F_RX_L4_CKSUM_UNKNOWN;
> +
> +			if (rcd->v4) {
> +				packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN;
> +				if (rcd->tcp)
> +					packet_type |= RTE_PTYPE_L4_TCP;
> +				else if (rcd->udp)
> +					packet_type |= RTE_PTYPE_L4_UDP;
> +			} else if (rcd->v6) {
> +				packet_type |= RTE_PTYPE_L3_IPV6_EXT_UNKNOWN;
> +				if (rcd->tcp)
> +					packet_type |= RTE_PTYPE_L4_TCP;
> +				else if (rcd->udp)
> +					packet_type |= RTE_PTYPE_L4_UDP;
> +			} else {
> +				packet_type |= RTE_PTYPE_UNKNOWN;
> +			}
> +
>   		} else {
>   			if (rcd->v4) {
>   				packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN;
  
Pankaj Gupta May 4, 2022, 8:40 p.m. UTC | #2
Hi Andrew,
Packet type was not set for fragmented packets so we are trying to set it in all possible scenarios.

I believe TCP packets can be fragmented.

Thanks,
Pankaj

From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Date: Wednesday, May 4, 2022 at 8:08 AM
To: Pankaj Gupta <pagupta@vmware.com>, Jochen Behrens <jbehrens@vmware.com>, Yong Wang <yongwang@vmware.com>
Cc: dev@dpdk.org <dev@dpdk.org>
Subject: Re: [PATCH 7/8] vmxnet3: Set packet for fragmented packet
⚠ External Email

On 5/3/22 07:22, Pankaj Gupta wrote:
> The packet type is set even if it is a fragmented packet

I'm wondering if is really IPv4/IPv6 fragmented packets or just
scattered on Rx across many Rx buffers.
I'm asking since fragmented sounds weird with TCP, since TCP
spec forbids fragmentation.

>
> Tested, using testpmd, for different hardware versions on
> ESXi 7.0 Update 2.
>
> Signed-off-by: Pankaj Gupta <pagupta@vmware.com>
> ---
>   drivers/net/vmxnet3/vmxnet3_rxtx.c | 17 +++++++++++++++++
>   1 file changed, 17 insertions(+)
>
> diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c
> index a6665fbf70..5e177400c0 100644
> --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
> +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
> @@ -759,6 +759,23 @@ vmxnet3_rx_offload(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd,
>               /* Check packet type, checksum errors, etc. */
>               if (rcd->cnc) {
>                       ol_flags |= RTE_MBUF_F_RX_L4_CKSUM_UNKNOWN;
> +
> +                     if (rcd->v4) {
> +                             packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN;
> +                             if (rcd->tcp)
> +                                     packet_type |= RTE_PTYPE_L4_TCP;
> +                             else if (rcd->udp)
> +                                     packet_type |= RTE_PTYPE_L4_UDP;
> +                     } else if (rcd->v6) {
> +                             packet_type |= RTE_PTYPE_L3_IPV6_EXT_UNKNOWN;
> +                             if (rcd->tcp)
> +                                     packet_type |= RTE_PTYPE_L4_TCP;
> +                             else if (rcd->udp)
> +                                     packet_type |= RTE_PTYPE_L4_UDP;
> +                     } else {
> +                             packet_type |= RTE_PTYPE_UNKNOWN;
> +                     }
> +
>               } else {
>                       if (rcd->v4) {
>                               packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN;
  
Andrew Rybchenko May 5, 2022, 8:45 a.m. UTC | #3
Hi Pankaj,


On 5/4/22 23:40, Pankaj Gupta wrote:
>
> Hi Andrew,
>
> Packet type was not set for fragmented packets so we are trying to set 
> it in all possible scenarios.
>
> I believe TCP packets can be fragmented.
>

Theoretically it is possible, yes. OK, my main goal was to check that
we are really talking about L3 fragmentation, not scattering on Rx
and I've got the answer.

Thanks,
Andrew.
>
> Thanks,
>
> Pankaj
>
> *From: *Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> *Date: *Wednesday, May 4, 2022 at 8:08 AM
> *To: *Pankaj Gupta <pagupta@vmware.com>, Jochen Behrens 
> <jbehrens@vmware.com>, Yong Wang <yongwang@vmware.com>
> *Cc: *dev@dpdk.org <dev@dpdk.org>
> *Subject: *Re: [PATCH 7/8] vmxnet3: Set packet for fragmented packet
>
> ⚠External Email
>
> On 5/3/22 07:22, Pankaj Gupta wrote:
> > The packet type is set even if it is a fragmented packet
>
> I'm wondering if is really IPv4/IPv6 fragmented packets or just
> scattered on Rx across many Rx buffers.
> I'm asking since fragmented sounds weird with TCP, since TCP
> spec forbids fragmentation.
>
> >
> > Tested, using testpmd, for different hardware versions on
> > ESXi 7.0 Update 2.
> >
> > Signed-off-by: Pankaj Gupta <pagupta@vmware.com>
> > ---
> >   drivers/net/vmxnet3/vmxnet3_rxtx.c | 17 +++++++++++++++++
> >   1 file changed, 17 insertions(+)
> >
> > diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c 
> b/drivers/net/vmxnet3/vmxnet3_rxtx.c
> > index a6665fbf70..5e177400c0 100644
> > --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
> > +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
> > @@ -759,6 +759,23 @@ vmxnet3_rx_offload(struct vmxnet3_hw *hw, const 
> Vmxnet3_RxCompDesc *rcd,
> >               /* Check packet type, checksum errors, etc. */
> >               if (rcd->cnc) {
> >                       ol_flags |= RTE_MBUF_F_RX_L4_CKSUM_UNKNOWN;
> > +
> > +                     if (rcd->v4) {
> > +                             packet_type |= 
> RTE_PTYPE_L3_IPV4_EXT_UNKNOWN;
> > +                             if (rcd->tcp)
> > +                                     packet_type |= RTE_PTYPE_L4_TCP;
> > +                             else if (rcd->udp)
> > +                                     packet_type |= RTE_PTYPE_L4_UDP;
> > +                     } else if (rcd->v6) {
> > +                             packet_type |= 
> RTE_PTYPE_L3_IPV6_EXT_UNKNOWN;
> > +                             if (rcd->tcp)
> > +                                     packet_type |= RTE_PTYPE_L4_TCP;
> > +                             else if (rcd->udp)
> > +                                     packet_type |= RTE_PTYPE_L4_UDP;
> > +                     } else {
> > +                             packet_type |= RTE_PTYPE_UNKNOWN;
> > +                     }
> > +
> >               } else {
> >                       if (rcd->v4) {
> >                               packet_type |= 
> RTE_PTYPE_L3_IPV4_EXT_UNKNOWN;
>
>
> ________________________________
>
> ⚠External Email: This email originated from outside of the 
> organization. Do not click links or open attachments unless you 
> recognize the sender.
>
  

Patch

diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c
index a6665fbf70..5e177400c0 100644
--- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
+++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
@@ -759,6 +759,23 @@  vmxnet3_rx_offload(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd,
 		/* Check packet type, checksum errors, etc. */
 		if (rcd->cnc) {
 			ol_flags |= RTE_MBUF_F_RX_L4_CKSUM_UNKNOWN;
+
+			if (rcd->v4) {
+				packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN;
+				if (rcd->tcp)
+					packet_type |= RTE_PTYPE_L4_TCP;
+				else if (rcd->udp)
+					packet_type |= RTE_PTYPE_L4_UDP;
+			} else if (rcd->v6) {
+				packet_type |= RTE_PTYPE_L3_IPV6_EXT_UNKNOWN;
+				if (rcd->tcp)
+					packet_type |= RTE_PTYPE_L4_TCP;
+				else if (rcd->udp)
+					packet_type |= RTE_PTYPE_L4_UDP;
+			} else {
+				packet_type |= RTE_PTYPE_UNKNOWN;
+			}
+
 		} else {
 			if (rcd->v4) {
 				packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN;