From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 1E22BA00C3;
	Fri,  1 Jul 2022 10:10:05 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id C87DA4069D;
	Fri,  1 Jul 2022 10:10:04 +0200 (CEST)
Received: from us-smtp-delivery-124.mimecast.com
 (us-smtp-delivery-124.mimecast.com [170.10.133.124])
 by mails.dpdk.org (Postfix) with ESMTP id E454F40150
 for <dev@dpdk.org>; Fri,  1 Jul 2022 10:10:02 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1656663002;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=49aON37ETqK/kWYo1xUURRrdx7HAsANmhrkS9PBpDSw=;
 b=XN87zMcB9WJOsa6JFmpLaGmgLsV0UM7hC1uyf5Ay1R+Otka32kSRUV9JhbD2V1vPK8HoSX
 fKG9TZmOl6nA+G3BddG0id7ebO9jWpYHOnYRWulkQXupjyRpeqmnyL1FTJJuv0mjk78dd2
 ED2LyZIiKXZd7CcoSQ8MvPPd1ObuR+8=
Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com
 [209.85.167.71]) by relay.mimecast.com with ESMTP with STARTTLS
 (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 us-mta-584-tRamiX4rMVSyI1ldunTaKA-1; Fri, 01 Jul 2022 04:10:01 -0400
X-MC-Unique: tRamiX4rMVSyI1ldunTaKA-1
Received: by mail-lf1-f71.google.com with SMTP id
 be18-20020a056512251200b0048120ff434dso793716lfb.19
 for <dev@dpdk.org>; Fri, 01 Jul 2022 01:10:01 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=49aON37ETqK/kWYo1xUURRrdx7HAsANmhrkS9PBpDSw=;
 b=iMDumBgWEKb0C9P0hFonII3HkS6o8RVjcd5QMZ4+WrYEQf3AiedYuRGDCHCYC6hIYS
 2BeVcD5K9hm6uaVWH5cGmwJal3/XSpUPfTmXaG37zHj6ASV4gyCQuLFASG9rLDuQbUeh
 NxmSfctS9eyPRJEVccUlZ1SUeu6mQvo7MOyQMcLByZCStOdWs3JUcZhJxbomoeDDySEo
 HPAKS/mf7OQIaxiru17bhG+4OZ6au7V598OXJ3IgbPXEQwfOFYgaQHPUsOhf7DdkspC0
 U8fJWeECa7Q+L252XNNs6K3xqXCKrR/ovBHPfsrFxChk/404PeZ3AeONlp3kWB/G9GUM
 zDsA==
X-Gm-Message-State: AJIora9xlJuN/+z42jrFBES+raywvZR7c/vqOU7xyq5dO8jAVxurY0cH
 h6SfnOeS0eif/PzUvTt70zP+F7YMwvl6mFe/0JBi6Mb1k5yID9+FiBcX00qCS3JXXLfDpIs8vKU
 mkslo64KWjWhoCfAAzNg=
X-Received: by 2002:a05:651c:905:b0:25a:9666:d273 with SMTP id
 e5-20020a05651c090500b0025a9666d273mr7999914ljq.297.1656662999813; 
 Fri, 01 Jul 2022 01:09:59 -0700 (PDT)
X-Google-Smtp-Source: AGRyM1s4dG0Fw8Cv9ZGNquT1vBxdrPj4XLixz8kppedbK18oswArd6ET3LuwX6DMA1NbzDmt11xRaSRH6fAKOiykkYk=
X-Received: by 2002:a05:651c:905:b0:25a:9666:d273 with SMTP id
 e5-20020a05651c090500b0025a9666d273mr7999902ljq.297.1656662999572; Fri, 01
 Jul 2022 01:09:59 -0700 (PDT)
MIME-Version: 1.0
References: <20220630094129.2066164-1-david.marchand@redhat.com>
 <DM6PR11MB4252327EC6E2A0B1375291A289BD9@DM6PR11MB4252.namprd11.prod.outlook.com>
 <DM6PR11MB35302FEA68C626C4CC349CC2EFBD9@DM6PR11MB3530.namprd11.prod.outlook.com>
 <CAJFAV8xMG5LFRHT1k_yscoAF7fnoNOW_qayECshjXuE3rYm0FA@mail.gmail.com>
 <DM6PR11MB3530E8CC09407C702A8B03B5EFBD9@DM6PR11MB3530.namprd11.prod.outlook.com>
 <CAJFAV8xde4ttss4VnQwi65FCqNpkV_Fb98R42NCKxn9rdJFhtQ@mail.gmail.com>
 <DM6PR11MB353022F7379668C9B1B15710EFBD9@DM6PR11MB3530.namprd11.prod.outlook.com>
In-Reply-To: <DM6PR11MB353022F7379668C9B1B15710EFBD9@DM6PR11MB3530.namprd11.prod.outlook.com>
From: David Marchand <david.marchand@redhat.com>
Date: Fri, 1 Jul 2022 10:09:48 +0200
Message-ID: <CAJFAV8yhOS++v_n764s5nxKn+ajL_7q_rQ93q+wqv=K+Xiv8tg@mail.gmail.com>
Subject: Re: [PATCH] doc: announce some raw/ifpga API removal
To: "Huang, Wei" <wei.huang@intel.com>
Cc: "Xu, Rosen" <rosen.xu@intel.com>, "Zhang,
 Tianfei" <tianfei.zhang@intel.com>, 
 "dev@dpdk.org" <dev@dpdk.org>, Ray Kinsella <mdr@ashroe.eu>
Authentication-Results: relay.mimecast.com;
 auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Content-Type: text/plain; charset="UTF-8"
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

On Fri, Jul 1, 2022 at 10:02 AM Huang, Wei <wei.huang@intel.com> wrote:
>
>
>
> > -----Original Message-----
> > From: David Marchand <david.marchand@redhat.com>
> > Sent: Friday, July 1, 2022 15:22
> > To: Huang, Wei <wei.huang@intel.com>
> > Cc: Xu, Rosen <rosen.xu@intel.com>; Zhang, Tianfei <tianfei.zhang@intel.com>;
> > dev@dpdk.org; Ray Kinsella <mdr@ashroe.eu>
> > Subject: Re: [PATCH] doc: announce some raw/ifpga API removal
> >
> > On Fri, Jul 1, 2022 at 9:16 AM Huang, Wei <wei.huang@intel.com> wrote:
> > > > What is the PCI bus used for, in this application?
> > > >
> > > In this application, target PCI device is Intel FPGA, it supports some
> > > special operation like removing it from PCI bus and rescanning it back from PCI
> > bus, So there are two things need to be done directly on rte_pci_bus:
> > > 1. Rescan PCI bus
> > >      pci_bus->bus.scan()
> > > 2. Get pci_dev by specified PCI address, and remove it
> > >     TAILQ_FOREACH(pci_dev, &pci_bus->device_list, next) {
> > >         if (!rte_pci_addr_cmp(&pci_dev->addr, &addr))
> > >                 return pci_dev;
> > >     }
> > >     ....
> > >     pci_drv = pci_dev->driver;
> > >     pci_drv->remove(pci_dev);
> >
> > Can't this application use rte_dev_remove and rte_dev_probe?
> > If not, we should add the missing parts in the API.
> >
> Both rte_dev_remove and rte_dev_probe need rte_device pointer. In this application, it only know the device's PCI address, is there an
> existing API to get the rte_pci_device pointer by its PCI address ?

rte_dev_probe takes a devargs string as input.
int rte_dev_probe(const char *devargs);

You need the rte_device for removing which can be retrieved from
rte_rawdev_info_get.

>
> For PCI rescan, I know there is an API called rte_bus_scan(), which seems to be able to replace pci_bus->bus.scan(). But is it reasonable to scan all buses
> when I want to only scan PCI ?
> Why I need to rescan PCI bus, the answer is current PCI scan only add PCI device to rte_pci_bus when it is bound to kernel driver. In our case, a FPGA
> may not bind to any driver, this application bind vfio-pci to it and call bus scan to add it to rte_pci_bus.

Scanning is called on the relevant bus when probing, see local_dev_probe.


-- 
David Marchand