smb: client: move rdma_readwrite_threshold from smbd_connection to TCP_Server_Info

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>
This commit is contained in:
Stefan Metzmacher 2025-08-21 14:50:56 +02:00 committed by Steve French
parent ddfcb069c1
commit a8efb796db
5 changed files with 20 additions and 13 deletions

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

View 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*/

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

View 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 @@ struct smbd_connection *smbd_get_connection(
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;
}

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