]> git.droids-corp.org - dpdk.git/commitdiff
net/thunderx: fix deadlock in Rx path
authorJerin Jacob <jerin.jacob@caviumnetworks.com>
Mon, 1 May 2017 18:41:55 +0000 (00:11 +0530)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 1 May 2017 20:23:57 +0000 (22:23 +0200)
RBDR buffers are refilled when SW consumes the buffers from CQ.
This creates deadlock case when CQ buffers exhausted due to lack
of RBDR buffers. Fix is to refill the RBDR when rx_free_thresh
meet, irrespective of the number of CQ buffers consumed.

Fixes: e2d7fc9f0a24 ("net/thunderx: add single and multi-segment Rx")
Cc: stable@dpdk.org
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
drivers/net/thunderx/nicvf_rxtx.c

index 003ab069305126e06d696831fa6dccf55cadf64a..6cae8341bdbafae80c2a68b88aec5319a156a68a 100644 (file)
@@ -464,11 +464,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;
@@ -555,11 +554,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;