Skip to content

Commit a940171

Browse files
committed
Merge tag 'v6.18-rc-part1-smb3-common' of git://git.samba.org/ksmbd
Pull smb restructuring updates from Steve French: "Large set of small restructuring smbdirect related patches for cifs.ko and ksmbd.ko. This is the next step in order to use common structures for smbdirect handling across both modules. And also includes improved handling of broken connections, as well as fixed negotiation as rdma resources. Moving to common functions is planned for 6.19, as well as also providing smbdirect via sockets to userspace (e.g. for samba to also be able to use smbdirect for userspace server and userspace client tools). This was heavily reviewed and tested at the recent SMB3.1.1 test event at SDC" * tag 'v6.18-rc-part1-smb3-common' of git://git.samba.org/ksmbd: (159 commits) smb: server: let smb_direct_flush_send_list() invalidate a remote key first smb: server: make use of ib_alloc_cq_any() instead of ib_alloc_cq() smb: server: make consitent use of spin_lock_irq{save,restore}() in transport_rdma.c smb: server: let {free_transport,smb_direct_disconnect_rdma_{work,connection}}() wake up all wait queues smb: server: let smb_direct_disconnect_rdma_connection() disable all work but disconnect_work smb: server: fill in smbdirect_socket.first_error on error smb: server: let smb_direct_disconnect_rdma_connection() set SMBDIRECT_SOCKET_ERROR... smb: server: pass struct smbdirect_socket to smb_direct_send_negotiate_response() smb: server: pass struct smbdirect_socket to {enqueue,get_first}_reassembly() smb: server: pass struct smbdirect_socket to smb_direct_post_send_data() smb: server: pass struct smbdirect_socket to post_sendmsg() smb: server: pass struct smbdirect_socket to smb_direct_create_header() smb: server: pass struct smbdirect_socket to manage_keep_alive_before_sending() smb: server: pass struct smbdirect_socket to manage_credits_prior_sending() smb: server: pass struct smbdirect_socket to calc_rw_credits() smb: server: pass struct smbdirect_socket to wait_for_rw_credits() smb: server: pass struct smbdirect_socket to wait_for_send_credits() smb: server: pass struct smbdirect_socket to wait_for_credits() smb: server: pass struct smbdirect_socket to smb_direct_flush_send_list() smb: server: pass struct smbdirect_socket to smb_direct_post_send() ...
2 parents e445fba + 1b53426 commit a940171

16 files changed

Lines changed: 2061 additions & 1386 deletions

fs/smb/client/cifs_debug.c

Lines changed: 40 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#endif
2525
#ifdef CONFIG_CIFS_SMB_DIRECT
2626
#include "smbdirect.h"
27+
#include "../common/smbdirect/smbdirect_pdu.h"
2728
#endif
2829
#include "cifs_swn.h"
2930
#include "cached_dir.h"
@@ -456,57 +457,55 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
456457
sc = &server->smbd_conn->socket;
457458
sp = &sc->parameters;
458459

459-
seq_printf(m, "\nSMBDirect (in hex) protocol version: %x "
460-
"transport status: %x",
461-
server->smbd_conn->protocol,
462-
server->smbd_conn->socket.status);
463-
seq_printf(m, "\nConn receive_credit_max: %x "
464-
"send_credit_target: %x max_send_size: %x",
460+
seq_printf(m, "\nSMBDirect protocol version: 0x%x "
461+
"transport status: %s (%u)",
462+
SMBDIRECT_V1,
463+
smbdirect_socket_status_string(sc->status),
464+
sc->status);
465+
seq_printf(m, "\nConn receive_credit_max: %u "
466+
"send_credit_target: %u max_send_size: %u",
465467
sp->recv_credit_max,
466468
sp->send_credit_target,
467469
sp->max_send_size);
468-
seq_printf(m, "\nConn max_fragmented_recv_size: %x "
469-
"max_fragmented_send_size: %x max_receive_size:%x",
470+
seq_printf(m, "\nConn max_fragmented_recv_size: %u "
471+
"max_fragmented_send_size: %u max_receive_size:%u",
470472
sp->max_fragmented_recv_size,
471473
sp->max_fragmented_send_size,
472474
sp->max_recv_size);
473-
seq_printf(m, "\nConn keep_alive_interval: %x "
474-
"max_readwrite_size: %x rdma_readwrite_threshold: %x",
475+
seq_printf(m, "\nConn keep_alive_interval: %u "
476+
"max_readwrite_size: %u rdma_readwrite_threshold: %u",
475477
sp->keepalive_interval_msec * 1000,
476478
sp->max_read_write_size,
477-
server->smbd_conn->rdma_readwrite_threshold);
478-
seq_printf(m, "\nDebug count_get_receive_buffer: %x "
479-
"count_put_receive_buffer: %x count_send_empty: %x",
480-
server->smbd_conn->count_get_receive_buffer,
481-
server->smbd_conn->count_put_receive_buffer,
482-
server->smbd_conn->count_send_empty);
483-
seq_printf(m, "\nRead Queue count_reassembly_queue: %x "
484-
"count_enqueue_reassembly_queue: %x "
485-
"count_dequeue_reassembly_queue: %x "
486-
"reassembly_data_length: %x "
487-
"reassembly_queue_length: %x",
488-
server->smbd_conn->count_reassembly_queue,
489-
server->smbd_conn->count_enqueue_reassembly_queue,
490-
server->smbd_conn->count_dequeue_reassembly_queue,
479+
server->rdma_readwrite_threshold);
480+
seq_printf(m, "\nDebug count_get_receive_buffer: %llu "
481+
"count_put_receive_buffer: %llu count_send_empty: %llu",
482+
sc->statistics.get_receive_buffer,
483+
sc->statistics.put_receive_buffer,
484+
sc->statistics.send_empty);
485+
seq_printf(m, "\nRead Queue "
486+
"count_enqueue_reassembly_queue: %llu "
487+
"count_dequeue_reassembly_queue: %llu "
488+
"reassembly_data_length: %u "
489+
"reassembly_queue_length: %u",
490+
sc->statistics.enqueue_reassembly_queue,
491+
sc->statistics.dequeue_reassembly_queue,
491492
sc->recv_io.reassembly.data_length,
492493
sc->recv_io.reassembly.queue_length);
493-
seq_printf(m, "\nCurrent Credits send_credits: %x "
494-
"receive_credits: %x receive_credit_target: %x",
495-
atomic_read(&server->smbd_conn->send_credits),
496-
atomic_read(&server->smbd_conn->receive_credits),
497-
server->smbd_conn->receive_credit_target);
498-
seq_printf(m, "\nPending send_pending: %x ",
499-
atomic_read(&server->smbd_conn->send_pending));
500-
seq_printf(m, "\nReceive buffers count_receive_queue: %x ",
501-
server->smbd_conn->count_receive_queue);
502-
seq_printf(m, "\nMR responder_resources: %x "
503-
"max_frmr_depth: %x mr_type: %x",
504-
server->smbd_conn->responder_resources,
505-
server->smbd_conn->max_frmr_depth,
506-
server->smbd_conn->mr_type);
507-
seq_printf(m, "\nMR mr_ready_count: %x mr_used_count: %x",
508-
atomic_read(&server->smbd_conn->mr_ready_count),
509-
atomic_read(&server->smbd_conn->mr_used_count));
494+
seq_printf(m, "\nCurrent Credits send_credits: %u "
495+
"receive_credits: %u receive_credit_target: %u",
496+
atomic_read(&sc->send_io.credits.count),
497+
atomic_read(&sc->recv_io.credits.count),
498+
sc->recv_io.credits.target);
499+
seq_printf(m, "\nPending send_pending: %u ",
500+
atomic_read(&sc->send_io.pending.count));
501+
seq_printf(m, "\nMR responder_resources: %u "
502+
"max_frmr_depth: %u mr_type: 0x%x",
503+
sp->responder_resources,
504+
sp->max_frmr_depth,
505+
sc->mr_io.type);
506+
seq_printf(m, "\nMR mr_ready_count: %u mr_used_count: %u",
507+
atomic_read(&sc->mr_io.ready.count),
508+
atomic_read(&sc->mr_io.used.count));
510509
skip_rdma:
511510
#endif
512511
seq_printf(m, "\nNumber of credits: %d,%d,%d Dialect 0x%x",

fs/smb/client/cifsglob.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,13 @@ struct TCP_Server_Info {
814814
unsigned int max_read;
815815
unsigned int max_write;
816816
unsigned int min_offload;
817+
/*
818+
* If payload is less than or equal to the threshold,
819+
* use RDMA send/recv to send upper layer I/O.
820+
* If payload is more than the threshold,
821+
* use RDMA read/write through memory registration for I/O.
822+
*/
823+
unsigned int rdma_readwrite_threshold;
817824
unsigned int retrans;
818825
struct {
819826
bool requested; /* "compress" mount option set*/
@@ -1540,7 +1547,7 @@ struct cifs_io_subrequest {
15401547
struct kvec iov[2];
15411548
struct TCP_Server_Info *server;
15421549
#ifdef CONFIG_CIFS_SMB_DIRECT
1543-
struct smbd_mr *mr;
1550+
struct smbdirect_mr_io *mr;
15441551
#endif
15451552
struct cifs_credits credits;
15461553
};

fs/smb/client/file.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,12 @@ static void cifs_prepare_write(struct netfs_io_subrequest *subreq)
9797
cifs_trace_rw_credits_write_prepare);
9898

9999
#ifdef CONFIG_CIFS_SMB_DIRECT
100-
if (server->smbd_conn)
101-
stream->sreq_max_segs = server->smbd_conn->max_frmr_depth;
100+
if (server->smbd_conn) {
101+
const struct smbdirect_socket_parameters *sp =
102+
smbd_get_parameters(server->smbd_conn);
103+
104+
stream->sreq_max_segs = sp->max_frmr_depth;
105+
}
102106
#endif
103107
}
104108

@@ -187,8 +191,12 @@ static int cifs_prepare_read(struct netfs_io_subrequest *subreq)
187191
cifs_trace_rw_credits_read_submit);
188192

189193
#ifdef CONFIG_CIFS_SMB_DIRECT
190-
if (server->smbd_conn)
191-
rreq->io_streams[0].sreq_max_segs = server->smbd_conn->max_frmr_depth;
194+
if (server->smbd_conn) {
195+
const struct smbdirect_socket_parameters *sp =
196+
smbd_get_parameters(server->smbd_conn);
197+
198+
rreq->io_streams[0].sreq_max_segs = sp->max_frmr_depth;
199+
}
192200
#endif
193201
return 0;
194202
}

fs/smb/client/smb2ops.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -504,8 +504,8 @@ smb3_negotiate_wsize(struct cifs_tcon *tcon, struct smb3_fs_context *ctx)
504504
wsize = min_t(unsigned int, wsize, server->max_write);
505505
#ifdef CONFIG_CIFS_SMB_DIRECT
506506
if (server->rdma) {
507-
struct smbdirect_socket_parameters *sp =
508-
&server->smbd_conn->socket.parameters;
507+
const struct smbdirect_socket_parameters *sp =
508+
smbd_get_parameters(server->smbd_conn);
509509

510510
if (server->sign)
511511
/*
@@ -555,8 +555,8 @@ smb3_negotiate_rsize(struct cifs_tcon *tcon, struct smb3_fs_context *ctx)
555555
rsize = min_t(unsigned int, rsize, server->max_read);
556556
#ifdef CONFIG_CIFS_SMB_DIRECT
557557
if (server->rdma) {
558-
struct smbdirect_socket_parameters *sp =
559-
&server->smbd_conn->socket.parameters;
558+
const struct smbdirect_socket_parameters *sp =
559+
smbd_get_parameters(server->smbd_conn);
560560

561561
if (server->sign)
562562
/*

fs/smb/client/smb2pdu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4411,7 +4411,7 @@ static inline bool smb3_use_rdma_offload(struct cifs_io_parms *io_parms)
44114411
return false;
44124412

44134413
/* offload also has its overhead, so only do it if desired */
4414-
if (io_parms->length < server->smbd_conn->rdma_readwrite_threshold)
4414+
if (io_parms->length < server->rdma_readwrite_threshold)
44154415
return false;
44164416

44174417
return true;

0 commit comments

Comments
 (0)