From mboxrd@z Thu Jan 1 00:00:00 1970 From: Long Li Subject: [Patch v7 07/22] CIFS: SMBD: Implement function to create a SMB Direct connection Date: Tue, 7 Nov 2017 01:54:59 -0700 Message-ID: <20171107085514.12693-8-longli@exchange.microsoft.com> References: <20171107085514.12693-1-longli@exchange.microsoft.com> Return-path: In-Reply-To: <20171107085514.12693-1-longli@exchange.microsoft.com> Sender: linux-kernel-owner@vger.kernel.org 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 , Stephen Hemminger Cc: Long Li List-Id: linux-rdma@vger.kernel.org From: Long Li The upper layer calls this function to connect to peer through SMB Direct. Each SMB Direct connection is based on a RDMA RC Queue Pair. Signed-off-by: Long Li --- fs/cifs/smbdirect.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/fs/cifs/smbdirect.c b/fs/cifs/smbdirect.c index 021d527..1db39a34 100644 --- a/fs/cifs/smbdirect.c +++ b/fs/cifs/smbdirect.c @@ -1651,3 +1651,20 @@ struct smbd_connection *_smbd_get_connection( kfree(info); return NULL; } + +struct smbd_connection *smbd_get_connection( + struct TCP_Server_Info *server, struct sockaddr *dstaddr) +{ + struct smbd_connection *ret; + int port = SMBD_PORT; + +try_again: + ret = _smbd_get_connection(server, dstaddr, port); + + /* Try SMB_PORT if SMBD_PORT doesn't work */ + if (!ret && port == SMBD_PORT) { + port = SMB_PORT; + goto try_again; + } + return ret; +} -- 2.7.4