]> git.baikalelectronics.ru Git - kernel.git/commitdiff
vhost/vsock: fix packet delivery order to monitoring devices
authorStefano Garzarella <sgarzare@redhat.com>
Fri, 24 Apr 2020 15:08:29 +0000 (17:08 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 27 Apr 2020 17:18:01 +0000 (10:18 -0700)
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>
drivers/vhost/vsock.c

index e36aaf9ba7bd9d29008fb23b4bf87b44a1b4e1bd..4f50dcb89ac8d0baa37a8c8023e338e764e4b145 100644 (file)
@@ -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;