diff --git a/fs/smb/common/smbdirect/smbdirect_connection.c b/fs/smb/common/smbdirect/smbdirect_connection.c index 38fb0f34dc86..b7adbd04eb69 100644 --- a/fs/smb/common/smbdirect/smbdirect_connection.c +++ b/fs/smb/common/smbdirect/smbdirect_connection.c @@ -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) diff --git a/fs/smb/common/smbdirect/smbdirect_public.h b/fs/smb/common/smbdirect/smbdirect_public.h index a5b15fce840c..3d20d9a87e7b 100644 --- a/fs/smb/common/smbdirect/smbdirect_public.h +++ b/fs/smb/common/smbdirect/smbdirect_public.h @@ -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,