From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0046.outbound.protection.outlook.com [104.47.38.46]) by dpdk.org (Postfix) with ESMTP id 11DA51B01E for ; Fri, 12 Jan 2018 17:45:15 +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=fHOwg90TskLbaRyVYSIdPxocj8Nlb4OSa0A+aLABAIo=; b=NYxYsU2jZ9rNaXc6kYnYO/qb/xGuGnmUeT76sgIqxt785VNJPx+g4jnycU9EsloLfKjjo97EZzddnpvx9gKDkP8tRQAm+bZepBBhVkvVPZ9nEe3IqAehWFn7z9qbP68pjOC82jvpEwQ6ZdvctkpbmsFQoVh2QePsay8kkrQexc8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from Pavan-LT.caveonetworks.com (119.82.125.132) by DM5PR07MB3465.namprd07.prod.outlook.com (10.164.153.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Fri, 12 Jan 2018 16:45:09 +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: Fri, 12 Jan 2018 22:14:10 +0530 Message-Id: <20180112164416.21374-7-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180112164416.21374-1-pbhagavatula@caviumnetworks.com> References: <20171130072406.15605-1-pbhagavatula@caviumnetworks.com> <20180112164416.21374-1-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [119.82.125.132] X-ClientProxiedBy: YQXPR0101CA0023.CANPRD01.PROD.OUTLOOK.COM (52.132.74.164) To DM5PR07MB3465.namprd07.prod.outlook.com (10.164.153.20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c3628a12-fc97-4ada-d9db-08d559dbd9d9 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020084)(4652020)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:DM5PR07MB3465; X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3465; 3:4FJfJYx55G6mrWJIfbr2cqTQ/jbmNGIsNzIWeuedS4LUfFAigz2dw2dBwype0VppPltl4R0YwC32+UHh8Qg3nipbiylRvexDy0/dd3rlYck/ONoJyHQntONykOTXvfOTBJmRVLVPugZrP3QMbsI/6VUUxhqECruhGZwO7aFO3JUHp5sTcxKfnQwCB+NdbEfRLEhHeFYBP3rliRX2KWqcCIrK0f7HWKu2mj86NZ0T29QhP1DdQz7VtZgvp1/HHu6g; 25:WVGnoJIWmcifOVHdFRDVgyi2+J8Gvu1Nm3n6rKw0Xh0neqGqNqcLirgtz2cXff2yHTVfOMVi/eiVQQpljhomD6/pORiEEQVDOpOOwmy2aq+XMizqzL7HuMlf+KD07TVRHGmLMH1S3LfDquitws3QWjJRz2W6f0+TvSJGNy3Kkeac4xvrxfJFGseLrCajK7Os7y4s3OhO5qgSb+tk6UjdiLMQ/s6nKLqn3heZcCH+zOmWjdwUMumuunQb9glYZOLcA5dq9UAjU6JTMMwqMee46bbu8m+qbGvxzDb3VS6LFa2mvk6dhnCxy1uyy8EvqjxPih/HUI9pZBuy5iINIrnIkA==; 31:moq9AjLzK9xN2bYhYcoREso/2DDGfyjzlcMuf2lJgMIaFX6cL3meRVz+PRt2/3eZCaCY1HBToXWUn1NhdDE+WnLqpT+Kvbfm+k0gpOV2u3fiyeY9OldXie6u9iw8rzEtWnJnerkITt44NUPLBC/+CNwl9uPy1MhIeqFvEhgZzFrD0QSZ2vQfTH02Uz0Wye+oQw8a0WzetPaJYkCuVK8gMz9WGpze0E6WZDN8K5sShhE= X-MS-TrafficTypeDiagnostic: DM5PR07MB3465: X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3465; 20:KUlxEZFDlAN9FBTmTW+SfLDFEih38O+vN/iQ1dsgbOCb4z5uYgRWckaYL7TfW7iGuySTSjHoa19tZUZdkW+lP+iWhjAANWgFDKPxuxcySQghj4TjMfGKaFOAY+/9tusM0fNvQ4YbisQ58PzcQUyk+R/V3iDiw2Mt2iOoMwxs5D2QRSpc98gP9dCMbWSYvf5v19yHYVpS21xiyFQF1Ya3K6TbeWOaTTFD2vhSBErsd+I5NHQef1/uErKuXZpZsvEnj6QVZj/+3enLYY1We2k6auwmoAiBMD8CGSxqoBgtYIxmL7xb+L/OcxWLNRu1c+NbuHdHdAevdQOYsP5FI4IQKGZgBLeWTGTG2KjPBgG/H39X3wkWfWVCMveJF+cwap1+AZGIWL4fLSlIi4S9/XPkYrRGGXuf+i46leZqEK4Gcxgjsj7WdAf8kucLHaJnJEO82uG4R+Nq85dIJfNejFmBfSM20X5BA16TmDS+HqRgqIofTfCYdJM8T7whKpk6U4a2wWXMSoS6K0giRZOApIUuDKUQb4jTAelvc+pxAIR6xFK1WkZkBq6l/7dS7H06rTGMVRldECO/f0zsnkCLt3ZQYWzJXHXk5XBoAj8Kq0481wE=; 4:1/eGzFUwTPcAGyJC8YYvMEezmJr3zgxpGCX+uDWLJhEHWVoYD8TuzjkoHy61evXECIvahRghPJwqVG8hcGo1JLWjig1olrI90BKe2KMl/PvPo8rYbLLerLw482gldgeNhskB3GEyf/Txydc6QjzDFF3zMr5h8IdhrCo2+xbeLKW8NUkGfbVxadwC3J1DVziUpTkHEDSMhgDNvs+AFHVi9f+yYupvBiJ+P4C1ORtGLnFYnH3XzSsHwEz9zVyB1pkW/Y+1gSiFmyZg1xyEPImEnA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(3002001)(93006095)(10201501046)(3231023)(944501145)(6041268)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DM5PR07MB3465; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:DM5PR07MB3465; X-Forefront-PRVS: 0550778858 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(346002)(39380400002)(376002)(396003)(366004)(189003)(199004)(50226002)(76176011)(8676002)(6666003)(316002)(48376002)(53416004)(81156014)(53936002)(69596002)(16586007)(81166006)(59450400001)(386003)(16526018)(52116002)(6506007)(51416003)(1076002)(6486002)(2950100002)(105586002)(66066001)(6512007)(50466002)(106356001)(47776003)(4326008)(5660300001)(3846002)(42882006)(6116002)(7736002)(68736007)(97736004)(8656006)(478600001)(107886003)(8936002)(72206003)(575784001)(36756003)(2906002)(305945005)(25786009)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR07MB3465; 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; DM5PR07MB3465; 23:6r9R/Dmqdfvnte+vY4te8WXapH/hyRJ8BwH5k5ypy?= =?us-ascii?Q?9qgOjg9uGmF4rWjMZ3WEEk103so5qiEdDxODZ6L6EZf0ynMFNKHMu5jueL7H?= =?us-ascii?Q?2pKRt/8JW/exFJdHO8wkjEcSZVyUDUB550MtZ5GyfOgBRpM9+vbi1hrWiKwB?= =?us-ascii?Q?uXDPdNe1iPlocsMja6yjxNOZDqM1U7RLtbXsPZ4T+si9tgXnMC7IjsMKvJ9d?= =?us-ascii?Q?XguXQi8zlW2SsErIyxF343dwXj69j5VU2trUZ/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z8NOkBlXbMCCcyHN5Y0e9wf/ecHARFCrI7gNTeQN7J SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2018 16:45:09.9498 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c3628a12-fc97-4ada-d9db-08d559dbd9d9 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR07MB3465 Subject: [dpdk-dev] [PATCH v4 07/13] 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: Fri, 12 Jan 2018 16:45:16 -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 --- 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