From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id 4B76E58C6 for ; Mon, 22 Jan 2018 10:30:13 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 72DE220DA4; Mon, 22 Jan 2018 04:30:12 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Mon, 22 Jan 2018 04:30:12 -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=fm1; bh=58F5BeTxRtv5QGml2Cx5CCe2wonfWvl8YcpjeddYt +M=; b=H3EbIdK8bsvWR7SG6pDknpTw4cq3oOakf7qkrDftcNz+qDc9suvi0Aox6 ZB6sjkJcw9Iy2l/aOiG4TydUmPxnV0Ok0a+nrBBt4fAgM+bYIdl2M0Yy0ahujv13 G2/hHBSmGkFtO60PuczCqStkqKWb4x+a8h0PlJ6yndRiBBi024LZcO15bCwA8CdQ D2xljV8B4FEPnu7NeBO3AieEybYOYZF9ITKo9qQLKAeUnkFkV18T9rOb4V7HdHm/ eYNKGOYlqlI0FGg9+T6rfdVi+HhbX2mJsSBw9sZa9jDg1DJMs3N1HIu+RRWsnLd/ x+zDblS/o4mKgqMK79owaysCUInRg== 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=fm1; bh=58F5BeTxRtv5QGml2 Cx5CCe2wonfWvl8YcpjeddYt+M=; b=j6lNMQkXb1jqYFrL8funqI0vNiRu5G0Ae UZ0U1znM1hoV3DzP1EK7d7dFIPR9IkaBgricmpqaBf/E+o+QYIaXF9N8BYFLuO8Y 9Dze6A1/MK15c0C4/1qAyjm6myJnLOhowaambYRJQbsEtQCXOdtaDtIzXdK+U30Z JF02mo6PpRvLKT1MHj9jjhZp52UODGXtQOmF8Ynpu6pZSAmRXeepAS545Zz7N6+T e0CuA/8MlW5o2DRD29X0wBC+AuEEaobUUF+QFWzzNVs4AB4wk9FO6AhIevqPOTou lCFUlNC2xDl1SA/uQqO0HDPxHf3x2JFFveTVu4TJx283jlxvZq8yw== X-ME-Sender: Received: from yliu-dev.mtl.com (unknown [115.150.27.206]) by mail.messagingengine.com (Postfix) with ESMTPA id 36A1424785; Mon, 22 Jan 2018 04:30:09 -0500 (EST) From: Yuanhan Liu To: dev@dpdk.org Cc: Adrien Mazarguil , Nelio Laranjeiro , Yongseok Koh , Yuanhan Liu Date: Mon, 22 Jan 2018 17:30:06 +0800 Message-Id: <1516613406-21257-1-git-send-email-yliu@fridaylinux.org> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH] net/mlx5: use PCI BDF as the 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: Mon, 22 Jan 2018 09:30:13 -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. 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 --- drivers/net/mlx5/mlx5.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 9d1de36..7cd9db7 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -610,6 +610,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; @@ -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); + mlx5_dev[idx].ports |= test; if (rte_eal_process_type() == RTE_PROC_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"); @@ -834,14 +837,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