xsk: Propagate napi_id to XDP socket Rx path
Add napi_id to the xdp_rxq_info structure, and make sure the XDP socket pick up the napi_id in the Rx path. The napi_id is used to find the corresponding NAPI structure for socket busy polling. Signed-off-by: Björn Töpel <bjorn.topel@intel.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Acked-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Tariq Toukan <tariqt@nvidia.com> Link: https://lore.kernel.org/bpf/20201130185205.196029-7-bjorn.topel@gmail.com
This commit is contained in:
committed by
Daniel Borkmann
parent
a0731952d9
commit
b02e5a0ebb
@ -884,7 +884,6 @@ static int veth_napi_add(struct net_device *dev)
|
||||
for (i = 0; i < dev->real_num_rx_queues; i++) {
|
||||
struct veth_rq *rq = &priv->rq[i];
|
||||
|
||||
netif_napi_add(dev, &rq->xdp_napi, veth_poll, NAPI_POLL_WEIGHT);
|
||||
napi_enable(&rq->xdp_napi);
|
||||
}
|
||||
|
||||
@ -926,7 +925,8 @@ static int veth_enable_xdp(struct net_device *dev)
|
||||
for (i = 0; i < dev->real_num_rx_queues; i++) {
|
||||
struct veth_rq *rq = &priv->rq[i];
|
||||
|
||||
err = xdp_rxq_info_reg(&rq->xdp_rxq, dev, i);
|
||||
netif_napi_add(dev, &rq->xdp_napi, veth_poll, NAPI_POLL_WEIGHT);
|
||||
err = xdp_rxq_info_reg(&rq->xdp_rxq, dev, i, rq->xdp_napi.napi_id);
|
||||
if (err < 0)
|
||||
goto err_rxq_reg;
|
||||
|
||||
@ -952,8 +952,12 @@ static int veth_enable_xdp(struct net_device *dev)
|
||||
err_reg_mem:
|
||||
xdp_rxq_info_unreg(&priv->rq[i].xdp_rxq);
|
||||
err_rxq_reg:
|
||||
for (i--; i >= 0; i--)
|
||||
xdp_rxq_info_unreg(&priv->rq[i].xdp_rxq);
|
||||
for (i--; i >= 0; i--) {
|
||||
struct veth_rq *rq = &priv->rq[i];
|
||||
|
||||
xdp_rxq_info_unreg(&rq->xdp_rxq);
|
||||
netif_napi_del(&rq->xdp_napi);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
Reference in New Issue
Block a user