smb: smbdirect: introduce smbdirect_init_send_batch_storage()

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>
This commit is contained in:
Stefan Metzmacher 2026-02-03 19:26:43 +01:00 committed by Steve French
parent 89df094290
commit 4c9e665cb1
2 changed files with 47 additions and 3 deletions

View 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 @@ static int smbdirect_connection_send_batch_flush(struct smbdirect_socket *sc,
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)

View 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,