Skip to content

Commit

Permalink
scsi: esp_scsi: Optimize PIO loops
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Finn Thain authored and Martin K. Petersen committed Oct 18, 2018
1 parent 53dce33 commit 8c6f803
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions drivers/scsi/esp_scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -2794,7 +2794,7 @@ static inline unsigned int esp_wait_for_fifo(struct esp *esp)
if (fbytes)
return fbytes;

udelay(2);
udelay(1);
} while (--i);

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

udelay(2);
udelay(1);
} while (--i);

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

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

if (!esp_count)
Expand All @@ -2860,9 +2860,9 @@ void esp_send_pio_cmd(struct esp *esp, u32 addr, u32 esp_count,
}

if (phase == ESP_MIP)
scsi_esp_cmd(esp, ESP_CMD_MOK);
esp_write8(ESP_CMD_MOK, ESP_CMD);

scsi_esp_cmd(esp, ESP_CMD_TI);
esp_write8(ESP_CMD_TI, ESP_CMD);
}
} else {
unsigned int n = ESP_FIFO_SIZE;
Expand Down Expand Up @@ -2902,7 +2902,7 @@ void esp_send_pio_cmd(struct esp *esp, u32 addr, u32 esp_count,
src += n;
esp_count -= n;

scsi_esp_cmd(esp, ESP_CMD_TI);
esp_write8(ESP_CMD_TI, ESP_CMD);
}
}

Expand Down

0 comments on commit 8c6f803

Please sign in to comment.