From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 2518FA00E6 for ; Tue, 11 Jun 2019 10:59:07 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3CD7B1C358; Tue, 11 Jun 2019 10:58:40 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 6B6541C34C for ; Tue, 11 Jun 2019 10:58:34 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x5B8tpet020934; Tue, 11 Jun 2019 01:58:33 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=tW5/dD7J6S23hI1+07uIhtrKeWcOvrgt5BHjeUmnLX4=; b=SSq7vO5H+a9da+zD45i+bOKqaLNkXv/gQYc14T+CV/qrae2k1svCbUHt26fcyV3uEHqn WD0MJ4/7vT45FHZCCrMYb0el8S50sb3agbcTkBbQNFxMkyOGXQ7skqz4djQg02Z7+s26 uTZpzP19DPy1B0DoUQQbiCgaoUFZm5eiq5+WGO0ODAkJO/7KP6ydbjEJFby0eha3aM8K rb4T8cI5hX5sm7Oekmdms9Yfm/ZVnngvgDvA2jehX6GpnDCWq+pQFRRPGt8ktNg34m+w oDsBEmxn4JjuE3wn3/IiHbBI+amaw0sFSHYRQFPE8zvnR+tYR8U2rtdTcSdXDJIsAmT9 QA== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 2t20h321de-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 11 Jun 2019 01:58:33 -0700 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 11 Jun 2019 01:58:32 -0700 Received: from NAM04-BN3-obe.outbound.protection.outlook.com (104.47.46.56) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Tue, 11 Jun 2019 01:58:32 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tW5/dD7J6S23hI1+07uIhtrKeWcOvrgt5BHjeUmnLX4=; b=Wz5c8JPpRIKONkfh8j/Q51J76MxZYkDZck+mAT11EsTQUVxRfvD+ovBW1bKksxOXoRYEiWP+e3XvF+ezDQIh9gwl/Xu+zAO//dFs4qFmvPXu8V/K3vM8DMPbzKq0Mh4M8ZdJvHDhW8bHGedz7PIlIYL2ZTQAzL9bu6hRmIlIa1g= Received: from BN8PR18MB2691.namprd18.prod.outlook.com (20.179.72.94) by BN8PR18MB2835.namprd18.prod.outlook.com (20.179.74.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1965.17; Tue, 11 Jun 2019 08:58:31 +0000 Received: from BN8PR18MB2691.namprd18.prod.outlook.com ([fe80::b86e:d3b3:34b4:377e]) by BN8PR18MB2691.namprd18.prod.outlook.com ([fe80::b86e:d3b3:34b4:377e%5]) with mapi id 15.20.1965.017; Tue, 11 Jun 2019 08:58:31 +0000 From: Sunil Kumar Kori To: Anoob Joseph , Jerin Jacob Kollanukkaran , Nikhil Rao , "Erik Gabriel Carrillo" , Abhinandan Gujjar , Bruce Richardson , Pablo de Lara CC: Anoob Joseph , Narayana Prasad Raju Athreya , "dev@dpdk.org" , Lukas Bartosik , Pavan Nikhilesh Bhagavatula , Hemant Agrawal , "Nipun Gupta" , Harry van Haaren , =?iso-8859-1?Q?Mattias_R=F6nnblom?= , Liang Ma Thread-Topic: [EXT] [dpdk-dev] [PATCH 33/39] eventdev: add Tx adapter support Thread-Index: AQHVGjONCeEbzWZrw0yQ+VlHM2IcgqaWLX6g Date: Tue, 11 Jun 2019 08:58:31 +0000 Message-ID: References: <1559583160-13944-1-git-send-email-anoobj@marvell.com> <1559583160-13944-34-git-send-email-anoobj@marvell.com> In-Reply-To: <1559583160-13944-34-git-send-email-anoobj@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [14.140.231.66] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: dd03209c-549d-415b-9ab1-08d6ee4afa30 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:BN8PR18MB2835; x-ms-traffictypediagnostic: BN8PR18MB2835: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-forefront-prvs: 006546F32A x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(979002)(136003)(366004)(396003)(376002)(39860400002)(346002)(189003)(199004)(13464003)(446003)(186003)(52536014)(74316002)(476003)(99286004)(53936002)(26005)(7736002)(11346002)(25786009)(6506007)(7696005)(76116006)(305945005)(8676002)(6116002)(4326008)(64756008)(81156014)(76176011)(3846002)(71200400001)(102836004)(66946007)(81166006)(71190400001)(66574012)(66446008)(6246003)(30864003)(66556008)(66476007)(256004)(14444005)(73956011)(9686003)(55236004)(478600001)(2906002)(5660300002)(86362001)(486006)(8936002)(68736007)(33656002)(110136005)(14454004)(53946003)(54906003)(7416002)(229853002)(55016002)(66066001)(6436002)(316002)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN8PR18MB2835; H:BN8PR18MB2691.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: vgMmZy26A+yMK1VQIzyKf/vGV/8hbC0zzaHP2S8hu8U3w1kXncoXdR4XHDUsE30+YW6m4//KC+GNvRvwqPtcE6qIkat9HJWTWhQpDTrS5Etxe+Dxa0h+sRRGjKQZKB0o71uz4AU7RZy68YtbsrmENIszQmY+Po0fye8GPn61VVzyo0alJ2MsleWqVtN6V0gMB3sGyTfdsn+OrRZ0MSETEE2u+tXDYldwU51LEoE4vS+z5eM3Z7cPdfdCWv3I3G1V8unnhFhGnLBCmEATa/v5fYyjul5MCgejNgrJgXtfs6/tXk4YZjnoTup4E01dbij1S9uCdhXpTl3rcTbZNbrp284ETBvbOffG458Y5Y2gazb8zd2qVQSc6l0j2S8uWCpciDCa8XZoY2I4xYwLiHTHclwgglrtSrmmFC6FQmys6nk= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: dd03209c-549d-415b-9ab1-08d6ee4afa30 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Jun 2019 08:58:31.0514 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: skori@marvell.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR18MB2835 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-11_04:, , signatures=0 Subject: Re: [dpdk-dev] [EXT] [PATCH 33/39] eventdev: add Tx adapter support 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Regards Sunil Kumar Kori >-----Original Message----- >From: dev On Behalf Of Anoob Joseph >Sent: Monday, June 3, 2019 11:03 PM >To: Jerin Jacob Kollanukkaran ; Nikhil Rao >; Erik Gabriel Carrillo ; >Abhinandan Gujjar ; Bruce Richardson >; Pablo de Lara > >Cc: Anoob Joseph ; Narayana Prasad Raju Athreya >; dev@dpdk.org; Lukas Bartosik >; Pavan Nikhilesh Bhagavatula >; Hemant Agrawal >; Nipun Gupta ; Harry >van Haaren ; Mattias R=F6nnblom >; Liang Ma >Subject: [EXT] [dpdk-dev] [PATCH 33/39] eventdev: add Tx adapter support > >External Email > >---------------------------------------------------------------------- >Adding support for Tx adapter. > >Signed-off-by: Anoob Joseph >Signed-off-by: Lukasz Bartosik >--- > lib/librte_eventdev/rte_eventmode_helper.c | 349 >++++++++++++++++++++- > lib/librte_eventdev/rte_eventmode_helper.h | 24 ++ > .../rte_eventmode_helper_internal.h | 30 ++ > lib/librte_eventdev/rte_eventmode_helper_prints.c | 9 + > 4 files changed, 399 insertions(+), 13 deletions(-) > >diff --git a/lib/librte_eventdev/rte_eventmode_helper.c >b/lib/librte_eventdev/rte_eventmode_helper.c >index 77a5a4e..f237cab 100644 >--- a/lib/librte_eventdev/rte_eventmode_helper.c >+++ b/lib/librte_eventdev/rte_eventmode_helper.c >@@ -8,6 +8,7 @@ > #include > #include > #include >+#include > #include > > #include "rte_eventmode_helper_internal.h" >@@ -50,25 +51,51 @@ internal_parse_decimal(const char *str) > return num; > } > >+static int >+internal_get_enabled_cores(unsigned int core_mask) { >+ int i; >+ int count =3D 0; >+ >+ RTE_LCORE_FOREACH(i) { >+ /* Check if this core is enabled in core_mask*/ >+ if (core_mask & (1 << i)) { >+ /* We have enabled core */ >+ count++; >+ } >+ } >+ return count; >+} >+ > static inline unsigned int >-internal_get_next_rx_core(struct eventmode_conf *em_conf, >- unsigned int prev_core) >+internal_get_next_eth_core(struct eventmode_conf *em_conf) > { > unsigned int next_core; >+ static unsigned int prev_core =3D -1; >+ >+ /* >+ * Make sure we have atleast one eth core running, else the following >+ * logic would lead to an infinite loop. >+ */ >+ if (internal_get_enabled_cores(em_conf->eth_core_mask) =3D=3D 0) { >+ RTE_EM_HLPR_LOG_INFO("No enabled eth core found"); >+ return RTE_MAX_LCORE; >+ } > > get_next_core: > /* Get the next core */ >- next_core =3D rte_get_next_lcore(prev_core, 0, 0); >+ next_core =3D rte_get_next_lcore(prev_core, 0, 1); > > /* Check if we have reached max lcores */ > if (next_core =3D=3D RTE_MAX_LCORE) > return next_core; > >+ /* Update prev_core */ >+ prev_core =3D next_core; >+ > /* Only some cores would be marked as rx cores. Skip others */ >- if (!(em_conf->eth_core_mask & (1 << next_core))) { >- prev_core =3D next_core; >+ if (!(em_conf->eth_core_mask & (1 << next_core))) > goto get_next_core; >- } > > return next_core; > } >@@ -164,7 +191,7 @@ static void > em_initialize_helper_conf(struct rte_eventmode_helper_conf *conf) { > struct eventmode_conf *em_conf =3D NULL; >- unsigned int rx_core_id; >+ unsigned int eth_core_id; > > /* Set default conf */ > >@@ -180,12 +207,21 @@ em_initialize_helper_conf(struct >rte_eventmode_helper_conf *conf) > /* Schedule type: ordered */ > /* FIXME */ > em_conf->ext_params.sched_type =3D RTE_SCHED_TYPE_ORDERED; >- /* Set rx core. Use first core other than master core as Rx core */ >- rx_core_id =3D rte_get_next_lcore(0, /* curr core */ >- 1, /* skip master core */ >- 0 /* wrap */); >+ /* Set two cores as eth cores for Rx & Tx */ >+ >+ /* Use first core other than master core as Rx core */ >+ eth_core_id =3D rte_get_next_lcore(0, /* curr core */ >+ 1, /* skip master core */ >+ 0 /* wrap */); > >- em_conf->eth_core_mask =3D (1 << rx_core_id); >+ em_conf->eth_core_mask =3D (1 << eth_core_id); >+ >+ /* Use next core as Tx core */ >+ eth_core_id =3D rte_get_next_lcore(eth_core_id, /* curr core */ >+ 1, /* skip master core */ >+ 0 /* wrap */); >+ >+ em_conf->eth_core_mask |=3D (1 << eth_core_id); > } > > struct rte_eventmode_helper_conf * __rte_experimental @@ -354,7 +390,7 >@@ rte_eventmode_helper_set_default_conf_rx_adapter(struct >eventmode_conf *em_conf) > /* Set adapter conf */ > adapter->eventdev_id =3D eventdev_id; > adapter->adapter_id =3D adapter_id; >- adapter->rx_core_id =3D internal_get_next_rx_core(em_conf, -1); >+ adapter->rx_core_id =3D internal_get_next_eth_core(em_conf); > > /* > * All queues of one eth device (port) will be mapped to one event >@@ -403,6 +439,100 @@ >rte_eventmode_helper_set_default_conf_rx_adapter(struct eventmode_conf >*em_conf) } > > static int >+rte_eventmode_helper_set_default_conf_tx_adapter(struct >eventmode_conf >+*em_conf) { >+ int nb_eth_dev; >+ int eventdev_id; >+ int adapter_id; >+ int i; >+ int conn_id; >+ struct eventdev_params *eventdev_config; >+ struct tx_adapter_conf *tx_adapter; >+ struct tx_adapter_connection_info *conn; >+ >+ /* >+ * Create one Tx adapter with all eth queues mapped to event queues >+ * 1:1. >+ */ >+ >+ if (em_conf->nb_eventdev =3D=3D 0) { >+ RTE_EM_HLPR_LOG_ERR("No event devs registered"); >+ return -1; >+ } >+ >+ /* Get the number of eth devs */ >+ nb_eth_dev =3D rte_eth_dev_count_avail(); Why it is used ? Instead em_conf->eth_portmask cannot be used to get number= of devices within the application ?=20 Also if em_conf->eth_portmask can be used then rte_eth_dev_count_avail can = be removed at multiple places in file. >+ >+ /* Use the first event dev */ >+ eventdev_config =3D &(em_conf->eventdev_config[0]); >+ >+ /* Get eventdev ID */ >+ eventdev_id =3D eventdev_config->eventdev_id; >+ adapter_id =3D 0; >+ >+ /* Get adapter conf */ >+ tx_adapter =3D &(em_conf->tx_adapter[adapter_id]); >+ >+ /* Set adapter conf */ >+ tx_adapter->eventdev_id =3D eventdev_id; >+ tx_adapter->adapter_id =3D adapter_id; >+ >+ /* TODO: Tx core is required only when internal port is not present */ >+ >+ tx_adapter->tx_core_id =3D internal_get_next_eth_core(em_conf); >+ >+ /* >+ * Application would need to use one event queue per adapter for >+ * submitting packets for Tx. Reserving the last queue available >+ * and decrementing the total available event queues for this >+ */ >+ >+ /* Queue numbers start at 0 */ >+ tx_adapter->tx_ev_queue =3D eventdev_config->nb_eventqueue - 1; >+ >+ /* Update the number of event queues available in eventdev */ >+ eventdev_config->nb_eventqueue--; >+ >+ /* >+ * All Tx queues of the eth device (port) will be mapped to the event >+ * device. >+ */ >+ >+ /* Set defaults for connections */ >+ >+ /* >+ * One eth device (port) would be one connection. All Tx queues of >+ * the device would be mapped to the Tx adapter. >+ */ >+ >+ for (i =3D 0; i < nb_eth_dev; i++) { >+ >+ /* Use only the ports enabled */ >+ if ((em_conf->eth_portmask & (1 << i)) =3D=3D 0) >+ continue; >+ >+ /* Get the connection id */ >+ conn_id =3D tx_adapter->nb_connections; >+ >+ /* Get the connection */ >+ conn =3D &(tx_adapter->conn[conn_id]); >+ >+ /* Add ethdev to connections */ >+ conn->ethdev_id =3D i; >+ >+ /* Add all eth tx queues to adapter */ >+ conn->ethdev_tx_qid =3D -1; >+ >+ /* Update no of connections */ >+ tx_adapter->nb_connections++; >+ } >+ >+ /* We have setup one adapter */ >+ em_conf->nb_tx_adapter =3D 1; >+ return 0; >+} >+ >+static int > rte_eventmode_helper_set_default_conf_link(struct eventmode_conf >*em_conf) { > int i, j; >@@ -501,6 +631,16 @@ rte_eventmode_helper_validate_conf(struct >eventmode_conf *em_conf) > } > > /* >+ * See if tx adapters are specified. Else generate a default conf >+ * with one tx adapter. >+ */ >+ if (em_conf->nb_tx_adapter =3D=3D 0) { >+ ret =3D >rte_eventmode_helper_set_default_conf_tx_adapter(em_conf); >+ if (ret !=3D 0) >+ return ret; >+ } >+ >+ /* > * See if links are specified. Else generate a default conf for > * the event ports used. > */ >@@ -799,6 +939,150 @@ rte_eventmode_helper_initialize_rx_adapter(struct >eventmode_conf *em_conf) > return 0; > } > >+static int >+tx_adapter_configure(struct eventmode_conf *em_conf, >+ struct tx_adapter_conf *adapter) >+{ >+ int ret, j; >+ uint8_t tx_port_id =3D 0; >+ uint8_t eventdev_id; >+ uint32_t service_id; >+ struct rte_event_port_conf port_conf =3D {0}; >+ struct rte_event_dev_info evdev_default_conf =3D {0}; >+ struct tx_adapter_connection_info *conn; >+ struct eventdev_params *eventdev_config; >+ >+ /* Get event dev ID */ >+ eventdev_id =3D adapter->eventdev_id; >+ >+ /* Get event device conf */ >+ eventdev_config =3D internal_get_eventdev_params(em_conf, >eventdev_id); >+ >+ /* Create Tx adapter */ >+ >+ /* Get default configuration of event dev */ >+ ret =3D rte_event_dev_info_get(eventdev_id, &evdev_default_conf); >+ if (ret < 0) { >+ RTE_EM_HLPR_LOG_ERR( >+ "Error in getting event device info[devID:%d]", >+ eventdev_id); >+ return ret; >+ } >+ >+ /* Setup port conf */ >+ port_conf.new_event_threshold =3D >+ evdev_default_conf.max_num_events; >+ port_conf.dequeue_depth =3D >+ > evdev_default_conf.max_event_port_dequeue_depth; >+ port_conf.enqueue_depth =3D >+ > evdev_default_conf.max_event_port_enqueue_depth; >+ >+ /* Create Tx adapter */ >+ ret =3D rte_event_eth_tx_adapter_create(adapter->adapter_id, >+ adapter->eventdev_id, >+ &port_conf); >+ if (ret < 0) { >+ RTE_EM_HLPR_LOG_ERR("Error in Tx adapter creation"); >+ return ret; >+ } >+ >+ /* Setup various connections in the adapter */ >+ for (j =3D 0; j < adapter->nb_connections; j++) { >+ >+ /* Get connection */ >+ conn =3D &(adapter->conn[j]); >+ >+ /* Add queue to the adapter */ >+ ret =3D rte_event_eth_tx_adapter_queue_add( >+ adapter->adapter_id, >+ conn->ethdev_id, >+ conn->ethdev_tx_qid); >+ if (ret < 0) { >+ RTE_EM_HLPR_LOG_ERR( >+ "Error in adding eth queue in Tx adapter"); >+ return ret; >+ } >+ } >+ >+ /* Get event port used by the adapter */ >+ ret =3D rte_event_eth_tx_adapter_event_port_get( >+ adapter->adapter_id, >+ &tx_port_id); >+ if (ret) { >+ RTE_EM_HLPR_LOG_ERR("Failed to get Tx adapter port ID"); >+ return ret; >+ } >+ >+ /* >+ * TODO: event queue for Tx adapter is required only if the >+ * INTERNAL PORT is not present. >+ */ >+ >+ /* >+ * Tx event queue would be reserved for Tx adapter. Need to unlink >+ * this queue from all other ports >+ * >+ */ >+ for (j =3D 0; j < eventdev_config->nb_eventport; j++) { >+ rte_event_port_unlink(eventdev_id, j, >+ &(adapter->tx_ev_queue), 1); >+ } >+ >+ ret =3D rte_event_port_link( >+ eventdev_id, >+ tx_port_id, >+ &(adapter->tx_ev_queue), >+ NULL, 1); >+ if (ret !=3D 1) { >+ RTE_EM_HLPR_LOG_ERR("Failed to link event queue to port"); >+ return ret; >+ } >+ >+ /* Get the service ID used by Tx adapter */ >+ ret =3D rte_event_eth_tx_adapter_service_id_get(adapter->adapter_id, >+ &service_id); >+ if (ret !=3D -ESRCH && ret !=3D 0) { >+ RTE_EM_HLPR_LOG_ERR( >+ "Error getting service ID used by adapter"); >+ return ret; >+ } >+ >+ /* >+ * TODO >+ * Tx core will invoke the service when required. The runstate check >+ * is not required. >+ * >+ */ >+ rte_service_set_runstate_mapped_check(service_id, 0); >+ >+ /* Start adapter */ >+ ret =3D rte_event_eth_tx_adapter_start(adapter->adapter_id); >+ if (ret) { >+ RTE_EM_HLPR_LOG_ERR("Error in starting Tx adapter"); >+ return ret; >+ } >+ >+ return 0; >+} >+ >+static int >+rte_eventmode_helper_initialize_tx_adapter(struct eventmode_conf >+*em_conf) { >+ int i, ret; >+ struct tx_adapter_conf *adapter; >+ >+ /* Configure Tx adapters */ >+ for (i =3D 0; i < em_conf->nb_tx_adapter; i++) { >+ adapter =3D &(em_conf->tx_adapter[i]); >+ ret =3D tx_adapter_configure(em_conf, adapter); >+ if (ret < 0) { >+ RTE_EM_HLPR_LOG_ERR("Tx adapter configuration >failed"); >+ return ret; >+ } >+ } >+ return 0; >+} >+ > int32_t __rte_experimental > rte_eventmode_helper_initialize_devs( > struct rte_eventmode_helper_conf *mode_conf) @@ -861,6 >+1145,11 @@ rte_eventmode_helper_initialize_devs( > if (ret !=3D 0) > return ret; > >+ /* Setup Tx adapter */ >+ ret =3D rte_eventmode_helper_initialize_tx_adapter(em_conf); >+ if (ret !=3D 0) >+ return ret; >+ > /* Start eth devices after setting up adapter */ > RTE_ETH_FOREACH_DEV(portid) { > >@@ -1001,6 +1290,7 @@ >rte_eventmode_helper_start_worker_eth_core(struct eventmode_conf >*em_conf, { > uint32_t service_id[EVENT_MODE_MAX_ADAPTERS_PER_RX_CORE]; > struct rx_adapter_conf *rx_adapter; >+ struct tx_adapter_conf *tx_adapter; > int service_count =3D 0; > int adapter_id; > int32_t ret; >@@ -1042,6 +1332,39 @@ >rte_eventmode_helper_start_worker_eth_core(struct eventmode_conf >*em_conf, > service_count++; > } > >+ /* >+ * Need to parse adapter conf to see which all Tx adapters need to be >+ * handled this core. >+ */ >+ for (i =3D 0; i < em_conf->nb_tx_adapter; i++) { >+ /* Check if we have exceeded the max allowed */ >+ if (service_count > >EVENT_MODE_MAX_ADAPTERS_PER_TX_CORE) { >+ RTE_EM_HLPR_LOG_ERR( >+ "Exceeded the max allowed adapters per Tx >core"); >+ break; >+ } >+ >+ tx_adapter =3D &(em_conf->tx_adapter[i]); >+ if (tx_adapter->tx_core_id !=3D lcore_id) >+ continue; >+ >+ /* Adapter need to be handled by this core */ >+ adapter_id =3D tx_adapter->adapter_id; >+ >+ /* Get the service ID for the adapters */ >+ ret =3D rte_event_eth_tx_adapter_service_id_get(adapter_id, >+ &(service_id[service_count])); >+ >+ if (ret !=3D -ESRCH && ret !=3D 0) { >+ RTE_EM_HLPR_LOG_ERR( >+ "Error getting service ID used by Tx adapter"); >+ return ret; >+ } >+ >+ /* Update service count */ >+ service_count++; >+ } >+ > eth_core_running =3D true; > > while (eth_core_running) { >diff --git a/lib/librte_eventdev/rte_eventmode_helper.h >b/lib/librte_eventdev/rte_eventmode_helper.h >index 1235ca4..2212622 100644 >--- a/lib/librte_eventdev/rte_eventmode_helper.h >+++ b/lib/librte_eventdev/rte_eventmode_helper.h >@@ -10,6 +10,14 @@ extern "C" { > > #include > #include >+#include >+#include >+ >+/* Flag to indicate that the event device used by all adapters is same */ >+#define RTE_EM_HELPER_TX_EV_LINK_COMMON_EVENT_DEV (1 << >0) >+ >+/* Flag to indicate that the event queue to be used for all adapters is s= ame */ >+#define RTE_EM_HELPER_TX_EV_LINK_COMMON_EVENT_QUEUE (1 << >1) > > /* Packet transfer mode of the application */ enum >rte_eventmode_helper_pkt_transfer_mode { @@ -55,6 +63,22 @@ struct >rte_eventmode_helper_event_link_info { > /**< Lcore to be polling on this port */ }; > >+/* >+ * Tx event queue - port link conf >+ * >+ * Application would need to know which event queue would correspond to >+which >+ * eth port, so that it can send out accordingly. >+ */ >+struct rte_eventmode_helper_tx_ev_link_conf { >+ uint8_t flags; >+ struct { >+ uint8_t eventdev_id; >+ /**< Event device ID */ >+ uint8_t tx_ev_queue; >+ /**< Tx event queue */ >+ } ports[RTE_MAX_ETHPORTS]; >+}; >+ > /* Workers registered by the application */ struct >rte_eventmode_helper_app_worker_params { > union { >diff --git a/lib/librte_eventdev/rte_eventmode_helper_internal.h >b/lib/librte_eventdev/rte_eventmode_helper_internal.h >index 906766c..1daca22 100644 >--- a/lib/librte_eventdev/rte_eventmode_helper_internal.h >+++ b/lib/librte_eventdev/rte_eventmode_helper_internal.h >@@ -38,9 +38,15 @@ > /* Max Rx adapters supported */ > #define EVENT_MODE_MAX_RX_ADAPTERS RTE_EVENT_MAX_DEVS > >+/* Max Tx adapters supported */ >+#define EVENT_MODE_MAX_TX_ADAPTERS RTE_EVENT_MAX_DEVS >+ > /* Max Rx adapter connections */ > #define EVENT_MODE_MAX_CONNECTIONS_PER_ADAPTER 16 > >+/* Max Tx adapter connections */ >+#define EVENT_MODE_MAX_CONNECTIONS_PER_TX_ADAPTER 16 >+ > /* Max event queues supported per event device */ #define >EVENT_MODE_MAX_EVENT_QUEUES_PER_DEV >RTE_EVENT_MAX_QUEUES_PER_DEV > >@@ -51,6 +57,9 @@ > /* Max adapters that one Rx core can handle */ #define >EVENT_MODE_MAX_ADAPTERS_PER_RX_CORE >EVENT_MODE_MAX_RX_ADAPTERS > >+/* Max adapters that one Tx core can handle */ #define >+EVENT_MODE_MAX_ADAPTERS_PER_TX_CORE >EVENT_MODE_MAX_TX_ADAPTERS >+ > /* Event dev params */ > struct eventdev_params { > uint8_t eventdev_id; >@@ -76,6 +85,23 @@ struct rx_adapter_conf { > > conn[EVENT_MODE_MAX_CONNECTIONS_PER_ADAPTER]; > }; > >+/* Tx adapter connection info */ >+struct tx_adapter_connection_info { >+ uint8_t ethdev_id; >+ int32_t ethdev_tx_qid; >+}; >+ >+/* Tx adapter conf */ >+struct tx_adapter_conf { >+ int32_t eventdev_id; >+ int32_t adapter_id; >+ uint32_t tx_core_id; >+ uint8_t nb_connections; >+ struct tx_adapter_connection_info >+ > conn[EVENT_MODE_MAX_CONNECTIONS_PER_TX_ADAPTER]; >+ uint8_t tx_ev_queue; >+}; >+ > /* Eventmode conf data */ > struct eventmode_conf { > int nb_eventdev; >@@ -86,6 +112,10 @@ struct eventmode_conf { > /**< No of Rx adapters */ > struct rx_adapter_conf >rx_adapter[EVENT_MODE_MAX_RX_ADAPTERS]; > /**< Rx adapter conf */ >+ uint8_t nb_tx_adapter; >+ /**< No of Tx adapters */ >+ struct tx_adapter_conf >tx_adapter[EVENT_MODE_MAX_TX_ADAPTERS]; >+ /** Tx adapter conf */ > uint8_t nb_link; > /**< No of links */ > struct rte_eventmode_helper_event_link_info >diff --git a/lib/librte_eventdev/rte_eventmode_helper_prints.c >b/lib/librte_eventdev/rte_eventmode_helper_prints.c >index 3114d29..387302a 100644 >--- a/lib/librte_eventdev/rte_eventmode_helper_prints.c >+++ b/lib/librte_eventdev/rte_eventmode_helper_prints.c >@@ -95,6 +95,12 @@ rte_eventmode_display_rx_adapter_conf(struct >eventmode_conf *em_conf) } > > static void >+rte_eventmode_display_tx_adapter_conf(struct eventmode_conf *em_conf) >{ >+ RTE_SET_USED(em_conf); >+} >+ >+static void > rte_eventmode_display_link_conf(struct eventmode_conf *em_conf) { > int i; >@@ -155,6 +161,9 @@ rte_eventmode_helper_display_conf(struct >rte_eventmode_helper_conf *mode_conf) > /* Display Rx adapter conf */ > rte_eventmode_display_rx_adapter_conf(em_conf); > >+ /* Display Tx adapter conf */ >+ rte_eventmode_display_tx_adapter_conf(em_conf); >+ > /* Display event-lcore link */ > rte_eventmode_display_link_conf(em_conf); > } >-- >2.7.4