linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: sagi@grimberg.me (Sagi Grimberg)
Subject: [PATCH v3 nvme-cli 1/4] fabrics: Allow ipv6 address resolution
Date: Tue, 16 Aug 2016 12:46:24 +0300	[thread overview]
Message-ID: <1471340787-26922-2-git-send-email-sagi@grimberg.me> (raw)
In-Reply-To: <1471340787-26922-1-git-send-email-sagi@grimberg.me>

While we're at it, make the adrfam condition
a proper switch-case statement.

Signed-off-by: Sagi Grimberg <sagi at grimberg.me>
Reviewed-by: Christoph Hellwig <hch at lst.de>
---
 fabrics.c | 36 ++++++++++++++++++++----------------
 1 file changed, 20 insertions(+), 16 deletions(-)

diff --git a/fabrics.c b/fabrics.c
index 8a174d41b82b..461e126cc56f 100644
--- a/fabrics.c
+++ b/fabrics.c
@@ -438,25 +438,29 @@ static int connect_ctrl(struct nvmf_disc_rsp_page_entry *e)
 		/* we can safely ignore the rest of the entries */
 		break;
 	case NVMF_TRTYPE_RDMA:
-		if (e->adrfam != NVMF_ADDR_FAMILY_IP4) {
+		switch (e->adrfam) {
+		case NVMF_ADDR_FAMILY_IP4:
+		case NVMF_ADDR_FAMILY_IP6:
+			/* FALLTHRU */
+			len = sprintf(p, ",transport=rdma");
+			if (len < 0)
+				return -EINVAL;
+			p += len;
+
+			len = sprintf(p, ",traddr=%s", e->traddr);
+			if (len < 0)
+				return -EINVAL;
+			p += len;
+
+			len = sprintf(p, ",trsvcid=%s", e->trsvcid);
+			if (len < 0)
+				return -EINVAL;
+			p += len;
+			break;
+		default:
 			fprintf(stderr, "skipping unsupported adrfam\n");
 			return -EINVAL;
 		}
-
-		len = sprintf(p, ",transport=rdma");
-		if (len < 0)
-			return -EINVAL;
-		p += len;
-
-		len = sprintf(p, ",traddr=%s", e->traddr);
-		if (len < 0)
-			return -EINVAL;
-		p += len;
-
-		len = sprintf(p, ",trsvcid=%s", e->trsvcid);
-		if (len < 0)
-			return -EINVAL;
-		p += len;
 		break;
 	default:
 		fprintf(stderr, "skipping unsupported transport %d\n",
-- 
1.9.1

  reply	other threads:[~2016-08-16  9:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-16  9:46 [PATCH v3 nvme-cli 0/4] Useful fabrics patches Sagi Grimberg
2016-08-16  9:46 ` Sagi Grimberg [this message]
2016-08-16  9:46 ` [PATCH v3 nvme-cli 2/4] fabrics: stringify discover output Sagi Grimberg
2016-08-16  9:46 ` [PATCH v3 nvme-cli 3/4] fabrics: Allow discover params to come from a conf file Sagi Grimberg
2016-08-16  9:46 ` [PATCH v3 nvme-cli 4/4] fabrics: Take the hostnqn parameter from a conf file if not given Sagi Grimberg
2016-08-16 16:35 ` [PATCH v3 nvme-cli 0/4] Useful fabrics patches Keith Busch

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=1471340787-26922-2-git-send-email-sagi@grimberg.me \
    --to=sagi@grimberg.me \
    /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;
as well as URLs for NNTP newsgroup(s).