[image] Allow for zero embedded images
[people/asdlkf/gpxe.git] / src / drivers / net / mlx_ipoib / mad_attrib.h
1 /*
2   This software is available to you under a choice of one of two
3   licenses.  You may choose to be licensed under the terms of the GNU
4   General Public License (GPL) Version 2, available at
5   <http://www.fsf.org/copyleft/gpl.html>, or the OpenIB.org BSD
6   license, available in the LICENSE.TXT file accompanying this
7   software.  These details are also available at
8   <http://openib.org/license.html>.
9
10   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
11   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
12   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
13   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
14   BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
15   ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
16   CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   SOFTWARE.
18
19   Copyright (c) 2004 Mellanox Technologies Ltd.  All rights reserved.
20 */
21
22 #ifndef __mad_attrib_h_
23 #define __mad_attrib_h_
24
25 #include "ib_mad.h"
26
27 #define IB_SA_ATTR_MC_MEMBER_REC 0x38
28 #define IB_SA_ATTR_PATH_REC 0x35
29
30 #define IB_SA_MCMEMBER_REC_MGID                                         (1<<0)
31 #define IB_SA_MCMEMBER_REC_PORT_GID                                     (1<<1)
32 #define IB_SA_MCMEMBER_REC_QKEY                                         (1<<2)
33 #define IB_SA_MCMEMBER_REC_MLID                                         (1<<3)
34 #define IB_SA_MCMEMBER_REC_MTU_SELECTOR                         (1<<4)
35 #define IB_SA_MCMEMBER_REC_MTU                                          (1<<5)
36 #define IB_SA_MCMEMBER_REC_TRAFFIC_CLASS                        (1<<6)
37 #define IB_SA_MCMEMBER_REC_PKEY                                         (1<<7)
38 #define IB_SA_MCMEMBER_REC_RATE_SELECTOR                        (1<<8)
39 #define IB_SA_MCMEMBER_REC_RATE                                         (1<<9)
40 #define IB_SA_MCMEMBER_REC_PACKET_LIFE_TIME_SELECTOR    (1<<10)
41 #define IB_SA_MCMEMBER_REC_PACKET_LIFE_TIME                     (1<<11)
42 #define IB_SA_MCMEMBER_REC_SL                                           (1<<12)
43 #define IB_SA_MCMEMBER_REC_FLOW_LABEL                           (1<<13)
44 #define IB_SA_MCMEMBER_REC_HOP_LIMIT                            (1<<14)
45 #define IB_SA_MCMEMBER_REC_SCOPE                                        (1<<15)
46 #define IB_SA_MCMEMBER_REC_JOIN_STATE                           (1<<16)
47 #define IB_SA_MCMEMBER_REC_PROXY_JOIN                           (1<<17)
48
49 #define IB_SA_PATH_REC_DGID             (1<<2)
50 #define IB_SA_PATH_REC_SGID             (1<<3)
51
52 struct port_info_st {
53         __u32 mkey[2];
54         __u32 gid_prefix[2];
55         __u16 mastersm_lid;
56         __u16 lid;
57         __u32 cap_mask;
58         __u32 combined2;
59                         /*__u32 mkey_lease_period:16;
60                         __u32 diag_code:16;*/
61         __u32 combined3;
62                         /*__u32 link_width_active:8;
63                         __u32 link_width_supported:8;
64                         __u32 link_width_enabled:8;
65                         __u32 local_port_num:8;*/
66         __u32 combined4;
67                         /*__u32 link_speed_enabled:4;
68                         __u32 link_speed_active:4;
69                         __u32 lmc:3;
70                         __u32 r1:3;
71                         __u32 mkey_prot_bits:2;
72                         __u32 link_down_def_state:4;
73                         __u32 port_phys_state:4;
74                         __u32 port_state:4;
75                         __u32 link_speed_supported:4;*/
76         __u32 combined5;
77                         /*__u32 vl_arb_hi_cap:8;
78                         __u32 vl_hi_limit:8;
79                         __u32 init_type:4;
80                         __u32 vl_cap:4;
81                         __u32 master_smsl:4;
82                         __u32 neigh_mtu:4;*/
83         __u32 combined6;
84                         /*__u32 filt_raw_oub:1;
85                         __u32 filt_raw_inb:1;
86                         __u32 part_enf_oub:1;
87                         __u32 part_enf_inb:1;
88                         __u32 op_vls:4;
89                         __u32 hoq_life:5;
90                         __u32 vl_stall_count:3;
91                         __u32 mtu_cap:4;
92                         __u32 init_type_reply:4;
93                         __u32 vl_arb_lo_cap:8;*/
94         __u32 combined7;
95                         /*__u32 pkey_viol:16;
96                         __u32 mkey_viol:16;*/
97         __u32 combined8;
98                         /*__u32 subn_tout:5;
99                         __u32 r2:2;
100                         __u32 client_rereg:1;
101                         __u32 guid_cap:8;
102                         __u32 qkey_viol:16;*/
103         __u32 combined9;
104                         /*__u32 max_cred_hint:16;
105                         __u32 overrun_err:4;
106                         __u32 local_phy_err:4;
107                         __u32 resp_t_val:5;
108                         __u32 r3:3;*/
109         __u32 combined10;
110                         /*__u32 r4:8;
111                         __u32 link_rtrip_lat:24;*/
112 } __attribute__ ((packed));
113
114 struct port_info_mad_st {
115         struct ib_mad_hdr_st mad_hdr;
116         __u32 mkey[2];
117         __u32 r1[8];
118         struct port_info_st port_info;
119 } __attribute__ ((packed));
120
121 union port_info_mad_u {
122         __u8 raw[256];
123         struct port_info_mad_st mad;
124 } __attribute__ ((packed));
125
126 struct guid_info_st {
127         union ib_gid_u gid_tbl[8];
128 } __attribute__ ((packed));
129
130 struct guid_info_mad_st {
131         struct ib_mad_hdr_st mad_hdr;
132         __u32 mkey[2];
133         __u32 r1[8];
134         struct guid_info_st guid_info;
135 } __attribute__ ((packed));
136
137 union guid_info_mad_u {
138         __u8 raw[256];
139         struct guid_info_mad_st mad;
140 } __attribute__ ((packed));
141
142 struct mc_member_st {
143         __u8 mgid[16];
144         __u8 port_gid[16];
145         __u32 q_key;
146         __u32 combined1;
147                         /*__u32 tclass:8;
148                         __u32 mtu:6;
149                         __u32 mtu_selector:2;
150                         __u32 mlid:16;*/
151         __u32 combined2;
152                         /*__u32 packet_liftime:6;
153                         __u32 packet_liftime_selector:2;
154                         __u32 rate:6;
155                         __u32 rate_selector:2;
156                         __u32 pkey:16;*/
157         __u32 combined3;
158                         /*__u32 hop_limit:8;
159                         __u32 flow_label:20;
160                         __u32 sl:4;*/
161         __u32 combined4;
162                         /*__u32 r0:23;
163                         __u32 proxy_join:1;
164                         __u32 join_state:4;
165                         __u32 scope:4;*/
166 } __attribute__ ((packed));
167
168 struct mc_member_mad_st {
169         struct ib_mad_hdr_st mad_hdr;
170         struct rmpp_hdr_st rmpp_hdr;
171         struct sa_header_st sa_hdr;
172         struct mc_member_st mc_member;
173 } __attribute__ ((packed));
174
175 union mc_member_mad_u {
176         struct mc_member_mad_st mc_member;
177         __u8 raw[256];
178 } __attribute__ ((packed));
179
180 struct pkey_tbl_st {
181         __u16 pkey_tbl[16][2];
182 } __attribute__ ((packed));
183
184 struct pkey_tbl_mad_st {
185         struct ib_mad_hdr_st mad_hdr;
186         __u32 mkey[2];
187         __u32 r1[8];
188         struct pkey_tbl_st pkey_tbl;
189 } __attribute__ ((packed));
190
191 union pkey_tbl_mad_u {
192         struct pkey_tbl_mad_st mad;
193         __u8 raw[256];
194 } __attribute__ ((packed));
195
196 struct path_record_st {
197         __u32 r0[2];
198         union ib_gid_u dgid;
199         union ib_gid_u sgid;
200         __u16 slid;
201         __u16 dlid;
202         __u32 combined1;
203                         /*__u32 hop_limit:8;
204                         __u32 flow_label:20;
205                         __u32 r1:3;
206                         __u32 raw_traffic:1;*/
207         __u32 combined2;
208                         /*__u32 pkey:16;
209                         __u32 numb_path:7;
210                         __u32 reversible:1;
211                         __u32 tclass:8;*/
212         __u32 combined3;
213                         /*__u32 rate:6;
214                         __u32 rate_selector:2;
215                         __u32 mtu:6;
216                         __u32 mtu_selector:2;
217                         __u32 sl:4;
218                         __u32 reserved:12;*/
219         __u32 combined4;
220                         /*__u32 r2:16;
221                         __u32 preference:8;
222                         __u32 packet_lifetime:6;
223                         __u32 packet_lifetime_selector:2;*/
224         __u32 r3;
225 } __attribute__ ((packed));
226
227 struct path_record_mad_st {
228         struct ib_mad_hdr_st mad_hdr;
229         struct rmpp_hdr_st rmpp_hdr;
230         struct sa_header_st sa_hdr;
231         struct path_record_st path_record;
232 } __attribute__ ((packed));
233
234 union path_record_mad_u {
235         struct path_record_mad_st mad;
236         __u8 raw[256];
237 } __attribute__ ((packed));
238
239 static int get_port_info(__u8 port, struct port_info_st *buf, __u16 * status);
240 static int get_guid_info(__u16 * status);
241 static int get_pkey_tbl(struct pkey_tbl_st *pkey_tbl, __u16 * status);
242 static int join_mc_group(__u32 * qkey_p, __u16 * mlid_p, __u8 join);
243
244 #endif                          /* __mad_attrib_h_ */