1/*
2 * Copyright (c) 2017-2018 Cavium, Inc.
3 * All rights reserved.
4 *
5 *  Redistribution and use in source and binary forms, with or without
6 *  modification, are permitted provided that the following conditions
7 *  are met:
8 *
9 *  1. Redistributions of source code must retain the above copyright
10 *     notice, this list of conditions and the following disclaimer.
11 *  2. Redistributions in binary form must reproduce the above copyright
12 *     notice, this list of conditions and the following disclaimer in the
13 *     documentation and/or other materials provided with the distribution.
14 *
15 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 *  POSSIBILITY OF SUCH DAMAGE.
26 *
27 * $FreeBSD: stable/11/sys/dev/qlnx/qlnxe/ecore_proto_if.h 337517 2018-08-09 01:17:35Z davidcs $
28 *
29 */
30
31#ifndef __ECORE_PROTO_IF_H__
32#define __ECORE_PROTO_IF_H__
33
34/*
35 * PF parameters (according to personality/protocol)
36 */
37
38#define ECORE_ROCE_PROTOCOL_INDEX	(3)
39
40struct ecore_eth_pf_params {
41	/* The following parameters are used during HW-init
42	 * and these parameters need to be passed as arguments
43	 * to update_pf_params routine invoked before slowpath start
44	 */
45	u16	num_cons;
46
47	/* per-VF number of CIDs */
48	u8	num_vf_cons;
49#define ETH_PF_PARAMS_VF_CONS_DEFAULT	(32)
50
51	/* To enable arfs, previous to HW-init a positive number needs to be
52	 * set [as filters require allocated searcher ILT memory].
53	 * This will set the maximal number of configured steering-filters.
54	 */
55	u32	num_arfs_filters;
56};
57
58/* Most of the the parameters below are described in the FW FCoE HSI */
59struct ecore_fcoe_pf_params {
60	/* The following parameters are used during protocol-init */
61	u64		glbl_q_params_addr;
62	u64		bdq_pbl_base_addr[2];
63
64	/* The following parameters are used during HW-init
65	 * and these parameters need to be passed as arguments
66	 * to update_pf_params routine invoked before slowpath start
67	 */
68	u16		num_cons;
69	u16		num_tasks;
70
71	/* The following parameters are used during protocol-init */
72	u16		sq_num_pbl_pages;
73
74	u16		cq_num_entries;
75	u16		cmdq_num_entries;
76	u16		rq_buffer_log_size;
77	u16		mtu;
78	u16		dummy_icid;
79	u16		bdq_xoff_threshold[2];
80	u16		bdq_xon_threshold[2];
81	u16		rq_buffer_size;
82	u8		num_cqs; /* num of global CQs */
83	u8		log_page_size;
84	u8		gl_rq_pi;
85	u8		gl_cmd_pi;
86	u8		debug_mode;
87	u8		is_target;
88	u8		bdq_pbl_num_entries[2];
89};
90
91/* Most of the the parameters below are described in the FW iSCSI / TCP HSI */
92struct ecore_iscsi_pf_params {
93
94	u64		glbl_q_params_addr;
95	u64		bdq_pbl_base_addr[3];
96	u16		cq_num_entries;
97	u16		cmdq_num_entries;
98	u32		two_msl_timer;
99	u16		tx_sws_timer;
100	/* The following parameters are used during HW-init
101	 * and these parameters need to be passed as arguments
102	 * to update_pf_params routine invoked before slowpath start
103	 */
104	u16		num_cons;
105	u16		num_tasks;
106
107	/* The following parameters are used during protocol-init */
108	u16		half_way_close_timeout;
109	u16		bdq_xoff_threshold[3];
110	u16		bdq_xon_threshold[3];
111	u16		cmdq_xoff_threshold;
112	u16		cmdq_xon_threshold;
113	u16		rq_buffer_size;
114
115	u8		num_sq_pages_in_ring;
116	u8		num_r2tq_pages_in_ring;
117	u8		num_uhq_pages_in_ring;
118	u8		num_queues;
119	u8		log_page_size;
120	u8		rqe_log_size;
121	u8		max_fin_rt;
122	u8		gl_rq_pi;
123	u8		gl_cmd_pi;
124	u8		debug_mode;
125	u8		ll2_ooo_queue_id;
126
127	u8		is_target;
128	u8		is_soc_en;
129	u8		soc_num_of_blocks_log;
130	u8		bdq_pbl_num_entries[3];
131	u8		disable_stats_collection;
132};
133
134enum ecore_rdma_protocol {
135	ECORE_RDMA_PROTOCOL_DEFAULT,
136	ECORE_RDMA_PROTOCOL_NONE,
137	ECORE_RDMA_PROTOCOL_ROCE,
138	ECORE_RDMA_PROTOCOL_IWARP,
139};
140
141struct ecore_rdma_pf_params {
142	/* Supplied to ECORE during resource allocation (may affect the ILT and
143	 * the doorbell BAR).
144	 */
145	u32		min_dpis;	/* number of requested DPIs */
146	u32		num_qps;	/* number of requested Queue Pairs */
147	u32		num_srqs;	/* number of requested SRQs */
148	u32		num_xrc_srqs;	/* number of requested XRC SRQs */
149	u8		roce_edpm_mode; /* see QED_ROCE_EDPM_MODE_ENABLE */
150	u8		gl_pi;		/* protocol index */
151
152	/* Will allocate rate limiters to be used with QPs */
153	u8		enable_dcqcn;
154
155	/* Max number of CNQs - limits number of ECORE_RDMA_CNQ feature,
156	 * Allowing an incrementation in ECORE_PF_L2_QUE.
157	 * To disable CNQs, use dedicated value instead of `0'.
158	 */
159#define ECORE_RDMA_PF_PARAMS_CNQS_NONE	(0xffff)
160	u16		max_cnqs;
161
162	/* TCP port number used for the iwarp traffic */
163	u16		iwarp_port;
164	enum ecore_rdma_protocol rdma_protocol;
165};
166
167struct ecore_pf_params {
168	struct ecore_eth_pf_params	eth_pf_params;
169	struct ecore_fcoe_pf_params	fcoe_pf_params;
170	struct ecore_iscsi_pf_params	iscsi_pf_params;
171	struct ecore_rdma_pf_params	rdma_pf_params;
172};
173
174#endif
175
176
177