aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla4xxx/ql4_isr.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/qla4xxx/ql4_isr.c')
-rw-r--r--drivers/scsi/qla4xxx/ql4_isr.c78
1 files changed, 78 insertions, 0 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_isr.c b/drivers/scsi/qla4xxx/ql4_isr.c
index 95828862eea0..7c9f28b7da72 100644
--- a/drivers/scsi/qla4xxx/ql4_isr.c
+++ b/drivers/scsi/qla4xxx/ql4_isr.c
@@ -385,6 +385,71 @@ static void qla4xxx_passthru_status_entry(struct scsi_qla_host *ha,
385 queue_work(ha->task_wq, &task_data->task_work); 385 queue_work(ha->task_wq, &task_data->task_work);
386} 386}
387 387
388static struct mrb *qla4xxx_del_mrb_from_active_array(struct scsi_qla_host *ha,
389 uint32_t index)
390{
391 struct mrb *mrb = NULL;
392
393 /* validate handle and remove from active array */
394 if (index >= MAX_MRB)
395 return mrb;
396
397 mrb = ha->active_mrb_array[index];
398 ha->active_mrb_array[index] = NULL;
399 if (!mrb)
400 return mrb;
401
402 /* update counters */
403 ha->req_q_count += mrb->iocb_cnt;
404 ha->iocb_cnt -= mrb->iocb_cnt;
405
406 return mrb;
407}
408
409static void qla4xxx_mbox_status_entry(struct scsi_qla_host *ha,
410 struct mbox_status_iocb *mbox_sts_entry)
411{
412 struct mrb *mrb;
413 uint32_t status;
414 uint32_t data_size;
415
416 mrb = qla4xxx_del_mrb_from_active_array(ha,
417 le32_to_cpu(mbox_sts_entry->handle));
418
419 if (mrb == NULL) {
420 ql4_printk(KERN_WARNING, ha, "%s: mrb[%d] is null\n", __func__,
421 mbox_sts_entry->handle);
422 return;
423 }
424
425 switch (mrb->mbox_cmd) {
426 case MBOX_CMD_PING:
427 DEBUG2(ql4_printk(KERN_INFO, ha, "%s: mbox_cmd = 0x%x, "
428 "mbox_sts[0] = 0x%x, mbox_sts[6] = 0x%x\n",
429 __func__, mrb->mbox_cmd,
430 mbox_sts_entry->out_mbox[0],
431 mbox_sts_entry->out_mbox[6]));
432
433 if (mbox_sts_entry->out_mbox[0] == MBOX_STS_COMMAND_COMPLETE)
434 status = QLA_SUCCESS;
435 else
436 status = QLA_ERROR;
437
438 data_size = sizeof(mbox_sts_entry->out_mbox);
439
440 qla4xxx_post_ping_evt_work(ha, status, mrb->pid, data_size,
441 (uint8_t *) mbox_sts_entry->out_mbox);
442 break;
443
444 default:
445 DEBUG2(ql4_printk(KERN_WARNING, ha, "%s: invalid mbox_cmd = "
446 "0x%x\n", __func__, mrb->mbox_cmd));
447 }
448
449 kfree(mrb);
450 return;
451}
452
388/** 453/**
389 * qla4xxx_process_response_queue - process response queue completions 454 * qla4xxx_process_response_queue - process response queue completions
390 * @ha: Pointer to host adapter structure. 455 * @ha: Pointer to host adapter structure.
@@ -461,6 +526,13 @@ void qla4xxx_process_response_queue(struct scsi_qla_host *ha)
461 "ignoring\n", ha->host_no, __func__)); 526 "ignoring\n", ha->host_no, __func__));
462 break; 527 break;
463 528
529 case ET_MBOX_STATUS:
530 DEBUG2(ql4_printk(KERN_INFO, ha,
531 "%s: mbox status IOCB\n", __func__));
532 qla4xxx_mbox_status_entry(ha,
533 (struct mbox_status_iocb *)sts_entry);
534 break;
535
464 default: 536 default:
465 /* 537 /*
466 * Invalid entry in response queue, reset RISC 538 * Invalid entry in response queue, reset RISC
@@ -576,6 +648,9 @@ static void qla4xxx_isr_decode_mailbox(struct scsi_qla_host * ha,
576 set_bit(DPC_LINK_CHANGED, &ha->dpc_flags); 648 set_bit(DPC_LINK_CHANGED, &ha->dpc_flags);
577 649
578 ql4_printk(KERN_INFO, ha, "%s: LINK UP\n", __func__); 650 ql4_printk(KERN_INFO, ha, "%s: LINK UP\n", __func__);
651 qla4xxx_post_aen_work(ha, ISCSI_EVENT_LINKUP,
652 sizeof(mbox_sts),
653 (uint8_t *) mbox_sts);
579 break; 654 break;
580 655
581 case MBOX_ASTS_LINK_DOWN: 656 case MBOX_ASTS_LINK_DOWN:
@@ -584,6 +659,9 @@ static void qla4xxx_isr_decode_mailbox(struct scsi_qla_host * ha,
584 set_bit(DPC_LINK_CHANGED, &ha->dpc_flags); 659 set_bit(DPC_LINK_CHANGED, &ha->dpc_flags);
585 660
586 ql4_printk(KERN_INFO, ha, "%s: LINK DOWN\n", __func__); 661 ql4_printk(KERN_INFO, ha, "%s: LINK DOWN\n", __func__);
662 qla4xxx_post_aen_work(ha, ISCSI_EVENT_LINKDOWN,
663 sizeof(mbox_sts),
664 (uint8_t *) mbox_sts);
587 break; 665 break;
588 666
589 case MBOX_ASTS_HEARTBEAT: 667 case MBOX_ASTS_HEARTBEAT: