From patchwork Tue Jan 22 18:57:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10776121 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 B17071399 for ; Tue, 22 Jan 2019 18:57:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F6AA2B881 for ; Tue, 22 Jan 2019 18:57:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 91F352B885; Tue, 22 Jan 2019 18:57:53 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 02C512B945 for ; Tue, 22 Jan 2019 18:57:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726156AbfAVS5w (ORCPT ); Tue, 22 Jan 2019 13:57:52 -0500 Received: from com-out001.mailprotect.be ([83.217.72.83]:34405 "EHLO com-out001.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726118AbfAVS5v (ORCPT ); Tue, 22 Jan 2019 13:57:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mailprotect.be; s=mail; h=Content-Transfer-Encoding:MIME-Version:References :In-Reply-To:Message-Id:Date:Subject:Cc:To:From:reply-to:sender:bcc: content-type; bh=LgS9cLFGOLqma+qpB8cK+aBMBM34pgVacKITrFxyYFo=; b=S+HQ9Crr9swi PpkmlRnFo9f41Ex7pfKJAoqsxY4OMw8VgRYHBffGFiRa844XUv/O+c4ZtIl1b8l+SD2+dzYCR6a2z ijSAOUOqyA1HzadbsNaROEZcB2uLg9xaOUN31igh9dt1FrIeZwhj0T5OSpIR4HnTH3ipzilahVTxc qQwKYzYRwAgNCHjRDnVkkdSruzUf5CvEd5NZSlFKssthsoiK19R0elZYTW6F0vdojkpglHmZ64Sdb raGUEsDjxTdVE3UWm9acVz7FuERAmbfFnQ+gEPcQFdEBc1JiPSHxduYXl5W1ZXVm4Vdp73ZTSBaRl kIM9FOQcFj1dwRix7YT33A==; Received: from smtp-auth.mailprotect.be ([178.208.39.159]) by com-mpt-out001.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1gm1F0-00037j-5L; Tue, 22 Jan 2019 19:57:43 +0100 Received: from desktop-bart.svl.corp.google.com (unknown [104.133.8.89]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-auth.mailprotect.be (Postfix) with ESMTPSA id 59DC4C0690; Tue, 22 Jan 2019 19:57:33 +0100 (CET) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Bart Van Assche , Douglas Gilbert , Hannes Reinecke , Christoph Hellwig , Lee Duncan , Chris Leech Subject: [PATCH 1/7] Introduce the bidi_supported flag in the host template structure Date: Tue, 22 Jan 2019 10:57:18 -0800 Message-Id: <20190122185724.71598-2-bvanassche@acm.org> X-Mailer: git-send-email 2.20.1.321.g9e740568ce-goog In-Reply-To: <20190122185724.71598-1-bvanassche@acm.org> References: <20190122185724.71598-1-bvanassche@acm.org> MIME-Version: 1.0 X-Originating-IP: 178.208.39.159 X-SpamExperts-Domain: mailprotect.be X-SpamExperts-Username: 178.208.39.128/27 Authentication-Results: mailprotect.be; auth=pass smtp.auth=178.208.39.128/27@mailprotect.be X-SpamExperts-Outgoing-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3CGZOwArNSiB4L0vPnoxTr2NWH36ha3twj2plI5gTrpIWFPo1WtBP+l YOfrvgrw9R4RW8N3EtXlChZgHiRPxf1pRjt2NivWaiBMRrGYXd3ZFm+pQz9zA2G4QI7KATDDBZ7f Fc0FDw0l2bg+7PRloQfgRqAA9B7uKdyotKn0Gzq8V/T/GRLZ7+h41mukASe0zzIoSVH5jzhBWWlj x6RjnCXhDec8Nvp7LFExktCJZimPMqz9/aWLyMB36IKko0xWPtUy+4U2/JBiKNi6 X-Report-Abuse-To: spam@com-mpt-mgt001.mailprotect.be 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 This patch does not change any functionality but makes the drivers that support bidirectional commands more compact. Cc: Douglas Gilbert Cc: Hannes Reinecke Cc: Christoph Hellwig Cc: Lee Duncan Cc: Chris Leech Signed-off-by: Bart Van Assche --- drivers/scsi/iscsi_tcp.c | 8 +------- drivers/scsi/scsi_debug.c | 11 +---------- drivers/scsi/scsi_lib.c | 2 ++ drivers/target/loopback/tcm_loop.c | 8 +------- include/scsi/scsi_host.h | 2 ++ 5 files changed, 7 insertions(+), 24 deletions(-) diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index cae6368ebb98..8c09e9e45a62 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -952,12 +952,6 @@ static umode_t iscsi_sw_tcp_attr_is_visible(int param_type, int param) return 0; } -static int iscsi_sw_tcp_slave_alloc(struct scsi_device *sdev) -{ - blk_queue_flag_set(QUEUE_FLAG_BIDI, sdev->request_queue); - return 0; -} - static int iscsi_sw_tcp_slave_configure(struct scsi_device *sdev) { struct iscsi_sw_tcp_host *tcp_sw_host = iscsi_host_priv(sdev->host); @@ -985,7 +979,7 @@ static struct scsi_host_template iscsi_sw_tcp_sht = { .eh_device_reset_handler= iscsi_eh_device_reset, .eh_target_reset_handler = iscsi_eh_recover_target, .dma_boundary = PAGE_SIZE - 1, - .slave_alloc = iscsi_sw_tcp_slave_alloc, + .bidi_supported = true, .slave_configure = iscsi_sw_tcp_slave_configure, .target_alloc = iscsi_target_alloc, .proc_name = "iscsi_tcp", diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 661512bec3ac..e253c0129b40 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -3948,15 +3948,6 @@ static struct sdebug_dev_info *find_build_dev_info(struct scsi_device *sdev) return open_devip; } -static int scsi_debug_slave_alloc(struct scsi_device *sdp) -{ - if (sdebug_verbose) - pr_info("slave_alloc <%u %u %u %llu>\n", - sdp->host->host_no, sdp->channel, sdp->id, sdp->lun); - blk_queue_flag_set(QUEUE_FLAG_BIDI, sdp->request_queue); - return 0; -} - static int scsi_debug_slave_configure(struct scsi_device *sdp) { struct sdebug_dev_info *devip = @@ -5834,7 +5825,7 @@ static struct scsi_host_template sdebug_driver_template = { .proc_name = sdebug_proc_name, .name = "SCSI DEBUG", .info = scsi_debug_info, - .slave_alloc = scsi_debug_slave_alloc, + .bidi_supported = true, .slave_configure = scsi_debug_slave_configure, .slave_destroy = scsi_debug_slave_destroy, .ioctl = scsi_debug_ioctl, diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 00cd365fb7d2..94842b104bcc 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1881,6 +1881,8 @@ struct request_queue *scsi_mq_alloc_queue(struct scsi_device *sdev) sdev->request_queue->queuedata = sdev; __scsi_init_queue(sdev->host, sdev->request_queue); blk_queue_flag_set(QUEUE_FLAG_SCSI_PASSTHROUGH, sdev->request_queue); + if (sdev->host->hostt->bidi_supported) + blk_queue_flag_set(QUEUE_FLAG_BIDI, sdev->request_queue); return sdev->request_queue; } diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index 7bd7c0c0db6f..e54a5c57a8bb 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c @@ -304,12 +304,6 @@ static int tcm_loop_target_reset(struct scsi_cmnd *sc) return FAILED; } -static int tcm_loop_slave_alloc(struct scsi_device *sd) -{ - blk_queue_flag_set(QUEUE_FLAG_BIDI, sd->request_queue); - return 0; -} - static struct scsi_host_template tcm_loop_driver_template = { .show_info = tcm_loop_show_info, .proc_name = "tcm_loopback", @@ -325,7 +319,7 @@ static struct scsi_host_template tcm_loop_driver_template = { .cmd_per_lun = 1024, .max_sectors = 0xFFFF, .dma_boundary = PAGE_SIZE - 1, - .slave_alloc = tcm_loop_slave_alloc, + .bidi_supported = true, .module = THIS_MODULE, .track_queue_depth = 1, }; diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 6ca954e9f752..384b50992a56 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -430,6 +430,8 @@ struct scsi_host_template { /* True if the low-level driver supports blk-mq only */ unsigned force_blk_mq:1; + unsigned bidi_supported:1; + /* * Countdown for host blocking with no commands outstanding. */