From 69e87b32680a41d9761191443587c595b6f5fc3f Mon Sep 17 00:00:00 2001 From: Jason Wang Date: Wed, 6 Jul 2016 09:57:55 +0800 Subject: tap: vhost busy polling support This patch add the capability of basic vhost net busy polling which is supported by recent kernel. User could configure the maximum number of us that could be spent on busy polling through a new property of tap "poll-us". Cc: Greg Kurz Reviewed-by: Michael S. Tsirkin Signed-off-by: Jason Wang --- net/tap.c | 7 ++++++- net/vhost-user.c | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'net') diff --git a/net/tap.c b/net/tap.c index 49817c70c1..676bad4e11 100644 --- a/net/tap.c +++ b/net/tap.c @@ -663,6 +663,11 @@ static void net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer, options.backend_type = VHOST_BACKEND_TYPE_KERNEL; options.net_backend = &s->nc; + if (tap->has_poll_us) { + options.busyloop_timeout = tap->poll_us; + } else { + options.busyloop_timeout = 0; + } if (vhostfdname) { vhostfd = monitor_fd_param(cur_mon, vhostfdname, &err); @@ -687,7 +692,7 @@ static void net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer, return; } } else if (vhostfdname) { - error_setg(errp, "vhostfd= is not valid without vhost"); + error_setg(errp, "vhostfd(s)= is not valid without vhost"); } } diff --git a/net/vhost-user.c b/net/vhost-user.c index 92f4cfd1b1..a88dfe0655 100644 --- a/net/vhost-user.c +++ b/net/vhost-user.c @@ -91,6 +91,7 @@ static int vhost_user_start(int queues, NetClientState *ncs[]) options.net_backend = ncs[i]; options.opaque = s->chr; + options.busyloop_timeout = 0; s->vhost_net = vhost_net_init(&options); if (!s->vhost_net) { error_report("failed to init vhost_net for queue %d", i); -- cgit v1.2.3