From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0060.outbound.protection.outlook.com [104.47.42.60]) by dpdk.org (Postfix) with ESMTP id 0C3921B015 for ; Wed, 10 Jan 2018 12:11:12 +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=7Q4u41e9xcPGrbLMeBld9WUaP2Mq9Wck8+fO8pcres8=; b=nVh8aUib+Df3WdZ3weQxOhWWKqnRAR8VFRQntIX/6AFPnUsGhZ7Ve7ZbCLXJ9pYOx63XS+8YI49/lvviZslZ2yh9S/EPHuYOP2vRbyA6/uUC6YY7JRn6cYbggrMRmay/hl8n939AQLG3gy9QRRlu6dq4xG8sc9QQpfHuMggLU/M= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from Pavan-LT.caveonetworks.com (111.93.218.67) by MWHPR07MB3469.namprd07.prod.outlook.com (10.164.192.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Wed, 10 Jan 2018 11:11:09 +0000 From: Pavan Nikhilesh To: gage.eads@intel.com, jerin.jacobkollanukkaran@cavium.com, harry.van.haaren@intel.com, hemant.agrawal@nxp.com, liang.j.ma@intel.com, santosh.shukla@caviumnetworks.com Cc: dev@dpdk.org, Pavan Nikhilesh Date: Wed, 10 Jan 2018 16:40:09 +0530 Message-Id: <20180110111013.14644-11-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180110111013.14644-1-pbhagavatula@caviumnetworks.com> References: <20171207203705.25020-1-pbhagavatula@caviumnetworks.com> <20180110111013.14644-1-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: CY4PR1701CA0010.namprd17.prod.outlook.com (10.171.208.20) To MWHPR07MB3469.namprd07.prod.outlook.com (10.164.192.20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d625b536-70be-47c6-2b55-08d5581adb64 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603307)(7153060)(7193020); SRVR:MWHPR07MB3469; X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3469; 3:0vfmfVUF3lUTGtQm1cBARZYsi79ksBFE4sclQh/QiWQrDoJXQNVqBQGmHmLqg9lNNuhydDZgooW9r/RiiMO6VdeOy92m7tTHYUPtlFHjr9Hr6xHNn9Oi8wqXJuQVGKTxQQDzM+I/NAmj3HVVGdCEm4NV8hEcU+7TzXD0CeHJrTfa4CeS2Rgxu0djXT5EnYOkT4px53lyxPqik5K2DiOfxjTVwqX1asEsl0HBZUQgKIiQJBOnTDyw2/D9Wo0+uP9X; 25:YBXnGkqZj/yMZVTXHZKd9RviyeOrcRJ9qLNXg8ZyroXDgXnefVITdQvJgOVvKQqV5sZbVZlYqsN+0dN0Zm7lbe183tA9H7gFG4alUXFLtBWv0SDQSdls8cOxpBx/popRuqGIsZnYo0OGk2+3y1zFVerL3goIXr1MtPN9smWFop67toBfiZ1BVaE7iPzhkgDudl6uZqC6JQ5OW6kfSKDbYuuq8rf9h8BWK+lOoQkR0Y8zlPSBsvfae2W3n4vWIZSgNOqKL+En6KOp8Yrrjo/Wv62N/xPMAIvVyFvPvGhEqVF+/EAdSrsZQ/VEoi5iPeXd9tGnr8PRCpTHIJhI0ry+hQ==; 31:mZmYAefaLpbyLkeIw/DRgeFIQONF9zfCP5Aqi6pBIA/gMGUxAxjDoA/bSg49zCx7XZYkgdkyX3l15AUye6ckrgQTUI50ybALRPf5oaunBRRZeP9VO8KEvB7mNuJdfzagVUymy0g3fqehg8+MttmhRN66sp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antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(3002001)(93006095)(10201501046)(3231023)(944501075)(6041268)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123564045)(20161123562045)(6072148)(201708071742011); SRVR:MWHPR07MB3469; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:MWHPR07MB3469; X-Forefront-PRVS: 0548586081 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(39380400002)(376002)(346002)(396003)(39860400002)(199004)(189003)(4326008)(8656006)(81156014)(316002)(81166006)(5009440100003)(53416004)(50466002)(50226002)(16586007)(8936002)(16526018)(47776003)(68736007)(66066001)(48376002)(36756003)(69596002)(25786009)(107886003)(42882006)(2950100002)(106356001)(5660300001)(51416003)(52116002)(386003)(53936002)(6636002)(105586002)(97736004)(305945005)(7736002)(8676002)(6116002)(3846002)(2906002)(478600001)(72206003)(6512007)(76176011)(6486002)(6506007)(1076002)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR07MB3469; H:Pavan-LT.caveonetworks.com; 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; MWHPR07MB3469; 23:2sG4APqWzcOrUjdqju+cgwOa7DCCd4YyXDch+sigU?= =?us-ascii?Q?3U8UwBSStQAxGj/RUfTKRyqMwxl4eF75qqJ3IhlBa9ng8XfXObdOg91QegiZ?= =?us-ascii?Q?GNpG9GUN6dt4ZMvtbTKo63kPKyMjEIFvO392ES8bZ0TUh75YLWRaQyQLuR5m?= =?us-ascii?Q?QgbxA/WwC0U3TssJtAoH2O4m1vH4qnj/QHRa9d/n61mRk1RugdQ+GZcZgyyN?= =?us-ascii?Q?dYvLX3uGE2Zo+G0eU6HqpMEkcZ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G5hMWgWDzN+t6 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2018 11:11:09.0024 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d625b536-70be-47c6-2b55-08d5581adb64 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR07MB3469 Subject: [dpdk-dev] [PATCH v2 11/15] 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: Wed, 10 Jan 2018 11:11:13 -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 | 111 ++++++++++++++++++++- 1 file changed, 107 insertions(+), 4 deletions(-) diff --git a/examples/eventdev_pipeline_sw_pmd/pipeline_worker_tx.c b/examples/eventdev_pipeline_sw_pmd/pipeline_worker_tx.c index 25eabbd6c..21985b00d 100644 --- a/examples/eventdev_pipeline_sw_pmd/pipeline_worker_tx.c +++ b/examples/eventdev_pipeline_sw_pmd/pipeline_worker_tx.c @@ -43,6 +43,90 @@ 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.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(); + } + + 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 @@ -617,15 +701,33 @@ get_worker_loop_non_burst(uint8_t atq) return worker_do_tx; } -void -set_worker_tx_setup_data(struct setup_data *caps, bool burst) +static worker_loop +get_worker_single_stage(bool burst) +{ + if (burst) + return worker_do_tx_single_burst; + + return worker_do_tx_single; +} + +static worker_loop +get_worker_multi_stage(bool burst) { uint8_t atq = cdata.all_type_queues ? 1 : 0; if (burst) - caps->worker = get_worker_loop_burst(atq); + return get_worker_loop_burst(atq); + + return get_worker_loop_non_burst(atq); +} + +void +set_worker_tx_setup_data(struct setup_data *caps, bool burst) +{ + if (cdata.num_stages == 1) + caps->worker = get_worker_single_stage(burst); else - caps->worker = get_worker_loop_non_burst(atq); + caps->worker = get_worker_multi_stage(burst); memset(fdata->tx_core, 0, sizeof(unsigned int) * MAX_NUM_CORE); @@ -634,4 +736,5 @@ set_worker_tx_setup_data(struct setup_data *caps, bool burst) caps->scheduler = schedule_devices; caps->evdev_setup = setup_eventdev_worker_tx; caps->adptr_setup = init_rx_adapter; + } -- 2.15.1