aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
8 dayssmb: smbdirect: introduce smbdirect_accept_connect_request()Stefan Metzmacher2-0/+738
This will be used by the server to handle new connections. All rdma processing from rdma_accept() to RDMA_CM_EVENT_ESTABLISHED as well as the waiting for the smbdirect negotiation request and sending the negotiation response is done async until we reach SMBDIRECT_SOCKET_CONNECTED. Sync behaviour will be done by the server calling smbdirect_conection_wait_for_connected() in order to each SMBDIRECT_SOCKET_CONNECTED or an 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>
8 dayssmb: smbdirect: introduce smbdirect_connect[_sync]()Stefan Metzmacher2-0/+927
This implements a fully async connect logic over all rdma related operations: rdma_resolve_addr, rdma_resolve_route and rdma_connect_locked until we reach RDMA_CM_EVENT_ESTABLISHED, followed by the smbdirect negotiation request/response handling until we reach SMBDIRECT_SOCKET_CONNECTED. smbdirect_connect_sync() is just a useful wrapper around the async logic calling smbdirect_connect() followed by smbdirect_connection_wait_for_connected(), which only waits for SMBDIRECT_SOCKET_CONNECTED or an 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>
8 dayssmb: smbdirect: let smbdirect_socket_set_initial_parameters() call ↵Stefan Metzmacher2-0/+18
rdma_restrict_node_type() We allow the caller of smbdirect_socket_set_initial_parameters() to pass SMBDIRECT_FLAG_PORT_RANGE_ONLY_{IB,IW} in order to restrict the rdma devices for the listener or connection to either iWarp (RDMA_NODE_RNIC) or InfiniBand/RoCEv1/RoCEv2 (RDMA_NODE_IB_CA). 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>
8 dayssmb: smbdirect: introduce smbdirect_socket_init_{new,accepting}() and helpersStefan Metzmacher1-2/+156
These will be used in order to initialize struct smbdirect_socket with rdma.cm_id being valid from the start in order to hold a reference to the correct net namespace, this will allow us to implement async connecting and accepting logic in the next steps. This comes with some related helper functions in order to initialize the socket without the need to access internals of struct smbdirect_socket: smbdirect_socket_set_initial_parameters smbdirect_socket_get_current_parameters smbdirect_socket_set_kernel_settings smbdirect_socket_set_custom_workqueue 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>
8 dayssmb: smbdirect: introduce smbdirect_socket_shutdown()Stefan Metzmacher1-0/+6
This can be used by client and server to trigger a disconnect of the connection, the idea of to be similar to kernel_sock_shutdown(), but for smbdirect there's no point in shutting down only one direction so there's no 'how' argument. 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>
8 dayssmb: smbdirect: introduce smbdirect_connection_is_connected()Stefan Metzmacher1-0/+8
This is a simple way to check is the connection is still ok without the need to know internals of struct smbdirect_socket. 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>
8 dayssmb: smbdirect: introduce smbdirect_connection_wait_for_connected()Stefan Metzmacher1-0/+73
This will be used by client and server in order to wait for the connect/negotiation to finish in order to get a usable connection. 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>
8 dayssmb: smbdirect: introduce smbdirect_connection_legacy_debug_proc_show()Stefan Metzmacher2-0/+89
This will be used by the client in order to keep the debug output in the current way without the need to access struct smbdirect_socket internals. 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>
8 dayssmb: smbdirect: introduce smbdirect_mr_io_fill_buffer_descriptor()Stefan Metzmacher1-0/+18
This will be used by the client instead of dereferencing struct smbdirect_mr_io internals. 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>
8 dayssmb: smbdirect: introduce smbdirect_connection_negotiation_done()Stefan Metzmacher1-2/+46
This will be used by client and server in order to turn the connection into a usable state. 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>
8 dayssmb: smbdirect: introduce smbdirect_connection_send_immediate_work()Stefan Metzmacher1-0/+22
This is a combination of smb_direct_send_immediate_work() in the server as well as send_immediate_empty_message() and smbd_post_send_empty() in the client. smbdirect_connection_send_immediate_work() replace all of them in client and 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>
8 dayssmb: smbdirect: introduce smbdirect_connection_send_iter() and related functionsStefan Metzmacher1-1/+495
This is basically a copy of the following functions in the server: smb_direct_post_send => smbdirect_connection_post_send_wr smb_direct_send_ctx_init => smbdirect_connection_send_batch_init smb_direct_flush_send_list => smbdirect_connection_send_batch_flush wait_for_send_lcredit => smbdirect_connection_wait_for_send_lcredit wait_for_send_credits => smbdirect_connection_wait_for_send_credits post_sendmsg => smbdirect_connection_post_send_io smb_direct_post_send_data => smbdirect_connection_send_single_iter smb_direct_send_iter => smbdirect_connection_send_iter They will replace the server functions soon and will also be used in the client as smbdirect_connection_send_single_iter() is very similar to smbd_post_send_iter(). There's also a smbdirect_connection_send_wait_zero_pending() helper that can be used together with smbdirect_connection_send_single_iter() in the client until it can use smbdirect_connection_send_iter(), which can happen with David's refactoring. 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>
8 dayssmb: smbdirect: introduce smbdirect_connection_request_keep_alive()Stefan Metzmacher1-0/+19
This a copy of manage_keep_alive_before_sending() in client and server, it will replace these 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>
8 dayssmb: smbdirect: introduce smbdirect_connection_grant_recv_credits()Stefan Metzmacher1-0/+38
This is basically a copy of manage_credits_prior_sending() in the client and the server. It will replace both versions 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>
8 dayssmb: smbdirect: introduce smbdirect_connection_recvmsg()Stefan Metzmacher1-0/+151
This is basically a copy of smbd_recv() in the client. And it's very similar to smb_direct_read() in the server. It will replace both 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>
8 dayssmb: smbdirect: introduce ↵Stefan Metzmacher2-0/+118
smbdirect_connection_rdma_{established,event_handler}() This will be used by client and server in future, it will be used after the rdma connection is established in order to simplify the events happening on an established connection. We'll also have smbdirect_{connect,accept}_rdma_event_handler functions which will be used before the rdma connection is established. 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>
8 dayssmb: smbdirect: introduce smbdirect_socket_destroy[_sync]()Stefan Metzmacher4-5/+142
This will be used in common between client and server in order to destroy all resources attached to a connection. 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>
8 dayssmb: smbdirect: introduce smbdirect_connection_recv_io_done()Stefan Metzmacher1-0/+170
This is basically a copy of recv_done() in client and server, with the following additions: - Only handling the SMBDIRECT_EXPECT_DATA_TRANSFER code path, as we'll have separate functions for the negotiate messages. - Using more helper variables - Improved logging - Add credits_requested == 0 error check - Add data_offset not 8 bytes aligned error check - Use disable_work(&sc->recv_io.posted.refill_work) before smbdirect_connection_put_recv_io, when it is followed by smbdirect_socket_schedule_cleanup() This will be used on common between client and server in future and replace the existing recv_done() 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>
8 dayssmb: smbdirect: define SMBDIRECT_RDMA_CM_[RNR_]RETRYStefan Metzmacher1-0/+9
These are copies of {SMBD,SMB_DIRECT}_CM_[RNR_]RETRY. 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>
8 dayssmb: smbdirect: define SMBDIRECT_MIN_{RECEIVE,FRAGMENTED}_SIZEStefan Metzmacher1-0/+4
These are specified in MS-SMBD... 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>
8 dayssmb: smbdirect: introduce smbdirect_rw.c with server rw codeStefan Metzmacher3-0/+265
This is basically contains the following functions copied from the server: wait_for_rw_credits, calc_rw_credits, get_sg_list, smb_direct_free_rdma_rw_msg, read_write_done, read_done, write_done, smb_direct_rdma_xmit. They got new names, some indentation/formatting changes, some variable names are changed too. They also only use struct smbdirect_socket instead of struct smb_direct_transport. But the logic is still the same. They will 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>
8 dayssmb: smbdirect: introduce smbdirect_mr.c with client mr codeStefan Metzmacher2-0/+545
This is basically contains the following functions copied from the client: destroy_mr_list, allocate_mr_list, register_mr_done, smbd_mr_recovery_work, get_mr, smbd_iter_to_mr, smbd_register_mr and smbd_deregister_mr. They 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. They will be used by the client 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>
8 dayssmb: smbdirect: introduce smbdirect_socket_wait_for_credits()Stefan Metzmacher2-0/+36
This is a copy of wait_for_credits() in the server, which will be replaced by this soon. This will allow us to share more common code between client and 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>
8 dayssmb: smbdirect: introduce smbdirect_get_buf_page_count()Stefan Metzmacher1-0/+6
This is a copy of get_buf_page_count() in the server and will replace it soon. The only difference is that we now use size_t instead of int. 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>
8 dayssmb: smbdirect: split out smbdirect_connection_recv_io_refill()Stefan Metzmacher1-11/+25
This will allow us to refill the recv queue in a sync way after negotiation. 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>
8 dayssmb: smbdirect: introduce smbdirect_connection_recv_io_refill_work()Stefan Metzmacher1-0/+94
This is basically a copy of smbd_post_send_credits() in the client and smb_direct_post_recv_credits() in the server. There are several improvements compared to the existing functions: 1. 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. 2. In order to tell the peer about the newly posted buffer and grant the credits, we only trigger the send immediate when we're not granting only the last possible credit (only one credit is missing to reach the desired target). This is mostly a difference relative to the servers smb_direct_post_recv_credits() implementation, which should avoid useless ping pong messages. 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>
8 dayssmb: smbdirect: introduce smbdirect_connection_post_recv_io()Stefan Metzmacher1-0/+42
This is basically a copy of smbd_post_recv() in the client and smb_direct_post_recv() in the server. The only difference is that this returns early if the connection is already broken. 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>
8 dayssmb: smbdirect: introduce smbdirect_connection_{create,destroy}_qp()Stefan Metzmacher2-0/+217
smbdirect_connection_create_qp() is basically a copy of smb_direct_create_qpair() in the server, it just adds extra send_wr space for MR requests. smbdirect_connection_destroy_qp() is the cleanup code smb_direct_create_qpair() has, plus calling ib_drain_qp(), it be a no-op if no requests are posted. These additions allow the functions to be used by client and 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>
8 dayssmb: smbdirect: introduce smbdirect_connection_negotiate_rdma_resources()Stefan Metzmacher1-0/+62
This is a copy of the same logic used in client and server, it's inlined there, but they will use the new helper function 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>
8 dayssmb: smbdirect: introduce smbdirect_connection_qp_event_handler()Stefan Metzmacher1-0/+25
This is basically a copy of smbd_qp_async_error_upcall() in the client and smb_direct_qpair_handler() in the server. They will be replaced by the new common function soon, which will allow more code to be moved 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>
8 dayssmb: smbdirect: introduce smbdirect_map_sges_from_iter() and helper functionsStefan Metzmacher1-0/+255
These are basically copies of smb_extract_iter_to_rdma() and its helpers in the client, which will be replaced in the next steps. The goal is to use them also in the server, which will simplify a lot. 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>
8 dayssmb: smbdirect: introduce smbdirect_connection_{create,destroy}_mem_pools()Stefan Metzmacher1-0/+107
This is based on smb_direct_{create,destroy}_pools() in the server. But it doesn't use smbdirect_connection_get_recv_io() on cleanup, instead it uses list_for_each_entry_safe()... It also keep some logic to allow userspace access to smbdirect_recv_io payload, which is needed for the client code. But it exposes 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. This should replace the related server functions and also be used on the client. It also abstracts recv_io.mem.gfp_mask in order to allow server to keep using __GFP_RETRY_MAYFAIL. It also uses struct kmem_cache_args consistently as that's the currently preferred version of kmem_cache_create(). And it makes use of the mempool_create_slab_pool() helper. And it uses list_add_tail() just to let me feel better when looking at the code... 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>
8 dayssmb: smbdirect: introduce smbdirect_connection_send_io_done()Stefan Metzmacher1-0/+70
This is a combination of send_done() of client and server. It will replace both... 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>
8 dayssmb: smbdirect: introduce smbdirect_connection_{alloc,free}_send_io()Stefan Metzmacher1-0/+47
These are more or less copies of smb_direct_{alloc,free}_sendmsg() in 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 have in inconsistency like that in the client code where we use ib_dma_unmap_single(), while we mapped using ib_dma_map_page(). The new functions will replace the existing once in the next commits and will also be used in the client. 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>
8 dayssmb: smbdirect: introduce smbdirect_socket.{send,recv}_io.mem.gfp_maskStefan Metzmacher1-4/+10
This will allow common code to be split out while still using the gfp_mask currently used. 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>
8 dayssmb: smbdirect: introduce smbdirect_frwr_is_supported()Stefan Metzmacher1-0/+16
This will replace frwr_is_supported() on the client and rdma_frwr_is_supported() on 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>
8 dayssmb: smbdirect: set SMBDIRECT_KEEPALIVE_NONE before ↵Stefan Metzmacher1-0/+2
disable_delayed_work(&sc->idle.timer_work); This avoids a potential confusing log message from smbdirect_connection_idle_timer_work() if it's already running. This is a very small race windows and not really needed, but it feels better when reading the code. 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>
8 dayssmb: smbdirect: introduce smbdirect_connection_idle_timer_work()Stefan Metzmacher3-1/+35
This is basically a copy of idle_connection_timer() in the client and smb_direct_idle_connection_timer() in the server. The only difference is that the server does not have logging. Currently the callers set their own timer function after smbdirect_socket_prepare_create(), but that will change 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>
8 dayssmb: smbdirect: introduce ↵Stefan Metzmacher1-0/+35
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>
8 dayssmb: smbdirect: introduce smbdirect_connection_{get,put}_recv_io()Stefan Metzmacher1-0/+42
These are basically copies of {get,put}_receive_buffer() in the client and they are very similar to {get_free,put}_recvmsg() in the server. The only difference to {get_free,put}_recvmsg() are the updating of the sc->statistics.*. In addition smbdirect_connection_get_recv_io() uses list_first_entry_or_null() in order to simplify the code. We also only use it on a healthy connection. smbdirect_connection_put_recv_io() uses msg->socket instead of an explicit argument. And it disables any complex_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>
8 dayssmb: smbdirect: introduce smbdirect_connection.c to be filledStefan Metzmacher2-0/+8
Over time smbdirect_connection.c will get more and more functions which will be included in fs/smb/client/smbdirect.c and fs/smb/server/transport_rdma.c via fs/smb/common/smbdirect/smbdirect_all_c_files.c in order to allow tiny steps in the direction of moving to a few exported functions from an smbdirect.ko. That's why __maybe_unused is added for now it will be removed at the end of the road to common code. Note the Copyright (C) 2017, Microsoft Corporation is added as a lot of functions from fs/smb/client/smbdirect.c will be moved into this file soon and I don't want to forget about adding it. 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>
8 dayssmb: smbdirect: introduce smbdirect_socket_schedule_cleanup[{_lvl,_status}]()Stefan Metzmacher3-0/+122
smbdirect_socket_schedule_cleanup() is more or less copy of smbd_disconnect_rdma_connection() and smb_direct_disconnect_rdma_connection(). It will replace them in the next steps. A difference is that the location of the first error is logged, which makes it easier to analyze problems. And also disable any complex work from recv_io objects, currently these are not used and the work is always disabled anyway, but this prepares future changes. It also gets an explicit error passed in instead of hardcoding -ECONNABORTED. Beside the main smbdirect_socket_schedule_cleanup() there are some special additions: - smbdirect_socket_schedule_cleanup_lvl(), will be used for cases where we don't want a log message with SMBDIRECT_LOG_ERR. - smbdirect_socket_schedule_cleanup_status(), will be used to specify the log level together with a direct final status, for the RDMA_CM_EVENT_DEVICE_REMOVAL and RDMA_CM_EVENT_DISCONNECTED cases where we need to avoid SMBDIRECT_SOCKET_DISCONNECTING and rdma_disconnect() in smbdirect_socket_cleanup_work(). With this we're also able to define a default for __SMBDIRECT_SOCKET_DISCONNECT() just using: smbdirect_socket_schedule_cleanup(__sc, -ECONNABORTED) 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>
8 dayssmb: smbdirect: introduce smbdirect_socket_cleanup_work()Stefan Metzmacher1-1/+74
This is basically a copy of smbd_disconnect_rdma_work() and smb_direct_disconnect_rdma_work() and will replace them in the next steps. Differences is that a message is logged if first error is still 0, which makes it easier to analyze problems. And also disable any complex work from recv_io objects, currently these are not used and the work is always disabled anyway, but this prepares future changes. It also makes sure it's never used in an interrupt, which is not expected 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>
8 dayssmb: smbdirect: introduce smbdirect_socket_wake_up_all()Stefan Metzmacher1-0/+19
This is a superset of smbd_disconnect_wake_up_all() in the client and smb_direct_disconnect_wake_up_all() in the server and will replace 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>
8 dayssmb: smbdirect: introduce smbdirect_socket_set_logging()Stefan Metzmacher1-0/+20
This will be used by client and server in order to setup their own logging 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>
8 dayssmb: smbdirect: introduce smbdirect_socket_prepare_create()Stefan Metzmacher1-0/+19
This will be used by client and server until we reach the point where we have only public function from an smbdirect.ko. 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>
8 dayssmb: smbdirect: introduce smbdirect_socket.c to be filledStefan Metzmacher2-0/+8
Over time smbdirect_socket.c will get more and more functions which will be included in fs/smb/client/smbdirect.c and fs/smb/server/transport_rdma.c via fs/smb/common/smbdirect/smbdirect_all_c_files.c in order to allow tiny steps in the direction of moving to a few exported functions from an smbdirect.ko. That's why __maybe_unused is added for now it will be removed at the end of the road to common code. Note the Copyright (C) 2017, Microsoft Corporation is added as a lot of functions from fs/smb/client/smbdirect.c will be moved into this file soon and I don't want to forget about adding it. 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>
8 dayssmb: server: include smbdirect_all_c_files.cStefan Metzmacher1-0/+12
This is the first tiny step in order to use common functions in future. Once we have all functions in common we'll move to an smbdirect.ko that exports public functions instead of including the .c file. 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>
8 dayssmb: client: include smbdirect_all_c_files.cStefan Metzmacher2-0/+14
This is the first tiny step in order to use common functions in future. Once we have all functions in common we'll move to an smbdirect.ko that exports public functions instead of including the .c file. 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: Arnd Bergmann <arnd@arndb.de> 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>
8 dayssmb: smbdirect: introduce smbdirect_internal.hStefan Metzmacher1-0/+13
This will be included by individual .c files as first header. 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>