summaryrefslogtreecommitdiff
path: root/drivers/vhost/vsock.c
diff options
context:
space:
mode:
authorStefano Garzarella <sgarzare@redhat.com>2020-04-24 17:08:29 +0200
committerDavid S. Miller <davem@davemloft.net>2020-04-27 10:18:01 -0700
commit107bc0766b9feb5113074c753735a3f115c2141f (patch)
tree4b437bb5daa788453292941dfccbc3f63d2060d1 /drivers/vhost/vsock.c
parent52a90612fa6108d20cffd3cf6a2c228e2f3619f7 (diff)
vhost/vsock: fix packet delivery order to monitoring devices
We want to deliver packets to monitoring devices before it is put in the virtqueue, to avoid that replies can appear in the packet capture before the transmitted packet. Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/vhost/vsock.c')
-rw-r--r--drivers/vhost/vsock.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c
index e36aaf9ba7bd..4f50dcb89ac8 100644
--- a/drivers/vhost/vsock.c
+++ b/drivers/vhost/vsock.c
@@ -181,14 +181,14 @@ vhost_transport_do_send_pkt(struct vhost_vsock *vsock,
break;
}
- vhost_add_used(vq, head, sizeof(pkt->hdr) + payload_len);
- added = true;
-
- /* Deliver to monitoring devices all correctly transmitted
- * packets.
+ /* Deliver to monitoring devices all packets that we
+ * will transmit.
*/
virtio_transport_deliver_tap_pkt(pkt);
+ vhost_add_used(vq, head, sizeof(pkt->hdr) + payload_len);
+ added = true;
+
pkt->off += payload_len;
total_len += payload_len;