18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (c) 2016 Mellanox Technologies, LTD. All rights reserved.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * This software is available to you under a choice of one of two
68c2ecf20Sopenharmony_ci * licenses.  You may choose to be licensed under the terms of the GNU
78c2ecf20Sopenharmony_ci * General Public License (GPL) Version 2, available from the file
88c2ecf20Sopenharmony_ci * COPYING in the main directory of this source tree, or the
98c2ecf20Sopenharmony_ci * OpenIB.org BSD license below:
108c2ecf20Sopenharmony_ci *
118c2ecf20Sopenharmony_ci *     Redistribution and use in source and binary forms, with or
128c2ecf20Sopenharmony_ci *     without modification, are permitted provided that the following
138c2ecf20Sopenharmony_ci *     conditions are met:
148c2ecf20Sopenharmony_ci *
158c2ecf20Sopenharmony_ci *      - Redistributions of source code must retain the above
168c2ecf20Sopenharmony_ci *        copyright notice, this list of conditions and the following
178c2ecf20Sopenharmony_ci *        disclaimer.
188c2ecf20Sopenharmony_ci *
198c2ecf20Sopenharmony_ci *      - Redistributions in binary form must reproduce the above
208c2ecf20Sopenharmony_ci *        copyright notice, this list of conditions and the following
218c2ecf20Sopenharmony_ci *        disclaimer in the documentation and/or other materials
228c2ecf20Sopenharmony_ci *        provided with the distribution.
238c2ecf20Sopenharmony_ci *
248c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
258c2ecf20Sopenharmony_ci * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
268c2ecf20Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
278c2ecf20Sopenharmony_ci * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
288c2ecf20Sopenharmony_ci * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
298c2ecf20Sopenharmony_ci * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
308c2ecf20Sopenharmony_ci * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
318c2ecf20Sopenharmony_ci * SOFTWARE.
328c2ecf20Sopenharmony_ci */
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#ifndef RDMA_USER_IOCTL_H
358c2ecf20Sopenharmony_ci#define RDMA_USER_IOCTL_H
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci#include <rdma/ib_user_mad.h>
388c2ecf20Sopenharmony_ci#include <rdma/hfi/hfi1_ioctl.h>
398c2ecf20Sopenharmony_ci#include <rdma/rdma_user_ioctl_cmds.h>
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci/* Legacy name, for user space application which already use it */
428c2ecf20Sopenharmony_ci#define IB_IOCTL_MAGIC		RDMA_IOCTL_MAGIC
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci/*
458c2ecf20Sopenharmony_ci * General blocks assignments
468c2ecf20Sopenharmony_ci * It is closed on purpose - do not expose it to user space
478c2ecf20Sopenharmony_ci * #define MAD_CMD_BASE		0x00
488c2ecf20Sopenharmony_ci * #define HFI1_CMD_BAS		0xE0
498c2ecf20Sopenharmony_ci */
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci/* MAD specific section */
528c2ecf20Sopenharmony_ci#define IB_USER_MAD_REGISTER_AGENT	_IOWR(RDMA_IOCTL_MAGIC, 0x01, struct ib_user_mad_reg_req)
538c2ecf20Sopenharmony_ci#define IB_USER_MAD_UNREGISTER_AGENT	_IOW(RDMA_IOCTL_MAGIC,  0x02, __u32)
548c2ecf20Sopenharmony_ci#define IB_USER_MAD_ENABLE_PKEY		_IO(RDMA_IOCTL_MAGIC,   0x03)
558c2ecf20Sopenharmony_ci#define IB_USER_MAD_REGISTER_AGENT2	_IOWR(RDMA_IOCTL_MAGIC, 0x04, struct ib_user_mad_reg_req2)
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci/* HFI specific section */
588c2ecf20Sopenharmony_ci/* allocate HFI and context */
598c2ecf20Sopenharmony_ci#define HFI1_IOCTL_ASSIGN_CTXT		_IOWR(RDMA_IOCTL_MAGIC, 0xE1, struct hfi1_user_info)
608c2ecf20Sopenharmony_ci/* find out what resources we got */
618c2ecf20Sopenharmony_ci#define HFI1_IOCTL_CTXT_INFO		_IOW(RDMA_IOCTL_MAGIC,  0xE2, struct hfi1_ctxt_info)
628c2ecf20Sopenharmony_ci/* set up userspace */
638c2ecf20Sopenharmony_ci#define HFI1_IOCTL_USER_INFO		_IOW(RDMA_IOCTL_MAGIC,  0xE3, struct hfi1_base_info)
648c2ecf20Sopenharmony_ci/* update expected TID entries */
658c2ecf20Sopenharmony_ci#define HFI1_IOCTL_TID_UPDATE		_IOWR(RDMA_IOCTL_MAGIC, 0xE4, struct hfi1_tid_info)
668c2ecf20Sopenharmony_ci/* free expected TID entries */
678c2ecf20Sopenharmony_ci#define HFI1_IOCTL_TID_FREE		_IOWR(RDMA_IOCTL_MAGIC, 0xE5, struct hfi1_tid_info)
688c2ecf20Sopenharmony_ci/* force an update of PIO credit */
698c2ecf20Sopenharmony_ci#define HFI1_IOCTL_CREDIT_UPD		_IO(RDMA_IOCTL_MAGIC,   0xE6)
708c2ecf20Sopenharmony_ci/* control receipt of packets */
718c2ecf20Sopenharmony_ci#define HFI1_IOCTL_RECV_CTRL		_IOW(RDMA_IOCTL_MAGIC,  0xE8, int)
728c2ecf20Sopenharmony_ci/* set the kind of polling we want */
738c2ecf20Sopenharmony_ci#define HFI1_IOCTL_POLL_TYPE		_IOW(RDMA_IOCTL_MAGIC,  0xE9, int)
748c2ecf20Sopenharmony_ci/* ack & clear user status bits */
758c2ecf20Sopenharmony_ci#define HFI1_IOCTL_ACK_EVENT		_IOW(RDMA_IOCTL_MAGIC,  0xEA, unsigned long)
768c2ecf20Sopenharmony_ci/* set context's pkey */
778c2ecf20Sopenharmony_ci#define HFI1_IOCTL_SET_PKEY		_IOW(RDMA_IOCTL_MAGIC,  0xEB, __u16)
788c2ecf20Sopenharmony_ci/* reset context's HW send context */
798c2ecf20Sopenharmony_ci#define HFI1_IOCTL_CTXT_RESET		_IO(RDMA_IOCTL_MAGIC,   0xEC)
808c2ecf20Sopenharmony_ci/* read TID cache invalidations */
818c2ecf20Sopenharmony_ci#define HFI1_IOCTL_TID_INVAL_READ	_IOWR(RDMA_IOCTL_MAGIC, 0xED, struct hfi1_tid_info)
828c2ecf20Sopenharmony_ci/* get the version of the user cdev */
838c2ecf20Sopenharmony_ci#define HFI1_IOCTL_GET_VERS		_IOR(RDMA_IOCTL_MAGIC,  0xEE, int)
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci#endif /* RDMA_USER_IOCTL_H */
86