xref: /titanic_41/usr/src/lib/libdtrace/common/srp.d (revision 191c289b86668766245f78ec1f87557319bc46a1)
1*191c289bSCharles Ting /*
2*191c289bSCharles Ting  * CDDL HEADER START
3*191c289bSCharles Ting  *
4*191c289bSCharles Ting  * The contents of this file are subject to the terms of the
5*191c289bSCharles Ting  * Common Development and Distribution License (the "License").
6*191c289bSCharles Ting  * You may not use this file except in compliance with the License.
7*191c289bSCharles Ting  *
8*191c289bSCharles Ting  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*191c289bSCharles Ting  * or http://www.opensolaris.org/os/licensing.
10*191c289bSCharles Ting  * See the License for the specific language governing permissions
11*191c289bSCharles Ting  * and limitations under the License.
12*191c289bSCharles Ting  *
13*191c289bSCharles Ting  * When distributing Covered Code, include this CDDL HEADER in each
14*191c289bSCharles Ting  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*191c289bSCharles Ting  * If applicable, add the following below this CDDL HEADER, with the
16*191c289bSCharles Ting  * fields enclosed by brackets "[]" replaced with your own identifying
17*191c289bSCharles Ting  * information: Portions Copyright [yyyy] [name of copyright owner]
18*191c289bSCharles Ting  *
19*191c289bSCharles Ting  * CDDL HEADER END
20*191c289bSCharles Ting  */
21*191c289bSCharles Ting 
22*191c289bSCharles Ting /*
23*191c289bSCharles Ting  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24*191c289bSCharles Ting  * Use is subject to license terms.
25*191c289bSCharles Ting  */
26*191c289bSCharles Ting 
27*191c289bSCharles Ting #pragma	D depends_on library net.d
28*191c289bSCharles Ting #pragma D depends_on library scsi.d
29*191c289bSCharles Ting #pragma D depends_on module genunix
30*191c289bSCharles Ting #pragma	D depends_on module srpt
31*191c289bSCharles Ting 
32*191c289bSCharles Ting typedef struct srp_portinfo {
33*191c289bSCharles Ting 	/* initiator */
34*191c289bSCharles Ting 	string  pi_initiator;	/* Initiator: eui.xxxxxxxxxxxxxxx */
35*191c289bSCharles Ting 	string	pi_i_sid;	/* Initiator session id */
36*191c289bSCharles Ting 
37*191c289bSCharles Ting 	/* target */
38*191c289bSCharles Ting 	string	pi_target;	/* Target: eui.xxxxxxxxxxxxxxx */
39*191c289bSCharles Ting 	string  pi_t_sid;	/* Target session id */
40*191c289bSCharles Ting 
41*191c289bSCharles Ting 	uintptr_t pi_chan_id;	/* Channel identifier */
42*191c289bSCharles Ting } srp_portinfo_t;
43*191c289bSCharles Ting 
44*191c289bSCharles Ting #pragma D binding "1.5" translator
45*191c289bSCharles Ting translator conninfo_t < srpt_session_t *P > {
46*191c289bSCharles Ting 	ci_local = P->ss_t_gid;
47*191c289bSCharles Ting 	ci_remote = P->ss_i_gid;
48*191c289bSCharles Ting 	ci_protocol = "ib";
49*191c289bSCharles Ting };
50*191c289bSCharles Ting 
51*191c289bSCharles Ting #pragma D binding "1.5" translator
52*191c289bSCharles Ting translator srp_portinfo_t < srpt_session_t *P > {
53*191c289bSCharles Ting 	pi_initiator = P->ss_i_name;
54*191c289bSCharles Ting 	pi_i_sid = P->ss_i_alias;
55*191c289bSCharles Ting 	pi_target = P->ss_t_name;
56*191c289bSCharles Ting 	pi_t_sid = P->ss_t_alias;
57*191c289bSCharles Ting 	pi_chan_id = 0;
58*191c289bSCharles Ting };
59*191c289bSCharles Ting 
60*191c289bSCharles Ting #pragma D binding "1.5" translator
61*191c289bSCharles Ting translator conninfo_t < srpt_channel_t *P > {
62*191c289bSCharles Ting 	ci_local = P->ch_session->ss_i_gid;
63*191c289bSCharles Ting 	ci_remote = P->ch_session->ss_t_gid;
64*191c289bSCharles Ting };
65*191c289bSCharles Ting 
66*191c289bSCharles Ting #pragma D binding "1.5" translator
67*191c289bSCharles Ting translator srp_portinfo_t < srpt_channel_t *P > {
68*191c289bSCharles Ting 	pi_initiator = P->ch_session->ss_i_name;
69*191c289bSCharles Ting 	pi_i_sid = P->ch_session->ss_i_alias;
70*191c289bSCharles Ting 	pi_target = P->ch_session->ss_t_name;
71*191c289bSCharles Ting 	pi_t_sid = P->ch_session->ss_t_alias;
72*191c289bSCharles Ting 	pi_chan_id = (uintptr_t) P->ch_chan_hdl;
73*191c289bSCharles Ting };
74*191c289bSCharles Ting 
75*191c289bSCharles Ting typedef struct srp_logininfo {
76*191c289bSCharles Ting 	uint64_t li_task_tag;	   /* SRP task tag */
77*191c289bSCharles Ting 	uint32_t li_max_it_iu_len; /* Maximum iu length that initiator can
78*191c289bSCharles Ting 				      send to target */
79*191c289bSCharles Ting 	uint32_t li_max_ti_iu_len; /* Maximum iu length that target can
80*191c289bSCharles Ting 				      send to initiator */
81*191c289bSCharles Ting 	uint32_t li_request_limit; /* Maximun number of SRP requests
82*191c289bSCharles Ting 				      that initiator can send on a channel */
83*191c289bSCharles Ting 	uint32_t li_reason_code;   /* Reason code */
84*191c289bSCharles Ting } srp_logininfo_t;
85*191c289bSCharles Ting 
86*191c289bSCharles Ting #pragma D binding "1.5" translator
87*191c289bSCharles Ting translator srp_logininfo_t < srp_login_req_t *P > {
88*191c289bSCharles Ting 	li_task_tag = P->lreq_tag;
89*191c289bSCharles Ting 	li_max_it_iu_len = ntohl(P->lreq_req_it_iu_len);
90*191c289bSCharles Ting 	li_max_ti_iu_len = 0;
91*191c289bSCharles Ting 	li_request_limit = 0;
92*191c289bSCharles Ting 	li_reason_code = 0;
93*191c289bSCharles Ting };
94*191c289bSCharles Ting 
95*191c289bSCharles Ting #pragma D binding "1.5" translator
96*191c289bSCharles Ting translator srp_logininfo_t < srp_login_rsp_t *P > {
97*191c289bSCharles Ting 	li_task_tag = P->lrsp_tag;
98*191c289bSCharles Ting 	li_max_it_iu_len = ntohl(P->lrsp_max_it_iu_len);
99*191c289bSCharles Ting 	li_max_ti_iu_len = ntohl(P->lrsp_max_ti_iu_len);
100*191c289bSCharles Ting 	li_request_limit = ntohl(P->lrsp_req_limit_delta);
101*191c289bSCharles Ting 	li_reason_code = ntohl(((srp_login_rej_t *) arg2)->lrej_reason);
102*191c289bSCharles Ting };
103*191c289bSCharles Ting 
104*191c289bSCharles Ting typedef struct srp_taskinfo {
105*191c289bSCharles Ting 	uint64_t ti_task_tag;	/* SRP task tag */
106*191c289bSCharles Ting 	uint64_t ti_lun;	/* Target logical unit number */
107*191c289bSCharles Ting 	uint8_t  ti_function;	/* Task management function */
108*191c289bSCharles Ting 	uint32_t ti_req_limit_delta; /* Increment of channel's request limit */
109*191c289bSCharles Ting 	uint8_t  ti_flag;	     /* bit 2: DOOVER */
110*191c289bSCharles Ting 	                             /* bit 3: DOUNDER */
111*191c289bSCharles Ting 	                             /* bit 4: DIOVER */
112*191c289bSCharles Ting 	                             /* bit 5: DIUNDER */
113*191c289bSCharles Ting 	uint32_t ti_do_resid_cnt;    /* Data-out residual count */
114*191c289bSCharles Ting 	uint32_t ti_di_resid_cnt;    /* Data-in residual count */
115*191c289bSCharles Ting 	uint8_t  ti_status;     /* Status of this task */
116*191c289bSCharles Ting } srp_taskinfo_t;
117*191c289bSCharles Ting 
118*191c289bSCharles Ting #pragma D binding "1.5" translator
119*191c289bSCharles Ting translator srp_taskinfo_t < srp_cmd_req_t *P > {
120*191c289bSCharles Ting 	ti_task_tag = P->cr_tag;
121*191c289bSCharles Ting 	ti_lun =  (ntohl(*((uint32_t *)P->cr_lun)) << 32) +
122*191c289bSCharles Ting 	    ntohl(*((uint32_t *)&P->cr_lun[4]));
123*191c289bSCharles Ting 	ti_function = P->cr_type == 1 ?  /* 1: MGMT CMD 2: SRP CMD */
124*191c289bSCharles Ting 	    ((srp_tsk_mgmt_t *)P)->tm_function : 0;
125*191c289bSCharles Ting 	ti_req_limit_delta = 0;
126*191c289bSCharles Ting 	ti_flag = 0;
127*191c289bSCharles Ting 	ti_do_resid_cnt = 0;
128*191c289bSCharles Ting 	ti_di_resid_cnt = 0;
129*191c289bSCharles Ting 	ti_status = 0;
130*191c289bSCharles Ting };
131*191c289bSCharles Ting 
132*191c289bSCharles Ting #pragma D binding "1.5" translator
133*191c289bSCharles Ting translator srp_taskinfo_t < srp_rsp_t *P > {
134*191c289bSCharles Ting 	ti_task_tag = P->rsp_tag;
135*191c289bSCharles Ting 	ti_lun = ntohll(*(uint64_t *)((scsi_task_t *) arg2)->task_lun_no);
136*191c289bSCharles Ting 	ti_function = ((scsi_task_t *) arg2)->task_mgmt_function;
137*191c289bSCharles Ting 	ti_req_limit_delta = ntohl(P->rsp_req_limit_delta);
138*191c289bSCharles Ting 	ti_flag = P->rsp_flags;
139*191c289bSCharles Ting 	ti_do_resid_cnt = ntohl(P->rsp_do_resid_cnt);
140*191c289bSCharles Ting 	ti_di_resid_cnt = ntohl(P->rsp_di_resid_cnt);
141*191c289bSCharles Ting 	ti_status = arg3;
142*191c289bSCharles Ting };
143*191c289bSCharles Ting 
144*191c289bSCharles Ting #pragma D binding "1.5" translator
145*191c289bSCharles Ting translator xferinfo_t < ibt_wr_ds_t *P > {
146*191c289bSCharles Ting 	xfer_laddr = P->ds_va + arg4;
147*191c289bSCharles Ting 	xfer_lkey = P->ds_key;
148*191c289bSCharles Ting 	xfer_raddr = (arg2 == 0) ? 0 :
149*191c289bSCharles Ting 	    ((ibt_send_wr_t *) arg2)->wr.rc.rcwr.rdma.rdma_raddr;
150*191c289bSCharles Ting 	xfer_rkey = (arg2 == 0) ? 0 :
151*191c289bSCharles Ting 	    ((ibt_send_wr_t *) arg2)->wr.rc.rcwr.rdma.rdma_rkey;
152*191c289bSCharles Ting 	xfer_len = arg3;
153*191c289bSCharles Ting 	xfer_loffset = arg4;
154*191c289bSCharles Ting 	xfer_roffset = arg5;
155*191c289bSCharles Ting 	xfer_type = arg6;
156*191c289bSCharles Ting };
157