^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /* QLogic qedr NIC Driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (c) 2015-2016 QLogic Corporation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * This software is available to you under a choice of one of two
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * licenses. You may choose to be licensed under the terms of the GNU
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * General Public License (GPL) Version 2, available from the file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * COPYING in the main directory of this source tree, or the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * OpenIB.org BSD license below:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * Redistribution and use in source and binary forms, with or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * without modification, are permitted provided that the following
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) * conditions are met:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * - Redistributions of source code must retain the above
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) * copyright notice, this list of conditions and the following
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) * disclaimer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) * - Redistributions in binary form must reproduce the above
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * copyright notice, this list of conditions and the following
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) * disclaimer in the documentation and /or other materials
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) * provided with the distribution.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) * SOFTWARE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #ifndef __QEDR_USER_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #define __QEDR_USER_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #define QEDR_ABI_VERSION (8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) /* user kernel communication data structures. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) enum qedr_alloc_ucontext_flags {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) QEDR_ALLOC_UCTX_EDPM_MODE = 1 << 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) QEDR_ALLOC_UCTX_DB_REC = 1 << 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) QEDR_SUPPORT_DPM_SIZES = 1 << 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) struct qedr_alloc_ucontext_req {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) __u32 context_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) __u32 reserved;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) #define QEDR_LDPM_MAX_SIZE (8192)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) #define QEDR_EDPM_TRANS_SIZE (64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) #define QEDR_EDPM_MAX_SIZE (ROCE_REQ_MAX_INLINE_DATA_SIZE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) enum qedr_rdma_dpm_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) QEDR_DPM_TYPE_NONE = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) QEDR_DPM_TYPE_ROCE_ENHANCED = 1 << 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) QEDR_DPM_TYPE_ROCE_LEGACY = 1 << 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) QEDR_DPM_TYPE_IWARP_LEGACY = 1 << 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) QEDR_DPM_TYPE_ROCE_EDPM_MODE = 1 << 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) QEDR_DPM_SIZES_SET = 1 << 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) struct qedr_alloc_ucontext_resp {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) __aligned_u64 db_pa;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) __u32 db_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) __u32 max_send_wr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) __u32 max_recv_wr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) __u32 max_srq_wr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) __u32 sges_per_send_wr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) __u32 sges_per_recv_wr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) __u32 sges_per_srq_wr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) __u32 max_cqes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) __u8 dpm_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) __u8 wids_enabled;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) __u16 wid_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) __u16 ldpm_limit_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) __u8 edpm_trans_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) __u8 reserved;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) __u16 edpm_limit_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) __u8 padding[6];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) struct qedr_alloc_pd_ureq {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) __aligned_u64 rsvd1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) struct qedr_alloc_pd_uresp {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) __u32 pd_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) __u32 reserved;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) struct qedr_create_cq_ureq {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) __aligned_u64 addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) __aligned_u64 len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) struct qedr_create_cq_uresp {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) __u32 db_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) __u16 icid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) __u16 reserved;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) __aligned_u64 db_rec_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) struct qedr_create_qp_ureq {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) __u32 qp_handle_hi;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) __u32 qp_handle_lo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) /* SQ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) /* user space virtual address of SQ buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) __aligned_u64 sq_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) /* length of SQ buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) __aligned_u64 sq_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) /* RQ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) /* user space virtual address of RQ buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) __aligned_u64 rq_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) /* length of RQ buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) __aligned_u64 rq_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) struct qedr_create_qp_uresp {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) __u32 qp_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) __u32 atomic_supported;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) /* SQ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) __u32 sq_db_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) __u16 sq_icid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) /* RQ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) __u32 rq_db_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) __u16 rq_icid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) __u32 rq_db2_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) __u32 reserved;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) /* address of SQ doorbell recovery user entry */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) __aligned_u64 sq_db_rec_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) /* address of RQ doorbell recovery user entry */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) __aligned_u64 rq_db_rec_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) struct qedr_create_srq_ureq {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) /* user space virtual address of producer pair */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) __aligned_u64 prod_pair_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) /* user space virtual address of SRQ buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) __aligned_u64 srq_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) /* length of SRQ buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) __aligned_u64 srq_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) struct qedr_create_srq_uresp {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) __u16 srq_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) __u16 reserved0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) __u32 reserved1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) /* doorbell recovery entry allocated and populated by userspace doorbelling
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) * entities and mapped to kernel. Kernel uses this to register doorbell
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) * information with doorbell drop recovery mechanism.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) struct qedr_user_db_rec {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) __aligned_u64 db_data; /* doorbell data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) #endif /* __QEDR_USER_H__ */