11f7ff9d5SMatan Barak /* 21f7ff9d5SMatan Barak * Copyright (c) 2018, Mellanox Technologies inc. All rights reserved. 31f7ff9d5SMatan Barak * 41f7ff9d5SMatan Barak * This software is available to you under a choice of one of two 51f7ff9d5SMatan Barak * licenses. You may choose to be licensed under the terms of the GNU 61f7ff9d5SMatan Barak * General Public License (GPL) Version 2, available from the file 71f7ff9d5SMatan Barak * COPYING in the main directory of this source tree, or the 81f7ff9d5SMatan Barak * OpenIB.org BSD license below: 91f7ff9d5SMatan Barak * 101f7ff9d5SMatan Barak * Redistribution and use in source and binary forms, with or 111f7ff9d5SMatan Barak * without modification, are permitted provided that the following 121f7ff9d5SMatan Barak * conditions are met: 131f7ff9d5SMatan Barak * 141f7ff9d5SMatan Barak * - Redistributions of source code must retain the above 151f7ff9d5SMatan Barak * copyright notice, this list of conditions and the following 161f7ff9d5SMatan Barak * disclaimer. 171f7ff9d5SMatan Barak * 181f7ff9d5SMatan Barak * - Redistributions in binary form must reproduce the above 191f7ff9d5SMatan Barak * copyright notice, this list of conditions and the following 201f7ff9d5SMatan Barak * disclaimer in the documentation and/or other materials 211f7ff9d5SMatan Barak * provided with the distribution. 221f7ff9d5SMatan Barak * 231f7ff9d5SMatan Barak * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 241f7ff9d5SMatan Barak * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 251f7ff9d5SMatan Barak * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 261f7ff9d5SMatan Barak * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 271f7ff9d5SMatan Barak * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 281f7ff9d5SMatan Barak * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 291f7ff9d5SMatan Barak * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 301f7ff9d5SMatan Barak * SOFTWARE. 311f7ff9d5SMatan Barak */ 321f7ff9d5SMatan Barak 331f7ff9d5SMatan Barak #ifndef RDMA_USER_IOCTL_CMDS_H 341f7ff9d5SMatan Barak #define RDMA_USER_IOCTL_CMDS_H 351f7ff9d5SMatan Barak 361f7ff9d5SMatan Barak #include <linux/types.h> 371f7ff9d5SMatan Barak #include <linux/ioctl.h> 381f7ff9d5SMatan Barak 391f7ff9d5SMatan Barak /* Documentation/ioctl/ioctl-number.txt */ 401f7ff9d5SMatan Barak #define RDMA_IOCTL_MAGIC 0x1b 411f7ff9d5SMatan Barak #define RDMA_VERBS_IOCTL \ 421f7ff9d5SMatan Barak _IOWR(RDMA_IOCTL_MAGIC, 1, struct ib_uverbs_ioctl_hdr) 431f7ff9d5SMatan Barak 441f7ff9d5SMatan Barak enum { 451f7ff9d5SMatan Barak /* User input */ 461f7ff9d5SMatan Barak UVERBS_ATTR_F_MANDATORY = 1U << 0, 471f7ff9d5SMatan Barak /* 481f7ff9d5SMatan Barak * Valid output bit should be ignored and considered set in 491f7ff9d5SMatan Barak * mandatory fields. This bit is kernel output. 501f7ff9d5SMatan Barak */ 511f7ff9d5SMatan Barak UVERBS_ATTR_F_VALID_OUTPUT = 1U << 1, 521f7ff9d5SMatan Barak }; 531f7ff9d5SMatan Barak 541f7ff9d5SMatan Barak struct ib_uverbs_attr { 551f7ff9d5SMatan Barak __u16 attr_id; /* command specific type attribute */ 5670cd20aeSGuy Levi __u16 len; /* only for pointers and IDRs array */ 571f7ff9d5SMatan Barak __u16 flags; /* combination of UVERBS_ATTR_F_XXXX */ 58494c5580SMatan Barak union { 59494c5580SMatan Barak struct { 60494c5580SMatan Barak __u8 elem_id; 61494c5580SMatan Barak __u8 reserved; 62494c5580SMatan Barak } enum_data; 631f7ff9d5SMatan Barak __u16 reserved; 64494c5580SMatan Barak } attr_data; 651250c304SJason Gunthorpe union { 6670cd20aeSGuy Levi /* 6770cd20aeSGuy Levi * ptr to command, inline data, idr/fd or 6870cd20aeSGuy Levi * ptr to __u32 array of IDRs 6970cd20aeSGuy Levi */ 701250c304SJason Gunthorpe __aligned_u64 data; 711250c304SJason Gunthorpe /* Used by FD_IN and FD_OUT */ 721250c304SJason Gunthorpe __s64 data_s64; 731250c304SJason Gunthorpe }; 741f7ff9d5SMatan Barak }; 751f7ff9d5SMatan Barak 761f7ff9d5SMatan Barak struct ib_uverbs_ioctl_hdr { 771f7ff9d5SMatan Barak __u16 length; 781f7ff9d5SMatan Barak __u16 object_id; 791f7ff9d5SMatan Barak __u16 method_id; 801f7ff9d5SMatan Barak __u16 num_attrs; 810ede73bcSMatan Barak __aligned_u64 reserved1; 820ede73bcSMatan Barak __u32 driver_id; 830ede73bcSMatan Barak __u32 reserved2; 841f7ff9d5SMatan Barak struct ib_uverbs_attr attrs[0]; 851f7ff9d5SMatan Barak }; 861f7ff9d5SMatan Barak 870ede73bcSMatan Barak enum rdma_driver_id { 880ede73bcSMatan Barak RDMA_DRIVER_UNKNOWN, 890ede73bcSMatan Barak RDMA_DRIVER_MLX5, 900ede73bcSMatan Barak RDMA_DRIVER_MLX4, 910ede73bcSMatan Barak RDMA_DRIVER_CXGB3, 920ede73bcSMatan Barak RDMA_DRIVER_CXGB4, 930ede73bcSMatan Barak RDMA_DRIVER_MTHCA, 940ede73bcSMatan Barak RDMA_DRIVER_BNXT_RE, 950ede73bcSMatan Barak RDMA_DRIVER_OCRDMA, 960ede73bcSMatan Barak RDMA_DRIVER_NES, 970ede73bcSMatan Barak RDMA_DRIVER_I40IW, 980ede73bcSMatan Barak RDMA_DRIVER_VMW_PVRDMA, 990ede73bcSMatan Barak RDMA_DRIVER_QEDR, 1000ede73bcSMatan Barak RDMA_DRIVER_HNS, 1010ede73bcSMatan Barak RDMA_DRIVER_USNIC, 1020ede73bcSMatan Barak RDMA_DRIVER_RXE, 1030ede73bcSMatan Barak RDMA_DRIVER_HFI1, 1040ede73bcSMatan Barak RDMA_DRIVER_QIB, 105*f95be3d2SGal Pressman RDMA_DRIVER_EFA, 1060ede73bcSMatan Barak }; 1070ede73bcSMatan Barak 1081f7ff9d5SMatan Barak #endif 109