1219820Sjeff/*
2219820Sjeff * Copyright (c) 2005 Topspin Communications.  All rights reserved.
3219820Sjeff * Copyright (c) 2005, 2006 Cisco Systems.  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 MTHCA_USER_H
35219820Sjeff#define MTHCA_USER_H
36219820Sjeff
37219820Sjeff#include <linux/types.h>
38219820Sjeff
39219820Sjeff/*
40219820Sjeff * Increment this value if any changes that break userspace ABI
41219820Sjeff * compatibility are made.
42219820Sjeff */
43219820Sjeff#define MTHCA_UVERBS_ABI_VERSION	1
44219820Sjeff
45219820Sjeff/*
46219820Sjeff * Make sure that all structs defined in this file remain laid out so
47219820Sjeff * that they pack the same way on 32-bit and 64-bit architectures (to
48219820Sjeff * avoid incompatibility between 32-bit userspace and 64-bit kernels).
49219820Sjeff * In particular do not use pointer types -- pass pointers in __u64
50219820Sjeff * instead.
51219820Sjeff */
52219820Sjeff
53219820Sjeffstruct mthca_alloc_ucontext_resp {
54219820Sjeff	__u32 qp_tab_size;
55219820Sjeff	__u32 uarc_size;
56219820Sjeff};
57219820Sjeff
58219820Sjeffstruct mthca_alloc_pd_resp {
59219820Sjeff	__u32 pdn;
60219820Sjeff	__u32 reserved;
61219820Sjeff};
62219820Sjeff
63219820Sjeffstruct mthca_reg_mr {
64219820Sjeff/*
65219820Sjeff * Mark the memory region with a DMA attribute that causes
66219820Sjeff * in-flight DMA to be flushed when the region is written to:
67219820Sjeff */
68219820Sjeff#define MTHCA_MR_DMASYNC	0x1
69219820Sjeff	__u32 mr_attrs;
70219820Sjeff	__u32 reserved;
71219820Sjeff};
72219820Sjeff
73219820Sjeffstruct mthca_create_cq {
74219820Sjeff	__u32 lkey;
75219820Sjeff	__u32 pdn;
76219820Sjeff	__u64 arm_db_page;
77219820Sjeff	__u64 set_db_page;
78219820Sjeff	__u32 arm_db_index;
79219820Sjeff	__u32 set_db_index;
80219820Sjeff};
81219820Sjeff
82219820Sjeffstruct mthca_create_cq_resp {
83219820Sjeff	__u32 cqn;
84219820Sjeff	__u32 reserved;
85219820Sjeff};
86219820Sjeff
87219820Sjeffstruct mthca_resize_cq {
88219820Sjeff	__u32 lkey;
89219820Sjeff	__u32 reserved;
90219820Sjeff};
91219820Sjeff
92219820Sjeffstruct mthca_create_srq {
93219820Sjeff	__u32 lkey;
94219820Sjeff	__u32 db_index;
95219820Sjeff	__u64 db_page;
96219820Sjeff};
97219820Sjeff
98219820Sjeffstruct mthca_create_srq_resp {
99219820Sjeff	__u32 srqn;
100219820Sjeff	__u32 reserved;
101219820Sjeff};
102219820Sjeff
103219820Sjeffstruct mthca_create_qp {
104219820Sjeff	__u32 lkey;
105219820Sjeff	__u32 reserved;
106219820Sjeff	__u64 sq_db_page;
107219820Sjeff	__u64 rq_db_page;
108219820Sjeff	__u32 sq_db_index;
109219820Sjeff	__u32 rq_db_index;
110219820Sjeff};
111219820Sjeff
112219820Sjeff#endif /* MTHCA_USER_H */
113