summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2025-08-19 09:34:27 +0200
committerSteve French <stfrench@microsoft.com>2025-09-28 18:29:48 -0500
commited3350f09d2c0234c59910ef1655cb9cbe17b0ca (patch)
tree154771fa9d75df0759461184a2129beb1f1a81ee
parent41e5086905a3c37c3e5b716192b2dcd719ad8ef5 (diff)
downloadlinux-ed3350f09d2c0234c59910ef1655cb9cbe17b0ca.tar.gz
linux-ed3350f09d2c0234c59910ef1655cb9cbe17b0ca.zip
smb: smbdirect: introduce smbdirect_socket.mr_io.*
This will be used by the client and will allow us to move to common code... 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>
-rw-r--r--fs/smb/common/smbdirect/smbdirect_socket.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/fs/smb/common/smbdirect/smbdirect_socket.h b/fs/smb/common/smbdirect/smbdirect_socket.h
index f220891ab290..5d403b1becea 100644
--- a/fs/smb/common/smbdirect/smbdirect_socket.h
+++ b/fs/smb/common/smbdirect/smbdirect_socket.h
@@ -207,6 +207,44 @@ struct smbdirect_socket {
} recv_io;
/*
+ * The state for Memory registrations on the client
+ */
+ struct {
+ enum ib_mr_type type;
+
+ /*
+ * The list of free smbdirect_mr_io
+ * structures
+ */
+ struct {
+ struct list_head list;
+ spinlock_t lock;
+ } all;
+
+ /*
+ * The number of available MRs ready for memory registration
+ */
+ struct {
+ atomic_t count;
+ wait_queue_head_t wait_queue;
+ } ready;
+
+ /*
+ * The number of used MRs
+ */
+ struct {
+ atomic_t count;
+ } used;
+
+ struct work_struct recovery_work;
+
+ /* Used by transport to wait until all MRs are returned */
+ struct {
+ wait_queue_head_t wait_queue;
+ } cleanup;
+ } mr_io;
+
+ /*
* The state for RDMA read/write requests on the server
*/
struct {
@@ -269,6 +307,13 @@ static __always_inline void smbdirect_socket_init(struct smbdirect_socket *sc)
atomic_set(&sc->rw_io.credits.count, 0);
init_waitqueue_head(&sc->rw_io.credits.wait_queue);
+
+ spin_lock_init(&sc->mr_io.all.lock);
+ INIT_LIST_HEAD(&sc->mr_io.all.list);
+ atomic_set(&sc->mr_io.ready.count, 0);
+ init_waitqueue_head(&sc->mr_io.ready.wait_queue);
+ atomic_set(&sc->mr_io.used.count, 0);
+ init_waitqueue_head(&sc->mr_io.cleanup.wait_queue);
}
struct smbdirect_send_io {