@@ -2071,6 +2071,12 @@ static int virtnet_rx_resize(struct virtnet_info *vi,
bool running = netif_running(vi->dev);
int err, qindex;
+ /* We cannot convert a ring to a small vring */
+ if (!vi->svring && IS_SMALL_VRING(ring_num)) {
+ netdev_err(vi->dev, "resize rx fail: size is too small..\n");
+ return -EINVAL;
+ }
+
qindex = rq - vi->rq;
if (running)
@@ -2097,6 +2103,12 @@ static int virtnet_tx_resize(struct virtnet_info *vi,
qindex = sq - vi->sq;
+ /* We cannot convert a ring to a small vring */
+ if (!vi->svring && IS_SMALL_VRING(ring_num)) {
+ netdev_err(vi->dev, "resize tx fail: size is too small..\n");
+ return -EINVAL;
+ }
+
if (running)
virtnet_napi_tx_disable(&sq->napi);
Stop ethtool from resizing a TX/RX ring to size less than MAX_SKB_FRAGS + 2, if the ring was initialized with a bigger size. We cannot convert a "normal" ring to a "small" ring in runtime. Signed-off-by: Alvaro Karsz <alvaro.karsz@solid-run.com> --- drivers/net/virtio_net.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)