[dpdk-dev] [PATCH v3 18/22] vhost: introduce API to start a specific driver

Maxime Coquelin maxime.coquelin at redhat.com
Fri Mar 31 11:11:57 CEST 2017



On 03/28/2017 02:45 PM, Yuanhan Liu wrote:
> 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 at linux.intel.com>
> ---
>
> v3: - fix broken reconnect
> ---
>  doc/guides/prog_guide/vhost_lib.rst    | 24 +++++-----
>  doc/guides/rel_notes/release_17_05.rst |  8 ++++
>  drivers/net/vhost/rte_eth_vhost.c      | 50 ++------------------
>  examples/tep_termination/main.c        |  8 +++-
>  examples/vhost/main.c                  |  9 +++-
>  lib/librte_vhost/fd_man.c              |  9 ++--
>  lib/librte_vhost/fd_man.h              |  2 +-
>  lib/librte_vhost/rte_vhost_version.map |  2 +-
>  lib/librte_vhost/rte_virtio_net.h      | 15 +++++-
>  lib/librte_vhost/socket.c              | 84 ++++++++++++++++++++--------------
>  10 files changed, 108 insertions(+), 103 deletions(-)
>

Reviewed-by: Maxime Coquelin <maxime.coquelin at redhat.com>

Thanks,
Maxime


More information about the dev mailing list