Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751618AbdH2Tal (ORCPT ); Tue, 29 Aug 2017 15:30:41 -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 x-originating-ip: 107.180.71.197 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1310 Lines: 51 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(). -- 2.7.4