Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

virtio_net: simplify tx queue wake condition check

Consolidate the two nested if conditions for checking tx queue wake
conditions into a single combined condition. This improves code
readability without changing functionality. And move netif_tx_wake_queue
into if condition to reduce unnecessary checks for queue stops.

Signed-off-by: Liming Wu <liming.wu@jaguarmicro.com>
Tested-by: Lei Yang <leiyang@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Link: https://patch.msgid.link/20250710023208.846-1-liming.wu@jaguarmicro.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Liming Wu and committed by
Jakub Kicinski
2f82e995 ecdec65e

+10 -12
+10 -12
drivers/net/virtio_net.c
··· 3064 3064 free_old_xmit(sq, txq, !!budget); 3065 3065 } while (unlikely(!virtqueue_enable_cb_delayed(sq->vq))); 3066 3066 3067 - if (sq->vq->num_free >= MAX_SKB_FRAGS + 2) { 3068 - if (netif_tx_queue_stopped(txq)) { 3069 - u64_stats_update_begin(&sq->stats.syncp); 3070 - u64_stats_inc(&sq->stats.wake); 3071 - u64_stats_update_end(&sq->stats.syncp); 3072 - } 3067 + if (sq->vq->num_free >= MAX_SKB_FRAGS + 2 && 3068 + netif_tx_queue_stopped(txq)) { 3069 + u64_stats_update_begin(&sq->stats.syncp); 3070 + u64_stats_inc(&sq->stats.wake); 3071 + u64_stats_update_end(&sq->stats.syncp); 3073 3072 netif_tx_wake_queue(txq); 3074 3073 } 3075 3074 ··· 3260 3261 else 3261 3262 free_old_xmit(sq, txq, !!budget); 3262 3263 3263 - if (sq->vq->num_free >= MAX_SKB_FRAGS + 2) { 3264 - if (netif_tx_queue_stopped(txq)) { 3265 - u64_stats_update_begin(&sq->stats.syncp); 3266 - u64_stats_inc(&sq->stats.wake); 3267 - u64_stats_update_end(&sq->stats.syncp); 3268 - } 3264 + if (sq->vq->num_free >= MAX_SKB_FRAGS + 2 && 3265 + netif_tx_queue_stopped(txq)) { 3266 + u64_stats_update_begin(&sq->stats.syncp); 3267 + u64_stats_inc(&sq->stats.wake); 3268 + u64_stats_update_end(&sq->stats.syncp); 3269 3269 netif_tx_wake_queue(txq); 3270 3270 } 3271 3271