[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJ8uoz3HDEh-vH=hUGcBCDZQr8au2b5ZfM3gpc-Lw1oRr1QDGQ@mail.gmail.com>
Date: Tue, 5 Dec 2023 10:03:32 +0100
From: Magnus Karlsson <magnus.karlsson@...il.com>
To: Yewon Choi <woni9911@...il.com>
Cc: Björn Töpel <bjorn@...nel.org>,
Magnus Karlsson <magnus.karlsson@...el.com>,
Maciej Fijalkowski <maciej.fijalkowski@...el.com>, Jonathan Lemon <jonathan.lemon@...il.com>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>, Jesper Dangaard Brouer <hawk@...nel.org>,
John Fastabend <john.fastabend@...il.com>, netdev@...r.kernel.org, bpf@...r.kernel.org,
linux-kernel@...r.kernel.org, threeearcat@...il.com
Subject: Re: [PATCH bpf] xsk: skip polling event check for unbound socket
On Fri, 1 Dec 2023 at 07:11, Yewon Choi <woni9911@...il.com> wrote:
>
> In xsk_poll(), checking available events and setting mask bits should
> be executed only when a socket has been bound. Setting mask bits for
> unbound socket is meaningless.
> Currently, it checks events even when xsk_check_common() failed.
> To prevent this, we move goto location (skip_tx) after that checking.
Thanks for the fix.
Acked-by: Magnus Karlsson <magnus.karlsson@...el.com>
> Fixes: 1596dae2f17e ("xsk: check IFF_UP earlier in Tx path")
> Signed-off-by: Yewon Choi <woni9911@...il.com>
> ---
> net/xdp/xsk.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c
> index ae9f8cb611f6..1e5a65326d1d 100644
> --- a/net/xdp/xsk.c
> +++ b/net/xdp/xsk.c
> @@ -947,7 +947,7 @@ static __poll_t xsk_poll(struct file *file, struct socket *sock,
>
> rcu_read_lock();
> if (xsk_check_common(xs))
> - goto skip_tx;
> + goto out;
>
> pool = xs->pool;
>
> @@ -959,12 +959,12 @@ static __poll_t xsk_poll(struct file *file, struct socket *sock,
> xsk_generic_xmit(sk);
> }
>
> -skip_tx:
> if (xs->rx && !xskq_prod_is_empty(xs->rx))
> mask |= EPOLLIN | EPOLLRDNORM;
> if (xs->tx && xsk_tx_writeable(xs))
> mask |= EPOLLOUT | EPOLLWRNORM;
>
> +out:
> rcu_read_unlock();
> return mask;
> }
> --
> 2.37.3
>
>
Powered by blists - more mailing lists