diff options
author | James Smart <James.Smart@Emulex.Com> | 2008-12-04 22:39:02 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-12-29 12:24:25 -0500 |
commit | 9bad76719ee4fa8c305bb6cba6e19b4ddbe800b2 (patch) | |
tree | e7934476b27070d570495ee3a82f48c27fee1783 /drivers/scsi | |
parent | 3a55b5327b80d805eb3c9720092fd24f15193696 (diff) |
[SCSI] lpfc 8.3.0 : Add kernel-doc headers to lpfc_scsi.c
Add kernel-doc function headers to lpfc_scsi.c
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_scsi.c | 287 |
1 files changed, 274 insertions, 13 deletions
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index b7896609800f..6293b6fc65a6 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c | |||
@@ -92,7 +92,6 @@ lpfc_update_stats(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd) | |||
92 | spin_unlock_irqrestore(shost->host_lock, flags); | 92 | spin_unlock_irqrestore(shost->host_lock, flags); |
93 | } | 93 | } |
94 | 94 | ||
95 | |||
96 | /** | 95 | /** |
97 | * lpfc_send_sdev_queuedepth_change_event: Posts a queuedepth change | 96 | * lpfc_send_sdev_queuedepth_change_event: Posts a queuedepth change |
98 | * event. | 97 | * event. |
@@ -148,10 +147,17 @@ lpfc_send_sdev_queuedepth_change_event(struct lpfc_hba *phba, | |||
148 | return; | 147 | return; |
149 | } | 148 | } |
150 | 149 | ||
151 | /* | 150 | /** |
152 | * This function is called with no lock held when there is a resource | 151 | * lpfc_adjust_queue_depth: Post RAMP_DOWN_QUEUE event for worker thread. |
153 | * error in driver or in firmware. | 152 | * @phba: The Hba for which this call is being executed. |
154 | */ | 153 | * |
154 | * This routine is called when there is resource error in driver or firmware. | ||
155 | * This routine posts WORKER_RAMP_DOWN_QUEUE event for @phba. This routine | ||
156 | * posts at most 1 event each second. This routine wakes up worker thread of | ||
157 | * @phba to process WORKER_RAM_DOWN_EVENT event. | ||
158 | * | ||
159 | * This routine should be called with no lock held. | ||
160 | **/ | ||
155 | void | 161 | void |
156 | lpfc_adjust_queue_depth(struct lpfc_hba *phba) | 162 | lpfc_adjust_queue_depth(struct lpfc_hba *phba) |
157 | { | 163 | { |
@@ -182,10 +188,17 @@ lpfc_adjust_queue_depth(struct lpfc_hba *phba) | |||
182 | return; | 188 | return; |
183 | } | 189 | } |
184 | 190 | ||
185 | /* | 191 | /** |
186 | * This function is called with no lock held when there is a successful | 192 | * lpfc_rampup_queue_depth: Post RAMP_UP_QUEUE event for worker thread. |
187 | * SCSI command completion. | 193 | * @phba: The Hba for which this call is being executed. |
188 | */ | 194 | * |
195 | * This routine post WORKER_RAMP_UP_QUEUE event for @phba vport. This routine | ||
196 | * post at most 1 event every 5 minute after last_ramp_up_time or | ||
197 | * last_rsrc_error_time. This routine wakes up worker thread of @phba | ||
198 | * to process WORKER_RAM_DOWN_EVENT event. | ||
199 | * | ||
200 | * This routine should be called with no lock held. | ||
201 | **/ | ||
189 | static inline void | 202 | static inline void |
190 | lpfc_rampup_queue_depth(struct lpfc_vport *vport, | 203 | lpfc_rampup_queue_depth(struct lpfc_vport *vport, |
191 | struct scsi_device *sdev) | 204 | struct scsi_device *sdev) |
@@ -217,6 +230,14 @@ lpfc_rampup_queue_depth(struct lpfc_vport *vport, | |||
217 | return; | 230 | return; |
218 | } | 231 | } |
219 | 232 | ||
233 | /** | ||
234 | * lpfc_ramp_down_queue_handler: WORKER_RAMP_DOWN_QUEUE event handler. | ||
235 | * @phba: The Hba for which this call is being executed. | ||
236 | * | ||
237 | * This routine is called to process WORKER_RAMP_DOWN_QUEUE event for worker | ||
238 | * thread.This routine reduces queue depth for all scsi device on each vport | ||
239 | * associated with @phba. | ||
240 | **/ | ||
220 | void | 241 | void |
221 | lpfc_ramp_down_queue_handler(struct lpfc_hba *phba) | 242 | lpfc_ramp_down_queue_handler(struct lpfc_hba *phba) |
222 | { | 243 | { |
@@ -267,6 +288,15 @@ lpfc_ramp_down_queue_handler(struct lpfc_hba *phba) | |||
267 | atomic_set(&phba->num_cmd_success, 0); | 288 | atomic_set(&phba->num_cmd_success, 0); |
268 | } | 289 | } |
269 | 290 | ||
291 | /** | ||
292 | * lpfc_ramp_up_queue_handler: WORKER_RAMP_UP_QUEUE event handler. | ||
293 | * @phba: The Hba for which this call is being executed. | ||
294 | * | ||
295 | * This routine is called to process WORKER_RAMP_UP_QUEUE event for worker | ||
296 | * thread.This routine increases queue depth for all scsi device on each vport | ||
297 | * associated with @phba by 1. This routine also sets @phba num_rsrc_err and | ||
298 | * num_cmd_success to zero. | ||
299 | **/ | ||
270 | void | 300 | void |
271 | lpfc_ramp_up_queue_handler(struct lpfc_hba *phba) | 301 | lpfc_ramp_up_queue_handler(struct lpfc_hba *phba) |
272 | { | 302 | { |
@@ -336,14 +366,21 @@ lpfc_scsi_dev_block(struct lpfc_hba *phba) | |||
336 | lpfc_destroy_vport_work_array(phba, vports); | 366 | lpfc_destroy_vport_work_array(phba, vports); |
337 | } | 367 | } |
338 | 368 | ||
339 | /* | 369 | /** |
370 | * lpfc_new_scsi_buf: Scsi buffer allocator. | ||
371 | * @vport: The virtual port for which this call being executed. | ||
372 | * | ||
340 | * This routine allocates a scsi buffer, which contains all the necessary | 373 | * This routine allocates a scsi buffer, which contains all the necessary |
341 | * information needed to initiate a SCSI I/O. The non-DMAable buffer region | 374 | * information needed to initiate a SCSI I/O. The non-DMAable buffer region |
342 | * contains information to build the IOCB. The DMAable region contains | 375 | * contains information to build the IOCB. The DMAable region contains |
343 | * memory for the FCP CMND, FCP RSP, and the inital BPL. In addition to | 376 | * memory for the FCP CMND, FCP RSP, and the initial BPL. In addition to |
344 | * allocating memeory, the FCP CMND and FCP RSP BDEs are setup in the BPL | 377 | * allocating memory, the FCP CMND and FCP RSP BDEs are setup in the BPL |
345 | * and the BPL BDE is setup in the IOCB. | 378 | * and the BPL BDE is setup in the IOCB. |
346 | */ | 379 | * |
380 | * Return codes: | ||
381 | * NULL - Error | ||
382 | * Pointer to lpfc_scsi_buf data structure - Success | ||
383 | **/ | ||
347 | static struct lpfc_scsi_buf * | 384 | static struct lpfc_scsi_buf * |
348 | lpfc_new_scsi_buf(struct lpfc_vport *vport) | 385 | lpfc_new_scsi_buf(struct lpfc_vport *vport) |
349 | { | 386 | { |
@@ -452,6 +489,17 @@ lpfc_new_scsi_buf(struct lpfc_vport *vport) | |||
452 | return psb; | 489 | return psb; |
453 | } | 490 | } |
454 | 491 | ||
492 | /** | ||
493 | * lpfc_get_scsi_buf: Get a scsi buffer from lpfc_scsi_buf_list list of Hba. | ||
494 | * @phba: The Hba for which this call is being executed. | ||
495 | * | ||
496 | * This routine removes a scsi buffer from head of @phba lpfc_scsi_buf_list list | ||
497 | * and returns to caller. | ||
498 | * | ||
499 | * Return codes: | ||
500 | * NULL - Error | ||
501 | * Pointer to lpfc_scsi_buf - Success | ||
502 | **/ | ||
455 | static struct lpfc_scsi_buf* | 503 | static struct lpfc_scsi_buf* |
456 | lpfc_get_scsi_buf(struct lpfc_hba * phba) | 504 | lpfc_get_scsi_buf(struct lpfc_hba * phba) |
457 | { | 505 | { |
@@ -469,6 +517,14 @@ lpfc_get_scsi_buf(struct lpfc_hba * phba) | |||
469 | return lpfc_cmd; | 517 | return lpfc_cmd; |
470 | } | 518 | } |
471 | 519 | ||
520 | /** | ||
521 | * lpfc_release_scsi_buf: Return a scsi buffer back to hba lpfc_scsi_buf_list list. | ||
522 | * @phba: The Hba for which this call is being executed. | ||
523 | * @psb: The scsi buffer which is being released. | ||
524 | * | ||
525 | * This routine releases @psb scsi buffer by adding it to tail of @phba | ||
526 | * lpfc_scsi_buf_list list. | ||
527 | **/ | ||
472 | static void | 528 | static void |
473 | lpfc_release_scsi_buf(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb) | 529 | lpfc_release_scsi_buf(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb) |
474 | { | 530 | { |
@@ -480,6 +536,20 @@ lpfc_release_scsi_buf(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb) | |||
480 | spin_unlock_irqrestore(&phba->scsi_buf_list_lock, iflag); | 536 | spin_unlock_irqrestore(&phba->scsi_buf_list_lock, iflag); |
481 | } | 537 | } |
482 | 538 | ||
539 | /** | ||
540 | * lpfc_scsi_prep_dma_buf: Routine to do DMA mapping for scsi buffer. | ||
541 | * @phba: The Hba for which this call is being executed. | ||
542 | * @lpfc_cmd: The scsi buffer which is going to be mapped. | ||
543 | * | ||
544 | * This routine does the pci dma mapping for scatter-gather list of scsi cmnd | ||
545 | * field of @lpfc_cmd. This routine scans through sg elements and format the | ||
546 | * bdea. This routine also initializes all IOCB fields which are dependent on | ||
547 | * scsi command request buffer. | ||
548 | * | ||
549 | * Return codes: | ||
550 | * 1 - Error | ||
551 | * 0 - Success | ||
552 | **/ | ||
483 | static int | 553 | static int |
484 | lpfc_scsi_prep_dma_buf(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd) | 554 | lpfc_scsi_prep_dma_buf(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd) |
485 | { | 555 | { |
@@ -681,6 +751,15 @@ lpfc_send_scsi_error_event(struct lpfc_hba *phba, struct lpfc_vport *vport, | |||
681 | lpfc_worker_wake_up(phba); | 751 | lpfc_worker_wake_up(phba); |
682 | return; | 752 | return; |
683 | } | 753 | } |
754 | |||
755 | /** | ||
756 | * lpfc_scsi_unprep_dma_buf: Routine to un-map DMA mapping of scatter gather. | ||
757 | * @phba: The Hba for which this call is being executed. | ||
758 | * @psb: The scsi buffer which is going to be un-mapped. | ||
759 | * | ||
760 | * This routine does DMA un-mapping of scatter gather list of scsi command | ||
761 | * field of @lpfc_cmd. | ||
762 | **/ | ||
684 | static void | 763 | static void |
685 | lpfc_scsi_unprep_dma_buf(struct lpfc_hba * phba, struct lpfc_scsi_buf * psb) | 764 | lpfc_scsi_unprep_dma_buf(struct lpfc_hba * phba, struct lpfc_scsi_buf * psb) |
686 | { | 765 | { |
@@ -694,6 +773,16 @@ lpfc_scsi_unprep_dma_buf(struct lpfc_hba * phba, struct lpfc_scsi_buf * psb) | |||
694 | scsi_dma_unmap(psb->pCmd); | 773 | scsi_dma_unmap(psb->pCmd); |
695 | } | 774 | } |
696 | 775 | ||
776 | /** | ||
777 | * lpfc_handler_fcp_err: FCP response handler. | ||
778 | * @vport: The virtual port for which this call is being executed. | ||
779 | * @lpfc_cmd: Pointer to lpfc_scsi_buf data structure. | ||
780 | * @rsp_iocb: The response IOCB which contains FCP error. | ||
781 | * | ||
782 | * This routine is called to process response IOCB with status field | ||
783 | * IOSTAT_FCP_RSP_ERROR. This routine sets result field of scsi command | ||
784 | * based upon SCSI and FCP error. | ||
785 | **/ | ||
697 | static void | 786 | static void |
698 | lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd, | 787 | lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd, |
699 | struct lpfc_iocbq *rsp_iocb) | 788 | struct lpfc_iocbq *rsp_iocb) |
@@ -828,6 +917,16 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd, | |||
828 | lpfc_send_scsi_error_event(vport->phba, vport, lpfc_cmd, rsp_iocb); | 917 | lpfc_send_scsi_error_event(vport->phba, vport, lpfc_cmd, rsp_iocb); |
829 | } | 918 | } |
830 | 919 | ||
920 | /** | ||
921 | * lpfc_scsi_cmd_iocb_cmpl: Scsi cmnd IOCB completion routine. | ||
922 | * @phba: The Hba for which this call is being executed. | ||
923 | * @pIocbIn: The command IOCBQ for the scsi cmnd. | ||
924 | * @pIocbOut: The response IOCBQ for the scsi cmnd . | ||
925 | * | ||
926 | * This routine assigns scsi command result by looking into response IOCB | ||
927 | * status field appropriately. This routine handles QUEUE FULL condition as | ||
928 | * well by ramping down device queue depth. | ||
929 | **/ | ||
831 | static void | 930 | static void |
832 | lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, | 931 | lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, |
833 | struct lpfc_iocbq *pIocbOut) | 932 | struct lpfc_iocbq *pIocbOut) |
@@ -1067,6 +1166,15 @@ lpfc_fcpcmd_to_iocb(uint8_t *data, struct fcp_cmnd *fcp_cmnd) | |||
1067 | } | 1166 | } |
1068 | } | 1167 | } |
1069 | 1168 | ||
1169 | /** | ||
1170 | * lpfc_scsi_prep_cmnd: Routine to convert scsi cmnd to FCP information unit. | ||
1171 | * @vport: The virtual port for which this call is being executed. | ||
1172 | * @lpfc_cmd: The scsi command which needs to send. | ||
1173 | * @pnode: Pointer to lpfc_nodelist. | ||
1174 | * | ||
1175 | * This routine initializes fcp_cmnd and iocb data structure from scsi command | ||
1176 | * to transfer. | ||
1177 | **/ | ||
1070 | static void | 1178 | static void |
1071 | lpfc_scsi_prep_cmnd(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd, | 1179 | lpfc_scsi_prep_cmnd(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd, |
1072 | struct lpfc_nodelist *pnode) | 1180 | struct lpfc_nodelist *pnode) |
@@ -1152,6 +1260,19 @@ lpfc_scsi_prep_cmnd(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd, | |||
1152 | piocbq->vport = vport; | 1260 | piocbq->vport = vport; |
1153 | } | 1261 | } |
1154 | 1262 | ||
1263 | /** | ||
1264 | * lpfc_scsi_prep_task_mgmt_cmnd: Convert scsi TM cmnd to FCP information unit. | ||
1265 | * @vport: The virtual port for which this call is being executed. | ||
1266 | * @lpfc_cmd: Pointer to lpfc_scsi_buf data structure. | ||
1267 | * @lun: Logical unit number. | ||
1268 | * @task_mgmt_cmd: SCSI task management command. | ||
1269 | * | ||
1270 | * This routine creates FCP information unit corresponding to @task_mgmt_cmd. | ||
1271 | * | ||
1272 | * Return codes: | ||
1273 | * 0 - Error | ||
1274 | * 1 - Success | ||
1275 | **/ | ||
1155 | static int | 1276 | static int |
1156 | lpfc_scsi_prep_task_mgmt_cmd(struct lpfc_vport *vport, | 1277 | lpfc_scsi_prep_task_mgmt_cmd(struct lpfc_vport *vport, |
1157 | struct lpfc_scsi_buf *lpfc_cmd, | 1278 | struct lpfc_scsi_buf *lpfc_cmd, |
@@ -1201,6 +1322,15 @@ lpfc_scsi_prep_task_mgmt_cmd(struct lpfc_vport *vport, | |||
1201 | return 1; | 1322 | return 1; |
1202 | } | 1323 | } |
1203 | 1324 | ||
1325 | /** | ||
1326 | * lpc_taskmgmt_def_cmpl: IOCB completion routine for task management command. | ||
1327 | * @phba: The Hba for which this call is being executed. | ||
1328 | * @cmdiocbq: Pointer to lpfc_iocbq data structure. | ||
1329 | * @rspiocbq: Pointer to lpfc_iocbq data structure. | ||
1330 | * | ||
1331 | * This routine is IOCB completion routine for device reset and target reset | ||
1332 | * routine. This routine release scsi buffer associated with lpfc_cmd. | ||
1333 | **/ | ||
1204 | static void | 1334 | static void |
1205 | lpfc_tskmgmt_def_cmpl(struct lpfc_hba *phba, | 1335 | lpfc_tskmgmt_def_cmpl(struct lpfc_hba *phba, |
1206 | struct lpfc_iocbq *cmdiocbq, | 1336 | struct lpfc_iocbq *cmdiocbq, |
@@ -1213,6 +1343,20 @@ lpfc_tskmgmt_def_cmpl(struct lpfc_hba *phba, | |||
1213 | return; | 1343 | return; |
1214 | } | 1344 | } |
1215 | 1345 | ||
1346 | /** | ||
1347 | * lpfc_scsi_tgt_reset: Target reset handler. | ||
1348 | * @lpfc_cmd: Pointer to lpfc_scsi_buf data structure | ||
1349 | * @vport: The virtual port for which this call is being executed. | ||
1350 | * @tgt_id: Target ID. | ||
1351 | * @lun: Lun number. | ||
1352 | * @rdata: Pointer to lpfc_rport_data. | ||
1353 | * | ||
1354 | * This routine issues a TARGET RESET iocb to reset a target with @tgt_id ID. | ||
1355 | * | ||
1356 | * Return Code: | ||
1357 | * 0x2003 - Error | ||
1358 | * 0x2002 - Success. | ||
1359 | **/ | ||
1216 | static int | 1360 | static int |
1217 | lpfc_scsi_tgt_reset(struct lpfc_scsi_buf *lpfc_cmd, struct lpfc_vport *vport, | 1361 | lpfc_scsi_tgt_reset(struct lpfc_scsi_buf *lpfc_cmd, struct lpfc_vport *vport, |
1218 | unsigned tgt_id, unsigned int lun, | 1362 | unsigned tgt_id, unsigned int lun, |
@@ -1266,6 +1410,15 @@ lpfc_scsi_tgt_reset(struct lpfc_scsi_buf *lpfc_cmd, struct lpfc_vport *vport, | |||
1266 | return ret; | 1410 | return ret; |
1267 | } | 1411 | } |
1268 | 1412 | ||
1413 | /** | ||
1414 | * lpfc_info: Info entry point of scsi_host_template data structure. | ||
1415 | * @host: The scsi host for which this call is being executed. | ||
1416 | * | ||
1417 | * This routine provides module information about hba. | ||
1418 | * | ||
1419 | * Reutrn code: | ||
1420 | * Pointer to char - Success. | ||
1421 | **/ | ||
1269 | const char * | 1422 | const char * |
1270 | lpfc_info(struct Scsi_Host *host) | 1423 | lpfc_info(struct Scsi_Host *host) |
1271 | { | 1424 | { |
@@ -1295,6 +1448,13 @@ lpfc_info(struct Scsi_Host *host) | |||
1295 | return lpfcinfobuf; | 1448 | return lpfcinfobuf; |
1296 | } | 1449 | } |
1297 | 1450 | ||
1451 | /** | ||
1452 | * lpfc_poll_rearm_time: Routine to modify fcp_poll timer of hba. | ||
1453 | * @phba: The Hba for which this call is being executed. | ||
1454 | * | ||
1455 | * This routine modifies fcp_poll_timer field of @phba by cfg_poll_tmo. | ||
1456 | * The default value of cfg_poll_tmo is 10 milliseconds. | ||
1457 | **/ | ||
1298 | static __inline__ void lpfc_poll_rearm_timer(struct lpfc_hba * phba) | 1458 | static __inline__ void lpfc_poll_rearm_timer(struct lpfc_hba * phba) |
1299 | { | 1459 | { |
1300 | unsigned long poll_tmo_expires = | 1460 | unsigned long poll_tmo_expires = |
@@ -1305,11 +1465,25 @@ static __inline__ void lpfc_poll_rearm_timer(struct lpfc_hba * phba) | |||
1305 | poll_tmo_expires); | 1465 | poll_tmo_expires); |
1306 | } | 1466 | } |
1307 | 1467 | ||
1468 | /** | ||
1469 | * lpfc_poll_start_timer: Routine to start fcp_poll_timer of HBA. | ||
1470 | * @phba: The Hba for which this call is being executed. | ||
1471 | * | ||
1472 | * This routine starts the fcp_poll_timer of @phba. | ||
1473 | **/ | ||
1308 | void lpfc_poll_start_timer(struct lpfc_hba * phba) | 1474 | void lpfc_poll_start_timer(struct lpfc_hba * phba) |
1309 | { | 1475 | { |
1310 | lpfc_poll_rearm_timer(phba); | 1476 | lpfc_poll_rearm_timer(phba); |
1311 | } | 1477 | } |
1312 | 1478 | ||
1479 | /** | ||
1480 | * lpfc_poll_timeout: Restart polling timer. | ||
1481 | * @ptr: Map to lpfc_hba data structure pointer. | ||
1482 | * | ||
1483 | * This routine restarts fcp_poll timer, when FCP ring polling is enable | ||
1484 | * and FCP Ring interrupt is disable. | ||
1485 | **/ | ||
1486 | |||
1313 | void lpfc_poll_timeout(unsigned long ptr) | 1487 | void lpfc_poll_timeout(unsigned long ptr) |
1314 | { | 1488 | { |
1315 | struct lpfc_hba *phba = (struct lpfc_hba *) ptr; | 1489 | struct lpfc_hba *phba = (struct lpfc_hba *) ptr; |
@@ -1321,6 +1495,20 @@ void lpfc_poll_timeout(unsigned long ptr) | |||
1321 | } | 1495 | } |
1322 | } | 1496 | } |
1323 | 1497 | ||
1498 | /** | ||
1499 | * lpfc_queuecommand: Queuecommand entry point of Scsi Host Templater data | ||
1500 | * structure. | ||
1501 | * @cmnd: Pointer to scsi_cmnd data structure. | ||
1502 | * @done: Pointer to done routine. | ||
1503 | * | ||
1504 | * Driver registers this routine to scsi midlayer to submit a @cmd to process. | ||
1505 | * This routine prepares an IOCB from scsi command and provides to firmware. | ||
1506 | * The @done callback is invoked after driver finished processing the command. | ||
1507 | * | ||
1508 | * Return value : | ||
1509 | * 0 - Success | ||
1510 | * SCSI_MLQUEUE_HOST_BUSY - Block all devices served by this host temporarily. | ||
1511 | **/ | ||
1324 | static int | 1512 | static int |
1325 | lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *)) | 1513 | lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *)) |
1326 | { | 1514 | { |
@@ -1405,6 +1593,12 @@ lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *)) | |||
1405 | return 0; | 1593 | return 0; |
1406 | } | 1594 | } |
1407 | 1595 | ||
1596 | /** | ||
1597 | * lpfc_block_error_handler: Routine to block error handler. | ||
1598 | * @cmnd: Pointer to scsi_cmnd data structure. | ||
1599 | * | ||
1600 | * This routine blocks execution till fc_rport state is not FC_PORSTAT_BLCOEKD. | ||
1601 | **/ | ||
1408 | static void | 1602 | static void |
1409 | lpfc_block_error_handler(struct scsi_cmnd *cmnd) | 1603 | lpfc_block_error_handler(struct scsi_cmnd *cmnd) |
1410 | { | 1604 | { |
@@ -1421,6 +1615,17 @@ lpfc_block_error_handler(struct scsi_cmnd *cmnd) | |||
1421 | return; | 1615 | return; |
1422 | } | 1616 | } |
1423 | 1617 | ||
1618 | /** | ||
1619 | * lpfc_abort_handler: Eh_abort_handler entry point of Scsi Host Template data | ||
1620 | *structure. | ||
1621 | * @cmnd: Pointer to scsi_cmnd data structure. | ||
1622 | * | ||
1623 | * This routine aborts @cmnd pending in base driver. | ||
1624 | * | ||
1625 | * Return code : | ||
1626 | * 0x2003 - Error | ||
1627 | * 0x2002 - Success | ||
1628 | **/ | ||
1424 | static int | 1629 | static int |
1425 | lpfc_abort_handler(struct scsi_cmnd *cmnd) | 1630 | lpfc_abort_handler(struct scsi_cmnd *cmnd) |
1426 | { | 1631 | { |
@@ -1516,6 +1721,18 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) | |||
1516 | return ret; | 1721 | return ret; |
1517 | } | 1722 | } |
1518 | 1723 | ||
1724 | /** | ||
1725 | * lpfc_device_reset_handler: eh_device_reset entry point of Scsi Host Template | ||
1726 | *data structure. | ||
1727 | * @cmnd: Pointer to scsi_cmnd data structure. | ||
1728 | * | ||
1729 | * This routine does a device reset by sending a TARGET_RESET task management | ||
1730 | * command. | ||
1731 | * | ||
1732 | * Return code : | ||
1733 | * 0x2003 - Error | ||
1734 | * 0ex2002 - Success | ||
1735 | **/ | ||
1519 | static int | 1736 | static int |
1520 | lpfc_device_reset_handler(struct scsi_cmnd *cmnd) | 1737 | lpfc_device_reset_handler(struct scsi_cmnd *cmnd) |
1521 | { | 1738 | { |
@@ -1633,6 +1850,17 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd) | |||
1633 | return ret; | 1850 | return ret; |
1634 | } | 1851 | } |
1635 | 1852 | ||
1853 | /** | ||
1854 | * lpfc_bus_reset_handler: eh_bus_reset_handler entry point of Scsi Host | ||
1855 | * Template data structure. | ||
1856 | * @cmnd: Pointer to scsi_cmnd data structure. | ||
1857 | * | ||
1858 | * This routine does target reset to all target on @cmnd->device->host. | ||
1859 | * | ||
1860 | * Return Code: | ||
1861 | * 0x2003 - Error | ||
1862 | * 0x2002 - Success | ||
1863 | **/ | ||
1636 | static int | 1864 | static int |
1637 | lpfc_bus_reset_handler(struct scsi_cmnd *cmnd) | 1865 | lpfc_bus_reset_handler(struct scsi_cmnd *cmnd) |
1638 | { | 1866 | { |
@@ -1723,6 +1951,20 @@ lpfc_bus_reset_handler(struct scsi_cmnd *cmnd) | |||
1723 | return ret; | 1951 | return ret; |
1724 | } | 1952 | } |
1725 | 1953 | ||
1954 | /** | ||
1955 | * lpfc_slave_alloc: slave_alloc entry point of Scsi Host Template data | ||
1956 | * structure. | ||
1957 | * @sdev: Pointer to scsi_device. | ||
1958 | * | ||
1959 | * This routine populates the cmds_per_lun count + 2 scsi_bufs into this host's | ||
1960 | * globally available list of scsi buffers. This routine also makes sure scsi | ||
1961 | * buffer is not allocated more than HBA limit conveyed to midlayer. This list | ||
1962 | * of scsi buffer exists for the lifetime of the driver. | ||
1963 | * | ||
1964 | * Return codes: | ||
1965 | * non-0 - Error | ||
1966 | * 0 - Success | ||
1967 | **/ | ||
1726 | static int | 1968 | static int |
1727 | lpfc_slave_alloc(struct scsi_device *sdev) | 1969 | lpfc_slave_alloc(struct scsi_device *sdev) |
1728 | { | 1970 | { |
@@ -1784,6 +2026,19 @@ lpfc_slave_alloc(struct scsi_device *sdev) | |||
1784 | return 0; | 2026 | return 0; |
1785 | } | 2027 | } |
1786 | 2028 | ||
2029 | /** | ||
2030 | * lpfc_slave_configure: slave_configure entry point of Scsi Host Templater data | ||
2031 | * structure. | ||
2032 | * @sdev: Pointer to scsi_device. | ||
2033 | * | ||
2034 | * This routine configures following items | ||
2035 | * - Tag command queuing support for @sdev if supported. | ||
2036 | * - Dev loss time out value of fc_rport. | ||
2037 | * - Enable SLI polling for fcp ring if ENABLE_FCP_RING_POLLING flag is set. | ||
2038 | * | ||
2039 | * Return codes: | ||
2040 | * 0 - Success | ||
2041 | **/ | ||
1787 | static int | 2042 | static int |
1788 | lpfc_slave_configure(struct scsi_device *sdev) | 2043 | lpfc_slave_configure(struct scsi_device *sdev) |
1789 | { | 2044 | { |
@@ -1813,6 +2068,12 @@ lpfc_slave_configure(struct scsi_device *sdev) | |||
1813 | return 0; | 2068 | return 0; |
1814 | } | 2069 | } |
1815 | 2070 | ||
2071 | /** | ||
2072 | * lpfc_slave_destroy: slave_destroy entry point of SHT data structure. | ||
2073 | * @sdev: Pointer to scsi_device. | ||
2074 | * | ||
2075 | * This routine sets @sdev hostatdata filed to null. | ||
2076 | **/ | ||
1816 | static void | 2077 | static void |
1817 | lpfc_slave_destroy(struct scsi_device *sdev) | 2078 | lpfc_slave_destroy(struct scsi_device *sdev) |
1818 | { | 2079 | { |