From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE676C04AB5 for ; Mon, 3 Jun 2019 16:55:24 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id 74CA2251FA for ; Mon, 3 Jun 2019 16:55:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="tiVp6K+J" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 74CA2251FA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=marvell.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4A9CF1B9FD; Mon, 3 Jun 2019 18:52:30 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id D82C51B9FA for ; Mon, 3 Jun 2019 18:52:28 +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 x53Ge82V031776; Mon, 3 Jun 2019 09:52:28 -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=tiVp6K+Js330x09bod9R2BxT+sBpg7HPajpyk9i4O6g4llbeYigKTXcSpX3hZX1EUE78 oi42R7mdygHsI8kElL+hon246DM1ZkBjHtr8vg00CxeJ2sOCyFnkrilY4ylcMB6KU9yZ 3OJm7A2Zv/oBkWV6J8CpsD11jT4gzTQYFP3JEShI1MJRIt+8UXiLbkCG1W3aLej08tRB WWuX1rOM67MtTEhCOLeHeRz1cEX0uR5hg1BLHrAJImTAlRaCdC2wGlF5NoyQO+npdvjy tmewNcK4XPT9DZjNzRyTm1EGv4exmXccldVJ+EE4Kw9CKVOTnNgckl78OGH72ChjvmD9 +w== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 2sw2wmh7a8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 03 Jun 2019 09:52:28 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 3 Jun 2019 09:52:27 -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 09:52:27 -0700 Received: from ajoseph83.caveonetworks.com.com (unknown [10.29.45.56]) by maili.marvell.com (Postfix) with ESMTP id 9EF213F703F; Mon, 3 Jun 2019 09:52:22 -0700 (PDT) From: Anoob Joseph To: Jerin Jacob , Nikhil Rao , "Erik Gabriel Carrillo" , Abhinandan Gujjar , Bruce Richardson , Pablo de Lara CC: Narayana Prasad , , Lukasz Bartosik , Pavan Nikhilesh , "Hemant Agrawal" , Nipun Gupta , "Harry van Haaren" , =?UTF-8?q?Mattias=20R=C3=B6nnblom?= , Liang Ma , "Anoob Joseph" Date: Mon, 3 Jun 2019 22:19:35 +0530 Message-ID: <1559580584-5728-31-git-send-email-anoobj@marvell.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1559580584-5728-1-git-send-email-anoobj@marvell.com> References: <1559580584-5728-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