18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */
28c2ecf20Sopenharmony_ci/* This file is part of the Emulex RoCE Device Driver for
38c2ecf20Sopenharmony_ci * RoCE (RDMA over Converged Ethernet) adapters.
48c2ecf20Sopenharmony_ci * Copyright (C) 2012-2015 Emulex. All rights reserved.
58c2ecf20Sopenharmony_ci * EMULEX and SLI are trademarks of Emulex.
68c2ecf20Sopenharmony_ci * www.emulex.com
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * This software is available to you under a choice of one of two licenses.
98c2ecf20Sopenharmony_ci * You may choose to be licensed under the terms of the GNU General Public
108c2ecf20Sopenharmony_ci * License (GPL) Version 2, available from the file COPYING in the main
118c2ecf20Sopenharmony_ci * directory of this source tree, or the BSD license below:
128c2ecf20Sopenharmony_ci *
138c2ecf20Sopenharmony_ci * Redistribution and use in source and binary forms, with or without
148c2ecf20Sopenharmony_ci * modification, are permitted provided that the following conditions
158c2ecf20Sopenharmony_ci * are met:
168c2ecf20Sopenharmony_ci *
178c2ecf20Sopenharmony_ci * - Redistributions of source code must retain the above copyright notice,
188c2ecf20Sopenharmony_ci *   this list of conditions and the following disclaimer.
198c2ecf20Sopenharmony_ci *
208c2ecf20Sopenharmony_ci * - Redistributions in binary form must reproduce the above copyright
218c2ecf20Sopenharmony_ci *   notice, this list of conditions and the following disclaimer in
228c2ecf20Sopenharmony_ci *   the documentation and/or other materials provided with the distribution.
238c2ecf20Sopenharmony_ci *
248c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
258c2ecf20Sopenharmony_ci * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,THE
268c2ecf20Sopenharmony_ci * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
278c2ecf20Sopenharmony_ci * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
288c2ecf20Sopenharmony_ci * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
298c2ecf20Sopenharmony_ci * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
308c2ecf20Sopenharmony_ci * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
318c2ecf20Sopenharmony_ci * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
328c2ecf20Sopenharmony_ci * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
338c2ecf20Sopenharmony_ci * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
348c2ecf20Sopenharmony_ci * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
358c2ecf20Sopenharmony_ci *
368c2ecf20Sopenharmony_ci * Contact Information:
378c2ecf20Sopenharmony_ci * linux-drivers@emulex.com
388c2ecf20Sopenharmony_ci *
398c2ecf20Sopenharmony_ci * Emulex
408c2ecf20Sopenharmony_ci * 3333 Susan Street
418c2ecf20Sopenharmony_ci * Costa Mesa, CA 92626
428c2ecf20Sopenharmony_ci */
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci#ifndef OCRDMA_ABI_USER_H
458c2ecf20Sopenharmony_ci#define OCRDMA_ABI_USER_H
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci#include <linux/types.h>
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci#define OCRDMA_ABI_VERSION 2
508c2ecf20Sopenharmony_ci#define OCRDMA_BE_ROCE_ABI_VERSION 1
518c2ecf20Sopenharmony_ci/* user kernel communication data structures. */
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_cistruct ocrdma_alloc_ucontext_resp {
548c2ecf20Sopenharmony_ci	__u32 dev_id;
558c2ecf20Sopenharmony_ci	__u32 wqe_size;
568c2ecf20Sopenharmony_ci	__u32 max_inline_data;
578c2ecf20Sopenharmony_ci	__u32 dpp_wqe_size;
588c2ecf20Sopenharmony_ci	__aligned_u64 ah_tbl_page;
598c2ecf20Sopenharmony_ci	__u32 ah_tbl_len;
608c2ecf20Sopenharmony_ci	__u32 rqe_size;
618c2ecf20Sopenharmony_ci	__u8 fw_ver[32];
628c2ecf20Sopenharmony_ci	/* for future use/new features in progress */
638c2ecf20Sopenharmony_ci	__aligned_u64 rsvd1;
648c2ecf20Sopenharmony_ci	__aligned_u64 rsvd2;
658c2ecf20Sopenharmony_ci};
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_cistruct ocrdma_alloc_pd_ureq {
688c2ecf20Sopenharmony_ci	__u32 rsvd[2];
698c2ecf20Sopenharmony_ci};
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_cistruct ocrdma_alloc_pd_uresp {
728c2ecf20Sopenharmony_ci	__u32 id;
738c2ecf20Sopenharmony_ci	__u32 dpp_enabled;
748c2ecf20Sopenharmony_ci	__u32 dpp_page_addr_hi;
758c2ecf20Sopenharmony_ci	__u32 dpp_page_addr_lo;
768c2ecf20Sopenharmony_ci	__u32 rsvd[2];
778c2ecf20Sopenharmony_ci};
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_cistruct ocrdma_create_cq_ureq {
808c2ecf20Sopenharmony_ci	__u32 dpp_cq;
818c2ecf20Sopenharmony_ci	__u32 rsvd; /* pad */
828c2ecf20Sopenharmony_ci};
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci#define MAX_CQ_PAGES 8
858c2ecf20Sopenharmony_cistruct ocrdma_create_cq_uresp {
868c2ecf20Sopenharmony_ci	__u32 cq_id;
878c2ecf20Sopenharmony_ci	__u32 page_size;
888c2ecf20Sopenharmony_ci	__u32 num_pages;
898c2ecf20Sopenharmony_ci	__u32 max_hw_cqe;
908c2ecf20Sopenharmony_ci	__aligned_u64 page_addr[MAX_CQ_PAGES];
918c2ecf20Sopenharmony_ci	__aligned_u64 db_page_addr;
928c2ecf20Sopenharmony_ci	__u32 db_page_size;
938c2ecf20Sopenharmony_ci	__u32 phase_change;
948c2ecf20Sopenharmony_ci	/* for future use/new features in progress */
958c2ecf20Sopenharmony_ci	__aligned_u64 rsvd1;
968c2ecf20Sopenharmony_ci	__aligned_u64 rsvd2;
978c2ecf20Sopenharmony_ci};
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ci#define MAX_QP_PAGES 8
1008c2ecf20Sopenharmony_ci#define MAX_UD_AV_PAGES 8
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_cistruct ocrdma_create_qp_ureq {
1038c2ecf20Sopenharmony_ci	__u8 enable_dpp_cq;
1048c2ecf20Sopenharmony_ci	__u8 rsvd;
1058c2ecf20Sopenharmony_ci	__u16 dpp_cq_id;
1068c2ecf20Sopenharmony_ci	__u32 rsvd1;	/* pad */
1078c2ecf20Sopenharmony_ci};
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_cistruct ocrdma_create_qp_uresp {
1108c2ecf20Sopenharmony_ci	__u16 qp_id;
1118c2ecf20Sopenharmony_ci	__u16 sq_dbid;
1128c2ecf20Sopenharmony_ci	__u16 rq_dbid;
1138c2ecf20Sopenharmony_ci	__u16 resv0;	/* pad */
1148c2ecf20Sopenharmony_ci	__u32 sq_page_size;
1158c2ecf20Sopenharmony_ci	__u32 rq_page_size;
1168c2ecf20Sopenharmony_ci	__u32 num_sq_pages;
1178c2ecf20Sopenharmony_ci	__u32 num_rq_pages;
1188c2ecf20Sopenharmony_ci	__aligned_u64 sq_page_addr[MAX_QP_PAGES];
1198c2ecf20Sopenharmony_ci	__aligned_u64 rq_page_addr[MAX_QP_PAGES];
1208c2ecf20Sopenharmony_ci	__aligned_u64 db_page_addr;
1218c2ecf20Sopenharmony_ci	__u32 db_page_size;
1228c2ecf20Sopenharmony_ci	__u32 dpp_credit;
1238c2ecf20Sopenharmony_ci	__u32 dpp_offset;
1248c2ecf20Sopenharmony_ci	__u32 num_wqe_allocated;
1258c2ecf20Sopenharmony_ci	__u32 num_rqe_allocated;
1268c2ecf20Sopenharmony_ci	__u32 db_sq_offset;
1278c2ecf20Sopenharmony_ci	__u32 db_rq_offset;
1288c2ecf20Sopenharmony_ci	__u32 db_shift;
1298c2ecf20Sopenharmony_ci	__aligned_u64 rsvd[11];
1308c2ecf20Sopenharmony_ci};
1318c2ecf20Sopenharmony_ci
1328c2ecf20Sopenharmony_cistruct ocrdma_create_srq_uresp {
1338c2ecf20Sopenharmony_ci	__u16 rq_dbid;
1348c2ecf20Sopenharmony_ci	__u16 resv0;	/* pad */
1358c2ecf20Sopenharmony_ci	__u32 resv1;
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_ci	__u32 rq_page_size;
1388c2ecf20Sopenharmony_ci	__u32 num_rq_pages;
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_ci	__aligned_u64 rq_page_addr[MAX_QP_PAGES];
1418c2ecf20Sopenharmony_ci	__aligned_u64 db_page_addr;
1428c2ecf20Sopenharmony_ci
1438c2ecf20Sopenharmony_ci	__u32 db_page_size;
1448c2ecf20Sopenharmony_ci	__u32 num_rqe_allocated;
1458c2ecf20Sopenharmony_ci	__u32 db_rq_offset;
1468c2ecf20Sopenharmony_ci	__u32 db_shift;
1478c2ecf20Sopenharmony_ci
1488c2ecf20Sopenharmony_ci	__aligned_u64 rsvd2;
1498c2ecf20Sopenharmony_ci	__aligned_u64 rsvd3;
1508c2ecf20Sopenharmony_ci};
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_ci#endif	/* OCRDMA_ABI_USER_H */
153