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 <xuanzhuo at linux.alibaba.com>
---
drivers/net/virtio/main.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/virtio/main.c b/drivers/net/virtio/main.c
index ed79e750bc6c..232cf151abff 100644
--- a/drivers/net/virtio/main.c
+++ b/drivers/net/virtio/main.c
@@ -2728,8 +2728,15 @@ static int virtnet_set_coalesce(struct net_device *dev,
return ret;
if (update_napi) {
- for (i = 0; i < vi->max_queue_pairs; i++)
+ for (i = 0; i < vi->max_queue_pairs; i++) {
+ /* xsk xmit depend on the tx napi. So if xsk is active,
+ * prevent modifications to tx napi.
+ */
+ if (rtnl_dereference(vi->sq[i].xsk.pool))
+ continue;
+
vi->sq[i].napi.weight = napi_weight;
+ }
}
return ret;
--
2.32.0.3.g01195cf9f
Michael S. Tsirkin
2023-Feb-02 17:25 UTC
[PATCH 24/33] virtio_net: xsk: stop disable tx napi
On Thu, Feb 02, 2023 at 07:00:49PM +0800, Xuan Zhuo wrote:> 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 <xuanzhuo at linux.alibaba.com> > --- > drivers/net/virtio/main.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/virtio/main.c b/drivers/net/virtio/main.c > index ed79e750bc6c..232cf151abff 100644 > --- a/drivers/net/virtio/main.c > +++ b/drivers/net/virtio/main.c > @@ -2728,8 +2728,15 @@ static int virtnet_set_coalesce(struct net_device *dev, > return ret; > > if (update_napi) { > - for (i = 0; i < vi->max_queue_pairs; i++) > + for (i = 0; i < vi->max_queue_pairs; i++) { > + /* xsk xmit depend on the tx napi. So if xsk is active,depends.> + * prevent modifications to tx napi. > + */ > + if (rtnl_dereference(vi->sq[i].xsk.pool)) > + continue; > + > vi->sq[i].napi.weight = napi_weight;I don't get it. changing napi weight does not work then. why is this ok?> + } > } > > return ret; > -- > 2.32.0.3.g01195cf9f