xref: /onnv-gate/usr/src/uts/common/sys/ib/ib_pkt_hdrs.h (revision 0:68f95e015346)
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 2003 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_IB_PKT_HDRS_H
28*0Sstevel@tonic-gate #define	_SYS_IB_IB_PKT_HDRS_H
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #ifdef __cplusplus
33*0Sstevel@tonic-gate extern "C" {
34*0Sstevel@tonic-gate #endif
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate typedef struct _ib_lrh_hdr_t {
37*0Sstevel@tonic-gate 	uint8_t		VL_LVer; 	/* virtual lane pkt is using & */
38*0Sstevel@tonic-gate 					/* link level protocol of pkt  */
39*0Sstevel@tonic-gate 	uint8_t		SL_LNH;		/* requested service level */
40*0Sstevel@tonic-gate 					/* & headers following LRH */
41*0Sstevel@tonic-gate 	ib_lid_t	DLID; 		/* dest port and path on subnet */
42*0Sstevel@tonic-gate 	uint16_t	PktLen;		/* size of packet in four-byte words */
43*0Sstevel@tonic-gate 	ib_lid_t	SLID;		/* source port on subnet */
44*0Sstevel@tonic-gate } ib_lrh_hdr_t;
45*0Sstevel@tonic-gate 
46*0Sstevel@tonic-gate /* defines and masks that go with local routing header */
47*0Sstevel@tonic-gate #define	IB_LRH_VL_MASK				0xF0
48*0Sstevel@tonic-gate #define	IB_LRH_VERSION_MASK			0x0F
49*0Sstevel@tonic-gate #define	IB_LRH_SL_MASK				0xF0
50*0Sstevel@tonic-gate #define	IB_LRH_NEXT_HDR_MASK			0x03
51*0Sstevel@tonic-gate #define	IB_LRH_NEXT_HDR_RWH			0x00
52*0Sstevel@tonic-gate #define	IB_LRH_NEXT_HDR_IPV6			0x01
53*0Sstevel@tonic-gate #define	IB_LRH_NEXT_HDR_BTH			0x02
54*0Sstevel@tonic-gate #define	IB_LRH_NEXT_HDR_GRH			0x03
55*0Sstevel@tonic-gate #define	IB_LRH_PACKET_LENGTH_MASK		0x07FF
56*0Sstevel@tonic-gate 
57*0Sstevel@tonic-gate typedef struct _ib_grh_t {
58*0Sstevel@tonic-gate 	uint32_t	IPVer_TC_Flow; 	/* version, traffic class & */
59*0Sstevel@tonic-gate 					/* flow label of the packet */
60*0Sstevel@tonic-gate 	uint16_t	PayLen;		/* len of the pkt following the GRH */
61*0Sstevel@tonic-gate 	uint8_t		NxtHdr;		/* Header following the GRH */
62*0Sstevel@tonic-gate 	uint8_t		HopLmt;		/* max hops the pkt can take */
63*0Sstevel@tonic-gate 	ib_gid_t	SGID;		/* GID of the source port */
64*0Sstevel@tonic-gate 	ib_gid_t	DGID;		/* GID of the consuming port */
65*0Sstevel@tonic-gate } ib_grh_t;
66*0Sstevel@tonic-gate 
67*0Sstevel@tonic-gate /* defines and masks that go with global route header */
68*0Sstevel@tonic-gate #define	IB_GRH_IPVER_MASK			0xF0000000
69*0Sstevel@tonic-gate #define	IB_GRH_TCLASS_MASK			0x0FF00000
70*0Sstevel@tonic-gate #define	IB_GRH_FLOW_LABEL_MASK			0x000FFFFF
71*0Sstevel@tonic-gate #define	IB_GRH_NEXT_HDR_BTH			0x1B
72*0Sstevel@tonic-gate 
73*0Sstevel@tonic-gate typedef struct _ib_bth_hdr_t {
74*0Sstevel@tonic-gate 	uint8_t 	OpCode;				/* iba packet type */
75*0Sstevel@tonic-gate 	uint8_t 	SE_M_PadCnt_TVer; /* responder should generate event */
76*0Sstevel@tonic-gate 				/* & migration state & payload pad count */
77*0Sstevel@tonic-gate 				/* & version of ibta transport headers */
78*0Sstevel@tonic-gate 	uint16_t 	P_Key; 		/* logical partition assoc with pkt */
79*0Sstevel@tonic-gate 	uint32_t	Reserved_DestQP; /* queue pair of dest */
80*0Sstevel@tonic-gate 	uint32_t	A_PSN; 		/* responder should generate ack & */
81*0Sstevel@tonic-gate 				/* packet sequence number */
82*0Sstevel@tonic-gate } ib_bth_hdr_t;
83*0Sstevel@tonic-gate 
84*0Sstevel@tonic-gate /* defines and masks that go with base transport header */
85*0Sstevel@tonic-gate #define	IB_BTH_SOLICITED_EVENT_MASK		0x80
86*0Sstevel@tonic-gate #define	IB_BTH_MIG_REQ_MASK			0x40
87*0Sstevel@tonic-gate #define	IB_BTH_PAD_CNT_MASK			0x30
88*0Sstevel@tonic-gate #define	IB_BTH_TVER_MASK			0x0F
89*0Sstevel@tonic-gate #define	IB_BTH_DEST_QP_MASK			0x00FFFFFF
90*0Sstevel@tonic-gate #define	IB_BTH_ACK_REQ_MASK			0x80000000
91*0Sstevel@tonic-gate #define	IB_BTH_PSN_MASK				0x00FFFFFF
92*0Sstevel@tonic-gate 
93*0Sstevel@tonic-gate typedef struct _ib_deth_hdr_t {
94*0Sstevel@tonic-gate 	uint32_t	Q_Key;		/* queue key */
95*0Sstevel@tonic-gate 	uint32_t	Reserved_SrcQP;	/* queue pair of the source */
96*0Sstevel@tonic-gate } ib_deth_hdr_t;
97*0Sstevel@tonic-gate 
98*0Sstevel@tonic-gate #define	IB_DETH_SRC_QP_MASK			0x00FFFFFF
99*0Sstevel@tonic-gate 
100*0Sstevel@tonic-gate /* defines and masks that go with datagram extended transport header */
101*0Sstevel@tonic-gate #define	IB_DETH_SRC_QP_MASK			0x00FFFFFF
102*0Sstevel@tonic-gate 
103*0Sstevel@tonic-gate #ifdef __cplusplus
104*0Sstevel@tonic-gate }
105*0Sstevel@tonic-gate #endif
106*0Sstevel@tonic-gate 
107*0Sstevel@tonic-gate #endif /* _SYS_IB_IB_PKT_HDRS_H */
108