Netdev List
 help / color / mirror / Atom feed
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Yunjian Wang <wangyunjian@huawei.com>,
	 willemdebruijn.kernel@gmail.com,  jasowang@redhat.com,
	 kuba@kernel.org,  davem@davemloft.net
Cc: netdev@vger.kernel.org,  linux-kernel@vger.kernel.org,
	 brouer@redhat.com,  xudingke@huawei.com,
	 Yunjian Wang <wangyunjian@huawei.com>
Subject: Re: [PATCH net] tun: Fix xdp_rxq_info's queue_index when detaching
Date: Tue, 20 Feb 2024 10:59:07 -0500	[thread overview]
Message-ID: <65d4cc4b88e56_23483829431@willemb.c.googlers.com.notmuch> (raw)
In-Reply-To: <1708398727-46308-1-git-send-email-wangyunjian@huawei.com>

Yunjian Wang wrote:
> When a queue(tfile) is detached, we only update tfile's queue_index,
> but do not update xdp_rxq_info's queue_index. This patch fixes it.
> 
> Fixes: 8bf5c4ee1889 ("tun: setup xdp_rxq_info")
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> ---
>  drivers/net/tun.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index bc80fc1d576e..be37235af55d 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -652,6 +652,7 @@ static void __tun_detach(struct tun_file *tfile, bool clean)
>  				   tun->tfiles[tun->numqueues - 1]);
>  		ntfile = rtnl_dereference(tun->tfiles[index]);
>  		ntfile->queue_index = index;
> +		ntfile->xdp_rxq.queue_index = index;
>  		rcu_assign_pointer(tun->tfiles[tun->numqueues - 1],
>  				   NULL);

Does it matter that this value is stale when undetached?

It is replaced in tun_attach if previously attached:

		/* Re-attach detached tfile, updating XDP queue_index */
                WARN_ON(!xdp_rxq_info_is_reg(&tfile->xdp_rxq));

                if (tfile->xdp_rxq.queue_index    != tfile->queue_index)
                        tfile->xdp_rxq.queue_index = tfile->queue_index;

  reply	other threads:[~2024-02-20 15:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-20  3:12 [PATCH net] tun: Fix xdp_rxq_info's queue_index when detaching Yunjian Wang
2024-02-20 15:59 ` Willem de Bruijn [this message]
2024-02-21  2:40   ` wangyunjian
2024-02-21 15:03     ` Willem de Bruijn
2024-02-24  0:30 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=65d4cc4b88e56_23483829431@willemb.c.googlers.com.notmuch \
    --to=willemdebruijn.kernel@gmail.com \
    --cc=brouer@redhat.com \
    --cc=davem@davemloft.net \
    --cc=jasowang@redhat.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=wangyunjian@huawei.com \
    --cc=xudingke@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox