diff options
-rw-r--r-- | drivers/s390/scsi/zfcp_dbf.c | 5 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_fc.c | 46 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_fc.h | 19 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_fsf.c | 8 |
4 files changed, 43 insertions, 35 deletions
diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c index 225e60d5d3fc..484da0b2d678 100644 --- a/drivers/s390/scsi/zfcp_dbf.c +++ b/drivers/s390/scsi/zfcp_dbf.c @@ -461,7 +461,7 @@ static u16 zfcp_dbf_san_res_cap_len_if_gpn_ft(char *tag, && reqh->ct_fs_subtype == FC_NS_SUBTYPE && reqh->ct_options == 0 && reqh->_ct_resvd1 == 0 - && reqh->ct_cmd == FC_NS_GPN_FT + && reqh->ct_cmd == cpu_to_be16(FC_NS_GPN_FT) /* reqh->ct_mr_size can vary so do not match but read below */ && reqh->_ct_resvd2 == 0 && reqh->ct_reason == 0 @@ -481,7 +481,8 @@ static u16 zfcp_dbf_san_res_cap_len_if_gpn_ft(char *tag, (resph->ct_cmd != cpu_to_be16(FC_FS_ACC))) return max(FC_CT_HDR_LEN, ZFCP_DBF_SAN_MAX_PAYLOAD); - max_entries = (reqh->ct_mr_size * 4 / sizeof(struct fc_gpn_ft_resp)) + max_entries = (be16_to_cpu(reqh->ct_mr_size) * 4 / + sizeof(struct fc_gpn_ft_resp)) + 1 /* zfcp_fc_scan_ports: bytes correct, entries off-by-one * to account for header as 1st pseudo "entry" */; diff --git a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c index cc3f378782b2..3e715597b739 100644 --- a/drivers/s390/scsi/zfcp_fc.c +++ b/drivers/s390/scsi/zfcp_fc.c @@ -260,7 +260,8 @@ static void zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req) page = (struct fc_els_rscn_page *) head; /* see FC-FS */ - no_entries = head->rscn_plen / sizeof(struct fc_els_rscn_page); + no_entries = be16_to_cpu(head->rscn_plen) / + sizeof(struct fc_els_rscn_page); for (i = 1; i < no_entries; i++) { /* skip head and start with 1st element */ @@ -296,7 +297,7 @@ static void zfcp_fc_incoming_plogi(struct zfcp_fsf_req *req) status_buffer = (struct fsf_status_read_buffer *) req->data; plogi = (struct fc_els_flogi *) status_buffer->payload.data; - zfcp_fc_incoming_wwpn(req, plogi->fl_wwpn); + zfcp_fc_incoming_wwpn(req, be64_to_cpu(plogi->fl_wwpn)); } static void zfcp_fc_incoming_logo(struct zfcp_fsf_req *req) @@ -306,7 +307,7 @@ static void zfcp_fc_incoming_logo(struct zfcp_fsf_req *req) struct fc_els_logo *logo = (struct fc_els_logo *) status_buffer->payload.data; - zfcp_fc_incoming_wwpn(req, logo->fl_n_port_wwn); + zfcp_fc_incoming_wwpn(req, be64_to_cpu(logo->fl_n_port_wwn)); } /** @@ -335,7 +336,7 @@ static void zfcp_fc_ns_gid_pn_eval(struct zfcp_fc_req *fc_req) if (ct_els->status) return; - if (gid_pn_rsp->ct_hdr.ct_cmd != FC_FS_ACC) + if (gid_pn_rsp->ct_hdr.ct_cmd != cpu_to_be16(FC_FS_ACC)) return; /* looks like a valid d_id */ @@ -352,8 +353,8 @@ static void zfcp_fc_ct_ns_init(struct fc_ct_hdr *ct_hdr, u16 cmd, u16 mr_size) ct_hdr->ct_rev = FC_CT_REV; ct_hdr->ct_fs_type = FC_FST_DIR; ct_hdr->ct_fs_subtype = FC_NS_SUBTYPE; - ct_hdr->ct_cmd = cmd; - ct_hdr->ct_mr_size = mr_size / 4; + ct_hdr->ct_cmd = cpu_to_be16(cmd); + ct_hdr->ct_mr_size = cpu_to_be16(mr_size / 4); } static int zfcp_fc_ns_gid_pn_request(struct zfcp_port *port, @@ -376,7 +377,7 @@ static int zfcp_fc_ns_gid_pn_request(struct zfcp_port *port, zfcp_fc_ct_ns_init(&gid_pn_req->ct_hdr, FC_NS_GID_PN, ZFCP_FC_CT_SIZE_PAGE); - gid_pn_req->gid_pn.fn_wwpn = port->wwpn; + gid_pn_req->gid_pn.fn_wwpn = cpu_to_be64(port->wwpn); ret = zfcp_fsf_send_ct(&adapter->gs->ds, &fc_req->ct_els, adapter->pool.gid_pn_req, @@ -460,26 +461,26 @@ void zfcp_fc_trigger_did_lookup(struct zfcp_port *port) */ void zfcp_fc_plogi_evaluate(struct zfcp_port *port, struct fc_els_flogi *plogi) { - if (plogi->fl_wwpn != port->wwpn) { + if (be64_to_cpu(plogi->fl_wwpn) != port->wwpn) { port->d_id = 0; dev_warn(&port->adapter->ccw_device->dev, "A port opened with WWPN 0x%016Lx returned data that " "identifies it as WWPN 0x%016Lx\n", (unsigned long long) port->wwpn, - (unsigned long long) plogi->fl_wwpn); + (unsigned long long) be64_to_cpu(plogi->fl_wwpn)); return; } - port->wwnn = plogi->fl_wwnn; - port->maxframe_size = plogi->fl_csp.sp_bb_data; + port->wwnn = be64_to_cpu(plogi->fl_wwnn); + port->maxframe_size = be16_to_cpu(plogi->fl_csp.sp_bb_data); - if (plogi->fl_cssp[0].cp_class & FC_CPC_VALID) + if (plogi->fl_cssp[0].cp_class & cpu_to_be16(FC_CPC_VALID)) port->supported_classes |= FC_COS_CLASS1; - if (plogi->fl_cssp[1].cp_class & FC_CPC_VALID) + if (plogi->fl_cssp[1].cp_class & cpu_to_be16(FC_CPC_VALID)) port->supported_classes |= FC_COS_CLASS2; - if (plogi->fl_cssp[2].cp_class & FC_CPC_VALID) + if (plogi->fl_cssp[2].cp_class & cpu_to_be16(FC_CPC_VALID)) port->supported_classes |= FC_COS_CLASS3; - if (plogi->fl_cssp[3].cp_class & FC_CPC_VALID) + if (plogi->fl_cssp[3].cp_class & cpu_to_be16(FC_CPC_VALID)) port->supported_classes |= FC_COS_CLASS4; } @@ -497,9 +498,9 @@ static void zfcp_fc_adisc_handler(void *data) } if (!port->wwnn) - port->wwnn = adisc_resp->adisc_wwnn; + port->wwnn = be64_to_cpu(adisc_resp->adisc_wwnn); - if ((port->wwpn != adisc_resp->adisc_wwpn) || + if ((port->wwpn != be64_to_cpu(adisc_resp->adisc_wwpn)) || !(atomic_read(&port->status) & ZFCP_STATUS_COMMON_OPEN)) { zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED, "fcadh_2"); @@ -538,8 +539,8 @@ static int zfcp_fc_adisc(struct zfcp_port *port) /* acc. to FC-FS, hard_nport_id in ADISC should not be set for ports without FC-AL-2 capability, so we don't set it */ - fc_req->u.adisc.req.adisc_wwpn = fc_host_port_name(shost); - fc_req->u.adisc.req.adisc_wwnn = fc_host_node_name(shost); + fc_req->u.adisc.req.adisc_wwpn = cpu_to_be64(fc_host_port_name(shost)); + fc_req->u.adisc.req.adisc_wwnn = cpu_to_be64(fc_host_node_name(shost)); fc_req->u.adisc.req.adisc_cmd = ELS_ADISC; hton24(fc_req->u.adisc.req.adisc_port_id, fc_host_port_id(shost)); @@ -666,7 +667,7 @@ static int zfcp_fc_eval_gpn_ft(struct zfcp_fc_req *fc_req, if (ct_els->status) return -EIO; - if (hdr->ct_cmd != FC_FS_ACC) { + if (hdr->ct_cmd != cpu_to_be16(FC_FS_ACC)) { if (hdr->ct_reason == FC_FS_RJT_UNABL) return -EAGAIN; /* might be a temporary condition */ return -EIO; @@ -693,10 +694,11 @@ static int zfcp_fc_eval_gpn_ft(struct zfcp_fc_req *fc_req, if (d_id >= FC_FID_WELL_KNOWN_BASE) continue; /* skip the adapter's port and known remote ports */ - if (acc->fp_wwpn == fc_host_port_name(adapter->scsi_host)) + if (be64_to_cpu(acc->fp_wwpn) == + fc_host_port_name(adapter->scsi_host)) continue; - port = zfcp_port_enqueue(adapter, acc->fp_wwpn, + port = zfcp_port_enqueue(adapter, be64_to_cpu(acc->fp_wwpn), ZFCP_STATUS_COMMON_NOESC, d_id); if (!IS_ERR(port)) zfcp_erp_port_reopen(port, 0, "fcegpf1"); diff --git a/drivers/s390/scsi/zfcp_fc.h b/drivers/s390/scsi/zfcp_fc.h index a2275825186f..41f22d3dc6d1 100644 --- a/drivers/s390/scsi/zfcp_fc.h +++ b/drivers/s390/scsi/zfcp_fc.h @@ -212,6 +212,8 @@ static inline void zfcp_fc_scsi_to_fcp(struct fcp_cmnd *fcp, struct scsi_cmnd *scsi, u8 tm_flags) { + u32 datalen; + int_to_scsilun(scsi->device->lun, (struct scsi_lun *) &fcp->fc_lun); if (unlikely(tm_flags)) { @@ -228,10 +230,13 @@ void zfcp_fc_scsi_to_fcp(struct fcp_cmnd *fcp, struct scsi_cmnd *scsi, memcpy(fcp->fc_cdb, scsi->cmnd, scsi->cmd_len); - fcp->fc_dl = scsi_bufflen(scsi); + datalen = scsi_bufflen(scsi); + fcp->fc_dl = cpu_to_be32(datalen); - if (scsi_get_prot_type(scsi) == SCSI_PROT_DIF_TYPE1) - fcp->fc_dl += fcp->fc_dl / scsi->device->sector_size * 8; + if (scsi_get_prot_type(scsi) == SCSI_PROT_DIF_TYPE1) { + datalen += datalen / scsi->device->sector_size * 8; + fcp->fc_dl = cpu_to_be32(datalen); + } } /** @@ -266,14 +271,14 @@ void zfcp_fc_eval_fcp_rsp(struct fcp_resp_with_ext *fcp_rsp, if (unlikely(rsp_flags & FCP_SNS_LEN_VAL)) { sense = (char *) &fcp_rsp[1]; if (rsp_flags & FCP_RSP_LEN_VAL) - sense += fcp_rsp->ext.fr_rsp_len; - sense_len = min(fcp_rsp->ext.fr_sns_len, - (u32) SCSI_SENSE_BUFFERSIZE); + sense += be32_to_cpu(fcp_rsp->ext.fr_rsp_len); + sense_len = min_t(u32, be32_to_cpu(fcp_rsp->ext.fr_sns_len), + SCSI_SENSE_BUFFERSIZE); memcpy(scsi->sense_buffer, sense, sense_len); } if (unlikely(rsp_flags & FCP_RESID_UNDER)) { - resid = fcp_rsp->ext.fr_resid; + resid = be32_to_cpu(fcp_rsp->ext.fr_resid); scsi_set_resid(scsi, resid); if (scsi_bufflen(scsi) - resid < scsi->underflow && !(rsp_flags & FCP_SNS_LEN_VAL) && diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c index 6ddaee5f3701..cc923c71a0fa 100644 --- a/drivers/s390/scsi/zfcp_fsf.c +++ b/drivers/s390/scsi/zfcp_fsf.c @@ -476,8 +476,8 @@ static int zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *req) if (req->data) memcpy(req->data, bottom, sizeof(*bottom)); - fc_host_port_name(shost) = nsp->fl_wwpn; - fc_host_node_name(shost) = nsp->fl_wwnn; + fc_host_port_name(shost) = be64_to_cpu(nsp->fl_wwpn); + fc_host_node_name(shost) = be64_to_cpu(nsp->fl_wwnn); fc_host_supported_classes(shost) = FC_COS_CLASS2 | FC_COS_CLASS3; adapter->timer_ticks = bottom->timer_interval & ZFCP_FSF_TIMER_INT_MASK; @@ -503,8 +503,8 @@ static int zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *req) switch (bottom->fc_topology) { case FSF_TOPO_P2P: adapter->peer_d_id = ntoh24(bottom->peer_d_id); - adapter->peer_wwpn = plogi->fl_wwpn; - adapter->peer_wwnn = plogi->fl_wwnn; + adapter->peer_wwpn = be64_to_cpu(plogi->fl_wwpn); + adapter->peer_wwnn = be64_to_cpu(plogi->fl_wwnn); fc_host_port_type(shost) = FC_PORTTYPE_PTP; break; case FSF_TOPO_FABRIC: |