linux/drivers/infiniband/hw/hfi1/common.h

/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
/*
 * Copyright(c) 2015 - 2020 Intel Corporation.
 */

#ifndef _COMMON_H
#define _COMMON_H

#include <rdma/hfi/hfi1_user.h>

/*
 * This file contains defines, structures, etc. that are used
 * to communicate between kernel and user code.
 */

/* version of protocol header (known to chip also). In the long run,
 * we should be able to generate and accept a range of version numbers;
 * for now we only accept one, and it's compiled in.
 */
#define IPS_PROTO_VERSION

/*
 * These are compile time constants that you may want to enable or disable
 * if you are trying to debug problems with code or performance.
 * HFI1_VERBOSE_TRACING define as 1 if you want additional tracing in
 * fast path code
 * HFI1_TRACE_REGWRITES define as 1 if you want register writes to be
 * traced in fast path code
 * _HFI1_TRACING define as 0 if you want to remove all tracing in a
 * compilation unit
 */

/* driver/hw feature set bitmask */
#define HFI1_CAP_USER_SHIFT
#define HFI1_CAP_MASK
/* locked flag - if set, only HFI1_CAP_WRITABLE_MASK bits can be set */
#define HFI1_CAP_LOCKED_SHIFT
#define HFI1_CAP_LOCKED_MASK
#define HFI1_CAP_LOCKED_SMASK
/* extra bits used between kernel and user processes */
#define HFI1_CAP_MISC_SHIFT
#define HFI1_CAP_MISC_MASK

#define HFI1_CAP_KSET(cap)
#define HFI1_CAP_KCLEAR(cap)
#define HFI1_CAP_USET(cap)
#define HFI1_CAP_UCLEAR(cap)
#define HFI1_CAP_SET(cap)
#define HFI1_CAP_CLEAR(cap)
#define HFI1_CAP_LOCK()
#define HFI1_CAP_LOCKED()
/*
 * The set of capability bits that can be changed after initial load
 * This set is the same for kernel and user contexts. However, for
 * user contexts, the set can be further filtered by using the
 * HFI1_CAP_RESERVED_MASK bits.
 */
#define HFI1_CAP_WRITABLE_MASK
/*
 * A set of capability bits that are "global" and are not allowed to be
 * set in the user bitmask.
 */
#define HFI1_CAP_RESERVED_MASK
/*
 * Set of capabilities that need to be enabled for kernel context in
 * order to be allowed for user contexts, as well.
 */
#define HFI1_CAP_MUST_HAVE_KERN
/* Default enabled capabilities (both kernel and user) */
#define HFI1_CAP_MASK_DEFAULT
/*
 * A bitmask of kernel/global capabilities that should be communicated
 * to user level processes.
 */
#define HFI1_CAP_K2U

#define HFI1_USER_SWVERSION

/*
 * The next set of defines are for packet headers, and chip register
 * and memory bits that are visible to and/or used by user-mode software.
 */

/*
 * Receive Header Flags
 */
#define RHF_PKT_LEN_SHIFT
#define RHF_PKT_LEN_MASK
#define RHF_PKT_LEN_SMASK

#define RHF_RCV_TYPE_SHIFT
#define RHF_RCV_TYPE_MASK
#define RHF_RCV_TYPE_SMASK

#define RHF_USE_EGR_BFR_SHIFT
#define RHF_USE_EGR_BFR_MASK
#define RHF_USE_EGR_BFR_SMASK

#define RHF_EGR_INDEX_SHIFT
#define RHF_EGR_INDEX_MASK
#define RHF_EGR_INDEX_SMASK

#define RHF_DC_INFO_SHIFT
#define RHF_DC_INFO_MASK
#define RHF_DC_INFO_SMASK

#define RHF_RCV_SEQ_SHIFT
#define RHF_RCV_SEQ_MASK
#define RHF_RCV_SEQ_SMASK

#define RHF_EGR_OFFSET_SHIFT
#define RHF_EGR_OFFSET_MASK
#define RHF_EGR_OFFSET_SMASK
#define RHF_HDRQ_OFFSET_SHIFT
#define RHF_HDRQ_OFFSET_MASK
#define RHF_HDRQ_OFFSET_SMASK
#define RHF_K_HDR_LEN_ERR
#define RHF_DC_UNC_ERR
#define RHF_DC_ERR
#define RHF_RCV_TYPE_ERR_SHIFT
#define RHF_RCV_TYPE_ERR_MASK
#define RHF_RCV_TYPE_ERR_SMASK
#define RHF_TID_ERR
#define RHF_LEN_ERR
#define RHF_ECC_ERR
#define RHF_RESERVED
#define RHF_ICRC_ERR

#define RHF_ERROR_SMASK

/* RHF receive types */
#define RHF_RCV_TYPE_EXPECTED
#define RHF_RCV_TYPE_EAGER
#define RHF_RCV_TYPE_IB
#define RHF_RCV_TYPE_ERROR
#define RHF_RCV_TYPE_BYPASS
#define RHF_RCV_TYPE_INVALID5
#define RHF_RCV_TYPE_INVALID6
#define RHF_RCV_TYPE_INVALID7

/* RHF receive type error - expected packet errors */
#define RHF_RTE_EXPECTED_FLOW_SEQ_ERR
#define RHF_RTE_EXPECTED_FLOW_GEN_ERR

/* RHF receive type error - eager packet errors */
#define RHF_RTE_EAGER_NO_ERR

/* RHF receive type error - IB packet errors */
#define RHF_RTE_IB_NO_ERR

/* RHF receive type error - error packet errors */
#define RHF_RTE_ERROR_NO_ERR
#define RHF_RTE_ERROR_OP_CODE_ERR
#define RHF_RTE_ERROR_KHDR_MIN_LEN_ERR
#define RHF_RTE_ERROR_KHDR_HCRC_ERR
#define RHF_RTE_ERROR_KHDR_KVER_ERR
#define RHF_RTE_ERROR_CONTEXT_ERR
#define RHF_RTE_ERROR_KHDR_TID_ERR

/* RHF receive type error - bypass packet errors */
#define RHF_RTE_BYPASS_NO_ERR

/* MAX RcvSEQ */
#define RHF_MAX_SEQ

/* IB - LRH header constants */
#define HFI1_LRH_GRH
#define HFI1_LRH_BTH

/* misc. */
#define SC15_PACKET
#define SIZE_OF_CRC
#define SIZE_OF_LT
#define MAX_16B_PADDING

#define LIM_MGMT_P_KEY
#define FULL_MGMT_P_KEY

#define DEFAULT_P_KEY

#define HFI1_PSM_IOC_BASE_SEQ

/* Number of BTH.PSN bits used for sequence number in expected rcvs */
#define HFI1_KDETH_BTH_SEQ_SHIFT
#define HFI1_KDETH_BTH_SEQ_MASK

static inline __u64 rhf_to_cpu(const __le32 *rbuf)
{}

static inline u64 rhf_err_flags(u64 rhf)
{}

static inline u32 rhf_rcv_type(u64 rhf)
{}

static inline u32 rhf_rcv_type_err(u64 rhf)
{}

/* return size is in bytes, not DWORDs */
static inline u32 rhf_pkt_len(u64 rhf)
{}

static inline u32 rhf_egr_index(u64 rhf)
{}

static inline u32 rhf_rcv_seq(u64 rhf)
{}

/* returned offset is in DWORDS */
static inline u32 rhf_hdrq_offset(u64 rhf)
{}

static inline u64 rhf_use_egr_bfr(u64 rhf)
{}

static inline u64 rhf_dc_info(u64 rhf)
{}

static inline u32 rhf_egr_buf_offset(u64 rhf)
{}
#endif /* _COMMON_H */