From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <jianfeng.tan@intel.com>
Received: from mga02.intel.com (mga02.intel.com [134.134.136.20])
 by dpdk.org (Postfix) with ESMTP id 545387CFC
 for <dev@dpdk.org>; Wed,  6 Dec 2017 03:48:41 +0100 (CET)
Received: from orsmga006.jf.intel.com ([10.7.209.51])
 by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 05 Dec 2017 18:48:40 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.45,366,1508828400"; 
   d="scan'208";a="489246"
Received: from tanjianf-mobl.ccr.corp.intel.com (HELO [10.67.64.58])
 ([10.67.64.58])
 by orsmga006.jf.intel.com with ESMTP; 05 Dec 2017 18:48:40 -0800
To: Thomas Monjalon <thomas@monjalon.net>
References: <20171201003642.19827-1-thomas@monjalon.net>
 <5374836.XgGFu4empV@xps> <f0aa8638-f0cd-4b1e-7b87-a7bfe0e04c9c@intel.com>
 <1712827.SmiPysL3o0@xps>
Cc: dev@dpdk.org
From: "Tan, Jianfeng" <jianfeng.tan@intel.com>
Message-ID: <484ecb30-1eae-c1c8-adce-2318dab2f4b1@intel.com>
Date: Wed, 6 Dec 2017 10:48:39 +0800
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101
 Thunderbird/45.8.0
MIME-Version: 1.0
In-Reply-To: <1712827.SmiPysL3o0@xps>
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
Subject: Re: [dpdk-dev] [PATCH] bus/vdev: add custom scan hook
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Wed, 06 Dec 2017 02:48:42 -0000

 > From: Thomas Monjalon [mailto:thomas@monjalon.net]
 > Sent: Tuesday, December 5, 2017 11:21 PM
 > To: Tan, Jianfeng
 > Cc: dev@dpdk.org
 > Subject: Re: [PATCH] bus/vdev: add custom scan hook
 >
 > 05/12/2017 14:56, Tan, Jianfeng:
 > >
 > > On 12/5/2017 4:41 PM, Thomas Monjalon wrote:
 > > >
 > > > 05/12/2017 09:27, Tan, Jianfeng:
 > > >
 > > > >
 > > >
 > > > > On 12/4/2017 5:31 PM, Thomas Monjalon wrote:
 > > >
 > > > > >
 > > >
 > > > > > The hook is in bus->scan().
 > > >
 > > > > > I think we should launch a bus scan when there is a new 
device event.
 > > >
 > > > >
 > > >
 > > > > That's what I'm trying to say. We finally need to execute a 
handler as
 > > >
 > > > > of a device event to finish the job.
 > > >
 > > > Please be more specific, I am not sure to understand.
 > > >
 > >
 > > By the handler, I mean when we monitor the udev by 
select/poll/epoll and
 > > device uevents come, the application will execute a handler (or just a
 > > function) for each of such uevent. Then why not adding the vdev there?
 >
 > Because it must work for hotplug, and initial scan too.
 > We can also think to application requiring a manual scan.
 > The bus scan is the right place to have every scans called. That's 
simple.

Yes, the logic is simpler; anything changes, appication just invokes a 
scan.Then we will have a somewhat complex hook that: (1) scan all 
devices and identify added/removed devices; (2) and add vdev for added 
device; (3) remove vdev for removed device.

Compared to that, we can separate the implementation for hotplug and 
initial scan:
   * For initial scan, iterate all devices to add vdev for each of them.
   * For hotplug, based on which device is added/removed, we just 
add/remove the corresponding vdev for that device.

Anyway, since this patch does provide a new way; and will not affect the 
other way. So I think it's OK to add this.

Thank you for your clarification.

Thanks,
Jianfeng