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