2 * QLogic Fibre Channel HBA Driver
3 * Copyright (c) 2003-2005 QLogic Corporation
5 * See LICENSE.qla2xxx for copyright and licensing details.
9 static inline struct ct_sns_req
*
10 qla2x00_prep_ct_req(struct ct_sns_req
*, uint16_t, uint16_t);
12 static inline struct sns_cmd_pkt
*
13 qla2x00_prep_sns_cmd(scsi_qla_host_t
*, uint16_t, uint16_t, uint16_t);
15 static int qla2x00_sns_ga_nxt(scsi_qla_host_t
*, fc_port_t
*);
16 static int qla2x00_sns_gid_pt(scsi_qla_host_t
*, sw_info_t
*);
17 static int qla2x00_sns_gpn_id(scsi_qla_host_t
*, sw_info_t
*);
18 static int qla2x00_sns_gnn_id(scsi_qla_host_t
*, sw_info_t
*);
19 static int qla2x00_sns_rft_id(scsi_qla_host_t
*);
20 static int qla2x00_sns_rnn_id(scsi_qla_host_t
*);
23 * qla2x00_prep_ms_iocb() - Prepare common MS/CT IOCB fields for SNS CT query.
25 * @req_size: request size in bytes
26 * @rsp_size: response size in bytes
28 * Returns a pointer to the @ha's ms_iocb.
31 qla2x00_prep_ms_iocb(scsi_qla_host_t
*ha
, uint32_t req_size
, uint32_t rsp_size
)
33 ms_iocb_entry_t
*ms_pkt
;
36 memset(ms_pkt
, 0, sizeof(ms_iocb_entry_t
));
38 ms_pkt
->entry_type
= MS_IOCB_TYPE
;
39 ms_pkt
->entry_count
= 1;
40 SET_TARGET_ID(ha
, ms_pkt
->loop_id
, SIMPLE_NAME_SERVER
);
41 ms_pkt
->control_flags
= __constant_cpu_to_le16(CF_READ
| CF_HEAD_TAG
);
42 <<<<<<< HEAD
:drivers
/scsi
/qla2xxx
/qla_gs
.c
43 ms_pkt
->timeout
= __constant_cpu_to_le16(25);
45 ms_pkt
->timeout
= cpu_to_le16(ha
->r_a_tov
/ 10 * 2);
46 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:drivers
/scsi
/qla2xxx
/qla_gs
.c
47 ms_pkt
->cmd_dsd_count
= __constant_cpu_to_le16(1);
48 ms_pkt
->total_dsd_count
= __constant_cpu_to_le16(2);
49 ms_pkt
->rsp_bytecount
= cpu_to_le32(rsp_size
);
50 ms_pkt
->req_bytecount
= cpu_to_le32(req_size
);
52 ms_pkt
->dseg_req_address
[0] = cpu_to_le32(LSD(ha
->ct_sns_dma
));
53 ms_pkt
->dseg_req_address
[1] = cpu_to_le32(MSD(ha
->ct_sns_dma
));
54 ms_pkt
->dseg_req_length
= ms_pkt
->req_bytecount
;
56 ms_pkt
->dseg_rsp_address
[0] = cpu_to_le32(LSD(ha
->ct_sns_dma
));
57 ms_pkt
->dseg_rsp_address
[1] = cpu_to_le32(MSD(ha
->ct_sns_dma
));
58 ms_pkt
->dseg_rsp_length
= ms_pkt
->rsp_bytecount
;
64 * qla24xx_prep_ms_iocb() - Prepare common CT IOCB fields for SNS CT query.
66 * @req_size: request size in bytes
67 * @rsp_size: response size in bytes
69 * Returns a pointer to the @ha's ms_iocb.
72 qla24xx_prep_ms_iocb(scsi_qla_host_t
*ha
, uint32_t req_size
, uint32_t rsp_size
)
74 struct ct_entry_24xx
*ct_pkt
;
76 ct_pkt
= (struct ct_entry_24xx
*)ha
->ms_iocb
;
77 memset(ct_pkt
, 0, sizeof(struct ct_entry_24xx
));
79 ct_pkt
->entry_type
= CT_IOCB_TYPE
;
80 ct_pkt
->entry_count
= 1;
81 ct_pkt
->nport_handle
= __constant_cpu_to_le16(NPH_SNS
);
82 <<<<<<< HEAD
:drivers
/scsi
/qla2xxx
/qla_gs
.c
83 ct_pkt
->timeout
= __constant_cpu_to_le16(25);
85 ct_pkt
->timeout
= cpu_to_le16(ha
->r_a_tov
/ 10 * 2);
86 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:drivers
/scsi
/qla2xxx
/qla_gs
.c
87 ct_pkt
->cmd_dsd_count
= __constant_cpu_to_le16(1);
88 ct_pkt
->rsp_dsd_count
= __constant_cpu_to_le16(1);
89 ct_pkt
->rsp_byte_count
= cpu_to_le32(rsp_size
);
90 ct_pkt
->cmd_byte_count
= cpu_to_le32(req_size
);
92 ct_pkt
->dseg_0_address
[0] = cpu_to_le32(LSD(ha
->ct_sns_dma
));
93 ct_pkt
->dseg_0_address
[1] = cpu_to_le32(MSD(ha
->ct_sns_dma
));
94 ct_pkt
->dseg_0_len
= ct_pkt
->cmd_byte_count
;
96 ct_pkt
->dseg_1_address
[0] = cpu_to_le32(LSD(ha
->ct_sns_dma
));
97 ct_pkt
->dseg_1_address
[1] = cpu_to_le32(MSD(ha
->ct_sns_dma
));
98 ct_pkt
->dseg_1_len
= ct_pkt
->rsp_byte_count
;
99 ct_pkt
->vp_index
= ha
->vp_idx
;
105 * qla2x00_prep_ct_req() - Prepare common CT request fields for SNS query.
106 * @ct_req: CT request buffer
108 * @rsp_size: response size in bytes
110 * Returns a pointer to the intitialized @ct_req.
112 static inline struct ct_sns_req
*
113 qla2x00_prep_ct_req(struct ct_sns_req
*ct_req
, uint16_t cmd
, uint16_t rsp_size
)
115 memset(ct_req
, 0, sizeof(struct ct_sns_pkt
));
117 ct_req
->header
.revision
= 0x01;
118 ct_req
->header
.gs_type
= 0xFC;
119 ct_req
->header
.gs_subtype
= 0x02;
120 ct_req
->command
= cpu_to_be16(cmd
);
121 ct_req
->max_rsp_size
= cpu_to_be16((rsp_size
- 16) / 4);
127 qla2x00_chk_ms_status(scsi_qla_host_t
*ha
, ms_iocb_entry_t
*ms_pkt
,
128 struct ct_sns_rsp
*ct_rsp
, const char *routine
)
131 uint16_t comp_status
;
133 rval
= QLA_FUNCTION_FAILED
;
134 if (ms_pkt
->entry_status
!= 0) {
135 DEBUG2_3(printk("scsi(%ld): %s failed, error status (%x).\n",
136 ha
->host_no
, routine
, ms_pkt
->entry_status
));
138 if (IS_FWI2_CAPABLE(ha
))
139 comp_status
= le16_to_cpu(
140 ((struct ct_entry_24xx
*)ms_pkt
)->comp_status
);
142 comp_status
= le16_to_cpu(ms_pkt
->status
);
143 switch (comp_status
) {
145 case CS_DATA_UNDERRUN
:
146 case CS_DATA_OVERRUN
: /* Overrun? */
147 if (ct_rsp
->header
.response
!=
148 __constant_cpu_to_be16(CT_ACCEPT_RESPONSE
)) {
149 DEBUG2_3(printk("scsi(%ld): %s failed, "
150 "rejected request:\n", ha
->host_no
,
152 DEBUG2_3(qla2x00_dump_buffer(
153 (uint8_t *)&ct_rsp
->header
,
154 sizeof(struct ct_rsp_hdr
)));
155 rval
= QLA_INVALID_COMMAND
;
160 DEBUG2_3(printk("scsi(%ld): %s failed, completion "
161 "status (%x).\n", ha
->host_no
, routine
,
170 * qla2x00_ga_nxt() - SNS scan for fabric devices via GA_NXT command.
172 * @fcport: fcport entry to updated
174 * Returns 0 on success.
177 qla2x00_ga_nxt(scsi_qla_host_t
*ha
, fc_port_t
*fcport
)
181 ms_iocb_entry_t
*ms_pkt
;
182 struct ct_sns_req
*ct_req
;
183 struct ct_sns_rsp
*ct_rsp
;
185 if (IS_QLA2100(ha
) || IS_QLA2200(ha
)) {
186 return (qla2x00_sns_ga_nxt(ha
, fcport
));
190 /* Prepare common MS IOCB */
191 ms_pkt
= ha
->isp_ops
->prep_ms_iocb(ha
, GA_NXT_REQ_SIZE
,
194 /* Prepare CT request */
195 ct_req
= qla2x00_prep_ct_req(&ha
->ct_sns
->p
.req
, GA_NXT_CMD
,
197 ct_rsp
= &ha
->ct_sns
->p
.rsp
;
199 /* Prepare CT arguments -- port_id */
200 ct_req
->req
.port_id
.port_id
[0] = fcport
->d_id
.b
.domain
;
201 ct_req
->req
.port_id
.port_id
[1] = fcport
->d_id
.b
.area
;
202 ct_req
->req
.port_id
.port_id
[2] = fcport
->d_id
.b
.al_pa
;
204 /* Execute MS IOCB */
205 rval
= qla2x00_issue_iocb(ha
, ha
->ms_iocb
, ha
->ms_iocb_dma
,
206 sizeof(ms_iocb_entry_t
));
207 if (rval
!= QLA_SUCCESS
) {
209 DEBUG2_3(printk("scsi(%ld): GA_NXT issue IOCB failed (%d).\n",
211 } else if (qla2x00_chk_ms_status(ha
, ms_pkt
, ct_rsp
, "GA_NXT") !=
213 rval
= QLA_FUNCTION_FAILED
;
215 /* Populate fc_port_t entry. */
216 fcport
->d_id
.b
.domain
= ct_rsp
->rsp
.ga_nxt
.port_id
[0];
217 fcport
->d_id
.b
.area
= ct_rsp
->rsp
.ga_nxt
.port_id
[1];
218 fcport
->d_id
.b
.al_pa
= ct_rsp
->rsp
.ga_nxt
.port_id
[2];
220 memcpy(fcport
->node_name
, ct_rsp
->rsp
.ga_nxt
.node_name
,
222 memcpy(fcport
->port_name
, ct_rsp
->rsp
.ga_nxt
.port_name
,
225 if (ct_rsp
->rsp
.ga_nxt
.port_type
!= NS_N_PORT_TYPE
&&
226 ct_rsp
->rsp
.ga_nxt
.port_type
!= NS_NL_PORT_TYPE
)
227 fcport
->d_id
.b
.domain
= 0xf0;
229 DEBUG2_3(printk("scsi(%ld): GA_NXT entry - "
230 "nn %02x%02x%02x%02x%02x%02x%02x%02x "
231 "pn %02x%02x%02x%02x%02x%02x%02x%02x "
232 "portid=%02x%02x%02x.\n",
234 fcport
->node_name
[0], fcport
->node_name
[1],
235 fcport
->node_name
[2], fcport
->node_name
[3],
236 fcport
->node_name
[4], fcport
->node_name
[5],
237 fcport
->node_name
[6], fcport
->node_name
[7],
238 fcport
->port_name
[0], fcport
->port_name
[1],
239 fcport
->port_name
[2], fcport
->port_name
[3],
240 fcport
->port_name
[4], fcport
->port_name
[5],
241 fcport
->port_name
[6], fcport
->port_name
[7],
242 fcport
->d_id
.b
.domain
, fcport
->d_id
.b
.area
,
243 fcport
->d_id
.b
.al_pa
));
250 * qla2x00_gid_pt() - SNS scan for fabric devices via GID_PT command.
252 * @list: switch info entries to populate
254 * NOTE: Non-Nx_Ports are not requested.
256 * Returns 0 on success.
259 qla2x00_gid_pt(scsi_qla_host_t
*ha
, sw_info_t
*list
)
264 ms_iocb_entry_t
*ms_pkt
;
265 struct ct_sns_req
*ct_req
;
266 struct ct_sns_rsp
*ct_rsp
;
268 struct ct_sns_gid_pt_data
*gid_data
;
270 if (IS_QLA2100(ha
) || IS_QLA2200(ha
)) {
271 return (qla2x00_sns_gid_pt(ha
, list
));
277 /* Prepare common MS IOCB */
278 ms_pkt
= ha
->isp_ops
->prep_ms_iocb(ha
, GID_PT_REQ_SIZE
,
281 /* Prepare CT request */
282 ct_req
= qla2x00_prep_ct_req(&ha
->ct_sns
->p
.req
, GID_PT_CMD
,
284 ct_rsp
= &ha
->ct_sns
->p
.rsp
;
286 /* Prepare CT arguments -- port_type */
287 ct_req
->req
.gid_pt
.port_type
= NS_NX_PORT_TYPE
;
289 /* Execute MS IOCB */
290 rval
= qla2x00_issue_iocb(ha
, ha
->ms_iocb
, ha
->ms_iocb_dma
,
291 sizeof(ms_iocb_entry_t
));
292 if (rval
!= QLA_SUCCESS
) {
294 DEBUG2_3(printk("scsi(%ld): GID_PT issue IOCB failed (%d).\n",
296 } else if (qla2x00_chk_ms_status(ha
, ms_pkt
, ct_rsp
, "GID_PT") !=
298 rval
= QLA_FUNCTION_FAILED
;
300 /* Set port IDs in switch info list. */
301 for (i
= 0; i
< MAX_FIBRE_DEVICES
; i
++) {
302 gid_data
= &ct_rsp
->rsp
.gid_pt
.entries
[i
];
303 list
[i
].d_id
.b
.domain
= gid_data
->port_id
[0];
304 list
[i
].d_id
.b
.area
= gid_data
->port_id
[1];
305 list
[i
].d_id
.b
.al_pa
= gid_data
->port_id
[2];
306 memset(list
[i
].fabric_port_name
, 0, WWN_SIZE
);
307 list
[i
].fp_speed
= PORT_SPEED_UNKNOWN
;
310 if (gid_data
->control_byte
& BIT_7
) {
311 list
[i
].d_id
.b
.rsvd_1
= gid_data
->control_byte
;
317 * If we've used all available slots, then the switch is
318 * reporting back more devices than we can handle with this
319 * single call. Return a failed status, and let GA_NXT handle
322 if (i
== MAX_FIBRE_DEVICES
)
323 rval
= QLA_FUNCTION_FAILED
;
330 * qla2x00_gpn_id() - SNS Get Port Name (GPN_ID) query.
332 * @list: switch info entries to populate
334 * Returns 0 on success.
337 qla2x00_gpn_id(scsi_qla_host_t
*ha
, sw_info_t
*list
)
342 ms_iocb_entry_t
*ms_pkt
;
343 struct ct_sns_req
*ct_req
;
344 struct ct_sns_rsp
*ct_rsp
;
346 if (IS_QLA2100(ha
) || IS_QLA2200(ha
)) {
347 return (qla2x00_sns_gpn_id(ha
, list
));
350 for (i
= 0; i
< MAX_FIBRE_DEVICES
; i
++) {
352 /* Prepare common MS IOCB */
353 ms_pkt
= ha
->isp_ops
->prep_ms_iocb(ha
, GPN_ID_REQ_SIZE
,
356 /* Prepare CT request */
357 ct_req
= qla2x00_prep_ct_req(&ha
->ct_sns
->p
.req
, GPN_ID_CMD
,
359 ct_rsp
= &ha
->ct_sns
->p
.rsp
;
361 /* Prepare CT arguments -- port_id */
362 ct_req
->req
.port_id
.port_id
[0] = list
[i
].d_id
.b
.domain
;
363 ct_req
->req
.port_id
.port_id
[1] = list
[i
].d_id
.b
.area
;
364 ct_req
->req
.port_id
.port_id
[2] = list
[i
].d_id
.b
.al_pa
;
366 /* Execute MS IOCB */
367 rval
= qla2x00_issue_iocb(ha
, ha
->ms_iocb
, ha
->ms_iocb_dma
,
368 sizeof(ms_iocb_entry_t
));
369 if (rval
!= QLA_SUCCESS
) {
371 DEBUG2_3(printk("scsi(%ld): GPN_ID issue IOCB failed "
372 "(%d).\n", ha
->host_no
, rval
));
373 } else if (qla2x00_chk_ms_status(ha
, ms_pkt
, ct_rsp
,
374 "GPN_ID") != QLA_SUCCESS
) {
375 rval
= QLA_FUNCTION_FAILED
;
378 memcpy(list
[i
].port_name
,
379 ct_rsp
->rsp
.gpn_id
.port_name
, WWN_SIZE
);
382 /* Last device exit. */
383 if (list
[i
].d_id
.b
.rsvd_1
!= 0)
391 * qla2x00_gnn_id() - SNS Get Node Name (GNN_ID) query.
393 * @list: switch info entries to populate
395 * Returns 0 on success.
398 qla2x00_gnn_id(scsi_qla_host_t
*ha
, sw_info_t
*list
)
403 ms_iocb_entry_t
*ms_pkt
;
404 struct ct_sns_req
*ct_req
;
405 struct ct_sns_rsp
*ct_rsp
;
407 if (IS_QLA2100(ha
) || IS_QLA2200(ha
)) {
408 return (qla2x00_sns_gnn_id(ha
, list
));
411 for (i
= 0; i
< MAX_FIBRE_DEVICES
; i
++) {
413 /* Prepare common MS IOCB */
414 ms_pkt
= ha
->isp_ops
->prep_ms_iocb(ha
, GNN_ID_REQ_SIZE
,
417 /* Prepare CT request */
418 ct_req
= qla2x00_prep_ct_req(&ha
->ct_sns
->p
.req
, GNN_ID_CMD
,
420 ct_rsp
= &ha
->ct_sns
->p
.rsp
;
422 /* Prepare CT arguments -- port_id */
423 ct_req
->req
.port_id
.port_id
[0] = list
[i
].d_id
.b
.domain
;
424 ct_req
->req
.port_id
.port_id
[1] = list
[i
].d_id
.b
.area
;
425 ct_req
->req
.port_id
.port_id
[2] = list
[i
].d_id
.b
.al_pa
;
427 /* Execute MS IOCB */
428 rval
= qla2x00_issue_iocb(ha
, ha
->ms_iocb
, ha
->ms_iocb_dma
,
429 sizeof(ms_iocb_entry_t
));
430 if (rval
!= QLA_SUCCESS
) {
432 DEBUG2_3(printk("scsi(%ld): GNN_ID issue IOCB failed "
433 "(%d).\n", ha
->host_no
, rval
));
434 } else if (qla2x00_chk_ms_status(ha
, ms_pkt
, ct_rsp
,
435 "GNN_ID") != QLA_SUCCESS
) {
436 rval
= QLA_FUNCTION_FAILED
;
439 memcpy(list
[i
].node_name
,
440 ct_rsp
->rsp
.gnn_id
.node_name
, WWN_SIZE
);
442 DEBUG2_3(printk("scsi(%ld): GID_PT entry - "
443 "nn %02x%02x%02x%02x%02x%02x%02x%02x "
444 "pn %02x%02x%02x%02x%02x%02x%02x%02x "
445 "portid=%02x%02x%02x.\n",
447 list
[i
].node_name
[0], list
[i
].node_name
[1],
448 list
[i
].node_name
[2], list
[i
].node_name
[3],
449 list
[i
].node_name
[4], list
[i
].node_name
[5],
450 list
[i
].node_name
[6], list
[i
].node_name
[7],
451 list
[i
].port_name
[0], list
[i
].port_name
[1],
452 list
[i
].port_name
[2], list
[i
].port_name
[3],
453 list
[i
].port_name
[4], list
[i
].port_name
[5],
454 list
[i
].port_name
[6], list
[i
].port_name
[7],
455 list
[i
].d_id
.b
.domain
, list
[i
].d_id
.b
.area
,
456 list
[i
].d_id
.b
.al_pa
));
459 /* Last device exit. */
460 if (list
[i
].d_id
.b
.rsvd_1
!= 0)
468 * qla2x00_rft_id() - SNS Register FC-4 TYPEs (RFT_ID) supported by the HBA.
471 * Returns 0 on success.
474 qla2x00_rft_id(scsi_qla_host_t
*ha
)
478 ms_iocb_entry_t
*ms_pkt
;
479 struct ct_sns_req
*ct_req
;
480 struct ct_sns_rsp
*ct_rsp
;
482 if (IS_QLA2100(ha
) || IS_QLA2200(ha
)) {
483 return (qla2x00_sns_rft_id(ha
));
487 /* Prepare common MS IOCB */
488 ms_pkt
= ha
->isp_ops
->prep_ms_iocb(ha
, RFT_ID_REQ_SIZE
,
491 /* Prepare CT request */
492 ct_req
= qla2x00_prep_ct_req(&ha
->ct_sns
->p
.req
, RFT_ID_CMD
,
494 ct_rsp
= &ha
->ct_sns
->p
.rsp
;
496 /* Prepare CT arguments -- port_id, FC-4 types */
497 ct_req
->req
.rft_id
.port_id
[0] = ha
->d_id
.b
.domain
;
498 ct_req
->req
.rft_id
.port_id
[1] = ha
->d_id
.b
.area
;
499 ct_req
->req
.rft_id
.port_id
[2] = ha
->d_id
.b
.al_pa
;
501 ct_req
->req
.rft_id
.fc4_types
[2] = 0x01; /* FCP-3 */
503 /* Execute MS IOCB */
504 rval
= qla2x00_issue_iocb(ha
, ha
->ms_iocb
, ha
->ms_iocb_dma
,
505 sizeof(ms_iocb_entry_t
));
506 if (rval
!= QLA_SUCCESS
) {
508 DEBUG2_3(printk("scsi(%ld): RFT_ID issue IOCB failed (%d).\n",
510 } else if (qla2x00_chk_ms_status(ha
, ms_pkt
, ct_rsp
, "RFT_ID") !=
512 rval
= QLA_FUNCTION_FAILED
;
514 DEBUG2(printk("scsi(%ld): RFT_ID exiting normally.\n",
522 * qla2x00_rff_id() - SNS Register FC-4 Features (RFF_ID) supported by the HBA.
525 * Returns 0 on success.
528 qla2x00_rff_id(scsi_qla_host_t
*ha
)
532 ms_iocb_entry_t
*ms_pkt
;
533 struct ct_sns_req
*ct_req
;
534 struct ct_sns_rsp
*ct_rsp
;
536 if (IS_QLA2100(ha
) || IS_QLA2200(ha
)) {
537 DEBUG2(printk("scsi(%ld): RFF_ID call unsupported on "
538 "ISP2100/ISP2200.\n", ha
->host_no
));
539 return (QLA_SUCCESS
);
543 /* Prepare common MS IOCB */
544 ms_pkt
= ha
->isp_ops
->prep_ms_iocb(ha
, RFF_ID_REQ_SIZE
,
547 /* Prepare CT request */
548 ct_req
= qla2x00_prep_ct_req(&ha
->ct_sns
->p
.req
, RFF_ID_CMD
,
550 ct_rsp
= &ha
->ct_sns
->p
.rsp
;
552 /* Prepare CT arguments -- port_id, FC-4 feature, FC-4 type */
553 ct_req
->req
.rff_id
.port_id
[0] = ha
->d_id
.b
.domain
;
554 ct_req
->req
.rff_id
.port_id
[1] = ha
->d_id
.b
.area
;
555 ct_req
->req
.rff_id
.port_id
[2] = ha
->d_id
.b
.al_pa
;
557 ct_req
->req
.rff_id
.fc4_feature
= BIT_1
;
558 ct_req
->req
.rff_id
.fc4_type
= 0x08; /* SCSI - FCP */
560 /* Execute MS IOCB */
561 rval
= qla2x00_issue_iocb(ha
, ha
->ms_iocb
, ha
->ms_iocb_dma
,
562 sizeof(ms_iocb_entry_t
));
563 if (rval
!= QLA_SUCCESS
) {
565 DEBUG2_3(printk("scsi(%ld): RFF_ID issue IOCB failed (%d).\n",
567 } else if (qla2x00_chk_ms_status(ha
, ms_pkt
, ct_rsp
, "RFF_ID") !=
569 rval
= QLA_FUNCTION_FAILED
;
571 DEBUG2(printk("scsi(%ld): RFF_ID exiting normally.\n",
579 * qla2x00_rnn_id() - SNS Register Node Name (RNN_ID) of the HBA.
582 * Returns 0 on success.
585 qla2x00_rnn_id(scsi_qla_host_t
*ha
)
589 ms_iocb_entry_t
*ms_pkt
;
590 struct ct_sns_req
*ct_req
;
591 struct ct_sns_rsp
*ct_rsp
;
593 if (IS_QLA2100(ha
) || IS_QLA2200(ha
)) {
594 return (qla2x00_sns_rnn_id(ha
));
598 /* Prepare common MS IOCB */
599 ms_pkt
= ha
->isp_ops
->prep_ms_iocb(ha
, RNN_ID_REQ_SIZE
,
602 /* Prepare CT request */
603 ct_req
= qla2x00_prep_ct_req(&ha
->ct_sns
->p
.req
, RNN_ID_CMD
,
605 ct_rsp
= &ha
->ct_sns
->p
.rsp
;
607 /* Prepare CT arguments -- port_id, node_name */
608 ct_req
->req
.rnn_id
.port_id
[0] = ha
->d_id
.b
.domain
;
609 ct_req
->req
.rnn_id
.port_id
[1] = ha
->d_id
.b
.area
;
610 ct_req
->req
.rnn_id
.port_id
[2] = ha
->d_id
.b
.al_pa
;
612 memcpy(ct_req
->req
.rnn_id
.node_name
, ha
->node_name
, WWN_SIZE
);
614 /* Execute MS IOCB */
615 rval
= qla2x00_issue_iocb(ha
, ha
->ms_iocb
, ha
->ms_iocb_dma
,
616 sizeof(ms_iocb_entry_t
));
617 if (rval
!= QLA_SUCCESS
) {
619 DEBUG2_3(printk("scsi(%ld): RNN_ID issue IOCB failed (%d).\n",
621 } else if (qla2x00_chk_ms_status(ha
, ms_pkt
, ct_rsp
, "RNN_ID") !=
623 rval
= QLA_FUNCTION_FAILED
;
625 DEBUG2(printk("scsi(%ld): RNN_ID exiting normally.\n",
633 qla2x00_get_sym_node_name(scsi_qla_host_t
*ha
, uint8_t *snn
)
635 sprintf(snn
, "%s FW:v%d.%02d.%02d DVR:v%s",ha
->model_number
,
636 ha
->fw_major_version
, ha
->fw_minor_version
,
637 ha
->fw_subminor_version
, qla2x00_version_str
);
641 * qla2x00_rsnn_nn() - SNS Register Symbolic Node Name (RSNN_NN) of the HBA.
644 * Returns 0 on success.
647 qla2x00_rsnn_nn(scsi_qla_host_t
*ha
)
650 ms_iocb_entry_t
*ms_pkt
;
651 struct ct_sns_req
*ct_req
;
652 struct ct_sns_rsp
*ct_rsp
;
654 if (IS_QLA2100(ha
) || IS_QLA2200(ha
)) {
655 DEBUG2(printk("scsi(%ld): RSNN_ID call unsupported on "
656 "ISP2100/ISP2200.\n", ha
->host_no
));
657 return (QLA_SUCCESS
);
661 /* Prepare common MS IOCB */
662 /* Request size adjusted after CT preparation */
663 ms_pkt
= ha
->isp_ops
->prep_ms_iocb(ha
, 0, RSNN_NN_RSP_SIZE
);
665 /* Prepare CT request */
666 ct_req
= qla2x00_prep_ct_req(&ha
->ct_sns
->p
.req
, RSNN_NN_CMD
,
668 ct_rsp
= &ha
->ct_sns
->p
.rsp
;
670 /* Prepare CT arguments -- node_name, symbolic node_name, size */
671 memcpy(ct_req
->req
.rsnn_nn
.node_name
, ha
->node_name
, WWN_SIZE
);
673 /* Prepare the Symbolic Node Name */
674 qla2x00_get_sym_node_name(ha
, ct_req
->req
.rsnn_nn
.sym_node_name
);
676 /* Calculate SNN length */
677 ct_req
->req
.rsnn_nn
.name_len
=
678 (uint8_t)strlen(ct_req
->req
.rsnn_nn
.sym_node_name
);
680 /* Update MS IOCB request */
681 ms_pkt
->req_bytecount
=
682 cpu_to_le32(24 + 1 + ct_req
->req
.rsnn_nn
.name_len
);
683 ms_pkt
->dseg_req_length
= ms_pkt
->req_bytecount
;
685 /* Execute MS IOCB */
686 rval
= qla2x00_issue_iocb(ha
, ha
->ms_iocb
, ha
->ms_iocb_dma
,
687 sizeof(ms_iocb_entry_t
));
688 if (rval
!= QLA_SUCCESS
) {
690 DEBUG2_3(printk("scsi(%ld): RSNN_NN issue IOCB failed (%d).\n",
692 } else if (qla2x00_chk_ms_status(ha
, ms_pkt
, ct_rsp
, "RSNN_NN") !=
694 rval
= QLA_FUNCTION_FAILED
;
696 DEBUG2(printk("scsi(%ld): RSNN_NN exiting normally.\n",
704 * qla2x00_prep_sns_cmd() - Prepare common SNS command request fields for query.
707 * @scmd_len: Subcommand length
708 * @data_size: response size in bytes
710 * Returns a pointer to the @ha's sns_cmd.
712 static inline struct sns_cmd_pkt
*
713 qla2x00_prep_sns_cmd(scsi_qla_host_t
*ha
, uint16_t cmd
, uint16_t scmd_len
,
717 struct sns_cmd_pkt
*sns_cmd
;
719 sns_cmd
= ha
->sns_cmd
;
720 memset(sns_cmd
, 0, sizeof(struct sns_cmd_pkt
));
721 wc
= data_size
/ 2; /* Size in 16bit words. */
722 sns_cmd
->p
.cmd
.buffer_length
= cpu_to_le16(wc
);
723 sns_cmd
->p
.cmd
.buffer_address
[0] = cpu_to_le32(LSD(ha
->sns_cmd_dma
));
724 sns_cmd
->p
.cmd
.buffer_address
[1] = cpu_to_le32(MSD(ha
->sns_cmd_dma
));
725 sns_cmd
->p
.cmd
.subcommand_length
= cpu_to_le16(scmd_len
);
726 sns_cmd
->p
.cmd
.subcommand
= cpu_to_le16(cmd
);
727 wc
= (data_size
- 16) / 4; /* Size in 32bit words. */
728 sns_cmd
->p
.cmd
.size
= cpu_to_le16(wc
);
734 * qla2x00_sns_ga_nxt() - SNS scan for fabric devices via GA_NXT command.
736 * @fcport: fcport entry to updated
738 * This command uses the old Exectute SNS Command mailbox routine.
740 * Returns 0 on success.
743 qla2x00_sns_ga_nxt(scsi_qla_host_t
*ha
, fc_port_t
*fcport
)
747 struct sns_cmd_pkt
*sns_cmd
;
750 /* Prepare SNS command request. */
751 sns_cmd
= qla2x00_prep_sns_cmd(ha
, GA_NXT_CMD
, GA_NXT_SNS_SCMD_LEN
,
752 GA_NXT_SNS_DATA_SIZE
);
754 /* Prepare SNS command arguments -- port_id. */
755 sns_cmd
->p
.cmd
.param
[0] = fcport
->d_id
.b
.al_pa
;
756 sns_cmd
->p
.cmd
.param
[1] = fcport
->d_id
.b
.area
;
757 sns_cmd
->p
.cmd
.param
[2] = fcport
->d_id
.b
.domain
;
759 /* Execute SNS command. */
760 rval
= qla2x00_send_sns(ha
, ha
->sns_cmd_dma
, GA_NXT_SNS_CMD_SIZE
/ 2,
761 sizeof(struct sns_cmd_pkt
));
762 if (rval
!= QLA_SUCCESS
) {
764 DEBUG2_3(printk("scsi(%ld): GA_NXT Send SNS failed (%d).\n",
766 } else if (sns_cmd
->p
.gan_data
[8] != 0x80 ||
767 sns_cmd
->p
.gan_data
[9] != 0x02) {
768 DEBUG2_3(printk("scsi(%ld): GA_NXT failed, rejected request, "
769 "ga_nxt_rsp:\n", ha
->host_no
));
770 DEBUG2_3(qla2x00_dump_buffer(sns_cmd
->p
.gan_data
, 16));
771 rval
= QLA_FUNCTION_FAILED
;
773 /* Populate fc_port_t entry. */
774 fcport
->d_id
.b
.domain
= sns_cmd
->p
.gan_data
[17];
775 fcport
->d_id
.b
.area
= sns_cmd
->p
.gan_data
[18];
776 fcport
->d_id
.b
.al_pa
= sns_cmd
->p
.gan_data
[19];
778 memcpy(fcport
->node_name
, &sns_cmd
->p
.gan_data
[284], WWN_SIZE
);
779 memcpy(fcport
->port_name
, &sns_cmd
->p
.gan_data
[20], WWN_SIZE
);
781 if (sns_cmd
->p
.gan_data
[16] != NS_N_PORT_TYPE
&&
782 sns_cmd
->p
.gan_data
[16] != NS_NL_PORT_TYPE
)
783 fcport
->d_id
.b
.domain
= 0xf0;
785 DEBUG2_3(printk("scsi(%ld): GA_NXT entry - "
786 "nn %02x%02x%02x%02x%02x%02x%02x%02x "
787 "pn %02x%02x%02x%02x%02x%02x%02x%02x "
788 "portid=%02x%02x%02x.\n",
790 fcport
->node_name
[0], fcport
->node_name
[1],
791 fcport
->node_name
[2], fcport
->node_name
[3],
792 fcport
->node_name
[4], fcport
->node_name
[5],
793 fcport
->node_name
[6], fcport
->node_name
[7],
794 fcport
->port_name
[0], fcport
->port_name
[1],
795 fcport
->port_name
[2], fcport
->port_name
[3],
796 fcport
->port_name
[4], fcport
->port_name
[5],
797 fcport
->port_name
[6], fcport
->port_name
[7],
798 fcport
->d_id
.b
.domain
, fcport
->d_id
.b
.area
,
799 fcport
->d_id
.b
.al_pa
));
806 * qla2x00_sns_gid_pt() - SNS scan for fabric devices via GID_PT command.
808 * @list: switch info entries to populate
810 * This command uses the old Exectute SNS Command mailbox routine.
812 * NOTE: Non-Nx_Ports are not requested.
814 * Returns 0 on success.
817 qla2x00_sns_gid_pt(scsi_qla_host_t
*ha
, sw_info_t
*list
)
823 struct sns_cmd_pkt
*sns_cmd
;
826 /* Prepare SNS command request. */
827 sns_cmd
= qla2x00_prep_sns_cmd(ha
, GID_PT_CMD
, GID_PT_SNS_SCMD_LEN
,
828 GID_PT_SNS_DATA_SIZE
);
830 /* Prepare SNS command arguments -- port_type. */
831 sns_cmd
->p
.cmd
.param
[0] = NS_NX_PORT_TYPE
;
833 /* Execute SNS command. */
834 rval
= qla2x00_send_sns(ha
, ha
->sns_cmd_dma
, GID_PT_SNS_CMD_SIZE
/ 2,
835 sizeof(struct sns_cmd_pkt
));
836 if (rval
!= QLA_SUCCESS
) {
838 DEBUG2_3(printk("scsi(%ld): GID_PT Send SNS failed (%d).\n",
840 } else if (sns_cmd
->p
.gid_data
[8] != 0x80 ||
841 sns_cmd
->p
.gid_data
[9] != 0x02) {
842 DEBUG2_3(printk("scsi(%ld): GID_PT failed, rejected request, "
843 "gid_rsp:\n", ha
->host_no
));
844 DEBUG2_3(qla2x00_dump_buffer(sns_cmd
->p
.gid_data
, 16));
845 rval
= QLA_FUNCTION_FAILED
;
847 /* Set port IDs in switch info list. */
848 for (i
= 0; i
< MAX_FIBRE_DEVICES
; i
++) {
849 entry
= &sns_cmd
->p
.gid_data
[(i
* 4) + 16];
850 list
[i
].d_id
.b
.domain
= entry
[1];
851 list
[i
].d_id
.b
.area
= entry
[2];
852 list
[i
].d_id
.b
.al_pa
= entry
[3];
855 if (entry
[0] & BIT_7
) {
856 list
[i
].d_id
.b
.rsvd_1
= entry
[0];
862 * If we've used all available slots, then the switch is
863 * reporting back more devices that we can handle with this
864 * single call. Return a failed status, and let GA_NXT handle
867 if (i
== MAX_FIBRE_DEVICES
)
868 rval
= QLA_FUNCTION_FAILED
;
875 * qla2x00_sns_gpn_id() - SNS Get Port Name (GPN_ID) query.
877 * @list: switch info entries to populate
879 * This command uses the old Exectute SNS Command mailbox routine.
881 * Returns 0 on success.
884 qla2x00_sns_gpn_id(scsi_qla_host_t
*ha
, sw_info_t
*list
)
889 struct sns_cmd_pkt
*sns_cmd
;
891 for (i
= 0; i
< MAX_FIBRE_DEVICES
; i
++) {
893 /* Prepare SNS command request. */
894 sns_cmd
= qla2x00_prep_sns_cmd(ha
, GPN_ID_CMD
,
895 GPN_ID_SNS_SCMD_LEN
, GPN_ID_SNS_DATA_SIZE
);
897 /* Prepare SNS command arguments -- port_id. */
898 sns_cmd
->p
.cmd
.param
[0] = list
[i
].d_id
.b
.al_pa
;
899 sns_cmd
->p
.cmd
.param
[1] = list
[i
].d_id
.b
.area
;
900 sns_cmd
->p
.cmd
.param
[2] = list
[i
].d_id
.b
.domain
;
902 /* Execute SNS command. */
903 rval
= qla2x00_send_sns(ha
, ha
->sns_cmd_dma
,
904 GPN_ID_SNS_CMD_SIZE
/ 2, sizeof(struct sns_cmd_pkt
));
905 if (rval
!= QLA_SUCCESS
) {
907 DEBUG2_3(printk("scsi(%ld): GPN_ID Send SNS failed "
908 "(%d).\n", ha
->host_no
, rval
));
909 } else if (sns_cmd
->p
.gpn_data
[8] != 0x80 ||
910 sns_cmd
->p
.gpn_data
[9] != 0x02) {
911 DEBUG2_3(printk("scsi(%ld): GPN_ID failed, rejected "
912 "request, gpn_rsp:\n", ha
->host_no
));
913 DEBUG2_3(qla2x00_dump_buffer(sns_cmd
->p
.gpn_data
, 16));
914 rval
= QLA_FUNCTION_FAILED
;
917 memcpy(list
[i
].port_name
, &sns_cmd
->p
.gpn_data
[16],
921 /* Last device exit. */
922 if (list
[i
].d_id
.b
.rsvd_1
!= 0)
930 * qla2x00_sns_gnn_id() - SNS Get Node Name (GNN_ID) query.
932 * @list: switch info entries to populate
934 * This command uses the old Exectute SNS Command mailbox routine.
936 * Returns 0 on success.
939 qla2x00_sns_gnn_id(scsi_qla_host_t
*ha
, sw_info_t
*list
)
944 struct sns_cmd_pkt
*sns_cmd
;
946 for (i
= 0; i
< MAX_FIBRE_DEVICES
; i
++) {
948 /* Prepare SNS command request. */
949 sns_cmd
= qla2x00_prep_sns_cmd(ha
, GNN_ID_CMD
,
950 GNN_ID_SNS_SCMD_LEN
, GNN_ID_SNS_DATA_SIZE
);
952 /* Prepare SNS command arguments -- port_id. */
953 sns_cmd
->p
.cmd
.param
[0] = list
[i
].d_id
.b
.al_pa
;
954 sns_cmd
->p
.cmd
.param
[1] = list
[i
].d_id
.b
.area
;
955 sns_cmd
->p
.cmd
.param
[2] = list
[i
].d_id
.b
.domain
;
957 /* Execute SNS command. */
958 rval
= qla2x00_send_sns(ha
, ha
->sns_cmd_dma
,
959 GNN_ID_SNS_CMD_SIZE
/ 2, sizeof(struct sns_cmd_pkt
));
960 if (rval
!= QLA_SUCCESS
) {
962 DEBUG2_3(printk("scsi(%ld): GNN_ID Send SNS failed "
963 "(%d).\n", ha
->host_no
, rval
));
964 } else if (sns_cmd
->p
.gnn_data
[8] != 0x80 ||
965 sns_cmd
->p
.gnn_data
[9] != 0x02) {
966 DEBUG2_3(printk("scsi(%ld): GNN_ID failed, rejected "
967 "request, gnn_rsp:\n", ha
->host_no
));
968 DEBUG2_3(qla2x00_dump_buffer(sns_cmd
->p
.gnn_data
, 16));
969 rval
= QLA_FUNCTION_FAILED
;
972 memcpy(list
[i
].node_name
, &sns_cmd
->p
.gnn_data
[16],
975 DEBUG2_3(printk("scsi(%ld): GID_PT entry - "
976 "nn %02x%02x%02x%02x%02x%02x%02x%02x "
977 "pn %02x%02x%02x%02x%02x%02x%02x%02x "
978 "portid=%02x%02x%02x.\n",
980 list
[i
].node_name
[0], list
[i
].node_name
[1],
981 list
[i
].node_name
[2], list
[i
].node_name
[3],
982 list
[i
].node_name
[4], list
[i
].node_name
[5],
983 list
[i
].node_name
[6], list
[i
].node_name
[7],
984 list
[i
].port_name
[0], list
[i
].port_name
[1],
985 list
[i
].port_name
[2], list
[i
].port_name
[3],
986 list
[i
].port_name
[4], list
[i
].port_name
[5],
987 list
[i
].port_name
[6], list
[i
].port_name
[7],
988 list
[i
].d_id
.b
.domain
, list
[i
].d_id
.b
.area
,
989 list
[i
].d_id
.b
.al_pa
));
992 /* Last device exit. */
993 if (list
[i
].d_id
.b
.rsvd_1
!= 0)
1001 * qla2x00_snd_rft_id() - SNS Register FC-4 TYPEs (RFT_ID) supported by the HBA.
1004 * This command uses the old Exectute SNS Command mailbox routine.
1006 * Returns 0 on success.
1009 qla2x00_sns_rft_id(scsi_qla_host_t
*ha
)
1013 struct sns_cmd_pkt
*sns_cmd
;
1016 /* Prepare SNS command request. */
1017 sns_cmd
= qla2x00_prep_sns_cmd(ha
, RFT_ID_CMD
, RFT_ID_SNS_SCMD_LEN
,
1018 RFT_ID_SNS_DATA_SIZE
);
1020 /* Prepare SNS command arguments -- port_id, FC-4 types */
1021 sns_cmd
->p
.cmd
.param
[0] = ha
->d_id
.b
.al_pa
;
1022 sns_cmd
->p
.cmd
.param
[1] = ha
->d_id
.b
.area
;
1023 sns_cmd
->p
.cmd
.param
[2] = ha
->d_id
.b
.domain
;
1025 sns_cmd
->p
.cmd
.param
[5] = 0x01; /* FCP-3 */
1027 /* Execute SNS command. */
1028 rval
= qla2x00_send_sns(ha
, ha
->sns_cmd_dma
, RFT_ID_SNS_CMD_SIZE
/ 2,
1029 sizeof(struct sns_cmd_pkt
));
1030 if (rval
!= QLA_SUCCESS
) {
1032 DEBUG2_3(printk("scsi(%ld): RFT_ID Send SNS failed (%d).\n",
1033 ha
->host_no
, rval
));
1034 } else if (sns_cmd
->p
.rft_data
[8] != 0x80 ||
1035 sns_cmd
->p
.rft_data
[9] != 0x02) {
1036 DEBUG2_3(printk("scsi(%ld): RFT_ID failed, rejected request, "
1037 "rft_rsp:\n", ha
->host_no
));
1038 DEBUG2_3(qla2x00_dump_buffer(sns_cmd
->p
.rft_data
, 16));
1039 rval
= QLA_FUNCTION_FAILED
;
1041 DEBUG2(printk("scsi(%ld): RFT_ID exiting normally.\n",
1049 * qla2x00_sns_rnn_id() - SNS Register Node Name (RNN_ID) of the HBA.
1053 * This command uses the old Exectute SNS Command mailbox routine.
1055 * Returns 0 on success.
1058 qla2x00_sns_rnn_id(scsi_qla_host_t
*ha
)
1062 struct sns_cmd_pkt
*sns_cmd
;
1065 /* Prepare SNS command request. */
1066 sns_cmd
= qla2x00_prep_sns_cmd(ha
, RNN_ID_CMD
, RNN_ID_SNS_SCMD_LEN
,
1067 RNN_ID_SNS_DATA_SIZE
);
1069 /* Prepare SNS command arguments -- port_id, nodename. */
1070 sns_cmd
->p
.cmd
.param
[0] = ha
->d_id
.b
.al_pa
;
1071 sns_cmd
->p
.cmd
.param
[1] = ha
->d_id
.b
.area
;
1072 sns_cmd
->p
.cmd
.param
[2] = ha
->d_id
.b
.domain
;
1074 sns_cmd
->p
.cmd
.param
[4] = ha
->node_name
[7];
1075 sns_cmd
->p
.cmd
.param
[5] = ha
->node_name
[6];
1076 sns_cmd
->p
.cmd
.param
[6] = ha
->node_name
[5];
1077 sns_cmd
->p
.cmd
.param
[7] = ha
->node_name
[4];
1078 sns_cmd
->p
.cmd
.param
[8] = ha
->node_name
[3];
1079 sns_cmd
->p
.cmd
.param
[9] = ha
->node_name
[2];
1080 sns_cmd
->p
.cmd
.param
[10] = ha
->node_name
[1];
1081 sns_cmd
->p
.cmd
.param
[11] = ha
->node_name
[0];
1083 /* Execute SNS command. */
1084 rval
= qla2x00_send_sns(ha
, ha
->sns_cmd_dma
, RNN_ID_SNS_CMD_SIZE
/ 2,
1085 sizeof(struct sns_cmd_pkt
));
1086 if (rval
!= QLA_SUCCESS
) {
1088 DEBUG2_3(printk("scsi(%ld): RNN_ID Send SNS failed (%d).\n",
1089 ha
->host_no
, rval
));
1090 } else if (sns_cmd
->p
.rnn_data
[8] != 0x80 ||
1091 sns_cmd
->p
.rnn_data
[9] != 0x02) {
1092 DEBUG2_3(printk("scsi(%ld): RNN_ID failed, rejected request, "
1093 "rnn_rsp:\n", ha
->host_no
));
1094 DEBUG2_3(qla2x00_dump_buffer(sns_cmd
->p
.rnn_data
, 16));
1095 rval
= QLA_FUNCTION_FAILED
;
1097 DEBUG2(printk("scsi(%ld): RNN_ID exiting normally.\n",
1105 * qla2x00_mgmt_svr_login() - Login to fabric Management Service.
1108 * Returns 0 on success.
1111 qla2x00_mgmt_svr_login(scsi_qla_host_t
*ha
)
1114 uint16_t mb
[MAILBOX_REGISTER_COUNT
];
1117 if (ha
->flags
.management_server_logged_in
)
1120 ha
->isp_ops
->fabric_login(ha
, ha
->mgmt_svr_loop_id
, 0xff, 0xff, 0xfa,
1122 if (mb
[0] != MBS_COMMAND_COMPLETE
) {
1123 DEBUG2_13(printk("%s(%ld): Failed MANAGEMENT_SERVER login: "
1124 "loop_id=%x mb[0]=%x mb[1]=%x mb[2]=%x mb[6]=%x mb[7]=%x\n",
1125 __func__
, ha
->host_no
, ha
->mgmt_svr_loop_id
, mb
[0], mb
[1],
1126 mb
[2], mb
[6], mb
[7]));
1127 ret
= QLA_FUNCTION_FAILED
;
1129 ha
->flags
.management_server_logged_in
= 1;
1135 * qla2x00_prep_ms_fdmi_iocb() - Prepare common MS IOCB fields for FDMI query.
1137 * @req_size: request size in bytes
1138 * @rsp_size: response size in bytes
1140 * Returns a pointer to the @ha's ms_iocb.
1143 qla2x00_prep_ms_fdmi_iocb(scsi_qla_host_t
*ha
, uint32_t req_size
,
1146 ms_iocb_entry_t
*ms_pkt
;
1148 ms_pkt
= ha
->ms_iocb
;
1149 memset(ms_pkt
, 0, sizeof(ms_iocb_entry_t
));
1151 ms_pkt
->entry_type
= MS_IOCB_TYPE
;
1152 ms_pkt
->entry_count
= 1;
1153 SET_TARGET_ID(ha
, ms_pkt
->loop_id
, ha
->mgmt_svr_loop_id
);
1154 ms_pkt
->control_flags
= __constant_cpu_to_le16(CF_READ
| CF_HEAD_TAG
);
1155 <<<<<<< HEAD
:drivers
/scsi
/qla2xxx
/qla_gs
.c
1156 ms_pkt
->timeout
= __constant_cpu_to_le16(59);
1158 ms_pkt
->timeout
= cpu_to_le16(ha
->r_a_tov
/ 10 * 2);
1159 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:drivers
/scsi
/qla2xxx
/qla_gs
.c
1160 ms_pkt
->cmd_dsd_count
= __constant_cpu_to_le16(1);
1161 ms_pkt
->total_dsd_count
= __constant_cpu_to_le16(2);
1162 ms_pkt
->rsp_bytecount
= cpu_to_le32(rsp_size
);
1163 ms_pkt
->req_bytecount
= cpu_to_le32(req_size
);
1165 ms_pkt
->dseg_req_address
[0] = cpu_to_le32(LSD(ha
->ct_sns_dma
));
1166 ms_pkt
->dseg_req_address
[1] = cpu_to_le32(MSD(ha
->ct_sns_dma
));
1167 ms_pkt
->dseg_req_length
= ms_pkt
->req_bytecount
;
1169 ms_pkt
->dseg_rsp_address
[0] = cpu_to_le32(LSD(ha
->ct_sns_dma
));
1170 ms_pkt
->dseg_rsp_address
[1] = cpu_to_le32(MSD(ha
->ct_sns_dma
));
1171 ms_pkt
->dseg_rsp_length
= ms_pkt
->rsp_bytecount
;
1177 * qla24xx_prep_ms_fdmi_iocb() - Prepare common MS IOCB fields for FDMI query.
1179 * @req_size: request size in bytes
1180 * @rsp_size: response size in bytes
1182 * Returns a pointer to the @ha's ms_iocb.
1185 qla24xx_prep_ms_fdmi_iocb(scsi_qla_host_t
*ha
, uint32_t req_size
,
1188 struct ct_entry_24xx
*ct_pkt
;
1190 ct_pkt
= (struct ct_entry_24xx
*)ha
->ms_iocb
;
1191 memset(ct_pkt
, 0, sizeof(struct ct_entry_24xx
));
1193 ct_pkt
->entry_type
= CT_IOCB_TYPE
;
1194 ct_pkt
->entry_count
= 1;
1195 ct_pkt
->nport_handle
= cpu_to_le16(ha
->mgmt_svr_loop_id
);
1196 <<<<<<< HEAD
:drivers
/scsi
/qla2xxx
/qla_gs
.c
1197 ct_pkt
->timeout
= __constant_cpu_to_le16(59);
1199 ct_pkt
->timeout
= cpu_to_le16(ha
->r_a_tov
/ 10 * 2);
1200 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:drivers
/scsi
/qla2xxx
/qla_gs
.c
1201 ct_pkt
->cmd_dsd_count
= __constant_cpu_to_le16(1);
1202 ct_pkt
->rsp_dsd_count
= __constant_cpu_to_le16(1);
1203 ct_pkt
->rsp_byte_count
= cpu_to_le32(rsp_size
);
1204 ct_pkt
->cmd_byte_count
= cpu_to_le32(req_size
);
1206 ct_pkt
->dseg_0_address
[0] = cpu_to_le32(LSD(ha
->ct_sns_dma
));
1207 ct_pkt
->dseg_0_address
[1] = cpu_to_le32(MSD(ha
->ct_sns_dma
));
1208 ct_pkt
->dseg_0_len
= ct_pkt
->cmd_byte_count
;
1210 ct_pkt
->dseg_1_address
[0] = cpu_to_le32(LSD(ha
->ct_sns_dma
));
1211 ct_pkt
->dseg_1_address
[1] = cpu_to_le32(MSD(ha
->ct_sns_dma
));
1212 ct_pkt
->dseg_1_len
= ct_pkt
->rsp_byte_count
;
1213 ct_pkt
->vp_index
= ha
->vp_idx
;
1218 static inline ms_iocb_entry_t
*
1219 qla2x00_update_ms_fdmi_iocb(scsi_qla_host_t
*ha
, uint32_t req_size
)
1221 ms_iocb_entry_t
*ms_pkt
= ha
->ms_iocb
;
1222 struct ct_entry_24xx
*ct_pkt
= (struct ct_entry_24xx
*)ha
->ms_iocb
;
1224 if (IS_FWI2_CAPABLE(ha
)) {
1225 ct_pkt
->cmd_byte_count
= cpu_to_le32(req_size
);
1226 ct_pkt
->dseg_0_len
= ct_pkt
->cmd_byte_count
;
1228 ms_pkt
->req_bytecount
= cpu_to_le32(req_size
);
1229 ms_pkt
->dseg_req_length
= ms_pkt
->req_bytecount
;
1236 * qla2x00_prep_ct_req() - Prepare common CT request fields for SNS query.
1237 * @ct_req: CT request buffer
1239 * @rsp_size: response size in bytes
1241 * Returns a pointer to the intitialized @ct_req.
1243 static inline struct ct_sns_req
*
1244 qla2x00_prep_ct_fdmi_req(struct ct_sns_req
*ct_req
, uint16_t cmd
,
1247 memset(ct_req
, 0, sizeof(struct ct_sns_pkt
));
1249 ct_req
->header
.revision
= 0x01;
1250 ct_req
->header
.gs_type
= 0xFA;
1251 ct_req
->header
.gs_subtype
= 0x10;
1252 ct_req
->command
= cpu_to_be16(cmd
);
1253 ct_req
->max_rsp_size
= cpu_to_be16((rsp_size
- 16) / 4);
1259 * qla2x00_fdmi_rhba() -
1262 * Returns 0 on success.
1265 qla2x00_fdmi_rhba(scsi_qla_host_t
*ha
)
1270 ms_iocb_entry_t
*ms_pkt
;
1271 struct ct_sns_req
*ct_req
;
1272 struct ct_sns_rsp
*ct_rsp
;
1274 struct ct_fdmi_hba_attr
*eiter
;
1277 /* Prepare common MS IOCB */
1278 /* Request size adjusted after CT preparation */
1279 ms_pkt
= ha
->isp_ops
->prep_ms_fdmi_iocb(ha
, 0, RHBA_RSP_SIZE
);
1281 /* Prepare CT request */
1282 ct_req
= qla2x00_prep_ct_fdmi_req(&ha
->ct_sns
->p
.req
, RHBA_CMD
,
1284 ct_rsp
= &ha
->ct_sns
->p
.rsp
;
1286 /* Prepare FDMI command arguments -- attribute block, attributes. */
1287 memcpy(ct_req
->req
.rhba
.hba_identifier
, ha
->port_name
, WWN_SIZE
);
1288 ct_req
->req
.rhba
.entry_count
= __constant_cpu_to_be32(1);
1289 memcpy(ct_req
->req
.rhba
.port_name
, ha
->port_name
, WWN_SIZE
);
1290 size
= 2 * WWN_SIZE
+ 4 + 4;
1293 ct_req
->req
.rhba
.attrs
.count
=
1294 __constant_cpu_to_be32(FDMI_HBA_ATTR_COUNT
);
1295 entries
= ct_req
->req
.rhba
.hba_identifier
;
1298 eiter
= (struct ct_fdmi_hba_attr
*) (entries
+ size
);
1299 eiter
->type
= __constant_cpu_to_be16(FDMI_HBA_NODE_NAME
);
1300 eiter
->len
= __constant_cpu_to_be16(4 + WWN_SIZE
);
1301 memcpy(eiter
->a
.node_name
, ha
->node_name
, WWN_SIZE
);
1302 size
+= 4 + WWN_SIZE
;
1304 DEBUG13(printk("%s(%ld): NODENAME=%02x%02x%02x%02x%02x%02x%02x%02x.\n",
1305 __func__
, ha
->host_no
,
1306 eiter
->a
.node_name
[0], eiter
->a
.node_name
[1], eiter
->a
.node_name
[2],
1307 eiter
->a
.node_name
[3], eiter
->a
.node_name
[4], eiter
->a
.node_name
[5],
1308 eiter
->a
.node_name
[6], eiter
->a
.node_name
[7]));
1311 eiter
= (struct ct_fdmi_hba_attr
*) (entries
+ size
);
1312 eiter
->type
= __constant_cpu_to_be16(FDMI_HBA_MANUFACTURER
);
1313 strcpy(eiter
->a
.manufacturer
, "QLogic Corporation");
1314 alen
= strlen(eiter
->a
.manufacturer
);
1315 alen
+= (alen
& 3) ? (4 - (alen
& 3)) : 4;
1316 eiter
->len
= cpu_to_be16(4 + alen
);
1319 DEBUG13(printk("%s(%ld): MANUFACTURER=%s.\n", __func__
, ha
->host_no
,
1320 eiter
->a
.manufacturer
));
1322 /* Serial number. */
1323 eiter
= (struct ct_fdmi_hba_attr
*) (entries
+ size
);
1324 eiter
->type
= __constant_cpu_to_be16(FDMI_HBA_SERIAL_NUMBER
);
1325 sn
= ((ha
->serial0
& 0x1f) << 16) | (ha
->serial2
<< 8) | ha
->serial1
;
1326 sprintf(eiter
->a
.serial_num
, "%c%05d", 'A' + sn
/ 100000, sn
% 100000);
1327 alen
= strlen(eiter
->a
.serial_num
);
1328 alen
+= (alen
& 3) ? (4 - (alen
& 3)) : 4;
1329 eiter
->len
= cpu_to_be16(4 + alen
);
1332 DEBUG13(printk("%s(%ld): SERIALNO=%s.\n", __func__
, ha
->host_no
,
1333 eiter
->a
.serial_num
));
1336 eiter
= (struct ct_fdmi_hba_attr
*) (entries
+ size
);
1337 eiter
->type
= __constant_cpu_to_be16(FDMI_HBA_MODEL
);
1338 strcpy(eiter
->a
.model
, ha
->model_number
);
1339 alen
= strlen(eiter
->a
.model
);
1340 alen
+= (alen
& 3) ? (4 - (alen
& 3)) : 4;
1341 eiter
->len
= cpu_to_be16(4 + alen
);
1344 DEBUG13(printk("%s(%ld): MODEL_NAME=%s.\n", __func__
, ha
->host_no
,
1347 /* Model description. */
1348 eiter
= (struct ct_fdmi_hba_attr
*) (entries
+ size
);
1349 eiter
->type
= __constant_cpu_to_be16(FDMI_HBA_MODEL_DESCRIPTION
);
1351 strncpy(eiter
->a
.model_desc
, ha
->model_desc
, 80);
1352 alen
= strlen(eiter
->a
.model_desc
);
1353 alen
+= (alen
& 3) ? (4 - (alen
& 3)) : 4;
1354 eiter
->len
= cpu_to_be16(4 + alen
);
1357 DEBUG13(printk("%s(%ld): MODEL_DESC=%s.\n", __func__
, ha
->host_no
,
1358 eiter
->a
.model_desc
));
1360 /* Hardware version. */
1361 eiter
= (struct ct_fdmi_hba_attr
*) (entries
+ size
);
1362 eiter
->type
= __constant_cpu_to_be16(FDMI_HBA_HARDWARE_VERSION
);
1363 strcpy(eiter
->a
.hw_version
, ha
->adapter_id
);
1364 alen
= strlen(eiter
->a
.hw_version
);
1365 alen
+= (alen
& 3) ? (4 - (alen
& 3)) : 4;
1366 eiter
->len
= cpu_to_be16(4 + alen
);
1369 DEBUG13(printk("%s(%ld): HARDWAREVER=%s.\n", __func__
, ha
->host_no
,
1370 eiter
->a
.hw_version
));
1372 /* Driver version. */
1373 eiter
= (struct ct_fdmi_hba_attr
*) (entries
+ size
);
1374 eiter
->type
= __constant_cpu_to_be16(FDMI_HBA_DRIVER_VERSION
);
1375 strcpy(eiter
->a
.driver_version
, qla2x00_version_str
);
1376 alen
= strlen(eiter
->a
.driver_version
);
1377 alen
+= (alen
& 3) ? (4 - (alen
& 3)) : 4;
1378 eiter
->len
= cpu_to_be16(4 + alen
);
1381 DEBUG13(printk("%s(%ld): DRIVERVER=%s.\n", __func__
, ha
->host_no
,
1382 eiter
->a
.driver_version
));
1384 /* Option ROM version. */
1385 eiter
= (struct ct_fdmi_hba_attr
*) (entries
+ size
);
1386 eiter
->type
= __constant_cpu_to_be16(FDMI_HBA_OPTION_ROM_VERSION
);
1387 strcpy(eiter
->a
.orom_version
, "0.00");
1388 alen
= strlen(eiter
->a
.orom_version
);
1389 alen
+= (alen
& 3) ? (4 - (alen
& 3)) : 4;
1390 eiter
->len
= cpu_to_be16(4 + alen
);
1393 DEBUG13(printk("%s(%ld): OPTROMVER=%s.\n", __func__
, ha
->host_no
,
1394 eiter
->a
.orom_version
));
1396 /* Firmware version */
1397 eiter
= (struct ct_fdmi_hba_attr
*) (entries
+ size
);
1398 eiter
->type
= __constant_cpu_to_be16(FDMI_HBA_FIRMWARE_VERSION
);
1399 ha
->isp_ops
->fw_version_str(ha
, eiter
->a
.fw_version
);
1400 alen
= strlen(eiter
->a
.fw_version
);
1401 alen
+= (alen
& 3) ? (4 - (alen
& 3)) : 4;
1402 eiter
->len
= cpu_to_be16(4 + alen
);
1405 DEBUG13(printk("%s(%ld): FIRMWAREVER=%s.\n", __func__
, ha
->host_no
,
1406 eiter
->a
.fw_version
));
1408 /* Update MS request size. */
1409 qla2x00_update_ms_fdmi_iocb(ha
, size
+ 16);
1411 DEBUG13(printk("%s(%ld): RHBA identifier="
1412 "%02x%02x%02x%02x%02x%02x%02x%02x size=%d.\n", __func__
,
1413 ha
->host_no
, ct_req
->req
.rhba
.hba_identifier
[0],
1414 ct_req
->req
.rhba
.hba_identifier
[1],
1415 ct_req
->req
.rhba
.hba_identifier
[2],
1416 ct_req
->req
.rhba
.hba_identifier
[3],
1417 ct_req
->req
.rhba
.hba_identifier
[4],
1418 ct_req
->req
.rhba
.hba_identifier
[5],
1419 ct_req
->req
.rhba
.hba_identifier
[6],
1420 ct_req
->req
.rhba
.hba_identifier
[7], size
));
1421 DEBUG13(qla2x00_dump_buffer(entries
, size
));
1423 /* Execute MS IOCB */
1424 rval
= qla2x00_issue_iocb(ha
, ha
->ms_iocb
, ha
->ms_iocb_dma
,
1425 sizeof(ms_iocb_entry_t
));
1426 if (rval
!= QLA_SUCCESS
) {
1428 DEBUG2_3(printk("scsi(%ld): RHBA issue IOCB failed (%d).\n",
1429 ha
->host_no
, rval
));
1430 } else if (qla2x00_chk_ms_status(ha
, ms_pkt
, ct_rsp
, "RHBA") !=
1432 rval
= QLA_FUNCTION_FAILED
;
1433 if (ct_rsp
->header
.reason_code
== CT_REASON_CANNOT_PERFORM
&&
1434 ct_rsp
->header
.explanation_code
==
1435 CT_EXPL_ALREADY_REGISTERED
) {
1436 DEBUG2_13(printk("%s(%ld): HBA already registered.\n",
1437 __func__
, ha
->host_no
));
1438 rval
= QLA_ALREADY_REGISTERED
;
1441 DEBUG2(printk("scsi(%ld): RHBA exiting normally.\n",
1449 * qla2x00_fdmi_dhba() -
1452 * Returns 0 on success.
1455 qla2x00_fdmi_dhba(scsi_qla_host_t
*ha
)
1459 ms_iocb_entry_t
*ms_pkt
;
1460 struct ct_sns_req
*ct_req
;
1461 struct ct_sns_rsp
*ct_rsp
;
1464 /* Prepare common MS IOCB */
1465 ms_pkt
= ha
->isp_ops
->prep_ms_fdmi_iocb(ha
, DHBA_REQ_SIZE
,
1468 /* Prepare CT request */
1469 ct_req
= qla2x00_prep_ct_fdmi_req(&ha
->ct_sns
->p
.req
, DHBA_CMD
,
1471 ct_rsp
= &ha
->ct_sns
->p
.rsp
;
1473 /* Prepare FDMI command arguments -- portname. */
1474 memcpy(ct_req
->req
.dhba
.port_name
, ha
->port_name
, WWN_SIZE
);
1476 DEBUG13(printk("%s(%ld): DHBA portname="
1477 "%02x%02x%02x%02x%02x%02x%02x%02x.\n", __func__
, ha
->host_no
,
1478 ct_req
->req
.dhba
.port_name
[0], ct_req
->req
.dhba
.port_name
[1],
1479 ct_req
->req
.dhba
.port_name
[2], ct_req
->req
.dhba
.port_name
[3],
1480 ct_req
->req
.dhba
.port_name
[4], ct_req
->req
.dhba
.port_name
[5],
1481 ct_req
->req
.dhba
.port_name
[6], ct_req
->req
.dhba
.port_name
[7]));
1483 /* Execute MS IOCB */
1484 rval
= qla2x00_issue_iocb(ha
, ha
->ms_iocb
, ha
->ms_iocb_dma
,
1485 sizeof(ms_iocb_entry_t
));
1486 if (rval
!= QLA_SUCCESS
) {
1488 DEBUG2_3(printk("scsi(%ld): DHBA issue IOCB failed (%d).\n",
1489 ha
->host_no
, rval
));
1490 } else if (qla2x00_chk_ms_status(ha
, ms_pkt
, ct_rsp
, "DHBA") !=
1492 rval
= QLA_FUNCTION_FAILED
;
1494 DEBUG2(printk("scsi(%ld): DHBA exiting normally.\n",
1502 * qla2x00_fdmi_rpa() -
1505 * Returns 0 on success.
1508 qla2x00_fdmi_rpa(scsi_qla_host_t
*ha
)
1511 uint32_t size
, max_frame_size
;
1513 ms_iocb_entry_t
*ms_pkt
;
1514 struct ct_sns_req
*ct_req
;
1515 struct ct_sns_rsp
*ct_rsp
;
1517 struct ct_fdmi_port_attr
*eiter
;
1518 struct init_cb_24xx
*icb24
= (struct init_cb_24xx
*)ha
->init_cb
;
1521 /* Prepare common MS IOCB */
1522 /* Request size adjusted after CT preparation */
1523 ms_pkt
= ha
->isp_ops
->prep_ms_fdmi_iocb(ha
, 0, RPA_RSP_SIZE
);
1525 /* Prepare CT request */
1526 ct_req
= qla2x00_prep_ct_fdmi_req(&ha
->ct_sns
->p
.req
, RPA_CMD
,
1528 ct_rsp
= &ha
->ct_sns
->p
.rsp
;
1530 /* Prepare FDMI command arguments -- attribute block, attributes. */
1531 memcpy(ct_req
->req
.rpa
.port_name
, ha
->port_name
, WWN_SIZE
);
1532 size
= WWN_SIZE
+ 4;
1535 ct_req
->req
.rpa
.attrs
.count
=
1536 __constant_cpu_to_be32(FDMI_PORT_ATTR_COUNT
- 1);
1537 entries
= ct_req
->req
.rpa
.port_name
;
1540 eiter
= (struct ct_fdmi_port_attr
*) (entries
+ size
);
1541 eiter
->type
= __constant_cpu_to_be16(FDMI_PORT_FC4_TYPES
);
1542 eiter
->len
= __constant_cpu_to_be16(4 + 32);
1543 eiter
->a
.fc4_types
[2] = 0x01;
1546 DEBUG13(printk("%s(%ld): FC4_TYPES=%02x %02x.\n", __func__
, ha
->host_no
,
1547 eiter
->a
.fc4_types
[2], eiter
->a
.fc4_types
[1]));
1549 /* Supported speed. */
1550 eiter
= (struct ct_fdmi_port_attr
*) (entries
+ size
);
1551 eiter
->type
= __constant_cpu_to_be16(FDMI_PORT_SUPPORT_SPEED
);
1552 eiter
->len
= __constant_cpu_to_be16(4 + 4);
1554 eiter
->a
.sup_speed
= __constant_cpu_to_be32(
1555 FDMI_PORT_SPEED_1GB
|FDMI_PORT_SPEED_2GB
|
1556 FDMI_PORT_SPEED_4GB
|FDMI_PORT_SPEED_8GB
);
1557 else if (IS_QLA24XX(ha
) || IS_QLA54XX(ha
))
1558 eiter
->a
.sup_speed
= __constant_cpu_to_be32(
1559 FDMI_PORT_SPEED_1GB
|FDMI_PORT_SPEED_2GB
|
1560 FDMI_PORT_SPEED_4GB
);
1561 else if (IS_QLA23XX(ha
))
1562 eiter
->a
.sup_speed
=__constant_cpu_to_be32(
1563 FDMI_PORT_SPEED_1GB
|FDMI_PORT_SPEED_2GB
);
1565 eiter
->a
.sup_speed
= __constant_cpu_to_be32(
1566 FDMI_PORT_SPEED_1GB
);
1569 DEBUG13(printk("%s(%ld): SUPPORTED_SPEED=%x.\n", __func__
, ha
->host_no
,
1570 eiter
->a
.sup_speed
));
1572 /* Current speed. */
1573 eiter
= (struct ct_fdmi_port_attr
*) (entries
+ size
);
1574 eiter
->type
= __constant_cpu_to_be16(FDMI_PORT_CURRENT_SPEED
);
1575 eiter
->len
= __constant_cpu_to_be16(4 + 4);
1576 switch (ha
->link_data_rate
) {
1577 case PORT_SPEED_1GB
:
1578 eiter
->a
.cur_speed
=
1579 __constant_cpu_to_be32(FDMI_PORT_SPEED_1GB
);
1581 case PORT_SPEED_2GB
:
1582 eiter
->a
.cur_speed
=
1583 __constant_cpu_to_be32(FDMI_PORT_SPEED_2GB
);
1585 case PORT_SPEED_4GB
:
1586 eiter
->a
.cur_speed
=
1587 __constant_cpu_to_be32(FDMI_PORT_SPEED_4GB
);
1589 case PORT_SPEED_8GB
:
1590 eiter
->a
.cur_speed
=
1591 __constant_cpu_to_be32(FDMI_PORT_SPEED_8GB
);
1594 eiter
->a
.cur_speed
=
1595 __constant_cpu_to_be32(FDMI_PORT_SPEED_UNKNOWN
);
1600 DEBUG13(printk("%s(%ld): CURRENT_SPEED=%x.\n", __func__
, ha
->host_no
,
1601 eiter
->a
.cur_speed
));
1603 /* Max frame size. */
1604 eiter
= (struct ct_fdmi_port_attr
*) (entries
+ size
);
1605 eiter
->type
= __constant_cpu_to_be16(FDMI_PORT_MAX_FRAME_SIZE
);
1606 eiter
->len
= __constant_cpu_to_be16(4 + 4);
1607 max_frame_size
= IS_FWI2_CAPABLE(ha
) ?
1608 (uint32_t) icb24
->frame_payload_size
:
1609 (uint32_t) ha
->init_cb
->frame_payload_size
;
1610 eiter
->a
.max_frame_size
= cpu_to_be32(max_frame_size
);
1613 DEBUG13(printk("%s(%ld): MAX_FRAME_SIZE=%x.\n", __func__
, ha
->host_no
,
1614 eiter
->a
.max_frame_size
));
1616 /* OS device name. */
1617 eiter
= (struct ct_fdmi_port_attr
*) (entries
+ size
);
1618 eiter
->type
= __constant_cpu_to_be16(FDMI_PORT_OS_DEVICE_NAME
);
1619 strcpy(eiter
->a
.os_dev_name
, QLA2XXX_DRIVER_NAME
);
1620 alen
= strlen(eiter
->a
.os_dev_name
);
1621 alen
+= (alen
& 3) ? (4 - (alen
& 3)) : 4;
1622 eiter
->len
= cpu_to_be16(4 + alen
);
1625 DEBUG13(printk("%s(%ld): OS_DEVICE_NAME=%s.\n", __func__
, ha
->host_no
,
1626 eiter
->a
.os_dev_name
));
1629 if (strlen(fc_host_system_hostname(ha
->host
))) {
1630 ct_req
->req
.rpa
.attrs
.count
=
1631 __constant_cpu_to_be32(FDMI_PORT_ATTR_COUNT
);
1632 eiter
= (struct ct_fdmi_port_attr
*) (entries
+ size
);
1633 eiter
->type
= __constant_cpu_to_be16(FDMI_PORT_HOST_NAME
);
1634 snprintf(eiter
->a
.host_name
, sizeof(eiter
->a
.host_name
),
1635 "%s", fc_host_system_hostname(ha
->host
));
1636 alen
= strlen(eiter
->a
.host_name
);
1637 alen
+= (alen
& 3) ? (4 - (alen
& 3)) : 4;
1638 eiter
->len
= cpu_to_be16(4 + alen
);
1641 DEBUG13(printk("%s(%ld): HOSTNAME=%s.\n", __func__
,
1642 ha
->host_no
, eiter
->a
.host_name
));
1645 /* Update MS request size. */
1646 qla2x00_update_ms_fdmi_iocb(ha
, size
+ 16);
1648 DEBUG13(printk("%s(%ld): RPA portname="
1649 "%02x%02x%02x%02x%02x%02x%02x%02x size=%d.\n", __func__
,
1650 ha
->host_no
, ct_req
->req
.rpa
.port_name
[0],
1651 ct_req
->req
.rpa
.port_name
[1], ct_req
->req
.rpa
.port_name
[2],
1652 ct_req
->req
.rpa
.port_name
[3], ct_req
->req
.rpa
.port_name
[4],
1653 ct_req
->req
.rpa
.port_name
[5], ct_req
->req
.rpa
.port_name
[6],
1654 ct_req
->req
.rpa
.port_name
[7], size
));
1655 DEBUG13(qla2x00_dump_buffer(entries
, size
));
1657 /* Execute MS IOCB */
1658 rval
= qla2x00_issue_iocb(ha
, ha
->ms_iocb
, ha
->ms_iocb_dma
,
1659 sizeof(ms_iocb_entry_t
));
1660 if (rval
!= QLA_SUCCESS
) {
1662 DEBUG2_3(printk("scsi(%ld): RPA issue IOCB failed (%d).\n",
1663 ha
->host_no
, rval
));
1664 } else if (qla2x00_chk_ms_status(ha
, ms_pkt
, ct_rsp
, "RPA") !=
1666 rval
= QLA_FUNCTION_FAILED
;
1668 DEBUG2(printk("scsi(%ld): RPA exiting normally.\n",
1676 * qla2x00_fdmi_register() -
1679 * Returns 0 on success.
1682 qla2x00_fdmi_register(scsi_qla_host_t
*ha
)
1686 rval
= qla2x00_mgmt_svr_login(ha
);
1690 rval
= qla2x00_fdmi_rhba(ha
);
1692 if (rval
!= QLA_ALREADY_REGISTERED
)
1695 rval
= qla2x00_fdmi_dhba(ha
);
1699 rval
= qla2x00_fdmi_rhba(ha
);
1703 rval
= qla2x00_fdmi_rpa(ha
);
1709 * qla2x00_gfpn_id() - SNS Get Fabric Port Name (GFPN_ID) query.
1711 * @list: switch info entries to populate
1713 * Returns 0 on success.
1716 qla2x00_gfpn_id(scsi_qla_host_t
*ha
, sw_info_t
*list
)
1721 ms_iocb_entry_t
*ms_pkt
;
1722 struct ct_sns_req
*ct_req
;
1723 struct ct_sns_rsp
*ct_rsp
;
1725 if (!IS_IIDMA_CAPABLE(ha
))
1726 return QLA_FUNCTION_FAILED
;
1728 for (i
= 0; i
< MAX_FIBRE_DEVICES
; i
++) {
1730 /* Prepare common MS IOCB */
1731 ms_pkt
= ha
->isp_ops
->prep_ms_iocb(ha
, GFPN_ID_REQ_SIZE
,
1734 /* Prepare CT request */
1735 ct_req
= qla2x00_prep_ct_req(&ha
->ct_sns
->p
.req
, GFPN_ID_CMD
,
1737 ct_rsp
= &ha
->ct_sns
->p
.rsp
;
1739 /* Prepare CT arguments -- port_id */
1740 ct_req
->req
.port_id
.port_id
[0] = list
[i
].d_id
.b
.domain
;
1741 ct_req
->req
.port_id
.port_id
[1] = list
[i
].d_id
.b
.area
;
1742 ct_req
->req
.port_id
.port_id
[2] = list
[i
].d_id
.b
.al_pa
;
1744 /* Execute MS IOCB */
1745 rval
= qla2x00_issue_iocb(ha
, ha
->ms_iocb
, ha
->ms_iocb_dma
,
1746 sizeof(ms_iocb_entry_t
));
1747 if (rval
!= QLA_SUCCESS
) {
1749 DEBUG2_3(printk("scsi(%ld): GFPN_ID issue IOCB "
1750 "failed (%d).\n", ha
->host_no
, rval
));
1751 } else if (qla2x00_chk_ms_status(ha
, ms_pkt
, ct_rsp
,
1752 "GFPN_ID") != QLA_SUCCESS
) {
1753 rval
= QLA_FUNCTION_FAILED
;
1755 /* Save fabric portname */
1756 memcpy(list
[i
].fabric_port_name
,
1757 ct_rsp
->rsp
.gfpn_id
.port_name
, WWN_SIZE
);
1760 /* Last device exit. */
1761 if (list
[i
].d_id
.b
.rsvd_1
!= 0)
1768 static inline void *
1769 qla24xx_prep_ms_fm_iocb(scsi_qla_host_t
*ha
, uint32_t req_size
,
1772 struct ct_entry_24xx
*ct_pkt
;
1774 ct_pkt
= (struct ct_entry_24xx
*)ha
->ms_iocb
;
1775 memset(ct_pkt
, 0, sizeof(struct ct_entry_24xx
));
1777 ct_pkt
->entry_type
= CT_IOCB_TYPE
;
1778 ct_pkt
->entry_count
= 1;
1779 ct_pkt
->nport_handle
= cpu_to_le16(ha
->mgmt_svr_loop_id
);
1780 <<<<<<< HEAD
:drivers
/scsi
/qla2xxx
/qla_gs
.c
1781 ct_pkt
->timeout
= __constant_cpu_to_le16(59);
1783 ct_pkt
->timeout
= cpu_to_le16(ha
->r_a_tov
/ 10 * 2);
1784 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:drivers
/scsi
/qla2xxx
/qla_gs
.c
1785 ct_pkt
->cmd_dsd_count
= __constant_cpu_to_le16(1);
1786 ct_pkt
->rsp_dsd_count
= __constant_cpu_to_le16(1);
1787 ct_pkt
->rsp_byte_count
= cpu_to_le32(rsp_size
);
1788 ct_pkt
->cmd_byte_count
= cpu_to_le32(req_size
);
1790 ct_pkt
->dseg_0_address
[0] = cpu_to_le32(LSD(ha
->ct_sns_dma
));
1791 ct_pkt
->dseg_0_address
[1] = cpu_to_le32(MSD(ha
->ct_sns_dma
));
1792 ct_pkt
->dseg_0_len
= ct_pkt
->cmd_byte_count
;
1794 ct_pkt
->dseg_1_address
[0] = cpu_to_le32(LSD(ha
->ct_sns_dma
));
1795 ct_pkt
->dseg_1_address
[1] = cpu_to_le32(MSD(ha
->ct_sns_dma
));
1796 ct_pkt
->dseg_1_len
= ct_pkt
->rsp_byte_count
;
1797 ct_pkt
->vp_index
= ha
->vp_idx
;
1803 static inline struct ct_sns_req
*
1804 qla24xx_prep_ct_fm_req(struct ct_sns_req
*ct_req
, uint16_t cmd
,
1807 memset(ct_req
, 0, sizeof(struct ct_sns_pkt
));
1809 ct_req
->header
.revision
= 0x01;
1810 ct_req
->header
.gs_type
= 0xFA;
1811 ct_req
->header
.gs_subtype
= 0x01;
1812 ct_req
->command
= cpu_to_be16(cmd
);
1813 ct_req
->max_rsp_size
= cpu_to_be16((rsp_size
- 16) / 4);
1819 * qla2x00_gpsc() - FCS Get Port Speed Capabilities (GPSC) query.
1821 * @list: switch info entries to populate
1823 * Returns 0 on success.
1826 qla2x00_gpsc(scsi_qla_host_t
*ha
, sw_info_t
*list
)
1831 ms_iocb_entry_t
*ms_pkt
;
1832 struct ct_sns_req
*ct_req
;
1833 struct ct_sns_rsp
*ct_rsp
;
1835 if (!IS_IIDMA_CAPABLE(ha
))
1836 return QLA_FUNCTION_FAILED
;
1837 if (!ha
->flags
.gpsc_supported
)
1838 return QLA_FUNCTION_FAILED
;
1840 rval
= qla2x00_mgmt_svr_login(ha
);
1844 for (i
= 0; i
< MAX_FIBRE_DEVICES
; i
++) {
1846 /* Prepare common MS IOCB */
1847 ms_pkt
= qla24xx_prep_ms_fm_iocb(ha
, GPSC_REQ_SIZE
,
1850 /* Prepare CT request */
1851 ct_req
= qla24xx_prep_ct_fm_req(&ha
->ct_sns
->p
.req
,
1852 GPSC_CMD
, GPSC_RSP_SIZE
);
1853 ct_rsp
= &ha
->ct_sns
->p
.rsp
;
1855 /* Prepare CT arguments -- port_name */
1856 memcpy(ct_req
->req
.gpsc
.port_name
, list
[i
].fabric_port_name
,
1859 /* Execute MS IOCB */
1860 rval
= qla2x00_issue_iocb(ha
, ha
->ms_iocb
, ha
->ms_iocb_dma
,
1861 sizeof(ms_iocb_entry_t
));
1862 if (rval
!= QLA_SUCCESS
) {
1864 DEBUG2_3(printk("scsi(%ld): GPSC issue IOCB "
1865 "failed (%d).\n", ha
->host_no
, rval
));
1866 } else if ((rval
= qla2x00_chk_ms_status(ha
, ms_pkt
, ct_rsp
,
1867 "GPSC")) != QLA_SUCCESS
) {
1868 /* FM command unsupported? */
1869 if (rval
== QLA_INVALID_COMMAND
&&
1870 ct_rsp
->header
.reason_code
==
1871 CT_REASON_INVALID_COMMAND_CODE
) {
1872 DEBUG2(printk("scsi(%ld): GPSC command "
1873 "unsupported, disabling query...\n",
1875 ha
->flags
.gpsc_supported
= 0;
1876 rval
= QLA_FUNCTION_FAILED
;
1879 rval
= QLA_FUNCTION_FAILED
;
1881 /* Save port-speed */
1882 switch (be16_to_cpu(ct_rsp
->rsp
.gpsc
.speed
)) {
1884 list
[i
].fp_speed
= PORT_SPEED_1GB
;
1887 list
[i
].fp_speed
= PORT_SPEED_2GB
;
1890 list
[i
].fp_speed
= PORT_SPEED_4GB
;
1893 list
[i
].fp_speed
= PORT_SPEED_8GB
;
1897 DEBUG2_3(printk("scsi(%ld): GPSC ext entry - "
1898 "fpn %02x%02x%02x%02x%02x%02x%02x%02x speeds=%04x "
1899 "speed=%04x.\n", ha
->host_no
,
1900 list
[i
].fabric_port_name
[0],
1901 list
[i
].fabric_port_name
[1],
1902 list
[i
].fabric_port_name
[2],
1903 list
[i
].fabric_port_name
[3],
1904 list
[i
].fabric_port_name
[4],
1905 list
[i
].fabric_port_name
[5],
1906 list
[i
].fabric_port_name
[6],
1907 list
[i
].fabric_port_name
[7],
1908 be16_to_cpu(ct_rsp
->rsp
.gpsc
.speeds
),
1909 be16_to_cpu(ct_rsp
->rsp
.gpsc
.speed
)));
1912 /* Last device exit. */
1913 if (list
[i
].d_id
.b
.rsvd_1
!= 0)