Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2581580imm; Sat, 13 Oct 2018 23:35:28 -0700 (PDT) X-Google-Smtp-Source: ACcGV61Tq7lSvaNZ9RW6xjUpppV8hnyxkqKg7QXKZaKm6kg/Pao2WxFYll0Ank7v7l3M8HxYswAy X-Received: by 2002:a63:fa09:: with SMTP id y9-v6mr11564369pgh.177.1539498928671; Sat, 13 Oct 2018 23:35:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539498928; cv=none; d=google.com; s=arc-20160816; b=w+8Ry7aA4XziSqpuODrjAL0rqocsznXwUekyD6g2X+5gFwk7/c3ZFNDYbJt8chJsO5 WSAWmc+suTNVWseN+qGaCqjymoLlDFdzI7hcsLoxPfjDyS2QNIaCW15FgqcVTnv29YvC QEoLjgRE8I+yyg8QEMhh/pDlRM0Gjj8NVQ6jUeebJM8pfKgCZ0evxfD1IXJSJ7GohW0Y iVme5yGtj8TnkkhxoefCpOIZ6p2kCx+Q49E34p4jrJxMq0xfWYpj+tdrfE6Xk5wxikck lbcqb2mxt4P5AJiKlnNKQ9lj9Q4dW/CLh+vPiGTQ4afrYqmR7XqL270zAQoRA+GpzFUK B6dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:subject:from:references:in-reply-to :message-id:cc:to; bh=HxdR8jkS212B9HhzYYvMWJLfkp4U2SV+7fayXlCRsGI=; b=Ef6WGqRMCxJy8o06pGJDsnB9Q5z1BygOXx+pjYJq+kgq4BDMpzpmJ+eR+UXc/cl1cF Kc0CLx65G9UGTwAWY0rSK54sYCgQ9cwTECI5XWQTqzL6xj82xEiFgnDXMArs3WioHsWv Jld46nZOCH7JnXMzfdRdysr/LxOHs8zW5gDaqWmpGRrNBXw1VO6GdBYS6+f2FaL7N40R usp+Qgf8RX5TIJ7JLHorwMXyUHm51d+P5T2bP7GzOsbywtN75dnaQr+efaPjvs/eDhNE Umuxa+uHlPbY85vG0fbFn1Lc4B89bL/rh6VCY65J5BKsXHhggAHNOCzZDZLBpDGuOMPH VkUA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h14-v6si7183627plk.130.2018.10.13.23.35.08; Sat, 13 Oct 2018 23:35:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726695AbeJNOOP (ORCPT + 99 others); Sun, 14 Oct 2018 10:14:15 -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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); } } -- 2.18.1