From patchwork Tue Aug 29 19:29:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Long Li X-Patchwork-Id: 9928119 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 C85DC602B9 for ; Tue, 29 Aug 2017 19:35:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B7EFE28A3C for ; Tue, 29 Aug 2017 19:35:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ACF2628A3F; Tue, 29 Aug 2017 19:35:58 +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.9 required=2.0 tests=BAYES_00,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 56AE828A3C for ; Tue, 29 Aug 2017 19:35:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751550AbdH2Tak (ORCPT ); Tue, 29 Aug 2017 15:30:40 -0400 Received: from a2nlsmtp01-02.prod.iad2.secureserver.net ([198.71.225.36]:33218 "EHLO a2nlsmtp01-02.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751519AbdH2Tai (ORCPT ); Tue, 29 Aug 2017 15:30:38 -0400 Received: from linuxonhyperv.com ([107.180.71.197]) by : HOSTING RELAY : with SMTP id mmCfdvmHHuGJpmmCfdvcUU; Tue, 29 Aug 2017 12:29:37 -0700 x-originating-ip: 107.180.71.197 Received: from longli by linuxonhyperv.com with local (Exim 4.89) (envelope-from ) id 1dmmCf-0006rU-FP; Tue, 29 Aug 2017 12:29:37 -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 Cc: Long Li Subject: [Patch v3 05/19] CIFS: SMBD: Connect to SMBDirect session Date: Tue, 29 Aug 2017 12:29:01 -0700 Message-Id: <20170829192915.26251-6-longli@exchange.microsoft.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170829192915.26251-1-longli@exchange.microsoft.com> References: <20170829192915.26251-1-longli@exchange.microsoft.com> X-CMAE-Envelope: MS4wfKomqj8kW/gl4Vn2tLzClNjct1DZAs5OF4rZPUnkyhVbVBYivT0CVInailL7utezpsOyTWMY/Z0R9IixSF5oM9CH1RjFtkAjqAtb5J+GxZRmxybFi7GO hiL6LO2k/8GoQz958LpRX0e+3XQs0A6rwFLbz0HHaksGem2oRF9E7JZkxcFtNW4BxdVk0TDXp6Wz6I4WcxGr+/kYX/+s0maavcZ4M0u4S9yKXPymyA6aSx33 6sEpFigX0XnW7ZfPElRiax1WgjWVgeZLJzttsXcWIT3vph1YB483RbUu4HjvG/A6vXbbiCRqXLlSoQImVIDAAb2Wx+Uyd2Toz/kmFCScnfmT+xbLPo+kySWY 6qq6XaBcag4YII9m+4ojF8QM2dXh91uzPFHuEX7gWd91tyhd5OooZah0EvlriS18NFXB75dRvvBo4UX2Chc9JFfJVdZx9rEv2EAWlCVy2GC3HLQhfhCdEfPY rJP9epG95SkftHe+ 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, CIFS attempts to connect to SMBDirect instead of TCP socket. Signed-off-by: Long Li --- fs/cifs/connect.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 19fdca8..43b4d54 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -45,6 +45,7 @@ #include #include +#include "smbdirect.h" #include "cifspdu.h" #include "cifsglob.h" #include "cifsproto.h" @@ -2289,12 +2290,26 @@ cifs_get_tcp_session(struct smb_vol *volume_info) else tcp_ses->echo_interval = SMB_ECHO_INTERVAL_DEFAULT * HZ; + if (tcp_ses->rdma) { + 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 connected; + } else { + rc = -ENOENT; + goto out_err_crypto_release; + } + } + rc = ip_connect(tcp_ses); if (rc < 0) { cifs_dbg(VFS, "Error connecting to socket. Aborting operation.\n"); goto out_err_crypto_release; } +connected: /* * since we're in a cifs function already, we know that * this will succeed. No need for try_module_get().