2.6.3 qla2xxx driver -- use readX_relaxed
Subsystems (2)
PATCH 1/1 2.6.3 qla2xxx driver -- use readX_relaxed
I'm submitting a patch for comment and consideration. The relaxed read interface was added a few weeks back, and this patch lets the qla2xxx driver take advantage of it.
For those to whom this is new (it was discussed on linux-kernel and linux-ia64 I believe), normal PCI register reads imply that PCI DMA writes that occured prior to the PCI MMR (memory mapped register) read (on the PCI bus) will be reflected in system memory once the MMR read is complete.
On our platforms, we can speed up the MMR read significantly if that ordering requirement is "relaxed".
So I attempted to find the common register reads that don't have a need for this ordering so that I could make them use this faster read.
I did not change this line (111 of drivers/scsi/qla2xxx/qla_isr.c), because it may in some cases imply that a DMA write has completed.
stat = RD_REG_DWORD(®->u.isp2300.host_status);
Andrew, if you have a chance to look at this and incorporate it in the driver, it would be great. Also, any comments would be welcome.
thanks
jeremy
===== drivers/scsi/qla2xxx/qla_def.h 1.5 vs edited =====
drivers/scsi/qla2xxx/qla_def.h +3 -0
@@ -154,6 +154,9 @@#define RD_REG_BYTE (addr) readb(addr)#define RD_REG_WORD (addr) readw(addr)#define RD_REG_DWORD (addr) readl(addr) +#define RD_REG_BYTE_relaxed (addr) readb_relaxed(addr) +#define RD_REG_WORD_relaxed (addr) readw_relaxed(addr) +#define RD_REG_DWORD_relaxed (addr) readl_relaxed(addr)#define WRT_REG_BYTE (addr, data) writeb(data,addr)#define WRT_REG_WORD (addr, data) writew(data,addr)#define WRT_REG_DWORD (addr, data) writel(data,addr)
===== drivers/scsi/qla2xxx/qla_iocb.c 1.2 vs edited =====
drivers/scsi/qla2xxx/qla_iocb.c +3 -3
@@ -388,7 +388,7 @@if (ha->req_q_cnt < (req_cnt +2 )) {/* Calculate number of free request entries */ - cnt =RD_REG_WORD (ISP_REQ_Q_OUT (ha, reg)); + cnt =RD_REG_WORD_relaxed (ISP_REQ_Q_OUT (ha, reg));if (ha->req_ring_index < cnt) ha->req_q_cnt = cnt - ha->req_ring_index;else
@@ -496,7 +496,7 @@/* Set chip new ring index. */ WRT_REG_WORD (ISP_REQ_Q_IN (ha, reg), ha->req_ring_index); -RD_REG_WORD (ISP_REQ_Q_IN (ha, reg));/* PCI Posting. */ +RD_REG_WORD_relaxed (ISP_REQ_Q_IN (ha, reg));/* PCI Posting. */ spin_unlock_irqrestore (&ha->hardware_lock, flags);return (QLA_SUCCESS );
@@ -748,5 +748,5 @@/* Set chip new ring index. */ WRT_REG_WORD (ISP_REQ_Q_IN (ha, reg), ha->req_ring_index); -RD_REG_WORD (ISP_REQ_Q_IN (ha, reg));/* PCI Posting. */ +RD_REG_WORD_relaxed (ISP_REQ_Q_IN (ha, reg));/* PCI Posting. */ }
===== drivers/scsi/qla2xxx/qla_isr.c 1.5 vs edited =====
drivers/scsi/qla2xxx/qla_isr.c +1 -1
@@ -165,7 +165,7 @@break ; }WRT_REG_WORD (®->hccr,HCCR_CLR_RISC_INT ); -RD_REG_WORD (®->hccr); +RD_REG_WORD_relaxed (®->hccr); } }
Quoted 3 lines · Jeremy Higdon
I'm submitting a patch for comment and consideration. The relaxed read interface was added a few weeks back, and this patch lets the qla2xxx driver take advantage of it.
please tell me we don't have to pee all over the drivers to add this everywhere now;(
Quoted 7 lines · Arjan van de Ven
Quoted 3 lines · Jeremy Higdon
I'm submitting a patch for comment and consideration. The relaxed read interface was added a few weeks back, and this patch lets the qla2xxx driver take advantage of it.
please tell me we don't have to pee all over the drivers to add this everywhere now;(
Not everywhere. Drivers will work fine without any changes, but will work faster if readX is turned into readX_relaxed in the fast paths where DMA completion isn't important. In the lkml thread that discussed this feature everyone seemed to agree on that approach. Would you rather have a different interface?
Thanks,
Jesse