Commit 1df5116a authored by Xuan Zhuo's avatar Xuan Zhuo Committed by Jakub Kicinski
Browse files

virtio_net: xsk: prevent disable tx napi



Since xsk's TX queue is consumed by TX NAPI, if sq is bound to xsk, then
we must stop tx napi from being disabled.

Signed-off-by: default avatarXuan Zhuo <xuanzhuo@linux.alibaba.com>
Acked-by: default avatarJason Wang <jasowang@redhat.com>
Link: https://patch.msgid.link/20241112012928.102478-11-xuanzhuo@linux.alibaba.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 21a4e3ce
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -5090,7 +5090,7 @@ static int virtnet_set_coalesce(struct net_device *dev,
				struct netlink_ext_ack *extack)
{
	struct virtnet_info *vi = netdev_priv(dev);
	int ret, queue_number, napi_weight;
	int ret, queue_number, napi_weight, i;
	bool update_napi = false;

	/* Can't change NAPI weight if the link is up */
@@ -5119,6 +5119,14 @@ static int virtnet_set_coalesce(struct net_device *dev,
		return ret;

	if (update_napi) {
		/* xsk xmit depends on the tx napi. So if xsk is active,
		 * prevent modifications to tx napi.
		 */
		for (i = queue_number; i < vi->max_queue_pairs; i++) {
			if (vi->sq[i].xsk_pool)
				return -EBUSY;
		}

		for (; queue_number < vi->max_queue_pairs; queue_number++)
			vi->sq[queue_number].napi.weight = napi_weight;
	}