aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSeokmann Ju <seokmann.ju@qlogic.com>2008-04-24 18:21:29 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-04-27 13:19:59 -0400
commitc6852c4c5984fff130a859792d4b26d30c85c54b (patch)
tree2dee2906fa8cd693a391903b96cafa544340b157 /drivers
parent3b8117b837f5768f46e9a876a58de11606f63483 (diff)
[SCSI] qla2xxx: Correct misc. endian and byte-ordering issues.
There were several places in the driver which could cause byte ordering problem as provided by Al Viro <viro@ZenIV.linux.org.uk>. Signed-off-by: Seokmann Ju <seokmann.ju@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/qla2xxx/qla_fw.h26
-rw-r--r--drivers/scsi/qla2xxx/qla_gs.c4
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_mbx.c13
4 files changed, 14 insertions, 31 deletions
diff --git a/drivers/scsi/qla2xxx/qla_fw.h b/drivers/scsi/qla2xxx/qla_fw.h
index 078f2a15f40b..cf194517400d 100644
--- a/drivers/scsi/qla2xxx/qla_fw.h
+++ b/drivers/scsi/qla2xxx/qla_fw.h
@@ -1036,22 +1036,6 @@ struct mid_db_entry_24xx {
1036 uint8_t reserved_1; 1036 uint8_t reserved_1;
1037}; 1037};
1038 1038
1039 /*
1040 * Virtual Fabric ID type definition.
1041 */
1042typedef struct vf_id {
1043 uint16_t id : 12;
1044 uint16_t priority : 4;
1045} vf_id_t;
1046
1047/*
1048 * Virtual Fabric HopCt type definition.
1049 */
1050typedef struct vf_hopct {
1051 uint16_t reserved : 8;
1052 uint16_t hopct : 8;
1053} vf_hopct_t;
1054
1055/* 1039/*
1056 * Virtual Port Control IOCB 1040 * Virtual Port Control IOCB
1057 */ 1041 */
@@ -1082,10 +1066,10 @@ struct vp_ctrl_entry_24xx {
1082 1066
1083 uint8_t vp_idx_map[16]; 1067 uint8_t vp_idx_map[16];
1084 uint16_t flags; 1068 uint16_t flags;
1085 struct vf_id id; 1069 uint16_t id;
1086 uint16_t reserved_4; 1070 uint16_t reserved_4;
1087 struct vf_hopct hopct; 1071 uint16_t hopct;
1088 uint8_t reserved_5[8]; 1072 uint8_t reserved_5[24];
1089}; 1073};
1090 1074
1091/* 1075/*
@@ -1132,9 +1116,9 @@ struct vp_config_entry_24xx {
1132 uint16_t reserved_vp2; 1116 uint16_t reserved_vp2;
1133 uint8_t port_name_idx2[WWN_SIZE]; 1117 uint8_t port_name_idx2[WWN_SIZE];
1134 uint8_t node_name_idx2[WWN_SIZE]; 1118 uint8_t node_name_idx2[WWN_SIZE];
1135 struct vf_id id; 1119 uint16_t id;
1136 uint16_t reserved_4; 1120 uint16_t reserved_4;
1137 struct vf_hopct hopct; 1121 uint16_t hopct;
1138 uint8_t reserved_5; 1122 uint8_t reserved_5;
1139}; 1123};
1140 1124
diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c
index 750d7ef83aae..4cb80b476c85 100644
--- a/drivers/scsi/qla2xxx/qla_gs.c
+++ b/drivers/scsi/qla2xxx/qla_gs.c
@@ -1583,8 +1583,8 @@ qla2x00_fdmi_rpa(scsi_qla_host_t *ha)
1583 eiter->type = __constant_cpu_to_be16(FDMI_PORT_MAX_FRAME_SIZE); 1583 eiter->type = __constant_cpu_to_be16(FDMI_PORT_MAX_FRAME_SIZE);
1584 eiter->len = __constant_cpu_to_be16(4 + 4); 1584 eiter->len = __constant_cpu_to_be16(4 + 4);
1585 max_frame_size = IS_FWI2_CAPABLE(ha) ? 1585 max_frame_size = IS_FWI2_CAPABLE(ha) ?
1586 (uint32_t) icb24->frame_payload_size: 1586 le16_to_cpu(icb24->frame_payload_size):
1587 (uint32_t) ha->init_cb->frame_payload_size; 1587 le16_to_cpu(ha->init_cb->frame_payload_size);
1588 eiter->a.max_frame_size = cpu_to_be32(max_frame_size); 1588 eiter->a.max_frame_size = cpu_to_be32(max_frame_size);
1589 size += 4 + 4; 1589 size += 4 + 4;
1590 1590
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 01e26087c1dd..bbbc5a632a1d 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -3645,7 +3645,7 @@ qla24xx_nvram_config(scsi_qla_host_t *ha)
3645 if (le16_to_cpu(nv->login_timeout) < 4) 3645 if (le16_to_cpu(nv->login_timeout) < 4)
3646 nv->login_timeout = __constant_cpu_to_le16(4); 3646 nv->login_timeout = __constant_cpu_to_le16(4);
3647 ha->login_timeout = le16_to_cpu(nv->login_timeout); 3647 ha->login_timeout = le16_to_cpu(nv->login_timeout);
3648 icb->login_timeout = cpu_to_le16(nv->login_timeout); 3648 icb->login_timeout = nv->login_timeout;
3649 3649
3650 /* Set minimum RATOV to 100 tenths of a second. */ 3650 /* Set minimum RATOV to 100 tenths of a second. */
3651 ha->r_a_tov = 100; 3651 ha->r_a_tov = 100;
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 875c41860ab2..210060420809 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -1468,7 +1468,7 @@ qla24xx_login_fabric(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain,
1468 lg->port_id[0] = al_pa; 1468 lg->port_id[0] = al_pa;
1469 lg->port_id[1] = area; 1469 lg->port_id[1] = area;
1470 lg->port_id[2] = domain; 1470 lg->port_id[2] = domain;
1471 lg->vp_index = cpu_to_le16(ha->vp_idx); 1471 lg->vp_index = ha->vp_idx;
1472 rval = qla2x00_issue_iocb(ha, lg, lg_dma, 0); 1472 rval = qla2x00_issue_iocb(ha, lg, lg_dma, 0);
1473 if (rval != QLA_SUCCESS) { 1473 if (rval != QLA_SUCCESS) {
1474 DEBUG2_3_11(printk("%s(%ld): failed to issue Login IOCB " 1474 DEBUG2_3_11(printk("%s(%ld): failed to issue Login IOCB "
@@ -1723,7 +1723,7 @@ qla24xx_fabric_logout(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain,
1723 lg->port_id[0] = al_pa; 1723 lg->port_id[0] = al_pa;
1724 lg->port_id[1] = area; 1724 lg->port_id[1] = area;
1725 lg->port_id[2] = domain; 1725 lg->port_id[2] = domain;
1726 lg->vp_index = cpu_to_le16(ha->vp_idx); 1726 lg->vp_index = ha->vp_idx;
1727 rval = qla2x00_issue_iocb(ha, lg, lg_dma, 0); 1727 rval = qla2x00_issue_iocb(ha, lg, lg_dma, 0);
1728 if (rval != QLA_SUCCESS) { 1728 if (rval != QLA_SUCCESS) {
1729 DEBUG2_3_11(printk("%s(%ld): failed to issue Logout IOCB " 1729 DEBUG2_3_11(printk("%s(%ld): failed to issue Logout IOCB "
@@ -2642,12 +2642,11 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *ha,
2642 struct vp_rpt_id_entry_24xx *rptid_entry) 2642 struct vp_rpt_id_entry_24xx *rptid_entry)
2643{ 2643{
2644 uint8_t vp_idx; 2644 uint8_t vp_idx;
2645 uint16_t stat = le16_to_cpu(rptid_entry->vp_idx);
2645 scsi_qla_host_t *vha; 2646 scsi_qla_host_t *vha;
2646 2647
2647 if (rptid_entry->entry_status != 0) 2648 if (rptid_entry->entry_status != 0)
2648 return; 2649 return;
2649 if (rptid_entry->entry_status != __constant_cpu_to_le16(CS_COMPLETE))
2650 return;
2651 2650
2652 if (rptid_entry->format == 0) { 2651 if (rptid_entry->format == 0) {
2653 DEBUG15(printk("%s:format 0 : scsi(%ld) number of VPs setup %d," 2652 DEBUG15(printk("%s:format 0 : scsi(%ld) number of VPs setup %d,"
@@ -2657,17 +2656,17 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *ha,
2657 rptid_entry->port_id[2], rptid_entry->port_id[1], 2656 rptid_entry->port_id[2], rptid_entry->port_id[1],
2658 rptid_entry->port_id[0])); 2657 rptid_entry->port_id[0]));
2659 } else if (rptid_entry->format == 1) { 2658 } else if (rptid_entry->format == 1) {
2660 vp_idx = LSB(rptid_entry->vp_idx); 2659 vp_idx = LSB(stat);
2661 DEBUG15(printk("%s:format 1: scsi(%ld): VP[%d] enabled " 2660 DEBUG15(printk("%s:format 1: scsi(%ld): VP[%d] enabled "
2662 "- status %d - " 2661 "- status %d - "
2663 "with port id %02x%02x%02x\n",__func__,ha->host_no, 2662 "with port id %02x%02x%02x\n",__func__,ha->host_no,
2664 vp_idx, MSB(rptid_entry->vp_idx), 2663 vp_idx, MSB(stat),
2665 rptid_entry->port_id[2], rptid_entry->port_id[1], 2664 rptid_entry->port_id[2], rptid_entry->port_id[1],
2666 rptid_entry->port_id[0])); 2665 rptid_entry->port_id[0]));
2667 if (vp_idx == 0) 2666 if (vp_idx == 0)
2668 return; 2667 return;
2669 2668
2670 if (MSB(rptid_entry->vp_idx) == 1) 2669 if (MSB(stat) == 1)
2671 return; 2670 return;
2672 2671
2673 list_for_each_entry(vha, &ha->vp_list, vp_list) 2672 list_for_each_entry(vha, &ha->vp_list, vp_list)