Patch "xsk: add multi-buffer support for sockets sharing umem" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    xsk: add multi-buffer support for sockets sharing umem

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     xsk-add-multi-buffer-support-for-sockets-sharing-ume.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 6436ee6684af950128d3fd91775b23bcbe2ae6c7
Author: Tirthendu Sarkar <tirthendu.sarkar@xxxxxxxxx>
Date:   Thu Sep 7 09:20:32 2023 +0530

    xsk: add multi-buffer support for sockets sharing umem
    
    [ Upstream commit d609f3d228a8efe991f44f11f24146e2a5209755 ]
    
    Userspace applications indicate their multi-buffer capability to xsk
    using XSK_USE_SG socket bind flag. For sockets using shared umem the
    bind flag may contain XSK_USE_SG only for the first socket. For any
    subsequent socket the only option supported is XDP_SHARED_UMEM.
    
    Add option XDP_UMEM_SG_FLAG in umem config flags to store the
    multi-buffer handling capability when indicated by XSK_USE_SG option in
    bing flag by the first socket. Use this to derive multi-buffer capability
    for subsequent sockets in xsk core.
    
    Signed-off-by: Tirthendu Sarkar <tirthendu.sarkar@xxxxxxxxx>
    Fixes: 81470b5c3c66 ("xsk: introduce XSK_USE_SG bind flag for xsk socket")
    Acked-by: Maciej Fijalkowski <maciej.fijalkowski@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20230907035032.2627879-1-tirthendu.sarkar@xxxxxxxxx
    Signed-off-by: Alexei Starovoitov <ast@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/include/net/xdp_sock.h b/include/net/xdp_sock.h
index 1617af3801620..69b472604b86f 100644
--- a/include/net/xdp_sock.h
+++ b/include/net/xdp_sock.h
@@ -14,6 +14,8 @@
 #include <linux/mm.h>
 #include <net/sock.h>
 
+#define XDP_UMEM_SG_FLAG (1 << 1)
+
 struct net_device;
 struct xsk_queue;
 struct xdp_buff;
diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c
index 3515e19852d88..774a6d1916e40 100644
--- a/net/xdp/xsk.c
+++ b/net/xdp/xsk.c
@@ -1227,7 +1227,7 @@ static int xsk_bind(struct socket *sock, struct sockaddr *addr, int addr_len)
 
 	xs->dev = dev;
 	xs->zc = xs->umem->zc;
-	xs->sg = !!(flags & XDP_USE_SG);
+	xs->sg = !!(xs->umem->flags & XDP_UMEM_SG_FLAG);
 	xs->queue_id = qid;
 	xp_add_xsk(xs->pool, xs);
 
diff --git a/net/xdp/xsk_buff_pool.c b/net/xdp/xsk_buff_pool.c
index b3f7b310811ed..49cb9f9a09bee 100644
--- a/net/xdp/xsk_buff_pool.c
+++ b/net/xdp/xsk_buff_pool.c
@@ -170,6 +170,9 @@ int xp_assign_dev(struct xsk_buff_pool *pool,
 	if (err)
 		return err;
 
+	if (flags & XDP_USE_SG)
+		pool->umem->flags |= XDP_UMEM_SG_FLAG;
+
 	if (flags & XDP_USE_NEED_WAKEUP)
 		pool->uses_need_wakeup = true;
 	/* Tx needs to be explicitly woken up the first time.  Also




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux