Add thunderx (LP: #1691659)
[deb_dpdk.git] / debian / patches / nicvf-0010-net-thunderx-fix-deadlock-in-Rx-path.patch
1 From b31eb105463fa1844c19fde382dd6bd294329831 Mon Sep 17 00:00:00 2001
2 From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
3 Date: Tue, 2 May 2017 00:11:55 +0530
4 Subject: [PATCH] net/thunderx: fix deadlock in Rx path
5
6 RBDR buffers are refilled when SW consumes the buffers from CQ.
7 This creates deadlock case when CQ buffers exhausted due to lack
8 of RBDR buffers. Fix is to refill the RBDR when rx_free_thresh
9 meet, irrespective of the number of CQ buffers consumed.
10
11 Fixes: e2d7fc9f0a24 ("net/thunderx: add single and multi-segment Rx")
12 Cc: stable@dpdk.org
13
14 Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
15 ---
16  drivers/net/thunderx/nicvf_rxtx.c | 18 ++++++++----------
17  1 file changed, 8 insertions(+), 10 deletions(-)
18
19 Origin: http://dpdk.org/browse/dpdk/commit/?id=b31eb105463fa1844c19fde382dd6bd294329831
20 Original-Author: Jerin Jacob <jerin.jacob@caviumnetworks.com>
21 Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/dpdk/+bug/1691659
22 Author: Christian Ehrhardt <christian.ehrhardt@canonical.com>
23 Last-Update: 2017-05-18
24
25 --- a/drivers/net/thunderx/nicvf_rxtx.c
26 +++ b/drivers/net/thunderx/nicvf_rxtx.c
27 @@ -469,11 +469,10 @@
28                 rxq->head = cqe_head;
29                 nicvf_addr_write(rxq->cq_door, to_process);
30                 rxq->recv_buffers += to_process;
31 -               if (rxq->recv_buffers > rxq->rx_free_thresh) {
32 -                       rxq->recv_buffers -= nicvf_fill_rbdr(rxq,
33 -                                               rxq->rx_free_thresh);
34 -                       NICVF_RX_ASSERT(rxq->recv_buffers >= 0);
35 -               }
36 +       }
37 +       if (rxq->recv_buffers > rxq->rx_free_thresh) {
38 +               rxq->recv_buffers -= nicvf_fill_rbdr(rxq, rxq->rx_free_thresh);
39 +               NICVF_RX_ASSERT(rxq->recv_buffers >= 0);
40         }
41  
42         return to_process;
43 @@ -563,11 +562,10 @@
44                 rxq->head = cqe_head;
45                 nicvf_addr_write(rxq->cq_door, to_process);
46                 rxq->recv_buffers += buffers_consumed;
47 -               if (rxq->recv_buffers > rxq->rx_free_thresh) {
48 -                       rxq->recv_buffers -=
49 -                               nicvf_fill_rbdr(rxq, rxq->rx_free_thresh);
50 -                       NICVF_RX_ASSERT(rxq->recv_buffers >= 0);
51 -               }
52 +       }
53 +       if (rxq->recv_buffers > rxq->rx_free_thresh) {
54 +               rxq->recv_buffers -= nicvf_fill_rbdr(rxq, rxq->rx_free_thresh);
55 +               NICVF_RX_ASSERT(rxq->recv_buffers >= 0);
56         }
57  
58         return to_process;