Skip to contentSkip to conversation

ixgbe: fix check for split packets

PATCH Superseded Bruce Richardson 4 participants 11 messages Jul 21, 2015 – Jul 26, 2015 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ixgbe: fix check for split packets

The check for split packets to be reassembled in the vector ixgbe PMD was incorrectly only checking the first 16 elements of the array instead of all 32. This is fixed by changing the uint32_t values to be uint64_t instead.

Fixes cf4b4708a88a ("ixgbe: improve slow-path perf with vector scattered Rx")
---
 drivers/net/ixgbe/ixgbe_rxtx_vec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ixgbe/ixgbe_rxtx_vec.c +1 -1
index 9f24849..cdad3e0 100644
@@ -549,7 +549,7 @@ ixgbe_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 		return 0;
 
 	/* happy day case, full burst + no packets to be joined */
-	const uint32_t *split_fl32 = (uint32_t *)split_flags;
+	const uint64_t *split_fl32 = (uint64_t *)split_flags;
 	if (rxq->pkt_first_seg == NULL &&
 			split_fl32[0] == 0 && split_fl32[1] == 0 &&
 			split_fl32[2] == 0 && split_fl32[3] == 0)
Signature · 1 line
1.8.3.1
#1 lore raw

Hi Bruce,

Quoted 24 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Tuesday, July 21, 2015 11:25 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH] ixgbe: fix check for split packets

The check for split packets to be reassembled in the vector ixgbe PMD was incorrectly only checking the first 16 elements of the array instead of all 32. This is fixed by changing the uint32_t values to be uint64_t instead.

Fixes cf4b4708a88a ("ixgbe: improve slow-path perf with vector scattered Rx")
---
 drivers/net/ixgbe/ixgbe_rxtx_vec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ixgbe/ixgbe_rxtx_vec.c +0 -0
index 9f24849..cdad3e0 100644

drivers/net/ixgbe/ixgbe_rxtx_vec.c ixgbe_recv_scattered_pkts_vec(void *rx_queue, struct · line 553

Quoted 6 lines
drivers/net/ixgbe/ixgbe_rxtx_vec.c +1 -1
@@ -549,7 +549,7 @@ ixgbe_recv_scattered_pkts_vec(void *rx_queue, struct
 rte_mbuf **rx_pkts,
 		return 0;
 
 	/* happy day case, full burst + no packets to be joined */
-	const uint32_t *split_fl32 = (uint32_t *)split_flags;
+	const uint64_t *split_fl32 = (uint64_t *)split_flags;

Why not change the name to split_fl64? I don't think it's appropriate to keep it be split_fl32. Thanks.

Quoted 5 lines
drivers/net/ixgbe/ixgbe_rxtx_vec.c +0 -0
 	if (rxq->pkt_first_seg == NULL &&
 			split_fl32[0] == 0 && split_fl32[1] == 0 &&

split_fl32[2] == 0 && split_fl32[3] == 0)
--
1.8.3.1

#2 lore raw
Quoted 29 lines · Wenzhuo

Hi Bruce,

Quoted 27 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Tuesday, July 21, 2015 11:25 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH] ixgbe: fix check for split packets

The check for split packets to be reassembled in the vector ixgbe PMD was incorrectly only checking the first 16 elements of the array instead of all 32. This is fixed by changing the uint32_t values to be uint64_t instead.

Fixes cf4b4708a88a ("ixgbe: improve slow-path perf with vector scattered Rx")
---
 drivers/net/ixgbe/ixgbe_rxtx_vec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ixgbe/ixgbe_rxtx_vec.c +0 -0
index 9f24849..cdad3e0 100644
@@ -549,7 +549,7 @@ ixgbe_recv_scattered_pkts_vec(void *rx_queue, struct
 rte_mbuf **rx_pkts,
 		return 0;
 
Quoted 6 lines

drivers/net/ixgbe/ixgbe_rxtx_vec.c ixgbe_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, · line 552

Quoted 3 lines
drivers/net/ixgbe/ixgbe_rxtx_vec.c +1 -1
 	/* happy day case, full burst + no packets to be joined */
-	const uint32_t *split_fl32 = (uint32_t *)split_flags;
+	const uint64_t *split_fl32 = (uint64_t *)split_flags;

Why not change the name to split_fl64? I don't think it's appropriate to keep it be split_fl32. Thanks.

Quite right, that's the obvious change! I'll do a V2.

/Bruce

#3 lore raw

PATCH v2 1/1 ixgbe: fix check for split packets

In reply to Bruce Richardson

The check for split packets to be reassembled in the vector ixgbe PMD was incorrectly only checking the first 16 elements of the array instead of all 32. This is fixed by changing the uint32_t values to be uint64_t instead.

Fixes cf4b4708a88a ("ixgbe: improve slow-path perf with vector scattered Rx")

---
V2: Rename variable from split_fl32 to split_fl64 to match type change.

---
 drivers/net/ixgbe/ixgbe_rxtx_vec.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ixgbe/ixgbe_rxtx_vec.c +3 -3
index d3ac74a..f2052c6 100644
@@ -549,10 +549,10 @@ ixgbe_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 		return 0;
 
 	/* happy day case, full burst + no packets to be joined */
-	const uint32_t *split_fl32 = (uint32_t *)split_flags;
+	const uint64_t *split_fl64 = (uint64_t *)split_flags;
 	if (rxq->pkt_first_seg == NULL &&
-			split_fl32[0] == 0 && split_fl32[1] == 0 &&
-			split_fl32[2] == 0 && split_fl32[3] == 0)
+			split_fl64[0] == 0 && split_fl64[1] == 0 &&
+			split_fl64[2] == 0 && split_fl64[3] == 0)
 		return nb_bufs;
 
 	/* reassemble any packets that need reassembly*/
Signature · 1 line
2.4.3
#4 lore raw

Hi,

And what happens if someone changes RTE_IXGBE_VPMD_RX_BURST to something else than 32? I guess this bug were introduced when someone raised it from 16 to 32
I think you are better off with a for loop which uses this value. Or at least make a comment around RTE_IXGBE_VPMD_RX_BURST that if you change that value this check should be modified as well.

Regards,

Zoltan

Quoted 35 lines · Bruce Richardson

The check for split packets to be reassembled in the vector ixgbe PMD was incorrectly only checking the first 16 elements of the array instead of all 32. This is fixed by changing the uint32_t values to be uint64_t instead.

Fixes cf4b4708a88a ("ixgbe: improve slow-path perf with vector scattered Rx")

---
V2: Rename variable from split_fl32 to split_fl64 to match type change.

---
  drivers/net/ixgbe/ixgbe_rxtx_vec.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ixgbe/ixgbe_rxtx_vec.c +3 -3
index d3ac74a..f2052c6 100644
@@ -549,10 +549,10 @@ ixgbe_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
  		return 0;
 
  	/* happy day case, full burst + no packets to be joined */
-	const uint32_t *split_fl32 = (uint32_t *)split_flags;
+	const uint64_t *split_fl64 = (uint64_t *)split_flags;
  	if (rxq->pkt_first_seg == NULL &&
-			split_fl32[0] == 0 && split_fl32[1] == 0 &&
-			split_fl32[2] == 0 && split_fl32[3] == 0)
+			split_fl64[0] == 0 && split_fl64[1] == 0 &&
+			split_fl64[2] == 0 && split_fl64[3] == 0)
  		return nb_bufs;
 
  	/* reassemble any packets that need reassembly*/
#5 lore raw
Quoted 5 lines · Zoltan Kiss

Hi,

And what happens if someone changes RTE_IXGBE_VPMD_RX_BURST to something else than 32? I guess this bug were introduced when someone raised it from 16 to 32

Actually, no, this bug is purely due to me getting my maths wrong when I wrote this function. The vector PMD has always worked in bursts of 32 at a time.

Quoted 3 lines

I think you are better off with a for loop which uses this value. Or at least make a comment around RTE_IXGBE_VPMD_RX_BURST that if you change that value this check should be modified as well.

The vector PMD always works off a fixed 32 burst size. Any change to that will lead to many changes in the code, so I don't believe a loop is necessary.

Regards,
/Bruce

Quoted 41 lines

Regards,

Zoltan

Quoted 35 lines · Bruce Richardson

The check for split packets to be reassembled in the vector ixgbe PMD was incorrectly only checking the first 16 elements of the array instead of all 32. This is fixed by changing the uint32_t values to be uint64_t instead.

Fixes cf4b4708a88a ("ixgbe: improve slow-path perf with vector scattered Rx")

---
V2: Rename variable from split_fl32 to split_fl64 to match type change.

---
 drivers/net/ixgbe/ixgbe_rxtx_vec.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ixgbe/ixgbe_rxtx_vec.c +3 -3
index d3ac74a..f2052c6 100644
@@ -549,10 +549,10 @@ ixgbe_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 		return 0;
 
 	/* happy day case, full burst + no packets to be joined */
-	const uint32_t *split_fl32 = (uint32_t *)split_flags;
+	const uint64_t *split_fl64 = (uint64_t *)split_flags;
 	if (rxq->pkt_first_seg == NULL &&
-			split_fl32[0] == 0 && split_fl32[1] == 0 &&
-			split_fl32[2] == 0 && split_fl32[3] == 0)
+			split_fl64[0] == 0 && split_fl64[1] == 0 &&
+			split_fl64[2] == 0 && split_fl64[3] == 0)
 		return nb_bufs;
 
 	/* reassemble any packets that need reassembly*/
#6 lore raw
Quoted 11 lines · Bruce Richardson
Quoted 5 lines · Zoltan Kiss

Hi,

And what happens if someone changes RTE_IXGBE_VPMD_RX_BURST to something else than 32? I guess this bug were introduced when someone raised it from 16 to 32

Actually, no, this bug is purely due to me getting my maths wrong when I wrote this function. The vector PMD has always worked in bursts of 32 at a time.

Quoted 6 lines
Quoted 3 lines

I think you are better off with a for loop which uses this value. Or at least make a comment around RTE_IXGBE_VPMD_RX_BURST that if you change that value this check should be modified as well.

The vector PMD always works off a fixed 32 burst size. Any change to that will lead to many changes in the code, so I don't believe a loop is necessary.

Ok, then I suggest to make a comment around RTE_IXGBE_VPMD_RX_BURST that changing it needs a lot of other changes in the code elsewhere, e.g in this split_flags check. Btw. vPMD was a bit misleading abbreviation for me, it took me a while until I realized 'v' stands for 'vector', not 'virtualization' as in most cases nowadays.

Quoted 45 lines

Regards,
/Bruce

Quoted 41 lines

Regards,

Zoltan

Quoted 35 lines · Bruce Richardson

The check for split packets to be reassembled in the vector ixgbe PMD was incorrectly only checking the first 16 elements of the array instead of all 32. This is fixed by changing the uint32_t values to be uint64_t instead.

Fixes cf4b4708a88a ("ixgbe: improve slow-path perf with vector scattered Rx")

---
V2: Rename variable from split_fl32 to split_fl64 to match type change.

---
  drivers/net/ixgbe/ixgbe_rxtx_vec.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ixgbe/ixgbe_rxtx_vec.c +3 -3
index d3ac74a..f2052c6 100644
@@ -549,10 +549,10 @@ ixgbe_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
  		return 0;
 
  	/* happy day case, full burst + no packets to be joined */
-	const uint32_t *split_fl32 = (uint32_t *)split_flags;
+	const uint64_t *split_fl64 = (uint64_t *)split_flags;
  	if (rxq->pkt_first_seg == NULL &&
-			split_fl32[0] == 0 && split_fl32[1] == 0 &&
-			split_fl32[2] == 0 && split_fl32[3] == 0)
+			split_fl64[0] == 0 && split_fl64[1] == 0 &&
+			split_fl64[2] == 0 && split_fl64[3] == 0)
  		return nb_bufs;
 
  	/* reassemble any packets that need reassembly*/
#7 lore raw
Quoted 4 lines · Zoltan Kiss

Btw. vPMD was a bit misleading abbreviation for me, it took me a while until I realized 'v' stands for 'vector', not 'virtualization' as in most cases nowadays.

Though that's mostly my fault to not to check the documentation :)

#8 lore raw
In reply to Zoltan Kiss
Quoted 30 lines

-----Original Message-----
From: Zoltan Kiss [mailto:[email protected]]
Sent: Wednesday, July 22, 2015 2:20 PM
To: Richardson, Bruce
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] ixgbe: fix check for split packets

Quoted 12 lines · Bruce Richardson
Quoted 6 lines · Zoltan Kiss

Hi,

And what happens if someone changes RTE_IXGBE_VPMD_RX_BURST to something else than 32? I guess this bug were introduced when someone raised it from
16 to 32

Actually, no, this bug is purely due to me getting my maths wrong when I wrote this function. The vector PMD has always worked in bursts of 32 at a time.

Quoted 6 lines
Quoted 3 lines

I think you are better off with a for loop which uses this value. Or at least make a comment around RTE_IXGBE_VPMD_RX_BURST that if you change that value this check should be modified as well.

The vector PMD always works off a fixed 32 burst size. Any change to that will lead to many changes in the code, so I don't believe a loop is

Quoted 8 lines

necessary.

Ok, then I suggest to make a comment around RTE_IXGBE_VPMD_RX_BURST that changing it needs a lot of other changes in the code elsewhere, e.g in this split_flags check.
Btw. vPMD was a bit misleading abbreviation for me, it took me a while until I realized 'v' stands for 'vector', not 'virtualization' as in most cases nowadays.

Good idea. I'll try to submit a patch to add a comment if I get the chance - otherwise feel free to do so yourself.

As for the naming, yes, I suppose it can be confusing. :-) We possibly need to start calling these pieces of code SSE or AVX rather than just vector, since for some we may end up with multiple vector versions.

/Bruce

Quoted 50 lines
Quoted 24 lines

Regards,
/Bruce

Quoted 19 lines

Regards,

Zoltan

Quoted 13 lines · Bruce Richardson

The check for split packets to be reassembled in the vector ixgbe PMD was incorrectly only checking the first 16 elements of the array instead of all 32. This is fixed by changing the uint32_t values to be uint64_t instead.

Fixes cf4b4708a88a ("ixgbe: improve slow-path perf with vector

scattered Rx")

---
V2: Rename variable from split_fl32 to split_fl64 to match type

change.

Quoted 10 lines
Quoted 10 lines

drivers/net/ixgbe/ixgbe_rxtx_vec.c ixgbe_recv_scattered_pkts_vec(void *rx_queue,

Quoted 10 lines
---
  drivers/net/ixgbe/ixgbe_rxtx_vec.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ixgbe/ixgbe_rxtx_vec.c +0 -0
index d3ac74a..f2052c6 100644
@@ -549,10 +549,10 @@ ixgbe_recv_scattered_pkts_vec(void *rx_queue,

struct rte_mbuf **rx_pkts,

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
drivers/net/ixgbe/ixgbe_rxtx_vec.c +3 -3
  		return 0;
 
  	/* happy day case, full burst + no packets to be joined */
-	const uint32_t *split_fl32 = (uint32_t *)split_flags;
+	const uint64_t *split_fl64 = (uint64_t *)split_flags;
  	if (rxq->pkt_first_seg == NULL &&
-			split_fl32[0] == 0 && split_fl32[1] == 0 &&
-			split_fl32[2] == 0 && split_fl32[3] == 0)
+			split_fl64[0] == 0 && split_fl64[1] == 0 &&
+			split_fl64[2] == 0 && split_fl64[3] == 0)
  		return nb_bufs;
 
  	/* reassemble any packets that need reassembly*/
#9 lore raw

2015-07-22 13:35, Richardson, Bruce:

Quoted 13 lines

From: Zoltan Kiss [mailto:[email protected]]

Quoted 11 lines · Bruce Richardson
Quoted 2 lines

The vector PMD always works off a fixed 32 burst size. Any change to that will lead to many changes in the code, so I don't believe a loop is

necessary.

Ok, then I suggest to make a comment around RTE_IXGBE_VPMD_RX_BURST that changing it needs a lot of other changes in the code elsewhere, e.g in this split_flags check.
Btw. vPMD was a bit misleading abbreviation for me, it took me a while until I realized 'v' stands for 'vector', not 'virtualization' as in most cases nowadays.

Quoted 2 lines

Good idea. I'll try to submit a patch to add a comment if I get the chance
- otherwise feel free to do so yourself.

Why not do it in this patch?
Is it not enough related?

Quoted 3 lines

As for the naming, yes, I suppose it can be confusing. :-) We possibly need to start calling these pieces of code SSE or AVX rather than just vector, since for some we may end up with multiple vector versions.

+1 for SSE/AVX naming

#10 lore raw
In reply to Bruce Richardson
Quoted 5 lines

The check for split packets to be reassembled in the vector ixgbe PMD was incorrectly only checking the first 16 elements of the array instead of all 32. This is fixed by changing the uint32_t values to be uint64_t instead.

Quoted 7 lines
Fixes cf4b4708a88a ("ixgbe: improve slow-path perf with vector scattered Rx")

---
V2: Rename variable from split_fl32 to split_fl64 to match type change.

Applied, thanks