diff mbox series

[v6,07/22] CIFS: SMBD: Implement function to create a SMB Direct connection

Message ID 20171105054404.23886-8-longli@exchange.microsoft.com
State New
Headers show
Series CIFS: Implement SMB Direct protocol | expand

Commit Message

Long Li Nov. 5, 2017, 5:43 a.m. UTC
From: Long Li <longli@microsoft.com>

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 <longli@microsoft.com>
---
 fs/cifs/smbdirect.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Comments

Ronnie Sahlberg Nov. 20, 2017, 7:38 a.m. UTC | #1
Acked-by: Ronnie Sahlberg <lsahlber@redhat.com>


----- Original Message -----
From: "Long Li" <longli@exchange.microsoft.com>
To: "Steve French" <sfrench@samba.org>, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, "Christoph Hellwig" <hch@infradead.org>, "Tom Talpey" <ttalpey@microsoft.com>, "Matthew Wilcox" <mawilcox@microsoft.com>, "Stephen Hemminger" <sthemmin@microsoft.com>
Cc: "Long Li" <longli@microsoft.com>
Sent: Sunday, 5 November, 2017 4:43:49 PM
Subject: [Patch v6 07/22] CIFS: SMBD: Implement function to create a SMB Direct connection

From: Long Li <longli@microsoft.com>

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 <longli@microsoft.com>
---
 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;
+}
Steve French Nov. 20, 2017, 4:56 p.m. UTC | #2
merged into cifs-2.6.git for-next

On Sun, Nov 5, 2017 at 12:43 AM, Long Li <longli@exchange.microsoft.com> wrote:
> From: Long Li <longli@microsoft.com>
>
> 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 <longli@microsoft.com>
> ---
>  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;
> +}
> --
> 2.7.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

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;
+}