1 /* 2 * CDDL HEADER START 3 * 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. 7 * 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. 12 * 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] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 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 31 32 typedef struct srp_portinfo { 33 /* initiator */ 34 string pi_initiator; /* Initiator: eui.xxxxxxxxxxxxxxx */ 35 string pi_i_sid; /* Initiator session id */ 36 37 /* target */ 38 string pi_target; /* Target: eui.xxxxxxxxxxxxxxx */ 39 string pi_t_sid; /* Target session id */ 40 41 uintptr_t pi_chan_id; /* Channel identifier */ 42 } srp_portinfo_t; 43 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; 48 ci_protocol = "ib"; 49 }; 50 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; 57 pi_chan_id = 0; 58 }; 59 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; 64 }; 65 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; 73 }; 74 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 78 send to target */ 79 uint32_t li_max_ti_iu_len; /* Maximum iu length that target can 80 send to initiator */ 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 */ 84 } srp_logininfo_t; 85 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); 90 li_max_ti_iu_len = 0; 91 li_request_limit = 0; 92 li_reason_code = 0; 93 }; 94 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); 102 }; 103 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 */ 110 /* bit 3: DOUNDER */ 111 /* bit 4: DIOVER */ 112 /* bit 5: DIUNDER */ 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 */ 116 } srp_taskinfo_t; 117 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; 126 ti_flag = 0; 127 ti_do_resid_cnt = 0; 128 ti_di_resid_cnt = 0; 129 ti_status = 0; 130 }; 131 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); 141 ti_status = arg3; 142 }; 143 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); 148 ti_function = 0; 149 ti_req_limit_delta = 0; 150 ti_flag = 0; 151 ti_do_resid_cnt = 0; 152 ti_di_resid_cnt = 0; 153 ti_status = 0; 154 }; 155 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; 164 xfer_len = arg4; 165 xfer_loffset = arg5; 166 xfer_roffset = arg6; 167 xfer_type = arg7; 168 }; 169