Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mad_priv.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2004, 2005, Voltaire, Inc. All rights reserved.
3  * Copyright (c) 2005 Intel Corporation. All rights reserved.
4  * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
5  * Copyright (c) 2009 HNR Consulting. All rights reserved.
6  *
7  * This software is available to you under a choice of one of two
8  * licenses. You may choose to be licensed under the terms of the GNU
9  * General Public License (GPL) Version 2, available from the file
10  * COPYING in the main directory of this source tree, or the
11  * OpenIB.org BSD license below:
12  *
13  * Redistribution and use in source and binary forms, with or
14  * without modification, are permitted provided that the following
15  * conditions are met:
16  *
17  * - Redistributions of source code must retain the above
18  * copyright notice, this list of conditions and the following
19  * disclaimer.
20  *
21  * - Redistributions in binary form must reproduce the above
22  * copyright notice, this list of conditions and the following
23  * disclaimer in the documentation and/or other materials
24  * provided with the distribution.
25  *
26  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
30  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
31  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
32  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33  * SOFTWARE.
34  */
35 
36 #ifndef __IB_MAD_PRIV_H__
37 #define __IB_MAD_PRIV_H__
38 
39 #include <linux/completion.h>
40 #include <linux/err.h>
41 #include <linux/workqueue.h>
42 #include <rdma/ib_mad.h>
43 #include <rdma/ib_smi.h>
44 
45 
46 #define PFX "ib_mad: "
47 
48 #define IB_MAD_QPS_CORE 2 /* Always QP0 and QP1 as a minimum */
49 
50 /* QP and CQ parameters */
51 #define IB_MAD_QP_SEND_SIZE 128
52 #define IB_MAD_QP_RECV_SIZE 512
53 #define IB_MAD_QP_MIN_SIZE 64
54 #define IB_MAD_QP_MAX_SIZE 8192
55 #define IB_MAD_SEND_REQ_MAX_SG 2
56 #define IB_MAD_RECV_REQ_MAX_SG 1
57 
58 #define IB_MAD_SEND_Q_PSN 0
59 
60 /* Registration table sizes */
61 #define MAX_MGMT_CLASS 80
62 #define MAX_MGMT_VERSION 8
63 #define MAX_MGMT_OUI 8
64 #define MAX_MGMT_VENDOR_RANGE2 (IB_MGMT_CLASS_VENDOR_RANGE2_END - \
65  IB_MGMT_CLASS_VENDOR_RANGE2_START + 1)
66 
68  struct list_head list;
70 };
71 
75  struct ib_wc wc;
77 } __attribute__ ((packed));
78 
81  struct ib_grh grh;
82  union {
83  struct ib_mad mad;
85  struct ib_smp smp;
86  } mad;
87 } __attribute__ ((packed));
88 
90  struct list_head list;
92  u8 data[0];
93 };
94 
100 
106  unsigned long timeout;
110 
112  struct completion comp;
113 };
114 
121  struct completion comp;
122 };
123 
134  unsigned long timeout;
137  int retry;
138  int refcount;
140 
141  /* RMPP control */
145  int last_ack;
146  int seg_num;
147  int newwin;
148  int pad;
149 };
150 
156 };
157 
160 };
161 
164 };
165 
169 };
170 
173 };
174 
176  struct ib_mad_mgmt_class_table *class;
178 };
179 
180 struct ib_mad_queue {
182  struct list_head list;
183  int count;
186 };
187 
190  struct ib_qp *qp;
198 };
199 
202  struct ib_device *device;
203  int port_num;
204  struct ib_cq *cq;
205  struct ib_pd *pd;
206  struct ib_mr *mr;
207 
214 };
215 
216 int ib_send_mad(struct ib_mad_send_wr_private *mad_send_wr);
217 
218 struct ib_mad_send_wr_private *
220  struct ib_mad_recv_wc *mad_recv_wc);
221 
222 void ib_mad_complete_send_wr(struct ib_mad_send_wr_private *mad_send_wr,
223  struct ib_mad_send_wc *mad_send_wc);
224 
225 void ib_mark_mad_done(struct ib_mad_send_wr_private *mad_send_wr);
226 
227 void ib_reset_mad_timeout(struct ib_mad_send_wr_private *mad_send_wr,
228  int timeout_ms);
229 
230 #endif /* __IB_MAD_PRIV_H__ */