All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] examples/distributor: fix Rx thread logic for zero packets
@ 2016-07-14 15:48 Reshma Pattan
  2016-07-15  9:59 ` De Lara Guarch, Pablo
  0 siblings, 1 reply; 4+ messages in thread
From: Reshma Pattan @ 2016-07-14 15:48 UTC (permalink / raw)
  To: dev; +Cc: Reshma Pattan

From: Reshma Pattan <reshma.pattan@intel.com>

Zero packets can be returned by rte_eth_rx_burst() and
rte_distributor_returned_pkts() inside lcore_rx(), so
for zero packet scenario instead of proceeding to
next operations we should continue to the next iteration of the
loop to avoid unnecessary processing overhead which is causing
rx packets to be dropped and hence distributor failing to forward the
packets.

Fixes: 07db4a97 ("examples/distributor: new sample app")

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
---
 examples/distributor/main.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/examples/distributor/main.c b/examples/distributor/main.c
index 24857f2..537cee1 100644
--- a/examples/distributor/main.c
+++ b/examples/distributor/main.c
@@ -221,14 +221,22 @@ lcore_rx(struct lcore_params *p)
 		struct rte_mbuf *bufs[BURST_SIZE*2];
 		const uint16_t nb_rx = rte_eth_rx_burst(port, 0, bufs,
 				BURST_SIZE);
+		if (unlikely(nb_rx == 0)) {
+			if (++port == nb_ports)
+				port = 0;
+			continue;
+		}
 		app_stats.rx.rx_pkts += nb_rx;
 
 		rte_distributor_process(d, bufs, nb_rx);
 		const uint16_t nb_ret = rte_distributor_returned_pkts(d,
 				bufs, BURST_SIZE*2);
 		app_stats.rx.returned_pkts += nb_ret;
-		if (unlikely(nb_ret == 0))
+		if (unlikely(nb_ret == 0)) {
+			if (++port == nb_ports)
+				port = 0;
 			continue;
+		}
 
 		uint16_t sent = rte_ring_enqueue_burst(r, (void *)bufs, nb_ret);
 		app_stats.rx.enqueued_pkts += sent;
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] examples/distributor: fix Rx thread logic for zero packets
  2016-07-14 15:48 [PATCH] examples/distributor: fix Rx thread logic for zero packets Reshma Pattan
@ 2016-07-15  9:59 ` De Lara Guarch, Pablo
  2016-07-15 21:44   ` Thomas Monjalon
  0 siblings, 1 reply; 4+ messages in thread
From: De Lara Guarch, Pablo @ 2016-07-15  9:59 UTC (permalink / raw)
  To: Pattan, Reshma, dev; +Cc: Pattan, Reshma



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Reshma Pattan
> Sent: Thursday, July 14, 2016 4:49 PM
> To: dev@dpdk.org
> Cc: Pattan, Reshma
> Subject: [dpdk-dev] [PATCH] examples/distributor: fix Rx thread logic for zero
> packets
> 
> From: Reshma Pattan <reshma.pattan@intel.com>
> 
> Zero packets can be returned by rte_eth_rx_burst() and
> rte_distributor_returned_pkts() inside lcore_rx(), so
> for zero packet scenario instead of proceeding to
> next operations we should continue to the next iteration of the
> loop to avoid unnecessary processing overhead which is causing
> rx packets to be dropped and hence distributor failing to forward the
> packets.
> 
> Fixes: 07db4a97 ("examples/distributor: new sample app")
> 
> Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>

Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] examples/distributor: fix Rx thread logic for zero packets
  2016-07-15  9:59 ` De Lara Guarch, Pablo
@ 2016-07-15 21:44   ` Thomas Monjalon
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2016-07-15 21:44 UTC (permalink / raw)
  To: Pattan, Reshma; +Cc: dev, De Lara Guarch, Pablo

> > Zero packets can be returned by rte_eth_rx_burst() and
> > rte_distributor_returned_pkts() inside lcore_rx(), so
> > for zero packet scenario instead of proceeding to
> > next operations we should continue to the next iteration of the
> > loop to avoid unnecessary processing overhead which is causing
> > rx packets to be dropped and hence distributor failing to forward the
> > packets.
> > 
> > Fixes: 07db4a97 ("examples/distributor: new sample app")
> > 
> > Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
> 
> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] examples/distributor: fix Rx thread logic for zero packets
@ 2016-07-17 14:05 Liu, Yong
  0 siblings, 0 replies; 4+ messages in thread
From: Liu, Yong @ 2016-07-17 14:05 UTC (permalink / raw)
  To: Pattan, Reshma, dev; +Cc: Pattan, Reshma

Tested-by: Marvin Liu <yong.liu@intel.com>

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Reshma Pattan
> Sent: Thursday, July 14, 2016 11:49 PM
> To: dev@dpdk.org
> Cc: Pattan, Reshma
> Subject: [dpdk-dev] [PATCH] examples/distributor: fix Rx thread logic for
> zero packets
> 
> From: Reshma Pattan <reshma.pattan@intel.com>
> 
> Zero packets can be returned by rte_eth_rx_burst() and
> rte_distributor_returned_pkts() inside lcore_rx(), so
> for zero packet scenario instead of proceeding to
> next operations we should continue to the next iteration of the
> loop to avoid unnecessary processing overhead which is causing
> rx packets to be dropped and hence distributor failing to forward the
> packets.
> 
> Fixes: 07db4a97 ("examples/distributor: new sample app")
> 
> Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
> ---
>  examples/distributor/main.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/examples/distributor/main.c b/examples/distributor/main.c
> index 24857f2..537cee1 100644
> --- a/examples/distributor/main.c
> +++ b/examples/distributor/main.c
> @@ -221,14 +221,22 @@ lcore_rx(struct lcore_params *p)
>  		struct rte_mbuf *bufs[BURST_SIZE*2];
>  		const uint16_t nb_rx = rte_eth_rx_burst(port, 0, bufs,
>  				BURST_SIZE);
> +		if (unlikely(nb_rx == 0)) {
> +			if (++port == nb_ports)
> +				port = 0;
> +			continue;
> +		}
>  		app_stats.rx.rx_pkts += nb_rx;
> 
>  		rte_distributor_process(d, bufs, nb_rx);
>  		const uint16_t nb_ret = rte_distributor_returned_pkts(d,
>  				bufs, BURST_SIZE*2);
>  		app_stats.rx.returned_pkts += nb_ret;
> -		if (unlikely(nb_ret == 0))
> +		if (unlikely(nb_ret == 0)) {
> +			if (++port == nb_ports)
> +				port = 0;
>  			continue;
> +		}
> 
>  		uint16_t sent = rte_ring_enqueue_burst(r, (void *)bufs,
> nb_ret);
>  		app_stats.rx.enqueued_pkts += sent;
> --
> 2.5.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-07-17 14:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-14 15:48 [PATCH] examples/distributor: fix Rx thread logic for zero packets Reshma Pattan
2016-07-15  9:59 ` De Lara Guarch, Pablo
2016-07-15 21:44   ` Thomas Monjalon
2016-07-17 14:05 Liu, Yong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.