From patchwork Tue Dec 5 01:47:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ching Huang X-Patchwork-Id: 10092575 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0FE7860348 for ; Tue, 5 Dec 2017 09:48:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E644F29478 for ; Tue, 5 Dec 2017 09:48:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DAE6C2947F; Tue, 5 Dec 2017 09:48:07 +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=-5.4 required=2.0 tests=BAYES_00, DATE_IN_PAST_06_12, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_HI autolearn=unavailable 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 8CA3C29478 for ; Tue, 5 Dec 2017 09:48:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753128AbdLEJr5 (ORCPT ); Tue, 5 Dec 2017 04:47:57 -0500 Received: from mail-pf0-f178.google.com ([209.85.192.178]:39266 "EHLO mail-pf0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752482AbdLEJrx (ORCPT ); Tue, 5 Dec 2017 04:47:53 -0500 Received: by mail-pf0-f178.google.com with SMTP id l24so10804610pfj.6 for ; Tue, 05 Dec 2017 01:47:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=areca-com-tw.20150623.gappssmtp.com; s=20150623; h=subject:from:to:cc:date:message-id:mime-version :content-transfer-encoding; bh=Bmi7IJKBYmoioyLyJfBRyvJZmGkzrND3252A+LeAQP0=; b=1M3ieYfok9Xn++3Ano/760L2K+638kSGwpNNJI2n7isg6OEZGBHi4wpo2EDeBnIDQv wwB2ftsEs3SKW8bKgRw8dPvq5HXpoNAfZA5DxgTbWt3XRm7TLuR82tYjd5xflBv8XN2M FqtMyo0Rbyp1aevBOG1cIAPNFE7JFFzgN8HIvgTelNzktuUtk2hTUa1B5ovvoc3VVECZ vEb8/LLaIKAJGs0UudFgczyCr8T+YRAmwogFTLR9CxSDG29Xr8soXgoEDK/g2+/Jb8Ev BCl4SstnL4AzMl37sc9xaPvQIR5IVSlsoMrWM34bv57qZDPpaQkjkoneIrZJXnnXVsDT 0E4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:date:message-id:mime-version :content-transfer-encoding; bh=Bmi7IJKBYmoioyLyJfBRyvJZmGkzrND3252A+LeAQP0=; b=H7y6iXy5mmfEKnKlHdj+sYw6y2KUwMp6Dx1yrh95uRF5GEWqsA+oOgRtQVk1nkqGSq faFleBhNNlnUY1jaiuvXiGnigrVSD8zYyq3ukoPEhFKa7n/PUFrRLkjQ0QRWpd15r9gt pSqWViuj+9r0BeK1C2SwpdkG6mIJFe9vYxqsXu1sG7hLzMFG1T1G0PiKTLIk+H8TmnEg dlLS2imDX7RRXC+NQHOVJ1hKcvCgIDDlzR0RSwcaop+yHHoDZrYkHQG75zRJuon1e9Cn lSd5kux2/wEyFGqUNjWEad59D03U8MnHIj73GxqApeoNaq1sOIVMvyAJ9X9sw1X9snlV eh+g== X-Gm-Message-State: AJaThX5xTpZDK0TL5+KXkalhL+v6YclVWD3OSmOtq1SNPAKE9nU9ddfP AB6gs6X64+7XVW3swNojkiV7Ioaa X-Google-Smtp-Source: AGs4zMZjDRA0AvqJyU38Py/SWkV+XVNRDfI4gFCRfHzf40EetrjlHlP/ErVOkhttKqzQM1A3/Ycl2w== X-Received: by 10.98.72.130 with SMTP id q2mr22003259pfi.99.1512467273010; Tue, 05 Dec 2017 01:47:53 -0800 (PST) Received: from [192.168.0.105] (60-248-88-209.HINET-IP.hinet.net. [60.248.88.209]) by smtp.gmail.com with ESMTPSA id j79sm29596331pfe.129.2017.12.05.01.47.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Dec 2017 01:47:51 -0800 (PST) Subject: [PATCH 6/17] scsi: arcmsr: add driver option host_can_queue to set host->can_queue value by user From: Ching Huang To: martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: James.Bottomley@HansenPartnership.com, sfr@canb.auug.org.au Date: Tue, 05 Dec 2017 09:47:44 +0800 Message-ID: <1512438464.4577.48.camel@Centos6.3-64> Mime-Version: 1.0 X-Mailer: Evolution 2.32.3 (2.32.3-37.el6) 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 From: Ching Huang add driver option host_can_queue to set host->can_queue value by user. It's value expands up to 1024 Signed-off-by: Ching Huang diff -uprN a/drivers/scsi/arcmsr/arcmsr.h b/drivers/scsi/arcmsr/arcmsr.h --- a/drivers/scsi/arcmsr/arcmsr.h 2017-12-05 15:25:06.000000000 +0800 +++ b/drivers/scsi/arcmsr/arcmsr.h 2017-12-05 15:25:36.000000000 +0800 @@ -47,6 +47,8 @@ struct device_attribute; /*The limit of outstanding scsi command that firmware can handle*/ #define ARCMSR_MAX_FREECCB_NUM 1024 #define ARCMSR_MAX_OUTSTANDING_CMD 1024 +#define ARCMSR_DEFAULT_OUTSTANDING_CMD 128 +#define ARCMSR_MIN_OUTSTANDING_CMD 32 #define ARCMSR_DRIVER_VERSION "v1.30.00.22-20151126" #define ARCMSR_SCSI_INITIATOR_ID 255 #define ARCMSR_MAX_XFER_SECTORS 512 diff -uprN a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c --- a/drivers/scsi/arcmsr/arcmsr_hba.c 2017-12-05 11:47:04.000000000 +0800 +++ b/drivers/scsi/arcmsr/arcmsr_hba.c 2017-12-05 11:46:50.000000000 +0800 @@ -75,6 +75,10 @@ MODULE_DESCRIPTION("Areca ARC11xx/12xx/1 MODULE_LICENSE("Dual BSD/GPL"); MODULE_VERSION(ARCMSR_DRIVER_VERSION); +static int host_can_queue = ARCMSR_DEFAULT_OUTSTANDING_CMD; +module_param(host_can_queue, int, S_IRUGO); +MODULE_PARM_DESC(host_can_queue, " adapter queue depth(32 ~ 1024), default is 128"); + #define ARCMSR_SLEEPTIME 10 #define ARCMSR_RETRYCOUNT 12 @@ -133,7 +137,7 @@ static struct scsi_host_template arcmsr_ .eh_bus_reset_handler = arcmsr_bus_reset, .bios_param = arcmsr_bios_param, .change_queue_depth = arcmsr_adjust_disk_queue_depth, - .can_queue = ARCMSR_MAX_OUTSTANDING_CMD, + .can_queue = ARCMSR_DEFAULT_OUTSTANDING_CMD, .this_id = ARCMSR_SCSI_INITIATOR_ID, .sg_tablesize = ARCMSR_DEFAULT_SG_ENTRIES, .max_sectors = ARCMSR_MAX_XFER_SECTORS_C, @@ -877,7 +881,9 @@ static int arcmsr_probe(struct pci_dev * host->max_lun = ARCMSR_MAX_TARGETLUN; host->max_id = ARCMSR_MAX_TARGETID; /*16:8*/ host->max_cmd_len = 16; /*this is issue of 64bit LBA ,over 2T byte*/ - host->can_queue = ARCMSR_MAX_OUTSTANDING_CMD; + if ((host_can_queue < ARCMSR_MIN_OUTSTANDING_CMD) || (host_can_queue > ARCMSR_MAX_OUTSTANDING_CMD)) + host_can_queue = ARCMSR_DEFAULT_OUTSTANDING_CMD; + host->can_queue = host_can_queue; /* max simultaneous cmds */ host->cmd_per_lun = ARCMSR_MAX_CMD_PERLUN; host->this_id = ARCMSR_SCSI_INITIATOR_ID; host->unique_id = (bus << 8) | dev_fun; @@ -3234,11 +3240,11 @@ static bool arcmsr_get_firmware_spec(str default: break; } - if (acb->firm_numbers_queue > ARCMSR_MAX_OUTSTANDING_CMD) - acb->maxOutstanding = ARCMSR_MAX_OUTSTANDING_CMD; + acb->maxOutstanding = acb->firm_numbers_queue - 1; + if (acb->host->can_queue >= acb->firm_numbers_queue) + acb->host->can_queue = acb->maxOutstanding; else - acb->maxOutstanding = acb->firm_numbers_queue - 1; - acb->host->can_queue = acb->maxOutstanding; + acb->maxOutstanding = acb->host->can_queue; acb->maxFreeCCB = acb->host->can_queue; if (acb->maxFreeCCB < ARCMSR_MAX_FREECCB_NUM) acb->maxFreeCCB += 64;