... | ... | ||
---|---|---|---|
29 | deliberately reschedule RX and TX work after a fixed threshold (256) of | 29 | deliberately reschedule RX and TX work after a fixed threshold (256) of |
30 | packets to process. | 30 | packets to process. |
31 | 31 | ||
32 | Fixes: 0ea9e1d3a9e3 ("VSOCK: Introduce virtio_transport.ko") | 32 | Fixes: 0ea9e1d3a9e3 ("VSOCK: Introduce virtio_transport.ko") |
33 | Signed-off-by: Alexander Graf <graf@amazon.com> | 33 | Signed-off-by: Alexander Graf <graf@amazon.com> |
34 | |||
34 | --- | 35 | --- |
35 | net/vmw_vsock/virtio_transport.c | 70 +++++++++----------------------- | 36 | |
36 | 1 file changed, 19 insertions(+), 51 deletions(-) | 37 | v1 -> v2: |
38 | |||
39 | - Rework to use fixed threshold | ||
40 | |||
41 | v2 -> v3: | ||
42 | |||
43 | - Remove superfluous reply variable | ||
44 | --- | ||
45 | net/vmw_vsock/virtio_transport.c | 73 +++++++++----------------------- | ||
46 | 1 file changed, 19 insertions(+), 54 deletions(-) | ||
37 | 47 | ||
38 | diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c | 48 | diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c |
39 | index XXXXXXX..XXXXXXX 100644 | 49 | index XXXXXXX..XXXXXXX 100644 |
40 | --- a/net/vmw_vsock/virtio_transport.c | 50 | --- a/net/vmw_vsock/virtio_transport.c |
41 | +++ b/net/vmw_vsock/virtio_transport.c | 51 | +++ b/net/vmw_vsock/virtio_transport.c |
... | ... | ||
69 | + int pkts = 0; | 79 | + int pkts = 0; |
70 | 80 | ||
71 | mutex_lock(&vsock->tx_lock); | 81 | mutex_lock(&vsock->tx_lock); |
72 | 82 | ||
73 | @@ -XXX,XX +XXX,XX @@ virtio_transport_send_pkt_work(struct work_struct *work) | 83 | @@ -XXX,XX +XXX,XX @@ virtio_transport_send_pkt_work(struct work_struct *work) |
74 | bool reply; | 84 | |
85 | for (;;) { | ||
86 | struct sk_buff *skb; | ||
87 | - bool reply; | ||
75 | int ret; | 88 | int ret; |
76 | 89 | ||
77 | + if (++pkts > VSOCK_MAX_PKTS_PER_WORK) { | 90 | + if (++pkts > VSOCK_MAX_PKTS_PER_WORK) { |
78 | + /* Allow other works on the same queue to run */ | 91 | + /* Allow other works on the same queue to run */ |
79 | + queue_work(virtio_vsock_workqueue, work); | 92 | + queue_work(virtio_vsock_workqueue, work); |
80 | + break; | 93 | + break; |
81 | + } | 94 | + } |
82 | + | 95 | + |
83 | skb = virtio_vsock_skb_dequeue(&vsock->send_pkt_queue); | 96 | skb = virtio_vsock_skb_dequeue(&vsock->send_pkt_queue); |
84 | if (!skb) | 97 | if (!skb) |
85 | break; | 98 | break; |
86 | @@ -XXX,XX +XXX,XX @@ virtio_transport_send_pkt_work(struct work_struct *work) | 99 | |
100 | - reply = virtio_vsock_skb_reply(skb); | ||
101 | - | ||
102 | ret = virtio_transport_send_skb(skb, vq, vsock, GFP_KERNEL); | ||
103 | if (ret < 0) { | ||
104 | virtio_vsock_skb_queue_head(&vsock->send_pkt_queue, skb); | ||
87 | break; | 105 | break; |
88 | } | 106 | } |
89 | 107 | ||
90 | - if (reply) { | 108 | - if (reply) { |
91 | - struct virtqueue *rx_vq = vsock->vqs[VSOCK_VQ_RX]; | 109 | - struct virtqueue *rx_vq = vsock->vqs[VSOCK_VQ_RX]; |
... | ... | diff view generated by jsdifflib |