From: Alejandro Lucero Date: Thu, 22 Feb 2018 11:30:39 +0000 (+0000) Subject: net/nfp: fix barrier location X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=f598e1a2d0e29293b924119c1b3cdd4e16756e95;p=dpdk.git net/nfp: fix barrier location The barrier needs to be after reading the DD bit. It has not been a problem because the potential reads which can not happen before reading the DD bit seem to be far enough, so the compiler is not rescheduling them. However, a refactoring could make this problem to arise. Fixes: b812daadad0d ("nfp: add Rx and Tx") Cc: stable@dpdk.org Signed-off-by: Alejandro Lucero --- diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index 5180a3189c..fc501d6e8c 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -2019,16 +2019,16 @@ nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) break; } + rxds = &rxq->rxds[rxq->rd_p]; + if ((rxds->rxd.meta_len_dd & PCIE_DESC_RX_DD) == 0) + break; + /* * Memory barrier to ensure that we won't do other * reads before the DD bit. */ rte_rmb(); - rxds = &rxq->rxds[rxq->rd_p]; - if ((rxds->rxd.meta_len_dd & PCIE_DESC_RX_DD) == 0) - break; - /* * We got a packet. Let's alloc a new mbuff for refilling the * free descriptor ring as soon as possible