xref: /illumos-gate/usr/src/cmd/mdb/common/modules/idm/idm.c (revision cf01ae8a)
1a6d42e7dSPeter Dunlap /*
2a6d42e7dSPeter Dunlap  * CDDL HEADER START
3a6d42e7dSPeter Dunlap  *
4a6d42e7dSPeter Dunlap  * The contents of this file are subject to the terms of the
5a6d42e7dSPeter Dunlap  * Common Development and Distribution License (the "License").
6a6d42e7dSPeter Dunlap  * You may not use this file except in compliance with the License.
7a6d42e7dSPeter Dunlap  *
8a6d42e7dSPeter Dunlap  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9a6d42e7dSPeter Dunlap  * or http://www.opensolaris.org/os/licensing.
10a6d42e7dSPeter Dunlap  * See the License for the specific language governing permissions
11a6d42e7dSPeter Dunlap  * and limitations under the License.
12a6d42e7dSPeter Dunlap  *
13a6d42e7dSPeter Dunlap  * When distributing Covered Code, include this CDDL HEADER in each
14a6d42e7dSPeter Dunlap  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15a6d42e7dSPeter Dunlap  * If applicable, add the following below this CDDL HEADER, with the
16a6d42e7dSPeter Dunlap  * fields enclosed by brackets "[]" replaced with your own identifying
17a6d42e7dSPeter Dunlap  * information: Portions Copyright [yyyy] [name of copyright owner]
18a6d42e7dSPeter Dunlap  *
19a6d42e7dSPeter Dunlap  * CDDL HEADER END
20a6d42e7dSPeter Dunlap  */
21a6d42e7dSPeter Dunlap /*
225819f75eSPeter Gill  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
23a6d42e7dSPeter Dunlap  */
24a6d42e7dSPeter Dunlap 
25d3d50737SRafael Vanoni #include <mdb/mdb_modapi.h>
26d3d50737SRafael Vanoni #include <mdb/mdb_ks.h>
27d3d50737SRafael Vanoni 
28a6d42e7dSPeter Dunlap #include <sys/cpuvar.h>
29a6d42e7dSPeter Dunlap #include <sys/conf.h>
30a6d42e7dSPeter Dunlap #include <sys/file.h>
31a6d42e7dSPeter Dunlap #include <sys/types.h>
32a6d42e7dSPeter Dunlap #include <sys/taskq.h>
33a6d42e7dSPeter Dunlap #include <sys/sysmacros.h>
34a6d42e7dSPeter Dunlap #include <sys/socket.h>		/* networking stuff */
35a6d42e7dSPeter Dunlap #include <sys/strsubr.h>	/* networking stuff */
36a6d42e7dSPeter Dunlap #include <sys/nvpair.h>
37a6d42e7dSPeter Dunlap #include <sys/sunldi.h>
38a6d42e7dSPeter Dunlap #include <sys/stmf.h>
39a6d42e7dSPeter Dunlap #include <sys/stmf_ioctl.h>
40a6d42e7dSPeter Dunlap #include <sys/portif.h>
41a6d42e7dSPeter Dunlap 
42a6d42e7dSPeter Dunlap #define	IDM_CONN_SM_STRINGS
43bf604c64SPeter Dunlap #define	IDM_TASK_SM_STRINGS
44a6d42e7dSPeter Dunlap #define	ISCSIT_TGT_SM_STRINGS
45a6d42e7dSPeter Dunlap #define	ISCSIT_SESS_SM_STRINGS
46a6d42e7dSPeter Dunlap #define	ISCSIT_LOGIN_SM_STRINGS
4730e7468fSPeter Dunlap #define	ISCSI_SESS_SM_STRINGS
4830e7468fSPeter Dunlap #define	ISCSI_CMD_SM_STRINGS
4930e7468fSPeter Dunlap #define	ISCSI_ICS_NAMES
5030e7468fSPeter Dunlap #define	ISCSI_LOGIN_STATE_NAMES
515f7d09c6SPeter Cudhea - Sun Microsystems - Burlington, MA United States #define	IDM_CN_NOTIFY_STRINGS
52a6d42e7dSPeter Dunlap #include <sys/idm/idm.h>
53aff4bce5Syi zhang - Sun Microsystems - Beijing China #include <iscsi.h>
54a6d42e7dSPeter Dunlap #include <iscsit.h>
55a6d42e7dSPeter Dunlap #include <iscsit_isns.h>
565819f75eSPeter Gill #include <sys/ib/clients/iser/iser.h>
57a6d42e7dSPeter Dunlap 
58a6d42e7dSPeter Dunlap /*
59a6d42e7dSPeter Dunlap  * We want to be able to print multiple levels of object hierarchy with a
60a6d42e7dSPeter Dunlap  * single dcmd information, and preferably also exclude intermediate
61a6d42e7dSPeter Dunlap  * levels if desired.  For example some of the target objects have the
62a6d42e7dSPeter Dunlap  * following relationship:
63a6d42e7dSPeter Dunlap  *
64a6d42e7dSPeter Dunlap  * target --> session --> connection --> task
65a6d42e7dSPeter Dunlap  *
66a6d42e7dSPeter Dunlap  * The session dcmd should allow the printing of all associated tasks for the
67a6d42e7dSPeter Dunlap  * sessions without printing all the associated connections.  To accomplish
68a6d42e7dSPeter Dunlap  * this the following structure contains a bit for each object type.  Dcmds
695819f75eSPeter Gill  * should invoke the functions for child objects if any bits are set
70a6d42e7dSPeter Dunlap  * in iscsi_dcmd_ctrl_t but the functions for the child object should only
715819f75eSPeter Gill  * print data if their associated bit is set. Each object type should print
725819f75eSPeter Gill  * a header for its first occurrence or if it is being printed as a child
735819f75eSPeter Gill  * object for the first occurrence under each parent. For the model to follow
745819f75eSPeter Gill  * see how idc->idc_header is handled in iscsi_sess_impl.
75a6d42e7dSPeter Dunlap  *
76a6d42e7dSPeter Dunlap  * Each dcmd should provide an external interface with the standard MDB API
77a6d42e7dSPeter Dunlap  * and an internal interface that accepts iscsi_dcmd_ctrl_t.  To display
78a6d42e7dSPeter Dunlap  * child objects the dcmd calls the internal interface for the child object
79a6d42e7dSPeter Dunlap  * directly.  Dcmds invoked from the command line will, of course, call the
80a6d42e7dSPeter Dunlap  * external interface.  See iscsi_conn() and iscsi_conn_impl().
81a6d42e7dSPeter Dunlap  */
82a6d42e7dSPeter Dunlap 
83a6d42e7dSPeter Dunlap typedef struct {
84a6d42e7dSPeter Dunlap 	union	{
85a6d42e7dSPeter Dunlap 		uint32_t	idc_children;
86a6d42e7dSPeter Dunlap 		struct {
87a6d42e7dSPeter Dunlap 			uint32_t	idc_tgt:1,
885819f75eSPeter Gill 					idc_tpg:1,
89a6d42e7dSPeter Dunlap 					idc_tpgt:1,
90a6d42e7dSPeter Dunlap 					idc_portal:1,
91a6d42e7dSPeter Dunlap 					idc_sess:1,
92a6d42e7dSPeter Dunlap 					idc_conn:1,
935819f75eSPeter Gill 					idc_svc:1,
94a6d42e7dSPeter Dunlap 					idc_print_ip:1,
95a6d42e7dSPeter Dunlap 					idc_task:1,
96a6d42e7dSPeter Dunlap 					idc_buffer:1,
97a6d42e7dSPeter Dunlap 					idc_states:1,
98a6d42e7dSPeter Dunlap 					idc_rc_audit:1,
99a6d42e7dSPeter Dunlap 					idc_lun:1,
1005819f75eSPeter Gill 					idc_hba:1,
1015819f75eSPeter Gill 					idc_cmd:1;
102a6d42e7dSPeter Dunlap 		} child;
103a6d42e7dSPeter Dunlap 	} u;
104a6d42e7dSPeter Dunlap 	boolean_t		idc_ini;
105a6d42e7dSPeter Dunlap 	boolean_t		idc_tgt;
106a6d42e7dSPeter Dunlap 	boolean_t		idc_verbose;
107a6d42e7dSPeter Dunlap 	boolean_t		idc_header;
108a6d42e7dSPeter Dunlap 	/*
109a6d42e7dSPeter Dunlap 	 * Our connection dcmd code works off the global connection lists
110a6d42e7dSPeter Dunlap 	 * in IDM since we want to know about connections even when they
111a6d42e7dSPeter Dunlap 	 * have not progressed to the point that they have an associated
112a6d42e7dSPeter Dunlap 	 * session.  If we use "::iscsi_sess [-c]" then we only want to
113a6d42e7dSPeter Dunlap 	 * see connections associated with particular session.  To avoid
114a6d42e7dSPeter Dunlap 	 * writing a separate set of code to print session-specific connection
115a6d42e7dSPeter Dunlap 	 * the session code should set the sessions kernel address in the
116a6d42e7dSPeter Dunlap 	 * following field.  The connection code will then only print
117a6d42e7dSPeter Dunlap 	 * connections that match.
118a6d42e7dSPeter Dunlap 	 */
119a6d42e7dSPeter Dunlap 	uintptr_t		idc_assoc_session;
120a6d42e7dSPeter Dunlap } iscsi_dcmd_ctrl_t;
121a6d42e7dSPeter Dunlap 
1225819f75eSPeter Gill typedef struct idm_hba_walk_info {
1235819f75eSPeter Gill 	void	**array;
1245819f75eSPeter Gill 	int	n_elements;
1255819f75eSPeter Gill 	int	cur_element;
1265819f75eSPeter Gill 	void	*data;
1275819f75eSPeter Gill } idm_hba_walk_info_t;
1285819f75eSPeter Gill 
129a6d42e7dSPeter Dunlap static int iscsi_walk_all_sess(iscsi_dcmd_ctrl_t *idc);
130a6d42e7dSPeter Dunlap static int iscsi_walk_all_conn(iscsi_dcmd_ctrl_t *idc);
131a6d42e7dSPeter Dunlap static int iscsi_tgt_walk_cb(uintptr_t addr, const void *list_walker_data,
132a6d42e7dSPeter Dunlap     void *idc_void);
133a6d42e7dSPeter Dunlap static int iscsi_tpgt_walk_cb(uintptr_t addr, const void *list_walker_data,
134a6d42e7dSPeter Dunlap     void *idc_void);
135a6d42e7dSPeter Dunlap static int iscsi_tpg_walk_cb(uintptr_t addr, const void *list_walker_data,
136a6d42e7dSPeter Dunlap     void *idc_void);
137a6d42e7dSPeter Dunlap static int iscsi_portal_walk_cb(uintptr_t addr, const void *list_walker_data,
138a6d42e7dSPeter Dunlap     void *idc_void);
139a6d42e7dSPeter Dunlap static int iscsi_sess_walk_cb(uintptr_t addr, const void *list_walker_data,
140a6d42e7dSPeter Dunlap     void *idc_void);
141a6d42e7dSPeter Dunlap static int iscsi_conn_walk_cb(uintptr_t addr, const void *list_walker_data,
142a6d42e7dSPeter Dunlap     void *idc_void);
143a6d42e7dSPeter Dunlap static int iscsi_buffer_walk_cb(uintptr_t addr, const void *list_walker_data,
144a6d42e7dSPeter Dunlap     void *idc_void);
1455819f75eSPeter Gill static int iscsi_svc_walk_cb(uintptr_t addr, const void *list_walker_data,
1465819f75eSPeter Gill     void *idc_void);
1475819f75eSPeter Gill static int iscsi_ini_hba_walk_cb(uintptr_t addr, const void *vhba,
1485819f75eSPeter Gill     void *idc_void);
1495819f75eSPeter Gill static int iscsi_ini_sess_walk_cb(uintptr_t addr, const void *vsess,
1505819f75eSPeter Gill     void *idc);
1515819f75eSPeter Gill static int iscsi_ini_conn_walk_cb(uintptr_t addr, const void *vconn,
1525819f75eSPeter Gill     void *idc_void);
1535819f75eSPeter Gill static int iscsi_ini_lun_walk_cb(uintptr_t addr, const void *vlun,
1545819f75eSPeter Gill     void *idc_void);
1555819f75eSPeter Gill static int iscsi_ini_cmd_walk_cb(uintptr_t addr, const void *vcmd,
1565819f75eSPeter Gill     void *idc);
157a6d42e7dSPeter Dunlap static int iscsi_tgt_impl(uintptr_t addr, iscsi_dcmd_ctrl_t *idc);
158a6d42e7dSPeter Dunlap static int iscsi_tpgt_impl(uintptr_t addr, iscsi_dcmd_ctrl_t *idc);
159a6d42e7dSPeter Dunlap static int iscsi_tpg_impl(uintptr_t addr, iscsi_dcmd_ctrl_t *idc);
160a6d42e7dSPeter Dunlap static int iscsi_portal_impl(uintptr_t addr, iscsi_dcmd_ctrl_t *idc);
161a6d42e7dSPeter Dunlap static int iscsi_sess_impl(uintptr_t addr, iscsi_dcmd_ctrl_t *idc);
162a6d42e7dSPeter Dunlap static int iscsi_conn_impl(uintptr_t addr, iscsi_dcmd_ctrl_t *idc);
163a6d42e7dSPeter Dunlap static void iscsi_print_iscsit_conn_data(idm_conn_t *ict);
1645819f75eSPeter Gill static void iscsi_print_ini_conn_data(idm_conn_t *ict);
165a6d42e7dSPeter Dunlap static void iscsi_print_idm_conn_data(idm_conn_t *ict);
166a6d42e7dSPeter Dunlap static int iscsi_task_impl(uintptr_t addr, iscsi_dcmd_ctrl_t *idc);
167a6d42e7dSPeter Dunlap static void iscsi_print_iscsit_task_data(idm_task_t *idt);
168a6d42e7dSPeter Dunlap static int iscsi_buffer_impl(uintptr_t addr, iscsi_dcmd_ctrl_t *idc);
169a6d42e7dSPeter Dunlap static idm_conn_type_t idm_conn_type(uintptr_t addr);
170a6d42e7dSPeter Dunlap static int iscsi_i_task_impl(idm_task_t *idt, uintptr_t addr,
171a6d42e7dSPeter Dunlap     iscsi_dcmd_ctrl_t *idc);
172a6d42e7dSPeter Dunlap static int iscsi_refcnt_impl(uintptr_t addr);
173a6d42e7dSPeter Dunlap static int iscsi_sm_audit_impl(uintptr_t addr);
174a6d42e7dSPeter Dunlap static int iscsi_isns(uintptr_t addr, uint_t flags, int argc,
175a6d42e7dSPeter Dunlap     const mdb_arg_t *argv);
1765819f75eSPeter Gill static int iscsi_svc_impl(uintptr_t addr, iscsi_dcmd_ctrl_t *idc);
1775819f75eSPeter Gill static int iscsi_ini_hba_impl(uintptr_t addr, iscsi_dcmd_ctrl_t *idc);
1785819f75eSPeter Gill static int iscsi_print_ini_sess(uintptr_t addr, iscsi_sess_t *sess,
1795819f75eSPeter Gill     iscsi_dcmd_ctrl_t *idc);
1805819f75eSPeter Gill static int iscsi_print_ini_lun(uintptr_t addr, const iscsi_lun_t *lun,
1815819f75eSPeter Gill     iscsi_dcmd_ctrl_t *idc);
1825819f75eSPeter Gill static int iscsi_print_ini_cmd(uintptr_t addr, const iscsi_cmd_t *cmd,
1835819f75eSPeter Gill     iscsi_dcmd_ctrl_t *idc);
1845819f75eSPeter Gill static int iscsi_ini_sess_walk_init(mdb_walk_state_t *wsp);
1855819f75eSPeter Gill static int iscsi_ini_sess_step(mdb_walk_state_t *wsp);
1865819f75eSPeter Gill static int iscsi_ini_conn_walk_init(mdb_walk_state_t *wsp);
1875819f75eSPeter Gill static int iscsi_ini_conn_step(mdb_walk_state_t *wsp);
1885819f75eSPeter Gill static int iscsi_ini_lun_walk_init(mdb_walk_state_t *wsp);
1895819f75eSPeter Gill static int iscsi_ini_lun_step(mdb_walk_state_t *wsp);
1905819f75eSPeter Gill static int iscsi_ini_cmd_walk_init(mdb_walk_state_t *wsp);
1915819f75eSPeter Gill static int iscsi_ini_cmd_step(mdb_walk_state_t *wsp);
19230e7468fSPeter Dunlap static const char *iscsi_idm_conn_event(unsigned int event);
19330e7468fSPeter Dunlap static const char *iscsi_iscsit_tgt_event(unsigned int event);
19430e7468fSPeter Dunlap static const char *iscsi_iscsit_sess_event(unsigned int event);
19530e7468fSPeter Dunlap static const char *iscsi_iscsit_login_event(unsigned int event);
19630e7468fSPeter Dunlap static const char *iscsi_iscsi_cmd_event(unsigned int event);
19730e7468fSPeter Dunlap static const char *iscsi_iscsi_sess_event(unsigned int event);
19830e7468fSPeter Dunlap static const char *iscsi_idm_conn_state(unsigned int state);
19930e7468fSPeter Dunlap static const char *iscsi_idm_task_state(unsigned int state);
20030e7468fSPeter Dunlap static const char *iscsi_iscsit_tgt_state(unsigned int state);
20130e7468fSPeter Dunlap static const char *iscsi_iscsit_sess_state(unsigned int state);
20230e7468fSPeter Dunlap static const char *iscsi_iscsit_login_state(unsigned int state);
20330e7468fSPeter Dunlap static const char *iscsi_iscsi_cmd_state(unsigned int state);
20430e7468fSPeter Dunlap static const char *iscsi_iscsi_sess_state(unsigned int state);
20530e7468fSPeter Dunlap static const char *iscsi_iscsi_conn_state(unsigned int state);
2065f7d09c6SPeter Cudhea - Sun Microsystems - Burlington, MA United States static const char *iscsi_iscsi_conn_event(unsigned int event);
20730e7468fSPeter Dunlap static const char *iscsi_iscsi_login_state(unsigned int state);
208a6d42e7dSPeter Dunlap 
209a6d42e7dSPeter Dunlap static void iscsi_format_timestamp(char *ts_str, int strlen,
210a6d42e7dSPeter Dunlap     timespec_t *ts);
21130e7468fSPeter Dunlap static char *iscsi_inet_ntop(int af, const void *addr, char *buf, int addrlen);
212a6d42e7dSPeter Dunlap static void convert2ascii(char *, const in6_addr_t *);
213a6d42e7dSPeter Dunlap static int sa_to_str(struct sockaddr_storage *sa, char *addr);
214e42a0851Speter dunlap static int iscsi_isns_esi_cb(uintptr_t addr, const void *walker_data,
215e42a0851Speter dunlap     void *data);
216a6d42e7dSPeter Dunlap static int iscsi_isns_portal_cb(uintptr_t addr, const void *walker_data,
217a6d42e7dSPeter Dunlap     void *data);
218a6d42e7dSPeter Dunlap 
219a6d42e7dSPeter Dunlap #define	PORTAL_STR_LEN	(INET6_ADDRSTRLEN + 7)
220a6d42e7dSPeter Dunlap 
221a6d42e7dSPeter Dunlap /*
222a6d42e7dSPeter Dunlap  * ::iscsi_tgt [-scatgpbSRv]
223a6d42e7dSPeter Dunlap  *
224a6d42e7dSPeter Dunlap  * iscsi_tgt - Print out information associated with an iscsit target instance
225a6d42e7dSPeter Dunlap  *
226a6d42e7dSPeter Dunlap  * s	Print associated session information
227a6d42e7dSPeter Dunlap  * c	Print associated connection information
228a6d42e7dSPeter Dunlap  * a	Print IP addresses with connection information
229a6d42e7dSPeter Dunlap  * t	Print associated task information
230a6d42e7dSPeter Dunlap  * g	Print associated TPG information
231a6d42e7dSPeter Dunlap  * p	Print portals with TPG information
232a6d42e7dSPeter Dunlap  * b	Print associated buffer information
233a6d42e7dSPeter Dunlap  * S	Print recent state events and transitions
234a6d42e7dSPeter Dunlap  * R	Print reference count audit data
235a6d42e7dSPeter Dunlap  * v	Verbose output about the connection
236a6d42e7dSPeter Dunlap  */
237a6d42e7dSPeter Dunlap /*ARGSUSED*/
238a6d42e7dSPeter Dunlap static int
iscsi_tgt(uintptr_t addr,uint_t flags,int argc,const mdb_arg_t * argv)239a6d42e7dSPeter Dunlap iscsi_tgt(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
240a6d42e7dSPeter Dunlap {
241a6d42e7dSPeter Dunlap 	iscsi_dcmd_ctrl_t	idc;
242a6d42e7dSPeter Dunlap 	int			buffer = 0, task = 0, print_ip = 0;
243a6d42e7dSPeter Dunlap 	int			tpgt = 0, conn = 0, sess = 0, portal = 0;
244a6d42e7dSPeter Dunlap 	int			states = 0, rc_audit = 0;
245a6d42e7dSPeter Dunlap 	uintptr_t		iscsit_global_addr, avl_addr, list_addr;
246a6d42e7dSPeter Dunlap 	GElf_Sym		sym;
247a6d42e7dSPeter Dunlap 
248a6d42e7dSPeter Dunlap 	bzero(&idc, sizeof (idc));
249a6d42e7dSPeter Dunlap 	if (mdb_getopts(argc, argv,
250a6d42e7dSPeter Dunlap 	    'a', MDB_OPT_SETBITS, TRUE, &print_ip,
251a6d42e7dSPeter Dunlap 	    'g', MDB_OPT_SETBITS, TRUE, &tpgt,
252a6d42e7dSPeter Dunlap 	    's', MDB_OPT_SETBITS, TRUE, &sess,
253a6d42e7dSPeter Dunlap 	    'c', MDB_OPT_SETBITS, TRUE, &conn,
254a6d42e7dSPeter Dunlap 	    't', MDB_OPT_SETBITS, TRUE, &task,
255a6d42e7dSPeter Dunlap 	    'b', MDB_OPT_SETBITS, TRUE, &buffer,
256a6d42e7dSPeter Dunlap 	    'p', MDB_OPT_SETBITS, TRUE, &portal,
257a6d42e7dSPeter Dunlap 	    'S', MDB_OPT_SETBITS, TRUE, &states,
258a6d42e7dSPeter Dunlap 	    'R', MDB_OPT_SETBITS, TRUE, &rc_audit,
259a6d42e7dSPeter Dunlap 	    'v', MDB_OPT_SETBITS, TRUE, &idc.idc_verbose,
260a6d42e7dSPeter Dunlap 	    NULL) != argc)
261a6d42e7dSPeter Dunlap 		return (DCMD_USAGE);
262a6d42e7dSPeter Dunlap 
263a6d42e7dSPeter Dunlap 	idc.u.child.idc_tgt = 1;
264a6d42e7dSPeter Dunlap 	idc.u.child.idc_print_ip = print_ip;
265a6d42e7dSPeter Dunlap 	idc.u.child.idc_tpgt = tpgt;
266a6d42e7dSPeter Dunlap 	idc.u.child.idc_portal = portal;
267a6d42e7dSPeter Dunlap 	idc.u.child.idc_sess = sess;
268a6d42e7dSPeter Dunlap 	idc.u.child.idc_conn = conn;
269a6d42e7dSPeter Dunlap 	idc.u.child.idc_task = task;
270a6d42e7dSPeter Dunlap 	idc.u.child.idc_buffer = buffer;
271a6d42e7dSPeter Dunlap 	idc.u.child.idc_states = states;
272a6d42e7dSPeter Dunlap 	idc.u.child.idc_rc_audit = rc_audit;
273a6d42e7dSPeter Dunlap 
274a6d42e7dSPeter Dunlap 	if (DCMD_HDRSPEC(flags))
275a6d42e7dSPeter Dunlap 		idc.idc_header = 1;
276a6d42e7dSPeter Dunlap 
277a6d42e7dSPeter Dunlap 	/*
278a6d42e7dSPeter Dunlap 	 * If no address was specified on the command line, we
279a6d42e7dSPeter Dunlap 	 * print out all tgtions
280a6d42e7dSPeter Dunlap 	 */
281a6d42e7dSPeter Dunlap 	if (!(flags & DCMD_ADDRSPEC)) {
282a6d42e7dSPeter Dunlap 		if (mdb_lookup_by_name("iscsit_global", &sym) == -1) {
283a6d42e7dSPeter Dunlap 			mdb_warn("failed to find symbol 'iscsit_global'");
284a6d42e7dSPeter Dunlap 			return (DCMD_ERR);
285a6d42e7dSPeter Dunlap 		}
286a6d42e7dSPeter Dunlap 		iscsit_global_addr = (uintptr_t)sym.st_value;
287a6d42e7dSPeter Dunlap 		avl_addr = iscsit_global_addr +
288a6d42e7dSPeter Dunlap 		    offsetof(iscsit_global_t, global_target_list);
289a6d42e7dSPeter Dunlap 		if (mdb_pwalk("avl", iscsi_tgt_walk_cb, &idc, avl_addr) == -1) {
290a6d42e7dSPeter Dunlap 			mdb_warn("avl walk failed for global target tree");
291a6d42e7dSPeter Dunlap 			return (DCMD_ERR);
292a6d42e7dSPeter Dunlap 		}
293a6d42e7dSPeter Dunlap 		list_addr = iscsit_global_addr +
294a6d42e7dSPeter Dunlap 		    offsetof(iscsit_global_t, global_deleted_target_list);
295a6d42e7dSPeter Dunlap 		if (mdb_pwalk("list", iscsi_tgt_walk_cb,
296a6d42e7dSPeter Dunlap 		    &idc, list_addr) == -1) {
297a6d42e7dSPeter Dunlap 			mdb_warn("list walk failed for deleted target list");
298a6d42e7dSPeter Dunlap 			return (DCMD_ERR);
299a6d42e7dSPeter Dunlap 		}
300a6d42e7dSPeter Dunlap 		return (DCMD_OK);
301a6d42e7dSPeter Dunlap 	}
3025819f75eSPeter Gill 	return (iscsi_tgt_impl(addr, &idc));
303a6d42e7dSPeter Dunlap }
304a6d42e7dSPeter Dunlap 
305a6d42e7dSPeter Dunlap static int
iscsi_tpg(uintptr_t addr,uint_t flags,int argc,const mdb_arg_t * argv)306a6d42e7dSPeter Dunlap iscsi_tpg(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
307a6d42e7dSPeter Dunlap {
308a6d42e7dSPeter Dunlap 	iscsi_dcmd_ctrl_t	idc;
309a6d42e7dSPeter Dunlap 	uintptr_t		iscsit_global_addr, avl_addr;
310a6d42e7dSPeter Dunlap 	GElf_Sym		sym;
3115819f75eSPeter Gill 	int			rc_audit = 0;
312a6d42e7dSPeter Dunlap 
313a6d42e7dSPeter Dunlap 	bzero(&idc, sizeof (idc));
314a6d42e7dSPeter Dunlap 	if (mdb_getopts(argc, argv,
3155819f75eSPeter Gill 	    'R', MDB_OPT_SETBITS, TRUE, &rc_audit,
316a6d42e7dSPeter Dunlap 	    NULL) != argc)
317a6d42e7dSPeter Dunlap 		return (DCMD_USAGE);
318a6d42e7dSPeter Dunlap 
3195819f75eSPeter Gill 	/* Always print tpgs and portals */
3205819f75eSPeter Gill 	idc.u.child.idc_tpg = 1;
3215819f75eSPeter Gill 	idc.u.child.idc_portal = 1;
3225819f75eSPeter Gill 	idc.u.child.idc_rc_audit = rc_audit;
323a6d42e7dSPeter Dunlap 	if (DCMD_HDRSPEC(flags))
324a6d42e7dSPeter Dunlap 		idc.idc_header = 1;
325a6d42e7dSPeter Dunlap 
326a6d42e7dSPeter Dunlap 	/*
327a6d42e7dSPeter Dunlap 	 * If no address was specified on the command line, we
328a6d42e7dSPeter Dunlap 	 * print out all tgtions
329a6d42e7dSPeter Dunlap 	 */
330a6d42e7dSPeter Dunlap 	if (!(flags & DCMD_ADDRSPEC)) {
331a6d42e7dSPeter Dunlap 		if (mdb_lookup_by_name("iscsit_global", &sym) == -1) {
332a6d42e7dSPeter Dunlap 			mdb_warn("failed to find symbol 'iscsit_global'");
333a6d42e7dSPeter Dunlap 			return (DCMD_ERR);
334a6d42e7dSPeter Dunlap 		}
335a6d42e7dSPeter Dunlap 		iscsit_global_addr = (uintptr_t)sym.st_value;
336a6d42e7dSPeter Dunlap 		avl_addr = iscsit_global_addr +
337a6d42e7dSPeter Dunlap 		    offsetof(iscsit_global_t, global_tpg_list);
338a6d42e7dSPeter Dunlap 		if (mdb_pwalk("avl", iscsi_tpg_walk_cb, &idc, avl_addr) == -1) {
339a6d42e7dSPeter Dunlap 			mdb_warn("avl walk failed for global target tree");
340a6d42e7dSPeter Dunlap 			return (DCMD_ERR);
341a6d42e7dSPeter Dunlap 		}
342a6d42e7dSPeter Dunlap 		return (DCMD_OK);
343a6d42e7dSPeter Dunlap 	}
3445819f75eSPeter Gill 	return (iscsi_tpg_impl(addr, &idc));
345a6d42e7dSPeter Dunlap }
346a6d42e7dSPeter Dunlap 
347a6d42e7dSPeter Dunlap /*
3485819f75eSPeter Gill  * ::iscsi_tpgt [-pR]
3495819f75eSPeter Gill  *
3505819f75eSPeter Gill  * Print tpgt information.
3515819f75eSPeter Gill  * R	Print reference count audit data
3525819f75eSPeter Gill  * p	Print portal data
3535819f75eSPeter Gill  */
3545819f75eSPeter Gill static int
iscsi_tpgt(uintptr_t addr,uint_t flags,int argc,const mdb_arg_t * argv)3555819f75eSPeter Gill iscsi_tpgt(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
3565819f75eSPeter Gill {
3575819f75eSPeter Gill 	iscsi_dcmd_ctrl_t	idc;
3585819f75eSPeter Gill 	uintptr_t		iscsit_global_addr, avl_addr, list_addr;
3595819f75eSPeter Gill 	GElf_Sym		sym;
3605819f75eSPeter Gill 	int			rc_audit = 0, portal = 0;
3615819f75eSPeter Gill 
3625819f75eSPeter Gill 	bzero(&idc, sizeof (idc));
3635819f75eSPeter Gill 	if (mdb_getopts(argc, argv,
3645819f75eSPeter Gill 	    'p', MDB_OPT_SETBITS, TRUE, &portal,
3655819f75eSPeter Gill 	    'R', MDB_OPT_SETBITS, TRUE, &rc_audit,
3665819f75eSPeter Gill 	    NULL) != argc)
3675819f75eSPeter Gill 		return (DCMD_USAGE);
3685819f75eSPeter Gill 
3695819f75eSPeter Gill 	idc.u.child.idc_tpgt = 1;
3705819f75eSPeter Gill 	idc.u.child.idc_portal = portal;
3715819f75eSPeter Gill 	idc.u.child.idc_rc_audit = rc_audit;
3725819f75eSPeter Gill 	if (DCMD_HDRSPEC(flags))
3735819f75eSPeter Gill 		idc.idc_header = 1;
3745819f75eSPeter Gill 
3755819f75eSPeter Gill 	/*
3765819f75eSPeter Gill 	 * If no address was specified on the command line,
3775819f75eSPeter Gill 	 * print out all tpgts
3785819f75eSPeter Gill 	 */
3795819f75eSPeter Gill 	if (!(flags & DCMD_ADDRSPEC)) {
3805819f75eSPeter Gill 		if (mdb_lookup_by_name("iscsit_global", &sym) == -1) {
3815819f75eSPeter Gill 			mdb_warn("failed to find symbol 'iscsit_global'");
3825819f75eSPeter Gill 			return (DCMD_ERR);
3835819f75eSPeter Gill 		}
3845819f75eSPeter Gill 		iscsit_global_addr = (uintptr_t)sym.st_value;
3855819f75eSPeter Gill 		avl_addr = iscsit_global_addr +
3865819f75eSPeter Gill 		    offsetof(iscsit_global_t, global_target_list);
3875819f75eSPeter Gill 		if (mdb_pwalk("avl", iscsi_tgt_walk_cb, &idc, avl_addr) == -1) {
3885819f75eSPeter Gill 			mdb_warn("avl walk failed for global target tree");
3895819f75eSPeter Gill 			return (DCMD_ERR);
3905819f75eSPeter Gill 		}
3915819f75eSPeter Gill 		list_addr = iscsit_global_addr +
3925819f75eSPeter Gill 		    offsetof(iscsit_global_t, global_deleted_target_list);
3935819f75eSPeter Gill 		if (mdb_pwalk("list", iscsi_tgt_walk_cb,
3945819f75eSPeter Gill 		    &idc, list_addr) == -1) {
3955819f75eSPeter Gill 			mdb_warn("list walk failed for deleted target list");
3965819f75eSPeter Gill 			return (DCMD_ERR);
3975819f75eSPeter Gill 		}
3985819f75eSPeter Gill 		return (DCMD_OK);
3995819f75eSPeter Gill 	}
4005819f75eSPeter Gill 	return (iscsi_tpgt_impl(addr, &idc));
4015819f75eSPeter Gill }
4025819f75eSPeter Gill 
4035819f75eSPeter Gill /*
4045819f75eSPeter Gill  * ::iscsi_sess [-ablmtvcSRIT]
405a6d42e7dSPeter Dunlap  *
406a6d42e7dSPeter Dunlap  * iscsi_sess - Print out information associated with an iSCSI session
407a6d42e7dSPeter Dunlap  *
408a6d42e7dSPeter Dunlap  * I	Print only initiator sessions
409a6d42e7dSPeter Dunlap  * T	Print only target sessions
410a6d42e7dSPeter Dunlap  * c	Print associated connection information
411a6d42e7dSPeter Dunlap  * a	Print IP addresses with connection information
412a6d42e7dSPeter Dunlap  * t	Print associated task information
4135819f75eSPeter Gill  * l	Print associated lun information (with -I)
4145819f75eSPeter Gill  * m	Print associated initiator command information (with -I)
415a6d42e7dSPeter Dunlap  * b	Print associated buffer information
416a6d42e7dSPeter Dunlap  * S	Print recent state events and transitions
417a6d42e7dSPeter Dunlap  * R	Print reference count audit data
418a6d42e7dSPeter Dunlap  * v	Verbose output about the connection
419a6d42e7dSPeter Dunlap  */
420a6d42e7dSPeter Dunlap /*ARGSUSED*/
421a6d42e7dSPeter Dunlap static int
iscsi_sess(uintptr_t addr,uint_t flags,int argc,const mdb_arg_t * argv)422a6d42e7dSPeter Dunlap iscsi_sess(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
423a6d42e7dSPeter Dunlap {
424a6d42e7dSPeter Dunlap 	iscsi_dcmd_ctrl_t	idc;
425a6d42e7dSPeter Dunlap 	int			buffer = 0, task = 0, conn = 0, print_ip = 0;
4265819f75eSPeter Gill 	int			states = 0, rc_audit = 0, commands = 0;
4275819f75eSPeter Gill 	int			luns = 0;
428a6d42e7dSPeter Dunlap 
429a6d42e7dSPeter Dunlap 	bzero(&idc, sizeof (idc));
430a6d42e7dSPeter Dunlap 	if (mdb_getopts(argc, argv,
431a6d42e7dSPeter Dunlap 	    'I', MDB_OPT_SETBITS, TRUE, &idc.idc_ini,
432a6d42e7dSPeter Dunlap 	    'T', MDB_OPT_SETBITS, TRUE, &idc.idc_tgt,
433a6d42e7dSPeter Dunlap 	    'a', MDB_OPT_SETBITS, TRUE, &print_ip,
434a6d42e7dSPeter Dunlap 	    'c', MDB_OPT_SETBITS, TRUE, &conn,
435a6d42e7dSPeter Dunlap 	    't', MDB_OPT_SETBITS, TRUE, &task,
4365819f75eSPeter Gill 	    'l', MDB_OPT_SETBITS, TRUE, &luns,
4375819f75eSPeter Gill 	    'm', MDB_OPT_SETBITS, TRUE, &commands,
438a6d42e7dSPeter Dunlap 	    'b', MDB_OPT_SETBITS, TRUE, &buffer,
439a6d42e7dSPeter Dunlap 	    'S', MDB_OPT_SETBITS, TRUE, &states,
440a6d42e7dSPeter Dunlap 	    'R', MDB_OPT_SETBITS, TRUE, &rc_audit,
441a6d42e7dSPeter Dunlap 	    'v', MDB_OPT_SETBITS, TRUE, &idc.idc_verbose,
442a6d42e7dSPeter Dunlap 	    NULL) != argc)
443a6d42e7dSPeter Dunlap 		return (DCMD_USAGE);
444a6d42e7dSPeter Dunlap 
445a6d42e7dSPeter Dunlap 	idc.u.child.idc_sess = 1;
446a6d42e7dSPeter Dunlap 	idc.u.child.idc_print_ip = print_ip;
447a6d42e7dSPeter Dunlap 	idc.u.child.idc_conn = conn;
448a6d42e7dSPeter Dunlap 	idc.u.child.idc_task = task;
4495819f75eSPeter Gill 	idc.u.child.idc_cmd = commands;
4505819f75eSPeter Gill 	idc.u.child.idc_lun = luns;
451a6d42e7dSPeter Dunlap 	idc.u.child.idc_buffer = buffer;
452a6d42e7dSPeter Dunlap 	idc.u.child.idc_states = states;
453a6d42e7dSPeter Dunlap 	idc.u.child.idc_rc_audit = rc_audit;
454a6d42e7dSPeter Dunlap 	if (DCMD_HDRSPEC(flags))
455a6d42e7dSPeter Dunlap 		idc.idc_header = 1;
456a6d42e7dSPeter Dunlap 
457a6d42e7dSPeter Dunlap 	/*
458a6d42e7dSPeter Dunlap 	 * If no address was specified on the command line, we
459a6d42e7dSPeter Dunlap 	 * print out all sessions
460a6d42e7dSPeter Dunlap 	 */
461a6d42e7dSPeter Dunlap 	if (!(flags & DCMD_ADDRSPEC)) {
462a6d42e7dSPeter Dunlap 		return (iscsi_walk_all_sess(&idc));
463a6d42e7dSPeter Dunlap 	}
4645819f75eSPeter Gill 	return (iscsi_sess_impl(addr, &idc));
465a6d42e7dSPeter Dunlap }
466a6d42e7dSPeter Dunlap 
467a6d42e7dSPeter Dunlap 
468a6d42e7dSPeter Dunlap 
469a6d42e7dSPeter Dunlap /*
4705819f75eSPeter Gill  * ::iscsi_conn [-abmtvSRIT]
471a6d42e7dSPeter Dunlap  *
472a6d42e7dSPeter Dunlap  * iscsi_conn - Print out information associated with an iSCSI connection
473a6d42e7dSPeter Dunlap  *
474a6d42e7dSPeter Dunlap  * I	Print only initiator connections
475a6d42e7dSPeter Dunlap  * T	Print only target connections
476a6d42e7dSPeter Dunlap  * a	Print IP addresses with connection information
477a6d42e7dSPeter Dunlap  * t	Print associated task information
478a6d42e7dSPeter Dunlap  * b	Print associated buffer information
4795819f75eSPeter Gill  * m	Print associated initiator commands (with -I)
480a6d42e7dSPeter Dunlap  * S	Print recent state events and transitions
481a6d42e7dSPeter Dunlap  * R	Print reference count audit data
482a6d42e7dSPeter Dunlap  * v	Verbose output about the connection
483a6d42e7dSPeter Dunlap  */
484a6d42e7dSPeter Dunlap /*ARGSUSED*/
485a6d42e7dSPeter Dunlap static int
iscsi_conn(uintptr_t addr,uint_t flags,int argc,const mdb_arg_t * argv)486a6d42e7dSPeter Dunlap iscsi_conn(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
487a6d42e7dSPeter Dunlap {
488a6d42e7dSPeter Dunlap 	iscsi_dcmd_ctrl_t	idc;
489a6d42e7dSPeter Dunlap 	int			buffer = 0, task = 0, print_ip = 0;
4905819f75eSPeter Gill 	int			states = 0, rc_audit = 0, commands = 0;
491a6d42e7dSPeter Dunlap 
492a6d42e7dSPeter Dunlap 	bzero(&idc, sizeof (idc));
493a6d42e7dSPeter Dunlap 	if (mdb_getopts(argc, argv,
494a6d42e7dSPeter Dunlap 	    'I', MDB_OPT_SETBITS, TRUE, &idc.idc_ini,
495a6d42e7dSPeter Dunlap 	    'T', MDB_OPT_SETBITS, TRUE, &idc.idc_tgt,
496a6d42e7dSPeter Dunlap 	    'a', MDB_OPT_SETBITS, TRUE, &print_ip,
497a6d42e7dSPeter Dunlap 	    't', MDB_OPT_SETBITS, TRUE, &task,
498a6d42e7dSPeter Dunlap 	    'b', MDB_OPT_SETBITS, TRUE, &buffer,
4995819f75eSPeter Gill 	    'm', MDB_OPT_SETBITS, TRUE, &commands,
500a6d42e7dSPeter Dunlap 	    'S', MDB_OPT_SETBITS, TRUE, &states,
501a6d42e7dSPeter Dunlap 	    'R', MDB_OPT_SETBITS, TRUE, &rc_audit,
502a6d42e7dSPeter Dunlap 	    'v', MDB_OPT_SETBITS, TRUE, &idc.idc_verbose,
503a6d42e7dSPeter Dunlap 	    NULL) != argc)
504a6d42e7dSPeter Dunlap 		return (DCMD_USAGE);
505a6d42e7dSPeter Dunlap 
506a6d42e7dSPeter Dunlap 	idc.u.child.idc_conn = 1;
507a6d42e7dSPeter Dunlap 	idc.u.child.idc_print_ip = print_ip;
508a6d42e7dSPeter Dunlap 	idc.u.child.idc_task = task;
509a6d42e7dSPeter Dunlap 	idc.u.child.idc_buffer = buffer;
5105819f75eSPeter Gill 	idc.u.child.idc_cmd = commands;
511a6d42e7dSPeter Dunlap 	idc.u.child.idc_states = states;
512a6d42e7dSPeter Dunlap 	idc.u.child.idc_rc_audit = rc_audit;
513a6d42e7dSPeter Dunlap 	if (DCMD_HDRSPEC(flags))
514a6d42e7dSPeter Dunlap 		idc.idc_header = 1;
515a6d42e7dSPeter Dunlap 
516a6d42e7dSPeter Dunlap 	/*
517a6d42e7dSPeter Dunlap 	 * If no address was specified on the command line, we
518a6d42e7dSPeter Dunlap 	 * print out all connections
519a6d42e7dSPeter Dunlap 	 */
520a6d42e7dSPeter Dunlap 	if (!(flags & DCMD_ADDRSPEC)) {
521a6d42e7dSPeter Dunlap 		return (iscsi_walk_all_conn(&idc));
5225819f75eSPeter Gill 	}
5235819f75eSPeter Gill 	return (iscsi_conn_impl(addr, &idc));
5245819f75eSPeter Gill }
5255819f75eSPeter Gill 
5265819f75eSPeter Gill 
5275819f75eSPeter Gill /*
5285819f75eSPeter Gill  * ::iscsi_svc [-vR]
5295819f75eSPeter Gill  *
5305819f75eSPeter Gill  * iscsi_svc - Print out information associated with an iSCSI svc
5315819f75eSPeter Gill  *
5325819f75eSPeter Gill  * R	Print reference count audit data
5335819f75eSPeter Gill  * v	Verbose output about the service
5345819f75eSPeter Gill  */
5355819f75eSPeter Gill static int
iscsi_svc(uintptr_t addr,uint_t flags,int argc,const mdb_arg_t * argv)5365819f75eSPeter Gill iscsi_svc(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
5375819f75eSPeter Gill {
5385819f75eSPeter Gill 	iscsi_dcmd_ctrl_t	idc;
5395819f75eSPeter Gill 	GElf_Sym		sym;
5405819f75eSPeter Gill 	uintptr_t		idm_addr;
5415819f75eSPeter Gill 	uintptr_t		svc_list_addr;
5425819f75eSPeter Gill 	int			rc_audit = 0;
5435819f75eSPeter Gill 
5445819f75eSPeter Gill 	bzero(&idc, sizeof (iscsi_dcmd_ctrl_t));
5455819f75eSPeter Gill 
5465819f75eSPeter Gill 	if (mdb_getopts(argc, argv,
5475819f75eSPeter Gill 	    'R', MDB_OPT_SETBITS, TRUE, &rc_audit,
5485819f75eSPeter Gill 	    'v', MDB_OPT_SETBITS, TRUE, &idc.idc_verbose,
5495819f75eSPeter Gill 	    NULL) != argc)
5505819f75eSPeter Gill 		return (DCMD_USAGE);
5515819f75eSPeter Gill 
5525819f75eSPeter Gill 	idc.u.child.idc_svc = 1;
5535819f75eSPeter Gill 	idc.u.child.idc_rc_audit = rc_audit;
5545819f75eSPeter Gill 	if (DCMD_HDRSPEC(flags)) {
5555819f75eSPeter Gill 		idc.idc_header = 1;
5565819f75eSPeter Gill 	}
5575819f75eSPeter Gill 
5585819f75eSPeter Gill 	if (!(flags & DCMD_ADDRSPEC)) {
5595819f75eSPeter Gill 		if (mdb_lookup_by_name("idm", &sym) == -1) {
5605819f75eSPeter Gill 			mdb_warn("failed to find symbol 'idm'");
5615819f75eSPeter Gill 			return (DCMD_ERR);
5625819f75eSPeter Gill 		}
5635819f75eSPeter Gill 		idm_addr = (uintptr_t)sym.st_value;
5645819f75eSPeter Gill 		svc_list_addr = idm_addr + offsetof(idm_global_t,
5655819f75eSPeter Gill 		    idm_tgt_svc_list);
5665819f75eSPeter Gill 
5675819f75eSPeter Gill 		if (mdb_pwalk("list", iscsi_svc_walk_cb, &idc,
5685819f75eSPeter Gill 		    svc_list_addr) == -1) {
5695819f75eSPeter Gill 			mdb_warn("list walk failed for idm services");
5705819f75eSPeter Gill 			return (DCMD_ERR);
5715819f75eSPeter Gill 		}
5725819f75eSPeter Gill 		return (DCMD_OK);
5735819f75eSPeter Gill 	}
5745819f75eSPeter Gill 	return (iscsi_svc_impl(addr, &idc));
5755819f75eSPeter Gill }
5765819f75eSPeter Gill 
5775819f75eSPeter Gill /*
5785819f75eSPeter Gill  * ::iscsi_portal -R
5795819f75eSPeter Gill  *
5805819f75eSPeter Gill  * iscsi_portal - Print out information associated with an iSCSI portal
5815819f75eSPeter Gill  *
5825819f75eSPeter Gill  * R	Print reference count audit data
5835819f75eSPeter Gill  */
5845819f75eSPeter Gill static int
iscsi_portal(uintptr_t addr,uint_t flags,int argc,const mdb_arg_t * argv)5855819f75eSPeter Gill iscsi_portal(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
5865819f75eSPeter Gill {
5875819f75eSPeter Gill 	iscsi_dcmd_ctrl_t	idc;
5885819f75eSPeter Gill 	GElf_Sym		sym;
5895819f75eSPeter Gill 	iscsit_global_t		iscsit_global;
5905819f75eSPeter Gill 	uintptr_t		iscsit_global_addr;
5915819f75eSPeter Gill 	uintptr_t		tpg_avl_addr;
5925819f75eSPeter Gill 	int			rc_audit = 0;
5935819f75eSPeter Gill 
5945819f75eSPeter Gill 	bzero(&idc, sizeof (iscsi_dcmd_ctrl_t));
5955819f75eSPeter Gill 
5965819f75eSPeter Gill 	if (mdb_getopts(argc, argv,
5975819f75eSPeter Gill 	    'R', MDB_OPT_SETBITS, TRUE, &rc_audit,
5985819f75eSPeter Gill 	    NULL) != argc)
5995819f75eSPeter Gill 		return (DCMD_USAGE);
6005819f75eSPeter Gill 
6015819f75eSPeter Gill 	idc.u.child.idc_rc_audit = rc_audit;
6025819f75eSPeter Gill 	idc.u.child.idc_portal = 1;
6035819f75eSPeter Gill 	if (DCMD_HDRSPEC(flags)) {
6045819f75eSPeter Gill 		idc.idc_header = 1;
6055819f75eSPeter Gill 	}
6065819f75eSPeter Gill 
6075819f75eSPeter Gill 	if (!(flags & DCMD_ADDRSPEC)) {
6085819f75eSPeter Gill 		if (mdb_lookup_by_name("iscsit_global", &sym) == -1) {
6095819f75eSPeter Gill 			mdb_warn("failed to find symbol 'iscsit_global'");
6105819f75eSPeter Gill 			return (DCMD_ERR);
6115819f75eSPeter Gill 		}
6125819f75eSPeter Gill 
6135819f75eSPeter Gill 		iscsit_global_addr = (uintptr_t)sym.st_value;
6145819f75eSPeter Gill 
6155819f75eSPeter Gill 		/* get and print the global default tpg */
6165819f75eSPeter Gill 		if (mdb_vread(&iscsit_global, sizeof (iscsit_global_t),
6175819f75eSPeter Gill 		    iscsit_global_addr) != sizeof (iscsit_global_t)) {
6185819f75eSPeter Gill 			mdb_warn("failed to read iscsit_global_t");
6195819f75eSPeter Gill 			return (DCMD_ERR);
6205819f75eSPeter Gill 		}
6215819f75eSPeter Gill 		if (iscsi_tpg_impl((uintptr_t)iscsit_global.global_default_tpg,
6225819f75eSPeter Gill 		    &idc) != DCMD_OK) {
6235819f75eSPeter Gill 			return (DCMD_ERR);
6245819f75eSPeter Gill 		}
6255819f75eSPeter Gill 
6265819f75eSPeter Gill 		/* Walk the tpgs for the rest of the portals */
6275819f75eSPeter Gill 		tpg_avl_addr = iscsit_global_addr + offsetof(iscsit_global_t,
6285819f75eSPeter Gill 		    global_tpg_list);
6295819f75eSPeter Gill 		if (mdb_pwalk("avl", iscsi_tpg_walk_cb, &idc,
6305819f75eSPeter Gill 		    tpg_avl_addr) == -1) {
6315819f75eSPeter Gill 			mdb_warn("list walk failed for global tpg tree");
6325819f75eSPeter Gill 			return (DCMD_ERR);
6335819f75eSPeter Gill 		}
6345819f75eSPeter Gill 		return (DCMD_OK);
6355819f75eSPeter Gill 	}
6365819f75eSPeter Gill 	return (iscsi_portal_impl(addr, &idc));
6375819f75eSPeter Gill }
6385819f75eSPeter Gill 
6395819f75eSPeter Gill 
6405819f75eSPeter Gill /*
6415819f75eSPeter Gill  * ::iscsi_cmd -S
6425819f75eSPeter Gill  *
6435819f75eSPeter Gill  * iscsi_cmd - Print out information associated with an iSCSI cmd
6445819f75eSPeter Gill  *
6455819f75eSPeter Gill  * S	Print state audit data
6465819f75eSPeter Gill  */
6475819f75eSPeter Gill static int
iscsi_cmd(uintptr_t addr,uint_t flags,int argc,const mdb_arg_t * argv)6485819f75eSPeter Gill iscsi_cmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
6495819f75eSPeter Gill {
6505819f75eSPeter Gill 	iscsi_dcmd_ctrl_t	idc;
6515819f75eSPeter Gill 	iscsi_cmd_t		cmd;
6525819f75eSPeter Gill 	int			states = 0;
6535819f75eSPeter Gill 
6545819f75eSPeter Gill 	bzero(&idc, sizeof (iscsi_dcmd_ctrl_t));
6555819f75eSPeter Gill 
6565819f75eSPeter Gill 	if (mdb_getopts(argc, argv,
6575819f75eSPeter Gill 	    'S', MDB_OPT_SETBITS, TRUE, &states,
6585819f75eSPeter Gill 	    NULL) != argc)
6595819f75eSPeter Gill 		return (DCMD_USAGE);
6605819f75eSPeter Gill 
6615819f75eSPeter Gill 	idc.u.child.idc_states = states;
6625819f75eSPeter Gill 	idc.u.child.idc_cmd = 1;
6635819f75eSPeter Gill 	idc.idc_ini = 1;
6645819f75eSPeter Gill 	if (DCMD_HDRSPEC(flags)) {
6655819f75eSPeter Gill 		idc.idc_header = 1;
6665819f75eSPeter Gill 	}
6675819f75eSPeter Gill 
6685819f75eSPeter Gill 	if (!(flags & DCMD_ADDRSPEC)) {
6695819f75eSPeter Gill 		if (mdb_pwalk("iscsi_ini_hba", iscsi_ini_hba_walk_cb,
670892ad162SToomas Soome 		    &idc, 0) == -1) {
6715819f75eSPeter Gill 			mdb_warn("iscsi cmd hba list walk failed");
6725819f75eSPeter Gill 			return (DCMD_ERR);
6735819f75eSPeter Gill 		}
674a6d42e7dSPeter Dunlap 	} else {
6755819f75eSPeter Gill 		if (mdb_vread(&cmd, sizeof (iscsi_cmd_t), addr) !=
6765819f75eSPeter Gill 		    sizeof (iscsi_cmd_t)) {
6775819f75eSPeter Gill 			return (DCMD_ERR);
6785819f75eSPeter Gill 		}
6795819f75eSPeter Gill 		return (iscsi_print_ini_cmd(addr, &cmd, &idc));
6805819f75eSPeter Gill 	}
6815819f75eSPeter Gill 	return (DCMD_OK);
6825819f75eSPeter Gill }
6835819f75eSPeter Gill 
6845819f75eSPeter Gill 
6855819f75eSPeter Gill static int
iscsi_ini_hba_impl(uintptr_t addr,iscsi_dcmd_ctrl_t * idc)686b1da084bSToomas Soome iscsi_ini_hba_impl(uintptr_t addr, iscsi_dcmd_ctrl_t *idc)
687b1da084bSToomas Soome {
6885819f75eSPeter Gill 	iscsi_hba_t ih;
6895819f75eSPeter Gill 
6905819f75eSPeter Gill 	if (mdb_vread(&ih, sizeof (ih), addr) != sizeof (ih)) {
6915819f75eSPeter Gill 		mdb_warn("Invalid HBA\n");
6925819f75eSPeter Gill 		return (DCMD_ERR);
6935819f75eSPeter Gill 	}
6945819f75eSPeter Gill 
6955819f75eSPeter Gill 	if (idc->u.child.idc_hba) {
6965819f75eSPeter Gill 		mdb_printf("iscsi_hba %p sessions: \n", addr);
697a6d42e7dSPeter Dunlap 	}
6985819f75eSPeter Gill 
6995819f75eSPeter Gill 	if (mdb_pwalk("iscsi_ini_sess", iscsi_ini_sess_walk_cb, idc,
7005819f75eSPeter Gill 	    (uintptr_t)ih.hba_sess_list) == -1) {
7015819f75eSPeter Gill 		mdb_warn("iscsi_sess_t walk failed");
7025819f75eSPeter Gill 		return (DCMD_ERR);
7035819f75eSPeter Gill 	}
7045819f75eSPeter Gill 	return (DCMD_OK);
705a6d42e7dSPeter Dunlap }
706a6d42e7dSPeter Dunlap 
707a6d42e7dSPeter Dunlap /*
708a6d42e7dSPeter Dunlap  * ::iscsi_task [-bv]
709a6d42e7dSPeter Dunlap  *
710a6d42e7dSPeter Dunlap  * iscsi_task - Print out information associated with an iSCSI task
711a6d42e7dSPeter Dunlap  *
712a6d42e7dSPeter Dunlap  * b	Print associated buffer information
713a6d42e7dSPeter Dunlap  * S	Print recent state events and transitions
714a6d42e7dSPeter Dunlap  * R	Print reference count audit data
715a6d42e7dSPeter Dunlap  * v	Verbose output about the connection
716a6d42e7dSPeter Dunlap  */
717a6d42e7dSPeter Dunlap /*ARGSUSED*/
718a6d42e7dSPeter Dunlap static int
iscsi_task(uintptr_t addr,uint_t flags,int argc,const mdb_arg_t * argv)719a6d42e7dSPeter Dunlap iscsi_task(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
720a6d42e7dSPeter Dunlap {
721a6d42e7dSPeter Dunlap 	iscsi_dcmd_ctrl_t	idc;
722a6d42e7dSPeter Dunlap 	int			buffer = 0;
723a6d42e7dSPeter Dunlap 	int			states = 0, rc_audit = 0;
724a6d42e7dSPeter Dunlap 
725a6d42e7dSPeter Dunlap 	bzero(&idc, sizeof (idc));
726a6d42e7dSPeter Dunlap 	if (mdb_getopts(argc, argv,
727a6d42e7dSPeter Dunlap 	    'b', MDB_OPT_SETBITS, TRUE, &buffer,
728a6d42e7dSPeter Dunlap 	    'S', MDB_OPT_SETBITS, TRUE, &states,
729a6d42e7dSPeter Dunlap 	    'R', MDB_OPT_SETBITS, TRUE, &rc_audit,
730a6d42e7dSPeter Dunlap 	    'v', MDB_OPT_SETBITS, TRUE, &idc.idc_verbose,
731a6d42e7dSPeter Dunlap 	    NULL) != argc)
732a6d42e7dSPeter Dunlap 		return (DCMD_USAGE);
733a6d42e7dSPeter Dunlap 
734a6d42e7dSPeter Dunlap 	idc.u.child.idc_conn = 0;
735a6d42e7dSPeter Dunlap 	idc.u.child.idc_task = 1;
736a6d42e7dSPeter Dunlap 	idc.u.child.idc_buffer = buffer;
737a6d42e7dSPeter Dunlap 	idc.u.child.idc_states = states;
738a6d42e7dSPeter Dunlap 	idc.u.child.idc_rc_audit = rc_audit;
739a6d42e7dSPeter Dunlap 	if (DCMD_HDRSPEC(flags))
740a6d42e7dSPeter Dunlap 		idc.idc_header = 1;
741a6d42e7dSPeter Dunlap 
742a6d42e7dSPeter Dunlap 	/*
743a6d42e7dSPeter Dunlap 	 * If no address was specified on the command line, we
744a6d42e7dSPeter Dunlap 	 * print out all connections
745a6d42e7dSPeter Dunlap 	 */
746a6d42e7dSPeter Dunlap 	if (!(flags & DCMD_ADDRSPEC)) {
747a6d42e7dSPeter Dunlap 		return (iscsi_walk_all_conn(&idc));
748a6d42e7dSPeter Dunlap 	}
7495819f75eSPeter Gill 	return (iscsi_task_impl(addr, &idc));
750a6d42e7dSPeter Dunlap }
751a6d42e7dSPeter Dunlap 
752a6d42e7dSPeter Dunlap /*
753a6d42e7dSPeter Dunlap  * ::iscsi_refcnt
754a6d42e7dSPeter Dunlap  *
755a6d42e7dSPeter Dunlap  * iscsi_refcnt - Dump an idm_refcnt_t structure
756a6d42e7dSPeter Dunlap  *
757a6d42e7dSPeter Dunlap  */
758a6d42e7dSPeter Dunlap /*ARGSUSED*/
759a6d42e7dSPeter Dunlap static int
iscsi_refcnt(uintptr_t addr,uint_t flags,int argc,const mdb_arg_t * argv)760a6d42e7dSPeter Dunlap iscsi_refcnt(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
761a6d42e7dSPeter Dunlap {
762a6d42e7dSPeter Dunlap 	if (!(flags & DCMD_ADDRSPEC)) {
763a6d42e7dSPeter Dunlap 		return (DCMD_ERR);
764a6d42e7dSPeter Dunlap 	}
7655819f75eSPeter Gill 	return (iscsi_refcnt_impl(addr));
766a6d42e7dSPeter Dunlap }
767a6d42e7dSPeter Dunlap 
768a6d42e7dSPeter Dunlap /*
769a6d42e7dSPeter Dunlap  * ::iscsi_states
770a6d42e7dSPeter Dunlap  *
771a6d42e7dSPeter Dunlap  * iscsi_states - Dump events and state transitions recoreded in an
772a6d42e7dSPeter Dunlap  * idm_sm_audit_t structure
773a6d42e7dSPeter Dunlap  *
774a6d42e7dSPeter Dunlap  */
775a6d42e7dSPeter Dunlap /*ARGSUSED*/
776a6d42e7dSPeter Dunlap static int
iscsi_states(uintptr_t addr,uint_t flags,int argc,const mdb_arg_t * argv)777a6d42e7dSPeter Dunlap iscsi_states(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
778a6d42e7dSPeter Dunlap {
779a6d42e7dSPeter Dunlap 	if (!(flags & DCMD_ADDRSPEC)) {
780a6d42e7dSPeter Dunlap 		return (DCMD_ERR);
781a6d42e7dSPeter Dunlap 	}
7825819f75eSPeter Gill 	return (iscsi_sm_audit_impl(addr));
783a6d42e7dSPeter Dunlap }
784a6d42e7dSPeter Dunlap 
78530e7468fSPeter Dunlap 
786a6d42e7dSPeter Dunlap static int
iscsi_walk_all_sess(iscsi_dcmd_ctrl_t * idc)787a6d42e7dSPeter Dunlap iscsi_walk_all_sess(iscsi_dcmd_ctrl_t *idc)
788a6d42e7dSPeter Dunlap {
789a6d42e7dSPeter Dunlap 	uintptr_t	iscsit_global_addr;
790a6d42e7dSPeter Dunlap 	uintptr_t	avl_addr;
791a6d42e7dSPeter Dunlap 	uintptr_t	list_addr;
792a6d42e7dSPeter Dunlap 	GElf_Sym	sym;
7935819f75eSPeter Gill 
79430e7468fSPeter Dunlap 	/* Initiator sessions */
79530e7468fSPeter Dunlap 	if (idc->idc_ini) {
7965819f75eSPeter Gill 		/* Always print hba info on this path */
7975819f75eSPeter Gill 		idc->u.child.idc_hba = 1;
7985819f75eSPeter Gill 		if (mdb_pwalk("iscsi_ini_hba", iscsi_ini_hba_walk_cb,
799892ad162SToomas Soome 		    idc, 0) == -1) {
8005819f75eSPeter Gill 			mdb_warn("iscsi cmd hba list walk failed");
80130e7468fSPeter Dunlap 			return (DCMD_ERR);
80230e7468fSPeter Dunlap 		}
8035819f75eSPeter Gill 		return (DCMD_OK);
80430e7468fSPeter Dunlap 	}
8055819f75eSPeter Gill 
80630e7468fSPeter Dunlap 	/* Target sessions */
807a6d42e7dSPeter Dunlap 	/* Walk discovery sessions */
808a6d42e7dSPeter Dunlap 	if (mdb_lookup_by_name("iscsit_global", &sym) == -1) {
809a6d42e7dSPeter Dunlap 		mdb_warn("failed to find symbol 'iscsit_global'");
810a6d42e7dSPeter Dunlap 		return (DCMD_ERR);
811a6d42e7dSPeter Dunlap 	}
812a6d42e7dSPeter Dunlap 	iscsit_global_addr = (uintptr_t)sym.st_value;
813a6d42e7dSPeter Dunlap 	avl_addr = iscsit_global_addr +
814a6d42e7dSPeter Dunlap 	    offsetof(iscsit_global_t, global_discovery_sessions);
815a6d42e7dSPeter Dunlap 	if (mdb_pwalk("avl", iscsi_sess_walk_cb, idc, avl_addr) == -1) {
816a6d42e7dSPeter Dunlap 		mdb_warn("avl walk failed for discovery sessions");
817a6d42e7dSPeter Dunlap 		return (DCMD_ERR);
818a6d42e7dSPeter Dunlap 	}
819a6d42e7dSPeter Dunlap 
820a6d42e7dSPeter Dunlap 	/* Walk targets printing all session info */
821a6d42e7dSPeter Dunlap 	avl_addr = iscsit_global_addr +
822a6d42e7dSPeter Dunlap 	    offsetof(iscsit_global_t, global_target_list);
823a6d42e7dSPeter Dunlap 	if (mdb_pwalk("avl", iscsi_tgt_walk_cb, idc, avl_addr) == -1) {
824a6d42e7dSPeter Dunlap 		mdb_warn("avl walk failed for target/session tree");
825a6d42e7dSPeter Dunlap 		return (DCMD_ERR);
826a6d42e7dSPeter Dunlap 	}
827a6d42e7dSPeter Dunlap 
828a6d42e7dSPeter Dunlap 	/* Walk deleting targets printing all session info */
829a6d42e7dSPeter Dunlap 	list_addr = iscsit_global_addr +
830a6d42e7dSPeter Dunlap 	    offsetof(iscsit_global_t, global_deleted_target_list);
831a6d42e7dSPeter Dunlap 	if (mdb_pwalk("list", iscsi_tgt_walk_cb, idc, list_addr) == -1) {
832a6d42e7dSPeter Dunlap 		mdb_warn("list walk failed for deleted target list");
833a6d42e7dSPeter Dunlap 		return (DCMD_ERR);
834a6d42e7dSPeter Dunlap 	}
835a6d42e7dSPeter Dunlap 
836a6d42e7dSPeter Dunlap 	return (DCMD_OK);
837a6d42e7dSPeter Dunlap }
838a6d42e7dSPeter Dunlap 
839a6d42e7dSPeter Dunlap static int
iscsi_walk_all_conn(iscsi_dcmd_ctrl_t * idc)840a6d42e7dSPeter Dunlap iscsi_walk_all_conn(iscsi_dcmd_ctrl_t *idc)
841a6d42e7dSPeter Dunlap {
842a6d42e7dSPeter Dunlap 	uintptr_t	idm_global_addr;
843a6d42e7dSPeter Dunlap 	uintptr_t	list_addr;
844a6d42e7dSPeter Dunlap 	GElf_Sym	sym;
845a6d42e7dSPeter Dunlap 
846a6d42e7dSPeter Dunlap 	/* Walk initiator connections */
847a6d42e7dSPeter Dunlap 	if (mdb_lookup_by_name("idm", &sym) == -1) {
848a6d42e7dSPeter Dunlap 		mdb_warn("failed to find symbol 'idm'");
849a6d42e7dSPeter Dunlap 		return (DCMD_ERR);
850a6d42e7dSPeter Dunlap 	}
851a6d42e7dSPeter Dunlap 	idm_global_addr = (uintptr_t)sym.st_value;
852a6d42e7dSPeter Dunlap 	/* Walk connection list associated with the initiator */
853a6d42e7dSPeter Dunlap 	list_addr = idm_global_addr + offsetof(idm_global_t, idm_ini_conn_list);
854a6d42e7dSPeter Dunlap 	if (mdb_pwalk("list", iscsi_conn_walk_cb, idc, list_addr) == -1) {
855a6d42e7dSPeter Dunlap 		mdb_warn("list walk failed for initiator connections");
856a6d42e7dSPeter Dunlap 		return (DCMD_ERR);
857a6d42e7dSPeter Dunlap 	}
858a6d42e7dSPeter Dunlap 
859a6d42e7dSPeter Dunlap 	/* Walk connection list associated with the target */
860a6d42e7dSPeter Dunlap 	list_addr = idm_global_addr + offsetof(idm_global_t, idm_tgt_conn_list);
861a6d42e7dSPeter Dunlap 	if (mdb_pwalk("list", iscsi_conn_walk_cb, idc, list_addr) == -1) {
862a6d42e7dSPeter Dunlap 		mdb_warn("list walk failed for target service instances");
863a6d42e7dSPeter Dunlap 		return (DCMD_ERR);
864a6d42e7dSPeter Dunlap 	}
865a6d42e7dSPeter Dunlap 
866a6d42e7dSPeter Dunlap 	return (DCMD_OK);
867a6d42e7dSPeter Dunlap }
868a6d42e7dSPeter Dunlap 
869a6d42e7dSPeter Dunlap /*ARGSUSED*/
870a6d42e7dSPeter Dunlap static int
iscsi_tpg_walk_cb(uintptr_t addr,const void * list_walker_data,void * idc_void)871a6d42e7dSPeter Dunlap iscsi_tpg_walk_cb(uintptr_t addr, const void *list_walker_data,
872a6d42e7dSPeter Dunlap     void *idc_void)
873a6d42e7dSPeter Dunlap {
874a6d42e7dSPeter Dunlap 	/* We don't particularly care about the list walker data */
875a6d42e7dSPeter Dunlap 	iscsi_dcmd_ctrl_t	*idc = idc_void;
876a6d42e7dSPeter Dunlap 	int			rc;
877a6d42e7dSPeter Dunlap 
878a6d42e7dSPeter Dunlap 	rc = iscsi_tpg_impl(addr, idc);
879a6d42e7dSPeter Dunlap 
880a6d42e7dSPeter Dunlap 	return ((rc == DCMD_OK) ? WALK_NEXT : WALK_ERR);
881a6d42e7dSPeter Dunlap }
882a6d42e7dSPeter Dunlap 
883a6d42e7dSPeter Dunlap /*ARGSUSED*/
884a6d42e7dSPeter Dunlap static int
iscsi_tgt_walk_cb(uintptr_t addr,const void * list_walker_data,void * idc_void)885a6d42e7dSPeter Dunlap iscsi_tgt_walk_cb(uintptr_t addr, const void *list_walker_data,
886a6d42e7dSPeter Dunlap     void *idc_void)
887a6d42e7dSPeter Dunlap {
888a6d42e7dSPeter Dunlap 	/* We don't particularly care about the list walker data */
889a6d42e7dSPeter Dunlap 	iscsi_dcmd_ctrl_t	*idc = idc_void;
890a6d42e7dSPeter Dunlap 	int			rc;
891a6d42e7dSPeter Dunlap 
892a6d42e7dSPeter Dunlap 	rc = iscsi_tgt_impl(addr, idc);
893a6d42e7dSPeter Dunlap 
894a6d42e7dSPeter Dunlap 	return ((rc == DCMD_OK) ? WALK_NEXT : WALK_ERR);
895a6d42e7dSPeter Dunlap }
896a6d42e7dSPeter Dunlap 
897a6d42e7dSPeter Dunlap /*ARGSUSED*/
898a6d42e7dSPeter Dunlap static int
iscsi_tpgt_walk_cb(uintptr_t addr,const void * list_walker_data,void * idc_void)899a6d42e7dSPeter Dunlap iscsi_tpgt_walk_cb(uintptr_t addr, const void *list_walker_data,
900a6d42e7dSPeter Dunlap     void *idc_void)
901a6d42e7dSPeter Dunlap {
902a6d42e7dSPeter Dunlap 	/* We don't particularly care about the list walker data */
903a6d42e7dSPeter Dunlap 	iscsi_dcmd_ctrl_t	*idc = idc_void;
904a6d42e7dSPeter Dunlap 	int			rc;
905a6d42e7dSPeter Dunlap 
906a6d42e7dSPeter Dunlap 	rc = iscsi_tpgt_impl(addr, idc);
907a6d42e7dSPeter Dunlap 
908a6d42e7dSPeter Dunlap 	return ((rc == DCMD_OK) ? WALK_NEXT : WALK_ERR);
909a6d42e7dSPeter Dunlap }
910a6d42e7dSPeter Dunlap 
911a6d42e7dSPeter Dunlap /*ARGSUSED*/
912a6d42e7dSPeter Dunlap static int
iscsi_portal_walk_cb(uintptr_t addr,const void * list_walker_data,void * idc_void)913a6d42e7dSPeter Dunlap iscsi_portal_walk_cb(uintptr_t addr, const void *list_walker_data,
914a6d42e7dSPeter Dunlap     void *idc_void)
915a6d42e7dSPeter Dunlap {
916a6d42e7dSPeter Dunlap 	/* We don't particularly care about the list walker data */
917a6d42e7dSPeter Dunlap 	iscsi_dcmd_ctrl_t	*idc = idc_void;
918a6d42e7dSPeter Dunlap 	int			rc;
919a6d42e7dSPeter Dunlap 
920a6d42e7dSPeter Dunlap 	rc = iscsi_portal_impl(addr, idc);
921a6d42e7dSPeter Dunlap 
922a6d42e7dSPeter Dunlap 	return ((rc == DCMD_OK) ? WALK_NEXT : WALK_ERR);
923a6d42e7dSPeter Dunlap }
924a6d42e7dSPeter Dunlap 
925a6d42e7dSPeter Dunlap /*ARGSUSED*/
926a6d42e7dSPeter Dunlap static int
iscsi_sess_walk_cb(uintptr_t addr,const void * list_walker_data,void * idc_void)927a6d42e7dSPeter Dunlap iscsi_sess_walk_cb(uintptr_t addr, const void *list_walker_data,
928a6d42e7dSPeter Dunlap     void *idc_void)
929a6d42e7dSPeter Dunlap {
930a6d42e7dSPeter Dunlap 	/* We don't particularly care about the list walker data */
931