lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <65c0f032ac71a_7396029419@willemb.c.googlers.com.notmuch>
Date: Mon, 05 Feb 2024 09:26:58 -0500
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: Magnus Karlsson <magnus.karlsson@...il.com>, 
 magnus.karlsson@...el.com, 
 bjorn@...nel.org, 
 ast@...nel.org, 
 daniel@...earbox.net, 
 netdev@...r.kernel.org, 
 maciej.fijalkowski@...el.com, 
 yuvale@...ware.com
Cc: bpf@...r.kernel.org
Subject: Re: [PATCH bpf-next 1/2] xsk: support redirect to any socket bound to
 the same umem

Magnus Karlsson wrote:
> From: Magnus Karlsson <magnus.karlsson@...el.com>
> 
> Add support for directing a packet to any socket bound to the same
> umem. This makes it possible to use the XDP program to select what
> socket the packet should be received on. The user can populate the
> XSKMAP with various sockets and as long as they share the same umem,
> the XDP program can pick any one of them.
> 
> Suggested-by: Yuval El-Hanany <yuvale@...ware.com>
> Signed-off-by: Magnus Karlsson <magnus.karlsson@...el.com>

Reviewed-by: Willem de Bruijn <willemb@...gle.com>

This will greatly simplify using AF_XDP sockets with standard RSS.

A socket can be attached to each NIC receive queue, and regardless to
which queue RSS directs a packet, the XDP program can pass it to the
AF_XDP socket that is the intended target.

In the trivial case a single AF_XDP socket receives all XDP_REDIRECT
traffic for the entire device. Similar to how a single PF_PACKET
socket can access all ingress traffic.

Though N fill queues still need to be maintained of course.

> ---
>  net/xdp/xsk.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c
> index 1eadfac03cc4..a339e9a1b557 100644
> --- a/net/xdp/xsk.c
> +++ b/net/xdp/xsk.c
> @@ -313,10 +313,13 @@ static bool xsk_is_bound(struct xdp_sock *xs)
>  
>  static int xsk_rcv_check(struct xdp_sock *xs, struct xdp_buff *xdp, u32 len)
>  {
> +	struct net_device *dev = xdp->rxq->dev;
> +	u32 qid = xdp->rxq->queue_index;
> +
>  	if (!xsk_is_bound(xs))
>  		return -ENXIO;
>  
> -	if (xs->dev != xdp->rxq->dev || xs->queue_id != xdp->rxq->queue_index)
> +	if (!dev->_rx[qid].pool || xs->umem != dev->_rx[qid].pool->umem)
>  		return -EINVAL;
>  
>  	if (len > xsk_pool_get_rx_frame_size(xs->pool) && !xs->sg) {
> -- 
> 2.42.0
> 



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ