Skip to contentSkip to conversation

net:Enable vhost with vhostforce, vhost options for guests without MSI-X support

PATCH Superseded Pankaj Gupta 2 participants 5 messages Jun 5, 2015 – Jun 12, 2015 Networking

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 net:Enable vhost with vhostforce, vhost options for guests without MSI-X support

We use vhostforce to enable vhost even if Guests don't have MSI-X support
and we fall back to QEMU virtio-net. This patch will enable vhost unconditionally whenever we have vhostforce='ON' or vhost='ON'.

Initially, I wanted to remove vhostforce completely as an additional argument. But after discussing this in mailing list found that some programs are using vhostforce and some vhost. So, we want to keep semantics of both the options.

---
 net/tap.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
net/tap.c +3 -3
index d1ca314..4618359 100644
@@ -649,13 +649,13 @@ static void net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,
         }
     }
 
-    if (tap->has_vhost ? tap->vhost :
-        vhostfdname || (tap->has_vhostforce && tap->vhostforce)) {
+    if ((tap->has_vhost ? tap->vhost :
+        vhostfdname) || tap->vhostforce) {
         VhostNetOptions options;
 
         options.backend_type = VHOST_BACKEND_TYPE_KERNEL;
         options.net_backend = &s->nc;
-        options.force = tap->has_vhostforce && tap->vhostforce;
+        options.force = true;
 
         if (tap->has_vhostfd || tap->has_vhostfds) {
             vhostfd = monitor_fd_param(cur_mon, vhostfdname, &err);
Signature · 1 line
1.9.3
#1 lore raw
Quoted 24 lines · Pankaj Gupta

We use vhostforce to enable vhost even if Guests don't have MSI-X support
and we fall back to QEMU virtio-net. This patch will enable vhost unconditionally whenever we have vhostforce='ON' or vhost='ON'.

Initially, I wanted to remove vhostforce completely as an additional argument. But after discussing this in mailing list found that some programs are using vhostforce and some vhost. So, we want to keep semantics of both the options.

---
 net/tap.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
net/tap.c +1 -2
index d1ca314..4618359 100644
@@ -649,13 +649,13 @@ static void net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,
         }
     }
 
-    if (tap->has_vhost ? tap->vhost :
-        vhostfdname || (tap->has_vhostforce && tap->vhostforce)) {
+    if ((tap->has_vhost ? tap->vhost :

net/tap.c static void net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer, · line 661

Quoted 10 lines
net/tap.c +2 -1
+        vhostfdname) || tap->vhostforce) {
         VhostNetOptions options;
 
         options.backend_type = VHOST_BACKEND_TYPE_KERNEL;
         options.net_backend = &s->nc;
-        options.force = tap->has_vhostforce && tap->vhostforce;
+        options.force = true;
 
         if (tap->has_vhostfd || tap->has_vhostfds) {
             vhostfd = monitor_fd_param(cur_mon, vhostfdname, &err);

In this case, I believe there's no need to have vhost_net_query() and query_guest_notifiers() callbacks (and maybe more others).

#2 lore raw
Quoted 40 lines · Pankaj Gupta
Quoted 37 lines

We use vhostforce to enable vhost even if Guests don't have MSI-X support
and we fall back to QEMU virtio-net. This patch will enable vhost unconditionally
whenever we have vhostforce='ON' or vhost='ON'.

Initially, I wanted to remove vhostforce completely as an additional argument.
But after discussing this in mailing list found that some programs are using vhostforce
and some vhost. So, we want to keep semantics of both the options.

---
 net/tap.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
net/tap.c +3 -3
index d1ca314..4618359 100644
@@ -649,13 +649,13 @@ static void net_init_tap_one(const NetdevTapOptions
 *tap, NetClientState *peer,
         }
     }
 
-    if (tap->has_vhost ? tap->vhost :
-        vhostfdname || (tap->has_vhostforce && tap->vhostforce)) {
+    if ((tap->has_vhost ? tap->vhost :
+        vhostfdname) || tap->vhostforce) {
         VhostNetOptions options;
 
         options.backend_type = VHOST_BACKEND_TYPE_KERNEL;
         options.net_backend = &s->nc;
-        options.force = tap->has_vhostforce && tap->vhostforce;
+        options.force = true;
 
Quoted 5 lines
Quoted 2 lines
net/tap.c +0 -0
         if (tap->has_vhostfd || tap->has_vhostfds) {
             vhostfd = monitor_fd_param(cur_mon, vhostfdname, &err);

In this case, I believe there's no need to have vhost_net_query() and query_guest_notifiers() callbacks (and maybe more others).

I also thought on this. If same functions can be used by some other module in future? If not, I was thinking to remove those in another patch.

Does the main functionality looks OK?

Quoted 1 line
#3 lore raw
Quoted 27 lines · Pankaj Gupta
Quoted 27 lines · Pankaj Gupta
Quoted 26 lines

We use vhostforce to enable vhost even if Guests don't have MSI-X support
and we fall back to QEMU virtio-net. This patch will enable vhost unconditionally
whenever we have vhostforce='ON' or vhost='ON'.

Initially, I wanted to remove vhostforce completely as an additional argument.
But after discussing this in mailing list found that some programs are using vhostforce
and some vhost. So, we want to keep semantics of both the options.

---
 net/tap.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
net/tap.c +0 -0
index d1ca314..4618359 100644
@@ -649,13 +649,13 @@ static void net_init_tap_one(const NetdevTapOptions
 *tap, NetClientState *peer,
         }
     }
 
Quoted 4 lines
Quoted 4 lines

net/tap.c static void net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer, · line 653

Quoted 4 lines
net/tap.c +2 -2
-    if (tap->has_vhost ? tap->vhost :
-        vhostfdname || (tap->has_vhostforce && tap->vhostforce)) {
+    if ((tap->has_vhost ? tap->vhost :
+        vhostfdname) || tap->vhostforce) {

The change here seems useless.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
net/tap.c +1 -1
         VhostNetOptions options;
 
         options.backend_type = VHOST_BACKEND_TYPE_KERNEL;
         options.net_backend = &s->nc;
-        options.force = tap->has_vhostforce && tap->vhostforce;
+        options.force = true;
 
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
net/tap.c +0 -0
         if (tap->has_vhostfd || tap->has_vhostfds) {
             vhostfd = monitor_fd_param(cur_mon, vhostfdname, &err);

In this case, I believe there's no need to have vhost_net_query() and query_guest_notifiers() callbacks (and maybe more others).

I also thought on this. If same functions can be used by some other module in future? If not, I was thinking to remove those in another patch.

I could not think a usage of this in the future.

Quoted 2 lines

Does the main functionality looks OK?

See comment above and I prefer to remove all unnecessary functions.

Thanks

#4 lore raw
Quoted 52 lines · Pankaj Gupta
Quoted 27 lines
Quoted 27 lines · Pankaj Gupta
Quoted 26 lines

We use vhostforce to enable vhost even if Guests don't have MSI-X support
and we fall back to QEMU virtio-net. This patch will enable vhost unconditionally
whenever we have vhostforce='ON' or vhost='ON'.

Initially, I wanted to remove vhostforce completely as an additional argument.
But after discussing this in mailing list found that some programs are using vhostforce
and some vhost. So, we want to keep semantics of both the options.

---
 net/tap.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
net/tap.c +0 -0
index d1ca314..4618359 100644
@@ -649,13 +649,13 @@ static void net_init_tap_one(const NetdevTapOptions
 *tap, NetClientState *peer,
         }
     }
 
Quoted 4 lines
Quoted 4 lines

net/tap.c static void net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer, · line 653

Quoted 4 lines
net/tap.c +2 -2
-    if (tap->has_vhost ? tap->vhost :
-        vhostfdname || (tap->has_vhostforce && tap->vhostforce)) {
+    if ((tap->has_vhost ? tap->vhost :
+        vhostfdname) || tap->vhostforce) {

The change here seems useless.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
net/tap.c +1 -1
         VhostNetOptions options;
 
         options.backend_type = VHOST_BACKEND_TYPE_KERNEL;
         options.net_backend = &s->nc;
-        options.force = tap->has_vhostforce && tap->vhostforce;
+        options.force = true;
 
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
net/tap.c +0 -0
         if (tap->has_vhostfd || tap->has_vhostfds) {
             vhostfd = monitor_fd_param(cur_mon, vhostfdname, &err);

In this case, I believe there's no need to have vhost_net_query() and query_guest_notifiers() callbacks (and maybe more others).

I also thought on this. If same functions can be used by some other module in future?
If not, I was thinking to remove those in another patch.

Quoted 5 lines

I could not think a usage of this in the future.

Quoted 2 lines

Does the main functionality looks OK?

See comment above and I prefer to remove all unnecessary functions.

o.k, will do the changes and post a new version.

Quoted 5 lines

Thanks