NetBSD Problem Report #21207

Received: (qmail 12863 invoked by uid 605); 16 Apr 2003 22:18:43 -0000
Message-Id: <200304162218.h3GMIfP02464@egsnore.cirr.com>
Date: Wed, 16 Apr 2003 17:18:41 -0500 (CDT)
From: Eric Schnoebelen <eric@egsnore.cirr.com>
Sender: gnats-bugs-owner@netbsd.org
Reply-To: eric@cirr.com
To: gnats-bugs@gnats.netbsd.org
Subject: add fibre channel wwn information to scsictl
X-Send-Pr-Version: 3.95

>Number:         21207
>Category:       bin
>Synopsis:       add fibre channel wwn information gathering to scsictl
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          analyzed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 16 22:19:00 +0000 2003
>Closed-Date:    
>Last-Modified:  Sun Apr 15 21:45:09 +0000 2012
>Originator:     Eric Schnoebelen
>Release:        NetBSD 1.6
>Organization:
Eric Schnoebelen	eric@cirr.com			http://www.cirr.com
>Environment:
System: NetBSD egsnore.cirr.com 1.6 NetBSD 1.6 (GENERIC) #0: Sun Sep 8 19:43:40 UTC 2002 autobuild@tgm.daemon.org:/autobuild/i386/OBJ/autobuild/src/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
	I've added a subcommand to scsictl(8) to allow it to retrieve
	(and display) WWN information for attached fibre channel drives.

	The source base is -current as of 12 April, 2003.
>How-To-Repeat:
	enhancement request:  try to gather the wwn's from fc devices
	    from the NetBSD userland.
>Fix:
cvs server: Diffing .
Index: scsictl.c
===================================================================
RCS file: /cvsroot/src/sbin/scsictl/scsictl.c,v
retrieving revision 1.19
diff -b -u -w -r1.19 scsictl.c
--- scsictl.c	2002/09/26 06:15:38	1.19
+++ scsictl.c	2003/04/16 22:18:00
@@ -58,6 +58,8 @@
 #include <dev/scsipi/scsi_disk.h>
 #include <dev/scsipi/scsipiconf.h>

+#include <dev/ic/isp_ioctl.h>
+
 #include "extern.h"

 struct command {
@@ -108,11 +110,13 @@
 void	bus_reset __P((int, char *[]));
 void	bus_scan __P((int, char *[]));
 void	bus_detach __P((int, char *[]));
+void	bus_getwwn __P((int, char *[]));

 struct command bus_commands[] = {
 	{ "reset",	"",			bus_reset },
 	{ "scan",	"target lun",		bus_scan },
 	{ "detach",	"target lun",		bus_detach },
+	{ "getwwn",	"target",		bus_getwwn },
 	{ NULL,		NULL,				NULL },
 };

@@ -870,6 +874,65 @@

 	if (ioctl(fd, SCBUSIODETACH, &args) != 0)
 		err(1, "SCBUSIODETACH");
+
+	return;
+}
+
+/*
+ * scsictl_getwwn_info
+ *
+ *	query individual fc device to get (and print) the 
+ *	port/node wwn information
+ */
+
+scsictl_getwwn_info(loopid)
+	int loopid;
+{
+	struct isp_fc_device args;
+	int rc;
+
+	args.loopid = loopid;
+	if ((rc = ioctl(fd, ISP_FC_GETDINFO, &args)) == 0) {
+	    printf( "%s: loopid: %d portid: %d\n",
+		    dvname,
+		    args.loopid, args.portid);
+	    printf( "%s: node wwn: %llx port wwn: %llx\n",
+		    dvname, 
+		    args.node_wwn, args.port_wwn);
+	}
+	return rc;
+}
+
+/*
+ * bus_getwwn:
+ *
+ *	query the fc bus to get port and node wwn information
+ */
+void
+bus_getwwn(argc, argv)
+	int argc;
+	char *argv[];
+{
+	char *cp;
+	int loopid;
+
+	/* Must have two args: loopid */
+	if (argc != 1)
+		usage();
+
+	if (strcmp(argv[0], "any") == 0 || strcmp(argv[0], "all") == 0)
+		for  (loopid = 0; loopid <= 255; loopid++) {
+		    scsictl_getwwn_info(loopid);
+		}
+	else {
+		loopid = strtol(argv[0], &cp, 10);
+		if (*cp != '\0' || loopid < 0 || loopid > 255)
+			errx(1, "invalid target: %s", argv[0]);
+
+		if (scsictl_getwwn_info(loopid) != 0)
+			err(1, "ISP_FC_GETDINFO");
+	}
+

 	return;
 }
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->analyzed 
State-Changed-By: thorpej 
State-Changed-When: Thu Apr 24 23:18:19 UTC 2003 
State-Changed-Why:  
I will handle this bug 


Responsible-Changed-From-To: bin-bug-people->thorpej 
Responsible-Changed-By: thorpej 
Responsible-Changed-When: Thu Apr 24 23:18:19 UTC 2003 
Responsible-Changed-Why:  
I will handle this bug 

From: Jason Thorpe <thorpej@wasabisystems.com>
To: gnats-bugs@netbsd.org
Cc:  
Subject: Re: bin/21207
Date: Thu, 24 Apr 2003 16:29:16 -0700

 Thank you for submitting the patch.

 Unfortunately, this is not really the right way to address this 
 problem.  The right way to solve the problem is to use the appropriate 
 locators for the transport being used. There are a couple of people 
 working on this issue.

 It's also really inappropriate to add an isp-specific ioctl to 
 scsictl(8).

          -- Jason R. Thorpe <thorpej@wasabisystems.com>


From: Matthew Jacob <mjacob@feral.com>
To: Eric Schnoebelen <eric@egsnore.cirr.com>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: bin/21207: add fibre channel wwn information to scsictl
Date: Sun, 27 Apr 2003 23:22:11 -0700 (PDT)

 It's a nice idea, but it's non-generic in that it uses ISP specific
 ioctls.

 You also might clarify *which* wwn this is. WWNN? WWPN? SAM-3 Lun WWN?

Responsible-Changed-From-To: thorpej->bin-bug-people
Responsible-Changed-By: wiz@NetBSD.org
Responsible-Changed-When: Sun, 15 Apr 2012 21:45:09 +0000
Responsible-Changed-Why:
Back to role account, thorpej left


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.