Imported Upstream version 16.11.2
[deb_dpdk.git] / drivers / net / thunderx / nicvf_rxtx.c
index e15c730..87e9de1 100644 (file)
@@ -368,7 +368,8 @@ nicvf_fill_rbdr(struct nicvf_rxq *rxq, int to_fill)
        void *obj_p[NICVF_MAX_RX_FREE_THRESH] __rte_cache_aligned;
 
        if (unlikely(rte_mempool_get_bulk(rxq->pool, obj_p, to_fill) < 0)) {
-               rxq->nic->eth_dev->data->rx_mbuf_alloc_failed += to_fill;
+               rte_eth_devices[rxq->port_id].data->rx_mbuf_alloc_failed +=
+                       to_fill;
                return 0;
        }
 
@@ -468,11 +469,10 @@ nicvf_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
                rxq->head = cqe_head;
                nicvf_addr_write(rxq->cq_door, to_process);
                rxq->recv_buffers += to_process;
-               if (rxq->recv_buffers > rxq->rx_free_thresh) {
-                       rxq->recv_buffers -= nicvf_fill_rbdr(rxq,
-                                               rxq->rx_free_thresh);
-                       NICVF_RX_ASSERT(rxq->recv_buffers >= 0);
-               }
+       }
+       if (rxq->recv_buffers > rxq->rx_free_thresh) {
+               rxq->recv_buffers -= nicvf_fill_rbdr(rxq, rxq->rx_free_thresh);
+               NICVF_RX_ASSERT(rxq->recv_buffers >= 0);
        }
 
        return to_process;
@@ -562,11 +562,10 @@ nicvf_recv_pkts_multiseg(void *rx_queue, struct rte_mbuf **rx_pkts,
                rxq->head = cqe_head;
                nicvf_addr_write(rxq->cq_door, to_process);
                rxq->recv_buffers += buffers_consumed;
-               if (rxq->recv_buffers > rxq->rx_free_thresh) {
-                       rxq->recv_buffers -=
-                               nicvf_fill_rbdr(rxq, rxq->rx_free_thresh);
-                       NICVF_RX_ASSERT(rxq->recv_buffers >= 0);
-               }
+       }
+       if (rxq->recv_buffers > rxq->rx_free_thresh) {
+               rxq->recv_buffers -= nicvf_fill_rbdr(rxq, rxq->rx_free_thresh);
+               NICVF_RX_ASSERT(rxq->recv_buffers >= 0);
        }
 
        return to_process;