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 E37D8A0096 for ; Mon, 3 Jun 2019 19:39:17 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8A1431BBEF; Mon, 3 Jun 2019 19:36:29 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 3EDFD1BBED for ; Mon, 3 Jun 2019 19:36:28 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x53HKadB027621; Mon, 3 Jun 2019 10:36:27 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=glHs6hF4Z4KL+D3/czNJ339orN7pX3dGuzehRREBckw=; b=DeJOhF2k1ZAxl+p3spwS/JV0sVJvDJ9+H5xLixQL4hFm661vTGestXLm4rTr1nk7fFu7 5EuKvXL7yhNwCjITIngwT4rbjduaTVJwqBvZ3Apxmj333z6ezvQM8XFueJXiwHcSkwEZ WystRWfq0m2m3XmziD9HVVkOW5ccdtQOL1d7X06QC4ubFr38wPmgLJEvae+H1BCuj9D5 38rp4iNbh5t1PlLUqsnV+ujvRaSpymvEkSwXrQ3Q1p7PQML5Lq2SMjkEmoEUh72IeYNj yr1CZw2E/xfZcN0otJ+T5TuFx/dz8V/4Dy++MqVVznXz7fZG9b2qsaMWzqvbO2k3eRJw bg== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2sw79pr73r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 03 Jun 2019 10:36:27 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 3 Jun 2019 10:36:24 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Mon, 3 Jun 2019 10:36:24 -0700 Received: from ajoseph83.caveonetworks.com.com (unknown [10.29.45.56]) by maili.marvell.com (Postfix) with ESMTP id 546F93F703F; Mon, 3 Jun 2019 10:36:20 -0700 (PDT) From: Anoob Joseph To: Jerin Jacob , Nikhil Rao , "Erik Gabriel Carrillo" , Abhinandan Gujjar , Bruce Richardson , Pablo de Lara CC: Anoob Joseph , Narayana Prasad , , Lukasz Bartosik , Pavan Nikhilesh , Hemant Agrawal , "Nipun Gupta" , Harry van Haaren , =?UTF-8?q?Mattias=20R=C3=B6nnblom?= , Liang Ma Date: Mon, 3 Jun 2019 23:02:30 +0530 Message-ID: <1559583160-13944-31-git-send-email-anoobj@marvell.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1559583160-13944-1-git-send-email-anoobj@marvell.com> References: <1559583160-13944-1-git-send-email-anoobj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-03_13:, , signatures=0 Subject: [dpdk-dev] [PATCH 30/39] eventdev: add routine to access eventmode link info 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" When the application is drafted for single stage eventmode, it will be efficient to have the loop in the application space, rather than passing it on to the helper. But application would need to have info on the links to be able to do that efficiently. This function exposes the links to that application. Signed-off-by: Anoob Joseph Signed-off-by: Lukasz Bartosik --- lib/librte_eventdev/rte_eventdev_version.map | 1 + lib/librte_eventdev/rte_eventmode_helper.c | 80 ++++++++++++++++++++++++++++ lib/librte_eventdev/rte_eventmode_helper.h | 24 +++++++++ 3 files changed, 105 insertions(+) diff --git a/lib/librte_eventdev/rte_eventdev_version.map b/lib/librte_eventdev/rte_eventdev_version.map index 8b78a68..8137cb5 100644 --- a/lib/librte_eventdev/rte_eventdev_version.map +++ b/lib/librte_eventdev/rte_eventdev_version.map @@ -133,4 +133,5 @@ EXPERIMENTAL { rte_eventmode_helper_parse_args; rte_eventmode_helper_initialize_devs; rte_eventmode_helper_display_conf; + rte_eventmode_helper_get_event_lcore_links; }; diff --git a/lib/librte_eventdev/rte_eventmode_helper.c b/lib/librte_eventdev/rte_eventmode_helper.c index a333c4a..6c853f6 100644 --- a/lib/librte_eventdev/rte_eventmode_helper.c +++ b/lib/librte_eventdev/rte_eventmode_helper.c @@ -847,3 +847,83 @@ rte_eventmode_helper_initialize_devs( return 0; } + +/* Helper functions for eventmode workers */ + +uint8_t __rte_experimental +rte_eventmode_helper_get_event_lcore_links(uint32_t lcore_id, + struct rte_eventmode_helper_conf *mode_conf, + struct rte_eventmode_helper_event_link_info **links) +{ + int i; + int index = 0; + uint8_t lcore_nb_link = 0; + struct rte_eventmode_helper_event_link_info *link; + struct rte_eventmode_helper_event_link_info *link_cache; + struct eventmode_conf *em_conf = NULL; + size_t cache_size; + size_t single_link_size; + + if (mode_conf == NULL || links == NULL) { + RTE_EM_HLPR_LOG_ERR("Invalid args"); + return 0; + } + + /* Get eventmode conf */ + em_conf = (struct eventmode_conf *)(mode_conf->mode_params); + + if (em_conf == NULL) { + RTE_EM_HLPR_LOG_ERR("Invalid event mode conf"); + return 0; + } + + /* Get the number of links registered */ + for (i = 0; i < em_conf->nb_link; i++) { + + /* Get link */ + link = &(em_conf->link[i]); + + /* Check if we have link intended for this lcore */ + if (link->lcore_id == lcore_id) { + + /* Update the number of links for this core */ + lcore_nb_link++; + + } + } + + /* Compute size of one entry to be copied */ + single_link_size = sizeof(struct rte_eventmode_helper_event_link_info); + + /* Compute size of the buffer required */ + cache_size = lcore_nb_link * + sizeof(struct rte_eventmode_helper_event_link_info); + + /* Allocate memory for caching the links */ + link_cache = rte_zmalloc("eventmode-event-lcore-links", cache_size, + RTE_CACHE_LINE_SIZE); + + /* Get the number of links registered */ + for (i = 0; i < em_conf->nb_link; i++) { + + /* Get link */ + link = &(em_conf->link[i]); + + /* Check if we have link intended for this lcore */ + if (link->lcore_id == lcore_id) { + + /* Cache the link */ + memcpy(&link_cache[index], link, single_link_size); + + /* Update index */ + index++; + } + } + + /* Update the links for application to use the cached links */ + *links = link_cache; + + /* Return the number of cached links */ + return lcore_nb_link; +} + diff --git a/lib/librte_eventdev/rte_eventmode_helper.h b/lib/librte_eventdev/rte_eventmode_helper.h index d4941be..925b660 100644 --- a/lib/librte_eventdev/rte_eventmode_helper.h +++ b/lib/librte_eventdev/rte_eventmode_helper.h @@ -112,6 +112,30 @@ rte_eventmode_helper_initialize_devs( void __rte_experimental rte_eventmode_helper_display_conf(struct rte_eventmode_helper_conf *mode_conf); +/** + * Get event dev - lcore links + * + * Since the execution loop is in the application, the application would need + * the info on which event port to be polled by an lcore etc. This helper + * function would help the application in doing so. The 'links' would point + * to the memory allocated for the links list, and the application should + * release this, once the use is over. + * + * @param lcore_id + * ID of the lcore for which the links list need to be populated + * @param mode_conf + * Configuration of the mode in which app is doing packet handling + * @param links + * Used to pass the pointer of the memory allocated by the helper to the + * application + * @return + * Number of links found for the lcore + */ +uint8_t __rte_experimental +rte_eventmode_helper_get_event_lcore_links(uint32_t lcore_id, + struct rte_eventmode_helper_conf *mode_conf, + struct rte_eventmode_helper_event_link_info **links); + #ifdef __cplusplus } #endif -- 2.7.4