xref: /freebsd/sys/dev/qlnx/qlnxe/ecore_proto_if.h (revision 4d846d26)
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$
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 
40 struct 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 */
59 struct 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 */
92 struct ecore_iscsi_pf_params {
93 	u64		glbl_q_params_addr;
94 	u64		bdq_pbl_base_addr[3];
95 	u16		cq_num_entries;
96 	u16		cmdq_num_entries;
97 	u32		two_msl_timer;
98 	u16		tx_sws_timer;
99 	/* The following parameters are used during HW-init
100 	 * and these parameters need to be passed as arguments
101 	 * to update_pf_params routine invoked before slowpath start
102 	 */
103 	u16		num_cons;
104 	u16		num_tasks;
105 
106 	/* The following parameters are used during protocol-init */
107 	u16		half_way_close_timeout;
108 	u16		bdq_xoff_threshold[3];
109 	u16		bdq_xon_threshold[3];
110 	u16		cmdq_xoff_threshold;
111 	u16		cmdq_xon_threshold;
112 	u16		rq_buffer_size;
113 
114 	u8		num_sq_pages_in_ring;
115 	u8		num_r2tq_pages_in_ring;
116 	u8		num_uhq_pages_in_ring;
117 	u8		num_queues;
118 	u8		log_page_size;
119 	u8		rqe_log_size;
120 	u8		max_fin_rt;
121 	u8		gl_rq_pi;
122 	u8		gl_cmd_pi;
123 	u8		debug_mode;
124 	u8		ll2_ooo_queue_id;
125 
126 	u8		is_target;
127 	u8		is_soc_en;
128 	u8		soc_num_of_blocks_log;
129 	u8		bdq_pbl_num_entries[3];
130 	u8		disable_stats_collection;
131 };
132 
133 enum ecore_rdma_protocol {
134 	ECORE_RDMA_PROTOCOL_DEFAULT,
135 	ECORE_RDMA_PROTOCOL_NONE,
136 	ECORE_RDMA_PROTOCOL_ROCE,
137 	ECORE_RDMA_PROTOCOL_IWARP,
138 };
139 
140 struct ecore_rdma_pf_params {
141 	/* Supplied to ECORE during resource allocation (may affect the ILT and
142 	 * the doorbell BAR).
143 	 */
144 	u32		min_dpis;	/* number of requested DPIs */
145 	u32		num_qps;	/* number of requested Queue Pairs */
146 	u32		num_srqs;	/* number of requested SRQs */
147 	u32		num_xrc_srqs;	/* number of requested XRC SRQs */
148 	u8		roce_edpm_mode; /* see QED_ROCE_EDPM_MODE_ENABLE */
149 	u8		gl_pi;		/* protocol index */
150 
151 	/* Will allocate rate limiters to be used with QPs */
152 	u8		enable_dcqcn;
153 
154 	/* Max number of CNQs - limits number of ECORE_RDMA_CNQ feature,
155 	 * Allowing an incrementation in ECORE_PF_L2_QUE.
156 	 * To disable CNQs, use dedicated value instead of `0'.
157 	 */
158 #define ECORE_RDMA_PF_PARAMS_CNQS_NONE	(0xffff)
159 	u16		max_cnqs;
160 
161 	/* TCP port number used for the iwarp traffic */
162 	u16		iwarp_port;
163 	enum ecore_rdma_protocol rdma_protocol;
164 };
165 
166 struct ecore_pf_params {
167 	struct ecore_eth_pf_params	eth_pf_params;
168 	struct ecore_fcoe_pf_params	fcoe_pf_params;
169 	struct ecore_iscsi_pf_params	iscsi_pf_params;
170 	struct ecore_rdma_pf_params	rdma_pf_params;
171 };
172 
173 #endif
174