Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright (c) 2018, Mellanox Technologies inc.  All rights reserved.
0003  *
0004  * This software is available to you under a choice of one of two
0005  * licenses.  You may choose to be licensed under the terms of the GNU
0006  * General Public License (GPL) Version 2, available from the file
0007  * COPYING in the main directory of this source tree, or the
0008  * OpenIB.org BSD license below:
0009  *
0010  *     Redistribution and use in source and binary forms, with or
0011  *     without modification, are permitted provided that the following
0012  *     conditions are met:
0013  *
0014  *      - Redistributions of source code must retain the above
0015  *        copyright notice, this list of conditions and the following
0016  *        disclaimer.
0017  *
0018  *      - Redistributions in binary form must reproduce the above
0019  *        copyright notice, this list of conditions and the following
0020  *        disclaimer in the documentation and/or other materials
0021  *        provided with the distribution.
0022  *
0023  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
0024  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
0025  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
0026  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
0027  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
0028  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
0029  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
0030  * SOFTWARE.
0031  */
0032 
0033 #ifndef RDMA_USER_IOCTL_CMDS_H
0034 #define RDMA_USER_IOCTL_CMDS_H
0035 
0036 #include <linux/types.h>
0037 #include <linux/ioctl.h>
0038 
0039 /* Documentation/userspace-api/ioctl/ioctl-number.rst */
0040 #define RDMA_IOCTL_MAGIC    0x1b
0041 #define RDMA_VERBS_IOCTL \
0042     _IOWR(RDMA_IOCTL_MAGIC, 1, struct ib_uverbs_ioctl_hdr)
0043 
0044 enum {
0045     /* User input */
0046     UVERBS_ATTR_F_MANDATORY = 1U << 0,
0047     /*
0048      * Valid output bit should be ignored and considered set in
0049      * mandatory fields. This bit is kernel output.
0050      */
0051     UVERBS_ATTR_F_VALID_OUTPUT = 1U << 1,
0052 };
0053 
0054 struct ib_uverbs_attr {
0055     __u16 attr_id;      /* command specific type attribute */
0056     __u16 len;      /* only for pointers and IDRs array */
0057     __u16 flags;        /* combination of UVERBS_ATTR_F_XXXX */
0058     union {
0059         struct {
0060             __u8 elem_id;
0061             __u8 reserved;
0062         } enum_data;
0063         __u16 reserved;
0064     } attr_data;
0065     union {
0066         /*
0067          * ptr to command, inline data, idr/fd or
0068          * ptr to __u32 array of IDRs
0069          */
0070         __aligned_u64 data;
0071         /* Used by FD_IN and FD_OUT */
0072         __s64 data_s64;
0073     };
0074 };
0075 
0076 struct ib_uverbs_ioctl_hdr {
0077     __u16 length;
0078     __u16 object_id;
0079     __u16 method_id;
0080     __u16 num_attrs;
0081     __aligned_u64 reserved1;
0082     __u32 driver_id;
0083     __u32 reserved2;
0084     struct ib_uverbs_attr  attrs[];
0085 };
0086 
0087 #endif