aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_sli.c
diff options
context:
space:
mode:
authorJames Smart <james.smart@emulex.com>2012-08-03 12:35:44 -0400
committerJames Bottomley <JBottomley@Parallels.com>2012-09-14 09:38:33 -0400
commit027140eab7d45f406e3397cc9373767d191ac6b4 (patch)
treec88a6d3debb9bfd0f4dca64250b8eba3eef52006 /drivers/scsi/lpfc/lpfc_sli.c
parent7e56aa25e3510ae72f0feada4b2d04eda48f95db (diff)
[SCSI] lpfc 8.3.33: Misc changes to optimize critical path
Signed-off-by: James Smart <james.smart@emulex.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_sli.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 51c7fc746de1..d7afd0fb4579 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -94,6 +94,7 @@ lpfc_sli4_wq_put(struct lpfc_queue *q, union lpfc_wqe *wqe)
94 union lpfc_wqe *temp_wqe; 94 union lpfc_wqe *temp_wqe;
95 struct lpfc_register doorbell; 95 struct lpfc_register doorbell;
96 uint32_t host_index; 96 uint32_t host_index;
97 uint32_t idx;
97 98
98 /* sanity check on queue memory */ 99 /* sanity check on queue memory */
99 if (unlikely(!q)) 100 if (unlikely(!q))
@@ -101,7 +102,8 @@ lpfc_sli4_wq_put(struct lpfc_queue *q, union lpfc_wqe *wqe)
101 temp_wqe = q->qe[q->host_index].wqe; 102 temp_wqe = q->qe[q->host_index].wqe;
102 103
103 /* If the host has not yet processed the next entry then we are done */ 104 /* If the host has not yet processed the next entry then we are done */
104 if (((q->host_index + 1) % q->entry_count) == q->hba_index) { 105 idx = ((q->host_index + 1) % q->entry_count);
106 if (idx == q->hba_index) {
105 q->WQ_overflow++; 107 q->WQ_overflow++;
106 return -ENOMEM; 108 return -ENOMEM;
107 } 109 }
@@ -115,7 +117,8 @@ lpfc_sli4_wq_put(struct lpfc_queue *q, union lpfc_wqe *wqe)
115 117
116 /* Update the host index before invoking device */ 118 /* Update the host index before invoking device */
117 host_index = q->host_index; 119 host_index = q->host_index;
118 q->host_index = ((q->host_index + 1) % q->entry_count); 120
121 q->host_index = idx;
119 122
120 /* Ring Doorbell */ 123 /* Ring Doorbell */
121 doorbell.word0 = 0; 124 doorbell.word0 = 0;
@@ -123,7 +126,6 @@ lpfc_sli4_wq_put(struct lpfc_queue *q, union lpfc_wqe *wqe)
123 bf_set(lpfc_wq_doorbell_index, &doorbell, host_index); 126 bf_set(lpfc_wq_doorbell_index, &doorbell, host_index);
124 bf_set(lpfc_wq_doorbell_id, &doorbell, q->queue_id); 127 bf_set(lpfc_wq_doorbell_id, &doorbell, q->queue_id);
125 writel(doorbell.word0, q->phba->sli4_hba.WQDBregaddr); 128 writel(doorbell.word0, q->phba->sli4_hba.WQDBregaddr);
126 readl(q->phba->sli4_hba.WQDBregaddr); /* Flush */
127 129
128 return 0; 130 return 0;
129} 131}
@@ -197,7 +199,6 @@ lpfc_sli4_mq_put(struct lpfc_queue *q, struct lpfc_mqe *mqe)
197 bf_set(lpfc_mq_doorbell_num_posted, &doorbell, 1); 199 bf_set(lpfc_mq_doorbell_num_posted, &doorbell, 1);
198 bf_set(lpfc_mq_doorbell_id, &doorbell, q->queue_id); 200 bf_set(lpfc_mq_doorbell_id, &doorbell, q->queue_id);
199 writel(doorbell.word0, q->phba->sli4_hba.MQDBregaddr); 201 writel(doorbell.word0, q->phba->sli4_hba.MQDBregaddr);
200 readl(q->phba->sli4_hba.MQDBregaddr); /* Flush */
201 return 0; 202 return 0;
202} 203}
203 204
@@ -237,6 +238,7 @@ static struct lpfc_eqe *
237lpfc_sli4_eq_get(struct lpfc_queue *q) 238lpfc_sli4_eq_get(struct lpfc_queue *q)
238{ 239{
239 struct lpfc_eqe *eqe; 240 struct lpfc_eqe *eqe;
241 uint32_t idx;
240 242
241 /* sanity check on queue memory */ 243 /* sanity check on queue memory */
242 if (unlikely(!q)) 244 if (unlikely(!q))
@@ -247,10 +249,11 @@ lpfc_sli4_eq_get(struct lpfc_queue *q)
247 if (!bf_get_le32(lpfc_eqe_valid, eqe)) 249 if (!bf_get_le32(lpfc_eqe_valid, eqe))
248 return NULL; 250 return NULL;
249 /* If the host has not yet processed the next entry then we are done */ 251 /* If the host has not yet processed the next entry then we are done */
250 if (((q->hba_index + 1) % q->entry_count) == q->host_index) 252 idx = ((q->hba_index + 1) % q->entry_count);
253 if (idx == q->host_index)
251 return NULL; 254 return NULL;
252 255
253 q->hba_index = ((q->hba_index + 1) % q->entry_count); 256 q->hba_index = idx;
254 return eqe; 257 return eqe;
255} 258}
256 259
@@ -321,6 +324,7 @@ static struct lpfc_cqe *
321lpfc_sli4_cq_get(struct lpfc_queue *q) 324lpfc_sli4_cq_get(struct lpfc_queue *q)
322{ 325{
323 struct lpfc_cqe *cqe; 326 struct lpfc_cqe *cqe;
327 uint32_t idx;
324 328
325 /* sanity check on queue memory */ 329 /* sanity check on queue memory */
326 if (unlikely(!q)) 330 if (unlikely(!q))
@@ -330,11 +334,12 @@ lpfc_sli4_cq_get(struct lpfc_queue *q)
330 if (!bf_get_le32(lpfc_cqe_valid, q->qe[q->hba_index].cqe)) 334 if (!bf_get_le32(lpfc_cqe_valid, q->qe[q->hba_index].cqe))
331 return NULL; 335 return NULL;
332 /* If the host has not yet processed the next entry then we are done */ 336 /* If the host has not yet processed the next entry then we are done */
333 if (((q->hba_index + 1) % q->entry_count) == q->host_index) 337 idx = ((q->hba_index + 1) % q->entry_count);
338 if (idx == q->host_index)
334 return NULL; 339 return NULL;
335 340
336 cqe = q->qe[q->hba_index].cqe; 341 cqe = q->qe[q->hba_index].cqe;
337 q->hba_index = ((q->hba_index + 1) % q->entry_count); 342 q->hba_index = idx;
338 return cqe; 343 return cqe;
339} 344}
340 345