File: acm.h

package info (click to toggle)
rdma-core 33.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 13,844 kB
  • sloc: ansic: 145,804; python: 5,688; sh: 2,761; perl: 1,465; makefile: 73
file content (169 lines) | stat: -rw-r--r-- 4,625 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
/*
 * Copyright (c) 2009 Intel Corporation.  All rights reserved.
 *
 * This software is available to you under the OpenFabrics.org BSD license
 * below:
 *
 *     Redistribution and use in source and binary forms, with or
 *     without modification, are permitted provided that the following
 *     conditions are met:
 *
 *      - Redistributions of source code must retain the above
 *        copyright notice, this list of conditions and the following
 *        disclaimer.
 *
 *      - Redistributions in binary form must reproduce the above
 *        copyright notice, this list of conditions and the following
 *        disclaimer in the documentation and/or other materials
 *        provided with the distribution.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AWV
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

#if !defined(ACM_H)
#define ACM_H

#include <infiniband/verbs.h>
#include <infiniband/sa.h>

#ifdef __cplusplus
extern "C" {
#endif

#define ACM_VERSION             1

#define ACM_OP_MASK             0x0F
#define ACM_OP_RESOLVE          0x01
#define ACM_OP_PERF_QUERY       0x02
#define ACM_OP_EP_QUERY         0x03
#define ACM_OP_ACK              0x80

#define ACM_STATUS_SUCCESS      0
#define ACM_STATUS_ENOMEM       1
#define ACM_STATUS_EINVAL       2
#define ACM_STATUS_ENODATA      3
#define ACM_STATUS_ENOTCONN     5
#define ACM_STATUS_ETIMEDOUT    6
#define ACM_STATUS_ESRCADDR     7
#define ACM_STATUS_ESRCTYPE     8
#define ACM_STATUS_EDESTADDR    9
#define ACM_STATUS_EDESTTYPE    10

#define ACM_FLAGS_QUERY_SA      (1<<31)
#define ACM_FLAGS_NODELAY	(1<<30)

#define ACM_MSG_HDR_LENGTH      16
#define ACM_MAX_ADDRESS         64
#define ACM_MSG_EP_LENGTH       72
#define ACM_MAX_PROV_NAME       64
/*
 * Support up to 6 path records (primary and alternate CM paths,
 * inbound and outbound primary and alternate data paths), plus CM data.
 */
#define ACM_MSG_DATA_LENGTH     (ACM_MSG_EP_LENGTH * 8)

#define src_out     data[0]
#define src_index   data[1]
#define dst_index   data[2]

struct acm_hdr {
	uint8_t                 version;
	uint8_t                 opcode;
	uint8_t                 status;
	uint8_t		        data[3];
	uint16_t                length;
	uint64_t                tid;
};

#define ACM_EP_INFO_NAME        0x0001
#define ACM_EP_INFO_ADDRESS_IP  0x0002
#define ACM_EP_INFO_ADDRESS_IP6 0x0003
#define ACM_EP_INFO_PATH        0x0010

union acm_ep_info {
	uint8_t                 addr[ACM_MAX_ADDRESS];
	uint8_t                 name[ACM_MAX_ADDRESS];
	struct ibv_path_record  path;
};

#define ACM_EP_FLAG_SOURCE      (1<<0)
#define ACM_EP_FLAG_DEST        (1<<1)

struct acm_ep_addr_data {
	uint32_t                flags;
	uint16_t                type;
	uint16_t                reserved;
	union acm_ep_info       info;
};

/*
 * Resolve messages with the opcode set to ACM_OP_RESOLVE are only
 * used to communicate with the local ib_acm service.  Message fields
 * in this case are not byte swapped, but note that the acm_ep_info
 * data is in network order.
 */
struct acm_resolve_msg {
	struct acm_hdr          hdr;
	struct acm_ep_addr_data data[];
};

enum {
	ACM_CNTR_ERROR,
	ACM_CNTR_RESOLVE,
	ACM_CNTR_NODATA,
	ACM_CNTR_ADDR_QUERY,
	ACM_CNTR_ADDR_CACHE,
	ACM_CNTR_ROUTE_QUERY,
	ACM_CNTR_ROUTE_CACHE,
	ACM_MAX_COUNTER
};

/*
 * Performance messages are sent/received in network byte order.
 */
struct acm_perf_msg {
	struct acm_hdr          hdr;
	uint64_t                data[];
};

/*
 * Endpoint query messages are sent/received in network byte order.
 */
struct acm_ep_config_data {
	uint64_t                dev_guid;
	uint8_t                 port_num;
	uint8_t			phys_port_cnt;
	uint8_t                 rsvd[2];
	uint16_t                pkey;
	uint16_t                addr_cnt;
	uint8_t                 prov_name[ACM_MAX_PROV_NAME];
	union acm_ep_info       addrs[];
};

struct acm_ep_query_msg {
	struct acm_hdr             hdr;
	struct acm_ep_config_data  data[];
};

struct acm_msg {
	struct acm_hdr                  hdr;
	union{
		uint8_t                 data[ACM_MSG_DATA_LENGTH];
		struct acm_ep_addr_data resolve_data[0];
		uint64_t                perf_data[0];
		struct acm_ep_config_data ep_data[0];
	};
};

#ifdef __cplusplus
}
#endif

#endif /* ACM_H */