From patchwork Mon Oct 2 02:30:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Long Li X-Patchwork-Id: 820328 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 3y55lg0JsVz9t4c for ; Mon, 2 Oct 2017 13:31:57 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751649AbdJBCbx (ORCPT ); Sun, 1 Oct 2017 22:31:53 -0400 Received: from a2nlsmtp01-02.prod.iad2.secureserver.net ([198.71.225.36]:43324 "EHLO a2nlsmtp01-02.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751148AbdJBCbw (ORCPT ); Sun, 1 Oct 2017 22:31:52 -0400 Received: from linuxonhyperv.com ([107.180.71.197]) by : HOSTING RELAY : with SMTP id yqVHdsk4giuNpyqVHdg8ti; Sun, 01 Oct 2017 19:30:51 -0700 x-originating-ip: 107.180.71.197 Received: from longli by linuxonhyperv.com with local (Exim 4.89) (envelope-from ) id 1dyqVH-0000x2-BS; Sun, 01 Oct 2017 19:30:43 -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 v4 06/22] CIFS: SMBD: Upper layer connects to SMBDirect session Date: Sun, 1 Oct 2017 19:30:14 -0700 Message-Id: <20171002023030.3582-7-longli@exchange.microsoft.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171002023030.3582-1-longli@exchange.microsoft.com> References: <20171002023030.3582-1-longli@exchange.microsoft.com> X-CMAE-Envelope: MS4wfNOCeAxPyG/VxwBwxwlzqFPI0uGDOOZwk0k2bcin23FEr+xfhtzOPvMB4144110CGuNkYQTftlE+ojPzqTBzOVQa0nQxo1vkLyWkbhjCh4spqWkeM9Ah h3gbJZvTHnA6d7x03I9HES9kV4Z7mmVosYbopPlv7aEhCEIO+jH24ngvSpWalyfHjmufUICdeILUA7IKFxglruTNKAE85zN3QJUpDyhZy7FSJAtRnaJe3B54 lcs2PU6/XM4PvFR/x/UfPXvsQ8vFIx41QQ/VT7s7AWcp2fXBYN6kokEPTYx87GX+siKOdTufaOqAQp+zc8WN4insSZFF2PA6TDQ+r8i6NWQeHaWCatZxyS25 Bis50yJEybHdaPrPwrpUTvMcdjAed7r7Sk24r5PGbjILlDKREHSOqEVBwI2cn4CS+NqAHcgWIOSH39cZ8g9Rv9ZvAySvVM77L0A/2KnyEAwgE3+YyiXgCyMK oqekXqbPvtRexXMA Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org 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 b5a575f..94b6357 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" @@ -2280,12 +2281,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().