diff options
| author | Stefan Metzmacher <metze@samba.org> | 2025-08-08 15:08:33 +0200 |
|---|---|---|
| committer | Steve French <stfrench@microsoft.com> | 2025-09-28 18:29:47 -0500 |
| commit | 17e1d07430e4bd6a14e2d194791f545f8548ff58 (patch) | |
| tree | 7cdb8711979e5e8ab732b9e0f0a21772ddc18c4c | |
| parent | 371d3ab51ce44c8a7c0f9b835b74b7340a922059 (diff) | |
| download | linux-17e1d07430e4bd6a14e2d194791f545f8548ff58.tar.gz linux-17e1d07430e4bd6a14e2d194791f545f8548ff58.zip | |
smb: smbdirect: introduce smbdirect_socket_init()
This will make it easier to keep the initialization
in a single place.
For now it's an __always_inline function as we only
share the header files. Once move to common functions
we'll have a dedicated smbdirect.ko that exports functions...
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>
| -rw-r--r-- | fs/smb/common/smbdirect/smbdirect_socket.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/smb/common/smbdirect/smbdirect_socket.h b/fs/smb/common/smbdirect/smbdirect_socket.h index a69b9649b88e..4e2b87208d91 100644 --- a/fs/smb/common/smbdirect/smbdirect_socket.h +++ b/fs/smb/common/smbdirect/smbdirect_socket.h @@ -136,6 +136,24 @@ struct smbdirect_socket { } recv_io; }; +static __always_inline void smbdirect_socket_init(struct smbdirect_socket *sc) +{ + /* + * This also sets status = SMBDIRECT_SOCKET_CREATED + */ + BUILD_BUG_ON(SMBDIRECT_SOCKET_CREATED != 0); + memset(sc, 0, sizeof(*sc)); + + init_waitqueue_head(&sc->status_wait); + + INIT_LIST_HEAD(&sc->recv_io.free.list); + spin_lock_init(&sc->recv_io.free.lock); + + 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); +} + struct smbdirect_send_io { struct smbdirect_socket *socket; struct ib_cqe cqe; |
