aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx
diff options
context:
space:
mode:
authorAndrew Vasquez <andrew.vasquez@qlogic.com>2005-07-06 13:30:47 -0400
committerJames Bottomley <jejb@mulgrave.(none)>2005-07-14 10:56:14 -0400
commit8c958a99d6a903ce4ffaa6780f3425a8567db9e6 (patch)
tree5c82091aacf011fbeb99bcbcab30f1ece632e792 /drivers/scsi/qla2xxx
parent6d9b61ed94fd9097f81adfa78d31c4613d9b3ae4 (diff)
[SCSI] qla2xxx: Generalize SNS generic-services routines.
Generalize SNS generic-services routines. Consolidate completion-status checking while adding support for the ISP24xx. Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/qla2xxx')
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h3
-rw-r--r--drivers/scsi/qla2xxx/qla_gbl.h4
-rw-r--r--drivers/scsi/qla2xxx/qla_gs.c181
-rw-r--r--drivers/scsi/qla2xxx/qla_mbx.c6
4 files changed, 121 insertions, 73 deletions
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 03074e52160f..61c2d4fb91a9 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -2032,8 +2032,7 @@ struct isp_operations {
2032 2032
2033 uint16_t (*calc_req_entries) (uint16_t); 2033 uint16_t (*calc_req_entries) (uint16_t);
2034 void (*build_iocbs) (srb_t *, cmd_entry_t *, uint16_t); 2034 void (*build_iocbs) (srb_t *, cmd_entry_t *, uint16_t);
2035 ms_iocb_entry_t * (*prep_ms_iocb) (struct scsi_qla_host *, uint32_t, 2035 void * (*prep_ms_iocb) (struct scsi_qla_host *, uint32_t, uint32_t);
2036 uint32_t);
2037 2036
2038 uint8_t * (*read_nvram) (struct scsi_qla_host *, uint8_t *, 2037 uint8_t * (*read_nvram) (struct scsi_qla_host *, uint8_t *,
2039 uint32_t, uint32_t); 2038 uint32_t, uint32_t);
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index ba648f69f2f5..eedb5bdec3b9 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -219,8 +219,8 @@ extern void qla2x00_dump_pkt(void *);
219/* 219/*
220 * Global Function Prototypes in qla_gs.c source file. 220 * Global Function Prototypes in qla_gs.c source file.
221 */ 221 */
222extern ms_iocb_entry_t *qla2x00_prep_ms_iocb(scsi_qla_host_t *, uint32_t, 222extern void *qla2x00_prep_ms_iocb(scsi_qla_host_t *, uint32_t, uint32_t);
223 uint32_t); 223extern void *qla24xx_prep_ms_iocb(scsi_qla_host_t *, uint32_t, uint32_t);
224extern int qla2x00_ga_nxt(scsi_qla_host_t *, fc_port_t *); 224extern int qla2x00_ga_nxt(scsi_qla_host_t *, fc_port_t *);
225extern int qla2x00_gid_pt(scsi_qla_host_t *, sw_info_t *); 225extern int qla2x00_gid_pt(scsi_qla_host_t *, sw_info_t *);
226extern int qla2x00_gpn_id(scsi_qla_host_t *, sw_info_t *); 226extern int qla2x00_gpn_id(scsi_qla_host_t *, sw_info_t *);
diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c
index 644c56431366..ec5ecbfbc1f6 100644
--- a/drivers/scsi/qla2xxx/qla_gs.c
+++ b/drivers/scsi/qla2xxx/qla_gs.c
@@ -32,14 +32,14 @@ static int qla2x00_sns_rft_id(scsi_qla_host_t *);
32static int qla2x00_sns_rnn_id(scsi_qla_host_t *); 32static int qla2x00_sns_rnn_id(scsi_qla_host_t *);
33 33
34/** 34/**
35 * qla2x00_prep_ms_iocb() - Prepare common MS IOCB fields for SNS CT query. 35 * qla2x00_prep_ms_iocb() - Prepare common MS/CT IOCB fields for SNS CT query.
36 * @ha: HA context 36 * @ha: HA context
37 * @req_size: request size in bytes 37 * @req_size: request size in bytes
38 * @rsp_size: response size in bytes 38 * @rsp_size: response size in bytes
39 * 39 *
40 * Returns a pointer to the @ha's ms_iocb. 40 * Returns a pointer to the @ha's ms_iocb.
41 */ 41 */
42ms_iocb_entry_t * 42void *
43qla2x00_prep_ms_iocb(scsi_qla_host_t *ha, uint32_t req_size, uint32_t rsp_size) 43qla2x00_prep_ms_iocb(scsi_qla_host_t *ha, uint32_t req_size, uint32_t rsp_size)
44{ 44{
45 ms_iocb_entry_t *ms_pkt; 45 ms_iocb_entry_t *ms_pkt;
@@ -69,6 +69,42 @@ qla2x00_prep_ms_iocb(scsi_qla_host_t *ha, uint32_t req_size, uint32_t rsp_size)
69} 69}
70 70
71/** 71/**
72 * qla24xx_prep_ms_iocb() - Prepare common CT IOCB fields for SNS CT query.
73 * @ha: HA context
74 * @req_size: request size in bytes
75 * @rsp_size: response size in bytes
76 *
77 * Returns a pointer to the @ha's ms_iocb.
78 */
79void *
80qla24xx_prep_ms_iocb(scsi_qla_host_t *ha, uint32_t req_size, uint32_t rsp_size)
81{
82 struct ct_entry_24xx *ct_pkt;
83
84 ct_pkt = (struct ct_entry_24xx *)ha->ms_iocb;
85 memset(ct_pkt, 0, sizeof(struct ct_entry_24xx));
86
87 ct_pkt->entry_type = CT_IOCB_TYPE;
88 ct_pkt->entry_count = 1;
89 ct_pkt->nport_handle = __constant_cpu_to_le16(NPH_SNS);
90 ct_pkt->timeout = __constant_cpu_to_le16(25);
91 ct_pkt->cmd_dsd_count = __constant_cpu_to_le16(1);
92 ct_pkt->rsp_dsd_count = __constant_cpu_to_le16(1);
93 ct_pkt->rsp_byte_count = cpu_to_le32(rsp_size);
94 ct_pkt->cmd_byte_count = cpu_to_le32(req_size);
95
96 ct_pkt->dseg_0_address[0] = cpu_to_le32(LSD(ha->ct_sns_dma));
97 ct_pkt->dseg_0_address[1] = cpu_to_le32(MSD(ha->ct_sns_dma));
98 ct_pkt->dseg_0_len = ct_pkt->cmd_byte_count;
99
100 ct_pkt->dseg_1_address[0] = cpu_to_le32(LSD(ha->ct_sns_dma));
101 ct_pkt->dseg_1_address[1] = cpu_to_le32(MSD(ha->ct_sns_dma));
102 ct_pkt->dseg_1_len = ct_pkt->rsp_byte_count;
103
104 return (ct_pkt);
105}
106
107/**
72 * qla2x00_prep_ct_req() - Prepare common CT request fields for SNS query. 108 * qla2x00_prep_ct_req() - Prepare common CT request fields for SNS query.
73 * @ct_req: CT request buffer 109 * @ct_req: CT request buffer
74 * @cmd: GS command 110 * @cmd: GS command
@@ -90,6 +126,47 @@ qla2x00_prep_ct_req(struct ct_sns_req *ct_req, uint16_t cmd, uint16_t rsp_size)
90 return (ct_req); 126 return (ct_req);
91} 127}
92 128
129static int
130qla2x00_chk_ms_status(scsi_qla_host_t *ha, ms_iocb_entry_t *ms_pkt,
131 struct ct_sns_rsp *ct_rsp, const char *routine)
132{
133 int rval;
134 uint16_t comp_status;
135
136 rval = QLA_FUNCTION_FAILED;
137 if (ms_pkt->entry_status != 0) {
138 DEBUG2_3(printk("scsi(%ld): %s failed, error status (%x).\n",
139 ha->host_no, routine, ms_pkt->entry_status));
140 } else {
141 if (IS_QLA24XX(ha) || IS_QLA25XX(ha))
142 comp_status =
143 ((struct ct_entry_24xx *)ms_pkt)->comp_status;
144 else
145 comp_status = le16_to_cpu(ms_pkt->status);
146 switch (comp_status) {
147 case CS_COMPLETE:
148 case CS_DATA_UNDERRUN:
149 case CS_DATA_OVERRUN: /* Overrun? */
150 if (ct_rsp->header.response !=
151 __constant_cpu_to_be16(CT_ACCEPT_RESPONSE)) {
152 DEBUG2_3(printk("scsi(%ld): %s failed, "
153 "rejected request:\n", ha->host_no,
154 routine));
155 DEBUG2_3(qla2x00_dump_buffer(
156 (uint8_t *)&ct_rsp->header,
157 sizeof(struct ct_rsp_hdr)));
158 } else
159 rval = QLA_SUCCESS;
160 break;
161 default:
162 DEBUG2_3(printk("scsi(%ld): %s failed, completion "
163 "status (%x).\n", ha->host_no, routine,
164 comp_status));
165 break;
166 }
167 }
168 return rval;
169}
93 170
94/** 171/**
95 * qla2x00_ga_nxt() - SNS scan for fabric devices via GA_NXT command. 172 * qla2x00_ga_nxt() - SNS scan for fabric devices via GA_NXT command.
@@ -113,7 +190,7 @@ qla2x00_ga_nxt(scsi_qla_host_t *ha, fc_port_t *fcport)
113 190
114 /* Issue GA_NXT */ 191 /* Issue GA_NXT */
115 /* Prepare common MS IOCB */ 192 /* Prepare common MS IOCB */
116 ms_pkt = qla2x00_prep_ms_iocb(ha, GA_NXT_REQ_SIZE, GA_NXT_RSP_SIZE); 193 ms_pkt = ha->isp_ops.prep_ms_iocb(ha, GA_NXT_REQ_SIZE, GA_NXT_RSP_SIZE);
117 194
118 /* Prepare CT request */ 195 /* Prepare CT request */
119 ct_req = qla2x00_prep_ct_req(&ha->ct_sns->p.req, GA_NXT_CMD, 196 ct_req = qla2x00_prep_ct_req(&ha->ct_sns->p.req, GA_NXT_CMD,
@@ -132,12 +209,8 @@ qla2x00_ga_nxt(scsi_qla_host_t *ha, fc_port_t *fcport)
132 /*EMPTY*/ 209 /*EMPTY*/
133 DEBUG2_3(printk("scsi(%ld): GA_NXT issue IOCB failed (%d).\n", 210 DEBUG2_3(printk("scsi(%ld): GA_NXT issue IOCB failed (%d).\n",
134 ha->host_no, rval)); 211 ha->host_no, rval));
135 } else if (ct_rsp->header.response != 212 } else if (qla2x00_chk_ms_status(ha, ms_pkt, ct_rsp, "GA_NXT") !=
136 __constant_cpu_to_be16(CT_ACCEPT_RESPONSE)) { 213 QLA_SUCCESS) {
137 DEBUG2_3(printk("scsi(%ld): GA_NXT failed, rejected request, "
138 "ga_nxt_rsp:\n", ha->host_no));
139 DEBUG2_3(qla2x00_dump_buffer((uint8_t *)&ct_rsp->header,
140 sizeof(struct ct_rsp_hdr)));
141 rval = QLA_FUNCTION_FAILED; 214 rval = QLA_FUNCTION_FAILED;
142 } else { 215 } else {
143 /* Populate fc_port_t entry. */ 216 /* Populate fc_port_t entry. */
@@ -203,7 +276,7 @@ qla2x00_gid_pt(scsi_qla_host_t *ha, sw_info_t *list)
203 276
204 /* Issue GID_PT */ 277 /* Issue GID_PT */
205 /* Prepare common MS IOCB */ 278 /* Prepare common MS IOCB */
206 ms_pkt = qla2x00_prep_ms_iocb(ha, GID_PT_REQ_SIZE, GID_PT_RSP_SIZE); 279 ms_pkt = ha->isp_ops.prep_ms_iocb(ha, GID_PT_REQ_SIZE, GID_PT_RSP_SIZE);
207 280
208 /* Prepare CT request */ 281 /* Prepare CT request */
209 ct_req = qla2x00_prep_ct_req(&ha->ct_sns->p.req, GID_PT_CMD, 282 ct_req = qla2x00_prep_ct_req(&ha->ct_sns->p.req, GID_PT_CMD,
@@ -220,12 +293,8 @@ qla2x00_gid_pt(scsi_qla_host_t *ha, sw_info_t *list)
220 /*EMPTY*/ 293 /*EMPTY*/
221 DEBUG2_3(printk("scsi(%ld): GID_PT issue IOCB failed (%d).\n", 294 DEBUG2_3(printk("scsi(%ld): GID_PT issue IOCB failed (%d).\n",
222 ha->host_no, rval)); 295 ha->host_no, rval));
223 } else if (ct_rsp->header.response != 296 } else if (qla2x00_chk_ms_status(ha, ms_pkt, ct_rsp, "GID_PT") !=
224 __constant_cpu_to_be16(CT_ACCEPT_RESPONSE)) { 297 QLA_SUCCESS) {
225 DEBUG2_3(printk("scsi(%ld): GID_PT failed, rejected request, "
226 "gid_pt_rsp:\n", ha->host_no));
227 DEBUG2_3(qla2x00_dump_buffer((uint8_t *)&ct_rsp->header,
228 sizeof(struct ct_rsp_hdr)));
229 rval = QLA_FUNCTION_FAILED; 298 rval = QLA_FUNCTION_FAILED;
230 } else { 299 } else {
231 /* Set port IDs in switch info list. */ 300 /* Set port IDs in switch info list. */
@@ -279,7 +348,7 @@ qla2x00_gpn_id(scsi_qla_host_t *ha, sw_info_t *list)
279 for (i = 0; i < MAX_FIBRE_DEVICES; i++) { 348 for (i = 0; i < MAX_FIBRE_DEVICES; i++) {
280 /* Issue GPN_ID */ 349 /* Issue GPN_ID */
281 /* Prepare common MS IOCB */ 350 /* Prepare common MS IOCB */
282 ms_pkt = qla2x00_prep_ms_iocb(ha, GPN_ID_REQ_SIZE, 351 ms_pkt = ha->isp_ops.prep_ms_iocb(ha, GPN_ID_REQ_SIZE,
283 GPN_ID_RSP_SIZE); 352 GPN_ID_RSP_SIZE);
284 353
285 /* Prepare CT request */ 354 /* Prepare CT request */
@@ -299,12 +368,8 @@ qla2x00_gpn_id(scsi_qla_host_t *ha, sw_info_t *list)
299 /*EMPTY*/ 368 /*EMPTY*/
300 DEBUG2_3(printk("scsi(%ld): GPN_ID issue IOCB failed " 369 DEBUG2_3(printk("scsi(%ld): GPN_ID issue IOCB failed "
301 "(%d).\n", ha->host_no, rval)); 370 "(%d).\n", ha->host_no, rval));
302 } else if (ct_rsp->header.response != 371 } else if (qla2x00_chk_ms_status(ha, ms_pkt, ct_rsp,
303 __constant_cpu_to_be16(CT_ACCEPT_RESPONSE)) { 372 "GPN_ID") != QLA_SUCCESS) {
304 DEBUG2_3(printk("scsi(%ld): GPN_ID failed, rejected "
305 "request, gpn_id_rsp:\n", ha->host_no));
306 DEBUG2_3(qla2x00_dump_buffer((uint8_t *)&ct_rsp->header,
307 sizeof(struct ct_rsp_hdr)));
308 rval = QLA_FUNCTION_FAILED; 373 rval = QLA_FUNCTION_FAILED;
309 } else { 374 } else {
310 /* Save portname */ 375 /* Save portname */
@@ -344,7 +409,7 @@ qla2x00_gnn_id(scsi_qla_host_t *ha, sw_info_t *list)
344 for (i = 0; i < MAX_FIBRE_DEVICES; i++) { 409 for (i = 0; i < MAX_FIBRE_DEVICES; i++) {
345 /* Issue GNN_ID */ 410 /* Issue GNN_ID */
346 /* Prepare common MS IOCB */ 411 /* Prepare common MS IOCB */
347 ms_pkt = qla2x00_prep_ms_iocb(ha, GNN_ID_REQ_SIZE, 412 ms_pkt = ha->isp_ops.prep_ms_iocb(ha, GNN_ID_REQ_SIZE,
348 GNN_ID_RSP_SIZE); 413 GNN_ID_RSP_SIZE);
349 414
350 /* Prepare CT request */ 415 /* Prepare CT request */
@@ -364,12 +429,8 @@ qla2x00_gnn_id(scsi_qla_host_t *ha, sw_info_t *list)
364 /*EMPTY*/ 429 /*EMPTY*/
365 DEBUG2_3(printk("scsi(%ld): GNN_ID issue IOCB failed " 430 DEBUG2_3(printk("scsi(%ld): GNN_ID issue IOCB failed "
366 "(%d).\n", ha->host_no, rval)); 431 "(%d).\n", ha->host_no, rval));
367 } else if (ct_rsp->header.response != 432 } else if (qla2x00_chk_ms_status(ha, ms_pkt, ct_rsp,
368 __constant_cpu_to_be16(CT_ACCEPT_RESPONSE)) { 433 "GNN_ID") != QLA_SUCCESS) {
369 DEBUG2_3(printk("scsi(%ld): GNN_ID failed, rejected "
370 "request, gnn_id_rsp:\n", ha->host_no));
371 DEBUG2_3(qla2x00_dump_buffer((uint8_t *)&ct_rsp->header,
372 sizeof(struct ct_rsp_hdr)));
373 rval = QLA_FUNCTION_FAILED; 434 rval = QLA_FUNCTION_FAILED;
374 } else { 435 } else {
375 /* Save nodename */ 436 /* Save nodename */
@@ -422,7 +483,7 @@ qla2x00_rft_id(scsi_qla_host_t *ha)
422 483
423 /* Issue RFT_ID */ 484 /* Issue RFT_ID */
424 /* Prepare common MS IOCB */ 485 /* Prepare common MS IOCB */
425 ms_pkt = qla2x00_prep_ms_iocb(ha, RFT_ID_REQ_SIZE, RFT_ID_RSP_SIZE); 486 ms_pkt = ha->isp_ops.prep_ms_iocb(ha, RFT_ID_REQ_SIZE, RFT_ID_RSP_SIZE);
426 487
427 /* Prepare CT request */ 488 /* Prepare CT request */
428 ct_req = qla2x00_prep_ct_req(&ha->ct_sns->p.req, RFT_ID_CMD, 489 ct_req = qla2x00_prep_ct_req(&ha->ct_sns->p.req, RFT_ID_CMD,
@@ -443,12 +504,8 @@ qla2x00_rft_id(scsi_qla_host_t *ha)
443 /*EMPTY*/ 504 /*EMPTY*/
444 DEBUG2_3(printk("scsi(%ld): RFT_ID issue IOCB failed (%d).\n", 505 DEBUG2_3(printk("scsi(%ld): RFT_ID issue IOCB failed (%d).\n",
445 ha->host_no, rval)); 506 ha->host_no, rval));
446 } else if (ct_rsp->header.response != 507 } else if (qla2x00_chk_ms_status(ha, ms_pkt, ct_rsp, "RFT_ID") !=
447 __constant_cpu_to_be16(CT_ACCEPT_RESPONSE)) { 508 QLA_SUCCESS) {
448 DEBUG2_3(printk("scsi(%ld): RFT_ID failed, rejected "
449 "request, rft_id_rsp:\n", ha->host_no));
450 DEBUG2_3(qla2x00_dump_buffer((uint8_t *)&ct_rsp->header,
451 sizeof(struct ct_rsp_hdr)));
452 rval = QLA_FUNCTION_FAILED; 509 rval = QLA_FUNCTION_FAILED;
453 } else { 510 } else {
454 DEBUG2(printk("scsi(%ld): RFT_ID exiting normally.\n", 511 DEBUG2(printk("scsi(%ld): RFT_ID exiting normally.\n",
@@ -481,7 +538,7 @@ qla2x00_rff_id(scsi_qla_host_t *ha)
481 538
482 /* Issue RFF_ID */ 539 /* Issue RFF_ID */
483 /* Prepare common MS IOCB */ 540 /* Prepare common MS IOCB */
484 ms_pkt = qla2x00_prep_ms_iocb(ha, RFF_ID_REQ_SIZE, RFF_ID_RSP_SIZE); 541 ms_pkt = ha->isp_ops.prep_ms_iocb(ha, RFF_ID_REQ_SIZE, RFF_ID_RSP_SIZE);
485 542
486 /* Prepare CT request */ 543 /* Prepare CT request */
487 ct_req = qla2x00_prep_ct_req(&ha->ct_sns->p.req, RFF_ID_CMD, 544 ct_req = qla2x00_prep_ct_req(&ha->ct_sns->p.req, RFF_ID_CMD,
@@ -502,12 +559,8 @@ qla2x00_rff_id(scsi_qla_host_t *ha)
502 /*EMPTY*/ 559 /*EMPTY*/
503 DEBUG2_3(printk("scsi(%ld): RFF_ID issue IOCB failed (%d).\n", 560 DEBUG2_3(printk("scsi(%ld): RFF_ID issue IOCB failed (%d).\n",
504 ha->host_no, rval)); 561 ha->host_no, rval));
505 } else if (ct_rsp->header.response != 562 } else if (qla2x00_chk_ms_status(ha, ms_pkt, ct_rsp, "RFF_ID") !=
506 __constant_cpu_to_be16(CT_ACCEPT_RESPONSE)) { 563 QLA_SUCCESS) {
507 DEBUG2_3(printk("scsi(%ld): RFF_ID failed, rejected "
508 "request, rff_id_rsp:\n", ha->host_no));
509 DEBUG2_3(qla2x00_dump_buffer((uint8_t *)&ct_rsp->header,
510 sizeof(struct ct_rsp_hdr)));
511 rval = QLA_FUNCTION_FAILED; 564 rval = QLA_FUNCTION_FAILED;
512 } else { 565 } else {
513 DEBUG2(printk("scsi(%ld): RFF_ID exiting normally.\n", 566 DEBUG2(printk("scsi(%ld): RFF_ID exiting normally.\n",
@@ -538,7 +591,7 @@ qla2x00_rnn_id(scsi_qla_host_t *ha)
538 591
539 /* Issue RNN_ID */ 592 /* Issue RNN_ID */
540 /* Prepare common MS IOCB */ 593 /* Prepare common MS IOCB */
541 ms_pkt = qla2x00_prep_ms_iocb(ha, RNN_ID_REQ_SIZE, RNN_ID_RSP_SIZE); 594 ms_pkt = ha->isp_ops.prep_ms_iocb(ha, RNN_ID_REQ_SIZE, RNN_ID_RSP_SIZE);
542 595
543 /* Prepare CT request */ 596 /* Prepare CT request */
544 ct_req = qla2x00_prep_ct_req(&ha->ct_sns->p.req, RNN_ID_CMD, 597 ct_req = qla2x00_prep_ct_req(&ha->ct_sns->p.req, RNN_ID_CMD,
@@ -550,7 +603,7 @@ qla2x00_rnn_id(scsi_qla_host_t *ha)
550 ct_req->req.rnn_id.port_id[1] = ha->d_id.b.area; 603 ct_req->req.rnn_id.port_id[1] = ha->d_id.b.area;
551 ct_req->req.rnn_id.port_id[2] = ha->d_id.b.al_pa; 604 ct_req->req.rnn_id.port_id[2] = ha->d_id.b.al_pa;
552 605
553 memcpy(ct_req->req.rnn_id.node_name, ha->init_cb->node_name, WWN_SIZE); 606 memcpy(ct_req->req.rnn_id.node_name, ha->node_name, WWN_SIZE);
554 607
555 /* Execute MS IOCB */ 608 /* Execute MS IOCB */
556 rval = qla2x00_issue_iocb(ha, ha->ms_iocb, ha->ms_iocb_dma, 609 rval = qla2x00_issue_iocb(ha, ha->ms_iocb, ha->ms_iocb_dma,
@@ -559,12 +612,8 @@ qla2x00_rnn_id(scsi_qla_host_t *ha)
559 /*EMPTY*/ 612 /*EMPTY*/
560 DEBUG2_3(printk("scsi(%ld): RNN_ID issue IOCB failed (%d).\n", 613 DEBUG2_3(printk("scsi(%ld): RNN_ID issue IOCB failed (%d).\n",
561 ha->host_no, rval)); 614 ha->host_no, rval));
562 } else if (ct_rsp->header.response != 615 } else if (qla2x00_chk_ms_status(ha, ms_pkt, ct_rsp, "RNN_ID") !=
563 __constant_cpu_to_be16(CT_ACCEPT_RESPONSE)) { 616 QLA_SUCCESS) {
564 DEBUG2_3(printk("scsi(%ld): RNN_ID failed, rejected "
565 "request, rnn_id_rsp:\n", ha->host_no));
566 DEBUG2_3(qla2x00_dump_buffer((uint8_t *)&ct_rsp->header,
567 sizeof(struct ct_rsp_hdr)));
568 rval = QLA_FUNCTION_FAILED; 617 rval = QLA_FUNCTION_FAILED;
569 } else { 618 } else {
570 DEBUG2(printk("scsi(%ld): RNN_ID exiting normally.\n", 619 DEBUG2(printk("scsi(%ld): RNN_ID exiting normally.\n",
@@ -600,7 +649,7 @@ qla2x00_rsnn_nn(scsi_qla_host_t *ha)
600 /* Issue RSNN_NN */ 649 /* Issue RSNN_NN */
601 /* Prepare common MS IOCB */ 650 /* Prepare common MS IOCB */
602 /* Request size adjusted after CT preparation */ 651 /* Request size adjusted after CT preparation */
603 ms_pkt = qla2x00_prep_ms_iocb(ha, 0, RSNN_NN_RSP_SIZE); 652 ms_pkt = ha->isp_ops.prep_ms_iocb(ha, 0, RSNN_NN_RSP_SIZE);
604 653
605 /* Prepare CT request */ 654 /* Prepare CT request */
606 ct_req = qla2x00_prep_ct_req(&ha->ct_sns->p.req, RSNN_NN_CMD, 655 ct_req = qla2x00_prep_ct_req(&ha->ct_sns->p.req, RSNN_NN_CMD,
@@ -608,7 +657,7 @@ qla2x00_rsnn_nn(scsi_qla_host_t *ha)
608 ct_rsp = &ha->ct_sns->p.rsp; 657 ct_rsp = &ha->ct_sns->p.rsp;
609 658
610 /* Prepare CT arguments -- node_name, symbolic node_name, size */ 659 /* Prepare CT arguments -- node_name, symbolic node_name, size */
611 memcpy(ct_req->req.rsnn_nn.node_name, ha->init_cb->node_name, WWN_SIZE); 660 memcpy(ct_req->req.rsnn_nn.node_name, ha->node_name, WWN_SIZE);
612 661
613 /* Prepare the Symbolic Node Name */ 662 /* Prepare the Symbolic Node Name */
614 /* Board type */ 663 /* Board type */
@@ -638,12 +687,8 @@ qla2x00_rsnn_nn(scsi_qla_host_t *ha)
638 /*EMPTY*/ 687 /*EMPTY*/
639 DEBUG2_3(printk("scsi(%ld): RSNN_NN issue IOCB failed (%d).\n", 688 DEBUG2_3(printk("scsi(%ld): RSNN_NN issue IOCB failed (%d).\n",
640 ha->host_no, rval)); 689 ha->host_no, rval));
641 } else if (ct_rsp->header.response != 690 } else if (qla2x00_chk_ms_status(ha, ms_pkt, ct_rsp, "RSNN_NN") !=
642 __constant_cpu_to_be16(CT_ACCEPT_RESPONSE)) { 691 QLA_SUCCESS) {
643 DEBUG2_3(printk("scsi(%ld): RSNN_NN failed, rejected "
644 "request, rsnn_id_rsp:\n", ha->host_no));
645 DEBUG2_3(qla2x00_dump_buffer((uint8_t *)&ct_rsp->header,
646 sizeof(struct ct_rsp_hdr)));
647 rval = QLA_FUNCTION_FAILED; 692 rval = QLA_FUNCTION_FAILED;
648 } else { 693 } else {
649 DEBUG2(printk("scsi(%ld): RSNN_NN exiting normally.\n", 694 DEBUG2(printk("scsi(%ld): RSNN_NN exiting normally.\n",
@@ -1025,14 +1070,14 @@ qla2x00_sns_rnn_id(scsi_qla_host_t *ha)
1025 sns_cmd->p.cmd.param[1] = ha->d_id.b.area; 1070 sns_cmd->p.cmd.param[1] = ha->d_id.b.area;
1026 sns_cmd->p.cmd.param[2] = ha->d_id.b.domain; 1071 sns_cmd->p.cmd.param[2] = ha->d_id.b.domain;
1027 1072
1028 sns_cmd->p.cmd.param[4] = ha->init_cb->node_name[7]; 1073 sns_cmd->p.cmd.param[4] = ha->node_name[7];
1029 sns_cmd->p.cmd.param[5] = ha->init_cb->node_name[6]; 1074 sns_cmd->p.cmd.param[5] = ha->node_name[6];
1030 sns_cmd->p.cmd.param[6] = ha->init_cb->node_name[5]; 1075 sns_cmd->p.cmd.param[6] = ha->node_name[5];
1031 sns_cmd->p.cmd.param[7] = ha->init_cb->node_name[4]; 1076 sns_cmd->p.cmd.param[7] = ha->node_name[4];
1032 sns_cmd->p.cmd.param[8] = ha->init_cb->node_name[3]; 1077 sns_cmd->p.cmd.param[8] = ha->node_name[3];
1033 sns_cmd->p.cmd.param[9] = ha->init_cb->node_name[2]; 1078 sns_cmd->p.cmd.param[9] = ha->node_name[2];
1034 sns_cmd->p.cmd.param[10] = ha->init_cb->node_name[1]; 1079 sns_cmd->p.cmd.param[10] = ha->node_name[1];
1035 sns_cmd->p.cmd.param[11] = ha->init_cb->node_name[0]; 1080 sns_cmd->p.cmd.param[11] = ha->node_name[0];
1036 1081
1037 /* Execute SNS command. */ 1082 /* Execute SNS command. */
1038 rval = qla2x00_send_sns(ha, ha->sns_cmd_dma, RNN_ID_SNS_CMD_SIZE / 2, 1083 rval = qla2x00_send_sns(ha, ha->sns_cmd_dma, RNN_ID_SNS_CMD_SIZE / 2,
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index b201971ff28e..f3720fa0adbf 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -822,7 +822,11 @@ qla2x00_issue_iocb(scsi_qla_host_t *ha, void* buffer, dma_addr_t phys_addr,
822 DEBUG2(printk("qla2x00_issue_iocb(%ld): failed rval 0x%x", 822 DEBUG2(printk("qla2x00_issue_iocb(%ld): failed rval 0x%x",
823 ha->host_no,rval);) 823 ha->host_no,rval);)
824 } else { 824 } else {
825 /*EMPTY*/ 825 sts_entry_t *sts_entry = (sts_entry_t *) buffer;
826
827 /* Mask reserved bits. */
828 sts_entry->entry_status &=
829 IS_QLA24XX(ha) || IS_QLA25XX(ha) ? RF_MASK_24XX :RF_MASK;
826 } 830 }
827 831
828 return rval; 832 return rval;