Commit f631b4be authored by Andrew Vasquez's avatar Andrew Vasquez Committed by James Bottomley

[SCSI] lpfc: use wwn_to_u64() transport helper

Signed-off-by: default avatarAndrew Vasquez <andrew.vasquez@qlogic.com>
Acked-by: default avatarSmart, James <James.Smart@emulex.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent f8b02a85
...@@ -966,21 +966,21 @@ static void ...@@ -966,21 +966,21 @@ static void
lpfc_get_host_fabric_name (struct Scsi_Host *shost) lpfc_get_host_fabric_name (struct Scsi_Host *shost)
{ {
struct lpfc_hba *phba = (struct lpfc_hba*)shost->hostdata[0]; struct lpfc_hba *phba = (struct lpfc_hba*)shost->hostdata[0];
u64 nodename; u64 node_name;
spin_lock_irq(shost->host_lock); spin_lock_irq(shost->host_lock);
if ((phba->fc_flag & FC_FABRIC) || if ((phba->fc_flag & FC_FABRIC) ||
((phba->fc_topology == TOPOLOGY_LOOP) && ((phba->fc_topology == TOPOLOGY_LOOP) &&
(phba->fc_flag & FC_PUBLIC_LOOP))) (phba->fc_flag & FC_PUBLIC_LOOP)))
memcpy(&nodename, &phba->fc_fabparam.nodeName, sizeof(u64)); node_name = wwn_to_u64(phba->fc_fabparam.nodeName.wwn);
else else
/* fabric is local port if there is no F/FL_Port */ /* fabric is local port if there is no F/FL_Port */
memcpy(&nodename, &phba->fc_nodename, sizeof(u64)); node_name = wwn_to_u64(phba->fc_nodename.wwn);
spin_unlock_irq(shost->host_lock); spin_unlock_irq(shost->host_lock);
fc_host_fabric_name(shost) = be64_to_cpu(nodename); fc_host_fabric_name(shost) = node_name;
} }
...@@ -1103,21 +1103,20 @@ lpfc_get_starget_node_name(struct scsi_target *starget) ...@@ -1103,21 +1103,20 @@ lpfc_get_starget_node_name(struct scsi_target *starget)
{ {
struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
struct lpfc_hba *phba = (struct lpfc_hba *) shost->hostdata[0]; struct lpfc_hba *phba = (struct lpfc_hba *) shost->hostdata[0];
uint64_t node_name = 0; u64 node_name = 0;
struct lpfc_nodelist *ndlp = NULL; struct lpfc_nodelist *ndlp = NULL;
spin_lock_irq(shost->host_lock); spin_lock_irq(shost->host_lock);
/* Search the mapped list for this target ID */ /* Search the mapped list for this target ID */
list_for_each_entry(ndlp, &phba->fc_nlpmap_list, nlp_listp) { list_for_each_entry(ndlp, &phba->fc_nlpmap_list, nlp_listp) {
if (starget->id == ndlp->nlp_sid) { if (starget->id == ndlp->nlp_sid) {
memcpy(&node_name, &ndlp->nlp_nodename, node_name = wwn_to_u64(ndlp->nlp_nodename.wwn);
sizeof(struct lpfc_name));
break; break;
} }
} }
spin_unlock_irq(shost->host_lock); spin_unlock_irq(shost->host_lock);
fc_starget_node_name(starget) = be64_to_cpu(node_name); fc_starget_node_name(starget) = node_name;
} }
static void static void
...@@ -1125,21 +1124,20 @@ lpfc_get_starget_port_name(struct scsi_target *starget) ...@@ -1125,21 +1124,20 @@ lpfc_get_starget_port_name(struct scsi_target *starget)
{ {
struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
struct lpfc_hba *phba = (struct lpfc_hba *) shost->hostdata[0]; struct lpfc_hba *phba = (struct lpfc_hba *) shost->hostdata[0];
uint64_t port_name = 0; u64 port_name = 0;
struct lpfc_nodelist *ndlp = NULL; struct lpfc_nodelist *ndlp = NULL;
spin_lock_irq(shost->host_lock); spin_lock_irq(shost->host_lock);
/* Search the mapped list for this target ID */ /* Search the mapped list for this target ID */
list_for_each_entry(ndlp, &phba->fc_nlpmap_list, nlp_listp) { list_for_each_entry(ndlp, &phba->fc_nlpmap_list, nlp_listp) {
if (starget->id == ndlp->nlp_sid) { if (starget->id == ndlp->nlp_sid) {
memcpy(&port_name, &ndlp->nlp_portname, port_name = wwn_to_u64(ndlp->nlp_portname.wwn);
sizeof(struct lpfc_name));
break; break;
} }
} }
spin_unlock_irq(shost->host_lock); spin_unlock_irq(shost->host_lock);
fc_starget_port_name(starget) = be64_to_cpu(port_name); fc_starget_port_name(starget) = port_name;
} }
static void static void
......
...@@ -1017,13 +1017,10 @@ lpfc_register_remote_port(struct lpfc_hba * phba, ...@@ -1017,13 +1017,10 @@ lpfc_register_remote_port(struct lpfc_hba * phba,
struct fc_rport *rport; struct fc_rport *rport;
struct lpfc_rport_data *rdata; struct lpfc_rport_data *rdata;
struct fc_rport_identifiers rport_ids; struct fc_rport_identifiers rport_ids;
uint64_t wwn;
/* Remote port has reappeared. Re-register w/ FC transport */ /* Remote port has reappeared. Re-register w/ FC transport */
memcpy(&wwn, &ndlp->nlp_nodename, sizeof(uint64_t)); rport_ids.node_name = wwn_to_u64(ndlp->nlp_nodename.wwn);
rport_ids.node_name = be64_to_cpu(wwn); rport_ids.port_name = wwn_to_u64(ndlp->nlp_portname.wwn);
memcpy(&wwn, &ndlp->nlp_portname, sizeof(uint64_t));
rport_ids.port_name = be64_to_cpu(wwn);
rport_ids.port_id = ndlp->nlp_DID; rport_ids.port_id = ndlp->nlp_DID;
rport_ids.roles = FC_RPORT_ROLE_UNKNOWN; rport_ids.roles = FC_RPORT_ROLE_UNKNOWN;
if (ndlp->nlp_type & NLP_FCP_TARGET) if (ndlp->nlp_type & NLP_FCP_TARGET)
......
...@@ -262,12 +262,14 @@ struct lpfc_sli_ct_request { ...@@ -262,12 +262,14 @@ struct lpfc_sli_ct_request {
#define FF_FRAME_SIZE 2048 #define FF_FRAME_SIZE 2048
struct lpfc_name { struct lpfc_name {
union {
struct {
#ifdef __BIG_ENDIAN_BITFIELD #ifdef __BIG_ENDIAN_BITFIELD
uint8_t nameType:4; /* FC Word 0, bit 28:31 */ uint8_t nameType:4; /* FC Word 0, bit 28:31 */
uint8_t IEEEextMsn:4; /* FC Word 0, bit 24:27, bit 8:11 of IEEE ext */ uint8_t IEEEextMsn:4; /* FC Word 0, bit 24:27, bit 8:11 of IEEE ext */
#else /* __LITTLE_ENDIAN_BITFIELD */ #else /* __LITTLE_ENDIAN_BITFIELD */
uint8_t IEEEextMsn:4; /* FC Word 0, bit 24:27, bit 8:11 of IEEE ext */ uint8_t IEEEextMsn:4; /* FC Word 0, bit 24:27, bit 8:11 of IEEE ext */
uint8_t nameType:4; /* FC Word 0, bit 28:31 */ uint8_t nameType:4; /* FC Word 0, bit 28:31 */
#endif #endif
#define NAME_IEEE 0x1 /* IEEE name - nameType */ #define NAME_IEEE 0x1 /* IEEE name - nameType */
...@@ -276,8 +278,11 @@ struct lpfc_name { ...@@ -276,8 +278,11 @@ struct lpfc_name {
#define NAME_IP_TYPE 0x4 /* IP address */ #define NAME_IP_TYPE 0x4 /* IP address */
#define NAME_CCITT_TYPE 0xC #define NAME_CCITT_TYPE 0xC
#define NAME_CCITT_GR_TYPE 0xE #define NAME_CCITT_GR_TYPE 0xE
uint8_t IEEEextLsb; /* FC Word 0, bit 16:23, IEEE extended Lsb */ uint8_t IEEEextLsb; /* FC Word 0, bit 16:23, IEEE extended Lsb */
uint8_t IEEE[6]; /* FC IEEE address */ uint8_t IEEE[6]; /* FC IEEE address */
};
uint8_t wwn[8];
};
}; };
struct csp { struct csp {
......
...@@ -1333,7 +1333,6 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) ...@@ -1333,7 +1333,6 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
unsigned long bar0map_len, bar2map_len; unsigned long bar0map_len, bar2map_len;
int error = -ENODEV, retval; int error = -ENODEV, retval;
int i; int i;
u64 wwname;
if (pci_enable_device(pdev)) if (pci_enable_device(pdev))
goto out; goto out;
...@@ -1524,10 +1523,8 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) ...@@ -1524,10 +1523,8 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
* Must done after lpfc_sli_hba_setup() * Must done after lpfc_sli_hba_setup()
*/ */
memcpy(&wwname, &phba->fc_nodename, sizeof(u64)); fc_host_node_name(host) = wwn_to_u64(phba->fc_nodename.wwn);
fc_host_node_name(host) = be64_to_cpu(wwname); fc_host_port_name(host) = wwn_to_u64(phba->fc_portname.wwn);
memcpy(&wwname, &phba->fc_portname, sizeof(u64));
fc_host_port_name(host) = be64_to_cpu(wwname);
fc_host_supported_classes(host) = FC_COS_CLASS3; fc_host_supported_classes(host) = FC_COS_CLASS3;
memset(fc_host_supported_fc4s(host), 0, memset(fc_host_supported_fc4s(host), 0,
......
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