From: Stefan Metzmacher Date: Thu, 14 Aug 2025 09:41:59 +0000 (+0200) Subject: smb: smbdirect: introduce smbdirect_socket.rw_io.credits X-Git-Tag: v6.18-rc1~225^2~151 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=90255ed46774bda93a945a6dbf9228d9ecfcd79f;p=thirdparty%2Fkernel%2Fstable.git smb: smbdirect: introduce smbdirect_socket.rw_io.credits This will be used by the server to manage the state for RDMA read/write requests. Cc: Steve French Cc: Tom Talpey Cc: Long Li Acked-by: Namjae Jeon Cc: linux-cifs@vger.kernel.org Cc: samba-technical@lists.samba.org Signed-off-by: Stefan Metzmacher Signed-off-by: Steve French --- diff --git a/fs/smb/common/smbdirect/smbdirect_socket.h b/fs/smb/common/smbdirect/smbdirect_socket.h index e1454ccf849b9..148e8dbf1254c 100644 --- a/fs/smb/common/smbdirect/smbdirect_socket.h +++ b/fs/smb/common/smbdirect/smbdirect_socket.h @@ -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 {