Skip to content

Commit 268762d

Browse files
committed
Merge branch 'virtio-net-rq-coalescing' into main
Heng Qi says: ==================== virtio-net: unbreak vq resizing if vq coalescing is not supported Currently, if the driver does not negotiate the vq coalescing feature but supports vq resize, the vq resize action, which could have been successfully executed, is interrupted due to the failure in configuring the vq coalescing parameters. This issue needs to be fixed. Changelog ========= v3->v4: - Add a comment for patch[2/2]. v2->v3: - Break out the feature check and the fix into separate patches. v1->v2: - Rephrase the subject. - Put the feature check inside the virtnet_send_{r,t}x_ctrl_coal_vq_cmd. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 14ab479 + 4ba8d97 commit 268762d

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

drivers/net/virtio_net.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3658,6 +3658,9 @@ static int virtnet_send_rx_ctrl_coal_vq_cmd(struct virtnet_info *vi,
36583658
{
36593659
int err;
36603660

3661+
if (!virtio_has_feature(vi->vdev, VIRTIO_NET_F_VQ_NOTF_COAL))
3662+
return -EOPNOTSUPP;
3663+
36613664
err = virtnet_send_ctrl_coal_vq_cmd(vi, rxq2vq(queue),
36623665
max_usecs, max_packets);
36633666
if (err)
@@ -3675,6 +3678,9 @@ static int virtnet_send_tx_ctrl_coal_vq_cmd(struct virtnet_info *vi,
36753678
{
36763679
int err;
36773680

3681+
if (!virtio_has_feature(vi->vdev, VIRTIO_NET_F_VQ_NOTF_COAL))
3682+
return -EOPNOTSUPP;
3683+
36783684
err = virtnet_send_ctrl_coal_vq_cmd(vi, txq2vq(queue),
36793685
max_usecs, max_packets);
36803686
if (err)
@@ -3743,7 +3749,11 @@ static int virtnet_set_ringparam(struct net_device *dev,
37433749
err = virtnet_send_tx_ctrl_coal_vq_cmd(vi, i,
37443750
vi->intr_coal_tx.max_usecs,
37453751
vi->intr_coal_tx.max_packets);
3746-
if (err)
3752+
3753+
/* Don't break the tx resize action if the vq coalescing is not
3754+
* supported. The same is true for rx resize below.
3755+
*/
3756+
if (err && err != -EOPNOTSUPP)
37473757
return err;
37483758
}
37493759

@@ -3758,7 +3768,7 @@ static int virtnet_set_ringparam(struct net_device *dev,
37583768
vi->intr_coal_rx.max_usecs,
37593769
vi->intr_coal_rx.max_packets);
37603770
mutex_unlock(&vi->rq[i].dim_lock);
3761-
if (err)
3771+
if (err && err != -EOPNOTSUPP)
37623772
return err;
37633773
}
37643774
}

0 commit comments

Comments
 (0)