xref: /linux/include/uapi/rdma/rdma_user_ioctl.h (revision c74a7469f97c0f40b46e82ee979f9fb1bb6e847c)
1*d50e14abSJason Gunthorpe /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */
2843debb8SLeon Romanovsky /*
3843debb8SLeon Romanovsky  * Copyright (c) 2016 Mellanox Technologies, LTD. All rights reserved.
4843debb8SLeon Romanovsky  *
5843debb8SLeon Romanovsky  * This software is available to you under a choice of one of two
6843debb8SLeon Romanovsky  * licenses.  You may choose to be licensed under the terms of the GNU
7843debb8SLeon Romanovsky  * General Public License (GPL) Version 2, available from the file
8843debb8SLeon Romanovsky  * COPYING in the main directory of this source tree, or the
9843debb8SLeon Romanovsky  * OpenIB.org BSD license below:
10843debb8SLeon Romanovsky  *
11843debb8SLeon Romanovsky  *     Redistribution and use in source and binary forms, with or
12843debb8SLeon Romanovsky  *     without modification, are permitted provided that the following
13843debb8SLeon Romanovsky  *     conditions are met:
14843debb8SLeon Romanovsky  *
15843debb8SLeon Romanovsky  *      - Redistributions of source code must retain the above
16843debb8SLeon Romanovsky  *        copyright notice, this list of conditions and the following
17843debb8SLeon Romanovsky  *        disclaimer.
18843debb8SLeon Romanovsky  *
19843debb8SLeon Romanovsky  *      - Redistributions in binary form must reproduce the above
20843debb8SLeon Romanovsky  *        copyright notice, this list of conditions and the following
21843debb8SLeon Romanovsky  *        disclaimer in the documentation and/or other materials
22843debb8SLeon Romanovsky  *        provided with the distribution.
23843debb8SLeon Romanovsky  *
24843debb8SLeon Romanovsky  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25843debb8SLeon Romanovsky  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26843debb8SLeon Romanovsky  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27843debb8SLeon Romanovsky  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28843debb8SLeon Romanovsky  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29843debb8SLeon Romanovsky  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30843debb8SLeon Romanovsky  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31843debb8SLeon Romanovsky  * SOFTWARE.
32843debb8SLeon Romanovsky  */
33843debb8SLeon Romanovsky 
34843debb8SLeon Romanovsky #ifndef RDMA_USER_IOCTL_H
35843debb8SLeon Romanovsky #define RDMA_USER_IOCTL_H
36843debb8SLeon Romanovsky 
3706393bc3SLeon Romanovsky #include <rdma/ib_user_mad.h>
388edec0b5SLeon Romanovsky #include <rdma/hfi/hfi1_ioctl.h>
391f7ff9d5SMatan Barak #include <rdma/rdma_user_ioctl_cmds.h>
40843debb8SLeon Romanovsky 
4110b31e79SLeon Romanovsky /* Legacy name, for user space application which already use it */
42843debb8SLeon Romanovsky #define IB_IOCTL_MAGIC		RDMA_IOCTL_MAGIC
43843debb8SLeon Romanovsky 
448edec0b5SLeon Romanovsky /*
45fa83b793SLeon Romanovsky  * General blocks assignments
46fa83b793SLeon Romanovsky  * It is closed on purpose do not expose it it user space
47fa83b793SLeon Romanovsky  * #define MAD_CMD_BASE		0x00
48fa83b793SLeon Romanovsky  * #define HFI1_CMD_BAS		0xE0
498edec0b5SLeon Romanovsky  */
508edec0b5SLeon Romanovsky 
51fa83b793SLeon Romanovsky /* MAD specific section */
52fa83b793SLeon Romanovsky #define IB_USER_MAD_REGISTER_AGENT	_IOWR(RDMA_IOCTL_MAGIC, 0x01, struct ib_user_mad_reg_req)
53fa83b793SLeon Romanovsky #define IB_USER_MAD_UNREGISTER_AGENT	_IOW(RDMA_IOCTL_MAGIC,  0x02, __u32)
54fa83b793SLeon Romanovsky #define IB_USER_MAD_ENABLE_PKEY		_IO(RDMA_IOCTL_MAGIC,   0x03)
55fa83b793SLeon Romanovsky #define IB_USER_MAD_REGISTER_AGENT2	_IOWR(RDMA_IOCTL_MAGIC, 0x04, struct ib_user_mad_reg_req2)
568edec0b5SLeon Romanovsky 
57fa83b793SLeon Romanovsky /* HFI specific section */
58fa83b793SLeon Romanovsky /* allocate HFI and context */
59fa83b793SLeon Romanovsky #define HFI1_IOCTL_ASSIGN_CTXT		_IOWR(RDMA_IOCTL_MAGIC, 0xE1, struct hfi1_user_info)
60fa83b793SLeon Romanovsky /* find out what resources we got */
61fa83b793SLeon Romanovsky #define HFI1_IOCTL_CTXT_INFO		_IOW(RDMA_IOCTL_MAGIC,  0xE2, struct hfi1_ctxt_info)
62fa83b793SLeon Romanovsky /* set up userspace */
63fa83b793SLeon Romanovsky #define HFI1_IOCTL_USER_INFO		_IOW(RDMA_IOCTL_MAGIC,  0xE3, struct hfi1_base_info)
64fa83b793SLeon Romanovsky /* update expected TID entries */
65fa83b793SLeon Romanovsky #define HFI1_IOCTL_TID_UPDATE		_IOWR(RDMA_IOCTL_MAGIC, 0xE4, struct hfi1_tid_info)
66fa83b793SLeon Romanovsky /* free expected TID entries */
67fa83b793SLeon Romanovsky #define HFI1_IOCTL_TID_FREE		_IOWR(RDMA_IOCTL_MAGIC, 0xE5, struct hfi1_tid_info)
68fa83b793SLeon Romanovsky /* force an update of PIO credit */
69fa83b793SLeon Romanovsky #define HFI1_IOCTL_CREDIT_UPD		_IO(RDMA_IOCTL_MAGIC,   0xE6)
70fa83b793SLeon Romanovsky /* control receipt of packets */
71fa83b793SLeon Romanovsky #define HFI1_IOCTL_RECV_CTRL		_IOW(RDMA_IOCTL_MAGIC,  0xE8, int)
72fa83b793SLeon Romanovsky /* set the kind of polling we want */
73fa83b793SLeon Romanovsky #define HFI1_IOCTL_POLL_TYPE		_IOW(RDMA_IOCTL_MAGIC,  0xE9, int)
74fa83b793SLeon Romanovsky /* ack & clear user status bits */
75fa83b793SLeon Romanovsky #define HFI1_IOCTL_ACK_EVENT		_IOW(RDMA_IOCTL_MAGIC,  0xEA, unsigned long)
76fa83b793SLeon Romanovsky /* set context's pkey */
77fa83b793SLeon Romanovsky #define HFI1_IOCTL_SET_PKEY		_IOW(RDMA_IOCTL_MAGIC,  0xEB, __u16)
78fa83b793SLeon Romanovsky /* reset context's HW send context */
79fa83b793SLeon Romanovsky #define HFI1_IOCTL_CTXT_RESET		_IO(RDMA_IOCTL_MAGIC,   0xEC)
80fa83b793SLeon Romanovsky /* read TID cache invalidations */
81fa83b793SLeon Romanovsky #define HFI1_IOCTL_TID_INVAL_READ	_IOWR(RDMA_IOCTL_MAGIC, 0xED, struct hfi1_tid_info)
82fa83b793SLeon Romanovsky /* get the version of the user cdev */
83fa83b793SLeon Romanovsky #define HFI1_IOCTL_GET_VERS		_IOR(RDMA_IOCTL_MAGIC,  0xEE, int)
848edec0b5SLeon Romanovsky 
85843debb8SLeon Romanovsky #endif /* RDMA_USER_IOCTL_H */
86