diff options
author | John Soni Jose <sony.john-n@emulex.com> | 2012-10-19 19:12:13 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2012-11-26 23:59:36 -0500 |
commit | 107dfcbacb34ceb5b8cd84c3903cab9038f4bdee (patch) | |
tree | 7e36286e14443b95eec2729a5f7830af65d973bb /drivers/scsi | |
parent | d629c47171ccc281bbb02507f9521a6125782e9b (diff) |
[SCSI] be2iscsi: Fix max supported EQ count to 8.
The maximum EQ that can be created for a function is 8. Check the
CPU online count and create only 8 EQ if CPU_Count >= 8
Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
Signed-off-by: Jayamohan Kallickal <jayamohan.kallickal@emulex.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/be2iscsi/be_main.c | 23 | ||||
-rw-r--r-- | drivers/scsi/be2iscsi/be_main.h | 1 |
2 files changed, 15 insertions, 9 deletions
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c index db3ea1496e96..2d1bbb898d96 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c | |||
@@ -2890,7 +2890,7 @@ static int beiscsi_create_eqs(struct beiscsi_hba *phba, | |||
2890 | } | 2890 | } |
2891 | return 0; | 2891 | return 0; |
2892 | create_eq_error: | 2892 | create_eq_error: |
2893 | for (i = 0; i < (phba->num_cpus + 1); i++) { | 2893 | for (i = 0; i < (phba->num_cpus + eq_for_mcc); i++) { |
2894 | eq = &phwi_context->be_eq[i].q; | 2894 | eq = &phwi_context->be_eq[i].q; |
2895 | mem = &eq->dma_mem; | 2895 | mem = &eq->dma_mem; |
2896 | if (mem->va) | 2896 | if (mem->va) |
@@ -3315,15 +3315,20 @@ err: | |||
3315 | return -ENOMEM; | 3315 | return -ENOMEM; |
3316 | } | 3316 | } |
3317 | 3317 | ||
3318 | static int find_num_cpus(void) | 3318 | /** |
3319 | * find_num_cpus()- Get the CPU online count | ||
3320 | * @phba: ptr to priv structure | ||
3321 | * | ||
3322 | * CPU count is used for creating EQ. | ||
3323 | **/ | ||
3324 | static void find_num_cpus(struct beiscsi_hba *phba) | ||
3319 | { | 3325 | { |
3320 | int num_cpus = 0; | 3326 | int num_cpus = 0; |
3321 | 3327 | ||
3322 | num_cpus = num_online_cpus(); | 3328 | num_cpus = num_online_cpus(); |
3323 | if (num_cpus >= MAX_CPUS) | ||
3324 | num_cpus = MAX_CPUS - 1; | ||
3325 | 3329 | ||
3326 | return num_cpus; | 3330 | phba->num_cpus = (num_cpus >= BEISCSI_MAX_NUM_CPU) ? |
3331 | (BEISCSI_MAX_NUM_CPU - 1) : num_cpus; | ||
3327 | } | 3332 | } |
3328 | 3333 | ||
3329 | static int hwi_init_port(struct beiscsi_hba *phba) | 3334 | static int hwi_init_port(struct beiscsi_hba *phba) |
@@ -4542,7 +4547,7 @@ static int __devinit beiscsi_dev_probe(struct pci_dev *pcidev, | |||
4542 | struct hwi_controller *phwi_ctrlr; | 4547 | struct hwi_controller *phwi_ctrlr; |
4543 | struct hwi_context_memory *phwi_context; | 4548 | struct hwi_context_memory *phwi_context; |
4544 | struct be_eq_obj *pbe_eq; | 4549 | struct be_eq_obj *pbe_eq; |
4545 | int ret, num_cpus, i; | 4550 | int ret, i; |
4546 | u8 *real_offset = 0; | 4551 | u8 *real_offset = 0; |
4547 | u32 value = 0; | 4552 | u32 value = 0; |
4548 | 4553 | ||
@@ -4578,10 +4583,10 @@ static int __devinit beiscsi_dev_probe(struct pci_dev *pcidev, | |||
4578 | } | 4583 | } |
4579 | 4584 | ||
4580 | if (enable_msix) | 4585 | if (enable_msix) |
4581 | num_cpus = find_num_cpus(); | 4586 | find_num_cpus(phba); |
4582 | else | 4587 | else |
4583 | num_cpus = 1; | 4588 | phba->num_cpus = 1; |
4584 | phba->num_cpus = num_cpus; | 4589 | |
4585 | beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT, | 4590 | beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT, |
4586 | "BM_%d : num_cpus = %d\n", | 4591 | "BM_%d : num_cpus = %d\n", |
4587 | phba->num_cpus); | 4592 | phba->num_cpus); |
diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h index f4e8d19c3828..e24d55015424 100644 --- a/drivers/scsi/be2iscsi/be_main.h +++ b/drivers/scsi/be2iscsi/be_main.h | |||
@@ -61,6 +61,7 @@ | |||
61 | #define BE2_DEFPDU_DATA_SZ 8192 | 61 | #define BE2_DEFPDU_DATA_SZ 8192 |
62 | 62 | ||
63 | #define MAX_CPUS 31 | 63 | #define MAX_CPUS 31 |
64 | #define BEISCSI_MAX_NUM_CPU 8 | ||
64 | #define BEISCSI_SGLIST_ELEMENTS 30 | 65 | #define BEISCSI_SGLIST_ELEMENTS 30 |
65 | 66 | ||
66 | #define BEISCSI_CMD_PER_LUN 128 /* scsi_host->cmd_per_lun */ | 67 | #define BEISCSI_CMD_PER_LUN 128 /* scsi_host->cmd_per_lun */ |