Skip to content

Commit dd53b45

Browse files
metze-sambasmfrench
authored andcommitted
smb: client: make use of smbdirect_socket_parameters.{initiator_depth,responder_resources}
This will make it easier to specify these from the outside of the core code first and then negotiate the value with the peer. Cc: Steve French <smfrench@gmail.com> Cc: Tom Talpey <tom@talpey.com> Cc: Long Li <longli@microsoft.com> Acked-by: 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> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 1f2ff73 commit dd53b45

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

fs/smb/client/cifs_debug.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
500500
atomic_read(&sc->send_io.pending.count));
501501
seq_printf(m, "\nMR responder_resources: %u "
502502
"max_frmr_depth: %u mr_type: 0x%x",
503-
server->smbd_conn->responder_resources,
503+
sp->responder_resources,
504504
server->smbd_conn->max_frmr_depth,
505505
server->smbd_conn->mr_type);
506506
seq_printf(m, "\nMR mr_ready_count: %u mr_used_count: %u",

fs/smb/client/smbdirect.c

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ static int smbd_conn_upcall(
222222
{
223223
struct smbd_connection *info = id->context;
224224
struct smbdirect_socket *sc = &info->socket;
225+
struct smbdirect_socket_parameters *sp = &sc->parameters;
225226
const char *event_name = rdma_event_msg(event->event);
226227
u8 peer_initiator_depth;
227228
u8 peer_responder_resources;
@@ -329,12 +330,12 @@ static int smbd_conn_upcall(
329330
* non 0 values.
330331
*/
331332
if (peer_initiator_depth != 0)
332-
info->initiator_depth =
333-
min_t(u8, info->initiator_depth,
333+
sp->initiator_depth =
334+
min_t(u8, sp->initiator_depth,
334335
peer_initiator_depth);
335336
if (peer_responder_resources != 0)
336-
info->responder_resources =
337-
min_t(u8, info->responder_resources,
337+
sp->responder_resources =
338+
min_t(u8, sp->responder_resources,
338339
peer_responder_resources);
339340

340341
WARN_ON_ONCE(sc->status != SMBDIRECT_SOCKET_RDMA_CONNECT_RUNNING);
@@ -1718,15 +1719,14 @@ static struct smbd_connection *_smbd_get_connection(
17181719
smbdirect_socket_init(sc);
17191720
sp = &sc->parameters;
17201721

1721-
info->initiator_depth = 1;
1722-
info->responder_resources = SMBD_CM_RESPONDER_RESOURCES;
1723-
17241722
INIT_WORK(&sc->disconnect_work, smbd_disconnect_rdma_work);
17251723

17261724
sp->resolve_addr_timeout_msec = RDMA_RESOLVE_TIMEOUT;
17271725
sp->resolve_route_timeout_msec = RDMA_RESOLVE_TIMEOUT;
17281726
sp->rdma_connect_timeout_msec = RDMA_RESOLVE_TIMEOUT;
17291727
sp->negotiate_timeout_msec = SMBD_NEGOTIATE_TIMEOUT * 1000;
1728+
sp->initiator_depth = 1;
1729+
sp->responder_resources = SMBD_CM_RESPONDER_RESOURCES;
17301730
sp->recv_credit_max = smbd_receive_credit_max;
17311731
sp->send_credit_target = smbd_send_credit_target;
17321732
sp->max_send_size = smbd_max_send_size;
@@ -1807,15 +1807,15 @@ static struct smbd_connection *_smbd_get_connection(
18071807
}
18081808
sc->ib.qp = sc->rdma.cm_id->qp;
18091809

1810-
info->responder_resources =
1811-
min_t(u8, info->responder_resources,
1810+
sp->responder_resources =
1811+
min_t(u8, sp->responder_resources,
18121812
sc->ib.dev->attrs.max_qp_rd_atom);
18131813
log_rdma_mr(INFO, "responder_resources=%d\n",
1814-
info->responder_resources);
1814+
sp->responder_resources);
18151815

18161816
memset(&conn_param, 0, sizeof(conn_param));
1817-
conn_param.initiator_depth = info->initiator_depth;
1818-
conn_param.responder_resources = info->responder_resources;
1817+
conn_param.initiator_depth = sp->initiator_depth;
1818+
conn_param.responder_resources = sp->responder_resources;
18191819

18201820
/* Need to send IRD/ORD in private data for iWARP */
18211821
sc->ib.dev->ops.get_port_immutable(
@@ -2270,6 +2270,7 @@ static void destroy_mr_list(struct smbd_connection *info)
22702270
static int allocate_mr_list(struct smbd_connection *info)
22712271
{
22722272
struct smbdirect_socket *sc = &info->socket;
2273+
struct smbdirect_socket_parameters *sp = &sc->parameters;
22732274
int i;
22742275
struct smbd_mr *smbdirect_mr, *tmp;
22752276

@@ -2281,13 +2282,13 @@ static int allocate_mr_list(struct smbd_connection *info)
22812282
init_waitqueue_head(&info->wait_for_mr_cleanup);
22822283
INIT_WORK(&info->mr_recovery_work, smbd_mr_recovery_work);
22832284

2284-
if (info->responder_resources == 0) {
2285+
if (sp->responder_resources == 0) {
22852286
log_rdma_mr(ERR, "responder_resources negotiated as 0\n");
22862287
return -EINVAL;
22872288
}
22882289

22892290
/* Allocate more MRs (2x) than hardware responder_resources */
2290-
for (i = 0; i < info->responder_resources * 2; i++) {
2291+
for (i = 0; i < sp->responder_resources * 2; i++) {
22912292
smbdirect_mr = kzalloc(sizeof(*smbdirect_mr), GFP_KERNEL);
22922293
if (!smbdirect_mr)
22932294
goto cleanup_entries;

fs/smb/client/smbdirect.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ struct smbd_connection {
5252
/* Memory registrations */
5353
/* Maximum number of RDMA read/write outstanding on this connection */
5454
bool legacy_iwarp;
55-
u8 initiator_depth;
56-
u8 responder_resources;
5755
/* Maximum number of pages in a single RDMA write/read on this connection */
5856
int max_frmr_depth;
5957
/*

0 commit comments

Comments
 (0)