1219820Sjeff/*
2219820Sjeff * Copyright (c) 2004 Mellanox Technologies Ltd.  All rights reserved.
3219820Sjeff * Copyright (c) 2004 Infinicon Corporation.  All rights reserved.
4219820Sjeff * Copyright (c) 2004 Intel Corporation.  All rights reserved.
5219820Sjeff * Copyright (c) 2004 Topspin Corporation.  All rights reserved.
6219820Sjeff * Copyright (c) 2004-2006 Voltaire Corporation.  All rights reserved.
7219820Sjeff *
8219820Sjeff * This software is available to you under a choice of one of two
9219820Sjeff * licenses.  You may choose to be licensed under the terms of the GNU
10219820Sjeff * General Public License (GPL) Version 2, available from the file
11219820Sjeff * COPYING in the main directory of this source tree, or the
12219820Sjeff * OpenIB.org BSD license below:
13219820Sjeff *
14219820Sjeff *     Redistribution and use in source and binary forms, with or
15219820Sjeff *     without modification, are permitted provided that the following
16219820Sjeff *     conditions are met:
17219820Sjeff *
18219820Sjeff *      - Redistributions of source code must retain the above
19219820Sjeff *        copyright notice, this list of conditions and the following
20219820Sjeff *        disclaimer.
21219820Sjeff *
22219820Sjeff *      - Redistributions in binary form must reproduce the above
23219820Sjeff *        copyright notice, this list of conditions and the following
24219820Sjeff *        disclaimer in the documentation and/or other materials
25219820Sjeff *        provided with the distribution.
26219820Sjeff *
27219820Sjeff * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
28219820Sjeff * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
29219820Sjeff * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
30219820Sjeff * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
31219820Sjeff * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
32219820Sjeff * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
33219820Sjeff * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
34219820Sjeff * SOFTWARE.
35331772Shselasky *
36331772Shselasky * $FreeBSD: stable/11/sys/ofed/include/rdma/ib_mad.h 331772 2018-03-30 18:17:33Z hselasky $
37219820Sjeff */
38219820Sjeff
39219820Sjeff#if !defined(IB_MAD_H)
40219820Sjeff#define IB_MAD_H
41219820Sjeff
42219820Sjeff#include <linux/list.h>
43219820Sjeff
44219820Sjeff#include <rdma/ib_verbs.h>
45331769Shselasky#include <rdma/ib_user_mad.h>
46219820Sjeff
47331769Shselasky/* Management base versions */
48219820Sjeff#define IB_MGMT_BASE_VERSION			1
49331769Shselasky#define OPA_MGMT_BASE_VERSION			0x80
50219820Sjeff
51331769Shselasky#define OPA_SMP_CLASS_VERSION			0x80
52331769Shselasky
53219820Sjeff/* Management classes */
54219820Sjeff#define IB_MGMT_CLASS_SUBN_LID_ROUTED		0x01
55219820Sjeff#define IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE	0x81
56219820Sjeff#define IB_MGMT_CLASS_SUBN_ADM			0x03
57219820Sjeff#define IB_MGMT_CLASS_PERF_MGMT			0x04
58219820Sjeff#define IB_MGMT_CLASS_BM			0x05
59219820Sjeff#define IB_MGMT_CLASS_DEVICE_MGMT		0x06
60219820Sjeff#define IB_MGMT_CLASS_CM			0x07
61219820Sjeff#define IB_MGMT_CLASS_SNMP			0x08
62219820Sjeff#define IB_MGMT_CLASS_DEVICE_ADM		0x10
63219820Sjeff#define IB_MGMT_CLASS_BOOT_MGMT			0x11
64219820Sjeff#define IB_MGMT_CLASS_BIS			0x12
65219820Sjeff#define IB_MGMT_CLASS_CONG_MGMT			0x21
66219820Sjeff#define IB_MGMT_CLASS_VENDOR_RANGE2_START	0x30
67219820Sjeff#define IB_MGMT_CLASS_VENDOR_RANGE2_END		0x4F
68219820Sjeff
69219820Sjeff#define	IB_OPENIB_OUI				(0x001405)
70219820Sjeff
71219820Sjeff/* Management methods */
72219820Sjeff#define IB_MGMT_METHOD_GET			0x01
73219820Sjeff#define IB_MGMT_METHOD_SET			0x02
74219820Sjeff#define IB_MGMT_METHOD_GET_RESP			0x81
75219820Sjeff#define IB_MGMT_METHOD_SEND			0x03
76219820Sjeff#define IB_MGMT_METHOD_TRAP			0x05
77219820Sjeff#define IB_MGMT_METHOD_REPORT			0x06
78219820Sjeff#define IB_MGMT_METHOD_REPORT_RESP		0x86
79219820Sjeff#define IB_MGMT_METHOD_TRAP_REPRESS		0x07
80219820Sjeff
81219820Sjeff#define IB_MGMT_METHOD_RESP			0x80
82219820Sjeff#define IB_BM_ATTR_MOD_RESP			cpu_to_be32(1)
83219820Sjeff
84219820Sjeff#define IB_MGMT_MAX_METHODS			128
85219820Sjeff
86278886Shselasky/* MAD Status field bit masks */
87278886Shselasky#define IB_MGMT_MAD_STATUS_SUCCESS			0x0000
88278886Shselasky#define IB_MGMT_MAD_STATUS_BUSY				0x0001
89278886Shselasky#define IB_MGMT_MAD_STATUS_REDIRECT_REQD		0x0002
90278886Shselasky#define IB_MGMT_MAD_STATUS_BAD_VERSION			0x0004
91278886Shselasky#define IB_MGMT_MAD_STATUS_UNSUPPORTED_METHOD		0x0008
92278886Shselasky#define IB_MGMT_MAD_STATUS_UNSUPPORTED_METHOD_ATTRIB	0x000c
93278886Shselasky#define IB_MGMT_MAD_STATUS_INVALID_ATTRIB_VALUE		0x001c
94278886Shselasky
95219820Sjeff/* RMPP information */
96219820Sjeff#define IB_MGMT_RMPP_VERSION			1
97219820Sjeff
98219820Sjeff#define IB_MGMT_RMPP_TYPE_DATA			1
99219820Sjeff#define IB_MGMT_RMPP_TYPE_ACK			2
100219820Sjeff#define IB_MGMT_RMPP_TYPE_STOP			3
101219820Sjeff#define IB_MGMT_RMPP_TYPE_ABORT			4
102219820Sjeff
103219820Sjeff#define IB_MGMT_RMPP_FLAG_ACTIVE		1
104219820Sjeff#define IB_MGMT_RMPP_FLAG_FIRST			(1<<1)
105219820Sjeff#define IB_MGMT_RMPP_FLAG_LAST			(1<<2)
106219820Sjeff
107219820Sjeff#define IB_MGMT_RMPP_NO_RESPTIME		0x1F
108219820Sjeff
109219820Sjeff#define	IB_MGMT_RMPP_STATUS_SUCCESS		0
110219820Sjeff#define	IB_MGMT_RMPP_STATUS_RESX		1
111219820Sjeff#define	IB_MGMT_RMPP_STATUS_ABORT_MIN		118
112219820Sjeff#define	IB_MGMT_RMPP_STATUS_T2L			118
113219820Sjeff#define	IB_MGMT_RMPP_STATUS_BAD_LEN		119
114219820Sjeff#define	IB_MGMT_RMPP_STATUS_BAD_SEG		120
115219820Sjeff#define	IB_MGMT_RMPP_STATUS_BADT		121
116219820Sjeff#define	IB_MGMT_RMPP_STATUS_W2S			122
117219820Sjeff#define	IB_MGMT_RMPP_STATUS_S2B			123
118219820Sjeff#define	IB_MGMT_RMPP_STATUS_BAD_STATUS		124
119219820Sjeff#define	IB_MGMT_RMPP_STATUS_UNV			125
120219820Sjeff#define	IB_MGMT_RMPP_STATUS_TMR			126
121219820Sjeff#define	IB_MGMT_RMPP_STATUS_UNSPEC		127
122219820Sjeff#define	IB_MGMT_RMPP_STATUS_ABORT_MAX		127
123219820Sjeff
124219820Sjeff#define IB_QP0		0
125219820Sjeff#define IB_QP1		cpu_to_be32(1)
126219820Sjeff#define IB_QP1_QKEY	0x80010000
127219820Sjeff#define IB_QP_SET_QKEY	0x80000000
128219820Sjeff
129219820Sjeff#define IB_DEFAULT_PKEY_PARTIAL 0x7FFF
130219820Sjeff#define IB_DEFAULT_PKEY_FULL	0xFFFF
131219820Sjeff
132331769Shselasky/*
133331769Shselasky * Generic trap/notice types
134331769Shselasky */
135331769Shselasky#define IB_NOTICE_TYPE_FATAL	0x80
136331769Shselasky#define IB_NOTICE_TYPE_URGENT	0x81
137331769Shselasky#define IB_NOTICE_TYPE_SECURITY	0x82
138331769Shselasky#define IB_NOTICE_TYPE_SM	0x83
139331769Shselasky#define IB_NOTICE_TYPE_INFO	0x84
140331769Shselasky
141331769Shselasky/*
142331769Shselasky * Generic trap/notice producers
143331769Shselasky */
144331769Shselasky#define IB_NOTICE_PROD_CA		cpu_to_be16(1)
145331769Shselasky#define IB_NOTICE_PROD_SWITCH		cpu_to_be16(2)
146331769Shselasky#define IB_NOTICE_PROD_ROUTER		cpu_to_be16(3)
147331769Shselasky#define IB_NOTICE_PROD_CLASS_MGR	cpu_to_be16(4)
148331769Shselasky
149219820Sjeffenum {
150219820Sjeff	IB_MGMT_MAD_HDR = 24,
151219820Sjeff	IB_MGMT_MAD_DATA = 232,
152219820Sjeff	IB_MGMT_RMPP_HDR = 36,
153219820Sjeff	IB_MGMT_RMPP_DATA = 220,
154219820Sjeff	IB_MGMT_VENDOR_HDR = 40,
155219820Sjeff	IB_MGMT_VENDOR_DATA = 216,
156219820Sjeff	IB_MGMT_SA_HDR = 56,
157219820Sjeff	IB_MGMT_SA_DATA = 200,
158219820Sjeff	IB_MGMT_DEVICE_HDR = 64,
159219820Sjeff	IB_MGMT_DEVICE_DATA = 192,
160325604Shselasky	IB_MGMT_MAD_SIZE = IB_MGMT_MAD_HDR + IB_MGMT_MAD_DATA,
161331769Shselasky	OPA_MGMT_MAD_DATA = 2024,
162331769Shselasky	OPA_MGMT_RMPP_DATA = 2012,
163331769Shselasky	OPA_MGMT_MAD_SIZE = IB_MGMT_MAD_HDR + OPA_MGMT_MAD_DATA,
164219820Sjeff};
165219820Sjeff
166219820Sjeffstruct ib_mad_hdr {
167219820Sjeff	u8	base_version;
168219820Sjeff	u8	mgmt_class;
169219820Sjeff	u8	class_version;
170219820Sjeff	u8	method;
171219820Sjeff	__be16	status;
172219820Sjeff	__be16	class_specific;
173219820Sjeff	__be64	tid;
174219820Sjeff	__be16	attr_id;
175219820Sjeff	__be16	resv;
176219820Sjeff	__be32	attr_mod;
177219820Sjeff};
178219820Sjeff
179219820Sjeffstruct ib_rmpp_hdr {
180219820Sjeff	u8	rmpp_version;
181219820Sjeff	u8	rmpp_type;
182219820Sjeff	u8	rmpp_rtime_flags;
183219820Sjeff	u8	rmpp_status;
184219820Sjeff	__be32	seg_num;
185219820Sjeff	__be32	paylen_newwin;
186219820Sjeff};
187219820Sjeff
188219820Sjefftypedef u64 __bitwise ib_sa_comp_mask;
189219820Sjeff
190255932Salfred#define IB_SA_COMP_MASK(n) ((__force ib_sa_comp_mask) cpu_to_be64(1ull << (n)))
191219820Sjeff
192219820Sjeff/*
193219820Sjeff * ib_sa_hdr and ib_sa_mad structures must be packed because they have
194219820Sjeff * 64-bit fields that are only 32-bit aligned. 64-bit architectures will
195219820Sjeff * lay them out wrong otherwise.  (And unfortunately they are sent on
196219820Sjeff * the wire so we can't change the layout)
197219820Sjeff */
198219820Sjeffstruct ib_sa_hdr {
199219820Sjeff	__be64			sm_key;
200219820Sjeff	__be16			attr_offset;
201219820Sjeff	__be16			reserved;
202219820Sjeff	ib_sa_comp_mask		comp_mask;
203219820Sjeff} __attribute__ ((packed));
204219820Sjeff
205219820Sjeffstruct ib_mad {
206219820Sjeff	struct ib_mad_hdr	mad_hdr;
207219820Sjeff	u8			data[IB_MGMT_MAD_DATA];
208219820Sjeff};
209219820Sjeff
210331769Shselaskystruct opa_mad {
211331769Shselasky	struct ib_mad_hdr	mad_hdr;
212331769Shselasky	u8			data[OPA_MGMT_MAD_DATA];
213331769Shselasky};
214331769Shselasky
215219820Sjeffstruct ib_rmpp_mad {
216219820Sjeff	struct ib_mad_hdr	mad_hdr;
217219820Sjeff	struct ib_rmpp_hdr	rmpp_hdr;
218219820Sjeff	u8			data[IB_MGMT_RMPP_DATA];
219219820Sjeff};
220219820Sjeff
221331769Shselaskystruct opa_rmpp_mad {
222331769Shselasky	struct ib_mad_hdr	mad_hdr;
223331769Shselasky	struct ib_rmpp_hdr	rmpp_hdr;
224331769Shselasky	u8			data[OPA_MGMT_RMPP_DATA];
225331769Shselasky};
226331769Shselasky
227219820Sjeffstruct ib_sa_mad {
228219820Sjeff	struct ib_mad_hdr	mad_hdr;
229219820Sjeff	struct ib_rmpp_hdr	rmpp_hdr;
230219820Sjeff	struct ib_sa_hdr	sa_hdr;
231219820Sjeff	u8			data[IB_MGMT_SA_DATA];
232219820Sjeff} __attribute__ ((packed));
233219820Sjeff
234219820Sjeffstruct ib_vendor_mad {
235219820Sjeff	struct ib_mad_hdr	mad_hdr;
236219820Sjeff	struct ib_rmpp_hdr	rmpp_hdr;
237219820Sjeff	u8			reserved;
238219820Sjeff	u8			oui[3];
239219820Sjeff	u8			data[IB_MGMT_VENDOR_DATA];
240219820Sjeff};
241219820Sjeff
242331769Shselasky#define IB_MGMT_CLASSPORTINFO_ATTR_ID	cpu_to_be16(0x0001)
243331769Shselasky
244331769Shselasky#define IB_CLASS_PORT_INFO_RESP_TIME_MASK	0x1F
245331769Shselasky#define IB_CLASS_PORT_INFO_RESP_TIME_FIELD_SIZE 5
246331769Shselasky
247219820Sjeffstruct ib_class_port_info {
248219820Sjeff	u8			base_version;
249219820Sjeff	u8			class_version;
250219820Sjeff	__be16			capability_mask;
251331769Shselasky	  /* 27 bits for cap_mask2, 5 bits for resp_time */
252331769Shselasky	__be32			cap_mask2_resp_time;
253219820Sjeff	u8			redirect_gid[16];
254219820Sjeff	__be32			redirect_tcslfl;
255219820Sjeff	__be16			redirect_lid;
256219820Sjeff	__be16			redirect_pkey;
257219820Sjeff	__be32			redirect_qp;
258219820Sjeff	__be32			redirect_qkey;
259219820Sjeff	u8			trap_gid[16];
260219820Sjeff	__be32			trap_tcslfl;
261219820Sjeff	__be16			trap_lid;
262219820Sjeff	__be16			trap_pkey;
263219820Sjeff	__be32			trap_hlqp;
264219820Sjeff	__be32			trap_qkey;
265219820Sjeff};
266219820Sjeff
267219820Sjeff/**
268331769Shselasky * ib_get_cpi_resp_time - Returns the resp_time value from
269331769Shselasky * cap_mask2_resp_time in ib_class_port_info.
270331769Shselasky * @cpi: A struct ib_class_port_info mad.
271331769Shselasky */
272331769Shselaskystatic inline u8 ib_get_cpi_resp_time(struct ib_class_port_info *cpi)
273331769Shselasky{
274331769Shselasky	return (u8)(be32_to_cpu(cpi->cap_mask2_resp_time) &
275331769Shselasky		    IB_CLASS_PORT_INFO_RESP_TIME_MASK);
276331769Shselasky}
277331769Shselasky
278331769Shselasky/**
279331769Shselasky * ib_set_cpi_resptime - Sets the response time in an
280331769Shselasky * ib_class_port_info mad.
281331769Shselasky * @cpi: A struct ib_class_port_info.
282331769Shselasky * @rtime: The response time to set.
283331769Shselasky */
284331769Shselaskystatic inline void ib_set_cpi_resp_time(struct ib_class_port_info *cpi,
285331769Shselasky					u8 rtime)
286331769Shselasky{
287331769Shselasky	cpi->cap_mask2_resp_time =
288331769Shselasky		(cpi->cap_mask2_resp_time &
289331769Shselasky		 cpu_to_be32(~IB_CLASS_PORT_INFO_RESP_TIME_MASK)) |
290331769Shselasky		cpu_to_be32(rtime & IB_CLASS_PORT_INFO_RESP_TIME_MASK);
291331769Shselasky}
292331769Shselasky
293331769Shselasky/**
294331769Shselasky * ib_get_cpi_capmask2 - Returns the capmask2 value from
295331769Shselasky * cap_mask2_resp_time in ib_class_port_info.
296331769Shselasky * @cpi: A struct ib_class_port_info mad.
297331769Shselasky */
298331769Shselaskystatic inline u32 ib_get_cpi_capmask2(struct ib_class_port_info *cpi)
299331769Shselasky{
300331769Shselasky	return (be32_to_cpu(cpi->cap_mask2_resp_time) >>
301331769Shselasky		IB_CLASS_PORT_INFO_RESP_TIME_FIELD_SIZE);
302331769Shselasky}
303331769Shselasky
304331769Shselasky/**
305331769Shselasky * ib_set_cpi_capmask2 - Sets the capmask2 in an
306331769Shselasky * ib_class_port_info mad.
307331769Shselasky * @cpi: A struct ib_class_port_info.
308331769Shselasky * @capmask2: The capmask2 to set.
309331769Shselasky */
310331769Shselaskystatic inline void ib_set_cpi_capmask2(struct ib_class_port_info *cpi,
311331769Shselasky				       u32 capmask2)
312331769Shselasky{
313331769Shselasky	cpi->cap_mask2_resp_time =
314331769Shselasky		(cpi->cap_mask2_resp_time &
315331769Shselasky		 cpu_to_be32(IB_CLASS_PORT_INFO_RESP_TIME_MASK)) |
316331769Shselasky		cpu_to_be32(capmask2 <<
317331769Shselasky			    IB_CLASS_PORT_INFO_RESP_TIME_FIELD_SIZE);
318331769Shselasky}
319331769Shselasky
320331769Shselaskystruct ib_mad_notice_attr {
321331769Shselasky	u8 generic_type;
322331769Shselasky	u8 prod_type_msb;
323331769Shselasky	__be16 prod_type_lsb;
324331769Shselasky	__be16 trap_num;
325331769Shselasky	__be16 issuer_lid;
326331769Shselasky	__be16 toggle_count;
327331769Shselasky
328331769Shselasky	union {
329331769Shselasky		struct {
330331769Shselasky			u8	details[54];
331331769Shselasky		} raw_data;
332331769Shselasky
333331769Shselasky		struct {
334331769Shselasky			__be16	reserved;
335331769Shselasky			__be16	lid;		/* where violation happened */
336331769Shselasky			u8	port_num;	/* where violation happened */
337331769Shselasky		} __packed ntc_129_131;
338331769Shselasky
339331769Shselasky		struct {
340331769Shselasky			__be16	reserved;
341331769Shselasky			__be16	lid;		/* LID where change occurred */
342331769Shselasky			u8	reserved2;
343331769Shselasky			u8	local_changes;	/* low bit - local changes */
344331769Shselasky			__be32	new_cap_mask;	/* new capability mask */
345331769Shselasky			u8	reserved3;
346331769Shselasky			u8	change_flags;	/* low 3 bits only */
347331769Shselasky		} __packed ntc_144;
348331769Shselasky
349331769Shselasky		struct {
350331769Shselasky			__be16	reserved;
351331769Shselasky			__be16	lid;		/* lid where sys guid changed */
352331769Shselasky			__be16	reserved2;
353331769Shselasky			__be64	new_sys_guid;
354331769Shselasky		} __packed ntc_145;
355331769Shselasky
356331769Shselasky		struct {
357331769Shselasky			__be16	reserved;
358331769Shselasky			__be16	lid;
359331769Shselasky			__be16	dr_slid;
360331769Shselasky			u8	method;
361331769Shselasky			u8	reserved2;
362331769Shselasky			__be16	attr_id;
363331769Shselasky			__be32	attr_mod;
364331769Shselasky			__be64	mkey;
365331769Shselasky			u8	reserved3;
366331769Shselasky			u8	dr_trunc_hop;
367331769Shselasky			u8	dr_rtn_path[30];
368331769Shselasky		} __packed ntc_256;
369331769Shselasky
370331769Shselasky		struct {
371331769Shselasky			__be16		reserved;
372331769Shselasky			__be16		lid1;
373331769Shselasky			__be16		lid2;
374331769Shselasky			__be32		key;
375331769Shselasky			__be32		sl_qp1;	/* SL: high 4 bits */
376331769Shselasky			__be32		qp2;	/* high 8 bits reserved */
377331769Shselasky			union ib_gid	gid1;
378331769Shselasky			union ib_gid	gid2;
379331769Shselasky		} __packed ntc_257_258;
380331769Shselasky
381331769Shselasky	} details;
382331769Shselasky};
383331769Shselasky
384331769Shselasky/**
385219820Sjeff * ib_mad_send_buf - MAD data buffer and work request for sends.
386219820Sjeff * @next: A pointer used to chain together MADs for posting.
387219820Sjeff * @mad: References an allocated MAD data buffer for MADs that do not have
388219820Sjeff *   RMPP active.  For MADs using RMPP, references the common and management
389219820Sjeff *   class specific headers.
390219820Sjeff * @mad_agent: MAD agent that allocated the buffer.
391219820Sjeff * @ah: The address handle to use when sending the MAD.
392219820Sjeff * @context: User-controlled context fields.
393219820Sjeff * @hdr_len: Indicates the size of the data header of the MAD.  This length
394219820Sjeff *   includes the common MAD, RMPP, and class specific headers.
395219820Sjeff * @data_len: Indicates the total size of user-transferred data.
396219820Sjeff * @seg_count: The number of RMPP segments allocated for this send.
397331769Shselasky * @seg_size: Size of the data in each RMPP segment.  This does not include
398331769Shselasky *   class specific headers.
399331769Shselasky * @seg_rmpp_size: Size of each RMPP segment including the class specific
400331769Shselasky *   headers.
401219820Sjeff * @timeout_ms: Time to wait for a response.
402219820Sjeff * @retries: Number of times to retry a request for a response.  For MADs
403219820Sjeff *   using RMPP, this applies per window.  On completion, returns the number
404219820Sjeff *   of retries needed to complete the transfer.
405219820Sjeff *
406219820Sjeff * Users are responsible for initializing the MAD buffer itself, with the
407219820Sjeff * exception of any RMPP header.  Additional segment buffer space allocated
408219820Sjeff * beyond data_len is padding.
409219820Sjeff */
410219820Sjeffstruct ib_mad_send_buf {
411219820Sjeff	struct ib_mad_send_buf	*next;
412219820Sjeff	void			*mad;
413219820Sjeff	struct ib_mad_agent	*mad_agent;
414219820Sjeff	struct ib_ah		*ah;
415219820Sjeff	void			*context[2];
416219820Sjeff	int			hdr_len;
417219820Sjeff	int			data_len;
418219820Sjeff	int			seg_count;
419219820Sjeff	int			seg_size;
420331769Shselasky	int			seg_rmpp_size;
421219820Sjeff	int			timeout_ms;
422219820Sjeff	int			retries;
423219820Sjeff};
424219820Sjeff
425219820Sjeff/**
426219820Sjeff * ib_response_mad - Returns if the specified MAD has been generated in
427219820Sjeff *   response to a sent request or trap.
428219820Sjeff */
429331769Shselaskyint ib_response_mad(const struct ib_mad_hdr *hdr);
430219820Sjeff
431219820Sjeff/**
432219820Sjeff * ib_get_rmpp_resptime - Returns the RMPP response time.
433219820Sjeff * @rmpp_hdr: An RMPP header.
434219820Sjeff */
435219820Sjeffstatic inline u8 ib_get_rmpp_resptime(struct ib_rmpp_hdr *rmpp_hdr)
436219820Sjeff{
437219820Sjeff	return rmpp_hdr->rmpp_rtime_flags >> 3;
438219820Sjeff}
439219820Sjeff
440219820Sjeff/**
441219820Sjeff * ib_get_rmpp_flags - Returns the RMPP flags.
442219820Sjeff * @rmpp_hdr: An RMPP header.
443219820Sjeff */
444331769Shselaskystatic inline u8 ib_get_rmpp_flags(const struct ib_rmpp_hdr *rmpp_hdr)
445219820Sjeff{
446219820Sjeff	return rmpp_hdr->rmpp_rtime_flags & 0x7;
447219820Sjeff}
448219820Sjeff
449219820Sjeff/**
450219820Sjeff * ib_set_rmpp_resptime - Sets the response time in an RMPP header.
451219820Sjeff * @rmpp_hdr: An RMPP header.
452219820Sjeff * @rtime: The response time to set.
453219820Sjeff */
454219820Sjeffstatic inline void ib_set_rmpp_resptime(struct ib_rmpp_hdr *rmpp_hdr, u8 rtime)
455219820Sjeff{
456219820Sjeff	rmpp_hdr->rmpp_rtime_flags = ib_get_rmpp_flags(rmpp_hdr) | (rtime << 3);
457219820Sjeff}
458219820Sjeff
459219820Sjeff/**
460219820Sjeff * ib_set_rmpp_flags - Sets the flags in an RMPP header.
461219820Sjeff * @rmpp_hdr: An RMPP header.
462219820Sjeff * @flags: The flags to set.
463219820Sjeff */
464219820Sjeffstatic inline void ib_set_rmpp_flags(struct ib_rmpp_hdr *rmpp_hdr, u8 flags)
465219820Sjeff{
466219820Sjeff	rmpp_hdr->rmpp_rtime_flags = (rmpp_hdr->rmpp_rtime_flags & 0xF8) |
467219820Sjeff				     (flags & 0x7);
468219820Sjeff}
469219820Sjeff
470219820Sjeffstruct ib_mad_agent;
471219820Sjeffstruct ib_mad_send_wc;
472219820Sjeffstruct ib_mad_recv_wc;
473219820Sjeff
474219820Sjeff/**
475219820Sjeff * ib_mad_send_handler - callback handler for a sent MAD.
476219820Sjeff * @mad_agent: MAD agent that sent the MAD.
477219820Sjeff * @mad_send_wc: Send work completion information on the sent MAD.
478219820Sjeff */
479219820Sjefftypedef void (*ib_mad_send_handler)(struct ib_mad_agent *mad_agent,
480219820Sjeff				    struct ib_mad_send_wc *mad_send_wc);
481219820Sjeff
482219820Sjeff/**
483219820Sjeff * ib_mad_snoop_handler - Callback handler for snooping sent MADs.
484219820Sjeff * @mad_agent: MAD agent that snooped the MAD.
485331769Shselasky * @send_buf: send MAD data buffer.
486219820Sjeff * @mad_send_wc: Work completion information on the sent MAD.  Valid
487219820Sjeff *   only for snooping that occurs on a send completion.
488219820Sjeff *
489331769Shselasky * Clients snooping MADs should not modify data referenced by the @send_buf
490219820Sjeff * or @mad_send_wc.
491219820Sjeff */
492219820Sjefftypedef void (*ib_mad_snoop_handler)(struct ib_mad_agent *mad_agent,
493219820Sjeff				     struct ib_mad_send_buf *send_buf,
494219820Sjeff				     struct ib_mad_send_wc *mad_send_wc);
495219820Sjeff
496219820Sjeff/**
497219820Sjeff * ib_mad_recv_handler - callback handler for a received MAD.
498219820Sjeff * @mad_agent: MAD agent requesting the received MAD.
499331769Shselasky * @send_buf: Send buffer if found, else NULL
500219820Sjeff * @mad_recv_wc: Received work completion information on the received MAD.
501219820Sjeff *
502219820Sjeff * MADs received in response to a send request operation will be handed to
503219820Sjeff * the user before the send operation completes.  All data buffers given
504219820Sjeff * to registered agents through this routine are owned by the receiving
505219820Sjeff * client, except for snooping agents.  Clients snooping MADs should not
506219820Sjeff * modify the data referenced by @mad_recv_wc.
507219820Sjeff */
508219820Sjefftypedef void (*ib_mad_recv_handler)(struct ib_mad_agent *mad_agent,
509331769Shselasky				    struct ib_mad_send_buf *send_buf,
510219820Sjeff				    struct ib_mad_recv_wc *mad_recv_wc);
511219820Sjeff
512219820Sjeff/**
513219820Sjeff * ib_mad_agent - Used to track MAD registration with the access layer.
514219820Sjeff * @device: Reference to device registration is on.
515219820Sjeff * @qp: Reference to QP used for sending and receiving MADs.
516219820Sjeff * @mr: Memory region for system memory usable for DMA.
517219820Sjeff * @recv_handler: Callback handler for a received MAD.
518219820Sjeff * @send_handler: Callback handler for a sent MAD.
519219820Sjeff * @snoop_handler: Callback handler for snooped sent MADs.
520219820Sjeff * @context: User-specified context associated with this registration.
521219820Sjeff * @hi_tid: Access layer assigned transaction ID for this client.
522219820Sjeff *   Unsolicited MADs sent by this client will have the upper 32-bits
523219820Sjeff *   of their TID set to this value.
524331769Shselasky * @flags: registration flags
525219820Sjeff * @port_num: Port number on which QP is registered
526219820Sjeff * @rmpp_version: If set, indicates the RMPP version used by this agent.
527219820Sjeff */
528331769Shselaskyenum {
529331769Shselasky	IB_MAD_USER_RMPP = IB_USER_MAD_USER_RMPP,
530331769Shselasky};
531219820Sjeffstruct ib_mad_agent {
532219820Sjeff	struct ib_device	*device;
533219820Sjeff	struct ib_qp		*qp;
534219820Sjeff	ib_mad_recv_handler	recv_handler;
535219820Sjeff	ib_mad_send_handler	send_handler;
536219820Sjeff	ib_mad_snoop_handler	snoop_handler;
537219820Sjeff	void			*context;
538219820Sjeff	u32			hi_tid;
539331769Shselasky	u32			flags;
540219820Sjeff	u8			port_num;
541219820Sjeff	u8			rmpp_version;
542219820Sjeff};
543219820Sjeff
544219820Sjeff/**
545219820Sjeff * ib_mad_send_wc - MAD send completion information.
546219820Sjeff * @send_buf: Send MAD data buffer associated with the send MAD request.
547219820Sjeff * @status: Completion status.
548219820Sjeff * @vendor_err: Optional vendor error information returned with a failed
549219820Sjeff *   request.
550219820Sjeff */
551219820Sjeffstruct ib_mad_send_wc {
552219820Sjeff	struct ib_mad_send_buf	*send_buf;
553219820Sjeff	enum ib_wc_status	status;
554219820Sjeff	u32			vendor_err;
555219820Sjeff};
556219820Sjeff
557219820Sjeff/**
558219820Sjeff * ib_mad_recv_buf - received MAD buffer information.
559219820Sjeff * @list: Reference to next data buffer for a received RMPP MAD.
560219820Sjeff * @grh: References a data buffer containing the global route header.
561219820Sjeff *   The data refereced by this buffer is only valid if the GRH is
562219820Sjeff *   valid.
563219820Sjeff * @mad: References the start of the received MAD.
564219820Sjeff */
565219820Sjeffstruct ib_mad_recv_buf {
566219820Sjeff	struct list_head	list;
567219820Sjeff	struct ib_grh		*grh;
568331769Shselasky	union {
569331769Shselasky		struct ib_mad	*mad;
570331769Shselasky		struct opa_mad	*opa_mad;
571331769Shselasky	};
572219820Sjeff};
573219820Sjeff
574219820Sjeff/**
575219820Sjeff * ib_mad_recv_wc - received MAD information.
576219820Sjeff * @wc: Completion information for the received data.
577219820Sjeff * @recv_buf: Specifies the location of the received data buffer(s).
578219820Sjeff * @rmpp_list: Specifies a list of RMPP reassembled received MAD buffers.
579219820Sjeff * @mad_len: The length of the received MAD, without duplicated headers.
580331769Shselasky * @mad_seg_size: The size of individual MAD segments
581219820Sjeff *
582219820Sjeff * For received response, the wr_id contains a pointer to the ib_mad_send_buf
583219820Sjeff *   for the corresponding send request.
584219820Sjeff */
585219820Sjeffstruct ib_mad_recv_wc {
586219820Sjeff	struct ib_wc		*wc;
587219820Sjeff	struct ib_mad_recv_buf	recv_buf;
588219820Sjeff	struct list_head	rmpp_list;
589219820Sjeff	int			mad_len;
590331769Shselasky	size_t			mad_seg_size;
591219820Sjeff};
592219820Sjeff
593219820Sjeff/**
594219820Sjeff * ib_mad_reg_req - MAD registration request
595219820Sjeff * @mgmt_class: Indicates which management class of MADs should be receive
596219820Sjeff *   by the caller.  This field is only required if the user wishes to
597219820Sjeff *   receive unsolicited MADs, otherwise it should be 0.
598219820Sjeff * @mgmt_class_version: Indicates which version of MADs for the given
599219820Sjeff *   management class to receive.
600219820Sjeff * @oui: Indicates IEEE OUI when mgmt_class is a vendor class
601219820Sjeff *   in the range from 0x30 to 0x4f. Otherwise not used.
602219820Sjeff * @method_mask: The caller will receive unsolicited MADs for any method
603219820Sjeff *   where @method_mask = 1.
604331769Shselasky *
605219820Sjeff */
606219820Sjeffstruct ib_mad_reg_req {
607219820Sjeff	u8	mgmt_class;
608219820Sjeff	u8	mgmt_class_version;
609219820Sjeff	u8	oui[3];
610219820Sjeff	DECLARE_BITMAP(method_mask, IB_MGMT_MAX_METHODS);
611219820Sjeff};
612219820Sjeff
613219820Sjeff/**
614219820Sjeff * ib_register_mad_agent - Register to send/receive MADs.
615219820Sjeff * @device: The device to register with.
616219820Sjeff * @port_num: The port on the specified device to use.
617219820Sjeff * @qp_type: Specifies which QP to access.  Must be either
618219820Sjeff *   IB_QPT_SMI or IB_QPT_GSI.
619219820Sjeff * @mad_reg_req: Specifies which unsolicited MADs should be received
620219820Sjeff *   by the caller.  This parameter may be NULL if the caller only
621219820Sjeff *   wishes to receive solicited responses.
622219820Sjeff * @rmpp_version: If set, indicates that the client will send
623219820Sjeff *   and receive MADs that contain the RMPP header for the given version.
624219820Sjeff *   If set to 0, indicates that RMPP is not used by this client.
625219820Sjeff * @send_handler: The completion callback routine invoked after a send
626219820Sjeff *   request has completed.
627219820Sjeff * @recv_handler: The completion callback routine invoked for a received
628219820Sjeff *   MAD.
629219820Sjeff * @context: User specified context associated with the registration.
630331769Shselasky * @registration_flags: Registration flags to set for this agent
631219820Sjeff */
632219820Sjeffstruct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
633219820Sjeff					   u8 port_num,
634219820Sjeff					   enum ib_qp_type qp_type,
635219820Sjeff					   struct ib_mad_reg_req *mad_reg_req,
636219820Sjeff					   u8 rmpp_version,
637219820Sjeff					   ib_mad_send_handler send_handler,
638219820Sjeff					   ib_mad_recv_handler recv_handler,
639331769Shselasky					   void *context,
640331769Shselasky					   u32 registration_flags);
641219820Sjeff
642219820Sjeffenum ib_mad_snoop_flags {
643219820Sjeff	/*IB_MAD_SNOOP_POSTED_SENDS	   = 1,*/
644219820Sjeff	/*IB_MAD_SNOOP_RMPP_SENDS	   = (1<<1),*/
645219820Sjeff	IB_MAD_SNOOP_SEND_COMPLETIONS	   = (1<<2),
646219820Sjeff	/*IB_MAD_SNOOP_RMPP_SEND_COMPLETIONS = (1<<3),*/
647219820Sjeff	IB_MAD_SNOOP_RECVS		   = (1<<4)
648219820Sjeff	/*IB_MAD_SNOOP_RMPP_RECVS	   = (1<<5),*/
649219820Sjeff	/*IB_MAD_SNOOP_REDIRECTED_QPS	   = (1<<6)*/
650219820Sjeff};
651219820Sjeff
652219820Sjeff/**
653219820Sjeff * ib_register_mad_snoop - Register to snoop sent and received MADs.
654219820Sjeff * @device: The device to register with.
655219820Sjeff * @port_num: The port on the specified device to use.
656219820Sjeff * @qp_type: Specifies which QP traffic to snoop.  Must be either
657219820Sjeff *   IB_QPT_SMI or IB_QPT_GSI.
658219820Sjeff * @mad_snoop_flags: Specifies information where snooping occurs.
659219820Sjeff * @send_handler: The callback routine invoked for a snooped send.
660219820Sjeff * @recv_handler: The callback routine invoked for a snooped receive.
661219820Sjeff * @context: User specified context associated with the registration.
662219820Sjeff */
663219820Sjeffstruct ib_mad_agent *ib_register_mad_snoop(struct ib_device *device,
664219820Sjeff					   u8 port_num,
665219820Sjeff					   enum ib_qp_type qp_type,
666219820Sjeff					   int mad_snoop_flags,
667219820Sjeff					   ib_mad_snoop_handler snoop_handler,
668219820Sjeff					   ib_mad_recv_handler recv_handler,
669219820Sjeff					   void *context);
670219820Sjeff
671219820Sjeff/**
672219820Sjeff * ib_unregister_mad_agent - Unregisters a client from using MAD services.
673219820Sjeff * @mad_agent: Corresponding MAD registration request to deregister.
674219820Sjeff *
675219820Sjeff * After invoking this routine, MAD services are no longer usable by the
676219820Sjeff * client on the associated QP.
677219820Sjeff */
678219820Sjeffint ib_unregister_mad_agent(struct ib_mad_agent *mad_agent);
679219820Sjeff
680219820Sjeff/**
681219820Sjeff * ib_post_send_mad - Posts MAD(s) to the send queue of the QP associated
682219820Sjeff *   with the registered client.
683219820Sjeff * @send_buf: Specifies the information needed to send the MAD(s).
684219820Sjeff * @bad_send_buf: Specifies the MAD on which an error was encountered.  This
685219820Sjeff *   parameter is optional if only a single MAD is posted.
686219820Sjeff *
687219820Sjeff * Sent MADs are not guaranteed to complete in the order that they were posted.
688219820Sjeff *
689219820Sjeff * If the MAD requires RMPP, the data buffer should contain a single copy
690219820Sjeff * of the common MAD, RMPP, and class specific headers, followed by the class
691219820Sjeff * defined data.  If the class defined data would not divide evenly into
692219820Sjeff * RMPP segments, then space must be allocated at the end of the referenced
693219820Sjeff * buffer for any required padding.  To indicate the amount of class defined
694219820Sjeff * data being transferred, the paylen_newwin field in the RMPP header should
695219820Sjeff * be set to the size of the class specific header plus the amount of class
696219820Sjeff * defined data being transferred.  The paylen_newwin field should be
697219820Sjeff * specified in network-byte order.
698219820Sjeff */
699219820Sjeffint ib_post_send_mad(struct ib_mad_send_buf *send_buf,
700219820Sjeff		     struct ib_mad_send_buf **bad_send_buf);
701219820Sjeff
702219820Sjeff
703219820Sjeff/**
704219820Sjeff * ib_free_recv_mad - Returns data buffers used to receive a MAD.
705219820Sjeff * @mad_recv_wc: Work completion information for a received MAD.
706219820Sjeff *
707219820Sjeff * Clients receiving MADs through their ib_mad_recv_handler must call this
708219820Sjeff * routine to return the work completion buffers to the access layer.
709219820Sjeff */
710219820Sjeffvoid ib_free_recv_mad(struct ib_mad_recv_wc *mad_recv_wc);
711219820Sjeff
712219820Sjeff/**
713219820Sjeff * ib_cancel_mad - Cancels an outstanding send MAD operation.
714219820Sjeff * @mad_agent: Specifies the registration associated with sent MAD.
715219820Sjeff * @send_buf: Indicates the MAD to cancel.
716219820Sjeff *
717219820Sjeff * MADs will be returned to the user through the corresponding
718219820Sjeff * ib_mad_send_handler.
719219820Sjeff */
720219820Sjeffvoid ib_cancel_mad(struct ib_mad_agent *mad_agent,
721219820Sjeff		   struct ib_mad_send_buf *send_buf);
722219820Sjeff
723219820Sjeff/**
724219820Sjeff * ib_modify_mad - Modifies an outstanding send MAD operation.
725219820Sjeff * @mad_agent: Specifies the registration associated with sent MAD.
726219820Sjeff * @send_buf: Indicates the MAD to modify.
727219820Sjeff * @timeout_ms: New timeout value for sent MAD.
728219820Sjeff *
729219820Sjeff * This call will reset the timeout value for a sent MAD to the specified
730219820Sjeff * value.
731219820Sjeff */
732219820Sjeffint ib_modify_mad(struct ib_mad_agent *mad_agent,
733219820Sjeff		  struct ib_mad_send_buf *send_buf, u32 timeout_ms);
734219820Sjeff
735219820Sjeff/**
736219820Sjeff * ib_redirect_mad_qp - Registers a QP for MAD services.
737219820Sjeff * @qp: Reference to a QP that requires MAD services.
738219820Sjeff * @rmpp_version: If set, indicates that the client will send
739219820Sjeff *   and receive MADs that contain the RMPP header for the given version.
740219820Sjeff *   If set to 0, indicates that RMPP is not used by this client.
741219820Sjeff * @send_handler: The completion callback routine invoked after a send
742219820Sjeff *   request has completed.
743219820Sjeff * @recv_handler: The completion callback routine invoked for a received
744219820Sjeff *   MAD.
745219820Sjeff * @context: User specified context associated with the registration.
746219820Sjeff *
747219820Sjeff * Use of this call allows clients to use MAD services, such as RMPP,
748219820Sjeff * on user-owned QPs.  After calling this routine, users may send
749219820Sjeff * MADs on the specified QP by calling ib_mad_post_send.
750219820Sjeff */
751219820Sjeffstruct ib_mad_agent *ib_redirect_mad_qp(struct ib_qp *qp,
752219820Sjeff					u8 rmpp_version,
753219820Sjeff					ib_mad_send_handler send_handler,
754219820Sjeff					ib_mad_recv_handler recv_handler,
755219820Sjeff					void *context);
756219820Sjeff
757219820Sjeff/**
758219820Sjeff * ib_process_mad_wc - Processes a work completion associated with a
759219820Sjeff *   MAD sent or received on a redirected QP.
760219820Sjeff * @mad_agent: Specifies the registered MAD service using the redirected QP.
761219820Sjeff * @wc: References a work completion associated with a sent or received
762219820Sjeff *   MAD segment.
763219820Sjeff *
764219820Sjeff * This routine is used to complete or continue processing on a MAD request.
765219820Sjeff * If the work completion is associated with a send operation, calling
766219820Sjeff * this routine is required to continue an RMPP transfer or to wait for a
767219820Sjeff * corresponding response, if it is a request.  If the work completion is
768219820Sjeff * associated with a receive operation, calling this routine is required to
769219820Sjeff * process an inbound or outbound RMPP transfer, or to match a response MAD
770219820Sjeff * with its corresponding request.
771219820Sjeff */
772219820Sjeffint ib_process_mad_wc(struct ib_mad_agent *mad_agent,
773219820Sjeff		      struct ib_wc *wc);
774219820Sjeff
775219820Sjeff/**
776219820Sjeff * ib_create_send_mad - Allocate and initialize a data buffer and work request
777219820Sjeff *   for sending a MAD.
778219820Sjeff * @mad_agent: Specifies the registered MAD service to associate with the MAD.
779219820Sjeff * @remote_qpn: Specifies the QPN of the receiving node.
780219820Sjeff * @pkey_index: Specifies which PKey the MAD will be sent using.  This field
781219820Sjeff *   is valid only if the remote_qpn is QP 1.
782219820Sjeff * @rmpp_active: Indicates if the send will enable RMPP.
783219820Sjeff * @hdr_len: Indicates the size of the data header of the MAD.  This length
784219820Sjeff *   should include the common MAD header, RMPP header, plus any class
785219820Sjeff *   specific header.
786219820Sjeff * @data_len: Indicates the size of any user-transferred data.  The call will
787219820Sjeff *   automatically adjust the allocated buffer size to account for any
788219820Sjeff *   additional padding that may be necessary.
789219820Sjeff * @gfp_mask: GFP mask used for the memory allocation.
790331769Shselasky * @base_version: Base Version of this MAD
791219820Sjeff *
792219820Sjeff * This routine allocates a MAD for sending.  The returned MAD send buffer
793219820Sjeff * will reference a data buffer usable for sending a MAD, along
794219820Sjeff * with an initialized work request structure.  Users may modify the returned
795219820Sjeff * MAD data buffer before posting the send.
796219820Sjeff *
797219820Sjeff * The returned MAD header, class specific headers, and any padding will be
798219820Sjeff * cleared.  Users are responsible for initializing the common MAD header,
799219820Sjeff * any class specific header, and MAD data area.
800219820Sjeff * If @rmpp_active is set, the RMPP header will be initialized for sending.
801219820Sjeff */
802219820Sjeffstruct ib_mad_send_buf *ib_create_send_mad(struct ib_mad_agent *mad_agent,
803219820Sjeff					   u32 remote_qpn, u16 pkey_index,
804219820Sjeff					   int rmpp_active,
805219820Sjeff					   int hdr_len, int data_len,
806331769Shselasky					   gfp_t gfp_mask,
807331769Shselasky					   u8 base_version);
808219820Sjeff
809219820Sjeff/**
810219820Sjeff * ib_is_mad_class_rmpp - returns whether given management class
811219820Sjeff * supports RMPP.
812219820Sjeff * @mgmt_class: management class
813219820Sjeff *
814219820Sjeff * This routine returns whether the management class supports RMPP.
815219820Sjeff */
816219820Sjeffint ib_is_mad_class_rmpp(u8 mgmt_class);
817219820Sjeff
818219820Sjeff/**
819219820Sjeff * ib_get_mad_data_offset - returns the data offset for a given
820219820Sjeff * management class.
821219820Sjeff * @mgmt_class: management class
822219820Sjeff *
823219820Sjeff * This routine returns the data offset in the MAD for the management
824219820Sjeff * class requested.
825219820Sjeff */
826219820Sjeffint ib_get_mad_data_offset(u8 mgmt_class);
827219820Sjeff
828219820Sjeff/**
829219820Sjeff * ib_get_rmpp_segment - returns the data buffer for a given RMPP segment.
830219820Sjeff * @send_buf: Previously allocated send data buffer.
831219820Sjeff * @seg_num: number of segment to return
832219820Sjeff *
833219820Sjeff * This routine returns a pointer to the data buffer of an RMPP MAD.
834219820Sjeff * Users must provide synchronization to @send_buf around this call.
835219820Sjeff */
836219820Sjeffvoid *ib_get_rmpp_segment(struct ib_mad_send_buf *send_buf, int seg_num);
837219820Sjeff
838219820Sjeff/**
839219820Sjeff * ib_free_send_mad - Returns data buffers used to send a MAD.
840219820Sjeff * @send_buf: Previously allocated send data buffer.
841219820Sjeff */
842219820Sjeffvoid ib_free_send_mad(struct ib_mad_send_buf *send_buf);
843219820Sjeff
844331769Shselasky/**
845331769Shselasky * ib_mad_kernel_rmpp_agent - Returns if the agent is performing RMPP.
846331769Shselasky * @agent: the agent in question
847331769Shselasky * @return: true if agent is performing rmpp, false otherwise.
848331769Shselasky */
849331769Shselaskyint ib_mad_kernel_rmpp_agent(const struct ib_mad_agent *agent);
850331769Shselasky
851219820Sjeff#endif /* IB_MAD_H */
852