From patchwork Sun Aug 20 19:04:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Long Li X-Patchwork-Id: 9911401 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 6C413603FA for ; Sun, 20 Aug 2017 19:10:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C21028739 for ; Sun, 20 Aug 2017 19:10:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 512E328751; Sun, 20 Aug 2017 19:10:41 +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 E7F7528757 for ; Sun, 20 Aug 2017 19:10:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753451AbdHTTG0 (ORCPT ); Sun, 20 Aug 2017 15:06:26 -0400 Received: from a2nlsmtp01-05.prod.iad2.secureserver.net ([198.71.225.49]:34228 "EHLO a2nlsmtp01-05.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753527AbdHTTGY (ORCPT ); Sun, 20 Aug 2017 15:06:24 -0400 Received: from linuxonhyperv.com ([107.180.71.197]) by : HOSTING RELAY : with SMTP id jVXHdFwI8IJCxjVXHdmcwi; Sun, 20 Aug 2017 12:05:23 -0700 x-originating-ip: 107.180.71.197 Received: from longli by linuxonhyperv.com with local (Exim 4.89) (envelope-from ) id 1djVXH-0000oC-PM; Sun, 20 Aug 2017 12:05:23 -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 v2 05/19] CIFS: SMBD: Connect to SMBDirect session Date: Sun, 20 Aug 2017 12:04:29 -0700 Message-Id: <1503255883-3041-6-git-send-email-longli@exchange.microsoft.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1503255883-3041-1-git-send-email-longli@exchange.microsoft.com> References: <1503255883-3041-1-git-send-email-longli@exchange.microsoft.com> X-CMAE-Envelope: MS4wfAjVq5xH6p00pEdE3tPTHFHg1aeajepAMffxVsCJSn1yocI7fYEkpyJT5J22juYSTn1EADLbc5KrQ8LrttLIQywYLtwZjt6wELDnf6ef7R1mtQGpD6Au 1xmKrr83Fq7YauyKcVF54QLcAacvcAibxY7fK6MxwXkcTPcZN+kECzPB6IhgcB3T7i9HO+kvz5bylq4DArVUppBdt54mi8gK1UZloVU4HyYSGKYArnNi8Iqg ZZYw2Eux81+2C90I54ypPjdPUY593OBiYalThs7nUmku0puCVr0gnuUhBlNxGuogJBl3bhmDkIWK1FMbRVz3UWh+U0ij3sCELeBv/pKlxoStqJ1SFUmQ3HHX ytSC0ru4mEe4o09HWNei985OVI/2wMwDCg5k7I1zhyQ4Y7nkSZjDzfCWcl5qHY0L+wONA6WAxmM5SDH4fCtpS4Pwfnnm3gwCLilPwqeM6kjk4gJcSivkgrWy NobKV820qbblfMtw 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 d5d0ecd..309eba0 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" @@ -2299,12 +2300,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().