From: Ferruh Yigit Subject: Re: [PATCH] net/mlx5: use PCI BDF as the port name Date: Thu, 1 Mar 2018 13:59:43 +0000 Message-ID: References: <1516613406-21257-1-git-send-email-yliu@fridaylinux.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: Adrien Mazarguil , Nelio Laranjeiro , Yongseok Koh To: Yuanhan Liu , dev@dpdk.org Return-path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id A296E4CA1 for ; Thu, 1 Mar 2018 14:59:46 +0100 (CET) In-Reply-To: <1516613406-21257-1-git-send-email-yliu@fridaylinux.org> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 1/22/2018 9:30 AM, Yuanhan Liu wrote: > It is suggested to use PCI BDF to identify a port for port addition > in OVS-DPDK. While mlx5 has its own naming style: name it by ib dev > name. This breaks the typical OVS DPDK use case and brings more puzzle > to the end users. > > To fix it, this patch changes it to use PCI BDF as the name, too. > Also, a postfix " port %u" is added, just in case their might be more > than 1 port assoicated with a PCI device. > > Signed-off-by: Yuanhan Liu <...> > @@ -633,14 +635,15 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) > .inline_max_packet_sz = MLX5_ARG_UNSET, > }; > > + len = snprintf(name, sizeof(name), PCI_PRI_FMT, > + pci_dev->addr.domain, pci_dev->addr.bus, > + pci_dev->addr.devid, pci_dev->addr.function); > + if (device_attr.orig_attr.phys_port_cnt > 1) > + snprintf(name + len, sizeof(name), " port %u", i); Getting a build error [1] with icc [2]. Because commit 9a761de8ea14 ("net/mlx5: flow counter support") adds variable "device_attr" into loop scope, but there is already a variable with same name in function scope. In this case the variable in the loop scope should be used and compiler error looks correct, not sure why others compilers not complain about it. [1] .../dpdk/drivers/net/mlx5/mlx5.c(729): error #592: variable "device_attr" is used before its value is set if (device_attr.orig_attr.phys_port_cnt > 1) ^ [2] icc (ICC) 18.0.1 20171018