/* * Copyright (c) 2012-2016 VMware, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of EITHER the GNU General Public License * version 2 as published by the Free Software Foundation or the BSD * 2-Clause License. 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 version 2 for more details at * http://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html. * * You should have received a copy of the GNU General Public License * along with this program available in the file COPYING in the main * directory of this source tree. * * The BSD 2-Clause License * * 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. * * 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 HOLDER 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. */ #ifndef __PVRDMA_DEV_API_H__ #define __PVRDMA_DEV_API_H__ #include <linux/types.h> #include "pvrdma_verbs.h" /* * PVRDMA version macros. Some new features require updates to PVRDMA_VERSION. * These macros allow us to check for different features if necessary. */ #define PVRDMA_ROCEV1_VERSION … #define PVRDMA_ROCEV2_VERSION … #define PVRDMA_PPN64_VERSION … #define PVRDMA_QPHANDLE_VERSION … #define PVRDMA_VERSION … #define PVRDMA_BOARD_ID … #define PVRDMA_REV_ID … /* * Masks and accessors for page directory, which is a two-level lookup: * page directory -> page table -> page. Only one directory for now, but we * could expand that easily. 9 bits for tables, 9 bits for pages, gives one * gigabyte for memory regions and so forth. */ #define PVRDMA_PDIR_SHIFT … #define PVRDMA_PTABLE_SHIFT … #define PVRDMA_PAGE_DIR_DIR(x) … #define PVRDMA_PAGE_DIR_TABLE(x) … #define PVRDMA_PAGE_DIR_PAGE(x) … #define PVRDMA_PAGE_DIR_MAX_PAGES … #define PVRDMA_MAX_FAST_REG_PAGES … /* * Max MSI-X vectors. */ #define PVRDMA_MAX_INTERRUPTS … /* Register offsets within PCI resource on BAR1. */ #define PVRDMA_REG_VERSION … #define PVRDMA_REG_DSRLOW … #define PVRDMA_REG_DSRHIGH … #define PVRDMA_REG_CTL … #define PVRDMA_REG_REQUEST … #define PVRDMA_REG_ERR … #define PVRDMA_REG_ICR … #define PVRDMA_REG_IMR … #define PVRDMA_REG_MACL … #define PVRDMA_REG_MACH … /* Object flags. */ #define PVRDMA_CQ_FLAG_ARMED_SOL … #define PVRDMA_CQ_FLAG_ARMED … #define PVRDMA_MR_FLAG_DMA … #define PVRDMA_MR_FLAG_FRMR … /* * Atomic operation capability (masked versions are extended atomic * operations. */ #define PVRDMA_ATOMIC_OP_COMP_SWAP … #define PVRDMA_ATOMIC_OP_FETCH_ADD … #define PVRDMA_ATOMIC_OP_MASK_COMP_SWAP … #define PVRDMA_ATOMIC_OP_MASK_FETCH_ADD … /* * Base Memory Management Extension flags to support Fast Reg Memory Regions * and Fast Reg Work Requests. Each flag represents a verb operation and we * must support all of them to qualify for the BMME device cap. */ #define PVRDMA_BMME_FLAG_LOCAL_INV … #define PVRDMA_BMME_FLAG_REMOTE_INV … #define PVRDMA_BMME_FLAG_FAST_REG_WR … /* * GID types. The interpretation of the gid_types bit field in the device * capabilities will depend on the device mode. For now, the device only * supports RoCE as mode, so only the different GID types for RoCE are * defined. */ #define PVRDMA_GID_TYPE_FLAG_ROCE_V1 … #define PVRDMA_GID_TYPE_FLAG_ROCE_V2 … /* * Version checks. This checks whether each version supports specific * capabilities from the device. */ #define PVRDMA_IS_VERSION17(_dev) … #define PVRDMA_IS_VERSION18(_dev) … \ #define PVRDMA_SUPPORTED(_dev) … /* * Get capability values based on device version. */ #define PVRDMA_GET_CAP(_dev, _old_val, _val) … enum pvrdma_pci_resource { … }; enum pvrdma_device_ctl { … }; enum pvrdma_intr_vector { … }; enum pvrdma_intr_cause { … }; enum pvrdma_gos_bits { … }; enum pvrdma_gos_type { … }; enum pvrdma_device_mode { … }; struct pvrdma_gos_info { … }; struct pvrdma_device_caps { … }; struct pvrdma_ring_page_info { … }; #pragma pack(push, 1) struct pvrdma_device_shared_region { … }; #pragma pack(pop) /* Event types. Currently a 1:1 mapping with enum ib_event. */ enum pvrdma_eqe_type { … }; /* Event queue element. */ struct pvrdma_eqe { … }; /* CQ notification queue element. */ struct pvrdma_cqne { … }; enum { … }; enum { … }; struct pvrdma_cmd_hdr { … }; struct pvrdma_cmd_resp_hdr { … }; struct pvrdma_cmd_query_port { … }; struct pvrdma_cmd_query_port_resp { … }; struct pvrdma_cmd_query_pkey { … }; struct pvrdma_cmd_query_pkey_resp { … }; struct pvrdma_cmd_create_uc { … }; struct pvrdma_cmd_create_uc_resp { … }; struct pvrdma_cmd_destroy_uc { … }; struct pvrdma_cmd_create_pd { … }; struct pvrdma_cmd_create_pd_resp { … }; struct pvrdma_cmd_destroy_pd { … }; struct pvrdma_cmd_create_mr { … }; struct pvrdma_cmd_create_mr_resp { … }; struct pvrdma_cmd_destroy_mr { … }; struct pvrdma_cmd_create_cq { … }; struct pvrdma_cmd_create_cq_resp { … }; struct pvrdma_cmd_resize_cq { … }; struct pvrdma_cmd_resize_cq_resp { … }; struct pvrdma_cmd_destroy_cq { … }; struct pvrdma_cmd_create_srq { … }; struct pvrdma_cmd_create_srq_resp { … }; struct pvrdma_cmd_modify_srq { … }; struct pvrdma_cmd_query_srq { … }; struct pvrdma_cmd_query_srq_resp { … }; struct pvrdma_cmd_destroy_srq { … }; struct pvrdma_cmd_create_qp { … }; struct pvrdma_cmd_create_qp_resp { … }; struct pvrdma_cmd_create_qp_resp_v2 { … }; struct pvrdma_cmd_modify_qp { … }; struct pvrdma_cmd_query_qp { … }; struct pvrdma_cmd_query_qp_resp { … }; struct pvrdma_cmd_destroy_qp { … }; struct pvrdma_cmd_destroy_qp_resp { … }; struct pvrdma_cmd_create_bind { … }; struct pvrdma_cmd_destroy_bind { … }; pvrdma_cmd_req; pvrdma_cmd_resp; #endif /* __PVRDMA_DEV_API_H__ */