Commit 53b2b2f5 authored by James Smart's avatar James Smart Committed by Jens Axboe

nvme-fc and nvmet-fc: sync with FC-NVME-2 header changes

Sync sources with revised structure and field names to correspond with
FC-NVME-2 header sync-up.

Tested interoperability with success:
- prior initiator with new target
- prior target with new initiator
- new on new
Signed-off-by: default avatarJames Smart <jsmart2021@gmail.com>
Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent f1658361
...@@ -1224,7 +1224,7 @@ nvme_fc_connect_admin_queue(struct nvme_fc_ctrl *ctrl, ...@@ -1224,7 +1224,7 @@ nvme_fc_connect_admin_queue(struct nvme_fc_ctrl *ctrl,
lsreq->rqstlen = sizeof(*assoc_rqst); lsreq->rqstlen = sizeof(*assoc_rqst);
lsreq->rspaddr = assoc_acc; lsreq->rspaddr = assoc_acc;
lsreq->rsplen = sizeof(*assoc_acc); lsreq->rsplen = sizeof(*assoc_acc);
lsreq->timeout = NVME_FC_CONNECT_TIMEOUT_SEC; lsreq->timeout = NVME_FC_LS_TIMEOUT_SEC;
ret = nvme_fc_send_ls_req(ctrl->rport, lsop); ret = nvme_fc_send_ls_req(ctrl->rport, lsop);
if (ret) if (ret)
...@@ -1332,7 +1332,7 @@ nvme_fc_connect_queue(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue, ...@@ -1332,7 +1332,7 @@ nvme_fc_connect_queue(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue,
lsreq->rqstlen = sizeof(*conn_rqst); lsreq->rqstlen = sizeof(*conn_rqst);
lsreq->rspaddr = conn_acc; lsreq->rspaddr = conn_acc;
lsreq->rsplen = sizeof(*conn_acc); lsreq->rsplen = sizeof(*conn_acc);
lsreq->timeout = NVME_FC_CONNECT_TIMEOUT_SEC; lsreq->timeout = NVME_FC_LS_TIMEOUT_SEC;
ret = nvme_fc_send_ls_req(ctrl->rport, lsop); ret = nvme_fc_send_ls_req(ctrl->rport, lsop);
if (ret) if (ret)
...@@ -1413,8 +1413,8 @@ nvme_fc_disconnect_assoc_done(struct nvmefc_ls_req *lsreq, int status) ...@@ -1413,8 +1413,8 @@ nvme_fc_disconnect_assoc_done(struct nvmefc_ls_req *lsreq, int status)
static void static void
nvme_fc_xmt_disconnect_assoc(struct nvme_fc_ctrl *ctrl) nvme_fc_xmt_disconnect_assoc(struct nvme_fc_ctrl *ctrl)
{ {
struct fcnvme_ls_disconnect_rqst *discon_rqst; struct fcnvme_ls_disconnect_assoc_rqst *discon_rqst;
struct fcnvme_ls_disconnect_acc *discon_acc; struct fcnvme_ls_disconnect_assoc_acc *discon_acc;
struct nvmefc_ls_req_op *lsop; struct nvmefc_ls_req_op *lsop;
struct nvmefc_ls_req *lsreq; struct nvmefc_ls_req *lsreq;
int ret; int ret;
...@@ -1430,11 +1430,11 @@ nvme_fc_xmt_disconnect_assoc(struct nvme_fc_ctrl *ctrl) ...@@ -1430,11 +1430,11 @@ nvme_fc_xmt_disconnect_assoc(struct nvme_fc_ctrl *ctrl)
lsreq = &lsop->ls_req; lsreq = &lsop->ls_req;
lsreq->private = (void *)&lsop[1]; lsreq->private = (void *)&lsop[1];
discon_rqst = (struct fcnvme_ls_disconnect_rqst *) discon_rqst = (struct fcnvme_ls_disconnect_assoc_rqst *)
(lsreq->private + ctrl->lport->ops->lsrqst_priv_sz); (lsreq->private + ctrl->lport->ops->lsrqst_priv_sz);
discon_acc = (struct fcnvme_ls_disconnect_acc *)&discon_rqst[1]; discon_acc = (struct fcnvme_ls_disconnect_assoc_acc *)&discon_rqst[1];
discon_rqst->w0.ls_cmd = FCNVME_LS_DISCONNECT; discon_rqst->w0.ls_cmd = FCNVME_LS_DISCONNECT_ASSOC;
discon_rqst->desc_list_len = cpu_to_be32( discon_rqst->desc_list_len = cpu_to_be32(
sizeof(struct fcnvme_lsdesc_assoc_id) + sizeof(struct fcnvme_lsdesc_assoc_id) +
sizeof(struct fcnvme_lsdesc_disconn_cmd)); sizeof(struct fcnvme_lsdesc_disconn_cmd));
...@@ -1451,14 +1451,12 @@ nvme_fc_xmt_disconnect_assoc(struct nvme_fc_ctrl *ctrl) ...@@ -1451,14 +1451,12 @@ nvme_fc_xmt_disconnect_assoc(struct nvme_fc_ctrl *ctrl)
discon_rqst->discon_cmd.desc_len = discon_rqst->discon_cmd.desc_len =
fcnvme_lsdesc_len( fcnvme_lsdesc_len(
sizeof(struct fcnvme_lsdesc_disconn_cmd)); sizeof(struct fcnvme_lsdesc_disconn_cmd));
discon_rqst->discon_cmd.scope = FCNVME_DISCONN_ASSOCIATION;
discon_rqst->discon_cmd.id = cpu_to_be64(ctrl->association_id);
lsreq->rqstaddr = discon_rqst; lsreq->rqstaddr = discon_rqst;
lsreq->rqstlen = sizeof(*discon_rqst); lsreq->rqstlen = sizeof(*discon_rqst);
lsreq->rspaddr = discon_acc; lsreq->rspaddr = discon_acc;
lsreq->rsplen = sizeof(*discon_acc); lsreq->rsplen = sizeof(*discon_acc);
lsreq->timeout = NVME_FC_CONNECT_TIMEOUT_SEC; lsreq->timeout = NVME_FC_LS_TIMEOUT_SEC;
ret = nvme_fc_send_ls_req_async(ctrl->rport, lsop, ret = nvme_fc_send_ls_req_async(ctrl->rport, lsop,
nvme_fc_disconnect_assoc_done); nvme_fc_disconnect_assoc_done);
...@@ -1662,7 +1660,7 @@ nvme_fc_fcpio_done(struct nvmefc_fcp_req *req) ...@@ -1662,7 +1660,7 @@ nvme_fc_fcpio_done(struct nvmefc_fcp_req *req)
(freq->rcv_rsplen / 4) || (freq->rcv_rsplen / 4) ||
be32_to_cpu(op->rsp_iu.xfrd_len) != be32_to_cpu(op->rsp_iu.xfrd_len) !=
freq->transferred_length || freq->transferred_length ||
op->rsp_iu.status_code || op->rsp_iu.ersp_result ||
sqe->common.command_id != cqe->command_id)) { sqe->common.command_id != cqe->command_id)) {
status = cpu_to_le16(NVME_SC_HOST_PATH_ERROR << 1); status = cpu_to_le16(NVME_SC_HOST_PATH_ERROR << 1);
dev_info(ctrl->ctrl.device, dev_info(ctrl->ctrl.device,
...@@ -1672,7 +1670,7 @@ nvme_fc_fcpio_done(struct nvmefc_fcp_req *req) ...@@ -1672,7 +1670,7 @@ nvme_fc_fcpio_done(struct nvmefc_fcp_req *req)
ctrl->cnum, be16_to_cpu(op->rsp_iu.iu_len), ctrl->cnum, be16_to_cpu(op->rsp_iu.iu_len),
be32_to_cpu(op->rsp_iu.xfrd_len), be32_to_cpu(op->rsp_iu.xfrd_len),
freq->transferred_length, freq->transferred_length,
op->rsp_iu.status_code, op->rsp_iu.ersp_result,
sqe->common.command_id, sqe->common.command_id,
cqe->command_id); cqe->command_id);
goto done; goto done;
...@@ -1731,7 +1729,7 @@ __nvme_fc_init_request(struct nvme_fc_ctrl *ctrl, ...@@ -1731,7 +1729,7 @@ __nvme_fc_init_request(struct nvme_fc_ctrl *ctrl,
op->rq = rq; op->rq = rq;
op->rqno = rqno; op->rqno = rqno;
cmdiu->scsi_id = NVME_CMD_SCSI_ID; cmdiu->format_id = NVME_CMD_FORMAT_ID;
cmdiu->fc_id = NVME_CMD_FC_ID; cmdiu->fc_id = NVME_CMD_FC_ID;
cmdiu->iu_len = cpu_to_be16(sizeof(*cmdiu) / sizeof(u32)); cmdiu->iu_len = cpu_to_be16(sizeof(*cmdiu) / sizeof(u32));
......
...@@ -1495,20 +1495,20 @@ static void ...@@ -1495,20 +1495,20 @@ static void
nvmet_fc_ls_disconnect(struct nvmet_fc_tgtport *tgtport, nvmet_fc_ls_disconnect(struct nvmet_fc_tgtport *tgtport,
struct nvmet_fc_ls_iod *iod) struct nvmet_fc_ls_iod *iod)
{ {
struct fcnvme_ls_disconnect_rqst *rqst = struct fcnvme_ls_disconnect_assoc_rqst *rqst =
(struct fcnvme_ls_disconnect_rqst *)iod->rqstbuf; (struct fcnvme_ls_disconnect_assoc_rqst *)iod->rqstbuf;
struct fcnvme_ls_disconnect_acc *acc = struct fcnvme_ls_disconnect_assoc_acc *acc =
(struct fcnvme_ls_disconnect_acc *)iod->rspbuf; (struct fcnvme_ls_disconnect_assoc_acc *)iod->rspbuf;
struct nvmet_fc_tgt_assoc *assoc; struct nvmet_fc_tgt_assoc *assoc;
int ret = 0; int ret = 0;
memset(acc, 0, sizeof(*acc)); memset(acc, 0, sizeof(*acc));
if (iod->rqstdatalen < sizeof(struct fcnvme_ls_disconnect_rqst)) if (iod->rqstdatalen < sizeof(struct fcnvme_ls_disconnect_assoc_rqst))
ret = VERR_DISCONN_LEN; ret = VERR_DISCONN_LEN;
else if (rqst->desc_list_len != else if (rqst->desc_list_len !=
fcnvme_lsdesc_len( fcnvme_lsdesc_len(
sizeof(struct fcnvme_ls_disconnect_rqst))) sizeof(struct fcnvme_ls_disconnect_assoc_rqst)))
ret = VERR_DISCONN_RQST_LEN; ret = VERR_DISCONN_RQST_LEN;
else if (rqst->associd.desc_tag != cpu_to_be32(FCNVME_LSDESC_ASSOC_ID)) else if (rqst->associd.desc_tag != cpu_to_be32(FCNVME_LSDESC_ASSOC_ID))
ret = VERR_ASSOC_ID; ret = VERR_ASSOC_ID;
...@@ -1523,8 +1523,11 @@ nvmet_fc_ls_disconnect(struct nvmet_fc_tgtport *tgtport, ...@@ -1523,8 +1523,11 @@ nvmet_fc_ls_disconnect(struct nvmet_fc_tgtport *tgtport,
fcnvme_lsdesc_len( fcnvme_lsdesc_len(
sizeof(struct fcnvme_lsdesc_disconn_cmd))) sizeof(struct fcnvme_lsdesc_disconn_cmd)))
ret = VERR_DISCONN_CMD_LEN; ret = VERR_DISCONN_CMD_LEN;
else if ((rqst->discon_cmd.scope != FCNVME_DISCONN_ASSOCIATION) && /*
(rqst->discon_cmd.scope != FCNVME_DISCONN_CONNECTION)) * As the standard changed on the LS, check if old format and scope
* something other than Association (e.g. 0).
*/
else if (rqst->discon_cmd.rsvd8[0])
ret = VERR_DISCONN_SCOPE; ret = VERR_DISCONN_SCOPE;
else { else {
/* match an active association */ /* match an active association */
...@@ -1556,8 +1559,8 @@ nvmet_fc_ls_disconnect(struct nvmet_fc_tgtport *tgtport, ...@@ -1556,8 +1559,8 @@ nvmet_fc_ls_disconnect(struct nvmet_fc_tgtport *tgtport,
nvmet_fc_format_rsp_hdr(acc, FCNVME_LS_ACC, nvmet_fc_format_rsp_hdr(acc, FCNVME_LS_ACC,
fcnvme_lsdesc_len( fcnvme_lsdesc_len(
sizeof(struct fcnvme_ls_disconnect_acc)), sizeof(struct fcnvme_ls_disconnect_assoc_acc)),
FCNVME_LS_DISCONNECT); FCNVME_LS_DISCONNECT_ASSOC);
/* release get taken in nvmet_fc_find_target_assoc */ /* release get taken in nvmet_fc_find_target_assoc */
nvmet_fc_tgt_a_put(iod->assoc); nvmet_fc_tgt_a_put(iod->assoc);
...@@ -1632,7 +1635,7 @@ nvmet_fc_handle_ls_rqst(struct nvmet_fc_tgtport *tgtport, ...@@ -1632,7 +1635,7 @@ nvmet_fc_handle_ls_rqst(struct nvmet_fc_tgtport *tgtport,
/* Creates an IO Queue/Connection */ /* Creates an IO Queue/Connection */
nvmet_fc_ls_create_connection(tgtport, iod); nvmet_fc_ls_create_connection(tgtport, iod);
break; break;
case FCNVME_LS_DISCONNECT: case FCNVME_LS_DISCONNECT_ASSOC:
/* Terminate a Queue/Connection or the Association */ /* Terminate a Queue/Connection or the Association */
nvmet_fc_ls_disconnect(tgtport, iod); nvmet_fc_ls_disconnect(tgtport, iod);
break; break;
...@@ -2299,7 +2302,7 @@ nvmet_fc_rcv_fcp_req(struct nvmet_fc_target_port *target_port, ...@@ -2299,7 +2302,7 @@ nvmet_fc_rcv_fcp_req(struct nvmet_fc_target_port *target_port,
/* validate iu, so the connection id can be used to find the queue */ /* validate iu, so the connection id can be used to find the queue */
if ((cmdiubuf_len != sizeof(*cmdiu)) || if ((cmdiubuf_len != sizeof(*cmdiu)) ||
(cmdiu->scsi_id != NVME_CMD_SCSI_ID) || (cmdiu->format_id != NVME_CMD_FORMAT_ID) ||
(cmdiu->fc_id != NVME_CMD_FC_ID) || (cmdiu->fc_id != NVME_CMD_FC_ID) ||
(be16_to_cpu(cmdiu->iu_len) != (sizeof(*cmdiu)/4))) (be16_to_cpu(cmdiu->iu_len) != (sizeof(*cmdiu)/4)))
return -EIO; return -EIO;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment