From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0077.outbound.protection.outlook.com [104.47.36.77]) by dpdk.org (Postfix) with ESMTP id 927E31B2E6 for ; Tue, 16 Jan 2018 16:40:55 +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=XURU0B765Ld8ufEzgmuGOklaFQw0jolB2gjOciHLLhwrcovINjN42pEDYo0aXxyxv/detE7LRXuu13z4jLuvoSYTqOd4MS1DBfZjazRBRZiy/K6CI7dsf0I0VmAZwTP6z8cu4mj0vxIW53Zefn/S9q2u55iLEQHUSCV5qu+HLy0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from Pavan-LT.caveonetworks.com (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 15:40:51 +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 21:09:56 +0530 Message-Id: <20180116154003.3762-7-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180116154003.3762-1-pbhagavatula@caviumnetworks.com> References: <20171130072406.15605-1-pbhagavatula@caviumnetworks.com> <20180116154003.3762-1-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: MWHPR02CA0016.namprd02.prod.outlook.com (10.168.209.154) To CY4PR07MB3464.namprd07.prod.outlook.com (10.171.252.145) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e3cb6a7f-fede-4d19-f85d-08d55cf78728 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:BYn6Z7eq6Otvb5UWrbfD+jPSn0ykI/I08bL2O/BUHWqrJL+gGft3fs5pbrWLzIgyGa7jGNDalNGp14maWtGmVwKOug/4WN8IhhhBB9N9BwcNh6TMXZ6ACPUKUnY9G0OiXzbalwzGIc1VFWc80bFbZzGjrvU2XVh62tbHohYYBFJBpfUQvtk4hGoTPWU0u4Xz8pXE/53qq5PA7E/X8Zr2hZb1D3yk+VeXFR2vHkOXQNrTKp+MdYCoTLL7gxFZcWVt; 25:Memfm5k16JaBdlR/mSdNyzuBgsYPzet8znLtKqGQw8EZQsdaPtDlA1p3r58NJ0LceGopYPtSPbpYsah8YjpniRDzMuhRca08Y5QtFdvSHsjMfTlgaVAVhTt1ERGRzqeHvM1qlRfmw2nyUOrJ7POVa9UufR1X1D4Nn4XlnX3tt+3cBco6HowpvzGOzA1TXguHXusCTpnXPSANlUcUrVAxDyzrffXCc5W+6iUCY8pBOmiXnjAC6kEjM5e5MrynHXPvTXnSp3y4YFrcyrC1VDW0lW5rivPGfd9WPMbuNk8MBFku1H04qhvzN3wizU8Xsa84aUdFVgLWofJ1Dj+Kuf3zBQ==; 31:cCZ0CoNi/qmLkfhtjEP0Oz0pN0hlkHZeYQIDdK8HB/BVgcH5tmRRpEKk8/7NFOyrHMzCxDbgT3wEM0GAKMZJ0y5VdF4vDoTTwhaTB58ZpLz3azRrMu0J0qU4xfY1uOpr3kEKJ28k8VqfeEF+Uiz4RqWFCqmUaz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IFhZCKeAHUedEB7hie5At9TW X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(93006095)(3231023)(944501161)(10201501046)(3002001)(6041268)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(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)(39860400002)(366004)(346002)(39380400002)(396003)(376002)(189003)(199004)(81166006)(97736004)(8676002)(6116002)(5009440100003)(52116002)(305945005)(8936002)(107886003)(1076002)(51416003)(81156014)(25786009)(8656006)(4326008)(50466002)(575784001)(50226002)(6486002)(5660300001)(3846002)(7736002)(16526018)(68736007)(69596002)(42882006)(106356001)(26005)(76176011)(53936002)(6512007)(59450400001)(47776003)(48376002)(16586007)(386003)(6506007)(66066001)(72206003)(2950100002)(36756003)(2906002)(478600001)(105586002)(316002)(53416004)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR07MB3464; H:Pavan-LT.caveonetworks.com; 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:TkSykuMAwgxUf5oMRq9aoTB+Vz3R6R9vO+xahSmZV?= =?us-ascii?Q?yLUMCI4MGQqYZfaQUtgGcHU1La2nLrvldSr6FodD301X6zMeOONxDsccwwOE?= =?us-ascii?Q?gJYj2g0YRSheTPqxe9Iy0bF9iyOR8D4UjbQEDrmH7y1yE6tQDfbs6x8bN4ev?= =?us-ascii?Q?QELd8k5qnvEA6B5parC8usq5LIvoleC2hzDbw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yn5eiHQvig54ivE42ZjCPOkYZvGn7ePjVmymynDlZ4goPGIz5SXE/sV+dEVAj/jcAc6csXkcKVp4urasV8206TYSPaqB1dU0C88+1cFf77jNBl8yjFlaPupcVu5f488vx SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2018 15:40:51.1298 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e3cb6a7f-fede-4d19-f85d-08d55cf78728 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 v6 07/14] 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 15:40:56 -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