aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJames Smart <james.smart@emulex.com>2012-08-03 12:36:24 -0400
committerJames Bottomley <JBottomley@Parallels.com>2012-09-14 09:42:12 -0400
commitbf8dae83fea151ebd74492740733e2ed62dc9f51 (patch)
tree85a04b04a8546bc542c10dd92135845712050cca /drivers
parent67d1273385d454a3f1b083b807f2cdda95e995ec (diff)
[SCSI] lpfc 8.3.33: Allow per-hba interrupt rate tuning
Signed-off-by: James Smart <james.smart@emulex.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/lpfc/lpfc_attr.c27
-rw-r--r--drivers/scsi/lpfc/lpfc_hw4.h8
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c2
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c3
4 files changed, 28 insertions, 12 deletions
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 2910208b5dfa..f7c5531d984c 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -3643,14 +3643,21 @@ lpfc_fcp_imax_store(struct device *dev, struct device_attribute *attr,
3643 struct lpfc_hba *phba = vport->phba; 3643 struct lpfc_hba *phba = vport->phba;
3644 int val = 0, i; 3644 int val = 0, i;
3645 3645
3646 /* fcp_imax is only valid for SLI4 */
3647 if (phba->sli_rev != LPFC_SLI_REV4)
3648 return -EINVAL;
3649
3646 /* Sanity check on user data */ 3650 /* Sanity check on user data */
3647 if (!isdigit(buf[0])) 3651 if (!isdigit(buf[0]))
3648 return -EINVAL; 3652 return -EINVAL;
3649 if (sscanf(buf, "%i", &val) != 1) 3653 if (sscanf(buf, "%i", &val) != 1)
3650 return -EINVAL; 3654 return -EINVAL;
3651 3655
3652 /* Value range is [636,651042] */ 3656 /*
3653 if (val < LPFC_MIM_IMAX || val > LPFC_DMULT_CONST) 3657 * Value range for the HBA is [5000,5000000]
3658 * The value for each EQ depends on how many EQs are configured.
3659 */
3660 if (val < LPFC_MIN_IMAX || val > LPFC_MAX_IMAX)
3654 return -EINVAL; 3661 return -EINVAL;
3655 3662
3656 phba->cfg_fcp_imax = (uint32_t)val; 3663 phba->cfg_fcp_imax = (uint32_t)val;
@@ -3662,13 +3669,14 @@ lpfc_fcp_imax_store(struct device *dev, struct device_attribute *attr,
3662 3669
3663/* 3670/*
3664# lpfc_fcp_imax: The maximum number of fast-path FCP interrupts per second 3671# lpfc_fcp_imax: The maximum number of fast-path FCP interrupts per second
3672# for the HBA.
3665# 3673#
3666# Value range is [636,651042]. Default value is 10000. 3674# Value range is [5,000 to 5,000,000]. Default value is 50,000.
3667*/ 3675*/
3668static int lpfc_fcp_imax = LPFC_FP_DEF_IMAX; 3676static int lpfc_fcp_imax = LPFC_DEF_IMAX;
3669module_param(lpfc_fcp_imax, int, S_IRUGO|S_IWUSR); 3677module_param(lpfc_fcp_imax, int, S_IRUGO|S_IWUSR);
3670MODULE_PARM_DESC(lpfc_fcp_imax, 3678MODULE_PARM_DESC(lpfc_fcp_imax,
3671 "Set the maximum number of fast-path FCP interrupts per second"); 3679 "Set the maximum number of FCP interrupts per second per HBA");
3672lpfc_param_show(fcp_imax) 3680lpfc_param_show(fcp_imax)
3673 3681
3674/** 3682/**
@@ -3687,14 +3695,19 @@ lpfc_param_show(fcp_imax)
3687static int 3695static int
3688lpfc_fcp_imax_init(struct lpfc_hba *phba, int val) 3696lpfc_fcp_imax_init(struct lpfc_hba *phba, int val)
3689{ 3697{
3690 if (val >= LPFC_MIM_IMAX && val <= LPFC_DMULT_CONST) { 3698 if (phba->sli_rev != LPFC_SLI_REV4) {
3699 phba->cfg_fcp_imax = 0;
3700 return 0;
3701 }
3702
3703 if (val >= LPFC_MIN_IMAX && val <= LPFC_MAX_IMAX) {
3691 phba->cfg_fcp_imax = val; 3704 phba->cfg_fcp_imax = val;
3692 return 0; 3705 return 0;
3693 } 3706 }
3694 3707
3695 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 3708 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
3696 "3016 fcp_imax: %d out of range, using default\n", val); 3709 "3016 fcp_imax: %d out of range, using default\n", val);
3697 phba->cfg_fcp_imax = LPFC_FP_DEF_IMAX; 3710 phba->cfg_fcp_imax = LPFC_DEF_IMAX;
3698 3711
3699 return 0; 3712 return 0;
3700} 3713}
diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h
index 9f5c93c5fda3..821262d2cf76 100644
--- a/drivers/scsi/lpfc/lpfc_hw4.h
+++ b/drivers/scsi/lpfc/lpfc_hw4.h
@@ -189,9 +189,11 @@ struct lpfc_sli_intf {
189 189
190/* Delay Multiplier constant */ 190/* Delay Multiplier constant */
191#define LPFC_DMULT_CONST 651042 191#define LPFC_DMULT_CONST 651042
192#define LPFC_MIM_IMAX 636 192
193#define LPFC_FP_DEF_IMAX 10000 193/* Configuration of Interrupts / sec for entire HBA port */
194#define LPFC_SP_DEF_IMAX 10000 194#define LPFC_MIN_IMAX 5000
195#define LPFC_MAX_IMAX 5000000
196#define LPFC_DEF_IMAX 50000
195 197
196/* PORT_CAPABILITIES constants. */ 198/* PORT_CAPABILITIES constants. */
197#define LPFC_MAX_SUPPORTED_PAGES 8 199#define LPFC_MAX_SUPPORTED_PAGES 8
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 164aa87734b8..3dad5ff870a8 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -6927,7 +6927,7 @@ lpfc_sli4_queue_setup(struct lpfc_hba *phba)
6927 goto out_destroy_hba_eq; 6927 goto out_destroy_hba_eq;
6928 } 6928 }
6929 rc = lpfc_eq_create(phba, phba->sli4_hba.hba_eq[fcp_eqidx], 6929 rc = lpfc_eq_create(phba, phba->sli4_hba.hba_eq[fcp_eqidx],
6930 phba->cfg_fcp_imax); 6930 (phba->cfg_fcp_imax / phba->cfg_fcp_io_channel));
6931 if (rc) { 6931 if (rc) {
6932 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 6932 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
6933 "0523 Failed setup of fast-path EQ " 6933 "0523 Failed setup of fast-path EQ "
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 8cbbd815c030..0d5dab3da964 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -12079,7 +12079,8 @@ lpfc_modify_fcp_eq_delay(struct lpfc_hba *phba, uint16_t startq)
12079 eq_delay = &mbox->u.mqe.un.eq_delay; 12079 eq_delay = &mbox->u.mqe.un.eq_delay;
12080 12080
12081 /* Calculate delay multiper from maximum interrupt per second */ 12081 /* Calculate delay multiper from maximum interrupt per second */
12082 dmult = LPFC_DMULT_CONST/phba->cfg_fcp_imax - 1; 12082 dmult = phba->cfg_fcp_imax / phba->cfg_fcp_io_channel;
12083 dmult = LPFC_DMULT_CONST/dmult - 1;
12083 12084
12084 cnt = 0; 12085 cnt = 0;
12085 for (fcp_eqidx = startq; fcp_eqidx < phba->cfg_fcp_io_channel; 12086 for (fcp_eqidx = startq; fcp_eqidx < phba->cfg_fcp_io_channel;