Skip to content

Commit bd2948d

Browse files
vivierPaolo Abeni
authored andcommitted
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 <[email protected]> Reviewed-by: Xuan Zhuo <[email protected]> Acked-by: Jason Wang <[email protected]> Link: https://patch.msgid.link/[email protected] Tested-by: Lei Yang <[email protected]> Acked-by: Michael S. Tsirkin <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
1 parent 45ebc7e commit bd2948d

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
@@ -1104,7 +1104,7 @@ static bool tx_may_stop(struct virtnet_info *vi,
11041104
* Since most packets only take 1 or 2 ring slots, stopping the queue
11051105
* early means 16 slots are typically wasted.
11061106
*/
1107-
if (sq->vq->num_free < 2+MAX_SKB_FRAGS) {
1107+
if (sq->vq->num_free < MAX_SKB_FRAGS + 2) {
11081108
struct netdev_queue *txq = netdev_get_tx_queue(dev, qnum);
11091109

11101110
netif_tx_stop_queue(txq);
@@ -1136,7 +1136,7 @@ static void check_sq_full_and_disable(struct virtnet_info *vi,
11361136
} else if (unlikely(!virtqueue_enable_cb_delayed(sq->vq))) {
11371137
/* More just got used, free them then recheck. */
11381138
free_old_xmit(sq, txq, false);
1139-
if (sq->vq->num_free >= 2+MAX_SKB_FRAGS) {
1139+
if (sq->vq->num_free >= MAX_SKB_FRAGS + 2) {
11401140
netif_start_subqueue(dev, qnum);
11411141
u64_stats_update_begin(&sq->stats.syncp);
11421142
u64_stats_inc(&sq->stats.wake);
@@ -3021,7 +3021,7 @@ static void virtnet_poll_cleantx(struct receive_queue *rq, int budget)
30213021
free_old_xmit(sq, txq, !!budget);
30223022
} while (unlikely(!virtqueue_enable_cb_delayed(sq->vq)));
30233023

3024-
if (sq->vq->num_free >= 2 + MAX_SKB_FRAGS) {
3024+
if (sq->vq->num_free >= MAX_SKB_FRAGS + 2) {
30253025
if (netif_tx_queue_stopped(txq)) {
30263026
u64_stats_update_begin(&sq->stats.syncp);
30273027
u64_stats_inc(&sq->stats.wake);
@@ -3218,7 +3218,7 @@ static int virtnet_poll_tx(struct napi_struct *napi, int budget)
32183218
else
32193219
free_old_xmit(sq, txq, !!budget);
32203220

3221-
if (sq->vq->num_free >= 2 + MAX_SKB_FRAGS) {
3221+
if (sq->vq->num_free >= MAX_SKB_FRAGS + 2) {
32223222
if (netif_tx_queue_stopped(txq)) {
32233223
u64_stats_update_begin(&sq->stats.syncp);
32243224
u64_stats_inc(&sq->stats.wake);

0 commit comments

Comments
 (0)