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 14CBAA054A; Mon, 5 Sep 2022 10:42:36 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BC8FB42B85; Mon, 5 Sep 2022 10:41:48 +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 37D10400D6 for ; Mon, 5 Sep 2022 10:41:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662367305; 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=S7odfnqCfDAlkz44J7xeHzx+QgQqWPNSOZk5HJ2tmDo=; b=g2kcBd8tYcoWABB9rPyZPAAnWELIj990cFZWT1mHN5y1Ni7a1DRiY3WHgEog4QC0vCnN8a oJny/uEwxxb0oxxk61bCiAAsFT2HR3dpb+5QNIFziN1qRB5FGNZuBBO6gOKwR2OdgfAmVR Bce8T+E75UZFM6k9aOY2salTyWm87ao= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-320-pzLUc8l1NoulyFw3hWrKxg-1; Mon, 05 Sep 2022 04:41:42 -0400 X-MC-Unique: pzLUc8l1NoulyFw3hWrKxg-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 121F584B054; Mon, 5 Sep 2022 08:41:42 +0000 (UTC) Received: from fchome.redhat.com (unknown [10.40.193.251]) by smtp.corp.redhat.com (Postfix) with ESMTP id D12AF403167; Mon, 5 Sep 2022 08:41:40 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: thomas@monjalon.net, bruce.richardson@intel.com, Aman Singh , Yuying Zhang , Ray Kinsella Subject: [PATCH v5 25/27] dev: provide bus specific information Date: Mon, 5 Sep 2022 10:39:31 +0200 Message-Id: <20220905083933.2506819-26-david.marchand@redhat.com> In-Reply-To: <20220905083933.2506819-1-david.marchand@redhat.com> References: <20220628144643.1213026-1-david.marchand@redhat.com> <20220905083933.2506819-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 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 For diagnostic, it may be useful to provide a description of the device with bus specific information. Signed-off-by: David Marchand Acked-by: Bruce Richardson --- Changes since RFC v3: - split patch in two, as per Thomas offlist request, --- app/test-pmd/config.c | 2 ++ lib/eal/common/eal_common_dev.c | 6 ++++++ lib/eal/include/rte_dev.h | 16 ++++++++++++++++ lib/eal/version.map | 1 + 4 files changed, 25 insertions(+) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index de74690f06..c5e5a66fa4 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -654,6 +654,8 @@ device_infos_display(const char *identifier) printf("\n%s Infos for device %s %s\n", info_border, rte_dev_name(dev), info_border); printf("Bus name: %s", rte_bus_name(rte_dev_bus(dev))); + printf("\nBus information: %s", + rte_dev_bus_info(dev) ? rte_dev_bus_info(dev) : ""); printf("\nDriver name: %s", rte_driver_name(rte_dev_driver(dev))); printf("\nDevargs: %s", rte_dev_devargs(dev) ? rte_dev_devargs(dev)->args : ""); diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c index 7b12d6e531..a190bd37af 100644 --- a/lib/eal/common/eal_common_dev.c +++ b/lib/eal/common/eal_common_dev.c @@ -31,6 +31,12 @@ rte_dev_bus(const struct rte_device *dev) return dev->bus; } +const char * +rte_dev_bus_info(const struct rte_device *dev) +{ + return dev->bus_info; +} + const struct rte_devargs * rte_dev_devargs(const struct rte_device *dev) { diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h index ce97ee1086..f010dd6441 100644 --- a/lib/eal/include/rte_dev.h +++ b/lib/eal/include/rte_dev.h @@ -98,6 +98,21 @@ __rte_experimental const struct rte_bus * rte_dev_bus(const struct rte_device *dev); +/** + * Retrieve bus specific information for a device. + * + * @warning + * @b EXPERIMENTAL: this API may change without prior notice + * + * @param dev + * A pointer to a device structure. + * @return + * A string describing this device or NULL if none is available. + */ +__rte_experimental +const char * +rte_dev_bus_info(const struct rte_device *dev); + /** * Retrieve a device arguments. * @@ -170,6 +185,7 @@ rte_dev_numa_node(const struct rte_device *dev); struct rte_device { RTE_TAILQ_ENTRY(rte_device) next; /**< Next device */ const char *name; /**< Device name */ + const char *bus_info; /**< Device bus specific information */ const struct rte_driver *driver; /**< Driver assigned after probing */ const struct rte_bus *bus; /**< Bus handle assigned on scan */ int numa_node; /**< NUMA node connection */ diff --git a/lib/eal/version.map b/lib/eal/version.map index 719789b8d1..0cf321605e 100644 --- a/lib/eal/version.map +++ b/lib/eal/version.map @@ -427,6 +427,7 @@ EXPERIMENTAL { # added in 22.11 rte_dev_bus; + rte_dev_bus_info; rte_dev_devargs; rte_dev_driver; rte_dev_name; -- 2.37.2