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