Skip to content

Commit 11708ff

Browse files
stefano-garzarellamstsirkin
authored andcommitted
vhost/vsock: cleanup removing len variable
We can increment `total_len` directly and remove `len` since it is no longer used for vhost_add_used(). Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> Link: https://lore.kernel.org/r/20211122163525.294024-3-sgarzare@redhat.com Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
1 parent 49d8c5f commit 11708ff

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

drivers/vhost/vsock.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -511,8 +511,6 @@ static void vhost_vsock_handle_tx_kick(struct vhost_work *work)
511511

512512
vhost_disable_notify(&vsock->dev, vq);
513513
do {
514-
u32 len;
515-
516514
if (!vhost_vsock_more_replies(vsock)) {
517515
/* Stop tx until the device processes already
518516
* pending replies. Leave tx virtqueue
@@ -540,7 +538,7 @@ static void vhost_vsock_handle_tx_kick(struct vhost_work *work)
540538
continue;
541539
}
542540

543-
len = pkt->len;
541+
total_len += sizeof(pkt->hdr) + pkt->len;
544542

545543
/* Deliver to monitoring devices all received packets */
546544
virtio_transport_deliver_tap_pkt(pkt);
@@ -553,9 +551,7 @@ static void vhost_vsock_handle_tx_kick(struct vhost_work *work)
553551
else
554552
virtio_transport_free_pkt(pkt);
555553

556-
len += sizeof(pkt->hdr);
557554
vhost_add_used(vq, head, 0);
558-
total_len += len;
559555
added = true;
560556
} while(likely(!vhost_exceeds_weight(vq, ++pkts, total_len)));
561557

0 commit comments

Comments
 (0)