14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/*
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * CDDL HEADER START
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync *
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * The contents of this file are subject to the terms of the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Common Development and Distribution License (the "License").
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * You may not use this file except in compliance with the License.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync *
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * or http://www.opensolaris.org/os/licensing.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * See the License for the specific language governing permissions
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * and limitations under the License.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync *
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * When distributing Covered Code, include this CDDL HEADER in each
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * If applicable, add the following below this CDDL HEADER, with the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * fields enclosed by brackets "[]" replaced with your own identifying
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * information: Portions Copyright [yyyy] [name of copyright owner]
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync *
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * CDDL HEADER END
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/*
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Use is subject to license terms.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#pragma D depends_on library net.d
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#pragma D depends_on library scsi.d
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#pragma D depends_on module genunix
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#pragma D depends_on module srpt
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctypedef struct srp_portinfo {
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* initiator */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync string pi_initiator; /* Initiator: eui.xxxxxxxxxxxxxxx */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync string pi_i_sid; /* Initiator session id */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* target */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync string pi_target; /* Target: eui.xxxxxxxxxxxxxxx */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync string pi_t_sid; /* Target session id */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync uintptr_t pi_chan_id; /* Channel identifier */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync} srp_portinfo_t;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#pragma D binding "1.5" translator
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctranslator conninfo_t < srpt_session_t *P > {
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ci_local = P->ss_t_gid;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ci_remote = P->ss_i_gid;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ci_protocol = "ib";
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync};
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#pragma D binding "1.5" translator
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctranslator srp_portinfo_t < srpt_session_t *P > {
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync pi_initiator = P->ss_i_name;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync pi_i_sid = P->ss_i_alias;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync pi_target = P->ss_t_name;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync pi_t_sid = P->ss_t_alias;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync pi_chan_id = 0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync};
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#pragma D binding "1.5" translator
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctranslator conninfo_t < srpt_channel_t *P > {
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ci_local = P->ch_session->ss_i_gid;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ci_remote = P->ch_session->ss_t_gid;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync};
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#pragma D binding "1.5" translator
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctranslator srp_portinfo_t < srpt_channel_t *P > {
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync pi_initiator = P->ch_session->ss_i_name;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync pi_i_sid = P->ch_session->ss_i_alias;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync pi_target = P->ch_session->ss_t_name;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync pi_t_sid = P->ch_session->ss_t_alias;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync pi_chan_id = (uintptr_t)P->ch_chan_hdl;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync};
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctypedef struct srp_logininfo {
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync uint64_t li_task_tag; /* SRP task tag */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync uint32_t li_max_it_iu_len; /* Maximum iu length that initiator can
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync send to target */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync uint32_t li_max_ti_iu_len; /* Maximum iu length that target can
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync send to initiator */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync uint32_t li_request_limit; /* Maximun number of SRP requests
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync that initiator can send on a channel */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync uint32_t li_reason_code; /* Reason code */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync} srp_logininfo_t;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#pragma D binding "1.5" translator
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctranslator srp_logininfo_t < srp_login_req_t *P > {
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync li_task_tag = P->lreq_tag;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync li_max_it_iu_len = ntohl(P->lreq_req_it_iu_len);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync li_max_ti_iu_len = 0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync li_request_limit = 0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync li_reason_code = 0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync};
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#pragma D binding "1.5" translator
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctranslator srp_logininfo_t < srp_login_rsp_t *P > {
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync li_task_tag = P->lrsp_tag;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync li_max_it_iu_len = ntohl(P->lrsp_max_it_iu_len);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync li_max_ti_iu_len = ntohl(P->lrsp_max_ti_iu_len);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync li_request_limit = ntohl(P->lrsp_req_limit_delta);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync li_reason_code = ntohl(((srp_login_rej_t *)arg2)->lrej_reason);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync};
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctypedef struct srp_taskinfo {
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync uint64_t ti_task_tag; /* SRP task tag */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync uint64_t ti_lun; /* Target logical unit number */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync uint8_t ti_function; /* Task management function */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync uint32_t ti_req_limit_delta; /* Increment of channel's request limit */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync uint8_t ti_flag; /* bit 2: DOOVER */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* bit 3: DOUNDER */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* bit 4: DIOVER */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* bit 5: DIUNDER */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync uint32_t ti_do_resid_cnt; /* Data-out residual count */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync uint32_t ti_di_resid_cnt; /* Data-in residual count */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync uint8_t ti_status; /* Status of this task */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync} srp_taskinfo_t;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#pragma D binding "1.5" translator
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctranslator srp_taskinfo_t < srp_cmd_req_t *P > {
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ti_task_tag = P->cr_tag;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ti_lun = (ntohl(*((uint32_t *)P->cr_lun)) << 32) +
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ntohl(*((uint32_t *)&P->cr_lun[4]));
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ti_function = P->cr_type == 1 ? /* 1: MGMT CMD 2: SRP CMD */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ((srp_tsk_mgmt_t *)P)->tm_function : 0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ti_req_limit_delta = 0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ti_flag = 0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ti_do_resid_cnt = 0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ti_di_resid_cnt = 0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ti_status = 0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync};
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#pragma D binding "1.5" translator
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctranslator srp_taskinfo_t < srp_rsp_t *P > {
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ti_task_tag = P->rsp_tag;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ti_lun = ntohll(*(uint64_t *)((scsi_task_t *)arg2)->task_lun_no);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ti_function = ((scsi_task_t *)arg2)->task_mgmt_function;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ti_req_limit_delta = ntohl(P->rsp_req_limit_delta);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ti_flag = P->rsp_flags;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ti_do_resid_cnt = ntohl(P->rsp_do_resid_cnt);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ti_di_resid_cnt = ntohl(P->rsp_di_resid_cnt);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ti_status = arg3;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync};
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#pragma D binding "1.5" translator
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctranslator srp_taskinfo_t < srpt_iu_t *P > {
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ti_task_tag = P->iu_tag;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ti_lun = ntohll(*(uint64_t *)P->iu_stmf_task->task_lun_no);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ti_function = 0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ti_req_limit_delta = 0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ti_flag = 0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ti_do_resid_cnt = 0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ti_di_resid_cnt = 0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ti_status = 0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync};
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#pragma D binding "1.5" translator
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctranslator xferinfo_t < ibt_wr_ds_t *P > {
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync xfer_laddr = P->ds_va + arg4;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync xfer_lkey = P->ds_key;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync xfer_raddr = (arg3 == 0) ? 0 :
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ((ibt_send_wr_t *)arg3)->wr.rc.rcwr.rdma.rdma_raddr;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync xfer_rkey = (arg3 == 0) ? 0 :
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ((ibt_send_wr_t *)arg3)->wr.rc.rcwr.rdma.rdma_rkey;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync xfer_len = arg4;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync xfer_loffset = arg5;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync xfer_roffset = arg6;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync xfer_type = arg7;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync};