Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mthca_cmd.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2004, 2005 Topspin Communications. All rights reserved.
3  * Copyright (c) 2005 Mellanox Technologies. All rights reserved.
4  * Copyright (c) 2006 Cisco Systems. All rights reserved.
5  *
6  * This software is available to you under a choice of one of two
7  * licenses. You may choose to be licensed under the terms of the GNU
8  * General Public License (GPL) Version 2, available from the file
9  * COPYING in the main directory of this source tree, or the
10  * OpenIB.org BSD license below:
11  *
12  * Redistribution and use in source and binary forms, with or
13  * without modification, are permitted provided that the following
14  * conditions are met:
15  *
16  * - Redistributions of source code must retain the above
17  * copyright notice, this list of conditions and the following
18  * disclaimer.
19  *
20  * - Redistributions in binary form must reproduce the above
21  * copyright notice, this list of conditions and the following
22  * disclaimer in the documentation and/or other materials
23  * provided with the distribution.
24  *
25  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32  * SOFTWARE.
33  */
34 
35 #ifndef MTHCA_CMD_H
36 #define MTHCA_CMD_H
37 
38 #include <rdma/ib_verbs.h>
39 
40 #define MTHCA_MAILBOX_SIZE 4096
41 
42 enum {
43  /* command completed successfully: */
45  /* Internal error (such as a bus error) occurred while processing command: */
47  /* Operation/command not supported or opcode modifier not supported: */
49  /* Parameter not supported or parameter out of range: */
51  /* System not enabled or bad system state: */
53  /* Attempt to access reserved or unallocaterd resource: */
55  /* Requested resource is currently executing a command, or is otherwise busy: */
57  /* memory error: */
59  /* Required capability exceeds device limits: */
61  /* Resource is not in the appropriate state or ownership: */
63  /* Index out of range: */
65  /* FW image corrupted: */
67  /* Attempt to modify a QP/EE which is not in the presumed state: */
69  /* Bad segment parameters (Address/Size): */
71  /* Memory Region has Memory Windows bound to: */
73  /* HCA local attached memory not present: */
75  /* Bad management packet (silently discarded): */
77  /* More outstanding CQEs in CQ than new CQ size: */
79 };
80 
81 enum {
94 };
95 
96 enum {
97  DEV_LIM_FLAG_RC = 1 << 0,
98  DEV_LIM_FLAG_UC = 1 << 1,
99  DEV_LIM_FLAG_UD = 1 << 2,
100  DEV_LIM_FLAG_RD = 1 << 3,
107  DEV_LIM_FLAG_MW = 1 << 16,
113 };
114 
117  void *buf;
118 };
119 
124  int max_qps;
126  int max_srqs;
128  int max_eecs;
131  int max_cqs;
132  int max_mpts;
134  int max_eqs;
143  int max_mtu;
145  int max_vl;
147  int max_gids;
152  int uar_size;
154  int max_sg;
158  int max_mcgs;
160  int max_pds;
162  int max_rdds;
172  union {
173  struct {
174  int max_avs;
175  } tavor;
176  struct {
183  } arbel;
184  } hca;
185 };
186 
193 };
194 
221 };
222 
225  int vl_cap;
226  int mtu_cap;
235 };
236 
242 };
243 
244 int mthca_cmd_init(struct mthca_dev *dev);
245 void mthca_cmd_cleanup(struct mthca_dev *dev);
246 int mthca_cmd_use_events(struct mthca_dev *dev);
247 void mthca_cmd_use_polling(struct mthca_dev *dev);
248 void mthca_cmd_event(struct mthca_dev *dev, u16 token,
249  u8 status, u64 out_param);
250 
252  gfp_t gfp_mask);
253 void mthca_free_mailbox(struct mthca_dev *dev, struct mthca_mailbox *mailbox);
254 
255 int mthca_SYS_EN(struct mthca_dev *dev);
256 int mthca_SYS_DIS(struct mthca_dev *dev);
257 int mthca_MAP_FA(struct mthca_dev *dev, struct mthca_icm *icm);
258 int mthca_UNMAP_FA(struct mthca_dev *dev);
259 int mthca_RUN_FW(struct mthca_dev *dev);
260 int mthca_QUERY_FW(struct mthca_dev *dev);
261 int mthca_ENABLE_LAM(struct mthca_dev *dev);
262 int mthca_DISABLE_LAM(struct mthca_dev *dev);
263 int mthca_QUERY_DDR(struct mthca_dev *dev);
264 int mthca_QUERY_DEV_LIM(struct mthca_dev *dev,
265  struct mthca_dev_lim *dev_lim);
266 int mthca_QUERY_ADAPTER(struct mthca_dev *dev,
267  struct mthca_adapter *adapter);
268 int mthca_INIT_HCA(struct mthca_dev *dev,
269  struct mthca_init_hca_param *param);
270 int mthca_INIT_IB(struct mthca_dev *dev,
271  struct mthca_init_ib_param *param,
272  int port);
273 int mthca_CLOSE_IB(struct mthca_dev *dev, int port);
274 int mthca_CLOSE_HCA(struct mthca_dev *dev, int panic);
275 int mthca_SET_IB(struct mthca_dev *dev, struct mthca_set_ib_param *param,
276  int port);
277 int mthca_MAP_ICM(struct mthca_dev *dev, struct mthca_icm *icm, u64 virt);
278 int mthca_MAP_ICM_page(struct mthca_dev *dev, u64 dma_addr, u64 virt);
279 int mthca_UNMAP_ICM(struct mthca_dev *dev, u64 virt, u32 page_count);
280 int mthca_MAP_ICM_AUX(struct mthca_dev *dev, struct mthca_icm *icm);
281 int mthca_UNMAP_ICM_AUX(struct mthca_dev *dev);
282 int mthca_SET_ICM_SIZE(struct mthca_dev *dev, u64 icm_size, u64 *aux_pages);
283 int mthca_SW2HW_MPT(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
284  int mpt_index);
285 int mthca_HW2SW_MPT(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
286  int mpt_index);
287 int mthca_WRITE_MTT(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
288  int num_mtt);
289 int mthca_SYNC_TPT(struct mthca_dev *dev);
290 int mthca_MAP_EQ(struct mthca_dev *dev, u64 event_mask, int unmap,
291  int eq_num);
292 int mthca_SW2HW_EQ(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
293  int eq_num);
294 int mthca_HW2SW_EQ(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
295  int eq_num);
296 int mthca_SW2HW_CQ(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
297  int cq_num);
298 int mthca_HW2SW_CQ(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
299  int cq_num);
300 int mthca_RESIZE_CQ(struct mthca_dev *dev, int cq_num, u32 lkey, u8 log_size);
301 int mthca_SW2HW_SRQ(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
302  int srq_num);
303 int mthca_HW2SW_SRQ(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
304  int srq_num);
305 int mthca_QUERY_SRQ(struct mthca_dev *dev, u32 num,
306  struct mthca_mailbox *mailbox);
307 int mthca_ARM_SRQ(struct mthca_dev *dev, int srq_num, int limit);
308 int mthca_MODIFY_QP(struct mthca_dev *dev, enum ib_qp_state cur,
309  enum ib_qp_state next, u32 num, int is_ee,
310  struct mthca_mailbox *mailbox, u32 optmask);
311 int mthca_QUERY_QP(struct mthca_dev *dev, u32 num, int is_ee,
312  struct mthca_mailbox *mailbox);
313 int mthca_CONF_SPECIAL_QP(struct mthca_dev *dev, int type, u32 qpn);
314 int mthca_MAD_IFC(struct mthca_dev *dev, int ignore_mkey, int ignore_bkey,
315  int port, struct ib_wc *in_wc, struct ib_grh *in_grh,
316  void *in_mad, void *response_mad);
317 int mthca_READ_MGM(struct mthca_dev *dev, int index,
318  struct mthca_mailbox *mailbox);
319 int mthca_WRITE_MGM(struct mthca_dev *dev, int index,
320  struct mthca_mailbox *mailbox);
321 int mthca_MGID_HASH(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
322  u16 *hash);
323 int mthca_NOP(struct mthca_dev *dev);
324 
325 #endif /* MTHCA_CMD_H */