162306a36Sopenharmony_ci/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */
262306a36Sopenharmony_ci/* This file is part of the Emulex RoCE Device Driver for
362306a36Sopenharmony_ci * RoCE (RDMA over Converged Ethernet) adapters.
462306a36Sopenharmony_ci * Copyright (C) 2012-2015 Emulex. All rights reserved.
562306a36Sopenharmony_ci * EMULEX and SLI are trademarks of Emulex.
662306a36Sopenharmony_ci * www.emulex.com
762306a36Sopenharmony_ci *
862306a36Sopenharmony_ci * This software is available to you under a choice of one of two licenses.
962306a36Sopenharmony_ci * You may choose to be licensed under the terms of the GNU General Public
1062306a36Sopenharmony_ci * License (GPL) Version 2, available from the file COPYING in the main
1162306a36Sopenharmony_ci * directory of this source tree, or the BSD license below:
1262306a36Sopenharmony_ci *
1362306a36Sopenharmony_ci * Redistribution and use in source and binary forms, with or without
1462306a36Sopenharmony_ci * modification, are permitted provided that the following conditions
1562306a36Sopenharmony_ci * are met:
1662306a36Sopenharmony_ci *
1762306a36Sopenharmony_ci * - Redistributions of source code must retain the above copyright notice,
1862306a36Sopenharmony_ci *   this list of conditions and the following disclaimer.
1962306a36Sopenharmony_ci *
2062306a36Sopenharmony_ci * - Redistributions in binary form must reproduce the above copyright
2162306a36Sopenharmony_ci *   notice, this list of conditions and the following disclaimer in
2262306a36Sopenharmony_ci *   the documentation and/or other materials provided with the distribution.
2362306a36Sopenharmony_ci *
2462306a36Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2562306a36Sopenharmony_ci * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,THE
2662306a36Sopenharmony_ci * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2762306a36Sopenharmony_ci * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
2862306a36Sopenharmony_ci * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2962306a36Sopenharmony_ci * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
3062306a36Sopenharmony_ci * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
3162306a36Sopenharmony_ci * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
3262306a36Sopenharmony_ci * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
3362306a36Sopenharmony_ci * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
3462306a36Sopenharmony_ci * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3562306a36Sopenharmony_ci *
3662306a36Sopenharmony_ci * Contact Information:
3762306a36Sopenharmony_ci * linux-drivers@emulex.com
3862306a36Sopenharmony_ci *
3962306a36Sopenharmony_ci * Emulex
4062306a36Sopenharmony_ci * 3333 Susan Street
4162306a36Sopenharmony_ci * Costa Mesa, CA 92626
4262306a36Sopenharmony_ci */
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci#ifndef OCRDMA_ABI_USER_H
4562306a36Sopenharmony_ci#define OCRDMA_ABI_USER_H
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci#include <linux/types.h>
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ci#define OCRDMA_ABI_VERSION 2
5062306a36Sopenharmony_ci#define OCRDMA_BE_ROCE_ABI_VERSION 1
5162306a36Sopenharmony_ci/* user kernel communication data structures. */
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_cistruct ocrdma_alloc_ucontext_resp {
5462306a36Sopenharmony_ci	__u32 dev_id;
5562306a36Sopenharmony_ci	__u32 wqe_size;
5662306a36Sopenharmony_ci	__u32 max_inline_data;
5762306a36Sopenharmony_ci	__u32 dpp_wqe_size;
5862306a36Sopenharmony_ci	__aligned_u64 ah_tbl_page;
5962306a36Sopenharmony_ci	__u32 ah_tbl_len;
6062306a36Sopenharmony_ci	__u32 rqe_size;
6162306a36Sopenharmony_ci	__u8 fw_ver[32];
6262306a36Sopenharmony_ci	/* for future use/new features in progress */
6362306a36Sopenharmony_ci	__aligned_u64 rsvd1;
6462306a36Sopenharmony_ci	__aligned_u64 rsvd2;
6562306a36Sopenharmony_ci};
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_cistruct ocrdma_alloc_pd_ureq {
6862306a36Sopenharmony_ci	__u32 rsvd[2];
6962306a36Sopenharmony_ci};
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_cistruct ocrdma_alloc_pd_uresp {
7262306a36Sopenharmony_ci	__u32 id;
7362306a36Sopenharmony_ci	__u32 dpp_enabled;
7462306a36Sopenharmony_ci	__u32 dpp_page_addr_hi;
7562306a36Sopenharmony_ci	__u32 dpp_page_addr_lo;
7662306a36Sopenharmony_ci	__u32 rsvd[2];
7762306a36Sopenharmony_ci};
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_cistruct ocrdma_create_cq_ureq {
8062306a36Sopenharmony_ci	__u32 dpp_cq;
8162306a36Sopenharmony_ci	__u32 rsvd; /* pad */
8262306a36Sopenharmony_ci};
8362306a36Sopenharmony_ci
8462306a36Sopenharmony_ci#define MAX_CQ_PAGES 8
8562306a36Sopenharmony_cistruct ocrdma_create_cq_uresp {
8662306a36Sopenharmony_ci	__u32 cq_id;
8762306a36Sopenharmony_ci	__u32 page_size;
8862306a36Sopenharmony_ci	__u32 num_pages;
8962306a36Sopenharmony_ci	__u32 max_hw_cqe;
9062306a36Sopenharmony_ci	__aligned_u64 page_addr[MAX_CQ_PAGES];
9162306a36Sopenharmony_ci	__aligned_u64 db_page_addr;
9262306a36Sopenharmony_ci	__u32 db_page_size;
9362306a36Sopenharmony_ci	__u32 phase_change;
9462306a36Sopenharmony_ci	/* for future use/new features in progress */
9562306a36Sopenharmony_ci	__aligned_u64 rsvd1;
9662306a36Sopenharmony_ci	__aligned_u64 rsvd2;
9762306a36Sopenharmony_ci};
9862306a36Sopenharmony_ci
9962306a36Sopenharmony_ci#define MAX_QP_PAGES 8
10062306a36Sopenharmony_ci#define MAX_UD_AV_PAGES 8
10162306a36Sopenharmony_ci
10262306a36Sopenharmony_cistruct ocrdma_create_qp_ureq {
10362306a36Sopenharmony_ci	__u8 enable_dpp_cq;
10462306a36Sopenharmony_ci	__u8 rsvd;
10562306a36Sopenharmony_ci	__u16 dpp_cq_id;
10662306a36Sopenharmony_ci	__u32 rsvd1;	/* pad */
10762306a36Sopenharmony_ci};
10862306a36Sopenharmony_ci
10962306a36Sopenharmony_cistruct ocrdma_create_qp_uresp {
11062306a36Sopenharmony_ci	__u16 qp_id;
11162306a36Sopenharmony_ci	__u16 sq_dbid;
11262306a36Sopenharmony_ci	__u16 rq_dbid;
11362306a36Sopenharmony_ci	__u16 resv0;	/* pad */
11462306a36Sopenharmony_ci	__u32 sq_page_size;
11562306a36Sopenharmony_ci	__u32 rq_page_size;
11662306a36Sopenharmony_ci	__u32 num_sq_pages;
11762306a36Sopenharmony_ci	__u32 num_rq_pages;
11862306a36Sopenharmony_ci	__aligned_u64 sq_page_addr[MAX_QP_PAGES];
11962306a36Sopenharmony_ci	__aligned_u64 rq_page_addr[MAX_QP_PAGES];
12062306a36Sopenharmony_ci	__aligned_u64 db_page_addr;
12162306a36Sopenharmony_ci	__u32 db_page_size;
12262306a36Sopenharmony_ci	__u32 dpp_credit;
12362306a36Sopenharmony_ci	__u32 dpp_offset;
12462306a36Sopenharmony_ci	__u32 num_wqe_allocated;
12562306a36Sopenharmony_ci	__u32 num_rqe_allocated;
12662306a36Sopenharmony_ci	__u32 db_sq_offset;
12762306a36Sopenharmony_ci	__u32 db_rq_offset;
12862306a36Sopenharmony_ci	__u32 db_shift;
12962306a36Sopenharmony_ci	__aligned_u64 rsvd[11];
13062306a36Sopenharmony_ci};
13162306a36Sopenharmony_ci
13262306a36Sopenharmony_cistruct ocrdma_create_srq_uresp {
13362306a36Sopenharmony_ci	__u16 rq_dbid;
13462306a36Sopenharmony_ci	__u16 resv0;	/* pad */
13562306a36Sopenharmony_ci	__u32 resv1;
13662306a36Sopenharmony_ci
13762306a36Sopenharmony_ci	__u32 rq_page_size;
13862306a36Sopenharmony_ci	__u32 num_rq_pages;
13962306a36Sopenharmony_ci
14062306a36Sopenharmony_ci	__aligned_u64 rq_page_addr[MAX_QP_PAGES];
14162306a36Sopenharmony_ci	__aligned_u64 db_page_addr;
14262306a36Sopenharmony_ci
14362306a36Sopenharmony_ci	__u32 db_page_size;
14462306a36Sopenharmony_ci	__u32 num_rqe_allocated;
14562306a36Sopenharmony_ci	__u32 db_rq_offset;
14662306a36Sopenharmony_ci	__u32 db_shift;
14762306a36Sopenharmony_ci
14862306a36Sopenharmony_ci	__aligned_u64 rsvd2;
14962306a36Sopenharmony_ci	__aligned_u64 rsvd3;
15062306a36Sopenharmony_ci};
15162306a36Sopenharmony_ci
15262306a36Sopenharmony_ci#endif	/* OCRDMA_ABI_USER_H */
153