diff options
| author | Stefan Metzmacher <metze@samba.org> | 2025-08-27 17:39:22 +0300 |
|---|---|---|
| committer | Steve French <stfrench@microsoft.com> | 2026-04-16 05:58:18 +0300 |
| commit | b90169bcb2a6f46b1b5d7a17d5fd15a64ab552ff (patch) | |
| tree | be43fb42ef9395b84bf7202e6dafb9833314edb9 | |
| parent | bb0a49edfe1ac5d831c897e4869a167cddea835f (diff) | |
| download | linux-b90169bcb2a6f46b1b5d7a17d5fd15a64ab552ff.tar.xz | |
smb: smbdirect: introduce smbdirect_connection_reassembly_{append,first}_recv_io()
These are basically copies of enqueue_reassembly() and
[_]get_first_reassembly() of both client and server. The only difference
is that enqueue_reassembly() of the server does not have:
sc->statistics.enqueue_reassembly_queue++
Also smbdirect_connection_reassembly_first_recv_io() makes use of
list_first_entry_or_null() in order to simplify the code.
In the next commits they will replace the existing functions.
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>
| -rw-r--r-- | fs/smb/common/smbdirect/smbdirect_connection.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/fs/smb/common/smbdirect/smbdirect_connection.c b/fs/smb/common/smbdirect/smbdirect_connection.c index 96f00c342a89..ce10aff54349 100644 --- a/fs/smb/common/smbdirect/smbdirect_connection.c +++ b/fs/smb/common/smbdirect/smbdirect_connection.c @@ -47,3 +47,38 @@ static void smbdirect_connection_put_recv_io(struct smbdirect_recv_io *msg) queue_work(sc->workqueue, &sc->recv_io.posted.refill_work); } + +__maybe_unused /* this is temporary while this file is included in others */ +static void smbdirect_connection_reassembly_append_recv_io(struct smbdirect_socket *sc, + struct smbdirect_recv_io *msg, + u32 data_length) +{ + unsigned long flags; + + spin_lock_irqsave(&sc->recv_io.reassembly.lock, flags); + list_add_tail(&msg->list, &sc->recv_io.reassembly.list); + sc->recv_io.reassembly.queue_length++; + /* + * Make sure reassembly_data_length is updated after list and + * reassembly_queue_length are updated. On the dequeue side + * reassembly_data_length is checked without a lock to determine + * if reassembly_queue_length and list is up to date + */ + virt_wmb(); + sc->recv_io.reassembly.data_length += data_length; + spin_unlock_irqrestore(&sc->recv_io.reassembly.lock, flags); + sc->statistics.enqueue_reassembly_queue++; +} + +__maybe_unused /* this is temporary while this file is included in others */ +static struct smbdirect_recv_io * +smbdirect_connection_reassembly_first_recv_io(struct smbdirect_socket *sc) +{ + struct smbdirect_recv_io *msg; + + msg = list_first_entry_or_null(&sc->recv_io.reassembly.list, + struct smbdirect_recv_io, + list); + + return msg; +} |
