Skip to content

Commit 8c6f803

Browse files
Finn Thainmartinkpetersen
authored andcommitted
scsi: esp_scsi: Optimize PIO loops
Avoid function calls in the inner PIO loops. On a Centris 660av this improves throughput for sequential read transfers by about 40% and sequential write by about 10%. Unfortunately it is not possible to have methods like .esp_write8 placed inline so this is always going to be slow, even with LTO. Tested-by: Stan Johnson <userm57@yahoo.com> Signed-off-by: Finn Thain <fthain@telegraphics.com.au> Tested-by: Michael Schmitz <schmitzmic@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 53dce33 commit 8c6f803

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/scsi/esp_scsi.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2794,7 +2794,7 @@ static inline unsigned int esp_wait_for_fifo(struct esp *esp)
27942794
if (fbytes)
27952795
return fbytes;
27962796

2797-
udelay(2);
2797+
udelay(1);
27982798
} while (--i);
27992799

28002800
shost_printk(KERN_ERR, esp->host, "FIFO is empty. sreg [%02x]\n",
@@ -2811,7 +2811,7 @@ static inline int esp_wait_for_intr(struct esp *esp)
28112811
if (esp->sreg & ESP_STAT_INTR)
28122812
return 0;
28132813

2814-
udelay(2);
2814+
udelay(1);
28152815
} while (--i);
28162816

28172817
shost_printk(KERN_ERR, esp->host, "IRQ timeout. sreg [%02x]\n",
@@ -2839,7 +2839,7 @@ void esp_send_pio_cmd(struct esp *esp, u32 addr, u32 esp_count,
28392839
if (!esp_wait_for_fifo(esp))
28402840
break;
28412841

2842-
*dst++ = esp_read8(ESP_FDATA);
2842+
*dst++ = readb(esp->fifo_reg);
28432843
--esp_count;
28442844

28452845
if (!esp_count)
@@ -2860,9 +2860,9 @@ void esp_send_pio_cmd(struct esp *esp, u32 addr, u32 esp_count,
28602860
}
28612861

28622862
if (phase == ESP_MIP)
2863-
scsi_esp_cmd(esp, ESP_CMD_MOK);
2863+
esp_write8(ESP_CMD_MOK, ESP_CMD);
28642864

2865-
scsi_esp_cmd(esp, ESP_CMD_TI);
2865+
esp_write8(ESP_CMD_TI, ESP_CMD);
28662866
}
28672867
} else {
28682868
unsigned int n = ESP_FIFO_SIZE;
@@ -2902,7 +2902,7 @@ void esp_send_pio_cmd(struct esp *esp, u32 addr, u32 esp_count,
29022902
src += n;
29032903
esp_count -= n;
29042904

2905-
scsi_esp_cmd(esp, ESP_CMD_TI);
2905+
esp_write8(ESP_CMD_TI, ESP_CMD);
29062906
}
29072907
}
29082908

0 commit comments

Comments
 (0)