4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #
pragma D depends_on library net
.d
28 #
pragma D depends_on library scsi
.d
29 #
pragma D depends_on
module genunix
30 #
pragma D depends_on
module srpt
32 typedef struct srp_portinfo
{
34 string pi_initiator
; /* Initiator: eui.xxxxxxxxxxxxxxx */
35 string pi_i_sid
; /* Initiator session id */
38 string pi_target
; /* Target: eui.xxxxxxxxxxxxxxx */
39 string pi_t_sid
; /* Target session id */
41 uintptr_t pi_chan_id
; /* Channel identifier */
44 #
pragma D binding
"1.5" translator
45 translator conninfo_t
< srpt_session_t
*P
> {
46 ci_local
= P
->ss_t_gid
;
47 ci_remote
= P
->ss_i_gid
;
51 #
pragma D binding
"1.5" translator
52 translator srp_portinfo_t
< srpt_session_t
*P
> {
53 pi_initiator
= P
->ss_i_name
;
54 pi_i_sid
= P
->ss_i_alias
;
55 pi_target
= P
->ss_t_name
;
56 pi_t_sid
= P
->ss_t_alias
;
60 #
pragma D binding
"1.5" translator
61 translator conninfo_t
< srpt_channel_t
*P
> {
62 ci_local
= P
->ch_session
->ss_i_gid
;
63 ci_remote
= P
->ch_session
->ss_t_gid
;
66 #
pragma D binding
"1.5" translator
67 translator srp_portinfo_t
< srpt_channel_t
*P
> {
68 pi_initiator
= P
->ch_session
->ss_i_name
;
69 pi_i_sid
= P
->ch_session
->ss_i_alias
;
70 pi_target
= P
->ch_session
->ss_t_name
;
71 pi_t_sid
= P
->ch_session
->ss_t_alias
;
72 pi_chan_id
= (uintptr_t
)P
->ch_chan_hdl
;
75 typedef struct srp_logininfo
{
76 uint64_t li_task_tag
; /* SRP task tag */
77 uint32_t li_max_it_iu_len
; /* Maximum iu length that initiator can
79 uint32_t li_max_ti_iu_len
; /* Maximum iu length that target can
81 uint32_t li_request_limit
; /* Maximun number of SRP requests
82 that initiator can send on a channel */
83 uint32_t li_reason_code
; /* Reason code */
86 #
pragma D binding
"1.5" translator
87 translator srp_logininfo_t
< srp_login_req_t
*P
> {
88 li_task_tag
= P
->lreq_tag
;
89 li_max_it_iu_len
= ntohl(P
->lreq_req_it_iu_len
);
95 #
pragma D binding
"1.5" translator
96 translator srp_logininfo_t
< srp_login_rsp_t
*P
> {
97 li_task_tag
= P
->lrsp_tag
;
98 li_max_it_iu_len
= ntohl(P
->lrsp_max_it_iu_len
);
99 li_max_ti_iu_len
= ntohl(P
->lrsp_max_ti_iu_len
);
100 li_request_limit
= ntohl(P
->lrsp_req_limit_delta
);
101 li_reason_code
= ntohl(((srp_login_rej_t
*)arg2
)->lrej_reason
);
104 typedef struct srp_taskinfo
{
105 uint64_t ti_task_tag
; /* SRP task tag */
106 uint64_t ti_lun
; /* Target logical unit number */
107 uint8_t ti_function
; /* Task management function */
108 uint32_t ti_req_limit_delta
; /* Increment of channel's request limit */
109 uint8_t ti_flag
; /* bit 2: DOOVER */
113 uint32_t ti_do_resid_cnt
; /* Data-out residual count */
114 uint32_t ti_di_resid_cnt
; /* Data-in residual count */
115 uint8_t ti_status
; /* Status of this task */
118 #
pragma D binding
"1.5" translator
119 translator srp_taskinfo_t
< srp_cmd_req_t
*P
> {
120 ti_task_tag
= P
->cr_tag
;
121 ti_lun
= (ntohl(*((uint32_t
*)P
->cr_lun
)) << 32) +
122 ntohl(*((uint32_t
*)&P
->cr_lun
[4]));
123 ti_function
= P
->cr_type
== 1 ?
/* 1: MGMT CMD 2: SRP CMD */
124 ((srp_tsk_mgmt_t
*)P
)->tm_function
: 0;
125 ti_req_limit_delta
= 0;
132 #
pragma D binding
"1.5" translator
133 translator srp_taskinfo_t
< srp_rsp_t
*P
> {
134 ti_task_tag
= P
->rsp_tag
;
135 ti_lun
= ntohll(*(uint64_t
*)((scsi_task_t
*)arg2
)->task_lun_no
);
136 ti_function
= ((scsi_task_t
*)arg2
)->task_mgmt_function
;
137 ti_req_limit_delta
= ntohl(P
->rsp_req_limit_delta
);
138 ti_flag
= P
->rsp_flags
;
139 ti_do_resid_cnt
= ntohl(P
->rsp_do_resid_cnt
);
140 ti_di_resid_cnt
= ntohl(P
->rsp_di_resid_cnt
);
144 #
pragma D binding
"1.5" translator
145 translator srp_taskinfo_t
< srpt_iu_t
*P
> {
146 ti_task_tag
= P
->iu_tag
;
147 ti_lun
= ntohll(*(uint64_t
*)P
->iu_stmf_task
->task_lun_no
);
149 ti_req_limit_delta
= 0;
156 #
pragma D binding
"1.5" translator
157 translator xferinfo_t
< ibt_wr_ds_t
*P
> {
158 xfer_laddr
= P
->ds_va
+ arg4
;
159 xfer_lkey
= P
->ds_key
;
160 xfer_raddr
= (arg3
== 0) ?
0 :
161 ((ibt_send_wr_t
*)arg3
)->wr
.rc
.rcwr
.rdma
.rdma_raddr
;
162 xfer_rkey
= (arg3
== 0) ?
0 :
163 ((ibt_send_wr_t
*)arg3
)->wr
.rc
.rcwr
.rdma
.rdma_rkey
;