From patchwork Tue Jan 22 18:25:20 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: 10776017 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 DFD70139A for ; Tue, 22 Jan 2019 18:25:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CFFB22B9B0 for ; Tue, 22 Jan 2019 18:25:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C45782B9B4; Tue, 22 Jan 2019 18:25:39 +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=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 70F352B9BF for ; Tue, 22 Jan 2019 18:25:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726167AbfAVSZi (ORCPT ); Tue, 22 Jan 2019 13:25:38 -0500 Received: from out002.mailprotect.be ([83.217.72.86]:37865 "EHLO out002.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725913AbfAVSZi (ORCPT ); Tue, 22 Jan 2019 13:25:38 -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:Message-Id :Date:Subject:Cc:To:From:reply-to:sender:bcc:in-reply-to:references: content-type; bh=EF7Ex70zBpJGNE5oAoOQNcO/Tvu/bcy0xKAV1ScFjRM=; b=AuWwolQmQ0vk RQTfTISAH7JrzhIp4flQeid22MtjUJRUuKsVvpg4IhyJ63xgjObobxpaigK0TK+6JjclSBpzA+K3S C5U7XEbrEOGBP4ILestsIQIHsmFRqQI29GMSBa2h3YuVnGVbQUtpmg4PAixgGw8vuxAYRHSCRzD/i GXHB32cnfgzR5fx1mstVREEA/SAQar+5asT2RB2X3QIYgS9MW462l0tG5u78Tf/mk7VzC7ew+vkzl 05o/8UxsF6BofmM2nPsysx1kLtUNN8acqXUJ5nxaYFFMiIDbSZUwbSecnrW0tA/psolosTvtDG2Vy DWhiWsg+Aa0o7KDws1m1zA==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out002.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1gm0jt-0001Yp-7O; Tue, 22 Jan 2019 19:25:33 +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 9B0C8C0575; Tue, 22 Jan 2019 19:25:27 +0100 (CET) From: Bart Van Assche To: Jason Gunthorpe Cc: Doug Ledford , linux-rdma@vger.kernel.org, linux-scsi@vger.kernel.org, Bart Van Assche , Christoph Hellwig Subject: [PATCH] RDMA/srp: Increase max_segment_size Date: Tue, 22 Jan 2019 10:25:20 -0800 Message-Id: <20190122182520.59519-1-bvanassche@acm.org> X-Mailer: git-send-email 2.20.1.321.g9e740568ce-goog MIME-Version: 1.0 X-Originating-IP: 178.208.39.155 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-Class: ham X-SpamExperts-Outgoing-Evidence: Combined (0.02) X-Recommended-Action: accept X-Filter-ID: EX5BVjFpneJeBchSMxfU5p2JRvBcaqyHXK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vxnwDjlfhjbvO7J//0XCxCMJn8bXo41UD0mGTckJMXp vQc/gk8LoYUiA3dFoDnuUOcjutpfgDFTBEY/C8d4cBelOPGhXsOvDvY= 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 The default behavior of the SCSI core is to set the block layer request queue parameter max_segment_size to 64 KB. That means that elements of scatterlists are limited to 64 KB. Since RDMA adapters support larger sizes, increase max_segment_size for the SRP initiator. Notes: - The SCSI max_segment_size parameter was introduced in kernel v5.0. See also commit 50c2e9107f17 ("scsi: introduce a max_segment_size host_template parameters"). - Some other block drivers already set max_segment_size to UINT_MAX, e.g. nbd and rbd. Cc: Christoph Hellwig Signed-off-by: Bart Van Assche --- drivers/infiniband/ulp/srp/ib_srp.c | 1 + include/rdma/ib_verbs.h | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 085dba075651..a1173e0992e6 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -3819,6 +3819,7 @@ static ssize_t srp_create_target(struct device *dev, target_host->max_id = 1; target_host->max_lun = -1LL; target_host->max_cmd_len = sizeof ((struct srp_cmd *) (void *) 0L)->cdb; + target_host->max_segment_size = ib_dma_max_seg_size(ibdev); target = host_to_target(target_host); diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 94b6e1dd4dab..71ea144ec823 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -3715,6 +3715,19 @@ static inline unsigned int ib_sg_dma_len(struct ib_device *dev, return sg_dma_len(sg); } +/** + * ib_dma_max_seg_size - Return the size limit of a single DMA transfer + * @dev: The device to query + * + * The returned value represents a size in bytes. + */ +static inline unsigned int ib_dma_max_seg_size(struct ib_device *dev) +{ + struct device_dma_parameters *p = dev->dma_device->dma_parms; + + return p ? p->max_segment_size : UINT_MAX; +} + /** * ib_dma_sync_single_for_cpu - Prepare DMA region to be accessed by CPU * @dev: The device for which the DMA address was created