From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0075.outbound.protection.outlook.com [104.47.41.75]) by dpdk.org (Postfix) with ESMTP id 489831B169 for ; Wed, 10 Jan 2018 12:11:06 +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=BqdOJrbCrbBA41RBn8jep6onKioHT5KQm+3OgeIam8E=; b=dd4OQjEu2UmyPW6yod0R11mgGSB0ssbeVE6mFpPuCqa8B7JXaWgO1EuE/yGNmhslJA7DGDQ0bHHZQi7oSiXRzfGBl+mRZmco/fC90tIzFM82DERCi7WtT8IQvsPTuMDkyMC+3lqKRWZtVWWhVzNJAnpRTzqGi9GI42ZzwkqVB4o= 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:02 +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:07 +0530 Message-Id: <20180110111013.14644-9-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: c42c7366-556a-45aa-9098-08d5581ad77f 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:BzdUvCaJwXs9YMuFWNQ0SIh2VxU4IxW1LH1MI/oD+6D3gCLzHTm6ZN7SVRZ70yb1EMviiVlzws3tnTuSyxEdT9j336MKTHXt8uvAEznOcS1tsqqOOoSefBkQznzxIJJZtlvWah1T3FKhE7bqMSbTPt89OpeYS46RvUOJ2AXUB2FlAHG5hMoMB3KCA3X4ZiV8yxX+iQTaZyGddhID/4isQbCkB3VR7cZ32or7EIPr+L3SqtHST3OWs2sNtVxEC+gI; 25:uQ1jpUKVuU4YoCZ2WvjwH9JwVbu4lfFALJmvJWQwDGdOJNalfH086Qj/+lfEHAlKL/CjsT/s1WwTglUg63cy1za55K4E/8XVxYGuR2Odm6q7qzcx/Wlh9fEnpJk9xckRDymJdo/qDTr+mv9yxrqY4XOJ3eAJzGizrhcO5MC3IN3RpM9Fez5quTT+W2gCV4Rk5VPx7GXMxWNNb2Ou0tyiA9UJXr+TP3CzAbuUzcIi38+yTrI9D8rhAELNGdLzgSTQSwndJwLt2EkqdLo8Bg0jCX03UEzoJN7rsmWRjeXLtbcnSw9mGpN3e4IE6TV1gMG0OjMFDvNy95Xpyw5stjPYlQ==; 31:IyC9D48cj1ze02VGdvyzZCG5jsfbfxlhlBZKaGuVGcAT7s5AiF6FcDF7PHewPE1f5Z9nzM4ex3sry/7CwLPgYRLhSBZu2N1Xj91aq0i4szArWUqsivCdvfkzgVwoDkYMdh4v94350RQ+8C82j1SYbJC3gqL8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am-PRVS: X-Exchange-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:I4EjHYpvoRxxLT6fVHEfVKaxl96Pc58Bzzi3CB0Z2?= =?us-ascii?Q?vINPpO+nAqkiwfplmI7GEb6ItVCtJwsquNaTExSpmGW9jaK9dMM360Apz+g0?= =?us-ascii?Q?0FnlBcNQuQT6awdP6euQch6XiDyTzLMOc1OUwTTfQyw+0qkKRImxncG0bu7I?= =?us-ascii?Q?sG5mteHY8PGM/z9URykekhS8/Qq0shEWjgrzGpsXgw82r2WuCsnKT4k0tx7T?= =?us-ascii?Q?6yT7RIAG33w+R4uMw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X+gPuAvKQ/4zMFr2B+k6pQckw1ALMnY SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2018 11:11:02.4085 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c42c7366-556a-45aa-9098-08d5581ad77f 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 09/15] 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: Wed, 10 Jan 2018 11:11:07 -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 | 74 +++++++++++++++++++++- 1 file changed, 72 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 397b1013f..419d8d410 100644 --- a/examples/eventdev_pipeline_sw_pmd/pipeline_worker_tx.c +++ b/examples/eventdev_pipeline_sw_pmd/pipeline_worker_tx.c @@ -22,6 +22,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) { @@ -81,6 +94,61 @@ 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(); + } + 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_worker_tx(struct cons_data *cons_data, struct worker_data *worker_data) @@ -412,8 +480,10 @@ worker_tx_opt_check(void) void set_worker_tx_setup_data(struct setup_data *caps, bool burst) { - RTE_SET_USED(burst); - caps->worker = worker_do_tx; + if (burst) + caps->worker = worker_do_tx_burst; + else + caps->worker = worker_do_tx; memset(fdata->tx_core, 0, sizeof(unsigned int) * MAX_NUM_CORE); -- 2.15.1