From patchwork Tue Nov 7 08:55:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Long Li X-Patchwork-Id: 835189 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3yWNhL5KGTz9s74 for ; Tue, 7 Nov 2017 20:01:22 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753270AbdKGJAy (ORCPT ); Tue, 7 Nov 2017 04:00:54 -0500 Received: from a2nlsmtp01-04.prod.iad2.secureserver.net ([198.71.225.38]:39004 "EHLO a2nlsmtp01-04.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753295AbdKGI5J (ORCPT ); Tue, 7 Nov 2017 03:57:09 -0500 Received: from linuxonhyperv.com ([107.180.71.197]) by : HOSTING RELAY : with SMTP id BzfqeKNopV6DQBzfqe7rb5; Tue, 07 Nov 2017 01:56:08 -0700 x-originating-ip: 107.180.71.197 Received: from longli by linuxonhyperv.com with local (Exim 4.89) (envelope-from ) id 1eBzfq-0003LV-Rw; Tue, 07 Nov 2017 01:55:58 -0700 From: Long Li To: Steve French , linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, Christoph Hellwig , Tom Talpey , Matthew Wilcox , Stephen Hemminger Cc: Long Li Subject: [Patch v7 13/22] CIFS: SMBD: Set SMB Direct maximum read or write size for I/O Date: Tue, 7 Nov 2017 01:55:05 -0700 Message-Id: <20171107085514.12693-14-longli@exchange.microsoft.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171107085514.12693-1-longli@exchange.microsoft.com> References: <20171107085514.12693-1-longli@exchange.microsoft.com> X-CMAE-Envelope: MS4wfF8i4O/0Ho5FkUKPV/D3rffDpagbqHas5BADeIknaixcqFOVAO4jizlh1d8PGM/muU8VKeS+swNrzckuStzijmprWSqB8x236KhhABmK+k6UcNq+6WTU FtteOgf+Dio2nZGdiWHpMz08FhYN5tocipEB8GrLTTfS1KCplWXZG7PHsrgnxaHkn4CHF8UmSUyhaYJBSIzAzJTCOrF+YPqV/7ysglI1LQA2ApZiwSChMEVx z/+COsEJHQztbupgHhyHiX5NfVqderSbBVTPALyAOSIagicNYuMUkmFJcaQWEHLTMbSZB/Vx97O6cGQqCjBI6k7yPbePT/B1QvD2gcCNxrfjY+oO9W30nDTd 9qA4esvwOoJ5Ocfk+Sq0Uywe/nP+z9X80jKAHiH9VJPLi+EUXKRhMq7k3lwwrvH1cBTuLzepdApr3KmkODDltp14YQnGvwymdm7BhwDWL6007PXx7SBAe1QT G6GwuhLqHD0T9yNlQNAPJmcw6+h4xs/6CjTexA== Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org From: Long Li When connecting over SMB Direct, the transport negotiates its maximum I/O sizes with the server and determines how to choose to do RDMA send/recv vs read/write. Expose these maximum I/O sizes to upper layer so we will get the correct sized payloads. Signed-off-by: Long Li --- fs/cifs/smb2ops.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index fb2934b..abc8bd5 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -32,6 +32,7 @@ #include "smb2status.h" #include "smb2glob.h" #include "cifs_ioctl.h" +#include "smbdirect.h" static int change_conf(struct TCP_Server_Info *server) @@ -250,7 +251,11 @@ smb2_negotiate_wsize(struct cifs_tcon *tcon, struct smb_vol *volume_info) /* start with specified wsize, or default */ wsize = volume_info->wsize ? volume_info->wsize : CIFS_DEFAULT_IOSIZE; wsize = min_t(unsigned int, wsize, server->max_write); - +#ifdef CONFIG_CIFS_SMB_DIRECT + if (server->rdma) + wsize = min_t(unsigned int, + wsize, server->smbd_conn->max_readwrite_size); +#endif if (!(server->capabilities & SMB2_GLOBAL_CAP_LARGE_MTU)) wsize = min_t(unsigned int, wsize, SMB2_MAX_BUFFER_SIZE); @@ -266,6 +271,11 @@ smb2_negotiate_rsize(struct cifs_tcon *tcon, struct smb_vol *volume_info) /* start with specified rsize, or default */ rsize = volume_info->rsize ? volume_info->rsize : CIFS_DEFAULT_IOSIZE; rsize = min_t(unsigned int, rsize, server->max_read); +#ifdef CONFIG_CIFS_SMB_DIRECT + if (server->rdma) + rsize = min_t(unsigned int, + rsize, server->smbd_conn->max_readwrite_size); +#endif if (!(server->capabilities & SMB2_GLOBAL_CAP_LARGE_MTU)) rsize = min_t(unsigned int, rsize, SMB2_MAX_BUFFER_SIZE);