diff options
author | Anil Veerabhadrappa <anilgv@broadcom.com> | 2009-12-07 14:40:18 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-12-10 10:45:57 -0500 |
commit | 8776193bc308553ac0011b3bb2dd1837e0c6ab28 (patch) | |
tree | 4334f5402592860b0c426d765a5647a20648d24d /drivers/scsi | |
parent | f8c9abe797c54e798b4025b54d71e5d2054c929a (diff) |
[SCSI] bnx2i: update CQ arming algorith for 5771x chipsets
Only affects 5771x (10G chipsets) devices
This is an optimized CQ arming algoritm which takes into account the
number of outstanding tasks
Signed-off-by: Anil Veerabhadrappa <anilgv@broadcom.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/bnx2i/bnx2i.h | 1 | ||||
-rw-r--r-- | drivers/scsi/bnx2i/bnx2i_hwi.c | 34 | ||||
-rw-r--r-- | drivers/scsi/bnx2i/bnx2i_init.c | 4 |
3 files changed, 31 insertions, 8 deletions
diff --git a/drivers/scsi/bnx2i/bnx2i.h b/drivers/scsi/bnx2i/bnx2i.h index 2b973f3c2eb2..6cf9dc37d78b 100644 --- a/drivers/scsi/bnx2i/bnx2i.h +++ b/drivers/scsi/bnx2i/bnx2i.h | |||
@@ -684,6 +684,7 @@ extern unsigned int error_mask1, error_mask2; | |||
684 | extern u64 iscsi_error_mask; | 684 | extern u64 iscsi_error_mask; |
685 | extern unsigned int en_tcp_dack; | 685 | extern unsigned int en_tcp_dack; |
686 | extern unsigned int event_coal_div; | 686 | extern unsigned int event_coal_div; |
687 | extern unsigned int event_coal_min; | ||
687 | 688 | ||
688 | extern struct scsi_transport_template *bnx2i_scsi_xport_template; | 689 | extern struct scsi_transport_template *bnx2i_scsi_xport_template; |
689 | extern struct iscsi_transport bnx2i_iscsi_transport; | 690 | extern struct iscsi_transport bnx2i_iscsi_transport; |
diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c index 5c8d7630c13e..bb69a14a4afc 100644 --- a/drivers/scsi/bnx2i/bnx2i_hwi.c +++ b/drivers/scsi/bnx2i/bnx2i_hwi.c | |||
@@ -133,20 +133,38 @@ void bnx2i_arm_cq_event_coalescing(struct bnx2i_endpoint *ep, u8 action) | |||
133 | { | 133 | { |
134 | struct bnx2i_5771x_cq_db *cq_db; | 134 | struct bnx2i_5771x_cq_db *cq_db; |
135 | u16 cq_index; | 135 | u16 cq_index; |
136 | u16 next_index; | ||
137 | u32 num_active_cmds; | ||
136 | 138 | ||
139 | |||
140 | /* Coalesce CQ entries only on 10G devices */ | ||
137 | if (!test_bit(BNX2I_NX2_DEV_57710, &ep->hba->cnic_dev_type)) | 141 | if (!test_bit(BNX2I_NX2_DEV_57710, &ep->hba->cnic_dev_type)) |
138 | return; | 142 | return; |
139 | 143 | ||
144 | /* Do not update CQ DB multiple times before firmware writes | ||
145 | * '0xFFFF' to CQDB->SQN field. Deviation may cause spurious | ||
146 | * interrupts and other unwanted results | ||
147 | */ | ||
148 | cq_db = (struct bnx2i_5771x_cq_db *) ep->qp.cq_pgtbl_virt; | ||
149 | if (cq_db->sqn[0] && cq_db->sqn[0] != 0xFFFF) | ||
150 | return; | ||
151 | |||
140 | if (action == CNIC_ARM_CQE) { | 152 | if (action == CNIC_ARM_CQE) { |
141 | cq_index = ep->qp.cqe_exp_seq_sn + | 153 | num_active_cmds = ep->num_active_cmds; |
142 | ep->num_active_cmds / event_coal_div; | 154 | if (num_active_cmds <= event_coal_min) |
143 | cq_index %= (ep->qp.cqe_size * 2 + 1); | 155 | next_index = 1; |
144 | if (!cq_index) { | 156 | else |
157 | next_index = event_coal_min + | ||
158 | (num_active_cmds - event_coal_min) / event_coal_div; | ||
159 | if (!next_index) | ||
160 | next_index = 1; | ||
161 | cq_index = ep->qp.cqe_exp_seq_sn + next_index - 1; | ||
162 | if (cq_index > ep->qp.cqe_size * 2) | ||
163 | cq_index -= ep->qp.cqe_size * 2; | ||
164 | if (!cq_index) | ||
145 | cq_index = 1; | 165 | cq_index = 1; |
146 | cq_db = (struct bnx2i_5771x_cq_db *) | 166 | |
147 | ep->qp.cq_pgtbl_virt; | 167 | cq_db->sqn[0] = cq_index; |
148 | cq_db->sqn[0] = cq_index; | ||
149 | } | ||
150 | } | 168 | } |
151 | } | 169 | } |
152 | 170 | ||
diff --git a/drivers/scsi/bnx2i/bnx2i_init.c b/drivers/scsi/bnx2i/bnx2i_init.c index 0307f85b4e2e..465241dfce63 100644 --- a/drivers/scsi/bnx2i/bnx2i_init.c +++ b/drivers/scsi/bnx2i/bnx2i_init.c | |||
@@ -32,6 +32,10 @@ MODULE_VERSION(DRV_MODULE_VERSION); | |||
32 | 32 | ||
33 | static DEFINE_MUTEX(bnx2i_dev_lock); | 33 | static DEFINE_MUTEX(bnx2i_dev_lock); |
34 | 34 | ||
35 | unsigned int event_coal_min = 24; | ||
36 | module_param(event_coal_min, int, 0664); | ||
37 | MODULE_PARM_DESC(event_coal_min, "Event Coalescing Minimum Commands"); | ||
38 | |||
35 | unsigned int event_coal_div = 1; | 39 | unsigned int event_coal_div = 1; |
36 | module_param(event_coal_div, int, 0664); | 40 | module_param(event_coal_div, int, 0664); |
37 | MODULE_PARM_DESC(event_coal_div, "Event Coalescing Divide Factor"); | 41 | MODULE_PARM_DESC(event_coal_div, "Event Coalescing Divide Factor"); |