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 DFA61A0547; Mon, 5 Sep 2022 10:40:19 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5862442B6D; Mon, 5 Sep 2022 10:40:04 +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 D54864284D for ; Mon, 5 Sep 2022 10:40:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662367201; 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=7ppVe9gXX6tpk+d6Zh5/dhx/pla8ivJhmHutM4G+Cw8=; b=WY99dHrp3le4DLwrUj9scqUCUN61nJuyBMdE6524xypTSDtdJh039nWQ8ZrxOmzBI4lsIH z2P3pVmD5aRllKmkyvkxEQ4t4Y0q+4f4ZCVt4BY7tuJCkPaEDupIaVy+/qaDCmAMX1JWDq EYaSFL0JVUxuhzr22T7AZ2OWhupq/ns= 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-562-E9T3P-NxOS61zFwSnJHQiA-1; Mon, 05 Sep 2022 04:39:58 -0400 X-MC-Unique: E9T3P-NxOS61zFwSnJHQiA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4B47A821BF3; Mon, 5 Sep 2022 08:39:58 +0000 (UTC) Received: from fchome.redhat.com (unknown [10.40.193.251]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8889C403D0D9; Mon, 5 Sep 2022 08:39:57 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: thomas@monjalon.net, bruce.richardson@intel.com Subject: [PATCH v5 06/27] examples/ethtool: prefer device name Date: Mon, 5 Sep 2022 10:39:12 +0200 Message-Id: <20220905083933.2506819-7-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.84 on 10.11.54.2 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.2