From patchwork Sun Nov 5 05:43:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Long Li X-Patchwork-Id: 10041983 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 74C02601EB for ; Sun, 5 Nov 2017 05:50:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6812E29630 for ; Sun, 5 Nov 2017 05:50:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5CF0429637; Sun, 5 Nov 2017 05:50:30 +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.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham 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 0C3B929630 for ; Sun, 5 Nov 2017 05:50:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753196AbdKEFtH (ORCPT ); Sun, 5 Nov 2017 01:49:07 -0400 Received: from a2nlsmtp01-04.prod.iad2.secureserver.net ([198.71.225.38]:55856 "EHLO a2nlsmtp01-04.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750877AbdKEFpx (ORCPT ); Sun, 5 Nov 2017 01:45:53 -0400 Received: from linuxonhyperv.com ([107.180.71.197]) by : HOSTING RELAY : with SMTP id BDjUeEGrpV6DQBDjUe8bPR; Sat, 04 Nov 2017 22:44:52 -0700 x-originating-ip: 107.180.71.197 Received: from longli by linuxonhyperv.com with local (Exim 4.89) (envelope-from ) id 1eBDjU-0006Ec-9f; Sat, 04 Nov 2017 22:44:32 -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 , Stephen Hemminger Cc: Long Li Subject: [Patch v6 07/22] CIFS: SMBD: Implement function to create a SMB Direct connection Date: Sat, 4 Nov 2017 22:43:49 -0700 Message-Id: <20171105054404.23886-8-longli@exchange.microsoft.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171105054404.23886-1-longli@exchange.microsoft.com> References: <20171105054404.23886-1-longli@exchange.microsoft.com> X-CMAE-Envelope: MS4wfOv9aqhE6n0GWlVUcvvzu0V4zHH2RyX8Gx2AYW6wd0R5gVw/bij2dhGZLaMwSCgNobMMK1lE7wdmEPj5Ihj7OyK2fY1iZQt3GiPLUrfhlMSaF008O16m YKIoRYIXXwSmEbRVZ4uhob7+U0tEk3tUq497WQrEFydPmj9/EA9OwJ/aKvUmLOBHgyXLx5T8MRFLna+cMiKFnpN92Jvlszn59nIXgXauuLd5m0yaqEoAd30p luaH+SDDUuxuQzguTVAf4hwvHtMf5A0zJkKxVl7pmfcg3p4bFBCA1MCCBmjoIQXPVwqx0liic7sYoC/CquNHdTPlgzAc09xP+bmeVc7NdYy9C5TkA9F0gk3c u4W3Cmvbtf82QA31O4Ij4M17MzuKLkfaxsNIcfUuZnhwjAh7DGfnJSLCmrxPBeIL1U/nQfohglGpoJJbJQ/7/ai8L0Mh4L40L2/UpievXzx0/elFIYivVRwX rwMLETK6rw4aQ+UZdMZZzxEmRNWwTEG4JCDVqQ== 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 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 7af49cd..47d999f 100644 --- a/fs/cifs/smbdirect.c +++ b/fs/cifs/smbdirect.c @@ -1652,3 +1652,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; +}