Skip to contentSkip to conversation

net/igc: fix Rx packet size error

PATCH Superseded Alvin Zhang 4 participants 8 messages Apr 16, 2021 – Apr 21, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
---
 drivers/net/igc/igc_txrx.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)
drivers/net/igc/igc_txrx.c +13 -9
index c0a5d5e..68b102d 100644
@@ -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;
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 38 lines

-----Original Message-----
From: Zhang, AlvinX <[email protected]>
Sent: Friday, April 16, 2021 09:14
To: Wang, Haiyue <[email protected]>; Guo, Jia <[email protected]>
Cc: [email protected]; Zhang, AlvinX <[email protected]>; [email protected]
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")
---
 drivers/net/igc/igc_txrx.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)
drivers/net/igc/igc_txrx.c +3 -2
index c0a5d5e..68b102d 100644
@@ -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);

drivers/net/igc/igc_txrx.c int eth_igc_rx_descriptor_status(void *rx_queue, uint16_t offset) · line 1304

Quoted 10 lines
drivers/net/igc/igc_txrx.c +5 -3
+
+		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;

drivers/net/igc/igc_txrx.c int eth_igc_rx_descriptor_status(void *rx_queue, uint16_t offset) · line 1303

Quoted 2 lines
drivers/net/igc/igc_txrx.c +0 -1
-			/* 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.

drivers/net/igc/igc_txrx.c int eth_igc_rx_descriptor_status(void *rx_queue, uint16_t offset) · line 1308

Quoted 6 lines
drivers/net/igc/igc_txrx.c +3 -3
-			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;
Quoted 7 lines
drivers/net/igc/igc_txrx.c +2 -1
+
+		IGC_WRITE_REG(hw, IGC_DVMOLR(rxq->reg_idx), dvmolr);
 	}
 
 	return 0;
--

1.8.3.1

#2 lore raw

Hi Haiyue,

Thanks for your review.

Quoted 67 lines

-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Friday, April 16, 2021 9:57 AM
To: Zhang, AlvinX <[email protected]>; Guo, Jia <[email protected]>
Cc: [email protected]; [email protected]
Subject: RE: [PATCH] net/igc: fix Rx packet size error

drivers/net/igc/igc_txrx.c int eth_igc_rx_descriptor_status(void *rx_queue,

Quoted 29 lines

-----Original Message-----
From: Zhang, AlvinX <[email protected]>
Sent: Friday, April 16, 2021 09:14
To: Wang, Haiyue <[email protected]>; Guo, Jia <[email protected]>
Cc: [email protected]; Zhang, AlvinX <[email protected]>; [email protected]
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")
---
 drivers/net/igc/igc_txrx.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)
drivers/net/igc/igc_txrx.c +0 -0
index c0a5d5e..68b102d 100644
@@ -1290,20 +1290,24 @@ int eth_igc_rx_descriptor_status(void *rx_queue,

uint16_t offset)

Quoted 10 lines
drivers/net/igc/igc_txrx.c +3 -2
 	 * 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);

drivers/net/igc/igc_txrx.c int eth_igc_rx_descriptor_status(void *rx_queue, uint16_t offset) · line 1304

Quoted 10 lines
drivers/net/igc/igc_txrx.c +5 -3
+
+		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;
Quoted 1 line
Quoted 5 lines

drivers/net/igc/igc_txrx.c int eth_igc_rx_descriptor_status(void *rx_queue, uint16_t offset) · line 1303

Quoted 1 line
drivers/net/igc/igc_txrx.c +0 -1
-			/* 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?

Quoted 22 lines

drivers/net/igc/igc_txrx.c int eth_igc_rx_descriptor_status(void *rx_queue, uint16_t offset) · line 1308

Quoted 7 lines
drivers/net/igc/igc_txrx.c +3 -3
-			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;
Quoted 7 lines
drivers/net/igc/igc_txrx.c +2 -1
+
+		IGC_WRITE_REG(hw, IGC_DVMOLR(rxq->reg_idx), dvmolr);
 	}
 
 	return 0;
--

1.8.3.1

#3 lore raw
Quoted 84 lines

-----Original Message-----
From: Zhang, AlvinX <[email protected]>
Sent: Monday, April 19, 2021 15:15
To: Wang, Haiyue <[email protected]>; Guo, Jia <[email protected]>
Cc: [email protected]; [email protected]
Subject: RE: [PATCH] net/igc: fix Rx packet size error

Hi Haiyue,

Thanks for your review.

Quoted 67 lines

-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Friday, April 16, 2021 9:57 AM
To: Zhang, AlvinX <[email protected]>; Guo, Jia <[email protected]>
Cc: [email protected]; [email protected]
Subject: RE: [PATCH] net/igc: fix Rx packet size error

drivers/net/igc/igc_txrx.c int eth_igc_rx_descriptor_status(void *rx_queue,

Quoted 29 lines

-----Original Message-----
From: Zhang, AlvinX <[email protected]>
Sent: Friday, April 16, 2021 09:14
To: Wang, Haiyue <[email protected]>; Guo, Jia <[email protected]>
Cc: [email protected]; Zhang, AlvinX <[email protected]>; [email protected]
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")
---
 drivers/net/igc/igc_txrx.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)
drivers/net/igc/igc_txrx.c +0 -0
index c0a5d5e..68b102d 100644
@@ -1290,20 +1290,24 @@ int eth_igc_rx_descriptor_status(void *rx_queue,

uint16_t offset)

Quoted 10 lines
drivers/net/igc/igc_txrx.c +3 -2
 	 * 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);

drivers/net/igc/igc_txrx.c int eth_igc_rx_descriptor_status(void *rx_queue, uint16_t offset) · line 1304

Quoted 10 lines
drivers/net/igc/igc_txrx.c +5 -3
+
+		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;
Quoted 1 line
Quoted 5 lines

drivers/net/igc/igc_txrx.c int eth_igc_rx_descriptor_status(void *rx_queue, uint16_t offset) · line 1303

Quoted 1 line
drivers/net/igc/igc_txrx.c +0 -1
-			/* 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.

Quoted 5 lines

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. ;-)

Quoted 23 lines
Quoted 23 lines

drivers/net/igc/igc_txrx.c int eth_igc_rx_descriptor_status(void *rx_queue, uint16_t offset) · line 1308

Quoted 8 lines
drivers/net/igc/igc_txrx.c +3 -3
-			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;
Quoted 7 lines
drivers/net/igc/igc_txrx.c +2 -1
+
+		IGC_WRITE_REG(hw, IGC_DVMOLR(rxq->reg_idx), dvmolr);
 	}
 
 	return 0;
--

1.8.3.1

#4 lore raw

PATCH v2 1/1 net/igc: fix Rx packet size error

In reply to Alvin Zhang

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")

---

v2: Refine the codes.

---
 drivers/net/igc/igc_txrx.c | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)
drivers/net/igc/igc_txrx.c +16 -14
index 8eaed72..b5489ee 100644
@@ -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;
 	}
 
Signature · 1 line
1.8.3.1
Acked-by on v2 1/1
#5 lore raw
Quoted 18 lines

-----Original Message-----
From: Zhang, AlvinX <[email protected]>
Sent: Tuesday, April 20, 2021 10:05
To: Wang, Haiyue <[email protected]>; Guo, Jia <[email protected]>
Cc: [email protected]; Zhang, AlvinX <[email protected]>; [email protected]
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")
Quoted 8 lines

---

v2: Refine the codes.

---
 drivers/net/igc/igc_txrx.c | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)
Quoted 2 lines

--
1.8.3.1

Applied
#6 lore raw
Quoted 32 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Wang, Haiyue
Sent: Tuesday, April 20, 2021 10:31 AM
To: Zhang, AlvinX <[email protected]>; Guo, Jia <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] net/igc: fix Rx packet size error

Quoted 9 lines

-----Original Message-----
From: Zhang, AlvinX <[email protected]>
Sent: Tuesday, April 20, 2021 10:05
To: Wang, Haiyue <[email protected]>; Guo, Jia <[email protected]>
Cc: [email protected]; Zhang, AlvinX <[email protected]>; [email protected]
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

Quoted 13 lines

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")

---

Quoted 10 lines
Quoted 5 lines

v2: Refine the codes.

---
 drivers/net/igc/igc_txrx.c | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)
Quoted 2 lines

--
1.8.3.1

Applied to dpdk-next-net-intel.

Thanks
Qi

Tested-by on v2 1/1
#7 lore raw
In reply to Alvin Zhang
Quoted 13 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Alvin Zhang
Sent: Tuesday, April 20, 2021 10:05 AM
To: Wang, Haiyue <[email protected]>; Guo, Jia <[email protected]>
Cc: [email protected]; Zhang, AlvinX <[email protected]>; [email protected]
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.

Quoted 7 lines

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")