> From: Thomas Monjalon [mailto:tho...@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

Reply via email to