From patchwork Thu Apr 22 07:24:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xueming Li X-Patchwork-Id: 92005 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A3A33A09E4; Thu, 22 Apr 2021 09:25:36 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9630241814; Thu, 22 Apr 2021 09:25:36 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by mails.dpdk.org (Postfix) with ESMTP id 8F1A2413E6 for ; Thu, 22 Apr 2021 09:25:34 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from xuemingl@nvidia.com) with SMTP; 22 Apr 2021 10:25:30 +0300 Received: from nvidia.com ([172.27.8.62]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 13M7PSHX001699; Thu, 22 Apr 2021 10:25:29 +0300 From: Xueming Li To: Cc: dev@dpdk.org, xuemingl@nvidia.com, Matan Azrad , Shahaf Shuler , Viacheslav Ovsiienko Date: Thu, 22 Apr 2021 15:24:45 +0800 Message-Id: <20210422072446.29455-1-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH] net/mlx5: probe LAG representor with PF1 PCI address X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" In case of bonding, orchestrator wants to use same devargs for LAG and non-LAG scenario, to probe representor on PF1 using PF1 PCI address like ",representor=pf1vf[0-3]". This patch changes PCI address check policy to allow PF1 PCI address for representors on PF1. Note: detaching PF0 device can't remove representors on PF1. It's recommended to use primary(PF0) PCI address to probe representors on both PFs. Signed-off-by: Xueming Li --- drivers/net/mlx5/linux/mlx5_os.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index 76c72d0e38..22271e289a 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -1875,11 +1875,14 @@ mlx5_device_bond_pci_match(const struct ibv_device *ibv_dev, tmp_str); break; } - /* Match PCI address. */ + /* Match PCI address, allows BDF0+pfx or BDFx+pfx. */ if (pci_dev->domain == pci_addr.domain && pci_dev->bus == pci_addr.bus && pci_dev->devid == pci_addr.devid && - pci_dev->function + owner == pci_addr.function) + ((pci_dev->function == 0 && + pci_dev->function + owner == pci_addr.function) || + (pci_dev->function == owner && + pci_addr.function == owner))) pf = info.port_name; /* Get ifindex. */ snprintf(tmp_str, sizeof(tmp_str),