Skip to content

Commit 33596ad

Browse files
committed
virtio_net: Cleanup '2+MAX_SKB_FRAGS'
JIRA: https://issues.redhat.com/browse/RHEL-84199 Upstream Status: git@gitlab.com:redhat/centos-stream/src/kernel/centos-stream-9.git commit bd2948d Author: Laurent Vivier <lvivier@redhat.com> Date: Wed May 21 11:22:35 2025 +0200 virtio_net: Cleanup '2+MAX_SKB_FRAGS' Improve consistency by using everywhere it is needed 'MAX_SKB_FRAGS + 2' rather than '2+MAX_SKB_FRAGS' or '2 + MAX_SKB_FRAGS'. No functional change. Signed-off-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com> Acked-by: Jason Wang <jasowang@redhat.com> Link: https://patch.msgid.link/20250521092236.661410-3-lvivier@redhat.com Tested-by: Lei Yang <leiyang@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
1 parent 5fb5bd7 commit 33596ad

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/net/virtio_net.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -802,15 +802,15 @@ static void check_sq_full_and_disable(struct virtnet_info *vi,
802802
* Since most packets only take 1 or 2 ring slots, stopping the queue
803803
* early means 16 slots are typically wasted.
804804
*/
805-
if (sq->vq->num_free < 2+MAX_SKB_FRAGS) {
805+
if (sq->vq->num_free < MAX_SKB_FRAGS + 2) {
806806
netif_stop_subqueue(dev, qnum);
807807
if (use_napi) {
808808
if (unlikely(!virtqueue_enable_cb_delayed(sq->vq)))
809809
virtqueue_napi_schedule(&sq->napi, sq->vq);
810810
} else if (unlikely(!virtqueue_enable_cb_delayed(sq->vq))) {
811811
/* More just got used, free them then recheck. */
812812
free_old_xmit_skbs(sq, false);
813-
if (sq->vq->num_free >= 2+MAX_SKB_FRAGS) {
813+
if (sq->vq->num_free >= MAX_SKB_FRAGS + 2) {
814814
netif_start_subqueue(dev, qnum);
815815
virtqueue_disable_cb(sq->vq);
816816
}
@@ -2129,7 +2129,7 @@ static void virtnet_poll_cleantx(struct receive_queue *rq)
21292129
free_old_xmit_skbs(sq, true);
21302130
} while (unlikely(!virtqueue_enable_cb_delayed(sq->vq)));
21312131

2132-
if (sq->vq->num_free >= 2 + MAX_SKB_FRAGS)
2132+
if (sq->vq->num_free >= MAX_SKB_FRAGS + 2)
21332133
netif_tx_wake_queue(txq);
21342134

21352135
__netif_tx_unlock(txq);
@@ -2250,7 +2250,7 @@ static int virtnet_poll_tx(struct napi_struct *napi, int budget)
22502250
virtqueue_disable_cb(sq->vq);
22512251
free_old_xmit_skbs(sq, true);
22522252

2253-
if (sq->vq->num_free >= 2 + MAX_SKB_FRAGS)
2253+
if (sq->vq->num_free >= MAX_SKB_FRAGS + 2)
22542254
netif_tx_wake_queue(txq);
22552255

22562256
opaque = virtqueue_enable_cb_prepare(sq->vq);

0 commit comments

Comments
 (0)