veth does not link its RX queues to their NAPI instances. queue-get therefore reports no napi-id for them. napi-get lists the NAPI instances of a veth, and their thread PIDs when NAPI is threaded. It does not show which RX queue each instance polls. Userspace cannot tell which NAPI thread to pin for a given queue, or which NAPI to change with napi-set. There is also no way to busy poll an AF_XDP socket bound to a veth queue. Since commit b95ed5517354 ("xsk: Bring back busy polling support in XDP_COPY"), xsk_bind() takes the NAPI ID of a copy-mode socket from rxq->napi. veth never sets rxq->napi, so the socket gets no NAPI ID. Call netif_queue_set_napi() after napi_enable(), which assigns the NAPI ID. Call it again with NULL before napi_disable(). veth is not ops locked, so netif_queue_set_napi() requires RTNL. veth enables and disables NAPI only in ndo_open, ndo_stop, ndo_bpf, ndo_set_features and ethtool's set_channels. All of them are called under RTNL. Suggested-by: Jesper Dangaard Brouer Signed-off-by: Tianyi Gao --- drivers/net/veth.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/veth.c b/drivers/net/veth.c index f5097696df15..c04277186405 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c @@ -1062,6 +1062,8 @@ static int veth_napi_enable_range(struct net_device *dev, int start, int end) netif_napi_add(dev, &rq->xdp_napi, veth_poll); rcu_assign_pointer(rq->xdp_prog, priv->_xdp_prog); napi_enable(&rq->xdp_napi); + netif_queue_set_napi(dev, i, NETDEV_QUEUE_TYPE_RX, + &rq->xdp_napi); rcu_assign_pointer(priv->rq[i].napi, &priv->rq[i].xdp_napi); } @@ -1094,6 +1096,7 @@ static void veth_napi_del_range(struct net_device *dev, int start, int end) struct veth_rq *rq = &priv->rq[i]; rcu_assign_pointer(priv->rq[i].napi, NULL); + netif_queue_set_napi(dev, i, NETDEV_QUEUE_TYPE_RX, NULL); napi_disable(&rq->xdp_napi); rcu_assign_pointer(rq->xdp_prog, NULL); __netif_napi_del(&rq->xdp_napi); -- 2.56.0