From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2FC9CA0C58; Mon, 23 Aug 2021 21:40:51 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1822A411BF; Mon, 23 Aug 2021 21:40:38 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 9F23C411A8 for ; Mon, 23 Aug 2021 21:40:35 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.0.43) with SMTP id 17NHEvpW021118; Mon, 23 Aug 2021 12:40:34 -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=pfpt0220; bh=ZxErImFnRcNBgoF99oShK0QDHhdFjpJal1PdFs8PTuo=; b=JwbaJrkzRZNrHcikI7rsblWF1iqzWxLceOmYmLQyI0vgthuXgGyi9RDwjZ4dqhgnojSm DlmHdWKU8qaATPXFu3Q8OrE1szLuE0AtkPv+skJGxfNT2WQBY4Br6nqtp+rnKz7lVKti nzAkHD7hxGOH6WBPusly7ql1R2ka+nmBvWzeURrceadgWvFcYSb/EpnEFdFAJAHgFdWL Rc7rCi1hXmhoA3YIM6MPkxnYYb5xNlSbujY2CoikPc5b/nU5QEa+W3vvNgCKRWlGyq+X gwl1L3mqFvM8qqZeJ+8W4IonYY1Tj/o4XGey+4UDM9RsK+uYm7D6OK420A7BlDllqTqH Nw== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com with ESMTP id 3amfwj0h5q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 23 Aug 2021 12:40:34 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 23 Aug 2021 12:40:33 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Mon, 23 Aug 2021 12:40:33 -0700 Received: from BG-LT7430.marvell.com (BG-LT7430.marvell.com [10.28.177.176]) by maili.marvell.com (Postfix) with ESMTP id C4D285B6937; Mon, 23 Aug 2021 12:40:31 -0700 (PDT) From: To: CC: , , Pavan Nikhilesh Date: Tue, 24 Aug 2021 01:10:07 +0530 Message-ID: <20210823194020.1229-3-pbhagavatula@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210823194020.1229-1-pbhagavatula@marvell.com> References: <20210823194020.1229-1-pbhagavatula@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: V7KC5bYfq5hTpBk_ce3EV2by-7xx-Xc9 X-Proofpoint-GUID: V7KC5bYfq5hTpBk_ce3EV2by-7xx-Xc9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-08-23_04,2021-08-23_01,2020-04-07_01 Subject: [dpdk-dev] [RFC 03/15] eventdev: move eventdevs globals to hugepage mem X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" From: Pavan Nikhilesh Move the global struct eventdevs to hugepage memory, allocate memory on the first pmd allocate request for both primary and secondary process. Signed-off-by: Pavan Nikhilesh --- lib/eventdev/rte_eventdev.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c index 594dd5e759..21c5c55086 100644 --- a/lib/eventdev/rte_eventdev.c +++ b/lib/eventdev/rte_eventdev.c @@ -38,9 +38,7 @@ #include "eventdev_pmd.h" #include "rte_eventdev_trace.h" -static struct rte_eventdev rte_event_devices[RTE_EVENT_MAX_DEVS]; - -struct rte_eventdev *rte_eventdevs = rte_event_devices; +struct rte_eventdev *rte_eventdevs; static struct rte_eventdev_global eventdev_globals = { .nb_devs = 0 @@ -64,13 +62,13 @@ rte_event_dev_get_dev_id(const char *name) return -EINVAL; for (i = 0; i < eventdev_globals.nb_devs; i++) { - cmp = (strncmp(rte_event_devices[i].data->name, name, - RTE_EVENTDEV_NAME_MAX_LEN) == 0) || - (rte_event_devices[i].dev ? (strncmp( - rte_event_devices[i].dev->driver->name, name, - RTE_EVENTDEV_NAME_MAX_LEN) == 0) : 0); - if (cmp && (rte_event_devices[i].attached == - RTE_EVENTDEV_ATTACHED)) + cmp = (strncmp(rte_eventdevs[i].data->name, name, + RTE_EVENTDEV_NAME_MAX_LEN) == 0) || + (rte_eventdevs[i].dev ? + (strncmp(rte_eventdevs[i].dev->driver->name, + name, RTE_EVENTDEV_NAME_MAX_LEN) == 0) : + 0); + if (cmp && (rte_eventdevs[i].attached == RTE_EVENTDEV_ATTACHED)) return i; } return -ENODEV; @@ -1469,6 +1467,18 @@ rte_event_pmd_allocate(const char *name, int socket_id) struct rte_eventdev *eventdev; uint8_t dev_id; + if (rte_eventdevs == NULL) { + rte_eventdevs = rte_zmalloc("Eventdev", + sizeof(struct rte_eventdev) * + RTE_EVENT_MAX_DEVS, + RTE_CACHE_LINE_SIZE); + if (rte_eventdevs == NULL) { + RTE_EDEV_LOG_ERR( + "Unable to allocate memory for event devices"); + return NULL; + } + } + if (rte_event_pmd_get_named_dev(name) != NULL) { RTE_EDEV_LOG_ERR("Event device with name %s already " "allocated!", name); -- 2.17.1