18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ 28c2ecf20Sopenharmony_ci/* QLogic qedr NIC Driver 38c2ecf20Sopenharmony_ci * Copyright (c) 2015-2016 QLogic Corporation 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * This software is available to you under a choice of one of two 68c2ecf20Sopenharmony_ci * licenses. You may choose to be licensed under the terms of the GNU 78c2ecf20Sopenharmony_ci * General Public License (GPL) Version 2, available from the file 88c2ecf20Sopenharmony_ci * COPYING in the main directory of this source tree, or the 98c2ecf20Sopenharmony_ci * OpenIB.org BSD license below: 108c2ecf20Sopenharmony_ci * 118c2ecf20Sopenharmony_ci * Redistribution and use in source and binary forms, with or 128c2ecf20Sopenharmony_ci * without modification, are permitted provided that the following 138c2ecf20Sopenharmony_ci * conditions are met: 148c2ecf20Sopenharmony_ci * 158c2ecf20Sopenharmony_ci * - Redistributions of source code must retain the above 168c2ecf20Sopenharmony_ci * copyright notice, this list of conditions and the following 178c2ecf20Sopenharmony_ci * disclaimer. 188c2ecf20Sopenharmony_ci * 198c2ecf20Sopenharmony_ci * - Redistributions in binary form must reproduce the above 208c2ecf20Sopenharmony_ci * copyright notice, this list of conditions and the following 218c2ecf20Sopenharmony_ci * disclaimer in the documentation and /or other materials 228c2ecf20Sopenharmony_ci * provided with the distribution. 238c2ecf20Sopenharmony_ci * 248c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 258c2ecf20Sopenharmony_ci * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 268c2ecf20Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 278c2ecf20Sopenharmony_ci * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 288c2ecf20Sopenharmony_ci * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 298c2ecf20Sopenharmony_ci * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 308c2ecf20Sopenharmony_ci * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 318c2ecf20Sopenharmony_ci * SOFTWARE. 328c2ecf20Sopenharmony_ci */ 338c2ecf20Sopenharmony_ci#ifndef __QEDR_USER_H__ 348c2ecf20Sopenharmony_ci#define __QEDR_USER_H__ 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci#include <linux/types.h> 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci#define QEDR_ABI_VERSION (8) 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci/* user kernel communication data structures. */ 418c2ecf20Sopenharmony_cienum qedr_alloc_ucontext_flags { 428c2ecf20Sopenharmony_ci QEDR_ALLOC_UCTX_EDPM_MODE = 1 << 0, 438c2ecf20Sopenharmony_ci QEDR_ALLOC_UCTX_DB_REC = 1 << 1, 448c2ecf20Sopenharmony_ci QEDR_SUPPORT_DPM_SIZES = 1 << 2, 458c2ecf20Sopenharmony_ci}; 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_cistruct qedr_alloc_ucontext_req { 488c2ecf20Sopenharmony_ci __u32 context_flags; 498c2ecf20Sopenharmony_ci __u32 reserved; 508c2ecf20Sopenharmony_ci}; 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci#define QEDR_LDPM_MAX_SIZE (8192) 538c2ecf20Sopenharmony_ci#define QEDR_EDPM_TRANS_SIZE (64) 548c2ecf20Sopenharmony_ci#define QEDR_EDPM_MAX_SIZE (ROCE_REQ_MAX_INLINE_DATA_SIZE) 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_cienum qedr_rdma_dpm_type { 578c2ecf20Sopenharmony_ci QEDR_DPM_TYPE_NONE = 0, 588c2ecf20Sopenharmony_ci QEDR_DPM_TYPE_ROCE_ENHANCED = 1 << 0, 598c2ecf20Sopenharmony_ci QEDR_DPM_TYPE_ROCE_LEGACY = 1 << 1, 608c2ecf20Sopenharmony_ci QEDR_DPM_TYPE_IWARP_LEGACY = 1 << 2, 618c2ecf20Sopenharmony_ci QEDR_DPM_TYPE_ROCE_EDPM_MODE = 1 << 3, 628c2ecf20Sopenharmony_ci QEDR_DPM_SIZES_SET = 1 << 4, 638c2ecf20Sopenharmony_ci}; 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_cistruct qedr_alloc_ucontext_resp { 668c2ecf20Sopenharmony_ci __aligned_u64 db_pa; 678c2ecf20Sopenharmony_ci __u32 db_size; 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci __u32 max_send_wr; 708c2ecf20Sopenharmony_ci __u32 max_recv_wr; 718c2ecf20Sopenharmony_ci __u32 max_srq_wr; 728c2ecf20Sopenharmony_ci __u32 sges_per_send_wr; 738c2ecf20Sopenharmony_ci __u32 sges_per_recv_wr; 748c2ecf20Sopenharmony_ci __u32 sges_per_srq_wr; 758c2ecf20Sopenharmony_ci __u32 max_cqes; 768c2ecf20Sopenharmony_ci __u8 dpm_flags; 778c2ecf20Sopenharmony_ci __u8 wids_enabled; 788c2ecf20Sopenharmony_ci __u16 wid_count; 798c2ecf20Sopenharmony_ci __u16 ldpm_limit_size; 808c2ecf20Sopenharmony_ci __u8 edpm_trans_size; 818c2ecf20Sopenharmony_ci __u8 reserved; 828c2ecf20Sopenharmony_ci __u16 edpm_limit_size; 838c2ecf20Sopenharmony_ci __u8 padding[6]; 848c2ecf20Sopenharmony_ci}; 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_cistruct qedr_alloc_pd_ureq { 878c2ecf20Sopenharmony_ci __aligned_u64 rsvd1; 888c2ecf20Sopenharmony_ci}; 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_cistruct qedr_alloc_pd_uresp { 918c2ecf20Sopenharmony_ci __u32 pd_id; 928c2ecf20Sopenharmony_ci __u32 reserved; 938c2ecf20Sopenharmony_ci}; 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_cistruct qedr_create_cq_ureq { 968c2ecf20Sopenharmony_ci __aligned_u64 addr; 978c2ecf20Sopenharmony_ci __aligned_u64 len; 988c2ecf20Sopenharmony_ci}; 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_cistruct qedr_create_cq_uresp { 1018c2ecf20Sopenharmony_ci __u32 db_offset; 1028c2ecf20Sopenharmony_ci __u16 icid; 1038c2ecf20Sopenharmony_ci __u16 reserved; 1048c2ecf20Sopenharmony_ci __aligned_u64 db_rec_addr; 1058c2ecf20Sopenharmony_ci}; 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_cistruct qedr_create_qp_ureq { 1088c2ecf20Sopenharmony_ci __u32 qp_handle_hi; 1098c2ecf20Sopenharmony_ci __u32 qp_handle_lo; 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_ci /* SQ */ 1128c2ecf20Sopenharmony_ci /* user space virtual address of SQ buffer */ 1138c2ecf20Sopenharmony_ci __aligned_u64 sq_addr; 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_ci /* length of SQ buffer */ 1168c2ecf20Sopenharmony_ci __aligned_u64 sq_len; 1178c2ecf20Sopenharmony_ci 1188c2ecf20Sopenharmony_ci /* RQ */ 1198c2ecf20Sopenharmony_ci /* user space virtual address of RQ buffer */ 1208c2ecf20Sopenharmony_ci __aligned_u64 rq_addr; 1218c2ecf20Sopenharmony_ci 1228c2ecf20Sopenharmony_ci /* length of RQ buffer */ 1238c2ecf20Sopenharmony_ci __aligned_u64 rq_len; 1248c2ecf20Sopenharmony_ci}; 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_cistruct qedr_create_qp_uresp { 1278c2ecf20Sopenharmony_ci __u32 qp_id; 1288c2ecf20Sopenharmony_ci __u32 atomic_supported; 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_ci /* SQ */ 1318c2ecf20Sopenharmony_ci __u32 sq_db_offset; 1328c2ecf20Sopenharmony_ci __u16 sq_icid; 1338c2ecf20Sopenharmony_ci 1348c2ecf20Sopenharmony_ci /* RQ */ 1358c2ecf20Sopenharmony_ci __u32 rq_db_offset; 1368c2ecf20Sopenharmony_ci __u16 rq_icid; 1378c2ecf20Sopenharmony_ci 1388c2ecf20Sopenharmony_ci __u32 rq_db2_offset; 1398c2ecf20Sopenharmony_ci __u32 reserved; 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_ci /* address of SQ doorbell recovery user entry */ 1428c2ecf20Sopenharmony_ci __aligned_u64 sq_db_rec_addr; 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ci /* address of RQ doorbell recovery user entry */ 1458c2ecf20Sopenharmony_ci __aligned_u64 rq_db_rec_addr; 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_ci}; 1488c2ecf20Sopenharmony_ci 1498c2ecf20Sopenharmony_cistruct qedr_create_srq_ureq { 1508c2ecf20Sopenharmony_ci /* user space virtual address of producer pair */ 1518c2ecf20Sopenharmony_ci __aligned_u64 prod_pair_addr; 1528c2ecf20Sopenharmony_ci 1538c2ecf20Sopenharmony_ci /* user space virtual address of SRQ buffer */ 1548c2ecf20Sopenharmony_ci __aligned_u64 srq_addr; 1558c2ecf20Sopenharmony_ci 1568c2ecf20Sopenharmony_ci /* length of SRQ buffer */ 1578c2ecf20Sopenharmony_ci __aligned_u64 srq_len; 1588c2ecf20Sopenharmony_ci}; 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_cistruct qedr_create_srq_uresp { 1618c2ecf20Sopenharmony_ci __u16 srq_id; 1628c2ecf20Sopenharmony_ci __u16 reserved0; 1638c2ecf20Sopenharmony_ci __u32 reserved1; 1648c2ecf20Sopenharmony_ci}; 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_ci/* doorbell recovery entry allocated and populated by userspace doorbelling 1678c2ecf20Sopenharmony_ci * entities and mapped to kernel. Kernel uses this to register doorbell 1688c2ecf20Sopenharmony_ci * information with doorbell drop recovery mechanism. 1698c2ecf20Sopenharmony_ci */ 1708c2ecf20Sopenharmony_cistruct qedr_user_db_rec { 1718c2ecf20Sopenharmony_ci __aligned_u64 db_data; /* doorbell data */ 1728c2ecf20Sopenharmony_ci}; 1738c2ecf20Sopenharmony_ci 1748c2ecf20Sopenharmony_ci#endif /* __QEDR_USER_H__ */ 175