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 46ADDA0550; Fri, 26 Aug 2022 14:45:16 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B4B5C42B85; Fri, 26 Aug 2022 14:44:34 +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 8997342B6C for ; Fri, 26 Aug 2022 14:44:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661517873; 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=TMLELPqFRVDmZcw/btNQ18W1rQ88bwwnH0f6nSoUwA7/zcEtkwulgMRhCEWK91LF83DGZb lZE8S4cleaPQRVO1hNn3WwINs9KAeepLejT35gwYmTTslHNPbHVhA9SRwLOFDyzPiP1Cyh jOE5y8FYuY0NZzYlcxfPmMpa5uMdyNA= 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-388-uTFUO_gNPYmEBXC8lcoWhg-1; Fri, 26 Aug 2022 08:44:30 -0400 X-MC-Unique: uTFUO_gNPYmEBXC8lcoWhg-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 8E2EA2919EC7; Fri, 26 Aug 2022 12:44:29 +0000 (UTC) Received: from fchome.redhat.com (unknown [10.40.193.251]) by smtp.corp.redhat.com (Postfix) with ESMTP id 59C2E2026D4C; Fri, 26 Aug 2022 12:44:28 +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 v4 25/27] dev: provide bus specific information Date: Fri, 26 Aug 2022 14:42:06 +0200 Message-Id: <20220826124208.671400-26-david.marchand@redhat.com> In-Reply-To: <20220826124208.671400-1-david.marchand@redhat.com> References: <20220628144643.1213026-1-david.marchand@redhat.com> <20220826124208.671400-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 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