mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
Revert "virtio/vsock: don't use skbuff state to account credit"
This reverts commit5852a2b573which is commit0777061657upstream. It needs to be reverted, as the function virtio_transport_free_pkt() is in the stable Android ABI, and this function is removed in the 6.1.63 kernel as part of a series of fixes and optimizations of the virtio networking connection. To preserve the ABI (and thereby keeping the slower interface), revert the commit for now. If this needs to come back in the future, if performance for this interface needs to be resolved, it can be done so in an ABI-safe way. Bug: 161946584 Change-Id: I6607855de7742319460554c4b81edbce0aab0c37 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
@@ -245,18 +245,21 @@ static int virtio_transport_send_pkt_info(struct vsock_sock *vsk,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool virtio_transport_inc_rx_pkt(struct virtio_vsock_sock *vvs,
|
static bool virtio_transport_inc_rx_pkt(struct virtio_vsock_sock *vvs,
|
||||||
u32 len)
|
struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
if (vvs->rx_bytes + len > vvs->buf_alloc)
|
if (vvs->rx_bytes + skb->len > vvs->buf_alloc)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
vvs->rx_bytes += len;
|
vvs->rx_bytes += skb->len;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void virtio_transport_dec_rx_pkt(struct virtio_vsock_sock *vvs,
|
static void virtio_transport_dec_rx_pkt(struct virtio_vsock_sock *vvs,
|
||||||
u32 len)
|
struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
|
int len;
|
||||||
|
|
||||||
|
len = skb_headroom(skb) - sizeof(struct virtio_vsock_hdr) - skb->len;
|
||||||
vvs->rx_bytes -= len;
|
vvs->rx_bytes -= len;
|
||||||
vvs->fwd_cnt += len;
|
vvs->fwd_cnt += len;
|
||||||
}
|
}
|
||||||
@@ -389,9 +392,7 @@ virtio_transport_stream_do_dequeue(struct vsock_sock *vsk,
|
|||||||
skb_pull(skb, bytes);
|
skb_pull(skb, bytes);
|
||||||
|
|
||||||
if (skb->len == 0) {
|
if (skb->len == 0) {
|
||||||
u32 pkt_len = le32_to_cpu(virtio_vsock_hdr(skb)->len);
|
virtio_transport_dec_rx_pkt(vvs, skb);
|
||||||
|
|
||||||
virtio_transport_dec_rx_pkt(vvs, pkt_len);
|
|
||||||
consume_skb(skb);
|
consume_skb(skb);
|
||||||
} else {
|
} else {
|
||||||
__skb_queue_head(&vvs->rx_queue, skb);
|
__skb_queue_head(&vvs->rx_queue, skb);
|
||||||
@@ -440,17 +441,17 @@ static int virtio_transport_seqpacket_do_dequeue(struct vsock_sock *vsk,
|
|||||||
|
|
||||||
while (!msg_ready) {
|
while (!msg_ready) {
|
||||||
struct virtio_vsock_hdr *hdr;
|
struct virtio_vsock_hdr *hdr;
|
||||||
size_t pkt_len;
|
|
||||||
|
|
||||||
skb = __skb_dequeue(&vvs->rx_queue);
|
skb = __skb_dequeue(&vvs->rx_queue);
|
||||||
if (!skb)
|
if (!skb)
|
||||||
break;
|
break;
|
||||||
hdr = virtio_vsock_hdr(skb);
|
hdr = virtio_vsock_hdr(skb);
|
||||||
pkt_len = (size_t)le32_to_cpu(hdr->len);
|
|
||||||
|
|
||||||
if (dequeued_len >= 0) {
|
if (dequeued_len >= 0) {
|
||||||
|
size_t pkt_len;
|
||||||
size_t bytes_to_copy;
|
size_t bytes_to_copy;
|
||||||
|
|
||||||
|
pkt_len = (size_t)le32_to_cpu(hdr->len);
|
||||||
bytes_to_copy = min(user_buf_len, pkt_len);
|
bytes_to_copy = min(user_buf_len, pkt_len);
|
||||||
|
|
||||||
if (bytes_to_copy) {
|
if (bytes_to_copy) {
|
||||||
@@ -487,7 +488,7 @@ static int virtio_transport_seqpacket_do_dequeue(struct vsock_sock *vsk,
|
|||||||
msg->msg_flags |= MSG_EOR;
|
msg->msg_flags |= MSG_EOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtio_transport_dec_rx_pkt(vvs, pkt_len);
|
virtio_transport_dec_rx_pkt(vvs, skb);
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1043,7 +1044,7 @@ virtio_transport_recv_enqueue(struct vsock_sock *vsk,
|
|||||||
|
|
||||||
spin_lock_bh(&vvs->rx_lock);
|
spin_lock_bh(&vvs->rx_lock);
|
||||||
|
|
||||||
can_enqueue = virtio_transport_inc_rx_pkt(vvs, len);
|
can_enqueue = virtio_transport_inc_rx_pkt(vvs, skb);
|
||||||
if (!can_enqueue) {
|
if (!can_enqueue) {
|
||||||
free_pkt = true;
|
free_pkt = true;
|
||||||
goto out;
|
goto out;
|
||||||
|
|||||||
Reference in New Issue
Block a user