DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/igc: fix Rx packet size error
@ 2021-04-16  1:14 Alvin Zhang
  2021-04-16  1:57 ` Wang, Haiyue
  2021-04-20  2:05 ` [dpdk-dev] [PATCH v2] " Alvin Zhang
  0 siblings, 2 replies; 8+ messages in thread
From: Alvin Zhang @ 2021-04-16  1:14 UTC (permalink / raw)
  To: haiyue.wang, jia.guo; +Cc: dev, Alvin Zhang, stable

When DEV_RX_OFFLOAD_KEEP_CRC is enabled, the PMD will minus 4 bytes
of CRC from the size of a packet, but the NIC will strip the CRC
because the CRC strip bit in DVMOLR register is not cleared. This
will cause the size of a packet to be 4 bytes less.

This patch updates the CRC strip bit according to whether
DEV_RX_OFFLOAD_KEEP_CRC is enabled.

Fixes: a5aeb2b9e225 ("net/igc: support Rx and Tx")
Cc: stable@dpdk.org

Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
---
 drivers/net/igc/igc_txrx.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/net/igc/igc_txrx.c b/drivers/net/igc/igc_txrx.c
index c0a5d5e..68b102d 100644
--- a/drivers/net/igc/igc_txrx.c
+++ b/drivers/net/igc/igc_txrx.c
@@ -1290,20 +1290,24 @@ int eth_igc_rx_descriptor_status(void *rx_queue, uint16_t offset)
 	 * This needs to be done after enable.
 	 */
 	for (i = 0; i < dev->data->nb_rx_queues; i++) {
+		uint32_t dvmolr;
+
 		rxq = dev->data->rx_queues[i];
 		IGC_WRITE_REG(hw, IGC_RDH(rxq->reg_idx), 0);
-		IGC_WRITE_REG(hw, IGC_RDT(rxq->reg_idx),
-				rxq->nb_rx_desc - 1);
+		IGC_WRITE_REG(hw, IGC_RDT(rxq->reg_idx), rxq->nb_rx_desc - 1);
+
+		dvmolr = IGC_READ_REG(hw, IGC_DVMOLR(rxq->queue_id));
 
 		/* strip queue vlan offload */
-		if (rxq->offloads & DEV_RX_OFFLOAD_VLAN_STRIP) {
-			uint32_t dvmolr;
-			dvmolr = IGC_READ_REG(hw, IGC_DVMOLR(rxq->queue_id));
+		dvmolr = (rxq->offloads & DEV_RX_OFFLOAD_VLAN_STRIP) ?
+			 (dvmolr | IGC_DVMOLR_STRVLAN) :
+			 (dvmolr & ~IGC_DVMOLR_STRVLAN);
 
-			/* If vlan been stripped off, the CRC is meaningless. */
-			dvmolr |= IGC_DVMOLR_STRVLAN | IGC_DVMOLR_STRCRC;
-			IGC_WRITE_REG(hw, IGC_DVMOLR(rxq->reg_idx), dvmolr);
-		}
+		dvmolr = (offloads & DEV_RX_OFFLOAD_KEEP_CRC) ?
+			 (dvmolr & ~IGC_DVMOLR_STRCRC) :
+			 (dvmolr | IGC_DVMOLR_STRCRC);
+
+		IGC_WRITE_REG(hw, IGC_DVMOLR(rxq->reg_idx), dvmolr);
 	}
 
 	return 0;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH] net/igc: fix Rx packet size error
  2021-04-16  1:14 [dpdk-dev] [PATCH] net/igc: fix Rx packet size error Alvin Zhang
@ 2021-04-16  1:57 ` Wang, Haiyue
  2021-04-19  7:14   ` Zhang, AlvinX
  2021-04-20  2:05 ` [dpdk-dev] [PATCH v2] " Alvin Zhang
  1 sibling, 1 reply; 8+ messages in thread
From: Wang, Haiyue @ 2021-04-16  1:57 UTC (permalink / raw)
  To: Zhang, AlvinX, Guo, Jia; +Cc: dev, stable

> -----Original Message-----
> From: Zhang, AlvinX <alvinx.zhang@intel.com>
> Sent: Friday, April 16, 2021 09:14
> To: Wang, Haiyue <haiyue.wang@intel.com>; Guo, Jia <jia.guo@intel.com>
> Cc: dev@dpdk.org; Zhang, AlvinX <alvinx.zhang@intel.com>; stable@dpdk.org
> Subject: [PATCH] net/igc: fix Rx packet size error
> 
> When DEV_RX_OFFLOAD_KEEP_CRC is enabled, the PMD will minus 4 bytes
> of CRC from the size of a packet, but the NIC will strip the CRC
> because the CRC strip bit in DVMOLR register is not cleared. This
> will cause the size of a packet to be 4 bytes less.
> 
> This patch updates the CRC strip bit according to whether
> DEV_RX_OFFLOAD_KEEP_CRC is enabled.
> 
> Fixes: a5aeb2b9e225 ("net/igc: support Rx and Tx")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
> ---
>  drivers/net/igc/igc_txrx.c | 22 +++++++++++++---------
>  1 file changed, 13 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/net/igc/igc_txrx.c b/drivers/net/igc/igc_txrx.c
> index c0a5d5e..68b102d 100644
> --- a/drivers/net/igc/igc_txrx.c
> +++ b/drivers/net/igc/igc_txrx.c
> @@ -1290,20 +1290,24 @@ int eth_igc_rx_descriptor_status(void *rx_queue, uint16_t offset)
>  	 * This needs to be done after enable.
>  	 */
>  	for (i = 0; i < dev->data->nb_rx_queues; i++) {
> +		uint32_t dvmolr;
> +
>  		rxq = dev->data->rx_queues[i];
>  		IGC_WRITE_REG(hw, IGC_RDH(rxq->reg_idx), 0);
> -		IGC_WRITE_REG(hw, IGC_RDT(rxq->reg_idx),
> -				rxq->nb_rx_desc - 1);
> +		IGC_WRITE_REG(hw, IGC_RDT(rxq->reg_idx), rxq->nb_rx_desc - 1);
> +
> +		dvmolr = IGC_READ_REG(hw, IGC_DVMOLR(rxq->queue_id));
> 
>  		/* strip queue vlan offload */
> -		if (rxq->offloads & DEV_RX_OFFLOAD_VLAN_STRIP) {
> -			uint32_t dvmolr;
> -			dvmolr = IGC_READ_REG(hw, IGC_DVMOLR(rxq->queue_id));
> +		dvmolr = (rxq->offloads & DEV_RX_OFFLOAD_VLAN_STRIP) ?
> +			 (dvmolr | IGC_DVMOLR_STRVLAN) :
> +			 (dvmolr & ~IGC_DVMOLR_STRVLAN);

Just use "if ... else .."to make code readable:

		if (rxq->offloads & DEV_RX_OFFLOAD_VLAN_STRIP)
			dvmolr |= IGC_DVMOLR_STRVLAN;
		else
			dvmolr &= ~IGC_DVMOLR_STRVLAN;


> 
> -			/* If vlan been stripped off, the CRC is meaningless. */

Looks like we need to handle CRC & VLAN_STRIP co-exist issue:
	If user enables VLAN strip, then keep CRC should be rejected,
	and vice versa.

> -			dvmolr |= IGC_DVMOLR_STRVLAN | IGC_DVMOLR_STRCRC;
> -			IGC_WRITE_REG(hw, IGC_DVMOLR(rxq->reg_idx), dvmolr);
> -		}
> +		dvmolr = (offloads & DEV_RX_OFFLOAD_KEEP_CRC) ?
> +			 (dvmolr & ~IGC_DVMOLR_STRCRC) :
> +			 (dvmolr | IGC_DVMOLR_STRCRC);

Just use "if ... else .."to make code readable:

		if (offloads & DEV_RX_OFFLOAD_KEEP_CRC)
			dvmolr &= ~IGC_DVMOLR_STRCRC;
		else
			dvmolr |= IGC_DVMOLR_STRCRC;

> +
> +		IGC_WRITE_REG(hw, IGC_DVMOLR(rxq->reg_idx), dvmolr);
>  	}
> 
>  	return 0;
> --
> 1.8.3.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH] net/igc: fix Rx packet size error
  2021-04-16  1:57 ` Wang, Haiyue
@ 2021-04-19  7:14   ` Zhang, AlvinX
  2021-04-19  7:43     ` Wang, Haiyue
  0 siblings, 1 reply; 8+ messages in thread
From: Zhang, AlvinX @ 2021-04-19  7:14 UTC (permalink / raw)
  To: Wang, Haiyue, Guo, Jia; +Cc: dev, stable

Hi Haiyue,

Thanks for your review.

> -----Original Message-----
> From: Wang, Haiyue <haiyue.wang@intel.com>
> Sent: Friday, April 16, 2021 9:57 AM
> To: Zhang, AlvinX <alvinx.zhang@intel.com>; Guo, Jia <jia.guo@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: RE: [PATCH] net/igc: fix Rx packet size error
> 
> > -----Original Message-----
> > From: Zhang, AlvinX <alvinx.zhang@intel.com>
> > Sent: Friday, April 16, 2021 09:14
> > To: Wang, Haiyue <haiyue.wang@intel.com>; Guo, Jia <jia.guo@intel.com>
> > Cc: dev@dpdk.org; Zhang, AlvinX <alvinx.zhang@intel.com>;
> > stable@dpdk.org
> > Subject: [PATCH] net/igc: fix Rx packet size error
> >
> > When DEV_RX_OFFLOAD_KEEP_CRC is enabled, the PMD will minus 4 bytes of
> > CRC from the size of a packet, but the NIC will strip the CRC because
> > the CRC strip bit in DVMOLR register is not cleared. This will cause
> > the size of a packet to be 4 bytes less.
> >
> > This patch updates the CRC strip bit according to whether
> > DEV_RX_OFFLOAD_KEEP_CRC is enabled.
> >
> > Fixes: a5aeb2b9e225 ("net/igc: support Rx and Tx")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
> > ---
> >  drivers/net/igc/igc_txrx.c | 22 +++++++++++++---------
> >  1 file changed, 13 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/net/igc/igc_txrx.c b/drivers/net/igc/igc_txrx.c
> > index c0a5d5e..68b102d 100644
> > --- a/drivers/net/igc/igc_txrx.c
> > +++ b/drivers/net/igc/igc_txrx.c
> > @@ -1290,20 +1290,24 @@ int eth_igc_rx_descriptor_status(void *rx_queue,
> uint16_t offset)
> >  	 * This needs to be done after enable.
> >  	 */
> >  	for (i = 0; i < dev->data->nb_rx_queues; i++) {
> > +		uint32_t dvmolr;
> > +
> >  		rxq = dev->data->rx_queues[i];
> >  		IGC_WRITE_REG(hw, IGC_RDH(rxq->reg_idx), 0);
> > -		IGC_WRITE_REG(hw, IGC_RDT(rxq->reg_idx),
> > -				rxq->nb_rx_desc - 1);
> > +		IGC_WRITE_REG(hw, IGC_RDT(rxq->reg_idx), rxq->nb_rx_desc - 1);
> > +
> > +		dvmolr = IGC_READ_REG(hw, IGC_DVMOLR(rxq->queue_id));
> >
> >  		/* strip queue vlan offload */
> > -		if (rxq->offloads & DEV_RX_OFFLOAD_VLAN_STRIP) {
> > -			uint32_t dvmolr;
> > -			dvmolr = IGC_READ_REG(hw, IGC_DVMOLR(rxq->queue_id));
> > +		dvmolr = (rxq->offloads & DEV_RX_OFFLOAD_VLAN_STRIP) ?
> > +			 (dvmolr | IGC_DVMOLR_STRVLAN) :
> > +			 (dvmolr & ~IGC_DVMOLR_STRVLAN);
> 
> Just use "if ... else .."to make code readable:
> 
> 		if (rxq->offloads & DEV_RX_OFFLOAD_VLAN_STRIP)
> 			dvmolr |= IGC_DVMOLR_STRVLAN;
> 		else
> 			dvmolr &= ~IGC_DVMOLR_STRVLAN;
> 
> 
> >
> > -			/* If vlan been stripped off, the CRC is meaningless. */
> 
> Looks like we need to handle CRC & VLAN_STRIP co-exist issue:
> 	If user enables VLAN strip, then keep CRC should be rejected,
> 	and vice versa.

By default, the DEV_RX_OFFLOAD_KEEP_CRC does not been set,
so if the user set the DEV_RX_OFFLOAD_KEEP_CRC and DEV_RX_OFFLOAD_VLAN_STRIP bits,
this means the user really need CRC and VLAN stripped off, although the CRC is meaningless at this situation.
So can we issue some warnings instead of changing the user's settings?

> 
> > -			dvmolr |= IGC_DVMOLR_STRVLAN | IGC_DVMOLR_STRCRC;
> > -			IGC_WRITE_REG(hw, IGC_DVMOLR(rxq->reg_idx), dvmolr);
> > -		}
> > +		dvmolr = (offloads & DEV_RX_OFFLOAD_KEEP_CRC) ?
> > +			 (dvmolr & ~IGC_DVMOLR_STRCRC) :
> > +			 (dvmolr | IGC_DVMOLR_STRCRC);
> 
> Just use "if ... else .."to make code readable:
> 
> 		if (offloads & DEV_RX_OFFLOAD_KEEP_CRC)
> 			dvmolr &= ~IGC_DVMOLR_STRCRC;
> 		else
> 			dvmolr |= IGC_DVMOLR_STRCRC;
> 
> > +
> > +		IGC_WRITE_REG(hw, IGC_DVMOLR(rxq->reg_idx), dvmolr);
> >  	}
> >
> >  	return 0;
> > --
> > 1.8.3.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH] net/igc: fix Rx packet size error
  2021-04-19  7:14   ` Zhang, AlvinX
@ 2021-04-19  7:43     ` Wang, Haiyue
  0 siblings, 0 replies; 8+ messages in thread
From: Wang, Haiyue @ 2021-04-19  7:43 UTC (permalink / raw)
  To: Zhang, AlvinX, Guo, Jia; +Cc: dev, stable

> -----Original Message-----
> From: Zhang, AlvinX <alvinx.zhang@intel.com>
> Sent: Monday, April 19, 2021 15:15
> To: Wang, Haiyue <haiyue.wang@intel.com>; Guo, Jia <jia.guo@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: RE: [PATCH] net/igc: fix Rx packet size error
> 
> Hi Haiyue,
> 
> Thanks for your review.
> 
> > -----Original Message-----
> > From: Wang, Haiyue <haiyue.wang@intel.com>
> > Sent: Friday, April 16, 2021 9:57 AM
> > To: Zhang, AlvinX <alvinx.zhang@intel.com>; Guo, Jia <jia.guo@intel.com>
> > Cc: dev@dpdk.org; stable@dpdk.org
> > Subject: RE: [PATCH] net/igc: fix Rx packet size error
> >
> > > -----Original Message-----
> > > From: Zhang, AlvinX <alvinx.zhang@intel.com>
> > > Sent: Friday, April 16, 2021 09:14
> > > To: Wang, Haiyue <haiyue.wang@intel.com>; Guo, Jia <jia.guo@intel.com>
> > > Cc: dev@dpdk.org; Zhang, AlvinX <alvinx.zhang@intel.com>;
> > > stable@dpdk.org
> > > Subject: [PATCH] net/igc: fix Rx packet size error
> > >
> > > When DEV_RX_OFFLOAD_KEEP_CRC is enabled, the PMD will minus 4 bytes of
> > > CRC from the size of a packet, but the NIC will strip the CRC because
> > > the CRC strip bit in DVMOLR register is not cleared. This will cause
> > > the size of a packet to be 4 bytes less.
> > >
> > > This patch updates the CRC strip bit according to whether
> > > DEV_RX_OFFLOAD_KEEP_CRC is enabled.
> > >
> > > Fixes: a5aeb2b9e225 ("net/igc: support Rx and Tx")
> > > Cc: stable@dpdk.org
> > >
> > > Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
> > > ---
> > >  drivers/net/igc/igc_txrx.c | 22 +++++++++++++---------
> > >  1 file changed, 13 insertions(+), 9 deletions(-)
> > >
> > > diff --git a/drivers/net/igc/igc_txrx.c b/drivers/net/igc/igc_txrx.c
> > > index c0a5d5e..68b102d 100644
> > > --- a/drivers/net/igc/igc_txrx.c
> > > +++ b/drivers/net/igc/igc_txrx.c
> > > @@ -1290,20 +1290,24 @@ int eth_igc_rx_descriptor_status(void *rx_queue,
> > uint16_t offset)
> > >  	 * This needs to be done after enable.
> > >  	 */
> > >  	for (i = 0; i < dev->data->nb_rx_queues; i++) {
> > > +		uint32_t dvmolr;
> > > +
> > >  		rxq = dev->data->rx_queues[i];
> > >  		IGC_WRITE_REG(hw, IGC_RDH(rxq->reg_idx), 0);
> > > -		IGC_WRITE_REG(hw, IGC_RDT(rxq->reg_idx),
> > > -				rxq->nb_rx_desc - 1);
> > > +		IGC_WRITE_REG(hw, IGC_RDT(rxq->reg_idx), rxq->nb_rx_desc - 1);
> > > +
> > > +		dvmolr = IGC_READ_REG(hw, IGC_DVMOLR(rxq->queue_id));
> > >
> > >  		/* strip queue vlan offload */
> > > -		if (rxq->offloads & DEV_RX_OFFLOAD_VLAN_STRIP) {
> > > -			uint32_t dvmolr;
> > > -			dvmolr = IGC_READ_REG(hw, IGC_DVMOLR(rxq->queue_id));
> > > +		dvmolr = (rxq->offloads & DEV_RX_OFFLOAD_VLAN_STRIP) ?
> > > +			 (dvmolr | IGC_DVMOLR_STRVLAN) :
> > > +			 (dvmolr & ~IGC_DVMOLR_STRVLAN);
> >
> > Just use "if ... else .."to make code readable:
> >
> > 		if (rxq->offloads & DEV_RX_OFFLOAD_VLAN_STRIP)
> > 			dvmolr |= IGC_DVMOLR_STRVLAN;
> > 		else
> > 			dvmolr &= ~IGC_DVMOLR_STRVLAN;
> >
> >
> > >
> > > -			/* If vlan been stripped off, the CRC is meaningless. */
> >
> > Looks like we need to handle CRC & VLAN_STRIP co-exist issue:
> > 	If user enables VLAN strip, then keep CRC should be rejected,
> > 	and vice versa.
> 
> By default, the DEV_RX_OFFLOAD_KEEP_CRC does not been set,
> so if the user set the DEV_RX_OFFLOAD_KEEP_CRC and DEV_RX_OFFLOAD_VLAN_STRIP bits,
> this means the user really need CRC and VLAN stripped off, although the CRC is meaningless at this
> situation.
> So can we issue some warnings instead of changing the user's settings?

I re-think it again, no need to handle this now, until user complains about something.

Let's just fix the code style issue. ;-)

> 
> >
> > > -			dvmolr |= IGC_DVMOLR_STRVLAN | IGC_DVMOLR_STRCRC;
> > > -			IGC_WRITE_REG(hw, IGC_DVMOLR(rxq->reg_idx), dvmolr);
> > > -		}
> > > +		dvmolr = (offloads & DEV_RX_OFFLOAD_KEEP_CRC) ?
> > > +			 (dvmolr & ~IGC_DVMOLR_STRCRC) :
> > > +			 (dvmolr | IGC_DVMOLR_STRCRC);
> >
> > Just use "if ... else .."to make code readable:
> >
> > 		if (offloads & DEV_RX_OFFLOAD_KEEP_CRC)
> > 			dvmolr &= ~IGC_DVMOLR_STRCRC;
> > 		else
> > 			dvmolr |= IGC_DVMOLR_STRCRC;
> >
> > > +
> > > +		IGC_WRITE_REG(hw, IGC_DVMOLR(rxq->reg_idx), dvmolr);
> > >  	}
> > >
> > >  	return 0;
> > > --
> > > 1.8.3.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH v2] net/igc: fix Rx packet size error
  2021-04-16  1:14 [dpdk-dev] [PATCH] net/igc: fix Rx packet size error Alvin Zhang
  2021-04-16  1:57 ` Wang, Haiyue
@ 2021-04-20  2:05 ` Alvin Zhang
  2021-04-20  2:31   ` Wang, Haiyue
  2021-04-20  9:10   ` Chen, LingliX
  1 sibling, 2 replies; 8+ messages in thread
From: Alvin Zhang @ 2021-04-20  2:05 UTC (permalink / raw)
  To: haiyue.wang, jia.guo; +Cc: dev, Alvin Zhang, stable

When DEV_RX_OFFLOAD_KEEP_CRC is enabled, the PMD will minus 4 bytes
of CRC from the size of a packet, but the NIC will strip the CRC
because the CRC strip bit in DVMOLR register is not cleared. This
will cause the size of a packet to be 4 bytes less.

This patch updates the CRC strip bit according to whether
DEV_RX_OFFLOAD_KEEP_CRC is enabled.

Fixes: a5aeb2b9e225 ("net/igc: support Rx and Tx")
Cc: stable@dpdk.org

Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
---

v2: Refine the codes.
---
 drivers/net/igc/igc_txrx.c | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/drivers/net/igc/igc_txrx.c b/drivers/net/igc/igc_txrx.c
index 8eaed72..b5489ee 100644
--- a/drivers/net/igc/igc_txrx.c
+++ b/drivers/net/igc/igc_txrx.c
@@ -1291,20 +1291,24 @@ int eth_igc_rx_descriptor_status(void *rx_queue, uint16_t offset)
 	 * This needs to be done after enable.
 	 */
 	for (i = 0; i < dev->data->nb_rx_queues; i++) {
+		uint32_t dvmolr;
+
 		rxq = dev->data->rx_queues[i];
 		IGC_WRITE_REG(hw, IGC_RDH(rxq->reg_idx), 0);
-		IGC_WRITE_REG(hw, IGC_RDT(rxq->reg_idx),
-				rxq->nb_rx_desc - 1);
+		IGC_WRITE_REG(hw, IGC_RDT(rxq->reg_idx), rxq->nb_rx_desc - 1);
 
-		/* strip queue vlan offload */
-		if (rxq->offloads & DEV_RX_OFFLOAD_VLAN_STRIP) {
-			uint32_t dvmolr;
-			dvmolr = IGC_READ_REG(hw, IGC_DVMOLR(rxq->queue_id));
+		dvmolr = IGC_READ_REG(hw, IGC_DVMOLR(rxq->reg_idx));
+		if (rxq->offloads & DEV_RX_OFFLOAD_VLAN_STRIP)
+			dvmolr |= IGC_DVMOLR_STRVLAN;
+		else
+			dvmolr &= ~IGC_DVMOLR_STRVLAN;
 
-			/* If vlan been stripped off, the CRC is meaningless. */
-			dvmolr |= IGC_DVMOLR_STRVLAN | IGC_DVMOLR_STRCRC;
-			IGC_WRITE_REG(hw, IGC_DVMOLR(rxq->reg_idx), dvmolr);
-		}
+		if (offloads & DEV_RX_OFFLOAD_KEEP_CRC)
+			dvmolr &= ~IGC_DVMOLR_STRCRC;
+		else
+			dvmolr |= IGC_DVMOLR_STRCRC;
+
+		IGC_WRITE_REG(hw, IGC_DVMOLR(rxq->reg_idx), dvmolr);
 	}
 
 	return 0;
@@ -2267,12 +2271,10 @@ int eth_igc_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 
 	reg_val = IGC_READ_REG(hw, IGC_DVMOLR(rx_queue_id));
 	if (on) {
-		/* If vlan been stripped off, the CRC is meaningless. */
-		reg_val |= IGC_DVMOLR_STRVLAN | IGC_DVMOLR_STRCRC;
+		reg_val |= IGC_DVMOLR_STRVLAN;
 		rxq->offloads |= DEV_RX_OFFLOAD_VLAN_STRIP;
 	} else {
-		reg_val &= ~(IGC_DVMOLR_STRVLAN | IGC_DVMOLR_HIDVLAN |
-				IGC_DVMOLR_STRCRC);
+		reg_val &= ~(IGC_DVMOLR_STRVLAN | IGC_DVMOLR_HIDVLAN);
 		rxq->offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP;
 	}
 
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net/igc: fix Rx packet size error
  2021-04-20  2:05 ` [dpdk-dev] [PATCH v2] " Alvin Zhang
@ 2021-04-20  2:31   ` Wang, Haiyue
  2021-04-21 11:46     ` Zhang, Qi Z
  2021-04-20  9:10   ` Chen, LingliX
  1 sibling, 1 reply; 8+ messages in thread
From: Wang, Haiyue @ 2021-04-20  2:31 UTC (permalink / raw)
  To: Zhang, AlvinX, Guo, Jia; +Cc: dev, stable

> -----Original Message-----
> From: Zhang, AlvinX <alvinx.zhang@intel.com>
> Sent: Tuesday, April 20, 2021 10:05
> To: Wang, Haiyue <haiyue.wang@intel.com>; Guo, Jia <jia.guo@intel.com>
> Cc: dev@dpdk.org; Zhang, AlvinX <alvinx.zhang@intel.com>; stable@dpdk.org
> Subject: [PATCH v2] net/igc: fix Rx packet size error
> 
> When DEV_RX_OFFLOAD_KEEP_CRC is enabled, the PMD will minus 4 bytes
> of CRC from the size of a packet, but the NIC will strip the CRC
> because the CRC strip bit in DVMOLR register is not cleared. This
> will cause the size of a packet to be 4 bytes less.
> 
> This patch updates the CRC strip bit according to whether
> DEV_RX_OFFLOAD_KEEP_CRC is enabled.
> 
> Fixes: a5aeb2b9e225 ("net/igc: support Rx and Tx")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
> ---
> 
> v2: Refine the codes.
> ---
>  drivers/net/igc/igc_txrx.c | 30 ++++++++++++++++--------------
>  1 file changed, 16 insertions(+), 14 deletions(-)
> 

Acked-by: Haiyue Wang <haiyue.wang@intel.com>

> --
> 1.8.3.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net/igc: fix Rx packet size error
  2021-04-20  2:05 ` [dpdk-dev] [PATCH v2] " Alvin Zhang
  2021-04-20  2:31   ` Wang, Haiyue
@ 2021-04-20  9:10   ` Chen, LingliX
  1 sibling, 0 replies; 8+ messages in thread
From: Chen, LingliX @ 2021-04-20  9:10 UTC (permalink / raw)
  To: Zhang, AlvinX, Wang, Haiyue, Guo, Jia; +Cc: dev, Zhang, AlvinX, stable


> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Alvin Zhang
> Sent: Tuesday, April 20, 2021 10:05 AM
> To: Wang, Haiyue <haiyue.wang@intel.com>; Guo, Jia <jia.guo@intel.com>
> Cc: dev@dpdk.org; Zhang, AlvinX <alvinx.zhang@intel.com>; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH v2] net/igc: fix Rx packet size error
> 
> When DEV_RX_OFFLOAD_KEEP_CRC is enabled, the PMD will minus 4 bytes of
> CRC from the size of a packet, but the NIC will strip the CRC because the CRC
> strip bit in DVMOLR register is not cleared. This will cause the size of a packet
> to be 4 bytes less.
> 
> This patch updates the CRC strip bit according to whether
> DEV_RX_OFFLOAD_KEEP_CRC is enabled.
> 
> Fixes: a5aeb2b9e225 ("net/igc: support Rx and Tx")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>

Tested-by: Lingli Chen <linglix.chen@intel.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net/igc: fix Rx packet size error
  2021-04-20  2:31   ` Wang, Haiyue
@ 2021-04-21 11:46     ` Zhang, Qi Z
  0 siblings, 0 replies; 8+ messages in thread
From: Zhang, Qi Z @ 2021-04-21 11:46 UTC (permalink / raw)
  To: Wang, Haiyue, Zhang, AlvinX, Guo, Jia; +Cc: dev, stable



> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Wang, Haiyue
> Sent: Tuesday, April 20, 2021 10:31 AM
> To: Zhang, AlvinX <alvinx.zhang@intel.com>; Guo, Jia <jia.guo@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v2] net/igc: fix Rx packet size error
> 
> > -----Original Message-----
> > From: Zhang, AlvinX <alvinx.zhang@intel.com>
> > Sent: Tuesday, April 20, 2021 10:05
> > To: Wang, Haiyue <haiyue.wang@intel.com>; Guo, Jia <jia.guo@intel.com>
> > Cc: dev@dpdk.org; Zhang, AlvinX <alvinx.zhang@intel.com>;
> > stable@dpdk.org
> > Subject: [PATCH v2] net/igc: fix Rx packet size error
> >
> > When DEV_RX_OFFLOAD_KEEP_CRC is enabled, the PMD will minus 4 bytes
> of
> > CRC from the size of a packet, but the NIC will strip the CRC because
> > the CRC strip bit in DVMOLR register is not cleared. This will cause
> > the size of a packet to be 4 bytes less.
> >
> > This patch updates the CRC strip bit according to whether
> > DEV_RX_OFFLOAD_KEEP_CRC is enabled.
> >
> > Fixes: a5aeb2b9e225 ("net/igc: support Rx and Tx")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
> > ---
> >
> > v2: Refine the codes.
> > ---
> >  drivers/net/igc/igc_txrx.c | 30 ++++++++++++++++--------------
> >  1 file changed, 16 insertions(+), 14 deletions(-)
> >
> 
> Acked-by: Haiyue Wang <haiyue.wang@intel.com>
> 
> > --
> > 1.8.3.1

Applied to dpdk-next-net-intel.

Thanks
Qi


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-04-21 11:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-16  1:14 [dpdk-dev] [PATCH] net/igc: fix Rx packet size error Alvin Zhang
2021-04-16  1:57 ` Wang, Haiyue
2021-04-19  7:14   ` Zhang, AlvinX
2021-04-19  7:43     ` Wang, Haiyue
2021-04-20  2:05 ` [dpdk-dev] [PATCH v2] " Alvin Zhang
2021-04-20  2:31   ` Wang, Haiyue
2021-04-21 11:46     ` Zhang, Qi Z
2021-04-20  9:10   ` Chen, LingliX

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).