changeset 9829:e8059fcaee97

6804431 Add Dtrace probes to SRPT
author Charles Ting <Charles.Ting@Sun.COM>
date Tue, 09 Jun 2009 10:11:35 -0400
parents 31dba366f03d
children eed00643bbdd
files usr/src/lib/libdtrace/Makefile.com usr/src/lib/libdtrace/common/srp.d usr/src/pkgdefs/SUNWdtrc/prototype_com usr/src/uts/common/dtrace/sdt_subr.c usr/src/uts/common/io/comstar/port/srpt/srpt_ch.c usr/src/uts/common/io/comstar/port/srpt/srpt_cm.c usr/src/uts/common/io/comstar/port/srpt/srpt_impl.h usr/src/uts/common/io/comstar/port/srpt/srpt_ioc.c usr/src/uts/common/io/comstar/port/srpt/srpt_stp.c usr/src/uts/common/io/comstar/port/srpt/srpt_stp.h usr/src/uts/common/sys/sdt.h
diffstat 11 files changed, 377 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/lib/libdtrace/Makefile.com	Mon Jun 08 23:02:20 2009 -0700
+++ b/usr/src/lib/libdtrace/Makefile.com	Tue Jun 09 10:11:35 2009 -0400
@@ -85,6 +85,7 @@
 	sched.d \
 	signal.d \
 	scsi.d \
+	srp.d \
 	sysevent.d \
 	unistd.d
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/lib/libdtrace/common/srp.d	Tue Jun 09 10:11:35 2009 -0400
@@ -0,0 +1,156 @@
+/*
+ * 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
+ * or http://www.opensolaris.org/os/licensing.
+ * 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.
+ */
+
+#pragma	D depends_on library net.d
+#pragma D depends_on library scsi.d
+#pragma D depends_on module genunix
+#pragma	D depends_on module srpt
+
+typedef struct srp_portinfo {
+	/* initiator */
+	string  pi_initiator;	/* Initiator: eui.xxxxxxxxxxxxxxx */
+	string	pi_i_sid;	/* Initiator session id */
+
+	/* target */
+	string	pi_target;	/* Target: eui.xxxxxxxxxxxxxxx */
+	string  pi_t_sid;	/* Target session id */
+
+	uintptr_t pi_chan_id;	/* Channel identifier */
+} srp_portinfo_t;
+
+#pragma D binding "1.5" translator
+translator conninfo_t < srpt_session_t *P > {
+	ci_local = P->ss_t_gid;
+	ci_remote = P->ss_i_gid;
+	ci_protocol = "ib";
+};
+
+#pragma D binding "1.5" translator
+translator srp_portinfo_t < srpt_session_t *P > {
+	pi_initiator = P->ss_i_name;
+	pi_i_sid = P->ss_i_alias;
+	pi_target = P->ss_t_name;
+	pi_t_sid = P->ss_t_alias;
+	pi_chan_id = 0; 
+};
+
+#pragma D binding "1.5" translator
+translator conninfo_t < srpt_channel_t *P > {
+	ci_local = P->ch_session->ss_i_gid;
+	ci_remote = P->ch_session->ss_t_gid;
+};
+
+#pragma D binding "1.5" translator
+translator srp_portinfo_t < srpt_channel_t *P > {
+	pi_initiator = P->ch_session->ss_i_name;
+	pi_i_sid = P->ch_session->ss_i_alias;
+	pi_target = P->ch_session->ss_t_name;
+	pi_t_sid = P->ch_session->ss_t_alias;
+	pi_chan_id = (uintptr_t) P->ch_chan_hdl;
+};
+
+typedef struct srp_logininfo {
+	uint64_t li_task_tag;	   /* SRP task tag */
+	uint32_t li_max_it_iu_len; /* Maximum iu length that initiator can
+				      send to target */
+	uint32_t li_max_ti_iu_len; /* Maximum iu length that target can
+				      send to initiator */
+	uint32_t li_request_limit; /* Maximun number of SRP requests 
+				      that initiator can send on a channel */
+	uint32_t li_reason_code;   /* Reason code */
+} srp_logininfo_t;
+
+#pragma D binding "1.5" translator
+translator srp_logininfo_t < srp_login_req_t *P > {
+	li_task_tag = P->lreq_tag; 
+	li_max_it_iu_len = ntohl(P->lreq_req_it_iu_len);
+	li_max_ti_iu_len = 0;
+	li_request_limit = 0;
+	li_reason_code = 0;
+};
+
+#pragma D binding "1.5" translator
+translator srp_logininfo_t < srp_login_rsp_t *P > {
+	li_task_tag = P->lrsp_tag; 
+	li_max_it_iu_len = ntohl(P->lrsp_max_it_iu_len);
+	li_max_ti_iu_len = ntohl(P->lrsp_max_ti_iu_len);
+	li_request_limit = ntohl(P->lrsp_req_limit_delta);
+	li_reason_code = ntohl(((srp_login_rej_t *) arg2)->lrej_reason);
+};
+
+typedef struct srp_taskinfo {
+	uint64_t ti_task_tag;	/* SRP task tag */
+	uint64_t ti_lun;	/* Target logical unit number */
+	uint8_t  ti_function;	/* Task management function */
+	uint32_t ti_req_limit_delta; /* Increment of channel's request limit */
+	uint8_t  ti_flag;	     /* bit 2: DOOVER */
+	                             /* bit 3: DOUNDER */
+	                             /* bit 4: DIOVER */
+	                             /* bit 5: DIUNDER */
+	uint32_t ti_do_resid_cnt;    /* Data-out residual count */
+	uint32_t ti_di_resid_cnt;    /* Data-in residual count */
+	uint8_t  ti_status;     /* Status of this task */
+} srp_taskinfo_t;
+
+#pragma D binding "1.5" translator
+translator srp_taskinfo_t < srp_cmd_req_t *P > {
+	ti_task_tag = P->cr_tag;
+	ti_lun =  (ntohl(*((uint32_t *)P->cr_lun)) << 32) +
+	    ntohl(*((uint32_t *)&P->cr_lun[4]));
+	ti_function = P->cr_type == 1 ?  /* 1: MGMT CMD 2: SRP CMD */
+	    ((srp_tsk_mgmt_t *)P)->tm_function : 0;
+	ti_req_limit_delta = 0;
+	ti_flag = 0;
+	ti_do_resid_cnt = 0;
+	ti_di_resid_cnt = 0;
+	ti_status = 0;
+};
+
+#pragma D binding "1.5" translator
+translator srp_taskinfo_t < srp_rsp_t *P > {
+	ti_task_tag = P->rsp_tag;
+	ti_lun = ntohll(*(uint64_t *)((scsi_task_t *) arg2)->task_lun_no);
+	ti_function = ((scsi_task_t *) arg2)->task_mgmt_function;
+	ti_req_limit_delta = ntohl(P->rsp_req_limit_delta);
+	ti_flag = P->rsp_flags;
+	ti_do_resid_cnt = ntohl(P->rsp_do_resid_cnt);
+	ti_di_resid_cnt = ntohl(P->rsp_di_resid_cnt);
+	ti_status = arg3;
+};
+
+#pragma D binding "1.5" translator
+translator xferinfo_t < ibt_wr_ds_t *P > {
+	xfer_laddr = P->ds_va + arg4;
+	xfer_lkey = P->ds_key;
+	xfer_raddr = (arg2 == 0) ? 0 :
+	    ((ibt_send_wr_t *) arg2)->wr.rc.rcwr.rdma.rdma_raddr;
+	xfer_rkey = (arg2 == 0) ? 0 :
+	    ((ibt_send_wr_t *) arg2)->wr.rc.rcwr.rdma.rdma_rkey;
+	xfer_len = arg3;
+	xfer_loffset = arg4;
+	xfer_roffset = arg5;
+	xfer_type = arg6;
+};
--- a/usr/src/pkgdefs/SUNWdtrc/prototype_com	Mon Jun 08 23:02:20 2009 -0700
+++ b/usr/src/pkgdefs/SUNWdtrc/prototype_com	Tue Jun 09 10:11:35 2009 -0400
@@ -57,6 +57,7 @@
 f none usr/lib/dtrace/sched.d 644 root bin
 f none usr/lib/dtrace/scsi.d 644 root bin
 f none usr/lib/dtrace/iscsit.d 644 root bin
+f none usr/lib/dtrace/srp.d 644 root bin
 f none usr/lib/dtrace/signal.d 644 root bin
 f none usr/lib/dtrace/sysevent.d 644 root bin
 f none usr/lib/dtrace/unistd.d 644 root bin
--- a/usr/src/uts/common/dtrace/sdt_subr.c	Mon Jun 08 23:02:20 2009 -0700
+++ b/usr/src/uts/common/dtrace/sdt_subr.c	Tue Jun 09 10:11:35 2009 -0400
@@ -113,6 +113,7 @@
 	{ "nfsv4", "__nfsv4_", &stab_attr, 0 },
 	{ "xpv", "__xpv_", &xpv_attr, 0 },
 	{ "fc", "__fc_", &fc_attr, 0 },
+	{ "srp", "__srp_", &fc_attr, 0 },
 	{ "sysevent", "__sysevent_", &stab_attr, 0 },
 	{ "sdt", NULL, &sdt_attr, 0 },
 	{ NULL }
@@ -948,6 +949,65 @@
 	{ "xpv", "setvcpucontext-start", 0, 0, "domid_t" },
 	{ "xpv", "setvcpucontext-start", 1, 1, "vcpu_guest_context_t *" },
 
+	{ "srp", "service-up", 0, 0, "srpt_session_t *", "conninfo_t *" },
+	{ "srp", "service-up", 1, 0, "srpt_session_t *", "srp_portinfo_t *" },
+	{ "srp", "service-down", 0, 0, "srpt_session_t *", "conninfo_t *" },
+	{ "srp", "service-down", 1, 0, "srpt_session_t *",
+	    "srp_portinfo_t *" },
+	{ "srp", "login-command", 0, 0, "srpt_session_t *", "conninfo_t *" },
+	{ "srp", "login-command", 1, 0, "srpt_session_t *",
+	    "srp_portinfo_t *" },
+	{ "srp", "login-command", 2, 1, "srp_login_req_t *",
+	    "srp_logininfo_t *" },
+	{ "srp", "login-response", 0, 0, "srpt_session_t *", "conninfo_t *" },
+	{ "srp", "login-response", 1, 0, "srpt_session_t *",
+	    "srp_portinfo_t *" },
+	{ "srp", "login-response", 2, 1, "srp_login_rsp_t *",
+	    "srp_logininfo_t *" },
+	{ "srp", "login-response", 3, 2, "srp_login_rej_t *" },
+	{ "srp", "logout-command", 0, 0, "srpt_channel_t *", "conninfo_t *" },
+	{ "srp", "logout-command", 1, 0, "srpt_channel_t *",
+	    "srp_portinfo_t *" },
+	{ "srp", "task-command", 0, 0, "srpt_channel_t *", "conninfo_t *" },
+	{ "srp", "task-command", 1, 0, "srpt_channel_t *",
+	    "srp_portinfo_t *" },
+	{ "srp", "task-command", 2, 1, "srp_cmd_req_t *", "srp_taskinfo_t *" },
+	{ "srp", "task-response", 0, 0, "srpt_channel_t *", "conninfo_t *" },
+	{ "srp", "task-response", 1, 0, "srpt_channel_t *",
+	    "srp_portinfo_t *" },
+	{ "srp", "task-response", 2, 1, "srp_rsp_t *", "srp_taskinfo_t *" },
+	{ "srp", "task-response", 3, 2, "scsi_task_t *" },
+	{ "srp", "task-response", 4, 3, "int8_t" },
+	{ "srp", "scsi-command", 0, 0, "srpt_channel_t *", "conninfo_t *" },
+	{ "srp", "scsi-command", 1, 0, "srpt_channel_t *",
+	    "srp_portinfo_t *" },
+	{ "srp", "scsi-command", 2, 1, "scsi_task_t *", "scsicmd_t *" },
+	{ "srp", "scsi-command", 3, 2, "srp_cmd_req_t *", "srp_taskinfo_t *" },
+	{ "srp", "scsi-response", 0, 0, "srpt_channel_t *", "conninfo_t *" },
+	{ "srp", "scsi-response", 1, 0, "srpt_channel_t *",
+	    "srp_portinfo_t *" },
+	{ "srp", "scsi-response", 2, 1, "srp_rsp_t *", "srp_taskinfo_t *" },
+	{ "srp", "scsi-response", 3, 2, "scsi_task_t *" },
+	{ "srp", "scsi-response", 4, 3, "int8_t" },
+	{ "srp", "xfer-start", 0, 0, "srpt_channel_t *", "conninfo_t *" },
+	{ "srp", "xfer-start", 1, 0, "srpt_channel_t *",
+	    "srp_portinfo_t *" },
+	{ "srp", "xfer-start", 2, 1, "ibt_wr_ds_t *", "xferinfo_t *" },
+	{ "srp", "xfer-start", 3, 2, "ibt_send_wr_t *"},
+	{ "srp", "xfer-start", 4, 3, "uint32_t" },
+	{ "srp", "xfer-start", 5, 4, "uint32_t" },
+	{ "srp", "xfer-start", 6, 5, "uint32_t" },
+	{ "srp", "xfer-start", 7, 6, "uint32_t" },
+	{ "srp", "xfer-done", 0, 0, "srpt_channel_t *", "conninfo_t *" },
+	{ "srp", "xfer-done", 1, 0, "srpt_channel_t *",
+	    "srp_portinfo_t *" },
+	{ "srp", "xfer-done", 2, 1, "ibt_wr_ds_t *", "xferinfo_t *" },
+	{ "srp", "xfer-done", 3, 2, "ibt_send_wr_t *"},
+	{ "srp", "xfer-done", 4, 3, "uint32_t" },
+	{ "srp", "xfer-done", 5, 4, "uint32_t" },
+	{ "srp", "xfer-done", 6, 5, "uint32_t" },
+	{ "srp", "xfer-done", 7, 6, "uint32_t" },
+
 	{ "fc", "link-up",   0, 0, "fct_i_local_port_t *", "conninfo_t *" },
 	{ "fc", "link-down", 0, 0, "fct_i_local_port_t *", "conninfo_t *" },
 	{ "fc", "fabric-login-start", 0, 0, "fct_i_local_port_t *",
--- a/usr/src/uts/common/io/comstar/port/srpt/srpt_ch.c	Mon Jun 08 23:02:20 2009 -0700
+++ b/usr/src/uts/common/io/comstar/port/srpt/srpt_ch.c	Tue Jun 09 10:11:35 2009 -0400
@@ -618,6 +618,10 @@
 		stmf_dbuf->db_xfer_status = STMF_FAILURE;
 	}
 
+	DTRACE_SRP_7(xfer__done, srpt_channel_t, ch,
+	    ibt_wr_ds_t, &(dbuf->db_sge), ibt_send_wr_t, 0,
+	    uint32_t, stmf_dbuf->db_data_size, uint32_t, 0, uint32_t, 0,
+	    uint32_t, (stmf_dbuf->db_flags & DB_DIRECTION_TO_RPORT) ? 1 : 0);
 	stmf_data_xfer_done(dbuf->db_iu->iu_stmf_task, stmf_dbuf, 0);
 }
 
@@ -833,6 +837,8 @@
 	ibt_status_t		status;
 	uint8_t			addlen;
 
+
+	DTRACE_SRP_2(task__command, srpt_channel_t, ch, srp_cmd_req_t, cmd);
 	iu->iu_ch  = ch;
 	iu->iu_tag = cmd->cr_tag;
 
@@ -1048,6 +1054,8 @@
 	 * remain in the session's list until STMF is informed by SRP that
 	 * it is done with the task.
 	 */
+	DTRACE_SRP_3(scsi__command, srpt_channel_t, iu->iu_ch,
+	    scsi_task_t, iu->iu_stmf_task, srp_cmd_req_t, cmd);
 	srpt_stp_add_task(ch->ch_session, iu);
 
 	SRPT_DPRINTF_L3("ch_srp_cmd, new task (%p) posted",
@@ -1144,6 +1152,14 @@
 	SRPT_DPRINTF_L3("ch_srp_task_mgmt, SRP TASK MGMT func(%d)",
 	    tsk->tm_function);
 
+	/*
+	 * Both tag and lun fileds have the same corresponding offsets
+	 * in both srp_tsk_mgmt_t and srp_cmd_req_t structures.  The
+	 * casting will allow us to use the same dtrace translator.
+	 */
+	DTRACE_SRP_2(task__command, srpt_channel_t, ch,
+	    srp_cmd_req_t, (srp_cmd_req_t *)tsk);
+
 	iu->iu_ch  = ch;
 	iu->iu_tag = tsk->tm_tag;
 
--- a/usr/src/uts/common/io/comstar/port/srpt/srpt_cm.c	Mon Jun 08 23:02:20 2009 -0700
+++ b/usr/src/uts/common/io/comstar/port/srpt/srpt_cm.c	Tue Jun 09 10:11:35 2009 -0400
@@ -72,6 +72,8 @@
 	srp_login_rej_t		login_rej;
 	srp_login_rsp_t		login_rsp;
 	srpt_channel_t		*ch = NULL;
+	char			remote_gid[SRPT_ALIAS_LEN];
+	char			local_gid[SRPT_ALIAS_LEN];
 
 	ASSERT(tgt != NULL);
 	req = &event->cm_event.req;
@@ -106,8 +108,15 @@
 	 */
 	bcopy(event->cm_priv_data, &login,  sizeof (login));
 
+	ALIAS_STR(local_gid,
+	    req->req_prim_addr.av_sgid.gid_prefix,
+	    req->req_prim_addr.av_sgid.gid_guid);
+	ALIAS_STR(remote_gid,
+	    req->req_prim_addr.av_dgid.gid_prefix,
+	    req->req_prim_addr.av_dgid.gid_guid);
+
 	ch = srpt_stp_login(tgt, &login, &login_rsp,
-	    &login_rej, req->req_prim_hca_port);
+	    &login_rej, req->req_prim_hca_port, local_gid, remote_gid);
 	if (ch != NULL) {
 		bcopy(&login_rsp, ret_priv_data,  SRP_LOGIN_RSP_SIZE);
 		ret_args->cm_ret_len = SRP_LOGIN_RSP_SIZE;
--- a/usr/src/uts/common/io/comstar/port/srpt/srpt_impl.h	Mon Jun 08 23:02:20 2009 -0700
+++ b/usr/src/uts/common/io/comstar/port/srpt/srpt_impl.h	Tue Jun 09 10:11:35 2009 -0400
@@ -46,6 +46,15 @@
 extern "C" {
 #endif
 
+/* Format the session identifier */
+#define	ALIAS_STR(s, a, b)						\
+	((void) snprintf((s), sizeof ((s)), "%016llx:%016llx",		\
+	    (u_longlong_t)(a), (u_longlong_t)(b)))
+
+/* Format the EUI name */
+#define	EUI_STR(s, a)							\
+	((void) snprintf((s), sizeof ((s)), "eui.%016llX", (u_longlong_t)(a)))
+
 /*
  * We should/could consider making some of these values tunables.
  * Specifically, SEND_MSG_SIZE and SEND_MSG_DEPTH.
@@ -66,6 +75,8 @@
 
 struct srpt_target_port_s;
 
+#define	SRPT_ALIAS_LEN	(SRP_PORT_ID_LEN * 2 + 2)
+
 /*
  * SRP Session - represents a SCSI I_T_Nexus.
  *
@@ -115,8 +126,14 @@
 	uint8_t				ss_t_id[SRP_PORT_ID_LEN];
 
 	/* So we can see the full 128-bit initiator login from stmfadm */
-	char				ss_alias[SRP_PORT_ID_LEN * 2 + 2];
+	char				ss_i_alias[SRPT_ALIAS_LEN];
 	uint8_t				ss_hw_port;
+
+	char				ss_t_alias[SRPT_ALIAS_LEN];
+	char				ss_i_name[SRPT_EUI_ID_LEN + 1];
+	char				ss_t_name[SRPT_EUI_ID_LEN + 1];
+	char				ss_i_gid[SRPT_ALIAS_LEN];
+	char				ss_t_gid[SRPT_ALIAS_LEN];
 } srpt_session_t;
 
 /*
--- a/usr/src/uts/common/io/comstar/port/srpt/srpt_ioc.c	Mon Jun 08 23:02:20 2009 -0700
+++ b/usr/src/uts/common/io/comstar/port/srpt/srpt_ioc.c	Tue Jun 09 10:11:35 2009 -0400
@@ -36,6 +36,7 @@
 #include <sys/atomic.h>
 #include <sys/sysmacros.h>
 #include <sys/ib/ibtl/ibti.h>
+#include <sys/sdt.h>
 
 #include "srp.h"
 #include "srpt_impl.h"
@@ -725,6 +726,7 @@
 	uint_t			qportnum;
 	ib_gid_t		new_gid;
 	srpt_ioc_t		*ioc;
+	srpt_session_t		sess;
 
 	ASSERT(tgt != NULL);
 	ASSERT(tgt->tp_ioc != NULL);
@@ -793,6 +795,15 @@
 		SRPT_DPRINTF_L1("ioc_svc_bind, bind error (%d)", status);
 		return (status);
 	}
+	port->hwp_gid.gid_prefix = new_gid.gid_prefix;
+	port->hwp_gid.gid_guid = new_gid.gid_guid;
+
+	/* setting up a transient structure for the dtrace probe. */
+	bzero(&sess, sizeof (srpt_session_t));
+	ALIAS_STR(sess.ss_t_gid, new_gid.gid_prefix, new_gid.gid_guid);
+	EUI_STR(sess.ss_t_name, tgt->tp_ibt_svc_id);
+
+	DTRACE_SRP_1(service__up, srpt_session_t, &sess);
 
 	return (IBT_SUCCESS);
 }
@@ -804,6 +815,7 @@
 srpt_ioc_svc_unbind(srpt_target_port_t *tgt, uint_t portnum)
 {
 	srpt_hw_port_t		*port;
+	srpt_session_t		sess;
 
 	if (tgt == NULL) {
 		SRPT_DPRINTF_L2("ioc_svc_unbind, SCSI target does not exist");
@@ -816,11 +828,21 @@
 	}
 	port = &tgt->tp_hw_port[portnum-1];
 
+	/* setting up a transient structure for the dtrace probe. */
+	bzero(&sess, sizeof (srpt_session_t));
+	ALIAS_STR(sess.ss_t_gid, port->hwp_gid.gid_prefix,
+	    port->hwp_gid.gid_guid);
+	EUI_STR(sess.ss_t_name, tgt->tp_ibt_svc_id);
+
+	DTRACE_SRP_1(service__down, srpt_session_t, &sess);
+
 	if (tgt->tp_ibt_svc_hdl != NULL && port->hwp_bind_hdl != NULL) {
 		SRPT_DPRINTF_L2("ioc_svc_unbind, unregister current bind");
 		ibt_unbind_service(tgt->tp_ibt_svc_hdl, port->hwp_bind_hdl);
 	}
 	port->hwp_bind_hdl = NULL;
+	port->hwp_gid.gid_prefix = 0;
+	port->hwp_gid.gid_guid = 0;
 }
 
 /*
--- a/usr/src/uts/common/io/comstar/port/srpt/srpt_stp.c	Mon Jun 08 23:02:20 2009 -0700
+++ b/usr/src/uts/common/io/comstar/port/srpt/srpt_stp.c	Tue Jun 09 10:11:35 2009 -0400
@@ -583,6 +583,10 @@
 		 * If this task is being aborted or has been aborted,
 		 * do not post additional I/O.
 		 */
+		DTRACE_SRP_7(xfer__start, srpt_channel_t, ch,
+		    ibt_wr_ds_t, &(db->db_sge), ibt_send_wr_t, &wr, uint32_t,
+		    rdma_len, uint32_t, xferred_len, uint32_t, desc_offset,
+		    uint32_t, wr.wr_opcode == IBT_WRC_RDMAR ? 0 : 1);
 		mutex_enter(&iu->iu_lock);
 		if ((iu->iu_flags & (SRPT_IU_SRP_ABORTING |
 		    SRPT_IU_STMF_ABORTING | SRPT_IU_ABORTED)) != 0) {
@@ -626,7 +630,6 @@
 			rw_exit(&iu->iu_ch->ch_rwlock);
 			return (STMF_FAILURE);
 		}
-
 		xferred_len += rdma_len;
 		xfer_len    -= rdma_len;
 		desc_offset  = 0;
@@ -678,6 +681,10 @@
 	    " iu(%p), mgmt status(%d)", (void *)iu->iu_ch,
 	    (void *)iu, srp_rsp);
 
+	DTRACE_SRP_4(task__response, srpt_channel_t, iu->iu_ch,
+	    srp_rsp_t, iu->iu_buf, scsi_task_t, iu->iu_stmf_task,
+	    int8_t, srp_rsp);
+
 	status = srpt_ch_post_send(iu->iu_ch, iu, rsp_length, fence);
 	if (status != IBT_SUCCESS) {
 		SRPT_DPRINTF_L2("stp_send_mgmt_response, post "
@@ -744,6 +751,10 @@
 	    " iu(%p), length(%d)", (void *)iu->iu_ch,
 	    (void *)iu, rsp_length);
 
+	DTRACE_SRP_4(task__response, srpt_channel_t, iu->iu_ch,
+	    srp_rsp_t, iu->iu_buf, scsi_task_t, iu->iu_stmf_task,
+	    uint8_t, scsi_status);
+
 	status = srpt_ch_post_send(iu->iu_ch, iu, rsp_length, fence);
 	if (status != IBT_SUCCESS) {
 		SRPT_DPRINTF_L2("stp_send_response, post response err(%d)",
@@ -783,6 +794,11 @@
 	    task->task_sense_length,
 	    (void *)task->task_sense_data);
 
+	DTRACE_SRP_4(scsi__response, srpt_channel_t, iu->iu_ch,
+	    srp_rsp_t, iu->iu_buf, scsi_task_t, task,
+	    int8_t, task->task_scsi_status);
+
+
 	/*
 	 * Indicate future aborts can not be initiated (although
 	 * we will handle any that have been requested since the
@@ -1132,7 +1148,8 @@
  */
 srpt_session_t *
 srpt_stp_alloc_session(srpt_target_port_t *tgt,
-	uint8_t *i_id, uint8_t *t_id, uint8_t port)
+	uint8_t *i_id, uint8_t *t_id, uint8_t port,
+	char *local_gid, char *remote_gid)
 {
 	stmf_status_t		status;
 	srpt_session_t		*ss;
@@ -1176,11 +1193,16 @@
 	 * the administrator to identify multiple unique sessions originating
 	 * from the same initiator.
 	 */
-	(void) sprintf(ss->ss_alias, "%016llx:%016llx",
-	    (u_longlong_t)BE_IN64(&ss->ss_i_id[0]),
-	    (u_longlong_t)BE_IN64(&ss->ss_i_id[8]));
+	(void) strlcpy(ss->ss_i_gid, remote_gid, SRPT_ALIAS_LEN);
+	(void) strlcpy(ss->ss_t_gid, local_gid, SRPT_ALIAS_LEN);
+	EUI_STR(ss->ss_i_name, BE_IN64(&ss->ss_i_id[8]));
+	EUI_STR(ss->ss_t_name, BE_IN64(&ss->ss_t_id[0]));
+	ALIAS_STR(ss->ss_i_alias, BE_IN64(&ss->ss_i_id[0]),
+	    BE_IN64(&ss->ss_i_id[8]));
+	ALIAS_STR(ss->ss_t_alias, BE_IN64(&ss->ss_t_id[0]),
+	    BE_IN64(&ss->ss_t_id[8]));
 
-	stmf_ss->ss_rport_alias = ss->ss_alias;
+	stmf_ss->ss_rport_alias = ss->ss_i_alias;
 
 	status = stmf_register_scsi_session(tgt->tp_lport, stmf_ss);
 	if (status != STMF_SUCCESS) {
@@ -1237,7 +1259,7 @@
 srpt_channel_t *
 srpt_stp_login(srpt_target_port_t *tgt, srp_login_req_t *login,
 	srp_login_rsp_t *login_rsp, srp_login_rej_t *login_rej,
-	uint8_t login_port)
+	uint8_t login_port, char *local_gid, char *remote_gid)
 {
 	uint32_t	reason;
 	uint32_t	req_it_ui_len;
@@ -1246,18 +1268,40 @@
 	srpt_channel_t	*ch = NULL;
 	srpt_channel_t	*next_ch = NULL;
 	srpt_session_t	*session = NULL;
+	srpt_session_t	sess;
 
 	ASSERT(tgt != NULL);
 	ASSERT(login != NULL);
 	ASSERT(login_rsp != NULL);
 	ASSERT(login_rej != NULL);
 
+	/* Store the string representation of connection info */
+	/* for Dtrace probes */
+	bzero(&sess, sizeof (srpt_session_t));
+	(void) strlcpy(sess.ss_i_gid, remote_gid, SRPT_ALIAS_LEN);
+	(void) strlcpy(sess.ss_t_gid, local_gid, SRPT_ALIAS_LEN);
+	EUI_STR(sess.ss_i_name,
+	    BE_IN64(&login->lreq_initiator_port_id[8]));
+	EUI_STR(sess.ss_t_name,
+	    BE_IN64(&login->lreq_target_port_id[0]));
+	ALIAS_STR(sess.ss_i_alias,
+	    BE_IN64(&login->lreq_initiator_port_id[0]),
+	    BE_IN64(&login->lreq_initiator_port_id[8]));
+	ALIAS_STR(sess.ss_t_alias,
+	    BE_IN64(&login->lreq_target_port_id[0]),
+	    BE_IN64(&login->lreq_target_port_id[8]));
+
+	DTRACE_SRP_2(login__command, srpt_session_t, &sess,
+	    srp_login_req_t, login);
+
 	/*
 	 * The target lock taken here serializes logins to this target
 	 * and prevents an STMF target port from starting a control
 	 * operation to transition the target state while a login is
 	 * being processed.
 	 */
+	bzero(login_rsp, sizeof (srp_login_rsp_t));
+	bzero(login_rej, sizeof (srp_login_rej_t));
 	mutex_enter(&tgt->tp_lock);
 	ioc = tgt->tp_ioc;
 	if (ioc == NULL) {
@@ -1389,7 +1433,8 @@
 		/* Create the new session for this SRP login */
 		session = srpt_stp_alloc_session(tgt,
 		    login->lreq_initiator_port_id,
-		    login->lreq_target_port_id, login_port);
+		    login->lreq_target_port_id, login_port,
+		    local_gid, remote_gid);
 		if (session == NULL) {
 			SRPT_DPRINTF_L2("stp_login, session allocation"
 			    " failed");
@@ -1441,11 +1486,18 @@
 	mutex_exit(&tgt->tp_lock);
 	SRPT_DPRINTF_L2("stp_login, login successful");
 
+	DTRACE_SRP_3(login__response, srpt_session_t, &sess,
+	    srp_login_rsp_t, login_rsp, srp_login_rej_t, login_rej)
+
 	return (ch);
 
 reject_login:
 	srpt_format_login_rej(login, login_rej, reason);
 	mutex_exit(&tgt->tp_lock);
+
+	DTRACE_SRP_3(login__response, srpt_session_t, &sess,
+	    srp_login_rsp_t, login_rsp, srp_login_rej_t, login_rej);
+
 	return (NULL);
 }
 
@@ -1458,8 +1510,8 @@
 void
 srpt_stp_logout(srpt_channel_t *ch)
 {
-	SRPT_DPRINTF_L2("stp_logout, invoked for ch (%p)",
-	    (void *)ch);
+	DTRACE_SRP_1(logout__command, srpt_channel_t, ch);
+	SRPT_DPRINTF_L2("stp_logout, invoked for ch (%p)", (void *)ch);
 	srpt_ch_disconnect(ch);
 }
 
@@ -1470,8 +1522,6 @@
 srpt_format_login_rej(srp_login_req_t *req, srp_login_rej_t *rej,
 	uint32_t reason)
 {
-	bzero(rej, sizeof (srp_login_rej_t));
-
 	rej->lrej_type   = SRP_IU_LOGIN_REJ;
 	rej->lrej_reason = h2b32(reason);
 	rej->lrej_tag    = req->lreq_tag;
@@ -1486,8 +1536,6 @@
 srpt_format_login_rsp(srp_login_req_t *req, srp_login_rsp_t *rsp,
 	uint8_t flags)
 {
-	bzero(rsp, sizeof (srp_login_rsp_t));
-
 	rsp->lrsp_type   = SRP_IU_LOGIN_RSP;
 	rsp->lrsp_req_limit_delta = h2b32((uint32_t)srpt_send_msg_depth);
 	rsp->lrsp_tag    = req->lreq_tag;
--- a/usr/src/uts/common/io/comstar/port/srpt/srpt_stp.h	Mon Jun 08 23:02:20 2009 -0700
+++ b/usr/src/uts/common/io/comstar/port/srpt/srpt_stp.h	Tue Jun 09 10:11:35 2009 -0400
@@ -46,12 +46,14 @@
 stmf_status_t srpt_stp_deregister_port(srpt_target_port_t *tgt);
 
 srpt_session_t *srpt_stp_alloc_session(srpt_target_port_t *tgt,
-	uint8_t *i_id, uint8_t *t_id, uint8_t port);
+	uint8_t *i_id, uint8_t *t_id, uint8_t port,
+	char *local_gid, char *remote_gid);
 void srpt_stp_free_session(srpt_session_t *session);
 
 srpt_channel_t *srpt_stp_login(srpt_target_port_t *tgt,
 	srp_login_req_t *login, srp_login_rsp_t *login_rsp,
-	srp_login_rej_t *login_rej, uint8_t login_port);
+	srp_login_rej_t *login_rej, uint8_t login_port,
+	char *local_gid, char *remote_gid);
 
 void srpt_stp_logout(srpt_channel_t *ch);
 
--- a/usr/src/uts/common/sys/sdt.h	Mon Jun 08 23:02:20 2009 -0700
+++ b/usr/src/uts/common/sys/sdt.h	Tue Jun 09 10:11:35 2009 -0400
@@ -319,7 +319,34 @@
 	DTRACE_PROBE5(__fc_##name, type1, arg1, type2, arg2, type3, arg3, \
 	    type4, arg4, type5, arg5);
 
+#define	DTRACE_SRP_1(name, type1, arg1)					\
+	DTRACE_PROBE1(__srp_##name, type1, arg1);
 
+#define	DTRACE_SRP_2(name, type1, arg1, type2, arg2)			\
+	DTRACE_PROBE2(__srp_##name, type1, arg1, type2, arg2);
+
+#define	DTRACE_SRP_3(name, type1, arg1, type2, arg2, type3, arg3)	\
+	DTRACE_PROBE3(__srp_##name, type1, arg1, type2, arg2, type3, arg3);
+
+#define	DTRACE_SRP_4(name, type1, arg1, type2, arg2, type3, arg3,	\
+	    type4, arg4)						\
+	DTRACE_PROBE4(__srp_##name, type1, arg1, type2, arg2, 		\
+	    type3, arg3, type4, arg4);
+
+#define	DTRACE_SRP_5(name, type1, arg1, type2, arg2, type3, arg3,	\
+	    type4, arg4, type5, arg5)					\
+	DTRACE_PROBE5(__srp_##name, type1, arg1, type2, arg2, 		\
+	    type3, arg3, type4, arg4, type5, arg5);
+
+#define	DTRACE_SRP_6(name, type1, arg1, type2, arg2, type3, arg3,	\
+	    type4, arg4, type5, arg5, type6, arg6)			\
+	DTRACE_PROBE6(__srp_##name, type1, arg1, type2, arg2, 		\
+	    type3, arg3, type4, arg4, type5, arg5, type6, arg6);
+
+#define	DTRACE_SRP_7(name, type1, arg1, type2, arg2, type3, arg3,	\
+	    type4, arg4, type5, arg5, type6, arg6, type7, arg7)		\
+	DTRACE_PROBE7(__srp_##name, type1, arg1, type2, arg2, 		\
+	    type3, arg3, type4, arg4, type5, arg5, type6, arg6, type7, arg7);
 
 #endif /* _KERNEL */