]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
smb: smbdirect: introduce smbdirect_init_send_batch_storage()
authorStefan Metzmacher <metze@samba.org>
Tue, 3 Feb 2026 18:26:43 +0000 (19:26 +0100)
committerSteve French <stfrench@microsoft.com>
Thu, 16 Apr 2026 02:58:20 +0000 (21:58 -0500)
This makes it possible to use batching via public functions
without exposing the internals of struct smbdirect_send_batch.

Once the client no longer needs to use
smbdirect_connection_send_single_iter() we can remove this again.

Cc: Steve French <smfrench@gmail.com>
Cc: Tom Talpey <tom@talpey.com>
Cc: Long Li <longli@microsoft.com>
Cc: 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>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/common/smbdirect/smbdirect_connection.c
fs/smb/common/smbdirect/smbdirect_public.h

index 38fb0f34dc86254fe32d7aa4238122e3561b775f..b7adbd04eb695b1b1ad2d2dff5fc85e95643f51c 100644 (file)
@@ -910,9 +910,10 @@ static void smbdirect_connection_send_batch_init(struct smbdirect_send_batch *ba
        batch->credit = 0;
 }
 
-static int smbdirect_connection_send_batch_flush(struct smbdirect_socket *sc,
-                                                struct smbdirect_send_batch *batch,
-                                                bool is_last)
+__SMBDIRECT_PUBLIC__
+int smbdirect_connection_send_batch_flush(struct smbdirect_socket *sc,
+                                         struct smbdirect_send_batch *batch,
+                                         bool is_last)
 {
        struct smbdirect_send_io *first, *last;
        int ret = 0;
@@ -969,6 +970,26 @@ release_credit:
 
        return ret;
 }
+__SMBDIRECT_EXPORT_SYMBOL__(smbdirect_connection_send_batch_flush);
+
+__SMBDIRECT_PUBLIC__
+struct smbdirect_send_batch *
+smbdirect_init_send_batch_storage(struct smbdirect_send_batch_storage *storage,
+                                 bool need_invalidate_rkey,
+                                 unsigned int remote_key)
+{
+       struct smbdirect_send_batch *batch = (struct smbdirect_send_batch *)storage;
+
+       memset(storage, 0, sizeof(*storage));
+       BUILD_BUG_ON(sizeof(*batch) > sizeof(*storage));
+
+       smbdirect_connection_send_batch_init(batch,
+                                            need_invalidate_rkey,
+                                            remote_key);
+
+       return batch;
+}
+__SMBDIRECT_EXPORT_SYMBOL__(smbdirect_init_send_batch_storage);
 
 static int smbdirect_connection_wait_for_send_bcredit(struct smbdirect_socket *sc,
                                                      struct smbdirect_send_batch *batch)
index a5b15fce840cd4b277e8070e56d78c27477a0406..3d20d9a87e7ba10220b2c7f64730a4316705592c 100644 (file)
@@ -91,6 +91,29 @@ void smbdirect_socket_shutdown(struct smbdirect_socket *sc);
 __SMBDIRECT_PUBLIC__
 void smbdirect_socket_release(struct smbdirect_socket *sc);
 
+__SMBDIRECT_PUBLIC__
+int smbdirect_connection_send_batch_flush(struct smbdirect_socket *sc,
+                                         struct smbdirect_send_batch *batch,
+                                         bool is_last);
+
+/*
+ * This is only temporary and only needed
+ * as long as the client still requires
+ * to use smbdirect_connection_send_single_iter()
+ */
+struct smbdirect_send_batch_storage {
+       union {
+               struct list_head __msg_list;
+               __aligned_u64 __space[5];
+       };
+};
+
+__SMBDIRECT_PUBLIC__
+struct smbdirect_send_batch *
+smbdirect_init_send_batch_storage(struct smbdirect_send_batch_storage *storage,
+                                 bool need_invalidate_rkey,
+                                 unsigned int remote_key);
+
 __SMBDIRECT_PUBLIC__
 int smbdirect_connection_send_single_iter(struct smbdirect_socket *sc,
                                          struct smbdirect_send_batch *batch,