From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by dpdk.org (Postfix) with ESMTP id A34091BDDA for ; Wed, 27 Jun 2018 15:32:05 +0200 (CEST) Received: by mail-wm0-f66.google.com with SMTP id e69-v6so2931358wme.2 for ; Wed, 27 Jun 2018 06:32:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=kNiRdnuuU67gPFPQK+FvMS+f9GAxPSuN03y7smoK7RU=; b=M7tclPfpiHD058A3rAoY0x1S2Tkgng5+/+1WLa8Pqymi5uLbSqxNgF631MjKkctr/m z2e5T7ju6NHAR65X2LkixAj5tOH8gotG6UZKtQ3wlU3ygpBwLcPOyGBweIY59V49Prap 82W/i2fmUy10qlow4D533qppJRDx8z6aJItcWJjbclATDUhnnwhVUclYzccc+bIeGU0Y qz0YxNNUDhJIsiqg2ftS4kuIBxGd3/4VZ3xOug36NUbmuHpVwfeO5BvdCOeR208fh9BO SFR9dBs57BwsdxrchsX4Kx03DGbWHjTbv1oqTcDxJn8ILWMP5JTJ5jhO0gHjddaZSIaa JiVw== 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; bh=kNiRdnuuU67gPFPQK+FvMS+f9GAxPSuN03y7smoK7RU=; b=UUsXKrvbr/UaRAYgvZ5HjErDb7ud3xH5CcJAZw7t1ljlhvdBBzmzi2YEzcavPPidWa nlk6PbW8rQTzxaCOcymAhhsBmRnkPq+W+oOIsAcIzXiFOFbxQUmfnK4G0yEvg0b2OT1U +vIg0CF9mNpjESt64bIW4qe+ZVido4Aagb3ZLGhaXBExGFKnYs4/GTTEipSEDZV6O8+Z huAe2+Oamsh4uqgi6KPXGBcp3ZHC1H9SqPCrTEflN6M2ilUyLadNGj+QgbmhNmqHzHQ/ sqI1AFwnx+z5Fa6GSTjqlXKqJyJ8RFK3alQH5mkjcQHmnNIh7LtgPTpMnMpzkHyTn9US qs9A== X-Gm-Message-State: APt69E0nch+a4iQuv+VeVyRi02v7gMvyjlSHJsQ+r0/JInO9Hy2bjHvX /lQjopFfgQchg9HI4zs8QKbBNQ== X-Google-Smtp-Source: AAOMgpebf85EcBjEI9iC4bDCP/a/VYj4VEorpCYrFGDNQNvHO1Qtjy3jR6E2NqwdliFnxbq8lDetJg== X-Received: by 2002:a1c:58a:: with SMTP id 132-v6mr4843561wmf.95.1530106325391; Wed, 27 Jun 2018 06:32:05 -0700 (PDT) Received: from 6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id s17-v6sm3130239wmc.34.2018.06.27.06.32.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Jun 2018 06:32:04 -0700 (PDT) Date: Wed, 27 Jun 2018 15:31:48 +0200 From: Adrien Mazarguil To: Shahaf Shuler Cc: "dev@dpdk.org" Message-ID: <20180627133148.GS4025@6wind.com> References: <20180525161814.13873-1-adrien.mazarguil@6wind.com> <20180614083047.10812-1-adrien.mazarguil@6wind.com> <20180614083047.10812-4-adrien.mazarguil@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [dpdk-dev] [PATCH v2 3/7] net/mlx5: split PCI from generic probing code 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: Wed, 27 Jun 2018 13:32:05 -0000 On Sun, Jun 17, 2018 at 10:14:58AM +0000, Shahaf Shuler wrote: > Thursday, June 14, 2018 11:35 AM, Adrien Mazarguil: > > Subject: [PATCH v2 3/7] net/mlx5: split PCI from generic probing code > > > > All the generic probing code needs is an IB device. While this device is > > currently supplied by a PCI lookup, other methods will be added soon. > > > > This patch divides the original function, which has become huge over time, as > > follows: > > > > 1. PCI-specific (mlx5_pci_probe()). > > 2. All ports of a Verbs device (mlx5_dev_spawn()). > > 3. A given port of a Verbs device (mlx5_dev_spawn_one()). > > > > (Patch based on prior work from Yuanhan Liu) > > > > Signed-off-by: Adrien Mazarguil > > -- > > v2 changes: > > > > - Fixed device naming. A port suffix is now appended only if several IB > > ports happen to be detected. > > - Added separate message to distinguish missing kernel drivers from other > > initialization errors, as it was confusing. > > +static int > > +mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, > > + struct rte_pci_device *pci_dev) { > > + struct ibv_device **ibv_list; > > + struct rte_eth_dev **eth_list = NULL; > > + int vf; > > + int ret; > > + > > + assert(pci_drv == &mlx5_driver); > > + switch (pci_dev->id.device_id) { > > + case PCI_DEVICE_ID_MELLANOX_CONNECTX4VF: > > + case PCI_DEVICE_ID_MELLANOX_CONNECTX4LXVF: > > + case PCI_DEVICE_ID_MELLANOX_CONNECTX5VF: > > + case PCI_DEVICE_ID_MELLANOX_CONNECTX5EXVF: > > + vf = 1; > > + break; > > + default: > > + vf = 0; > > + } > > Even though I couldn't find any functional bug, I think it is logically more correct to determine if pci device is vf after we know this is Mellanox device. > Meaning the above block should be ... > > + while (ret-- > 0) { > > + struct rte_pci_addr pci_addr; > > + > > + DRV_LOG(DEBUG, "checking device \"%s\"", ibv_list[ret]- > > >name); > > + if (mlx5_ibv_device_to_pci_addr(ibv_list[ret], &pci_addr)) > > + continue; > > + if (pci_dev->addr.domain != pci_addr.domain || > > + pci_dev->addr.bus != pci_addr.bus || > > + pci_dev->addr.devid != pci_addr.devid || > > + pci_dev->addr.function != pci_addr.function) > > + continue; > > + DRV_LOG(INFO, "PCI information matches, using device > > \"%s\"", > > + ibv_list[ret]->name); > > + break; > > + } > > Here. No problem, I will update. -- Adrien Mazarguil 6WIND