numam-dpdk/lib/librte_vhost
Yuanhan Liu af14759181 vhost: introduce API to start a specific driver
We used to use rte_vhost_driver_session_start() to trigger the vhost-user
session. It takes no argument, thus it's a global trigger. And it could
be problematic.

The issue is, currently, rte_vhost_driver_register(path, flags) actually
tries to put it into the session loop (by fdset_add). However, it needs
a set of APIs to set a vhost-user driver properly:
  * rte_vhost_driver_register(path, flags);
  * rte_vhost_driver_set_features(path, features);
  * rte_vhost_driver_callback_register(path, vhost_device_ops);

If a new vhost-user driver is registered after the trigger (think OVS-DPDK
that could add a port dynamically from cmdline), the current code will
effectively starts the session for the new driver just after the first
API rte_vhost_driver_register() is invoked, leaving later calls taking
no effect at all.

To handle the case properly, this patch introduce a new API,
rte_vhost_driver_start(path), to trigger a specific vhost-user driver.
To do that, the rte_vhost_driver_register(path, flags) is simplified
to create the socket only and let rte_vhost_driver_start(path) to
actually put it into the session loop.

Meanwhile, the rte_vhost_driver_session_start is removed: we could hide
the session thread internally (create the thread if it has not been
created). This would also simplify the application.

NOTE: the API order in prog guide is slightly adjusted for showing the
correct invoke order.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2017-04-01 10:42:44 +02:00
..
fd_man.c vhost: introduce API to start a specific driver 2017-04-01 10:42:44 +02:00
fd_man.h vhost: introduce API to start a specific driver 2017-04-01 10:42:44 +02:00
Makefile vhost: rename device ops struct 2017-04-01 10:42:44 +02:00
rte_vhost_version.map vhost: introduce API to start a specific driver 2017-04-01 10:42:44 +02:00
rte_virtio_net.h vhost: introduce API to start a specific driver 2017-04-01 10:42:44 +02:00
socket.c vhost: introduce API to start a specific driver 2017-04-01 10:42:44 +02:00
vhost_user.c vhost: add features changed callback 2017-04-01 10:42:44 +02:00
vhost_user.h vhost: support MTU protocol feature 2017-04-01 10:36:17 +02:00
vhost.c vhost: export APIs for live migration support 2017-04-01 10:42:44 +02:00
vhost.h vhost: export APIs for live migration support 2017-04-01 10:42:44 +02:00
virtio_net.c vhost: export APIs for live migration support 2017-04-01 10:42:44 +02:00