]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
smb: smbdirect: introduce smbdirect_socket.recv_io.{posted,credits}
authorStefan Metzmacher <metze@samba.org>
Mon, 11 Aug 2025 13:57:04 +0000 (15:57 +0200)
committerSteve French <stfrench@microsoft.com>
Sun, 28 Sep 2025 23:29:47 +0000 (18:29 -0500)
This will be used by client and server soon in order to maintain
the state of posted recv_io messages and granted credits.

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/common/smbdirect/smbdirect_socket.h

index d7f3b25c022df70eab63cc25f791ad3533775205..1abfcd230f9a3fda63f35762cd8baf17a5c8e778 100644 (file)
@@ -135,6 +135,23 @@ struct smbdirect_socket {
                        spinlock_t lock;
                } free;
 
+               /*
+                * The state for posted recv_io messages
+                * and the refill work struct.
+                */
+               struct {
+                       atomic_t count;
+                       struct work_struct refill_work;
+               } posted;
+
+               /*
+                * The credit state for the recv side
+                */
+               struct {
+                       u16 target;
+                       atomic_t count;
+               } credits;
+
                /*
                 * The list of arrived non-empty smbdirect_recv_io
                 * structures
@@ -204,6 +221,10 @@ static __always_inline void smbdirect_socket_init(struct smbdirect_socket *sc)
        INIT_LIST_HEAD(&sc->recv_io.free.list);
        spin_lock_init(&sc->recv_io.free.lock);
 
+       atomic_set(&sc->recv_io.posted.count, 0);
+
+       atomic_set(&sc->recv_io.credits.count, 0);
+
        INIT_LIST_HEAD(&sc->recv_io.reassembly.list);
        spin_lock_init(&sc->recv_io.reassembly.lock);
        init_waitqueue_head(&sc->recv_io.reassembly.wait_queue);