diff options
author | John Garry <john.garry@huawei.com> | 2016-09-06 11:36:11 -0400 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2016-09-14 12:54:17 -0400 |
commit | e6c346f303d41b8799ea224d0faf1b2caa1c98db (patch) | |
tree | 5ab81caef92f48c4960acefc2e66605b2e05eab4 | |
parent | c4a11827b760ef8dcda26b5731d072b1d8fb7c81 (diff) |
scsi: hisi_sas: save completion queue read pointer
Optimise by saving an avoidable read in the cq interrupt. The queue
read pointer will only be updated by software, so don't bother
re-reading what was already written in the previous interrupt.
Signed-off-by: John Garry <john.garry@huawei.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r-- | drivers/scsi/hisi_sas/hisi_sas.h | 1 | ||||
-rw-r--r-- | drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 6 | ||||
-rw-r--r-- | drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 5 |
3 files changed, 5 insertions, 7 deletions
diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h index ca55ec2974e0..9410335caf41 100644 --- a/drivers/scsi/hisi_sas/hisi_sas.h +++ b/drivers/scsi/hisi_sas/hisi_sas.h | |||
@@ -94,6 +94,7 @@ struct hisi_sas_port { | |||
94 | 94 | ||
95 | struct hisi_sas_cq { | 95 | struct hisi_sas_cq { |
96 | struct hisi_hba *hisi_hba; | 96 | struct hisi_hba *hisi_hba; |
97 | int rd_point; | ||
97 | int id; | 98 | int id; |
98 | }; | 99 | }; |
99 | 100 | ||
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c index 1abbc2e162df..3b31b2046559 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | |||
@@ -1565,14 +1565,11 @@ static irqreturn_t cq_interrupt_v1_hw(int irq, void *p) | |||
1565 | struct hisi_sas_complete_v1_hdr *complete_queue = | 1565 | struct hisi_sas_complete_v1_hdr *complete_queue = |
1566 | (struct hisi_sas_complete_v1_hdr *) | 1566 | (struct hisi_sas_complete_v1_hdr *) |
1567 | hisi_hba->complete_hdr[queue]; | 1567 | hisi_hba->complete_hdr[queue]; |
1568 | u32 irq_value, rd_point, wr_point; | 1568 | u32 irq_value, rd_point = cq->rd_point, wr_point; |
1569 | 1569 | ||
1570 | irq_value = hisi_sas_read32(hisi_hba, OQ_INT_SRC); | 1570 | irq_value = hisi_sas_read32(hisi_hba, OQ_INT_SRC); |
1571 | 1571 | ||
1572 | hisi_sas_write32(hisi_hba, OQ_INT_SRC, 1 << queue); | 1572 | hisi_sas_write32(hisi_hba, OQ_INT_SRC, 1 << queue); |
1573 | |||
1574 | rd_point = hisi_sas_read32(hisi_hba, | ||
1575 | COMPL_Q_0_RD_PTR + (0x14 * queue)); | ||
1576 | wr_point = hisi_sas_read32(hisi_hba, | 1573 | wr_point = hisi_sas_read32(hisi_hba, |
1577 | COMPL_Q_0_WR_PTR + (0x14 * queue)); | 1574 | COMPL_Q_0_WR_PTR + (0x14 * queue)); |
1578 | 1575 | ||
@@ -1600,6 +1597,7 @@ static irqreturn_t cq_interrupt_v1_hw(int irq, void *p) | |||
1600 | } | 1597 | } |
1601 | 1598 | ||
1602 | /* update rd_point */ | 1599 | /* update rd_point */ |
1600 | cq->rd_point = rd_point; | ||
1603 | hisi_sas_write32(hisi_hba, COMPL_Q_0_RD_PTR + (0x14 * queue), rd_point); | 1601 | hisi_sas_write32(hisi_hba, COMPL_Q_0_RD_PTR + (0x14 * queue), rd_point); |
1604 | 1602 | ||
1605 | return IRQ_HANDLED; | 1603 | return IRQ_HANDLED; |
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c index bf9b693a717f..11006c99de54 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | |||
@@ -2049,7 +2049,7 @@ static irqreturn_t cq_interrupt_v2_hw(int irq_no, void *p) | |||
2049 | struct hisi_sas_slot *slot; | 2049 | struct hisi_sas_slot *slot; |
2050 | struct hisi_sas_itct *itct; | 2050 | struct hisi_sas_itct *itct; |
2051 | struct hisi_sas_complete_v2_hdr *complete_queue; | 2051 | struct hisi_sas_complete_v2_hdr *complete_queue; |
2052 | u32 irq_value, rd_point, wr_point, dev_id; | 2052 | u32 irq_value, rd_point = cq->rd_point, wr_point, dev_id; |
2053 | int queue = cq->id; | 2053 | int queue = cq->id; |
2054 | 2054 | ||
2055 | complete_queue = hisi_hba->complete_hdr[queue]; | 2055 | complete_queue = hisi_hba->complete_hdr[queue]; |
@@ -2057,8 +2057,6 @@ static irqreturn_t cq_interrupt_v2_hw(int irq_no, void *p) | |||
2057 | 2057 | ||
2058 | hisi_sas_write32(hisi_hba, OQ_INT_SRC, 1 << queue); | 2058 | hisi_sas_write32(hisi_hba, OQ_INT_SRC, 1 << queue); |
2059 | 2059 | ||
2060 | rd_point = hisi_sas_read32(hisi_hba, COMPL_Q_0_RD_PTR + | ||
2061 | (0x14 * queue)); | ||
2062 | wr_point = hisi_sas_read32(hisi_hba, COMPL_Q_0_WR_PTR + | 2060 | wr_point = hisi_sas_read32(hisi_hba, COMPL_Q_0_WR_PTR + |
2063 | (0x14 * queue)); | 2061 | (0x14 * queue)); |
2064 | 2062 | ||
@@ -2106,6 +2104,7 @@ static irqreturn_t cq_interrupt_v2_hw(int irq_no, void *p) | |||
2106 | } | 2104 | } |
2107 | 2105 | ||
2108 | /* update rd_point */ | 2106 | /* update rd_point */ |
2107 | cq->rd_point = rd_point; | ||
2109 | hisi_sas_write32(hisi_hba, COMPL_Q_0_RD_PTR + (0x14 * queue), rd_point); | 2108 | hisi_sas_write32(hisi_hba, COMPL_Q_0_RD_PTR + (0x14 * queue), rd_point); |
2110 | return IRQ_HANDLED; | 2109 | return IRQ_HANDLED; |
2111 | } | 2110 | } |