idm.c revision e42a0851889d583925aa3bd2d9bd139189031cb0
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/mdb_modapi.h>
#include <sys/sysmacros.h>
#include <sys/stmf_ioctl.h>
#define IDM_CONN_SM_STRINGS
#define IDM_TASK_SM_STRINGS
#define ISCSIT_TGT_SM_STRINGS
#define ISCSIT_SESS_SM_STRINGS
#define ISCSIT_LOGIN_SM_STRINGS
#define ISCSI_SESS_SM_STRINGS
#define ISCSI_CMD_SM_STRINGS
#define ISCSI_ICS_NAMES
#define ISCSI_LOGIN_STATE_NAMES
#include <iscsit.h>
#include <iscsit_isns.h>
#include <iscsi.h>
/*
* We want to be able to print multiple levels of object hierarchy with a
* single dcmd information, and preferably also exclude intermediate
* levels if desired. For example some of the target objects have the
* following relationship:
*
* target --> session --> connection --> task
*
* The session dcmd should allow the printing of all associated tasks for the
* sessions without printing all the associated connections. To accomplish
* this the following structure contains a bit for each object type. Dcmds
* should invoked the functions for child objects if any bits are set
* in iscsi_dcmd_ctrl_t but the functions for the child object should only
* print data if their associated bit is set.
*
* Each dcmd should provide an external interface with the standard MDB API
* and an internal interface that accepts iscsi_dcmd_ctrl_t. To display
* child objects the dcmd calls the internal interface for the child object
* directly. Dcmds invoked from the command line will, of course, call the
* external interface. See iscsi_conn() and iscsi_conn_impl().
*/
typedef struct {
union {
struct {
idc_tpgt:1,
idc_portal:1,
idc_sess:1,
idc_conn:1,
idc_print_ip:1,
idc_task:1,
idc_buffer:1,
idc_states:1,
idc_rc_audit:1,
idc_lun:1,
idc_hba:1;
} child;
} u;
/*
* Our connection dcmd code works off the global connection lists
* in IDM since we want to know about connections even when they
* have not progressed to the point that they have an associated
* session. If we use "::iscsi_sess [-c]" then we only want to
* see connections associated with particular session. To avoid
* writing a separate set of code to print session-specific connection
* the session code should set the sessions kernel address in the
* following field. The connection code will then only print
* connections that match.
*/
void *idc_void);
void *idc_void);
void *idc_void);
void *idc_void);
void *idc_void);
void *idc_void);
void *idc_void);
static const char *iscsi_idm_conn_event(unsigned int event);
static const char *iscsi_iscsit_tgt_event(unsigned int event);
static const char *iscsi_iscsit_sess_event(unsigned int event);
static const char *iscsi_iscsit_login_event(unsigned int event);
static const char *iscsi_iscsi_cmd_event(unsigned int event);
static const char *iscsi_iscsi_sess_event(unsigned int event);
static const char *iscsi_idm_conn_state(unsigned int state);
static const char *iscsi_idm_task_state(unsigned int state);
static const char *iscsi_iscsit_tgt_state(unsigned int state);
static const char *iscsi_iscsit_sess_state(unsigned int state);
static const char *iscsi_iscsit_login_state(unsigned int state);
static const char *iscsi_iscsi_cmd_state(unsigned int state);
static const char *iscsi_iscsi_sess_state(unsigned int state);
static const char *iscsi_iscsi_conn_state(unsigned int state);
static const char *iscsi_iscsi_login_state(unsigned int state);
timespec_t *ts);
static void convert2ascii(char *, const in6_addr_t *);
void *data);
void *data);
/*
* ::iscsi_tgt [-scatgpbSRv]
*
* iscsi_tgt - Print out information associated with an iscsit target instance
*
* s Print associated session information
* c Print associated connection information
* a Print IP addresses with connection information
* t Print associated task information
* g Print associated TPG information
* p Print portals with TPG information
* b Print associated buffer information
* S Print recent state events and transitions
* R Print reference count audit data
* v Verbose output about the connection
*/
/*ARGSUSED*/
static int
{
return (DCMD_USAGE);
if (DCMD_HDRSPEC(flags))
/*
* If no address was specified on the command line, we
* print out all tgtions
*/
if (!(flags & DCMD_ADDRSPEC)) {
mdb_warn("failed to find symbol 'iscsit_global'");
return (DCMD_ERR);
}
mdb_warn("avl walk failed for global target tree");
return (DCMD_ERR);
}
mdb_warn("list walk failed for deleted target list");
return (DCMD_ERR);
}
return (DCMD_OK);
} else {
}
/*NOTREACHED*/
}
static int
{
return (DCMD_USAGE);
if (DCMD_HDRSPEC(flags))
/*
* If no address was specified on the command line, we
* print out all tgtions
*/
if (!(flags & DCMD_ADDRSPEC)) {
mdb_warn("failed to find symbol 'iscsit_global'");
return (DCMD_ERR);
}
mdb_warn("avl walk failed for global target tree");
return (DCMD_ERR);
}
return (DCMD_OK);
} else {
}
/*NOTREACHED*/
}
/*
* ::iscsi_sess [-bctvIT]
*
* iscsi_sess - Print out information associated with an iSCSI session
*
* I Print only initiator sessions
* T Print only target sessions
* c Print associated connection information
* a Print IP addresses with connection information
* t Print associated task information
* b Print associated buffer information
* S Print recent state events and transitions
* R Print reference count audit data
* v Verbose output about the connection
*/
/*ARGSUSED*/
static int
{
return (DCMD_USAGE);
if (DCMD_HDRSPEC(flags))
/*
* If no address was specified on the command line, we
* print out all sessions
*/
if (!(flags & DCMD_ADDRSPEC)) {
return (iscsi_walk_all_sess(&idc));
} else {
}
/*NOTREACHED*/
}
/*
* ::iscsi_conn [-btvIT]
*
* iscsi_conn - Print out information associated with an iSCSI connection
*
* I Print only initiator connections
* T Print only target connections
* a Print IP addresses with connection information
* t Print associated task information
* b Print associated buffer information
* S Print recent state events and transitions
* R Print reference count audit data
* v Verbose output about the connection
*/
/*ARGSUSED*/
static int
{
return (DCMD_USAGE);
if (DCMD_HDRSPEC(flags))
/*
* If no address was specified on the command line, we
* print out all connections
*/
if (!(flags & DCMD_ADDRSPEC)) {
return (iscsi_walk_all_conn(&idc));
} else {
}
/*NOTREACHED*/
}
/*
* ::iscsi_task [-bv]
*
* iscsi_task - Print out information associated with an iSCSI task
*
* b Print associated buffer information
* S Print recent state events and transitions
* R Print reference count audit data
* v Verbose output about the connection
*/
/*ARGSUSED*/
static int
{
int buffer = 0;
return (DCMD_USAGE);
if (DCMD_HDRSPEC(flags))
/*
* If no address was specified on the command line, we
* print out all connections
*/
if (!(flags & DCMD_ADDRSPEC)) {
return (iscsi_walk_all_conn(&idc));
} else {
}
/*NOTREACHED*/
}
/*
* ::iscsi_refcnt
*
* iscsi_refcnt - Dump an idm_refcnt_t structure
*
*/
/*ARGSUSED*/
static int
{
if (!(flags & DCMD_ADDRSPEC)) {
return (DCMD_ERR);
} else {
return (iscsi_refcnt_impl(addr));
}
/*NOTREACHED*/
}
/*
* ::iscsi_states
*
* iscsi_states - Dump events and state transitions recoreded in an
* idm_sm_audit_t structure
*
*/
/*ARGSUSED*/
static int
{
if (!(flags & DCMD_ADDRSPEC)) {
return (DCMD_ERR);
} else {
return (iscsi_sm_audit_impl(addr));
}
/*NOTREACHED*/
}
/*
* Helper function to list all the initiator sessions
*/
static int
{
int i;
int array_size;
struct i_ddi_soft_state *ss;
mdb_warn("Cannot read softstate struct (Invalid pointer?).\n");
return (DCMD_ERR);
}
mdb_warn("Corrupted softstate struct.\n");
return (DCMD_ERR);
}
continue;
!= sizeof (ihp)) {
mdb_warn("Corrupted softstate struct.\n");
return (DCMD_ERR);
}
mdb_printf("%<u>%-19s %-4s %-8s%</u>\n",
"Session", "Type", "State");
mdb_warn("Failed to read session\n");
return (DCMD_ERR);
}
}
}
return (DCMD_OK);
}
static int
{
/* Initiator sessions */
mdb_warn("state variable iscsi_state not found.\n");
mdb_warn("Is the driver loaded ?\n");
return (DCMD_ERR);
}
return (iscsi_walk_ini_sessions(adr));
}
/* Target sessions */
/* Walk discovery sessions */
mdb_warn("failed to find symbol 'iscsit_global'");
return (DCMD_ERR);
}
mdb_warn("avl walk failed for discovery sessions");
return (DCMD_ERR);
}
/* Walk targets printing all session info */
return (DCMD_ERR);
}
/* Walk deleting targets printing all session info */
mdb_warn("list walk failed for deleted target list");
return (DCMD_ERR);
}
return (DCMD_OK);
}
static int
{
/* Walk initiator connections */
mdb_warn("failed to find symbol 'idm'");
return (DCMD_ERR);
}
/* Walk connection list associated with the initiator */
mdb_warn("list walk failed for initiator connections");
return (DCMD_ERR);
}
/* Walk connection list associated with the target */
mdb_warn("list walk failed for target service instances");
return (DCMD_ERR);
}
return (DCMD_OK);
}
/*ARGSUSED*/
static int
void *idc_void)
{
/* We don't particularly care about the list walker data */
int rc;
}
/*ARGSUSED*/
static int
void *idc_void)
{
/* We don't particularly care about the list walker data */
int rc;
}
/*ARGSUSED*/
static int
void *idc_void)
{
/* We don't particularly care about the list walker data */
int rc;
}
/*ARGSUSED*/
static int
void *idc_void)
{
/* We don't particularly care about the list walker data */
int rc;
}
/*ARGSUSED*/
static int
void *idc_void)
{
/* We don't particularly care about the list walker data */
int rc;
}
/*ARGSUSED*/
static int
void *idc_void)
{
/* We don't particularly care about the list walker data */
int rc;
/*
* This function is different from iscsi_conn_walk_cb because
* we get an iscsit_conn_t instead of an idm_conn_t
*
* Read iscsit_conn_t, use to get idm_conn_t pointer
*/
sizeof (iscsit_conn_t)) {
return (DCMD_ERR);
}
}
/*ARGSUSED*/
static int
void *idc_void)
{
/* We don't particularly care about the list walker data */
int rc;
}
/*ARGSUSED*/
static int
void *idc_void)
{
/* We don't particularly care about the list walker data */
int rc;
}
static int
{
char tgt_name[MAX_ISCSI_NODENAMELEN];
/*
* Read iscsit_tgt_t
*/
sizeof (iscsit_tgt_t)) {
return (DCMD_ERR);
}
/*
* Read target name if available
*/
}
/*
* Brief output
*
* iscsit_tgt_t pointer
* iscsit_tgt_t.target_stmf_state
* iscsit_tgt_t.target_sess_list.avl_numnodes (session count)
* iscsit_tgt_t.target_name;
*/
/* For now we will ignore the verbose flag */
/* Print target data */
if (idc->idc_header) {
mdb_printf("%<u>%-19s %-4s %-8s%</u>\n",
"iscsit_tgt_t", "Sess", "State");
}
}
idc->idc_header = 0;
idc->idc_verbose = 0;
/*
* Print states if requested
*/
(void) mdb_inc_indent(4);
mdb_printf("State History:\n");
return (DCMD_ERR);
(void) mdb_dec_indent(4);
}
/*
* Print refcnt audit data if requested
*/
(void) mdb_inc_indent(4);
mdb_printf("target_sess_refcnt:\n");
return (DCMD_ERR);
mdb_printf("target_refcnt:\n");
return (DCMD_ERR);
(void) mdb_dec_indent(4);
}
/* Any child objects to walk? */
/* Walk TPGT tree */
(void) mdb_inc_indent(4);
avl_addr) == -1) {
mdb_warn("target tpgt list walk failed");
(void) mdb_dec_indent(4);
return (DCMD_ERR);
}
(void) mdb_dec_indent(4);
/* Walk sess tree */
(void) mdb_inc_indent(4);
avl_addr) == -1) {
mdb_warn("target sess list walk failed");
(void) mdb_dec_indent(4);
return (DCMD_ERR);
}
(void) mdb_dec_indent(4);
idc->idc_header = 0;
}
return (DCMD_OK);
}
static int
{
/*
* Read iscsit_tpgt_t
*/
sizeof (iscsit_tpgt_t)) {
return (DCMD_ERR);
}
/*
* Read iscsit_tpg_t
*/
sizeof (iscsit_tpg_t)) {
return (DCMD_ERR);
}
/*
* Brief output
*
* iscsit_tpgt_t pointer
* iscsit_tpg_t pointer
* iscsit_tpg_t.tpg_name
* iscsit_tpgt_t.tpgt_tag;
*/
/* For now we will ignore the verbose flag */
/* Print target data */
if (idc->idc_header) {
mdb_printf("%<u>%-?s %-?s %-18s %-6s%</u>\n",
"iscsit_tpgt_t", "iscsit_tpg_t", "Name", "Tag");
}
}
/*
* Assume for now that anyone interested in TPGT wants to see the
* portals as well.
*/
(void) mdb_inc_indent(4);
mdb_warn("portal list walk failed");
(void) mdb_dec_indent(4);
return (DCMD_ERR);
}
(void) mdb_dec_indent(4);
idc->idc_header = 0;
return (DCMD_OK);
}
static int
{
/*
* Read iscsit_tpg_t
*/
sizeof (iscsit_tpg_t)) {
return (DCMD_ERR);
}
/*
* Brief output
*
* iscsit_tpgt_t pointer
* iscsit_tpg_t pointer
* iscsit_tpg_t.tpg_name
* iscsit_tpgt_t.tpgt_tag;
*/
/* For now we will ignore the verbose flag */
/* Print target data */
if (idc->idc_header) {
mdb_printf("%<u>%-?s %-18s%</u>\n",
"iscsit_tpg_t", "Name");
}
/*
* Assume for now that anyone interested in TPG wants to see the
* portals as well.
*/
(void) mdb_inc_indent(4);
mdb_warn("portal list walk failed");
(void) mdb_dec_indent(4);
return (DCMD_ERR);
}
(void) mdb_dec_indent(4);
idc->idc_header = 0;
return (DCMD_OK);
}
static int
{
char portal_addr[PORTAL_STR_LEN];
/*
* Read iscsit_portal_t
*/
sizeof (iscsit_portal_t)) {
return (DCMD_ERR);
}
/* Print portal data */
if (idc->idc_header) {
mdb_printf("%<u>%-?s %-?s %-30s%</u>\n",
"iscsit_portal_t", "idm_svc_t", "IP:Port");
}
}
return (DCMD_OK);
}
static int
{
char ini_name[80];
char tgt_name[80];
/*
* Read iscsit_sess_t
*/
sizeof (iscsit_sess_t)) {
return (DCMD_ERR);
}
/*
* Brief output
*
* iscsit_sess_t pointer
* iscsit_sess_t.ist_tsih
* iscsit_sess_t.ist_initiator_name
*/
if (verbose) {
/*
* Read initiator name if available
*/
}
/*
* Read target name if available
*/
}
ini_name);
tgt_name);
} else {
/* Print session data */
if (idc->idc_header) {
mdb_printf("%<u>%-?s %10s %-12s %-6s%</u>\n",
"TSIH");
}
mdb_printf("%?p %4d/%-4d %02x%02x%02x%02x%02x%02x "
"0x%04x\n", addr,
}
idc->idc_header = 0;
}
idc->idc_verbose = 0;
/*
* Print states if requested
*/
if (states) {
(void) mdb_inc_indent(4);
mdb_printf("State History:\n");
return (DCMD_ERR);
/* Don't print state history for child objects */
(void) mdb_dec_indent(4);
}
/*
* Print refcnt audit data if requested
*/
if (rc_audit) {
(void) mdb_inc_indent(4);
mdb_printf("Reference History:\n");
return (DCMD_ERR);
/* Don't print audit data for child objects */
(void) mdb_dec_indent(4);
}
/* Any child objects to walk? */
/* Walk conn list */
(void) mdb_inc_indent(4);
list_addr) == -1) {
mdb_warn("session conn list walk failed");
(void) mdb_dec_indent(4);
return (DCMD_ERR);
}
(void) mdb_dec_indent(4);
idc->idc_header = 0;
}
return (DCMD_OK);
}
static int
{
char *conn_type;
int task_idx;
char laddr[PORTAL_STR_LEN];
char raddr[PORTAL_STR_LEN];
/*
* Get pointer to task table
*/
mdb_warn("failed to find symbol 'idm'");
return (DCMD_ERR);
}
sizeof (uintptr_t)) {
mdb_warn("Failed to read address of task table");
return (DCMD_ERR);
}
/*
* Read idm_conn_t
*/
return (DCMD_ERR);
}
/*
* Brief output
*
* idm_conn_t pointer
* idm_conn_t.ic_conn_type
* idm_conn_t.ic_statet+idm_conn_t.ic_ffp
*/
if (idc->idc_verbose) {
} else {
}
} else {
/* Print connection data */
if (idc->idc_header) {
mdb_printf("%<u>%-?s %-6s %-10s %12s%</u>\n",
"idm_conn_t", "Type", "Transport",
}
(ic.ic_transport_type ==
IDM_TRANSPORT_TYPE_ISER) ? "ISER_IB" :
(ic.ic_transport_type ==
IDM_TRANSPORT_TYPE_SOCKETS) ? "SOCKETS" :
"N/A",
mdb_printf(" L%s R%s\n",
}
}
}
idc->idc_header = 0;
idc->idc_verbose = 0;
/*
* Print states if requested
*/
if (states) {
(void) mdb_inc_indent(4);
mdb_printf("State History:\n");
return (DCMD_ERR);
/* Don't print state history for child objects */
(void) mdb_dec_indent(4);
}
/*
* Print refcnt audit data if requested
*/
if (rc_audit) {
(void) mdb_inc_indent(4);
mdb_printf("Reference History:\n");
return (DCMD_ERR);
/* Don't print audit data for child objects */
(void) mdb_dec_indent(4);
}
task_idx = 0;
/* Any child objects to walk? */
while (task_idx < IDM_TASKIDS_MAX) {
/*
* Read the next idm_task_t
*/
mdb_warn("Failed to read task pointer");
return (DCMD_ERR);
}
task_idx++;
continue;
}
!= sizeof (idm_task_t)) {
mdb_warn("Failed to read task pointer");
return (DCMD_ERR);
}
(void) mdb_inc_indent(4);
== -1) {
mdb_warn("Failed to walk connection "
"task tree");
(void) mdb_dec_indent(4);
return (DCMD_ERR);
}
(void) mdb_dec_indent(4);
}
task_idx++;
}
idc->idc_header = 0;
}
return (DCMD_OK);
}
static void
{
char *csg;
char *nsg;
mdb_printf("**Failed to read conn private data\n");
return;
}
csg = "Security";
break;
csg = "Operational";
break;
case ISCSI_FULL_FEATURE_PHASE:
csg = "FFP";
break;
default:
csg = "Unknown";
}
nsg = "Security";
break;
nsg = "Operational";
break;
case ISCSI_FULL_FEATURE_PHASE:
nsg = "FFP";
break;
default:
nsg = "Unknown";
}
}
}
}
static void
{
char laddr[PORTAL_STR_LEN];
char raddr[PORTAL_STR_LEN];
"Unknown")));
ic->ic_svc_binding);
}
"N/A");
ic->ic_last_state);
"UNKNOWN")));
}
static int
{
if (verbose) {
(void) mdb_inc_indent(2);
if (conn_type == CONN_TYPE_TGT) {
}
(void) mdb_dec_indent(2);
} else {
/* Print task data */
if (idc->idc_header) {
"%<u>%-?s %-16s %-4s %-8s %-8s%</u>\n",
"Tasks:", "State", "Ref",
"TT")), "Handle");
}
}
}
idc->idc_header = 0;
idc->idc_verbose = 0;
/*
* Print states if requested
*/
#if 0
if (states) {
(void) mdb_inc_indent(4);
mdb_printf("State History:\n");
return (DCMD_ERR);
/* Don't print state history for child objects */
(void) mdb_dec_indent(4);
}
#endif
/*
* Print refcnt audit data if requested
*/
if (rc_audit) {
(void) mdb_inc_indent(4);
mdb_printf("Reference History:\n");
return (DCMD_ERR);
/* Don't print audit data for child objects */
(void) mdb_dec_indent(4);
}
/* Buffers are leaf objects */
/* Walk in buffer list */
(void) mdb_inc_indent(2);
mdb_printf("In buffers:\n");
(void) mdb_inc_indent(2);
-1) {
mdb_warn("list walk failed for task in buffers");
(void) mdb_dec_indent(4);
return (DCMD_ERR);
}
(void) mdb_dec_indent(2);
/* Walk out buffer list */
mdb_printf("Out buffers:\n");
(void) mdb_inc_indent(2);
-1) {
mdb_warn("list walk failed for task out buffers\n");
(void) mdb_dec_indent(2);
return (DCMD_ERR);
}
(void) mdb_dec_indent(4);
}
return (DCMD_OK);
}
static int
{
/*
* Read idm_conn_t
*/
return (DCMD_ERR);
}
}
#define ISCSI_CDB_INDENT 16
static void
{
mdb_printf("**Failed to read idt_private data\n");
return;
}
}
mdb_printf("%20s: %p/%p/%p%s\n",
if (good_scsi_task) {
mdb_printf("%20s: %02x %02x %02x %02x %02x %02x %02x %02x\n",
"LU number",
mdb_printf(" CDB (%d bytes):\n",
(void) mdb_inc_indent(ISCSI_CDB_INDENT);
MDB_DUMP_GROUP(1),
mdb_printf("** Invalid CDB addr (%p)\n",
}
(void) mdb_dec_indent(ISCSI_CDB_INDENT);
}
}
static int
{
/*
* Read idm_buf_t
*/
return (DCMD_ERR);
}
if (idc->idc_header) {
mdb_printf("%<u>%-?s %?s/%-8s %8s %8s %8s%</u>\n",
"idm_buf_t", "Mem Rgn", "Length",
"Rel Off", "Xfer Len", "Exp. Off");
}
idc->idc_header = 0;
/* Print buffer data */
/* Buffers are leaf objects */
return (DCMD_OK);
}
static int
{
int ctr;
/*
* Print refcnt info
*/
sizeof (idm_refcnt_t)) {
return (DCMD_ERR);
}
while (ctr) {
char c[MDB_SYM_NAMLEN];
int i;
MDB_SYM_FUZZY, c, sizeof (c),
&sym) == -1) {
continue;
}
mdb_printf("%s+0x%1x", c,
++i;
break;
}
MDB_SYM_FUZZY, c, sizeof (c),
&sym) == -1) {
++i;
continue;
}
mdb_printf("\n\t\t%s+0x%1x", c,
++i;
}
mdb_printf("\n");
}
ctr--;
}
return (DCMD_OK);
}
static int
{
int ctr;
const char *event_name;
const char *state_name;
const char *new_state_name;
char ts_string[40];
/*
* Print refcnt info
*/
sizeof (sm_audit_buf_t)) {
return (DCMD_ERR);
}
while (ctr) {
case SAR_STATE_EVENT:
switch (sar->sar_sm_type) {
case SAS_IDM_CONN:
break;
case SAS_ISCSIT_TGT:
break;
case SAS_ISCSIT_SESS:
break;
case SAS_ISCSIT_LOGIN:
break;
case SAS_ISCSI_CMD:
break;
case SAS_ISCSI_SESS:
break;
default:
break;
}
mdb_printf("%s|%s (%d)\n\t%9s %s (%d) %p\n",
"Event", event_name,
break;
case SAR_STATE_CHANGE:
switch (sar->sar_sm_type) {
case SAS_IDM_CONN:
break;
case SAS_IDM_TASK:
break;
case SAS_ISCSIT_TGT:
break;
case SAS_ISCSIT_SESS:
break;
case SAS_ISCSIT_LOGIN:
sar->sar_new_state);
break;
case SAS_ISCSI_CMD:
break;
case SAS_ISCSI_SESS:
break;
case SAS_ISCSI_CONN:
break;
case SAS_ISCSI_LOGIN:
break;
default:
break;
}
mdb_printf("%s|%s (%d)\n\t%9s %s (%d)\n",
default:
break;
}
ctr--;
}
return (DCMD_OK);
}
static const char *
iscsi_idm_conn_event(unsigned int event)
{
}
static const char *
iscsi_iscsit_tgt_event(unsigned int event)
{
}
static const char *
iscsi_iscsit_sess_event(unsigned int event)
{
}
static const char *
iscsi_iscsit_login_event(unsigned int event)
{
}
static const char *
iscsi_iscsi_cmd_event(unsigned int event)
{
return ((event < ISCSI_CMD_EVENT_MAX) ?
}
static const char *
iscsi_iscsi_sess_event(unsigned int event)
{
return ((event < ISCSI_SESS_EVENT_MAX) ?
}
static const char *
iscsi_idm_conn_state(unsigned int state)
{
}
/*ARGSUSED*/
static const char *
iscsi_idm_task_state(unsigned int state)
{
return ("N/A");
}
static const char *
iscsi_iscsit_tgt_state(unsigned int state)
{
}
static const char *
iscsi_iscsit_sess_state(unsigned int state)
{
}
static const char *
iscsi_iscsit_login_state(unsigned int state)
{
}
static const char *
iscsi_iscsi_cmd_state(unsigned int state)
{
return ((state < ISCSI_CMD_STATE_MAX) ?
}
static const char *
iscsi_iscsi_sess_state(unsigned int state)
{
return ((state < ISCSI_SESS_STATE_MAX) ?
}
static const char *
iscsi_iscsi_conn_state(unsigned int state)
{
}
static const char *
iscsi_iscsi_login_state(unsigned int state)
{
}
/*
* Retrieve connection type given a kernel address
*/
static idm_conn_type_t
{
return (result);
}
/*
* Convert a sockaddr to the string representation, suitable for
* storing in an nvlist or printing out in a list.
*/
static int
{
char pbuf[7];
const char *bufp;
struct sockaddr_in *sin;
struct sockaddr_in6 *sin6;
return (EINVAL);
}
buf[0] = '\0';
return (-1);
}
return (-1);
}
} else {
return (EINVAL);
}
return (0);
}
static void
{
}
/*
* Help information for the iscsi_isns dcmd
*/
static void
iscsi_isns_help(void)
{
mdb_printf("iscsi_isns:\n");
mdb_inc_indent(4);
mdb_printf("-e: Print ESI information\n");
mdb_printf("-p: Print portal information\n");
mdb_printf("-s: Print iSNS server information\n");
mdb_printf("-t: Print target information\n");
mdb_printf("-v: Add verbosity to the other options' output\n");
mdb_dec_indent(4);
}
/* ARGSUSED */
static int
{
sizeof (isns_esi_tinfo_t)) {
return (WALK_ERR);
}
mdb_printf("ESI thread running : %s\n",
return (WALK_NEXT);
}
static int
{
mdb_warn("failed to find symbol 'esi_list'");
return (DCMD_ERR);
}
return (0);
}
/* ARGSUSED */
static int
{
char portal_addr[PORTAL_STR_LEN];
struct sockaddr_storage *ss;
char ts_string[40];
sizeof (isns_portal_list_t)) {
return (WALK_ERR);
}
mdb_printf("Portal IP address ");
} else {
}
mdb_printf(" (Default portal)\n");
} else {
mdb_printf("\n");
}
}
return (WALK_NEXT);
}
static int
{
mdb_warn("failed to find symbol 'portal_list'");
return (DCMD_ERR);
}
mdb_warn("avl walk failed for portal_list");
return (DCMD_ERR);
}
return (0);
}
/* ARGSUSED */
static int
{
int rc = 0;
sizeof (isns_target_t)) {
return (WALK_ERR);
}
mdb_inc_indent(4);
mdb_printf("Registered: %s\n",
mdb_dec_indent(4);
return (WALK_NEXT);
}
return (WALK_ERR);
}
static int
{
mdb_warn("failed to find symbol 'isns_target_list'");
return (DCMD_ERR);
}
isns_target_list) == -1) {
mdb_warn("avl walk failed for isns_target_list");
return (DCMD_ERR);
}
return (0);
}
/* ARGSUSED */
static int
{
char server_addr[PORTAL_STR_LEN];
struct sockaddr_storage *ss;
sizeof (iscsit_isns_svr_t)) {
return (WALK_ERR);
}
mdb_warn("failed to find symbol 'lbolt'");
return (DCMD_ERR);
}
sizeof (clock_t)) {
return (WALK_ERR);
}
mdb_inc_indent(4);
mdb_printf("IP address ");
} else {
}
mdb_printf("Last ESI message : %d seconds ago\n",
mdb_printf("Client registered: %s\n",
mdb_dec_indent(4);
return (WALK_ERR);
}
static int
{
mdb_warn("failed to find symbol 'iscsit_global'");
return (DCMD_ERR);
}
mdb_warn("list walk failed for iSNS servers");
return (DCMD_ERR);
}
return (0);
}
/* ARGSUSED */
static int
{
if (flags & DCMD_ADDRSPEC) {
mdb_warn("iscsi_isns is only a global dcmd.");
return (DCMD_ERR);
}
return (DCMD_USAGE);
mdb_printf("Only one of e, p, s, and t must be provided");
return (DCMD_ERR);
}
mdb_printf("Exactly one of e, p, s, or t must be provided");
return (DCMD_ERR);
}
if (esi) {
return (iscsi_isns_esi(&idc));
}
if (portals) {
return (iscsi_isns_portals(&idc));
}
if (servers) {
return (iscsi_isns_servers(&idc));
}
return (iscsi_isns_targets(&idc));
}
/*
* iscsi_inet_ntop -- Convert an IPv4 or IPv6 address in binary form into
* printable form, and return a pointer to that string. Caller should
* provide a buffer of correct length to store string into.
* Note: this routine is kernel version of inet_ntop. It has similar
* format as iscsi_inet_ntop() defined in rfc2553. But it does not do
* error handling operations exactly as rfc2553 defines. This function
* is used by kernel inet directory routines only for debugging.
* This iscsi_inet_ntop() function, does not return NULL if third argument
* is NULL. The reason is simple that we don't want kernel to panic
* as the output of this function is directly fed to ip<n>dbg macro.
* Instead it uses a local buffer for destination address for
* those calls which purposely pass NULL ptr for the destination
* buffer. This function is thread-safe when the caller passes a non-
* null buffer with the third argument.
*/
/* ARGSUSED */
#if defined(__x86)
#else
#endif
char *
{
static char local_buf[PORTAL_STR_LEN];
static char *err_buf1 = "<badaddr>";
static char *err_buf2 = "<badfamily>";
char *caddr;
/*
* We don't allow thread unsafe iscsi_inet_ntop calls, they
* must pass a non-null buffer pointer. For DEBUG mode
* we use the ASSERT() and for non-debug kernel it will
* silently allow it for now. Someday we should remove
* the static buffer from this function.
*/
buf[0] = '\0';
/* Let user know politely not to send NULL or unaligned addr */
return (err_buf1);
}
#define UC(b) (((int)b) & 0xff)
switch (af) {
case AF_INET:
"%03d.%03d.%03d.%03d",
return (buf);
case AF_INET6:
if (IN6_IS_ADDR_V4MAPPED(v6addr)) {
"::ffff:%d.%d.%d.%d",
} else if (IN6_IS_ADDR_V4COMPAT(v6addr)) {
"::%d.%d.%d.%d",
} else if (IN6_IS_ADDR_UNSPECIFIED(v6addr)) {
} else {
}
return (buf);
default:
return (err_buf2);
}
}
/*
*
* v6 formats supported
* General format xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx
* The short hand notation :: is used for COMPAT addr
* Other forms : fe80::xxxx:xxxx:xxxx:xxxx
*/
static void
{
int hexdigits;
int head_zero = 0;
int tail_zero = 0;
/* tempbuf must be big enough to hold ffff:\0 */
char tempbuf[6];
char *ptr;
/* First count if trailing zeroes higher in number */
if (*addr_component == 0) {
if (hexdigits < 4)
head_zero++;
else
tail_zero++;
}
}
/* if entry is a 0 */
if (*addr_component == 0) {
*ptr++ = '0';
*ptr++ = ':';
} else {
/*
* address starts with 0s ..
* stick in leading ':' of pair
*/
if (hexdigits == 0)
*ptr++ = ':';
/* add another */
*ptr++ = ':';
}
if (hexdigits == 7)
*ptr++ = ':';
continue;
} else {
*ptr++ = '0';
*ptr++ = ':';
}
continue;
}
if (med_zero)
tempbuf[0] = '\0';
sizeof (uint16_t));
}
*--ptr = '\0';
}
/*
* MDB module linkage information:
*
* We declare a list of structures describing our dcmds, a list of structures
* describing our walkers and a function named _mdb_init to return a pointer
* to our module information.
*/
static const mdb_dcmd_t dcmds[] = {
{ "iscsi_tgt", "[-agsctbSRv]",
"iSCSI target information", iscsi_tgt },
{ "iscsi_tpg", "[-v]",
"iSCSI target portal group information", iscsi_tpg },
{ "iscsi_sess", "[-abtvcSRIT]",
"iSCSI session information", iscsi_sess },
{ "iscsi_conn", "[-abtvSRIT]",
"iSCSI connection information", iscsi_conn },
{ "iscsi_task", "[-bSRv]",
"iSCSI task information", iscsi_task },
{ "iscsi_refcnt", "",
"Print audit informtion for idm_refcnt_t", iscsi_refcnt },
{ "iscsi_states", "",
"Dump events and state transitions recorded in an\t"
"\t\tidm_sm_audit_t structure", iscsi_states },
{ "iscsi_isns", "[-epstv]",
{ NULL }
};
/*
* No walkers for now. Initiator might need some since it doesn't use list_t
*/
static const mdb_modinfo_t modinfo = {
};
const mdb_modinfo_t *
_mdb_init(void)
{
return (&modinfo);
}