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.c206
1 files changed, 63 insertions, 143 deletions
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 9be818f7b26d..0d822297aa80 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -898,7 +898,6 @@ static irqreturn_t be_isr_msix(int irq, void *dev_id)
898 struct be_queue_info *cq; 898 struct be_queue_info *cq;
899 unsigned int num_eq_processed; 899 unsigned int num_eq_processed;
900 struct be_eq_obj *pbe_eq; 900 struct be_eq_obj *pbe_eq;
901 unsigned long flags;
902 901
903 pbe_eq = dev_id; 902 pbe_eq = dev_id;
904 eq = &pbe_eq->q; 903 eq = &pbe_eq->q;
@@ -907,31 +906,15 @@ static irqreturn_t be_isr_msix(int irq, void *dev_id)
907 906
908 phba = pbe_eq->phba; 907 phba = pbe_eq->phba;
909 num_eq_processed = 0; 908 num_eq_processed = 0;
910 if (blk_iopoll_enabled) { 909 while (eqe->dw[offsetof(struct amap_eq_entry, valid) / 32]
911 while (eqe->dw[offsetof(struct amap_eq_entry, valid) / 32] 910 & EQE_VALID_MASK) {
912 & EQE_VALID_MASK) { 911 if (!blk_iopoll_sched_prep(&pbe_eq->iopoll))
913 if (!blk_iopoll_sched_prep(&pbe_eq->iopoll)) 912 blk_iopoll_sched(&pbe_eq->iopoll);
914 blk_iopoll_sched(&pbe_eq->iopoll);
915
916 AMAP_SET_BITS(struct amap_eq_entry, valid, eqe, 0);
917 queue_tail_inc(eq);
918 eqe = queue_tail_node(eq);
919 num_eq_processed++;
920 }
921 } else {
922 while (eqe->dw[offsetof(struct amap_eq_entry, valid) / 32]
923 & EQE_VALID_MASK) {
924 spin_lock_irqsave(&phba->isr_lock, flags);
925 pbe_eq->todo_cq = true;
926 spin_unlock_irqrestore(&phba->isr_lock, flags);
927 AMAP_SET_BITS(struct amap_eq_entry, valid, eqe, 0);
928 queue_tail_inc(eq);
929 eqe = queue_tail_node(eq);
930 num_eq_processed++;
931 }
932 913
933 if (pbe_eq->todo_cq) 914 AMAP_SET_BITS(struct amap_eq_entry, valid, eqe, 0);
934 queue_work(phba->wq, &pbe_eq->work_cqs); 915 queue_tail_inc(eq);
916 eqe = queue_tail_node(eq);
917 num_eq_processed++;
935 } 918 }
936 919
937 if (num_eq_processed) 920 if (num_eq_processed)
@@ -952,7 +935,6 @@ static irqreturn_t be_isr(int irq, void *dev_id)
952 struct hwi_context_memory *phwi_context; 935 struct hwi_context_memory *phwi_context;
953 struct be_eq_entry *eqe = NULL; 936 struct be_eq_entry *eqe = NULL;
954 struct be_queue_info *eq; 937 struct be_queue_info *eq;
955 struct be_queue_info *cq;
956 struct be_queue_info *mcc; 938 struct be_queue_info *mcc;
957 unsigned long flags, index; 939 unsigned long flags, index;
958 unsigned int num_mcceq_processed, num_ioeq_processed; 940 unsigned int num_mcceq_processed, num_ioeq_processed;
@@ -978,72 +960,40 @@ static irqreturn_t be_isr(int irq, void *dev_id)
978 960
979 num_ioeq_processed = 0; 961 num_ioeq_processed = 0;
980 num_mcceq_processed = 0; 962 num_mcceq_processed = 0;
981 if (blk_iopoll_enabled) { 963 while (eqe->dw[offsetof(struct amap_eq_entry, valid) / 32]
982 while (eqe->dw[offsetof(struct amap_eq_entry, valid) / 32] 964 & EQE_VALID_MASK) {
983 & EQE_VALID_MASK) { 965 if (((eqe->dw[offsetof(struct amap_eq_entry,
984 if (((eqe->dw[offsetof(struct amap_eq_entry, 966 resource_id) / 32] &
985 resource_id) / 32] & 967 EQE_RESID_MASK) >> 16) == mcc->id) {
986 EQE_RESID_MASK) >> 16) == mcc->id) { 968 spin_lock_irqsave(&phba->isr_lock, flags);
987 spin_lock_irqsave(&phba->isr_lock, flags); 969 pbe_eq->todo_mcc_cq = true;
988 pbe_eq->todo_mcc_cq = true; 970 spin_unlock_irqrestore(&phba->isr_lock, flags);
989 spin_unlock_irqrestore(&phba->isr_lock, flags); 971 num_mcceq_processed++;
990 num_mcceq_processed++; 972 } else {
991 } else { 973 if (!blk_iopoll_sched_prep(&pbe_eq->iopoll))
992 if (!blk_iopoll_sched_prep(&pbe_eq->iopoll)) 974 blk_iopoll_sched(&pbe_eq->iopoll);
993 blk_iopoll_sched(&pbe_eq->iopoll);
994 num_ioeq_processed++;
995 }
996 AMAP_SET_BITS(struct amap_eq_entry, valid, eqe, 0);
997 queue_tail_inc(eq);
998 eqe = queue_tail_node(eq);
999 }
1000 if (num_ioeq_processed || num_mcceq_processed) {
1001 if (pbe_eq->todo_mcc_cq)
1002 queue_work(phba->wq, &pbe_eq->work_cqs);
1003
1004 if ((num_mcceq_processed) && (!num_ioeq_processed))
1005 hwi_ring_eq_db(phba, eq->id, 0,
1006 (num_ioeq_processed +
1007 num_mcceq_processed) , 1, 1);
1008 else
1009 hwi_ring_eq_db(phba, eq->id, 0,
1010 (num_ioeq_processed +
1011 num_mcceq_processed), 0, 1);
1012
1013 return IRQ_HANDLED;
1014 } else
1015 return IRQ_NONE;
1016 } else {
1017 cq = &phwi_context->be_cq[0];
1018 while (eqe->dw[offsetof(struct amap_eq_entry, valid) / 32]
1019 & EQE_VALID_MASK) {
1020
1021 if (((eqe->dw[offsetof(struct amap_eq_entry,
1022 resource_id) / 32] &
1023 EQE_RESID_MASK) >> 16) != cq->id) {
1024 spin_lock_irqsave(&phba->isr_lock, flags);
1025 pbe_eq->todo_mcc_cq = true;
1026 spin_unlock_irqrestore(&phba->isr_lock, flags);
1027 } else {
1028 spin_lock_irqsave(&phba->isr_lock, flags);
1029 pbe_eq->todo_cq = true;
1030 spin_unlock_irqrestore(&phba->isr_lock, flags);
1031 }
1032 AMAP_SET_BITS(struct amap_eq_entry, valid, eqe, 0);
1033 queue_tail_inc(eq);
1034 eqe = queue_tail_node(eq);
1035 num_ioeq_processed++; 975 num_ioeq_processed++;
1036 } 976 }
1037 if (pbe_eq->todo_cq || pbe_eq->todo_mcc_cq) 977 AMAP_SET_BITS(struct amap_eq_entry, valid, eqe, 0);
978 queue_tail_inc(eq);
979 eqe = queue_tail_node(eq);
980 }
981 if (num_ioeq_processed || num_mcceq_processed) {
982 if (pbe_eq->todo_mcc_cq)
1038 queue_work(phba->wq, &pbe_eq->work_cqs); 983 queue_work(phba->wq, &pbe_eq->work_cqs);
1039 984
1040 if (num_ioeq_processed) { 985 if ((num_mcceq_processed) && (!num_ioeq_processed))
1041 hwi_ring_eq_db(phba, eq->id, 0, 986 hwi_ring_eq_db(phba, eq->id, 0,
1042 num_ioeq_processed, 1, 1); 987 (num_ioeq_processed +
1043 return IRQ_HANDLED; 988 num_mcceq_processed) , 1, 1);
1044 } else 989 else
1045 return IRQ_NONE; 990 hwi_ring_eq_db(phba, eq->id, 0,
1046 } 991 (num_ioeq_processed +
992 num_mcceq_processed), 0, 1);
993
994 return IRQ_HANDLED;
995 } else
996 return IRQ_NONE;
1047} 997}
1048 998
1049static int beiscsi_init_irqs(struct beiscsi_hba *phba) 999static int beiscsi_init_irqs(struct beiscsi_hba *phba)
@@ -5263,11 +5213,10 @@ static void beiscsi_quiesce(struct beiscsi_hba *phba,
5263 } 5213 }
5264 pci_disable_msix(phba->pcidev); 5214 pci_disable_msix(phba->pcidev);
5265 5215
5266 if (blk_iopoll_enabled) 5216 for (i = 0; i < phba->num_cpus; i++) {
5267 for (i = 0; i < phba->num_cpus; i++) { 5217 pbe_eq = &phwi_context->be_eq[i];
5268 pbe_eq = &phwi_context->be_eq[i]; 5218 blk_iopoll_disable(&pbe_eq->iopoll);
5269 blk_iopoll_disable(&pbe_eq->iopoll); 5219 }
5270 }
5271 5220
5272 if (unload_state == BEISCSI_CLEAN_UNLOAD) { 5221 if (unload_state == BEISCSI_CLEAN_UNLOAD) {
5273 destroy_workqueue(phba->wq); 5222 destroy_workqueue(phba->wq);
@@ -5478,32 +5427,18 @@ static void beiscsi_eeh_resume(struct pci_dev *pdev)
5478 phwi_ctrlr = phba->phwi_ctrlr; 5427 phwi_ctrlr = phba->phwi_ctrlr;
5479 phwi_context = phwi_ctrlr->phwi_ctxt; 5428 phwi_context = phwi_ctrlr->phwi_ctxt;
5480 5429
5481 if (blk_iopoll_enabled) { 5430 for (i = 0; i < phba->num_cpus; i++) {
5482 for (i = 0; i < phba->num_cpus; i++) {
5483 pbe_eq = &phwi_context->be_eq[i];
5484 blk_iopoll_init(&pbe_eq->iopoll, be_iopoll_budget,
5485 be_iopoll);
5486 blk_iopoll_enable(&pbe_eq->iopoll);
5487 }
5488
5489 i = (phba->msix_enabled) ? i : 0;
5490 /* Work item for MCC handling */
5491 pbe_eq = &phwi_context->be_eq[i]; 5431 pbe_eq = &phwi_context->be_eq[i];
5492 INIT_WORK(&pbe_eq->work_cqs, beiscsi_process_all_cqs); 5432 blk_iopoll_init(&pbe_eq->iopoll, be_iopoll_budget,
5493 } else { 5433 be_iopoll);
5494 if (phba->msix_enabled) { 5434 blk_iopoll_enable(&pbe_eq->iopoll);
5495 for (i = 0; i <= phba->num_cpus; i++) {
5496 pbe_eq = &phwi_context->be_eq[i];
5497 INIT_WORK(&pbe_eq->work_cqs,
5498 beiscsi_process_all_cqs);
5499 }
5500 } else {
5501 pbe_eq = &phwi_context->be_eq[0];
5502 INIT_WORK(&pbe_eq->work_cqs,
5503 beiscsi_process_all_cqs);
5504 }
5505 } 5435 }
5506 5436
5437 i = (phba->msix_enabled) ? i : 0;
5438 /* Work item for MCC handling */
5439 pbe_eq = &phwi_context->be_eq[i];
5440 INIT_WORK(&pbe_eq->work_cqs, beiscsi_process_all_cqs);
5441
5507 ret = beiscsi_init_irqs(phba); 5442 ret = beiscsi_init_irqs(phba);
5508 if (ret < 0) { 5443 if (ret < 0) {
5509 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, 5444 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
@@ -5665,32 +5600,18 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev,
5665 phwi_ctrlr = phba->phwi_ctrlr; 5600 phwi_ctrlr = phba->phwi_ctrlr;
5666 phwi_context = phwi_ctrlr->phwi_ctxt; 5601 phwi_context = phwi_ctrlr->phwi_ctxt;
5667 5602
5668 if (blk_iopoll_enabled) { 5603 for (i = 0; i < phba->num_cpus; i++) {
5669 for (i = 0; i < phba->num_cpus; i++) {
5670 pbe_eq = &phwi_context->be_eq[i];
5671 blk_iopoll_init(&pbe_eq->iopoll, be_iopoll_budget,
5672 be_iopoll);
5673 blk_iopoll_enable(&pbe_eq->iopoll);
5674 }
5675
5676 i = (phba->msix_enabled) ? i : 0;
5677 /* Work item for MCC handling */
5678 pbe_eq = &phwi_context->be_eq[i]; 5604 pbe_eq = &phwi_context->be_eq[i];
5679 INIT_WORK(&pbe_eq->work_cqs, beiscsi_process_all_cqs); 5605 blk_iopoll_init(&pbe_eq->iopoll, be_iopoll_budget,
5680 } else { 5606 be_iopoll);
5681 if (phba->msix_enabled) { 5607 blk_iopoll_enable(&pbe_eq->iopoll);
5682 for (i = 0; i <= phba->num_cpus; i++) {
5683 pbe_eq = &phwi_context->be_eq[i];
5684 INIT_WORK(&pbe_eq->work_cqs,
5685 beiscsi_process_all_cqs);
5686 }
5687 } else {
5688 pbe_eq = &phwi_context->be_eq[0];
5689 INIT_WORK(&pbe_eq->work_cqs,
5690 beiscsi_process_all_cqs);
5691 }
5692 } 5608 }
5693 5609
5610 i = (phba->msix_enabled) ? i : 0;
5611 /* Work item for MCC handling */
5612 pbe_eq = &phwi_context->be_eq[i];
5613 INIT_WORK(&pbe_eq->work_cqs, beiscsi_process_all_cqs);
5614
5694 ret = beiscsi_init_irqs(phba); 5615 ret = beiscsi_init_irqs(phba);
5695 if (ret < 0) { 5616 if (ret < 0) {
5696 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, 5617 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
@@ -5719,11 +5640,10 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev,
5719 5640
5720free_blkenbld: 5641free_blkenbld:
5721 destroy_workqueue(phba->wq); 5642 destroy_workqueue(phba->wq);
5722 if (blk_iopoll_enabled) 5643 for (i = 0; i < phba->num_cpus; i++) {
5723 for (i = 0; i < phba->num_cpus; i++) { 5644 pbe_eq = &phwi_context->be_eq[i];
5724 pbe_eq = &phwi_context->be_eq[i]; 5645 blk_iopoll_disable(&pbe_eq->iopoll);
5725 blk_iopoll_disable(&pbe_eq->iopoll); 5646 }
5726 }
5727free_twq: 5647free_twq:
5728 beiscsi_clean_port(phba); 5648 beiscsi_clean_port(phba);
5729 beiscsi_free_mem(phba); 5649 beiscsi_free_mem(phba);