On Thu, Nov 19, 2015 at 02:14:13PM +0900, Tetsuya Mukawa wrote: > On 2015/11/19 12:33, Yuanhan Liu wrote: > > On Thu, Nov 19, 2015 at 12:13:38PM +0900, Tetsuya Mukawa wrote: > >> On 2015/11/19 11:18, Yuanhan Liu wrote: > >>> On Thu, Nov 19, 2015 at 11:03:50AM +0900, Tetsuya Mukawa wrote: > >>>> On 2015/11/17 22:29, Yuanhan Liu wrote: > >>>>> On Fri, Nov 13, 2015 at 02:20:30PM +0900, Tetsuya Mukawa wrote: > >>>>>> These variables are needed to be able to manage one of virtio devices > >>>>>> using both vhost library APIs and vhost PMD. > >>>>>> For example, if vhost PMD uses current callback handler and private > >>>>>> data > >>>>>> provided by vhost library, A DPDK application that links vhost library > >>>>>> cannot use some of vhost library APIs. > >>>>> Can you be more specific about this? > >>>>> > >>>>> --yliu > >>>> How about like below? > >>>> > >>>> commit log: > >>>> Currently, when virtio device is created and destroyed, vhost library > >>>> will call one of callback handlers. > >>>> The vhost PMD need to use this pair of callback handlers to know which > >>>> virtio devices are connected actually. > >>>> Because we can register only one pair of callbacks to vhost library, if > >>>> the PMD use it, DPDK applications > >>>> cannot have a way to know the events. > >>> Will (and why) the two co-exist at same time? > >> Yes it is. Sure, I will describe below in commit log. > >> > >> Because we cannot map some of vhost library APIs to ethdev APIs, in some > >> cases, we still > >> need to use vhost library APIs for a port created by the vhost PMD. One > >> of example is > >> rte_vhost_enable_guest_notification(). > > I don't get it why it has something to do with a standalone PMD callback. > > And if you don't call rte_vhost_enable_guest_notification() inside vhost > > PMD, where else can you call that? I mean, you can't start vhost-pmd > > and vhost-swithc in the mean time, right? > > No it's not true, even after connecting to virtio-net device, you can > change the flag. > It's just a hint for virtio-net driver, and it will be used while queuing. > (We may be able to change the flag, even while sending or receiving packets) > > > > > And, pmd callback and the old notify callback will not exist at same > > time in one case, right? If so, why is that needed? > > > > BTW, if it's a MUST, would you provide a specific example? > > Actually, this patch is not a MUST. > > But still the users need callback handlers to know when virtio-net > device is connected or disconnected. > This is because the user can call rte_vhost_enable_guest_notification() > only while connection is established.
What does "the user" mean? Is there a second user of vhost lib besides vhost PMD, that he has to interact with those connected devices? If so, how? --yliu > > Probably we can use link status changed callback of the PMD for this > purpose. > (The vhost PMD will notice DPDK application using link status callback) > > But I am not sure whether we need to implement link status changed > callback for this purpose. > While processing this callback handler, the users will only calls vhost > library APIs that ethdev API cannot map, or store some variables related > with vhost library. > If so, this callback handler itself is specific for using vhost library. > And it may be ok that callback itself is implemented as one of vhost > library APIs. > > Tetsuya > > > > > --yliu > >> Thanks, > >> Tetsuya > >> > >> > >>> --yliu > >>> > >>>> This may break legacy DPDK > >>>> applications that uses vhost library. > >>>> To prevent it, this patch adds one more pair of callbacks to vhost > >>>> library especially for the vhost PMD. > >>>> With the patch, legacy applications can use the vhost PMD even if they > >>>> need additional specific handling > >>>> for virtio device creation and destruction. > >>>> For example, legacy application can call > >>>> rte_vhost_enable_guest_notification() in callbacks to change setting. > >>>> > >>>> Tetsuya