public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: steved@redhat.com
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH 1/4] getport: Recognize "rdma" and "rdma6" netid
Date: Tue, 07 Sep 2010 12:26:07 -0400	[thread overview]
Message-ID: <20100907162607.3392.72787.stgit@seurat.1015granger.net> (raw)
In-Reply-To: <20100907162156.3392.90376.stgit@seurat.1015granger.net>

The mount.nfs command must recognize the values of "rdma" and "rdma6"
with the "proto=" mount option.  Typically the mount.nfs command
relies on libtirpc or getprotobyname(3) to recognize netids and
translate them to protocol numbers.

RFCs 5665 and 5666 define the "rdma" and "rdma6" netids.  IANA defines
a specific port number for NFS over RDMA (20049), but has not provided
a protocol name and number for RDMA transports, and is not expected
to.  The best we can do is translate these by hand, as needed, to get
RDMA mount requests to the kernel without erroring out.

Only the forward translation is needed until such time that "rdma" and
"rdma6" start to appear in rpcbind registries.  For now, the version
and transport negotiation logic is skipped, avoiding rpcbind queries
for RDMA mounts.

Note: As of kernel 2.6.36, the kernel's NFS over RDMA transport
capability does not support IPv6.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 support/include/nfsrpc.h |    6 ++++++
 support/nfs/getport.c    |   25 +++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/support/include/nfsrpc.h b/support/include/nfsrpc.h
index 6ebefca..d50fe94 100644
--- a/support/include/nfsrpc.h
+++ b/support/include/nfsrpc.h
@@ -27,6 +27,12 @@
 #include <rpc/clnt.h>
 
 /*
+ * IANA does not define an IP protocol number for RDMA transports.
+ * Choose an arbitrary value we can use locally.
+ */
+#define NFSPROTO_RDMA		(3939)
+
+/*
  * Conventional RPC program numbers
  */
 #ifndef RPCBPROG
diff --git a/support/nfs/getport.c b/support/nfs/getport.c
index c930539..d74400b 100644
--- a/support/nfs/getport.c
+++ b/support/nfs/getport.c
@@ -216,6 +216,21 @@ nfs_get_proto(const char *netid, sa_family_t *family, unsigned long *protocol)
 	struct netconfig *nconf;
 	struct protoent *proto;
 
+	/*
+	 * IANA does not define a protocol number for rdma netids,
+	 * since "rdma" is not an IP protocol.
+	 */
+	if (strcmp(netid, "rdma") == 0) {
+		*family = AF_INET;
+		*protocol = NFSPROTO_RDMA;
+		return 1;
+	}
+	if (strcmp(netid, "rdma6") == 0) {
+		*family = AF_INET6;
+		*protocol = NFSPROTO_RDMA;
+		return 1;
+	}
+
 	nconf = getnetconfigent(netid);
 	if (nconf == NULL)
 		return 0;
@@ -242,6 +257,16 @@ nfs_get_proto(const char *netid, sa_family_t *family, unsigned long *protocol)
 {
 	struct protoent *proto;
 
+	/*
+	 * IANA does not define a protocol number for rdma netids,
+	 * since "rdma" is not an IP protocol.
+	 */
+	if (strcmp(netid, "rdma") == 0) {
+		*family = AF_INET;
+		*protocol = NFSPROTO_RDMA;
+		return 1;
+	}
+
 	proto = getprotobyname(netid);
 	if (proto == NULL)
 		return 0;


  reply	other threads:[~2010-09-07 16:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-07 16:25 [PATCH 0/4] Handle "proto=rdma" regressions Chuck Lever
2010-09-07 16:26 ` Chuck Lever [this message]
2010-09-07 16:26 ` [PATCH 2/4] mount.nfs: Use nfs_nfs_protocol() for checking for proto=rdma Chuck Lever
2010-09-07 16:26 ` [PATCH 3/4] mount.nfs: Support an "rdma" mount option Chuck Lever
2010-09-07 16:26 ` [PATCH 4/4] mount.nfs: Prepare way for "vers=4,rdma" mounts Chuck Lever
     [not found]   ` <20100907162638.3392.14786.stgit-x+BlCsqV7M/wdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2010-09-07 20:07     ` Steve Dickson
2010-09-07 20:14       ` Chuck Lever
2010-09-07 20:30         ` Steve Dickson
2010-09-07 17:57 ` [PATCH 0/4] Handle "proto=rdma" regressions Steve Dickson
2010-09-07 19:21   ` Chuck Lever
2010-09-08 16:22     ` Steve Dickson
2010-09-09 14:50 ` Steve Dickson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100907162607.3392.72787.stgit@seurat.1015granger.net \
    --to=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=steved@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox