smb: smbdirect: introduce smbdirect_socket.connect.{lock,work}
authorStefan Metzmacher <metze@samba.org>
Tue, 2 Dec 2025 21:15:24 +0000 (22:15 +0100)
committerSteve French <stfrench@microsoft.com>
Mon, 15 Dec 2025 00:35:55 +0000 (18:35 -0600)
This will first be used by the server in order to defer
the processing of the initial recv of the negotiation
request.

But in future it will also be used by the client in order
to implement an async connect.

Cc: Tom Talpey <tom@talpey.com>
Cc: Long Li <longli@microsoft.com>
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/common/smbdirect/smbdirect_socket.h

index 384b191..ee4c272 100644 (file)
@@ -132,6 +132,14 @@ struct smbdirect_socket {
 
        struct smbdirect_socket_parameters parameters;
 
+       /*
+        * The state for connect/negotiation
+        */
+       struct {
+               spinlock_t lock;
+               struct work_struct work;
+       } connect;
+
        /*
         * The state for keepalive and timeout handling
         */
@@ -353,6 +361,10 @@ static __always_inline void smbdirect_socket_init(struct smbdirect_socket *sc)
        INIT_WORK(&sc->disconnect_work, __smbdirect_socket_disabled_work);
        disable_work_sync(&sc->disconnect_work);
 
+       spin_lock_init(&sc->connect.lock);
+       INIT_WORK(&sc->connect.work, __smbdirect_socket_disabled_work);
+       disable_work_sync(&sc->connect.work);
+
        INIT_WORK(&sc->idle.immediate_work, __smbdirect_socket_disabled_work);
        disable_work_sync(&sc->idle.immediate_work);
        INIT_DELAYED_WORK(&sc->idle.timer_work, __smbdirect_socket_disabled_work);