[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230502174404.668749-1-xiyou.wangcong@gmail.com>
Date: Tue, 2 May 2023 10:44:04 -0700
From: Cong Wang <xiyou.wangcong@...il.com>
To: netdev@...r.kernel.org
Cc: virtualization@...ts.linux-foundation.org, kvm@...r.kernel.org,
Cong Wang <cong.wang@...edance.com>,
Stefan Hajnoczi <stefanha@...hat.com>,
Stefano Garzarella <sgarzare@...hat.com>,
Bobby Eshleman <bobby.eshleman@...edance.com>
Subject: [Patch net] vsock: improve tap delivery accuracy
From: Cong Wang <cong.wang@...edance.com>
When virtqueue_add_sgs() fails, the skb is put back to send queue,
we should not deliver the copy to tap device in this case. So we
need to move virtio_transport_deliver_tap_pkt() down after all
possible failures.
Fixes: 82dfb540aeb2 ("VSOCK: Add virtio vsock vsockmon hooks")
Cc: Stefan Hajnoczi <stefanha@...hat.com>
Cc: Stefano Garzarella <sgarzare@...hat.com>
Cc: Bobby Eshleman <bobby.eshleman@...edance.com>
Signed-off-by: Cong Wang <cong.wang@...edance.com>
---
net/vmw_vsock/virtio_transport.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c
index e95df847176b..055678628c07 100644
--- a/net/vmw_vsock/virtio_transport.c
+++ b/net/vmw_vsock/virtio_transport.c
@@ -109,9 +109,6 @@ virtio_transport_send_pkt_work(struct work_struct *work)
if (!skb)
break;
- virtio_transport_deliver_tap_pkt(skb);
- reply = virtio_vsock_skb_reply(skb);
-
sg_init_one(&hdr, virtio_vsock_hdr(skb), sizeof(*virtio_vsock_hdr(skb)));
sgs[out_sg++] = &hdr;
if (skb->len > 0) {
@@ -128,6 +125,8 @@ virtio_transport_send_pkt_work(struct work_struct *work)
break;
}
+ virtio_transport_deliver_tap_pkt(skb);
+ reply = virtio_vsock_skb_reply(skb);
if (reply) {
struct virtqueue *rx_vq = vsock->vqs[VSOCK_VQ_RX];
int val;
--
2.34.1
Powered by blists - more mailing lists