1 /*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, v.1,  (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://opensource.org/licenses/CDDL-1.0.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 
22 /*
23 * Copyright 2014-2017 Cavium, Inc.
24 * The contents of this file are subject to the terms of the Common Development
25 * and Distribution License, v.1,  (the "License").
26 
27 * You may not use this file except in compliance with the License.
28 
29 * You can obtain a copy of the License at available
30 * at http://opensource.org/licenses/CDDL-1.0
31 
32 * See the License for the specific language governing permissions and
33 * limitations under the License.
34 */
35 
36 #ifndef __ECORE_PROTO_IF_H__
37 #define __ECORE_PROTO_IF_H__
38 
39 /*
40  * PF parameters (according to personality/protocol)
41  */
42 
43 #define ECORE_ROCE_PROTOCOL_INDEX	(3)
44 
45 struct ecore_eth_pf_params {
46 	/* The following parameters are used during HW-init
47 	 * and these parameters need to be passed as arguments
48 	 * to update_pf_params routine invoked before slowpath start
49 	 */
50 	u16	num_cons;
51 
52 	/* per-VF number of CIDs */
53 	u8	num_vf_cons;
54 #define ETH_PF_PARAMS_VF_CONS_DEFAULT	(32)
55 
56 	/* To enable arfs, previous to HW-init a positive number needs to be
57 	 * set [as filters require allocated searcher ILT memory].
58 	 * This will set the maximal number of configured steering-filters.
59 	 */
60 	u32	num_arfs_filters;
61 };
62 
63 /* Most of the the parameters below are described in the FW FCoE HSI */
64 struct ecore_fcoe_pf_params {
65 	/* The following parameters are used during protocol-init */
66 	u64		glbl_q_params_addr;
67 	u64		bdq_pbl_base_addr[2];
68 
69 	/* The following parameters are used during HW-init
70 	 * and these parameters need to be passed as arguments
71 	 * to update_pf_params routine invoked before slowpath start
72 	 */
73 	u16		num_cons;
74 	u16		num_tasks;
75 
76 	/* The following parameters are used during protocol-init */
77 	u16		sq_num_pbl_pages;
78 
79 	u16		cq_num_entries;
80 	u16		cmdq_num_entries;
81 	u16		rq_buffer_log_size;
82 	u16		mtu;
83 	u16		dummy_icid;
84 	u16		bdq_xoff_threshold[2];
85 	u16		bdq_xon_threshold[2];
86 	u16		rq_buffer_size;
87 	u8		num_cqs; /* num of global CQs */
88 	u8		log_page_size;
89 	u8		gl_rq_pi;
90 	u8		gl_cmd_pi;
91 	u8		debug_mode;
92 	u8		is_target;
93 	u8		bdq_pbl_num_entries[2];
94 };
95 
96 /* Most of the the parameters below are described in the FW iSCSI / TCP HSI */
97 struct ecore_iscsi_pf_params {
98 
99 	u64		glbl_q_params_addr;
100 	u64		bdq_pbl_base_addr[2];
101 	u16		cq_num_entries;
102 	u16		cmdq_num_entries;
103 	u32		two_msl_timer;
104 	u16		tx_sws_timer;
105 	/* The following parameters are used during HW-init
106 	 * and these parameters need to be passed as arguments
107 	 * to update_pf_params routine invoked before slowpath start
108 	 */
109 	u16		num_cons;
110 	u16		num_tasks;
111 
112 	/* The following parameters are used during protocol-init */
113 	u16		half_way_close_timeout;
114 	u16		bdq_xoff_threshold[2];
115 	u16		bdq_xon_threshold[2];
116 	u16		cmdq_xoff_threshold;
117 	u16		cmdq_xon_threshold;
118 	u16		rq_buffer_size;
119 
120 	u8		num_sq_pages_in_ring;
121 	u8		num_r2tq_pages_in_ring;
122 	u8		num_uhq_pages_in_ring;
123 	u8		num_queues;
124 	u8		log_page_size;
125 	u8		rqe_log_size;
126 	u8		max_fin_rt;
127 	u8		gl_rq_pi;
128 	u8		gl_cmd_pi;
129 	u8		debug_mode;
130 	u8		ll2_ooo_queue_id;
131 	u8		ooo_enable;
132 
133 	u8		is_target;
134 	u8		bdq_pbl_num_entries[2];
135 };
136 
137 enum ecore_rdma_protocol {
138 	ECORE_RDMA_PROTOCOL_DEFAULT,
139 	ECORE_RDMA_PROTOCOL_NONE,
140 	ECORE_RDMA_PROTOCOL_ROCE,
141 	ECORE_RDMA_PROTOCOL_IWARP,
142 };
143 
144 struct ecore_rdma_pf_params {
145 	/* Supplied to ECORE during resource allocation (may affect the ILT and
146 	 * the doorbell BAR).
147 	 */
148 	u32		min_dpis;	/* number of requested DPIs */
149 	u32		num_qps;	/* number of requested Queue Pairs */
150 	u32		num_srqs;	/* number of requested SRQ */
151 	u8		roce_edpm_mode; /* see QED_ROCE_EDPM_MODE_ENABLE */
152 	u8		gl_pi;		/* protocol index */
153 
154 	/* Will allocate rate limiters to be used with QPs */
155 	u8		enable_dcqcn;
156 
157 	/* Max number of CNQs - limits number of ECORE_RDMA_CNQ feature,
158 	 * Allowing an incrementation in ECORE_PF_L2_QUE.
159 	 * To disable CNQs, use dedicated value instead of `0'.
160 	 */
161 #define ECORE_RDMA_PF_PARAMS_CNQS_NONE	(0xffff)
162 	u16		max_cnqs;
163 
164 	/* TCP port number used for the iwarp traffic */
165 	u16		iwarp_port;
166 	enum ecore_rdma_protocol rdma_protocol;
167 };
168 
169 struct ecore_pf_params {
170 	struct ecore_eth_pf_params	eth_pf_params;
171 	struct ecore_fcoe_pf_params	fcoe_pf_params;
172 	struct ecore_iscsi_pf_params	iscsi_pf_params;
173 	struct ecore_rdma_pf_params	rdma_pf_params;
174 };
175 
176 #endif
177 
178 
179