Lines Matching full:queue

66  * queue before determining it to be idle.  This optional module behavior
110 struct nvmet_tcp_queue *queue; member
221 static inline u16 nvmet_tcp_cmd_tag(struct nvmet_tcp_queue *queue, in nvmet_tcp_cmd_tag() argument
224 if (unlikely(!queue->nr_cmds)) { in nvmet_tcp_cmd_tag()
229 return cmd - queue->cmds; in nvmet_tcp_cmd_tag()
257 nvmet_tcp_get_cmd(struct nvmet_tcp_queue *queue) in nvmet_tcp_get_cmd() argument
261 cmd = list_first_entry_or_null(&queue->free_list, in nvmet_tcp_get_cmd()
277 if (unlikely(cmd == &cmd->queue->connect)) in nvmet_tcp_put_cmd()
280 list_add_tail(&cmd->entry, &cmd->queue->free_list); in nvmet_tcp_put_cmd()
283 static inline int queue_cpu(struct nvmet_tcp_queue *queue) in queue_cpu() argument
285 return queue->sock->sk->sk_incoming_cpu; in queue_cpu()
288 static inline u8 nvmet_tcp_hdgst_len(struct nvmet_tcp_queue *queue) in nvmet_tcp_hdgst_len() argument
290 return queue->hdr_digest ? NVME_TCP_DIGEST_LENGTH : 0; in nvmet_tcp_hdgst_len()
293 static inline u8 nvmet_tcp_ddgst_len(struct nvmet_tcp_queue *queue) in nvmet_tcp_ddgst_len() argument
295 return queue->data_digest ? NVME_TCP_DIGEST_LENGTH : 0; in nvmet_tcp_ddgst_len()
308 static int nvmet_tcp_verify_hdgst(struct nvmet_tcp_queue *queue, in nvmet_tcp_verify_hdgst() argument
316 pr_err("queue %d: header digest enabled but no header digest\n", in nvmet_tcp_verify_hdgst()
317 queue->idx); in nvmet_tcp_verify_hdgst()
322 nvmet_tcp_hdgst(queue->rcv_hash, pdu, len); in nvmet_tcp_verify_hdgst()
325 pr_err("queue %d: header digest error: recv %#x expected %#x\n", in nvmet_tcp_verify_hdgst()
326 queue->idx, le32_to_cpu(recv_digest), in nvmet_tcp_verify_hdgst()
334 static int nvmet_tcp_check_ddgst(struct nvmet_tcp_queue *queue, void *pdu) in nvmet_tcp_check_ddgst() argument
337 u8 digest_len = nvmet_tcp_hdgst_len(queue); in nvmet_tcp_check_ddgst()
344 pr_err("queue %d: data digest flag is cleared\n", queue->idx); in nvmet_tcp_check_ddgst()
390 static void nvmet_tcp_fatal_error(struct nvmet_tcp_queue *queue) in nvmet_tcp_fatal_error() argument
392 queue->rcv_state = NVMET_TCP_RECV_ERR; in nvmet_tcp_fatal_error()
393 if (queue->nvme_sq.ctrl) in nvmet_tcp_fatal_error()
394 nvmet_ctrl_fatal_error(queue->nvme_sq.ctrl); in nvmet_tcp_fatal_error()
396 kernel_sock_shutdown(queue->sock, SHUT_RDWR); in nvmet_tcp_fatal_error()
399 static void nvmet_tcp_socket_error(struct nvmet_tcp_queue *queue, int status) in nvmet_tcp_socket_error() argument
401 queue->rcv_state = NVMET_TCP_RECV_ERR; in nvmet_tcp_socket_error()
403 kernel_sock_shutdown(queue->sock, SHUT_RDWR); in nvmet_tcp_socket_error()
405 nvmet_tcp_fatal_error(queue); in nvmet_tcp_socket_error()
456 struct nvmet_tcp_queue *queue = cmd->queue; in nvmet_setup_c2h_data_pdu() local
457 u8 hdgst = nvmet_tcp_hdgst_len(cmd->queue); in nvmet_setup_c2h_data_pdu()
458 u8 ddgst = nvmet_tcp_ddgst_len(cmd->queue); in nvmet_setup_c2h_data_pdu()
464 pdu->hdr.flags = NVME_TCP_F_DATA_LAST | (queue->nvme_sq.sqhd_disabled ? in nvmet_setup_c2h_data_pdu()
475 if (queue->data_digest) { in nvmet_setup_c2h_data_pdu()
477 nvmet_tcp_calc_ddgst(queue->snd_hash, cmd); in nvmet_setup_c2h_data_pdu()
480 if (cmd->queue->hdr_digest) { in nvmet_setup_c2h_data_pdu()
482 nvmet_tcp_hdgst(queue->snd_hash, pdu, sizeof(*pdu)); in nvmet_setup_c2h_data_pdu()
489 struct nvmet_tcp_queue *queue = cmd->queue; in nvmet_setup_r2t_pdu() local
490 u8 hdgst = nvmet_tcp_hdgst_len(cmd->queue); in nvmet_setup_r2t_pdu()
502 pdu->ttag = nvmet_tcp_cmd_tag(cmd->queue, cmd); in nvmet_setup_r2t_pdu()
505 if (cmd->queue->hdr_digest) { in nvmet_setup_r2t_pdu()
507 nvmet_tcp_hdgst(queue->snd_hash, pdu, sizeof(*pdu)); in nvmet_setup_r2t_pdu()
514 struct nvmet_tcp_queue *queue = cmd->queue; in nvmet_setup_response_pdu() local
515 u8 hdgst = nvmet_tcp_hdgst_len(cmd->queue); in nvmet_setup_response_pdu()
525 if (cmd->queue->hdr_digest) { in nvmet_setup_response_pdu()
527 nvmet_tcp_hdgst(queue->snd_hash, pdu, sizeof(*pdu)); in nvmet_setup_response_pdu()
531 static void nvmet_tcp_process_resp_list(struct nvmet_tcp_queue *queue) in nvmet_tcp_process_resp_list() argument
536 for (node = llist_del_all(&queue->resp_list); node; node = node->next) { in nvmet_tcp_process_resp_list()
538 list_add(&cmd->entry, &queue->resp_send_list); in nvmet_tcp_process_resp_list()
539 queue->send_list_len++; in nvmet_tcp_process_resp_list()
543 static struct nvmet_tcp_cmd *nvmet_tcp_fetch_cmd(struct nvmet_tcp_queue *queue) in nvmet_tcp_fetch_cmd() argument
545 queue->snd_cmd = list_first_entry_or_null(&queue->resp_send_list, in nvmet_tcp_fetch_cmd()
547 if (!queue->snd_cmd) { in nvmet_tcp_fetch_cmd()
548 nvmet_tcp_process_resp_list(queue); in nvmet_tcp_fetch_cmd()
549 queue->snd_cmd = in nvmet_tcp_fetch_cmd()
550 list_first_entry_or_null(&queue->resp_send_list, in nvmet_tcp_fetch_cmd()
552 if (unlikely(!queue->snd_cmd)) in nvmet_tcp_fetch_cmd()
556 list_del_init(&queue->snd_cmd->entry); in nvmet_tcp_fetch_cmd()
557 queue->send_list_len--; in nvmet_tcp_fetch_cmd()
559 if (nvmet_tcp_need_data_out(queue->snd_cmd)) in nvmet_tcp_fetch_cmd()
560 nvmet_setup_c2h_data_pdu(queue->snd_cmd); in nvmet_tcp_fetch_cmd()
561 else if (nvmet_tcp_need_data_in(queue->snd_cmd)) in nvmet_tcp_fetch_cmd()
562 nvmet_setup_r2t_pdu(queue->snd_cmd); in nvmet_tcp_fetch_cmd()
564 nvmet_setup_response_pdu(queue->snd_cmd); in nvmet_tcp_fetch_cmd()
566 return queue->snd_cmd; in nvmet_tcp_fetch_cmd()
573 struct nvmet_tcp_queue *queue = cmd->queue; in nvmet_tcp_queue_response() local
577 if (unlikely(cmd == queue->cmd)) { in nvmet_tcp_queue_response()
586 if (queue->rcv_state == NVMET_TCP_RECV_PDU && in nvmet_tcp_queue_response()
592 llist_add(&cmd->lentry, &queue->resp_list); in nvmet_tcp_queue_response()
593 queue_work_on(queue_cpu(queue), nvmet_tcp_wq, &cmd->queue->io_work); in nvmet_tcp_queue_response()
610 u8 hdgst = nvmet_tcp_hdgst_len(cmd->queue); in nvmet_try_send_data_pdu()
616 ret = sock_sendmsg(cmd->queue->sock, &msg); in nvmet_try_send_data_pdu()
633 struct nvmet_tcp_queue *queue = cmd->queue; in nvmet_try_send_data() local
644 if ((!last_in_batch && cmd->queue->send_list_len) || in nvmet_try_send_data()
646 queue->data_digest || !queue->nvme_sq.sqhd_disabled) in nvmet_try_send_data()
651 ret = sock_sendmsg(cmd->queue->sock, &msg); in nvmet_try_send_data()
665 if (queue->data_digest) { in nvmet_try_send_data()
669 if (queue->nvme_sq.sqhd_disabled) { in nvmet_try_send_data()
670 cmd->queue->snd_cmd = NULL; in nvmet_try_send_data()
677 if (queue->nvme_sq.sqhd_disabled) in nvmet_try_send_data()
689 u8 hdgst = nvmet_tcp_hdgst_len(cmd->queue); in nvmet_try_send_response()
693 if (!last_in_batch && cmd->queue->send_list_len) in nvmet_try_send_response()
700 ret = sock_sendmsg(cmd->queue->sock, &msg); in nvmet_try_send_response()
710 cmd->queue->snd_cmd = NULL; in nvmet_try_send_response()
719 u8 hdgst = nvmet_tcp_hdgst_len(cmd->queue); in nvmet_try_send_r2t()
723 if (!last_in_batch && cmd->queue->send_list_len) in nvmet_try_send_r2t()
730 ret = sock_sendmsg(cmd->queue->sock, &msg); in nvmet_try_send_r2t()
739 cmd->queue->snd_cmd = NULL; in nvmet_try_send_r2t()
745 struct nvmet_tcp_queue *queue = cmd->queue; in nvmet_try_send_ddgst() local
754 if (!last_in_batch && cmd->queue->send_list_len) in nvmet_try_send_ddgst()
759 ret = kernel_sendmsg(queue->sock, &msg, &iov, 1, iov.iov_len); in nvmet_try_send_ddgst()
769 if (queue->nvme_sq.sqhd_disabled) { in nvmet_try_send_ddgst()
770 cmd->queue->snd_cmd = NULL; in nvmet_try_send_ddgst()
778 static int nvmet_tcp_try_send_one(struct nvmet_tcp_queue *queue, in nvmet_tcp_try_send_one() argument
781 struct nvmet_tcp_cmd *cmd = queue->snd_cmd; in nvmet_tcp_try_send_one()
784 if (!cmd || queue->state == NVMET_TCP_Q_DISCONNECTING) { in nvmet_tcp_try_send_one()
785 cmd = nvmet_tcp_fetch_cmd(queue); in nvmet_tcp_try_send_one()
827 static int nvmet_tcp_try_send(struct nvmet_tcp_queue *queue, in nvmet_tcp_try_send() argument
833 ret = nvmet_tcp_try_send_one(queue, i == budget - 1); in nvmet_tcp_try_send()
835 nvmet_tcp_socket_error(queue, ret); in nvmet_tcp_try_send()
846 static void nvmet_prepare_receive_pdu(struct nvmet_tcp_queue *queue) in nvmet_prepare_receive_pdu() argument
848 queue->offset = 0; in nvmet_prepare_receive_pdu()
849 queue->left = sizeof(struct nvme_tcp_hdr); in nvmet_prepare_receive_pdu()
850 queue->cmd = NULL; in nvmet_prepare_receive_pdu()
851 queue->rcv_state = NVMET_TCP_RECV_PDU; in nvmet_prepare_receive_pdu()
854 static void nvmet_tcp_free_crypto(struct nvmet_tcp_queue *queue) in nvmet_tcp_free_crypto() argument
856 struct crypto_ahash *tfm = crypto_ahash_reqtfm(queue->rcv_hash); in nvmet_tcp_free_crypto()
858 ahash_request_free(queue->rcv_hash); in nvmet_tcp_free_crypto()
859 ahash_request_free(queue->snd_hash); in nvmet_tcp_free_crypto()
863 static int nvmet_tcp_alloc_crypto(struct nvmet_tcp_queue *queue) in nvmet_tcp_alloc_crypto() argument
871 queue->snd_hash = ahash_request_alloc(tfm, GFP_KERNEL); in nvmet_tcp_alloc_crypto()
872 if (!queue->snd_hash) in nvmet_tcp_alloc_crypto()
874 ahash_request_set_callback(queue->snd_hash, 0, NULL, NULL); in nvmet_tcp_alloc_crypto()
876 queue->rcv_hash = ahash_request_alloc(tfm, GFP_KERNEL); in nvmet_tcp_alloc_crypto()
877 if (!queue->rcv_hash) in nvmet_tcp_alloc_crypto()
879 ahash_request_set_callback(queue->rcv_hash, 0, NULL, NULL); in nvmet_tcp_alloc_crypto()
883 ahash_request_free(queue->snd_hash); in nvmet_tcp_alloc_crypto()
890 static int nvmet_tcp_handle_icreq(struct nvmet_tcp_queue *queue) in nvmet_tcp_handle_icreq() argument
892 struct nvme_tcp_icreq_pdu *icreq = &queue->pdu.icreq; in nvmet_tcp_handle_icreq()
893 struct nvme_tcp_icresp_pdu *icresp = &queue->pdu.icresp; in nvmet_tcp_handle_icreq()
901 nvmet_tcp_fatal_error(queue); in nvmet_tcp_handle_icreq()
906 pr_err("queue %d: bad pfv %d\n", queue->idx, icreq->pfv); in nvmet_tcp_handle_icreq()
911 pr_err("queue %d: unsupported hpda %d\n", queue->idx, in nvmet_tcp_handle_icreq()
916 queue->hdr_digest = !!(icreq->digest & NVME_TCP_HDR_DIGEST_ENABLE); in nvmet_tcp_handle_icreq()
917 queue->data_digest = !!(icreq->digest & NVME_TCP_DATA_DIGEST_ENABLE); in nvmet_tcp_handle_icreq()
918 if (queue->hdr_digest || queue->data_digest) { in nvmet_tcp_handle_icreq()
919 ret = nvmet_tcp_alloc_crypto(queue); in nvmet_tcp_handle_icreq()
932 if (queue->hdr_digest) in nvmet_tcp_handle_icreq()
934 if (queue->data_digest) in nvmet_tcp_handle_icreq()
939 ret = kernel_sendmsg(queue->sock, &msg, &iov, 1, iov.iov_len); in nvmet_tcp_handle_icreq()
941 queue->state = NVMET_TCP_Q_FAILED; in nvmet_tcp_handle_icreq()
942 return ret; /* queue removal will cleanup */ in nvmet_tcp_handle_icreq()
945 queue->state = NVMET_TCP_Q_LIVE; in nvmet_tcp_handle_icreq()
946 nvmet_prepare_receive_pdu(queue); in nvmet_tcp_handle_icreq()
950 static void nvmet_tcp_handle_req_failure(struct nvmet_tcp_queue *queue, in nvmet_tcp_handle_req_failure() argument
965 nvmet_prepare_receive_pdu(queue); in nvmet_tcp_handle_req_failure()
971 pr_err("queue %d: failed to map data\n", queue->idx); in nvmet_tcp_handle_req_failure()
972 nvmet_tcp_fatal_error(queue); in nvmet_tcp_handle_req_failure()
976 queue->rcv_state = NVMET_TCP_RECV_DATA; in nvmet_tcp_handle_req_failure()
981 static int nvmet_tcp_handle_h2c_data_pdu(struct nvmet_tcp_queue *queue) in nvmet_tcp_handle_h2c_data_pdu() argument
983 struct nvme_tcp_data_pdu *data = &queue->pdu.data; in nvmet_tcp_handle_h2c_data_pdu()
987 if (likely(queue->nr_cmds)) { in nvmet_tcp_handle_h2c_data_pdu()
988 if (unlikely(data->ttag >= queue->nr_cmds)) { in nvmet_tcp_handle_h2c_data_pdu()
989 pr_err("queue %d: received out of bound ttag %u, nr_cmds %u\n", in nvmet_tcp_handle_h2c_data_pdu()
990 queue->idx, data->ttag, queue->nr_cmds); in nvmet_tcp_handle_h2c_data_pdu()
993 cmd = &queue->cmds[data->ttag]; in nvmet_tcp_handle_h2c_data_pdu()
995 cmd = &queue->connect; in nvmet_tcp_handle_h2c_data_pdu()
1006 nvmet_tcp_hdgst_len(queue) - in nvmet_tcp_handle_h2c_data_pdu()
1007 nvmet_tcp_ddgst_len(queue) - in nvmet_tcp_handle_h2c_data_pdu()
1019 queue->cmd = cmd; in nvmet_tcp_handle_h2c_data_pdu()
1020 queue->rcv_state = NVMET_TCP_RECV_DATA; in nvmet_tcp_handle_h2c_data_pdu()
1026 nvmet_tcp_fatal_error(queue); in nvmet_tcp_handle_h2c_data_pdu()
1030 static int nvmet_tcp_done_recv_pdu(struct nvmet_tcp_queue *queue) in nvmet_tcp_done_recv_pdu() argument
1032 struct nvme_tcp_hdr *hdr = &queue->pdu.cmd.hdr; in nvmet_tcp_done_recv_pdu()
1033 struct nvme_command *nvme_cmd = &queue->pdu.cmd.cmd; in nvmet_tcp_done_recv_pdu()
1037 if (unlikely(queue->state == NVMET_TCP_Q_CONNECTING)) { in nvmet_tcp_done_recv_pdu()
1041 nvmet_tcp_fatal_error(queue); in nvmet_tcp_done_recv_pdu()
1044 return nvmet_tcp_handle_icreq(queue); in nvmet_tcp_done_recv_pdu()
1048 pr_err("queue %d: received icreq pdu in state %d\n", in nvmet_tcp_done_recv_pdu()
1049 queue->idx, queue->state); in nvmet_tcp_done_recv_pdu()
1050 nvmet_tcp_fatal_error(queue); in nvmet_tcp_done_recv_pdu()
1055 ret = nvmet_tcp_handle_h2c_data_pdu(queue); in nvmet_tcp_done_recv_pdu()
1061 queue->cmd = nvmet_tcp_get_cmd(queue); in nvmet_tcp_done_recv_pdu()
1062 if (unlikely(!queue->cmd)) { in nvmet_tcp_done_recv_pdu()
1064 pr_err("queue %d: out of commands (%d) send_list_len: %d, opcode: %d", in nvmet_tcp_done_recv_pdu()
1065 queue->idx, queue->nr_cmds, queue->send_list_len, in nvmet_tcp_done_recv_pdu()
1067 nvmet_tcp_fatal_error(queue); in nvmet_tcp_done_recv_pdu()
1071 req = &queue->cmd->req; in nvmet_tcp_done_recv_pdu()
1074 if (unlikely(!nvmet_req_init(req, &queue->nvme_cq, in nvmet_tcp_done_recv_pdu()
1075 &queue->nvme_sq, &nvmet_tcp_ops))) { in nvmet_tcp_done_recv_pdu()
1081 nvmet_tcp_handle_req_failure(queue, queue->cmd, req); in nvmet_tcp_done_recv_pdu()
1085 ret = nvmet_tcp_map_data(queue->cmd); in nvmet_tcp_done_recv_pdu()
1087 pr_err("queue %d: failed to map data\n", queue->idx); in nvmet_tcp_done_recv_pdu()
1088 if (nvmet_tcp_has_inline_data(queue->cmd)) in nvmet_tcp_done_recv_pdu()
1089 nvmet_tcp_fatal_error(queue); in nvmet_tcp_done_recv_pdu()
1096 if (nvmet_tcp_need_data_in(queue->cmd)) { in nvmet_tcp_done_recv_pdu()
1097 if (nvmet_tcp_has_inline_data(queue->cmd)) { in nvmet_tcp_done_recv_pdu()
1098 queue->rcv_state = NVMET_TCP_RECV_DATA; in nvmet_tcp_done_recv_pdu()
1099 nvmet_tcp_build_pdu_iovec(queue->cmd); in nvmet_tcp_done_recv_pdu()
1103 nvmet_tcp_queue_response(&queue->cmd->req); in nvmet_tcp_done_recv_pdu()
1107 queue->cmd->req.execute(&queue->cmd->req); in nvmet_tcp_done_recv_pdu()
1109 nvmet_prepare_receive_pdu(queue); in nvmet_tcp_done_recv_pdu()
1141 static int nvmet_tcp_tls_record_ok(struct nvmet_tcp_queue *queue, in nvmet_tcp_tls_record_ok() argument
1148 ctype = tls_get_record_type(queue->sock->sk, cmsg); in nvmet_tcp_tls_record_ok()
1155 tls_alert_recv(queue->sock->sk, msg, &level, &description); in nvmet_tcp_tls_record_ok()
1157 pr_err("queue %d: TLS Alert desc %u\n", in nvmet_tcp_tls_record_ok()
1158 queue->idx, description); in nvmet_tcp_tls_record_ok()
1161 pr_warn("queue %d: TLS Alert desc %u\n", in nvmet_tcp_tls_record_ok()
1162 queue->idx, description); in nvmet_tcp_tls_record_ok()
1168 pr_err("queue %d: TLS record %d unhandled\n", in nvmet_tcp_tls_record_ok()
1169 queue->idx, ctype); in nvmet_tcp_tls_record_ok()
1176 static int nvmet_tcp_try_recv_pdu(struct nvmet_tcp_queue *queue) in nvmet_tcp_try_recv_pdu() argument
1178 struct nvme_tcp_hdr *hdr = &queue->pdu.cmd.hdr; in nvmet_tcp_try_recv_pdu()
1185 iov.iov_base = (void *)&queue->pdu + queue->offset; in nvmet_tcp_try_recv_pdu()
1186 iov.iov_len = queue->left; in nvmet_tcp_try_recv_pdu()
1187 if (queue->tls_pskid) { in nvmet_tcp_try_recv_pdu()
1191 len = kernel_recvmsg(queue->sock, &msg, &iov, 1, in nvmet_tcp_try_recv_pdu()
1195 if (queue->tls_pskid) { in nvmet_tcp_try_recv_pdu()
1196 ret = nvmet_tcp_tls_record_ok(queue, &msg, cbuf); in nvmet_tcp_try_recv_pdu()
1201 queue->offset += len; in nvmet_tcp_try_recv_pdu()
1202 queue->left -= len; in nvmet_tcp_try_recv_pdu()
1203 if (queue->left) in nvmet_tcp_try_recv_pdu()
1206 if (queue->offset == sizeof(struct nvme_tcp_hdr)) { in nvmet_tcp_try_recv_pdu()
1207 u8 hdgst = nvmet_tcp_hdgst_len(queue); in nvmet_tcp_try_recv_pdu()
1211 nvmet_tcp_fatal_error(queue); in nvmet_tcp_try_recv_pdu()
1220 queue->left = hdr->hlen - queue->offset + hdgst; in nvmet_tcp_try_recv_pdu()
1224 if (queue->hdr_digest && in nvmet_tcp_try_recv_pdu()
1225 nvmet_tcp_verify_hdgst(queue, &queue->pdu, hdr->hlen)) { in nvmet_tcp_try_recv_pdu()
1226 nvmet_tcp_fatal_error(queue); /* fatal */ in nvmet_tcp_try_recv_pdu()
1230 if (queue->data_digest && in nvmet_tcp_try_recv_pdu()
1231 nvmet_tcp_check_ddgst(queue, &queue->pdu)) { in nvmet_tcp_try_recv_pdu()
1232 nvmet_tcp_fatal_error(queue); /* fatal */ in nvmet_tcp_try_recv_pdu()
1236 return nvmet_tcp_done_recv_pdu(queue); in nvmet_tcp_try_recv_pdu()
1241 struct nvmet_tcp_queue *queue = cmd->queue; in nvmet_tcp_prep_recv_ddgst() local
1243 nvmet_tcp_calc_ddgst(queue->rcv_hash, cmd); in nvmet_tcp_prep_recv_ddgst()
1244 queue->offset = 0; in nvmet_tcp_prep_recv_ddgst()
1245 queue->left = NVME_TCP_DIGEST_LENGTH; in nvmet_tcp_prep_recv_ddgst()
1246 queue->rcv_state = NVMET_TCP_RECV_DDGST; in nvmet_tcp_prep_recv_ddgst()
1249 static int nvmet_tcp_try_recv_data(struct nvmet_tcp_queue *queue) in nvmet_tcp_try_recv_data() argument
1251 struct nvmet_tcp_cmd *cmd = queue->cmd; in nvmet_tcp_try_recv_data()
1255 len = sock_recvmsg(cmd->queue->sock, &cmd->recv_msg, in nvmet_tcp_try_recv_data()
1259 if (queue->tls_pskid) { in nvmet_tcp_try_recv_data()
1260 ret = nvmet_tcp_tls_record_ok(cmd->queue, in nvmet_tcp_try_recv_data()
1270 if (queue->data_digest) { in nvmet_tcp_try_recv_data()
1278 nvmet_prepare_receive_pdu(queue); in nvmet_tcp_try_recv_data()
1282 static int nvmet_tcp_try_recv_ddgst(struct nvmet_tcp_queue *queue) in nvmet_tcp_try_recv_ddgst() argument
1284 struct nvmet_tcp_cmd *cmd = queue->cmd; in nvmet_tcp_try_recv_ddgst()
1289 .iov_base = (void *)&cmd->recv_ddgst + queue->offset, in nvmet_tcp_try_recv_ddgst()
1290 .iov_len = queue->left in nvmet_tcp_try_recv_ddgst()
1293 if (queue->tls_pskid) { in nvmet_tcp_try_recv_ddgst()
1297 len = kernel_recvmsg(queue->sock, &msg, &iov, 1, in nvmet_tcp_try_recv_ddgst()
1301 if (queue->tls_pskid) { in nvmet_tcp_try_recv_ddgst()
1302 ret = nvmet_tcp_tls_record_ok(queue, &msg, cbuf); in nvmet_tcp_try_recv_ddgst()
1307 queue->offset += len; in nvmet_tcp_try_recv_ddgst()
1308 queue->left -= len; in nvmet_tcp_try_recv_ddgst()
1309 if (queue->left) in nvmet_tcp_try_recv_ddgst()
1312 if (queue->data_digest && cmd->exp_ddgst != cmd->recv_ddgst) { in nvmet_tcp_try_recv_ddgst()
1313 pr_err("queue %d: cmd %d pdu (%d) data digest error: recv %#x expected %#x\n", in nvmet_tcp_try_recv_ddgst()
1314 queue->idx, cmd->req.cmd->common.command_id, in nvmet_tcp_try_recv_ddgst()
1315 queue->pdu.cmd.hdr.type, le32_to_cpu(cmd->recv_ddgst), in nvmet_tcp_try_recv_ddgst()
1319 nvmet_tcp_fatal_error(queue); in nvmet_tcp_try_recv_ddgst()
1329 nvmet_prepare_receive_pdu(queue); in nvmet_tcp_try_recv_ddgst()
1333 static int nvmet_tcp_try_recv_one(struct nvmet_tcp_queue *queue) in nvmet_tcp_try_recv_one() argument
1337 if (unlikely(queue->rcv_state == NVMET_TCP_RECV_ERR)) in nvmet_tcp_try_recv_one()
1340 if (queue->rcv_state == NVMET_TCP_RECV_PDU) { in nvmet_tcp_try_recv_one()
1341 result = nvmet_tcp_try_recv_pdu(queue); in nvmet_tcp_try_recv_one()
1346 if (queue->rcv_state == NVMET_TCP_RECV_DATA) { in nvmet_tcp_try_recv_one()
1347 result = nvmet_tcp_try_recv_data(queue); in nvmet_tcp_try_recv_one()
1352 if (queue->rcv_state == NVMET_TCP_RECV_DDGST) { in nvmet_tcp_try_recv_one()
1353 result = nvmet_tcp_try_recv_ddgst(queue); in nvmet_tcp_try_recv_one()
1367 static int nvmet_tcp_try_recv(struct nvmet_tcp_queue *queue, in nvmet_tcp_try_recv() argument
1373 ret = nvmet_tcp_try_recv_one(queue); in nvmet_tcp_try_recv()
1375 nvmet_tcp_socket_error(queue, ret); in nvmet_tcp_try_recv()
1388 struct nvmet_tcp_queue *queue = in nvmet_tcp_release_queue() local
1391 WARN_ON(queue->state != NVMET_TCP_Q_DISCONNECTING); in nvmet_tcp_release_queue()
1392 queue_work(nvmet_wq, &queue->release_work); in nvmet_tcp_release_queue()
1395 static void nvmet_tcp_schedule_release_queue(struct nvmet_tcp_queue *queue) in nvmet_tcp_schedule_release_queue() argument
1397 spin_lock_bh(&queue->state_lock); in nvmet_tcp_schedule_release_queue()
1398 if (queue->state == NVMET_TCP_Q_TLS_HANDSHAKE) { in nvmet_tcp_schedule_release_queue()
1400 tls_handshake_cancel(queue->sock->sk); in nvmet_tcp_schedule_release_queue()
1402 if (queue->state != NVMET_TCP_Q_DISCONNECTING) { in nvmet_tcp_schedule_release_queue()
1403 queue->state = NVMET_TCP_Q_DISCONNECTING; in nvmet_tcp_schedule_release_queue()
1404 kref_put(&queue->kref, nvmet_tcp_release_queue); in nvmet_tcp_schedule_release_queue()
1406 spin_unlock_bh(&queue->state_lock); in nvmet_tcp_schedule_release_queue()
1409 static inline void nvmet_tcp_arm_queue_deadline(struct nvmet_tcp_queue *queue) in nvmet_tcp_arm_queue_deadline() argument
1411 queue->poll_end = jiffies + usecs_to_jiffies(idle_poll_period_usecs); in nvmet_tcp_arm_queue_deadline()
1414 static bool nvmet_tcp_check_queue_deadline(struct nvmet_tcp_queue *queue, in nvmet_tcp_check_queue_deadline() argument
1421 nvmet_tcp_arm_queue_deadline(queue); in nvmet_tcp_check_queue_deadline()
1423 return !time_after(jiffies, queue->poll_end); in nvmet_tcp_check_queue_deadline()
1428 struct nvmet_tcp_queue *queue = in nvmet_tcp_io_work() local
1436 ret = nvmet_tcp_try_recv(queue, NVMET_TCP_RECV_BUDGET, &ops); in nvmet_tcp_io_work()
1442 ret = nvmet_tcp_try_send(queue, NVMET_TCP_SEND_BUDGET, &ops); in nvmet_tcp_io_work()
1454 if (nvmet_tcp_check_queue_deadline(queue, ops) || pending) in nvmet_tcp_io_work()
1455 queue_work_on(queue_cpu(queue), nvmet_tcp_wq, &queue->io_work); in nvmet_tcp_io_work()
1458 static int nvmet_tcp_alloc_cmd(struct nvmet_tcp_queue *queue, in nvmet_tcp_alloc_cmd() argument
1461 u8 hdgst = nvmet_tcp_hdgst_len(queue); in nvmet_tcp_alloc_cmd()
1463 c->queue = queue; in nvmet_tcp_alloc_cmd()
1464 c->req.port = queue->port->nport; in nvmet_tcp_alloc_cmd()
1466 c->cmd_pdu = page_frag_alloc(&queue->pf_cache, in nvmet_tcp_alloc_cmd()
1472 c->rsp_pdu = page_frag_alloc(&queue->pf_cache, in nvmet_tcp_alloc_cmd()
1478 c->data_pdu = page_frag_alloc(&queue->pf_cache, in nvmet_tcp_alloc_cmd()
1483 c->r2t_pdu = page_frag_alloc(&queue->pf_cache, in nvmet_tcp_alloc_cmd()
1488 if (queue->state == NVMET_TCP_Q_TLS_HANDSHAKE) { in nvmet_tcp_alloc_cmd()
1494 list_add_tail(&c->entry, &queue->free_list); in nvmet_tcp_alloc_cmd()
1514 static int nvmet_tcp_alloc_cmds(struct nvmet_tcp_queue *queue) in nvmet_tcp_alloc_cmds() argument
1517 int i, ret = -EINVAL, nr_cmds = queue->nr_cmds; in nvmet_tcp_alloc_cmds()
1524 ret = nvmet_tcp_alloc_cmd(queue, cmds + i); in nvmet_tcp_alloc_cmds()
1529 queue->cmds = cmds; in nvmet_tcp_alloc_cmds()
1540 static void nvmet_tcp_free_cmds(struct nvmet_tcp_queue *queue) in nvmet_tcp_free_cmds() argument
1542 struct nvmet_tcp_cmd *cmds = queue->cmds; in nvmet_tcp_free_cmds()
1545 for (i = 0; i < queue->nr_cmds; i++) in nvmet_tcp_free_cmds()
1548 nvmet_tcp_free_cmd(&queue->connect); in nvmet_tcp_free_cmds()
1552 static void nvmet_tcp_restore_socket_callbacks(struct nvmet_tcp_queue *queue) in nvmet_tcp_restore_socket_callbacks() argument
1554 struct socket *sock = queue->sock; in nvmet_tcp_restore_socket_callbacks()
1557 sock->sk->sk_data_ready = queue->data_ready; in nvmet_tcp_restore_socket_callbacks()
1558 sock->sk->sk_state_change = queue->state_change; in nvmet_tcp_restore_socket_callbacks()
1559 sock->sk->sk_write_space = queue->write_space; in nvmet_tcp_restore_socket_callbacks()
1564 static void nvmet_tcp_uninit_data_in_cmds(struct nvmet_tcp_queue *queue) in nvmet_tcp_uninit_data_in_cmds() argument
1566 struct nvmet_tcp_cmd *cmd = queue->cmds; in nvmet_tcp_uninit_data_in_cmds()
1569 for (i = 0; i < queue->nr_cmds; i++, cmd++) { in nvmet_tcp_uninit_data_in_cmds()
1574 if (!queue->nr_cmds && nvmet_tcp_need_data_in(&queue->connect)) { in nvmet_tcp_uninit_data_in_cmds()
1576 nvmet_req_uninit(&queue->connect.req); in nvmet_tcp_uninit_data_in_cmds()
1580 static void nvmet_tcp_free_cmd_data_in_buffers(struct nvmet_tcp_queue *queue) in nvmet_tcp_free_cmd_data_in_buffers() argument
1582 struct nvmet_tcp_cmd *cmd = queue->cmds; in nvmet_tcp_free_cmd_data_in_buffers()
1585 for (i = 0; i < queue->nr_cmds; i++, cmd++) in nvmet_tcp_free_cmd_data_in_buffers()
1587 nvmet_tcp_free_cmd_buffers(&queue->connect); in nvmet_tcp_free_cmd_data_in_buffers()
1592 struct nvmet_tcp_queue *queue = in nvmet_tcp_release_queue_work() local
1596 list_del_init(&queue->queue_list); in nvmet_tcp_release_queue_work()
1599 nvmet_tcp_restore_socket_callbacks(queue); in nvmet_tcp_release_queue_work()
1600 cancel_delayed_work_sync(&queue->tls_handshake_tmo_work); in nvmet_tcp_release_queue_work()
1601 cancel_work_sync(&queue->io_work); in nvmet_tcp_release_queue_work()
1603 queue->rcv_state = NVMET_TCP_RECV_ERR; in nvmet_tcp_release_queue_work()
1605 nvmet_tcp_uninit_data_in_cmds(queue); in nvmet_tcp_release_queue_work()
1606 nvmet_sq_destroy(&queue->nvme_sq); in nvmet_tcp_release_queue_work()
1607 cancel_work_sync(&queue->io_work); in nvmet_tcp_release_queue_work()
1608 nvmet_tcp_free_cmd_data_in_buffers(queue); in nvmet_tcp_release_queue_work()
1610 fput(queue->sock->file); in nvmet_tcp_release_queue_work()
1611 nvmet_tcp_free_cmds(queue); in nvmet_tcp_release_queue_work()
1612 if (queue->hdr_digest || queue->data_digest) in nvmet_tcp_release_queue_work()
1613 nvmet_tcp_free_crypto(queue); in nvmet_tcp_release_queue_work()
1614 ida_free(&nvmet_tcp_queue_ida, queue->idx); in nvmet_tcp_release_queue_work()
1615 page_frag_cache_drain(&queue->pf_cache); in nvmet_tcp_release_queue_work()
1616 kfree(queue); in nvmet_tcp_release_queue_work()
1621 struct nvmet_tcp_queue *queue; in nvmet_tcp_data_ready() local
1626 queue = sk->sk_user_data; in nvmet_tcp_data_ready()
1627 if (likely(queue)) { in nvmet_tcp_data_ready()
1628 if (queue->data_ready) in nvmet_tcp_data_ready()
1629 queue->data_ready(sk); in nvmet_tcp_data_ready()
1630 if (queue->state != NVMET_TCP_Q_TLS_HANDSHAKE) in nvmet_tcp_data_ready()
1631 queue_work_on(queue_cpu(queue), nvmet_tcp_wq, in nvmet_tcp_data_ready()
1632 &queue->io_work); in nvmet_tcp_data_ready()
1639 struct nvmet_tcp_queue *queue; in nvmet_tcp_write_space() local
1642 queue = sk->sk_user_data; in nvmet_tcp_write_space()
1643 if (unlikely(!queue)) in nvmet_tcp_write_space()
1646 if (unlikely(queue->state == NVMET_TCP_Q_CONNECTING)) { in nvmet_tcp_write_space()
1647 queue->write_space(sk); in nvmet_tcp_write_space()
1653 queue_work_on(queue_cpu(queue), nvmet_tcp_wq, &queue->io_work); in nvmet_tcp_write_space()
1661 struct nvmet_tcp_queue *queue; in nvmet_tcp_state_change() local
1664 queue = sk->sk_user_data; in nvmet_tcp_state_change()
1665 if (!queue) in nvmet_tcp_state_change()
1676 nvmet_tcp_schedule_release_queue(queue); in nvmet_tcp_state_change()
1679 pr_warn("queue %d unhandled state %d\n", in nvmet_tcp_state_change()
1680 queue->idx, sk->sk_state); in nvmet_tcp_state_change()
1686 static int nvmet_tcp_set_queue_sock(struct nvmet_tcp_queue *queue) in nvmet_tcp_set_queue_sock() argument
1688 struct socket *sock = queue->sock; in nvmet_tcp_set_queue_sock()
1693 (struct sockaddr *)&queue->sockaddr); in nvmet_tcp_set_queue_sock()
1698 (struct sockaddr *)&queue->sockaddr_peer); in nvmet_tcp_set_queue_sock()
1703 * Cleanup whatever is sitting in the TCP transmit queue on socket in nvmet_tcp_set_queue_sock()
1725 sock->sk->sk_user_data = queue; in nvmet_tcp_set_queue_sock()
1726 queue->data_ready = sock->sk->sk_data_ready; in nvmet_tcp_set_queue_sock()
1728 queue->state_change = sock->sk->sk_state_change; in nvmet_tcp_set_queue_sock()
1730 queue->write_space = sock->sk->sk_write_space; in nvmet_tcp_set_queue_sock()
1733 nvmet_tcp_arm_queue_deadline(queue); in nvmet_tcp_set_queue_sock()
1734 queue_work_on(queue_cpu(queue), nvmet_tcp_wq, &queue->io_work); in nvmet_tcp_set_queue_sock()
1742 static int nvmet_tcp_try_peek_pdu(struct nvmet_tcp_queue *queue) in nvmet_tcp_try_peek_pdu() argument
1744 struct nvme_tcp_hdr *hdr = &queue->pdu.cmd.hdr; in nvmet_tcp_try_peek_pdu()
1747 .iov_base = (u8 *)&queue->pdu + queue->offset, in nvmet_tcp_try_peek_pdu()
1757 if (nvmet_port_secure_channel_required(queue->port->nport)) in nvmet_tcp_try_peek_pdu()
1760 len = kernel_recvmsg(queue->sock, &msg, &iov, 1, in nvmet_tcp_try_peek_pdu()
1763 pr_debug("queue %d: peek error %d\n", in nvmet_tcp_try_peek_pdu()
1764 queue->idx, len); in nvmet_tcp_try_peek_pdu()
1768 ret = nvmet_tcp_tls_record_ok(queue, &msg, cbuf); in nvmet_tcp_try_peek_pdu()
1773 pr_debug("queue %d: short read, %d bytes missing\n", in nvmet_tcp_try_peek_pdu()
1774 queue->idx, (int)iov.iov_len - len); in nvmet_tcp_try_peek_pdu()
1777 pr_debug("queue %d: hdr type %d hlen %d plen %d size %d\n", in nvmet_tcp_try_peek_pdu()
1778 queue->idx, hdr->type, hdr->hlen, hdr->plen, in nvmet_tcp_try_peek_pdu()
1783 pr_debug("queue %d: icreq detected\n", in nvmet_tcp_try_peek_pdu()
1784 queue->idx); in nvmet_tcp_try_peek_pdu()
1793 struct nvmet_tcp_queue *queue = data; in nvmet_tcp_tls_handshake_done() local
1795 pr_debug("queue %d: TLS handshake done, key %x, status %d\n", in nvmet_tcp_tls_handshake_done()
1796 queue->idx, peerid, status); in nvmet_tcp_tls_handshake_done()
1797 spin_lock_bh(&queue->state_lock); in nvmet_tcp_tls_handshake_done()
1798 if (WARN_ON(queue->state != NVMET_TCP_Q_TLS_HANDSHAKE)) { in nvmet_tcp_tls_handshake_done()
1799 spin_unlock_bh(&queue->state_lock); in nvmet_tcp_tls_handshake_done()
1803 queue->tls_pskid = peerid; in nvmet_tcp_tls_handshake_done()
1804 queue->state = NVMET_TCP_Q_CONNECTING; in nvmet_tcp_tls_handshake_done()
1806 queue->state = NVMET_TCP_Q_FAILED; in nvmet_tcp_tls_handshake_done()
1807 spin_unlock_bh(&queue->state_lock); in nvmet_tcp_tls_handshake_done()
1809 cancel_delayed_work_sync(&queue->tls_handshake_tmo_work); in nvmet_tcp_tls_handshake_done()
1811 nvmet_tcp_schedule_release_queue(queue); in nvmet_tcp_tls_handshake_done()
1813 nvmet_tcp_set_queue_sock(queue); in nvmet_tcp_tls_handshake_done()
1814 kref_put(&queue->kref, nvmet_tcp_release_queue); in nvmet_tcp_tls_handshake_done()
1819 struct nvmet_tcp_queue *queue = container_of(to_delayed_work(w), in nvmet_tcp_tls_handshake_timeout() local
1822 pr_warn("queue %d: TLS handshake timeout\n", queue->idx); in nvmet_tcp_tls_handshake_timeout()
1826 if (!tls_handshake_cancel(queue->sock->sk)) in nvmet_tcp_tls_handshake_timeout()
1828 spin_lock_bh(&queue->state_lock); in nvmet_tcp_tls_handshake_timeout()
1829 if (WARN_ON(queue->state != NVMET_TCP_Q_TLS_HANDSHAKE)) { in nvmet_tcp_tls_handshake_timeout()
1830 spin_unlock_bh(&queue->state_lock); in nvmet_tcp_tls_handshake_timeout()
1833 queue->state = NVMET_TCP_Q_FAILED; in nvmet_tcp_tls_handshake_timeout()
1834 spin_unlock_bh(&queue->state_lock); in nvmet_tcp_tls_handshake_timeout()
1835 nvmet_tcp_schedule_release_queue(queue); in nvmet_tcp_tls_handshake_timeout()
1836 kref_put(&queue->kref, nvmet_tcp_release_queue); in nvmet_tcp_tls_handshake_timeout()
1839 static int nvmet_tcp_tls_handshake(struct nvmet_tcp_queue *queue) in nvmet_tcp_tls_handshake() argument
1844 if (queue->state != NVMET_TCP_Q_TLS_HANDSHAKE) { in nvmet_tcp_tls_handshake()
1845 pr_warn("cannot start TLS in state %d\n", queue->state); in nvmet_tcp_tls_handshake()
1849 kref_get(&queue->kref); in nvmet_tcp_tls_handshake()
1850 pr_debug("queue %d: TLS ServerHello\n", queue->idx); in nvmet_tcp_tls_handshake()
1852 args.ta_sock = queue->sock; in nvmet_tcp_tls_handshake()
1854 args.ta_data = queue; in nvmet_tcp_tls_handshake()
1855 args.ta_keyring = key_serial(queue->port->nport->keyring); in nvmet_tcp_tls_handshake()
1860 kref_put(&queue->kref, nvmet_tcp_release_queue); in nvmet_tcp_tls_handshake()
1863 queue_delayed_work(nvmet_wq, &queue->tls_handshake_tmo_work, in nvmet_tcp_tls_handshake()
1875 struct nvmet_tcp_queue *queue; in nvmet_tcp_alloc_queue() local
1879 queue = kzalloc(sizeof(*queue), GFP_KERNEL); in nvmet_tcp_alloc_queue()
1880 if (!queue) { in nvmet_tcp_alloc_queue()
1885 INIT_WORK(&queue->release_work, nvmet_tcp_release_queue_work); in nvmet_tcp_alloc_queue()
1886 INIT_WORK(&queue->io_work, nvmet_tcp_io_work); in nvmet_tcp_alloc_queue()
1887 kref_init(&queue->kref); in nvmet_tcp_alloc_queue()
1888 queue->sock = newsock; in nvmet_tcp_alloc_queue()
1889 queue->port = port; in nvmet_tcp_alloc_queue()
1890 queue->nr_cmds = 0; in nvmet_tcp_alloc_queue()
1891 spin_lock_init(&queue->state_lock); in nvmet_tcp_alloc_queue()
1892 if (queue->port->nport->disc_addr.tsas.tcp.sectype == in nvmet_tcp_alloc_queue()
1894 queue->state = NVMET_TCP_Q_TLS_HANDSHAKE; in nvmet_tcp_alloc_queue()
1896 queue->state = NVMET_TCP_Q_CONNECTING; in nvmet_tcp_alloc_queue()
1897 INIT_LIST_HEAD(&queue->free_list); in nvmet_tcp_alloc_queue()
1898 init_llist_head(&queue->resp_list); in nvmet_tcp_alloc_queue()
1899 INIT_LIST_HEAD(&queue->resp_send_list); in nvmet_tcp_alloc_queue()
1901 sock_file = sock_alloc_file(queue->sock, O_CLOEXEC, NULL); in nvmet_tcp_alloc_queue()
1907 queue->idx = ida_alloc(&nvmet_tcp_queue_ida, GFP_KERNEL); in nvmet_tcp_alloc_queue()
1908 if (queue->idx < 0) { in nvmet_tcp_alloc_queue()
1909 ret = queue->idx; in nvmet_tcp_alloc_queue()
1913 ret = nvmet_tcp_alloc_cmd(queue, &queue->connect); in nvmet_tcp_alloc_queue()
1917 ret = nvmet_sq_init(&queue->nvme_sq); in nvmet_tcp_alloc_queue()
1921 nvmet_prepare_receive_pdu(queue); in nvmet_tcp_alloc_queue()
1924 list_add_tail(&queue->queue_list, &nvmet_tcp_queue_list); in nvmet_tcp_alloc_queue()
1927 INIT_DELAYED_WORK(&queue->tls_handshake_tmo_work, in nvmet_tcp_alloc_queue()
1930 if (queue->state == NVMET_TCP_Q_TLS_HANDSHAKE) { in nvmet_tcp_alloc_queue()
1931 struct sock *sk = queue->sock->sk; in nvmet_tcp_alloc_queue()
1938 if (!nvmet_tcp_try_peek_pdu(queue)) { in nvmet_tcp_alloc_queue()
1939 if (!nvmet_tcp_tls_handshake(queue)) in nvmet_tcp_alloc_queue()
1945 queue->state = NVMET_TCP_Q_CONNECTING; in nvmet_tcp_alloc_queue()
1949 ret = nvmet_tcp_set_queue_sock(queue); in nvmet_tcp_alloc_queue()
1956 list_del_init(&queue->queue_list); in nvmet_tcp_alloc_queue()
1958 nvmet_sq_destroy(&queue->nvme_sq); in nvmet_tcp_alloc_queue()
1960 nvmet_tcp_free_cmd(&queue->connect); in nvmet_tcp_alloc_queue()
1962 ida_free(&nvmet_tcp_queue_ida, queue->idx); in nvmet_tcp_alloc_queue()
1964 fput(queue->sock->file); in nvmet_tcp_alloc_queue()
1966 kfree(queue); in nvmet_tcp_alloc_queue()
1968 pr_err("failed to allocate queue, error %d\n", ret); in nvmet_tcp_alloc_queue()
2088 struct nvmet_tcp_queue *queue; in nvmet_tcp_destroy_port_queues() local
2091 list_for_each_entry(queue, &nvmet_tcp_queue_list, queue_list) in nvmet_tcp_destroy_port_queues()
2092 if (queue->port == port) in nvmet_tcp_destroy_port_queues()
2093 kernel_sock_shutdown(queue->sock, SHUT_RDWR); in nvmet_tcp_destroy_port_queues()
2118 struct nvmet_tcp_queue *queue; in nvmet_tcp_delete_ctrl() local
2121 list_for_each_entry(queue, &nvmet_tcp_queue_list, queue_list) in nvmet_tcp_delete_ctrl()
2122 if (queue->nvme_sq.ctrl == ctrl) in nvmet_tcp_delete_ctrl()
2123 kernel_sock_shutdown(queue->sock, SHUT_RDWR); in nvmet_tcp_delete_ctrl()
2129 struct nvmet_tcp_queue *queue = in nvmet_tcp_install_queue() local
2148 queue->nr_cmds = sq->size * 2; in nvmet_tcp_install_queue()
2149 if (nvmet_tcp_alloc_cmds(queue)) { in nvmet_tcp_install_queue()
2150 queue->nr_cmds = 0; in nvmet_tcp_install_queue()
2164 struct nvmet_tcp_queue *queue = cmd->queue; in nvmet_tcp_disc_port_addr() local
2166 sprintf(traddr, "%pISc", (struct sockaddr *)&queue->sockaddr); in nvmet_tcp_disc_port_addr()
2176 struct nvmet_tcp_queue *queue = in nvmet_tcp_host_port_addr() local
2179 if (queue->sockaddr_peer.ss_family == AF_UNSPEC) in nvmet_tcp_host_port_addr()
2182 (struct sockaddr *)&queue->sockaddr_peer); in nvmet_tcp_host_port_addr()
2219 struct nvmet_tcp_queue *queue; in nvmet_tcp_exit() local
2225 list_for_each_entry(queue, &nvmet_tcp_queue_list, queue_list) in nvmet_tcp_exit()
2226 kernel_sock_shutdown(queue->sock, SHUT_RDWR); in nvmet_tcp_exit()