1219820Sjeff/*
2219820Sjeff * Copyright (c) 2004 Topspin Communications.  All rights reserved.
3219820Sjeff * Copyright (c) 2005 Voltaire, Inc. All rights reserved.
4219820Sjeff *
5219820Sjeff * This software is available to you under a choice of one of two
6219820Sjeff * licenses.  You may choose to be licensed under the terms of the GNU
7219820Sjeff * General Public License (GPL) Version 2, available from the file
8219820Sjeff * COPYING in the main directory of this source tree, or the
9219820Sjeff * OpenIB.org BSD license below:
10219820Sjeff *
11219820Sjeff *     Redistribution and use in source and binary forms, with or
12219820Sjeff *     without modification, are permitted provided that the following
13219820Sjeff *     conditions are met:
14219820Sjeff *
15219820Sjeff *      - Redistributions of source code must retain the above
16219820Sjeff *        copyright notice, this list of conditions and the following
17219820Sjeff *        disclaimer.
18219820Sjeff *
19219820Sjeff *      - Redistributions in binary form must reproduce the above
20219820Sjeff *        copyright notice, this list of conditions and the following
21219820Sjeff *        disclaimer in the documentation and/or other materials
22219820Sjeff *        provided with the distribution.
23219820Sjeff *
24219820Sjeff * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25219820Sjeff * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26219820Sjeff * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27219820Sjeff * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28219820Sjeff * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29219820Sjeff * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30219820Sjeff * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31219820Sjeff * SOFTWARE.
32219820Sjeff */
33219820Sjeff
34219820Sjeff#ifndef INFINIBAND_SA_H
35219820Sjeff#define INFINIBAND_SA_H
36219820Sjeff
37219820Sjeff#include <infiniband/verbs.h>
38219820Sjeff
39219820Sjeffstruct ibv_sa_path_rec {
40219820Sjeff	/* reserved */
41219820Sjeff	/* reserved */
42219820Sjeff	union ibv_gid dgid;
43219820Sjeff	union ibv_gid sgid;
44219820Sjeff	uint16_t      dlid;
45219820Sjeff	uint16_t      slid;
46219820Sjeff	int           raw_traffic;
47219820Sjeff	/* reserved */
48219820Sjeff	uint32_t      flow_label;
49219820Sjeff	uint8_t       hop_limit;
50219820Sjeff	uint8_t       traffic_class;
51219820Sjeff	int           reversible;
52219820Sjeff	uint8_t       numb_path;
53219820Sjeff	uint16_t      pkey;
54219820Sjeff	/* reserved */
55219820Sjeff	uint8_t       sl;
56219820Sjeff	uint8_t       mtu_selector;
57219820Sjeff	uint8_t	      mtu;
58219820Sjeff	uint8_t       rate_selector;
59219820Sjeff	uint8_t       rate;
60219820Sjeff	uint8_t       packet_life_time_selector;
61219820Sjeff	uint8_t       packet_life_time;
62219820Sjeff	uint8_t       preference;
63219820Sjeff};
64219820Sjeff
65219820Sjeffstruct ibv_sa_mcmember_rec {
66219820Sjeff	union ibv_gid mgid;
67219820Sjeff	union ibv_gid port_gid;
68219820Sjeff	uint32_t      qkey;
69219820Sjeff	uint16_t      mlid;
70219820Sjeff	uint8_t       mtu_selector;
71219820Sjeff	uint8_t       mtu;
72219820Sjeff	uint8_t       traffic_class;
73219820Sjeff	uint16_t      pkey;
74219820Sjeff	uint8_t       rate_selector;
75219820Sjeff	uint8_t       rate;
76219820Sjeff	uint8_t       packet_life_time_selector;
77219820Sjeff	uint8_t       packet_life_time;
78219820Sjeff	uint8_t       sl;
79219820Sjeff	uint32_t      flow_label;
80219820Sjeff	uint8_t       hop_limit;
81219820Sjeff	uint8_t       scope;
82219820Sjeff	uint8_t       join_state;
83219820Sjeff	int           proxy_join;
84219820Sjeff};
85219820Sjeff
86219820Sjeffstruct ibv_sa_service_rec {
87219820Sjeff	uint64_t      id;
88219820Sjeff	union ibv_gid gid;
89219820Sjeff	uint16_t      pkey;
90219820Sjeff	/* uint16_t  resv;   */
91219820Sjeff	uint32_t      lease;
92219820Sjeff	uint8_t       key[16];
93219820Sjeff	uint8_t       name[64];
94219820Sjeff	uint8_t       data8[16];
95219820Sjeff	uint16_t      data16[8];
96219820Sjeff	uint32_t      data32[4];
97219820Sjeff	uint64_t      data64[2];
98219820Sjeff};
99219820Sjeff
100219820Sjeff#define IBV_PATH_RECORD_REVERSIBLE 0x80
101219820Sjeff
102219820Sjeffstruct ibv_path_record {
103219820Sjeff	uint64_t	service_id;
104219820Sjeff	union ibv_gid	dgid;
105219820Sjeff	union ibv_gid	sgid;
106219820Sjeff	uint16_t	dlid;
107219820Sjeff	uint16_t	slid;
108219820Sjeff	uint32_t	flowlabel_hoplimit; /* resv-31:28 flow label-27:8 hop limit-7:0*/
109219820Sjeff	uint8_t		tclass;
110219820Sjeff	uint8_t		reversible_numpath; /* reversible-7:7 num path-6:0 */
111219820Sjeff	uint16_t	pkey;
112219820Sjeff	uint16_t	qosclass_sl;	    /* qos class-15:4 sl-3:0 */
113219820Sjeff	uint8_t		mtu;		    /* mtu selector-7:6 mtu-5:0 */
114219820Sjeff	uint8_t		rate;		    /* rate selector-7:6 rate-5:0 */
115219820Sjeff	uint8_t		packetlifetime;	    /* lifetime selector-7:6 lifetime-5:0 */
116219820Sjeff	uint8_t		preference;
117219820Sjeff	uint8_t		reserved[6];
118219820Sjeff};
119219820Sjeff
120219820Sjeff#define IBV_PATH_FLAG_GMP	       (1<<0)
121219820Sjeff#define IBV_PATH_FLAG_PRIMARY	       (1<<1)
122219820Sjeff#define IBV_PATH_FLAG_ALTERNATE       (1<<2)
123219820Sjeff#define IBV_PATH_FLAG_OUTBOUND	       (1<<3)
124219820Sjeff#define IBV_PATH_FLAG_INBOUND	       (1<<4)
125219820Sjeff#define IBV_PATH_FLAG_INBOUND_REVERSE (1<<5)
126219820Sjeff#define IBV_PATH_FLAG_BIDIRECTIONAL   (IBV_PATH_FLAG_OUTBOUND |     \
127219820Sjeff					IBV_PATH_FLAG_INBOUND_REVERSE)
128219820Sjeff
129219820Sjeffstruct ibv_path_data {
130219820Sjeff	uint32_t		flags;
131219820Sjeff	uint32_t		reserved;
132219820Sjeff	struct ibv_path_record	path;
133219820Sjeff};
134219820Sjeff
135219820Sjeff#endif /* INFINIBAND_SA_H */
136