1321936Shselasky/*
2321936Shselasky * Copyright (c) 2004 Topspin Communications.  All rights reserved.
3321936Shselasky * Copyright (c) 2005 Voltaire, Inc. All rights reserved.
4321936Shselasky *
5321936Shselasky * This software is available to you under a choice of one of two
6321936Shselasky * licenses.  You may choose to be licensed under the terms of the GNU
7321936Shselasky * General Public License (GPL) Version 2, available from the file
8321936Shselasky * COPYING in the main directory of this source tree, or the
9321936Shselasky * OpenIB.org BSD license below:
10321936Shselasky *
11321936Shselasky *     Redistribution and use in source and binary forms, with or
12321936Shselasky *     without modification, are permitted provided that the following
13321936Shselasky *     conditions are met:
14321936Shselasky *
15321936Shselasky *      - Redistributions of source code must retain the above
16321936Shselasky *        copyright notice, this list of conditions and the following
17321936Shselasky *        disclaimer.
18321936Shselasky *
19321936Shselasky *      - Redistributions in binary form must reproduce the above
20321936Shselasky *        copyright notice, this list of conditions and the following
21321936Shselasky *        disclaimer in the documentation and/or other materials
22321936Shselasky *        provided with the distribution.
23321936Shselasky *
24321936Shselasky * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25321936Shselasky * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26321936Shselasky * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27321936Shselasky * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28321936Shselasky * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29321936Shselasky * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30321936Shselasky * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31321936Shselasky * SOFTWARE.
32321936Shselasky */
33321936Shselasky
34321936Shselasky#ifndef INFINIBAND_SA_H
35321936Shselasky#define INFINIBAND_SA_H
36321936Shselasky
37321936Shselasky#include <infiniband/verbs.h>
38321936Shselasky#include <infiniband/types.h>
39321936Shselasky
40321936Shselaskystruct ibv_sa_path_rec {
41321936Shselasky	/* reserved */
42321936Shselasky	/* reserved */
43321936Shselasky	union ibv_gid dgid;
44321936Shselasky	union ibv_gid sgid;
45321936Shselasky	__be16        dlid;
46321936Shselasky	__be16        slid;
47321936Shselasky	int           raw_traffic;
48321936Shselasky	/* reserved */
49321936Shselasky	__be32        flow_label;
50321936Shselasky	uint8_t       hop_limit;
51321936Shselasky	uint8_t       traffic_class;
52321936Shselasky	int           reversible;
53321936Shselasky	uint8_t       numb_path;
54321936Shselasky	__be16        pkey;
55321936Shselasky	/* reserved */
56321936Shselasky	uint8_t       sl;
57321936Shselasky	uint8_t       mtu_selector;
58321936Shselasky	uint8_t	      mtu;
59321936Shselasky	uint8_t       rate_selector;
60321936Shselasky	uint8_t       rate;
61321936Shselasky	uint8_t       packet_life_time_selector;
62321936Shselasky	uint8_t       packet_life_time;
63321936Shselasky	uint8_t       preference;
64321936Shselasky};
65321936Shselasky
66321936Shselaskystruct ibv_sa_mcmember_rec {
67321936Shselasky	union ibv_gid mgid;
68321936Shselasky	union ibv_gid port_gid;
69321936Shselasky	uint32_t      qkey;
70321936Shselasky	uint16_t      mlid;
71321936Shselasky	uint8_t       mtu_selector;
72321936Shselasky	uint8_t       mtu;
73321936Shselasky	uint8_t       traffic_class;
74321936Shselasky	uint16_t      pkey;
75321936Shselasky	uint8_t       rate_selector;
76321936Shselasky	uint8_t       rate;
77321936Shselasky	uint8_t       packet_life_time_selector;
78321936Shselasky	uint8_t       packet_life_time;
79321936Shselasky	uint8_t       sl;
80321936Shselasky	uint32_t      flow_label;
81321936Shselasky	uint8_t       hop_limit;
82321936Shselasky	uint8_t       scope;
83321936Shselasky	uint8_t       join_state;
84321936Shselasky	int           proxy_join;
85321936Shselasky};
86321936Shselasky
87321936Shselaskystruct ibv_sa_service_rec {
88321936Shselasky	uint64_t      id;
89321936Shselasky	union ibv_gid gid;
90321936Shselasky	uint16_t      pkey;
91321936Shselasky	/* uint16_t  resv;   */
92321936Shselasky	uint32_t      lease;
93321936Shselasky	uint8_t       key[16];
94321936Shselasky	uint8_t       name[64];
95321936Shselasky	uint8_t       data8[16];
96321936Shselasky	uint16_t      data16[8];
97321936Shselasky	uint32_t      data32[4];
98321936Shselasky	uint64_t      data64[2];
99321936Shselasky};
100321936Shselasky
101321936Shselasky#define IBV_PATH_RECORD_REVERSIBLE 0x80
102321936Shselasky
103321936Shselaskystruct ibv_path_record {
104321936Shselasky	__be64		service_id;
105321936Shselasky	union ibv_gid	dgid;
106321936Shselasky	union ibv_gid	sgid;
107321936Shselasky	__be16		dlid;
108321936Shselasky	__be16		slid;
109321936Shselasky	__be32		flowlabel_hoplimit; /* resv-31:28 flow label-27:8 hop limit-7:0*/
110321936Shselasky	uint8_t		tclass;
111321936Shselasky	uint8_t		reversible_numpath; /* reversible-7:7 num path-6:0 */
112321936Shselasky	__be16		pkey;
113321936Shselasky	__be16		qosclass_sl;	    /* qos class-15:4 sl-3:0 */
114321936Shselasky	uint8_t		mtu;		    /* mtu selector-7:6 mtu-5:0 */
115321936Shselasky	uint8_t		rate;		    /* rate selector-7:6 rate-5:0 */
116321936Shselasky	uint8_t		packetlifetime;	    /* lifetime selector-7:6 lifetime-5:0 */
117321936Shselasky	uint8_t		preference;
118321936Shselasky	uint8_t		reserved[6];
119321936Shselasky};
120321936Shselasky
121321936Shselasky#define IBV_PATH_FLAG_GMP	       (1<<0)
122321936Shselasky#define IBV_PATH_FLAG_PRIMARY	       (1<<1)
123321936Shselasky#define IBV_PATH_FLAG_ALTERNATE       (1<<2)
124321936Shselasky#define IBV_PATH_FLAG_OUTBOUND	       (1<<3)
125321936Shselasky#define IBV_PATH_FLAG_INBOUND	       (1<<4)
126321936Shselasky#define IBV_PATH_FLAG_INBOUND_REVERSE (1<<5)
127321936Shselasky#define IBV_PATH_FLAG_BIDIRECTIONAL   (IBV_PATH_FLAG_OUTBOUND |     \
128321936Shselasky					IBV_PATH_FLAG_INBOUND_REVERSE)
129321936Shselasky
130321936Shselaskystruct ibv_path_data {
131321936Shselasky	uint32_t		flags;
132321936Shselasky	uint32_t		reserved;
133321936Shselasky	struct ibv_path_record	path;
134321936Shselasky};
135321936Shselasky
136321936Shselasky#endif /* INFINIBAND_SA_H */
137