blob: e9a69f0b18a2510bd903fb59501216423f615dcb [file] [log] [blame]
Leon Romanovsky843debb2016-09-04 14:30:30 +03001/*
2 * Copyright (c) 2016 Mellanox Technologies, LTD. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33#ifndef RDMA_USER_IOCTL_H
34#define RDMA_USER_IOCTL_H
35
36#include <linux/types.h>
37#include <linux/ioctl.h>
Leon Romanovsky06393bc2016-09-04 14:30:31 +030038#include <rdma/ib_user_mad.h>
Leon Romanovsky8edec0b2016-09-04 14:30:33 +030039#include <rdma/hfi/hfi1_ioctl.h>
Leon Romanovsky843debb2016-09-04 14:30:30 +030040
41/* Documentation/ioctl/ioctl-number.txt */
42#define RDMA_IOCTL_MAGIC 0x1b
43#define IB_IOCTL_MAGIC RDMA_IOCTL_MAGIC
44
Leon Romanovsky06393bc2016-09-04 14:30:31 +030045#define IB_USER_MAD_REGISTER_AGENT _IOWR(IB_IOCTL_MAGIC, 1, \
46 struct ib_user_mad_reg_req)
47
48#define IB_USER_MAD_UNREGISTER_AGENT _IOW(IB_IOCTL_MAGIC, 2, __u32)
49
50#define IB_USER_MAD_ENABLE_PKEY _IO(IB_IOCTL_MAGIC, 3)
51
52#define IB_USER_MAD_REGISTER_AGENT2 _IOWR(IB_IOCTL_MAGIC, 4, \
53 struct ib_user_mad_reg_req2)
54
Leon Romanovsky8edec0b2016-09-04 14:30:33 +030055/* User commands. */
56#define HFI1_CMD_ASSIGN_CTXT 1 /* allocate HFI and context */
57#define HFI1_CMD_CTXT_INFO 2 /* find out what resources we got */
58#define HFI1_CMD_USER_INFO 3 /* set up userspace */
59#define HFI1_CMD_TID_UPDATE 4 /* update expected TID entries */
60#define HFI1_CMD_TID_FREE 5 /* free expected TID entries */
61#define HFI1_CMD_CREDIT_UPD 6 /* force an update of PIO credit */
62
63#define HFI1_CMD_RECV_CTRL 8 /* control receipt of packets */
64#define HFI1_CMD_POLL_TYPE 9 /* set the kind of polling we want */
65#define HFI1_CMD_ACK_EVENT 10 /* ack & clear user status bits */
66#define HFI1_CMD_SET_PKEY 11 /* set context's pkey */
67#define HFI1_CMD_CTXT_RESET 12 /* reset context's HW send context */
68#define HFI1_CMD_TID_INVAL_READ 13 /* read TID cache invalidations */
69#define HFI1_CMD_GET_VERS 14 /* get the version of the user cdev */
70
71/*
72 * User IOCTLs can not go above 128 if they do then see common.h and change the
73 * base for the snoop ioctl
74 */
75
76/*
77 * Make the ioctls occupy the last 0xf0-0xff portion of the IB range
78 */
79#define __NUM(cmd) (HFI1_CMD_##cmd + 0xe0)
80
81#define HFI1_IOCTL_ASSIGN_CTXT \
82 _IOWR(IB_IOCTL_MAGIC, __NUM(ASSIGN_CTXT), struct hfi1_user_info)
83#define HFI1_IOCTL_CTXT_INFO \
84 _IOW(IB_IOCTL_MAGIC, __NUM(CTXT_INFO), struct hfi1_ctxt_info)
85#define HFI1_IOCTL_USER_INFO \
86 _IOW(IB_IOCTL_MAGIC, __NUM(USER_INFO), struct hfi1_base_info)
87#define HFI1_IOCTL_TID_UPDATE \
88 _IOWR(IB_IOCTL_MAGIC, __NUM(TID_UPDATE), struct hfi1_tid_info)
89#define HFI1_IOCTL_TID_FREE \
90 _IOWR(IB_IOCTL_MAGIC, __NUM(TID_FREE), struct hfi1_tid_info)
91#define HFI1_IOCTL_CREDIT_UPD \
92 _IO(IB_IOCTL_MAGIC, __NUM(CREDIT_UPD))
93#define HFI1_IOCTL_RECV_CTRL \
94 _IOW(IB_IOCTL_MAGIC, __NUM(RECV_CTRL), int)
95#define HFI1_IOCTL_POLL_TYPE \
96 _IOW(IB_IOCTL_MAGIC, __NUM(POLL_TYPE), int)
97#define HFI1_IOCTL_ACK_EVENT \
98 _IOW(IB_IOCTL_MAGIC, __NUM(ACK_EVENT), unsigned long)
99#define HFI1_IOCTL_SET_PKEY \
100 _IOW(IB_IOCTL_MAGIC, __NUM(SET_PKEY), __u16)
101#define HFI1_IOCTL_CTXT_RESET \
102 _IO(IB_IOCTL_MAGIC, __NUM(CTXT_RESET))
103#define HFI1_IOCTL_TID_INVAL_READ \
104 _IOWR(IB_IOCTL_MAGIC, __NUM(TID_INVAL_READ), struct hfi1_tid_info)
105#define HFI1_IOCTL_GET_VERS \
106 _IOR(IB_IOCTL_MAGIC, __NUM(GET_VERS), int)
107
Leon Romanovsky843debb2016-09-04 14:30:30 +0300108#endif /* RDMA_USER_IOCTL_H */