Skip to content

Commit 1df5116

Browse files
fengidrikuba-moo
authored andcommitted
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: Xuan Zhuo <[email protected]> Acked-by: Jason Wang <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 21a4e3c commit 1df5116

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

drivers/net/virtio_net.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5090,7 +5090,7 @@ static int virtnet_set_coalesce(struct net_device *dev,
50905090
struct netlink_ext_ack *extack)
50915091
{
50925092
struct virtnet_info *vi = netdev_priv(dev);
5093-
int ret, queue_number, napi_weight;
5093+
int ret, queue_number, napi_weight, i;
50945094
bool update_napi = false;
50955095

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

51215121
if (update_napi) {
5122+
/* xsk xmit depends on the tx napi. So if xsk is active,
5123+
* prevent modifications to tx napi.
5124+
*/
5125+
for (i = queue_number; i < vi->max_queue_pairs; i++) {
5126+
if (vi->sq[i].xsk_pool)
5127+
return -EBUSY;
5128+
}
5129+
51225130
for (; queue_number < vi->max_queue_pairs; queue_number++)
51235131
vi->sq[queue_number].napi.weight = napi_weight;
51245132
}

0 commit comments

Comments
 (0)