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 012B2A00C5; Sat, 9 Jul 2022 10:29:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 89E0A42B8B; Sat, 9 Jul 2022 10:29:35 +0200 (CEST) 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 587F14280C for ; Sat, 9 Jul 2022 10:29:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657355372; 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=cNemJsj8SJl8QsMeKii2Rv6GtpYdhjyjEhpRulWRzME=; b=A/QJI45X40meNLvjGmSXCnwtABTy0toa0/XRNmJJFe3s8UmbKQn1T2cBima4DmDHOa55Aj SrKsFIxzDeUADD6hfaEEivwa40FhSikao7xcIksHrErwAY2T9u1kPoEUf+uxYhAHzOYqYA mmk6w6IogYMj/45WIVVUpM4b+K6dFRY= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-292-gOlFzWayMdymoQ-EqYjg3w-1; Sat, 09 Jul 2022 04:29:31 -0400 X-MC-Unique: gOlFzWayMdymoQ-EqYjg3w-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 312863806720; Sat, 9 Jul 2022 08:29:31 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.192.194]) by smtp.corp.redhat.com (Postfix) with ESMTP id CAEE52026D64; Sat, 9 Jul 2022 08:29:29 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: Aman Singh , Yuying Zhang , Ray Kinsella , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko Subject: [RFC v2 v2 26/29] dev: introduce driver name Date: Sat, 9 Jul 2022 10:26:41 +0200 Message-Id: <20220709082644.664675-27-david.marchand@redhat.com> In-Reply-To: <20220709082644.664675-1-david.marchand@redhat.com> References: <20220628144643.1213026-1-david.marchand@redhat.com> <20220709082644.664675-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 Add a helper to get a rte_driver object name. This will be used externally. Internal users may still dereference a rte_driver object. Signed-off-by: David Marchand --- app/test-pmd/config.c | 2 +- lib/eal/common/eal_common_dev.c | 6 ++++++ lib/eal/include/rte_dev.h | 13 +++++++++++++ lib/eal/version.map | 1 + lib/ethdev/rte_ethdev.h | 2 +- 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index bc154e8bf7..22aa086ef1 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -654,7 +654,7 @@ device_infos_display(const char *identifier) printf("\n%s Infos for device %s %s\n", info_border, dev->name, info_border); printf("Bus name: %s", rte_bus_name(dev->bus)); - printf("\nDriver name: %s", dev->driver->name); + printf("\nDriver name: %s", rte_driver_name(dev->driver)); printf("\nDevargs: %s", dev->devargs ? dev->devargs->args : ""); printf("\nConnect to socket: %d", dev->numa_node); diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c index 62a598957c..16c5aef1d8 100644 --- a/lib/eal/common/eal_common_dev.c +++ b/lib/eal/common/eal_common_dev.c @@ -19,6 +19,12 @@ #include "eal_private.h" #include "hotplug_mp.h" +const char * +rte_driver_name(const struct rte_driver *driver) +{ + return driver->name; +} + /** * The device event callback description. * diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h index 24f9122558..871a046ffe 100644 --- a/lib/eal/include/rte_dev.h +++ b/lib/eal/include/rte_dev.h @@ -62,6 +62,19 @@ struct rte_driver { const char *alias; /**< Driver alias. */ }; +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice + * + * @param driver + * A pointer to a driver structure. + * @return + * A pointer to the driver name string. + */ +__rte_experimental +const char * +rte_driver_name(const struct rte_driver *driver); + /* * Internal identifier length * Sufficiently large to allow for UUID or PCI address diff --git a/lib/eal/version.map b/lib/eal/version.map index 48c8a2f511..54f85ab01f 100644 --- a/lib/eal/version.map +++ b/lib/eal/version.map @@ -425,6 +425,7 @@ EXPERIMENTAL { # added in 22.11 rte_bus_name; + rte_driver_name; }; INTERNAL { diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index de9e970d4d..e9574f646f 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -3380,7 +3380,7 @@ int rte_eth_macaddrs_get(uint16_t port_id, struct rte_ether_addr *ma, * exists for the device and the rte_eth_dev 'dev' has been populated * successfully with a call to it: * - * driver_name = dev->device->driver->name + * driver_name = rte_driver_name(dev->device->driver) * nb_rx_queues = dev->data->nb_rx_queues * nb_tx_queues = dev->data->nb_tx_queues * dev_flags = &dev->data->dev_flags -- 2.36.1