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 F407AA034C; Thu, 28 Jul 2022 21:27:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E44AE40151; Thu, 28 Jul 2022 21:27:55 +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 ABCC54014F for ; Thu, 28 Jul 2022 21:27:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659036474; 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: in-reply-to:in-reply-to:references:references; bh=qqTQQGMVWdJWRrQ799ZdNXzyIsdltiegMLaz6eTcYf0=; b=gMbu/3AJMVNsn80P1+FtZf4nsQyjvbVD3kwluvM7y+lEe7RhThkS7MAMfunh5fEhoL7XF7 1xXEM2D2AgnrX+QTp6bRhdjTKth5pIvY8k8g19WtTR40vcyakhP7wmQLP6hNLwHjigav3b kvi9T0y5tv8jq2mrmGltoBi4JgJWOuE= Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-536-GtVVkdGKN5WT9jfjL4V7Hg-1; Thu, 28 Jul 2022 15:27:45 -0400 X-MC-Unique: GtVVkdGKN5WT9jfjL4V7Hg-1 Received: by mail-lf1-f70.google.com with SMTP id a19-20020a19f813000000b0048a7379e38bso925180lff.5 for ; Thu, 28 Jul 2022 12:27:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=qqTQQGMVWdJWRrQ799ZdNXzyIsdltiegMLaz6eTcYf0=; b=fyuzjs5289QkOhy2qzCLtc8UW5HC9pWx5BrLGkLJC8dUtRYhetgr//W3JmPq3AnEHN OXMrQKVHp9ibpo9TbEeMEkqZBT0gdyA21LvA77hCTI4ncqzhzlbgfwzWysHV5CSdeey6 54N/KQA5pMTMJ2e4NWF9LOLrrpIkt/RiBqIaMzqfl+YyF1qWylaNgI0bDRKUA8PmjKd/ 1q83tkfLwZimU8EAx9ZK0fHHUFb6KmD246pFFRl1mHC9mOG2YPqSfOOqC33Lr6y5NIq7 kXH1SgzO9kRzkFf7RhEufQ9kJwHtAWCcFn3LkLGtz4AzLo9R1Fmj3MbLvoievheJ+vUo GfVg== X-Gm-Message-State: AJIora/WgOKSmEXA20gy+z4K8DtlYHPnzyXYhfSnR4/Q72yJ0LeXuSzh 2itjjt2BcPa6Vh11gtDlaQowhgT9jkvO73lmUei5J78YUToHzPmb61wX7dnSEYOngDL1xH+yqPB QeZnyF8T7OkDHx9eZrpY= X-Received: by 2002:a19:6d0d:0:b0:48a:8b3c:e28 with SMTP id i13-20020a196d0d000000b0048a8b3c0e28mr96654lfc.265.1659036463529; Thu, 28 Jul 2022 12:27:43 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v2BTrsUVqDoX564K/9iMQq43OjyUlg7HA7m8vTMe0NK0k7oJQqZWoiJxLREDa3yQHVuGGU6O/aHPXwOOE+Al4= X-Received: by 2002:a19:6d0d:0:b0:48a:8b3c:e28 with SMTP id i13-20020a196d0d000000b0048a8b3c0e28mr96647lfc.265.1659036463272; Thu, 28 Jul 2022 12:27:43 -0700 (PDT) MIME-Version: 1.0 References: <20220628144643.1213026-1-david.marchand@redhat.com> <20220728152640.547725-1-david.marchand@redhat.com> <20220728152640.547725-7-david.marchand@redhat.com> In-Reply-To: From: David Marchand Date: Thu, 28 Jul 2022 21:27:31 +0200 Message-ID: Subject: Re: [RFC v3 06/26] examples/ethtool: prefer device name To: Bruce Richardson Cc: dev Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" 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 On Thu, Jul 28, 2022 at 6:32 PM Bruce Richardson wrote: > > On Thu, Jul 28, 2022 at 05:26:20PM +0200, David Marchand wrote: > > 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)); > > > > Does the bus_info field need to be renamed now? It seems strange coping a > device name to a bus info field. This bus_info name in the example is copied from ethtool. So maybe it is the other way, and I should rename the new field I added in rte_device.. -- David Marchand