From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0056.outbound.protection.outlook.com [104.47.38.56]) by dpdk.org (Postfix) with ESMTP id 7648C2B89 for ; Thu, 7 Dec 2017 21:39:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=2TU3JOFhhycjQEOPVxtT7mMfRIAMTe4CxmAVMb2EHDs=; b=WjtN4E1YIRcCUdZf1BnVpwuY4PFMXSnM7qOswklE1nHjyBRzCPWnxYRw2soxdZlo0mh5rgcY51kERSMQd48V+Z4RShHtYpqeiit19kqGs21EoFjwcamAWf0v5+d2XHY26CbjyyESUf7kBTz7UF8DKgrxjwNEU8mBdq08VgiqGS8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from localhost.localdomain (111.93.218.67) by DM5PR07MB3468.namprd07.prod.outlook.com (10.164.153.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.282.5; Thu, 7 Dec 2017 20:39:02 +0000 From: Pavan Nikhilesh To: gage.eads@intel.com, jerin.jacobkollanukkaran@cavium.com, harry.van.haaren@intel.com, nikhil.rao@intel.com, hemant.agrawal@nxp.com, liang.j.ma@intel.com Cc: dev@dpdk.org, Pavan Nikhilesh Date: Fri, 8 Dec 2017 02:07:00 +0530 Message-Id: <20171207203705.25020-9-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171207203705.25020-1-pbhagavatula@caviumnetworks.com> References: <20171207203705.25020-1-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: PS1PR0601CA0101.apcprd06.prod.outlook.com (10.170.176.155) To DM5PR07MB3468.namprd07.prod.outlook.com (10.164.153.23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 33ab45f6-d701-43a9-827e-08d53db290b5 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603304); SRVR:DM5PR07MB3468; X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3468; 3:cujXE1BZRXlzvXwEvb35f6zPoYmv0AOyfK5ESb2h1bxYmEDhrIj+9OCQ0aXa3xC/SyZFAA83TtYcgQ5x7kdK2A8KfepoiVgoHgSgizTimqlmv18NWXgZVCI8m8ozluyO6/9uG3nyVJGABFgC4hHxaAFHZoluNfVY6IEFr8p07iUWGbGsb/0cHnGfe/QwCOjf1rZ4GLvL0s1WB+5oRaMFqUeB10V62vpERlKzzf+VcryTrFmd9QjKeZ+WOoyjS1ef; 25:SgeDJKmIP7jAjlVM2B3JwDvjglk7pFTD+5SjX9mhLP8fB1pcDsCaMKpC1Uz+J+5OGFeidIrPjT/cejVWxyv0dfav6MwAm+w6nKJIGG4HRuIr1nlDGD7Bzq8P+GXn1TnxgASWA5l93hMHg18jIgwjj+hrTFPUn3m84j9WP0tEizHgJjg2wyjQpKV6r4h6kzj60cd/Pdtwe4bGcw1+9iYHdeZolVZ5lrNpdSXDqdX+iKXDuQQsSrRNZA3co8f2QYHXq4lbXn7wbpQDTyJ/oOXOBgW3MW/OnbbHdgcnSGeCdvCuxRYk9dFYshq9Lo7zy1iF1zP29r2XbfKNqV7hN07Kjg==; 31:oviaRwm0otyrzta9eiU+IBE21D8VKy5MjmTFdjIIXLaK9d1tLGwCO6XKdgEwiWMh2EJ9QXgdW0Lti2vD9KAL1fUJ1ZQvCt+T75xiLOBCELsVkWnNbC4I8FC3Irta5HJ3A/7RXA+YHs7d+vaiwP50IZMzZ/MqP4HXUzDIe2rUJccNO8dV8WKFFwgCZOppzo4uMBOLYKoYpUJCHrHFWeBzcMfxsmCOSNu6nKJpa3EezyY= X-MS-TrafficTypeDiagnostic: DM5PR07MB3468: X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3468; 20:W2rVxF8QBt6oEMBrCOSFbdkzPmYqaz0p3bHG6dFsKQmV98bWkqx364USSumq1IW/QKDxxUIgyitfyZ1allo6HGo6v1Fi6DxrrdkV2Sve24H5Dt4pZW4TjTHj13GyCDpNbs2Mt4Yo73kviU/2Le1xqVLM9vy2OEJIl5dkNn1UUuKkZjXbRfGg1G3Ib8YJ8wUS0G/7StvNTCxggr8fmnte4+2rY3AeniLMWcfZAXEC8OVF2+WgyJFSg1xE9yKYJ7phiWJFAEH7LIZz6geS8KM2wEGs3BqteQDI7zTr0g9Ew+tfpfjd429uOccPJoVH5NMR9erZLIzie1w62ACbx3aRSF0Zf7j2NUF9bF3KVZHWm4i5W+hMzzEv+1vsFQSlaef9Nnr+2YhF1WfEw3hBBpZBchR/7G+GvCXj99ImiMpAZF/laUqLgz1jHkBGbkD+E0lnbo4oxHCYATCSEGASh+BFPVc8icwKtazbdAfwFvESuHZ9ZonN9yKcodTtFyEIX8H/nWjhcf3UabQPf0WzKL7vOEvme84IvQHrUCOv1v790Xfcs1WkncenYR4T0JIUkoR7tfEQ6q/JOdfc+E2amp0FX6j5L4Wb+H7/KELGOZSPtwA=; 4:7ibOBaBbdiEAZLLSy7+OKjo3fxoEsb/dIKXO/v7TvDGMaUTNA7cmMg7i+Nctu2Te+SWo+5PMGAR9XLlLGrt8YUldSUPBT567IXiO7rM/0Rc0WbePuBfnPD6BrS9sRKkAsJZyJvlod5zD7R+SGKsFVVSrqTefY3G3U7Z9oOpHyH/x0Ntp0ejbAhBwn/xdhdu/Dfiok04yks/Rw0IGbALwZqkUPxbVgROpopTJhKKAbCn00fRYVw1J2hRmd72EI/Vz7r0cEov6BO6P5bq44cCefg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(5005006)(8121501046)(93006095)(3002001)(10201501046)(3231022)(6041248)(20161123560025)(20161123564025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123555025)(6072148)(201708071742011); SRVR:DM5PR07MB3468; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:DM5PR07MB3468; X-Forefront-PRVS: 05143A8241 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(376002)(366004)(346002)(199004)(189003)(8676002)(2950100002)(42882006)(2906002)(50226002)(5009440100003)(305945005)(81156014)(8936002)(97736004)(5660300001)(101416001)(33646002)(478600001)(7736002)(81166006)(68736007)(107886003)(4326008)(25786009)(16526018)(50466002)(16586007)(48376002)(106356001)(6506006)(6486002)(6116002)(105586002)(3846002)(51416003)(76176011)(47776003)(72206003)(52116002)(8656006)(316002)(66066001)(1076002)(53936002)(6512007)(36756003)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR07MB3468; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR07MB3468; 23:OjomEKjy0d86xoq3u/EPNJplthP+vCUfDLKZiC9jU?= =?us-ascii?Q?PqX1755fpYZkZYQZF4KLjKmyL3c8yT5m/oWtarxECAoS0RE1BavEfEYjFjj7?= =?us-ascii?Q?cjEKoluP6uiWmRkrc8RS/QPYEgSyb9Iso45A9r2G1+d54L/yYArLLHVUsQPC?= =?us-ascii?Q?efY2JOPiguKWIbFDP4d5nbyudIPELprV6ruIK5QZ0TJKdatDsUwXAZW+uvav?= =?us-ascii?Q?uqtMa48LIJq/PO1J/g63WcgoKvjXTZ4CsffawigAGY7LGhW0FahUXjOFCuwt?= =?us-ascii?Q?oeTcwUmH0XYYmc818yGAChmy704+TFCER6gtuX6suejow0HorXX0BRXLj1JT?= =?us-ascii?Q?LlLmk6losRlYGCihKMe2owKeZZH7JlAA9VHnIMcgyQ/ORRSVNagp8e5FqmYH?= =?us-ascii?Q?mYVquzJFBl2Am12ptesKpt0Y5BcpgMf5r04zAnRlIrgrP40Dw8nlmYQ2vW8B?= =?us-ascii?Q?xLjbvTVpHEWsP6uHAZl+oI7AH0YummdrGDAt8aKnyR7dzeCnXG6bDCWBnwx7?= =?us-ascii?Q?brxgOQcO2gZHvzH5gfNA3TYYV4+v+ecopri5QRe/0JDj5iomBsD7c5g9F37o?= =?us-ascii?Q?4krTqsh90bSMz/B1UprAW2GG6/+iuclJCUSdkOkRgM2MsCZH0V3vIGhojdEz?= =?us-ascii?Q?PSHrZQzCmN6aF6KO7l9ISqAaMD1P9nibvwmk6p92Z3xKGxcpKSCcJ2dt9ZC9?= =?us-ascii?Q?tj/u7nlhfEvyQfYGo13CbmKhuS1ZnN29TIqpUvZgFAyXSagVg21Cq2dnWj0x?= =?us-ascii?Q?SOd87M825LQFjsSJzMFhbeHg3TAwARW5JmZhwAchsbF+DSrC//WcGUYz4U2j?= =?us-ascii?Q?KCuEikuOzqd1Lh8JQoBkHx59jahpk5KAAqa868snAtQO4mxUQIW/rTAAwFHv?= =?us-ascii?Q?SRXdwXqADjFlbHk1B8PX8MC4do8sXvqSQscA+jmyb1GmM72sXf4V02QzZ3GN?= =?us-ascii?Q?NypZ9iDdQSvfmOZ9BrW3Rj18wwYqfRLVwcobWS9ctByI/w5J4CJJ4yzwZb9V?= =?us-ascii?Q?bh4Y0NxkIhN2trN9X91IppB+LHmUvDBR0E9n+WVJqoGz4qFYfaYs3eWFyLq8?= =?us-ascii?Q?n5584OpzluNnNfykWR8A9562dXMKbLkfjG7+xnT6nIJFR90MvaZKk9xqJDPa?= =?us-ascii?Q?6cquz+ghON6aITJPKeK/R85y/TFAyNo?= X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3468; 6:bfqNEVcQUJqjLHHC4oA46MKmcOzEdpHUqs1R/ZtoFHI6B7gbJr3fB5eRKjBBPZwmhQrLIaktGuieyHb1oFRuU/yZCyefvseXmA05EQiF14INiSdBTWGTyMMDTFYCe84ownapKbOBVzUfVGYKumPi7y9lA5ICszFm+5UCCqDkpU1AniudCQsmnC7aOJMj6jyNBnpx17pc3xf0Ky6RVJQuOA42ooLbKDJsSM8N48sjSZ7Zw2O+mqne0F5TQyKpl7YBS9mDmtjern5XQYym6nIrsOqCIVHWYNYK96OQ1JQWKWLek6JqdAMQvQAiShucLpEcedykQeK8cQPQw4SAUWYIu5C3b0rvdEhzNh2BXRsibnE=; 5:jPvJj/7ynUxv+9oaJamBcchaVYBSjyAfU49XrgGH7PqvVpeVH3eHjCVe0isToTlVqhDwgGuCaEtm2+J6uaFBZK0LM8BOZmfu5Gt05Abaod8H7nPmN6+PX8N8nidTJM7xAAOFlEB3eGcg6keX2RyjHlsQIqgl/SaUXkCE73/l14g=; 24:Fccyak/adamtR52YN0X0w2P3MtFIYEFxUsSVATfO8DFx2LqXGI16FWXo/mo2DmIFTTzutJLohOrPaPH5cKTwfMZ7BxAgf6iz9SKR7uQ6Ik0=; 7:2kgVdkkc57A9UcP7IPS7zwCgOMZ6Hfqa2HYYlRf7GEbg6gXS3uJ93ehXlxRaH0LSs9GM1nzx/8zJ9+kkdWbIEyjuANHySUfvK7fNTNSilpcNKc9eUqjpzyrWgecF9O8TRvrc9CgoS0DRvzl+ZGbYB1jKExmRZA9w+QkoiyiPr49DUbbB1wlu5VacJr8ZyLQJtwo8jwDeskZD5GW23JLESCR9ZlRInZ8YIDAZJZ9FvhetU+XeKp64baQ4dLC9FcI2 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Dec 2017 20:39:02.6892 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 33ab45f6-d701-43a9-827e-08d53db290b5 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR07MB3468 Subject: [dpdk-dev] [PATCH 08/13] examples/eventdev: add burst for thread safe pipeline X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Dec 2017 20:39:10 -0000 Add burst mode worker pipeline when Tx is multi thread safe. Signed-off-by: Pavan Nikhilesh --- .../eventdev_pipeline_sw_pmd/pipeline_worker_tx.c | 78 +++++++++++++++++++++- 1 file changed, 76 insertions(+), 2 deletions(-) diff --git a/examples/eventdev_pipeline_sw_pmd/pipeline_worker_tx.c b/examples/eventdev_pipeline_sw_pmd/pipeline_worker_tx.c index 31b7d8936..a824f1f49 100644 --- a/examples/eventdev_pipeline_sw_pmd/pipeline_worker_tx.c +++ b/examples/eventdev_pipeline_sw_pmd/pipeline_worker_tx.c @@ -48,6 +48,19 @@ worker_event_enqueue(const uint8_t dev, const uint8_t port, rte_pause(); } +static __rte_always_inline void +worker_event_enqueue_burst(const uint8_t dev, const uint8_t port, + struct rte_event *ev, const uint16_t nb_rx) +{ + uint16_t enq; + + enq = rte_event_enqueue_burst(dev, port, ev, nb_rx); + while (enq < nb_rx) { + enq += rte_event_enqueue_burst(dev, port, + ev + enq, nb_rx - enq); + } +} + static __rte_always_inline void worker_tx_pkt(struct rte_mbuf *mbuf) { @@ -106,6 +119,65 @@ worker_do_tx(void *arg) return 0; } +static int +worker_do_tx_burst(void *arg) +{ + struct rte_event ev[BATCH_SIZE]; + + struct worker_data *data = (struct worker_data *)arg; + uint8_t dev = data->dev_id; + uint8_t port = data->port_id; + uint8_t lst_qid = cdata.num_stages - 1; + size_t fwd = 0, received = 0, tx = 0; + + while (!fdata->done) { + uint16_t i; + const uint16_t nb_rx = rte_event_dequeue_burst(dev, port, + ev, BATCH_SIZE, 0); + + if (nb_rx == 0) { + rte_pause(); + continue; + } + received += nb_rx; + + for (i = 0; i < nb_rx; i++) { + const uint8_t cq_id = ev[i].queue_id % cdata.num_stages; + + if (cq_id >= lst_qid) { + if (ev[i].sched_type == + RTE_SCHED_TYPE_ATOMIC) { + worker_tx_pkt(ev[i].mbuf); + tx++; + ev[i].op = RTE_EVENT_OP_RELEASE; + continue; + } + ev[i].queue_id = (cq_id == lst_qid) ? + cdata.next_qid[ev[i].queue_id] : + ev[i].queue_id; + + worker_fwd_event(&ev[i], + RTE_SCHED_TYPE_ATOMIC); + } else { + ev[i].queue_id = cdata.next_qid[ + ev[i].queue_id]; + worker_fwd_event(&ev[i], + cdata.queue_type); + } + work(ev[i].mbuf); + } + worker_event_enqueue_burst(dev, port, ev, nb_rx); + + fwd += nb_rx; + } + + if (!cdata.quiet) + printf(" worker %u thread done. RX=%zu FWD=%zu TX=%zu\n", + rte_lcore_id(), received, fwd, tx); + + return 0; +} + static int setup_eventdev_w(struct prod_data *prod_data, struct cons_data *cons_data, @@ -422,8 +494,10 @@ opt_check(void) void set_worker_tx_setup_data(struct setup_data *caps, bool burst) { - RTE_SET_USED(burst); - caps->worker_loop = worker_do_tx; + if (burst) + caps->worker_loop = worker_do_tx_burst; + if (!burst) + caps->worker_loop = worker_do_tx; caps->opt_check = opt_check; caps->consumer_loop = NULL; -- 2.14.1