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 46BD1A0032; Wed, 14 Sep 2022 10:02:16 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0923742BC0; Wed, 14 Sep 2022 10:01:06 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 2306142BB2 for ; Wed, 14 Sep 2022 10:01:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663142464; 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=ND85HzvtE2uw7fqKBIqtQm5r8l4JmnZHAImA/8gSZUc=; b=jQZfM1TgkFtwJfxFeFzbnUoKS0m3ke/wxi0Rc024ix4Zdn0tg+RGqFMOjCO6dpAeJAXqnz 5auhwAQDxfCGF5BiTzLAbOdxutUxWwODV8LiIPXaeTED7RwRkh9QxV1ssAjlLnbw0txPC9 bEjuTy0/eH1vA0FGPRGvvS4wK64b3fc= 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-201-hWFqXVcBP3OxDkanSZA7gg-1; Wed, 14 Sep 2022 04:01:01 -0400 X-MC-Unique: hWFqXVcBP3OxDkanSZA7gg-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 ECDAE296A607; Wed, 14 Sep 2022 08:01:00 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id BC1E7492B04; Wed, 14 Sep 2022 08:00:59 +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 v6 25/27] dev: provide bus specific information Date: Wed, 14 Sep 2022 09:58:39 +0200 Message-Id: <20220914075841.51555-26-david.marchand@redhat.com> In-Reply-To: <20220914075841.51555-1-david.marchand@redhat.com> References: <20220628144643.1213026-1-david.marchand@redhat.com> <20220914075841.51555-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 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.3