Lines Matching +full:pre +full:- +full:processing

1 // SPDX-License-Identifier: GPL-2.0-or-later
44 return -EINVAL; in ___server_conf_set()
47 return -EINVAL; in ___server_conf_set()
52 return -ENOMEM; in ___server_conf_set()
87 * check_conn_state() - check state of server thread connection
96 if (ksmbd_conn_exiting(work->conn) || in check_conn_state()
97 ksmbd_conn_need_reconnect(work->conn)) { in check_conn_state()
98 rsp_hdr = work->response_buf; in check_conn_state()
99 rsp_hdr->Status.CifsError = STATUS_CONNECTION_DISCONNECTED; in check_conn_state()
119 conn->ops->set_rsp_status(work, STATUS_INVALID_PARAMETER); in __process_request()
123 command = conn->ops->get_cmd_val(work); in __process_request()
127 if (command >= conn->max_cmds) { in __process_request()
128 conn->ops->set_rsp_status(work, STATUS_INVALID_PARAMETER); in __process_request()
132 cmds = &conn->cmds[command]; in __process_request()
133 if (!cmds->proc) { in __process_request()
135 conn->ops->set_rsp_status(work, STATUS_NOT_IMPLEMENTED); in __process_request()
139 if (work->sess && conn->ops->is_sign_req(work, command)) { in __process_request()
140 ret = conn->ops->check_sign_req(work); in __process_request()
142 conn->ops->set_rsp_status(work, STATUS_ACCESS_DENIED); in __process_request()
147 ret = cmds->proc(work); in __process_request()
151 /* AndX commands - chained request can return positive values */ in __process_request()
158 if (work->send_no_response) in __process_request()
170 if (conn->ops->is_transform_hdr && in __handle_ksmbd_work()
171 conn->ops->is_transform_hdr(work->request_buf)) { in __handle_ksmbd_work()
172 rc = conn->ops->decrypt_req(work); in __handle_ksmbd_work()
175 work->encrypted = true; in __handle_ksmbd_work()
178 if (conn->ops->allocate_rsp_buf(work)) in __handle_ksmbd_work()
181 rc = conn->ops->init_rsp_hdr(work); in __handle_ksmbd_work()
184 conn->ops->set_rsp_status(work, STATUS_INVALID_HANDLE); in __handle_ksmbd_work()
189 if (conn->ops->check_user_session) { in __handle_ksmbd_work()
190 rc = conn->ops->check_user_session(work); in __handle_ksmbd_work()
192 if (rc == -EINVAL) in __handle_ksmbd_work()
193 conn->ops->set_rsp_status(work, in __handle_ksmbd_work()
196 conn->ops->set_rsp_status(work, in __handle_ksmbd_work()
200 rc = conn->ops->get_ksmbd_tcon(work); in __handle_ksmbd_work()
202 if (rc == -EINVAL) in __handle_ksmbd_work()
203 conn->ops->set_rsp_status(work, in __handle_ksmbd_work()
206 conn->ops->set_rsp_status(work, in __handle_ksmbd_work()
221 if (conn->ops->set_rsp_credits) { in __handle_ksmbd_work()
222 spin_lock(&conn->credits_lock); in __handle_ksmbd_work()
223 rc = conn->ops->set_rsp_credits(work); in __handle_ksmbd_work()
224 spin_unlock(&conn->credits_lock); in __handle_ksmbd_work()
226 conn->ops->set_rsp_status(work, in __handle_ksmbd_work()
234 if (work->sess && in __handle_ksmbd_work()
235 (work->sess->sign || smb3_11_final_sess_setup_resp(work) || in __handle_ksmbd_work()
236 conn->ops->is_sign_req(work, command))) in __handle_ksmbd_work()
237 conn->ops->set_sign_rsp(work); in __handle_ksmbd_work()
241 if (work->tcon) in __handle_ksmbd_work()
242 ksmbd_tree_connect_put(work->tcon); in __handle_ksmbd_work()
244 if (work->sess) in __handle_ksmbd_work()
245 ksmbd_user_session_put(work->sess); in __handle_ksmbd_work()
246 if (work->sess && work->sess->enc && work->encrypted && in __handle_ksmbd_work()
247 conn->ops->encrypt_resp) { in __handle_ksmbd_work()
248 rc = conn->ops->encrypt_resp(work); in __handle_ksmbd_work()
250 conn->ops->set_rsp_status(work, STATUS_DATA_ERROR); in __handle_ksmbd_work()
257 * handle_ksmbd_work() - process pending smb work requests
260 * called by kworker threads to processing remaining smb work requests
265 struct ksmbd_conn *conn = work->conn; in handle_ksmbd_work()
267 atomic64_inc(&conn->stats.request_served); in handle_ksmbd_work()
273 atomic_dec(&conn->mux_smb_requests); in handle_ksmbd_work()
279 if (!atomic_dec_return(&conn->r_count) && waitqueue_active(&conn->r_count_q)) in handle_ksmbd_work()
280 wake_up(&conn->r_count_q); in handle_ksmbd_work()
284 * queue_ksmbd_work() - queue a smb request to worker thread queue
285 * for processing smb command and sending response
299 if (atomic_inc_return(&conn->mux_smb_requests) >= conn->vals->max_credits) { in queue_ksmbd_work()
300 atomic_dec_return(&conn->mux_smb_requests); in queue_ksmbd_work()
301 return -ENOSPC; in queue_ksmbd_work()
307 return -ENOMEM; in queue_ksmbd_work()
310 work->conn = conn; in queue_ksmbd_work()
311 work->request_buf = conn->request_buf; in queue_ksmbd_work()
312 conn->request_buf = NULL; in queue_ksmbd_work()
315 atomic_inc(&conn->r_count); in queue_ksmbd_work()
317 conn->last_active = jiffies; in queue_ksmbd_work()
318 INIT_WORK(&work->work, handle_ksmbd_work); in queue_ksmbd_work()
399 switch (ctrl->type) { in server_ctrl_handle_work()
407 pr_err("Unknown server work type: %d\n", ctrl->type); in server_ctrl_handle_work()
420 return -ENOMEM; in __queue_ctrl_work()
423 ctrl->type = type; in __queue_ctrl_work()
424 INIT_WORK(&ctrl->ctrl_work, server_ctrl_handle_work); in __queue_ctrl_work()
425 queue_work(system_long_wq, &ctrl->ctrl_work); in __queue_ctrl_work()
536 .name = "ksmbd-control",
563 pr_err("Unable to register ksmbd-control class\n"); in ksmbd_server_init()
622 * ksmbd_server_exit() - shutdown forker thread and free memory at module exit
634 MODULE_SOFTDEP("pre: ecb");
635 MODULE_SOFTDEP("pre: hmac");
636 MODULE_SOFTDEP("pre: md5");
637 MODULE_SOFTDEP("pre: nls");
638 MODULE_SOFTDEP("pre: aes");
639 MODULE_SOFTDEP("pre: cmac");
640 MODULE_SOFTDEP("pre: sha256");
641 MODULE_SOFTDEP("pre: sha512");
642 MODULE_SOFTDEP("pre: aead2");
643 MODULE_SOFTDEP("pre: ccm");
644 MODULE_SOFTDEP("pre: gcm");
645 MODULE_SOFTDEP("pre: crc32");