]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
smb: smbdirect: introduce smbdirect_mr_io_fill_buffer_descriptor()
authorStefan Metzmacher <metze@samba.org>
Tue, 21 Oct 2025 15:52:05 +0000 (17:52 +0200)
committerSteve French <stfrench@microsoft.com>
Thu, 16 Apr 2026 02:58:20 +0000 (21:58 -0500)
This will be used by the client instead of dereferencing
struct smbdirect_mr_io internals.

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_mr.c

index 249719c916a8576262a1cabb658b822321b9a8ff..d5bf8531e2373eef674a9e57f638deaa87377390 100644 (file)
@@ -452,6 +452,24 @@ dma_map_error:
                mutex_unlock(&mr->mutex);
        return NULL;
 }
+
+__maybe_unused /* this is temporary while this file is included in others */
+static void smbdirect_mr_io_fill_buffer_descriptor(struct smbdirect_mr_io *mr,
+                                                  struct smbdirect_buffer_descriptor_v1 *v1)
+{
+       mutex_lock(&mr->mutex);
+       if (mr->state == SMBDIRECT_MR_REGISTERED) {
+               v1->offset = cpu_to_le64(mr->mr->iova);
+               v1->token = cpu_to_le32(mr->mr->rkey);
+               v1->length = cpu_to_le32(mr->mr->length);
+       } else {
+               v1->offset = cpu_to_le64(U64_MAX);
+               v1->token = cpu_to_le32(U32_MAX);
+               v1->length = cpu_to_le32(U32_MAX);
+       }
+       mutex_unlock(&mr->mutex);
+}
+
 /*
  * Deregister a MR after I/O is done
  * This function may wait if remote invalidation is not used