Stefan Metzmacher
d5e2bdda49
smb: server: make use of smbdirect_connection_negotiate_rdma_resources()
...
It's good to have this logic in a central place, it will allow us
share more code soon.
Cc: Namjae Jeon <linkinjeon@kernel.org >
Cc: Steve French <smfrench@gmail.com >
Cc: Tom Talpey <tom@talpey.com >
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 >
2026-04-15 21:58:23 -05:00
Stefan Metzmacher
ab8e9249e7
smb: server: make use of smbdirect_connection_qp_event_handler()
...
This is a copy of smb_direct_qpair_handler()...
It will allow more code to be moved to common functions
soon.
Cc: Namjae Jeon <linkinjeon@kernel.org >
Cc: Steve French <smfrench@gmail.com >
Cc: Tom Talpey <tom@talpey.com >
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 >
2026-04-15 21:58:23 -05:00
Stefan Metzmacher
8688d7a8c7
smb: server: make use of smbdirect_map_sges_from_iter()
...
It will make it easier to move stuff into common code when
both client and server use smbdirect_map_sges_from_iter().
Cc: Namjae Jeon <linkinjeon@kernel.org >
Cc: Steve French <smfrench@gmail.com >
Cc: Tom Talpey <tom@talpey.com >
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 >
2026-04-15 21:58:23 -05:00
Stefan Metzmacher
07aec3a151
smb: server: make use of smbdirect_connection_{create,destroy}_mem_pools()
...
This were based on smb_direct_{create,destroy}_pools() in the server.
The main logical differences are the following:
We now don't use smbdirect_connection_get_recv_io() on cleanup,
instead it uses list_for_each_entry_safe()...
We don't generate warnings if smbdirect_recv_io payload
is copied into userspace buffers. This doesn't happen
in the server anyway.
And it uses list_add_tail() just to let me feel
better when looking at the code...
Cc: Namjae Jeon <linkinjeon@kernel.org >
Cc: Steve French <smfrench@gmail.com >
Cc: Tom Talpey <tom@talpey.com >
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 >
2026-04-15 21:58:23 -05:00
Stefan Metzmacher
bb1d5c49d6
smb: server: make use of smbdirect_connection_send_io_done()
...
This also wakes up send_io.pending.dec_wait_queue, which
is currently always empty in the server, but that might
change in future. And we also don't spam the logs on IB_WC_WR_FLUSH_ERR.
Cc: Namjae Jeon <linkinjeon@kernel.org >
Cc: Steve French <smfrench@gmail.com >
Cc: Tom Talpey <tom@talpey.com >
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 >
2026-04-15 21:58:23 -05:00
Stefan Metzmacher
8ecb32ada1
smb: server: make use of smbdirect_connection_{alloc,free}_send_io()
...
These are basically copies of smb_direct_{alloc,free}_sendmsg() just
a bit simpler and with the gfp_mask mask abstracted.
For now we still use KSMBD_DEFAULT_GFP, which includes
__GFP_RETRY_MAYFAIL.
The only difference is that we use ib_dma_unmap_page() for all sges,
this simplifies the logic and doesn't matter as
ib_dma_unmap_single() and ib_dma_unmap_page() both operate
on dma_addr_t and dma_unmap_single_attrs() is just an
alias for dma_unmap_page_attrs().
We already had such an inconsistency in the client
code where we use ib_dma_unmap_single(), while we mapped
using ib_dma_map_page().
Cc: Namjae Jeon <linkinjeon@kernel.org >
Cc: Steve French <smfrench@gmail.com >
Cc: Tom Talpey <tom@talpey.com >
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 >
2026-04-15 21:58:23 -05:00
Stefan Metzmacher
c81c66d3c0
smb: server: make use of smbdirect_frwr_is_supported()
...
This is an exact copy of rdma_frwr_is_supported().
Cc: Namjae Jeon <linkinjeon@kernel.org >
Cc: Steve French <smfrench@gmail.com >
Cc: Tom Talpey <tom@talpey.com >
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 >
2026-04-15 21:58:22 -05:00
Stefan Metzmacher
84d7085e5f
smb: server: make use of smbdirect_connection_idle_timer_work()
...
This is basically a copy of smb_direct_idle_connection_timer().
The only difference is that we had no logging before.
Note smbdirect_socket_prepare_create() already calls INIT_DELAYED_WORK().
Cc: Namjae Jeon <linkinjeon@kernel.org >
Cc: Steve French <smfrench@gmail.com >
Cc: Tom Talpey <tom@talpey.com >
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 >
2026-04-15 21:58:22 -05:00
Stefan Metzmacher
aa1255e71f
smb: server: make use of smbdirect_connection_reassembly_{append,first}_recv_io()
...
These are basically copies of enqueue_reassembly() and
get_first_reassembly(). The only difference is that
sc->statistics.enqueue_reassembly_queue now updated.
Cc: Namjae Jeon <linkinjeon@kernel.org >
Cc: Steve French <smfrench@gmail.com >
Cc: Tom Talpey <tom@talpey.com >
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 >
2026-04-15 21:58:22 -05:00
Stefan Metzmacher
01f26988c8
smb: server: make use of smbdirect_connection_{get,put}_recv_io()
...
These are basically copies of {get,put}_receive_buffer() in the client.
They are very similar to {get_free,put}_recvmsg() the only logical
difference is the updating of the sc->statistics.*.
Cc: Namjae Jeon <linkinjeon@kernel.org >
Cc: Steve French <smfrench@gmail.com >
Cc: Tom Talpey <tom@talpey.com >
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 >
2026-04-15 21:58:22 -05:00
Stefan Metzmacher
0ffbbfdf6a
smb: server: make use of smbdirect_socket_schedule_cleanup()
...
This removes smb_direct_disconnect_rdma_connection() which is basically
the same as smbdirect_socket_schedule_cleanup().
And we pass more useful errors than -ECONNABORTED if we have them.
Cc: Namjae Jeon <linkinjeon@kernel.org >
Cc: Steve French <smfrench@gmail.com >
Cc: Tom Talpey <tom@talpey.com >
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 >
2026-04-15 21:58:22 -05:00
Stefan Metzmacher
1b1ee1e3ee
smb: server: make use of smbdirect_socket_cleanup_work()
...
Note smbdirect_socket_prepare_create() already calls INIT_WORK()
with smbdirect_socket_cleanup_work.
Cc: Namjae Jeon <linkinjeon@kernel.org >
Cc: Steve French <smfrench@gmail.com >
Cc: Tom Talpey <tom@talpey.com >
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 >
2026-04-15 21:58:22 -05:00
Stefan Metzmacher
33562021f4
smb: server: make use of smbdirect_socket_wake_up_all()
...
This is a superset of smb_direct_disconnect_wake_up_all() and
calling wake_up_all(&sc->mr_io.ready.wait_queue); and
wake_up_all(&sc->mr_io.cleanup.wait_queue); in addition
should not matter as it's not used on the server anyway.
Cc: Namjae Jeon <linkinjeon@kernel.org >
Cc: Steve French <smfrench@gmail.com >
Cc: Tom Talpey <tom@talpey.com >
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 >
2026-04-15 21:58:22 -05:00
Stefan Metzmacher
bbf3559afe
smb: server: make use of smbdirect_socket_set_logging()
...
This will allow the logging to keep working as before,
when we move to common functions in the next commits.
Cc: Namjae Jeon <linkinjeon@kernel.org >
Cc: Steve French <smfrench@gmail.com >
Cc: Tom Talpey <tom@talpey.com >
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 >
2026-04-15 21:58:22 -05:00
Stefan Metzmacher
4624f1bf1b
smb: server: make use of smbdirect_socket_prepare_create()
...
This prepares the use of functions from smbdirect_connection.c.
Cc: Namjae Jeon <linkinjeon@kernel.org >
Cc: Steve French <smfrench@gmail.com >
Cc: Tom Talpey <tom@talpey.com >
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 >
2026-04-15 21:58:22 -05:00
Stefan Metzmacher
6acc747906
smb: client: make use of smbdirect.ko
...
This means we no longer inline the common smbdirect
.c files and use the exported functions from the
module instead.
Note the connection specific logging is still
redirect to cifs.ko functions via
smbdirect_socket_set_logging().
We still don't use real socket layer,
but we're very close...
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: David Howells <dhowells@redhat.com >
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 >
2026-04-15 21:58:22 -05:00
Stefan Metzmacher
a8e98e3920
smb: client: only use public smbdirect functions
...
Also remove a lot of unused includes...
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 >
2026-04-15 21:58:22 -05:00
Stefan Metzmacher
b8aef8c880
smb: client: make use of smbdirect_socket_create_kern()/smbdirect_socket_release()
...
With this we no longer embed struct smbdirect_socket, which will allow
us to make it private in the following commits.
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 >
2026-04-15 21:58:22 -05:00
Stefan Metzmacher
7dbfc0d910
smb: client: make use of smbdirect_socket_init_new() and smbdirect_connect_sync()
...
This means we finally only use common functions in the client.
We still use the embedded struct smbdirect_socket and are
able to access internals, but the will be removed in the
next commits as well.
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 >
2026-04-15 21:58:22 -05:00
Stefan Metzmacher
0b0a1a3b2d
smb: client: introduce and use smbd_debug_proc_show()
...
This will allow us to make struct smbdirect_socket private
in future.
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 >
2026-04-15 21:58:22 -05:00
Stefan Metzmacher
5bd752e774
smb: client: introduce and use smbd_mr_fill_buffer_descriptor()
...
This will allow us to make struct smbdirect_mr_io private in future.
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 >
2026-04-15 21:58:22 -05:00
Stefan Metzmacher
63972da39f
smb: client: make use of smbdirect_connection_send_{single_iter,immediate_work}()
...
With this the low level send functions are in common,
we'll have to do some more changes in generic smb code
in order to use smbdirect_connection_send_iter() instead
of looping around smbdirect_connection_send_single_iter().
David's cleanups will allow us to use
smbdirect_connection_send_iter().
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: David Howells <dhowells@redhat.com >
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 >
2026-04-15 21:58:22 -05:00
Stefan Metzmacher
7c81e7bb13
smb: client: let smbd_post_send_full_iter() get remaining_length and return data_length
...
This will simplify further changes in order to share
more common code in future.
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 >
2026-04-15 21:58:22 -05:00
Stefan Metzmacher
b626ccd251
smb: client: let smbd_post_send_iter() get remaining_length and return data_length
...
This lets the logic be like smb_direct_post_send_data(), so
we can share common code in the next steps.
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 >
2026-04-15 21:58:22 -05:00
Stefan Metzmacher
15c7e49261
smb: client: change smbd_post_send_empty() to void return
...
The caller doesn't check, so we better call
smbdirect_socket_schedule_cleanup() to handle the error.
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 >
2026-04-15 21:58:22 -05:00
Stefan Metzmacher
b942f351c2
smb: client: make use of smbdirect_connection_request_keep_alive()
...
This will help to share more common code soon.
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 >
2026-04-15 21:58:22 -05:00
Stefan Metzmacher
8b72c199a9
smb: client: make use of smbdirect_connection_grant_recv_credits()
...
This already calls atomic_add(new_credits, &sc->recv_io.credits.count),
so there's no need to do it in the caller anymore.
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 >
2026-04-15 21:58:22 -05:00
Stefan Metzmacher
edb9e514f0
smb: client: make use of smbdirect_connection_recvmsg()
...
This is basically the same as it was copied before...
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 >
2026-04-15 21:58:21 -05:00
Stefan Metzmacher
2cafcddbda
smb: client: make use of smbdirect_socket_destroy_sync()
...
This is basically the same logic as before, but we now
use common code, which will also be used by the server soon.
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 >
2026-04-15 21:58:21 -05:00
Stefan Metzmacher
2a49b62518
smb: client: make use of functions from smbdirect_mr.c
...
The copied code only got new names, some indentation/formatting changes,
some variable names are changed too.
They also only use struct smbdirect_socket instead of
struct smbd_connection.
But the logic is still the same.
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 >
2026-04-15 21:58:21 -05:00
Stefan Metzmacher
73ec624781
smb: client: make use of smbdirect_connection_recv_io_refill_work()
...
This is basically a copy of smbd_post_send_credits(), but
there are several improvements compared to the existing function:
We calculate the number of missing posted buffers by getting the
difference between recv_io.credits.target and recv_io.posted.count.
Instead of the difference between recv_io.credits.target
and recv_io.credits.count, because recv_io.credits.count is
only updated once a message is send to the peer.
It was not really a problem before, because we have
a fixed number smbdirect_recv_io buffers, so the
loop terminated when smbdirect_connection_get_recv_io()
returns NULL.
But using recv_io.posted.count makes it easier to
understand.
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 >
2026-04-15 21:58:21 -05:00
Stefan Metzmacher
26003faa7d
smb: client: make use of smbdirect_connection_post_recv_io()
...
The only difference is that smbdirect_connection_post_recv_io()
returns early if the connection is already broken.
And that the error code from ib_dma_mapping_error() (currently only -ENOMEM
is possible) is returned instead of -EIO.
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 >
2026-04-15 21:58:21 -05:00
Stefan Metzmacher
6a67fe6212
smb: client: initialize recv_io->cqe.done = recv_done just once
...
smbdirect_recv_io structures are pre-allocated so we can set the
callback function just once.
This will make it easy to move smbd_post_recv() to common code
soon.
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 >
2026-04-15 21:58:21 -05:00
Stefan Metzmacher
8de5571045
smb: client: make use of smbdirect_connection_{create,destroy}_qp()
...
It's good a use common code for this and it will allow us
to share more code in the next steps.
Calling ib_drain_qp() twice is ok.
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 >
2026-04-15 21:58:21 -05:00
Stefan Metzmacher
6bcccfb0c0
smb: client: make use of smbdirect_connection_negotiate_rdma_resources()
...
It's good to have this logic in a central place, it will allow us
share more code soon.
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 >
2026-04-15 21:58:21 -05:00
Stefan Metzmacher
0b7da58fec
smb: client: make use of smbdirect_connection_qp_event_handler()
...
This is a copy of smbd_qp_async_error_upcall()...
It will allow more code to be moved to common functions
soon.
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 >
2026-04-15 21:58:21 -05:00
Stefan Metzmacher
e5fd091663
smb: client: make use of smbdirect_map_sges_from_iter()
...
This is basically a copy of smb_extract_iter_to_rdma() moved
to common code.
Before we had the inconsistency we called ib_dma_unmap_single(),
while we mapped using ib_dma_map_page() in smb_set_sge().
Now ib_dma_unmap_page() is used for consistency.
It doesn't really matter as ib_dma_unmap_single() and
ib_dma_unmap_page() both operate
on dma_addr_t and dma_unmap_single_attrs() is just an
alias for dma_unmap_page_attrs().
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 >
2026-04-15 21:58:21 -05:00
Stefan Metzmacher
116f3eed36
smb: client: make use of smbdirect_connection_{create,destroy}_mem_pools()
...
The main logical differences are the following:
We now don't use smbdirect_connection_get_recv_io() on cleanup,
instead it uses list_for_each_entry_safe()...
For the smbdirect_recv_io payload we expose the whole payload including
the smbdirect_data_transfer header as documentation says data_offset = 0
and data_length != 0 would be valid, while the existing client code
requires data_offset >= 24.
The smbdirect_send_io cache includes header space for
sizeof(struct smbdirect_negotiate_resp) = 32 bytes
instead of sizeof(struct smbdirect_data_transfer) = 24 bytes.
If this ever becomes a problem, we can allocate separate
space for the smbdirect_negotiate_resp in the server.
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 >
2026-04-15 21:58:21 -05:00
Stefan Metzmacher
958da403e1
smb: client: make use of smbdirect_connection_send_io_done()
...
This handles freeing of siblings too, which is used on
the client yet, but that might follow later.
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 >
2026-04-15 21:58:21 -05:00
Stefan Metzmacher
f7a59fff02
smb: client: make use of smbdirect_connection_{alloc,free}_send_io()
...
This simplifies the code and allows us to share more code in common
with the server.
The only difference is that we use ib_dma_unmap_page() for all sges,
this simplifies the logic and doesn't matter as
ib_dma_unmap_single() and ib_dma_unmap_page() both operate
on dma_addr_t and dma_unmap_single_attrs() is just an
alias for dma_unmap_page_attrs().
We already had such an inconsistency before
as we called ib_dma_unmap_single(), while we mapped
using ib_dma_map_page() in smb_set_sge().
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 >
2026-04-15 21:58:21 -05:00
Stefan Metzmacher
6f9055aa9c
smb: client: make use of smbdirect_frwr_is_supported()
...
This an exact copy of frwr_is_supported().
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 >
2026-04-15 21:58:21 -05:00
Stefan Metzmacher
c85814ca5f
smb: client: make use of smbdirect_connection_idle_timer_work()
...
This is basically a copy of idle_connection_timer().
Note smbdirect_socket_prepare_create() already calls INIT_DELAYED_WORK().
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 >
2026-04-15 21:58:21 -05:00
Stefan Metzmacher
018ed87aa5
smb: client: make use of smbdirect_connection_reassembly_{append,first}_recv_io()
...
These are exact copies of enqueue_reassembly() and _get_first_reassembly().
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 >
2026-04-15 21:58:21 -05:00
Stefan Metzmacher
927183cdbe
smb: client: make use of smbdirect_connection_{get,put}_recv_io()
...
These are basically copies of {get,put}_receive_buffer().
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 >
2026-04-15 21:58:21 -05:00
Stefan Metzmacher
43e1fed89e
smb: client: make use of smbdirect_socket_schedule_cleanup()
...
This removes smbd_disconnect_rdma_connection() which is basically
the same as smbdirect_socket_schedule_cleanup().
And we pass more useful errors than -ECONNABORTED if we have them.
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 >
2026-04-15 21:58:21 -05:00
Stefan Metzmacher
872b23ab6d
smb: client: make use of smbdirect_socket_cleanup_work()
...
Note smbdirect_socket_prepare_create() already calls INIT_WORK()
with smbdirect_socket_cleanup_work.
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 >
2026-04-15 21:58:21 -05:00
Stefan Metzmacher
5f6e338bbb
smb: client: make use of smbdirect_socket_wake_up_all()
...
This is a superset of smbd_disconnect_wake_up_all() and
calling wake_up_all(&sc->rw_io.credits.wait_queue); in addition
should not matter as it's not used on the client anyway.
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 >
2026-04-15 21:58:21 -05:00
Stefan Metzmacher
2459505596
smb: client: make use of smbdirect_socket_set_logging()
...
This will allow the logging to keep working as before,
when we move to common functions in the next commits.
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 >
2026-04-15 21:58:21 -05:00
Stefan Metzmacher
dd43c22273
smb: client: make use of smbdirect_socket_prepare_create()
...
This prepares the use of functions from smbdirect_connection.c.
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 >
2026-04-15 21:58:20 -05:00
Stefan Metzmacher
f9a804da47
smb: smbdirect: introduce the basic smbdirect.ko
...
This exports the functions needed by cifs.ko and ksmbd.ko.
It doesn't yet provide a generic socket layer, but it
is a good start to introduce that on top.
It will be much easier after Davids refactoring
using MSG_SPLICE_PAGES, will make it easier to
use the socket layer without an additional copy.
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: David Howells <dhowells@redhat.com >
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 >
2026-04-15 21:58:20 -05:00