diff mbox series

[v2,2/2] virtio-net: Fix log message

Message ID 20211125101614.76927-3-eperezma@redhat.com
State New
Headers show
Series vdpa: Fix SIGSEGV on failed vdpa devices | expand

Commit Message

Eugenio Perez Martin Nov. 25, 2021, 10:16 a.m. UTC
The message has never been true in the case of non tap networking, so
only tell that userland networking will be used if possible.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
 hw/net/virtio-net.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Comments

Jason Wang Nov. 26, 2021, 2:54 a.m. UTC | #1
On Thu, Nov 25, 2021 at 6:16 PM Eugenio Pérez <eperezma@redhat.com> wrote:
>
> The message has never been true in the case of non tap networking, so
> only tell that userland networking will be used if possible.
>
> Signed-off-by: Eugenio Pérez <eperezma@redhat.com>

Acked-by: Jason Wang <jasowang@redhat.com>

> ---
>  hw/net/virtio-net.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> index f2014d5ea0..d6c98c3c2d 100644
> --- a/hw/net/virtio-net.c
> +++ b/hw/net/virtio-net.c
> @@ -245,6 +245,7 @@ static void virtio_net_vhost_status(VirtIONet *n, uint8_t status)
>      NetClientState *nc = qemu_get_queue(n->nic);
>      int queue_pairs = n->multiqueue ? n->max_queue_pairs : 1;
>      int cvq = n->max_ncs - n->max_queue_pairs;
> +    bool tap_backend = nc->peer->info->type == NET_CLIENT_DRIVER_TAP;
>
>      if (!get_vhost_net(nc->peer)) {
>          return;
> @@ -258,9 +259,9 @@ static void virtio_net_vhost_status(VirtIONet *n, uint8_t status)
>          int r, i;
>
>          if (n->needs_vnet_hdr_swap) {
> -            error_report("backend does not support %s vnet headers; "
> -                         "falling back on userspace virtio",
> -                         virtio_is_big_endian(vdev) ? "BE" : "LE");
> +            error_report("backend does not support %s vnet headers%s",
> +                    virtio_is_big_endian(vdev) ? "BE" : "LE",
> +                    tap_backend ? "; falling back on userspace virtio" : "");
>              return;
>          }
>
> @@ -288,8 +289,8 @@ static void virtio_net_vhost_status(VirtIONet *n, uint8_t status)
>          n->vhost_started = 1;
>          r = vhost_net_start(vdev, n->nic->ncs, queue_pairs, cvq);
>          if (r < 0) {
> -            error_report("unable to start vhost net: %d: "
> -                         "falling back on userspace virtio", -r);
> +            error_report("unable to start vhost net: %d%s", -r,
> +                       tap_backend ? " falling back on userspace virtio" : "");
>              n->vhost_started = 0;
>          }
>      } else {
> --
> 2.27.0
>
Michael S. Tsirkin Nov. 29, 2021, 1:43 p.m. UTC | #2
On Fri, Nov 26, 2021 at 10:54:32AM +0800, Jason Wang wrote:
> On Thu, Nov 25, 2021 at 6:16 PM Eugenio Pérez <eperezma@redhat.com> wrote:
> >
> > The message has never been true in the case of non tap networking, so
> > only tell that userland networking will be used if possible.
> >
> > Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
> 
> Acked-by: Jason Wang <jasowang@redhat.com>

Breaks make check. I suspect it's called without a peer or something.

Dropped for 6.2.

> > ---
> >  hw/net/virtio-net.c | 11 ++++++-----
> >  1 file changed, 6 insertions(+), 5 deletions(-)
> >
> > diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> > index f2014d5ea0..d6c98c3c2d 100644
> > --- a/hw/net/virtio-net.c
> > +++ b/hw/net/virtio-net.c
> > @@ -245,6 +245,7 @@ static void virtio_net_vhost_status(VirtIONet *n, uint8_t status)
> >      NetClientState *nc = qemu_get_queue(n->nic);
> >      int queue_pairs = n->multiqueue ? n->max_queue_pairs : 1;
> >      int cvq = n->max_ncs - n->max_queue_pairs;
> > +    bool tap_backend = nc->peer->info->type == NET_CLIENT_DRIVER_TAP;
> >
> >      if (!get_vhost_net(nc->peer)) {
> >          return;
> > @@ -258,9 +259,9 @@ static void virtio_net_vhost_status(VirtIONet *n, uint8_t status)
> >          int r, i;
> >
> >          if (n->needs_vnet_hdr_swap) {
> > -            error_report("backend does not support %s vnet headers; "
> > -                         "falling back on userspace virtio",
> > -                         virtio_is_big_endian(vdev) ? "BE" : "LE");
> > +            error_report("backend does not support %s vnet headers%s",
> > +                    virtio_is_big_endian(vdev) ? "BE" : "LE",
> > +                    tap_backend ? "; falling back on userspace virtio" : "");
> >              return;
> >          }
> >
> > @@ -288,8 +289,8 @@ static void virtio_net_vhost_status(VirtIONet *n, uint8_t status)
> >          n->vhost_started = 1;
> >          r = vhost_net_start(vdev, n->nic->ncs, queue_pairs, cvq);
> >          if (r < 0) {
> > -            error_report("unable to start vhost net: %d: "
> > -                         "falling back on userspace virtio", -r);
> > +            error_report("unable to start vhost net: %d%s", -r,
> > +                       tap_backend ? " falling back on userspace virtio" : "");
> >              n->vhost_started = 0;
> >          }
> >      } else {
> > --
> > 2.27.0
> >
Eugenio Perez Martin Nov. 29, 2021, 2:56 p.m. UTC | #3
On Mon, Nov 29, 2021 at 2:43 PM Michael S. Tsirkin <mst@redhat.com> wrote:
>
> On Fri, Nov 26, 2021 at 10:54:32AM +0800, Jason Wang wrote:
> > On Thu, Nov 25, 2021 at 6:16 PM Eugenio Pérez <eperezma@redhat.com> wrote:
> > >
> > > The message has never been true in the case of non tap networking, so
> > > only tell that userland networking will be used if possible.
> > >
> > > Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
> >
> > Acked-by: Jason Wang <jasowang@redhat.com>
>
> Breaks make check. I suspect it's called without a peer or something.
>

You're right, sending it as a separate patch since I saw the other one
made it into the pull request.

Thanks!

> Dropped for 6.2.
>
> > > ---
> > >  hw/net/virtio-net.c | 11 ++++++-----
> > >  1 file changed, 6 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> > > index f2014d5ea0..d6c98c3c2d 100644
> > > --- a/hw/net/virtio-net.c
> > > +++ b/hw/net/virtio-net.c
> > > @@ -245,6 +245,7 @@ static void virtio_net_vhost_status(VirtIONet *n, uint8_t status)
> > >      NetClientState *nc = qemu_get_queue(n->nic);
> > >      int queue_pairs = n->multiqueue ? n->max_queue_pairs : 1;
> > >      int cvq = n->max_ncs - n->max_queue_pairs;
> > > +    bool tap_backend = nc->peer->info->type == NET_CLIENT_DRIVER_TAP;
> > >
> > >      if (!get_vhost_net(nc->peer)) {
> > >          return;
> > > @@ -258,9 +259,9 @@ static void virtio_net_vhost_status(VirtIONet *n, uint8_t status)
> > >          int r, i;
> > >
> > >          if (n->needs_vnet_hdr_swap) {
> > > -            error_report("backend does not support %s vnet headers; "
> > > -                         "falling back on userspace virtio",
> > > -                         virtio_is_big_endian(vdev) ? "BE" : "LE");
> > > +            error_report("backend does not support %s vnet headers%s",
> > > +                    virtio_is_big_endian(vdev) ? "BE" : "LE",
> > > +                    tap_backend ? "; falling back on userspace virtio" : "");
> > >              return;
> > >          }
> > >
> > > @@ -288,8 +289,8 @@ static void virtio_net_vhost_status(VirtIONet *n, uint8_t status)
> > >          n->vhost_started = 1;
> > >          r = vhost_net_start(vdev, n->nic->ncs, queue_pairs, cvq);
> > >          if (r < 0) {
> > > -            error_report("unable to start vhost net: %d: "
> > > -                         "falling back on userspace virtio", -r);
> > > +            error_report("unable to start vhost net: %d%s", -r,
> > > +                       tap_backend ? " falling back on userspace virtio" : "");
> > >              n->vhost_started = 0;
> > >          }
> > >      } else {
> > > --
> > > 2.27.0
> > >
>
diff mbox series

Patch

diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index f2014d5ea0..d6c98c3c2d 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -245,6 +245,7 @@  static void virtio_net_vhost_status(VirtIONet *n, uint8_t status)
     NetClientState *nc = qemu_get_queue(n->nic);
     int queue_pairs = n->multiqueue ? n->max_queue_pairs : 1;
     int cvq = n->max_ncs - n->max_queue_pairs;
+    bool tap_backend = nc->peer->info->type == NET_CLIENT_DRIVER_TAP;
 
     if (!get_vhost_net(nc->peer)) {
         return;
@@ -258,9 +259,9 @@  static void virtio_net_vhost_status(VirtIONet *n, uint8_t status)
         int r, i;
 
         if (n->needs_vnet_hdr_swap) {
-            error_report("backend does not support %s vnet headers; "
-                         "falling back on userspace virtio",
-                         virtio_is_big_endian(vdev) ? "BE" : "LE");
+            error_report("backend does not support %s vnet headers%s",
+                    virtio_is_big_endian(vdev) ? "BE" : "LE",
+                    tap_backend ? "; falling back on userspace virtio" : "");
             return;
         }
 
@@ -288,8 +289,8 @@  static void virtio_net_vhost_status(VirtIONet *n, uint8_t status)
         n->vhost_started = 1;
         r = vhost_net_start(vdev, n->nic->ncs, queue_pairs, cvq);
         if (r < 0) {
-            error_report("unable to start vhost net: %d: "
-                         "falling back on userspace virtio", -r);
+            error_report("unable to start vhost net: %d%s", -r,
+                       tap_backend ? " falling back on userspace virtio" : "");
             n->vhost_started = 0;
         }
     } else {