smb: smbdirect: introduce smbdirect_socket.recv_io.{posted,credits}

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>
This commit is contained in:
Stefan Metzmacher
2025-08-11 15:57:04 +02:00
committed by Steve French
parent b5a4242fb9
commit ec76e3cc6b
@@ -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);