qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Ladi Prosek <lprosek@redhat.com>
To: qemu-devel@nongnu.org
Cc: casasfernando@hotmail.com, mst@redhat.com, jasowang@redhat.com,
	armbru@redhat.com, groug@kaod.org, arei.gonglei@huawei.com,
	aneesh.kumar@linux.vnet.ibm.com, stefanha@redhat.com
Subject: [Qemu-devel] [PATCH v2 6/8] virtio-net: use virtqueue_error for errors with queue context
Date: Thu, 13 Jul 2017 13:02:35 +0200	[thread overview]
Message-ID: <20170713110237.6712-7-lprosek@redhat.com> (raw)
In-Reply-To: <20170713110237.6712-1-lprosek@redhat.com>

virtqueue_error includes queue index in the error output and is preferred
for errors that pertain to a virtqueue rather than to the device as a whole.

Signed-off-by: Ladi Prosek <lprosek@redhat.com>
---
 hw/net/virtio-net.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 5630a9e..b3d0b85 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -970,7 +970,7 @@ static void virtio_net_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)
         }
         if (iov_size(elem->in_sg, elem->in_num) < sizeof(status) ||
             iov_size(elem->out_sg, elem->out_num) < sizeof(ctrl)) {
-            virtio_error(vdev, "virtio-net ctrl missing headers");
+            virtqueue_error(vq, "virtio-net ctrl missing headers");
             virtqueue_detach_element(vq, elem, 0);
             g_free(elem);
             break;
@@ -1204,20 +1204,20 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
         elem = virtqueue_pop(q->rx_vq, sizeof(VirtQueueElement));
         if (!elem) {
             if (i) {
-                virtio_error(vdev, "virtio-net unexpected empty queue: "
-                             "i %zd mergeable %d offset %zd, size %zd, "
-                             "guest hdr len %zd, host hdr len %zd "
-                             "guest features 0x%" PRIx64,
-                             i, n->mergeable_rx_bufs, offset, size,
-                             n->guest_hdr_len, n->host_hdr_len,
-                             vdev->guest_features);
+                virtqueue_error(q->rx_vq, "virtio-net unexpected empty queue: "
+                                "i %zd mergeable %d offset %zd, size %zd, "
+                                "guest hdr len %zd, host hdr len %zd "
+                                "guest features 0x%" PRIx64,
+                                i, n->mergeable_rx_bufs, offset, size,
+                                n->guest_hdr_len, n->host_hdr_len,
+                                vdev->guest_features);
             }
             return -1;
         }
 
         if (elem->in_num < 1) {
-            virtio_error(vdev,
-                         "virtio-net receive queue contains no in buffers");
+            virtqueue_error(q->rx_vq,
+                            "virtio-net receive queue contains no in buffers");
             virtqueue_detach_element(q->rx_vq, elem, 0);
             g_free(elem);
             return -1;
@@ -1333,7 +1333,7 @@ static int32_t virtio_net_flush_tx(VirtIONetQueue *q)
         out_num = elem->out_num;
         out_sg = elem->out_sg;
         if (out_num < 1) {
-            virtio_error(vdev, "virtio-net header not in first element");
+            virtqueue_error(q->tx_vq, "virtio-net header not in first element");
             virtqueue_detach_element(q->tx_vq, elem, 0);
             g_free(elem);
             return -EINVAL;
@@ -1342,7 +1342,7 @@ static int32_t virtio_net_flush_tx(VirtIONetQueue *q)
         if (n->has_vnet_hdr) {
             if (iov_to_buf(out_sg, out_num, 0, &mhdr, n->guest_hdr_len) <
                 n->guest_hdr_len) {
-                virtio_error(vdev, "virtio-net header incorrect");
+                virtqueue_error(q->tx_vq, "virtio-net header incorrect");
                 virtqueue_detach_element(q->tx_vq, elem, 0);
                 g_free(elem);
                 return -EINVAL;
-- 
2.9.3

  parent reply	other threads:[~2017-07-13 11:03 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-13 11:02 [Qemu-devel] [PATCH v2 0/8] virtio: enhance virtio_error messages Ladi Prosek
2017-07-13 11:02 ` [Qemu-devel] [PATCH v2 1/8] qemu-error: introduce error_report_nolf Ladi Prosek
2017-07-13 13:32   ` Stefan Hajnoczi
2017-07-13 13:48     ` Ladi Prosek
2017-07-14 10:25       ` Stefan Hajnoczi
2017-07-15  5:50         ` Markus Armbruster
2017-07-17  6:43           ` Ladi Prosek
2017-07-14 10:41     ` Daniel P. Berrange
2017-07-17  6:54       ` Ladi Prosek
2017-07-17  8:58         ` Daniel P. Berrange
2017-07-17  9:30           ` Ladi Prosek
2017-07-13 11:02 ` [Qemu-devel] [PATCH v2 2/8] virtio: enhance virtio_error messages Ladi Prosek
2017-07-13 13:40   ` Stefan Hajnoczi
2017-07-13 13:58     ` Ladi Prosek
2017-07-13 11:02 ` [Qemu-devel] [PATCH v2 3/8] virtio: introduce virtqueue_error Ladi Prosek
2017-07-13 14:42   ` Cornelia Huck
2017-07-13 15:02     ` Ladi Prosek
2017-07-14 10:28   ` Stefan Hajnoczi
2017-07-13 11:02 ` [Qemu-devel] [PATCH v2 4/8] virtio-9p: use virtqueue_error for errors with queue context Ladi Prosek
2017-07-13 14:21   ` Greg Kurz
2017-07-13 14:49   ` Cornelia Huck
2017-07-14 10:29   ` Stefan Hajnoczi
2017-07-13 11:02 ` [Qemu-devel] [PATCH v2 5/8] virtio-blk: " Ladi Prosek
2017-07-13 14:54   ` Cornelia Huck
2017-07-14 10:29   ` Stefan Hajnoczi
2017-07-13 11:02 ` Ladi Prosek [this message]
2017-07-13 15:00   ` [Qemu-devel] [PATCH v2 6/8] virtio-net: " Cornelia Huck
2017-07-14 10:30   ` Stefan Hajnoczi
2017-07-13 11:02 ` [Qemu-devel] [PATCH v2 7/8] virtio-scsi: " Ladi Prosek
2017-07-13 15:03   ` Cornelia Huck
2017-07-14 10:30   ` Stefan Hajnoczi
2017-07-13 11:02 ` [Qemu-devel] [PATCH v2 8/8] virtio-crypto: " Ladi Prosek
2017-07-13 15:20   ` Cornelia Huck
2017-07-13 15:31     ` Ladi Prosek
2017-07-13 15:36       ` Cornelia Huck
2017-07-14  0:51         ` Gonglei (Arei)
2017-07-14 10:31   ` Stefan Hajnoczi
2017-07-13 14:36 ` [Qemu-devel] [PATCH v2 0/8] virtio: enhance virtio_error messages Greg Kurz
2017-07-13 15:00   ` Ladi Prosek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170713110237.6712-7-lprosek@redhat.com \
    --to=lprosek@redhat.com \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=arei.gonglei@huawei.com \
    --cc=armbru@redhat.com \
    --cc=casasfernando@hotmail.com \
    --cc=groug@kaod.org \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).