From patchwork Wed Sep 24 09:00:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Whitcroft X-Patchwork-Id: 392813 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id D20611400B7; Wed, 24 Sep 2014 19:01:14 +1000 (EST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1XWiRk-0003VT-DC; Wed, 24 Sep 2014 09:01:12 +0000 Received: from mail-we0-f170.google.com ([74.125.82.170]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1XWiRX-0003Pl-H1 for kernel-team@lists.ubuntu.com; Wed, 24 Sep 2014 09:00:59 +0000 Received: by mail-we0-f170.google.com with SMTP id x48so4386705wes.29 for ; Wed, 24 Sep 2014 02:00:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=z02RsR+iv0XlhSKEKBUm5Xt599Psx8Ajt9T0+81B1M4=; b=mRmUxIH8Jey7gE+bnq+x+YlbIop2aRUNI6j+sWevhMtFWPNnRhNDbSSvuZTUaEo2y2 tewoT9VFzlyQx9Cfy03is6E5Fb2teo/jLQrhT7jZlC7ckiXwSmU4emZmiFHZ5vbXRIo5 q3GPND5JXr2yndJmDE58GmkJWav2oSlNuUhecXLI+I1cIPQLM1Pww5+yo6LtFNrt3nPx 4eZsfZGE+3IbrrB2sKP+nDJbLwsPqa15uPP3Pt+K/CCRf3DFw2Tamqvbm/9iFlyoH3DB n9Pg7fu/QGivF9IsgD2JuI5l6UZGQWwrAdzLPJjx2tyykPGJ7JB/uadCTBRdU9TYRX+M IFDg== X-Gm-Message-State: ALoCoQnNvOIQyrD8df3vplFFeGMg9xKFaIFLXWyaq6knsOycSA+ALlV2fc/aiv8sy0c+iNozlFv2 X-Received: by 10.194.24.101 with SMTP id t5mr6299072wjf.76.1411549259362; Wed, 24 Sep 2014 02:00:59 -0700 (PDT) Received: from localhost ([2001:470:6973:2:78b9:724f:ec05:5c33]) by mx.google.com with ESMTPSA id fo6sm5043552wic.3.2014.09.24.02.00.58 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 24 Sep 2014 02:00:58 -0700 (PDT) From: Andy Whitcroft To: kernel-team@lists.ubuntu.com Subject: [PATCH 03/11] Drivers: scsi: storvsc: Change the limits to reflect the values on the host Date: Wed, 24 Sep 2014 10:00:39 +0100 Message-Id: <1411549247-6511-4-git-send-email-apw@canonical.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1411549247-6511-1-git-send-email-apw@canonical.com> References: <1411549247-6511-1-git-send-email-apw@canonical.com> Cc: Andy Whitcroft X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com From: "K. Y. Srinivasan" Hyper-V hosts can support multiple targets and multiple channels and larger number of LUNs per target. Update the code to reflect this. With this patch we can correctly enumerate all the paths in a multi-path storage environment. Signed-off-by: K. Y. Srinivasan Reviewed-by: Hannes Reinecke Cc: Signed-off-by: Christoph Hellwig (cherry picked from commit 4cd83ecdac20d30725b4f96e5d7814a1e290bc7e) BugLink: http://bugs.launchpad.net/bugs/1354397 Signed-off-by: Andy Whitcroft --- drivers/scsi/storvsc_drv.c | 47 ++++++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index 9969fa1..8938b13 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c @@ -330,17 +330,17 @@ static int storvsc_timeout = 180; static void storvsc_on_channel_callback(void *context); -/* - * In Hyper-V, each port/path/target maps to 1 scsi host adapter. In - * reality, the path/target is not used (ie always set to 0) so our - * scsi host adapter essentially has 1 bus with 1 target that contains - * up to 256 luns. - */ -#define STORVSC_MAX_LUNS_PER_TARGET 64 -#define STORVSC_MAX_TARGETS 1 -#define STORVSC_MAX_CHANNELS 1 +#define STORVSC_MAX_LUNS_PER_TARGET 255 +#define STORVSC_MAX_TARGETS 2 +#define STORVSC_MAX_CHANNELS 8 +#define STORVSC_FC_MAX_LUNS_PER_TARGET 255 +#define STORVSC_FC_MAX_TARGETS 128 +#define STORVSC_FC_MAX_CHANNELS 8 +#define STORVSC_IDE_MAX_LUNS_PER_TARGET 64 +#define STORVSC_IDE_MAX_TARGETS 1 +#define STORVSC_IDE_MAX_CHANNELS 1 struct storvsc_cmd_request { struct list_head entry; @@ -1691,7 +1691,6 @@ static struct scsi_host_template scsi_driver = { .slave_destroy = storvsc_device_destroy, .slave_configure = storvsc_device_configure, .cmd_per_lun = 1, - /* 64 max_queue * 1 target */ .can_queue = STORVSC_MAX_IO_REQUESTS*STORVSC_MAX_TARGETS, .this_id = -1, /* no use setting to 0 since ll_blk_rw reset it to 1 */ @@ -1756,6 +1755,9 @@ static int storvsc_probe(struct hv_device *device, } + if (dev_id->driver_data == SFC_GUID) + scsi_driver.can_queue = (STORVSC_MAX_IO_REQUESTS * + STORVSC_FC_MAX_TARGETS); host = scsi_host_alloc(&scsi_driver, sizeof(struct hv_host_device)); if (!host) @@ -1789,12 +1791,25 @@ static int storvsc_probe(struct hv_device *device, host_dev->path = stor_device->path_id; host_dev->target = stor_device->target_id; - /* max # of devices per target */ - host->max_lun = STORVSC_MAX_LUNS_PER_TARGET; - /* max # of targets per channel */ - host->max_id = STORVSC_MAX_TARGETS; - /* max # of channels */ - host->max_channel = STORVSC_MAX_CHANNELS - 1; + switch (dev_id->driver_data) { + case SFC_GUID: + host->max_lun = STORVSC_FC_MAX_LUNS_PER_TARGET; + host->max_id = STORVSC_FC_MAX_TARGETS; + host->max_channel = STORVSC_FC_MAX_CHANNELS - 1; + break; + + case SCSI_GUID: + host->max_lun = STORVSC_MAX_LUNS_PER_TARGET; + host->max_id = STORVSC_MAX_TARGETS; + host->max_channel = STORVSC_MAX_CHANNELS - 1; + break; + + default: + host->max_lun = STORVSC_IDE_MAX_LUNS_PER_TARGET; + host->max_id = STORVSC_IDE_MAX_TARGETS; + host->max_channel = STORVSC_IDE_MAX_CHANNELS - 1; + break; + } /* max cmd length */ host->max_cmd_len = STORVSC_MAX_CMD_LEN;