Skip to contentSkip to conversation

ethdev: rte_eth_rx_burst() nb_pkts requirements

PATCH Applied Morten Brørup 5 participants 14 messages Sep 14, 2020 – Oct 30, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ethdev: rte_eth_rx_burst() nb_pkts requirements

Updated description of rte_eth_rx_burst() to reflect what drivers, when using vector instructions, expect from nb_pkts.

Also discussed on the mailing list here:
http://inbox.dpdk.org/dev/[email protected]/

---
 lib/librte_ethdev/rte_ethdev.h | 5 +++++
 1 file changed, 5 insertions(+)
lib/librte_ethdev/rte_ethdev.h +5 -0
index 70295d7ab..41f8ba4ef 100644
@@ -4469,6 +4469,10 @@ int rte_eth_dev_hairpin_capability_get(uint16_t port_id,
  * burst-oriented optimizations in both synchronous and asynchronous
  * packet processing environments with no overhead in both cases.
  *
+ * @note
+ *   Some drivers using vector instructions require that *nb_pkts* is
+ *   divisible by 4 or 8, depending on the driver implementation.
+ *
  * The rte_eth_rx_burst() function does not provide any error
  * notification to avoid the corresponding overhead. As a hint, the
  * upper-level application might check the status of the device link once
@@ -4485,6 +4489,7 @@ int rte_eth_dev_hairpin_capability_get(uint16_t port_id,
  *   must be large enough to store *nb_pkts* pointers in it.
  * @param nb_pkts
  *   The maximum number of packets to retrieve.
+ *   The value must be divisible by 8 in order to work with any driver.
  * @return
  *   The number of packets actually retrieved, which is the number
  *   of pointers to *rte_mbuf* structures effectively supplied to the
Signature · 1 line
2.17.1
#1 lore raw
Quoted 16 lines · Morten Brørup

Updated description of rte_eth_rx_burst() to reflect what drivers, when using vector instructions, expect from nb_pkts.

Also discussed on the mailing list here:
http://inbox.dpdk.org/dev/[email protected]/

---
 lib/librte_ethdev/rte_ethdev.h | 5 +++++
 1 file changed, 5 insertions(+)
lib/librte_ethdev/rte_ethdev.h +0 -0
index 70295d7ab..41f8ba4ef 100644

lib/librte_ethdev/rte_ethdev.h int rte_eth_dev_hairpin_capability_get(uint16_t port_id, · line 4475

Quoted 7 lines
lib/librte_ethdev/rte_ethdev.h +4 -0
@@ -4469,6 +4469,10 @@ int rte_eth_dev_hairpin_capability_get(uint16_t port_id,
  * burst-oriented optimizations in both synchronous and asynchronous
  * packet processing environments with no overhead in both cases.
  *
+ * @note
+ *   Some drivers using vector instructions require that *nb_pkts* is
+ *   divisible by 4 or 8, depending on the driver implementation.
+ *

Not technically true, in that the drivers will round the value down to the nearest multiple of 4 or 8. So how about rewording as:

"Some drivers using vector instructions may round the *nb_pkts* driver to a multiple of 4 or 8 depending upon the driver implementation."

lib/librte_ethdev/rte_ethdev.h int rte_eth_dev_hairpin_capability_get(uint16_t port_id, · line 4492

Quoted 8 lines
lib/librte_ethdev/rte_ethdev.h +1 -0
  * The rte_eth_rx_burst() function does not provide any error
  * notification to avoid the corresponding overhead. As a hint, the
  * upper-level application might check the status of the device link once
@@ -4485,6 +4489,7 @@ int rte_eth_dev_hairpin_capability_get(uint16_t port_id,
  *   must be large enough to store *nb_pkts* pointers in it.
  * @param nb_pkts
  *   The maximum number of packets to retrieve.
+ *   The value must be divisible by 8 in order to work with any driver.

Similarly here, I think it's better to state that it should be at least 8, and any values not divisible by 8 may be rounded down.

Quoted 6 lines
lib/librte_ethdev/rte_ethdev.h +0 -0
  * @return
  *   The number of packets actually retrieved, which is the number
  *   of pointers to *rte_mbuf* structures effectively supplied to the
Signature · 1 line
2.17.1
#2 lore raw

Re: [dpdk-dev] [PATCH] ethdev: rte_eth_rx_burst() nb_pktsrequirements

Quoted 33 lines

From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Monday, September 14, 2020 1:27 PM

Quoted 5 lines · Morten Brørup

Updated description of rte_eth_rx_burst() to reflect what drivers, when using vector instructions, expect from nb_pkts.

Also discussed on the mailing list here:

http://inbox.dpdk.org/dev/98CBD80474FA8B44BF855DF32C47DC35C61257@smarts
erver.smartshare.dk/

Review

Quoted 7 lines
---
 lib/librte_ethdev/rte_ethdev.h | 5 +++++
 1 file changed, 5 insertions(+)
(quoted diff) +0 -0

b/lib/librte_ethdev/rte_ethdev.h

lib/librte_ethdev/rte_ethdev.h int

Quoted 4 lines

index 70295d7ab..41f8ba4ef 100644

lib/librte_ethdev/rte_ethdev.h +0 -0
@@ -4469,6 +4469,10 @@ int

rte_eth_dev_hairpin_capability_get(uint16_t port_id,

lib/librte_ethdev/rte_ethdev.h int rte_eth_dev_hairpin_capability_get(uint16_t port_id,

Quoted 5 lines
lib/librte_ethdev/rte_ethdev.h +2 -0
  * burst-oriented optimizations in both synchronous and asynchronous
  * packet processing environments with no overhead in both cases.
  *
+ * @note
+ *   Some drivers using vector instructions require that *nb_pkts*

is

lib/librte_ethdev/rte_ethdev.h int rte_eth_dev_hairpin_capability_get(uint16_t port_id, · line 4475

Quoted 2 lines
lib/librte_ethdev/rte_ethdev.h +2 -0
+ *   divisible by 4 or 8, depending on the driver implementation.
+ *
Quoted 8 lines

Not technically true, in that the drivers will round the value down to the
nearest multiple of 4 or 8. So how about rewording as:

"Some drivers using vector instructions may round the *nb_pkts* driver to
a multiple of 4 or 8 depending upon the driver implementation."

You are correct about the driver behavior.

However, if you pass nb_pkts=9, the driver will return 8 packets, and thus it does not conform to the API behavior of returning nb_pkts if they are there.

This is why the description in this patch differs from the description we reached in the RFC discussion.

Quoted 23 lines

lib/librte_ethdev/rte_ethdev.h int rte_eth_dev_hairpin_capability_get(uint16_t port_id,

Quoted 3 lines
lib/librte_ethdev/rte_ethdev.h +0 -0
  * The rte_eth_rx_burst() function does not provide any error
  * notification to avoid the corresponding overhead. As a hint, the
  * upper-level application might check the status of the device link

once

lib/librte_ethdev/rte_ethdev.h int rte_eth_dev_hairpin_capability_get(uint16_t

Quoted 1 line
lib/librte_ethdev/rte_ethdev.h +0 -0
@@ -4485,6 +4489,7 @@ int rte_eth_dev_hairpin_capability_get(uint16_t

port_id,

lib/librte_ethdev/rte_ethdev.h int rte_eth_dev_hairpin_capability_get(uint16_t port_id,

Quoted 4 lines
lib/librte_ethdev/rte_ethdev.h +1 -0
  *   must be large enough to store *nb_pkts* pointers in it.
  * @param nb_pkts
  *   The maximum number of packets to retrieve.
+ *   The value must be divisible by 8 in order to work with any

driver.

Similarly here, I think it's better to state that it should be at least 8,
and any values not divisible by 8 may be rounded down.

lib/librte_ethdev/rte_ethdev.h int rte_eth_dev_hairpin_capability_get(uint16_t port_id,

Quoted 3 lines
lib/librte_ethdev/rte_ethdev.h +0 -0
  * @return
  *   The number of packets actually retrieved, which is the number
  *   of pointers to *rte_mbuf* structures effectively supplied to

the

Quoted 3 lines

--
2.17.1

#3 lore raw

Re: [dpdk-dev] [PATCH] ethdev: rte_eth_rx_burst() nb_pktsrequirements

Quoted 42 lines · Morten Brørup
Quoted 33 lines

From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Monday, September 14, 2020 1:27 PM

Quoted 5 lines · Morten Brørup

Updated description of rte_eth_rx_burst() to reflect what drivers, when using vector instructions, expect from nb_pkts.

Also discussed on the mailing list here:

http://inbox.dpdk.org/dev/98CBD80474FA8B44BF855DF32C47DC35C61257@smarts
erver.smartshare.dk/

Review

Quoted 7 lines
---
  lib/librte_ethdev/rte_ethdev.h | 5 +++++
  1 file changed, 5 insertions(+)
(quoted diff) +0 -0

b/lib/librte_ethdev/rte_ethdev.h

lib/librte_ethdev/rte_ethdev.h int

Quoted 4 lines

index 70295d7ab..41f8ba4ef 100644

lib/librte_ethdev/rte_ethdev.h +0 -0
@@ -4469,6 +4469,10 @@ int

rte_eth_dev_hairpin_capability_get(uint16_t port_id,

lib/librte_ethdev/rte_ethdev.h int rte_eth_dev_hairpin_capability_get(uint16_t port_id,

Quoted 5 lines
lib/librte_ethdev/rte_ethdev.h +2 -0
   * burst-oriented optimizations in both synchronous and asynchronous
   * packet processing environments with no overhead in both cases.
   *
+ * @note
+ *   Some drivers using vector instructions require that *nb_pkts*

is

lib/librte_ethdev/rte_ethdev.h int rte_eth_dev_hairpin_capability_get(uint16_t port_id, · line 4475

Quoted 2 lines
lib/librte_ethdev/rte_ethdev.h +2 -0
+ *   divisible by 4 or 8, depending on the driver implementation.
+ *
Quoted 8 lines

Not technically true, in that the drivers will round the value down to the
nearest multiple of 4 or 8. So how about rewording as:

"Some drivers using vector instructions may round the *nb_pkts* driver to
a multiple of 4 or 8 depending upon the driver implementation."

Quoted 8 lines

You are correct about the driver behavior.

However, if you pass nb_pkts=9, the driver will return 8 packets, and thus it does not conform to the API behavior of returning nb_pkts if they are there.

This is why the description in this patch differs from the description we reached in the RFC discussion.

Hi Morten, Bruce,

+1 to document the this behavior.

But in the patch the wording is more strict:
"... require that *nb_pkts* is divisible by 4 or 8 ..."
"... The value must be divisible by 8 in order to work with any driver."

I am not sure the requirement is that strict. Application still provide any value for 'nb_pkts', so the value doesn't "have to" be divisible 8/4.

But for vector PMD case it will return number of packets round down to 8/4. Perhaps can add for vector PMD it must be at least 4/8?

Bruce's explanation sound more accurate to me, what do you think?

Quoted 24 lines
Quoted 23 lines

lib/librte_ethdev/rte_ethdev.h int rte_eth_dev_hairpin_capability_get(uint16_t port_id,

Quoted 3 lines
lib/librte_ethdev/rte_ethdev.h +0 -0
   * The rte_eth_rx_burst() function does not provide any error
   * notification to avoid the corresponding overhead. As a hint, the
   * upper-level application might check the status of the device link

once

lib/librte_ethdev/rte_ethdev.h int rte_eth_dev_hairpin_capability_get(uint16_t

Quoted 1 line
lib/librte_ethdev/rte_ethdev.h +0 -0
@@ -4485,6 +4489,7 @@ int rte_eth_dev_hairpin_capability_get(uint16_t

port_id,

lib/librte_ethdev/rte_ethdev.h int rte_eth_dev_hairpin_capability_get(uint16_t port_id,

Quoted 4 lines
lib/librte_ethdev/rte_ethdev.h +1 -0
   *   must be large enough to store *nb_pkts* pointers in it.
   * @param nb_pkts
   *   The maximum number of packets to retrieve.
+ *   The value must be divisible by 8 in order to work with any

driver.

Similarly here, I think it's better to state that it should be at least 8,
and any values not divisible by 8 may be rounded down.

lib/librte_ethdev/rte_ethdev.h int rte_eth_dev_hairpin_capability_get(uint16_t port_id,

Quoted 3 lines
lib/librte_ethdev/rte_ethdev.h +0 -0
   * @return
   *   The number of packets actually retrieved, which is the number
   *   of pointers to *rte_mbuf* structures effectively supplied to

the

Quoted 3 lines

--
2.17.1

#4 lore raw

Re: [dpdk-dev] [PATCH] ethdev: rte_eth_rx_burst()nb_pktsrequirements

Quoted 64 lines

From: dev [mailto:[email protected]] On Behalf Of Ferruh Yigit
Sent: Tuesday, October 13, 2020 12:56 PM

Quoted 42 lines · Morten Brørup
Quoted 33 lines

From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Monday, September 14, 2020 1:27 PM

Quoted 5 lines · Morten Brørup

Updated description of rte_eth_rx_burst() to reflect what drivers, when using vector instructions, expect from nb_pkts.

Also discussed on the mailing list here:

http://inbox.dpdk.org/dev/98CBD80474FA8B44BF855DF32C47DC35C61257@smarts
erver.smartshare.dk/

Review

Quoted 7 lines
---
  lib/librte_ethdev/rte_ethdev.h | 5 +++++
  1 file changed, 5 insertions(+)
(quoted diff) +0 -0

b/lib/librte_ethdev/rte_ethdev.h

lib/librte_ethdev/rte_ethdev.h int

Quoted 4 lines

index 70295d7ab..41f8ba4ef 100644

lib/librte_ethdev/rte_ethdev.h +0 -0
@@ -4469,6 +4469,10 @@ int

rte_eth_dev_hairpin_capability_get(uint16_t port_id,

lib/librte_ethdev/rte_ethdev.h int rte_eth_dev_hairpin_capability_get(uint16_t port_id,

Quoted 5 lines
lib/librte_ethdev/rte_ethdev.h +2 -0
   * burst-oriented optimizations in both synchronous and asynchronous
   * packet processing environments with no overhead in both cases.
   *
+ * @note
+ *   Some drivers using vector instructions require that *nb_pkts*

is

lib/librte_ethdev/rte_ethdev.h int rte_eth_dev_hairpin_capability_get(uint16_t port_id, · line 4475

Quoted 2 lines
lib/librte_ethdev/rte_ethdev.h +2 -0
+ *   divisible by 4 or 8, depending on the driver implementation.
+ *
Quoted 8 lines

Not technically true, in that the drivers will round the value down to the
nearest multiple of 4 or 8. So how about rewording as:

"Some drivers using vector instructions may round the *nb_pkts* driver to
a multiple of 4 or 8 depending upon the driver implementation."

Quoted 7 lines

You are correct about the driver behavior.

However, if you pass nb_pkts=9, the driver will return 8 packets, and thus it does not conform to the API behavior of returning nb_pkts if they are there.

This is why the description in this patch differs from the description we

reached in the RFC discussion.

Quoted 1 line

Hi Morten, Bruce,

+1 to document the this behavior.

But in the patch the wording is more strict:
"... require that *nb_pkts* is divisible by 4 or 8 ..."
"... The value must be divisible by 8 in order to work with any driver."

Quoted 8 lines

I am not sure the requirement is that strict. Application still provide any value for 'nb_pkts', so the value doesn't "have to" be divisible 8/4.

But for vector PMD case it will return number of packets round down to 8/4. Perhaps can add for vector PMD it must be at least 4/8?

Bruce's explanation sound more accurate to me, what do you think?

I aim to keep the explanation in the documentation relatively simple. Keep the parameter description short, and add the details about vector driver behavior as a note to the function.

The reason for all this is the existing documentation describing how to use the rte_eth_rx_burst() function at high level:

The rte_eth_rx_burst() function returns the number of packets actually retrieved [...]. A return value equal to nb_pkts indicates [...] that other received packets remain in the input queue. Applications implementing a "retrieve as much received packets as possible" policy can check this specific case and keep invoking the rte_eth_rx_burst() function until a value less than nb_pkts is returned.

As an alternative to my proposed solution, we could add that vector drivers round down to 4 or 8, and the application's comparison of the nb_pkts and return value must consider this. But that would make the above description strangely complex, rather than just requiring that nb_pkts for vector drivers must be divisible by 4 or 8.

And as a minor detail, keeping my proposed restriction would also eliminate the vector drivers' need to round down.

I don't see a need to be able to call rte_eth_rx_burst() with a value not divisible by 4 or 8 for a vector driver, so my proposed restriction is a tradeoff favoring simplicity over unnecessary flexibility.

Quoted 26 lines
Quoted 25 lines
Quoted 24 lines

lib/librte_ethdev/rte_ethdev.h int rte_eth_dev_hairpin_capability_get(uint16_t port_id,

Quoted 4 lines
lib/librte_ethdev/rte_ethdev.h +0 -0
   * The rte_eth_rx_burst() function does not provide any error
   * notification to avoid the corresponding overhead. As a hint, the
   * upper-level application might check the status of the device link

once

lib/librte_ethdev/rte_ethdev.h int rte_eth_dev_hairpin_capability_get(uint16_t

Quoted 1 line
lib/librte_ethdev/rte_ethdev.h +0 -0
@@ -4485,6 +4489,7 @@ int rte_eth_dev_hairpin_capability_get(uint16_t

port_id,

lib/librte_ethdev/rte_ethdev.h int rte_eth_dev_hairpin_capability_get(uint16_t port_id,

Quoted 4 lines
lib/librte_ethdev/rte_ethdev.h +1 -0
   *   must be large enough to store *nb_pkts* pointers in it.
   * @param nb_pkts
   *   The maximum number of packets to retrieve.
+ *   The value must be divisible by 8 in order to work with any

driver.

Similarly here, I think it's better to state that it should be at least 8,
and any values not divisible by 8 may be rounded down.

lib/librte_ethdev/rte_ethdev.h int rte_eth_dev_hairpin_capability_get(uint16_t port_id,

Quoted 3 lines
lib/librte_ethdev/rte_ethdev.h +0 -0
   * @return
   *   The number of packets actually retrieved, which is the number
   *   of pointers to *rte_mbuf* structures effectively supplied to

the

Quoted 3 lines

--
2.17.1

#5 lore raw

Re: [dpdk-dev] [PATCH] ethdev: rte_eth_rx_burst()nb_pktsrequirements

14/10/2020 10:26, Morten Brørup:

Quoted 65 lines

From: Ferruh Yigit

Quoted 51 lines · Morten Brørup
Quoted 32 lines

From: Bruce Richardson

Quoted 22 lines · Morten Brørup
Quoted 5 lines

Updated description of rte_eth_rx_burst() to reflect what drivers, when using vector instructions, expect from nb_pkts.

Also discussed on the mailing list here:

http://inbox.dpdk.org/dev/98CBD80474FA8B44BF855DF32C47DC35C61257@smarts
erver.smartshare.dk/

lib/librte_ethdev/rte_ethdev.h int

Quoted 4 lines
lib/librte_ethdev/rte_ethdev.h +0 -0
@@ -4469,6 +4469,10 @@ int

rte_eth_dev_hairpin_capability_get(uint16_t port_id,

lib/librte_ethdev/rte_ethdev.h int rte_eth_dev_hairpin_capability_get(uint16_t port_id,

Quoted 5 lines
lib/librte_ethdev/rte_ethdev.h +2 -0
   * burst-oriented optimizations in both synchronous and asynchronous
   * packet processing environments with no overhead in both cases.
   *
+ * @note
+ *   Some drivers using vector instructions require that *nb_pkts*

is

lib/librte_ethdev/rte_ethdev.h int rte_eth_dev_hairpin_capability_get(uint16_t port_id, · line 4475

Quoted 2 lines
lib/librte_ethdev/rte_ethdev.h +2 -0
+ *   divisible by 4 or 8, depending on the driver implementation.
+ *
Quoted 8 lines

Not technically true, in that the drivers will round the value down to the
nearest multiple of 4 or 8. So how about rewording as:

"Some drivers using vector instructions may round the *nb_pkts* driver to
a multiple of 4 or 8 depending upon the driver implementation."

Quoted 7 lines

You are correct about the driver behavior.

However, if you pass nb_pkts=9, the driver will return 8 packets, and thus it does not conform to the API behavior of returning nb_pkts if they are there.

This is why the description in this patch differs from the description we

reached in the RFC discussion.

Quoted 1 line

Hi Morten, Bruce,

+1 to document the this behavior.

But in the patch the wording is more strict:
"... require that *nb_pkts* is divisible by 4 or 8 ..."
"... The value must be divisible by 8 in order to work with any driver."

Quoted 8 lines

I am not sure the requirement is that strict. Application still provide any value for 'nb_pkts', so the value doesn't "have to" be divisible 8/4.

But for vector PMD case it will return number of packets round down to 8/4. Perhaps can add for vector PMD it must be at least 4/8?

Bruce's explanation sound more accurate to me, what do you think?

I aim to keep the explanation in the documentation relatively simple. Keep the parameter description short, and add the details about vector driver behavior as a note to the function.

The reason for all this is the existing documentation describing how to use the rte_eth_rx_burst() function at high level:

Quoted 7 lines

The rte_eth_rx_burst() function returns the number of packets actually retrieved [...]. A return value equal to nb_pkts indicates [...] that other received packets remain in the input queue. Applications implementing a "retrieve as much received packets as possible" policy can check this specific case and keep invoking the rte_eth_rx_burst() function until a value less than nb_pkts is returned.

As an alternative to my proposed solution, we could add that vector drivers round down to 4 or 8, and the application's comparison of the nb_pkts and return value must consider this. But that would make the above description strangely complex, rather than just requiring that nb_pkts for vector drivers must be divisible by 4 or 8.

And as a minor detail, keeping my proposed restriction would also eliminate the vector drivers' need to round down.

I don't see a need to be able to call rte_eth_rx_burst() with a value not divisible by 4 or 8 for a vector driver, so my proposed restriction is a tradeoff favoring simplicity over unnecessary flexibility.

It makes sense to me.

#6 lore raw

Re: [dpdk-dev] [PATCH] ethdev: rte_eth_rx_burst()nb_pktsrequirements

Quoted 68 lines · Thomas Monjalon

14/10/2020 10:26, Morten Brørup:

Quoted 67 lines

From: Ferruh Yigit

Quoted 51 lines · Morten Brørup
Quoted 32 lines

From: Bruce Richardson

Quoted 22 lines · Morten Brørup
Quoted 5 lines

Updated description of rte_eth_rx_burst() to reflect what drivers, when using vector instructions, expect from nb_pkts.

Also discussed on the mailing list here:

http://inbox.dpdk.org/dev/98CBD80474FA8B44BF855DF32C47DC35C61257@smarts
erver.smartshare.dk/

lib/librte_ethdev/rte_ethdev.h int

Quoted 4 lines
lib/librte_ethdev/rte_ethdev.h +0 -0
@@ -4469,6 +4469,10 @@ int

rte_eth_dev_hairpin_capability_get(uint16_t port_id,

lib/librte_ethdev/rte_ethdev.h int rte_eth_dev_hairpin_capability_get(uint16_t port_id,

Quoted 5 lines
lib/librte_ethdev/rte_ethdev.h +2 -0
   * burst-oriented optimizations in both synchronous and asynchronous
   * packet processing environments with no overhead in both cases.
   *
+ * @note
+ *   Some drivers using vector instructions require that *nb_pkts*

is

lib/librte_ethdev/rte_ethdev.h int rte_eth_dev_hairpin_capability_get(uint16_t port_id, · line 4475

Quoted 2 lines
lib/librte_ethdev/rte_ethdev.h +2 -0
+ *   divisible by 4 or 8, depending on the driver implementation.
+ *
Quoted 8 lines

Not technically true, in that the drivers will round the value down to the
nearest multiple of 4 or 8. So how about rewording as:

"Some drivers using vector instructions may round the *nb_pkts* driver to
a multiple of 4 or 8 depending upon the driver implementation."

Quoted 7 lines

You are correct about the driver behavior.

However, if you pass nb_pkts=9, the driver will return 8 packets, and thus it does not conform to the API behavior of returning nb_pkts if they are there.

This is why the description in this patch differs from the description we

reached in the RFC discussion.

Quoted 1 line

Hi Morten, Bruce,

+1 to document the this behavior.

But in the patch the wording is more strict:
"... require that *nb_pkts* is divisible by 4 or 8 ..."
"... The value must be divisible by 8 in order to work with any driver."

Quoted 8 lines

I am not sure the requirement is that strict. Application still provide any value for 'nb_pkts', so the value doesn't "have to" be divisible 8/4.

But for vector PMD case it will return number of packets round down to 8/4. Perhaps can add for vector PMD it must be at least 4/8?

Bruce's explanation sound more accurate to me, what do you think?

I aim to keep the explanation in the documentation relatively simple. Keep the parameter description short, and add the details about vector driver behavior as a note to the function.

The reason for all this is the existing documentation describing how to use the rte_eth_rx_burst() function at high level:

The rte_eth_rx_burst() function returns the number of packets actually retrieved [...]. A return value equal to nb_pkts indicates [...] that other received packets remain in the input queue. Applications implementing a "retrieve as much received packets as possible" policy can check this specific case and keep invoking the rte_eth_rx_burst() function until a value less than nb_pkts is returned.

Quoted 8 lines
Quoted 5 lines

As an alternative to my proposed solution, we could add that vector drivers round down to 4 or 8, and the application's comparison of the nb_pkts and return value must consider this. But that would make the above description strangely complex, rather than just requiring that nb_pkts for vector drivers must be divisible by 4 or 8.

And as a minor detail, keeping my proposed restriction would also eliminate the vector drivers' need to round down.

I don't see a need to be able to call rte_eth_rx_burst() with a value not divisible by 4 or 8 for a vector driver, so my proposed restriction is a tradeoff favoring simplicity over unnecessary flexibility.

It makes sense to me.

That sounds reasonable for what we have now. We just need to standardize on either 4 or 8 as the required factor of the input size. I would suggest having it as 4, and look to put in fallback paths for the few drivers which don't support less than 8. I think that 8 is too large a min burst size to support, for any apps that want small bursts for lower latency.

/Bruce

#7 lore raw

Re: [dpdk-dev] [PATCH] ethdev: rte_eth_rx_burst()nb_pktsrequirements

Quoted 106 lines

From: Bruce Richardson [mailto:[email protected]]
Sent: Wednesday, October 14, 2020 11:30 AM

Quoted 6 lines · Thomas Monjalon

14/10/2020 10:26, Morten Brørup:

Quoted 5 lines

From: Ferruh Yigit

Quoted 4 lines · Morten Brørup
Quoted 3 lines

From: Bruce Richardson

Quoted 2 lines · Morten Brørup
Quoted 1 line

Updated description of rte_eth_rx_burst() to reflect what

drivers,

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

when using vector instructions, expect from nb_pkts.

Also discussed on the mailing list here:

http://inbox.dpdk.org/dev/98CBD80474FA8B44BF855DF32C47DC35C61257@smarts

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

erver.smartshare.dk/

lib/librte_ethdev/rte_ethdev.h int

Quoted 4 lines
lib/librte_ethdev/rte_ethdev.h +0 -0
@@ -4469,6 +4469,10 @@ int

rte_eth_dev_hairpin_capability_get(uint16_t port_id,

Quoted 1 line
lib/librte_ethdev/rte_ethdev.h +0 -0
   * burst-oriented optimizations in both synchronous and

asynchronous

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

lib/librte_ethdev/rte_ethdev.h int · line 4470

Quoted 1 line
lib/librte_ethdev/rte_ethdev.h +0 -0
   * packet processing environments with no overhead in both

cases.

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

lib/librte_ethdev/rte_ethdev.h int · line 4473

Quoted 3 lines
lib/librte_ethdev/rte_ethdev.h +2 -0
   *
+ * @note
+ *   Some drivers using vector instructions require that

*nb_pkts*

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

is

Quoted 1 line
lib/librte_ethdev/rte_ethdev.h +1 -0
+ *   divisible by 4 or 8, depending on the driver

implementation.

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

lib/librte_ethdev/rte_ethdev.h int · line 4475

Quoted 1 line
lib/librte_ethdev/rte_ethdev.h +1 -0
+ *

Not technically true, in that the drivers will round the value

down to

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

the
nearest multiple of 4 or 8. So how about rewording as:

"Some drivers using vector instructions may round the *nb_pkts*

driver

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines

to
a multiple of 4 or 8 depending upon the driver implementation."

You are correct about the driver behavior.

However, if you pass nb_pkts=9, the driver will return 8 packets, and thus it does not conform to the API behavior of returning

nb_pkts

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

if they are there.

This is why the description in this patch differs from the

description we

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

reached in the RFC discussion.

Quoted 1 line

Hi Morten, Bruce,

+1 to document the this behavior.

But in the patch the wording is more strict:
"... require that *nb_pkts* is divisible by 4 or 8 ..." "... The value must be divisible by 8 in order to work with any

driver."

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

I am not sure the requirement is that strict. Application still

provide any

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

value for 'nb_pkts', so the value doesn't "have to" be divisible 8/4.

But for vector PMD case it will return number of packets round down

to 8/4.

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

Perhaps can add for vector PMD it must be at least 4/8?

Bruce's explanation sound more accurate to me, what do you think?

I aim to keep the explanation in the documentation relatively simple.

Keep the parameter description short, and add the details about vector driver behavior as a note to the function.

Quoted 2 lines
Quoted 2 lines

The reason for all this is the existing documentation describing how to

use the rte_eth_rx_burst() function at high level:

Quoted 2 lines
Quoted 2 lines

The rte_eth_rx_burst() function returns the number of packets actually

retrieved [...]. A return value equal to nb_pkts indicates [...] that other received packets remain in the input queue. Applications implementing a "retrieve as much received packets as possible" policy can check this specific case and keep invoking the rte_eth_rx_burst() function until a value less than nb_pkts is returned.

Quoted 2 lines
Quoted 2 lines

As an alternative to my proposed solution, we could add that vector

drivers round down to 4 or 8, and the application's comparison of the nb_pkts and return value must consider this. But that would make the above description strangely complex, rather than just requiring that nb_pkts for vector drivers must be divisible by 4 or 8.

Quoted 2 lines
Quoted 2 lines

And as a minor detail, keeping my proposed restriction would also

eliminate the vector drivers' need to round down.

Quoted 2 lines
Quoted 2 lines

I don't see a need to be able to call rte_eth_rx_burst() with a value

not divisible by 4 or 8 for a vector driver, so my proposed restriction is a tradeoff favoring simplicity over unnecessary flexibility.

Quoted 1 line
Quoted 9 lines
Quoted 2 lines

It makes sense to me.

That sounds reasonable for what we have now. We just need to standardize on either 4 or 8 as the required factor of the input size. I would suggest having it as 4, and look to put in fallback paths for the few drivers which don't support less than 8. I think that 8 is too large a min burst size to support, for any apps that want small bursts for lower latency.

8 works with all drivers today, so I prefer 8. Also, it seems more future proof for even higher bandwidths. If you need low latency, don't use vector drivers. Also, DPDK generally seems to prefer throughput over latency, so 8 seems like the better choice to me.

Bruce, if you have a very strong preference for standardizing on 4 and you can convince the affected driver developers to modify their drivers to support 4, we can go ahead with that.

Quoted 1 line

/Bruce

#8 lore raw

Re: [dpdk-dev] [PATCH] ethdev: rte_eth_rx_burst()nb_pktsrequirements

Quoted 116 lines · Morten Brørup
Quoted 106 lines

From: Bruce Richardson [mailto:[email protected]]
Sent: Wednesday, October 14, 2020 11:30 AM

Quoted 6 lines · Thomas Monjalon

14/10/2020 10:26, Morten Brørup:

Quoted 5 lines

From: Ferruh Yigit

Quoted 4 lines · Morten Brørup
Quoted 3 lines

From: Bruce Richardson

Quoted 2 lines · Morten Brørup
Quoted 1 line

Updated description of rte_eth_rx_burst() to reflect what

drivers,

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

when using vector instructions, expect from nb_pkts.

Also discussed on the mailing list here:

http://inbox.dpdk.org/dev/98CBD80474FA8B44BF855DF32C47DC35C61257@smarts

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

erver.smartshare.dk/

lib/librte_ethdev/rte_ethdev.h int

Quoted 4 lines
lib/librte_ethdev/rte_ethdev.h +0 -0
@@ -4469,6 +4469,10 @@ int

rte_eth_dev_hairpin_capability_get(uint16_t port_id,

Quoted 1 line
lib/librte_ethdev/rte_ethdev.h +0 -0
   * burst-oriented optimizations in both synchronous and

asynchronous

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

lib/librte_ethdev/rte_ethdev.h int · line 4470

Quoted 1 line
lib/librte_ethdev/rte_ethdev.h +0 -0
   * packet processing environments with no overhead in both

cases.

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

lib/librte_ethdev/rte_ethdev.h int · line 4473

Quoted 3 lines
lib/librte_ethdev/rte_ethdev.h +2 -0
   *
+ * @note
+ *   Some drivers using vector instructions require that

*nb_pkts*

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

is

Quoted 1 line
lib/librte_ethdev/rte_ethdev.h +1 -0
+ *   divisible by 4 or 8, depending on the driver

implementation.

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

lib/librte_ethdev/rte_ethdev.h int · line 4475

Quoted 1 line
lib/librte_ethdev/rte_ethdev.h +1 -0
+ *

Not technically true, in that the drivers will round the value

down to

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

the
nearest multiple of 4 or 8. So how about rewording as:

"Some drivers using vector instructions may round the *nb_pkts*

driver

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines

to
a multiple of 4 or 8 depending upon the driver implementation."

You are correct about the driver behavior.

However, if you pass nb_pkts=9, the driver will return 8 packets, and thus it does not conform to the API behavior of returning

nb_pkts

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

if they are there.

This is why the description in this patch differs from the

description we

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

reached in the RFC discussion.

Quoted 1 line

Hi Morten, Bruce,

+1 to document the this behavior.

But in the patch the wording is more strict:
"... require that *nb_pkts* is divisible by 4 or 8 ..." "... The value must be divisible by 8 in order to work with any

driver."

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

I am not sure the requirement is that strict. Application still

provide any

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

value for 'nb_pkts', so the value doesn't "have to" be divisible 8/4.

But for vector PMD case it will return number of packets round down

to 8/4.

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

Perhaps can add for vector PMD it must be at least 4/8?

Bruce's explanation sound more accurate to me, what do you think?

I aim to keep the explanation in the documentation relatively simple.

Keep the parameter description short, and add the details about vector driver behavior as a note to the function.

Quoted 2 lines
Quoted 2 lines

The reason for all this is the existing documentation describing how to

use the rte_eth_rx_burst() function at high level:

Quoted 2 lines
Quoted 2 lines

The rte_eth_rx_burst() function returns the number of packets actually

retrieved [...]. A return value equal to nb_pkts indicates [...] that other received packets remain in the input queue. Applications implementing a "retrieve as much received packets as possible" policy can check this specific case and keep invoking the rte_eth_rx_burst() function until a value less than nb_pkts is returned.

Quoted 2 lines
Quoted 2 lines

As an alternative to my proposed solution, we could add that vector

drivers round down to 4 or 8, and the application's comparison of the nb_pkts and return value must consider this. But that would make the above description strangely complex, rather than just requiring that nb_pkts for vector drivers must be divisible by 4 or 8.

Quoted 2 lines
Quoted 2 lines

And as a minor detail, keeping my proposed restriction would also

eliminate the vector drivers' need to round down.

Quoted 2 lines
Quoted 2 lines

I don't see a need to be able to call rte_eth_rx_burst() with a value

not divisible by 4 or 8 for a vector driver, so my proposed restriction is a tradeoff favoring simplicity over unnecessary flexibility.

Quoted 1 line
Quoted 9 lines
Quoted 2 lines

It makes sense to me.

That sounds reasonable for what we have now. We just need to standardize on either 4 or 8 as the required factor of the input size. I would suggest having it as 4, and look to put in fallback paths for the few drivers which don't support less than 8. I think that 8 is too large a min burst size to support, for any apps that want small bursts for lower latency.

Quoted 4 lines

8 works with all drivers today, so I prefer 8. Also, it seems more future proof for even higher bandwidths. If you need low latency, don't use vector drivers. Also, DPDK generally seems to prefer throughput over latency, so 8 seems like the better choice to me.

Bruce, if you have a very strong preference for standardizing on 4 and you can convince the affected driver developers to modify their drivers to support 4, we can go ahead with that.

Let's go with 8 for now, and we can reduce in future if we can.

#9 lore raw

Re: [dpdk-dev] [PATCH] ethdev: rte_eth_rx_burst()nb_pktsrequirements

Quoted 141 lines

From: Bruce Richardson [mailto:[email protected]]
Sent: Wednesday, October 14, 2020 1:39 PM

Quoted 34 lines · Morten Brørup
Quoted 34 lines

From: Bruce Richardson [mailto:[email protected]]
Sent: Wednesday, October 14, 2020 11:30 AM

Quoted 6 lines · Thomas Monjalon

14/10/2020 10:26, Morten Brørup:

Quoted 5 lines

From: Ferruh Yigit

Quoted 4 lines · Morten Brørup
Quoted 3 lines

From: Bruce Richardson

Quoted 2 lines · Morten Brørup
Quoted 1 line

Updated description of rte_eth_rx_burst() to reflect what

drivers,

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

when using vector instructions, expect from nb_pkts.

Also discussed on the mailing list here:

http://inbox.dpdk.org/dev/98CBD80474FA8B44BF855DF32C47DC35C61257@smarts

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

erver.smartshare.dk/

lib/librte_ethdev/rte_ethdev.h int

Quoted 4 lines
lib/librte_ethdev/rte_ethdev.h +0 -0
@@ -4469,6 +4469,10 @@ int

rte_eth_dev_hairpin_capability_get(uint16_t port_id,

Quoted 1 line
lib/librte_ethdev/rte_ethdev.h +0 -0
   * burst-oriented optimizations in both synchronous and

asynchronous

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

lib/librte_ethdev/rte_ethdev.h int · line 4470

Quoted 1 line
lib/librte_ethdev/rte_ethdev.h +0 -0
   * packet processing environments with no overhead in both

cases.

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

lib/librte_ethdev/rte_ethdev.h int · line 4473

Quoted 3 lines
lib/librte_ethdev/rte_ethdev.h +2 -0
   *
+ * @note
+ *   Some drivers using vector instructions require that

*nb_pkts*

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

is

Quoted 1 line
lib/librte_ethdev/rte_ethdev.h +1 -0
+ *   divisible by 4 or 8, depending on the driver

implementation.

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

lib/librte_ethdev/rte_ethdev.h int · line 4475

Quoted 1 line
lib/librte_ethdev/rte_ethdev.h +1 -0
+ *

Not technically true, in that the drivers will round the value

down to

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

the
nearest multiple of 4 or 8. So how about rewording as:

"Some drivers using vector instructions may round the

*nb_pkts*

Quoted 3 lines
Quoted 3 lines

driver

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

to
a multiple of 4 or 8 depending upon the driver

implementation."

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line

You are correct about the driver behavior.

However, if you pass nb_pkts=9, the driver will return 8

packets,

Quoted 13 lines
Quoted 13 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

and thus it does not conform to the API behavior of returning

nb_pkts

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

if they are there.

This is why the description in this patch differs from the

description we

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

reached in the RFC discussion.

Quoted 1 line

Hi Morten, Bruce,

+1 to document the this behavior.

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

But in the patch the wording is more strict:
"... require that *nb_pkts* is divisible by 4 or 8 ..." "... The value must be divisible by 8 in order to work with any

driver."

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

I am not sure the requirement is that strict. Application still

provide any

Quoted 1 line
Quoted 1 line
Quoted 1 line

value for 'nb_pkts', so the value doesn't "have to" be divisible

8/4.

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

But for vector PMD case it will return number of packets round

down

Quoted 7 lines
Quoted 7 lines

to 8/4.

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

Perhaps can add for vector PMD it must be at least 4/8?

Bruce's explanation sound more accurate to me, what do you think?

I aim to keep the explanation in the documentation relatively

simple.

Quoted 4 lines
Quoted 4 lines

Keep the parameter description short, and add the details about vector driver behavior as a note to the function.

Quoted 2 lines
Quoted 2 lines

The reason for all this is the existing documentation describing

how to

Quoted 3 lines
Quoted 3 lines

use the rte_eth_rx_burst() function at high level:

Quoted 2 lines
Quoted 2 lines

The rte_eth_rx_burst() function returns the number of packets

actually

Quoted 1 line
Quoted 1 line

retrieved [...]. A return value equal to nb_pkts indicates [...] that

other

Quoted 8 lines
Quoted 8 lines

received packets remain in the input queue. Applications implementing a "retrieve as much received packets as possible" policy can check this specific case and keep invoking the rte_eth_rx_burst() function until a value less than nb_pkts is returned.

Quoted 2 lines
Quoted 2 lines

As an alternative to my proposed solution, we could add that vector

drivers round down to 4 or 8, and the application's comparison of the nb_pkts and return value must consider this. But that would make the

above

Quoted 1 line
Quoted 1 line

description strangely complex, rather than just requiring that nb_pkts

for

Quoted 6 lines
Quoted 6 lines

vector drivers must be divisible by 4 or 8.

Quoted 2 lines
Quoted 2 lines

And as a minor detail, keeping my proposed restriction would also

eliminate the vector drivers' need to round down.

Quoted 2 lines
Quoted 2 lines

I don't see a need to be able to call rte_eth_rx_burst() with a

value

Quoted 1 line
Quoted 1 line

not divisible by 4 or 8 for a vector driver, so my proposed restriction

is

Quoted 6 lines
Quoted 6 lines

a tradeoff favoring simplicity over unnecessary flexibility.

Quoted 3 lines

It makes sense to me.

That sounds reasonable for what we have now. We just need to

standardize on

Quoted 2 lines
Quoted 2 lines

either 4 or 8 as the required factor of the input size. I would suggest having it as 4, and look to put in fallback paths for the few drivers

which

Quoted 1 line
Quoted 1 line

don't support less than 8. I think that 8 is too large a min burst size

to

Quoted 4 lines
Quoted 2 lines

support, for any apps that want small bursts for lower latency.

8 works with all drivers today, so I prefer 8. Also, it seems more future

proof for even higher bandwidths. If you need low latency, don't use vector drivers. Also, DPDK generally seems to prefer throughput over latency, so 8 seems like the better choice to me.

Quoted 1 line
Quoted 5 lines
Quoted 1 line

Bruce, if you have a very strong preference for standardizing on 4 and

you can convince the affected driver developers to modify their drivers to support 4, we can go ahead with that.

Quoted 1 line

Let's go with 8 for now, and we can reduce in future if we can.

Great. If y'all agree now, can I get some Acks, then?

-Morten

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

From: Morten Brørup
Sent: Thursday, October 15, 2020 9:37 AM

Quoted 4 lines

From: Bruce Richardson [mailto:[email protected]]
Sent: Wednesday, October 14, 2020 1:39 PM

On Wed, Oct 14, 2020 at 01:14:13PM +0200, Morten Brørup wrote:

[...]

Quoted 9 lines
Quoted 1 line
Quoted 1 line

8 works with all drivers today, so I prefer 8. Also, it seems more

future

Quoted 1 line

proof for even higher bandwidths. If you need low latency, don't use

vector

Quoted 1 line

drivers. Also, DPDK generally seems to prefer throughput over

latency, so 8

Quoted 3 lines

seems like the better choice to me.

Quoted 2 lines

Bruce, if you have a very strong preference for standardizing on 4

Quoted 8 lines

and

Quoted 1 line

you can convince the affected driver developers to modify their

drivers to

Quoted 3 lines

support 4, we can go ahead with that.

Quoted 1 line

Let's go with 8 for now, and we can reduce in future if we can.

Great. If y'all agree now, can I get some Acks, then?

I think we agreed on the simple patch:
https://patchwork.dpdk.org/patch/77598/

Ack?

Acked-by on v1 1/1
#11 lore raw
In reply to Morten Brørup
Quoted 8 lines · Morten Brørup

Updated description of rte_eth_rx_burst() to reflect what drivers, when using vector instructions, expect from nb_pkts.

Also discussed on the mailing list here:
http://inbox.dpdk.org/dev/[email protected]/

Quoted 30 lines
---
 lib/librte_ethdev/rte_ethdev.h | 5 +++++
 1 file changed, 5 insertions(+)
lib/librte_ethdev/rte_ethdev.h +5 -1
index 70295d7ab..41f8ba4ef 100644
@@ -4469,6 +4469,10 @@ int rte_eth_dev_hairpin_capability_get(uint16_t port_id,
  * burst-oriented optimizations in both synchronous and asynchronous
  * packet processing environments with no overhead in both cases.
  *
+ * @note
+ *   Some drivers using vector instructions require that *nb_pkts* is
+ *   divisible by 4 or 8, depending on the driver implementation.
+ *
  * The rte_eth_rx_burst() function does not provide any error
  * notification to avoid the corresponding overhead. As a hint, the
  * upper-level application might check the status of the device link once
@@ -4485,6 +4489,7 @@ int rte_eth_dev_hairpin_capability_get(uint16_t port_id,
  *   must be large enough to store *nb_pkts* pointers in it.
  * @param nb_pkts
  *   The maximum number of packets to retrieve.
+ *   The value must be divisible by 8 in order to work with any driver.
  * @return
  *   The number of packets actually retrieved, which is the number
  *   of pointers to *rte_mbuf* structures effectively supplied to the
--

2.17.1

Acked-by on v1 1/1
#12 lore raw
In reply to Morten Brørup
Quoted 28 lines · Morten Brørup

Updated description of rte_eth_rx_burst() to reflect what drivers, when using vector instructions, expect from nb_pkts.

Also discussed on the mailing list here:
http://inbox.dpdk.org/dev/[email protected]/

---
 lib/librte_ethdev/rte_ethdev.h | 5 +++++
 1 file changed, 5 insertions(+)
lib/librte_ethdev/rte_ethdev.h +4 -0
index 70295d7ab..41f8ba4ef 100644
@@ -4469,6 +4469,10 @@ int rte_eth_dev_hairpin_capability_get(uint16_t port_id,
  * burst-oriented optimizations in both synchronous and asynchronous
  * packet processing environments with no overhead in both cases.
  *
+ * @note
+ *   Some drivers using vector instructions require that *nb_pkts* is
+ *   divisible by 4 or 8, depending on the driver implementation.
+ *
  * The rte_eth_rx_burst() function does not provide any error
  * notification to avoid the corresponding overhead. As a hint, the
  * upper-level application might check the status of the device link once

lib/librte_ethdev/rte_ethdev.h int rte_eth_dev_hairpin_capability_get(uint16_t port_id, · line 4495

Quoted 7 lines
lib/librte_ethdev/rte_ethdev.h +1 -0
@@ -4485,6 +4489,7 @@ int rte_eth_dev_hairpin_capability_get(uint16_t port_id,
  *   must be large enough to store *nb_pkts* pointers in it.
  * @param nb_pkts
  *   The maximum number of packets to retrieve.
+ *   The value must be divisible by 8 in order to work with any driver.
  * @return
  *   The number of packets actually retrieved, which is the number
  *   of pointers to *rte_mbuf* structures effectively supplied to the

This correctly documents the current situation, so following the discussion on-list:

Applied
#13 lore raw
Quoted 40 lines · Bruce Richardson
Quoted 28 lines · Morten Brørup

Updated description of rte_eth_rx_burst() to reflect what drivers, when using vector instructions, expect from nb_pkts.

Also discussed on the mailing list here:
http://inbox.dpdk.org/dev/[email protected]/

---
  lib/librte_ethdev/rte_ethdev.h | 5 +++++
  1 file changed, 5 insertions(+)
lib/librte_ethdev/rte_ethdev.h +4 -0
index 70295d7ab..41f8ba4ef 100644
@@ -4469,6 +4469,10 @@ int rte_eth_dev_hairpin_capability_get(uint16_t port_id,
   * burst-oriented optimizations in both synchronous and asynchronous
   * packet processing environments with no overhead in both cases.
   *
+ * @note
+ *   Some drivers using vector instructions require that *nb_pkts* is
+ *   divisible by 4 or 8, depending on the driver implementation.
+ *
   * The rte_eth_rx_burst() function does not provide any error
   * notification to avoid the corresponding overhead. As a hint, the
   * upper-level application might check the status of the device link once

lib/librte_ethdev/rte_ethdev.h int rte_eth_dev_hairpin_capability_get(uint16_t port_id, · line 4495

Quoted 7 lines
lib/librte_ethdev/rte_ethdev.h +1 -0
@@ -4485,6 +4489,7 @@ int rte_eth_dev_hairpin_capability_get(uint16_t port_id,
   *   must be large enough to store *nb_pkts* pointers in it.
   * @param nb_pkts
   *   The maximum number of packets to retrieve.
+ *   The value must be divisible by 8 in order to work with any driver.
   * @return
   *   The number of packets actually retrieved, which is the number
   *   of pointers to *rte_mbuf* structures effectively supplied to the

This correctly documents the current situation, so following the discussion on-list:

Quoted 2 lines

Applied to dpdk-next-net/main, thanks.