]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
smb: client: move rdma_readwrite_threshold from smbd_connection to TCP_Server_Info
authorStefan Metzmacher <metze@samba.org>
Thu, 21 Aug 2025 12:50:56 +0000 (14:50 +0200)
committerSteve French <stfrench@microsoft.com>
Sun, 28 Sep 2025 23:29:49 +0000 (18:29 -0500)
This belongs to the SMB layer not to the transport layer, it
just uses the negotiated transport parameters to adjust the
value if needed.

Cc: Steve French <smfrench@gmail.com>
Cc: Tom Talpey <tom@talpey.com>
Cc: Long Li <longli@microsoft.com>
Cc: linux-cifs@vger.kernel.org
Cc: samba-technical@lists.samba.org
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/cifs_debug.c
fs/smb/client/cifsglob.h
fs/smb/client/smb2pdu.c
fs/smb/client/smbdirect.c
fs/smb/client/smbdirect.h

index 55bf867be0e2bb2fc0e80d78bb6621406987e118..9c9f15871c239573152a8c288049995de52f0b69 100644 (file)
@@ -476,7 +476,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
                        "max_readwrite_size: %u rdma_readwrite_threshold: %u",
                        sp->keepalive_interval_msec * 1000,
                        sp->max_read_write_size,
-                       server->smbd_conn->rdma_readwrite_threshold);
+                       server->rdma_readwrite_threshold);
                seq_printf(m, "\nDebug count_get_receive_buffer: %llu "
                        "count_put_receive_buffer: %llu count_send_empty: %llu",
                        sc->statistics.get_receive_buffer,
index 0fae95cf81c434a9b08226fe573c1ddd0c9158bc..80664f937fc7371e2a055af6a091d432883e5f23 100644 (file)
@@ -814,6 +814,13 @@ struct TCP_Server_Info {
        unsigned int    max_read;
        unsigned int    max_write;
        unsigned int    min_offload;
+       /*
+        * If payload is less than or equal to the threshold,
+        * use RDMA send/recv to send upper layer I/O.
+        * If payload is more than the threshold,
+        * use RDMA read/write through memory registration for I/O.
+        */
+       unsigned int    rdma_readwrite_threshold;
        unsigned int    retrans;
        struct {
                bool requested; /* "compress" mount option set*/
index c3b9d3f6210ff9c74972abb0662d8e870a1caebc..1c63d2c9cc9c82910ad41f91f0404574708db64e 100644 (file)
@@ -4411,7 +4411,7 @@ static inline bool smb3_use_rdma_offload(struct cifs_io_parms *io_parms)
                return false;
 
        /* offload also has its overhead, so only do it if desired */
-       if (io_parms->length < server->smbd_conn->rdma_readwrite_threshold)
+       if (io_parms->length < server->rdma_readwrite_threshold)
                return false;
 
        return true;
index fe4127b53013a14fb277350416e8d269d10658dc..09bf47c854a8ad83389b64e20347ccf9ec626809 100644 (file)
@@ -518,10 +518,6 @@ static bool process_negotiation_response(
        }
        sp->max_fragmented_send_size =
                le32_to_cpu(packet->max_fragmented_size);
-       info->rdma_readwrite_threshold =
-               rdma_readwrite_threshold > sp->max_fragmented_send_size ?
-               sp->max_fragmented_send_size :
-               rdma_readwrite_threshold;
 
 
        sp->max_read_write_size = min_t(u32,
@@ -1962,6 +1958,7 @@ struct smbd_connection *smbd_get_connection(
        struct TCP_Server_Info *server, struct sockaddr *dstaddr)
 {
        struct smbd_connection *ret;
+       const struct smbdirect_socket_parameters *sp;
        int port = SMBD_PORT;
 
 try_again:
@@ -1972,6 +1969,16 @@ try_again:
                port = SMB_PORT;
                goto try_again;
        }
+       if (!ret)
+               return NULL;
+
+       sp = &ret->socket.parameters;
+
+       server->rdma_readwrite_threshold =
+               rdma_readwrite_threshold > sp->max_fragmented_send_size ?
+               sp->max_fragmented_send_size :
+               rdma_readwrite_threshold;
+
        return ret;
 }
 
index 8ebbbc0b0499aaf36923815dd57861729b1f5e4c..4eec2ac4ba80f653c47e7f7318218160c7705b37 100644 (file)
@@ -43,13 +43,6 @@ struct smbd_connection {
        /* Memory registrations */
        /* Maximum number of pages in a single RDMA write/read on this connection */
        int max_frmr_depth;
-       /*
-        * If payload is less than or equal to the threshold,
-        * use RDMA send/recv to send upper layer I/O.
-        * If payload is more than the threshold,
-        * use RDMA read/write through memory registration for I/O.
-        */
-       int rdma_readwrite_threshold;
        enum ib_mr_type mr_type;
        struct list_head mr_list;
        spinlock_t mr_list_lock;