public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
Cc: target-devel <target-devel@vger.kernel.org>,
	linux-rdma <linux-rdma@vger.kernel.org>,
	Nicholas Bellinger <nab@linux-iscsi.org>,
	Bart Van Assche <bvanassche@acm.org>,
	Roland Dreier <roland@purestorage.com>
Subject: [PATCH] ib_srpt: Convert port_guid to use subnet_prefix + interface_id formatting
Date: Wed,  2 Nov 2011 15:17:36 +0000	[thread overview]
Message-ID: <1320247056-26809-1-git-send-email-nab@linux-iscsi.org> (raw)

From: Nicholas Bellinger <nab@linux-iscsi.org>

This patch converts ib_srpt to use srpt_port->port_guid subnet_prefix +
interface_id formatting in srpt_add_one() to identify individual HW
target ports in /sys/kernel/config/target/srpt/$SRPT_WWPN

This layout for SRP Target WWPNs and explict SRP Initiator Node WWPNs
will now appear as:

/ib_srpt> ls
o- ib_srpt ......................................................... [2 Targets]
  o- 0xfe800000000000000002c903000e8acd .............................. [enabled]
  | o- acls ............................................................ [1 ACL]
  | | o- 0x00000000000000000002c903000e8be9 .................... [1 Mapped LUNs]
  | |   o- mapped_lun0 ............................................. [lun0 (rw)]
  | o- luns ........................................................... [1 LUNs]
  |   o- lun0 ................................... [iblock/scsi_debug (/dev/sdb)]
  o- 0xfe800000000000000002c903000e8ace .............................. [enabled]
    o- acls ............................................................ [1 ACL]
    | o- 0x00000000000000000002c903000e8bea .................... [1 Mapped LUNs]
    |   o- mapped_lun0 ............................................. [lun0 (rw)]
    o- luns ........................................................... [1 LUNs]
      o- lun0 .................................. [iblock/scsi_debug2 (/dev/sdc)]

Reported-by: Bart Van Assche <bvanassche@acm.org>
Cc: Bart Van Assche <bvanassche@acm.org>
Cc: Roland Dreier <roland@purestorage.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
---
 drivers/infiniband/ulp/srpt/ib_srpt.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index 283bc65..4734e44 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -3295,8 +3295,9 @@ static void srpt_add_one(struct ib_device *device)
 			goto err_ring;
 		}
 		snprintf(sport->port_guid, sizeof(sport->port_guid),
-				"0x0000000000000000%016llx",
-				be64_to_cpu(sport->gid.global.interface_id));
+			"0x%016llx%016llx",
+			be64_to_cpu(sport->gid.global.subnet_prefix),
+			be64_to_cpu(sport->gid.global.interface_id));
 	}
 
 	spin_lock(&srpt_dev_lock);
-- 
1.7.2.5

                 reply	other threads:[~2011-11-02 15:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1320247056-26809-1-git-send-email-nab@linux-iscsi.org \
    --to=nab@linux-iscsi.org \
    --cc=bvanassche@acm.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=roland@purestorage.com \
    --cc=target-devel@vger.kernel.org \
    /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