xref: /freebsd/sys/dev/qlnx/qlnxe/ecore_proto_if.h (revision 315ee00f)
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  */
28 
29 #ifndef __ECORE_PROTO_IF_H__
30 #define __ECORE_PROTO_IF_H__
31 
32 /*
33  * PF parameters (according to personality/protocol)
34  */
35 
36 #define ECORE_ROCE_PROTOCOL_INDEX	(3)
37 
38 struct ecore_eth_pf_params {
39 	/* The following parameters are used during HW-init
40 	 * and these parameters need to be passed as arguments
41 	 * to update_pf_params routine invoked before slowpath start
42 	 */
43 	u16	num_cons;
44 
45 	/* per-VF number of CIDs */
46 	u8	num_vf_cons;
47 #define ETH_PF_PARAMS_VF_CONS_DEFAULT	(32)
48 
49 	/* To enable arfs, previous to HW-init a positive number needs to be
50 	 * set [as filters require allocated searcher ILT memory].
51 	 * This will set the maximal number of configured steering-filters.
52 	 */
53 	u32	num_arfs_filters;
54 };
55 
56 /* Most of the the parameters below are described in the FW FCoE HSI */
57 struct ecore_fcoe_pf_params {
58 	/* The following parameters are used during protocol-init */
59 	u64		glbl_q_params_addr;
60 	u64		bdq_pbl_base_addr[2];
61 
62 	/* The following parameters are used during HW-init
63 	 * and these parameters need to be passed as arguments
64 	 * to update_pf_params routine invoked before slowpath start
65 	 */
66 	u16		num_cons;
67 	u16		num_tasks;
68 
69 	/* The following parameters are used during protocol-init */
70 	u16		sq_num_pbl_pages;
71 
72 	u16		cq_num_entries;
73 	u16		cmdq_num_entries;
74 	u16		rq_buffer_log_size;
75 	u16		mtu;
76 	u16		dummy_icid;
77 	u16		bdq_xoff_threshold[2];
78 	u16		bdq_xon_threshold[2];
79 	u16		rq_buffer_size;
80 	u8		num_cqs; /* num of global CQs */
81 	u8		log_page_size;
82 	u8		gl_rq_pi;
83 	u8		gl_cmd_pi;
84 	u8		debug_mode;
85 	u8		is_target;
86 	u8		bdq_pbl_num_entries[2];
87 };
88 
89 /* Most of the the parameters below are described in the FW iSCSI / TCP HSI */
90 struct ecore_iscsi_pf_params {
91 	u64		glbl_q_params_addr;
92 	u64		bdq_pbl_base_addr[3];
93 	u16		cq_num_entries;
94 	u16		cmdq_num_entries;
95 	u32		two_msl_timer;
96 	u16		tx_sws_timer;
97 	/* The following parameters are used during HW-init
98 	 * and these parameters need to be passed as arguments
99 	 * to update_pf_params routine invoked before slowpath start
100 	 */
101 	u16		num_cons;
102 	u16		num_tasks;
103 
104 	/* The following parameters are used during protocol-init */
105 	u16		half_way_close_timeout;
106 	u16		bdq_xoff_threshold[3];
107 	u16		bdq_xon_threshold[3];
108 	u16		cmdq_xoff_threshold;
109 	u16		cmdq_xon_threshold;
110 	u16		rq_buffer_size;
111 
112 	u8		num_sq_pages_in_ring;
113 	u8		num_r2tq_pages_in_ring;
114 	u8		num_uhq_pages_in_ring;
115 	u8		num_queues;
116 	u8		log_page_size;
117 	u8		rqe_log_size;
118 	u8		max_fin_rt;
119 	u8		gl_rq_pi;
120 	u8		gl_cmd_pi;
121 	u8		debug_mode;
122 	u8		ll2_ooo_queue_id;
123 
124 	u8		is_target;
125 	u8		is_soc_en;
126 	u8		soc_num_of_blocks_log;
127 	u8		bdq_pbl_num_entries[3];
128 	u8		disable_stats_collection;
129 };
130 
131 enum ecore_rdma_protocol {
132 	ECORE_RDMA_PROTOCOL_DEFAULT,
133 	ECORE_RDMA_PROTOCOL_NONE,
134 	ECORE_RDMA_PROTOCOL_ROCE,
135 	ECORE_RDMA_PROTOCOL_IWARP,
136 };
137 
138 struct ecore_rdma_pf_params {
139 	/* Supplied to ECORE during resource allocation (may affect the ILT and
140 	 * the doorbell BAR).
141 	 */
142 	u32		min_dpis;	/* number of requested DPIs */
143 	u32		num_qps;	/* number of requested Queue Pairs */
144 	u32		num_srqs;	/* number of requested SRQs */
145 	u32		num_xrc_srqs;	/* number of requested XRC SRQs */
146 	u8		roce_edpm_mode; /* see QED_ROCE_EDPM_MODE_ENABLE */
147 	u8		gl_pi;		/* protocol index */
148 
149 	/* Will allocate rate limiters to be used with QPs */
150 	u8		enable_dcqcn;
151 
152 	/* Max number of CNQs - limits number of ECORE_RDMA_CNQ feature,
153 	 * Allowing an incrementation in ECORE_PF_L2_QUE.
154 	 * To disable CNQs, use dedicated value instead of `0'.
155 	 */
156 #define ECORE_RDMA_PF_PARAMS_CNQS_NONE	(0xffff)
157 	u16		max_cnqs;
158 
159 	/* TCP port number used for the iwarp traffic */
160 	u16		iwarp_port;
161 	enum ecore_rdma_protocol rdma_protocol;
162 };
163 
164 struct ecore_pf_params {
165 	struct ecore_eth_pf_params	eth_pf_params;
166 	struct ecore_fcoe_pf_params	fcoe_pf_params;
167 	struct ecore_iscsi_pf_params	iscsi_pf_params;
168 	struct ecore_rdma_pf_params	rdma_pf_params;
169 };
170 
171 #endif
172