smb: client: make use of common smbdirect.h
authorStefan Metzmacher <metze@samba.org>
Wed, 28 May 2025 16:01:34 +0000 (18:01 +0200)
committerSteve French <stfrench@microsoft.com>
Tue, 3 Jun 2025 23:42:47 +0000 (18:42 -0500)
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: Hyunchul Lee <hyc.lee@gmail.com>
Cc: Meetakshi Setiya <meetakshisetiyaoss@gmail.com>
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>
fs/smb/client/smb2pdu.c
fs/smb/client/smbdirect.h

index 0c320d06809ca4e147a00e94632ac14e8e62fa43..2bd814cd612bff5edbda97a5304e2f2cca29ce33 100644 (file)
@@ -36,6 +36,7 @@
 #include "smb2glob.h"
 #include "cifspdu.h"
 #include "cifs_spnego.h"
+#include "../common/smbdirect/smbdirect.h"
 #include "smbdirect.h"
 #include "trace.h"
 #ifdef CONFIG_CIFS_DFS_UPCALL
@@ -4449,10 +4450,10 @@ smb2_new_read_req(void **buf, unsigned int *total_len,
 #ifdef CONFIG_CIFS_SMB_DIRECT
        /*
         * If we want to do a RDMA write, fill in and append
-        * smbd_buffer_descriptor_v1 to the end of read request
+        * smbdirect_buffer_descriptor_v1 to the end of read request
         */
        if (rdata && smb3_use_rdma_offload(io_parms)) {
-               struct smbd_buffer_descriptor_v1 *v1;
+               struct smbdirect_buffer_descriptor_v1 *v1;
                bool need_invalidate = server->dialect == SMB30_PROT_ID;
 
                rdata->mr = smbd_register_mr(server->smbd_conn, &rdata->subreq.io_iter,
@@ -4466,8 +4467,8 @@ smb2_new_read_req(void **buf, unsigned int *total_len,
                req->ReadChannelInfoOffset =
                        cpu_to_le16(offsetof(struct smb2_read_req, Buffer));
                req->ReadChannelInfoLength =
-                       cpu_to_le16(sizeof(struct smbd_buffer_descriptor_v1));
-               v1 = (struct smbd_buffer_descriptor_v1 *) &req->Buffer[0];
+                       cpu_to_le16(sizeof(struct smbdirect_buffer_descriptor_v1));
+               v1 = (struct smbdirect_buffer_descriptor_v1 *) &req->Buffer[0];
                v1->offset = cpu_to_le64(rdata->mr->mr->iova);
                v1->token = cpu_to_le32(rdata->mr->mr->rkey);
                v1->length = cpu_to_le32(rdata->mr->mr->length);
@@ -4975,10 +4976,10 @@ smb2_async_writev(struct cifs_io_subrequest *wdata)
 #ifdef CONFIG_CIFS_SMB_DIRECT
        /*
         * If we want to do a server RDMA read, fill in and append
-        * smbd_buffer_descriptor_v1 to the end of write request
+        * smbdirect_buffer_descriptor_v1 to the end of write request
         */
        if (smb3_use_rdma_offload(io_parms)) {
-               struct smbd_buffer_descriptor_v1 *v1;
+               struct smbdirect_buffer_descriptor_v1 *v1;
                bool need_invalidate = server->dialect == SMB30_PROT_ID;
 
                wdata->mr = smbd_register_mr(server->smbd_conn, &wdata->subreq.io_iter,
@@ -4997,8 +4998,8 @@ smb2_async_writev(struct cifs_io_subrequest *wdata)
                req->WriteChannelInfoOffset =
                        cpu_to_le16(offsetof(struct smb2_write_req, Buffer));
                req->WriteChannelInfoLength =
-                       cpu_to_le16(sizeof(struct smbd_buffer_descriptor_v1));
-               v1 = (struct smbd_buffer_descriptor_v1 *) &req->Buffer[0];
+                       cpu_to_le16(sizeof(struct smbdirect_buffer_descriptor_v1));
+               v1 = (struct smbdirect_buffer_descriptor_v1 *) &req->Buffer[0];
                v1->offset = cpu_to_le64(wdata->mr->mr->iova);
                v1->token = cpu_to_le32(wdata->mr->mr->rkey);
                v1->length = cpu_to_le32(wdata->mr->mr->length);
index 4da0974ce73056fc13d8644d22b9ff16a3a979e2..8561e19a23a33830f8dc8b55cda973f7dd85096c 100644 (file)
@@ -177,13 +177,6 @@ enum smbd_message_type {
        SMBD_TRANSFER_DATA,
 };
 
-/* The packet fields for a registered RDMA buffer */
-struct smbd_buffer_descriptor_v1 {
-       __le64 offset;
-       __le32 token;
-       __le32 length;
-} __packed;
-
 /* Maximum number of SGEs used by smbdirect.c in any send work request */
 #define SMBDIRECT_MAX_SEND_SGE 6