From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt0-f195.google.com (mail-qt0-f195.google.com [209.85.216.195]) by dpdk.org (Postfix) with ESMTP id 9E0AF1B1CE; Fri, 16 Feb 2018 14:19:28 +0100 (CET) Received: by mail-qt0-f195.google.com with SMTP id g14so3716562qti.2; Fri, 16 Feb 2018 05:19:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=cEiNsVSXS1syWCGVT2iTM5wHqg8KRiStWqo+WAXioDU=; b=nKFTgvZfR62O0GbdYVvuEKY3La/cq4EKUySHomXiOxaqhXLiMKzApmxIzzYXijbzfW 952tL1wVOs9Saav5BkTZeVvijuRW5ed79EExEBpFmjxI+/A6ITXfd/IQpzMwBaWTkeEM zKwSdykfFdKQbktuRTPhI6IXxhG0HNDpnhN0Av9aGDnPjihCWtmcaMJZ/M+3ccPcR6bS MxtR0+1O+tEP+iMg9XrU8ctMNCY8ugmwXEzIsjKccPBMmxx46TM51oSzd72yfdCJmO3i 74wX+DRQ3wBMwLtz9gu5HF3S+R8RVf0MdJRVfvSpcCoQhGFot/VkGBJV5Ggu3Xo0oiw3 D/eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=cEiNsVSXS1syWCGVT2iTM5wHqg8KRiStWqo+WAXioDU=; b=AyHQs4kIC3GKrwik4h5343oL9EbBSmrRmmVW+kL7c9icwxW+Ug1uBeH/OA/9/NEDiJ 1y7qgmLpC3Lw6pAaNbUwtuHbiRLPLRftO7wQuh8TsG4CHLWJDPDv1n7a+h8LR0E9A4Y+ iekbO+Nmdzb+vO5JUSGDj8dE4BV/Jpz468EkaxrPNzict+NHtjhsEMvRlSuTznNL5+eC lGBDkvy0rvMtPX4LWRLEPYUM3a97PLTy3NZhjVcgbj2YlFHln1Uut7kBuX2cg6DjcvJh xwMIAqCHjCCTpHzQE6ih1s34tWopaO/72kG8XNmnZggsUR4dsIz3T4DSx2+fF/v3SCSW Romg== X-Gm-Message-State: APf1xPAa3YO7vTYHhdJoy6U/ffDYactR1JmGL1Kivwqg2WlcxPuASzky t9k0KjHsdrphpLPe71+ZLls= X-Google-Smtp-Source: AH8x224IcyWP+bV5jULgLYtwAdPxsZcuePtDNTL2YBgnVJ0FyZYAiii+bk73i9xKeMjeZRFe22RpGQ== X-Received: by 10.200.26.79 with SMTP id q15mr9531482qtk.174.1518787167879; Fri, 16 Feb 2018 05:19:27 -0800 (PST) Received: from localhost.localdomain ([177.10.56.96]) by smtp.gmail.com with ESMTPSA id e65sm242781qkb.84.2018.02.16.05.19.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 16 Feb 2018 05:19:27 -0800 (PST) Received: by localhost.localdomain (Postfix, from userid 1000) id E68B918108A; Fri, 16 Feb 2018 11:19:24 -0200 (-02) Date: Fri, 16 Feb 2018 11:19:24 -0200 From: Marcelo Ricardo Leitner To: Yuanhan Liu Cc: dev@dpdk.org, Adrien Mazarguil , Nelio Laranjeiro , Yongseok Koh , Shahaf Shuler , stable@dpdk.org Message-ID: <20180216131924.GA5247@localhost.localdomain> References: <1518337772-24763-1-git-send-email-yliu@fridaylinux.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1518337772-24763-1-git-send-email-yliu@fridaylinux.org> User-Agent: Mutt/1.9.2 (2017-12-15) Subject: Re: [dpdk-dev] [PATCH] net/mlx4: use PCI address as port name X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Feb 2018 13:19:28 -0000 On Sun, Feb 11, 2018 at 04:29:32PM +0800, 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 ^ I believe you mean mlx4 here? > 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. > Judging the fact that there are 2 ports associated with one PCI for > ConnectX-3, a postfix is needed. Thus, the final name looks like > something below: > > 0000:04:00.0-port0 > 0000:04:00.0-port1 > > Cc: stable@dpdk.org > Signed-off-by: Yuanhan Liu > --- > drivers/net/mlx4/mlx4.c | 17 +++++++++-------- > 1 file changed, 9 insertions(+), 8 deletions(-) > > diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c > index ee93daf..eb8851c 100644 > --- a/drivers/net/mlx4/mlx4.c > +++ b/drivers/net/mlx4/mlx4.c > @@ -497,6 +497,14 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) > struct priv *priv = NULL; > struct rte_eth_dev *eth_dev = NULL; > struct ether_addr mac; > + char name[RTE_ETH_NAME_MAX_LEN]; > + int len; > + > + 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.phys_port_cnt > 1) > + snprintf(name + len, sizeof(name), "-port%u", i); > > /* If port is not enabled, skip. */ > if (!(conf.ports.enabled & (1 << i))) > @@ -605,14 +613,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) > /* Get actual MTU if possible. */ > mlx4_mtu_get(priv, &priv->mtu); > DEBUG("port %u MTU is %u", priv->port, priv->mtu); > - /* from rte_ethdev.c */ > - { > - char name[RTE_ETH_NAME_MAX_LEN]; > - > - snprintf(name, sizeof(name), "%s port %u", > - mlx4_glue->get_device_name(ibv_dev), port); > - eth_dev = rte_eth_dev_allocate(name); > - } > + eth_dev = rte_eth_dev_allocate(name); > if (eth_dev == NULL) { > ERROR("can not allocate rte ethdev"); > rte_errno = ENOMEM; > -- > 2.7.4 >