From patchwork Sun Oct 14 06:12:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Finn Thain X-Patchwork-Id: 10640553 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C9ECC14BD for ; Sun, 14 Oct 2018 06:34:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA8AC2A345 for ; Sun, 14 Oct 2018 06:34:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AEE8A2A422; Sun, 14 Oct 2018 06:34:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5396B2A345 for ; Sun, 14 Oct 2018 06:34:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726638AbeJNOOO (ORCPT ); Sun, 14 Oct 2018 10:14:14 -0400 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:42626 "EHLO kvm5.telegraphics.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726342AbeJNOOO (ORCPT ); Sun, 14 Oct 2018 10:14:14 -0400 Received: by kvm5.telegraphics.com.au (Postfix, from userid 502) id 690B82A1CF; Sun, 14 Oct 2018 02:34:18 -0400 (EDT) To: "James E.J. Bottomley" , "Martin K. Petersen" Cc: Michael Schmitz , Hannes Reinecke , linux-scsi@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org Message-Id: <83ae6c0a090dc46decf8e99c544cb6329b516ed1.1539497520.git.fthain@telegraphics.com.au> In-Reply-To: References: From: Finn Thain Subject: [PATCH v2 6/6] esp_scsi: Optimize PIO loops Date: Sun, 14 Oct 2018 17:12:00 +1100 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 method calls like esp_write8() placed inline so this is always going to be slow (even with LTO). Tested-by: Stan Johnson Signed-off-by: Finn Thain Tested-by: Michael Schmitz --- Changed since v1: - Don't touch the scsi_esp_cmd(esp, ESP_CMD_FLUSH) that's outside the loop. --- drivers/scsi/esp_scsi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c index 305a322ad13c..cdf55bd8562e 100644 --- a/drivers/scsi/esp_scsi.c +++ b/drivers/scsi/esp_scsi.c @@ -2788,7 +2788,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", @@ -2805,7 +2805,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", @@ -2833,7 +2833,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) @@ -2854,9 +2854,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; @@ -2896,7 +2896,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); } }