From patchwork Wed Oct 18 23:09:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Long Li X-Patchwork-Id: 827854 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 3yHSY26Ryvz9t44 for ; Thu, 19 Oct 2017 10:13:42 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751726AbdJRXMr (ORCPT ); Wed, 18 Oct 2017 19:12:47 -0400 Received: from a2nlsmtp01-04.prod.iad2.secureserver.net ([198.71.225.38]:49926 "EHLO a2nlsmtp01-04.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751521AbdJRXK5 (ORCPT ); Wed, 18 Oct 2017 19:10:57 -0400 Received: from linuxonhyperv.com ([107.180.71.197]) by : HOSTING RELAY : with SMTP id 4xT8evRX6hvnb4xT8e49c7; Wed, 18 Oct 2017 16:09:56 -0700 x-originating-ip: 107.180.71.197 Received: from longli by linuxonhyperv.com with local (Exim 4.89) (envelope-from ) id 1e4xT8-0005Un-1M; Wed, 18 Oct 2017 16:09:46 -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, Tom Talpey , Matthew Wilcox , Stephen Hemminger Cc: Long Li Subject: [Patch v5 05/21] CIFS: SMBD: Implement function to create a SMB Direct connection Date: Wed, 18 Oct 2017 16:09:04 -0700 Message-Id: <20171018230920.21042-6-longli@exchange.microsoft.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171018230920.21042-1-longli@exchange.microsoft.com> References: <20171018230920.21042-1-longli@exchange.microsoft.com> X-CMAE-Envelope: MS4wfD87CLG/HjyqitYYqYAFNhpVku0rhPm4hKRu/Gx/QfiqWCPcmxUq8wyiWj9WDxfJpgVX4VqrY8qn7H1zBGRKISh/2awPBtosWe01JkjftG+Ie8MGT69B /K6xIc/+4D4x5a+VsCQxkvr6NdN2r3TTjaeT54BSzT9Yb7lxwutKFEJWzSGXqvkscObVXJJs21rcr5A1oTlfNRp87zdWd53FKZDzcjrfMnKV6ABc6NuadDL1 APcvXJYNMrDn+n8/0J2QdEFjMlnmoJU1CArrpLM3vdo6HaICQHKkqHm5ifYAkH45QD8yge2aenBkCiJlK+FAa1iQrUfoAC9u3RLy+ninJ1lh7RH1CpcgKfRI FMjf8c9yKIoJt+oGxAY2WiomNikqhxLgwgw4sL/gCmTk2f9M/Vdzz0bGpWJE+pXI3Or5anT8ox+EtC7UtZal8YYqhASwtJNr9nlOXPeiqtwCna/BeG3O6oli lxZEC5LKQh6r9M5B Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@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 e5524e9..4bbb13b 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; +}