Skip to content

Commit ec76e3c

Browse files
metze-sambasmfrench
authored andcommitted
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>
1 parent b5a4242 commit ec76e3c

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

fs/smb/common/smbdirect/smbdirect_socket.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,23 @@ struct smbdirect_socket {
135135
spinlock_t lock;
136136
} free;
137137

138+
/*
139+
* The state for posted recv_io messages
140+
* and the refill work struct.
141+
*/
142+
struct {
143+
atomic_t count;
144+
struct work_struct refill_work;
145+
} posted;
146+
147+
/*
148+
* The credit state for the recv side
149+
*/
150+
struct {
151+
u16 target;
152+
atomic_t count;
153+
} credits;
154+
138155
/*
139156
* The list of arrived non-empty smbdirect_recv_io
140157
* structures
@@ -204,6 +221,10 @@ static __always_inline void smbdirect_socket_init(struct smbdirect_socket *sc)
204221
INIT_LIST_HEAD(&sc->recv_io.free.list);
205222
spin_lock_init(&sc->recv_io.free.lock);
206223

224+
atomic_set(&sc->recv_io.posted.count, 0);
225+
226+
atomic_set(&sc->recv_io.credits.count, 0);
227+
207228
INIT_LIST_HEAD(&sc->recv_io.reassembly.list);
208229
spin_lock_init(&sc->recv_io.reassembly.lock);
209230
init_waitqueue_head(&sc->recv_io.reassembly.wait_queue);

0 commit comments

Comments
 (0)