Lines Matching refs:req
64 nvmf_auth_request_complete(struct spdk_nvmf_request *req, int sct, int sc, int dnr)
66 struct spdk_nvme_cpl *response = &req->rsp->nvme_cpl;
72 spdk_nvmf_request_complete(req);
113 nvmf_auth_request_fail1(struct spdk_nvmf_request *req, int reason)
115 struct spdk_nvmf_qpair *qpair = req->qpair;
124 nvmf_auth_request_complete(req, SPDK_NVME_SCT_GENERIC, SPDK_NVME_SC_SUCCESS, 0);
191 nvmf_auth_check_command(struct spdk_nvmf_request *req, uint8_t secp,
194 struct spdk_nvmf_qpair *qpair = req->qpair;
204 if (len != req->length) {
205 AUTH_ERRLOG(qpair, "invalid length: %"PRIu32" != %"PRIu32"\n", len, req->length);
213 nvmf_auth_get_message(struct spdk_nvmf_request *req, size_t size)
215 if (req->length > 0 && req->iovcnt == 1 && req->iov[0].iov_len >= size) {
216 return req->iov[0].iov_base;
223 nvmf_auth_negotiate_exec(struct spdk_nvmf_request *req, struct spdk_nvmf_auth_negotiate *msg)
225 struct spdk_nvmf_qpair *qpair = req->qpair;
249 nvmf_auth_request_fail1(req, SPDK_NVMF_AUTH_INCORRECT_PROTOCOL_MESSAGE);
254 if (req->length < sizeof(*msg) || req->length != sizeof(*msg) + msg->napd * sizeof(*desc)) {
255 AUTH_ERRLOG(qpair, "invalid message length: %"PRIu32"\n", req->length);
256 nvmf_auth_request_fail1(req, SPDK_NVMF_AUTH_INCORRECT_PAYLOAD);
262 nvmf_auth_request_fail1(req, SPDK_NVMF_AUTH_SCC_MISMATCH);
274 nvmf_auth_request_fail1(req, SPDK_NVMF_AUTH_PROTOCOL_UNUSABLE);
280 nvmf_auth_request_fail1(req, SPDK_NVMF_AUTH_INCORRECT_PAYLOAD);
302 nvmf_auth_request_fail1(req, SPDK_NVMF_AUTH_HASH_UNUSABLE);
324 nvmf_auth_request_fail1(req, SPDK_NVMF_AUTH_DHGROUP_UNUSABLE);
329 nvmf_auth_request_complete(req, SPDK_NVME_SCT_GENERIC,
338 nvmf_auth_request_complete(req, SPDK_NVME_SCT_GENERIC, SPDK_NVME_SC_SUCCESS, 0);
342 nvmf_auth_reply_exec(struct spdk_nvmf_request *req, struct spdk_nvmf_dhchap_reply *msg)
344 struct spdk_nvmf_qpair *qpair = req->qpair;
356 nvmf_auth_request_fail1(req, SPDK_NVMF_AUTH_INCORRECT_PROTOCOL_MESSAGE);
359 if (req->length < sizeof(*msg)) {
360 AUTH_ERRLOG(qpair, "invalid message length=%"PRIu32"\n", req->length);
361 nvmf_auth_request_fail1(req, SPDK_NVMF_AUTH_INCORRECT_PAYLOAD);
368 nvmf_auth_request_fail1(req, SPDK_NVMF_AUTH_INCORRECT_PAYLOAD);
373 nvmf_auth_request_fail1(req, SPDK_NVMF_AUTH_INCORRECT_PAYLOAD);
376 if (req->length != sizeof(*msg) + 2 * hl + msg->dhvlen) {
378 req->length, sizeof(*msg) + 2 * hl);
379 nvmf_auth_request_fail1(req, SPDK_NVMF_AUTH_INCORRECT_PAYLOAD);
384 nvmf_auth_request_fail1(req, SPDK_NVMF_AUTH_INCORRECT_PAYLOAD);
389 nvmf_auth_request_fail1(req, SPDK_NVMF_AUTH_INCORRECT_PAYLOAD);
394 nvmf_auth_request_fail1(req, SPDK_NVMF_AUTH_INCORRECT_PAYLOAD);
401 nvmf_auth_request_fail1(req, SPDK_NVMF_AUTH_FAILED);
412 nvmf_auth_request_fail1(req, SPDK_NVMF_AUTH_FAILED);
428 nvmf_auth_request_fail1(req, SPDK_NVMF_AUTH_FAILED);
436 nvmf_auth_request_fail1(req, SPDK_NVMF_AUTH_FAILED);
445 nvmf_auth_request_fail1(req, SPDK_NVMF_AUTH_FAILED);
456 nvmf_auth_request_fail1(req, SPDK_NVMF_AUTH_FAILED);
463 nvmf_auth_request_complete(req, SPDK_NVME_SCT_GENERIC,
470 nvmf_auth_request_complete(req, SPDK_NVME_SCT_GENERIC, SPDK_NVME_SC_SUCCESS, 0);
477 nvmf_auth_success2_exec(struct spdk_nvmf_request *req, struct spdk_nvmf_dhchap_success2 *msg)
479 struct spdk_nvmf_qpair *qpair = req->qpair;
484 nvmf_auth_request_fail1(req, SPDK_NVMF_AUTH_INCORRECT_PROTOCOL_MESSAGE);
487 if (req->length != sizeof(*msg)) {
488 AUTH_ERRLOG(qpair, "invalid message length=%"PRIu32"\n", req->length);
489 nvmf_auth_request_fail1(req, SPDK_NVMF_AUTH_INCORRECT_PAYLOAD);
494 nvmf_auth_request_fail1(req, SPDK_NVMF_AUTH_INCORRECT_PAYLOAD);
502 nvmf_auth_request_complete(req, SPDK_NVME_SCT_GENERIC, SPDK_NVME_SC_SUCCESS, 0);
506 nvmf_auth_failure2_exec(struct spdk_nvmf_request *req, struct spdk_nvmf_auth_failure *msg)
508 struct spdk_nvmf_qpair *qpair = req->qpair;
514 nvmf_auth_request_fail1(req, SPDK_NVMF_AUTH_INCORRECT_PROTOCOL_MESSAGE);
517 if (req->length != sizeof(*msg)) {
518 AUTH_ERRLOG(qpair, "invalid message length=%"PRIu32"\n", req->length);
519 nvmf_auth_request_fail1(req, SPDK_NVMF_AUTH_INCORRECT_PAYLOAD);
524 nvmf_auth_request_fail1(req, SPDK_NVMF_AUTH_INCORRECT_PAYLOAD);
530 nvmf_auth_request_complete(req, SPDK_NVME_SCT_GENERIC, SPDK_NVME_SC_SUCCESS, 0);
534 nvmf_auth_send_exec(struct spdk_nvmf_request *req)
536 struct spdk_nvmf_qpair *qpair = req->qpair;
537 struct spdk_nvmf_fabric_auth_send_cmd *cmd = &req->cmd->auth_send_cmd;
541 rc = nvmf_auth_check_command(req, cmd->secp, cmd->spsp0, cmd->spsp1, cmd->tl);
543 nvmf_auth_request_complete(req, SPDK_NVME_SCT_GENERIC,
548 header = nvmf_auth_get_message(req, sizeof(*header));
550 nvmf_auth_request_fail1(req, SPDK_NVMF_AUTH_INCORRECT_PAYLOAD);
558 nvmf_auth_negotiate_exec(req, (void *)header);
561 nvmf_auth_failure2_exec(req, (void *)header);
565 nvmf_auth_request_fail1(req, SPDK_NVMF_AUTH_INCORRECT_PROTOCOL_MESSAGE);
572 nvmf_auth_reply_exec(req, (void *)header);
575 nvmf_auth_success2_exec(req, (void *)header);
579 nvmf_auth_request_fail1(req, SPDK_NVMF_AUTH_INCORRECT_PROTOCOL_MESSAGE);
585 nvmf_auth_request_fail1(req, SPDK_NVMF_AUTH_INCORRECT_PROTOCOL_MESSAGE);
591 nvmf_auth_recv_complete(struct spdk_nvmf_request *req, uint32_t length)
593 assert(req->cmd->nvmf_cmd.fctype == SPDK_NVMF_FABRIC_COMMAND_AUTHENTICATION_RECV);
594 req->length = length;
595 nvmf_auth_request_complete(req, SPDK_NVME_SCT_GENERIC, SPDK_NVME_SC_SUCCESS, 0);
611 nvmf_auth_recv_failure1(struct spdk_nvmf_request *req, int fail_reason)
613 struct spdk_nvmf_qpair *qpair = req->qpair;
617 failure = nvmf_auth_get_message(req, sizeof(*failure));
619 nvmf_auth_request_complete(req, SPDK_NVME_SCT_GENERIC,
632 nvmf_auth_recv_complete(req, sizeof(*failure));
665 nvmf_auth_recv_challenge(struct spdk_nvmf_request *req)
667 struct spdk_nvmf_qpair *qpair = req->qpair;
694 challenge = nvmf_auth_get_message(req, sizeof(*challenge) + hl + dhvlen);
696 AUTH_ERRLOG(qpair, "invalid message length: %"PRIu32"\n", req->length);
708 nvmf_auth_request_complete(req, SPDK_NVME_SCT_GENERIC,
726 nvmf_auth_recv_complete(req, sizeof(*challenge) + hl + dhvlen);
732 nvmf_auth_recv_success1(struct spdk_nvmf_request *req)
734 struct spdk_nvmf_qpair *qpair = req->qpair;
740 success = nvmf_auth_get_message(req, sizeof(*success) + auth->cvalid * hl);
742 AUTH_ERRLOG(qpair, "invalid message length: %"PRIu32"\n", req->length);
761 nvmf_auth_request_complete(req, SPDK_NVME_SCT_GENERIC,
772 nvmf_auth_recv_complete(req, sizeof(*success) + auth->cvalid * hl);
777 nvmf_auth_recv_exec(struct spdk_nvmf_request *req)
779 struct spdk_nvmf_qpair *qpair = req->qpair;
781 struct spdk_nvmf_fabric_auth_recv_cmd *cmd = &req->cmd->auth_recv_cmd;
784 rc = nvmf_auth_check_command(req, cmd->secp, cmd->spsp0, cmd->spsp1, cmd->al);
786 nvmf_auth_request_complete(req, SPDK_NVME_SCT_GENERIC,
791 spdk_iov_memset(req->iov, req->iovcnt, 0);
794 rc = nvmf_auth_recv_challenge(req);
796 nvmf_auth_recv_failure1(req, rc);
800 rc = nvmf_auth_recv_success1(req);
802 nvmf_auth_recv_failure1(req, rc);
806 nvmf_auth_recv_failure1(req, auth->fail_reason);
809 nvmf_auth_recv_failure1(req, SPDK_NVMF_AUTH_INCORRECT_PROTOCOL_MESSAGE);
815 nvmf_auth_check_state(struct spdk_nvmf_qpair *qpair, struct spdk_nvmf_request *req)
827 nvmf_auth_request_complete(req, SPDK_NVME_SCT_GENERIC,
834 nvmf_auth_request_complete(req, SPDK_NVME_SCT_GENERIC,
843 nvmf_auth_request_exec(struct spdk_nvmf_request *req)
845 struct spdk_nvmf_qpair *qpair = req->qpair;
846 union nvmf_h2c_msg *cmd = req->cmd;
848 if (!nvmf_auth_check_state(qpair, req)) {
855 nvmf_auth_send_exec(req);
858 nvmf_auth_recv_exec(req);
862 nvmf_auth_request_complete(req, SPDK_NVME_SCT_GENERIC,