162306a36Sopenharmony_ci/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (c) 2016 Mellanox Technologies, LTD. All rights reserved.
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * This software is available to you under a choice of one of two
662306a36Sopenharmony_ci * licenses.  You may choose to be licensed under the terms of the GNU
762306a36Sopenharmony_ci * General Public License (GPL) Version 2, available from the file
862306a36Sopenharmony_ci * COPYING in the main directory of this source tree, or the
962306a36Sopenharmony_ci * OpenIB.org BSD license below:
1062306a36Sopenharmony_ci *
1162306a36Sopenharmony_ci *     Redistribution and use in source and binary forms, with or
1262306a36Sopenharmony_ci *     without modification, are permitted provided that the following
1362306a36Sopenharmony_ci *     conditions are met:
1462306a36Sopenharmony_ci *
1562306a36Sopenharmony_ci *      - Redistributions of source code must retain the above
1662306a36Sopenharmony_ci *        copyright notice, this list of conditions and the following
1762306a36Sopenharmony_ci *        disclaimer.
1862306a36Sopenharmony_ci *
1962306a36Sopenharmony_ci *      - Redistributions in binary form must reproduce the above
2062306a36Sopenharmony_ci *        copyright notice, this list of conditions and the following
2162306a36Sopenharmony_ci *        disclaimer in the documentation and/or other materials
2262306a36Sopenharmony_ci *        provided with the distribution.
2362306a36Sopenharmony_ci *
2462306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
2562306a36Sopenharmony_ci * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2662306a36Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
2762306a36Sopenharmony_ci * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
2862306a36Sopenharmony_ci * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
2962306a36Sopenharmony_ci * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
3062306a36Sopenharmony_ci * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3162306a36Sopenharmony_ci * SOFTWARE.
3262306a36Sopenharmony_ci */
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci#ifndef RDMA_USER_IOCTL_H
3562306a36Sopenharmony_ci#define RDMA_USER_IOCTL_H
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci#include <rdma/ib_user_mad.h>
3862306a36Sopenharmony_ci#include <rdma/hfi/hfi1_ioctl.h>
3962306a36Sopenharmony_ci#include <rdma/rdma_user_ioctl_cmds.h>
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci/* Legacy name, for user space application which already use it */
4262306a36Sopenharmony_ci#define IB_IOCTL_MAGIC		RDMA_IOCTL_MAGIC
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci/*
4562306a36Sopenharmony_ci * General blocks assignments
4662306a36Sopenharmony_ci * It is closed on purpose - do not expose it to user space
4762306a36Sopenharmony_ci * #define MAD_CMD_BASE		0x00
4862306a36Sopenharmony_ci * #define HFI1_CMD_BAS		0xE0
4962306a36Sopenharmony_ci */
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci/* MAD specific section */
5262306a36Sopenharmony_ci#define IB_USER_MAD_REGISTER_AGENT	_IOWR(RDMA_IOCTL_MAGIC, 0x01, struct ib_user_mad_reg_req)
5362306a36Sopenharmony_ci#define IB_USER_MAD_UNREGISTER_AGENT	_IOW(RDMA_IOCTL_MAGIC,  0x02, __u32)
5462306a36Sopenharmony_ci#define IB_USER_MAD_ENABLE_PKEY		_IO(RDMA_IOCTL_MAGIC,   0x03)
5562306a36Sopenharmony_ci#define IB_USER_MAD_REGISTER_AGENT2	_IOWR(RDMA_IOCTL_MAGIC, 0x04, struct ib_user_mad_reg_req2)
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci/* HFI specific section */
5862306a36Sopenharmony_ci/* allocate HFI and context */
5962306a36Sopenharmony_ci#define HFI1_IOCTL_ASSIGN_CTXT		_IOWR(RDMA_IOCTL_MAGIC, 0xE1, struct hfi1_user_info)
6062306a36Sopenharmony_ci/* find out what resources we got */
6162306a36Sopenharmony_ci#define HFI1_IOCTL_CTXT_INFO		_IOW(RDMA_IOCTL_MAGIC,  0xE2, struct hfi1_ctxt_info)
6262306a36Sopenharmony_ci/* set up userspace */
6362306a36Sopenharmony_ci#define HFI1_IOCTL_USER_INFO		_IOW(RDMA_IOCTL_MAGIC,  0xE3, struct hfi1_base_info)
6462306a36Sopenharmony_ci/* update expected TID entries */
6562306a36Sopenharmony_ci#define HFI1_IOCTL_TID_UPDATE		_IOWR(RDMA_IOCTL_MAGIC, 0xE4, struct hfi1_tid_info)
6662306a36Sopenharmony_ci/* free expected TID entries */
6762306a36Sopenharmony_ci#define HFI1_IOCTL_TID_FREE		_IOWR(RDMA_IOCTL_MAGIC, 0xE5, struct hfi1_tid_info)
6862306a36Sopenharmony_ci/* force an update of PIO credit */
6962306a36Sopenharmony_ci#define HFI1_IOCTL_CREDIT_UPD		_IO(RDMA_IOCTL_MAGIC,   0xE6)
7062306a36Sopenharmony_ci/* control receipt of packets */
7162306a36Sopenharmony_ci#define HFI1_IOCTL_RECV_CTRL		_IOW(RDMA_IOCTL_MAGIC,  0xE8, int)
7262306a36Sopenharmony_ci/* set the kind of polling we want */
7362306a36Sopenharmony_ci#define HFI1_IOCTL_POLL_TYPE		_IOW(RDMA_IOCTL_MAGIC,  0xE9, int)
7462306a36Sopenharmony_ci/* ack & clear user status bits */
7562306a36Sopenharmony_ci#define HFI1_IOCTL_ACK_EVENT		_IOW(RDMA_IOCTL_MAGIC,  0xEA, unsigned long)
7662306a36Sopenharmony_ci/* set context's pkey */
7762306a36Sopenharmony_ci#define HFI1_IOCTL_SET_PKEY		_IOW(RDMA_IOCTL_MAGIC,  0xEB, __u16)
7862306a36Sopenharmony_ci/* reset context's HW send context */
7962306a36Sopenharmony_ci#define HFI1_IOCTL_CTXT_RESET		_IO(RDMA_IOCTL_MAGIC,   0xEC)
8062306a36Sopenharmony_ci/* read TID cache invalidations */
8162306a36Sopenharmony_ci#define HFI1_IOCTL_TID_INVAL_READ	_IOWR(RDMA_IOCTL_MAGIC, 0xED, struct hfi1_tid_info)
8262306a36Sopenharmony_ci/* get the version of the user cdev */
8362306a36Sopenharmony_ci#define HFI1_IOCTL_GET_VERS		_IOR(RDMA_IOCTL_MAGIC,  0xEE, int)
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_ci#endif /* RDMA_USER_IOCTL_H */
86