1/*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
3 *
4 * This program is free software; you may redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
10 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
11 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
12 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
13 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
14 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
15 * SOFTWARE.
16 *
17 */
18
19
20#ifndef USNIC_ABI_H
21#define USNIC_ABI_H
22
23/* ABI between userspace and kernel */
24#define USNIC_UVERBS_ABI_VERSION	4
25
26#define USNIC_QP_GRP_MAX_WQS		8
27#define USNIC_QP_GRP_MAX_RQS		8
28#define USNIC_QP_GRP_MAX_CQS		16
29
30enum usnic_transport_type {
31	USNIC_TRANSPORT_UNKNOWN		= 0,
32	USNIC_TRANSPORT_ROCE_CUSTOM	= 1,
33	USNIC_TRANSPORT_IPV4_UDP	= 2,
34	USNIC_TRANSPORT_MAX		= 3,
35};
36
37struct usnic_transport_spec {
38	enum usnic_transport_type	trans_type;
39	union {
40		struct {
41			uint16_t	port_num;
42		} usnic_roce;
43		struct {
44			uint32_t	sock_fd;
45		} udp;
46	};
47};
48
49struct usnic_ib_create_qp_cmd {
50	struct usnic_transport_spec	spec;
51};
52
53/*TODO: Future - usnic_modify_qp needs to pass in generic filters */
54struct usnic_ib_create_qp_resp {
55	u32				vfid;
56	u32				qp_grp_id;
57	u64				bar_bus_addr;
58	u32				bar_len;
59/*
60 * WQ, RQ, CQ are explicity specified bc exposing a generic resources inteface
61 * expands the scope of ABI to many files.
62 */
63	u32				wq_cnt;
64	u32				rq_cnt;
65	u32				cq_cnt;
66	u32				wq_idx[USNIC_QP_GRP_MAX_WQS];
67	u32				rq_idx[USNIC_QP_GRP_MAX_RQS];
68	u32				cq_idx[USNIC_QP_GRP_MAX_CQS];
69	u32				transport;
70	u32				reserved[9];
71};
72
73#endif /* USNIC_ABI_H */
74