]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
smb: smbdirect: introduce smbdirect_socket.rw_io.credits
authorStefan Metzmacher <metze@samba.org>
Thu, 14 Aug 2025 09:41:59 +0000 (11:41 +0200)
committerSteve French <stfrench@microsoft.com>
Sun, 28 Sep 2025 23:29:47 +0000 (18:29 -0500)
This will be used by the server to manage the state
for RDMA read/write requests.

Cc: Steve French <smfrench@gmail.com>
Cc: Tom Talpey <tom@talpey.com>
Cc: Long Li <longli@microsoft.com>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Cc: linux-cifs@vger.kernel.org
Cc: samba-technical@lists.samba.org
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/common/smbdirect/smbdirect_socket.h

index e1454ccf849b98889620b32a178b1a56bd606bb9..148e8dbf1254c6401f57f3e199445015cd82fbfd 100644 (file)
@@ -159,6 +159,27 @@ struct smbdirect_socket {
                        bool full_packet_received;
                } reassembly;
        } recv_io;
+
+       /*
+        * The state for RDMA read/write requests on the server
+        */
+       struct {
+               /*
+                * The credit state for the send side
+                */
+               struct {
+                       /*
+                        * The maximum number of rw credits
+                        */
+                       size_t max;
+                       /*
+                        * The number of pages per credit
+                        */
+                       size_t num_pages;
+                       atomic_t count;
+                       wait_queue_head_t wait_queue;
+               } credits;
+       } rw_io;
 };
 
 static __always_inline void smbdirect_socket_init(struct smbdirect_socket *sc)
@@ -184,6 +205,9 @@ static __always_inline void smbdirect_socket_init(struct smbdirect_socket *sc)
        INIT_LIST_HEAD(&sc->recv_io.reassembly.list);
        spin_lock_init(&sc->recv_io.reassembly.lock);
        init_waitqueue_head(&sc->recv_io.reassembly.wait_queue);
+
+       atomic_set(&sc->rw_io.credits.count, 0);
+       init_waitqueue_head(&sc->rw_io.credits.wait_queue);
 }
 
 struct smbdirect_send_io {