From patchwork Wed Sep 23 13:25:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Wojciechowski X-Patchwork-Id: 78566 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 DCFDBA04B1; Wed, 23 Sep 2020 15:25:54 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A0EFD1DBAB; Wed, 23 Sep 2020 15:25:50 +0200 (CEST) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 37E0E1DB4B for ; Wed, 23 Sep 2020 15:25:46 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200923132545euoutp021e37bf1319cc13f1b839dd0e190dbc5e~3bI0hkoE20985909859euoutp02R for ; Wed, 23 Sep 2020 13:25:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200923132545euoutp021e37bf1319cc13f1b839dd0e190dbc5e~3bI0hkoE20985909859euoutp02R DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1600867546; bh=Aad7i1ZMUc3rAZvaKTVtYAaNPC1c1LFWoHAxNKuK8lU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EsSv4UA//MjUOSEiunjsz4fBtCCeKkhVpvuTv8L93n3clieo2kSsNL9LXnLzK+Eq2 q6S06Fg9nYmPGLAWr+qRn1ca3n0w8SDGHJTW9aWNz1unu+fxGaRZG4tldKDWHK0q50 6Z377AAryPQhWPHlHvE+64HIXUY7CVb5L0qM3Df8= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200923132545eucas1p288b0aa3869a62a34105ee243dd46b318~3bI0XGX3p1223812238eucas1p26; Wed, 23 Sep 2020 13:25:45 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 8B.33.06318.9DC4B6F5; Wed, 23 Sep 2020 14:25:45 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200923132545eucas1p10db12d91121c9afdbab338bb60c8ed37~3bIz1kp622311923119eucas1p1V; Wed, 23 Sep 2020 13:25:45 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200923132545eusmtrp117a094952ebeb0ceebc5fa7d711c9990~3bIz01Rel3185331853eusmtrp1m; Wed, 23 Sep 2020 13:25:45 +0000 (GMT) X-AuditID: cbfec7f5-38bff700000018ae-ff-5f6b4cd9312a Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 53.FA.06017.9DC4B6F5; Wed, 23 Sep 2020 14:25:45 +0100 (BST) Received: from Padamandas.fritz.box (unknown [106.210.88.70]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200923132544eusmtip238b32e84fbde6d9e6feefe086059645f~3bIzOjJjD2716427164eusmtip2I; Wed, 23 Sep 2020 13:25:44 +0000 (GMT) From: Lukasz Wojciechowski To: David Hunt , Bruce Richardson Cc: dev@dpdk.org, l.wojciechow@partner.samsung.com, stable@dpdk.org Date: Wed, 23 Sep 2020 15:25:34 +0200 Message-Id: <20200923132541.21417-2-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200923132541.21417-1-l.wojciechow@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrKIsWRmVeSWpSXmKPExsWy7djPc7o3fbLjDW490bO4screom/SRyaL d5+2M1k861nHaPGv4w+7A6vHrwVLWT0W73nJ5HHw3R6mAOYoLpuU1JzMstQifbsEroy16/ez F8yXqtjy+hBrA2OTaBcjJ4eEgInEsZm7GbsYuTiEBFYwSlx4N5EZJCEk8IVR4vqJEgj7M6PE 9PcCMA2H9j1khmhYziixtfUfC0TRJ6DuA4wgNpuArcSRmV9ZQWwRgTCJ5ua9QDUcHMwCzhJP vrKBhIUFnCQuHDwCVs4ioCpxYddyMJtXwFXi9O8uNohd8hKrNxwAu4dTwE3iw4/3YIdKCFxn k3g+7xszRJGLxOQNs1ghbGGJV8e3sEPYMhKnJ/ewQDRsY5S4+vsnVPd+oM96V0BVWUsc/veb DeI6TYn1u/Qhwo4Ss3tAruMAsvkkbrwVBAkzA5mTtk1nhgjzSnS0CUFU60k87ZnKCLP2z9on LBC2h0TbjCvQsLrKKNF66jT7BEb5WQjLFjAyrmIUTy0tzk1PLTbOSy3XK07MLS7NS9dLzs/d xAiM/NP/jn/dwbjvT9IhRgEORiUeXg7d7Hgh1sSy4srcQ4wSHMxKIrxOZ0/HCfGmJFZWpRbl xxeV5qQWH2KU5mBREuc1XvQyVkggPbEkNTs1tSC1CCbLxMEp1cC4ToUrQVRrewdbvtGDyIMR RvHiq35sbfl8QiHSRf9KUdrzpzZm242mm8g4J885d3Xzpyw7rk4N+12y5Zl+N/2nP1mVeO/x fNasUzJMT7MUWyt2rcref/NPmkiKh3Tl4qVz7mddvti7+A/nku1Lui79+d2tpm/8nXmndq3E TPfuQ18ZNXKcJbyVWIozEg21mIuKEwHBk89H+AIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrOLMWRmVeSWpSXmKPExsVy+t/xe7o3fbLjDZ6/4rK4screom/SRyaL d5+2M1k861nHaPGv4w+7A6vHrwVLWT0W73nJ5HHw3R6mAOYoPZui/NKSVIWM/OISW6VoQwsj PUNLCz0jE0s9Q2PzWCsjUyV9O5uU1JzMstQifbsEvYy16/ezF8yXqtjy+hBrA2OTaBcjJ4eE gInEoX0PmbsYuTiEBJYySvQ2nmTpYuQASshIfLgkAFEjLPHnWhcbiC0k8IFR4uW7SBCbTcBW 4sjMr6wg5SICYRInVvqDhJkF3CW2LJ7KDGILCzhJXDh4hBHEZhFQlbiwazmYzSvgKnH6N8RI CQF5idUbDoDVcwq4SXz48Z4R4pxGRomNb9sYJzDyLWBkWMUoklpanJueW2ykV5yYW1yal66X nJ+7iREYiNuO/dyyg7HrXfAhRgEORiUeXg7d7Hgh1sSy4srcQ4wSHMxKIrxOZ0/HCfGmJFZW pRblxxeV5qQWH2I0BbpqIrOUaHI+MErySuINTQ3NLSwNzY3Njc0slMR5OwQOxggJpCeWpGan phakFsH0MXFwSjUwbrhktIt/oYvQX4Fzu5hrl74MFAvTmCH6qewll2GX2vZNvNyK8d4nN8Qx nX58yskoM0NH8kpgT/yZJL3nBut1Zj7VfvfpkHGU3AMG9++3F1na3NbIyFu+5iHbrVvJszbP 4FYSe3o6l/OHoQpz/9TM57891vFsDQgP4F3xmOsboxv3tQOdiVJ/lViKMxINtZiLihMBiqvF cloCAAA= X-CMS-MailID: 20200923132545eucas1p10db12d91121c9afdbab338bb60c8ed37 X-Msg-Generator: CA X-RootMTR: 20200923132545eucas1p10db12d91121c9afdbab338bb60c8ed37 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200923132545eucas1p10db12d91121c9afdbab338bb60c8ed37 References: <20200923014713.16932-1-l.wojciechow@partner.samsung.com> <20200923132541.21417-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-dev] [PATCH v3 1/8] app/test: fix deadlock in distributor test 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. Problem occurred if freezed lcore is the same as the one that is processing the mbufs. 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 changes avoids possible collision by freezing lcore with zero_idx. The lcore that receives the data updates the zero_idx, so it is not freezed itself. To reproduce the issue fixed by this patch, please run distributor_autotest command in test app several times in a row. 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 | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c index ba1f81cf8..35b25463a 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; @@ -346,27 +347,43 @@ handle_work_for_shutdown_test(void *arg) unsigned int total = 0; unsigned int i; unsigned int returned = 0; + unsigned int zero_id = 0; const unsigned int id = __atomic_fetch_add(&worker_idx, 1, __ATOMIC_RELAXED); num = rte_distributor_get_pkt(d, id, buf, buf, num); + zero_id = __atomic_load_n(&zero_idx, __ATOMIC_ACQUIRE); + if (id == zero_id && num > 0) { + zero_id = (zero_id + 1) % __atomic_load_n(&worker_idx, + __ATOMIC_ACQUIRE); + __atomic_store_n(&zero_idx, zero_id, __ATOMIC_RELEASE); + } + /* 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, buf, num); + + zero_id = __atomic_load_n(&zero_idx, __ATOMIC_ACQUIRE); + if (id == zero_id && num > 0) { + zero_id = (zero_id + 1) % __atomic_load_n(&worker_idx, + __ATOMIC_ACQUIRE); + __atomic_store_n(&zero_idx, zero_id, __ATOMIC_RELEASE); + } + 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. */ @@ -586,6 +603,7 @@ quit_workers(struct worker_params *wp, struct rte_mempool *p) rte_eal_mp_wait_lcore(); quit = 0; worker_idx = 0; + zero_idx = 0; } static int From patchwork Wed Sep 23 13:25:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Wojciechowski X-Patchwork-Id: 78567 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 65B29A04B1; Wed, 23 Sep 2020 15:26:06 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1A0381DC9B; Wed, 23 Sep 2020 15:25:53 +0200 (CEST) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 3329D1DB81 for ; Wed, 23 Sep 2020 15:25:47 +0200 (CEST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200923132546euoutp02903886a9e8d032158e12ea42623c9c51~3bI1Qj1LI0994309943euoutp02K for ; Wed, 23 Sep 2020 13:25:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200923132546euoutp02903886a9e8d032158e12ea42623c9c51~3bI1Qj1LI0994309943euoutp02K DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1600867546; bh=F2MlnKN/Nod7IV1TW08UZJ2Os/OjS7XiqwUPYcL+iys=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n6cAk5Tai8JjRdisJpBP7mXSfkkdH+fia0eF5xOgujaMcR67HXjvISZcw/X6Hzxlf m67T25E4MuzVNJ9Sx/gEdTACV7YLRXpHbF9Xx9AiAT2ysuxdiw6jLor2HTeytYrqMF zmps52GtG9HLXrAVkqcnDgpGX1q9SeNdFeaStJz8= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200923132546eucas1p146579ec1d91ad7b6eb8a2b30439d4bed~3bI1GCjZI2311923119eucas1p1Y; Wed, 23 Sep 2020 13:25:46 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 84.B3.06456.ADC4B6F5; Wed, 23 Sep 2020 14:25:46 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200923132546eucas1p212b6eede801514b544d82d41f5b7e4b8~3bI0xKIs-1223812238eucas1p28; Wed, 23 Sep 2020 13:25:46 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200923132546eusmtrp177a398ec63c36538bb3008465a3879b2~3bI0wh5_u3190431904eusmtrp1B; Wed, 23 Sep 2020 13:25:46 +0000 (GMT) X-AuditID: cbfec7f2-809ff70000001938-1f-5f6b4cdaaaed Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id E9.FA.06017.ADC4B6F5; Wed, 23 Sep 2020 14:25:46 +0100 (BST) Received: from Padamandas.fritz.box (unknown [106.210.88.70]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200923132545eusmtip24ddf44d28ad55e2edebf9e2f005aa862~3bI0DlCy_2716727167eusmtip2c; Wed, 23 Sep 2020 13:25:45 +0000 (GMT) From: Lukasz Wojciechowski To: David Hunt , Bruce Richardson Cc: dev@dpdk.org, l.wojciechow@partner.samsung.com, stable@dpdk.org Date: Wed, 23 Sep 2020 15:25:35 +0200 Message-Id: <20200923132541.21417-3-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200923132541.21417-1-l.wojciechow@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCIsWRmVeSWpSXmKPExsWy7djP87q3fLLjDd5elLW4screom/SRyaL d5+2M1k861nHaPGv4w+7A6vHrwVLWT0W73nJ5HHw3R6mAOYoLpuU1JzMstQifbsErozz026w F8zSrejY84y5gfGkShcjJ4eEgInExC0b2boYuTiEBFYwShz6uJERwvnCKNHV9JEFpEpI4DOj xLPfcjAdzZ/2M0EULWeU2H36ATuE8wmofcYJZpAqNgFbiSMzv7KC2CICYRLNzXuBJnFwMAs4 Szz5ygZiCgu4S7RfCAWpYBFQlXhx7ic7SJhXwFVi1g91iFXyEqs3HAAbyCngJvHhx3uw2yQE LrNJ/PzQwwJR5CJxfM11ZghbWOLV8S3sELaMxOnJIDUgDdsYJa7+/gnVvZ9R4nrvCqgqa4nD /36zQdymKbF+lz6IKSHgKPGumRHC5JO48VYQpJgZyJy0bTozRJhXoqNNCGKGnsTTnqmMMFv/ rH0CdZmHRPfbLayQwLnKKLH+yQ3mCYzysxB2LWBkXMUonlpanJueWmyYl1quV5yYW1yal66X nJ+7iREY96f/Hf+0g/HrpaRDjAIcjEo8vBy62fFCrIllxZW5hxglOJiVRHidzp6OE+JNSays Si3Kjy8qzUktPsQozcGiJM5rvOhlrJBAemJJanZqakFqEUyWiYNTqoHR8FLPq5LuuY2L3/se dhG4llbIpu/70+Tas3bVtU8mP7Extgy9xDX5/Ba51n9ypR0LpzVu5NIxKP0+kZPbmifoXtrf 56X7VvU+Y9mZsFRQ38vp2+LM+yLmq3Nzil21OHt/vnqZND3wu/V2xyl7Q9fpflJaJsFwpcXw 4bH8va9SBc/vX2L3p/uoEktxRqKhFnNRcSIAs/A07vcCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrGLMWRmVeSWpSXmKPExsVy+t/xe7q3fLLjDR7vYbe4screom/SRyaL d5+2M1k861nHaPGv4w+7A6vHrwVLWT0W73nJ5HHw3R6mAOYoPZui/NKSVIWM/OISW6VoQwsj PUNLCz0jE0s9Q2PzWCsjUyV9O5uU1JzMstQifbsEvYzz026wF8zSrejY84y5gfGkShcjJ4eE gIlE86f9TF2MXBxCAksZJU6t3sHcxcgBlJCR+HBJAKJGWOLPtS42iJoPjBJ/jl5gB0mwCdhK HJn5lRWkXkQgTOLESn+QMLOAu8SWxVPBxggD2e0XQkHCLAKqEi/O/WQHCfMKuErM+qEOMV1e YvWGA8wgNqeAm8SHH+8ZITY1MkpsfNvGOIGRbwEjwypGkdTS4tz03GIjveLE3OLSvHS95Pzc TYzAMNx27OeWHYxd74IPMQpwMCrx8HLoZscLsSaWFVfmHmKU4GBWEuF1Ons6Tog3JbGyKrUo P76oNCe1+BCjKdBRE5mlRJPzgTGSVxJvaGpobmFpaG5sbmxmoSTO2yFwMEZIID2xJDU7NbUg tQimj4mDU6qBUSRfJ/3D+fPrHTuOT5vEsyHgyszpLTMkipmuCExPSuSeaG3QXXfH5Mi1pP9q YlfDNrS28Oncniad39V14U3Ut6Zb5dPWxYZM0X3x0tFx1Uzbe1v8jMN1JkvbabBf03OeUn/9 3xvH275C/0K+uP5sN98df+TGY/+Gx9uOHRX6Wb8mJorBfIHYHiWW4oxEQy3mouJEAJmDuexZ AgAA X-CMS-MailID: 20200923132546eucas1p212b6eede801514b544d82d41f5b7e4b8 X-Msg-Generator: CA X-RootMTR: 20200923132546eucas1p212b6eede801514b544d82d41f5b7e4b8 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200923132546eucas1p212b6eede801514b544d82d41f5b7e4b8 References: <20200923014713.16932-1-l.wojciechow@partner.samsung.com> <20200923132541.21417-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-dev] [PATCH v3 2/8] app/test: synchronize statistics between lcores 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 acquire/release mechanisms to synchronize. Fixes: c3eabff124e6 ("distributor: add unit tests") Cc: bruce.richardson@intel.com Cc: stable@dpdk.org Signed-off-by: Lukasz Wojciechowski Acked-by: David Hunt --- app/test/test_distributor.c | 39 ++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c index 35b25463a..0e49e3714 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_ACQUIRE); return count; } @@ -52,6 +53,7 @@ static inline void clear_packet_count(void) { memset(&worker_stats, 0, sizeof(worker_stats)); + rte_atomic_thread_fence(__ATOMIC_RELEASE); } /* this is the basic worker function for sanity test @@ -72,13 +74,13 @@ handle_work(void *arg) num = rte_distributor_get_pkt(db, id, buf, buf, num); while (!quit) { __atomic_fetch_add(&worker_stats[id].handled_packets, num, - __ATOMIC_RELAXED); + __ATOMIC_ACQ_REL); count += num; num = rte_distributor_get_pkt(db, id, buf, buf, num); } __atomic_fetch_add(&worker_stats[id].handled_packets, num, - __ATOMIC_RELAXED); + __ATOMIC_ACQ_REL); count += num; rte_distributor_return_pkt(db, id, buf, num); return 0; @@ -134,7 +136,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_ACQUIRE)); printf("Sanity test with all zero hashes done.\n"); /* pick two flows and check they go correctly */ @@ -159,7 +162,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_ACQUIRE)); printf("Sanity test with two hash values done\n"); } @@ -185,7 +190,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_ACQUIRE)); printf("Sanity test with non-zero hashes done\n"); rte_mempool_put_bulk(p, (void *)bufs, BURST); @@ -280,15 +286,17 @@ handle_work_with_free_mbufs(void *arg) buf[i] = NULL; num = rte_distributor_get_pkt(d, id, buf, buf, num); while (!quit) { - worker_stats[id].handled_packets += num; count += num; + __atomic_fetch_add(&worker_stats[id].handled_packets, num, + __ATOMIC_ACQ_REL); for (i = 0; i < num; i++) rte_pktmbuf_free(buf[i]); num = rte_distributor_get_pkt(d, id, buf, buf, num); } - worker_stats[id].handled_packets += num; count += num; + __atomic_fetch_add(&worker_stats[id].handled_packets, num, + __ATOMIC_ACQ_REL); rte_distributor_return_pkt(d, id, buf, num); return 0; } @@ -363,8 +371,9 @@ 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; count += num; + __atomic_fetch_add(&worker_stats[id].handled_packets, num, + __ATOMIC_ACQ_REL); for (i = 0; i < num; i++) rte_pktmbuf_free(buf[i]); num = rte_distributor_get_pkt(d, @@ -379,10 +388,11 @@ handle_work_for_shutdown_test(void *arg) total += num; } - worker_stats[id].handled_packets += num; count += num; returned = rte_distributor_return_pkt(d, id, buf, num); + __atomic_fetch_add(&worker_stats[id].handled_packets, num, + __ATOMIC_ACQ_REL); if (id == zero_id) { /* for worker zero, allow it to restart to pick up last packet * when all workers are shutting down. @@ -394,10 +404,11 @@ handle_work_for_shutdown_test(void *arg) id, buf, buf, num); while (!quit) { - worker_stats[id].handled_packets += num; count += num; rte_pktmbuf_free(pkt); num = rte_distributor_get_pkt(d, id, buf, buf, num); + __atomic_fetch_add(&worker_stats[id].handled_packets, + num, __ATOMIC_ACQ_REL); } returned = rte_distributor_return_pkt(d, id, buf, num); @@ -461,7 +472,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_ACQUIRE)); if (total_packet_count() != BURST * 2) { printf("Line %d: Error, not all packets flushed. " @@ -514,7 +526,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_ACQUIRE)); if (total_packet_count() != BURST) { printf("Line %d: Error, not all packets flushed. " From patchwork Wed Sep 23 13:25:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Wojciechowski X-Patchwork-Id: 78568 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 065BDA04B1; Wed, 23 Sep 2020 15:26:18 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CAAF61DCAE; Wed, 23 Sep 2020 15:25:54 +0200 (CEST) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id 235011DB92 for ; Wed, 23 Sep 2020 15:25:48 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200923132547euoutp0152f383a73457ebf98d2e1a3241880012~3bI2HtUcc1234112341euoutp010 for ; Wed, 23 Sep 2020 13:25:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200923132547euoutp0152f383a73457ebf98d2e1a3241880012~3bI2HtUcc1234112341euoutp010 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1600867547; bh=/Yh9Xifz6ErYuPI2lEwh0VvbJ/gETpniH4w5BJzBnQA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DSG5PGgMPVmfMibmgvrPLgzjFuPuefTcQWyUa59p913i07rxzRS4xAKT+yPo3DFir xN/9eoxVuZ608elmwMY6+lAE7IcSq5faNm//v24NcZhpGVAq4L06BrUb+H+ny0e0fF LamPyBDDNEV92Ljs2Ao32qmYDsproCccQ72lqxfA= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200923132547eucas1p21693a65131f275ad20ff3a85768522e8~3bI171cD90346503465eucas1p2h; Wed, 23 Sep 2020 13:25:47 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 34.84.05997.BDC4B6F5; Wed, 23 Sep 2020 14:25:47 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200923132547eucas1p130620b0d5f3080a7a57234838a992e0e~3bI1nRsLV2306723067eucas1p1a; Wed, 23 Sep 2020 13:25:47 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200923132547eusmtrp1dd1cef75130e0caa4648a92e90426871~3bI1murmY3185331853eusmtrp1u; Wed, 23 Sep 2020 13:25:47 +0000 (GMT) X-AuditID: cbfec7f4-677ff7000000176d-55-5f6b4cdb3258 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id BA.FA.06017.ADC4B6F5; Wed, 23 Sep 2020 14:25:47 +0100 (BST) Received: from Padamandas.fritz.box (unknown [106.210.88.70]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200923132546eusmtip2f6438fdefa30497e8978cb14a57e611d~3bI038-WV2716427164eusmtip2K; Wed, 23 Sep 2020 13:25:46 +0000 (GMT) From: Lukasz Wojciechowski To: David Hunt , Bruce Richardson Cc: dev@dpdk.org, l.wojciechow@partner.samsung.com, stable@dpdk.org Date: Wed, 23 Sep 2020 15:25:36 +0200 Message-Id: <20200923132541.21417-4-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200923132541.21417-1-l.wojciechow@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrKIsWRmVeSWpSXmKPExsWy7djPc7q3fbLjDU68ELW4screom/SRyaL d5+2M1k861nHaPGv4w+7A6vHrwVLWT0W73nJ5HHw3R6mAOYoLpuU1JzMstQifbsErowV+68w F0xVqzg9q42lgbFfrouRk0NCwETi6/91TF2MXBxCAisYJc5u380O4XxhlJjavpMFwvnMKLH3 XR9jFyMHWMvsA2YQ8eWMEg923Ifq+MQocevPbxaQuWwCthJHZn5lBbFFBMIkmpv3soA0Mws4 Szz5ygYSFhbwkFjf2AdWziKgKrHr3yd2EJtXwFVi/syNTBDnyUus3nCAGcTmFHCT+PDjPSNE /DqbxOOdARC2i8TM97vYIGxhiVfHt7BD2DISpyf3gD0gIbCNUeLq75+MEM5+RonrvSugqqwl Dv/7zQZxnKbE+l36EGFHicVPVjBBPMwnceOtIEiYGcictG06M0SYV6KjTQiiWk/iac9URpi1 f9Y+YYEo8ZDoeFsLCZ2rjBJvbuxkm8AoPwth1wJGxlWM4qmlxbnpqcVGeanlesWJucWleel6 yfm5mxiBkX/63/EvOxh3/Uk6xCjAwajEw8uhmx0vxJpYVlyZe4hRgoNZSYTX6ezpOCHelMTK qtSi/Pii0pzU4kOM0hwsSuK8xotexgoJpCeWpGanphakFsFkmTg4pRoYixx+h2rbJN3g9F3u eaGMb83n0NjiFZd5jIXvmxr4TeR+UGJcn+Q2w8hlRfrzHW/vX905X5ztjWlOpcvziyflbup2 hJzturBjof8jPXGduQ8EzgUIc+j4BUpx5FTlHfgt+mfLqYkfdI6EHTvfm/7laND+7/ZzXvB4 +hcJepyIrDGY8qPTJOK+EktxRqKhFnNRcSIAlltaBvgCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrOLMWRmVeSWpSXmKPExsVy+t/xe7q3fbLjDdbsZ7S4screom/SRyaL d5+2M1k861nHaPGv4w+7A6vHrwVLWT0W73nJ5HHw3R6mAOYoPZui/NKSVIWM/OISW6VoQwsj PUNLCz0jE0s9Q2PzWCsjUyV9O5uU1JzMstQifbsEvYwV+68wF0xVqzg9q42lgbFfrouRg0NC wERi9gGzLkYuDiGBpYwSr9f+ZYOIy0h8uCTQxcgJZApL/LnWxQZR84FR4vunm2wgCTYBW4kj M7+ygtSLCIRJnFjpDxJmFnCX2LJ4KjOILSzgIbG+sY8FxGYRUJXY9e8TO4jNK+AqMX/mRiaI +fISqzccAKvnFHCT+PDjPSPErkZGiY1v2xgnMPItYGRYxSiSWlqcm55bbKRXnJhbXJqXrpec n7uJERiI24793LKDsetd8CFGAQ5GJR5eDt3seCHWxLLiytxDjBIczEoivE5nT8cJ8aYkVlal FuXHF5XmpBYfYjQFumois5Rocj4wSvJK4g1NDc0tLA3Njc2NzSyUxHk7BA7GCAmkJ5akZqem FqQWwfQxcXBKNTA2l+vxKlsk+a+cIWdZwvFw7z0Gp2OWSk0SZmF3P/EsMuwxOv7g3VEu+ZsF us1rF/k+C5N+G35pWnKhwFNnW9kVCnyzjp65Gr41x+Nz0CmZuytj/f9JbJ1Wu0T508JFM/bW nZZbI10n4tZtzsJddSzpUk/n7xXaVrUHVYVCJ+Wpl2is+umn9lWJpTgj0VCLuag4EQBUwe3C WgIAAA== X-CMS-MailID: 20200923132547eucas1p130620b0d5f3080a7a57234838a992e0e X-Msg-Generator: CA X-RootMTR: 20200923132547eucas1p130620b0d5f3080a7a57234838a992e0e X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200923132547eucas1p130620b0d5f3080a7a57234838a992e0e References: <20200923014713.16932-1-l.wojciechow@partner.samsung.com> <20200923132541.21417-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-dev] [PATCH v3 3/8] app/test: fix freeing mbufs in distributor tests 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 fixes freeing mbufs, stops returning them to distributor's core and 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 | 50 +++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c index 0e49e3714..94b65b382 100644 --- a/app/test/test_distributor.c +++ b/app/test/test_distributor.c @@ -277,24 +277,23 @@ 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 = 0; 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, buf, 0); while (!quit) { - count += num; __atomic_fetch_add(&worker_stats[id].handled_packets, num, __ATOMIC_ACQ_REL); - for (i = 0; i < num; i++) + for (i = 0; i < num; i++) { rte_pktmbuf_free(buf[i]); + buf[i] = NULL; + } num = rte_distributor_get_pkt(d, - id, buf, buf, num); + id, buf, buf, 0); } - count += num; __atomic_fetch_add(&worker_stats[id].handled_packets, num, __ATOMIC_ACQ_REL); rte_distributor_return_pkt(d, id, buf, num); @@ -322,7 +321,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); @@ -346,20 +344,18 @@ 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 = 0; - unsigned int total = 0; unsigned int i; - unsigned int returned = 0; unsigned int zero_id = 0; const 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, buf, 0); zero_id = __atomic_load_n(&zero_idx, __ATOMIC_ACQUIRE); if (id == zero_id && num > 0) { @@ -371,13 +367,14 @@ 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)) { - count += num; __atomic_fetch_add(&worker_stats[id].handled_packets, num, __ATOMIC_ACQ_REL); - for (i = 0; i < num; i++) + for (i = 0; i < num; i++) { rte_pktmbuf_free(buf[i]); + buf[i] = NULL; + } num = rte_distributor_get_pkt(d, - id, buf, buf, num); + id, buf, buf, 0); zero_id = __atomic_load_n(&zero_idx, __ATOMIC_ACQUIRE); if (id == zero_id && num > 0) { @@ -385,12 +382,7 @@ handle_work_for_shutdown_test(void *arg) __ATOMIC_ACQUIRE); __atomic_store_n(&zero_idx, zero_id, __ATOMIC_RELEASE); } - - total += num; } - count += num; - returned = rte_distributor_return_pkt(d, id, buf, num); - __atomic_fetch_add(&worker_stats[id].handled_packets, num, __ATOMIC_ACQ_REL); if (id == zero_id) { @@ -400,20 +392,24 @@ handle_work_for_shutdown_test(void *arg) while (zero_quit) usleep(100); + for (i = 0; i < num; i++) { + rte_pktmbuf_free(buf[i]); + buf[i] = NULL; + } num = rte_distributor_get_pkt(d, - id, buf, buf, num); + id, buf, buf, 0); while (!quit) { - count += num; - rte_pktmbuf_free(pkt); - num = rte_distributor_get_pkt(d, id, buf, buf, num); __atomic_fetch_add(&worker_stats[id].handled_packets, num, __ATOMIC_ACQ_REL); + for (i = 0; i < num; i++) { + rte_pktmbuf_free(buf[i]); + buf[i] = NULL; + } + num = rte_distributor_get_pkt(d, id, buf, buf, 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; } From patchwork Wed Sep 23 13:25:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Wojciechowski X-Patchwork-Id: 78569 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 EB469A04B1; Wed, 23 Sep 2020 15:26:28 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 951031DCBD; Wed, 23 Sep 2020 15:25:56 +0200 (CEST) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id 2DD271DBAB for ; Wed, 23 Sep 2020 15:25:49 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200923132548euoutp018f98673d2d8e95d1b2f6e1a8213f3e6d~3bI3V7HTL1163111631euoutp01Y for ; Wed, 23 Sep 2020 13:25:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200923132548euoutp018f98673d2d8e95d1b2f6e1a8213f3e6d~3bI3V7HTL1163111631euoutp01Y DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1600867549; bh=IOeOeopAHOosnQytqDrDXRlUBkjmRMVxxWKsQpzvEWw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NHfx4CA5VVgGVE4kHLU+exolSAYcrUjpAjkSrq0zh3Yym/naJBnq7ZkbGkkqCaZYn CQTUe6lPypP17AX/kvUP+J1nQipEWii0xcsle8xB/iEIJpIqnm+ydkraEwP79sboTS gppE4vin4VvnNmLxV/krpNwkAdeuxz82xaIKxD0M= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200923132548eucas1p20af658a90660932e19dc5950f1c11c57~3bI25VcU50347203472eucas1p2b; Wed, 23 Sep 2020 13:25:48 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 0F.33.06318.CDC4B6F5; Wed, 23 Sep 2020 14:25:48 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200923132548eucas1p2a54328cddb79ae5e876eb104217d585f~3bI2geVXb0347203472eucas1p2a; Wed, 23 Sep 2020 13:25:48 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200923132548eusmtrp2f66c9e48b6348e8cc2f02ff84a1c7dc4~3bI2f406_2233622336eusmtrp2W; Wed, 23 Sep 2020 13:25:48 +0000 (GMT) X-AuditID: cbfec7f5-371ff700000018ae-0b-5f6b4cdc39cb Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id DC.A9.06314.CDC4B6F5; Wed, 23 Sep 2020 14:25:48 +0100 (BST) Received: from Padamandas.fritz.box (unknown [106.210.88.70]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200923132547eusmtip252f4a6b924d3710f79cf24db27698bbd~3bI1x4KME2715827158eusmtip2V; Wed, 23 Sep 2020 13:25:47 +0000 (GMT) From: Lukasz Wojciechowski To: David Hunt , Bruce Richardson Cc: dev@dpdk.org, l.wojciechow@partner.samsung.com, stable@dpdk.org Date: Wed, 23 Sep 2020 15:25:37 +0200 Message-Id: <20200923132541.21417-5-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200923132541.21417-1-l.wojciechow@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrGIsWRmVeSWpSXmKPExsWy7djP87p3fLLjDVqOyVrcWGVv0TfpI5PF u0/bmSye9axjtPjX8YfdgdXj14KlrB6L97xk8jj4bg9TAHMUl01Kak5mWWqRvl0CV8bbt4cY Cy5zVvRs7GZrYJzE0cXIySEhYCLxuauDtYuRi0NIYAWjxOJbK1kgnC+MEl9XbWECqRIS+Mwo cbKDG6bjR/tLFoj4ckaJ+bsCIBo+MUoc/tPIDpJgE7CVODLzKyuILSIQJtHcvBeogYODWcBZ 4slXNpCwsICXxIyZnxlBbBYBVYkXDyaAlfMKuEocn3iICWKXvMTqDQeYQWxOATeJDz/eM4Ls khC4ziZxY+snqCIXid53b1kgbGGJV8e3sEPYMhL/d85ngmjYxihx9fdPqO79jBLXe1dAVVlL HP73mw3iOk2J9bv0IcKOEudPNDKDhCUE+CRuvBUECTMDmZO2TYcK80p0tAlBVOtJPO2Zygiz 9s/aJ1DneEhMXdkKDdCrjBLnb39hnMAoPwth2QJGxlWM4qmlxbnpqcXGeanlesWJucWleel6 yfm5mxiBsX/63/GvOxj3/Uk6xCjAwajEw8uhmx0vxJpYVlyZe4hRgoNZSYTX6ezpOCHelMTK qtSi/Pii0pzU4kOM0hwsSuK8xotexgoJpCeWpGanphakFsFkmTg4pRoYm0u3bKy9v9J/jUW9 g/hltUkWeucnT2e0eXt185mmb+3fVl6XM3Hf5yD/2yPmWW3MJmbzo8J/GwNkkj7znV0+IUWo dBF76dyUV7u5qhak97vdD957Ljb88J0Pmxdwfj07scXt86T3FS+cZu7a9U+Df33KIrfttleu pfstSW8+ZvT01N5iYfubvkosxRmJhlrMRcWJAKvYEv/5AgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrBLMWRmVeSWpSXmKPExsVy+t/xe7p3fLLjDZoeMlncWGVv0TfpI5PF u0/bmSye9axjtPjX8YfdgdXj14KlrB6L97xk8jj4bg9TAHOUnk1RfmlJqkJGfnGJrVK0oYWR nqGlhZ6RiaWeobF5rJWRqZK+nU1Kak5mWWqRvl2CXsbbt4cYCy5zVvRs7GZrYJzE0cXIySEh YCLxo/0lSxcjF4eQwFJGiQvzJ7B1MXIAJWQkPlwSgKgRlvhzrYsNouYDo8S0NV9ZQRJsArYS R2aC2BwcIgJhEidW+oOEmQXcJbYsnsoMYgsLeEnMmPmZEcRmEVCVePFgAlgrr4CrxPGJh5gg 5stLrN5wAKyeU8BN4sOP94wQuxoZJTa+bWOcwMi3gJFhFaNIamlxbnpusaFecWJucWleul5y fu4mRmAobjv2c/MOxksbgw8xCnAwKvHwcuhmxwuxJpYVV+YeYpTgYFYS4XU6ezpOiDclsbIq tSg/vqg0J7X4EKMp0FUTmaVEk/OBcZJXEm9oamhuYWlobmxubGahJM7bIXAwRkggPbEkNTs1 tSC1CKaPiYNTqoEx976K5791L9k7jbYdOfrhjoSM1Ko93Jsblwce9OKwKIu4tJlx2uymM8nX jdYoRN+68j7cY/ZEhWr+lYHqssrLZ+17spytVDWLV64v/IrJdMvvl/o85v7f4Tb7bLXvl5+F q76WyDFa1d7gXpN7/2FGe7ccD086T/rKnG8dX08ue5ek/aJoe990JZbijERDLeai4kQAsvrB GFsCAAA= X-CMS-MailID: 20200923132548eucas1p2a54328cddb79ae5e876eb104217d585f X-Msg-Generator: CA X-RootMTR: 20200923132548eucas1p2a54328cddb79ae5e876eb104217d585f X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200923132548eucas1p2a54328cddb79ae5e876eb104217d585f References: <20200923014713.16932-1-l.wojciechow@partner.samsung.com> <20200923132541.21417-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-dev] [PATCH v3 4/8] app/test: collect return mbufs in distributor test 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 packages 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 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c index 94b65b382..f31b54edf 100644 --- a/app/test/test_distributor.c +++ b/app/test/test_distributor.c @@ -610,6 +610,10 @@ quit_workers(struct worker_params *wp, struct rte_mempool *p) rte_distributor_process(d, NULL, 0); rte_distributor_flush(d); rte_eal_mp_wait_lcore(); + + while (rte_distributor_returned_pkts(d, bufs, RTE_MAX_LCORE)) + ; + quit = 0; worker_idx = 0; zero_idx = 0; From patchwork Wed Sep 23 13:25:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Wojciechowski X-Patchwork-Id: 78570 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 DE48CA04B1; Wed, 23 Sep 2020 15:26:38 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5C0AF1DCCC; Wed, 23 Sep 2020 15:25:58 +0200 (CEST) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 6CECC1DB92 for ; Wed, 23 Sep 2020 15:25:50 +0200 (CEST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200923132550euoutp02517baacb1a852a0b6ab9f30b290cdedf~3bI4gkjlh0994309943euoutp02P for ; Wed, 23 Sep 2020 13:25:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200923132550euoutp02517baacb1a852a0b6ab9f30b290cdedf~3bI4gkjlh0994309943euoutp02P DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1600867550; bh=yH3M1Cb4L5UauMPb4vqNmQJysLFgOKEd5bHi5VjtoSc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UeIs+uiCmSA7YSt4DDD/CmBsHmfA00UoBVkO3KuA1u/XkyXoSq/4amM62EkNm5laR f+qPwyP8IIp332lRAGHmH17PSyIG+KCET+auNcrTAMmgo5PjjmmWgoemVBlb0FQAlt gSIBsry1L4QuPqx6tjs9oTPHFLpFkRSwniWCRDmo= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200923132550eucas1p153d02e3bab19e499f30c0a2cf6396f90~3bI4SVDev1413714137eucas1p1T; Wed, 23 Sep 2020 13:25:50 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id C6.84.05997.DDC4B6F5; Wed, 23 Sep 2020 14:25:49 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200923132549eucas1p29fc391c3f236fa704ff800774ab851f0~3bI3YmgGH2615126151eucas1p2G; Wed, 23 Sep 2020 13:25:49 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200923132549eusmtrp1c05ab2d0365613015827202cd77b3b7e~3bI3YAdXX3190431904eusmtrp1F; Wed, 23 Sep 2020 13:25:49 +0000 (GMT) X-AuditID: cbfec7f4-65dff7000000176d-60-5f6b4cdd5bb2 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 1C.FA.06017.CDC4B6F5; Wed, 23 Sep 2020 14:25:48 +0100 (BST) Received: from Padamandas.fritz.box (unknown [106.210.88.70]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200923132548eusmtip283b25f6cde74e387e530d1f287a0e9c8~3bI2ubL6_2716727167eusmtip2e; Wed, 23 Sep 2020 13:25:48 +0000 (GMT) From: Lukasz Wojciechowski To: David Hunt , Bruce Richardson Cc: dev@dpdk.org, l.wojciechow@partner.samsung.com, stable@dpdk.org Date: Wed, 23 Sep 2020 15:25:38 +0200 Message-Id: <20200923132541.21417-6-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200923132541.21417-1-l.wojciechow@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrKIsWRmVeSWpSXmKPExsWy7djP87p3fbLjDVYuNrW4screom/SRyaL d5+2M1k861nHaPGv4w+7A6vHrwVLWT0W73nJ5HHw3R6mAOYoLpuU1JzMstQifbsEroyOB+cY C06LVjz4tIm5gXG9UBcjB4eEgInEp1taXYxcHEICKxglJqy8wQjhfGGUuDv/DjOE85lR4l7z OZYuRk6wjr/rv7FDJJYzSkx78I4FwvnEKHH8xDkmkCo2AVuJIzO/soLYIgJhEs3Ne1lA9jEL OEs8+coGEhYW8JK49/EVWAmLgKrE+b8TGUFsXgFXiW2rlzFCLJOXWL3hADOIzSngJvHhx3uo +G02iVMXEiFsF4lHb/4yQdjCEq+Ob2GHsGUkTk/uAbtNQmAbo8TV3z8ZIZz9jBLXe1dAVVlL HP73mw3iOE2J9bv0IcKOEtP/72SChBGfxI23giBhZiBz0rbpzBBhXomONiGIaj2Jpz1TGWHW /ln7BBpWHhJ9n86BnS8kcJVRYvOVvAmM8rMQdi1gZFzFKJ5aWpybnlpslJdarlecmFtcmpeu l5yfu4kRGPmn/x3/soNx15+kQ4wCHIxKPLwcutnxQqyJZcWVuYcYJTiYlUR4nc6ejhPiTUms rEotyo8vKs1JLT7EKM3BoiTOa7zoZayQQHpiSWp2ampBahFMlomDU6qBsZBR3MFzS6nTe7Pa 5/Mfvrxib/H3z65PgnmK4TtYe27O6H8ikDB/7hI3m6N7sgUdMlZ1vbheu3jH4zeu6n9dbmYw 8fv63ArKSvld9HDCNaXywy8uKe/lO3TL1OPjM6aJ81+3fLizdZ3Mlz9n3K1ktsouS9v3xTs/ sz8oJm7qvdoZQTWPToXPu6/EUpyRaKjFXFScCADR9EQg+AIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrBLMWRmVeSWpSXmKPExsVy+t/xe7p3fLLjDab+srG4screom/SRyaL d5+2M1k861nHaPGv4w+7A6vHrwVLWT0W73nJ5HHw3R6mAOYoPZui/NKSVIWM/OISW6VoQwsj PUNLCz0jE0s9Q2PzWCsjUyV9O5uU1JzMstQifbsEvYyOB+cYC06LVjz4tIm5gXG9UBcjJ4eE gInE3/Xf2LsYuTiEBJYySuy/+Y6ti5EDKCEj8eGSAESNsMSfa11sEDUfGCUuX+pjBUmwCdhK HJn5lRWkXkQgTOLESn+QMLOAu8SWxVOZQWxhAS+Jex9fgZWzCKhKnP87kRHE5hVwldi2ehkj xHx5idUbDoDVcwq4SXz48Z4RYlcjo8TGt22MExj5FjAyrGIUSS0tzk3PLTbSK07MLS7NS9dL zs/dxAgMxW3Hfm7Zwdj1LvgQowAHoxIPL4dudrwQa2JZcWXuIUYJDmYlEV6ns6fjhHhTEiur Uovy44tKc1KLDzGaAl01kVlKNDkfGCd5JfGGpobmFpaG5sbmxmYWSuK8HQIHY4QE0hNLUrNT UwtSi2D6mDg4pRoYJ4atPnvEYv9vD55fPz7s4plx6ufe44r3lt9Su5NZ2rFlW8xavxNnHm7i in18ZopIOffprOs8JYLc8p+KpB0kZ7OHzax8PGfLsrapvVXTKnYd13EPfzn15jzXp8t71QT4 pz87bfpCcdXBPT95Xe8l+X6aeo9XaP953vBt67XmqX1OP/uL5fKlyVeUWIozEg21mIuKEwFF oJzvWwIAAA== X-CMS-MailID: 20200923132549eucas1p29fc391c3f236fa704ff800774ab851f0 X-Msg-Generator: CA X-RootMTR: 20200923132549eucas1p29fc391c3f236fa704ff800774ab851f0 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200923132549eucas1p29fc391c3f236fa704ff800774ab851f0 References: <20200923014713.16932-1-l.wojciechow@partner.samsung.com> <20200923132541.21417-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-dev] [PATCH v3 5/8] 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 --- lib/librte_distributor/rte_distributor.c | 14 ++++++++++++++ lib/librte_distributor/rte_distributor_single.c | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/lib/librte_distributor/rte_distributor.c b/lib/librte_distributor/rte_distributor.c index 1c047f065..89493c331 100644 --- a/lib/librte_distributor/rte_distributor.c +++ b/lib/librte_distributor/rte_distributor.c @@ -160,6 +160,7 @@ rte_distributor_return_pkt(struct rte_distributor *d, { struct rte_distributor_buffer *buf = &d->bufs[worker_id]; unsigned int i; + volatile int64_t *retptr64; if (unlikely(d->alg_type == RTE_DIST_ALG_SINGLE)) { if (num == 1) @@ -169,6 +170,19 @@ rte_distributor_return_pkt(struct rte_distributor *d, return -EINVAL; } + retptr64 = &(buf->retptr64[0]); + /* Spin while handshake bits are set (scheduler clears it). + * Sync with worker on GET_BUF flag. + */ + while (unlikely(__atomic_load_n(retptr64, __ATOMIC_ACQUIRE) + & 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 Wed Sep 23 13:25:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Wojciechowski X-Patchwork-Id: 78571 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 07988A04B1; Wed, 23 Sep 2020 15:26:51 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 340901DCDE; Wed, 23 Sep 2020 15:26:04 +0200 (CEST) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id EA0871DC60 for ; Wed, 23 Sep 2020 15:25:50 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200923132550euoutp01bb21e4562e1e8a9509d2f3cb45a8fd6b~3bI4_J5oN1234812348euoutp011 for ; Wed, 23 Sep 2020 13:25:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200923132550euoutp01bb21e4562e1e8a9509d2f3cb45a8fd6b~3bI4_J5oN1234812348euoutp011 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1600867550; bh=jos6MfnCwcP82KcnUf4P5M+gQGwQK14lVxEP6mCmTW4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hD9aBXzcQXo4eL9ih995T0b4CPJro7ypWTszqEIficErKJS8R8btAusNod06oM/fK HxC5J/V5QxzogNJ0FNJJYIh+2BskbFL1fwTnG0GHXH5EwIFO6gRYvrPfaRoDx8iAFo IhdNUVwar67kCS0lEH0QTGEHahEOMVCyd7LqvGuQ= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200923132550eucas1p21953e85888b7eb29f4e79076fbac764b~3bI4oxSxa2685426854eucas1p2c; Wed, 23 Sep 2020 13:25:50 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 47.84.05997.EDC4B6F5; Wed, 23 Sep 2020 14:25:50 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200923132550eucas1p2ce158dd81ccc04abcab4130d8cb391f4~3bI4S0uOp2291022910eucas1p2j; Wed, 23 Sep 2020 13:25:50 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200923132549eusmtrp2d661565c96c339171b422734a42e0871~3bI4SHglK2233622336eusmtrp2Y; Wed, 23 Sep 2020 13:25:49 +0000 (GMT) X-AuditID: cbfec7f4-65dff7000000176d-62-5f6b4cdea680 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id AE.A9.06314.DDC4B6F5; Wed, 23 Sep 2020 14:25:49 +0100 (BST) Received: from Padamandas.fritz.box (unknown [106.210.88.70]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200923132549eusmtip25f834ec2380b9d4dbe62daef96593100~3bI3kTCL32716427164eusmtip2O; Wed, 23 Sep 2020 13:25:49 +0000 (GMT) From: Lukasz Wojciechowski To: David Hunt , Bruce Richardson Cc: dev@dpdk.org, l.wojciechow@partner.samsung.com, stable@dpdk.org Date: Wed, 23 Sep 2020 15:25:39 +0200 Message-Id: <20200923132541.21417-7-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200923132541.21417-1-l.wojciechow@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCIsWRmVeSWpSXmKPExsWy7djP87r3fLLjDX7+FbK4screom/SRyaL d5+2M1k861nHaPGv4w+7A6vHrwVLWT0W73nJ5HHw3R6mAOYoLpuU1JzMstQifbsErowllw8z FewXrPjx/glrA+Nevi5GDg4JAROJW9/Uuxi5OIQEVjBKzFyxhBXC+cIo8bb7OpTzmVGiY+FT xi5GTrCOWat7oBLLGSVOfZ3FBuF8YpSY/3kNG0gVm4CtxJGZX1lBbBGBMInm5r0sIPuYBZwl nnwFKxEWsJbYvGEDK0iYRUBVYt4FJhCTV8BV4tUNXohV8hKrNxxgBrE5BdwkPvx4zwiySULg MptEy43dLBBFLhL7b+1mhbCFJV4d38IOYctI/N85nwmiYRujxNXfP6G69zNKXO9dAVVlLXH4 3282iNs0Jdbv0ocIO0oc+b6DERJEfBI33gqChJmBzEnbpjNDhHklOtqEIKr1JJ72TGWEWftn 7ROo0zwkFr+/zQRiCwlcZZS41186gVF+FsKuBYyMqxjFU0uLc9NTi43yUsv1ihNzi0vz0vWS 83M3MQLj/vS/4192MO76k3SIUYCDUYmHl0M3O16INbGsuDL3EKMEB7OSCK/T2dNxQrwpiZVV qUX58UWlOanFhxilOViUxHmNF72MFRJITyxJzU5NLUgtgskycXBKNTCuj134Zbdy7+tv8wu3 /9xdxFPuznh9+4oLqyevzTjWZbns5cpdfWb6zyYUt+cFFefqzGvjjLHbX33vvMrnR6vdt5ce 558Zqdx+d6nsCccvD6JSs40XFz1NZU+ezLx5gXtEstLSFWGq6gKz0urnZy/Yt2YLj2OY/6Gw s5f8js9J2RQ06d4ccR4DJZbijERDLeai4kQAgU02WPcCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrGLMWRmVeSWpSXmKPExsVy+t/xe7p3fbLjDY6stbK4screom/SRyaL d5+2M1k861nHaPGv4w+7A6vHrwVLWT0W73nJ5HHw3R6mAOYoPZui/NKSVIWM/OISW6VoQwsj PUNLCz0jE0s9Q2PzWCsjUyV9O5uU1JzMstQifbsEvYwllw8zFewXrPjx/glrA+Nevi5GTg4J AROJWat7WLsYuTiEBJYySiw5uJ+5i5EDKCEj8eGSAESNsMSfa11sEDUfGCVuXO1kA0mwCdhK HJn5lRWkXkQgTOLESn+QMLOAu8SWxVOZQWxhAWuJzRs2gJWwCKhKzLvABGLyCrhKvLrBCzFd XmL1hgNg1ZwCbhIffrxnhNjUyCix8W0b4wRGvgWMDKsYRVJLi3PTc4sN9YoTc4tL89L1kvNz NzECw3DbsZ+bdzBe2hh8iFGAg1GJh5dDNzteiDWxrLgy9xCjBAezkgiv09nTcUK8KYmVValF +fFFpTmpxYcYTYFumsgsJZqcD4yRvJJ4Q1NDcwtLQ3Njc2MzCyVx3g6BgzFCAumJJanZqakF qUUwfUwcnFINjOkRwv/Wd2U1/dX9t8rfrLXxbHnV6QdKFSxrVSX2xFT+zRft50ycpfciVGrf R/blJxpeT7l27Yfojinbd+yoe3Dtpn97lyC76Zz428r/RD0Zk14Ix1cv1ZgVwvJjpseCL9ox O1euNzlec+WV9DP7fLMqs+TtK+/OiH9cLPPnumC5SGFdam1FtRJLcUaioRZzUXEiACvZBMtZ AgAA X-CMS-MailID: 20200923132550eucas1p2ce158dd81ccc04abcab4130d8cb391f4 X-Msg-Generator: CA X-RootMTR: 20200923132550eucas1p2ce158dd81ccc04abcab4130d8cb391f4 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200923132550eucas1p2ce158dd81ccc04abcab4130d8cb391f4 References: <20200923014713.16932-1-l.wojciechow@partner.samsung.com> <20200923132541.21417-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-dev] [PATCH v3 6/8] 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 want to return back mbufs and waits for retptr handshake to be cleared and distributor core wait 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 release 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 89493c331..12b3db33c 100644 --- a/lib/librte_distributor/rte_distributor.c +++ b/lib/librte_distributor/rte_distributor.c @@ -321,12 +321,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; @@ -376,6 +378,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 Wed Sep 23 13:25:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Wojciechowski X-Patchwork-Id: 78572 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 26A0CA04B1; Wed, 23 Sep 2020 15:27:01 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CAF521DCED; Wed, 23 Sep 2020 15:26:06 +0200 (CEST) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id 9B6C21DC60 for ; Wed, 23 Sep 2020 15:25:51 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200923132551euoutp015ac4d29ca28239f4fdd1617cf2b97119~3bI5pUcMl1234112341euoutp016 for ; Wed, 23 Sep 2020 13:25:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200923132551euoutp015ac4d29ca28239f4fdd1617cf2b97119~3bI5pUcMl1234112341euoutp016 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1600867551; bh=gFZ/BC5QS8r9vYAoQsykBlxn+BSZtg1dnO8kDQnIEds=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=grPY9O+5fQ94EeAMSg1Qo5z/PnrJwJOlggYLmrQKAIH+HRvOzd/PQk/Vg1EGyMrBp F2LHvnzznelqYshvAkdf3uRuqoYccjmpHGsJT5hWrV5AK3z+KcO4HR9Ss81QQRLT2p Q3vPfKr1oBXbok9xhOB6kFd40I8AEkNr79K7NNK8= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200923132551eucas1p2f3aa70cc8efbc49c297f4d023c81d47e~3bI5eZq6f1223012230eucas1p2r; Wed, 23 Sep 2020 13:25:51 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id F7.84.05997.FDC4B6F5; Wed, 23 Sep 2020 14:25:51 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200923132550eucas1p1ce21011562d0a00cccfd4ae3f0be4ff9~3bI5IU3bT0406104061eucas1p1J; Wed, 23 Sep 2020 13:25:50 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200923132550eusmtrp2d610dda061e1269c4ba350b182cb5bcc~3bI5HyfcS2233622336eusmtrp2a; Wed, 23 Sep 2020 13:25:50 +0000 (GMT) X-AuditID: cbfec7f4-65dff7000000176d-66-5f6b4cdf1beb Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 10.B9.06314.EDC4B6F5; Wed, 23 Sep 2020 14:25:50 +0100 (BST) Received: from Padamandas.fritz.box (unknown [106.210.88.70]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200923132550eusmtip22163b935587d07dc17727f180385d49f~3bI4fUesA2715827158eusmtip2X; Wed, 23 Sep 2020 13:25:50 +0000 (GMT) From: Lukasz Wojciechowski To: David Hunt , Bruce Richardson Cc: dev@dpdk.org, l.wojciechow@partner.samsung.com, stable@dpdk.org Date: Wed, 23 Sep 2020 15:25:40 +0200 Message-Id: <20200923132541.21417-8-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200923132541.21417-1-l.wojciechow@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrGIsWRmVeSWpSXmKPExsWy7djP87r3fbLjDdYs4Le4screom/SRyaL d5+2M1k861nHaPGv4w+7A6vHrwVLWT0W73nJ5HHw3R6mAOYoLpuU1JzMstQifbsEroye3RfY Cq5wV8y/voqlgfExZxcjJ4eEgInEqvnLGLsYuTiEBFYwSnxdsBPK+cIo8aplEZTzmVFizY43 zDAtm971QiWWM0qc+72cBcL5xCjx4MMJdpAqNgFbiSMzv7KC2CICYRLNzXuBijg4mAWcJZ58 ZQMJCwu4SZw8spcVJMwioCqx8S7YfF4BV4mLJ16wQ+ySl1i94QBYnBOo/MOP92B7JQQus0l8 X7kO6iAXielL/rBB2MISr45vgWqWkfi/cz4TRMM2Romrv39Cde9nlLjeuwKqylri8L/fbBDH aUqs36UPEXaUuHTzLRNIWEKAT+LGW0GQMDOQOWnbdGaIMK9ER5sQRLWexNOeqYwwa/+sfcIC UeIh8edZIiR0rjJKfF+6g2kCo/wshF0LGBlXMYqnlhbnpqcWG+WllusVJ+YWl+al6yXn525i BMb+6X/Hv+xg3PUn6RCjAAejEg8vh252vBBrYllxZe4hRgkOZiURXqezp+OEeFMSK6tSi/Lj i0pzUosPMUpzsCiJ8xovehkrJJCeWJKanZpakFoEk2Xi4JRqYOyqrZ5mFzxBW+SAxoTfP2fz m7g7bSp6LfF0E++B0E+LhDqDwgV36r/b8O+mukyA4Pqg7DuKDUVXv52JmHsoUf5n2cy3Wleq WXIrI6t8Zp5d80Yj4MGcOWGSse1OzYzHmnZtjlnBerZ/baNFkNPTPt767/NbLCPdl/esqFtc 9unNlBmTsyqatyqxFGckGmoxFxUnAgB5D6uA+QIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrGLMWRmVeSWpSXmKPExsVy+t/xe7r3fLLjDQ7tMrW4screom/SRyaL d5+2M1k861nHaPGv4w+7A6vHrwVLWT0W73nJ5HHw3R6mAOYoPZui/NKSVIWM/OISW6VoQwsj PUNLCz0jE0s9Q2PzWCsjUyV9O5uU1JzMstQifbsEvYye3RfYCq5wV8y/voqlgfExZxcjJ4eE gInEpne9jCC2kMBSRondj8W6GDmA4jISHy4JQJQIS/y51sXWxcgFVPKBUeLh0SmsIAk2AVuJ IzO/soLUiwiESZxY6Q8SZhZwl9iyeCoziC0s4CZx8shesBIWAVWJjXfBwrwCrhIXT7xghxgv L7F6wwGwOCdQ+Ycf7xkhVjUySmx828Y4gZFvASPDKkaR1NLi3PTcYkO94sTc4tK8dL3k/NxN jMAw3Hbs5+YdjJc2Bh9iFOBgVOLh5dDNjhdiTSwrrsw9xCjBwawkwut09nScEG9KYmVValF+ fFFpTmrxIUZToKMmMkuJJucDYySvJN7Q1NDcwtLQ3Njc2MxCSZy3Q+BgjJBAemJJanZqakFq EUwfEwenVANj3LEYtcA0qwU6L/ecVq3lc+fa+77tR9CRBbv4piio3OLQ/3B08cLIrrid8YKf mN/EP5fa1C86QdsiZnbq1wnJLjxx/6VXHun6bDB9q3tiCsNeNsdd5RY3K2L2xK3l3bT8aBX7 qrSHpl2FC9/fblZZ9+xKjd0lkU8VTxuv3zqhE7XRzvHNP5+VSizFGYmGWsxFxYkAITnUzlkC AAA= X-CMS-MailID: 20200923132550eucas1p1ce21011562d0a00cccfd4ae3f0be4ff9 X-Msg-Generator: CA X-RootMTR: 20200923132550eucas1p1ce21011562d0a00cccfd4ae3f0be4ff9 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200923132550eucas1p1ce21011562d0a00cccfd4ae3f0be4ff9 References: <20200923014713.16932-1-l.wojciechow@partner.samsung.com> <20200923132541.21417-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-dev] [PATCH v3 7/8] 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. Fixes: 775003ad2f96 ("distributor: add new burst-capable library") Cc: david.hunt@intel.com Cc: stable@dpdk.org Signed-off-by: Lukasz Wojciechowski --- 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 12b3db33c..b720abe03 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 Wed Sep 23 13:25:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Wojciechowski X-Patchwork-Id: 78573 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 935FDA04B1; Wed, 23 Sep 2020 15:27:14 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3D3D11DCDB; Wed, 23 Sep 2020 15:26:09 +0200 (CEST) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id AD71E1DC88 for ; Wed, 23 Sep 2020 15:25:52 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200923132552euoutp02655497bba21b73df756b050ab07bb55c~3bI6pFdbN1049510495euoutp027 for ; Wed, 23 Sep 2020 13:25:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200923132552euoutp02655497bba21b73df756b050ab07bb55c~3bI6pFdbN1049510495euoutp027 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1600867552; bh=dU7rWktTPIfjQZ7fCAIykFYYMgwWcdJlLIM6bxgVZkM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e9hcELPHhf0tYm/wT0s50cCZSp3TB+JgqdSureq/9iDgt9c12AaTxH3vwOD7BplBa aCeAOUou4hezoK9fsbQZHRbAyJQR+X4BYoFYpAx09jbExZ7B6+R3HQjK27y0a5rlXo PVxXddTd6TeucC+J7FfpZc6X+6hS3GfO+uiEBgsw= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200923132552eucas1p2e90bb315630d9d1eb37ea82254f063ea~3bI6Z3JxB1223412234eucas1p2R; Wed, 23 Sep 2020 13:25:52 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id A8.84.05997.0EC4B6F5; Wed, 23 Sep 2020 14:25:52 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200923132551eucas1p214a5f78c61e891c5e7b6cddc038d0e2e~3bI5-iett2291022910eucas1p2l; Wed, 23 Sep 2020 13:25:51 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200923132551eusmtrp1eaa5cd8ab7c3ecb4c91d3b2fd2bf8ad5~3bI5_-DXL3190431904eusmtrp1J; Wed, 23 Sep 2020 13:25:51 +0000 (GMT) X-AuditID: cbfec7f4-677ff7000000176d-69-5f6b4ce0c461 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 6E.FA.06017.FDC4B6F5; Wed, 23 Sep 2020 14:25:51 +0100 (BST) Received: from Padamandas.fritz.box (unknown [106.210.88.70]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200923132551eusmtip2f7688535bb01670e978cd5c685e3a16f~3bI5WIR2G2716727167eusmtip2g; Wed, 23 Sep 2020 13:25:51 +0000 (GMT) From: Lukasz Wojciechowski To: David Hunt , Bruce Richardson Cc: dev@dpdk.org, l.wojciechow@partner.samsung.com, stable@dpdk.org Date: Wed, 23 Sep 2020 15:25:41 +0200 Message-Id: <20200923132541.21417-9-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200923132541.21417-1-l.wojciechow@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMIsWRmVeSWpSXmKPExsWy7djP87oPfLLjDc7e5ra4screom/SRyaL d5+2M1k861nHaPGv4w+7A6vHrwVLWT0W73nJ5HHw3R6mAOYoLpuU1JzMstQifbsEroyLx36z FhyWqnjz6zxTA+M20S5GTg4JAROJH9c62LsYuTiEBFYwSmza0AjlfGGU2Nr+jhXC+cwoMWH6 c8YuRg6wlr5pfiDdQgLLGSXuXOCEsD8xSlz5rgtiswnYShyZ+ZUVxBYRCJNobt7LAtLKLOAs 8eQrG0hYWMBNonfheiYQm0VAVeJe8wOw6bwCrhL7rrJD3CYvsXrDAWYQmxOo/MOP94wg10gI XGaT6Fh7lBWiyEVi5cRzzBC2sMSr41ugmmUkTk/uYYFo2MYocfX3T6ju/YwS13tXQFVZSxz+ 95sN4jhNifW79CHCjhI7jx9hhniXT+LGW0GQMDOQOWnbdKgwr0RHmxBEtZ7E056pjDBr/6x9 wgJR4iFx8ZY5JACvMkqc/naaeQKj/CyEXQsYGVcxiqeWFuempxYb5aWW6xUn5haX5qXrJefn bmIERv3pf8e/7GDc9SfpEKMAB6MSDy+Hbna8EGtiWXFl7iFGCQ5mJRFep7On44R4UxIrq1KL 8uOLSnNSiw8xSnOwKInzGi96GSskkJ5YkpqdmlqQWgSTZeLglGpgnJTY53dZqbHa5mLs62cs S2UXNkbqZzEm68xkelm2uDXDqIuvqMiWT/qMz526msc9m767sgYs2p6j2fWoOdzeyN9o3yy+ xakHf5hvXspcX17kcmcpm9xx3wu/LSrmlGiGe5UI2rVFzmy8+HvvoqdTjrEf2ClqXXnue9+i tQcDZojUTax0C56uxFKckWioxVxUnAgALRWRifYCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrGLMWRmVeSWpSXmKPExsVy+t/xe7r3fbLjDV7s1LG4screom/SRyaL d5+2M1k861nHaPGv4w+7A6vHrwVLWT0W73nJ5HHw3R6mAOYoPZui/NKSVIWM/OISW6VoQwsj PUNLCz0jE0s9Q2PzWCsjUyV9O5uU1JzMstQifbsEvYyLx36zFhyWqnjz6zxTA+M20S5GDg4J AROJvml+XYxcHEICSxkl3jzpYIKIy0h8uCTQxcgJZApL/LnWxQZR84FR4va604wgCTYBW4kj M7+ygtSLCIRJnFjpDxJmFnCX2LJ4KjOILSzgJtG7cD0TiM0ioCpxr/kBI0g5r4CrxL6r7BDj 5SVWbzgAVs4JVP7hx3tGiFWNjBIb37YxTmDkW8DIsIpRJLW0ODc9t9hIrzgxt7g0L10vOT93 EyMwDLcd+7llB2PXu+BDjAIcjEo8vBy62fFCrIllxZW5hxglOJiVRHidzp6OE+JNSaysSi3K jy8qzUktPsRoCnTURGYp0eR8YIzklcQbmhqaW1gamhubG5tZKInzdggcjBESSE8sSc1OTS1I LYLpY+LglGpgvCTvauZ1WH9mzH3G652+Vae0P3Be9hfd+CFkco7695IFF9V0n68WrOQ7sLFy U5nupztKQn/nuPw15/P1mtmiEP23QVOy+fweVkbl8tkxCdXvHn3cm+UjmhLM+V3707rL16TC 2BNN1ju0BE6tK6pTWfakqlvApmdV6Ru+b56R1Wp9639enduvxFKckWioxVxUnAgA43iJL1kC AAA= X-CMS-MailID: 20200923132551eucas1p214a5f78c61e891c5e7b6cddc038d0e2e X-Msg-Generator: CA X-RootMTR: 20200923132551eucas1p214a5f78c61e891c5e7b6cddc038d0e2e X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200923132551eucas1p214a5f78c61e891c5e7b6cddc038d0e2e References: <20200923014713.16932-1-l.wojciechow@partner.samsung.com> <20200923132541.21417-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-dev] [PATCH v3 8/8] 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 --- 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,