From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0086.outbound.protection.outlook.com [104.47.38.86]) by dpdk.org (Postfix) with ESMTP id 8ED577D04 for ; Thu, 7 Dec 2017 21:39:24 +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=ojrDkcEV+QP+fVmJiituLEebpGz9RmPkQipBGMR9rQY=; b=NnSH9u3LhSrGQZOs/J0TpMjpbzZdIFAwCdORGpjGSEqQH99fsKM+MBmMNAOc1gkBbPBtrYfygXpLPiJDHwH23LiVhW5cEsCLrYDTc409xBGWCg3DTLg4osdb/tKh40oQdo1S5yHZ0Oxh+jlJ1Cw1Ub8p0vFeBc1W2lje3DYO04A= 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:17 +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:02 +0530 Message-Id: <20171207203705.25020-11-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: 6041e0fe-b78d-4605-c810-08d53db29872 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:U6+pzQJiDXMaCdz/ecV2npnvM8ZYRHTyvBfw/titw0loggCW8JF9otEp9w/ZCKk1IkS5RkdAyCwS/+06V3T3WpQ0QSpv6SkopjdQim7vm09WFDDAL+rvUUQK7fcBDhZZVbFX3Sli2n5Je4mpautAVaV7oZW3pL4pSY1O2TpPKRjZUoQDMddflGWvWD5rD7MYYA/m96U1j/GK45NUGItgaFX4x7shLmij3quFK9FxfutSa0d7IigJhhw3DnwCmYis; 25:1XtUXF3aw0/RV0++xNye78RWBlrlTfTC9EjhI10XRXVGK9haOnhxXvgoFCrOTJeb+L9Qw+aZIMLtdLnR9pPoGfj4wpAO2KfcYewNmOu/WWZmxmNxxbwimTj7G6y57FWjGA9mYqVRHbOfkmseYeUgWOXutVWx7jj2GIj8r15rNGapXBipYrza+y6pSZA1YK4WyOh8J/wnv5W3+I2OH0t3vTVwwbFLjIRieQ6GiBTvWFv6nUY6VTj4DGSRM2G2EIYy33kGHcOsUvHX72HJYKbqL8WD+7MVeIDf5u21VEBK+kl9kkBAp7AbJFLe2AZHCqFJLV2NQ+tM+bNnCNT7EgfiwA==; 31:olLkwRZ+UhUp9whTKj05eEGnNbtwUuPDIGbCYqo+ykHPM/a8pvhd8RI2QZ4MbiGaGt65bPIvw8CIVVe4zxLl9zPCXl8OtSLyvE9RLDaPZQFVDPACveU8qjip1r5AOq/4gsC08B4QIUPHNaH4I5I0sbhCAZOvShD1etZRJ4Ig8KK40ErhXslPiy7RFUXUxNN1vgQwuxx5kqvLG+YjmpB7EqCJqsbGiwsJHx4mEetyZTU= X-MS-TrafficTypeDiagnostic: DM5PR07MB3468: X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3468; 20:oEzOKo3UJX0c3tOCDtzWGRZ3kKLp7UZeHqPkqJ2mRoO2g8QGssRYPaZQGc8h1q0zplAZKbiSlc6r+sKuaKN5ZJ5H8p7KORlMk9hhXEoioqvnRAnPs7VvONu95b6sTRXiaffyM5UdeTKOYCn+gFEW08/X3Fsfb6DDIP6Aq8NbPnvzjKS8kFDGANQxeq/K5aSjnC8rkbta3KEsWwNT3sREUJ/pX3CubgxKAqGpRfQdZ8t5DuuaYwfcpWLEmaQAWKefSGsEY5daxU+GpqOK7HfGB5LiYUYAZDdg8cxf6UC3l2DT7TSs4oqUv/NTmcFQX5qbp9G200tTW2a8C3PocRsYMvIT25svyWozG8C2HMs/l2E39qNsAPn4ymh6//D/bOEmKXO2QC61UOeBiC4TwKTXvvBTbNjocRYf724siI2IARnKEU6dPsKql+5UmzJajwgj6xa0s5QibdXREmeJ3NKwst9JIP9H7jRp9/vvu6RbwmrTAgDAkH81uZxltr/h966huIjfxMJ5+I90MDYmkd1n6VT/LVUFRnvcmeWYrtAVJ9jnGpjvv5LY1zTDUi+LyFUdD0/1A86ORhLQjEGzrsn6d8srggjwPsb8eSHYO5UySbY=; 4:Q3kcKppgQ8h+CB6SAmnelKvh8DwCg0SBSrz6eELpMqceOx8GmRni5RWzWhjrb5hhpSSx5V+GVs8CPHLyksb8QxN167aRn+QLL/e2jT5cfokeVEGdMJVumQwW0uWDBS2Ih+wpfQHnRa2MA/a0gmGDBtQjjcD3buSFdmr8X82UjlZlbgCUGPmCiP3bZny040waypj5FaxZP+Z+w0ozT07v7rQL/JgaU+ZXylT69A4qYm9K/JrVW3R7IyE/yxS39CUS6Vfj+GtL3i7+01SxfxQ5AA== 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)(6666003)(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:PLHOiaqiLv2my4ypHMLCvI0c8TuwmwvytHI+cgqN3?= =?us-ascii?Q?Hs9EIHju4DiyVtm8p5wrdMsJ3FT/y0rGV4neo0kB+5wftY34sRSKfc2emhsM?= =?us-ascii?Q?Mye5tuHiDXnOATZUBNG/HhjP1gICqT55C8dy+wQFYZCAcx+FRTCbmK2+jGF3?= =?us-ascii?Q?7oIBSTIH2Bc54Ea7N/B6/XSQqxGeVdZ4ELSGpzf3RilGhAWdGZrgu45NcBcI?= =?us-ascii?Q?0DxPN8S8WytopD4GUXoGLR7jqJomPjlWwa13E/dFck73GMD4EkR7wUP3RjP+?= =?us-ascii?Q?buvFjKlq6WpnVhcubhbAwNmx5T3PplLPBikofqOd3NhWgx9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ostics: 1; DM5PR07MB3468; 6:8Sqahf8bI9d5/YypwB/pqbbRIkqPN/mvSR1JQYhA00kPjOhu5uU6PH8LZMpceOtbNjwJ6bmcfe2oQisBnkuHKvW+c4OqEKZbvio/Nr30vGRtk2UVF/3fAHFjA2UBDFRHC7OjS5qyWvgmfYPfdFWuMTFJh0i+/5H1+ZLaYiRFHqWrn7fDSBLt+az2JZQErC4MDUoArkxCXj5SgGEcIfIJQhQ1YUL24m5RsIftmuwvfMqUiPxwxLCOc7Kg3Otl2XDQBLEhHhL3oFkj2I4mNj3F10nh522BrzJkwc6Tqg2Cp4tJpwOpCIxh6jbN9hecpu5salPy1tED7XZUMsijBAAGL782GEJrLVcvPaMKVXfTAIQ=; 5:0Z9TSyUb7vqmJ7sBGSyAhJNDxuZohSxnkznAI050YyKof2yV4gimrPiQplwSiabxDLUZffpkiF1bIjDI9hYZ4ZvAqkTd5pZSbs8cQ4NdOXkIXQYOjLDJSAVOf554+dfY4ASRc92fVIKowUpQkejCBODibxTGI4kjLwBXfZBkRc0=; 24:+70G3WiWPnXHBKRmAjjF6Max3mRLYpD8IoGE+vL2VoT6RLLNwzzFxcBRb9oikFV2hYU6h31Pa66Z42vKcYFdLL44i0SiN7QWkwjQ9JXaHyM=; 7:lZ0PrLJVgTNIUYDHb2DoPVQoR903LSTANOuj2xLfTW+BiK1YiBC7oLdHLRuFJqN0/z7Xhn1Nw1IENkuF2G2NUtp+73I3xjI2RGFGuyqhnGaqNnDSSS7l8FIutQnP9+eNH0KvmuvLvKJtI8FtWpUX2CHjxpSqBBz7M6QLjzPwj3nFtCaWH10fXFyruvBblunMM2JwvqTFZmwKMNxsdsdX0PYGs8Asa62uBARWed34kJxBI2QD48oQuZV0sRSYMXWx SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Dec 2017 20:39:17.9081 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6041e0fe-b78d-4605-c810-08d53db29872 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 10/13] examples/eventdev: add single stage pipeline 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: , X-List-Received-Date: Thu, 07 Dec 2017 20:39:25 -0000 Add optimized eventdev pipeline when ethdev supports thread safe Tx and number of configured stages is one. Signed-off-by: Pavan Nikhilesh --- .../eventdev_pipeline_sw_pmd/pipeline_worker_tx.c | 109 +++++++++++++++++++-- 1 file changed, 101 insertions(+), 8 deletions(-) diff --git a/examples/eventdev_pipeline_sw_pmd/pipeline_worker_tx.c b/examples/eventdev_pipeline_sw_pmd/pipeline_worker_tx.c index e25a06027..15df21b7e 100644 --- a/examples/eventdev_pipeline_sw_pmd/pipeline_worker_tx.c +++ b/examples/eventdev_pipeline_sw_pmd/pipeline_worker_tx.c @@ -68,6 +68,91 @@ worker_tx_pkt(struct rte_mbuf *mbuf) rte_pause(); } +/* Single stage pipeline workers */ + +static int +worker_do_tx_single(void *arg) +{ + struct worker_data *data = (struct worker_data *)arg; + const uint8_t dev = data->dev_id; + const uint8_t port = data->port_id; + size_t fwd = 0, received = 0, tx = 0; + struct rte_event ev; + + while (!fdata->done) { + + if (!rte_event_dequeue_burst(dev, port, &ev, 1, 0)) { + rte_pause(); + continue; + } + + received++; + + if (ev.sched_type == RTE_SCHED_TYPE_ATOMIC) { + worker_tx_pkt(ev.mbuf); + tx++; + continue; + } + work(ev.mbuf); + ev.queue_id++; + worker_fwd_event(&ev, RTE_SCHED_TYPE_ATOMIC); + worker_event_enqueue(dev, port, &ev); + fwd++; + } + + 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 +worker_do_tx_single_burst(void *arg) +{ + struct rte_event ev[BATCH_SIZE + 1]; + + struct worker_data *data = (struct worker_data *)arg; + const uint8_t dev = data->dev_id; + const uint8_t port = data->port_id; + size_t fwd = 0, received = 0, tx = 0; + + while (!fdata->done) { + uint16_t i; + uint16_t nb_rx = rte_event_dequeue_burst(dev, port, ev, + BATCH_SIZE, 0); + + if (!nb_rx) { + rte_pause(); + continue; + } + received += nb_rx; + + for (i = 0; i < nb_rx; i++) { + rte_prefetch0(ev[i + 1].mbuf); + if (ev[i].sched_type == RTE_SCHED_TYPE_ATOMIC) { + + worker_tx_pkt(ev[i].mbuf); + ev[i].op = RTE_EVENT_OP_RELEASE; + tx++; + + } else { + ev[i].queue_id++; + worker_fwd_event(&ev[i], + RTE_SCHED_TYPE_ATOMIC); + } + 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; +} + /* Multi stage Pipeline Workers */ static int @@ -265,6 +350,7 @@ worker_do_tx_burst_atq(void *arg) worker_fwd_event(&ev[i], cdata.queue_type); } + work(ev[i].mbuf); } worker_event_enqueue_burst(dev, port, ev, nb_rx); @@ -610,14 +696,21 @@ set_worker_tx_setup_data(struct setup_data *caps, bool burst) { uint8_t atq = cdata.all_type_queues ? 1 : 0; - if (burst && atq) - caps->worker_loop = worker_do_tx_burst_atq; - if (burst && !atq) - caps->worker_loop = worker_do_tx_burst; - if (!burst && atq) - caps->worker_loop = worker_do_tx_atq; - if (!burst && !atq) - caps->worker_loop = worker_do_tx; + if (cdata.num_stages == 1) { + if (burst) + caps->worker_loop = worker_do_tx_single_burst; + if (!burst) + caps->worker_loop = worker_do_tx_single; + } else { + if (burst && atq) + caps->worker_loop = worker_do_tx_burst_atq; + if (burst && !atq) + caps->worker_loop = worker_do_tx_burst; + if (!burst && atq) + caps->worker_loop = worker_do_tx_atq; + if (!burst && !atq) + caps->worker_loop = worker_do_tx; + } caps->opt_check = opt_check; caps->consumer_loop = NULL; -- 2.14.1