From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0084.outbound.protection.outlook.com [104.47.42.84]) by dpdk.org (Postfix) with ESMTP id 569051D08C for ; Fri, 8 Jun 2018 19:25:59 +0200 (CEST) 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:X-MS-Exchange-SenderADCheck; bh=Al+romWSU0PjNM3jC0WIhNA5Dsbx8Ja3Qki3pKpFY00=; b=AZXRxT2IA9089A9YE/ukp8Zs9n3iP9+Tm3IzIZZVhIwlrs05rb9JlvYAPVo6WpCMJI2EzoW4RQSLx3HUUMbWXmkCzMmwpEdzlQ1RRHSZEsB7K25JQdvrylmseTejrbhR+Sn6NdS95uJk8BK7+buAeJsykv52NJ3JheJ6oiu/thc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Anoob.Joseph@cavium.com; Received: from ajoseph83.caveonetworks.com.caveonetworks.com (115.113.156.2) by DM6PR07MB4906.namprd07.prod.outlook.com (2603:10b6:5:a3::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.841.17; Fri, 8 Jun 2018 17:25:55 +0000 From: Anoob Joseph To: Bruce Richardson , Jerin Jacob , Pablo de Lara Cc: Anoob Joseph , Hemant Agrawal , Narayana Prasad , Nikhil Rao , Pavan Nikhilesh , Sunil Kumar Kori , dev@dpdk.org Date: Fri, 8 Jun 2018 22:54:16 +0530 Message-Id: <1528478659-15859-18-git-send-email-anoob.joseph@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1528478659-15859-1-git-send-email-anoob.joseph@caviumnetworks.com> References: <1528478659-15859-1-git-send-email-anoob.joseph@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [115.113.156.2] X-ClientProxiedBy: BM1PR0101CA0050.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:19::12) To DM6PR07MB4906.namprd07.prod.outlook.com (2603:10b6:5:a3::11) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DM6PR07MB4906; X-Microsoft-Exchange-Diagnostics: 1; DM6PR07MB4906; 3:rnEEwQs0r5IQ5P6XtGbwB0vvMbzAEhiAq6Ip1uMLghZCX4U6HU20XnLIkLNcr+xglEwhaNQVlvY/UGPLK+fx75yKR8u8QTfROiMsJxBYRJuGpk60eag28jxHsa489+K1GqQMuG9KTpyyM+tmO/hhkO8kjoK8auDQiquapSbiwMuKbRpy/WNUicmUT66w4j43vJjVdQevuBn/ZT5BlxC/OCIj6giCAwTOQxt/W8qbMtdusGv8MlCLwrP1fSuZOyd7; 25:3Tc8BMei3tsNd33zrcHeOlrKQBUH0jONKjnurdv/QiZ2TnXb8g0zzGyHKEbgtjjfWaK1NL2n7ROiO9AjIlnMgCgkDfM9/mM2REneulcZTgir4eJHU5ip1MS+mDQVMLawXNdxsHPrQ7gO79IbSWb/g/TiqjQ+gzRo+WKNL8i2OYm3qW7+wyUWX3Wt6ezh5auTpx+DqLevxKbD1XbSfdeaemkXL4NWwGnSJqRoRqca8HbPN74caA0Zxad9RrEbp27X8kNV07vkkZHgf5ExRGT2BAEibeEIby/MMDWRx12M6OxnBQhydDVSmUGCWxHWBrrtSk6+Dlfyq1d7dFN6tKTFLw==; 31:aI73P4a8hwCukHz8RjzIA4XiwqJT/UAX40cDByq799RZhuz/q7XhH1O1NFiruI4HOVMhqTNI4pDyBdKqIzHf7e99TPX2SQo7hY0d5ZuW4fsvwsawowZ58IYL8OKO+o5QcyBi2cmr+ig5dfKTa0z/ADL/YGqZgS1UwE4Nz9Wowx54ADdpxRHvfyJalMR3JXXwrKCHjUTZuQcUTHFlZLf02F15UxI70zR7yUStDr9BxQg= X-MS-TrafficTypeDiagnostic: DM6PR07MB4906: X-Microsoft-Exchange-Diagnostics: 1; DM6PR07MB4906; 20:MW3PFbqQb8dLaTXBMIsb+tMgOOZjpqQgEY9+VRvTkKMxuDwmS8XQXfVS9atAdtvZA0N3I4h7bla8IQZ7xaI5pYf4b6cp8ZHGcK2HfhNsIWTkW2905atcgrsv0EBweJwECkpbEefT+tRCG7Kx+5EvGcZl9N7jcnyDQ0DyGoKr9jceLtopK5307wDF3lF4d+PTDVZ2hYjCbj3znA2m+5Mfw7289LD5DSbOg4lRvviZhTZbugrqhExkazCj8Eu9mK0/K6dDYoTkW/TLwqvOXE2HZkIISPnBz0FEfnCS8EHscPlw7uYNPibDfLxoP9kCAHo00RwqdP6e/39NyWF+hf7T1LzeWUkqceudXi+8fGrdNJgbZW8tclEqsKZ/oFO6SeBzUkut+RTjaUjbjdXoEIHwzmJtVqgdl/qzFlq8AEE4Tu5n8zOPqbjKexhSGcDr6LmF6OkJrSdf5hiJU3lnG453iDgx6xkbExwwNrhIscLLgQTQx1kga13IvvWXxT6YIGZzDd159eRtd/R5UlYpj+5QfFYAzjmm+zYxC+pcIUfYzRjGrsAIutMDQZ/pNTYiQzK2CzaC5L6uj5v6i+jjWasD//P+AN7FZQTHUseugSo46OE=; 4:MGxnRNDRqHTkDe83ccfVvmbebwO7/kQU1HQs3He7rMYjmbeAx1Vn0yw3C/9HrBOVpoXKHGdvdpjoYPr5ZoQqXID45Rup3Lmd8TS5A9eH2pv0Iq8MFswxz3uZpTSWRp3sJzPy1rzy/ZgvUOo2Yr2KxLfUDnpyqrouYZCe2Iwjc1GyoF/2DeyKHynBRckg81UZWsKmzxN/V21mcFU5BE8GDenel9aUSv2/fVV3HzjKbMdupdrGvwMJZZ/OErEor1Q3j+BD6xcwBbUn7iRfB2T9Yw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(3231254)(944501410)(52105095)(10201501046)(3002001)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123562045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:DM6PR07MB4906; BCL:0; PCL:0; RULEID:; SRVR:DM6PR07MB4906; X-Forefront-PRVS: 06973FFAD3 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(346002)(366004)(376002)(396003)(39380400002)(189003)(199004)(186003)(16526019)(5660300001)(26005)(42882007)(55236004)(66066001)(47776003)(68736007)(6666003)(305945005)(2906002)(8676002)(7736002)(8936002)(36756003)(52116002)(2616005)(956004)(476003)(446003)(50226002)(81166006)(11346002)(44832011)(6506007)(386003)(486006)(59450400001)(76176011)(51416003)(48376002)(50466002)(97736004)(316002)(6512007)(25786009)(53936002)(6486002)(81156014)(4326008)(3846002)(6116002)(16586007)(54906003)(110136005)(105586002)(106356001)(72206003)(478600001)(8656006); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR07MB4906; H:ajoseph83.caveonetworks.com.caveonetworks.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM6PR07MB4906; 23:4yjlphURVRwxJW6zkb7jEx9o8Y/jWxIhLwDMGCEXv?= =?us-ascii?Q?RhSWNfMW2uOudBgh7fKTtRT5TA3YqtE44RqaCZVT7/vwUr62L3ZiQlXD6mdd?= =?us-ascii?Q?WBpXkbEv2DneLDKScQdj1i1uPa0PTG47pAz+lfMTCZCHgXfDL+ptQT/JceFZ?= =?us-ascii?Q?LH6jVkn+MdzCxuaKRUjSy6jPlZ7N8u4SKii5nXo20hnQdYw5nMuFEd0SbmPO?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1fVwokK3q8mZCFjtwXloiSNn5Rf53o07cAsy03/0ru1awOKuTqFZb399t4uYtdyh/6I/VQegn7jpwkkUr3g6Kkx2QolDmydyrJxD5C8b70miaIrxzbKyFIsW0cTGI=; 24:kAR4jqYbAcz+1Lpx1FPwTiPnp6pbWuWTxYiccYTZ+CGIGZlY1JphtzJKR6at3OQepZYb4bVWpcPo8A+7UtcNtsP/difHOJU0Xu1yxXvfc0M= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM6PR07MB4906; 7:yHIriGrZ4rldRYAOvJoN2FVBxEkeJzoEa6kDMi5nGfDnkEztDV1htV1OFrj8sIKubFRIoy5FX9V332Mi6a1RCVV7jIcZ+VuYPmS6meO6u8Offx4+WhOWA/q4VfIuwcHLQySG9DNplnMsFURRfsBPbDNhCihvWlZo4uZFaFqkTjS0ofOZqoK4tKxyvTdEM3YCwapGgG7ikXkjz3NstkQ2ZDPYycsZv689iP8Yfq2GS+Llyns0YZSLELalfmfEaNly X-MS-Office365-Filtering-Correlation-Id: 6a2b8156-a985-47ee-49ad-08d5cd64e5d3 X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jun 2018 17:25:55.1233 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6a2b8156-a985-47ee-49ad-08d5cd64e5d3 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR07MB4906 Subject: [dpdk-dev] [PATCH 17/20] 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: , X-List-Received-Date: Fri, 08 Jun 2018 17:26:00 -0000 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 --- lib/librte_eventdev/rte_eventmode_helper.c | 80 ++++++++++++++++++++++++++++++ lib/librte_eventdev/rte_eventmode_helper.h | 25 ++++++++++ 2 files changed, 105 insertions(+) diff --git a/lib/librte_eventdev/rte_eventmode_helper.c b/lib/librte_eventdev/rte_eventmode_helper.c index 82cc6d3..7827ea6 100644 --- a/lib/librte_eventdev/rte_eventmode_helper.c +++ b/lib/librte_eventdev/rte_eventmode_helper.c @@ -877,3 +877,83 @@ rte_eventmode_helper_initialize_devs( return 0; } + +/* Helper functions for eventmode workers */ + +uint8_t +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 c1676e3..1d8af44 100644 --- a/lib/librte_eventdev/rte_eventmode_helper.h +++ b/lib/librte_eventdev/rte_eventmode_helper.h @@ -107,4 +107,29 @@ rte_eventmode_helper_initialize_devs( void rte_eventmode_helper_display_conf(struct rte_eventmode_helper_conf *mode_conf); +/** + * Get event dev - lcore links + * + * When the application is doing single stage execution, the execution loop + * will be in the application. So the application would need the info on which + * event port need 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_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); + #endif /* _RTE_EVENTMODE_HELPER_H_ */ -- 2.7.4