[v2] eventdev: fix Rx adapter event flush logic
Checks
Commit Message
The Rx adapter flushes events only if it has BATCH_SIZE
events buffered where BATCH_SIZE is set to 32, e.g., if a
single packet is sent, it is never passed to
eventdev. Fix this issue by adding an event buffer flush
either when a Rx queue is found to be empty or the adapter service
function has processed the max number of packets for an invocation.
Bugzilla ID: 277
Fixes: 6b83f5935543 ("eventdev: add event buffer flush in Rx adapter")
Reported-by: Matias Elo <matias.elo@nokia.com>
Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
---
lib/librte_eventdev/rte_event_eth_rx_adapter.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
v2:
* added Bugzilla ID
Comments
09/05/2019 06:50, Nikhil Rao:
> The Rx adapter flushes events only if it has BATCH_SIZE
> events buffered where BATCH_SIZE is set to 32, e.g., if a
> single packet is sent, it is never passed to
> eventdev. Fix this issue by adding an event buffer flush
> either when a Rx queue is found to be empty or the adapter service
> function has processed the max number of packets for an invocation.
>
> Bugzilla ID: 277
>
> Fixes: 6b83f5935543 ("eventdev: add event buffer flush in Rx adapter")
>
> Reported-by: Matias Elo <matias.elo@nokia.com>
>
> Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
> ---
> --- a/lib/librte_eventdev/rte_event_eth_rx_adapter.c
> +++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.c
> @@ -872,7 +872,7 @@ static uint16_t rxa_gcd_u16(uint16_t a, uint16_t b)
> - if (buf->count >= BATCH_SIZE)
> + if (buf->count)
I don't this code, but it looks you are removing a test
which was probably done on purpose.
By the way, you should make your test explicit with "!= 0".
On 2019-05-09 06:50, Nikhil Rao wrote:
> The Rx adapter flushes events only if it has BATCH_SIZE
> events buffered where BATCH_SIZE is set to 32, e.g., if a
> single packet is sent, it is never passed to
> eventdev. Fix this issue by adding an event buffer flush
> either when a Rx queue is found to be empty or the adapter service
> function has processed the max number of packets for an invocation.
>
> Bugzilla ID: 277
>
> Fixes: 6b83f5935543 ("eventdev: add event buffer flush in Rx adapter")
>
> Reported-by: Matias Elo <matias.elo@nokia.com>
>
> Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
> ---
> lib/librte_eventdev/rte_event_eth_rx_adapter.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> v2:
> * added Bugzilla ID
>
> diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.c b/lib/librte_eventdev/rte_event_eth_rx_adapter.c
> index 8d178be..fd3761b 100644
> --- a/lib/librte_eventdev/rte_event_eth_rx_adapter.c
> +++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.c
> @@ -872,7 +872,7 @@ static uint16_t rxa_gcd_u16(uint16_t a, uint16_t b)
> break;
> }
>
> - if (buf->count >= BATCH_SIZE)
> + if (buf->count)
> rxa_flush_event_buffer(rx_adapter);
>
> return nb_rx;
>
After this change, is there any point in having the event_enqueue_buffer
being a part of the rx_adapter struct? It could be stack allocated. In
the process, you could eliminate the rte_event copying that goes on and
the logic around that. Just make mbufs ETH_EVENT_BUFFER_SIZE in size,
and retry until the NIC queue is empty or you accumulated
ETH_EVENT_BUFFER_SIZE events. Then you ship it off to the event device.
On 2019-05-09 21:17, Thomas Monjalon wrote:
> 09/05/2019 06:50, Nikhil Rao:
>> The Rx adapter flushes events only if it has BATCH_SIZE
>> events buffered where BATCH_SIZE is set to 32, e.g., if a
>> single packet is sent, it is never passed to
>> eventdev. Fix this issue by adding an event buffer flush
>> either when a Rx queue is found to be empty or the adapter service
>> function has processed the max number of packets for an invocation.
>>
>> Bugzilla ID: 277
>>
>> Fixes: 6b83f5935543 ("eventdev: add event buffer flush in Rx adapter")
>>
>> Reported-by: Matias Elo <matias.elo@nokia.com>
>>
>> Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
>> ---
>> --- a/lib/librte_eventdev/rte_event_eth_rx_adapter.c
>> +++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.c
>> @@ -872,7 +872,7 @@ static uint16_t rxa_gcd_u16(uint16_t a, uint16_t b)
>> - if (buf->count >= BATCH_SIZE)
>> + if (buf->count)
>
> I don't this code, but it looks you are removing a test
> which was probably done on purpose.
> By the way, you should make your test explicit with "!= 0".
>
"> 0". count is unsigned.
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Friday, May 10, 2019 12:48 AM
> To: Rao, Nikhil <nikhil.rao@intel.com>
> Cc: dev@dpdk.org; jerinj@marvell.com; matias.elo@nokia.com
> Subject: Re: [dpdk-dev] [PATCH v2] eventdev: fix Rx adapter event flush logic
>
> 09/05/2019 06:50, Nikhil Rao:
> > The Rx adapter flushes events only if it has BATCH_SIZE events
> > buffered where BATCH_SIZE is set to 32, e.g., if a single packet is
> > sent, it is never passed to eventdev. Fix this issue by adding an
> > event buffer flush either when a Rx queue is found to be empty or the
> > adapter service function has processed the max number of packets for
> > an invocation.
> >
> > Bugzilla ID: 277
> >
> > Fixes: 6b83f5935543 ("eventdev: add event buffer flush in Rx adapter")
> >
> > Reported-by: Matias Elo <matias.elo@nokia.com>
> >
> > Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
> > ---
> > --- a/lib/librte_eventdev/rte_event_eth_rx_adapter.c
> > +++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.c
> > @@ -872,7 +872,7 @@ static uint16_t rxa_gcd_u16(uint16_t a, uint16_t b)
> > - if (buf->count >= BATCH_SIZE)
> > + if (buf->count)
>
> I don't this code, but it looks you are removing a test which was probably
> done on purpose.
The previous test (against BATCH_SIZE) resulted in events permanently sitting
in the buffer if the number of events in the buffer was less than BATCH_SIZE.
> By the way, you should make your test explicit with "!= 0".
>
Done.
Thanks,
Nikhil
> -----Original Message-----
> From: Mattias Rönnblom [mailto:mattias.ronnblom@ericsson.com]
> Sent: Friday, May 10, 2019 12:52 AM
> To: Rao, Nikhil <nikhil.rao@intel.com>; jerinj@marvell.com
> Cc: dev@dpdk.org; matias.elo@nokia.com
> Subject: Re: [dpdk-dev] [PATCH v2] eventdev: fix Rx adapter event flush logic
>
> On 2019-05-09 06:50, Nikhil Rao wrote:
> > The Rx adapter flushes events only if it has BATCH_SIZE events
> > buffered where BATCH_SIZE is set to 32, e.g., if a single packet is
> > sent, it is never passed to eventdev. Fix this issue by adding an
> > event buffer flush either when a Rx queue is found to be empty or the
> > adapter service function has processed the max number of packets for
> > an invocation.
> >
> > Bugzilla ID: 277
> >
> > Fixes: 6b83f5935543 ("eventdev: add event buffer flush in Rx adapter")
> >
> > Reported-by: Matias Elo <matias.elo@nokia.com>
> >
> > Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
> > ---
> > lib/librte_eventdev/rte_event_eth_rx_adapter.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > v2:
> > * added Bugzilla ID
> >
> > diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.c
> > b/lib/librte_eventdev/rte_event_eth_rx_adapter.c
> > index 8d178be..fd3761b 100644
> > --- a/lib/librte_eventdev/rte_event_eth_rx_adapter.c
> > +++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.c
> > @@ -872,7 +872,7 @@ static uint16_t rxa_gcd_u16(uint16_t a, uint16_t b)
> > break;
> > }
> >
> > - if (buf->count >= BATCH_SIZE)
> > + if (buf->count)
> > rxa_flush_event_buffer(rx_adapter);
> >
> > return nb_rx;
> >
>
> After this change, is there any point in having the event_enqueue_buffer
> being a part of the rx_adapter struct? It could be stack allocated. In the
> process, you could eliminate the rte_event copying that goes on and the
> logic around that. Just make mbufs ETH_EVENT_BUFFER_SIZE in size, and
> retry until the NIC queue is empty or you accumulated
> ETH_EVENT_BUFFER_SIZE events. Then you ship it off to the event device.
You are right, I will post a separate (from the bug fix) patch for this.
Thanks,
Nikhil
@@ -872,7 +872,7 @@ static uint16_t rxa_gcd_u16(uint16_t a, uint16_t b)
break;
}
- if (buf->count >= BATCH_SIZE)
+ if (buf->count)
rxa_flush_event_buffer(rx_adapter);
return nb_rx;