/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ /* * * This file is provided under a dual BSD/GPLv2 license. When using or * redistributing this file, you may do so under either license. * * GPL LICENSE SUMMARY * * Copyright(c) 2015 - 2020 Intel Corporation. * * This program is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * BSD LICENSE * * Copyright(c) 2015 Intel Corporation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * - Neither the name of Intel Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /* * This file contains defines, structures, etc. that are used * to communicate between kernel and user code. */ #ifndef _LINUX__HFI1_USER_H #define _LINUX__HFI1_USER_H #include <linux/types.h> #include <rdma/rdma_user_ioctl.h> /* * This version number is given to the driver by the user code during * initialization in the spu_userversion field of hfi1_user_info, so * the driver can check for compatibility with user code. * * The major version changes when data structures change in an incompatible * way. The driver must be the same for initialization to succeed. */ #define HFI1_USER_SWMAJOR … /* * Minor version differences are always compatible * a within a major version, however if user software is larger * than driver software, some new features and/or structure fields * may not be implemented; the user code must deal with this if it * cares, or it must abort after initialization reports the difference. */ #define HFI1_USER_SWMINOR … /* * We will encode the major/minor inside a single 32bit version number. */ #define HFI1_SWMAJOR_SHIFT … /* * Set of HW and driver capability/feature bits. * These bit values are used to configure enabled/disabled HW and * driver features. The same set of bits are communicated to user * space. */ #define HFI1_CAP_DMA_RTAIL … #define HFI1_CAP_SDMA … #define HFI1_CAP_SDMA_AHG … #define HFI1_CAP_EXTENDED_PSN … #define HFI1_CAP_HDRSUPP … #define HFI1_CAP_TID_RDMA … #define HFI1_CAP_USE_SDMA_HEAD … #define HFI1_CAP_MULTI_PKT_EGR … #define HFI1_CAP_NODROP_RHQ_FULL … #define HFI1_CAP_NODROP_EGR_FULL … #define HFI1_CAP_TID_UNMAP … #define HFI1_CAP_PRINT_UNIMPL … #define HFI1_CAP_ALLOW_PERM_JKEY … #define HFI1_CAP_NO_INTEGRITY … #define HFI1_CAP_PKEY_CHECK … #define HFI1_CAP_STATIC_RATE_CTRL … #define HFI1_CAP_OPFN … #define HFI1_CAP_SDMA_HEAD_CHECK … #define HFI1_CAP_EARLY_CREDIT_RETURN … #define HFI1_CAP_AIP … #define HFI1_RCVHDR_ENTSIZE_2 … #define HFI1_RCVHDR_ENTSIZE_16 … #define HFI1_RCVDHR_ENTSIZE_32 … #define _HFI1_EVENT_FROZEN_BIT … #define _HFI1_EVENT_LINKDOWN_BIT … #define _HFI1_EVENT_LID_CHANGE_BIT … #define _HFI1_EVENT_LMC_CHANGE_BIT … #define _HFI1_EVENT_SL2VL_CHANGE_BIT … #define _HFI1_EVENT_TID_MMU_NOTIFY_BIT … #define _HFI1_MAX_EVENT_BIT … #define HFI1_EVENT_FROZEN … #define HFI1_EVENT_LINKDOWN … #define HFI1_EVENT_LID_CHANGE … #define HFI1_EVENT_LMC_CHANGE … #define HFI1_EVENT_SL2VL_CHANGE … #define HFI1_EVENT_TID_MMU_NOTIFY … /* * These are the status bits readable (in ASCII form, 64bit value) * from the "status" sysfs file. For binary compatibility, values * must remain as is; removed states can be reused for different * purposes. */ #define HFI1_STATUS_INITTED … /* Chip has been found and initialized */ #define HFI1_STATUS_CHIP_PRESENT … /* IB link is at ACTIVE, usable for data traffic */ #define HFI1_STATUS_IB_READY … /* link is configured, LID, MTU, etc. have been set */ #define HFI1_STATUS_IB_CONF … /* A Fatal hardware error has occurred. */ #define HFI1_STATUS_HWERROR … /* * Number of supported shared contexts. * This is the maximum number of software contexts that can share * a hardware send/receive context. */ #define HFI1_MAX_SHARED_CTXTS … /* * Poll types */ #define HFI1_POLL_TYPE_ANYRCV … #define HFI1_POLL_TYPE_URGENT … enum hfi1_sdma_comp_state { … }; /* * SDMA completion ring entry */ struct hfi1_sdma_comp_entry { … }; /* * Device status and notifications from driver to user-space. */ struct hfi1_status { … }; enum sdma_req_opcode { … }; #define HFI1_SDMA_REQ_VERSION_MASK … #define HFI1_SDMA_REQ_VERSION_SHIFT … #define HFI1_SDMA_REQ_OPCODE_MASK … #define HFI1_SDMA_REQ_OPCODE_SHIFT … #define HFI1_SDMA_REQ_IOVCNT_MASK … #define HFI1_SDMA_REQ_IOVCNT_SHIFT … struct sdma_req_info { … } __attribute__((packed)); /* * SW KDETH header. * swdata is SW defined portion. */ struct hfi1_kdeth_header { … } __attribute__((packed)); /* * Structure describing the headers that User space uses. The * structure above is a subset of this one. */ struct hfi1_pkt_header { … } __attribute__((packed)); /* * The list of usermode accessible registers. */ enum hfi1_ureg { … }; #endif /* _LINIUX__HFI1_USER_H */