1219820Sjeff/*
2219820Sjeff * Copyright (c) 2005 Topspin Communications.  All rights reserved.
3219820Sjeff *
4219820Sjeff * This software is available to you under a choice of one of two
5219820Sjeff * licenses.  You may choose to be licensed under the terms of the GNU
6219820Sjeff * General Public License (GPL) Version 2, available from the file
7219820Sjeff * COPYING in the main directory of this source tree, or the
8219820Sjeff * OpenIB.org BSD license below:
9219820Sjeff *
10219820Sjeff *     Redistribution and use in source and binary forms, with or
11219820Sjeff *     without modification, are permitted provided that the following
12219820Sjeff *     conditions are met:
13219820Sjeff *
14219820Sjeff *      - Redistributions of source code must retain the above
15219820Sjeff *        copyright notice, this list of conditions and the following
16219820Sjeff *        disclaimer.
17219820Sjeff *
18219820Sjeff *      - Redistributions in binary form must reproduce the above
19219820Sjeff *        copyright notice, this list of conditions and the following
20219820Sjeff *        disclaimer in the documentation and/or other materials
21219820Sjeff *        provided with the distribution.
22219820Sjeff *
23219820Sjeff * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24219820Sjeff * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25219820Sjeff * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26219820Sjeff * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27219820Sjeff * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28219820Sjeff * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29219820Sjeff * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30219820Sjeff * SOFTWARE.
31219820Sjeff */
32219820Sjeff
33219820Sjeff#ifndef KERN_ABI_H
34219820Sjeff#define KERN_ABI_H
35219820Sjeff
36219820Sjeff#include <linux/types.h>
37219820Sjeff
38219820Sjeff/*
39219820Sjeff * Increment this value if any changes that break userspace ABI
40219820Sjeff * compatibility are made.
41219820Sjeff */
42219820Sjeff#define IB_USER_VERBS_ABI_VERSION	1
43219820Sjeff
44219820Sjeffenum {
45219820Sjeff	IB_USER_VERBS_CMD_GET_CONTEXT,
46219820Sjeff	IB_USER_VERBS_CMD_GET_EVENT_FDS,
47219820Sjeff	IB_USER_VERBS_CMD_ALLOC_PD,
48219820Sjeff	IB_USER_VERBS_CMD_DEALLOC_PD,
49219820Sjeff	IB_USER_VERBS_CMD_REG_MR,
50219820Sjeff	IB_USER_VERBS_CMD_DEREG_MR
51219820Sjeff};
52219820Sjeff
53219820Sjeff/*
54219820Sjeff * Make sure that all structs defined in this file remain laid out so
55219820Sjeff * that they pack the same way on 32-bit and 64-bit architectures (to
56219820Sjeff * avoid incompatibility between 32-bit userspace and 64-bit kernels).
57219820Sjeff * In particular do not use pointer types -- pass pointers in __u64
58219820Sjeff * instead.
59219820Sjeff */
60219820Sjeff
61219820Sjeffstruct ibv_kern_async_event {
62219820Sjeff	__u32 event_type;
63219820Sjeff	__u32 element;
64219820Sjeff};
65219820Sjeff
66219820Sjeffstruct ibv_comp_event {
67219820Sjeff	__u32 cq_handle;
68219820Sjeff};
69219820Sjeff
70219820Sjeff/*
71219820Sjeff * All commands from userspace should start with a __u32 command field
72219820Sjeff * followed by __u16 in_words and out_words fields (which give the
73219820Sjeff * length of the command block and response buffer if any in 32-bit
74219820Sjeff * words).  The kernel driver will read these fields first and read
75219820Sjeff * the rest of the command struct based on these value.
76219820Sjeff */
77219820Sjeff
78219820Sjeffstruct ibv_get_context {
79219820Sjeff	__u32 command;
80219820Sjeff	__u16 in_words;
81219820Sjeff	__u16 out_words;
82219820Sjeff	__u64 response;
83219820Sjeff};
84219820Sjeff
85219820Sjeffstruct ibv_get_context_resp {
86219820Sjeff	__u32 num_cq_events;
87219820Sjeff};
88219820Sjeff
89219820Sjeffstruct ibv_get_event_fds {
90219820Sjeff	__u32 command;
91219820Sjeff	__u16 in_words;
92219820Sjeff	__u16 out_words;
93219820Sjeff	__u64 response;
94219820Sjeff};
95219820Sjeff
96219820Sjeffstruct ibv_get_event_fds_resp {
97219820Sjeff	__u32 async_fd;
98219820Sjeff	__u32 cq_fd[1];
99219820Sjeff};
100219820Sjeff
101219820Sjeff#endif /* KERN_ABI_H */
102