From patchwork Mon Oct 2 02:30:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Long Li X-Patchwork-Id: 9980127 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 DB54D60365 for ; Mon, 2 Oct 2017 02:34:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C59A02766D for ; Mon, 2 Oct 2017 02:34:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BA48A288F9; Mon, 2 Oct 2017 02:34:11 +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 5B2732766D for ; Mon, 2 Oct 2017 02:34:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752709AbdJBCeJ (ORCPT ); Sun, 1 Oct 2017 22:34:09 -0400 Received: from a2nlsmtp01-05.prod.iad2.secureserver.net ([198.71.225.49]:56530 "EHLO a2nlsmtp01-05.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751951AbdJBCbz (ORCPT ); Sun, 1 Oct 2017 22:31:55 -0400 Received: from linuxonhyperv.com ([107.180.71.197]) by : HOSTING RELAY : with SMTP id yqVHdUmzkirtSyqVHddSmv; Sun, 01 Oct 2017 19:30:53 -0700 x-originating-ip: 107.180.71.197 Received: from longli by linuxonhyperv.com with local (Exim 4.89) (envelope-from ) id 1dyqVH-0000ww-82; Sun, 01 Oct 2017 19:30:43 -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 Cc: Long Li Subject: [Patch v4 05/22] CIFS: SMBD: Implement function to create a SMBDirect connection Date: Sun, 1 Oct 2017 19:30:13 -0700 Message-Id: <20171002023030.3582-6-longli@exchange.microsoft.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171002023030.3582-1-longli@exchange.microsoft.com> References: <20171002023030.3582-1-longli@exchange.microsoft.com> X-CMAE-Envelope: MS4wfFjCmMNXkC3EknwKPnR/mOzzjXt+cDFV2nqbg6r1IMO1O/xleaqggyf++GBb7NhHt5umYKCJg1itmvHTXvIwFvfGVW62/yZn1kEjbloYdnavgBK8942K R23jo63l3ROwC8Pw7zBU9nWZXujb7I1iX0QCoNXTMH2ibBIAuX7dAljzBO0qB/eH9ZqBXlCn4iiyW5rXvmfd33xCTjBKtrB2lQly6LobR/JLxH/OFhK0jkeR OnABjhBRnIG5NrY4UjMwkf3KcL7I/ht8EFySxcx2+g43dbt900ug5VGdZA3rh/VUZKyhL2oQRCEg+HzSfE9HlzXfvYWpBMabfCKNj08mkXJqs8J6n9U4HO3T YF7tL5GOeA1Rij9/KfIPrcMtZg/Pc7rWYM/dlUEpSk2Jg2jqBnwTNxJNtFBVvi8O7nU/KYdGz4+K8KYokgWvhxJBx/s2wX81RAW8Ht7gueYVmI8v7X/QJlB+ lgSCQGJ+FJqSXuZP 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 SMBDirect. Each SMBDirect connection is based on a RC Queue Pair. Signed-off-by: Long Li --- fs/cifs/smbdirect.c | 17 +++++++++++++++++ fs/cifs/smbdirect.h | 4 ++++ 2 files changed, 21 insertions(+) diff --git a/fs/cifs/smbdirect.c b/fs/cifs/smbdirect.c index e8f976f..34f73e2 100644 --- a/fs/cifs/smbdirect.c +++ b/fs/cifs/smbdirect.c @@ -1675,3 +1675,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; +} diff --git a/fs/cifs/smbdirect.h b/fs/cifs/smbdirect.h index ca60700..42a9338 100644 --- a/fs/cifs/smbdirect.h +++ b/fs/cifs/smbdirect.h @@ -245,6 +245,10 @@ struct smbd_response { u8 packet[]; }; +/* Create a SMBDirect session */ +struct smbd_connection *smbd_get_connection( + struct TCP_Server_Info *server, struct sockaddr *dstaddr); + void profiling_display_histogram( struct seq_file *m, unsigned long long array[]); #endif