1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24*0Sstevel@tonic-gate * Use is subject to license terms. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #ifndef _SYS_IB_MGT_IBMF_IBMF_RMPP_H 28*0Sstevel@tonic-gate #define _SYS_IB_MGT_IBMF_IBMF_RMPP_H 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate /* 33*0Sstevel@tonic-gate * This file contains the IBMF RMPP implementation dependent structures 34*0Sstevel@tonic-gate * and defines. 35*0Sstevel@tonic-gate */ 36*0Sstevel@tonic-gate 37*0Sstevel@tonic-gate #ifdef __cplusplus 38*0Sstevel@tonic-gate extern "C" { 39*0Sstevel@tonic-gate #endif 40*0Sstevel@tonic-gate 41*0Sstevel@tonic-gate /* The RMPP context */ 42*0Sstevel@tonic-gate typedef struct _ibmf_rmpp_ctx_t { 43*0Sstevel@tonic-gate uint32_t rmpp_wf; /* first segment in window (send) */ 44*0Sstevel@tonic-gate uint32_t rmpp_wl; /* last segment in window (send) */ 45*0Sstevel@tonic-gate uint32_t rmpp_ns; /* next segment in window (send) */ 46*0Sstevel@tonic-gate uint32_t rmpp_es; /* expected segment num (receive) */ 47*0Sstevel@tonic-gate uint32_t rmpp_is_ds; /* direction change indicator */ 48*0Sstevel@tonic-gate uint32_t rmpp_nwl; /* new window last */ 49*0Sstevel@tonic-gate uint32_t rmpp_pyld_len; /* payload length */ 50*0Sstevel@tonic-gate uint32_t rmpp_state; /* rmpp protocol state */ 51*0Sstevel@tonic-gate uint32_t rmpp_retry_cnt; /* retry count */ 52*0Sstevel@tonic-gate uint32_t rmpp_pkt_data_sz; /* data size in packet */ 53*0Sstevel@tonic-gate uint32_t rmpp_last_pkt_sz; /* data size in last packet */ 54*0Sstevel@tonic-gate uint32_t rmpp_num_pkts; /* number of packets needed */ 55*0Sstevel@tonic-gate size_t rmpp_data_offset; /* offset in data buffer */ 56*0Sstevel@tonic-gate uint32_t rmpp_word3; /* 3rd word of RMPP hdr */ 57*0Sstevel@tonic-gate uint32_t rmpp_word4; /* 4th word of RMPP hdr */ 58*0Sstevel@tonic-gate uint8_t rmpp_type; /* type of RMPP packet */ 59*0Sstevel@tonic-gate uint8_t rmpp_respt; /* resp time for RMPP packet */ 60*0Sstevel@tonic-gate uint8_t rmpp_flags; /* rmpp flags */ 61*0Sstevel@tonic-gate uint8_t rmpp_status; /* status for RMPP packet */ 62*0Sstevel@tonic-gate } ibmf_rmpp_ctx_t; 63*0Sstevel@tonic-gate 64*0Sstevel@tonic-gate /* RMPP state definitions */ 65*0Sstevel@tonic-gate #define IBMF_RMPP_STATE_UNDEFINED 0 66*0Sstevel@tonic-gate #define IBMF_RMPP_STATE_SENDER_ACTIVE 1 67*0Sstevel@tonic-gate #define IBMF_RMPP_STATE_SENDER_SWITCH 2 68*0Sstevel@tonic-gate #define IBMF_RMPP_STATE_RECEVR_ACTIVE 3 69*0Sstevel@tonic-gate #define IBMF_RMPP_STATE_RECEVR_TERMINATE 4 70*0Sstevel@tonic-gate #define IBMF_RMPP_STATE_ABORT 5 71*0Sstevel@tonic-gate #define IBMF_RMPP_STATE_DONE 6 72*0Sstevel@tonic-gate 73*0Sstevel@tonic-gate /* RMPP context flags definition */ 74*0Sstevel@tonic-gate #define IBMF_CTX_RMPP_FLAGS_DYN_PYLD 8 75*0Sstevel@tonic-gate 76*0Sstevel@tonic-gate #define IBMF_RMPP_DEFAULT_RRESPT 0x1F 77*0Sstevel@tonic-gate #define IBMF_RMPP_TERM_RRESPT 0xE 78*0Sstevel@tonic-gate 79*0Sstevel@tonic-gate #define IBMF_RMPP_METHOD_RESP_BIT 0x80 80*0Sstevel@tonic-gate 81*0Sstevel@tonic-gate /* RMPP header (IB Architecture Specification 1.1, Section 13.6.2) */ 82*0Sstevel@tonic-gate #if defined(_BIT_FIELDS_HTOL) 83*0Sstevel@tonic-gate typedef struct _ibmf_rmpp_hdr_t { 84*0Sstevel@tonic-gate uint8_t rmpp_version; /* RMPP version = 1 */ 85*0Sstevel@tonic-gate uint8_t rmpp_type; /* RMPP packet type */ 86*0Sstevel@tonic-gate uint8_t rmpp_resp_time :5; /* response time val */ 87*0Sstevel@tonic-gate uint8_t rmpp_flags :3; /* RMPP flags */ 88*0Sstevel@tonic-gate uint8_t rmpp_status; /* RMPP status */ 89*0Sstevel@tonic-gate 90*0Sstevel@tonic-gate uint32_t rmpp_segnum; /* packet ID */ 91*0Sstevel@tonic-gate 92*0Sstevel@tonic-gate /* Payload len for data or, NewWindowLast for ack packets */ 93*0Sstevel@tonic-gate uint32_t rmpp_pyldlen_nwl; 94*0Sstevel@tonic-gate } ibmf_rmpp_hdr_t; 95*0Sstevel@tonic-gate #else 96*0Sstevel@tonic-gate typedef struct _ibmf_rmpp_hdr_t { 97*0Sstevel@tonic-gate uint8_t rmpp_version; /* RMPP version = 1 */ 98*0Sstevel@tonic-gate uint8_t rmpp_type; /* RMPP packet type */ 99*0Sstevel@tonic-gate uint8_t rmpp_flags :3; /* RMPP flags */ 100*0Sstevel@tonic-gate uint8_t rmpp_resp_time :5; /* response time val */ 101*0Sstevel@tonic-gate uint8_t rmpp_status; /* RMPP status */ 102*0Sstevel@tonic-gate 103*0Sstevel@tonic-gate uint32_t rmpp_segnum; /* packet ID */ 104*0Sstevel@tonic-gate 105*0Sstevel@tonic-gate /* Payload len for data or, NewWindowLast for ack packets */ 106*0Sstevel@tonic-gate uint32_t rmpp_pyldlen_nwl; 107*0Sstevel@tonic-gate } ibmf_rmpp_hdr_t; 108*0Sstevel@tonic-gate #endif 109*0Sstevel@tonic-gate 110*0Sstevel@tonic-gate _NOTE(READ_ONLY_DATA(ibmf_rmpp_hdr_t)) 111*0Sstevel@tonic-gate 112*0Sstevel@tonic-gate /* RMPP header type definitions */ 113*0Sstevel@tonic-gate #define IBMF_RMPP_TYPE_NONE 0 114*0Sstevel@tonic-gate #define IBMF_RMPP_TYPE_DATA 1 115*0Sstevel@tonic-gate #define IBMF_RMPP_TYPE_ACK 2 116*0Sstevel@tonic-gate #define IBMF_RMPP_TYPE_STOP 3 117*0Sstevel@tonic-gate #define IBMF_RMPP_TYPE_ABORT 4 118*0Sstevel@tonic-gate 119*0Sstevel@tonic-gate /* RMPP header flags definitions */ 120*0Sstevel@tonic-gate #define IBMF_RMPP_FLAGS_ACTIVE 0x1 121*0Sstevel@tonic-gate #define IBMF_RMPP_FLAGS_FIRST_PKT 0x2 122*0Sstevel@tonic-gate #define IBMF_RMPP_FLAGS_LAST_PKT 0x4 123*0Sstevel@tonic-gate 124*0Sstevel@tonic-gate /* RMPP_header status definitions */ 125*0Sstevel@tonic-gate #define IBMF_RMPP_STATUS_NORMAL 0 /* Normal */ 126*0Sstevel@tonic-gate #define IBMF_RMPP_STATUS_RESX 1 /* Resources exhausted */ 127*0Sstevel@tonic-gate #define IBMF_RMPP_STATUS_T2L 118 /* Total time too long */ 128*0Sstevel@tonic-gate 129*0Sstevel@tonic-gate /* Inconsistent last and payload length */ 130*0Sstevel@tonic-gate #define IBMF_RMPP_STATUS_ILPL 119 131*0Sstevel@tonic-gate 132*0Sstevel@tonic-gate /* Inconsistent first and segment number */ 133*0Sstevel@tonic-gate #define IBMF_RMPP_STATUS_IFSN 120 134*0Sstevel@tonic-gate 135*0Sstevel@tonic-gate #define IBMF_RMPP_STATUS_BADT 121 /* Bad RMPP type */ 136*0Sstevel@tonic-gate #define IBMF_RMPP_STATUS_W2S 122 /* New window last too small */ 137*0Sstevel@tonic-gate #define IBMF_RMPP_STATUS_S2B 123 /* Segment number too big */ 138*0Sstevel@tonic-gate #define IBMF_RMPP_STATUS_IS 124 /* Illegal status */ 139*0Sstevel@tonic-gate #define IBMF_RMPP_STATUS_UNV 125 /* Unsupported version */ 140*0Sstevel@tonic-gate #define IBMF_RMPP_STATUS_TMR 126 /* Too many retries */ 141*0Sstevel@tonic-gate #define IBMF_RMPP_STATUS_USP 127 /* Unspecified error */ 142*0Sstevel@tonic-gate 143*0Sstevel@tonic-gate #define IBMF_RMPP_VERSION 1 144*0Sstevel@tonic-gate #define IBMF_RMPP_DEFAULT_WIN_SZ 5 145*0Sstevel@tonic-gate #define IBMF_NO_BLOCK 0 146*0Sstevel@tonic-gate 147*0Sstevel@tonic-gate #ifdef __cplusplus 148*0Sstevel@tonic-gate } 149*0Sstevel@tonic-gate #endif 150*0Sstevel@tonic-gate 151*0Sstevel@tonic-gate #endif /* _SYS_IB_MGT_IBMF_IBMF_RMPP_H */ 152