]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
smb: client: make use of smbdirect_socket_prepare_create()
authorStefan Metzmacher <metze@samba.org>
Tue, 26 Aug 2025 13:32:48 +0000 (15:32 +0200)
committerSteve French <stfrench@microsoft.com>
Thu, 16 Apr 2026 02:58:20 +0000 (21:58 -0500)
This prepares the use of functions from smbdirect_connection.c.

Cc: Steve French <smfrench@gmail.com>
Cc: Tom Talpey <tom@talpey.com>
Cc: Long Li <longli@microsoft.com>
Cc: 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>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/smbdirect.c

index f5ba33460723242a8228779925a0705bca1bd4f8..2d6d8a1e2d994d149790f4066d3d788e6c77851b 100644 (file)
@@ -2111,6 +2111,7 @@ static struct smbd_connection *_smbd_get_connection(
        int rc;
        struct smbd_connection *info;
        struct smbdirect_socket *sc;
+       struct smbdirect_socket_parameters init_params = {};
        struct smbdirect_socket_parameters *sp;
        struct rdma_conn_param conn_param;
        struct ib_qp_cap qp_cap;
@@ -2121,20 +2122,10 @@ static struct smbd_connection *_smbd_get_connection(
        char wq_name[80];
        struct workqueue_struct *workqueue;
 
-       info = kzalloc_obj(struct smbd_connection);
-       if (!info)
-               return NULL;
-       sc = &info->socket;
-       scnprintf(wq_name, ARRAY_SIZE(wq_name), "smbd_%p", sc);
-       workqueue = create_workqueue(wq_name);
-       if (!workqueue)
-               goto create_wq_failed;
-       smbdirect_socket_init(sc);
-       sc->workqueue = workqueue;
-       sp = &sc->parameters;
-
-       INIT_WORK(&sc->disconnect_work, smbd_disconnect_rdma_work);
-
+       /*
+        * Create the initial parameters
+        */
+       sp = &init_params;
        sp->resolve_addr_timeout_msec = RDMA_RESOLVE_TIMEOUT;
        sp->resolve_route_timeout_msec = RDMA_RESOLVE_TIMEOUT;
        sp->rdma_connect_timeout_msec = RDMA_RESOLVE_TIMEOUT;
@@ -2150,6 +2141,22 @@ static struct smbd_connection *_smbd_get_connection(
        sp->keepalive_interval_msec = smbd_keep_alive_interval * 1000;
        sp->keepalive_timeout_msec = KEEPALIVE_RECV_TIMEOUT * 1000;
 
+       info = kzalloc_obj(*info);
+       if (!info)
+               return NULL;
+       sc = &info->socket;
+       scnprintf(wq_name, ARRAY_SIZE(wq_name), "smbd_%p", sc);
+       workqueue = create_workqueue(wq_name);
+       if (!workqueue)
+               goto create_wq_failed;
+       smbdirect_socket_prepare_create(sc, sp, workqueue);
+       /*
+        * from here we operate on the copy.
+        */
+       sp = &sc->parameters;
+
+       INIT_WORK(&sc->disconnect_work, smbd_disconnect_rdma_work);
+
        rc = smbd_ia_open(sc, dstaddr, port);
        if (rc) {
                log_rdma_event(INFO, "smbd_ia_open rc=%d\n", rc);