From patchwork Sat Oct 17 03:06:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Wojciechowski X-Patchwork-Id: 81165 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A7082A04DB; Sat, 17 Oct 2020 05:07:53 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 38DBDE29D; Sat, 17 Oct 2020 05:07:31 +0200 (CEST) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id E1324E27A for ; Sat, 17 Oct 2020 05:07:27 +0200 (CEST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20201017030716euoutp02507636d11089d9a585b25e2141d74aaa~_qLp3Wg-H2305923059euoutp02Q for ; Sat, 17 Oct 2020 03:07:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20201017030716euoutp02507636d11089d9a585b25e2141d74aaa~_qLp3Wg-H2305923059euoutp02Q DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1602904036; bh=MUA/AWoQYa93ZfKVmGkqKZTBhCmKyloue6Sqv5lZoBw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p/V4r/qjnJobLH6YsUNrpO//yxqeu2AnTaB/uPigzFpFQ/z+grU54fJN2Myj2tO75 dmU2se/v4pZtRpzo/YZ1BeQDH4XgbOJ1KX0A9+xXVsg868Hm0nRwGLevw9VFZ0h3UN ZO/ggcIHLM849vHSpXPs8A41/As+j/qoYwd/a5E4= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20201017030710eucas1p1d5908365d9468c3e7124e65258f84b3f~_qLlAsWmA0652806528eucas1p1w; Sat, 17 Oct 2020 03:07:10 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 87.D5.06318.EDF5A8F5; Sat, 17 Oct 2020 04:07:10 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20201017030710eucas1p17fb6129fd3414b4b6b70dcd593c01a40~_qLkkgpWR0898408984eucas1p10; Sat, 17 Oct 2020 03:07:10 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20201017030710eusmtrp1bc23ca0de75cdb11c7a8e7cd4b97d38d~_qLkj_0ph3018830188eusmtrp1S; Sat, 17 Oct 2020 03:07:10 +0000 (GMT) X-AuditID: cbfec7f5-38bff700000018ae-8e-5f8a5fde76a2 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 4C.DE.06017.EDF5A8F5; Sat, 17 Oct 2020 04:07:10 +0100 (BST) Received: from localhost.localdomain (unknown [106.210.88.70]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201017030709eusmtip19d39216685745960b0d65e58fe02a557~_qLj9S5aT3071330713eusmtip1E; Sat, 17 Oct 2020 03:07:09 +0000 (GMT) From: Lukasz Wojciechowski To: David Hunt , Bruce Richardson Cc: dev@dpdk.org, l.wojciechow@partner.samsung.com, stable@dpdk.org Date: Sat, 17 Oct 2020 05:06:45 +0200 Message-Id: <20201017030701.16134-2-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201017030701.16134-1-l.wojciechow@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrOIsWRmVeSWpSXmKPExs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2bA9jA+NBgS5GTg4J AROJ5Wt+MncxcnEICSxllDj6/hVLFyMHUEJG4sMlqBphiT/Xutggaj4ySpybMJ0RJMEmYCtx ZOZXVpB6EYEwiRMr/UHCzALuElsWT2UGsYUFfCTWnLoHVs4ioCpxcUMPO4jNK+Aq0Xr0BQvE fHmJ1RsOMIOM4RRwk2g87gqxqpFR4uysdSwTGPkWMDKsYhRJLS3OTc8tNtIrTswtLs1L10vO z93ECAzEbcd+btnB2PUu+BCjAAejEg/vhkWd8UKsiWXFlbmHGCU4mJVEeJ3Ono4T4k1JrKxK LcqPLyrNSS0+xGgKdNREZinR5HxglOSVxBuaGppbWBqaG5sbm1koifN2CByMERJITyxJzU5N LUgtgulj4uCUamCcwaUtftKfP8/dj/XUhvfVvrPt7zHpqP5WnxPXOv/tN7MbFsdWButNf/Dh hrWeQ+KbgtCKusBDxhNZL/z5auBuW6KxpOTNXJnzkfZJaZ2ugZbzT+9ZOzVh5vQ28RvmTXKp C97cXhb/w9w24KnmtXWt6YJfNvuW3qu3Xbkg/FWSXeeVp7vWBnQosRRnJBpqMRcVJwIA0oZn AFoCAAA= X-CMS-MailID: 20201017030710eucas1p17fb6129fd3414b4b6b70dcd593c01a40 X-Msg-Generator: CA X-RootMTR: 20201017030710eucas1p17fb6129fd3414b4b6b70dcd593c01a40 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201017030710eucas1p17fb6129fd3414b4b6b70dcd593c01a40 References: <20201010160508.19709-1-l.wojciechow@partner.samsung.com> <20201017030701.16134-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-dev] [PATCH v8 01/17] distributor: fix missing handshake synchronization 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" rte_distributor_return_pkt function which is run on worker cores must wait for distributor core to clear handshake on retptr64 before using those buffers. While the handshake is set distributor core controls buffers and any operations on worker side might overwrite buffers which are unread yet. Same situation appears in the legacy single distributor. Function rte_distributor_return_pkt_single shouldn't modify the bufptr64 until handshake on it is cleared by distributor lcore. Fixes: 775003ad2f96 ("distributor: add new burst-capable library") Cc: david.hunt@intel.com Cc: stable@dpdk.org Signed-off-by: Lukasz Wojciechowski Acked-by: David Hunt Reviewed-by: Honnappa Nagarahalli --- lib/librte_distributor/rte_distributor.c | 12 ++++++++++++ lib/librte_distributor/rte_distributor_single.c | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/lib/librte_distributor/rte_distributor.c b/lib/librte_distributor/rte_distributor.c index 1c047f065..c6b19a388 100644 --- a/lib/librte_distributor/rte_distributor.c +++ b/lib/librte_distributor/rte_distributor.c @@ -169,6 +169,18 @@ rte_distributor_return_pkt(struct rte_distributor *d, return -EINVAL; } + /* Spin while handshake bits are set (scheduler clears it). + * Sync with worker on GET_BUF flag. + */ + while (unlikely(__atomic_load_n(&(buf->retptr64[0]), __ATOMIC_RELAXED) + & RTE_DISTRIB_GET_BUF)) { + rte_pause(); + uint64_t t = rte_rdtsc()+100; + + while (rte_rdtsc() < t) + rte_pause(); + } + /* Sync with distributor to acquire retptrs */ __atomic_thread_fence(__ATOMIC_ACQUIRE); for (i = 0; i < RTE_DIST_BURST_SIZE; i++) diff --git a/lib/librte_distributor/rte_distributor_single.c b/lib/librte_distributor/rte_distributor_single.c index abaf7730c..f4725b1d0 100644 --- a/lib/librte_distributor/rte_distributor_single.c +++ b/lib/librte_distributor/rte_distributor_single.c @@ -74,6 +74,10 @@ rte_distributor_return_pkt_single(struct rte_distributor_single *d, union rte_distributor_buffer_single *buf = &d->bufs[worker_id]; uint64_t req = (((int64_t)(uintptr_t)oldpkt) << RTE_DISTRIB_FLAG_BITS) | RTE_DISTRIB_RETURN_BUF; + while (unlikely(__atomic_load_n(&buf->bufptr64, __ATOMIC_RELAXED) + & RTE_DISTRIB_FLAGS_MASK)) + rte_pause(); + /* Sync with distributor on RETURN_BUF flag. */ __atomic_store_n(&(buf->bufptr64), req, __ATOMIC_RELEASE); return 0; From patchwork Sat Oct 17 03:06:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Wojciechowski X-Patchwork-Id: 81166 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id CCC09A04DB; Sat, 17 Oct 2020 05:08:17 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E752EE2A7; Sat, 17 Oct 2020 05:07:38 +0200 (CEST) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 7764FE272 for ; Sat, 17 Oct 2020 05:07:28 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20201017030717euoutp0258266c626624c1606c0e58142d88e7c5~_qLq2Ti8B2306523065euoutp02U for ; Sat, 17 Oct 2020 03:07:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20201017030717euoutp0258266c626624c1606c0e58142d88e7c5~_qLq2Ti8B2306523065euoutp02U DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1602904037; bh=q+pfAStd5xrOR1iPFbpstZ2K7pNMPEEJM45PQovHdoU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lUZVYrEeYGk9QzFumX0+ml4ie6KvTHPcS3P76Le3tFXMSEKf7U3jZiYJx2XrDK+uv gqLYhVgiZbITw4LBYXLG58yQH1NNW019Rb8JnEQhaCveB6vi/DN0OTr+CdotSWhdoC EUoMj9al/wqX95AHjfoWk/fyF/xqPa/hLCUStMW0= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20201017030712eucas1p100317480a4b1f1de26224bd2ae9b6a48~_qLl_y1iq0897308973eucas1p1o; Sat, 17 Oct 2020 03:07:12 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 12.42.05997.FDF5A8F5; Sat, 17 Oct 2020 04:07:11 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20201017030711eucas1p1b70f13e4636ad7c3e842b48726ae1845~_qLlIIYXY0898308983eucas1p14; Sat, 17 Oct 2020 03:07:11 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20201017030711eusmtrp10af15526127711f0b0cbdccde9bd79ad~_qLlHl8uO3018830188eusmtrp1T; Sat, 17 Oct 2020 03:07:11 +0000 (GMT) X-AuditID: cbfec7f4-65dff7000000176d-b8-5f8a5fdfb5c0 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id AC.DE.06017.FDF5A8F5; Sat, 17 Oct 2020 04:07:11 +0100 (BST) Received: from localhost.localdomain (unknown [106.210.88.70]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201017030710eusmtip1b03fd00558f7af640aaa09a53eb65d72~_qLkmCB8k3124931249eusmtip15; Sat, 17 Oct 2020 03:07:10 +0000 (GMT) From: Lukasz Wojciechowski To: David Hunt , Bruce Richardson Cc: dev@dpdk.org, l.wojciechow@partner.samsung.com, stable@dpdk.org Date: Sat, 17 Oct 2020 05:06:46 +0200 Message-Id: <20201017030701.16134-3-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201017030701.16134-1-l.wojciechow@partner.samsung.com> X-Brightmail-Tracker: H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O5uU1JzMstQifbsEvYzvsyILjghWNLzayNLAeIivi5GDQ0LA ROLGLqkuRk4OIYGljBJXFpZDhGUkPlwSAAlLCAhL/LnWxdbFyAVU8pFR4khLJxtIgk3AVuLI zK+sIPUiAmESJ1b6g4SZBdwltiyeygxiCwOVHF6yCcxmEVCV+HW/mxXE5hVwlbh3ZSU7xHx5 idUbDjCDjOEUcJNoPO4KsaqRUeLsrHUsExj5FjAyrGIUSS0tzk3PLTbSK07MLS7NS9dLzs/d xAgMwW3Hfm7Zwdj1LvgQowAHoxIP74ZFnfFCrIllxZW5hxglOJiVRHidzp6OE+JNSaysSi3K jy8qzUktPsRoCnTURGYp0eR8YHzklcQbmhqaW1gamhubG5tZKInzdggcjBESSE8sSc1OTS1I LYLpY+LglGpgbH0h15fdxJJ5PvTUC7adSp3sX+as3PxpW7NK9vv+7nkewhez79mvO8lx7tTz R+mrV6+wTJu1bmeQ8WfjhcmihxiO3X9ZkMa8YGH24soCOZFAp5ctu2b96r3ibsOe47T3/aub v+TfJ6S35bQdYr+iV9r0KvLKNf/5xyK6TF4oMTAtTwkynav4Q4mlOCPRUIu5qDgRACyEM+hX AgAA X-CMS-MailID: 20201017030711eucas1p1b70f13e4636ad7c3e842b48726ae1845 X-Msg-Generator: CA X-RootMTR: 20201017030711eucas1p1b70f13e4636ad7c3e842b48726ae1845 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201017030711eucas1p1b70f13e4636ad7c3e842b48726ae1845 References: <20201010160508.19709-1-l.wojciechow@partner.samsung.com> <20201017030701.16134-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-dev] [PATCH v8 02/17] distributor: fix handshake deadlock 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Synchronization of data exchange between distributor and worker cores is based on 2 handshakes: retptr64 for returning mbufs from workers to distributor and bufptr64 for passing mbufs to workers. Without proper order of verifying those 2 handshakes a deadlock may occur. This can happen when worker core wants to return back mbufs and waits for retptr handshake to be cleared while distributor core waits for bufptr to send mbufs to worker. This can happen as worker core first returns mbufs to distributor and later gets new mbufs, while distributor first releases mbufs to worker and later handle returning packets. This patch fixes possibility of the deadlock by always taking care of returning packets first on the distributor side and handling packets while waiting to release new. Fixes: 775003ad2f96 ("distributor: add new burst-capable library") Cc: david.hunt@intel.com Cc: stable@dpdk.org Signed-off-by: Lukasz Wojciechowski Acked-by: David Hunt --- lib/librte_distributor/rte_distributor.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/librte_distributor/rte_distributor.c b/lib/librte_distributor/rte_distributor.c index c6b19a388..d6d4350a2 100644 --- a/lib/librte_distributor/rte_distributor.c +++ b/lib/librte_distributor/rte_distributor.c @@ -319,12 +319,14 @@ release(struct rte_distributor *d, unsigned int wkr) struct rte_distributor_buffer *buf = &(d->bufs[wkr]); unsigned int i; + handle_returns(d, wkr); + /* Sync with worker on GET_BUF flag */ while (!(__atomic_load_n(&(d->bufs[wkr].bufptr64[0]), __ATOMIC_ACQUIRE) - & RTE_DISTRIB_GET_BUF)) + & RTE_DISTRIB_GET_BUF)) { + handle_returns(d, wkr); rte_pause(); - - handle_returns(d, wkr); + } buf->count = 0; @@ -374,6 +376,7 @@ rte_distributor_process(struct rte_distributor *d, /* Flush out all non-full cache-lines to workers. */ for (wid = 0 ; wid < d->num_workers; wid++) { /* Sync with worker on GET_BUF flag. */ + handle_returns(d, wid); if (__atomic_load_n(&(d->bufs[wid].bufptr64[0]), __ATOMIC_ACQUIRE) & RTE_DISTRIB_GET_BUF) { release(d, wid); From patchwork Sat Oct 17 03:06:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Wojciechowski X-Patchwork-Id: 81170 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0706BA04DB; Sat, 17 Oct 2020 05:09:51 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4CF7AE2B9; Sat, 17 Oct 2020 05:07:58 +0200 (CEST) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id EB466E2A9 for ; Sat, 17 Oct 2020 05:07:37 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20201017030722euoutp01a0f050b9eb09c56990632f0d940d0faf~_qLvQ2TXM1627716277euoutp01W for ; Sat, 17 Oct 2020 03:07:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20201017030722euoutp01a0f050b9eb09c56990632f0d940d0faf~_qLvQ2TXM1627716277euoutp01W DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1602904042; bh=/u5EAfeiJ4p2Br7ASyxtneecnI0wj90it9BSaT4EZOE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f5lKbw0D3eYs56e3Q5KC4jiNkQC9NhmDg0JyJCHxDgAB2Q76XxzljoylAHBSHSoFN faCpcPKWs1uRSJkSzgjPEyzoajzBf7Sfj0Zo8turIBe6Vso4icZq17rgMGbyoU8P6q pe9D+j13j5MKdEGq0MvUiLkvdG5VqS9LPVB91LMc= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20201017030712eucas1p2eee90905a943ebe0e3d3f405737026f0~_qLmI-jFV2935829358eucas1p2r; Sat, 17 Oct 2020 03:07:12 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 97.E8.06456.0EF5A8F5; Sat, 17 Oct 2020 04:07:12 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20201017030711eucas1p14855de461cd9d6a4fd3e4bac031b53e5~_qLlxt_RR0896808968eucas1p1r; Sat, 17 Oct 2020 03:07:11 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20201017030711eusmtrp28a1358fec5ba86bb9aaac463d330f3a8~_qLlxOoD-2813028130eusmtrp2L; Sat, 17 Oct 2020 03:07:11 +0000 (GMT) X-AuditID: cbfec7f2-7efff70000001938-2a-5f8a5fe07073 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 6A.99.06314.FDF5A8F5; Sat, 17 Oct 2020 04:07:11 +0100 (BST) Received: from localhost.localdomain (unknown [106.210.88.70]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201017030711eusmtip17c37a8e298927a8a3035ece16f2a83a5~_qLlO1MPo3071330713eusmtip1F; Sat, 17 Oct 2020 03:07:11 +0000 (GMT) From: Lukasz Wojciechowski To: David Hunt , Bruce Richardson Cc: dev@dpdk.org, l.wojciechow@partner.samsung.com, stable@dpdk.org Date: Sat, 17 Oct 2020 05:06:47 +0200 Message-Id: <20201017030701.16134-4-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201017030701.16134-1-l.wojciechow@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMIsWRmVeSWpSXmKPExsWy7djPc7oP4rviDU5M4LC4screom/SRyaL d5+2M1k861nHaPGv4w+7A6vHrwVLWT0W73nJ5HHw3R6mAOYoLpuU1JzMstQifbsEroy/G2Yz FjxQqTh2dCFTA+M52S5GTg4JAROJx4tXMXcxcnEICaxglPh9Zw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Aqcb+tBCTMK+AqMevdKXaI 8fISqzccYAYp4RRwk2g87gqxqZFR4uysdSwTGPkWMDKsYhRJLS3OTc8tNtQrTswtLs1L10vO z93ECAzCbcd+bt7BeGlj8CFGAQ5GJR7eDYs644VYE8uKK3MPMUpwMCuJ8DqdPR0nxJuSWFmV WpQfX1Sak1p8iNEU6KaJzFKiyfnACMkriTc0NTS3sDQ0NzY3NrNQEuftEDgYIySQnliSmp2a WpBaBNPHxMEp1cDYbWEy87tU3+r8boPGnW5rvrzhkRG8G1bBfMo5oO31FVvPbhcxa4b/HV/+ NPkaLVCMcs0Wlcq452P7o3DZbpeOM4vsp+4RiVHhcjnRcZTrztTnR5fJnBc+mFzzYomAmw1v Tt9ar0zHlFvbe1c/mcoc3LuL87La1y7Wm10z/727vrrnpoTPHX0lluKMREMt5qLiRADykp4Q WAIAAA== X-CMS-MailID: 20201017030711eucas1p14855de461cd9d6a4fd3e4bac031b53e5 X-Msg-Generator: CA X-RootMTR: 20201017030711eucas1p14855de461cd9d6a4fd3e4bac031b53e5 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201017030711eucas1p14855de461cd9d6a4fd3e4bac031b53e5 References: <20201010160508.19709-1-l.wojciechow@partner.samsung.com> <20201017030701.16134-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-dev] [PATCH v8 03/17] distributor: do not use oldpkt when not needed 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" rte_distributor_request_pkt and rte_distributor_get_pkt dereferenced oldpkt parameter when in RTE_DIST_ALG_SINGLE even if number of returned buffers from worker to distributor was 0. This patch passes NULL to the legacy API when number of returned buffers is 0. This allows passing NULL as oldpkt parameter. Distributor tests are also updated passing NULL as oldpkt and 0 as number of returned packets, where packets are not returned. Fixes: 775003ad2f96 ("distributor: add new burst-capable library") Cc: david.hunt@intel.com Cc: stable@dpdk.org Signed-off-by: Lukasz Wojciechowski Acked-by: David Hunt --- app/test/test_distributor.c | 28 +++++++++--------------- lib/librte_distributor/rte_distributor.c | 4 ++-- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c index ba1f81cf8..52230d250 100644 --- a/app/test/test_distributor.c +++ b/app/test/test_distributor.c @@ -62,13 +62,10 @@ handle_work(void *arg) struct rte_mbuf *buf[8] __rte_cache_aligned; struct worker_params *wp = arg; struct rte_distributor *db = wp->dist; - unsigned int count = 0, num = 0; + unsigned int count = 0, num; unsigned int id = __atomic_fetch_add(&worker_idx, 1, __ATOMIC_RELAXED); - int i; - for (i = 0; i < 8; i++) - buf[i] = NULL; - num = rte_distributor_get_pkt(db, id, buf, buf, num); + num = rte_distributor_get_pkt(db, id, buf, NULL, 0); while (!quit) { __atomic_fetch_add(&worker_stats[id].handled_packets, num, __ATOMIC_RELAXED); @@ -272,19 +269,16 @@ handle_work_with_free_mbufs(void *arg) struct rte_distributor *d = wp->dist; unsigned int count = 0; unsigned int i; - unsigned int num = 0; + unsigned int num; unsigned int id = __atomic_fetch_add(&worker_idx, 1, __ATOMIC_RELAXED); - for (i = 0; i < 8; i++) - buf[i] = NULL; - num = rte_distributor_get_pkt(d, id, buf, buf, num); + num = rte_distributor_get_pkt(d, id, buf, NULL, 0); while (!quit) { worker_stats[id].handled_packets += num; count += num; for (i = 0; i < num; i++) rte_pktmbuf_free(buf[i]); - num = rte_distributor_get_pkt(d, - id, buf, buf, num); + num = rte_distributor_get_pkt(d, id, buf, NULL, 0); } worker_stats[id].handled_packets += num; count += num; @@ -342,14 +336,14 @@ handle_work_for_shutdown_test(void *arg) struct worker_params *wp = arg; struct rte_distributor *d = wp->dist; unsigned int count = 0; - unsigned int num = 0; + unsigned int num; unsigned int total = 0; unsigned int i; unsigned int returned = 0; const unsigned int id = __atomic_fetch_add(&worker_idx, 1, __ATOMIC_RELAXED); - num = rte_distributor_get_pkt(d, id, buf, buf, num); + num = rte_distributor_get_pkt(d, id, buf, NULL, 0); /* wait for quit single globally, or for worker zero, wait * for zero_quit */ @@ -358,8 +352,7 @@ handle_work_for_shutdown_test(void *arg) count += num; for (i = 0; i < num; i++) rte_pktmbuf_free(buf[i]); - num = rte_distributor_get_pkt(d, - id, buf, buf, num); + num = rte_distributor_get_pkt(d, id, buf, NULL, 0); total += num; } worker_stats[id].handled_packets += num; @@ -373,14 +366,13 @@ handle_work_for_shutdown_test(void *arg) while (zero_quit) usleep(100); - num = rte_distributor_get_pkt(d, - id, buf, buf, num); + num = rte_distributor_get_pkt(d, id, buf, NULL, 0); while (!quit) { worker_stats[id].handled_packets += num; count += num; rte_pktmbuf_free(pkt); - num = rte_distributor_get_pkt(d, id, buf, buf, num); + num = rte_distributor_get_pkt(d, id, buf, NULL, 0); } returned = rte_distributor_return_pkt(d, id, buf, num); diff --git a/lib/librte_distributor/rte_distributor.c b/lib/librte_distributor/rte_distributor.c index d6d4350a2..93c90cf54 100644 --- a/lib/librte_distributor/rte_distributor.c +++ b/lib/librte_distributor/rte_distributor.c @@ -42,7 +42,7 @@ rte_distributor_request_pkt(struct rte_distributor *d, if (unlikely(d->alg_type == RTE_DIST_ALG_SINGLE)) { rte_distributor_request_pkt_single(d->d_single, - worker_id, oldpkt[0]); + worker_id, count ? oldpkt[0] : NULL); return; } @@ -134,7 +134,7 @@ rte_distributor_get_pkt(struct rte_distributor *d, if (unlikely(d->alg_type == RTE_DIST_ALG_SINGLE)) { if (return_count <= 1) { pkts[0] = rte_distributor_get_pkt_single(d->d_single, - worker_id, oldpkt[0]); + worker_id, return_count ? oldpkt[0] : NULL); return (pkts[0]) ? 1 : 0; } else return -EINVAL; From patchwork Sat Oct 17 03:06:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Wojciechowski X-Patchwork-Id: 81167 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A415BA04DB; Sat, 17 Oct 2020 05:08:36 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4483EE2AB; Sat, 17 Oct 2020 05:07:41 +0200 (CEST) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id 3CA2DE29E for ; Sat, 17 Oct 2020 05:07:31 +0200 (CEST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20201017030720euoutp0101b4efac82adb84a1b275ea636a805bb~_qLtdc3LP1627716277euoutp01U for ; Sat, 17 Oct 2020 03:07:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20201017030720euoutp0101b4efac82adb84a1b275ea636a805bb~_qLtdc3LP1627716277euoutp01U DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1602904040; bh=4Fg38YzAOQjDzzsTx+jLEB0J7F07DOC8klhoNTn9h6M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mj6jDmB5YgHoCDqpBYhJNM2Xi+RqLc48TXTEqGDPCigWtBVg1UykNE60kjjtHzRJL lc6GFoYlF93wnFAz5hz3WIw4t5eWHU2tn7GjfPNdf6/XvUI9PhB7VFRQko8ngBVRje uoX82dFjFiDBZVuL9Ajm+iYY6h6U4yIbEbAsaNec= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20201017030713eucas1p2740872b5aade23eb8f922eaf5e22ee83~_qLnhlT1g2440824408eucas1p2w; Sat, 17 Oct 2020 03:07:13 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id E7.D5.06318.1EF5A8F5; Sat, 17 Oct 2020 04:07:13 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20201017030712eucas1p1ce19efadc60ed2888dc615cbb2549bdc~_qLmhjR0U2253222532eucas1p17; Sat, 17 Oct 2020 03:07:12 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20201017030712eusmtrp1028ad8c0eef5a9511bdf965ed1336934~_qLmhCawn3018830188eusmtrp1U; Sat, 17 Oct 2020 03:07:12 +0000 (GMT) X-AuditID: cbfec7f5-371ff700000018ae-91-5f8a5fe170b8 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 0D.DE.06017.0EF5A8F5; Sat, 17 Oct 2020 04:07:12 +0100 (BST) Received: from localhost.localdomain (unknown [106.210.88.70]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201017030711eusmtip12127a0ab18f1695d30587d8cf12ce849~_qLl3oN7z0424404244eusmtip1N; Sat, 17 Oct 2020 03:07:11 +0000 (GMT) From: Lukasz Wojciechowski To: David Hunt , Bruce Richardson Cc: dev@dpdk.org, l.wojciechow@partner.samsung.com, stable@dpdk.org Date: Sat, 17 Oct 2020 05:06:48 +0200 Message-Id: <20201017030701.16134-5-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201017030701.16134-1-l.wojciechow@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCIsWRmVeSWpSXmKPExsWy7djPc7oP47viDWa8UrW4screom/SRyaL d5+2M1k861nHaPGv4w+7A6vHrwVLWT0W73nJ5HHw3R6mAOYoLpuU1JzMstQifbsErowL1yYz FlzOr5h16i1TA+OTiC5GTg4JAROJTXOOMncxcnEICaxglJj9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XDGaI 8fISqzccYAYp4RRwk2g87gqxqZFR4uysdSwTGPkWMDKsYhRJLS3OTc8tNtIrTswtLs1L10vO z93ECAzDbcd+btnB2PUu+BCjAAejEg/vhkWd8UKsiWXFlbmHGCU4mJVEeJ3Ono4T4k1JrKxK LcqPLyrNSS0+xGgKdNNEZinR5HxgjOSVxBuaGppbWBqaG5sbm1koifN2CByMERJITyxJzU5N LUgtgulj4uCUamCM27VNnIu7a77PzyYfiQlF8nYMBfv6bQRDM86U1l486PG37v8luzPp/F5z K68+ObEpr9zvSm2ToLP2huyAilvX/Lx42SX3/dMT+Wvpo3tNbcpr3h+HhJbkTsiI8L5+X8U7 /5VWgMLaUr5ZN302xapwvpA2Zzn7t+uJfvzxnZv2yvGGMFX+3aTEUpyRaKjFXFScCADupt30 WQIAAA== X-CMS-MailID: 20201017030712eucas1p1ce19efadc60ed2888dc615cbb2549bdc X-Msg-Generator: CA X-RootMTR: 20201017030712eucas1p1ce19efadc60ed2888dc615cbb2549bdc X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201017030712eucas1p1ce19efadc60ed2888dc615cbb2549bdc References: <20201010160508.19709-1-l.wojciechow@partner.samsung.com> <20201017030701.16134-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-dev] [PATCH v8 04/17] distributor: handle worker shutdown in burst mode 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The burst version of distributor implementation was missing proper handling of worker shutdown. A worker processing packets received from distributor can call rte_distributor_return_pkt() function informing distributor that it want no more packets. Further calls to rte_distributor_request_pkt() or rte_distributor_get_pkt() however should inform distributor that new packets are requested again. Lack of the proper implementation has caused that even after worker informed about returning last packets, new packets were still sent from distributor causing deadlocks as no one could get them on worker side. This patch adds handling shutdown of the worker in following way: 1) It fixes usage of RTE_DISTRIB_VALID_BUF handshake flag. This flag was formerly unused in burst implementation and now it is used for marking valid packets in retptr64 replacing invalid use of RTE_DISTRIB_RETURN_BUF flag. 2) Uses RTE_DISTRIB_RETURN_BUF as a worker to distributor handshake in retptr64 to indicate that worker has shutdown. 3) Worker that shuts down blocks also bufptr for itself with RTE_DISTRIB_RETURN_BUF flag allowing distributor to retrieve any in flight packets. 4) When distributor receives information about shutdown of a worker, it: marks worker as not active; retrieves any in flight and backlog packets and process them to different workers; unlocks bufptr64 by clearing RTE_DISTRIB_RETURN_BUF flag and allowing use in the future if worker requests any new packages. 5) Do not allow to: send or add to backlog any packets for not active workers. Such workers are also ignored if matched. 6) Adjust calls to handle_returns() and tags matching procedure to react for possible activation deactivation of workers. Fixes: 775003ad2f96 ("distributor: add new burst-capable library") Cc: david.hunt@intel.com Cc: stable@dpdk.org Signed-off-by: Lukasz Wojciechowski Acked-by: David Hunt --- lib/librte_distributor/distributor_private.h | 3 + lib/librte_distributor/rte_distributor.c | 175 +++++++++++++++---- 2 files changed, 146 insertions(+), 32 deletions(-) diff --git a/lib/librte_distributor/distributor_private.h b/lib/librte_distributor/distributor_private.h index 489aef2ac..689fe3e18 100644 --- a/lib/librte_distributor/distributor_private.h +++ b/lib/librte_distributor/distributor_private.h @@ -155,6 +155,9 @@ struct rte_distributor { enum rte_distributor_match_function dist_match_fn; struct rte_distributor_single *d_single; + + uint8_t active[RTE_DISTRIB_MAX_WORKERS]; + uint8_t activesum; }; void diff --git a/lib/librte_distributor/rte_distributor.c b/lib/librte_distributor/rte_distributor.c index 93c90cf54..7aa079d53 100644 --- a/lib/librte_distributor/rte_distributor.c +++ b/lib/librte_distributor/rte_distributor.c @@ -51,7 +51,7 @@ rte_distributor_request_pkt(struct rte_distributor *d, * Sync with worker on GET_BUF flag. */ while (unlikely(__atomic_load_n(retptr64, __ATOMIC_ACQUIRE) - & RTE_DISTRIB_GET_BUF)) { + & (RTE_DISTRIB_GET_BUF | RTE_DISTRIB_RETURN_BUF))) { rte_pause(); uint64_t t = rte_rdtsc()+100; @@ -67,11 +67,11 @@ rte_distributor_request_pkt(struct rte_distributor *d, for (i = count; i < RTE_DIST_BURST_SIZE; i++) buf->retptr64[i] = 0; - /* Set Return bit for each packet returned */ + /* Set VALID_BUF bit for each packet returned */ for (i = count; i-- > 0; ) buf->retptr64[i] = (((int64_t)(uintptr_t)(oldpkt[i])) << - RTE_DISTRIB_FLAG_BITS) | RTE_DISTRIB_RETURN_BUF; + RTE_DISTRIB_FLAG_BITS) | RTE_DISTRIB_VALID_BUF; /* * Finally, set the GET_BUF to signal to distributor that cache @@ -97,11 +97,13 @@ rte_distributor_poll_pkt(struct rte_distributor *d, return (pkts[0]) ? 1 : 0; } - /* If bit is set, return + /* If any of below bits is set, return. + * GET_BUF is set when distributor hasn't sent any packets yet + * RETURN_BUF is set when distributor must retrieve in-flight packets * Sync with distributor to acquire bufptrs */ if (__atomic_load_n(&(buf->bufptr64[0]), __ATOMIC_ACQUIRE) - & RTE_DISTRIB_GET_BUF) + & (RTE_DISTRIB_GET_BUF | RTE_DISTRIB_RETURN_BUF)) return -1; /* since bufptr64 is signed, this should be an arithmetic shift */ @@ -113,7 +115,7 @@ rte_distributor_poll_pkt(struct rte_distributor *d, } /* - * so now we've got the contents of the cacheline into an array of + * so now we've got the contents of the cacheline into an array of * mbuf pointers, so toggle the bit so scheduler can start working * on the next cacheline while we're working. * Sync with distributor on GET_BUF flag. Release bufptrs. @@ -173,7 +175,7 @@ rte_distributor_return_pkt(struct rte_distributor *d, * Sync with worker on GET_BUF flag. */ while (unlikely(__atomic_load_n(&(buf->retptr64[0]), __ATOMIC_RELAXED) - & RTE_DISTRIB_GET_BUF)) { + & (RTE_DISTRIB_GET_BUF | RTE_DISTRIB_RETURN_BUF))) { rte_pause(); uint64_t t = rte_rdtsc()+100; @@ -185,17 +187,25 @@ rte_distributor_return_pkt(struct rte_distributor *d, __atomic_thread_fence(__ATOMIC_ACQUIRE); for (i = 0; i < RTE_DIST_BURST_SIZE; i++) /* Switch off the return bit first */ - buf->retptr64[i] &= ~RTE_DISTRIB_RETURN_BUF; + buf->retptr64[i] = 0; for (i = num; i-- > 0; ) buf->retptr64[i] = (((int64_t)(uintptr_t)oldpkt[i]) << - RTE_DISTRIB_FLAG_BITS) | RTE_DISTRIB_RETURN_BUF; + RTE_DISTRIB_FLAG_BITS) | RTE_DISTRIB_VALID_BUF; + + /* Use RETURN_BUF on bufptr64 to notify distributor that + * we won't read any mbufs from there even if GET_BUF is set. + * This allows distributor to retrieve in-flight already sent packets. + */ + __atomic_or_fetch(&(buf->bufptr64[0]), RTE_DISTRIB_RETURN_BUF, + __ATOMIC_ACQ_REL); - /* set the GET_BUF but even if we got no returns. - * Sync with distributor on GET_BUF flag. Release retptrs. + /* set the RETURN_BUF on retptr64 even if we got no returns. + * Sync with distributor on RETURN_BUF flag. Release retptrs. + * Notify distributor that we don't request more packets any more. */ __atomic_store_n(&(buf->retptr64[0]), - buf->retptr64[0] | RTE_DISTRIB_GET_BUF, __ATOMIC_RELEASE); + buf->retptr64[0] | RTE_DISTRIB_RETURN_BUF, __ATOMIC_RELEASE); return 0; } @@ -265,6 +275,59 @@ find_match_scalar(struct rte_distributor *d, */ } +/* + * When worker called rte_distributor_return_pkt() + * and passed RTE_DISTRIB_RETURN_BUF handshake through retptr64, + * distributor must retrieve both inflight and backlog packets assigned + * to the worker and reprocess them to another worker. + */ +static void +handle_worker_shutdown(struct rte_distributor *d, unsigned int wkr) +{ + struct rte_distributor_buffer *buf = &(d->bufs[wkr]); + /* double BURST size for storing both inflights and backlog */ + struct rte_mbuf *pkts[RTE_DIST_BURST_SIZE * 2]; + unsigned int pkts_count = 0; + unsigned int i; + + /* If GET_BUF is cleared there are in-flight packets sent + * to worker which does not require new packets. + * They must be retrieved and assigned to another worker. + */ + if (!(__atomic_load_n(&(buf->bufptr64[0]), __ATOMIC_ACQUIRE) + & RTE_DISTRIB_GET_BUF)) + for (i = 0; i < RTE_DIST_BURST_SIZE; i++) + if (buf->bufptr64[i] & RTE_DISTRIB_VALID_BUF) + pkts[pkts_count++] = (void *)((uintptr_t) + (buf->bufptr64[i] + >> RTE_DISTRIB_FLAG_BITS)); + + /* Make following operations on handshake flags on bufptr64: + * - set GET_BUF to indicate that distributor can overwrite buffer + * with new packets if worker will make a new request. + * - clear RETURN_BUF to unlock reads on worker side. + */ + __atomic_store_n(&(buf->bufptr64[0]), RTE_DISTRIB_GET_BUF, + __ATOMIC_RELEASE); + + /* Collect backlog packets from worker */ + for (i = 0; i < d->backlog[wkr].count; i++) + pkts[pkts_count++] = (void *)((uintptr_t) + (d->backlog[wkr].pkts[i] >> RTE_DISTRIB_FLAG_BITS)); + + d->backlog[wkr].count = 0; + + /* Clear both inflight and backlog tags */ + for (i = 0; i < RTE_DIST_BURST_SIZE; i++) { + d->in_flight_tags[wkr][i] = 0; + d->backlog[wkr].tags[i] = 0; + } + + /* Recursive call */ + if (pkts_count > 0) + rte_distributor_process(d, pkts, pkts_count); +} + /* * When the handshake bits indicate that there are packets coming @@ -283,19 +346,33 @@ handle_returns(struct rte_distributor *d, unsigned int wkr) /* Sync on GET_BUF flag. Acquire retptrs. */ if (__atomic_load_n(&(buf->retptr64[0]), __ATOMIC_ACQUIRE) - & RTE_DISTRIB_GET_BUF) { + & (RTE_DISTRIB_GET_BUF | RTE_DISTRIB_RETURN_BUF)) { for (i = 0; i < RTE_DIST_BURST_SIZE; i++) { - if (buf->retptr64[i] & RTE_DISTRIB_RETURN_BUF) { + if (buf->retptr64[i] & RTE_DISTRIB_VALID_BUF) { oldbuf = ((uintptr_t)(buf->retptr64[i] >> RTE_DISTRIB_FLAG_BITS)); /* store returns in a circular buffer */ store_return(oldbuf, d, &ret_start, &ret_count); count++; - buf->retptr64[i] &= ~RTE_DISTRIB_RETURN_BUF; + buf->retptr64[i] &= ~RTE_DISTRIB_VALID_BUF; } } d->returns.start = ret_start; d->returns.count = ret_count; + + /* If worker requested packets with GET_BUF, set it to active + * otherwise (RETURN_BUF), set it to not active. + */ + d->activesum -= d->active[wkr]; + d->active[wkr] = !!(buf->retptr64[0] & RTE_DISTRIB_GET_BUF); + d->activesum += d->active[wkr]; + + /* If worker returned packets without requesting new ones, + * handle all in-flights and backlog packets assigned to it. + */ + if (unlikely(buf->retptr64[0] & RTE_DISTRIB_RETURN_BUF)) + handle_worker_shutdown(d, wkr); + /* Clear for the worker to populate with more returns. * Sync with distributor on GET_BUF flag. Release retptrs. */ @@ -320,11 +397,15 @@ release(struct rte_distributor *d, unsigned int wkr) unsigned int i; handle_returns(d, wkr); + if (unlikely(!d->active[wkr])) + return 0; /* Sync with worker on GET_BUF flag */ while (!(__atomic_load_n(&(d->bufs[wkr].bufptr64[0]), __ATOMIC_ACQUIRE) & RTE_DISTRIB_GET_BUF)) { handle_returns(d, wkr); + if (unlikely(!d->active[wkr])) + return 0; rte_pause(); } @@ -364,7 +445,7 @@ rte_distributor_process(struct rte_distributor *d, int64_t next_value = 0; uint16_t new_tag = 0; uint16_t flows[RTE_DIST_BURST_SIZE] __rte_cache_aligned; - unsigned int i, j, w, wid; + unsigned int i, j, w, wid, matching_required; if (d->alg_type == RTE_DIST_ALG_SINGLE) { /* Call the old API */ @@ -372,11 +453,13 @@ rte_distributor_process(struct rte_distributor *d, mbufs, num_mbufs); } + for (wid = 0 ; wid < d->num_workers; wid++) + handle_returns(d, wid); + if (unlikely(num_mbufs == 0)) { /* Flush out all non-full cache-lines to workers. */ for (wid = 0 ; wid < d->num_workers; wid++) { /* Sync with worker on GET_BUF flag. */ - handle_returns(d, wid); if (__atomic_load_n(&(d->bufs[wid].bufptr64[0]), __ATOMIC_ACQUIRE) & RTE_DISTRIB_GET_BUF) { release(d, wid); @@ -386,6 +469,9 @@ rte_distributor_process(struct rte_distributor *d, return 0; } + if (unlikely(!d->activesum)) + return 0; + while (next_idx < num_mbufs) { uint16_t matches[RTE_DIST_BURST_SIZE]; unsigned int pkts; @@ -410,22 +496,30 @@ rte_distributor_process(struct rte_distributor *d, for (; i < RTE_DIST_BURST_SIZE; i++) flows[i] = 0; - switch (d->dist_match_fn) { - case RTE_DIST_MATCH_VECTOR: - find_match_vec(d, &flows[0], &matches[0]); - break; - default: - find_match_scalar(d, &flows[0], &matches[0]); - } + matching_required = 1; + for (j = 0; j < pkts; j++) { + if (unlikely(!d->activesum)) + return next_idx; + + if (unlikely(matching_required)) { + switch (d->dist_match_fn) { + case RTE_DIST_MATCH_VECTOR: + find_match_vec(d, &flows[0], + &matches[0]); + break; + default: + find_match_scalar(d, &flows[0], + &matches[0]); + } + matching_required = 0; + } /* * Matches array now contain the intended worker ID (+1) of * the incoming packets. Any zeroes need to be assigned * workers. */ - for (j = 0; j < pkts; j++) { - next_mb = mbufs[next_idx++]; next_value = (((int64_t)(uintptr_t)next_mb) << RTE_DISTRIB_FLAG_BITS); @@ -445,12 +539,18 @@ rte_distributor_process(struct rte_distributor *d, */ /* matches[j] = 0; */ - if (matches[j]) { + if (matches[j] && d->active[matches[j]-1]) { struct rte_distributor_backlog *bl = &d->backlog[matches[j]-1]; if (unlikely(bl->count == RTE_DIST_BURST_SIZE)) { release(d, matches[j]-1); + if (!d->active[matches[j]-1]) { + j--; + next_idx--; + matching_required = 1; + continue; + } } /* Add to worker that already has flow */ @@ -460,11 +560,21 @@ rte_distributor_process(struct rte_distributor *d, bl->pkts[idx] = next_value; } else { - struct rte_distributor_backlog *bl = - &d->backlog[wkr]; + struct rte_distributor_backlog *bl; + + while (unlikely(!d->active[wkr])) + wkr = (wkr + 1) % d->num_workers; + bl = &d->backlog[wkr]; + if (unlikely(bl->count == RTE_DIST_BURST_SIZE)) { release(d, wkr); + if (!d->active[wkr]) { + j--; + next_idx--; + matching_required = 1; + continue; + } } /* Add to current worker worker */ @@ -483,9 +593,7 @@ rte_distributor_process(struct rte_distributor *d, matches[w] = wkr+1; } } - wkr++; - if (wkr >= d->num_workers) - wkr = 0; + wkr = (wkr + 1) % d->num_workers; } /* Flush out all non-full cache-lines to workers. */ @@ -661,6 +769,9 @@ rte_distributor_create(const char *name, for (i = 0 ; i < num_workers ; i++) d->backlog[i].tags = &d->in_flight_tags[i][RTE_DIST_BURST_SIZE]; + memset(d->active, 0, sizeof(d->active)); + d->activesum = 0; + dist_burst_list = RTE_TAILQ_CAST(rte_dist_burst_tailq.head, rte_dist_burst_list); From patchwork Sat Oct 17 03:06:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Wojciechowski X-Patchwork-Id: 81174 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0F586A04DB; Sat, 17 Oct 2020 05:11:26 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1C5EFE2F3; Sat, 17 Oct 2020 05:08:11 +0200 (CEST) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id 5AD80E2B1 for ; Sat, 17 Oct 2020 05:07:42 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20201017030722euoutp01bc8418e34a4525e56cee39956bc8fcb8~_qLvrzWvy1627716277euoutp01Y for ; Sat, 17 Oct 2020 03:07:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20201017030722euoutp01bc8418e34a4525e56cee39956bc8fcb8~_qLvrzWvy1627716277euoutp01Y DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1602904042; bh=LemR1YjnE+c23RXwEQzxMBn4x6DVQHDmQWboTCBU/MI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LKUFQ8ZGVdzFM4MpIj2knneOtKmS3hMaiyT8R3ThXYoA5AAxFKAQ17t+RwYiqLm6/ WVHcy1V2nu0GlA4b5btnxT9h7jzgM//zde+n3qvdMW0dv4ngVOUgMw0Qam/b/huPC1 hz3VxdsCYA69AXPkJjhSytLbz7XeGqwPs3RhAVPw= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20201017030713eucas1p2a2bfb6ab66a424ef7afa2882a619c88e~_qLnqGuKu1521315213eucas1p2X; Sat, 17 Oct 2020 03:07:13 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 72.42.05997.1EF5A8F5; Sat, 17 Oct 2020 04:07:13 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20201017030713eucas1p1173c2178e647be341db2da29078c8d5d~_qLnXDueq0898308983eucas1p15; Sat, 17 Oct 2020 03:07:13 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20201017030713eusmtrp23d5c410cb0a98dd956099e4fc4602e00~_qLnWj3FC2572125721eusmtrp2i; Sat, 17 Oct 2020 03:07:13 +0000 (GMT) X-AuditID: cbfec7f4-677ff7000000176d-bb-5f8a5fe1a42c Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id CA.99.06314.1EF5A8F5; Sat, 17 Oct 2020 04:07:13 +0100 (BST) Received: from localhost.localdomain (unknown [106.210.88.70]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201017030712eusmtip18de3ab114528a40c48b1b9cb261e179f~_qLmlZ-KT3124931249eusmtip16; Sat, 17 Oct 2020 03:07:12 +0000 (GMT) From: Lukasz Wojciechowski To: David Hunt , Bruce Richardson Cc: dev@dpdk.org, l.wojciechow@partner.samsung.com, stable@dpdk.org Date: Sat, 17 Oct 2020 05:06:49 +0200 Message-Id: <20201017030701.16134-6-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201017030701.16134-1-l.wojciechow@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrPIsWRmVeSWpSXmKPExsWy7djP87oP47viDWa2GVjcWGVv0TfpI5PF u0/bmSye9axjtPjX8YfdgdXj14KlrB6L97xk8jj4bg9TAHMUl01Kak5mWWqRvl0CV8bTZ0dZ Cs5KVRxav4mxgXG7aBcjO4eEgInEdJsuRi4OIYEVjBK/th9j6WLkBHK+MEo87HGHsD8zSkyZ Vwdig5RPOX8BqmY5o8TJc7VwNfvmq4DYbAK2EkdmfmUFsUUEwiSam/cC1XNwMAs4Szz5ygYS FhZwl/h5ZSNYCYuAqsSR4wuZQWxeAVeJtStbWSFWyUus3nCAGaSVU8BNovG4K0T4OpvE1rPW IGEJAReJ7kO6EGFhiVfHt7BD2DIS/3fOZwL5SkJgG6PE1d8/GSGc/YwS13tXQFVZSxz+95sN 4jRNifW79CHCjhL3P85lgZjPJ3HjrSBImBnInLRtOjNEmFeio00IolpP4mnPVEaYtX/WPmGB sD0kZv5fwwQJ2KtAW183ME9glJ+FsGwBI+MqRvHU0uLc9NRio7zUcr3ixNzi0rx0veT83E2M wGg//e/4lx2Mu/4kHWIU4GBU4uHlWNoZL8SaWFZcmXuIUYKDWUmE1+ns6Tgh3pTEyqrUovz4 otKc1OJDjNIcLErivMaLXsYKCaQnlqRmp6YWpBbBZJk4OKUaGIPmZV0VLXgSocJ26MN6lX3W 7if8Xt8NafiW+mPaAZuGGFUD65u655favDQ+O53xSeWlVzoyG5xt13y5Xj1vxo2CrQ7ZxZHM 588vFmVqYv3M1CV3M0sllXuW5Z5doV+Y46/anzcofJfUxGDGkWmdeX/q7l15ZyrTvLev+i15 /Wx+b5nmJ6cbrEosxRmJhlrMRcWJAObys33yAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrOLMWRmVeSWpSXmKPExsVy+t/xu7oP47viDV6fl7G4screom/SRyaL d5+2M1k861nHaPGv4w+7A6vHrwVLWT0W73nJ5HHw3R6mAOYoPZui/NKSVIWM/OISW6VoQwsj PUNLCz0jE0s9Q2PzWCsjUyV9O5uU1JzMstQifbsEvYynz46yFJyVqji0fhNjA+N20S5GTg4J AROJKecvsHQxcnEICSxllJjx6hZ7FyMHUEJG4sMlAYgaYYk/17rYIGo+MkocmHmPESTBJmAr cWTmV1aQehGBMIkTK/1BwswC7hJbFk9lBrGFgeyfVzaygtgsAqoSR44vBIvzCrhKrF3Zygox X15i9YYDzCBjOAXcJBqPu0KsamSUODtrHcsERr4FjAyrGEVSS4tz03OLDfWKE3OLS/PS9ZLz czcxAgNx27Gfm3cwXtoYfIhRgINRiYd3w6LOeCHWxLLiytxDjBIczEoivE5nT8cJ8aYkVlal FuXHF5XmpBYfYjQFOmois5Rocj4wSvJK4g1NDc0tLA3Njc2NzSyUxHk7BA7GCAmkJ5akZqem FqQWwfQxcXBKNTDOXWe8ymniv6dbi52YlK2mb9m7MGVHeobLsuONja3LGBdcfrg6vH+vjF3i Y6FvJnqrd1R8/7Bv8425v53KUwpatfp0jQ8y7tkkv/T+909dhheX9tq/Kjw/84rEw/6N+w9/ 0a3gehEobGO/ZYa8IQPnu7VPXJa/Tg/Y0rbE7+SbgDi9zi3nj8u9VWIpzkg01GIuKk4EANeG M/1aAgAA X-CMS-MailID: 20201017030713eucas1p1173c2178e647be341db2da29078c8d5d X-Msg-Generator: CA X-RootMTR: 20201017030713eucas1p1173c2178e647be341db2da29078c8d5d X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201017030713eucas1p1173c2178e647be341db2da29078c8d5d References: <20201010160508.19709-1-l.wojciechow@partner.samsung.com> <20201017030701.16134-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-dev] [PATCH v8 05/17] test/distributor: fix shutdown of busy worker 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The sanity test with worker shutdown delegates all bufs to be processed by a single lcore worker, then it freezes one of the lcore workers and continues to send more bufs. The freezed core shuts down first by calling rte_distributor_return_pkt(). The test intention is to verify if packets assigned to the shut down lcore will be reassigned to another worker. However the shutdown core was not always the one, that was processing packets. The lcore processing mbufs might be different every time test is launched. This is caused by keeping the value of wkr static variable in rte_distributor_process() function between running test cases. Test freezed always lcore with 0 id. The patch stores the id of worker that is processing the data in zero_idx global atomic variable. This way the freezed lcore is always the proper one. Fixes: c3eabff124e6 ("distributor: add unit tests") Cc: bruce.richardson@intel.com Cc: stable@dpdk.org Signed-off-by: Lukasz Wojciechowski Tested-by: David Hunt --- app/test/test_distributor.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c index 52230d250..6cd7a2edd 100644 --- a/app/test/test_distributor.c +++ b/app/test/test_distributor.c @@ -28,6 +28,7 @@ struct worker_params worker_params; static volatile int quit; /**< general quit variable for all threads */ static volatile int zero_quit; /**< var for when we just want thr0 to quit*/ static volatile unsigned worker_idx; +static volatile unsigned zero_idx; struct worker_stats { volatile unsigned handled_packets; @@ -340,26 +341,43 @@ handle_work_for_shutdown_test(void *arg) unsigned int total = 0; unsigned int i; unsigned int returned = 0; + unsigned int zero_id = 0; + unsigned int zero_unset; const unsigned int id = __atomic_fetch_add(&worker_idx, 1, __ATOMIC_RELAXED); num = rte_distributor_get_pkt(d, id, buf, NULL, 0); + if (num > 0) { + zero_unset = RTE_MAX_LCORE; + __atomic_compare_exchange_n(&zero_idx, &zero_unset, id, + false, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE); + } + zero_id = __atomic_load_n(&zero_idx, __ATOMIC_ACQUIRE); + /* wait for quit single globally, or for worker zero, wait * for zero_quit */ - while (!quit && !(id == 0 && zero_quit)) { + while (!quit && !(id == zero_id && zero_quit)) { worker_stats[id].handled_packets += num; count += num; for (i = 0; i < num; i++) rte_pktmbuf_free(buf[i]); num = rte_distributor_get_pkt(d, id, buf, NULL, 0); + + if (num > 0) { + zero_unset = RTE_MAX_LCORE; + __atomic_compare_exchange_n(&zero_idx, &zero_unset, id, + false, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE); + } + zero_id = __atomic_load_n(&zero_idx, __ATOMIC_ACQUIRE); + total += num; } worker_stats[id].handled_packets += num; count += num; returned = rte_distributor_return_pkt(d, id, buf, num); - if (id == 0) { + if (id == zero_id) { /* for worker zero, allow it to restart to pick up last packet * when all workers are shutting down. */ @@ -578,6 +596,7 @@ quit_workers(struct worker_params *wp, struct rte_mempool *p) rte_eal_mp_wait_lcore(); quit = 0; worker_idx = 0; + zero_idx = RTE_MAX_LCORE; } static int From patchwork Sat Oct 17 03:06:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Wojciechowski X-Patchwork-Id: 81171 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id EA4F7A04DB; Sat, 17 Oct 2020 05:10:14 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D1695E2CB; Sat, 17 Oct 2020 05:07:59 +0200 (CEST) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id EE62AE2AA for ; Sat, 17 Oct 2020 05:07:38 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20201017030722euoutp015aeb1aae67d36f7ecf73e2cff13b4703~_qLvWXIuc0903009030euoutp01v for ; Sat, 17 Oct 2020 03:07:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20201017030722euoutp015aeb1aae67d36f7ecf73e2cff13b4703~_qLvWXIuc0903009030euoutp01v DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1602904042; bh=HJPgphr+hd6bGoQWpMo7AknsNsjiDnUwTElgEuD8nH0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fdYV2FIlCB2H+6DJlCnkLXY5oCZKs2qLqn3M5yQfyeN3nb4yeG/0V/guaCGPNPeOG hg4iUkVNlTsE2ls7DjCfcBkFq0Q1+zWUAcNZ2ZEM1FHDGr6S4nYSJpmLvJ/fC6bg2n uVM+5pCkO73KmNk5VNmujrg4gUfs5HoY4O2oe+rs= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20201017030714eucas1p111c6d82462a467c05637ee82293e45e0~_qLojKy1O0898408984eucas1p11; Sat, 17 Oct 2020 03:07:14 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 48.D5.06318.2EF5A8F5; Sat, 17 Oct 2020 04:07:14 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20201017030714eucas1p292bd71a85ea6d638256c21d279c8d533~_qLoG9HuY1942819428eucas1p2w; Sat, 17 Oct 2020 03:07:14 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20201017030714eusmtrp1974fdc1fc6c79c752d7469f4bb206716~_qLoGZ7g-3018830188eusmtrp1V; Sat, 17 Oct 2020 03:07:14 +0000 (GMT) X-AuditID: cbfec7f5-38bff700000018ae-94-5f8a5fe228f5 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 6D.DE.06017.2EF5A8F5; Sat, 17 Oct 2020 04:07:14 +0100 (BST) Received: from localhost.localdomain (unknown [106.210.88.70]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201017030713eusmtip1d02f205519153d1c822ab4dba6c7058a~_qLngtj2l3071330713eusmtip1G; Sat, 17 Oct 2020 03:07:13 +0000 (GMT) From: Lukasz Wojciechowski To: David Hunt , Bruce Richardson Cc: dev@dpdk.org, l.wojciechow@partner.samsung.com, stable@dpdk.org Date: Sat, 17 Oct 2020 05:06:50 +0200 Message-Id: <20201017030701.16134-7-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201017030701.16134-1-l.wojciechow@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrOIsWRmVeSWpSXmKPExsWy7djPc7qP4rviDR4t0rK4screom/SRyaL d5+2M1k861nHaPGv4w+7A6vHrwVLWT0W73nJ5HHw3R6mAOYoLpuU1JzMstQifbsErowFMzax FUzirjh19QNzA+Nmzi5GTg4JAROJx1+/sHUxcnEICaxglNi4bQGU84VR4m/DfXYI5zOjxNI9 cxlhWjpXr4SqWs4o0Tm7lRWu6tKCSSwgVWwCthJHZn5lBbFFBMIkmpv3AsU5OJgFnCWefGUD CQsLeElMeDiLGcRmEVCVOHaxjQnE5hVwlTi85AozxDJ5idUbDjCDtHIKuEk0HncFWSUhcJ1N Yu7jhWwQNS4SG9pOQdULS7w6voUdwpaROD25hwWiYRujxNXfPxkhnP2MEtd7V0BVWUsc/veb DeI4TYn1u/Qhwo4SM25fA1ssIcAnceOtIEiYGcictG06VJhXoqNNCKJaT+Jpz1RGmLV/1j5h gbA9JPb+O8EICZ6rjBKNpxayT2CUn4WwbAEj4ypG8dTS4tz01GLjvNRyveLE3OLSvHS95Pzc TYzA6D/97/jXHYz7/iQdYhTgYFTi4eVY2hkvxJpYVlyZe4hRgoNZSYTX6ezpOCHelMTKqtSi /Pii0pzU4k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1p292bd71a85ea6d638256c21d279c8d533 X-Msg-Generator: CA X-RootMTR: 20201017030714eucas1p292bd71a85ea6d638256c21d279c8d533 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201017030714eucas1p292bd71a85ea6d638256c21d279c8d533 References: <20201010160508.19709-1-l.wojciechow@partner.samsung.com> <20201017030701.16134-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-dev] [PATCH v8 06/17] distributor: fix return pkt calls in single mode 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" In the single legacy version of the distributor synchronization requires continues exchange of buffers between distributor and workers. Empty buffers are sent if only handshake synchronization is required. However calls to the rte_distributor_return_pkt() with 0 buffers in single mode were ignored and not passed to the legacy algorithm implementation causing lack of synchronization. This patch fixes this issue by passing NULL as buffer which is a valid way of sending just synchronization handshakes in single mode. Fixes: 775003ad2f96 ("distributor: add new burst-capable library") Cc: david.hunt@intel.com Cc: stable@dpdk.org Signed-off-by: Lukasz Wojciechowski Acked-by: David Hunt --- lib/librte_distributor/rte_distributor.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/librte_distributor/rte_distributor.c b/lib/librte_distributor/rte_distributor.c index 7aa079d53..6e3eae58f 100644 --- a/lib/librte_distributor/rte_distributor.c +++ b/lib/librte_distributor/rte_distributor.c @@ -167,6 +167,9 @@ rte_distributor_return_pkt(struct rte_distributor *d, if (num == 1) return rte_distributor_return_pkt_single(d->d_single, worker_id, oldpkt[0]); + else if (num == 0) + return rte_distributor_return_pkt_single(d->d_single, + worker_id, NULL); else return -EINVAL; } From patchwork Sat Oct 17 03:06:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Wojciechowski X-Patchwork-Id: 81172 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id EFE7AA04DB; Sat, 17 Oct 2020 05:10:41 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8805BE2E4; Sat, 17 Oct 2020 05:08:07 +0200 (CEST) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id 9755AE2A8 for ; Sat, 17 Oct 2020 05:07:39 +0200 (CEST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20201017030722euoutp0151c9003e044a93626cdf65bab89dfd72~_qLvkNkSQ0903009030euoutp01w for ; Sat, 17 Oct 2020 03:07:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20201017030722euoutp0151c9003e044a93626cdf65bab89dfd72~_qLvkNkSQ0903009030euoutp01w DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1602904042; bh=dtWIMxmqC093nromZjQX9OoS2dikG3YuYpmSL0ZQi8w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M4fIBWGClr4NJD1WgRTRI0t2xBo6QHk/N6eAa/JivYFvy8Gmzv4iCHiej2AgnHZ16 887j0xGsJZ548ZA8n+cja6VOB+88K4WKTjxWeopg1tbhNrj/weS1P3PmYR7D2DqqHS 3m/XAiBE1a2neoOHf+CYGoICfIisesoJz82c/Pco= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20201017030716eucas1p2f06e78f9a35e054842b1ad194bc548bd~_qLpzOsjq1521315213eucas1p2Z; Sat, 17 Oct 2020 03:07:16 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id D2.42.05997.4EF5A8F5; Sat, 17 Oct 2020 04:07:16 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20201017030715eucas1p2366d1f0ce16a219b21542bb26e4588a6~_qLpCbwAZ1097310973eucas1p24; Sat, 17 Oct 2020 03:07:15 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20201017030715eusmtrp25e6ba6d9f2f9fe785a3912ec8f5d7510~_qLpB3h9g2813028130eusmtrp2M; Sat, 17 Oct 2020 03:07:15 +0000 (GMT) X-AuditID: cbfec7f4-65dff7000000176d-be-5f8a5fe40e4c Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 2B.99.06314.3EF5A8F5; Sat, 17 Oct 2020 04:07:15 +0100 (BST) Received: from localhost.localdomain (unknown [106.210.88.70]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201017030714eusmtip13a1463d0d770a8b49ffa101699ad0146~_qLoQVeVj3124931249eusmtip17; Sat, 17 Oct 2020 03:07:14 +0000 (GMT) From: Lukasz Wojciechowski To: David Hunt , Bruce Richardson Cc: dev@dpdk.org, l.wojciechow@partner.samsung.com, stable@dpdk.org Date: Sat, 17 Oct 2020 05:06:51 +0200 Message-Id: <20201017030701.16134-8-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201017030701.16134-1-l.wojciechow@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrKIsWRmVeSWpSXmKPExsWy7djPc7pP4rviDfacYre4screom/SRyaL d5+2M1k861nHaPGv4w+7A6vHrwVLWT0W73nJ5HHw3R6mAOYoLpuU1JzMstQifbsErozrk8MK ztlVbNgu1sA4z6iLkZNDQsBE4urVacxdjFwcQgIrGCUuT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lVj7/B0TxHx5 idUbDoCt5RRwk2g87gqxqpFR4uysdSwTGPkWMDKsYhRJLS3OTc8tNtQrTswtLs1L10vOz93E CAzCbcd+bt7BeGlj8CFGAQ5GJR7eDYs644VYE8uKK3MPMUpwMCuJ8DqdPR0nxJuSWFmVWpQf X1Sak1p8iNEU6KiJzFKiyfnACMkriTc0NTS3sDQ0NzY3NrNQEuftEDgYIySQnliSmp2aWpBa BNPHxMEp1cDIdtyxcNIZpUN3dh7wXLnsbOJl2fbGOFHf430/Ur7VBBotLI0u8G66rX0u6crR Mu/ygyclbq1ZeMv93t1zDZcPthyOuZ96xTEmlaOZbbaCQ3UL16b/XGF75pq+atNaHuetG9P6 /um7yNdzZ0TJvFyUcsf/fdtRzSXqvw8tzJ80o6hAvKnoncp8JZbijERDLeai4kQA6y7qrlgC AAA= X-CMS-MailID: 20201017030715eucas1p2366d1f0ce16a219b21542bb26e4588a6 X-Msg-Generator: CA X-RootMTR: 20201017030715eucas1p2366d1f0ce16a219b21542bb26e4588a6 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201017030715eucas1p2366d1f0ce16a219b21542bb26e4588a6 References: <20201010160508.19709-1-l.wojciechow@partner.samsung.com> <20201017030701.16134-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-dev] [PATCH v8 07/17] test/distributor: fix freeing mbufs 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Sanity tests with mbuf alloc and shutdown tests assume that mbufs passed to worker cores are freed in handlers. Such packets should not be returned to the distributor's main core. The only packets that should be returned are the packets send after completion of the tests in quit_workers function. This patch stops returning mbufs to distributor's core. In case of shutdown tests it is impossible to determine how worker and distributor threads would synchronize. Packets used by tests should be freed and packets used during quit_workers() shouldn't. That's why returning mbufs to mempool is moved to test procedure run on distributor thread from worker threads. Additionally this patch cleans up unused variables. Fixes: c0de0eb82e40 ("distributor: switch over to new API") Cc: david.hunt@intel.com Cc: stable@dpdk.org Signed-off-by: Lukasz Wojciechowski Acked-by: David Hunt --- app/test/test_distributor.c | 67 ++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 34 deletions(-) diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c index 6cd7a2edd..ec1fe348b 100644 --- a/app/test/test_distributor.c +++ b/app/test/test_distributor.c @@ -63,20 +63,18 @@ handle_work(void *arg) struct rte_mbuf *buf[8] __rte_cache_aligned; struct worker_params *wp = arg; struct rte_distributor *db = wp->dist; - unsigned int count = 0, num; + unsigned int num; unsigned int id = __atomic_fetch_add(&worker_idx, 1, __ATOMIC_RELAXED); num = rte_distributor_get_pkt(db, id, buf, NULL, 0); while (!quit) { __atomic_fetch_add(&worker_stats[id].handled_packets, num, __ATOMIC_RELAXED); - count += num; num = rte_distributor_get_pkt(db, id, buf, buf, num); } __atomic_fetch_add(&worker_stats[id].handled_packets, num, __ATOMIC_RELAXED); - count += num; rte_distributor_return_pkt(db, id, buf, num); return 0; } @@ -268,7 +266,6 @@ handle_work_with_free_mbufs(void *arg) struct rte_mbuf *buf[8] __rte_cache_aligned; struct worker_params *wp = arg; struct rte_distributor *d = wp->dist; - unsigned int count = 0; unsigned int i; unsigned int num; unsigned int id = __atomic_fetch_add(&worker_idx, 1, __ATOMIC_RELAXED); @@ -276,13 +273,11 @@ handle_work_with_free_mbufs(void *arg) num = rte_distributor_get_pkt(d, id, buf, NULL, 0); while (!quit) { worker_stats[id].handled_packets += num; - count += num; for (i = 0; i < num; i++) rte_pktmbuf_free(buf[i]); num = rte_distributor_get_pkt(d, id, buf, NULL, 0); } worker_stats[id].handled_packets += num; - count += num; rte_distributor_return_pkt(d, id, buf, num); return 0; } @@ -308,7 +303,6 @@ sanity_test_with_mbuf_alloc(struct worker_params *wp, struct rte_mempool *p) rte_distributor_process(d, NULL, 0); for (j = 0; j < BURST; j++) { bufs[j]->hash.usr = (i+j) << 1; - rte_mbuf_refcnt_set(bufs[j], 1); } rte_distributor_process(d, bufs, BURST); @@ -332,15 +326,10 @@ sanity_test_with_mbuf_alloc(struct worker_params *wp, struct rte_mempool *p) static int handle_work_for_shutdown_test(void *arg) { - struct rte_mbuf *pkt = NULL; struct rte_mbuf *buf[8] __rte_cache_aligned; struct worker_params *wp = arg; struct rte_distributor *d = wp->dist; - unsigned int count = 0; unsigned int num; - unsigned int total = 0; - unsigned int i; - unsigned int returned = 0; unsigned int zero_id = 0; unsigned int zero_unset; const unsigned int id = __atomic_fetch_add(&worker_idx, 1, @@ -359,9 +348,6 @@ handle_work_for_shutdown_test(void *arg) * for zero_quit */ while (!quit && !(id == zero_id && zero_quit)) { worker_stats[id].handled_packets += num; - count += num; - for (i = 0; i < num; i++) - rte_pktmbuf_free(buf[i]); num = rte_distributor_get_pkt(d, id, buf, NULL, 0); if (num > 0) { @@ -370,14 +356,12 @@ handle_work_for_shutdown_test(void *arg) false, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE); } zero_id = __atomic_load_n(&zero_idx, __ATOMIC_ACQUIRE); - - total += num; } worker_stats[id].handled_packets += num; - count += num; - returned = rte_distributor_return_pkt(d, id, buf, num); if (id == zero_id) { + rte_distributor_return_pkt(d, id, NULL, 0); + /* for worker zero, allow it to restart to pick up last packet * when all workers are shutting down. */ @@ -388,14 +372,10 @@ handle_work_for_shutdown_test(void *arg) while (!quit) { worker_stats[id].handled_packets += num; - count += num; - rte_pktmbuf_free(pkt); num = rte_distributor_get_pkt(d, id, buf, NULL, 0); } - returned = rte_distributor_return_pkt(d, - id, buf, num); - printf("Num returned = %d\n", returned); } + rte_distributor_return_pkt(d, id, buf, num); return 0; } @@ -411,7 +391,9 @@ sanity_test_with_worker_shutdown(struct worker_params *wp, { struct rte_distributor *d = wp->dist; struct rte_mbuf *bufs[BURST]; - unsigned i; + struct rte_mbuf *bufs2[BURST]; + unsigned int i; + unsigned int failed = 0; printf("=== Sanity test of worker shutdown ===\n"); @@ -437,16 +419,17 @@ sanity_test_with_worker_shutdown(struct worker_params *wp, */ /* get more buffers to queue up, again setting them to the same flow */ - if (rte_mempool_get_bulk(p, (void *)bufs, BURST) != 0) { + if (rte_mempool_get_bulk(p, (void *)bufs2, BURST) != 0) { printf("line %d: Error getting mbufs from pool\n", __LINE__); + rte_mempool_put_bulk(p, (void *)bufs, BURST); return -1; } for (i = 0; i < BURST; i++) - bufs[i]->hash.usr = 1; + bufs2[i]->hash.usr = 1; /* get worker zero to quit */ zero_quit = 1; - rte_distributor_process(d, bufs, BURST); + rte_distributor_process(d, bufs2, BURST); /* flush the distributor */ rte_distributor_flush(d); @@ -460,9 +443,15 @@ sanity_test_with_worker_shutdown(struct worker_params *wp, printf("Line %d: Error, not all packets flushed. " "Expected %u, got %u\n", __LINE__, BURST * 2, total_packet_count()); - return -1; + failed = 1; } + rte_mempool_put_bulk(p, (void *)bufs, BURST); + rte_mempool_put_bulk(p, (void *)bufs2, BURST); + + if (failed) + return -1; + printf("Sanity test with worker shutdown passed\n\n"); return 0; } @@ -476,7 +465,8 @@ test_flush_with_worker_shutdown(struct worker_params *wp, { struct rte_distributor *d = wp->dist; struct rte_mbuf *bufs[BURST]; - unsigned i; + unsigned int i; + unsigned int failed = 0; printf("=== Test flush fn with worker shutdown (%s) ===\n", wp->name); @@ -513,9 +503,14 @@ test_flush_with_worker_shutdown(struct worker_params *wp, printf("Line %d: Error, not all packets flushed. " "Expected %u, got %u\n", __LINE__, BURST, total_packet_count()); - return -1; + failed = 1; } + rte_mempool_put_bulk(p, (void *)bufs, BURST); + + if (failed) + return -1; + printf("Flush test with worker shutdown passed\n\n"); return 0; } @@ -581,7 +576,10 @@ quit_workers(struct worker_params *wp, struct rte_mempool *p) const unsigned num_workers = rte_lcore_count() - 1; unsigned i; struct rte_mbuf *bufs[RTE_MAX_LCORE]; - rte_mempool_get_bulk(p, (void *)bufs, num_workers); + if (rte_mempool_get_bulk(p, (void *)bufs, num_workers) != 0) { + printf("line %d: Error getting mbufs from pool\n", __LINE__); + return; + } zero_quit = 0; quit = 1; @@ -589,11 +587,12 @@ quit_workers(struct worker_params *wp, struct rte_mempool *p) bufs[i]->hash.usr = i << 1; rte_distributor_process(d, bufs, num_workers); - rte_mempool_put_bulk(p, (void *)bufs, num_workers); - rte_distributor_process(d, NULL, 0); rte_distributor_flush(d); rte_eal_mp_wait_lcore(); + + rte_mempool_put_bulk(p, (void *)bufs, num_workers); + quit = 0; worker_idx = 0; zero_idx = RTE_MAX_LCORE; From patchwork Sat Oct 17 03:06:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Wojciechowski X-Patchwork-Id: 81175 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 712B3A04DB; Sat, 17 Oct 2020 05:11:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9DB14E2FD; Sat, 17 Oct 2020 05:08:12 +0200 (CEST) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 97336E29B for ; Sat, 17 Oct 2020 05:07:41 +0200 (CEST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20201017030722euoutp0239064754bc5091358a41b0957cb8d704~_qLv5U5QP2305923059euoutp02W for ; Sat, 17 Oct 2020 03:07:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20201017030722euoutp0239064754bc5091358a41b0957cb8d704~_qLv5U5QP2305923059euoutp02W DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1602904042; bh=QAISyyr3ZOV4JCVDYbcde2TX6o3fexIKja9MtfGYUK4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SDI4rGlArCjmhkT4kTUGNh+INhEf/5Cq8uCJzSalKSY74YQrahTJ68iPCYRj5qwxq 5Rf7mMssoQjRcmfjJK4pLWCdGC5UEPTwKBeoCZjUbW6YMbg1SQj0iIVg2Ig9giNPlo vmTsfBznqpGrnWOX1HHMsT42/pBtFKqif18ZAJTU= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20201017030717eucas1p2aa02624ef1d361529b5a3e76a4efe4bd~_qLq001It1097310973eucas1p25; Sat, 17 Oct 2020 03:07:17 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 33.42.05997.5EF5A8F5; Sat, 17 Oct 2020 04:07:17 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20201017030716eucas1p2911112ee3c9e0a3f3dd9a811cbafe77b~_qLqEILay2441224412eucas1p2_; Sat, 17 Oct 2020 03:07:16 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20201017030716eusmtrp1c7a13402ea20fe783d1f8e7f0c1b9e0b~_qLqDjldS3018830188eusmtrp1W; Sat, 17 Oct 2020 03:07:16 +0000 (GMT) X-AuditID: cbfec7f4-65dff7000000176d-c0-5f8a5fe54eec Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id CD.DE.06017.4EF5A8F5; Sat, 17 Oct 2020 04:07:16 +0100 (BST) Received: from localhost.localdomain (unknown [106.210.88.70]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201017030715eusmtip1b8491a2fd8e4e0b99f5ae0317809edd4~_qLpKYN250424404244eusmtip1O; Sat, 17 Oct 2020 03:07:15 +0000 (GMT) From: Lukasz Wojciechowski To: David Hunt , Bruce Richardson Cc: dev@dpdk.org, l.wojciechow@partner.samsung.com, stable@dpdk.org Date: Sat, 17 Oct 2020 05:06:52 +0200 Message-Id: <20201017030701.16134-9-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201017030701.16134-1-l.wojciechow@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCIsWRmVeSWpSXmKPExsWy7djP87pP47viDWY0cVncWGVv0TfpI5PF u0/bmSye9axjtPjX8YfdgdXj14KlrB6L97xk8jj4bg9TAHMUl01Kak5mWWqRvl0CV8bc63uZ C2ZoVHQdT2lgfK7QxcjJISFgInHk6TS2LkYuDiGBFYwSXy6uYIJwvjBKTHy9FMr5zCjx5+1l VpiWzQcmMEIkljNKPJz6jh2uatOm80wgVWwCthJHZn4F6xARCJNobt7L0sXIwcEs4Czx5Csb iCks4ClxpE0UpIJFQFWi98EHdpAwr4CrxLadxRCr5CVWbzjADBLmFHCTaDzuCrJIQuAym8Td maehznGR2HeokRnCFpZ4dXwLO4QtI3F6cg8LRMM2Romrv38yQjj7GSWu966AqrKWOPzvNxvE aZoS63fpQ4QdJVrXLWYECUsI8EnceCsIEmYGMidtm84MEeaV6GgTgqjWk3jaM5URZu2ftU9Y IGwPiY7zE5ghgXOVUeL2xvMsExjlZyEsW8DIuIpRPLW0ODc9tdgoL7Vcrzgxt7g0L10vOT93 EyMw7k//O/5lB+OuP0mHGAU4GJV4eDmWdsYLsSaWFVfmHmKU4GBWEuF1Ons6Tog3JbGyKrUo P76oNCe1+BCjNAeLkjiv8aKXsUIC6YklqdmpqQWpRTBZJg5OqQZGw+TlO72D1p/dczpKLs5r i+fp44Wy/e4lb/4HlVn+Zqznn6R9um3t9jaTGumSbSfMmVzEdnyx9yupX7051tahvOfR7C3O cpFX7j/Y0y9dL/pV55Dn1tKZ2VcSFNVfBd9N2Gp34rBSgs7GVYusEu4f8LROvqxyfHbPLj7t G8krXy48w79wPZe0EktxRqKhFnNRcSIAeAzqmvcCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrCLMWRmVeSWpSXmKPExsVy+t/xu7pP4rviDbbME7O4screom/SRyaL d5+2M1k861nHaPGv4w+7A6vHrwVLWT0W73nJ5HHw3R6mAOYoPZui/NKSVIWM/OISW6VoQwsj PUNLCz0jE0s9Q2PzWCsjUyV9O5uU1JzMstQifbsEvYy51/cyF8zQqOg6ntLA+Fyhi5GTQ0LA RGLzgQmMXYxcHEICSxklLh44ytLFyAGUkJH4cEkAokZY4s+1LjaImo+MEpfu7mMHSbAJ2Eoc mfmVFaReRCBM4sRKf5Aws4C7xJbFU5lBwsICnhJH2kRBwiwCqhK9Dz6wg4R5BVwltu0shpgu L7F6wwGwak4BN4nG464QixoZJc7OWscygZFvASPDKkaR1NLi3PTcYiO94sTc4tK8dL3k/NxN jMAQ3Hbs55YdjF3vgg8xCnAwKvHwbljUGS/EmlhWXJl7iFGCg1lJhNfp7Ok4Id6UxMqq1KL8 +KLSnNTiQ4ymQDdNZJYSTc4HxkdeSbyhqaG5haWhubG5sZmFkjhvh8DBGCGB9MSS1OzU1ILU Ipg+Jg5OqQbGLNfs9fOfrj3qWGlY9/+uVWHpPiEJ/iXv+kQ836wrKNpwxOeByqtnGT2MMsXz lvf7fopN3vj2d47Y29ZHUZdFnA9tnRmnsjvhoMaGqRuXp7ituuP9mr1QhPX5M6NHJV8uOrYt XMBx4761FNvaDwHPVbQfl75NrRH+eKmLMe7firTSjPOPnm9JUWIpzkg01GIuKk4EAPdETI5X AgAA X-CMS-MailID: 20201017030716eucas1p2911112ee3c9e0a3f3dd9a811cbafe77b X-Msg-Generator: CA X-RootMTR: 20201017030716eucas1p2911112ee3c9e0a3f3dd9a811cbafe77b X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201017030716eucas1p2911112ee3c9e0a3f3dd9a811cbafe77b References: <20201010160508.19709-1-l.wojciechow@partner.samsung.com> <20201017030701.16134-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-dev] [PATCH v8 08/17] test/distributor: synchronize lcores statistics 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Statistics of handled packets are cleared and read on main lcore, while they are increased in workers handlers on different lcores. Without synchronization occasionally showed invalid values. This patch uses atomic mechanisms to synchronize. Relaxed memory model is used. Fixes: c3eabff124e6 ("distributor: add unit tests") Cc: bruce.richardson@intel.com Cc: stable@dpdk.org Signed-off-by: Lukasz Wojciechowski Acked-by: David Hunt Reviewed-by: Honnappa Nagarahalli --- app/test/test_distributor.c | 39 +++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c index ec1fe348b..4343efed1 100644 --- a/app/test/test_distributor.c +++ b/app/test/test_distributor.c @@ -43,7 +43,8 @@ total_packet_count(void) { unsigned i, count = 0; for (i = 0; i < worker_idx; i++) - count += worker_stats[i].handled_packets; + count += __atomic_load_n(&worker_stats[i].handled_packets, + __ATOMIC_RELAXED); return count; } @@ -51,7 +52,10 @@ total_packet_count(void) static inline void clear_packet_count(void) { - memset(&worker_stats, 0, sizeof(worker_stats)); + unsigned int i; + for (i = 0; i < RTE_MAX_LCORE; i++) + __atomic_store_n(&worker_stats[i].handled_packets, 0, + __ATOMIC_RELAXED); } /* this is the basic worker function for sanity test @@ -129,7 +133,8 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p) for (i = 0; i < rte_lcore_count() - 1; i++) printf("Worker %u handled %u packets\n", i, - worker_stats[i].handled_packets); + __atomic_load_n(&worker_stats[i].handled_packets, + __ATOMIC_RELAXED)); printf("Sanity test with all zero hashes done.\n"); /* pick two flows and check they go correctly */ @@ -154,7 +159,9 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p) for (i = 0; i < rte_lcore_count() - 1; i++) printf("Worker %u handled %u packets\n", i, - worker_stats[i].handled_packets); + __atomic_load_n( + &worker_stats[i].handled_packets, + __ATOMIC_RELAXED)); printf("Sanity test with two hash values done\n"); } @@ -180,7 +187,8 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p) for (i = 0; i < rte_lcore_count() - 1; i++) printf("Worker %u handled %u packets\n", i, - worker_stats[i].handled_packets); + __atomic_load_n(&worker_stats[i].handled_packets, + __ATOMIC_RELAXED)); printf("Sanity test with non-zero hashes done\n"); rte_mempool_put_bulk(p, (void *)bufs, BURST); @@ -272,12 +280,14 @@ handle_work_with_free_mbufs(void *arg) num = rte_distributor_get_pkt(d, id, buf, NULL, 0); while (!quit) { - worker_stats[id].handled_packets += num; + __atomic_fetch_add(&worker_stats[id].handled_packets, num, + __ATOMIC_RELAXED); for (i = 0; i < num; i++) rte_pktmbuf_free(buf[i]); num = rte_distributor_get_pkt(d, id, buf, NULL, 0); } - worker_stats[id].handled_packets += num; + __atomic_fetch_add(&worker_stats[id].handled_packets, num, + __ATOMIC_RELAXED); rte_distributor_return_pkt(d, id, buf, num); return 0; } @@ -347,7 +357,8 @@ handle_work_for_shutdown_test(void *arg) /* wait for quit single globally, or for worker zero, wait * for zero_quit */ while (!quit && !(id == zero_id && zero_quit)) { - worker_stats[id].handled_packets += num; + __atomic_fetch_add(&worker_stats[id].handled_packets, num, + __ATOMIC_RELAXED); num = rte_distributor_get_pkt(d, id, buf, NULL, 0); if (num > 0) { @@ -357,8 +368,9 @@ handle_work_for_shutdown_test(void *arg) } zero_id = __atomic_load_n(&zero_idx, __ATOMIC_ACQUIRE); } - worker_stats[id].handled_packets += num; + __atomic_fetch_add(&worker_stats[id].handled_packets, num, + __ATOMIC_RELAXED); if (id == zero_id) { rte_distributor_return_pkt(d, id, NULL, 0); @@ -371,7 +383,8 @@ handle_work_for_shutdown_test(void *arg) num = rte_distributor_get_pkt(d, id, buf, NULL, 0); while (!quit) { - worker_stats[id].handled_packets += num; + __atomic_fetch_add(&worker_stats[id].handled_packets, + num, __ATOMIC_RELAXED); num = rte_distributor_get_pkt(d, id, buf, NULL, 0); } } @@ -437,7 +450,8 @@ sanity_test_with_worker_shutdown(struct worker_params *wp, for (i = 0; i < rte_lcore_count() - 1; i++) printf("Worker %u handled %u packets\n", i, - worker_stats[i].handled_packets); + __atomic_load_n(&worker_stats[i].handled_packets, + __ATOMIC_RELAXED)); if (total_packet_count() != BURST * 2) { printf("Line %d: Error, not all packets flushed. " @@ -497,7 +511,8 @@ test_flush_with_worker_shutdown(struct worker_params *wp, zero_quit = 0; for (i = 0; i < rte_lcore_count() - 1; i++) printf("Worker %u handled %u packets\n", i, - worker_stats[i].handled_packets); + __atomic_load_n(&worker_stats[i].handled_packets, + __ATOMIC_RELAXED)); if (total_packet_count() != BURST) { printf("Line %d: Error, not all packets flushed. " From patchwork Sat Oct 17 03:06:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Wojciechowski X-Patchwork-Id: 81168 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2FCBFA04DB; Sat, 17 Oct 2020 05:08:58 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3ACBAE2B1; Sat, 17 Oct 2020 05:07:43 +0200 (CEST) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 698BDE2A0 for ; Sat, 17 Oct 2020 05:07:31 +0200 (CEST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20201017030720euoutp0255dab284f113f8e02279fd1bb5213288~_qLtoMZ0U2306523065euoutp02V for ; Sat, 17 Oct 2020 03:07:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20201017030720euoutp0255dab284f113f8e02279fd1bb5213288~_qLtoMZ0U2306523065euoutp02V DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1602904040; bh=pLPHVpOWYNnED/LxEp7Q/jmg1Yu1zrs08910bMndYwk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mN9+j/F68+AIXYlTmiE0vGPPFI6Mj16bmeTLHfMcckSHHHnYFAPaw4E3hXszhi8D1 KkETmzNzqcHDtluTiuyjYT13wNuhQohnwHeyfJnLKhrHxJ8+HCqnRtC92ep02NMX2j ZHMndX7APlRFZQvwdyDnB36vq7uYsTZUXqe2OE6g= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20201017030718eucas1p123a567773460cb9b096cf12a5c044e9c~_qLsSUjdY0897308973eucas1p1q; Sat, 17 Oct 2020 03:07:18 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 68.E8.06456.6EF5A8F5; Sat, 17 Oct 2020 04:07:18 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20201017030717eucas1p1ae327494575f851af4bdf77f3e8c83ae~_qLrFn0Z30896808968eucas1p1s; Sat, 17 Oct 2020 03:07:17 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20201017030717eusmtrp13b0fa52643ce6311aa1ee54d7ef2cb4e~_qLrFHh5M3018830188eusmtrp1X; Sat, 17 Oct 2020 03:07:17 +0000 (GMT) X-AuditID: cbfec7f2-809ff70000001938-33-5f8a5fe6ec3d Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 2E.DE.06017.5EF5A8F5; Sat, 17 Oct 2020 04:07:17 +0100 (BST) Received: from localhost.localdomain (unknown [106.210.88.70]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201017030716eusmtip183da5deec2fee89bc17522d8bffbffa1~_qLqNdIkn3124931249eusmtip18; Sat, 17 Oct 2020 03:07:16 +0000 (GMT) From: Lukasz Wojciechowski To: David Hunt , Bruce Richardson Cc: dev@dpdk.org, l.wojciechow@partner.samsung.com, stable@dpdk.org Date: Sat, 17 Oct 2020 05:06:53 +0200 Message-Id: <20201017030701.16134-10-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201017030701.16134-1-l.wojciechow@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrOIsWRmVeSWpSXmKPExsWy7djPc7rP4rviDZ4s17W4screom/SRyaL d5+2M1k861nHaPGv4w+7A6vHrwVLWT0W73nJ5HHw3R6mAOYoLpuU1JzMstQifbsErow15ycw FjznqTh06S1TA+NLri5GTg4JAROJScf6mbsYuTiEBFYwSpxY8oUNwvnCKHF49QR2COczo8Tc JSfYYFpaf8G0LGeUWHR5KStc1fd7bSwgVWwCthJHZn5lBbFFBMIkmpv3AsU5OJgFnCWefAUb JCzgIPHi4wKwchYBVYmWBw3sIDavgJvEqr5b7BDL5CVWbzjADNLKCRRvPO4KskpC4DqbxNq2 34wQNS4SHz+vhrKFJV4d3wLVKyNxenIPC0TDNkaJq79/MkI4+xklrveugKqyljj87zcbxHGa Eut36UOEHSXebNsMdrOEAJ/EjbeCIGFmIHPStunMEGFeiY42IYhqPYmnPVMZYdb+WfuEBcL2 kNi4bQMLJHiuMkp0zl/JOoFRfhbCsgWMjKsYxVNLi3PTU4sN81LL9YoTc4tL89L1kvNzNzEC o//0v+OfdjB+vZR0iFGAg1GJh5djaWe8EGtiWXFl7iFGCQ5mJRFep7On44R4UxIrq1KL8uOL SnNSiw8xSnOwKInzGi96GSskkJ5YkpqdmlqQWgSTZeLglGpg1D6xqll9PzNzl+uLU26hGxSl uv7Pn9M+5/BXp09FIqJFZdzHNgkkLDR+MmkOwybxv1PVGTuLVugFmMZY/0lb8lIk/Hg7i4i2 5aLKJbePn3/2WzSeZ5lmz78A5/V5Cf5W5x+56M5O/rd0rrfBRY/YIwIeGgG9O6TSn+65y+p9 erLe/uazJh7sSizFGYmGWsxFxYkAW88w4/oCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrOLMWRmVeSWpSXmKPExsVy+t/xu7pP47viDR69lbS4screom/SRyaL d5+2M1k861nHaPGv4w+7A6vHrwVLWT0W73nJ5HHw3R6mAOYoPZui/NKSVIWM/OISW6VoQwsj PUNLCz0jE0s9Q2PzWCsjUyV9O5uU1JzMstQifbsEvYw15ycwFjznqTh06S1TA+NLri5GTg4J AROJ1l/9zF2MXBxCAksZJRbO+cjSxcgBlJCR+HBJAKJGWOLPtS42iJqPjBL9V/azgiTYBGwl jsz8ygpSLyIQJnFipT9ImFnAXWLL4qnMILawgIPEi48LWEBsFgFViZYHDewgNq+Am8Sqvlvs EPPlJVZvOMAMMoYTKN543BViVSOjxNlZ61gmMPItYGRYxSiSWlqcm55bbKRXnJhbXJqXrpec n7uJERiI24793LKDsetd8CFGAQ5GJR7eDYs644VYE8uKK3MPMUpwMCuJ8DqdPR0nxJuSWFmV WpQfX1Sak1p8iNEU6KiJzFKiyfnAKMkriTc0NTS3sDQ0NzY3NrNQEuftEDgYIySQnliSmp2a WpBaBNPHxMEp1cBYlNa1bqGUndeyiTdff10Tlcp/YULuRb3twtYKG5ad2G4h3V5fLqP7yDtw w8uY55I507iWT1Zd061X9mJ95OzIGoH700Xvbpvxuf6i5y/JObkqOhvyWs+07I12m24VNnmp 4opr/z9pmZ5s82m8Y7E+13beW7n1NzPDEpfHzg7TUqo9LXzH/WqcEktxRqKhFnNRcSIAAG0y jloCAAA= X-CMS-MailID: 20201017030717eucas1p1ae327494575f851af4bdf77f3e8c83ae X-Msg-Generator: CA X-RootMTR: 20201017030717eucas1p1ae327494575f851af4bdf77f3e8c83ae X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201017030717eucas1p1ae327494575f851af4bdf77f3e8c83ae References: <20201010160508.19709-1-l.wojciechow@partner.samsung.com> <20201017030701.16134-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-dev] [PATCH v8 09/17] test/distributor: collect return mbufs 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" During quit_workers function distributor's main core processes some packets to wake up pending worker cores so they can quit. As quit_workers acts also as a cleanup procedure for next test case it should also collect these packets returned by workers' handlers, so the cyclic buffer with returned packets in distributor remains empty. Fixes: c3eabff124e6 ("distributor: add unit tests") Cc: bruce.richardson@intel.com Fixes: c0de0eb82e40 ("distributor: switch over to new API") Cc: david.hunt@intel.com Cc: stable@dpdk.org Signed-off-by: Lukasz Wojciechowski Acked-by: David Hunt --- app/test/test_distributor.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c index 4343efed1..3f0aeb7b9 100644 --- a/app/test/test_distributor.c +++ b/app/test/test_distributor.c @@ -591,6 +591,7 @@ quit_workers(struct worker_params *wp, struct rte_mempool *p) const unsigned num_workers = rte_lcore_count() - 1; unsigned i; struct rte_mbuf *bufs[RTE_MAX_LCORE]; + struct rte_mbuf *returns[RTE_MAX_LCORE]; if (rte_mempool_get_bulk(p, (void *)bufs, num_workers) != 0) { printf("line %d: Error getting mbufs from pool\n", __LINE__); return; @@ -606,6 +607,10 @@ quit_workers(struct worker_params *wp, struct rte_mempool *p) rte_distributor_flush(d); rte_eal_mp_wait_lcore(); + while (rte_distributor_returned_pkts(d, returns, RTE_MAX_LCORE)) + ; + + rte_distributor_clear_returns(d); rte_mempool_put_bulk(p, (void *)bufs, num_workers); quit = 0; From patchwork Sat Oct 17 03:06:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Wojciechowski X-Patchwork-Id: 81173 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C66D0A04DB; Sat, 17 Oct 2020 05:11:02 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5308CE2E8; Sat, 17 Oct 2020 05:08:09 +0200 (CEST) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id 9C174E2A9 for ; Sat, 17 Oct 2020 05:07:39 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20201017030722euoutp01b18b697bbb8656be7145c7956f0d4f0d~_qLvhNaDF1627716277euoutp01X for ; Sat, 17 Oct 2020 03:07:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20201017030722euoutp01b18b697bbb8656be7145c7956f0d4f0d~_qLvhNaDF1627716277euoutp01X DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1602904042; bh=fynvMAAU6OLk1/+zR+LOvZdNO64pUieNLjkvDKcsip8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nPhfBget/MI+k+k7sSQvtPyxcGo2txQiYjG2Saoirht+0UHXZUbdB9DixHiTXgl4J sPiPZ4TOdRsgmUsRnIk3Mq/iYbT1lXOD9+/pTXaK5aGPwjjPh1XqHfNfxx5oEyXaJG zDjPzq1Q2q18pZeIWEX7JcyZapWCwglWkbGV9odQ= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20201017030719eucas1p2bab72f14313b7dcd3f72c5ed93981a21~_qLtP0J2V2441224412eucas1p2-; Sat, 17 Oct 2020 03:07:19 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 93.42.05997.7EF5A8F5; Sat, 17 Oct 2020 04:07:19 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20201017030718eucas1p256e1f934af12af2a6b07640c9de7a766~_qLsHGb361942819428eucas1p2x; Sat, 17 Oct 2020 03:07:18 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20201017030718eusmtrp24668aa7eeb9aa84b6ee2e43bc351f107~_qLsGl_rK2572125721eusmtrp2j; Sat, 17 Oct 2020 03:07:18 +0000 (GMT) X-AuditID: cbfec7f4-677ff7000000176d-c3-5f8a5fe78366 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 8B.99.06314.6EF5A8F5; Sat, 17 Oct 2020 04:07:18 +0100 (BST) Received: from localhost.localdomain (unknown [106.210.88.70]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201017030717eusmtip122abc76b9830dfab5f100f4375c7bf66~_qLrOMbnC0424404244eusmtip1P; Sat, 17 Oct 2020 03:07:17 +0000 (GMT) From: Lukasz Wojciechowski To: David Hunt , Bruce Richardson Cc: dev@dpdk.org, l.wojciechow@partner.samsung.com, stable@dpdk.org Date: Sat, 17 Oct 2020 05:06:54 +0200 Message-Id: <20201017030701.16134-11-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201017030701.16134-1-l.wojciechow@partner.samsung.com> X-Brightmail-Tracker: H4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QifbsEvYxbl0oKPkhVXHzWxNzAeE+0i5GTQ0LA ROLG9qvMXYxcHEICSxklLnztBXI4gBIyEh8uCUDUCEv8udbFBlHzkVFiass6JpAEm4CtxJGZ X1lB6kUEwiROrPQHCTMLuEtsWTyVGcQWFvCQ6N3SxQpiswioSlw7dJsdxOYVcJM4uno1C8R8 eYnVGw6AreUEijced4VY1cgocXbWOpYJjHwLGBlWMYqklhbnpucWG+oVJ+YWl+al6yXn525i BIbhtmM/N+9gvLQx+BCjAAejEg/vhkWd8UKsiWXFlbmHGCU4mJVEeJ3Ono4T4k1JrKxKLcqP LyrNSS0+xGgKdNREZinR5HxgjOSVxBuaGppbWBqaG5sbm1koifN2CByMERJITyxJzU5NLUgt gulj4uCUamCcWh99ZsmtOr9+lWWspTpN7K+CtJ+Url3KkLWOYfW9aWv+RJrH7tspGLRmuweL f9kVH9u8v0VHlu9cnKV3RCtKe1PAFIG129l8XTO+5c5l/jcj+dmmditmqWsh0hKNFj43LRw1 YxmW3u2IfP39y06DkpM75wgLlpTqqPSc/Kgtx7xJUWLhumlKLMUZiYZazEXFiQAtfrCgWQIA AA== X-CMS-MailID: 20201017030718eucas1p256e1f934af12af2a6b07640c9de7a766 X-Msg-Generator: CA X-RootMTR: 20201017030718eucas1p256e1f934af12af2a6b07640c9de7a766 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201017030718eucas1p256e1f934af12af2a6b07640c9de7a766 References: <20201010160508.19709-1-l.wojciechow@partner.samsung.com> <20201017030701.16134-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-dev] [PATCH v8 10/17] distributor: align API documentation with code 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" After introducing burst API there were some artefacts in the API documentation from legacy single API. Also the rte_distributor_poll_pkt() function return values mismatched the implementation. Fixes: c0de0eb82e40 ("distributor: switch over to new API") Cc: david.hunt@intel.com Cc: stable@dpdk.org Signed-off-by: Lukasz Wojciechowski Acked-by: David Hunt --- lib/librte_distributor/rte_distributor.h | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/librte_distributor/rte_distributor.h b/lib/librte_distributor/rte_distributor.h index 327c0c4ab..a073e6461 100644 --- a/lib/librte_distributor/rte_distributor.h +++ b/lib/librte_distributor/rte_distributor.h @@ -155,7 +155,7 @@ rte_distributor_clear_returns(struct rte_distributor *d); * @param pkts * The mbufs pointer array to be filled in (up to 8 packets) * @param oldpkt - * The previous packet, if any, being processed by the worker + * The previous packets, if any, being processed by the worker * @param retcount * The number of packets being returned * @@ -187,15 +187,15 @@ rte_distributor_return_pkt(struct rte_distributor *d, /** * API called by a worker to request a new packet to process. - * Any previous packet given to the worker is assumed to have completed + * Any previous packets given to the worker are assumed to have completed * processing, and may be optionally returned to the distributor via * the oldpkt parameter. - * Unlike rte_distributor_get_pkt_burst(), this function does not wait for a - * new packet to be provided by the distributor. + * Unlike rte_distributor_get_pkt(), this function does not wait for + * new packets to be provided by the distributor. * - * NOTE: after calling this function, rte_distributor_poll_pkt_burst() should - * be used to poll for the packet requested. The rte_distributor_get_pkt_burst() - * API should *not* be used to try and retrieve the new packet. + * NOTE: after calling this function, rte_distributor_poll_pkt() should + * be used to poll for the packets requested. The rte_distributor_get_pkt() + * API should *not* be used to try and retrieve the new packets. * * @param d * The distributor instance to be used @@ -213,9 +213,9 @@ rte_distributor_request_pkt(struct rte_distributor *d, unsigned int count); /** - * API called by a worker to check for a new packet that was previously + * API called by a worker to check for new packets that were previously * requested by a call to rte_distributor_request_pkt(). It does not wait - * for the new packet to be available, but returns NULL if the request has + * for the new packets to be available, but returns if the request has * not yet been fulfilled by the distributor. * * @param d @@ -227,8 +227,9 @@ rte_distributor_request_pkt(struct rte_distributor *d, * The array of mbufs being given to the worker * * @return - * The number of packets being given to the worker thread, zero if no - * packet is yet available. + * The number of packets being given to the worker thread, + * -1 if no packets are yet available (burst API - RTE_DIST_ALG_BURST) + * 0 if no packets are yet available (legacy single API - RTE_DIST_ALG_SINGLE) */ int rte_distributor_poll_pkt(struct rte_distributor *d, From patchwork Sat Oct 17 03:06:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Wojciechowski X-Patchwork-Id: 81179 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 82498A04DB; Sat, 17 Oct 2020 05:13:13 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 50CF7E31A; Sat, 17 Oct 2020 05:08:20 +0200 (CEST) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id 0C27BE2BF for ; Sat, 17 Oct 2020 05:07:50 +0200 (CEST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20201017030725euoutp01d3188d1a9548ff1dfe92c29891df6335~_qLyYWrlQ1627716277euoutp01a for ; Sat, 17 Oct 2020 03:07:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20201017030725euoutp01d3188d1a9548ff1dfe92c29891df6335~_qLyYWrlQ1627716277euoutp01a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1602904045; bh=SnmTiKBzRRhvImy7KbnOAiG2ut6PE3sR/5t4LwQPtoQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dldQpTSMjpTeN3JY9g/RjcxCF+aiW5dTzaqN5nZFAdiAU9P8DHUJU7yTwbG4geYW6 hj86OMCF8QOQMEPy+tPBZv3InHTVDh5UrheTQ/LzRRzK/Af1p6wi3NtWMy7lee9cU5 WnbDo470wD3lpttlq+3DeKdxpHPXbKMyHQxHmpOs= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20201017030719eucas1p29bd08f65f4d2f64aeb45ab3b685d2fa2~_qLtNNOyt1521315213eucas1p2b; Sat, 17 Oct 2020 03:07:19 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id A8.D5.06318.7EF5A8F5; Sat, 17 Oct 2020 04:07:19 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20201017030719eucas1p13b13db1fbc3715e19e81bb4be4635b7d~_qLsw1G1E0898308983eucas1p16; Sat, 17 Oct 2020 03:07:19 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20201017030719eusmtrp202ba367df1d7414345c7667d57ff6131~_qLswV3z12813028130eusmtrp2N; Sat, 17 Oct 2020 03:07:19 +0000 (GMT) X-AuditID: cbfec7f5-371ff700000018ae-99-5f8a5fe7cdcf Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id EB.99.06314.7EF5A8F5; Sat, 17 Oct 2020 04:07:19 +0100 (BST) Received: from localhost.localdomain (unknown [106.210.88.70]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201017030718eusmtip1293067d2e6872bd2e02a58515ca5ad7c~_qLsNvPzQ3124931249eusmtip19; Sat, 17 Oct 2020 03:07:18 +0000 (GMT) From: Lukasz Wojciechowski To: David Hunt , Bruce Richardson Cc: dev@dpdk.org, l.wojciechow@partner.samsung.com, stable@dpdk.org Date: Sat, 17 Oct 2020 05:06:55 +0200 Message-Id: <20201017030701.16134-12-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201017030701.16134-1-l.wojciechow@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrOIsWRmVeSWpSXmKPExsWy7djP87rP47viDWbe1rW4screom/SRyaL d5+2M1k861nHaPGv4w+7A6vHrwVLWT0W73nJ5HHw3R6mAOYoLpuU1JzMstQifbsErozvOxYz FXSJVkyf+4u9gXGNYBcjJ4eEgInExy+PWbsYuTiEBFYwSszo2MAC4XxhlDgx+wA7hPOZUWLB ndmMMC1r2vuZIBLLGSVurzvBCFc1c+lMFpAqNgFbiSMzv7KC2CICYRLNzXuB4hwczALOEk++ soGEhQW8JFY9mAg2lEVAVWLZhQNgcV4BN4mbJ6czQSyTl1i94QAzSCsnULzxuCvIKgmB62wS 7/f2sUPUuEi8e7SVDcIWlnh1fAtUXEbi/875TBAN2xglrv7+yQjh7GeUuN67AqrKWuLwv99s EMdpSqzfpQ8RdpQ4f20tK0hYQoBP4sZbcHgxA5mTtk1nhgjzSnS0CUFU60k87ZnKCLP2z9on LBC2h8TCCQegIXqVUWLW3adsExjlZyEsW8DIuIpRPLW0ODc9tdg4L7Vcrzgxt7g0L10vOT93 EyMw+k//O/51B+O+P0mHGAU4GJV4eDmWdsYLsSaWFVfmHmKU4GBWEuF1Ons6Tog3JbGyKrUo P76oNCe1+BCjNAeLkjiv8aKXsUIC6YklqdmpqQWpRTBZJg5OqQbGa9OvT5EUXldp8MXvN6/N C4kL65duF/mu9fT7OyGrqtyOB0pr/1R+VSmNlN8QbCH96Ff+d/6L2ytsLI5VP/20ZM6FQ5su vwxjmf6+9aeK/gbrlcekC64VeL2b6hS/7nLI876PT9d3en0yyNwm8H8Gx6EXLeZpC5IUCyLE T6eEaX+cprzu3LaEKiWW4oxEQy3mouJEAO+JwUP6AgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrOLMWRmVeSWpSXmKPExsVy+t/xu7rP47viDZ4+E7C4screom/SRyaL d5+2M1k861nHaPGv4w+7A6vHrwVLWT0W73nJ5HHw3R6mAOYoPZui/NKSVIWM/OISW6VoQwsj PUNLCz0jE0s9Q2PzWCsjUyV9O5uU1JzMstQifbsEvYzvOxYzFXSJVkyf+4u9gXGNYBcjJ4eE gInEmvZ+pi5GLg4hgaWMEu+vPGXpYuQASshIfLgkAFEjLPHnWhcbRM1HRollB26wgiTYBGwl jsz8ygpSLyIQJnFipT9ImFnAXWLL4qnMILawgJfEqgcTGUFsFgFViWUXDrCB2LwCbhI3T05n gpgvL7F6wwFmkDGcQPHG464QqxoZJc7OWscygZFvASPDKkaR1NLi3PTcYkO94sTc4tK8dL3k /NxNjMBA3Hbs5+YdjJc2Bh9iFOBgVOLh3bCoM16INbGsuDL3EKMEB7OSCK/T2dNxQrwpiZVV qUX58UWlOanFhxhNgY6ayCwlmpwPjJK8knhDU0NzC0tDc2NzYzMLJXHeDoGDMUIC6Yklqdmp qQWpRTB9TBycUg2MOpPnxRe5ftymbWdzKMQ1JHbNly0mF+etdbjeXhgZaOR/iG2LG8NT0Vk3 XGwW7JnBEBxtUKKrLf8qWKvutdTyDQv9W82Eq/T3V86JZtwz42du/Jlv0dYNHVMav5xlsFZe ERfzQP5mD+85jWRvr5bQBZfNFj9SMF67Y/ZW3WzxaVMuTjnN4BilxFKckWioxVxUnAgAff+c lVoCAAA= X-CMS-MailID: 20201017030719eucas1p13b13db1fbc3715e19e81bb4be4635b7d X-Msg-Generator: CA X-RootMTR: 20201017030719eucas1p13b13db1fbc3715e19e81bb4be4635b7d X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201017030719eucas1p13b13db1fbc3715e19e81bb4be4635b7d References: <20201010160508.19709-1-l.wojciechow@partner.samsung.com> <20201017030701.16134-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-dev] [PATCH v8 11/17] test/distributor: replace delays with spin locks 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Instead of making delays in test code and waiting for worker hopefully to reach proper states, synchronize worker shutdown test cases with spin lock on atomic variable. Fixes: c0de0eb82e40 ("distributor: switch over to new API") Cc: david.hunt@intel.com Cc: stable@dpdk.org Signed-off-by: Lukasz Wojciechowski Acked-by: David Hunt --- app/test/test_distributor.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c index 3f0aeb7b9..fdb6ea9ce 100644 --- a/app/test/test_distributor.c +++ b/app/test/test_distributor.c @@ -27,6 +27,7 @@ struct worker_params worker_params; /* statics - all zero-initialized by default */ static volatile int quit; /**< general quit variable for all threads */ static volatile int zero_quit; /**< var for when we just want thr0 to quit*/ +static volatile int zero_sleep; /**< thr0 has quit basic loop and is sleeping*/ static volatile unsigned worker_idx; static volatile unsigned zero_idx; @@ -377,8 +378,10 @@ handle_work_for_shutdown_test(void *arg) /* for worker zero, allow it to restart to pick up last packet * when all workers are shutting down. */ + __atomic_store_n(&zero_sleep, 1, __ATOMIC_RELEASE); while (zero_quit) usleep(100); + __atomic_store_n(&zero_sleep, 0, __ATOMIC_RELEASE); num = rte_distributor_get_pkt(d, id, buf, NULL, 0); @@ -446,7 +449,12 @@ sanity_test_with_worker_shutdown(struct worker_params *wp, /* flush the distributor */ rte_distributor_flush(d); - rte_delay_us(10000); + while (!__atomic_load_n(&zero_sleep, __ATOMIC_ACQUIRE)) + rte_distributor_flush(d); + + zero_quit = 0; + while (__atomic_load_n(&zero_sleep, __ATOMIC_ACQUIRE)) + rte_delay_us(100); for (i = 0; i < rte_lcore_count() - 1; i++) printf("Worker %u handled %u packets\n", i, @@ -506,9 +514,14 @@ test_flush_with_worker_shutdown(struct worker_params *wp, /* flush the distributor */ rte_distributor_flush(d); - rte_delay_us(10000); + while (!__atomic_load_n(&zero_sleep, __ATOMIC_ACQUIRE)) + rte_distributor_flush(d); zero_quit = 0; + + while (__atomic_load_n(&zero_sleep, __ATOMIC_ACQUIRE)) + rte_delay_us(100); + for (i = 0; i < rte_lcore_count() - 1; i++) printf("Worker %u handled %u packets\n", i, __atomic_load_n(&worker_stats[i].handled_packets, @@ -616,6 +629,8 @@ quit_workers(struct worker_params *wp, struct rte_mempool *p) quit = 0; worker_idx = 0; zero_idx = RTE_MAX_LCORE; + zero_quit = 0; + zero_sleep = 0; } static int From patchwork Sat Oct 17 03:06:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Wojciechowski X-Patchwork-Id: 81169 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 55817A04DB; Sat, 17 Oct 2020 05:09:27 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 72857E2C1; Sat, 17 Oct 2020 05:07:53 +0200 (CEST) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id E8390E2A8 for ; Sat, 17 Oct 2020 05:07:37 +0200 (CEST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20201017030721euoutp01032d9204e1c7378d89aefd778095940c~_qLuixTwt1627116271euoutp01V for ; Sat, 17 Oct 2020 03:07:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20201017030721euoutp01032d9204e1c7378d89aefd778095940c~_qLuixTwt1627116271euoutp01V DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1602904041; bh=YE4tYljEdyMzg3x+iIxB10eZz8QBylsGt0BW+IXy3Ow=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hrxxmCUF2QwEo2fLxwFbBQsRBRY7lOvZ3tqE+nOHXm/ZbELQi4BXhAZD+SuwePg9O hHwDnP7BtIxZQekwEh6tMkZq/PKu/2lCbFBH1feammt1TKSDYzQV8rwcYIhjjq0HcB gjohZmxMHBuopcrgZqL+c8KmTvx8NNyoTPLF66zs= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20201017030721eucas1p1a4daeb6ff5874d73ffe4ab6a47ccd5c1~_qLuVhPb50897308973eucas1p1s; Sat, 17 Oct 2020 03:07:21 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id C8.E8.06456.8EF5A8F5; Sat, 17 Oct 2020 04:07:20 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20201017030720eucas1p1fe683996638c3692cae530e67271b79b~_qLtaqWih0652806528eucas1p1y; Sat, 17 Oct 2020 03:07:20 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20201017030720eusmtrp152d1851ded1b2f5e8aaf17f69d5a8e99~_qLtaJ2js3018830188eusmtrp1Y; Sat, 17 Oct 2020 03:07:20 +0000 (GMT) X-AuditID: cbfec7f2-7efff70000001938-36-5f8a5fe881e0 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 8E.DE.06017.7EF5A8F5; Sat, 17 Oct 2020 04:07:19 +0100 (BST) Received: from localhost.localdomain (unknown [106.210.88.70]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201017030719eusmtip148674cbd7153fa5adda1987d876c7b46~_qLs3fpzv3071330713eusmtip1H; Sat, 17 Oct 2020 03:07:19 +0000 (GMT) From: Lukasz Wojciechowski To: David Hunt , Bruce Richardson Cc: dev@dpdk.org, l.wojciechow@partner.samsung.com, stable@dpdk.org Date: Sat, 17 Oct 2020 05:06:56 +0200 Message-Id: <20201017030701.16134-13-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201017030701.16134-1-l.wojciechow@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrGIsWRmVeSWpSXmKPExsWy7djP87ov4rviDS4strK4screom/SRyaL d5+2M1k861nHaPGv4w+7A6vHrwVLWT0W73nJ5HHw3R6mAOYoLpuU1JzMstQifbsErowdf66w FKzgqjh06TR7A+Mqji5GTg4JAROJo00nWbsYuTiEBFYwSkx80AvlfGGU+L7+DxOE85lRonnv PvYuRg6wlrvLMyDiyxklXjf1IhT9bp7LBDKXTcBW4sjMr6wgtohAmERz814WkGZmAWeJJ1/Z QMLCAlYSm2d/BythEVCVmHjyBguIzSvgJrH74TEmiPPkJVZvOMAM0soJFG887gqySkLgMpvE gXezoWpcJNb8ecACYQtLvDq+hR3ClpE4PbmHBaJhG6PE1d8/GSGc/YwS13tXQFVZSxz+95sN 4jhNifW79CHCjhIPppyCephP4sZbQZAwM5A5adt0Zogwr0RHmxBEtZ7E056pjDBr/6x9AnWO h8TMV0eZIcFzlVHi1+tfTBMY5WchLFvAyLiKUTy1tDg3PbXYMC+1XK84Mbe4NC9dLzk/dxMj MPZP/zv+aQfj10tJhxgFOBiVeHg5lnbGC7EmlhVX5h5ilOBgVhLhdTp7Ok6INyWxsiq1KD++ qDQntfgQozQHi5I4r/Gil7FCAumJJanZqakFqUUwWSYOTqkGxoINx8V2uc7r2+1ftuyW/MGb jy5yp4bZS683eWeVELlPbIXi016FVl3f8PrjPVs8vuWYHjDcscNLbq3msfUvI41UGbVN3yo+ d/96YKOAJq/37FOvUls+LJCOMLqQ1Zv065dk8Mngghc9iYq/Enrn1CofOiKw4/p9o1kHZhSq ziib1q9dHl60T4mlOCPRUIu5qDgRAJY006z5AgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrKLMWRmVeSWpSXmKPExsVy+t/xu7ov4rviDWZJWNxYZW/RN+kjk8W7 T9uZLJ71rGO0+Nfxh92B1ePXgqWsHov3vGTyOPhuD1MAc5SeTVF+aUmqQkZ+cYmtUrShhZGe oaWFnpGJpZ6hsXmslZGpkr6dTUpqTmZZapG+XYJexo4/V1gKVnBVHLp0mr2BcRVHFyMHh4SA icTd5RldjFwcQgJLGSW+f3/ODBGXkfhwSaCLkRPIFJb4c62LDaLmI6PEztY9TCAJNgFbiSMz v7KC1IsIhEmcWOkPEmYWcJfYsngqM4gtLGAlsXn2d1YQm0VAVWLiyRssIDavgJvE7ofHmCDm y0us3nAAbC0nULzxuCvEqkZGibOz1rFMYORbwMiwilEktbQ4Nz232EivODG3uDQvXS85P3cT IzAItx37uWUHY9e74EOMAhyMSjy8GxZ1xguxJpYVV+YeYpTgYFYS4XU6ezpOiDclsbIqtSg/ vqg0J7X4EKMp0FETmaVEk/OBEZJXEm9oamhuYWlobmxubGahJM7bIXAwRkggPbEkNTs1tSC1 CKaPiYNTqoFR2HSV1/XoxTZ/rAxrNjp21t2N3B99II/z0/6ztbJf7Kdrz2iO2OP666jGbfbo vVqPir6b6r56JiBe7L81Z6/ChJAUt4U+jyYdWn+uRIun5r6xO0/11rw6zuoXES9UA5nCyoUY NnE9Vwk0i9JO23/G/49XbevhZTdbroS0lM9I1Y+UYw4xnqfEUpyRaKjFXFScCADqeJ1uWAIA AA== X-CMS-MailID: 20201017030720eucas1p1fe683996638c3692cae530e67271b79b X-Msg-Generator: CA X-RootMTR: 20201017030720eucas1p1fe683996638c3692cae530e67271b79b X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201017030720eucas1p1fe683996638c3692cae530e67271b79b References: <20201010160508.19709-1-l.wojciechow@partner.samsung.com> <20201017030701.16134-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-dev] [PATCH v8 12/17] distributor: fix scalar matching 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Fix improper indexes while comparing tags. In the find_match_scalar() function: * j iterates over flow tags of following packets; * w iterates over backlog or in flight tags positions. Fixes: 775003ad2f96 ("distributor: add new burst-capable library") Cc: david.hunt@intel.com Cc: stable@dpdk.org Signed-off-by: Lukasz Wojciechowski Acked-by: David Hunt --- lib/librte_distributor/rte_distributor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/librte_distributor/rte_distributor.c b/lib/librte_distributor/rte_distributor.c index 6e3eae58f..9fea3f69a 100644 --- a/lib/librte_distributor/rte_distributor.c +++ b/lib/librte_distributor/rte_distributor.c @@ -259,13 +259,13 @@ find_match_scalar(struct rte_distributor *d, for (j = 0; j < RTE_DIST_BURST_SIZE ; j++) for (w = 0; w < RTE_DIST_BURST_SIZE; w++) - if (d->in_flight_tags[i][j] == data_ptr[w]) { + if (d->in_flight_tags[i][w] == data_ptr[j]) { output_ptr[j] = i+1; break; } for (j = 0; j < RTE_DIST_BURST_SIZE; j++) for (w = 0; w < RTE_DIST_BURST_SIZE; w++) - if (bl->tags[j] == data_ptr[w]) { + if (bl->tags[w] == data_ptr[j]) { output_ptr[j] = i+1; break; } From patchwork Sat Oct 17 03:06:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Wojciechowski X-Patchwork-Id: 81181 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7FEC9A04DB; Sat, 17 Oct 2020 05:13:58 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 06459FC34; Sat, 17 Oct 2020 05:08:24 +0200 (CEST) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id 0CA59E2BF for ; Sat, 17 Oct 2020 05:07:50 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20201017030727euoutp0110bd4fbfdc2b1a9f60c36fe9a191fc1f~_qL0RG3xe1627116271euoutp01b for ; Sat, 17 Oct 2020 03:07:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20201017030727euoutp0110bd4fbfdc2b1a9f60c36fe9a191fc1f~_qL0RG3xe1627116271euoutp01b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1602904047; bh=KYVc1+6CtSGD0DPYSHvyk1Sa6nIsG/kBvkm4YykYcng=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fsRsNI8qYMnSbejE4xij77fUrloqajHkTZMG5Jv7dOEIRMwcDvfD57Fdi3ZUaee9a Ngd3E+5xHPmTL7Kw+oP6xtTgSrqx8qSRF0riZ8dKZCnz0lRnY95fNds9qw/pW7j+Yq CREiYW2960IrXM0ViZ5IUUkfq+8TAe56aq+YeT/o= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20201017030721eucas1p12ead66bc746e018d3e4d19b8b0465edf~_qLugm-oa0898308983eucas1p17; Sat, 17 Oct 2020 03:07:21 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 09.D5.06318.9EF5A8F5; Sat, 17 Oct 2020 04:07:21 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20201017030720eucas1p1359382fafa661abb1ba82fa65e19562c~_qLt_RcA72252822528eucas1p12; Sat, 17 Oct 2020 03:07:20 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20201017030720eusmtrp28fbece19743db7098239e41d575e3f3a~_qLt9zbMy2572125721eusmtrp2k; Sat, 17 Oct 2020 03:07:20 +0000 (GMT) X-AuditID: cbfec7f5-38bff700000018ae-9c-5f8a5fe9f400 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 4C.99.06314.8EF5A8F5; Sat, 17 Oct 2020 04:07:20 +0100 (BST) Received: from localhost.localdomain (unknown [106.210.88.70]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201017030720eusmtip192a41e4b2a463ec92c45998780623990~_qLthzjng0424404244eusmtip1R; Sat, 17 Oct 2020 03:07:20 +0000 (GMT) From: Lukasz Wojciechowski To: David Hunt Cc: dev@dpdk.org, l.wojciechow@partner.samsung.com Date: Sat, 17 Oct 2020 05:06:57 +0200 Message-Id: <20201017030701.16134-14-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201017030701.16134-1-l.wojciechow@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrPIsWRmVeSWpSXmKPExsWy7djPc7ov47viDQ6fZLXom/SRyeLdp+1M Fs961jE6MHv8WrCU1WPxnpdMHgff7WEKYI7isklJzcksSy3St0vgyvi86jpjwWGtitd3JrA2 MG5V7GLk5JAQMJHYtu06WxcjF4eQwApGiYdHDzBBOF8YJW7Nf8kM4XxmlHh8pY0NpuXrx59Q ieWMEgcm9SNUnbn6FKyKTcBW4sjMr6wgtoiAqsS//Z+YQGxmASOJl90TmUFsYQFPiT1HWxhB bBagmiv3/oPFeQXcJLbMPsEIsU1eYvWGA0BxDg5OoHjjcVeQXRICR9gkrjY8YIaocZG4e3wj O4QtLPHq+BYoW0bi/875TBAN2xglrv7+yQj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GhjD lRy8U+eeifmybHbN95vvb5f3cgCj6rFeflqXyCo2aZ5Jjw/n7XA1TL72coGJCtNlTav8wiOr d9u/nb3o+pFvh/lUZ9+YbHDyZUrZzgD5etn9uxT2BZ39/37Wd+nk8ylb8mb+Pth5fnvRqsaN z2xX8Oxfeb1tdey5PzMNXWZkH9j0sF2gbPclJZbijERDLeai4kQAJ0OBJlICAAA= X-CMS-MailID: 20201017030720eucas1p1359382fafa661abb1ba82fa65e19562c X-Msg-Generator: CA X-RootMTR: 20201017030720eucas1p1359382fafa661abb1ba82fa65e19562c X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201017030720eucas1p1359382fafa661abb1ba82fa65e19562c References: <20201010160508.19709-1-l.wojciechow@partner.samsung.com> <20201017030701.16134-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-dev] [PATCH v8 13/17] test/distributor: add test with packets marking 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" All of the former tests analyzed only statistics of packets processed by all workers. The new test verifies also if packets are processed on workers as expected. Every packets processed by the worker is marked and analyzed after it is returned to distributor. This test allows finding issues in matching algorithms. Signed-off-by: Lukasz Wojciechowski Acked-by: David Hunt --- app/test/test_distributor.c | 141 ++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c index fdb6ea9ce..cfae5a1ac 100644 --- a/app/test/test_distributor.c +++ b/app/test/test_distributor.c @@ -543,6 +543,141 @@ test_flush_with_worker_shutdown(struct worker_params *wp, return 0; } +static int +handle_and_mark_work(void *arg) +{ + struct rte_mbuf *buf[8] __rte_cache_aligned; + struct worker_params *wp = arg; + struct rte_distributor *db = wp->dist; + unsigned int num, i; + unsigned int id = __atomic_fetch_add(&worker_idx, 1, __ATOMIC_RELAXED); + num = rte_distributor_get_pkt(db, id, buf, NULL, 0); + while (!quit) { + __atomic_fetch_add(&worker_stats[id].handled_packets, num, + __ATOMIC_RELAXED); + for (i = 0; i < num; i++) + buf[i]->udata64 += id + 1; + num = rte_distributor_get_pkt(db, id, + buf, buf, num); + } + __atomic_fetch_add(&worker_stats[id].handled_packets, num, + __ATOMIC_RELAXED); + rte_distributor_return_pkt(db, id, buf, num); + return 0; +} + +/* sanity_mark_test sends packets to workers which mark them. + * Every packet has also encoded sequence number. + * The returned packets are sorted and verified if they were handled + * by proper workers. + */ +static int +sanity_mark_test(struct worker_params *wp, struct rte_mempool *p) +{ + const unsigned int buf_count = 24; + const unsigned int burst = 8; + const unsigned int shift = 12; + const unsigned int seq_shift = 10; + + struct rte_distributor *db = wp->dist; + struct rte_mbuf *bufs[buf_count]; + struct rte_mbuf *returns[buf_count]; + unsigned int i, count, id; + unsigned int sorted[buf_count], seq; + unsigned int failed = 0; + + printf("=== Marked packets test ===\n"); + clear_packet_count(); + if (rte_mempool_get_bulk(p, (void *)bufs, buf_count) != 0) { + printf("line %d: Error getting mbufs from pool\n", __LINE__); + return -1; + } + + /* bufs' hashes will be like these below, but shifted left. + * The shifting is for avoiding collisions with backlogs + * and in-flight tags left by previous tests. + * [1, 1, 1, 1, 1, 1, 1, 1 + * 1, 1, 1, 1, 2, 2, 2, 2 + * 2, 2, 2, 2, 1, 1, 1, 1] + */ + for (i = 0; i < burst; i++) { + bufs[0 * burst + i]->hash.usr = 1 << shift; + bufs[1 * burst + i]->hash.usr = ((i < burst / 2) ? 1 : 2) + << shift; + bufs[2 * burst + i]->hash.usr = ((i < burst / 2) ? 2 : 1) + << shift; + } + /* Assign a sequence number to each packet. The sequence is shifted, + * so that lower bits of the udate64 will hold mark from worker. + */ + for (i = 0; i < buf_count; i++) + bufs[i]->udata64 = i << seq_shift; + + count = 0; + for (i = 0; i < buf_count/burst; i++) { + rte_distributor_process(db, &bufs[i * burst], burst); + count += rte_distributor_returned_pkts(db, &returns[count], + buf_count - count); + } + + do { + rte_distributor_flush(db); + count += rte_distributor_returned_pkts(db, &returns[count], + buf_count - count); + } while (count < buf_count); + + for (i = 0; i < rte_lcore_count() - 1; i++) + printf("Worker %u handled %u packets\n", i, + __atomic_load_n(&worker_stats[i].handled_packets, + __ATOMIC_RELAXED)); + + /* Sort returned packets by sent order (sequence numbers). */ + for (i = 0; i < buf_count; i++) { + seq = returns[i]->udata64 >> seq_shift; + id = returns[i]->udata64 - (seq << seq_shift); + sorted[seq] = id; + } + + /* Verify that packets [0-11] and [20-23] were processed + * by the same worker + */ + for (i = 1; i < 12; i++) { + if (sorted[i] != sorted[0]) { + printf("Packet number %u processed by worker %u," + " but should be processes by worker %u\n", + i, sorted[i], sorted[0]); + failed = 1; + } + } + for (i = 20; i < 24; i++) { + if (sorted[i] != sorted[0]) { + printf("Packet number %u processed by worker %u," + " but should be processes by worker %u\n", + i, sorted[i], sorted[0]); + failed = 1; + } + } + /* And verify that packets [12-19] were processed + * by the another worker + */ + for (i = 13; i < 20; i++) { + if (sorted[i] != sorted[12]) { + printf("Packet number %u processed by worker %u," + " but should be processes by worker %u\n", + i, sorted[i], sorted[12]); + failed = 1; + } + } + + rte_mempool_put_bulk(p, (void *)bufs, buf_count); + + if (failed) + return -1; + + printf("Marked packets test passed\n"); + return 0; +} + static int test_error_distributor_create_name(void) { @@ -727,6 +862,12 @@ test_distributor(void) goto err; quit_workers(&worker_params, p); + rte_eal_mp_remote_launch(handle_and_mark_work, + &worker_params, SKIP_MASTER); + if (sanity_mark_test(&worker_params, p) < 0) + goto err; + quit_workers(&worker_params, p); + } else { printf("Too few cores to run worker shutdown test\n"); } From patchwork Sat Oct 17 03:06:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Wojciechowski X-Patchwork-Id: 81178 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id DEB4FA04DB; Sat, 17 Oct 2020 05:12:49 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6E490E317; Sat, 17 Oct 2020 05:08:18 +0200 (CEST) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 76FABE2B2 for ; Sat, 17 Oct 2020 05:07:43 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20201017030723euoutp02b74494f28d707eb11ce6644535b71c01~_qLxAoLi12305523055euoutp02a for ; Sat, 17 Oct 2020 03:07:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20201017030723euoutp02b74494f28d707eb11ce6644535b71c01~_qLxAoLi12305523055euoutp02a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1602904043; bh=GwLA6l85hqqm5pEZfxRGoVDxmc62Nhct+avgiy2//Tk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SG77pAeZOpshOlbN/unok/32PcdqugfBTv5hXTFOUwQsUFc3BQklEgELCVIdTZ3g8 4mk0lazMgFzi+clVbhKcJDEebbBPmT3b7wTIYdz3QsAyLtvhMGfkVPbV7oGEi+Pidc OM1zRXWYT0e4OJvJ+VjvCIYxavyAvhbtoZQYhf/E= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20201017030722eucas1p11a5a1c6b033644e891624f1c0d8f5e07~_qLvS72D20652806528eucas1p1z; Sat, 17 Oct 2020 03:07:22 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id F3.42.05997.9EF5A8F5; Sat, 17 Oct 2020 04:07:22 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20201017030721eucas1p2a1032e6c78d99f903ea539e49f057a83~_qLuiMlPr1097310973eucas1p27; Sat, 17 Oct 2020 03:07:21 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20201017030721eusmtrp184605379642a554399b99f27feb6a007~_qLuhrLSo3018830188eusmtrp1Z; Sat, 17 Oct 2020 03:07:21 +0000 (GMT) X-AuditID: cbfec7f4-677ff7000000176d-c7-5f8a5fe9144d Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id EE.DE.06017.9EF5A8F5; Sat, 17 Oct 2020 04:07:21 +0100 (BST) Received: from localhost.localdomain (unknown [106.210.88.70]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201017030720eusmtip1a5605586b90a5f5d0246053259251f6a~_qLuA9QPU3071330713eusmtip1I; Sat, 17 Oct 2020 03:07:20 +0000 (GMT) From: Lukasz Wojciechowski To: David Hunt , Bruce Richardson Cc: dev@dpdk.org, l.wojciechow@partner.samsung.com, stable@dpdk.org Date: Sat, 17 Oct 2020 05:06:58 +0200 Message-Id: <20201017030701.16134-15-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201017030701.16134-1-l.wojciechow@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMIsWRmVeSWpSXmKPExsWy7djPc7qv4rviDe66WdxYZW/RN+kjk8W7 T9uZLJ71rGO0+Nfxh92B1ePXgqWsHov3vGTyOPhuD1MAcxSXTUpqTmZZapG+XQJXxsa+K6wF t4Qq1j16xdzAuJ2/i5GTQ0LARGLj0rVMXYxcHEICKxgldl3azQjhfGGUWDd9F5TzmVFiWkcf K0zLg5OPmUFsIYHljBJ9p/wgbKCi8z+qQ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BYwMqxhFUkuLc9Nzi430ihNzi0vz0vWS83M3 MQLDcNuxn1t2MHa9Cz7EKMDBqMTDu2FRZ7wQa2JZcWXuIUYJDmYlEV6ns6fjhHhTEiurUovy 44tKc1KLDzGaAt00kVlKNDkfGCN5JfGGpobmFpaG5sbmxmYWSuK8HQIHY4QE0hNLUrNTUwtS i2D6mDg4pRoYow6xHpP0PCusIWmkXSJ/hyk5ZPvpyoV/mco/ftZsPLSfn6d9y7QvyyZvE9pl cX9GRaDKi9PKLvNePfr0wpNF6/DLnqZ/960Onra/buLMynPVmT9Cv2DiujUbZhed6DEKP7ye s2nuBI11Nk7cTbG/3reuMRRrz7/z9eH2UxEbSk4/0+7blxh3U4mlOCPRUIu5qDgRAFbU21pZ AgAA X-CMS-MailID: 20201017030721eucas1p2a1032e6c78d99f903ea539e49f057a83 X-Msg-Generator: CA X-RootMTR: 20201017030721eucas1p2a1032e6c78d99f903ea539e49f057a83 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201017030721eucas1p2a1032e6c78d99f903ea539e49f057a83 References: <20201010160508.19709-1-l.wojciechow@partner.samsung.com> <20201017030701.16134-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-dev] [PATCH v8 14/17] distributor: fix flushing in flight packets 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" rte_distributor_flush() is using total_outstanding() function to calculate if it should still wait for processing packets. However in burst mode only backlog packets were counted. This patch fixes that issue by counting also in flight packets. There are also sum fixes to properly keep count of in flight packets for each worker in bufs[].count. Fixes: 775003ad2f96 ("distributor: add new burst-capable library") Cc: david.hunt@intel.com Cc: stable@dpdk.org Signed-off-by: Lukasz Wojciechowski Acked-by: David Hunt --- lib/librte_distributor/rte_distributor.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/librte_distributor/rte_distributor.c b/lib/librte_distributor/rte_distributor.c index 9fea3f69a..fb4e9d93f 100644 --- a/lib/librte_distributor/rte_distributor.c +++ b/lib/librte_distributor/rte_distributor.c @@ -465,6 +465,7 @@ rte_distributor_process(struct rte_distributor *d, /* Sync with worker on GET_BUF flag. */ if (__atomic_load_n(&(d->bufs[wid].bufptr64[0]), __ATOMIC_ACQUIRE) & RTE_DISTRIB_GET_BUF) { + d->bufs[wid].count = 0; release(d, wid); handle_returns(d, wid); } @@ -479,11 +480,6 @@ rte_distributor_process(struct rte_distributor *d, uint16_t matches[RTE_DIST_BURST_SIZE]; unsigned int pkts; - /* Sync with worker on GET_BUF flag. */ - if (__atomic_load_n(&(d->bufs[wkr].bufptr64[0]), - __ATOMIC_ACQUIRE) & RTE_DISTRIB_GET_BUF) - d->bufs[wkr].count = 0; - if ((num_mbufs - next_idx) < RTE_DIST_BURST_SIZE) pkts = num_mbufs - next_idx; else @@ -603,8 +599,10 @@ rte_distributor_process(struct rte_distributor *d, for (wid = 0 ; wid < d->num_workers; wid++) /* Sync with worker on GET_BUF flag. */ if ((__atomic_load_n(&(d->bufs[wid].bufptr64[0]), - __ATOMIC_ACQUIRE) & RTE_DISTRIB_GET_BUF)) + __ATOMIC_ACQUIRE) & RTE_DISTRIB_GET_BUF)) { + d->bufs[wid].count = 0; release(d, wid); + } return num_mbufs; } @@ -647,7 +645,7 @@ total_outstanding(const struct rte_distributor *d) unsigned int wkr, total_outstanding = 0; for (wkr = 0; wkr < d->num_workers; wkr++) - total_outstanding += d->backlog[wkr].count; + total_outstanding += d->backlog[wkr].count + d->bufs[wkr].count; return total_outstanding; } From patchwork Sat Oct 17 03:06:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Wojciechowski X-Patchwork-Id: 81176 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 156EEA04DB; Sat, 17 Oct 2020 05:12:12 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DF92FE30A; Sat, 17 Oct 2020 05:08:14 +0200 (CEST) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 873FFE2B6 for ; Sat, 17 Oct 2020 05:07:43 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20201017030723euoutp028ef8c6a42d1908de91f2e8a7fe95402e~_qLxBT6B_2306523065euoutp02Z for ; Sat, 17 Oct 2020 03:07:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20201017030723euoutp028ef8c6a42d1908de91f2e8a7fe95402e~_qLxBT6B_2306523065euoutp02Z DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1602904043; bh=EBsVdQdA92d0EDEPC23FaMghf9BOWuY7l3TdfE3kO3A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LNSnu4Wm+QeXRC5lifM7lzXy0rvUV+i/qclvhx8zgC3gDDovGeP1pulVhxEf2l3ao uXIPiSHmRavm/NPuv7O5L3L10y3g8kZMk7NViDTciEm3IxxfZm3/7PwNmD/mFOEJuJ 6MB4GGCALcxveSaEQoVT7FPPIVOSdvepz3NXnbvo= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20201017030722eucas1p1e8044d615e36277b7de9c98f9dd10e9f~_qLvi-Fm62253222532eucas1p18; Sat, 17 Oct 2020 03:07:22 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 29.E8.06456.AEF5A8F5; Sat, 17 Oct 2020 04:07:22 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20201017030721eucas1p1f3307c1e4e69c65186ad8f2fb18f5f74~_qLvLy9k42252822528eucas1p13; Sat, 17 Oct 2020 03:07:21 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20201017030721eusmtrp2faa52be2ca7ecfadac2e21b6a578727f~_qLvLT8wh2813028130eusmtrp2O; Sat, 17 Oct 2020 03:07:21 +0000 (GMT) X-AuditID: cbfec7f2-7efff70000001938-38-5f8a5fead6d6 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 8C.99.06314.9EF5A8F5; Sat, 17 Oct 2020 04:07:21 +0100 (BST) Received: from localhost.localdomain (unknown [106.210.88.70]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201017030721eusmtip1d47dd10d90bcc0991db87d9bd5901e61~_qLumdQAW3124931249eusmtip1-; Sat, 17 Oct 2020 03:07:21 +0000 (GMT) From: Lukasz Wojciechowski To: David Hunt , Bruce Richardson Cc: dev@dpdk.org, l.wojciechow@partner.samsung.com, stable@dpdk.org Date: Sat, 17 Oct 2020 05:06:59 +0200 Message-Id: <20201017030701.16134-16-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201017030701.16134-1-l.wojciechow@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrEIsWRmVeSWpSXmKPExsWy7djP87qv4rviDWY381jcWGVv0TfpI5PF u0/bmSye9axjtPjX8YfdgdXj14KlrB6L97xk8jj4bg9TAHMUl01Kak5mWWqRvl0CV8bGKQIF R9grlmycyNTAuJOti5GTQ0LAROLhoi1ANheHkMAKRokZU39BOV+AnMvTWCCcz4wSnQ8uMsK0 TFyyDiqxnFH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8dL3k/NxNjMAg 3Hbs5+YdjJc2Bh9iFOBgVOLh3bCoM16INbGsuDL3EKMEB7OSCK/T2dNxQrwpiZVVqUX58UWl OanFhxhNgY6ayCwlmpwPjJC8knhDU0NzC0tDc2NzYzMLJXHeDoGDMUIC6YklqdmpqQWpRTB9 TBycUg2MTjZl0XeWVmftmCB7Wi6n1q5w2yunZKtLBsHGq1/rnptq5NqUfT6YZ+LDU6KvJzm/ VFqcae93NGn2jr8l1eutW9p63Ao1DBcmvsx1fGR5K9plXcJJW67wnO7JMa6vg4+1C0uJG5fP cNkcZzjP+KbwvTD/l4Fhzk+sVlmwXX1yQ9H29Of5TJlKLMUZiYZazEXFiQB5cFXqWAIAAA== X-CMS-MailID: 20201017030721eucas1p1f3307c1e4e69c65186ad8f2fb18f5f74 X-Msg-Generator: CA X-RootMTR: 20201017030721eucas1p1f3307c1e4e69c65186ad8f2fb18f5f74 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201017030721eucas1p1f3307c1e4e69c65186ad8f2fb18f5f74 References: <20201010160508.19709-1-l.wojciechow@partner.samsung.com> <20201017030701.16134-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-dev] [PATCH v8 15/17] distributor: fix clearing returns buffer 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The patch clears distributors returns buffer in clear_returns() by setting start and count to 0. Fixes: 775003ad2f96 ("distributor: add new burst-capable library") Cc: david.hunt@intel.com Cc: stable@dpdk.org Signed-off-by: Lukasz Wojciechowski Acked-by: David Hunt --- lib/librte_distributor/rte_distributor.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/librte_distributor/rte_distributor.c b/lib/librte_distributor/rte_distributor.c index fb4e9d93f..ef34facba 100644 --- a/lib/librte_distributor/rte_distributor.c +++ b/lib/librte_distributor/rte_distributor.c @@ -702,6 +702,8 @@ rte_distributor_clear_returns(struct rte_distributor *d) /* Sync with worker. Release retptrs. */ __atomic_store_n(&(d->bufs[wkr].retptr64[0]), 0, __ATOMIC_RELEASE); + + d->returns.start = d->returns.count = 0; } /* creates a distributor instance */ From patchwork Sat Oct 17 03:07:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Wojciechowski X-Patchwork-Id: 81180 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4566AA04DB; Sat, 17 Oct 2020 05:13:37 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 987ABE36E; Sat, 17 Oct 2020 05:08:22 +0200 (CEST) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 29359E2C1 for ; Sat, 17 Oct 2020 05:07:50 +0200 (CEST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20201017030729euoutp028113cadda7fee51dbcdcae752be7e81a~_qL2Km0Fm2304823048euoutp02h for ; Sat, 17 Oct 2020 03:07:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20201017030729euoutp028113cadda7fee51dbcdcae752be7e81a~_qL2Km0Fm2304823048euoutp02h DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1602904049; bh=Scuc5Yl7mnmC3/9oBm1I4cjSrTqf6Y6Dqa10WtinLUk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L2BgyoswA/zlN8qMP3hk8Eza/+TYHdnAbyMYCfJlM7UgbMLaCM5nR+ZjT7zDFqJrl 0Ulz8W2/wykQAy8VMbiE1usB/dmAUrSNJ/0D3FvvWPJmAhL8zoD+usCe70asA0gt0V C8Qkg12BO+w136wEq66JLidAy3i3tsBVySrEFR7s= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20201017030723eucas1p255a22a301b598139f6925f7dc2c71fcf~_qLxHkpcE2440824408eucas1p2y; Sat, 17 Oct 2020 03:07:23 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 49.D5.06318.BEF5A8F5; Sat, 17 Oct 2020 04:07:23 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20201017030722eucas1p107dc8d3eb2d9ef620065deba31cf08ed~_qLvvqz_W2252822528eucas1p14; Sat, 17 Oct 2020 03:07:22 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20201017030722eusmtrp1dc64595bd7823bb07a0900ecec7a5559~_qLvvMamN3018830188eusmtrp1a; Sat, 17 Oct 2020 03:07:22 +0000 (GMT) X-AuditID: cbfec7f5-371ff700000018ae-9f-5f8a5febeac5 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 4F.DE.06017.AEF5A8F5; Sat, 17 Oct 2020 04:07:22 +0100 (BST) Received: from localhost.localdomain (unknown [106.210.88.70]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201017030721eusmtip12450277e2202383d3ef9f3dbd74e8850~_qLvQPR9j0424404244eusmtip1S; Sat, 17 Oct 2020 03:07:21 +0000 (GMT) From: Lukasz Wojciechowski To: David Hunt Cc: dev@dpdk.org, l.wojciechow@partner.samsung.com, stable@dpdk.org Date: Sat, 17 Oct 2020 05:07:00 +0200 Message-Id: <20201017030701.16134-17-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201017030701.16134-1-l.wojciechow@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrAIsWRmVeSWpSXmKPExsWy7djP87qv47viDV50WFr0TfrIZPHu03Ym i2c96xgt/nX8YXdg8fi1YCmrx+I9L5k8Dr7bwxTAHMVlk5Kak1mWWqRvl8CVse/dTaaCI4oV pz4eZm1gnCLdxcjBISFgInHhE2MXIxeHkMAKRomrdzvYuhg5gZwvjBKvb2dAJD4zSvz48wAs AdKwad5/JojEckaJqV9OsMBVbVzbzw5SxSZgK3Fk5ldWEFtEQFXi3/5PTCDrmAWcJZ58BRsk LOAjsbV9BjOIzQJU0vm6B6yVV8BNonflPlaIZfISqzccYAZp5QSKNx53BVklIXCGTWLSuY8s EDUuEhfXfIKqF5Z4dXwLO4QtI3F6cg8LRMM2oNd+/2SEcPYzSlzvXQFVZS1x+N9vNojjNCXW 79KHCDtKfDnYxg4JIj6JG28FQcLMQOakbdOZIcK8Eh1tQhDVehJPe6Yywqz9s/YJC0SJh8SF 7gJI6FxllDg6aRLjBEb5WQi7FjAyrmIUTy0tzk1PLTbOSy3XK07MLS7NS9dLzs/dxAiM99P/ jn/dwbjvT9IhRgEORiUeXo6lnfFCrIllxZW5hxglOJiVRHidzp6OE+JNSaysSi3Kjy8qzUkt PsQozcGiJM5rvOhlrJBAemJJanZqakFqEUyWiYNTqoFx66U/M1gjD5d5bdBYM1mr9eyKO6F/ 7M+vlr5nITq9eMrLBVUb2VoUGL8oFP4OnvbjlpPPu2qZjXcZXlzbvr7B99vRjI27U45ph5e2 1s1n+Pv30gZTaz1VZY66DW+jjq7iOibSqhn2Mez/9KLi8KWflb7WfpW8yV+gkpRi6CZ3j5nb pfxdjWifEktxRqKhFnNRcSIAgzlJovMCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrMLMWRmVeSWpSXmKPExsVy+t/xu7qv4rviDXZ3ylj0TfrIZPHu03Ym i2c96xgt/nX8YXdg8fi1YCmrx+I9L5k8Dr7bwxTAHKVnU5RfWpKqkJFfXGKrFG1oYaRnaGmh Z2RiqWdobB5rZWSqpG9nk5Kak1mWWqRvl6CXse/dTaaCI4oVpz4eZm1gnCLdxcjJISFgIrFp 3n8mEFtIYCmjxMdjYV2MHEBxGYkPlwQgSoQl/lzrYuti5AIq+cgoMX3TPDaQBJuArcSRmV9Z QWwRAVWJf/s/gc1hFnCX2LJ4KjOILSzgI7G1fQaYzQJU0/m6hx3E5hVwk+hduY8VYoG8xOoN B5hB9nICxRuPu0LsamSUODtrHcsERr4FjAyrGEVSS4tz03OLjfSKE3OLS/PS9ZLzczcxAgNw 27GfW3Ywdr0LPsQowMGoxMO7YVFnvBBrYllxZe4hRgkOZiURXqezp+OEeFMSK6tSi/Lji0pz UosPMZoCHTWRWUo0OR8YHXkl8YamhuYWlobmxubGZhZK4rwdAgdjhATSE0tSs1NTC1KLYPqY ODilGhg7HrG/dbu2kd3ywjLzTfq35OcIvL5wzdFofppgxzuTk4vW7ggvfvmKMXT/4a9fBIzP b05oWm4TxWDJ5X5zqoPCFNlyu1tfD7xR/3xoj47cJBuddmntNWHxBj7chxzc/3lcnWU+OU5I 7EqveGl/zbfdn3MV/Wc2O967FpG/L608wGVJc+iyRw+VWIozEg21mIuKEwGAtElwVgIAAA== X-CMS-MailID: 20201017030722eucas1p107dc8d3eb2d9ef620065deba31cf08ed X-Msg-Generator: CA X-RootMTR: 20201017030722eucas1p107dc8d3eb2d9ef620065deba31cf08ed X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201017030722eucas1p107dc8d3eb2d9ef620065deba31cf08ed References: <20201010160508.19709-1-l.wojciechow@partner.samsung.com> <20201017030701.16134-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-dev] [PATCH v8 16/17] test/distributor: ensure all packets are delivered 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" In all distributor tests there is a chance that tests will send packets to distributor with rte_distributor_process() before workers are started and requested for packets. This patch ensures that all packets are delivered to workers by calling rte_distributor_process() in loop until number of successfully processed packets reaches required by test. Change is applied to every first call in test case. Cc: stable@dpdk.org Signed-off-by: Lukasz Wojciechowski Acked-by: David Hunt --- app/test/test_distributor.c | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c index cfae5a1ac..a4af0a39c 100644 --- a/app/test/test_distributor.c +++ b/app/test/test_distributor.c @@ -103,6 +103,7 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p) struct rte_mbuf *returns[BURST*2]; unsigned int i, count; unsigned int retries; + unsigned int processed; printf("=== Basic distributor sanity tests ===\n"); clear_packet_count(); @@ -116,7 +117,11 @@ sanity_test(struct worker_params *wp, struct rte_mempool *p) for (i = 0; i < BURST; i++) bufs[i]->hash.usr = 0; - rte_distributor_process(db, bufs, BURST); + processed = 0; + while (processed < BURST) + processed += rte_distributor_process(db, &bufs[processed], + BURST - processed); + count = 0; do { @@ -304,6 +309,7 @@ sanity_test_with_mbuf_alloc(struct worker_params *wp, struct rte_mempool *p) struct rte_distributor *d = wp->dist; unsigned i; struct rte_mbuf *bufs[BURST]; + unsigned int processed; printf("=== Sanity test with mbuf alloc/free (%s) ===\n", wp->name); @@ -316,7 +322,10 @@ sanity_test_with_mbuf_alloc(struct worker_params *wp, struct rte_mempool *p) bufs[j]->hash.usr = (i+j) << 1; } - rte_distributor_process(d, bufs, BURST); + processed = 0; + while (processed < BURST) + processed += rte_distributor_process(d, + &bufs[processed], BURST - processed); } rte_distributor_flush(d); @@ -410,6 +419,7 @@ sanity_test_with_worker_shutdown(struct worker_params *wp, struct rte_mbuf *bufs2[BURST]; unsigned int i; unsigned int failed = 0; + unsigned int processed = 0; printf("=== Sanity test of worker shutdown ===\n"); @@ -427,7 +437,10 @@ sanity_test_with_worker_shutdown(struct worker_params *wp, for (i = 0; i < BURST; i++) bufs[i]->hash.usr = 1; - rte_distributor_process(d, bufs, BURST); + processed = 0; + while (processed < BURST) + processed += rte_distributor_process(d, &bufs[processed], + BURST - processed); rte_distributor_flush(d); /* at this point, we will have processed some packets and have a full @@ -489,6 +502,7 @@ test_flush_with_worker_shutdown(struct worker_params *wp, struct rte_mbuf *bufs[BURST]; unsigned int i; unsigned int failed = 0; + unsigned int processed; printf("=== Test flush fn with worker shutdown (%s) ===\n", wp->name); @@ -503,7 +517,10 @@ test_flush_with_worker_shutdown(struct worker_params *wp, for (i = 0; i < BURST; i++) bufs[i]->hash.usr = 0; - rte_distributor_process(d, bufs, BURST); + processed = 0; + while (processed < BURST) + processed += rte_distributor_process(d, &bufs[processed], + BURST - processed); /* at this point, we will have processed some packets and have a full * backlog for the other ones at worker 0. */ @@ -585,6 +602,7 @@ sanity_mark_test(struct worker_params *wp, struct rte_mempool *p) unsigned int i, count, id; unsigned int sorted[buf_count], seq; unsigned int failed = 0; + unsigned int processed; printf("=== Marked packets test ===\n"); clear_packet_count(); @@ -615,7 +633,11 @@ sanity_mark_test(struct worker_params *wp, struct rte_mempool *p) count = 0; for (i = 0; i < buf_count/burst; i++) { - rte_distributor_process(db, &bufs[i * burst], burst); + processed = 0; + while (processed < burst) + processed += rte_distributor_process(db, + &bufs[i * burst + processed], + burst - processed); count += rte_distributor_returned_pkts(db, &returns[count], buf_count - count); } From patchwork Sat Oct 17 03:07:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Wojciechowski X-Patchwork-Id: 81177 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id CCDB7A04DB; Sat, 17 Oct 2020 05:12:32 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 95F48E30F; Sat, 17 Oct 2020 05:08:16 +0200 (CEST) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 6893DE2B2 for ; Sat, 17 Oct 2020 05:07:43 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20201017030724euoutp0218bd7540b8fe41470643038251c2a8df~_qLx8RJAp2305523055euoutp02b for ; Sat, 17 Oct 2020 03:07:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20201017030724euoutp0218bd7540b8fe41470643038251c2a8df~_qLx8RJAp2305523055euoutp02b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1602904044; bh=LK9tnnz9BUwf+7yrbAOb7lKqvixt4NXxfdi1Xw9xLhY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PxHBND2LLgr1Jlq2h1153KSm5MN+Uo7QAJ2b23mQ9pIVbS2pu5HdCkhtUML8LHKU3 aXBd1weVGz+spR+uDO0cqyDx8zbVfTU64GkoIxUA5RXVXpk1bpsXqE4e5QOIJ59b8S rUPChi7nA3WxwAmlLJgFjDi9RGr2IuRsTT/NaprE= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20201017030724eucas1p2df338296b80809518c41e1c6eae8f719~_qLxiBP4X3222932229eucas1p21; Sat, 17 Oct 2020 03:07:24 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 54.42.05997.CEF5A8F5; Sat, 17 Oct 2020 04:07:24 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20201017030723eucas1p16904cabfd94afa4fe751c072077e09ae~_qLwZU7Js0896808968eucas1p1t; Sat, 17 Oct 2020 03:07:23 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20201017030723eusmtrp2df488fac488b4e2bd26daafdd68c4ea5~_qLwY0vDB2572125721eusmtrp2l; Sat, 17 Oct 2020 03:07:23 +0000 (GMT) X-AuditID: cbfec7f4-65dff7000000176d-ca-5f8a5fec1c29 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id EC.99.06314.BEF5A8F5; Sat, 17 Oct 2020 04:07:23 +0100 (BST) Received: from localhost.localdomain (unknown [106.210.88.70]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201017030722eusmtip1708014eda969368a38ebe99819eb53a2~_qLv0haky3071330713eusmtip1J; Sat, 17 Oct 2020 03:07:22 +0000 (GMT) From: Lukasz Wojciechowski To: David Hunt , Bruce Richardson Cc: dev@dpdk.org, l.wojciechow@partner.samsung.com, stable@dpdk.org Date: Sat, 17 Oct 2020 05:07:01 +0200 Message-Id: <20201017030701.16134-18-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201017030701.16134-1-l.wojciechow@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCIsWRmVeSWpSXmKPExsWy7djPc7pv4rviDW5eE7e4screom/SRyaL d5+2M1k861nHaPGv4w+7A6vHrwVLWT0W73nJ5HHw3R6mAOYoLpuU1JzMstQifbsErozTR5az FLzgrNh1fgZbA2MvRxcjB4eEgIlE1/GiLkYuDiGBFYwSHZ+aWSGcL4wSy68dZ4dwPjNKPGt7 zdjFyAnWsWP/NKiq5YwSDdcuscBVzZnZzgxSxSZgK3Fk5ldWEFtEIEyiuXkvC8g+ZgFniSdf 2UBMYQEHiZ+b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UWe8EGtiWXFl7iFGCQ5mJRFep7On44R4UxIrq1KL 8uOLSnNSiw8xmgIdNZFZSjQ5HxgjeSXxhqaG5haWhubG5sZmFkrivB0CB2OEBNITS1KzU1ML Uotg+pg4OKUaGMNFLK9ckprFZizH4q1/6s+lCwL23w4sll3yvtK45lXVqnlB/m4qmgI/Tnq5 la1/+Od9bKR5jcm2i6c+1h74+ujs2cKCKAdFVU3barWjzmtXagZJT4gTTX1Tt4Op8dI2bWVz tRiOlh0SU2+cO7jN3vmqj42C653ovfWHn0gzlATzcns1PGH9rsRSnJFoqMVcVJwIACdxDwBZ AgAA X-CMS-MailID: 20201017030723eucas1p16904cabfd94afa4fe751c072077e09ae X-Msg-Generator: CA X-RootMTR: 20201017030723eucas1p16904cabfd94afa4fe751c072077e09ae X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201017030723eucas1p16904cabfd94afa4fe751c072077e09ae References: <20201010160508.19709-1-l.wojciechow@partner.samsung.com> <20201017030701.16134-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-dev] [PATCH v8 17/17] test/distributor: fix quitting workers 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Sending number of packets equal to number of workers isn't enough to stop all workers in burst version of distributor as more than one packet can be matched and consumed by a single worker. This way some of workers might not be awaken from rte_distributor_get_pkt(). This patch fixes it by sending packets one by one. Each sent packet causes exactly one worker to quit. Fixes: 775003ad2f96 ("distributor: add new burst-capable library") Cc: david.hunt@intel.com Cc: stable@dpdk.org Signed-off-by: Lukasz Wojciechowski Reviewed-by: Honnappa Nagarahalli --- app/test/test_distributor.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c index a4af0a39c..e0cb698e1 100644 --- a/app/test/test_distributor.c +++ b/app/test/test_distributor.c @@ -769,9 +769,10 @@ quit_workers(struct worker_params *wp, struct rte_mempool *p) zero_quit = 0; quit = 1; - for (i = 0; i < num_workers; i++) + for (i = 0; i < num_workers; i++) { bufs[i]->hash.usr = i << 1; - rte_distributor_process(d, bufs, num_workers); + rte_distributor_process(d, &bufs[i], 1); + } rte_distributor_process(d, NULL, 0); rte_distributor_flush(d);