Skip to content

Commit e8182df

Browse files
committed
virtio_net: Cleanup '2+MAX_SKB_FRAGS'
JIRA: https://issues.redhat.com/browse/RHEL-84409 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 ba349c7 commit e8182df

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
@@ -1065,7 +1065,7 @@ static void check_sq_full_and_disable(struct virtnet_info *vi,
10651065
* Since most packets only take 1 or 2 ring slots, stopping the queue
10661066
* early means 16 slots are typically wasted.
10671067
*/
1068-
if (sq->vq->num_free < 2+MAX_SKB_FRAGS) {
1068+
if (sq->vq->num_free < MAX_SKB_FRAGS + 2) {
10691069
struct netdev_queue *txq = netdev_get_tx_queue(dev, qnum);
10701070

10711071
netif_tx_stop_queue(txq);
@@ -1078,7 +1078,7 @@ static void check_sq_full_and_disable(struct virtnet_info *vi,
10781078
} else if (unlikely(!virtqueue_enable_cb_delayed(sq->vq))) {
10791079
/* More just got used, free them then recheck. */
10801080
free_old_xmit(sq, txq, false);
1081-
if (sq->vq->num_free >= 2+MAX_SKB_FRAGS) {
1081+
if (sq->vq->num_free >= MAX_SKB_FRAGS + 2) {
10821082
netif_start_subqueue(dev, qnum);
10831083
u64_stats_update_begin(&sq->stats.syncp);
10841084
u64_stats_inc(&sq->stats.wake);
@@ -2797,7 +2797,7 @@ static void virtnet_poll_cleantx(struct receive_queue *rq, int budget)
27972797
free_old_xmit(sq, txq, !!budget);
27982798
} while (unlikely(!virtqueue_enable_cb_delayed(sq->vq)));
27992799

2800-
if (sq->vq->num_free >= 2 + MAX_SKB_FRAGS) {
2800+
if (sq->vq->num_free >= MAX_SKB_FRAGS + 2) {
28012801
if (netif_tx_queue_stopped(txq)) {
28022802
u64_stats_update_begin(&sq->stats.syncp);
28032803
u64_stats_inc(&sq->stats.wake);
@@ -2990,7 +2990,7 @@ static int virtnet_poll_tx(struct napi_struct *napi, int budget)
29902990
virtqueue_disable_cb(sq->vq);
29912991
free_old_xmit(sq, txq, !!budget);
29922992

2993-
if (sq->vq->num_free >= 2 + MAX_SKB_FRAGS) {
2993+
if (sq->vq->num_free >= MAX_SKB_FRAGS + 2) {
29942994
if (netif_tx_queue_stopped(txq)) {
29952995
u64_stats_update_begin(&sq->stats.syncp);
29962996
u64_stats_inc(&sq->stats.wake);

0 commit comments

Comments
 (0)