From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0073.outbound.protection.outlook.com [104.47.37.73]) by dpdk.org (Postfix) with ESMTP id 2FD0C1B33C for ; Tue, 16 Jan 2018 18:47:57 +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=8FGvobLWCU7mn0FQdMAEP/1KIneNetePNCZ5A7eK2ig=; b=JT5/woCt+gIyAQoLdHdLMAt4UeoY9wIZugkhxMhsBL9PFW4zEGEFUXu6GVKXegonFoeK8/U4b5ydOZu6/hB/GUYfRBJhxtSd+rWVfiYGjL91zsKdyD7FF9SxdoqYKN+Q+d+qPPVE+sYQrgLJ4+ImUDa9FWjalrm+7UIj+03UMzs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from localhost.localdomain (111.93.218.67) by CY4PR07MB3464.namprd07.prod.outlook.com (10.171.252.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Tue, 16 Jan 2018 17:47:49 +0000 From: Pavan Nikhilesh To: jerin.jacob@caviumnetworks.com, santosh.shukla@caviumnetworks.com, harry.van.haaren@intel.com, gage.eads@intel.com, hemant.agrawal@nxp.com, nipun.gupta@nxp.com, liang.j.ma@intel.com Cc: dev@dpdk.org, Pavan Nikhilesh Date: Tue, 16 Jan 2018 23:15:59 +0530 Message-Id: <20180116174607.10821-7-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180116174607.10821-1-pbhagavatula@caviumnetworks.com> References: <20171130072406.15605-1-pbhagavatula@caviumnetworks.com> <20180116174607.10821-1-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: HK2PR02CA0158.apcprd02.prod.outlook.com (10.171.30.18) To CY4PR07MB3464.namprd07.prod.outlook.com (10.171.252.145) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 20b936f0-6021-4793-9fbe-08d55d094489 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:CY4PR07MB3464; X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3464; 3:3VZbMRjJkxNYtd0Lb2Ls/YYm85WkdU6igyg/dv394L+mZxx7g9q+4yhUkZNsb9XuT0rt10LfkM5LkZkKNmeNFPyggWX7MHBr75L4X2PaBEOIno8630/U2pk5aAo48fO27izQc7BU3iuwRLORCY9s+H4O4X770mICzr+PEZ9dATqOzsEbYJdobHT7brvEbcadAgBe0ktdSt+NxryxndWcQdKOvf/OL2ZH3xXe5qjaxmAvuRwA9NJzuF7y0tfg84Um; 25:2FDzAfOg8hjR9RvpHmjeErfeRP6X3Ac2Sv2i1qPF/OHiuJNJoWuoRAxe26NMZtKmqrUUR3P0BbBd4Nrf9fV40XrOOrKm/uKE0GXQhvKvctrDaVtjOok6XRP4X46KSaEKydKfQm56lbGFVVNY63g/zjsYUT3zOByuzBdCPkng7TXj2YFJ308NNcUshz87p/vTVrRXs/CASQ6ozsjfR0qEvPF4QpNdSoU4Eug+XO9N80lDHvnyMEod2Mmq/YNqmowDx38YUlYbNc9pNJQvgqivC9tm//zm5PGaem9b51ImB/6R7TGyQq+2CNkIC+PgZ7SsLa5NQAQYQ9wDRerqXYQQvw==; 31:akFRkJrWrCs0LuJhGG2X4TetIrBkcI2OJSYW+sCcu1PYOG5GMZSqxT3styFtSl4RnOKn502SFE/fHmVsHys5Baj3fhOJXOH8eFcKs3JScv0YWxH4wYqyPiJ2ot8XzoXcfGQndxjIo11g6b3BEOjoN6okz9NXd5Vq4NyLPBFyMvne4bfrnkdJXTP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am-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(3231023)(944501161)(93006095)(3002001)(10201501046)(6041268)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123562045)(20161123558120)(6072148)(201708071742011); SRVR:CY4PR07MB3464; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:CY4PR07MB3464; X-Forefront-PRVS: 0554B1F54F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(346002)(366004)(39860400002)(376002)(39380400002)(396003)(189003)(199004)(81166006)(97736004)(8676002)(6116002)(5009440100003)(52116002)(305945005)(8936002)(107886003)(1076002)(51416003)(81156014)(25786009)(8656006)(4326008)(575784001)(50466002)(6486002)(5660300001)(3846002)(7736002)(50226002)(16526018)(68736007)(106356001)(26005)(76176011)(53936002)(6512007)(59450400001)(47776003)(48376002)(16586007)(386003)(6506007)(66066001)(72206003)(2950100002)(36756003)(2906002)(105586002)(478600001)(316002)(6666003)(42882006)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR07MB3464; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A: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; CY4PR07MB3464; 23:MYceGj1d3cHyzLIHqeh/j2EGXfs/p6wpfrjDxhhNr?= =?us-ascii?Q?N6EmQntsfUO4NuiwVeR8XNq/cRxPTxSF2NGcz/50HdtxmPc2Z/SOrt8f3YOV?= =?us-ascii?Q?DKT08jpleHiyAoLnsQDC1+ecVDOoGb1UZoBUTu+ZxXfARXYvbBoQm5vzzP7K?= =?us-ascii?Q?gLF1xlEp6DcoJIf1UADKQ6dlj+5FKcu9hgjy7UZ+oNi7ME9JABCsPASUZeEn?= =?us-ascii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4DnPwx0emH/BX0UsnxWKnZIo1qSffYanGt2YZplSEMIo20ut/Mxy2IV3E0FHr7Fbud7sHe0YetBOIBVeDyI2lp6N SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2018 17:47:49.2033 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 20b936f0-6021-4793-9fbe-08d55d094489 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR07MB3464 Subject: [dpdk-dev] [PATCH v7 07/15] app/eventdev: add Tx service setup 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: Tue, 16 Jan 2018 17:47:57 -0000 Setup one port event port for Tx and link the respective event queue. Register the Tx function as a service to be called from a service core. The Tx function dequeues the events from the event queue and transmits the packet to its respective ethernet port. Signed-off-by: Pavan Nikhilesh Acked-by: Harry van Haaren --- app/test-eventdev/test_pipeline_common.c | 119 +++++++++++++++++++++++++++++++ app/test-eventdev/test_pipeline_common.h | 19 ++++- 2 files changed, 136 insertions(+), 2 deletions(-) diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c index 63f54daef..98df423ae 100644 --- a/app/test-eventdev/test_pipeline_common.c +++ b/app/test-eventdev/test_pipeline_common.c @@ -5,6 +5,58 @@ #include "test_pipeline_common.h" +static int32_t +pipeline_event_tx_burst_service_func(void *args) +{ + + int i; + struct tx_service_data *tx = args; + const uint8_t dev = tx->dev_id; + const uint8_t port = tx->port_id; + struct rte_event ev[BURST_SIZE + 1]; + + uint16_t nb_rx = rte_event_dequeue_burst(dev, port, ev, BURST_SIZE, 0); + + if (!nb_rx) { + for (i = 0; i < tx->nb_ethports; i++) + rte_eth_tx_buffer_flush(i, 0, tx->tx_buf[i]); + return 0; + } + + for (i = 0; i < nb_rx; i++) { + struct rte_mbuf *m = ev[i].mbuf; + rte_eth_tx_buffer(m->port, 0, tx->tx_buf[m->port], m); + } + tx->processed_pkts += nb_rx; + + return 0; +} + +static int32_t +pipeline_event_tx_service_func(void *args) +{ + + int i; + struct tx_service_data *tx = args; + const uint8_t dev = tx->dev_id; + const uint8_t port = tx->port_id; + struct rte_event ev; + + uint16_t nb_rx = rte_event_dequeue_burst(dev, port, &ev, 1, 0); + + if (!nb_rx) { + for (i = 0; i < tx->nb_ethports; i++) + rte_eth_tx_buffer_flush(i, 0, tx->tx_buf[i]); + return 0; + } + + struct rte_mbuf *m = ev.mbuf; + rte_eth_tx_buffer(m->port, 0, tx->tx_buf[m->port], m); + tx->processed_pkts++; + + return 0; +} + int pipeline_test_result(struct evt_test *test, struct evt_options *opt) { @@ -151,6 +203,10 @@ pipeline_ethdev_setup(struct evt_test *test, struct evt_options *opt) } t->mt_unsafe |= mt_state; + t->tx_service.tx_buf[i] = + rte_malloc(NULL, RTE_ETH_TX_BUFFER_SIZE(BURST_SIZE), 0); + if (t->tx_service.tx_buf[i] == NULL) + rte_panic("Unable to allocate Tx buffer memory."); rte_eth_promiscuous_enable(i); } @@ -271,12 +327,75 @@ pipeline_event_rx_adapter_setup(struct evt_options *opt, uint8_t stride, return ret; } +int +pipeline_event_tx_service_setup(struct evt_test *test, struct evt_options *opt, + uint8_t tx_queue_id, uint8_t tx_port_id, + const struct rte_event_port_conf p_conf) +{ + int ret; + struct rte_service_spec serv; + struct test_pipeline *t = evt_test_priv(test); + struct tx_service_data *tx = &t->tx_service; + + ret = rte_event_port_setup(opt->dev_id, tx_port_id, &p_conf); + if (ret) { + evt_err("failed to setup port %d", tx_port_id); + return ret; + } + + if (rte_event_port_link(opt->dev_id, tx_port_id, &tx_queue_id, + NULL, 1) != 1) { + evt_err("failed to link queues to port %d", tx_port_id); + return -EINVAL; + } + + tx->dev_id = opt->dev_id; + tx->queue_id = tx_queue_id; + tx->port_id = tx_port_id; + tx->nb_ethports = rte_eth_dev_count(); + tx->t = t; + + /* Register Tx service */ + memset(&serv, 0, sizeof(struct rte_service_spec)); + snprintf(serv.name, sizeof(serv.name), "Tx_service"); + + if (evt_has_burst_mode(opt->dev_id)) + serv.callback = pipeline_event_tx_burst_service_func; + else + serv.callback = pipeline_event_tx_service_func; + + serv.callback_userdata = (void *)tx; + ret = rte_service_component_register(&serv, &tx->service_id); + if (ret) { + evt_err("failed to register Tx service"); + return ret; + } + + ret = evt_service_setup(tx->service_id); + if (ret) { + evt_err("Failed to setup service core for Tx service\n"); + return ret; + } + + rte_service_runstate_set(tx->service_id, 1); + + return 0; +} + + void pipeline_ethdev_destroy(struct evt_test *test, struct evt_options *opt) { int i; RTE_SET_USED(test); RTE_SET_USED(opt); + struct test_pipeline *t = evt_test_priv(test); + + if (t->mt_unsafe) { + rte_service_component_runstate_set(t->tx_service.service_id, 0); + rte_service_runstate_set(t->tx_service.service_id, 0); + rte_service_component_unregister(t->tx_service.service_id); + } for (i = 0; i < rte_eth_dev_count(); i++) { rte_event_eth_rx_adapter_stop(i); diff --git a/app/test-eventdev/test_pipeline_common.h b/app/test-eventdev/test_pipeline_common.h index f8c46c0d7..acbf688fb 100644 --- a/app/test-eventdev/test_pipeline_common.h +++ b/app/test-eventdev/test_pipeline_common.h @@ -19,6 +19,8 @@ #include #include #include +#include +#include #include "evt_common.h" #include "evt_options.h" @@ -33,6 +35,17 @@ struct worker_data { struct test_pipeline *t; } __rte_cache_aligned; +struct tx_service_data { + uint8_t dev_id; + uint8_t queue_id; + uint8_t port_id; + uint32_t service_id; + uint64_t processed_pkts; + uint16_t nb_ethports; + struct rte_eth_dev_tx_buffer *tx_buf[RTE_MAX_ETHPORTS]; + struct test_pipeline *t; +} __rte_cache_aligned; + struct test_pipeline { /* Don't change the offset of "done". Signal handler use this memory * to terminate all lcores work. @@ -45,8 +58,7 @@ struct test_pipeline { uint64_t outstand_pkts; struct rte_mempool *pool; struct worker_data worker[EVT_MAX_PORTS]; - struct rte_eth_dev_tx_buffer *tx_buf[RTE_MAX_ETHPORTS]; - rte_spinlock_t tx_lk[RTE_MAX_ETHPORTS]; + struct tx_service_data tx_service; struct evt_options *opt; uint8_t sched_type_list[EVT_MAX_STAGES] __rte_cache_aligned; } __rte_cache_aligned; @@ -57,6 +69,9 @@ int pipeline_test_setup(struct evt_test *test, struct evt_options *opt); int pipeline_ethdev_setup(struct evt_test *test, struct evt_options *opt); int pipeline_event_rx_adapter_setup(struct evt_options *opt, uint8_t stride, struct rte_event_port_conf prod_conf); +int pipeline_event_tx_service_setup(struct evt_test *test, + struct evt_options *opt, uint8_t tx_queue_id, + uint8_t tx_port_id, const struct rte_event_port_conf p_conf); int pipeline_mempool_setup(struct evt_test *test, struct evt_options *opt); int pipeline_event_port_setup(struct evt_test *test, struct evt_options *opt, uint8_t *queue_arr, uint8_t nb_queues, -- 2.14.1