Skip to content

Commit b50f2af

Browse files
Heng Qidavem330
authored andcommitted
virtio-net: check feature before configuring the vq coalescing command
Virtio spec says: The driver MUST have negotiated the VIRTIO_NET_F_VQ_NOTF_COAL feature when issuing commands VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET and VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET. So we add the feature negotiation check to virtnet_send_{r,t}x_ctrl_coal_vq_cmd as a basis for the next bugfix patch. Suggested-by: Michael S. Tsirkin <[email protected]> Signed-off-by: Heng Qi <[email protected]> Acked-by: Jason Wang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 14ab479 commit b50f2af

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/net/virtio_net.c

Lines changed: 6 additions & 0 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)

0 commit comments

Comments
 (0)