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 96CA81B36D; Sun, 11 Feb 2018 09:29:37 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 0EFDC20D6C; Sun, 11 Feb 2018 03:29:37 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Sun, 11 Feb 2018 03:29:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux.org; h=cc:date:from:message-id:subject:to:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=tCaWFkn88ZkrakFKXVJgfVzztc6QW0z5wc9rmLk8Q 2U=; b=K30gkeOZ/29au9wF/iaMR5n1+Ij1TkQoKQ29WSFOgXIlq3bsxWUY0UUY8 2Qrotn/Q/KkEY4opsngrGE6C7Kx4BDz0seQqQJG+JN/PzLzAbywyuZy9YnzPrmgM xWtBQVnXesAfIuSfMpLaZvIPtddaWhS9bZhsEPvUVALoKXlo+RbD3A7dXbLhG83K xppJx56GXjsyu7ilXQGpmmZaUzt60gsdoPYeFcIyW40OcWVW/+ii7QnBsEbY/Z26 6mKnuQqXLf72aaYHCLAwkMMmCsJJyuUHnM/qdz2ykFJy/kPRocqbmufQYias/P+4 0H3RIuIiGZzDUFhEGqDxZmWG/1Haw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=tCaWFkn88ZkrakFKX VJgfVzztc6QW0z5wc9rmLk8Q2U=; b=dA+CvpVkFJqq8EuJsdXWkhYUZqoBFMOWD fRODS/pk7Rr9mkHqL9rtG0twlsmmdEWC0yvl/FfdtIPrmLee6yBVrrFqsU9thPZC XIvjY4lw215zpOxTYNOWzacECbq9eX8rk26U91xahNrOXqN/as3gWYkP3Xy203gT cNF9KXMGYNTJxGqWSp/xOPrR+m0bOLBQdpCZpIkOjIS31oyJOmm5SxFlT8Jb9U0b slzDzyNcRE3ON04ybMV0FQkbVlfxxdXYM9R+Skf8Amo6NeOwrUMZdqZwJ43coB7N iRgLZ2G9AfRSb0dODfVhpcLb9to3ng2TC65ZyyoY/i1KD6DK1jUEg== X-ME-Sender: Received: from yliu-mob.mtl.com (unknown [115.150.101.1]) by mail.messagingengine.com (Postfix) with ESMTPA id C42D224108; Sun, 11 Feb 2018 03:29:34 -0500 (EST) From: Yuanhan Liu To: dev@dpdk.org Cc: Adrien Mazarguil , Nelio Laranjeiro , Yongseok Koh , Shahaf Shuler , Yuanhan Liu , stable@dpdk.org Date: Sun, 11 Feb 2018 16:29:32 +0800 Message-Id: <1518337772-24763-1-git-send-email-yliu@fridaylinux.org> X-Mailer: git-send-email 2.7.4 Subject: [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: Sun, 11 Feb 2018 08:29:37 -0000 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. 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