]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
smb: smbdirect: introduce smbdirect_connection_request_keep_alive()
authorStefan Metzmacher <metze@samba.org>
Fri, 17 Oct 2025 13:49:50 +0000 (15:49 +0200)
committerSteve French <stfrench@microsoft.com>
Thu, 16 Apr 2026 02:58:19 +0000 (21:58 -0500)
This a copy of manage_keep_alive_before_sending() in client and server,
it will replace these in future.

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/common/smbdirect/smbdirect_connection.c

index 40d830c58f195ebba7bca8b2f9b5ec54d6e6a811..45a7ff9b7354af2970e12a4e8263dbf1fd0fa4a3 100644 (file)
@@ -726,6 +726,25 @@ static u16 smbdirect_connection_grant_recv_credits(struct smbdirect_socket *sc)
        return new_credits;
 }
 
+__maybe_unused /* this is temporary while this file is included in others */
+static bool smbdirect_connection_request_keep_alive(struct smbdirect_socket *sc)
+{
+       const struct smbdirect_socket_parameters *sp = &sc->parameters;
+
+       if (sc->idle.keepalive == SMBDIRECT_KEEPALIVE_PENDING) {
+               sc->idle.keepalive = SMBDIRECT_KEEPALIVE_SENT;
+               /*
+                * Now use the keepalive timeout (instead of keepalive interval)
+                * in order to wait for a response
+                */
+               mod_delayed_work(sc->workqueue, &sc->idle.timer_work,
+                                msecs_to_jiffies(sp->keepalive_timeout_msec));
+               return true;
+       }
+
+       return false;
+}
+
 __maybe_unused /* this is temporary while this file is included in others */
 static void smbdirect_connection_send_io_done(struct ib_cq *cq, struct ib_wc *wc)
 {