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 EE4E2A0032; Wed, 14 Sep 2022 09:59:40 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5132742B7B; Wed, 14 Sep 2022 09:59:20 +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 8B0CD42B76 for ; Wed, 14 Sep 2022 09:59:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663142358; 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=nKxi/s9/IO+m3yiFkJLUOeLhVfRiqRKpDmklCxn/YBw=; b=XCd1UxCuGDETWsT4o+Jx8I8dOYrwUpbgtUsr8VIoEJrX74srLRmXPDeS/GyXU3UT4PZd1r R0sQSFLbOMgO2amMYdquOet7pkb5ABUOm8wWa5A00bYU6vQBj2MurDOOHM2ObYlbnlVdsz klvsY+EqtnSzuH+eXby4CBYAdzXrJ1g= 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-478-DlrzfyWHMSSUhC_Vs9yHCw-1; Wed, 14 Sep 2022 03:59:15 -0400 X-MC-Unique: DlrzfyWHMSSUhC_Vs9yHCw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AEF511C1394B; Wed, 14 Sep 2022 07:59:14 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id EC46C1121319; Wed, 14 Sep 2022 07:59:13 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: thomas@monjalon.net, bruce.richardson@intel.com Subject: [PATCH v6 06/27] examples/ethtool: prefer device name Date: Wed, 14 Sep 2022 09:58:20 +0200 Message-Id: <20220914075841.51555-7-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.3 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 Rely on the generic device name rather than restrict to only supporting PCI devices. Signed-off-by: David Marchand --- examples/ethtool/lib/rte_ethtool.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c index ffaad96498..88dc917b73 100644 --- a/examples/ethtool/lib/rte_ethtool.c +++ b/examples/ethtool/lib/rte_ethtool.c @@ -8,7 +8,6 @@ #include #include #include -#include #ifdef RTE_NET_IXGBE #include #endif @@ -23,8 +22,6 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo) { struct rte_eth_dev_info dev_info; struct rte_dev_reg_info reg_info; - const struct rte_pci_device *pci_dev; - const struct rte_bus *bus = NULL; int n; int ret; @@ -52,18 +49,8 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo) strlcpy(drvinfo->driver, dev_info.driver_name, sizeof(drvinfo->driver)); strlcpy(drvinfo->version, rte_version(), sizeof(drvinfo->version)); - /* TODO: replace bus_info by rte_devargs.name */ - if (dev_info.device) - bus = rte_bus_find_by_device(dev_info.device); - if (bus && !strcmp(bus->name, "pci")) { - pci_dev = RTE_DEV_TO_PCI(dev_info.device); - snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info), - "%04x:%02x:%02x.%x", - pci_dev->addr.domain, pci_dev->addr.bus, - pci_dev->addr.devid, pci_dev->addr.function); - } else { - snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info), "N/A"); - } + strlcpy(drvinfo->bus_info, dev_info.device->name, + sizeof(drvinfo->bus_info)); memset(®_info, 0, sizeof(reg_info)); rte_eth_dev_get_reg_info(port_id, ®_info); -- 2.37.3