From patchwork Thu Nov 7 10:37:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinpu Wang X-Patchwork-Id: 3152141 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0ADAF9F407 for ; Thu, 7 Nov 2013 10:37:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C024F204AD for ; Thu, 7 Nov 2013 10:37:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BDDCA204B5 for ; Thu, 7 Nov 2013 10:37:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753094Ab3KGKh0 (ORCPT ); Thu, 7 Nov 2013 05:37:26 -0500 Received: from mail-bk0-f42.google.com ([209.85.214.42]:56427 "EHLO mail-bk0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751691Ab3KGKhZ (ORCPT ); Thu, 7 Nov 2013 05:37:25 -0500 Received: by mail-bk0-f42.google.com with SMTP id w16so150337bkz.1 for ; Thu, 07 Nov 2013 02:37:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:content-type; bh=+f61rLMqZIKCmT0Hv76EduBnSIRifO5qmmSTH2OO4oI=; b=QLKxaQwIBgHKalMKyCeABfLItziOa/XBwxHb2Cmr0ZZW1954Ne0iN+g42CyzFFRKK+ n538zm/ReKIM4KghfkKem9fVruGn7EUc1S73xNAZBUulDmyMCA/LTCN8e0peO5b1M/cF nVVoh2G9zzhKQDKg/4o0Rnd5FEUvd/B97QEe8jofz7sEGdjvc5SPJTtuyR56o7OyBp6K VJuLCxGPb8D7PXFg0cDi66G7aibMdWdFhGoL23ZcoTM7B+mgi2FrjDsxpuLnXlgNW6gu KRCuMQn62u8ZLsfADsABRBVW6rJuogZo1hdBKq1LFysEHnP1JugHTmh20Lk1zPT+9exn XflA== X-Gm-Message-State: ALoCoQmILLlJiqWNM9v7vzv+mbtPBH7AaX+gMDkiT4tQvde0TI8fpC73pjAGOayEjPo5gPBdNXN/ X-Received: by 10.205.15.72 with SMTP id pt8mr5912798bkb.17.1383820642992; Thu, 07 Nov 2013 02:37:22 -0800 (PST) Received: from [192.168.88.32] ([62.217.45.26]) by mx.google.com with ESMTPSA id w9sm1762779bkn.12.2013.11.07.02.37.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 07 Nov 2013 02:37:22 -0800 (PST) Message-ID: <527B6D71.3020805@profitbricks.com> Date: Thu, 07 Nov 2013 11:37:37 +0100 From: Jack Wang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4 MIME-Version: 1.0 To: Roland Dreier CC: David Dillow , Bart Van Assche , linux-rdma Subject: [PATCHv3] IB/srp: add change_queue_depth and change_queue_type support Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Roland, Could you include this patch? I update with tested-by from Bart and acked-by from David. From e8d655fec4ac74a6af6a0b2471173c74e7c13f51 Mon Sep 17 00:00:00 2001 From: Jack Wang Date: Mon, 26 Aug 2013 15:50:03 +0200 Subject: [PATCH] IB/srp: add change_queue_depth/change_queue_type support Currently, it's not possible to change queue depth for device behind SRP host. Sometimes, we need to adjust queue_depth for performance reason(eg storage busy, we need lower queue_depth to avoid running into SCSI error handler), so this patch add support for SRP driver. Signed-off-by: Jack Wang Tested-by: Bart Van Assche Acked-by: David Dillow --- drivers/infiniband/ulp/srp/ib_srp.c | 54 +++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) { @@ -2260,6 +2312,8 @@ static struct scsi_host_template srp_template = { .slave_configure = srp_slave_configure, .info = srp_target_info, .queuecommand = srp_queuecommand, + .change_queue_depth = srp_change_queue_depth, + .change_queue_type = srp_change_queue_type, .eh_abort_handler = srp_abort, .eh_device_reset_handler = srp_reset_device, .eh_host_reset_handler = srp_reset_host, From e8d655fec4ac74a6af6a0b2471173c74e7c13f51 Mon Sep 17 00:00:00 2001 From: Jack Wang Date: Mon, 26 Aug 2013 15:50:03 +0200 Subject: [PATCH] IB/srp: add change_queue_depth/change_queue_type support Currently, it's not possible to change queue depth for device behind SRP host. Sometimes, we need to adjust queue_depth for performance reason(eg storage busy, we need lower queue_depth to avoid running into SCSI error handler), so this patch add support for SRP driver. Signed-off-by: Jack Wang Tested-by: Bart Van Assche Acked-by: David Dillow --- drivers/infiniband/ulp/srp/ib_srp.c | 54 +++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 06a3e4b..2713e02 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -1875,6 +1876,57 @@ static int srp_cm_handler(struct ib_cm_id *cm_id, struct ib_cm_event *event) return 0; } +/** + * srp_change_queue_type - changing device queue tag type + * @sdev: scsi device struct + * @tag_type: requested tag type + * + * Returns queue tag type. + */ +static int +srp_change_queue_type(struct scsi_device *sdev, int tag_type) +{ + if (sdev->tagged_supported) { + scsi_set_tag_type(sdev, tag_type); + if (tag_type) + scsi_activate_tcq(sdev, sdev->queue_depth); + else + scsi_deactivate_tcq(sdev, sdev->queue_depth); + } else + tag_type = 0; + + return tag_type; +} + +/** + * srp_change_queue_depth - setting device queue depth + * @sdev: scsi device struct + * @qdepth: requested queue depth + * @reason: SCSI_QDEPTH_DEFAULT/SCSI_QDEPTH_QFULL/SCSI_QDEPTH_RAMP_UP + * (see include/scsi/scsi_host.h for definition) + * + * Returns queue depth. + */ +static int +srp_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason) +{ + struct Scsi_Host *shost = sdev->host; + int max_depth; + if (reason == SCSI_QDEPTH_DEFAULT || reason == SCSI_QDEPTH_RAMP_UP) { + max_depth = shost->can_queue; + if (!sdev->tagged_supported) + max_depth = 1; + if (qdepth > max_depth) + qdepth = max_depth; + scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth); + } else if (reason == SCSI_QDEPTH_QFULL) + scsi_track_queue_full(sdev, qdepth); + else + return -EOPNOTSUPP; + + return sdev->queue_depth; +} + static int srp_send_tsk_mgmt(struct srp_target_port *target, u64 req_tag, unsigned int lun, u8 func) { @@ -2260,6 +2312,8 @@ static struct scsi_host_template srp_template = { .slave_configure = srp_slave_configure, .info = srp_target_info, .queuecommand = srp_queuecommand, + .change_queue_depth = srp_change_queue_depth, + .change_queue_type = srp_change_queue_type, .eh_abort_handler = srp_abort, .eh_device_reset_handler = srp_reset_device, .eh_host_reset_handler = srp_reset_host, -- 1.7.10.4