blob: 7ecf8cd17f588f9433fa2d83ecfabb9298226c5f [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
Leon Romanovsky10b31e72016-09-04 14:30:34 +030043/* Legacy name, for user space application which already use it */
Leon Romanovsky843debb2016-09-04 14:30:30 +030044#define IB_IOCTL_MAGIC RDMA_IOCTL_MAGIC
45
Leon Romanovsky10b31e72016-09-04 14:30:34 +030046#define IB_USER_MAD_REGISTER_AGENT _IOWR(RDMA_IOCTL_MAGIC, 1, \
Leon Romanovsky06393bc2016-09-04 14:30:31 +030047 struct ib_user_mad_reg_req)
48
Leon Romanovsky10b31e72016-09-04 14:30:34 +030049#define IB_USER_MAD_UNREGISTER_AGENT _IOW(RDMA_IOCTL_MAGIC, 2, __u32)
Leon Romanovsky06393bc2016-09-04 14:30:31 +030050
Leon Romanovsky10b31e72016-09-04 14:30:34 +030051#define IB_USER_MAD_ENABLE_PKEY _IO(RDMA_IOCTL_MAGIC, 3)
Leon Romanovsky06393bc2016-09-04 14:30:31 +030052
Leon Romanovsky10b31e72016-09-04 14:30:34 +030053#define IB_USER_MAD_REGISTER_AGENT2 _IOWR(RDMA_IOCTL_MAGIC, 4, \
Leon Romanovsky06393bc2016-09-04 14:30:31 +030054 struct ib_user_mad_reg_req2)
55
Leon Romanovsky8edec0b2016-09-04 14:30:33 +030056/* User commands. */
57#define HFI1_CMD_ASSIGN_CTXT 1 /* allocate HFI and context */
58#define HFI1_CMD_CTXT_INFO 2 /* find out what resources we got */
59#define HFI1_CMD_USER_INFO 3 /* set up userspace */
60#define HFI1_CMD_TID_UPDATE 4 /* update expected TID entries */
61#define HFI1_CMD_TID_FREE 5 /* free expected TID entries */
62#define HFI1_CMD_CREDIT_UPD 6 /* force an update of PIO credit */
63
64#define HFI1_CMD_RECV_CTRL 8 /* control receipt of packets */
65#define HFI1_CMD_POLL_TYPE 9 /* set the kind of polling we want */
66#define HFI1_CMD_ACK_EVENT 10 /* ack & clear user status bits */
67#define HFI1_CMD_SET_PKEY 11 /* set context's pkey */
68#define HFI1_CMD_CTXT_RESET 12 /* reset context's HW send context */
69#define HFI1_CMD_TID_INVAL_READ 13 /* read TID cache invalidations */
70#define HFI1_CMD_GET_VERS 14 /* get the version of the user cdev */
71
72/*
73 * User IOCTLs can not go above 128 if they do then see common.h and change the
74 * base for the snoop ioctl
75 */
76
77/*
78 * Make the ioctls occupy the last 0xf0-0xff portion of the IB range
79 */
80#define __NUM(cmd) (HFI1_CMD_##cmd + 0xe0)
81
82#define HFI1_IOCTL_ASSIGN_CTXT \
Leon Romanovsky10b31e72016-09-04 14:30:34 +030083 _IOWR(RDMA_IOCTL_MAGIC, __NUM(ASSIGN_CTXT), struct hfi1_user_info)
Leon Romanovsky8edec0b2016-09-04 14:30:33 +030084#define HFI1_IOCTL_CTXT_INFO \
Leon Romanovsky10b31e72016-09-04 14:30:34 +030085 _IOW(RDMA_IOCTL_MAGIC, __NUM(CTXT_INFO), struct hfi1_ctxt_info)
Leon Romanovsky8edec0b2016-09-04 14:30:33 +030086#define HFI1_IOCTL_USER_INFO \
Leon Romanovsky10b31e72016-09-04 14:30:34 +030087 _IOW(RDMA_IOCTL_MAGIC, __NUM(USER_INFO), struct hfi1_base_info)
Leon Romanovsky8edec0b2016-09-04 14:30:33 +030088#define HFI1_IOCTL_TID_UPDATE \
Leon Romanovsky10b31e72016-09-04 14:30:34 +030089 _IOWR(RDMA_IOCTL_MAGIC, __NUM(TID_UPDATE), struct hfi1_tid_info)
Leon Romanovsky8edec0b2016-09-04 14:30:33 +030090#define HFI1_IOCTL_TID_FREE \
Leon Romanovsky10b31e72016-09-04 14:30:34 +030091 _IOWR(RDMA_IOCTL_MAGIC, __NUM(TID_FREE), struct hfi1_tid_info)
Leon Romanovsky8edec0b2016-09-04 14:30:33 +030092#define HFI1_IOCTL_CREDIT_UPD \
Leon Romanovsky10b31e72016-09-04 14:30:34 +030093 _IO(RDMA_IOCTL_MAGIC, __NUM(CREDIT_UPD))
Leon Romanovsky8edec0b2016-09-04 14:30:33 +030094#define HFI1_IOCTL_RECV_CTRL \
Leon Romanovsky10b31e72016-09-04 14:30:34 +030095 _IOW(RDMA_IOCTL_MAGIC, __NUM(RECV_CTRL), int)
Leon Romanovsky8edec0b2016-09-04 14:30:33 +030096#define HFI1_IOCTL_POLL_TYPE \
Leon Romanovsky10b31e72016-09-04 14:30:34 +030097 _IOW(RDMA_IOCTL_MAGIC, __NUM(POLL_TYPE), int)
Leon Romanovsky8edec0b2016-09-04 14:30:33 +030098#define HFI1_IOCTL_ACK_EVENT \
Leon Romanovsky10b31e72016-09-04 14:30:34 +030099 _IOW(RDMA_IOCTL_MAGIC, __NUM(ACK_EVENT), unsigned long)
Leon Romanovsky8edec0b2016-09-04 14:30:33 +0300100#define HFI1_IOCTL_SET_PKEY \
Leon Romanovsky10b31e72016-09-04 14:30:34 +0300101 _IOW(RDMA_IOCTL_MAGIC, __NUM(SET_PKEY), __u16)
Leon Romanovsky8edec0b2016-09-04 14:30:33 +0300102#define HFI1_IOCTL_CTXT_RESET \
Leon Romanovsky10b31e72016-09-04 14:30:34 +0300103 _IO(RDMA_IOCTL_MAGIC, __NUM(CTXT_RESET))
Leon Romanovsky8edec0b2016-09-04 14:30:33 +0300104#define HFI1_IOCTL_TID_INVAL_READ \
Leon Romanovsky10b31e72016-09-04 14:30:34 +0300105 _IOWR(RDMA_IOCTL_MAGIC, __NUM(TID_INVAL_READ), struct hfi1_tid_info)
Leon Romanovsky8edec0b2016-09-04 14:30:33 +0300106#define HFI1_IOCTL_GET_VERS \
Leon Romanovsky10b31e72016-09-04 14:30:34 +0300107 _IOR(RDMA_IOCTL_MAGIC, __NUM(GET_VERS), int)
Leon Romanovsky8edec0b2016-09-04 14:30:33 +0300108
Leon Romanovsky843debb2016-09-04 14:30:30 +0300109#endif /* RDMA_USER_IOCTL_H */