Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) or BSD-3-Clause */
0002 
0003 /* Authors: Bernard Metzler <bmt@zurich.ibm.com> */
0004 /* Copyright (c) 2008-2019, IBM Corporation */
0005 
0006 #ifndef _SIW_USER_H
0007 #define _SIW_USER_H
0008 
0009 #include <linux/types.h>
0010 
0011 #define SIW_NODE_DESC_COMMON "Software iWARP stack"
0012 #define SIW_ABI_VERSION 1
0013 #define SIW_MAX_SGE 6
0014 #define SIW_UOBJ_MAX_KEY 0x08FFFF
0015 #define SIW_INVAL_UOBJ_KEY (SIW_UOBJ_MAX_KEY + 1)
0016 
0017 struct siw_uresp_create_cq {
0018     __u32 cq_id;
0019     __u32 num_cqe;
0020     __aligned_u64 cq_key;
0021 };
0022 
0023 struct siw_uresp_create_qp {
0024     __u32 qp_id;
0025     __u32 num_sqe;
0026     __u32 num_rqe;
0027     __u32 pad;
0028     __aligned_u64 sq_key;
0029     __aligned_u64 rq_key;
0030 };
0031 
0032 struct siw_ureq_reg_mr {
0033     __u8 stag_key;
0034     __u8 reserved[3];
0035     __u32 pad;
0036 };
0037 
0038 struct siw_uresp_reg_mr {
0039     __u32 stag;
0040     __u32 pad;
0041 };
0042 
0043 struct siw_uresp_create_srq {
0044     __u32 num_rqe;
0045     __u32 pad;
0046     __aligned_u64 srq_key;
0047 };
0048 
0049 struct siw_uresp_alloc_ctx {
0050     __u32 dev_id;
0051     __u32 pad;
0052 };
0053 
0054 enum siw_opcode {
0055     SIW_OP_WRITE,
0056     SIW_OP_READ,
0057     SIW_OP_READ_LOCAL_INV,
0058     SIW_OP_SEND,
0059     SIW_OP_SEND_WITH_IMM,
0060     SIW_OP_SEND_REMOTE_INV,
0061 
0062     /* Unsupported */
0063     SIW_OP_FETCH_AND_ADD,
0064     SIW_OP_COMP_AND_SWAP,
0065 
0066     SIW_OP_RECEIVE,
0067     /* provider internal SQE */
0068     SIW_OP_READ_RESPONSE,
0069     /*
0070      * below opcodes valid for
0071      * in-kernel clients only
0072      */
0073     SIW_OP_INVAL_STAG,
0074     SIW_OP_REG_MR,
0075     SIW_NUM_OPCODES
0076 };
0077 
0078 /* Keep it same as ibv_sge to allow for memcpy */
0079 struct siw_sge {
0080     __aligned_u64 laddr;
0081     __u32 length;
0082     __u32 lkey;
0083 };
0084 
0085 /*
0086  * Inline data are kept within the work request itself occupying
0087  * the space of sge[1] .. sge[n]. Therefore, inline data cannot be
0088  * supported if SIW_MAX_SGE is below 2 elements.
0089  */
0090 #define SIW_MAX_INLINE (sizeof(struct siw_sge) * (SIW_MAX_SGE - 1))
0091 
0092 #if SIW_MAX_SGE < 2
0093 #error "SIW_MAX_SGE must be at least 2"
0094 #endif
0095 
0096 enum siw_wqe_flags {
0097     SIW_WQE_VALID = 1,
0098     SIW_WQE_INLINE = (1 << 1),
0099     SIW_WQE_SIGNALLED = (1 << 2),
0100     SIW_WQE_SOLICITED = (1 << 3),
0101     SIW_WQE_READ_FENCE = (1 << 4),
0102     SIW_WQE_REM_INVAL = (1 << 5),
0103     SIW_WQE_COMPLETED = (1 << 6)
0104 };
0105 
0106 /* Send Queue Element */
0107 struct siw_sqe {
0108     __aligned_u64 id;
0109     __u16 flags;
0110     __u8 num_sge;
0111     /* Contains enum siw_opcode values */
0112     __u8 opcode;
0113     __u32 rkey;
0114     union {
0115         __aligned_u64 raddr;
0116         __aligned_u64 base_mr;
0117     };
0118     union {
0119         struct siw_sge sge[SIW_MAX_SGE];
0120         __aligned_u64 access;
0121     };
0122 };
0123 
0124 /* Receive Queue Element */
0125 struct siw_rqe {
0126     __aligned_u64 id;
0127     __u16 flags;
0128     __u8 num_sge;
0129     /*
0130      * only used by kernel driver,
0131      * ignored if set by user
0132      */
0133     __u8 opcode;
0134     __u32 unused;
0135     struct siw_sge sge[SIW_MAX_SGE];
0136 };
0137 
0138 enum siw_notify_flags {
0139     SIW_NOTIFY_NOT = (0),
0140     SIW_NOTIFY_SOLICITED = (1 << 0),
0141     SIW_NOTIFY_NEXT_COMPLETION = (1 << 1),
0142     SIW_NOTIFY_MISSED_EVENTS = (1 << 2),
0143     SIW_NOTIFY_ALL = SIW_NOTIFY_SOLICITED | SIW_NOTIFY_NEXT_COMPLETION |
0144              SIW_NOTIFY_MISSED_EVENTS
0145 };
0146 
0147 enum siw_wc_status {
0148     SIW_WC_SUCCESS,
0149     SIW_WC_LOC_LEN_ERR,
0150     SIW_WC_LOC_PROT_ERR,
0151     SIW_WC_LOC_QP_OP_ERR,
0152     SIW_WC_WR_FLUSH_ERR,
0153     SIW_WC_BAD_RESP_ERR,
0154     SIW_WC_LOC_ACCESS_ERR,
0155     SIW_WC_REM_ACCESS_ERR,
0156     SIW_WC_REM_INV_REQ_ERR,
0157     SIW_WC_GENERAL_ERR,
0158     SIW_NUM_WC_STATUS
0159 };
0160 
0161 struct siw_cqe {
0162     __aligned_u64 id;
0163     __u8 flags;
0164     __u8 opcode;
0165     __u16 status;
0166     __u32 bytes;
0167     union {
0168         __aligned_u64 imm_data;
0169         __u32 inval_stag;
0170     };
0171     /* QP number or QP pointer */
0172     union {
0173         struct ib_qp *base_qp;
0174         __aligned_u64 qp_id;
0175     };
0176 };
0177 
0178 /*
0179  * Shared structure between user and kernel
0180  * to control CQ arming.
0181  */
0182 struct siw_cq_ctrl {
0183     __u32 flags;
0184     __u32 pad;
0185 };
0186 #endif