From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-000f0801.pphosted.com (mx0b-000f0801.pphosted.com [67.231.152.113]) by dpdk.org (Postfix) with ESMTP id BE8D73252 for ; Fri, 19 May 2017 19:56:19 +0200 (CEST) Received: from pps.filterd (m0048192.ppops.net [127.0.0.1]) by mx0b-000f0801.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v4JHuGwx005565; Fri, 19 May 2017 10:56:19 -0700 Received: from hq1wp-exmb12.corp.brocade.com ([144.49.131.13]) by mx0b-000f0801.pphosted.com with ESMTP id 2ae1e181ca-8 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 19 May 2017 10:56:19 -0700 Received: from confsjhq2-2-001.brocade.com (10.252.136.13) by HQ1WP-EXMB12.corp.brocade.com (10.70.20.186) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Fri, 19 May 2017 10:56:16 -0700 From: "Charles (Chas) Williams" To: CC: , Mandeep Rohilla Date: Fri, 19 May 2017 13:55:59 -0400 Message-ID: <1495216560-12920-5-git-send-email-ciwillia@brocade.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1495216560-12920-1-git-send-email-ciwillia@brocade.com> References: <1495216560-12920-1-git-send-email-ciwillia@brocade.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.252.136.13] X-ClientProxiedBy: hq1wp-excas11.corp.brocade.com (10.70.36.102) To HQ1WP-EXMB12.corp.brocade.com (10.70.20.186) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-05-19_11:, , signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1705190107 Subject: [dpdk-dev] [PATCH 5/6] net/vmxnet3: receive queue lockup and memleak X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 May 2017 17:56:20 -0000 From: Mandeep Rohilla The receive queue can lockup if all the rx descriptors have lost their mbufs and temporarily there are no mbufs available. This can happen if there is an mbuf leak or if the application holds on to the mbuf for a while. This also addresses an mbuf leak in an error condition during packet receive. Signed-off-by: Mandeep Rohilla --- drivers/net/vmxnet3/vmxnet3_rxtx.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index d8713a1..d21679d 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -731,6 +731,7 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) uint16_t nb_rx; uint32_t nb_rxd, idx; uint8_t ring_idx; + uint8_t i; vmxnet3_rx_queue_t *rxq; Vmxnet3_RxCompDesc *rcd; vmxnet3_buf_info_t *rbi; @@ -800,6 +801,12 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) (int)(rcd - (struct Vmxnet3_RxCompDesc *) rxq->comp_ring.base), rcd->rxdIdx); rte_pktmbuf_free_seg(rxm); + if (rxq->start_seg) { + struct rte_mbuf *start = rxq->start_seg; + + rxq->start_seg = NULL; + rte_pktmbuf_free(start); + } goto rcd_done; } @@ -893,6 +900,18 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) } } + /* + * Try to replenish the rx descriptors with the new mbufs + */ + for (i = 0; i < VMXNET3_RX_CMDRING_SIZE; i++) { + vmxnet3_post_rx_bufs(rxq, i); + if (unlikely(rxq->shared->ctrl.updateRxProd)) { + VMXNET3_WRITE_BAR0_REG(hw, + rxprod_reg[i] + + (rxq->queue_id * VMXNET3_REG_ALIGN), + rxq->cmd_ring[i].next2fill); + } + } return nb_rx; } -- 2.1.4