From: Andrew Rybchenko Date: Wed, 3 Oct 2018 09:03:51 +0000 (+0100) Subject: net/sfc: avoid dummy writes to Rx queue state structure X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=3ac6ddd4281e18e10947cd15fe96262b7a7eb9b3;p=dpdk.git net/sfc: avoid dummy writes to Rx queue state structure If there is no packets to be processed, it does not make sense to write the same values back to Rx queue structure. Signed-off-by: Andrew Rybchenko Reviewed-by: Ivan Malov --- diff --git a/drivers/net/sfc/sfc_ef10_rx.c b/drivers/net/sfc/sfc_ef10_rx.c index 8d0e69c649..0986102109 100644 --- a/drivers/net/sfc/sfc_ef10_rx.c +++ b/drivers/net/sfc/sfc_ef10_rx.c @@ -191,14 +191,18 @@ sfc_ef10_rx_prepared(struct sfc_ef10_rxq *rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) { uint16_t n_rx_pkts = RTE_MIN(nb_pkts, rxq->prepared); - unsigned int completed = rxq->completed; - unsigned int i; - rxq->prepared -= n_rx_pkts; - rxq->completed = completed + n_rx_pkts; + if (n_rx_pkts != 0) { + unsigned int completed = rxq->completed; - for (i = 0; i < n_rx_pkts; ++i, ++completed) - rx_pkts[i] = rxq->sw_ring[completed & rxq->ptr_mask].mbuf; + rxq->prepared -= n_rx_pkts; + rxq->completed = completed + n_rx_pkts; + + do { + *rx_pkts++ = + rxq->sw_ring[completed++ & rxq->ptr_mask].mbuf; + } while (completed != rxq->completed); + } return n_rx_pkts; }