1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef _SYS_IB_IB_PKT_HDRS_H
28*7c478bd9Sstevel@tonic-gate #define	_SYS_IB_IB_PKT_HDRS_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus
31*7c478bd9Sstevel@tonic-gate extern "C" {
32*7c478bd9Sstevel@tonic-gate #endif
33*7c478bd9Sstevel@tonic-gate 
34*7c478bd9Sstevel@tonic-gate typedef struct _ib_lrh_hdr_t {
35*7c478bd9Sstevel@tonic-gate 	uint8_t		VL_LVer; 	/* virtual lane pkt is using & */
36*7c478bd9Sstevel@tonic-gate 					/* link level protocol of pkt  */
37*7c478bd9Sstevel@tonic-gate 	uint8_t		SL_LNH;		/* requested service level */
38*7c478bd9Sstevel@tonic-gate 					/* & headers following LRH */
39*7c478bd9Sstevel@tonic-gate 	ib_lid_t	DLID; 		/* dest port and path on subnet */
40*7c478bd9Sstevel@tonic-gate 	uint16_t	PktLen;		/* size of packet in four-byte words */
41*7c478bd9Sstevel@tonic-gate 	ib_lid_t	SLID;		/* source port on subnet */
42*7c478bd9Sstevel@tonic-gate } ib_lrh_hdr_t;
43*7c478bd9Sstevel@tonic-gate 
44*7c478bd9Sstevel@tonic-gate /* defines and masks that go with local routing header */
45*7c478bd9Sstevel@tonic-gate #define	IB_LRH_VL_MASK				0xF0
46*7c478bd9Sstevel@tonic-gate #define	IB_LRH_VERSION_MASK			0x0F
47*7c478bd9Sstevel@tonic-gate #define	IB_LRH_SL_MASK				0xF0
48*7c478bd9Sstevel@tonic-gate #define	IB_LRH_NEXT_HDR_MASK			0x03
49*7c478bd9Sstevel@tonic-gate #define	IB_LRH_NEXT_HDR_RWH			0x00
50*7c478bd9Sstevel@tonic-gate #define	IB_LRH_NEXT_HDR_IPV6			0x01
51*7c478bd9Sstevel@tonic-gate #define	IB_LRH_NEXT_HDR_BTH			0x02
52*7c478bd9Sstevel@tonic-gate #define	IB_LRH_NEXT_HDR_GRH			0x03
53*7c478bd9Sstevel@tonic-gate #define	IB_LRH_PACKET_LENGTH_MASK		0x07FF
54*7c478bd9Sstevel@tonic-gate 
55*7c478bd9Sstevel@tonic-gate typedef struct _ib_grh_t {
56*7c478bd9Sstevel@tonic-gate 	uint32_t	IPVer_TC_Flow; 	/* version, traffic class & */
57*7c478bd9Sstevel@tonic-gate 					/* flow label of the packet */
58*7c478bd9Sstevel@tonic-gate 	uint16_t	PayLen;		/* len of the pkt following the GRH */
59*7c478bd9Sstevel@tonic-gate 	uint8_t		NxtHdr;		/* Header following the GRH */
60*7c478bd9Sstevel@tonic-gate 	uint8_t		HopLmt;		/* max hops the pkt can take */
61*7c478bd9Sstevel@tonic-gate 	ib_gid_t	SGID;		/* GID of the source port */
62*7c478bd9Sstevel@tonic-gate 	ib_gid_t	DGID;		/* GID of the consuming port */
63*7c478bd9Sstevel@tonic-gate } ib_grh_t;
64*7c478bd9Sstevel@tonic-gate 
65*7c478bd9Sstevel@tonic-gate /* defines and masks that go with global route header */
66*7c478bd9Sstevel@tonic-gate #define	IB_GRH_IPVER_MASK			0xF0000000
67*7c478bd9Sstevel@tonic-gate #define	IB_GRH_TCLASS_MASK			0x0FF00000
68*7c478bd9Sstevel@tonic-gate #define	IB_GRH_FLOW_LABEL_MASK			0x000FFFFF
69*7c478bd9Sstevel@tonic-gate #define	IB_GRH_NEXT_HDR_BTH			0x1B
70*7c478bd9Sstevel@tonic-gate 
71*7c478bd9Sstevel@tonic-gate typedef struct _ib_bth_hdr_t {
72*7c478bd9Sstevel@tonic-gate 	uint8_t 	OpCode;				/* iba packet type */
73*7c478bd9Sstevel@tonic-gate 	uint8_t 	SE_M_PadCnt_TVer; /* responder should generate event */
74*7c478bd9Sstevel@tonic-gate 				/* & migration state & payload pad count */
75*7c478bd9Sstevel@tonic-gate 				/* & version of ibta transport headers */
76*7c478bd9Sstevel@tonic-gate 	uint16_t 	P_Key; 		/* logical partition assoc with pkt */
77*7c478bd9Sstevel@tonic-gate 	uint32_t	Reserved_DestQP; /* queue pair of dest */
78*7c478bd9Sstevel@tonic-gate 	uint32_t	A_PSN; 		/* responder should generate ack & */
79*7c478bd9Sstevel@tonic-gate 				/* packet sequence number */
80*7c478bd9Sstevel@tonic-gate } ib_bth_hdr_t;
81*7c478bd9Sstevel@tonic-gate 
82*7c478bd9Sstevel@tonic-gate /* defines and masks that go with base transport header */
83*7c478bd9Sstevel@tonic-gate #define	IB_BTH_SOLICITED_EVENT_MASK		0x80
84*7c478bd9Sstevel@tonic-gate #define	IB_BTH_MIG_REQ_MASK			0x40
85*7c478bd9Sstevel@tonic-gate #define	IB_BTH_PAD_CNT_MASK			0x30
86*7c478bd9Sstevel@tonic-gate #define	IB_BTH_TVER_MASK			0x0F
87*7c478bd9Sstevel@tonic-gate #define	IB_BTH_DEST_QP_MASK			0x00FFFFFF
88*7c478bd9Sstevel@tonic-gate #define	IB_BTH_ACK_REQ_MASK			0x80000000
89*7c478bd9Sstevel@tonic-gate #define	IB_BTH_PSN_MASK				0x00FFFFFF
90*7c478bd9Sstevel@tonic-gate 
91*7c478bd9Sstevel@tonic-gate typedef struct _ib_deth_hdr_t {
92*7c478bd9Sstevel@tonic-gate 	uint32_t	Q_Key;		/* queue key */
93*7c478bd9Sstevel@tonic-gate 	uint32_t	Reserved_SrcQP;	/* queue pair of the source */
94*7c478bd9Sstevel@tonic-gate } ib_deth_hdr_t;
95*7c478bd9Sstevel@tonic-gate 
96*7c478bd9Sstevel@tonic-gate #define	IB_DETH_SRC_QP_MASK			0x00FFFFFF
97*7c478bd9Sstevel@tonic-gate 
98*7c478bd9Sstevel@tonic-gate /* defines and masks that go with datagram extended transport header */
99*7c478bd9Sstevel@tonic-gate #define	IB_DETH_SRC_QP_MASK			0x00FFFFFF
100*7c478bd9Sstevel@tonic-gate 
101*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus
102*7c478bd9Sstevel@tonic-gate }
103*7c478bd9Sstevel@tonic-gate #endif
104*7c478bd9Sstevel@tonic-gate 
105*7c478bd9Sstevel@tonic-gate #endif /* _SYS_IB_IB_PKT_HDRS_H */
106