162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * This software is available to you under a choice of one of two
562306a36Sopenharmony_ci * licenses.  You may choose to be licensed under the terms of the GNU
662306a36Sopenharmony_ci * General Public License (GPL) Version 2, available from the file
762306a36Sopenharmony_ci * COPYING in the main directory of this source tree, or the
862306a36Sopenharmony_ci * BSD license below:
962306a36Sopenharmony_ci *
1062306a36Sopenharmony_ci *     Redistribution and use in source and binary forms, with or
1162306a36Sopenharmony_ci *     without modification, are permitted provided that the following
1262306a36Sopenharmony_ci *     conditions are met:
1362306a36Sopenharmony_ci *
1462306a36Sopenharmony_ci *      - Redistributions of source code must retain the above
1562306a36Sopenharmony_ci *        copyright notice, this list of conditions and the following
1662306a36Sopenharmony_ci *        disclaimer.
1762306a36Sopenharmony_ci *
1862306a36Sopenharmony_ci *      - Redistributions in binary form must reproduce the above
1962306a36Sopenharmony_ci *        copyright notice, this list of conditions and the following
2062306a36Sopenharmony_ci *        disclaimer in the documentation and/or other materials
2162306a36Sopenharmony_ci *        provided with the distribution.
2262306a36Sopenharmony_ci *
2362306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
2462306a36Sopenharmony_ci * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2562306a36Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
2662306a36Sopenharmony_ci * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
2762306a36Sopenharmony_ci * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
2862306a36Sopenharmony_ci * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
2962306a36Sopenharmony_ci * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3062306a36Sopenharmony_ci * SOFTWARE.
3162306a36Sopenharmony_ci *
3262306a36Sopenharmony_ci */
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci#ifndef USNIC_ABI_H
3662306a36Sopenharmony_ci#define USNIC_ABI_H
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci/* ABI between userspace and kernel */
3962306a36Sopenharmony_ci#define USNIC_UVERBS_ABI_VERSION	4
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci#define USNIC_QP_GRP_MAX_WQS		8
4262306a36Sopenharmony_ci#define USNIC_QP_GRP_MAX_RQS		8
4362306a36Sopenharmony_ci#define USNIC_QP_GRP_MAX_CQS		16
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_cienum usnic_transport_type {
4662306a36Sopenharmony_ci	USNIC_TRANSPORT_UNKNOWN		= 0,
4762306a36Sopenharmony_ci	USNIC_TRANSPORT_ROCE_CUSTOM	= 1,
4862306a36Sopenharmony_ci	USNIC_TRANSPORT_IPV4_UDP	= 2,
4962306a36Sopenharmony_ci	USNIC_TRANSPORT_MAX		= 3,
5062306a36Sopenharmony_ci};
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_cistruct usnic_transport_spec {
5362306a36Sopenharmony_ci	enum usnic_transport_type	trans_type;
5462306a36Sopenharmony_ci	union {
5562306a36Sopenharmony_ci		struct {
5662306a36Sopenharmony_ci			uint16_t	port_num;
5762306a36Sopenharmony_ci		} usnic_roce;
5862306a36Sopenharmony_ci		struct {
5962306a36Sopenharmony_ci			uint32_t	sock_fd;
6062306a36Sopenharmony_ci		} udp;
6162306a36Sopenharmony_ci	};
6262306a36Sopenharmony_ci};
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_cistruct usnic_ib_create_qp_cmd {
6562306a36Sopenharmony_ci	struct usnic_transport_spec	spec;
6662306a36Sopenharmony_ci};
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ci/*TODO: Future - usnic_modify_qp needs to pass in generic filters */
6962306a36Sopenharmony_cistruct usnic_ib_create_qp_resp {
7062306a36Sopenharmony_ci	u32				vfid;
7162306a36Sopenharmony_ci	u32				qp_grp_id;
7262306a36Sopenharmony_ci	u64				bar_bus_addr;
7362306a36Sopenharmony_ci	u32				bar_len;
7462306a36Sopenharmony_ci/*
7562306a36Sopenharmony_ci * WQ, RQ, CQ are explicity specified bc exposing a generic resources inteface
7662306a36Sopenharmony_ci * expands the scope of ABI to many files.
7762306a36Sopenharmony_ci */
7862306a36Sopenharmony_ci	u32				wq_cnt;
7962306a36Sopenharmony_ci	u32				rq_cnt;
8062306a36Sopenharmony_ci	u32				cq_cnt;
8162306a36Sopenharmony_ci	u32				wq_idx[USNIC_QP_GRP_MAX_WQS];
8262306a36Sopenharmony_ci	u32				rq_idx[USNIC_QP_GRP_MAX_RQS];
8362306a36Sopenharmony_ci	u32				cq_idx[USNIC_QP_GRP_MAX_CQS];
8462306a36Sopenharmony_ci	u32				transport;
8562306a36Sopenharmony_ci	u32				reserved[9];
8662306a36Sopenharmony_ci};
8762306a36Sopenharmony_ci
8862306a36Sopenharmony_ci#endif /* USNIC_ABI_H */
89