Skip to contentSkip to conversation

This series adds the missing flow for enabling the LRO in the ethdev and

PATCH Superseded Vlad Zolotarov 4 participants 18 messages Mar 9, 2015 13 messages not in the archive

v5 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

v5 cover This series adds the missing flow for enabling the LRO in the ethdev and

The series starts with some cleanup work in the code the final patch (the actual adding of the LRO support) is going to touch/use/change. There are still quite a few issues in the ixgbe PMD code left but they have to be a matter of a different series and I've left a few "TODO" remarks in the code.

The LRO ("RSC" in Intel's context) PMD completion handling code follows the same design as the corresponding Linux and FreeBSD implementation: pass the aggregation's cluster HEAD buffer to the NEXTP entry of the software ring till EOP is met.

HW configuration follows the corresponding specs: this feature is supported only by x540 and 82599 PF devices.

The feature has been tested with seastar TCP stack with the following configuration on Tx side:
- MTU: 400B
- 100 concurrent TCP connections.

The results were:
- Without LRO: total throughput: 0.12Gbps, coefficient of variance: 1.41%
- With LRO: total throughput: 8.21Gbps, coefficient of variance: 0.59%

This is an almost factor 80 improvement.

New in v5:
- Split the series into "bug fixes" and "all the rest" so that the former could be integrated into a 2.0 release.
- Put the RTE_ETHDEV_HAS_LRO_SUPPORT definition at the beginning of rte_ethdev.h.
- Removed the "TODO: Remove me" comment near RTE_ETHDEV_HAS_LRO_SUPPORT.

New in v4:
- Remove CONFIG_RTE_ETHDEV_LRO_SUPPORT from config/common_linuxapp.
- Define RTE_ETHDEV_HAS_LRO_SUPPORT in rte_ethdev.h.
- As a result of "ixgbe: check rxd number to avoid mbuf leak" (352078e8e) Vector Rx had to get the same treatment as Rx Bulk Alloc (see PATCH4 for more details).

New in v3:
- ixgbe_rx_alloc_bufs(): Always reset refcnt of the buffers to 1. Otherwise rte_pktmbuf_free() won't free them.

New in v2:
- Removed rte_eth_dev_data.lro_bulk_alloc and added ixgbe_hw.rx_bulk_alloc_allowed instead.
- Unified the rx_pkt_bulk callback setting (a separate new patch).
- Fixed a few styling and spelling issues.

Vlad Zolotarov (3):
ixgbe: Cleanups
ixgbe: Code refactoring
ixgbe: Add LRO support

 lib/librte_ether/rte_ethdev.h       |   9 +-
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c |   6 +
 lib/librte_pmd_ixgbe/ixgbe_ethdev.h |   5 +
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c   | 703 ++++++++++++++++++++++++++++++++----
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h   |   6 +
 5 files changed, 662 insertions(+), 67 deletions(-)
Signature · 1 line
2.1.0

A message that is not in the archive (sent off-list or not yet received): 1425896433-12452-1-git-send-email-vladz-RmZWMc9puTNJc61us3aD9laTQe2KTcn/@public.gmane.org

#2 lore raw

PATCH v5 1/3 ixgbe: Cleanups

- Removed the not needed casting.
- ixgbe_dev_rx_init(): shorten the lines by defining a local alias variable to access

                          &dev->data->dev_conf.rxmode.
---
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 27 ++++++++++++---------------
 1 file changed, 12 insertions(+), 15 deletions(-)
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +12 -15
index 72c65df..609b5fd 100644
@@ -1032,8 +1032,7 @@ ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq)
 	int diag, i;
 
 	/* allocate buffers in bulk directly into the S/W ring */
-	alloc_idx = (uint16_t)(rxq->rx_free_trigger -
-				(rxq->rx_free_thresh - 1));
+	alloc_idx = rxq->rx_free_trigger - (rxq->rx_free_thresh - 1);
 	rxep = &rxq->sw_ring[alloc_idx];
 	diag = rte_mempool_get_bulk(rxq->mb_pool, (void *)rxep,
 				    rxq->rx_free_thresh);
@@ -1061,10 +1060,9 @@ ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq)
 	IXGBE_PCI_REG_WRITE(rxq->rdt_reg_addr, rxq->rx_free_trigger);
 
 	/* update state of internal queue structure */
-	rxq->rx_free_trigger = (uint16_t)(rxq->rx_free_trigger +
-						rxq->rx_free_thresh);
+	rxq->rx_free_trigger = rxq->rx_free_trigger + rxq->rx_free_thresh;
 	if (rxq->rx_free_trigger >= rxq->nb_rx_desc)
-		rxq->rx_free_trigger = (uint16_t)(rxq->rx_free_thresh - 1);
+		rxq->rx_free_trigger = rxq->rx_free_thresh - 1;
 
 	/* no errors */
 	return 0;
@@ -3560,6 +3558,7 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
 	uint32_t rxcsum;
 	uint16_t buf_size;
 	uint16_t i;
+	struct rte_eth_rxmode *rx_conf = &dev->data->dev_conf.rxmode;
 
 	PMD_INIT_FUNC_TRACE();
 	hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -3582,7 +3581,7 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
 	 * Configure CRC stripping, if any.
 	 */
 	hlreg0 = IXGBE_READ_REG(hw, IXGBE_HLREG0);
-	if (dev->data->dev_conf.rxmode.hw_strip_crc)
+	if (rx_conf->hw_strip_crc)
 		hlreg0 |= IXGBE_HLREG0_RXCRCSTRP;
 	else
 		hlreg0 &= ~IXGBE_HLREG0_RXCRCSTRP;
@@ -3590,11 +3589,11 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
 	/*
 	 * Configure jumbo frame support, if any.
 	 */
-	if (dev->data->dev_conf.rxmode.jumbo_frame == 1) {
+	if (rx_conf->jumbo_frame == 1) {
 		hlreg0 |= IXGBE_HLREG0_JUMBOEN;
 		maxfrs = IXGBE_READ_REG(hw, IXGBE_MAXFRS);
 		maxfrs &= 0x0000FFFF;
-		maxfrs |= (dev->data->dev_conf.rxmode.max_rx_pkt_len << 16);
+		maxfrs |= (rx_conf->max_rx_pkt_len << 16);
 		IXGBE_WRITE_REG(hw, IXGBE_MAXFRS, maxfrs);
 	} else
 		hlreg0 &= ~IXGBE_HLREG0_JUMBOEN;
@@ -3618,9 +3617,7 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
 		 * Reset crc_len in case it was changed after queue setup by a
 		 * call to configure.
 		 */
-		rxq->crc_len = (uint8_t)
-				((dev->data->dev_conf.rxmode.hw_strip_crc) ? 0 :
-				ETHER_CRC_LEN);
+		rxq->crc_len = rx_conf->hw_strip_crc ? 0 : ETHER_CRC_LEN;
 
 		/* Setup the Base and Length of the Rx Descriptor Rings */
 		bus_addr = rxq->rx_ring_phys_addr;
@@ -3638,7 +3635,7 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
 		/*
 		 * Configure Header Split
 		 */
-		if (dev->data->dev_conf.rxmode.header_split) {
+		if (rx_conf->header_split) {
 			if (hw->mac.type == ixgbe_mac_82599EB) {
 				/* Must setup the PSRTYPE register */
 				uint32_t psrtype;
@@ -3648,7 +3645,7 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
 					IXGBE_PSRTYPE_IPV6HDR;
 				IXGBE_WRITE_REG(hw, IXGBE_PSRTYPE(rxq->reg_idx), psrtype);
 			}
-			srrctl = ((dev->data->dev_conf.rxmode.split_hdr_size <<
+			srrctl = ((rx_conf->split_hdr_size <<
 				IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT) &
 				IXGBE_SRRCTL_BSIZEHDR_MASK);
 			srrctl |= IXGBE_SRRCTL_DESCTYPE_HDR_SPLIT_ALWAYS;
@@ -3699,7 +3696,7 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
 	 */
 	rxcsum = IXGBE_READ_REG(hw, IXGBE_RXCSUM);
 	rxcsum |= IXGBE_RXCSUM_PCSD;
-	if (dev->data->dev_conf.rxmode.hw_ip_checksum)
+	if (rx_conf->hw_ip_checksum)
 		rxcsum |= IXGBE_RXCSUM_IPPCSE;
 	else
 		rxcsum &= ~IXGBE_RXCSUM_IPPCSE;
@@ -3709,7 +3706,7 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
 	if (hw->mac.type == ixgbe_mac_82599EB ||
 	    hw->mac.type == ixgbe_mac_X540) {
 		rdrxctl = IXGBE_READ_REG(hw, IXGBE_RDRXCTL);
-		if (dev->data->dev_conf.rxmode.hw_strip_crc)
+		if (rx_conf->hw_strip_crc)
 			rdrxctl |= IXGBE_RDRXCTL_CRCSTRIP;
 		else
 			rdrxctl &= ~IXGBE_RDRXCTL_CRCSTRIP;
Signature · 1 line
2.1.0

A message that is not in the archive (sent off-list or not yet received): 1425896433-12452-2-git-send-email-vladz-RmZWMc9puTNJc61us3aD9laTQe2KTcn/@public.gmane.org

#4 lore raw

Re: [PATCH v5 1/3] ixgbe: Cleanups

Quoted 22 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Vlad Zolotarov
Sent: Monday, March 09, 2015 10:21 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH v5 1/3] ixgbe: Cleanups

- Removed the not needed casting.
- ixgbe_dev_rx_init(): shorten the lines by defining a local alias variable to access

                          &dev->data->dev_conf.rxmode.
---
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 27 ++++++++++++---------------
 1 file changed, 12 insertions(+), 15 deletions(-)
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +0 -0
index 72c65df..609b5fd 100644

lib/librte_pmd_ixgbe/ixgbe_rxtx.c ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq) · line 1035

Quoted 6 lines
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +1 -2
@@ -1032,8 +1032,7 @@ ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq)
 	int diag, i;
 
 	/* allocate buffers in bulk directly into the S/W ring */
-	alloc_idx = (uint16_t)(rxq->rx_free_trigger -
-				(rxq->rx_free_thresh - 1));
+	alloc_idx = rxq->rx_free_trigger - (rxq->rx_free_thresh - 1);

I think all these extra casts came in to keep icc 12.* compiling without warnings. I am agree that they are unnecessary.
Though if we still have to support icc 12.* we either need to keep them, or find some other way to keep it happy.
Konstantin

Quoted 96 lines
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +11 -14
 	rxep = &rxq->sw_ring[alloc_idx];
 	diag = rte_mempool_get_bulk(rxq->mb_pool, (void *)rxep,
 				    rxq->rx_free_thresh);
@@ -1061,10 +1060,9 @@ ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq)
 	IXGBE_PCI_REG_WRITE(rxq->rdt_reg_addr, rxq->rx_free_trigger);
 
 	/* update state of internal queue structure */
-	rxq->rx_free_trigger = (uint16_t)(rxq->rx_free_trigger +
-						rxq->rx_free_thresh);
+	rxq->rx_free_trigger = rxq->rx_free_trigger + rxq->rx_free_thresh;
 	if (rxq->rx_free_trigger >= rxq->nb_rx_desc)
-		rxq->rx_free_trigger = (uint16_t)(rxq->rx_free_thresh - 1);
+		rxq->rx_free_trigger = rxq->rx_free_thresh - 1;
 
 	/* no errors */
 	return 0;
@@ -3560,6 +3558,7 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
 	uint32_t rxcsum;
 	uint16_t buf_size;
 	uint16_t i;
+	struct rte_eth_rxmode *rx_conf = &dev->data->dev_conf.rxmode;
 
 	PMD_INIT_FUNC_TRACE();
 	hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -3582,7 +3581,7 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
 	 * Configure CRC stripping, if any.
 	 */
 	hlreg0 = IXGBE_READ_REG(hw, IXGBE_HLREG0);
-	if (dev->data->dev_conf.rxmode.hw_strip_crc)
+	if (rx_conf->hw_strip_crc)
 		hlreg0 |= IXGBE_HLREG0_RXCRCSTRP;
 	else
 		hlreg0 &= ~IXGBE_HLREG0_RXCRCSTRP;
@@ -3590,11 +3589,11 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
 	/*
 	 * Configure jumbo frame support, if any.
 	 */
-	if (dev->data->dev_conf.rxmode.jumbo_frame == 1) {
+	if (rx_conf->jumbo_frame == 1) {
 		hlreg0 |= IXGBE_HLREG0_JUMBOEN;
 		maxfrs = IXGBE_READ_REG(hw, IXGBE_MAXFRS);
 		maxfrs &= 0x0000FFFF;
-		maxfrs |= (dev->data->dev_conf.rxmode.max_rx_pkt_len << 16);
+		maxfrs |= (rx_conf->max_rx_pkt_len << 16);
 		IXGBE_WRITE_REG(hw, IXGBE_MAXFRS, maxfrs);
 	} else
 		hlreg0 &= ~IXGBE_HLREG0_JUMBOEN;
@@ -3618,9 +3617,7 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
 		 * Reset crc_len in case it was changed after queue setup by a
 		 * call to configure.
 		 */
-		rxq->crc_len = (uint8_t)
-				((dev->data->dev_conf.rxmode.hw_strip_crc) ? 0 :
-				ETHER_CRC_LEN);
+		rxq->crc_len = rx_conf->hw_strip_crc ? 0 : ETHER_CRC_LEN;
 
 		/* Setup the Base and Length of the Rx Descriptor Rings */
 		bus_addr = rxq->rx_ring_phys_addr;
@@ -3638,7 +3635,7 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
 		/*
 		 * Configure Header Split
 		 */
-		if (dev->data->dev_conf.rxmode.header_split) {
+		if (rx_conf->header_split) {
 			if (hw->mac.type == ixgbe_mac_82599EB) {
 				/* Must setup the PSRTYPE register */
 				uint32_t psrtype;
@@ -3648,7 +3645,7 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
 					IXGBE_PSRTYPE_IPV6HDR;
 				IXGBE_WRITE_REG(hw, IXGBE_PSRTYPE(rxq->reg_idx), psrtype);
 			}
-			srrctl = ((dev->data->dev_conf.rxmode.split_hdr_size <<
+			srrctl = ((rx_conf->split_hdr_size <<
 				IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT) &
 				IXGBE_SRRCTL_BSIZEHDR_MASK);
 			srrctl |= IXGBE_SRRCTL_DESCTYPE_HDR_SPLIT_ALWAYS;
@@ -3699,7 +3696,7 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
 	 */
 	rxcsum = IXGBE_READ_REG(hw, IXGBE_RXCSUM);
 	rxcsum |= IXGBE_RXCSUM_PCSD;
-	if (dev->data->dev_conf.rxmode.hw_ip_checksum)
+	if (rx_conf->hw_ip_checksum)
 		rxcsum |= IXGBE_RXCSUM_IPPCSE;
 	else
 		rxcsum &= ~IXGBE_RXCSUM_IPPCSE;
@@ -3709,7 +3706,7 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
 	if (hw->mac.type == ixgbe_mac_82599EB ||
 	    hw->mac.type == ixgbe_mac_X540) {
 		rdrxctl = IXGBE_READ_REG(hw, IXGBE_RDRXCTL);
-		if (dev->data->dev_conf.rxmode.hw_strip_crc)
+		if (rx_conf->hw_strip_crc)
 			rdrxctl |= IXGBE_RDRXCTL_CRCSTRIP;
 		else
 			rdrxctl &= ~IXGBE_RDRXCTL_CRCSTRIP;
--

2.1.0

A message that is not in the archive (sent off-list or not yet received): 2601191342CEEE43887BDE71AB977258213F4B37-pww93C2UFcwu0RiL9chJVbfspsVTdybXVpNB7YpNyf8@public.gmane.org

#6 lore raw

Re: [PATCH v5 1/3] ixgbe: Cleanups

Quoted 24 lines · Konstantin
Quoted 24 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Vlad Zolotarov
Sent: Monday, March 09, 2015 10:21 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH v5 1/3] ixgbe: Cleanups

- Removed the not needed casting.
- ixgbe_dev_rx_init(): shorten the lines by defining a local alias variable to access &dev->data->dev_conf.rxmode.

---
  lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 27 ++++++++++++---------------
  1 file changed, 12 insertions(+), 15 deletions(-)
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +0 -0
index 72c65df..609b5fd 100644
@@ -1032,8 +1032,7 @@ ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq)
  	int diag, i;
 
Quoted 11 lines

lib/librte_pmd_ixgbe/ixgbe_rxtx.c ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq) · line 1035

Quoted 4 lines
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +1 -2
  	/* allocate buffers in bulk directly into the S/W ring */
-	alloc_idx = (uint16_t)(rxq->rx_free_trigger -
-				(rxq->rx_free_thresh - 1));
+	alloc_idx = rxq->rx_free_trigger - (rxq->rx_free_thresh - 1);

I think all these extra casts came in to keep icc 12.* compiling without warnings. I am agree that they are unnecessary.
Though if we still have to support icc 12.* we either need to keep them, or find some other way to keep it happy.
Konstantin

What warnings icc 12.* is throwing? Only warning I can think of here is signed -> unsigned implicit cast. Changing '1' to '1U' helps?

Signature · 1 line
Pawel

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw

Re: [PATCH v5 1/3] ixgbe: Cleanups

Quoted 45 lines

-----Original Message-----
From: Wodkowski, PawelX
Sent: Monday, March 09, 2015 11:09 AM
To: Ananyev, Konstantin; Vlad Zolotarov; [email protected]
Subject: Re: [dpdk-dev] [PATCH v5 1/3] ixgbe: Cleanups

Quoted 24 lines · Konstantin
Quoted 24 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Vlad Zolotarov
Sent: Monday, March 09, 2015 10:21 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH v5 1/3] ixgbe: Cleanups

- Removed the not needed casting.
- ixgbe_dev_rx_init(): shorten the lines by defining a local alias variable to access &dev->data->dev_conf.rxmode.

---
  lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 27 ++++++++++++---------------
  1 file changed, 12 insertions(+), 15 deletions(-)
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +0 -0
index 72c65df..609b5fd 100644
@@ -1032,8 +1032,7 @@ ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq)
  	int diag, i;
 
Quoted 11 lines

lib/librte_pmd_ixgbe/ixgbe_rxtx.c ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq) · line 1035

Quoted 4 lines
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +1 -2
  	/* allocate buffers in bulk directly into the S/W ring */
-	alloc_idx = (uint16_t)(rxq->rx_free_trigger -
-				(rxq->rx_free_thresh - 1));
+	alloc_idx = rxq->rx_free_trigger - (rxq->rx_free_thresh - 1);

I think all these extra casts came in to keep icc 12.* compiling without warnings. I am agree that they are unnecessary.
Though if we still have to support icc 12.* we either need to keep them, or find some other way to keep it happy.
Konstantin

Quoted 1 line

What warnings icc 12.* is throwing?

Try and see :)

Quoted 2 lines

Only warning I can think of here is
signed -> unsigned implicit cast.

If I remember things correctly, it considered result at right side of '=' operator as unsigned int, and then complained that we assign it to smaller size (unsigned short) operand.

Quoted 1 line

Changing '1' to '1U' helps?

Don't think so, but you are welcome to try.

Konstantin

Quoted 4 lines

--
Pawel

A message that is not in the archive (sent off-list or not yet received): 2601191342CEEE43887BDE71AB977258213F4B99-pww93C2UFcwu0RiL9chJVbfspsVTdybXVpNB7YpNyf8@public.gmane.org

#10 lore raw

Re: [PATCH v5 1/3] ixgbe: Cleanups

Quoted 41 lines · Konstantin
Quoted 41 lines

-----Original Message-----
From: Wodkowski, PawelX
Sent: Monday, March 09, 2015 11:09 AM
To: Ananyev, Konstantin; Vlad Zolotarov; [email protected]
Subject: Re: [dpdk-dev] [PATCH v5 1/3] ixgbe: Cleanups

Quoted 33 lines · Konstantin
Quoted 21 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Vlad Zolotarov
Sent: Monday, March 09, 2015 10:21 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH v5 1/3] ixgbe: Cleanups

- Removed the not needed casting.
- ixgbe_dev_rx_init(): shorten the lines by defining a local alias variable to access &dev->data->dev_conf.rxmode.

---
   lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 27 ++++++++++++---------------
   1 file changed, 12 insertions(+), 15 deletions(-)
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +0 -0
index 72c65df..609b5fd 100644

lib/librte_pmd_ixgbe/ixgbe_rxtx.c ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq) · line 1035

Quoted 6 lines
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +1 -2
@@ -1032,8 +1032,7 @@ ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq)
   	int diag, i;
 
   	/* allocate buffers in bulk directly into the S/W ring */
-	alloc_idx = (uint16_t)(rxq->rx_free_trigger -
-				(rxq->rx_free_thresh - 1));
+	alloc_idx = rxq->rx_free_trigger - (rxq->rx_free_thresh - 1);

I think all these extra casts came in to keep icc 12.* compiling without warnings. I am agree that they are unnecessary.
Though if we still have to support icc 12.* we either need to keep them, or find some other way to keep it happy.
Konstantin

Quoted 7 lines
Quoted 1 line

What warnings icc 12.* is throwing?

Try and see :)

Quoted 2 lines

Only warning I can think of here is
signed -> unsigned implicit cast.

If I remember things correctly, it considered result at right side of '=' operator as unsigned int, and then complained that we assign it to smaller size (unsigned short) operand.

If that's the case - that's a clear compiler bug.

Quoted 9 lines
Quoted 2 lines

Changing '1' to '1U' helps?

Don't think so, but you are welcome to try.

Konstantin

Quoted 3 lines

--
Pawel

A message that is not in the archive (sent off-list or not yet received): 54FDC306.4030503-RmZWMc9puTNJc61us3aD9laTQe2KTcn/@public.gmane.org

#12 lore raw

Re: [PATCH v5 1/3] ixgbe: Cleanups

Quoted 53 lines

-----Original Message-----
From: Vlad Zolotarov [mailto:vladz-RmZWMc9puTNJc61us3aD9laTQe2KTcn/@public.gmane.org]
Sent: Monday, March 09, 2015 3:58 PM
To: Ananyev, Konstantin; Wodkowski, PawelX; [email protected]
Subject: Re: [dpdk-dev] [PATCH v5 1/3] ixgbe: Cleanups

Quoted 42 lines · Konstantin
Quoted 42 lines

-----Original Message-----
From: Wodkowski, PawelX
Sent: Monday, March 09, 2015 11:09 AM
To: Ananyev, Konstantin; Vlad Zolotarov; [email protected]
Subject: Re: [dpdk-dev] [PATCH v5 1/3] ixgbe: Cleanups

Quoted 23 lines · Konstantin
Quoted 23 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Vlad Zolotarov
Sent: Monday, March 09, 2015 10:21 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH v5 1/3] ixgbe: Cleanups

- Removed the not needed casting.
- ixgbe_dev_rx_init(): shorten the lines by defining a local alias variable to access &dev->data->dev_conf.rxmode.

---
   lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 27 ++++++++++++---------------
   1 file changed, 12 insertions(+), 15 deletions(-)
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +0 -0
index 72c65df..609b5fd 100644
@@ -1032,8 +1032,7 @@ ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq)
   	int diag, i;
 
Quoted 10 lines

lib/librte_pmd_ixgbe/ixgbe_rxtx.c ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq) · line 1035

Quoted 4 lines
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +1 -2
   	/* allocate buffers in bulk directly into the S/W ring */
-	alloc_idx = (uint16_t)(rxq->rx_free_trigger -
-				(rxq->rx_free_thresh - 1));
+	alloc_idx = rxq->rx_free_trigger - (rxq->rx_free_thresh - 1);

I think all these extra casts came in to keep icc 12.* compiling without warnings. I am agree that they are unnecessary.
Though if we still have to support icc 12.* we either need to keep them, or find some other way to keep it happy.
Konstantin

What warnings icc 12.* is throwing?

Quoted 8 lines
Quoted 6 lines

Try and see :)

Quoted 2 lines

Only warning I can think of here is
signed -> unsigned implicit cast.

If I remember things correctly, it considered result at right side of '=' operator as unsigned int, and then complained that we assign it to smaller size (unsigned short) operand.

If that's the case - that's a clear compiler bug.

Might be, though if we still have to support it, there is no much choice I am afraid.

Quoted 10 lines
Quoted 10 lines
Quoted 3 lines

Changing '1' to '1U' helps?

Don't think so, but you are welcome to try.

Konstantin

Quoted 3 lines

--
Pawel

A message that is not in the archive (sent off-list or not yet received): 2601191342CEEE43887BDE71AB977258213F4E68-pww93C2UFcwu0RiL9chJVbfspsVTdybXVpNB7YpNyf8@public.gmane.org

#14 lore raw

Re: [PATCH v5 1/3] ixgbe: Cleanups

Quoted 21 lines · Konstantin
Quoted 21 lines

-----Original Message-----
From: Vlad Zolotarov [mailto:vladz-RmZWMc9puTNJc61us3aD9laTQe2KTcn/@public.gmane.org]
Sent: Monday, March 09, 2015 3:58 PM
To: Ananyev, Konstantin; Wodkowski, PawelX; [email protected]
Subject: Re: [dpdk-dev] [PATCH v5 1/3] ixgbe: Cleanups

Quoted 9 lines · Konstantin
Quoted 9 lines

-----Original Message-----
From: Wodkowski, PawelX
Sent: Monday, March 09, 2015 11:09 AM
To: Ananyev, Konstantin; Vlad Zolotarov; [email protected]
Subject: Re: [dpdk-dev] [PATCH v5 1/3] ixgbe: Cleanups

Quoted 1 line · Konstantin
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Vlad Zolotarov
Sent: Monday, March 09, 2015 10:21 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH v5 1/3] ixgbe: Cleanups

- Removed the not needed casting.
- ixgbe_dev_rx_init(): shorten the lines by defining a local

alias variable to access

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
                            &dev->data->dev_conf.rxmode.
---
   lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 27

++++++++++++---------------

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Review

Quoted 3 lines
   1 file changed, 12 insertions(+), 15 deletions(-)
(quoted diff) +0 -0

b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

lib/librte_pmd_ixgbe/ixgbe_rxtx.c ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq) · line 1035

Quoted 10 lines

index 72c65df..609b5fd 100644

lib/librte_pmd_ixgbe/ixgbe_rxtx.c +1 -2
@@ -1032,8 +1032,7 @@ ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq)
         int diag, i;
 
         /* allocate buffers in bulk directly into the S/W ring */
-        alloc_idx = (uint16_t)(rxq->rx_free_trigger -
-                                (rxq->rx_free_thresh - 1));
+        alloc_idx = rxq->rx_free_trigger - (rxq->rx_free_thresh -

1);

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

I think all these extra casts came in to keep icc 12.* compiling

without warnings.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

I am agree that they are unnecessary.
Though if we still have to support icc 12.* we either need to keep

them, or find

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 4 lines
Quoted 3 lines

some other way to keep it happy.
Konstantin

What warnings icc 12.* is throwing?

Try and see :)

Quoted 2 lines

Only warning I can think of here is
signed -> unsigned implicit cast.

If I remember things correctly, it considered result at right side of

'=' operator as unsigned int,

Quoted 1 line
Quoted 1 line
Quoted 1 line

and then complained that we assign it to smaller size (unsigned

short) operand.

Quoted 4 lines
Quoted 2 lines

If that's the case - that's a clear compiler bug.

Might be, though if we still have to support it, there is no much choice

I am afraid.

Well to begin with could anybody who has this icc thing (preferably the latest version) post the compilation errors u are talking about. Let's continue this discussion with some specific things in hands. So far there were a lot of "maybe"s and "as far as i remember"s. Could u, guys, pls., be more specific so that i could address the real issues and not just your fears? ;)

Thanks,
Vlad

Quoted 12 lines
Quoted 11 lines
Quoted 11 lines
Quoted 4 lines

Changing '1' to '1U' helps?

Don't think so, but you are welcome to try.

Konstantin

Quoted 3 lines

--
Pawel

,

A message that is not in the archive (sent off-list or not yet received): CAOYyTHZ6j83syfHpGY2ig+wU3azGAMjhRpT0w9oVpuJ1Nf_MGQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#16 lore raw

Re: [PATCH v5 1/3] ixgbe: Cleanups

Quoted 16 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Vladislav Zolotarov
Sent: Monday, March 9, 2015 5:14 PM
To: Ananyev, Konstantin
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v5 1/3] ixgbe: Cleanups

Quoted 2 lines · Konstantin
Quoted 2 lines
Quoted 2 lines

If I remember things correctly, it considered result at right side of

'=' operator as unsigned int,

Quoted 1 line
Quoted 1 line
Quoted 1 line

and then complained that we assign it to smaller size (unsigned

short) operand.

Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Quoted 1 line

If that's the case - that's a clear compiler bug.

Might be, though if we still have to support it, there is no much choice

I am afraid.

Well to begin with could anybody who has this icc thing (preferably the latest version) post the compilation errors u are talking about

Hi,

For what it is worth there aren't any warnings with ICC 13 and the 1/3 patch (+ the previous patchset):

  $ make T=x86_64-native-linuxapp-icc install CC=icc
  Build complete
  $ git log --pretty=format:"%h - %an: %s" -4  
  b5d06e4 - Vladislav Zolotarov: ixgbe: Cleanups
  3cd0367 - Vladislav Zolotarov: ixgbe: Unify the rx_pkt_bulk callback ...
  10ed30e - Vladislav Zolotarov: ixgbe: Bug fix: Properly configure Rx ...
  2a5bc6a - Vladislav Zolotarov: ixgbe: Use the rte_le_to_cpu_xx()/rte_...
  $ icc --version
  icc (ICC) 13.1.1 20130313

John.

A message that is not in the archive (sent off-list or not yet received): B27915DBBA3421428155699D51E4CFE2ECC700-kPTMFJFq+rELt2AQoY/[email protected]

#18 lore raw

Re: [PATCH v5 1/3] ixgbe: Cleanups

Quoted 21 lines · John
Quoted 21 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Vladislav Zolotarov
Sent: Monday, March 9, 2015 5:14 PM
To: Ananyev, Konstantin
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v5 1/3] ixgbe: Cleanups

Quoted 2 lines · Konstantin
Quoted 2 lines
Quoted 2 lines

If I remember things correctly, it considered result at right side of

'=' operator as unsigned int,

Quoted 1 line
Quoted 1 line
Quoted 1 line

and then complained that we assign it to smaller size (unsigned

short) operand.

Quoted 5 lines
Quoted 2 lines

If that's the case - that's a clear compiler bug.

Might be, though if we still have to support it, there is no much choice

Quoted 8 lines
Quoted 4 lines

I am afraid.

Well to begin with could anybody who has this icc thing (preferably the latest version) post the compilation errors u are talking about

Hi,

For what it is worth there aren't any warnings with ICC 13 and the 1/3

patch (+ the previous patchset):

Quoted 4 lines
  $ make T=x86_64-native-linuxapp-icc install CC=icc
  Build complete
Quoted 8 lines
  $ git log --pretty=format:"%h - %an: %s" -4
  b5d06e4 - Vladislav Zolotarov: ixgbe: Cleanups
  3cd0367 - Vladislav Zolotarov: ixgbe: Unify the rx_pkt_bulk callback ...
  10ed30e - Vladislav Zolotarov: ixgbe: Bug fix: Properly configure Rx ...
  2a5bc6a - Vladislav Zolotarov: ixgbe: Use the rte_le_to_cpu_xx()/rte_...
  $ icc --version
  icc (ICC) 13.1.1 20130313

That's worth a lot to me!.. :D

Quoted 5 lines

John.
--

#19 lore raw

Re: [PATCH v5 1/3] ixgbe: Cleanups

In reply to a message not in the archive
Quoted 21 lines · John
Quoted 21 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Vladislav Zolotarov
Sent: Monday, March 9, 2015 5:14 PM
To: Ananyev, Konstantin
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v5 1/3] ixgbe: Cleanups

Quoted 2 lines · Konstantin
Quoted 2 lines
Quoted 2 lines

If I remember things correctly, it considered result at right side of

'=' operator as unsigned int,

Quoted 1 line
Quoted 1 line
Quoted 1 line

and then complained that we assign it to smaller size (unsigned

short) operand.

Quoted 5 lines
Quoted 2 lines

If that's the case - that's a clear compiler bug.

Might be, though if we still have to support it, there is no much choice

Quoted 8 lines
Quoted 4 lines

I am afraid.

Well to begin with could anybody who has this icc thing (preferably the latest version) post the compilation errors u are talking about

Hi,

For what it is worth there aren't any warnings with ICC 13 and the 1/3

patch (+ the previous patchset):

Quoted 4 lines
  $ make T=x86_64-native-linuxapp-icc install CC=icc
  Build complete
Quoted 8 lines
  $ git log --pretty=format:"%h - %an: %s" -4
  b5d06e4 - Vladislav Zolotarov: ixgbe: Cleanups
  3cd0367 - Vladislav Zolotarov: ixgbe: Unify the rx_pkt_bulk callback ...
  10ed30e - Vladislav Zolotarov: ixgbe: Bug fix: Properly configure Rx ...
  2a5bc6a - Vladislav Zolotarov: ixgbe: Use the rte_le_to_cpu_xx()/rte_...
  $ icc --version
  icc (ICC) 13.1.1 20130313

Thanks a lot, John.

Quoted 5 lines

John.
--

A message that is not in the archive (sent off-list or not yet received): 2601191342CEEE43887BDE71AB977258213F4F13@irsmsx105.ger.corp.intel.com

A message that is not in the archive (sent off-list or not yet received): 2601191342CEEE43887BDE71AB977258213F4F13-pww93C2UFcwu0RiL9chJVbfspsVTdybXVpNB7YpNyf8@public.gmane.org

#22 lore raw

Re: [PATCH v5 1/3] ixgbe: Cleanups

Quoted 50 lines

From: Vladislav Zolotarov [mailto:[email protected]]
Sent: Monday, March 09, 2015 6:22 PM
To: Mcnamara, John
Cc: [email protected]; Ananyev, Konstantin
Subject: RE: [dpdk-dev] [PATCH v5 1/3] ixgbe: Cleanups

Quoted 39 lines · John
Quoted 17 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Vladislav Zolotarov
Sent: Monday, March 9, 2015 5:14 PM
To: Ananyev, Konstantin
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v5 1/3] ixgbe: Cleanups

Quoted 2 lines · Konstantin
Quoted 2 lines
Quoted 2 lines

If I remember things correctly, it considered result at right side of

'=' operator as unsigned int,

Quoted 1 line
Quoted 1 line
Quoted 1 line

and then complained that we assign it to smaller size (unsigned

short) operand.

Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Quoted 1 line

If that's the case - that's a clear compiler bug.

Might be, though if we still have to support it, there is no much choice

I am afraid.

Well to begin with could anybody who has this icc thing (preferably the latest version) post the compilation errors u are talking about

Hi,

For what it is worth there aren't any warnings with ICC 13 and the 1/3 patch (+ the previous patchset):

  $ make T=x86_64-native-linuxapp-icc install CC=icc
  Build complete
  $ git log --pretty=format:"%h - %an: %s" -4
  b5d06e4 - Vladislav Zolotarov: ixgbe: Cleanups
  3cd0367 - Vladislav Zolotarov: ixgbe: Unify the rx_pkt_bulk callback ...
  10ed30e - Vladislav Zolotarov: ixgbe: Bug fix: Properly configure Rx ...
  2a5bc6a - Vladislav Zolotarov: ixgbe: Use the rte_le_to_cpu_xx()/rte_...
Quoted 3 lines
Quoted 2 lines
  $ icc --version
  icc (ICC) 13.1.1 20130313

Thanks a lot, John.

As I said my worry was about 12.*.
icc v13* and above, are not that picky.
After applying the patch, indeed all these lines make icc 12.1 to generate warnings.
See below for details.
Though with icc 12.1 current dpdk.org main branch will generate ~2K unhandled warnings all over the places anyway... Which makes me think that probably DPDK support for icc 12.* was scrapped already, I just didn't notice that. Konstantin

$ icc -v
icc version 12.1.0 (gcc version 4.5.0 compatibility)
$ icc -Wp,-MD,./.ixgbe_rxtx.o.d.tmp -m64 -pthread  -march=native -DRTE_MACHINE_CPU
FLAG_SSE -DRTE_MACHINE_CPUFLAG_SSE2 -DRTE_MACHINE_CPUFLAG_SSE3 -DRTE_MACHINE_CPU
FLAG_SSSE3 -DRTE_MACHINE_CPUFLAG_SSE4_1 -DRTE_MACHINE_CPUFLAG_SSE4_2 -DRTE_MACHI
NE_CPUFLAG_AVX -DRTE_COMPILE_TIME_CPUFLAGS=RTE_CPUFLAG_SSE,RTE_CPUFLAG_SSE2,RTE_
CPUFLAG_SSE3,RTE_CPUFLAG_SSSE3,RTE_CPUFLAG_SSE4_1,RTE_CPUFLAG_SSE4_2,RTE_CPUFLAG
_AVX  -I/local/kananye1/dpdk.org/x86_64-native-linuxapp-icc/include -include /lo
cal/kananye1/dpdk.org/x86_64-native-linuxapp-icc/include/rte_config.h -O3 -Wall
-w2 -diag-disable 271 -diag-warning 1478 -diag-disable 13368 -diag-disable 15527   -o ixgbe_rxtx.o -c /local/kananye1/dpdk.org/lib/librte_pmd_ixgbe/ixgbe_rxtx.c

....

/local/kananye1/dpdk.org/lib/librte_pmd_ixgbe/ixgbe_rxtx.c(1035): remark #2259:
non-pointer conversion from "int" to "uint16_t={unsigned short}" may lose signif icant bits

        alloc_idx = rxq->rx_free_trigger - (rxq->rx_free_thresh - 1);
                  ^

/local/kananye1/dpdk.org/lib/librte_pmd_ixgbe/ixgbe_rxtx.c(1064): remark #2259: non-pointer conversion from "int" to "uint16_t={unsigned short}" may lose significant bits

        rxq->rx_free_trigger = rxq->rx_free_trigger + rxq->rx_free_thresh;
                             ^

/local/kananye1/dpdk.org/lib/librte_pmd_ixgbe/ixgbe_rxtx.c(1067): remark #2259: non-pointer conversion from "int" to "uint16_t={unsigned short}" may lose significant bits

                rxq->rx_free_trigger = rxq->rx_free_thresh - 1;

....

A message that is not in the archive (sent off-list or not yet received): 2601191342CEEE43887BDE71AB977258213F4F4B-pww93C2UFcwu0RiL9chJVbfspsVTdybXVpNB7YpNyf8@public.gmane.org

#24 lore raw

Re: [PATCH v5 1/3] ixgbe: Cleanups

Quoted 46 lines · Konstantin
Quoted 46 lines

From: Vladislav Zolotarov [mailto:vladz-RmZWMc9puTNJc61us3aD9laTQe2KTcn/@public.gmane.org]
Sent: Monday, March 09, 2015 6:22 PM
To: Mcnamara, John
Cc: [email protected]; Ananyev, Konstantin
Subject: RE: [dpdk-dev] [PATCH v5 1/3] ixgbe: Cleanups

Quoted 37 lines · John
Quoted 14 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Vladislav Zolotarov
Sent: Monday, March 9, 2015 5:14 PM
To: Ananyev, Konstantin
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v5 1/3] ixgbe: Cleanups

Quoted 2 lines · Konstantin
Quoted 2 lines
Quoted 2 lines

If I remember things correctly, it considered result at right side of

'=' operator as unsigned int,

Quoted 1 line
Quoted 1 line
Quoted 1 line

and then complained that we assign it to smaller size (unsigned

Quoted 8 lines

short) operand.

Quoted 3 lines
Quoted 1 line

If that's the case - that's a clear compiler bug.

Might be, though if we still have to support it, there is no much choice

I am afraid.

Well to begin with could anybody who has this icc thing (preferably the latest version) post the compilation errors u are talking about

Hi,

For what it is worth there aren't any warnings with ICC 13 and the 1/3 patch (+ the previous patchset):

   $ make T=x86_64-native-linuxapp-icc install CC=icc
   Build complete
   $ git log --pretty=format:"%h - %an: %s" -4
   b5d06e4 - Vladislav Zolotarov: ixgbe: Cleanups
   3cd0367 - Vladislav Zolotarov: ixgbe: Unify the rx_pkt_bulk callback ...
   10ed30e - Vladislav Zolotarov: ixgbe: Bug fix: Properly configure Rx ...
   2a5bc6a - Vladislav Zolotarov: ixgbe: Use the rte_le_to_cpu_xx()/rte_...
   $ icc --version
   icc (ICC) 13.1.1 20130313
Quoted 7 lines
Quoted 1 line

Thanks a lot, John.

As I said my worry was about 12.*.
icc v13* and above, are not that picky.
After applying the patch, indeed all these lines make icc 12.1 to generate warnings.
See below for details.
Though with icc 12.1 current dpdk.org main branch will generate ~2K unhandled warnings all over the places anyway... Which makes me think that probably DPDK support for icc 12.* was scrapped already, I just didn't notice that.

So, I suppose this concludes this specific discussion, right? ;)

Quoted 31 lines

Konstantin

$ icc -v
icc version 12.1.0 (gcc version 4.5.0 compatibility)
$ icc -Wp,-MD,./.ixgbe_rxtx.o.d.tmp -m64 -pthread  -march=native -DRTE_MACHINE_CPU
FLAG_SSE -DRTE_MACHINE_CPUFLAG_SSE2 -DRTE_MACHINE_CPUFLAG_SSE3 -DRTE_MACHINE_CPU
FLAG_SSSE3 -DRTE_MACHINE_CPUFLAG_SSE4_1 -DRTE_MACHINE_CPUFLAG_SSE4_2 -DRTE_MACHI
NE_CPUFLAG_AVX -DRTE_COMPILE_TIME_CPUFLAGS=RTE_CPUFLAG_SSE,RTE_CPUFLAG_SSE2,RTE_
CPUFLAG_SSE3,RTE_CPUFLAG_SSSE3,RTE_CPUFLAG_SSE4_1,RTE_CPUFLAG_SSE4_2,RTE_CPUFLAG
_AVX  -I/local/kananye1/dpdk.org/x86_64-native-linuxapp-icc/include -include /lo
cal/kananye1/dpdk.org/x86_64-native-linuxapp-icc/include/rte_config.h -O3 -Wall
-w2 -diag-disable 271 -diag-warning 1478 -diag-disable 13368 -diag-disable 15527   -o ixgbe_rxtx.o -c /local/kananye1/dpdk.org/lib/librte_pmd_ixgbe/ixgbe_rxtx.c

....

/local/kananye1/dpdk.org/lib/librte_pmd_ixgbe/ixgbe_rxtx.c(1035): remark #2259:
non-pointer conversion from "int" to "uint16_t={unsigned short}" may lose signif icant bits

         alloc_idx = rxq->rx_free_trigger - (rxq->rx_free_thresh - 1);
                   ^

/local/kananye1/dpdk.org/lib/librte_pmd_ixgbe/ixgbe_rxtx.c(1064): remark #2259: non-pointer conversion from "int" to "uint16_t={unsigned short}" may lose significant bits

         rxq->rx_free_trigger = rxq->rx_free_trigger + rxq->rx_free_thresh;
                              ^

/local/kananye1/dpdk.org/lib/librte_pmd_ixgbe/ixgbe_rxtx.c(1067): remark #2259: non-pointer conversion from "int" to "uint16_t={unsigned short}" may lose significant bits

                 rxq->rx_free_trigger = rxq->rx_free_thresh - 1;

....

A message that is not in the archive (sent off-list or not yet received): 54FDF53A.7090901-RmZWMc9puTNJc61us3aD9laTQe2KTcn/@public.gmane.org

#26 lore raw

Re: [PATCH v5 1/3] ixgbe: Cleanups

Quoted 59 lines

-----Original Message-----
From: Vlad Zolotarov [mailto:[email protected]]
Sent: Monday, March 09, 2015 7:32 PM
To: Ananyev, Konstantin
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v5 1/3] ixgbe: Cleanups

Quoted 47 lines · Konstantin
Quoted 47 lines

From: Vladislav Zolotarov [mailto:[email protected]]
Sent: Monday, March 09, 2015 6:22 PM
To: Mcnamara, John
Cc: [email protected]; Ananyev, Konstantin
Subject: RE: [dpdk-dev] [PATCH v5 1/3] ixgbe: Cleanups

Quoted 29 lines · John
Quoted 14 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Vladislav Zolotarov
Sent: Monday, March 9, 2015 5:14 PM
To: Ananyev, Konstantin
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v5 1/3] ixgbe: Cleanups

Quoted 2 lines · Konstantin
Quoted 2 lines
Quoted 2 lines

If I remember things correctly, it considered result at right side of

'=' operator as unsigned int,

Quoted 1 line
Quoted 1 line
Quoted 1 line

and then complained that we assign it to smaller size (unsigned

Quoted 8 lines

short) operand.

Quoted 3 lines
Quoted 1 line

If that's the case - that's a clear compiler bug.

Might be, though if we still have to support it, there is no much choice

I am afraid.

Well to begin with could anybody who has this icc thing (preferably the latest version) post the compilation errors u are talking about

Hi,

For what it is worth there aren't any warnings with ICC 13 and the 1/3 patch (+ the previous patchset):

   $ make T=x86_64-native-linuxapp-icc install CC=icc
   Build complete
Quoted 8 lines
   $ git log --pretty=format:"%h - %an: %s" -4
   b5d06e4 - Vladislav Zolotarov: ixgbe: Cleanups
   3cd0367 - Vladislav Zolotarov: ixgbe: Unify the rx_pkt_bulk callback ...
   10ed30e - Vladislav Zolotarov: ixgbe: Bug fix: Properly configure Rx ...
   2a5bc6a - Vladislav Zolotarov: ixgbe: Use the rte_le_to_cpu_xx()/rte_...
   $ icc --version
   icc (ICC) 13.1.1 20130313

Thanks a lot, John.

Quoted 8 lines
Quoted 6 lines

As I said my worry was about 12.*.
icc v13* and above, are not that picky.
After applying the patch, indeed all these lines make icc 12.1 to generate warnings.
See below for details.
Though with icc 12.1 current dpdk.org main branch will generate ~2K unhandled warnings all over the places anyway... Which makes me think that probably DPDK support for icc 12.* was scrapped already, I just didn't notice that.

So, I suppose this concludes this specific discussion, right? ;)

I believe so.
Sorry for the noise generated.
Konstantin

Quoted 35 lines
Quoted 6 lines

Konstantin

$ icc -v
icc version 12.1.0 (gcc version 4.5.0 compatibility)
Quoted 8 lines
$ icc -Wp,-MD,./.ixgbe_rxtx.o.d.tmp -m64 -pthread  -march=native -DRTE_MACHINE_CPU
FLAG_SSE -DRTE_MACHINE_CPUFLAG_SSE2 -DRTE_MACHINE_CPUFLAG_SSE3 -DRTE_MACHINE_CPU
FLAG_SSSE3 -DRTE_MACHINE_CPUFLAG_SSE4_1 -DRTE_MACHINE_CPUFLAG_SSE4_2 -DRTE_MACHI
NE_CPUFLAG_AVX -DRTE_COMPILE_TIME_CPUFLAGS=RTE_CPUFLAG_SSE,RTE_CPUFLAG_SSE2,RTE_
CPUFLAG_SSE3,RTE_CPUFLAG_SSSE3,RTE_CPUFLAG_SSE4_1,RTE_CPUFLAG_SSE4_2,RTE_CPUFLAG
_AVX  -I/local/kananye1/dpdk.org/x86_64-native-linuxapp-icc/include -include /lo
cal/kananye1/dpdk.org/x86_64-native-linuxapp-icc/include/rte_config.h -O3 -Wall
-w2 -diag-disable 271 -diag-warning 1478 -diag-disable 13368 -diag-disable 15527   -o ixgbe_rxtx.o -c

/local/kananye1/dpdk.org/lib/librte_pmd_ixgbe/ixgbe_rxtx.c

Quoted 10 lines

....

/local/kananye1/dpdk.org/lib/librte_pmd_ixgbe/ixgbe_rxtx.c(1035): remark #2259:
non-pointer conversion from "int" to "uint16_t={unsigned short}" may lose signif icant bits

         alloc_idx = rxq->rx_free_trigger - (rxq->rx_free_thresh - 1);
                   ^

/local/kananye1/dpdk.org/lib/librte_pmd_ixgbe/ixgbe_rxtx.c(1064): remark #2259: non-pointer conversion from "int" to

"uint16_t={unsigned short}" may lose significant bits

Quoted 4 lines
         rxq->rx_free_trigger = rxq->rx_free_trigger + rxq->rx_free_thresh;
                              ^

/local/kananye1/dpdk.org/lib/librte_pmd_ixgbe/ixgbe_rxtx.c(1067): remark #2259: non-pointer conversion from "int" to

"uint16_t={unsigned short}" may lose significant bits

Quoted 4 lines
                 rxq->rx_free_trigger = rxq->rx_free_thresh - 1;

....

#27 lore raw

Re: [PATCH v5 1/3] ixgbe: Cleanups

In reply to a message not in the archive
Quoted 23 lines · Konstantin
Quoted 23 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Vlad Zolotarov
Sent: Monday, March 09, 2015 10:21 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH v5 1/3] ixgbe: Cleanups

- Removed the not needed casting.
- ixgbe_dev_rx_init(): shorten the lines by defining a local alias variable to access &dev->data->dev_conf.rxmode.

---
  lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 27 ++++++++++++---------------
  1 file changed, 12 insertions(+), 15 deletions(-)
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +0 -0
index 72c65df..609b5fd 100644
@@ -1032,8 +1032,7 @@ ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq)
  	int diag, i;
 
Quoted 8 lines

lib/librte_pmd_ixgbe/ixgbe_rxtx.c ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq) · line 1035

Quoted 4 lines
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +1 -2
  	/* allocate buffers in bulk directly into the S/W ring */
-	alloc_idx = (uint16_t)(rxq->rx_free_trigger -
-				(rxq->rx_free_thresh - 1));
+	alloc_idx = rxq->rx_free_trigger - (rxq->rx_free_thresh - 1);

I think all these extra casts came in to keep icc 12.* compiling without warnings. I am agree that they are unnecessary.
Though if we still have to support icc 12.* we either need to keep them, or find some other way to keep it happy.

Fix icc maybe?
I'm sorry, but what do I miss here? Both alloc_idx, rxq->rx_free_trigger and rxq->rx_free_thresh are uint16_t

So, according to C standard the result is also uint16_t thus no casting is needed:

the result of a subtraction generating a negative number in an unsigned type is well-defined:

1. [...] A computation involving unsigned operands can never overflow, because a result that cannot be represented by the resulting unsigned integer type is reduced modulo the number that is one greater than the largest value that can be represented by the resulting type. (ISO/IEC 9899:1999 (E) §6.2.5/9)

Could u, pls., be more specific and send here the error generated by icc after my patches?

thanks,
vlad

Quoted 98 lines

Konstantin

Quoted 96 lines
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +11 -14
  	rxep = &rxq->sw_ring[alloc_idx];
  	diag = rte_mempool_get_bulk(rxq->mb_pool, (void *)rxep,
  				    rxq->rx_free_thresh);
@@ -1061,10 +1060,9 @@ ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq)
  	IXGBE_PCI_REG_WRITE(rxq->rdt_reg_addr, rxq->rx_free_trigger);
 
  	/* update state of internal queue structure */
-	rxq->rx_free_trigger = (uint16_t)(rxq->rx_free_trigger +
-						rxq->rx_free_thresh);
+	rxq->rx_free_trigger = rxq->rx_free_trigger + rxq->rx_free_thresh;
  	if (rxq->rx_free_trigger >= rxq->nb_rx_desc)
-		rxq->rx_free_trigger = (uint16_t)(rxq->rx_free_thresh - 1);
+		rxq->rx_free_trigger = rxq->rx_free_thresh - 1;
 
  	/* no errors */
  	return 0;
@@ -3560,6 +3558,7 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
  	uint32_t rxcsum;
  	uint16_t buf_size;
  	uint16_t i;
+	struct rte_eth_rxmode *rx_conf = &dev->data->dev_conf.rxmode;
 
  	PMD_INIT_FUNC_TRACE();
  	hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -3582,7 +3581,7 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
  	 * Configure CRC stripping, if any.
  	 */
  	hlreg0 = IXGBE_READ_REG(hw, IXGBE_HLREG0);
-	if (dev->data->dev_conf.rxmode.hw_strip_crc)
+	if (rx_conf->hw_strip_crc)
  		hlreg0 |= IXGBE_HLREG0_RXCRCSTRP;
  	else
  		hlreg0 &= ~IXGBE_HLREG0_RXCRCSTRP;
@@ -3590,11 +3589,11 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
  	/*
  	 * Configure jumbo frame support, if any.
  	 */
-	if (dev->data->dev_conf.rxmode.jumbo_frame == 1) {
+	if (rx_conf->jumbo_frame == 1) {
  		hlreg0 |= IXGBE_HLREG0_JUMBOEN;
  		maxfrs = IXGBE_READ_REG(hw, IXGBE_MAXFRS);
  		maxfrs &= 0x0000FFFF;
-		maxfrs |= (dev->data->dev_conf.rxmode.max_rx_pkt_len << 16);
+		maxfrs |= (rx_conf->max_rx_pkt_len << 16);
  		IXGBE_WRITE_REG(hw, IXGBE_MAXFRS, maxfrs);
  	} else
  		hlreg0 &= ~IXGBE_HLREG0_JUMBOEN;
@@ -3618,9 +3617,7 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
  		 * Reset crc_len in case it was changed after queue setup by a
  		 * call to configure.
  		 */
-		rxq->crc_len = (uint8_t)
-				((dev->data->dev_conf.rxmode.hw_strip_crc) ? 0 :
-				ETHER_CRC_LEN);
+		rxq->crc_len = rx_conf->hw_strip_crc ? 0 : ETHER_CRC_LEN;
 
  		/* Setup the Base and Length of the Rx Descriptor Rings */
  		bus_addr = rxq->rx_ring_phys_addr;
@@ -3638,7 +3635,7 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
  		/*
  		 * Configure Header Split
  		 */
-		if (dev->data->dev_conf.rxmode.header_split) {
+		if (rx_conf->header_split) {
  			if (hw->mac.type == ixgbe_mac_82599EB) {
  				/* Must setup the PSRTYPE register */
  				uint32_t psrtype;
@@ -3648,7 +3645,7 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
  					IXGBE_PSRTYPE_IPV6HDR;
  				IXGBE_WRITE_REG(hw, IXGBE_PSRTYPE(rxq->reg_idx), psrtype);
  			}
-			srrctl = ((dev->data->dev_conf.rxmode.split_hdr_size <<
+			srrctl = ((rx_conf->split_hdr_size <<
  				IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT) &
  				IXGBE_SRRCTL_BSIZEHDR_MASK);
  			srrctl |= IXGBE_SRRCTL_DESCTYPE_HDR_SPLIT_ALWAYS;
@@ -3699,7 +3696,7 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
  	 */
  	rxcsum = IXGBE_READ_REG(hw, IXGBE_RXCSUM);
  	rxcsum |= IXGBE_RXCSUM_PCSD;
-	if (dev->data->dev_conf.rxmode.hw_ip_checksum)
+	if (rx_conf->hw_ip_checksum)
  		rxcsum |= IXGBE_RXCSUM_IPPCSE;
  	else
  		rxcsum &= ~IXGBE_RXCSUM_IPPCSE;
@@ -3709,7 +3706,7 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
  	if (hw->mac.type == ixgbe_mac_82599EB ||
  	    hw->mac.type == ixgbe_mac_X540) {
  		rdrxctl = IXGBE_READ_REG(hw, IXGBE_RDRXCTL);
-		if (dev->data->dev_conf.rxmode.hw_strip_crc)
+		if (rx_conf->hw_strip_crc)
  			rdrxctl |= IXGBE_RDRXCTL_CRCSTRIP;
  		else
  			rdrxctl &= ~IXGBE_RDRXCTL_CRCSTRIP;
--

2.1.0

#28 lore raw

PATCH v5 2/3 ixgbe: Code refactoring

In reply to a message not in the archive

- ixgbe_rx_alloc_bufs():
- Reset the rte_mbuf fields only when requested.
- Take the RDT update out of the function.
- Add the stub when RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC is not defined.
- ixgbe_recv_scattered_pkts():
- Take the code that updates the fields of the cluster's HEAD buffer into the inline function.

New in v3:
- ixgbe_rx_alloc_bufs(): Always reset refcnt of the buffers to 1.

---
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 114 +++++++++++++++++++++++---------------
 1 file changed, 69 insertions(+), 45 deletions(-)
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +69 -45
index 609b5fd..37aca5d 100644
@@ -1022,7 +1022,7 @@ ixgbe_rx_scan_hw_ring(struct igb_rx_queue *rxq)
 }
 
 static inline int
-ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq)
+ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq, bool reset_mbuf)
 {
 	volatile union ixgbe_adv_rx_desc *rxdp;
 	struct igb_rx_entry *rxep;
@@ -1043,11 +1043,14 @@ ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq)
 	for (i = 0; i < rxq->rx_free_thresh; ++i) {
 		/* populate the static rte mbuf fields */
 		mb = rxep[i].mbuf;
+		if (reset_mbuf) {
+			mb->next = NULL;
+			mb->nb_segs = 1;
+			mb->port = rxq->port_id;
+		}
+
 		rte_mbuf_refcnt_set(mb, 1);
-		mb->next = NULL;
 		mb->data_off = RTE_PKTMBUF_HEADROOM;
-		mb->nb_segs = 1;
-		mb->port = rxq->port_id;
 
 		/* populate the descriptors */
 		dma_addr = rte_cpu_to_le_64(RTE_MBUF_DATA_DMA_ADDR_DEFAULT(mb));
@@ -1055,10 +1058,6 @@ ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq)
 		rxdp[i].read.pkt_addr = dma_addr;
 	}
 
-	/* update tail pointer */
-	rte_wmb();
-	IXGBE_PCI_REG_WRITE(rxq->rdt_reg_addr, rxq->rx_free_trigger);
-
 	/* update state of internal queue structure */
 	rxq->rx_free_trigger = rxq->rx_free_trigger + rxq->rx_free_thresh;
 	if (rxq->rx_free_trigger >= rxq->nb_rx_desc)
@@ -1110,7 +1109,9 @@ rx_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 
 	/* if required, allocate new buffers to replenish descriptors */
 	if (rxq->rx_tail > rxq->rx_free_trigger) {
-		if (ixgbe_rx_alloc_bufs(rxq) != 0) {
+		uint16_t cur_free_trigger = rxq->rx_free_trigger;
+
+		if (ixgbe_rx_alloc_bufs(rxq, true) != 0) {
 			int i, j;
 			PMD_RX_LOG(DEBUG, "RX mbuf alloc failed port_id=%u "
 				   "queue_id=%u", (unsigned) rxq->port_id,
@@ -1130,6 +1131,10 @@ rx_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 
 			return 0;
 		}
+
+		/* update tail pointer */
+		rte_wmb();
+		IXGBE_PCI_REG_WRITE(rxq->rdt_reg_addr, cur_free_trigger);
 	}
 
 	if (rxq->rx_tail >= rxq->nb_rx_desc)
@@ -1169,6 +1174,13 @@ ixgbe_recv_pkts_bulk_alloc(void *rx_queue, struct rte_mbuf **rx_pkts,
 
 	return nb_rx;
 }
+#else
+static inline int
+ixgbe_rx_alloc_bufs(__rte_unused struct igb_rx_queue *rxq,
+		    __rte_unused bool reset_mbuf)
+{
+	return -ENOMEM;
+}
 #endif /* RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC */
 
 uint16_t
@@ -1353,6 +1365,51 @@ ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 	return (nb_rx);
 }
 
+/**
+ * Initialize the first mbuf of the returned packet:
+ *    - RX port identifier,
+ *    - hardware offload data, if any:
+ *      - RSS flag & hash,
+ *      - IP checksum flag,
+ *      - VLAN TCI, if any,
+ *      - error flags.
+ * @head HEAD of the packet cluster
+ * @desc HW descriptor to get data from
+ * @port_id Port ID of the Rx queue
+ */
+static inline void ixgbe_fill_cluster_head_buf(
+	struct rte_mbuf *head,
+	union ixgbe_adv_rx_desc *desc,
+	uint8_t port_id,
+	uint32_t staterr)
+{
+	uint32_t hlen_type_rss;
+	uint64_t pkt_flags;
+
+	head->port = port_id;
+
+	/*
+	 * The vlan_tci field is only valid when PKT_RX_VLAN_PKT is
+	 * set in the pkt_flags field.
+	 */
+	head->vlan_tci = rte_le_to_cpu_16(desc->wb.upper.vlan);
+	hlen_type_rss = rte_le_to_cpu_32(desc->wb.lower.lo_dword.data);
+	pkt_flags = rx_desc_hlen_type_rss_to_pkt_flags(hlen_type_rss);
+	pkt_flags |= rx_desc_status_to_pkt_flags(staterr);
+	pkt_flags |= rx_desc_error_to_pkt_flags(staterr);
+	head->ol_flags = pkt_flags;
+
+	if (likely(pkt_flags & PKT_RX_RSS_HASH))
+		head->hash.rss = rte_le_to_cpu_32(desc->wb.lower.hi_dword.rss);
+	else if (pkt_flags & PKT_RX_FDIR) {
+		head->hash.fdir.hash =
+			rte_le_to_cpu_16(desc->wb.lower.hi_dword.csum_ip.csum)
+							  & IXGBE_ATR_HASH_MASK;
+		head->hash.fdir.id =
+			rte_le_to_cpu_16(desc->wb.lower.hi_dword.csum_ip.ip_id);
+	}
+}
+
 uint16_t
 ixgbe_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 			  uint16_t nb_pkts)
@@ -1369,12 +1426,10 @@ ixgbe_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 	union ixgbe_adv_rx_desc rxd;
 	uint64_t dma; /* Physical address of mbuf data buffer */
 	uint32_t staterr;
-	uint32_t hlen_type_rss;
 	uint16_t rx_id;
 	uint16_t nb_rx;
 	uint16_t nb_hold;
 	uint16_t data_len;
-	uint64_t pkt_flags;
 
 	nb_rx = 0;
 	nb_hold = 0;
@@ -1532,40 +1587,9 @@ ixgbe_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 					(uint16_t) (data_len - ETHER_CRC_LEN);
 		}
 
-		/*
-		 * Initialize the first mbuf of the returned packet:
-		 *    - RX port identifier,
-		 *    - hardware offload data, if any:
-		 *      - RSS flag & hash,
-		 *      - IP checksum flag,
-		 *      - VLAN TCI, if any,
-		 *      - error flags.
-		 */
-		first_seg->port = rxq->port_id;
-
-		/*
-		 * The vlan_tci field is only valid when PKT_RX_VLAN_PKT is
-		 * set in the pkt_flags field.
-		 */
-		first_seg->vlan_tci = rte_le_to_cpu_16(rxd.wb.upper.vlan);
-		hlen_type_rss = rte_le_to_cpu_32(rxd.wb.lower.lo_dword.data);
-		pkt_flags = rx_desc_hlen_type_rss_to_pkt_flags(hlen_type_rss);
-		pkt_flags = (pkt_flags |
-				rx_desc_status_to_pkt_flags(staterr));
-		pkt_flags = (pkt_flags |
-				rx_desc_error_to_pkt_flags(staterr));
-		first_seg->ol_flags = pkt_flags;
-
-		if (likely(pkt_flags & PKT_RX_RSS_HASH))
-			first_seg->hash.rss =
-				    rte_le_to_cpu_32(rxd.wb.lower.hi_dword.rss);
-		else if (pkt_flags & PKT_RX_FDIR) {
-			first_seg->hash.fdir.hash =
-			    rte_le_to_cpu_16(rxd.wb.lower.hi_dword.csum_ip.csum)
-					   & IXGBE_ATR_HASH_MASK;
-			first_seg->hash.fdir.id =
-			  rte_le_to_cpu_16(rxd.wb.lower.hi_dword.csum_ip.ip_id);
-		}
+		/* Initialize the first mbuf of the returned packet */
+		ixgbe_fill_cluster_head_buf(first_seg, &rxd, rxq->port_id,
+					    staterr);
 
 		/* Prefetch data of first segment, if configured to do so. */
 		rte_packet_prefetch((char *)first_seg->buf_addr +
Signature · 1 line
2.1.0
#29 lore raw

PATCH v5 3/3 ixgbe: Add LRO support

In reply to a message not in the archive

- Only x540 and 82599 devices support LRO.
- Add the appropriate HW configuration.
- Add RSC aware rx_pkt_burst() handlers:
- Implemented bulk allocation and non-bulk allocation versions.
- Add LRO-specific fields to rte_eth_rxmode, to rte_eth_dev_data and to igb_rx_queue.
- Use the appropriate handler when LRO is requested.

---
New in v5:
- Put the RTE_ETHDEV_HAS_LRO_SUPPORT definition at the beginning of rte_ethdev.h.
- Removed the "TODO: Remove me" comment near RTE_ETHDEV_HAS_LRO_SUPPORT.

New in v4:
- Define RTE_ETHDEV_HAS_LRO_SUPPORT in rte_ethdev.h instead of RTE_ETHDEV_LRO_SUPPORT defined in config/common_linuxapp.

New in v2:
- Removed rte_eth_dev_data.lro_bulk_alloc.
- Fixed a few styling and spelling issues.

---
 lib/librte_ether/rte_ethdev.h       |   9 +-
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c |   6 +
 lib/librte_pmd_ixgbe/ixgbe_ethdev.h |   5 +
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c   | 562 +++++++++++++++++++++++++++++++++++-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h   |   6 +
 5 files changed, 581 insertions(+), 7 deletions(-)
lib/librte_ether/rte_ethdev.h +7 -2
index 8db3127..44f081f 100644
@@ -172,6 +172,9 @@ extern "C" {
 
 #include <stdint.h>
 
+/* Use this macro to check if LRO API is supported */
+#define RTE_ETHDEV_HAS_LRO_SUPPORT
+
 #include <rte_log.h>
 #include <rte_interrupts.h>
 #include <rte_pci.h>
@@ -320,14 +323,15 @@ struct rte_eth_rxmode {
 	enum rte_eth_rx_mq_mode mq_mode;
 	uint32_t max_rx_pkt_len;  /**< Only used if jumbo_frame enabled. */
 	uint16_t split_hdr_size;  /**< hdr buf size (header_split enabled).*/
-	uint8_t header_split : 1, /**< Header Split enable. */
+	uint16_t header_split : 1, /**< Header Split enable. */
 		hw_ip_checksum   : 1, /**< IP/UDP/TCP checksum offload enable. */
 		hw_vlan_filter   : 1, /**< VLAN filter enable. */
 		hw_vlan_strip    : 1, /**< VLAN strip enable. */
 		hw_vlan_extend   : 1, /**< Extended VLAN enable. */
 		jumbo_frame      : 1, /**< Jumbo Frame Receipt enable. */
 		hw_strip_crc     : 1, /**< Enable CRC stripping by hardware. */
-		enable_scatter   : 1; /**< Enable scatter packets rx handler */
+		enable_scatter   : 1, /**< Enable scatter packets rx handler */
+		enable_lro       : 1; /**< Enable LRO */
 };
 
 /**
@@ -1515,6 +1519,7 @@ struct rte_eth_dev_data {
 	uint8_t port_id;           /**< Device [external] port identifier. */
 	uint8_t promiscuous   : 1, /**< RX promiscuous mode ON(1) / OFF(0). */
 		scattered_rx : 1,  /**< RX of scattered packets is ON(1) / OFF(0) */
+		lro          : 1,  /**< RX LRO is ON(1) / OFF(0) */
 		all_multicast : 1, /**< RX all multicast mode ON(1) / OFF(0). */
 		dev_started : 1;   /**< Device state: STARTED(1) / STOPPED(0). */
 };
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +6 -0
index 9d3de1a..765174d 100644
@@ -1648,6 +1648,7 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)
 
 	/* Clear stored conf */
 	dev->data->scattered_rx = 0;
+	dev->data->lro = 0;
 	hw->rx_bulk_alloc_allowed = false;
 	hw->rx_vec_allowed = false;
 
@@ -2018,6 +2019,11 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 		DEV_RX_OFFLOAD_IPV4_CKSUM |
 		DEV_RX_OFFLOAD_UDP_CKSUM  |
 		DEV_RX_OFFLOAD_TCP_CKSUM;
+
+	if (hw->mac.type == ixgbe_mac_82599EB ||
+	    hw->mac.type == ixgbe_mac_X540)
+		dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_TCP_LRO;
+
 	dev_info->tx_offload_capa =
 		DEV_TX_OFFLOAD_VLAN_INSERT |
 		DEV_TX_OFFLOAD_IPV4_CKSUM  |
lib/librte_pmd_ixgbe/ixgbe_ethdev.h +5 -0
index a549f5c..e206584 100644
@@ -349,6 +349,11 @@ uint16_t ixgbe_recv_pkts_bulk_alloc(void *rx_queue, struct rte_mbuf **rx_pkts,
 uint16_t ixgbe_recv_scattered_pkts(void *rx_queue,
 		struct rte_mbuf **rx_pkts, uint16_t nb_pkts);
 
+uint16_t ixgbe_recv_pkts_lro(void *rx_queue,
+		struct rte_mbuf **rx_pkts, uint16_t nb_pkts);
+uint16_t ixgbe_recv_pkts_lro_bulk_alloc(void *rx_queue,
+		struct rte_mbuf **rx_pkts, uint16_t nb_pkts);
+
 uint16_t ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		uint16_t nb_pkts);
 
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +557 -5

673 lines not on this page · raw message

lib/librte_pmd_ixgbe/ixgbe_rxtx.h +6 -0
index bbe5ff3..389173f 100644
@@ -79,6 +79,10 @@ struct igb_rx_entry {
 	struct rte_mbuf *mbuf; /**< mbuf associated with RX descriptor. */
 };
 
+struct igb_rsc_entry {
+	struct rte_mbuf *fbuf; /**< First segment of the fragmented packet. */
+};
+
 /**
  * Structure associated with each descriptor of the TX ring of a TX queue.
  */
@@ -105,6 +109,7 @@ struct igb_rx_queue {
 	volatile uint32_t   *rdt_reg_addr; /**< RDT register address. */
 	volatile uint32_t   *rdh_reg_addr; /**< RDH register address. */
 	struct igb_rx_entry *sw_ring; /**< address of RX software ring. */
+	struct igb_rsc_entry *sw_rsc_ring; /**< address of RSC software ring. */
 	struct rte_mbuf *pkt_first_seg; /**< First segment of current packet. */
 	struct rte_mbuf *pkt_last_seg; /**< Last segment of current packet. */
 	uint64_t            mbuf_initializer; /**< value to init mbufs */
@@ -126,6 +131,7 @@ struct igb_rx_queue {
 	uint8_t             port_id;  /**< Device port identifier. */
 	uint8_t             crc_len;  /**< 0 if CRC stripped, 4 otherwise. */
 	uint8_t             drop_en;  /**< If not 0, set SRRCTL.Drop_En. */
+	uint8_t             rsc_en;   /**< If not 0, RSC is enabled. */
 	uint8_t             rx_deferred_start; /**< not in global dev start. */
 #ifdef RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC
 	/** need to alloc dummy mbuf, for wraparound when scanning hw ring */
Signature · 1 line
2.1.0
#30 lore raw
In reply to a message not in the archive
Quoted 16 lines · Vlad Zolotarov

The series starts with some cleanup work in the code the final patch (the actual adding of the LRO support) is going to touch/use/change. There are still quite a few issues in the ixgbe PMD code left but they have to be a matter of a different series and I've left a few "TODO" remarks in the code.

The LRO ("RSC" in Intel's context) PMD completion handling code follows the same design as the corresponding Linux and FreeBSD implementation: pass the aggregation's cluster HEAD buffer to the NEXTP entry of the software ring till EOP is met.

HW configuration follows the corresponding specs: this feature is supported only by x540 and 82599 PF devices.

The feature has been tested with seastar TCP stack with the following configuration on Tx side:
- MTU: 400B
- 100 concurrent TCP connections.

Quoted 5 lines

The results were:
- Without LRO: total throughput: 0.12Gbps, coefficient of variance: 1.41%
- With LRO: total throughput: 8.21Gbps, coefficient of variance: 0.59%

This is an almost factor 80 improvement.

Pls., note that this series is a followup series to the "bug fixes in the ixgbe PF PMD Rx flow" series I've sent before.

thanks,
vlad

Quoted 36 lines

New in v5:
- Split the series into "bug fixes" and "all the rest" so that the former could be integrated into a 2.0 release.
- Put the RTE_ETHDEV_HAS_LRO_SUPPORT definition at the beginning of rte_ethdev.h.
- Removed the "TODO: Remove me" comment near RTE_ETHDEV_HAS_LRO_SUPPORT.

New in v4:
- Remove CONFIG_RTE_ETHDEV_LRO_SUPPORT from config/common_linuxapp.
- Define RTE_ETHDEV_HAS_LRO_SUPPORT in rte_ethdev.h.
- As a result of "ixgbe: check rxd number to avoid mbuf leak" (352078e8e) Vector Rx had to get the same treatment as Rx Bulk Alloc (see PATCH4 for more details).

New in v3:
- ixgbe_rx_alloc_bufs(): Always reset refcnt of the buffers to 1. Otherwise rte_pktmbuf_free() won't free them.

New in v2:
- Removed rte_eth_dev_data.lro_bulk_alloc and added ixgbe_hw.rx_bulk_alloc_allowed instead.
- Unified the rx_pkt_bulk callback setting (a separate new patch).
- Fixed a few styling and spelling issues.

Vlad Zolotarov (3):
ixgbe: Cleanups
ixgbe: Code refactoring
ixgbe: Add LRO support

  lib/librte_ether/rte_ethdev.h       |   9 +-
  lib/librte_pmd_ixgbe/ixgbe_ethdev.c |   6 +
  lib/librte_pmd_ixgbe/ixgbe_ethdev.h |   5 +
  lib/librte_pmd_ixgbe/ixgbe_rxtx.c   | 703 ++++++++++++++++++++++++++++++++----
  lib/librte_pmd_ixgbe/ixgbe_rxtx.h   |   6 +
  5 files changed, 662 insertions(+), 67 deletions(-)