From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id 46EA11B358 for ; Sun, 11 Feb 2018 04:38:12 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id DEB9B20DAF; Sat, 10 Feb 2018 22:38:11 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Sat, 10 Feb 2018 22:38:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux.org; h=content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=mh6iTfo1ycRqscnQxukA3hWaWd/c4GvK57hJSJluATE=; b=DBjU02/V NpRszIXPizTcoU0CtXaIycVnmOeE5S1eoYS3mDdhUsE/3Ve5fZDz9+QKYoA/Gtfy 1hTbRGph7NRpSQFYU0oIngymScGB9wy9ze+LHoX8NiWsncG4wabNnSEIRt32SUmJ Q2qEl35SyowzvMV/uENCIT9RgJbM4kphCjWOAzeFitxtf6TMrgvfFOrqYocjp4Ws S+7zaYl+4PfTOOhkPhSipELK7vj/ElAKoKs9LAyBWO9WGvruiPpyGoHZlG4wXkux uNDhNtK9ITxGA2nP+j7BhUcBmLsE91OWEg2cpd4KlXgNH6leQUZ75vpCEzYTtQAO eh/j+fB4EIKd4A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=mh6iTfo1ycRqscnQxukA3hWaWd/c4 GvK57hJSJluATE=; b=Hn1c/KTsfzdXmbCGdw8CCEfR9IM0nw3HkqrVzO87BmdZy EN4VgXB2mhl6q+OR8DOcQa8WpgNbFTTUhuNGeU2VjL6vzCauZ1OFG8lZoR/Ck3Q+ zB8Kk8QRQZkc8amMdFmkI825ywcRTOz+7NXAz9W6trvuQWr9BqQ7Z3yPnB/XFs3m GOE33tyAndpakcw8mVLSytIwJSxvLeJwqBWmspOyWfpzgYOhquVZEzmki0DZHe5i yg2iH2/z46j0rj+5YCe5GeGIGW86w5PExojMIWQEw5udbdEVWEQ2nZEQee/78/32 oJs7E/QO/xgW8l2c/jgsC3/4hkbpGZyVYLb9F3nQA== X-ME-Sender: Received: from yliu-mob (unknown [115.150.101.1]) by mail.messagingengine.com (Postfix) with ESMTPA id 367A3241E0; Sat, 10 Feb 2018 22:38:10 -0500 (EST) Date: Sun, 11 Feb 2018 11:38:08 +0800 From: Yuanhan Liu To: stable@dpdk.org Message-ID: <20180211033808.GG23970@yliu-mob> References: <1518320132-4878-1-git-send-email-yliu@fridaylinux.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1518320132-4878-1-git-send-email-yliu@fridaylinux.org> User-Agent: Mutt/1.5.24 (2015-08-30) Subject: Re: [dpdk-stable] [PATCH 17.11] net/mlx5: use PCI address as port name X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Feb 2018 03:38:12 -0000 On Sun, Feb 11, 2018 at 11:35:32AM +0800, Yuanhan Liu wrote: > [ backported from upstream commit ad831a1176538f726428ebfe70f6607d7d854197 ] Applied to dpdk-stable/17.11. --yliu > > 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 associated with a PCI device. > > Signed-off-by: Yuanhan Liu > Acked-by: Nelio Laranjeiro > --- > drivers/net/mlx5/mlx5.c | 20 +++++++------------- > 1 file changed, 7 insertions(+), 13 deletions(-) > > diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c > index a5eb3fd..912e53c 100644 > --- a/drivers/net/mlx5/mlx5.c > +++ b/drivers/net/mlx5/mlx5.c > @@ -662,6 +662,8 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) > INFO("%u port(s) detected", device_attr.orig_attr.phys_port_cnt); > > for (i = 0; i < device_attr.orig_attr.phys_port_cnt; i++) { > + char name[RTE_ETH_NAME_MAX_LEN]; > + int len; > uint32_t port = i + 1; /* ports are indexed from one */ > uint32_t test = (1 << i); > struct ibv_context *ctx = NULL; > @@ -685,14 +687,13 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) > .rx_vec_en = 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); > + > mlx5_dev[idx].ports |= test; > > if (mlx5_is_secondary()) { > - /* from rte_ethdev.c */ > - char name[RTE_ETH_NAME_MAX_LEN]; > - > - snprintf(name, sizeof(name), "%s port %u", > - ibv_get_device_name(ibv_dev), port); > eth_dev = rte_eth_dev_attach_secondary(name); > if (eth_dev == NULL) { > ERROR("can not attach rte ethdev"); > @@ -902,14 +903,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) > priv_get_mtu(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", > - ibv_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"); > err = ENOMEM; > -- > 2.7.4