From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0041.outbound.protection.outlook.com [104.47.1.41]) by dpdk.org (Postfix) with ESMTP id A48378DB2 for ; Tue, 22 Dec 2015 20:50:36 +0100 (CET) Received: from AM4PR02CA0039.eurprd02.prod.outlook.com (10.165.239.177) by HE1PR02MB1017.eurprd02.prod.outlook.com (10.163.172.147) with Microsoft SMTP Server (TLS) id 15.1.361.13; Tue, 22 Dec 2015 19:50:34 +0000 Received: from DB3FFO11FD037.protection.gbl (2a01:111:f400:7e04::170) by AM4PR02CA0039.outlook.office365.com (2a01:111:e400:7a66::49) with Microsoft SMTP Server (TLS) id 15.1.361.13 via Frontend Transport; Tue, 22 Dec 2015 19:50:34 +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-43.internal.tilera.com; Received: from lab-43.internal.tilera.com (12.216.194.146) by DB3FFO11FD037.mail.protection.outlook.com (10.47.217.68) with Microsoft SMTP Server (TLS) id 15.1.355.15 via Frontend Transport; Tue, 22 Dec 2015 19:50:33 +0000 Received: (from lsun@localhost) by lab-43.internal.tilera.com (8.14.4/8.14.4/Submit) id tBMJoW1t012022; Tue, 22 Dec 2015 14:50:32 -0500 From: Liming Sun To: Date: Tue, 22 Dec 2015 14:49:50 -0500 Message-ID: <1450813790-11874-3-git-send-email-lsun@ezchip.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1450813790-11874-1-git-send-email-lsun@ezchip.com> References: <1450813790-11874-1-git-send-email-lsun@ezchip.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; DB3FFO11FD037; 1:S1Bg61HUgPnEh6+f98vkBSaTioeb3R3v4+7/TmqdnQfmlEzvNloWUroljeJUnueSauvdA/je0mveoShA2HaAiqzFbVGRCikDGNDv6cRSfwamgP9B9kJKWUzdDYRvZjFzPtG12gMSjUYRH9E2aeg070nolB8DWyciJ3W0FYldR0NWyh2WenXT3w0V10V8dwdMCJ9JIcDKnTjM2EVZRvBLf2M+HYmcRtSVZJHzw2SusBJj9rdo3xdOF8ljdFHCwCVnFxbbQHLuiXStmrGIAhW05EggsDXAh+SaF57Fa4ioPEX7X4GPfFZibh7kGmNczjK49Qr/qs9DwBXv4laOBk1ftCU73KNfBWeUJfCBaO9JE5gjq7rcxSdgcpGnYrvpp6NbtEaCqmR1Y2FKDShDyaLxow== X-Forefront-Antispam-Report: CIP:12.216.194.146; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(42186005)(4001430100002)(76176999)(11100500001)(50986999)(47776003)(5003940100001)(106466001)(229853001)(110136002)(107886002)(5001970100001)(19580405001)(87936001)(104016004)(33646002)(85426001)(450100001)(1096002)(1220700001)(2351001)(586003)(50466002)(6806005)(86362001)(92566002)(105606002)(50226001)(2950100001)(36756003)(48376002)(19580395003)(189998001)(5008740100001); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR02MB1017; H:lab-43.internal.tilera.com; FPR:; SPF:Fail; PTR:wb-fw1.tilera.com; A:1; MX:1; LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1; HE1PR02MB1017; 2:+gA5FaruassNtKBCdl6qYRu5Mnf+F0DgvCqt1MDwWpFotkd2tMCWukvLGQRVQfUFad84eS8MC3N3L+3mNlpKH+UTUsMoESs+63RWlL5kczxCyqOB70RyDXN+H6r2B5YB49jDcV7MEgaDoGZ7ystRgQ==; 3:AIdReUGE6kW7EFAxiwVLUs7Ckn+Q6fWzNae4OrxCBotoOVopmB4eYCwfu1bRPOOh70nQHuF6giuXcELwE0nOsulzFF0A94GxJBGPjmti3Rn92fZaxdrorGW0Iv2DLq4fWt+Aks6Z0JCQcz4YhjjJ2vO56ttmEIA9S6KTnMCoPTF+OGgdVZnMkt81rnPQ2Mlshp65iTfGELjkeM+ls8GUYXh5hqGZE8DwY6qyBaByN8E=; 25:Z0BVc3i3wBDbG4Lt4mMjLizJzQ/gWI03doJSiKqMmuA+NCDKhomCYsuR7P1KWEo/hXLj87Gc0t0WkZaqVXO4svZxF2DbRfWH5lHKwG5TRhfuUQXVW4YiHoknpvCLiTrD+GIVcLVGeoucocPyVIWz35FfbKAmEOer37jqqZ17H9CMtmdjWgQ5/S3SsuSFy4R2hPbMb2nt3mdZnm7Xn9qmTE5rhKHY5dHPKE5x+3Rj/lWcYZtLtkIuVRsCIQGxmlHg; 20:yrGQWvcBT8qSY0gP80nfM1eURkNdW3RipkK2EsvSfMd2ymJCqMO6602ueH+1udYz2hk2lyHbBfT/NUYolMhmTB2L2g6d5NvGLRk+3QW8XA5cEZ+UGMGM3qqRWJdsx8aokjcc8nRvjA4NzhJDu33c6pdHBkcA8i3jGZJT1j+smso= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HE1PR02MB1017; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(121898900299872); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(520078)(5005006)(3002001)(10201501046); SRVR:HE1PR02MB1017; BCL:0; PCL:0; RULEID:; SRVR:HE1PR02MB1017; X-Microsoft-Exchange-Diagnostics: 1; HE1PR02MB1017; 4:bZGNJiu2/NLPFAM9l/lNF1advRUBmuviDkW236ANFYyrwerJjmOKyb2+5R5pREHclwizdDkBhUfgkJ06dRqB0jOghAVkXGseLvrUg1nht7ifzdCCH4k+uBUeKveLgHFG4qca/jHNcM0X7wDrmRX5Gf54gRP0/3Mik/tQuDbsmnzLGu6RzbGMPx5frLJnbp/C7aidofhla1+H+RYTV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-ascii?Q?FGSnRUZkq8Rs0/xqOcD3fkLC2h5+FuqVbs05wJN4ElgLhoNgdo+76G2gPbgs?= =?us-ascii?Q?p09NnXG1mAfw7bvbn5uLOfGFKq6NKBqT5XHoqpIN3W03LmRD+8mHB9f/azht?= =?us-ascii?Q?P9rDz2EtPDzQH/+lQQW+qvAyd6hkwwDho1dpts/CGzJ2QvdnjJPnLINDaXFi?= =?us-ascii?Q?BbkjXMspPLW96xuDtzOBRcp3Scxhc/5lbe5zWaTA+sGjY+bp/x/WdLdeZs+D?= =?us-ascii?Q?tmYx9ntxrW9eyqgTkxPKF6dOgRd7dAYW7weq6HCPPwEfTxQt4ULC07+7oFZV?= =?us-ascii?Q?uPAwFfryZTTf1S/8J3UkYwZecNzN5CgTwi4+rJVFyZ8Q1eEPq0igx9kx3r3H?= =?us-ascii?Q?9EOIGJ5KbRMnsqv+u6mHEb+FzQkqlYEAH+m60ZZhHM8JxKP+aOdIc+jvQ48p?= =?us-ascii?Q?QQd47Z35151sDtHRiRT94PPwVbKX+fspwnvtPrRgk5tm8Isvg=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; HE1PR02MB1017; 5:/fFXICVdjp9yQEb5lcRTLDpZ46vWp17mFCq3gSHAxH1LGsB97100qUWeqv6ds5a2XgSxwxqAFZ5+HpUDabSuu4zVYogONeRWL/0d8kafc82QBMDrcyOAgMr9xgV8w5av0yfx+hkQAZetDlohJT93Bg==; 24:J7sPm2uR6tsqbODIo3i18lZRRwIhxsqED2BAFYOdPtyWTONFk+kPQUbfKkpAg9Nlh3H3WHdn91OX1GWZqJQ2lJmLmdJ2wFRc1K3Z8eXo7NE= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Dec 2015 19:50:33.9683 (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-43.internal.tilera.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR02MB1017 Subject: [dpdk-dev] [PATCH 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: Tue, 22 Dec 2015 19:50:37 -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 --- 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.7.1