@@ -10554,103 +10554,6 @@ lpfc_find_eq_handle(struct lpfc_hba *phba, uint16_t hdwq)
10554
10554
return 0 ;
10555
10555
}
10556
10556
10557
- /**
10558
- * lpfc_find_phys_id_eq - Find the next EQ that corresponds to the specified
10559
- * Physical Id.
10560
- * @phba: pointer to lpfc hba data structure.
10561
- * @eqidx: EQ index
10562
- * @phys_id: CPU package physical id
10563
- */
10564
- static uint16_t
10565
- lpfc_find_phys_id_eq (struct lpfc_hba * phba , uint16_t eqidx , uint16_t phys_id )
10566
- {
10567
- struct lpfc_vector_map_info * cpup ;
10568
- int cpu , desired_phys_id ;
10569
-
10570
- desired_phys_id = LPFC_VECTOR_MAP_EMPTY ;
10571
-
10572
- /* Find the desired phys_id for the specified EQ */
10573
- cpup = phba -> sli4_hba .cpu_map ;
10574
- for (cpu = 0 ; cpu < phba -> sli4_hba .num_present_cpu ; cpu ++ ) {
10575
- if ((cpup -> irq != LPFC_VECTOR_MAP_EMPTY ) &&
10576
- (cpup -> eq == eqidx )) {
10577
- desired_phys_id = cpup -> phys_id ;
10578
- break ;
10579
- }
10580
- cpup ++ ;
10581
- }
10582
- if (phys_id == desired_phys_id )
10583
- return eqidx ;
10584
-
10585
- /* Find a EQ thats on the specified phys_id */
10586
- cpup = phba -> sli4_hba .cpu_map ;
10587
- for (cpu = 0 ; cpu < phba -> sli4_hba .num_present_cpu ; cpu ++ ) {
10588
- if ((cpup -> irq != LPFC_VECTOR_MAP_EMPTY ) &&
10589
- (cpup -> phys_id == phys_id ))
10590
- return cpup -> eq ;
10591
- cpup ++ ;
10592
- }
10593
- return 0 ;
10594
- }
10595
-
10596
- /**
10597
- * lpfc_find_cpu_map - Find next available CPU map entry that matches the
10598
- * phys_id and core_id.
10599
- * @phba: pointer to lpfc hba data structure.
10600
- * @phys_id: CPU package physical id
10601
- * @core_id: CPU core id
10602
- * @hdwqidx: Hardware Queue index
10603
- * @eqidx: EQ index
10604
- * @isr_avail: Should an IRQ be associated with this entry
10605
- */
10606
- static struct lpfc_vector_map_info *
10607
- lpfc_find_cpu_map (struct lpfc_hba * phba , uint16_t phys_id , uint16_t core_id ,
10608
- uint16_t hdwqidx , uint16_t eqidx , int isr_avail )
10609
- {
10610
- struct lpfc_vector_map_info * cpup ;
10611
- int cpu ;
10612
-
10613
- cpup = phba -> sli4_hba .cpu_map ;
10614
- for (cpu = 0 ; cpu < phba -> sli4_hba .num_present_cpu ; cpu ++ ) {
10615
- /* Does the cpup match the one we are looking for */
10616
- if ((cpup -> phys_id == phys_id ) &&
10617
- (cpup -> core_id == core_id )) {
10618
- /* If it has been already assigned, then skip it */
10619
- if (cpup -> hdwq != LPFC_VECTOR_MAP_EMPTY ) {
10620
- cpup ++ ;
10621
- continue ;
10622
- }
10623
- /* Ensure we are on the same phys_id as the first one */
10624
- if (!isr_avail )
10625
- cpup -> eq = lpfc_find_phys_id_eq (phba , eqidx ,
10626
- phys_id );
10627
- else
10628
- cpup -> eq = eqidx ;
10629
-
10630
- cpup -> hdwq = hdwqidx ;
10631
- if (isr_avail ) {
10632
- cpup -> irq =
10633
- pci_irq_vector (phba -> pcidev , eqidx );
10634
-
10635
- /* Now affinitize to the selected CPU */
10636
- irq_set_affinity_hint (cpup -> irq ,
10637
- get_cpu_mask (cpu ));
10638
- irq_set_status_flags (cpup -> irq ,
10639
- IRQ_NO_BALANCING );
10640
-
10641
- lpfc_printf_log (phba , KERN_INFO , LOG_INIT ,
10642
- "3330 Set Affinity: CPU %d "
10643
- "EQ %d irq %d (HDWQ %x)\n" ,
10644
- cpu , cpup -> eq ,
10645
- cpup -> irq , cpup -> hdwq );
10646
- }
10647
- return cpup ;
10648
- }
10649
- cpup ++ ;
10650
- }
10651
- return 0 ;
10652
- }
10653
-
10654
10557
#ifdef CONFIG_X86
10655
10558
/**
10656
10559
* lpfc_find_hyper - Determine if the CPU map entry is hyper-threaded
@@ -10693,11 +10596,11 @@ lpfc_find_hyper(struct lpfc_hba *phba, int cpu,
10693
10596
static void
10694
10597
lpfc_cpu_affinity_check (struct lpfc_hba * phba , int vectors )
10695
10598
{
10696
- int i , j , idx , phys_id ;
10599
+ int i , cpu , idx , phys_id ;
10697
10600
int max_phys_id , min_phys_id ;
10698
10601
int max_core_id , min_core_id ;
10699
10602
struct lpfc_vector_map_info * cpup ;
10700
- int cpu , eqidx , hdwqidx , isr_avail ;
10603
+ const struct cpumask * maskp ;
10701
10604
#ifdef CONFIG_X86
10702
10605
struct cpuinfo_x86 * cpuinfo ;
10703
10606
#endif
@@ -10754,60 +10657,21 @@ lpfc_cpu_affinity_check(struct lpfc_hba *phba, int vectors)
10754
10657
eqi -> icnt = 0 ;
10755
10658
}
10756
10659
10757
- /*
10758
- * If the number of IRQ vectors == number of CPUs,
10759
- * mapping is pretty simple: 1 to 1.
10760
- * This is the desired path if NVME is enabled.
10761
- */
10762
- if (vectors == phba -> sli4_hba .num_present_cpu ) {
10763
- cpup = phba -> sli4_hba .cpu_map ;
10764
- for (idx = 0 ; idx < vectors ; idx ++ ) {
10660
+ for (idx = 0 ; idx < phba -> cfg_irq_chann ; idx ++ ) {
10661
+ maskp = pci_irq_get_affinity (phba -> pcidev , idx );
10662
+ if (!maskp )
10663
+ continue ;
10664
+
10665
+ for_each_cpu_and (cpu , maskp , cpu_present_mask ) {
10666
+ cpup = & phba -> sli4_hba .cpu_map [cpu ];
10765
10667
cpup -> eq = idx ;
10766
10668
cpup -> hdwq = idx ;
10767
10669
cpup -> irq = pci_irq_vector (phba -> pcidev , idx );
10768
10670
10769
- /* Now affinitize to the selected CPU */
10770
- irq_set_affinity_hint (
10771
- pci_irq_vector (phba -> pcidev , idx ),
10772
- get_cpu_mask (idx ));
10773
- irq_set_status_flags (cpup -> irq , IRQ_NO_BALANCING );
10774
-
10775
- lpfc_printf_log (phba , KERN_INFO , LOG_INIT ,
10671
+ lpfc_printf_log (phba , KERN_ERR , LOG_INIT ,
10776
10672
"3336 Set Affinity: CPU %d "
10777
- "EQ %d irq %d\n" ,
10778
- idx , cpup -> eq ,
10779
- pci_irq_vector (phba -> pcidev , idx ));
10780
- cpup ++ ;
10781
- }
10782
- return ;
10783
- }
10784
-
10785
- idx = 0 ;
10786
- isr_avail = 1 ;
10787
- eqidx = 0 ;
10788
- hdwqidx = 0 ;
10789
-
10790
- /* Mapping is more complicated for this case. Hardware Queues are
10791
- * assigned in a "ping pong" fashion, ping pong-ing between the
10792
- * available phys_id's.
10793
- */
10794
- while (idx < phba -> sli4_hba .num_present_cpu ) {
10795
- for (i = min_core_id ; i <= max_core_id ; i ++ ) {
10796
- for (j = min_phys_id ; j <= max_phys_id ; j ++ ) {
10797
- cpup = lpfc_find_cpu_map (phba , j , i , hdwqidx ,
10798
- eqidx , isr_avail );
10799
- if (!cpup )
10800
- continue ;
10801
- idx ++ ;
10802
- hdwqidx ++ ;
10803
- if (hdwqidx >= phba -> cfg_hdw_queue )
10804
- hdwqidx = 0 ;
10805
- eqidx ++ ;
10806
- if (eqidx >= phba -> cfg_irq_chann ) {
10807
- isr_avail = 0 ;
10808
- eqidx = 0 ;
10809
- }
10810
- }
10673
+ "hdwq %d irq %d\n" ,
10674
+ cpu , cpup -> hdwq , cpup -> irq );
10811
10675
}
10812
10676
}
10813
10677
return ;
@@ -10834,7 +10698,7 @@ lpfc_sli4_enable_msix(struct lpfc_hba *phba)
10834
10698
vectors = phba -> cfg_irq_chann ;
10835
10699
10836
10700
rc = pci_alloc_irq_vectors (phba -> pcidev ,
10837
- ( phba -> nvmet_support ) ? 1 : 2 ,
10701
+ 1 ,
10838
10702
vectors , PCI_IRQ_MSIX | PCI_IRQ_AFFINITY );
10839
10703
if (rc < 0 ) {
10840
10704
lpfc_printf_log (phba , KERN_INFO , LOG_INIT ,
0 commit comments