From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0089.outbound.protection.outlook.com [104.47.2.89]) by dpdk.org (Postfix) with ESMTP id AFD8C567C for ; Fri, 8 Jan 2016 15:39:49 +0100 (CET) Received: from AMSPR02CA0043.eurprd02.prod.outlook.com (10.242.225.171) by VI1PR02MB1021.eurprd02.prod.outlook.com (10.163.163.19) with Microsoft SMTP Server (TLS) id 15.1.361.13; Fri, 8 Jan 2016 14:39:47 +0000 Received: from DB3FFO11OLC004.protection.gbl (2a01:111:f400:7e04::191) by AMSPR02CA0043.outlook.office365.com (2a01:111:e400:8028::43) with Microsoft SMTP Server (TLS) id 15.1.365.19 via Frontend Transport; Fri, 8 Jan 2016 14:39:47 +0000 Authentication-Results: spf=fail (sender IP is 12.216.194.146) smtp.mailfrom=ezchip.com; ezchip.com; dkim=none (message not signed) header.d=none;ezchip.com; dmarc=none action=none header.from=ezchip.com; Received-SPF: Fail (protection.outlook.com: domain of ezchip.com does not designate 12.216.194.146 as permitted sender) receiver=protection.outlook.com; client-ip=12.216.194.146; helo=lab-14.internal.tilera.com; Received: from lab-14.internal.tilera.com (12.216.194.146) by DB3FFO11OLC004.mail.protection.outlook.com (10.47.217.132) with Microsoft SMTP Server (TLS) id 15.1.355.15 via Frontend Transport; Fri, 8 Jan 2016 14:39:46 +0000 Received: (from lsun@localhost) by lab-14.internal.tilera.com (8.14.7/8.14.7/Submit) id u08EdjPO022534; Fri, 8 Jan 2016 09:39:45 -0500 From: Liming Sun To: Date: Fri, 8 Jan 2016 09:39:08 -0500 Message-ID: <1452263948-22485-2-git-send-email-lsun@ezchip.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1452263948-22485-1-git-send-email-lsun@ezchip.com> References: <1450813790-11874-3-git-send-email-lsun@ezchip.com> <1452263948-22485-1-git-send-email-lsun@ezchip.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; DB3FFO11OLC004; 1:grawwuzBtBQYfS5TCJFInq3TAsNQ+dfJlEy09OQyqujYhsOYb3I63nTQMSOtwZKN7WTo88Z3Ria9pOIpYm3LObVcD6BqJRErhY2LaOFETI7J9svfa3TTAq41ZK91NOo7wVwZbRhS0HLqYZ7SESQ1UVRo7UG1TDe9tNj+aCA+auhCQidY9h8W4XHY1NKDivm5g2FQo2YYEghbEntEl3JH/jQg7XWlz86HJlFYkf66xhvlG9ZDDQLuxGAU2ap+WOqkhDkTAuUEGdxNxVBFVIGw+GeRG+enz9/iBUnEdY8mUAODvY7qQcjJjZ0XJ1jHeeu5I0rfpw5KkBQ02MYL7nvrgHuXGXBJ+O8sL92NTe33MDwNcRY6k72Ihc9lmnXTtesbvTwNAJ+NdnO0BQrmfR+xZQ== X-Forefront-Antispam-Report: CIP:12.216.194.146; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(42186005)(4326007)(106466001)(85426001)(11100500001)(2906002)(586003)(50466002)(1220700001)(1096002)(105606002)(48376002)(36756003)(50226001)(5001970100001)(107886002)(110136002)(2351001)(450100001)(2950100001)(189998001)(92566002)(76176999)(50986999)(19580405001)(47776003)(19580395003)(229853001)(104016004)(6806005)(5008740100001)(4001430100002)(5003940100001)(87936001)(33646002)(86362001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR02MB1021; H:lab-14.internal.tilera.com; FPR:; SPF:Fail; PTR:wb-fw1.tilera.com; MX:1; A:1; LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1; VI1PR02MB1021; 2:6f6tuwjOQUo/z87N8mCaFCcUnZ2cz6WviQ+FT6dBIcGjAvLGEfELQvnHLxbEhMaxdL0zkQNjpeZb/YCbJ8adpIB7SUqcmBBkIBe9C08sSi5ZfI95AcCvYcDeptWFm9/ZKzps+/Ns+TBdLEBZmNSxtA==; 3:+1gx3CWfQSLkDLAbVUWYmZgGhb7FqxuxhqENL2lOGHBnhyx/ucs6pb4IN1dO8XcRcx4LoLkVy/ppuPaqs4s+JngHO12PJ3LPAFDjqVMjnQOmYzPR50YoMVM2rgXYY0liPduQj20vW77Ji+/3wXiqNgrG1rMDatmFgFag7LZ4lfZKyzbB09Kh3rXlYMvK1Q7Oj3ixnG5v1VJEVbT2BR22FIIbhdHG5+vv/3zSqc1n6Ew=; 25:vfFRyL1dENBMyoyXtJe27jec9f7/JA7EwSIdxcMcPnIoB4ZTYUalpyfLAPSMvh6J9jfQaYMV4PYKNKwYdld9OOrlJsstfHvy4JGtTbXzAmzpTyWjyLKWVf5uSNOTLxbHiz2qU/E+4DHtvEcvr/ynade2A5QMyi1ZXlwQh7KVEu18ZUB9VMiBvxq990PV4knH1VlaKogqKLc6El5V088m5pU3UABHlRBCOkUGBY9tb3eTZn5OiTJ27w/yYwGfSYfg; 20:6qahut+XgRZ7ZukCe4us/BXNx3CC7dL6AAu6lEutnCv2H79myN46bI2XGdXtWi+05c9JTnNGtQrMqzGL6sc0U7gG/NF2BJWuKsY2osYpiGBUWtFI2cJBi3uJgUOK38Yx/wN+cW3hrBUDmcM5674iQMftvQ82xvZhHd2HxMsbpj0= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:VI1PR02MB1021; X-MS-Office365-Filtering-Correlation-Id: b4debaee-80fd-41c5-717e-08d318398e6a X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(121898900299872); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(13017025)(13015025)(8121501046)(520078)(13018025)(10201501046)(3002001); SRVR:VI1PR02MB1021; BCL:0; PCL:0; RULEID:; SRVR:VI1PR02MB1021; X-Microsoft-Exchange-Diagnostics: 1; VI1PR02MB1021; 4:GMdLerowxnNvXfKZ083e3Dlq4PacuTTpsiBDvRYkrG2l997bliVVN2WiL20zWJDUcvWH7cHRPNL6PBGlSB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aypHTBZkpDG+/nSyaYmtcMoB/DC+R82Hk80= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jan 2016 14:39:46.6391 (UTC) X-MS-Exchange-CrossTenant-Id: 0fc16e0a-3cd3-4092-8b2f-0a42cff122c3 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=0fc16e0a-3cd3-4092-8b2f-0a42cff122c3; Ip=[12.216.194.146]; Helo=[lab-14.internal.tilera.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR02MB1021 Subject: [dpdk-dev] [PATCH v2 2/2] driver/net/mpipe: fix the crash/hung issue when testpmd quits X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2016 14:39:49 -0000 1. Fixed the compiling issue of the ethtool example on tilegx platform. 2. Fixed the hung/crash issue when quitting testpmd under high traffic rate. The buffer error bit needs to be checked before processing the idesc and releasing the buffer. Code logic is also simplified. Signed-off-by: Liming Sun Acked-by: Zhigang Lu --- drivers/net/mpipe/mpipe_tilegx.c | 46 ++++++++-------------- .../common/include/arch/tile/rte_rwlock.h | 1 + 2 files changed, 17 insertions(+), 30 deletions(-) diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c index 8d006fa..4cb54c3 100644 --- a/drivers/net/mpipe/mpipe_tilegx.c +++ b/drivers/net/mpipe/mpipe_tilegx.c @@ -134,7 +134,6 @@ struct mpipe_dev_priv { struct rte_mempool *rx_mpool; /* mpool used by the rx queues. */ unsigned rx_offset; /* Receive head room. */ unsigned rx_size_code; /* mPIPE rx buffer size code. */ - unsigned rx_buffers; /* receive buffers on stack. */ int is_xaui:1, /* Is this an xgbe or gbe? */ initialized:1, /* Initialized port? */ running:1; /* Running port? */ @@ -529,7 +528,6 @@ mpipe_recv_fill_stack(struct mpipe_dev_priv *priv, int count) mpipe_recv_push(priv, mbuf); } - priv->rx_buffers += count; PMD_DEBUG_RX("%s: Filled %d/%d buffers\n", mpipe_name(priv), i, count); } @@ -539,10 +537,9 @@ mpipe_recv_flush_stack(struct mpipe_dev_priv *priv) const int offset = priv->rx_offset & ~RTE_MEMPOOL_ALIGN_MASK; uint8_t in_port = priv->port_id; struct rte_mbuf *mbuf; - unsigned count; void *va; - for (count = 0; count < priv->rx_buffers; count++) { + while (1) { va = gxio_mpipe_pop_buffer(priv->context, priv->stack); if (!va) break; @@ -561,10 +558,6 @@ mpipe_recv_flush_stack(struct mpipe_dev_priv *priv) __rte_mbuf_raw_free(mbuf); } - - PMD_DEBUG_RX("%s: Returned %d/%d buffers\n", - mpipe_name(priv), count, priv->rx_buffers); - priv->rx_buffers -= count; } static void @@ -1246,31 +1239,23 @@ mpipe_recv_flush(struct mpipe_dev_priv *priv) gxio_mpipe_iqueue_t *iqueue; gxio_mpipe_idesc_t idesc; struct rte_mbuf *mbuf; - int retries = 0; unsigned queue; - do { - mpipe_recv_flush_stack(priv); - - /* Flush packets sitting in recv queues. */ - for (queue = 0; queue < priv->nb_rx_queues; queue++) { - rx_queue = mpipe_rx_queue(priv, queue); - iqueue = &rx_queue->iqueue; - while (gxio_mpipe_iqueue_try_get(iqueue, &idesc) >= 0) { - mbuf = mpipe_recv_mbuf(priv, &idesc, in_port); - rte_pktmbuf_free(mbuf); - priv->rx_buffers--; - } - rte_free(rx_queue->rx_ring_mem); - } - } while (retries++ < 10 && priv->rx_buffers); + /* Release packets on the buffer stack. */ + mpipe_recv_flush_stack(priv); - if (priv->rx_buffers) { - RTE_LOG(ERR, PMD, "%s: Leaked %d receive buffers.\n", - mpipe_name(priv), priv->rx_buffers); - } else { - PMD_DEBUG_RX("%s: Returned all receive buffers.\n", - mpipe_name(priv)); + /* Flush packets sitting in recv queues. */ + for (queue = 0; queue < priv->nb_rx_queues; queue++) { + rx_queue = mpipe_rx_queue(priv, queue); + iqueue = &rx_queue->iqueue; + while (gxio_mpipe_iqueue_try_get(iqueue, &idesc) >= 0) { + /* Skip idesc with the 'buffer error' bit set. */ + if (idesc.be) + continue; + mbuf = mpipe_recv_mbuf(priv, &idesc, in_port); + rte_pktmbuf_free(mbuf); + } + rte_free(rx_queue->rx_ring_mem); } } @@ -1339,6 +1324,7 @@ mpipe_do_xmit(struct mpipe_tx_queue *tx_queue, struct rte_mbuf **tx_pkts, .xfer_size = rte_pktmbuf_data_len(mbuf), .bound = next ? 0 : 1, .stack_idx = mpipe_mbuf_stack_index(priv, mbuf), + .size = priv->rx_size_code, } }; if (mpipe_local.mbuf_push_debt[port_id] > 0) { mpipe_local.mbuf_push_debt[port_id]--; diff --git a/lib/librte_eal/common/include/arch/tile/rte_rwlock.h b/lib/librte_eal/common/include/arch/tile/rte_rwlock.h index 8f67a19..6d609e8 100644 --- a/lib/librte_eal/common/include/arch/tile/rte_rwlock.h +++ b/lib/librte_eal/common/include/arch/tile/rte_rwlock.h @@ -38,6 +38,7 @@ extern "C" { #endif #include "generic/rte_rwlock.h" +#include static inline void rte_rwlock_read_lock_tm(rte_rwlock_t *rwl) -- 1.8.3.1