xref: /titanic_51/usr/src/lib/libdtrace/common/srp.d (revision 7830165bb404e703a4653a49ad9fe110003bde03)
1191c289bSCharles Ting /*
2191c289bSCharles Ting  * CDDL HEADER START
3191c289bSCharles Ting  *
4191c289bSCharles Ting  * The contents of this file are subject to the terms of the
5191c289bSCharles Ting  * Common Development and Distribution License (the "License").
6191c289bSCharles Ting  * You may not use this file except in compliance with the License.
7191c289bSCharles Ting  *
8191c289bSCharles Ting  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9191c289bSCharles Ting  * or http://www.opensolaris.org/os/licensing.
10191c289bSCharles Ting  * See the License for the specific language governing permissions
11191c289bSCharles Ting  * and limitations under the License.
12191c289bSCharles Ting  *
13191c289bSCharles Ting  * When distributing Covered Code, include this CDDL HEADER in each
14191c289bSCharles Ting  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15191c289bSCharles Ting  * If applicable, add the following below this CDDL HEADER, with the
16191c289bSCharles Ting  * fields enclosed by brackets "[]" replaced with your own identifying
17191c289bSCharles Ting  * information: Portions Copyright [yyyy] [name of copyright owner]
18191c289bSCharles Ting  *
19191c289bSCharles Ting  * CDDL HEADER END
20191c289bSCharles Ting  */
21191c289bSCharles Ting 
22191c289bSCharles Ting /*
23191c289bSCharles Ting  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24191c289bSCharles Ting  * Use is subject to license terms.
25191c289bSCharles Ting  */
26191c289bSCharles Ting 
27191c289bSCharles Ting #pragma	D depends_on library net.d
28191c289bSCharles Ting #pragma D depends_on library scsi.d
29191c289bSCharles Ting #pragma D depends_on module genunix
30191c289bSCharles Ting #pragma	D depends_on module srpt
31191c289bSCharles Ting 
32191c289bSCharles Ting typedef struct srp_portinfo {
33191c289bSCharles Ting 	/* initiator */
34191c289bSCharles Ting 	string  pi_initiator;	/* Initiator: eui.xxxxxxxxxxxxxxx */
35191c289bSCharles Ting 	string	pi_i_sid;	/* Initiator session id */
36191c289bSCharles Ting 
37191c289bSCharles Ting 	/* target */
38191c289bSCharles Ting 	string	pi_target;	/* Target: eui.xxxxxxxxxxxxxxx */
39191c289bSCharles Ting 	string  pi_t_sid;	/* Target session id */
40191c289bSCharles Ting 
41191c289bSCharles Ting 	uintptr_t pi_chan_id;	/* Channel identifier */
42191c289bSCharles Ting } srp_portinfo_t;
43191c289bSCharles Ting 
44191c289bSCharles Ting #pragma D binding "1.5" translator
45191c289bSCharles Ting translator conninfo_t < srpt_session_t *P > {
46191c289bSCharles Ting 	ci_local = P->ss_t_gid;
47191c289bSCharles Ting 	ci_remote = P->ss_i_gid;
48191c289bSCharles Ting 	ci_protocol = "ib";
49191c289bSCharles Ting };
50191c289bSCharles Ting 
51191c289bSCharles Ting #pragma D binding "1.5" translator
52191c289bSCharles Ting translator srp_portinfo_t < srpt_session_t *P > {
53191c289bSCharles Ting 	pi_initiator = P->ss_i_name;
54191c289bSCharles Ting 	pi_i_sid = P->ss_i_alias;
55191c289bSCharles Ting 	pi_target = P->ss_t_name;
56191c289bSCharles Ting 	pi_t_sid = P->ss_t_alias;
57191c289bSCharles Ting 	pi_chan_id = 0;
58191c289bSCharles Ting };
59191c289bSCharles Ting 
60191c289bSCharles Ting #pragma D binding "1.5" translator
61191c289bSCharles Ting translator conninfo_t < srpt_channel_t *P > {
62191c289bSCharles Ting 	ci_local = P->ch_session->ss_i_gid;
63191c289bSCharles Ting 	ci_remote = P->ch_session->ss_t_gid;
64191c289bSCharles Ting };
65191c289bSCharles Ting 
66191c289bSCharles Ting #pragma D binding "1.5" translator
67191c289bSCharles Ting translator srp_portinfo_t < srpt_channel_t *P > {
68191c289bSCharles Ting 	pi_initiator = P->ch_session->ss_i_name;
69191c289bSCharles Ting 	pi_i_sid = P->ch_session->ss_i_alias;
70191c289bSCharles Ting 	pi_target = P->ch_session->ss_t_name;
71191c289bSCharles Ting 	pi_t_sid = P->ch_session->ss_t_alias;
72191c289bSCharles Ting 	pi_chan_id = (uintptr_t)P->ch_chan_hdl;
73191c289bSCharles Ting };
74191c289bSCharles Ting 
75191c289bSCharles Ting typedef struct srp_logininfo {
76191c289bSCharles Ting 	uint64_t li_task_tag;	   /* SRP task tag */
77191c289bSCharles Ting 	uint32_t li_max_it_iu_len; /* Maximum iu length that initiator can
78191c289bSCharles Ting 				      send to target */
79191c289bSCharles Ting 	uint32_t li_max_ti_iu_len; /* Maximum iu length that target can
80191c289bSCharles Ting 				      send to initiator */
81191c289bSCharles Ting 	uint32_t li_request_limit; /* Maximun number of SRP requests
82191c289bSCharles Ting 				      that initiator can send on a channel */
83191c289bSCharles Ting 	uint32_t li_reason_code;   /* Reason code */
84191c289bSCharles Ting } srp_logininfo_t;
85191c289bSCharles Ting 
86191c289bSCharles Ting #pragma D binding "1.5" translator
87191c289bSCharles Ting translator srp_logininfo_t < srp_login_req_t *P > {
88191c289bSCharles Ting 	li_task_tag = P->lreq_tag;
89191c289bSCharles Ting 	li_max_it_iu_len = ntohl(P->lreq_req_it_iu_len);
90191c289bSCharles Ting 	li_max_ti_iu_len = 0;
91191c289bSCharles Ting 	li_request_limit = 0;
92191c289bSCharles Ting 	li_reason_code = 0;
93191c289bSCharles Ting };
94191c289bSCharles Ting 
95191c289bSCharles Ting #pragma D binding "1.5" translator
96191c289bSCharles Ting translator srp_logininfo_t < srp_login_rsp_t *P > {
97191c289bSCharles Ting 	li_task_tag = P->lrsp_tag;
98191c289bSCharles Ting 	li_max_it_iu_len = ntohl(P->lrsp_max_it_iu_len);
99191c289bSCharles Ting 	li_max_ti_iu_len = ntohl(P->lrsp_max_ti_iu_len);
100191c289bSCharles Ting 	li_request_limit = ntohl(P->lrsp_req_limit_delta);
101191c289bSCharles Ting 	li_reason_code = ntohl(((srp_login_rej_t *)arg2)->lrej_reason);
102191c289bSCharles Ting };
103191c289bSCharles Ting 
104191c289bSCharles Ting typedef struct srp_taskinfo {
105191c289bSCharles Ting 	uint64_t ti_task_tag;	/* SRP task tag */
106191c289bSCharles Ting 	uint64_t ti_lun;	/* Target logical unit number */
107191c289bSCharles Ting 	uint8_t  ti_function;	/* Task management function */
108191c289bSCharles Ting 	uint32_t ti_req_limit_delta; /* Increment of channel's request limit */
109191c289bSCharles Ting 	uint8_t  ti_flag;	     /* bit 2: DOOVER */
110191c289bSCharles Ting 	                             /* bit 3: DOUNDER */
111191c289bSCharles Ting 	                             /* bit 4: DIOVER */
112191c289bSCharles Ting 	                             /* bit 5: DIUNDER */
113191c289bSCharles Ting 	uint32_t ti_do_resid_cnt;    /* Data-out residual count */
114191c289bSCharles Ting 	uint32_t ti_di_resid_cnt;    /* Data-in residual count */
115191c289bSCharles Ting 	uint8_t  ti_status;     /* Status of this task */
116191c289bSCharles Ting } srp_taskinfo_t;
117191c289bSCharles Ting 
118191c289bSCharles Ting #pragma D binding "1.5" translator
119191c289bSCharles Ting translator srp_taskinfo_t < srp_cmd_req_t *P > {
120191c289bSCharles Ting 	ti_task_tag = P->cr_tag;
121191c289bSCharles Ting 	ti_lun = (ntohl(*((uint32_t *)P->cr_lun)) << 32) +
122191c289bSCharles Ting 	    ntohl(*((uint32_t *)&P->cr_lun[4]));
123191c289bSCharles Ting 	ti_function = P->cr_type == 1 ?  /* 1: MGMT CMD 2: SRP CMD */
124191c289bSCharles Ting 	    ((srp_tsk_mgmt_t *)P)->tm_function : 0;
125191c289bSCharles Ting 	ti_req_limit_delta = 0;
126191c289bSCharles Ting 	ti_flag = 0;
127191c289bSCharles Ting 	ti_do_resid_cnt = 0;
128191c289bSCharles Ting 	ti_di_resid_cnt = 0;
129191c289bSCharles Ting 	ti_status = 0;
130191c289bSCharles Ting };
131191c289bSCharles Ting 
132191c289bSCharles Ting #pragma D binding "1.5" translator
133191c289bSCharles Ting translator srp_taskinfo_t < srp_rsp_t *P > {
134191c289bSCharles Ting 	ti_task_tag = P->rsp_tag;
135191c289bSCharles Ting 	ti_lun = ntohll(*(uint64_t *)((scsi_task_t *)arg2)->task_lun_no);
136191c289bSCharles Ting 	ti_function = ((scsi_task_t *)arg2)->task_mgmt_function;
137191c289bSCharles Ting 	ti_req_limit_delta = ntohl(P->rsp_req_limit_delta);
138191c289bSCharles Ting 	ti_flag = P->rsp_flags;
139191c289bSCharles Ting 	ti_do_resid_cnt = ntohl(P->rsp_do_resid_cnt);
140191c289bSCharles Ting 	ti_di_resid_cnt = ntohl(P->rsp_di_resid_cnt);
141191c289bSCharles Ting 	ti_status = arg3;
142191c289bSCharles Ting };
143191c289bSCharles Ting 
144191c289bSCharles Ting #pragma D binding "1.5" translator
145*7830165bSCharles Ting translator srp_taskinfo_t < srpt_iu_t *P > {
146*7830165bSCharles Ting 	ti_task_tag = P->iu_tag;
147*7830165bSCharles Ting 	ti_lun = ntohll(*(uint64_t *)P->iu_stmf_task->task_lun_no);
148*7830165bSCharles Ting 	ti_function = 0;
149*7830165bSCharles Ting 	ti_req_limit_delta = 0;
150*7830165bSCharles Ting 	ti_flag = 0;
151*7830165bSCharles Ting 	ti_do_resid_cnt = 0;
152*7830165bSCharles Ting 	ti_di_resid_cnt = 0;
153*7830165bSCharles Ting 	ti_status = 0;
154*7830165bSCharles Ting };
155*7830165bSCharles Ting 
156*7830165bSCharles Ting #pragma D binding "1.5" translator
157191c289bSCharles Ting translator xferinfo_t < ibt_wr_ds_t *P > {
158191c289bSCharles Ting 	xfer_laddr = P->ds_va + arg4;
159191c289bSCharles Ting 	xfer_lkey = P->ds_key;
160*7830165bSCharles Ting 	xfer_raddr = (arg3 == 0) ? 0 :
161*7830165bSCharles Ting 	    ((ibt_send_wr_t *)arg3)->wr.rc.rcwr.rdma.rdma_raddr;
162*7830165bSCharles Ting 	xfer_rkey = (arg3 == 0) ? 0 :
163*7830165bSCharles Ting 	    ((ibt_send_wr_t *)arg3)->wr.rc.rcwr.rdma.rdma_rkey;
164*7830165bSCharles Ting 	xfer_len = arg4;
165*7830165bSCharles Ting 	xfer_loffset = arg5;
166*7830165bSCharles Ting 	xfer_roffset = arg6;
167*7830165bSCharles Ting 	xfer_type = arg7;
168191c289bSCharles Ting };
169