···40134013# For [0], FCP commands are issued to Work Queues ina round robin fashion.40144014# For [1], FCP commands are issued to a Work Queue associated with the40154015# current CPU.40164016+# It would be set to 1 by the driver if it's able to set up cpu affinity40174017+# for FCP I/Os through Work Queue associated with the current CPU. Otherwise,40184018+# roundrobin scheduling of FCP I/Os through WQs will be used.40164019*/40174017-LPFC_ATTR_RW(fcp_io_sched, 0, 0, 1, "Determine scheduling algrithmn for "40204020+LPFC_ATTR_RW(fcp_io_sched, 0, 0, 1, "Determine scheduling algorithm for "40184021 "issuing commands [0] - Round Robin, [1] - Current CPU");4019402240204023/*
+23-5
drivers/scsi/lpfc/lpfc_init.c
···83998399lpfc_sli4_set_affinity(struct lpfc_hba *phba, int vectors)84008400{84018401 int i, idx, saved_chann, used_chann, cpu, phys_id;84028402- int max_phys_id, num_io_channel, first_cpu;84028402+ int max_phys_id, min_phys_id;84038403+ int num_io_channel, first_cpu, chan;84038404 struct lpfc_vector_map_info *cpup;84048405#ifdef CONFIG_X8684058406 struct cpuinfo_x86 *cpuinfo;···84188417 phba->sli4_hba.num_present_cpu));8419841884208419 max_phys_id = 0;84208420+ min_phys_id = 0xff;84218421 phys_id = 0;84228422 num_io_channel = 0;84238423 first_cpu = LPFC_VECTOR_MAP_EMPTY;···8442844084438441 if (cpup->phys_id > max_phys_id)84448442 max_phys_id = cpup->phys_id;84438443+ if (cpup->phys_id < min_phys_id)84448444+ min_phys_id = cpup->phys_id;84458445 cpup++;84468446 }8447844784488448+ phys_id = min_phys_id;84488449 /* Now associate the HBA vectors with specific CPUs */84498450 for (idx = 0; idx < vectors; idx++) {84508451 cpup = phba->sli4_hba.cpu_map;···84588453 for (i = 1; i < max_phys_id; i++) {84598454 phys_id++;84608455 if (phys_id > max_phys_id)84618461- phys_id = 0;84568456+ phys_id = min_phys_id;84628457 cpu = lpfc_find_next_cpu(phba, phys_id);84638458 if (cpu == LPFC_VECTOR_MAP_EMPTY)84648459 continue;84658460 goto found;84618461+ }84628462+84638463+ /* Use round robin for scheduling */84648464+ phba->cfg_fcp_io_sched = LPFC_FCP_SCHED_ROUND_ROBIN;84658465+ chan = 0;84668466+ cpup = phba->sli4_hba.cpu_map;84678467+ for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) {84688468+ cpup->channel_id = chan;84698469+ cpup++;84708470+ chan++;84718471+ if (chan >= phba->cfg_fcp_io_channel)84728472+ chan = 0;84668473 }8467847484688475 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,···85148497 /* Spread vector mapping across multple physical CPU nodes */85158498 phys_id++;85168499 if (phys_id > max_phys_id)85178517- phys_id = 0;85008500+ phys_id = min_phys_id;85188501 }8519850285208503 /*···85248507 * Base the remaining IO channel assigned, to IO channels already85258508 * assigned to other CPUs on the same phys_id.85268509 */85278527- for (i = 0; i <= max_phys_id; i++) {85108510+ for (i = min_phys_id; i <= max_phys_id; i++) {85288511 /*85298512 * If there are no io channels already mapped to85308513 * this phys_id, just round robin thru the io_channels.···86068589 if (num_io_channel != phba->sli4_hba.num_present_cpu)86078590 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,86088591 "3333 Set affinity mismatch:"86098609- "%d chann != %d cpus: %d vactors\n",85928592+ "%d chann != %d cpus: %d vectors\n",86108593 num_io_channel, phba->sli4_hba.num_present_cpu,86118594 vectors);8612859585968596+ /* Enable using cpu affinity for scheduling */86138597 phba->cfg_fcp_io_sched = LPFC_FCP_SCHED_BY_CPU;86148598 return 1;86158599}