]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
smb: client: make use of smbdirect_socket_parameters.{initiator_depth,responder_resou...
authorStefan Metzmacher <metze@samba.org>
Tue, 19 Aug 2025 21:18:21 +0000 (23:18 +0200)
committerSteve French <stfrench@microsoft.com>
Sun, 28 Sep 2025 23:29:49 +0000 (18:29 -0500)
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>
fs/smb/client/cifs_debug.c
fs/smb/client/smbdirect.c
fs/smb/client/smbdirect.h

index 10bfcb57e1963514c80b38e12d58520a63714ae4..3086ab2622baac323b20c48932001039c092f1af 100644 (file)
@@ -500,7 +500,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
                        atomic_read(&sc->send_io.pending.count));
                seq_printf(m, "\nMR responder_resources: %u "
                        "max_frmr_depth: %u mr_type: 0x%x",
-                       server->smbd_conn->responder_resources,
+                       sp->responder_resources,
                        server->smbd_conn->max_frmr_depth,
                        server->smbd_conn->mr_type);
                seq_printf(m, "\nMR mr_ready_count: %u mr_used_count: %u",
index b7b54a36a46e576f913545b15b08ebaef5b09991..a55163e2876b7a9d1c5b8bdff6608f6e6134fbe7 100644 (file)
@@ -222,6 +222,7 @@ static int smbd_conn_upcall(
 {
        struct smbd_connection *info = id->context;
        struct smbdirect_socket *sc = &info->socket;
+       struct smbdirect_socket_parameters *sp = &sc->parameters;
        const char *event_name = rdma_event_msg(event->event);
        u8 peer_initiator_depth;
        u8 peer_responder_resources;
@@ -329,12 +330,12 @@ static int smbd_conn_upcall(
                 * non 0 values.
                 */
                if (peer_initiator_depth != 0)
-                       info->initiator_depth =
-                                       min_t(u8, info->initiator_depth,
+                       sp->initiator_depth =
+                                       min_t(u8, sp->initiator_depth,
                                              peer_initiator_depth);
                if (peer_responder_resources != 0)
-                       info->responder_resources =
-                                       min_t(u8, info->responder_resources,
+                       sp->responder_resources =
+                                       min_t(u8, sp->responder_resources,
                                              peer_responder_resources);
 
                WARN_ON_ONCE(sc->status != SMBDIRECT_SOCKET_RDMA_CONNECT_RUNNING);
@@ -1718,15 +1719,14 @@ static struct smbd_connection *_smbd_get_connection(
        smbdirect_socket_init(sc);
        sp = &sc->parameters;
 
-       info->initiator_depth = 1;
-       info->responder_resources = SMBD_CM_RESPONDER_RESOURCES;
-
        INIT_WORK(&sc->disconnect_work, smbd_disconnect_rdma_work);
 
        sp->resolve_addr_timeout_msec = RDMA_RESOLVE_TIMEOUT;
        sp->resolve_route_timeout_msec = RDMA_RESOLVE_TIMEOUT;
        sp->rdma_connect_timeout_msec = RDMA_RESOLVE_TIMEOUT;
        sp->negotiate_timeout_msec = SMBD_NEGOTIATE_TIMEOUT * 1000;
+       sp->initiator_depth = 1;
+       sp->responder_resources = SMBD_CM_RESPONDER_RESOURCES;
        sp->recv_credit_max = smbd_receive_credit_max;
        sp->send_credit_target = smbd_send_credit_target;
        sp->max_send_size = smbd_max_send_size;
@@ -1807,15 +1807,15 @@ static struct smbd_connection *_smbd_get_connection(
        }
        sc->ib.qp = sc->rdma.cm_id->qp;
 
-       info->responder_resources =
-               min_t(u8, info->responder_resources,
+       sp->responder_resources =
+               min_t(u8, sp->responder_resources,
                      sc->ib.dev->attrs.max_qp_rd_atom);
        log_rdma_mr(INFO, "responder_resources=%d\n",
-               info->responder_resources);
+               sp->responder_resources);
 
        memset(&conn_param, 0, sizeof(conn_param));
-       conn_param.initiator_depth = info->initiator_depth;
-       conn_param.responder_resources = info->responder_resources;
+       conn_param.initiator_depth = sp->initiator_depth;
+       conn_param.responder_resources = sp->responder_resources;
 
        /* Need to send IRD/ORD in private data for iWARP */
        sc->ib.dev->ops.get_port_immutable(
@@ -2270,6 +2270,7 @@ static void destroy_mr_list(struct smbd_connection *info)
 static int allocate_mr_list(struct smbd_connection *info)
 {
        struct smbdirect_socket *sc = &info->socket;
+       struct smbdirect_socket_parameters *sp = &sc->parameters;
        int i;
        struct smbd_mr *smbdirect_mr, *tmp;
 
@@ -2281,13 +2282,13 @@ static int allocate_mr_list(struct smbd_connection *info)
        init_waitqueue_head(&info->wait_for_mr_cleanup);
        INIT_WORK(&info->mr_recovery_work, smbd_mr_recovery_work);
 
-       if (info->responder_resources == 0) {
+       if (sp->responder_resources == 0) {
                log_rdma_mr(ERR, "responder_resources negotiated as 0\n");
                return -EINVAL;
        }
 
        /* Allocate more MRs (2x) than hardware responder_resources */
-       for (i = 0; i < info->responder_resources * 2; i++) {
+       for (i = 0; i < sp->responder_resources * 2; i++) {
                smbdirect_mr = kzalloc(sizeof(*smbdirect_mr), GFP_KERNEL);
                if (!smbdirect_mr)
                        goto cleanup_entries;
index 2666f39ef26bdb03c767090bd43285a0ad52b946..a5a70b3c63cb83339531a8392f9e55be68c5b0a7 100644 (file)
@@ -52,8 +52,6 @@ struct smbd_connection {
        /* Memory registrations */
        /* Maximum number of RDMA read/write outstanding on this connection */
        bool legacy_iwarp;
-       u8 initiator_depth;
-       u8 responder_resources;
        /* Maximum number of pages in a single RDMA write/read on this connection */
        int max_frmr_depth;
        /*