From patchwork Wed Oct 18 23:09: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: 10015485 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1F744602C8 for ; Wed, 18 Oct 2017 23:13:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11E6028968 for ; Wed, 18 Oct 2017 23:13:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 060BB28CFE; Wed, 18 Oct 2017 23:13:28 +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=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 AB97D28968 for ; Wed, 18 Oct 2017 23:13:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751521AbdJRXMt (ORCPT ); Wed, 18 Oct 2017 19:12:49 -0400 Received: from a2nlsmtp01-04.prod.iad2.secureserver.net ([198.71.225.38]:49924 "EHLO a2nlsmtp01-04.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751519AbdJRXK5 (ORCPT ); Wed, 18 Oct 2017 19:10:57 -0400 Received: from linuxonhyperv.com ([107.180.71.197]) by : HOSTING RELAY : with SMTP id 4xT8evRXAhvnb4xT8e49cC; Wed, 18 Oct 2017 16:09:56 -0700 x-originating-ip: 107.180.71.197 Received: from longli by linuxonhyperv.com with local (Exim 4.89) (envelope-from ) id 1e4xT8-0005Ut-4s; Wed, 18 Oct 2017 16:09:46 -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, Tom Talpey , Matthew Wilcox , Stephen Hemminger Cc: Long Li Subject: [Patch v5 06/21] CIFS: SMBD: Upper layer connects to SMBDirect session Date: Wed, 18 Oct 2017 16:09:05 -0700 Message-Id: <20171018230920.21042-7-longli@exchange.microsoft.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171018230920.21042-1-longli@exchange.microsoft.com> References: <20171018230920.21042-1-longli@exchange.microsoft.com> X-CMAE-Envelope: MS4wfD87CLG/HjyqitYYqYAFNhpVku0rhPm4hKRu/Gx/QfiqWCPcmxUq8wyiWj9WDxfJpgVX4VqrY8qn7H1zBGRKISh/2awPBtosWe01JkjftG+Ie8MGT69B /K6xIc/+4D4x5a+VsCQxkvr6NdN2r3TTjaeT54BSzT9Yb7lxwutKFEJWzSGXqvkscObVXJJs21rcr5A1oTlfNRp87zdWd53FKZDzcjrfMnKV6ABc6NuadDL1 APcvXJYNMrDn+n8/0J2QdEFjMlnmoJU1CArrpLM3vdo6HaICQHKkqHm5ifYAkH45QD8yge2aenBkCiJlK+FAa1iQrUfoAC9u3RLy+ninJ1lh7RH1CpcgKfRI FMjf8c9yKIoJt+oGxAY2WiomNikqhxLgwgw4sL/gCmTk2f9M/Vdzz0bGpWJE+pXI3Or5anT8ox+EtC7UtZal8YYqhASwtJNr9nlOXPeiqtwCna/BeG3O6oli lxZEC5LKQh6r9M5B Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Long Li When "rdma" is specified in the mount option, make CIFS connect to SMB Direct. Signed-off-by: Long Li --- fs/cifs/connect.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index b5a575f..2c0b34a 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -44,7 +44,6 @@ #include #include #include - #include "cifspdu.h" #include "cifsglob.h" #include "cifsproto.h" @@ -56,6 +55,9 @@ #include "rfc1002pdu.h" #include "fscache.h" #include "smb2proto.h" +#ifdef CONFIG_CIFS_SMB_DIRECT +#include "smbdirect.h" +#endif #define CIFS_PORT 445 #define RFC1001_PORT 139 @@ -2279,13 +2281,32 @@ cifs_get_tcp_session(struct smb_vol *volume_info) tcp_ses->echo_interval = volume_info->echo_interval * HZ; else tcp_ses->echo_interval = SMB_ECHO_INTERVAL_DEFAULT * HZ; - + if (tcp_ses->rdma) { +#ifdef CONFIG_CIFS_SMB_DIRECT + tcp_ses->smbd_conn = smbd_get_connection( + tcp_ses, (struct sockaddr *)&volume_info->dstaddr); + if (tcp_ses->smbd_conn) { + cifs_dbg(VFS, "RDMA transport established\n"); + rc = 0; + goto smbd_connected; + } else { + rc = -ENOENT; + goto out_err_crypto_release; + } +#else + cifs_dbg(VFS, "CONFIG_CIFS_SMB_DIRECT is not enabled\n"); + rc = -ENOENT; + goto out_err_crypto_release; +#endif + } rc = ip_connect(tcp_ses); if (rc < 0) { cifs_dbg(VFS, "Error connecting to socket. Aborting operation.\n"); goto out_err_crypto_release; } - +#ifdef CONFIG_CIFS_SMB_DIRECT +smbd_connected: +#endif /* * since we're in a cifs function already, we know that * this will succeed. No need for try_module_get().