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 ED16FA0350 for ; Mon, 21 Feb 2022 16:41:13 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E7BB74013F; Mon, 21 Feb 2022 16:41:13 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 9B8D94013F for ; Mon, 21 Feb 2022 16:41:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645458072; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hgO7w1cZdmoFBXKU6UAZPs1ZVa4Digv1kYWyeeWpV+o=; b=ckHOYv1xhxhboKkjNSJQ56oGjdLzSHdKU3rHRcdmPjgApNLaYSKFg2y2l9IKaFe5RFGFCP ycY1OdZirUfS39Gs9bjyUGrtRv8tf0M27tvnd2+64GpiyWM0cqDYHmfHQ6w8YBosBE+q1H Uu9fFb2sexLMxHGywdfpAgttmxRPQGs= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-228-bCYTiNjbNp2vY9R9JIgs6g-1; Mon, 21 Feb 2022 10:41:08 -0500 X-MC-Unique: bCYTiNjbNp2vY9R9JIgs6g-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C3BB6343C9; Mon, 21 Feb 2022 15:41:07 +0000 (UTC) Received: from rh.Home (unknown [10.39.195.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id BE3E77E2E8; Mon, 21 Feb 2022 15:41:06 +0000 (UTC) From: Kevin Traynor To: Kumara Parameshwaran Cc: Ferruh Yigit , dpdk stable Subject: patch 'ethdev: add internal function to device struct from name' has been queued to stable release 21.11.1 Date: Mon, 21 Feb 2022 15:35:28 +0000 Message-Id: <20220221153625.152324-139-ktraynor@redhat.com> In-Reply-To: <20220221153625.152324-1-ktraynor@redhat.com> References: <20220221153625.152324-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 21.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/26/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/721d0bbd1668d2a4b617a4a4de0b93dd60283d58 Thanks. Kevin --- >From 721d0bbd1668d2a4b617a4a4de0b93dd60283d58 Mon Sep 17 00:00:00 2001 From: Kumara Parameshwaran Date: Mon, 31 Jan 2022 20:02:33 +0530 Subject: [PATCH] ethdev: add internal function to device struct from name [ upstream commit 961fb4029b8c52c0e8230d34993c354d70e10e14 ] The PMDs would need a function to access the rte_eth_devices without accessing the global rte_eth_device array. Signed-off-by: Kumara Parameshwaran Reviewed-by: Ferruh Yigit --- lib/ethdev/ethdev_driver.h | 18 ++++++++++++++++++ lib/ethdev/rte_ethdev.c | 11 +++++++++++ lib/ethdev/version.map | 1 + 3 files changed, 30 insertions(+) diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h index d95605a355..0dac55f9c8 100644 --- a/lib/ethdev/ethdev_driver.h +++ b/lib/ethdev/ethdev_driver.h @@ -1630,4 +1630,22 @@ rte_eth_hairpin_queue_peer_bind(uint16_t cur_port, uint16_t cur_queue, uint32_t direction); +/** + * @internal + * Get rte_eth_dev from device name. The device name should be specified + * as below: + * - PCIe address (Domain:Bus:Device.Function), for example 0000:2:00.0 + * - SoC device name, for example fsl-gmac0 + * - vdev dpdk name, for example net_[pcap0|null0|tap0] + * + * @param name + * PCI address or name of the device + * @return + * - rte_eth_dev if successful + * - NULL on failure + */ +__rte_internal +struct rte_eth_dev* +rte_eth_dev_get_by_name(const char *name); + /** * @internal diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index 29e21ad580..917a320afa 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -895,4 +895,15 @@ rte_eth_dev_get_port_by_name(const char *name, uint16_t *port_id) } +struct rte_eth_dev * +rte_eth_dev_get_by_name(const char *name) +{ + uint16_t pid; + + if (rte_eth_dev_get_port_by_name(name, &pid)) + return NULL; + + return &rte_eth_devices[pid]; +} + static int eth_err(uint16_t port_id, int ret) diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map index c2fb0669a4..1f7359c846 100644 --- a/lib/ethdev/version.map +++ b/lib/ethdev/version.map @@ -268,4 +268,5 @@ INTERNAL { rte_eth_dev_create; rte_eth_dev_destroy; + rte_eth_dev_get_by_name; rte_eth_dev_is_rx_hairpin_queue; rte_eth_dev_is_tx_hairpin_queue; -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-02-21 15:22:47.611834978 +0000 +++ 0139-ethdev-add-internal-function-to-device-struct-from-n.patch 2022-02-21 15:22:44.293704581 +0000 @@ -1 +1 @@ -From 961fb4029b8c52c0e8230d34993c354d70e10e14 Mon Sep 17 00:00:00 2001 +From 721d0bbd1668d2a4b617a4a4de0b93dd60283d58 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 961fb4029b8c52c0e8230d34993c354d70e10e14 ] + @@ -8,2 +9,0 @@ - -Cc: stable@dpdk.org