aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/be2iscsi/be_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/be2iscsi/be_main.c')
-rw-r--r--drivers/scsi/be2iscsi/be_main.c82
1 files changed, 66 insertions, 16 deletions
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 0d822297aa80..554349029628 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -599,15 +599,7 @@ static struct beiscsi_hba *beiscsi_hba_alloc(struct pci_dev *pcidev)
599 pci_set_drvdata(pcidev, phba); 599 pci_set_drvdata(pcidev, phba);
600 phba->interface_handle = 0xFFFFFFFF; 600 phba->interface_handle = 0xFFFFFFFF;
601 601
602 if (iscsi_host_add(shost, &phba->pcidev->dev))
603 goto free_devices;
604
605 return phba; 602 return phba;
606
607free_devices:
608 pci_dev_put(phba->pcidev);
609 iscsi_host_free(phba->shost);
610 return NULL;
611} 603}
612 604
613static void beiscsi_unmap_pci_function(struct beiscsi_hba *phba) 605static void beiscsi_unmap_pci_function(struct beiscsi_hba *phba)
@@ -2279,6 +2271,7 @@ static int be_iopoll(struct blk_iopoll *iop, int budget)
2279 2271
2280 pbe_eq = container_of(iop, struct be_eq_obj, iopoll); 2272 pbe_eq = container_of(iop, struct be_eq_obj, iopoll);
2281 ret = beiscsi_process_cq(pbe_eq); 2273 ret = beiscsi_process_cq(pbe_eq);
2274 pbe_eq->cq_count += ret;
2282 if (ret < budget) { 2275 if (ret < budget) {
2283 phba = pbe_eq->phba; 2276 phba = pbe_eq->phba;
2284 blk_iopoll_complete(iop); 2277 blk_iopoll_complete(iop);
@@ -3692,7 +3685,7 @@ static void hwi_cleanup(struct beiscsi_hba *phba)
3692 struct hwi_controller *phwi_ctrlr; 3685 struct hwi_controller *phwi_ctrlr;
3693 struct hwi_context_memory *phwi_context; 3686 struct hwi_context_memory *phwi_context;
3694 struct hwi_async_pdu_context *pasync_ctx; 3687 struct hwi_async_pdu_context *pasync_ctx;
3695 int i, eq_num, ulp_num; 3688 int i, eq_for_mcc, ulp_num;
3696 3689
3697 phwi_ctrlr = phba->phwi_ctrlr; 3690 phwi_ctrlr = phba->phwi_ctrlr;
3698 phwi_context = phwi_ctrlr->phwi_ctxt; 3691 phwi_context = phwi_ctrlr->phwi_ctxt;
@@ -3729,16 +3722,17 @@ static void hwi_cleanup(struct beiscsi_hba *phba)
3729 if (q->created) 3722 if (q->created)
3730 beiscsi_cmd_q_destroy(ctrl, q, QTYPE_CQ); 3723 beiscsi_cmd_q_destroy(ctrl, q, QTYPE_CQ);
3731 } 3724 }
3725
3726 be_mcc_queues_destroy(phba);
3732 if (phba->msix_enabled) 3727 if (phba->msix_enabled)
3733 eq_num = 1; 3728 eq_for_mcc = 1;
3734 else 3729 else
3735 eq_num = 0; 3730 eq_for_mcc = 0;
3736 for (i = 0; i < (phba->num_cpus + eq_num); i++) { 3731 for (i = 0; i < (phba->num_cpus + eq_for_mcc); i++) {
3737 q = &phwi_context->be_eq[i].q; 3732 q = &phwi_context->be_eq[i].q;
3738 if (q->created) 3733 if (q->created)
3739 beiscsi_cmd_q_destroy(ctrl, q, QTYPE_EQ); 3734 beiscsi_cmd_q_destroy(ctrl, q, QTYPE_EQ);
3740 } 3735 }
3741 be_mcc_queues_destroy(phba);
3742 be_cmd_fw_uninit(ctrl); 3736 be_cmd_fw_uninit(ctrl);
3743} 3737}
3744 3738
@@ -3833,9 +3827,9 @@ static int hwi_init_port(struct beiscsi_hba *phba)
3833 3827
3834 phwi_ctrlr = phba->phwi_ctrlr; 3828 phwi_ctrlr = phba->phwi_ctrlr;
3835 phwi_context = phwi_ctrlr->phwi_ctxt; 3829 phwi_context = phwi_ctrlr->phwi_ctxt;
3836 phwi_context->max_eqd = 0; 3830 phwi_context->max_eqd = 128;
3837 phwi_context->min_eqd = 0; 3831 phwi_context->min_eqd = 0;
3838 phwi_context->cur_eqd = 64; 3832 phwi_context->cur_eqd = 0;
3839 be_cmd_fw_initialize(&phba->ctrl); 3833 be_cmd_fw_initialize(&phba->ctrl);
3840 3834
3841 status = beiscsi_create_eqs(phba, phwi_context); 3835 status = beiscsi_create_eqs(phba, phwi_context);
@@ -5290,6 +5284,57 @@ static void beiscsi_msix_enable(struct beiscsi_hba *phba)
5290 return; 5284 return;
5291} 5285}
5292 5286
5287static void be_eqd_update(struct beiscsi_hba *phba)
5288{
5289 struct be_set_eqd set_eqd[MAX_CPUS];
5290 struct be_aic_obj *aic;
5291 struct be_eq_obj *pbe_eq;
5292 struct hwi_controller *phwi_ctrlr;
5293 struct hwi_context_memory *phwi_context;
5294 int eqd, i, num = 0;
5295 ulong now;
5296 u32 pps, delta;
5297 unsigned int tag;
5298
5299 phwi_ctrlr = phba->phwi_ctrlr;
5300 phwi_context = phwi_ctrlr->phwi_ctxt;
5301
5302 for (i = 0; i <= phba->num_cpus; i++) {
5303 aic = &phba->aic_obj[i];
5304 pbe_eq = &phwi_context->be_eq[i];
5305 now = jiffies;
5306 if (!aic->jiffs || time_before(now, aic->jiffs) ||
5307 pbe_eq->cq_count < aic->eq_prev) {
5308 aic->jiffs = now;
5309 aic->eq_prev = pbe_eq->cq_count;
5310 continue;
5311 }
5312 delta = jiffies_to_msecs(now - aic->jiffs);
5313 pps = (((u32)(pbe_eq->cq_count - aic->eq_prev) * 1000) / delta);
5314 eqd = (pps / 1500) << 2;
5315
5316 if (eqd < 8)
5317 eqd = 0;
5318 eqd = min_t(u32, eqd, phwi_context->max_eqd);
5319 eqd = max_t(u32, eqd, phwi_context->min_eqd);
5320
5321 aic->jiffs = now;
5322 aic->eq_prev = pbe_eq->cq_count;
5323
5324 if (eqd != aic->prev_eqd) {
5325 set_eqd[num].delay_multiplier = (eqd * 65)/100;
5326 set_eqd[num].eq_id = pbe_eq->q.id;
5327 aic->prev_eqd = eqd;
5328 num++;
5329 }
5330 }
5331 if (num) {
5332 tag = be_cmd_modify_eq_delay(phba, set_eqd, num);
5333 if (tag)
5334 beiscsi_mccq_compl(phba, tag, NULL, NULL);
5335 }
5336}
5337
5293/* 5338/*
5294 * beiscsi_hw_health_check()- Check adapter health 5339 * beiscsi_hw_health_check()- Check adapter health
5295 * @work: work item to check HW health 5340 * @work: work item to check HW health
@@ -5303,6 +5348,8 @@ beiscsi_hw_health_check(struct work_struct *work)
5303 container_of(work, struct beiscsi_hba, 5348 container_of(work, struct beiscsi_hba,
5304 beiscsi_hw_check_task.work); 5349 beiscsi_hw_check_task.work);
5305 5350
5351 be_eqd_update(phba);
5352
5306 beiscsi_ue_detect(phba); 5353 beiscsi_ue_detect(phba);
5307 5354
5308 schedule_delayed_work(&phba->beiscsi_hw_check_task, 5355 schedule_delayed_work(&phba->beiscsi_hw_check_task,
@@ -5579,7 +5626,7 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev,
5579 phba->ctrl.mcc_numtag[i + 1] = 0; 5626 phba->ctrl.mcc_numtag[i + 1] = 0;
5580 phba->ctrl.mcc_tag_available++; 5627 phba->ctrl.mcc_tag_available++;
5581 memset(&phba->ctrl.ptag_state[i].tag_mem_state, 0, 5628 memset(&phba->ctrl.ptag_state[i].tag_mem_state, 0,
5582 sizeof(struct beiscsi_mcc_tag_state)); 5629 sizeof(struct be_dma_mem));
5583 } 5630 }
5584 5631
5585 phba->ctrl.mcc_alloc_index = phba->ctrl.mcc_free_index = 0; 5632 phba->ctrl.mcc_alloc_index = phba->ctrl.mcc_free_index = 0;
@@ -5621,6 +5668,9 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev,
5621 } 5668 }
5622 hwi_enable_intr(phba); 5669 hwi_enable_intr(phba);
5623 5670
5671 if (iscsi_host_add(phba->shost, &phba->pcidev->dev))
5672 goto free_blkenbld;
5673
5624 if (beiscsi_setup_boot_info(phba)) 5674 if (beiscsi_setup_boot_info(phba))
5625 /* 5675 /*
5626 * log error but continue, because we may not be using 5676 * log error but continue, because we may not be using