From patchwork Tue Nov 7 08:54:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Long Li X-Patchwork-Id: 10046023 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 45AC16031B for ; Tue, 7 Nov 2017 09:02:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 377F428721 for ; Tue, 7 Nov 2017 09:02:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2AB7228723; Tue, 7 Nov 2017 09:02:25 +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=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 7A16628783 for ; Tue, 7 Nov 2017 09:02:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753262AbdKGJBo (ORCPT ); Tue, 7 Nov 2017 04:01:44 -0500 Received: from a2nlsmtp01-04.prod.iad2.secureserver.net ([198.71.225.38]:39006 "EHLO a2nlsmtp01-04.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753263AbdKGI5J (ORCPT ); Tue, 7 Nov 2017 03:57:09 -0500 Received: from linuxonhyperv.com ([107.180.71.197]) by : HOSTING RELAY : with SMTP id BzfqeKNnzV6DQBzfqe7raL; Tue, 07 Nov 2017 01:56:08 -0700 x-originating-ip: 107.180.71.197 Received: from longli by linuxonhyperv.com with local (Exim 4.89) (envelope-from ) id 1eBzfq-0003Kv-4i; Tue, 07 Nov 2017 01:55:58 -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 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> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171107085514.12693-1-longli@exchange.microsoft.com> References: <20171107085514.12693-1-longli@exchange.microsoft.com> X-CMAE-Envelope: MS4wfF8i4O/0Ho5FkUKPV/D3rffDpagbqHas5BADeIknaixcqFOVAO4jizlh1d8PGM/muU8VKeS+swNrzckuStzijmprWSqB8x236KhhABmK+k6UcNq+6WTU FtteOgf+Dio2nZGdiWHpMz08FhYN5tocipEB8GrLTTfS1KCplWXZG7PHsrgnxaHkn4CHF8UmSUyhaYJBSIzAzJTCOrF+YPqV/7ysglI1LQA2ApZiwSChMEVx z/+COsEJHQztbupgHhyHiX5NfVqderSbBVTPALyAOSIagicNYuMUkmFJcaQWEHLTMbSZB/Vx97O6cGQqCjBI6k7yPbePT/B1QvD2gcCNxrfjY+oO9W30nDTd 9qA4esvwOoJ5Ocfk+Sq0Uywe/nP+z9X80jKAHiH9VJPLi+EUXKRhMq7k3lwwrvH1cBTuLzepdApr3KmkODDltp14YQnGvwymdm7BhwDWL6007PXx7SBAe1QT G6GwuhLqHD0T9yNlQNAPJmcw6+h4xs/6CjTexA== 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 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; +}