xref: /freebsd/contrib/ofed/libibverbs/sa.h (revision b9f654b163bce26de79705e77b872427c9f2afa1)
1 /*
2  * Copyright (c) 2004 Topspin Communications.  All rights reserved.
3  * Copyright (c) 2005 Voltaire, Inc. All rights reserved.
4  *
5  * This software is available to you under a choice of one of two
6  * licenses.  You may choose to be licensed under the terms of the GNU
7  * General Public License (GPL) Version 2, available from the file
8  * COPYING in the main directory of this source tree, or the
9  * OpenIB.org BSD license below:
10  *
11  *     Redistribution and use in source and binary forms, with or
12  *     without modification, are permitted provided that the following
13  *     conditions are met:
14  *
15  *      - Redistributions of source code must retain the above
16  *        copyright notice, this list of conditions and the following
17  *        disclaimer.
18  *
19  *      - Redistributions in binary form must reproduce the above
20  *        copyright notice, this list of conditions and the following
21  *        disclaimer in the documentation and/or other materials
22  *        provided with the distribution.
23  *
24  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31  * SOFTWARE.
32  */
33 
34 #ifndef INFINIBAND_SA_H
35 #define INFINIBAND_SA_H
36 
37 #include <infiniband/verbs.h>
38 #include <infiniband/types.h>
39 
40 struct ibv_sa_path_rec {
41 	/* reserved */
42 	/* reserved */
43 	union ibv_gid dgid;
44 	union ibv_gid sgid;
45 	__be16        dlid;
46 	__be16        slid;
47 	int           raw_traffic;
48 	/* reserved */
49 	__be32        flow_label;
50 	uint8_t       hop_limit;
51 	uint8_t       traffic_class;
52 	int           reversible;
53 	uint8_t       numb_path;
54 	__be16        pkey;
55 	/* reserved */
56 	uint8_t       sl;
57 	uint8_t       mtu_selector;
58 	uint8_t	      mtu;
59 	uint8_t       rate_selector;
60 	uint8_t       rate;
61 	uint8_t       packet_life_time_selector;
62 	uint8_t       packet_life_time;
63 	uint8_t       preference;
64 };
65 
66 struct ibv_sa_mcmember_rec {
67 	union ibv_gid mgid;
68 	union ibv_gid port_gid;
69 	uint32_t      qkey;
70 	uint16_t      mlid;
71 	uint8_t       mtu_selector;
72 	uint8_t       mtu;
73 	uint8_t       traffic_class;
74 	uint16_t      pkey;
75 	uint8_t       rate_selector;
76 	uint8_t       rate;
77 	uint8_t       packet_life_time_selector;
78 	uint8_t       packet_life_time;
79 	uint8_t       sl;
80 	uint32_t      flow_label;
81 	uint8_t       hop_limit;
82 	uint8_t       scope;
83 	uint8_t       join_state;
84 	int           proxy_join;
85 };
86 
87 struct ibv_sa_service_rec {
88 	uint64_t      id;
89 	union ibv_gid gid;
90 	uint16_t      pkey;
91 	/* uint16_t  resv;   */
92 	uint32_t      lease;
93 	uint8_t       key[16];
94 	uint8_t       name[64];
95 	uint8_t       data8[16];
96 	uint16_t      data16[8];
97 	uint32_t      data32[4];
98 	uint64_t      data64[2];
99 };
100 
101 #define IBV_PATH_RECORD_REVERSIBLE 0x80
102 
103 struct ibv_path_record {
104 	__be64		service_id;
105 	union ibv_gid	dgid;
106 	union ibv_gid	sgid;
107 	__be16		dlid;
108 	__be16		slid;
109 	__be32		flowlabel_hoplimit; /* resv-31:28 flow label-27:8 hop limit-7:0*/
110 	uint8_t		tclass;
111 	uint8_t		reversible_numpath; /* reversible-7:7 num path-6:0 */
112 	__be16		pkey;
113 	__be16		qosclass_sl;	    /* qos class-15:4 sl-3:0 */
114 	uint8_t		mtu;		    /* mtu selector-7:6 mtu-5:0 */
115 	uint8_t		rate;		    /* rate selector-7:6 rate-5:0 */
116 	uint8_t		packetlifetime;	    /* lifetime selector-7:6 lifetime-5:0 */
117 	uint8_t		preference;
118 	uint8_t		reserved[6];
119 };
120 
121 #define IBV_PATH_FLAG_GMP	       (1<<0)
122 #define IBV_PATH_FLAG_PRIMARY	       (1<<1)
123 #define IBV_PATH_FLAG_ALTERNATE       (1<<2)
124 #define IBV_PATH_FLAG_OUTBOUND	       (1<<3)
125 #define IBV_PATH_FLAG_INBOUND	       (1<<4)
126 #define IBV_PATH_FLAG_INBOUND_REVERSE (1<<5)
127 #define IBV_PATH_FLAG_BIDIRECTIONAL   (IBV_PATH_FLAG_OUTBOUND |     \
128 					IBV_PATH_FLAG_INBOUND_REVERSE)
129 
130 struct ibv_path_data {
131 	uint32_t		flags;
132 	uint32_t		reserved;
133 	struct ibv_path_record	path;
134 };
135 
136 #endif /* INFINIBAND_SA_H */
137