1*14b24e2bSVaishali Kulkarni /*
2*14b24e2bSVaishali Kulkarni * CDDL HEADER START
3*14b24e2bSVaishali Kulkarni *
4*14b24e2bSVaishali Kulkarni * The contents of this file are subject to the terms of the
5*14b24e2bSVaishali Kulkarni * Common Development and Distribution License, v.1,  (the "License").
6*14b24e2bSVaishali Kulkarni * You may not use this file except in compliance with the License.
7*14b24e2bSVaishali Kulkarni *
8*14b24e2bSVaishali Kulkarni * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*14b24e2bSVaishali Kulkarni * or http://opensource.org/licenses/CDDL-1.0.
10*14b24e2bSVaishali Kulkarni * See the License for the specific language governing permissions
11*14b24e2bSVaishali Kulkarni * and limitations under the License.
12*14b24e2bSVaishali Kulkarni *
13*14b24e2bSVaishali Kulkarni * When distributing Covered Code, include this CDDL HEADER in each
14*14b24e2bSVaishali Kulkarni * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*14b24e2bSVaishali Kulkarni * If applicable, add the following below this CDDL HEADER, with the
16*14b24e2bSVaishali Kulkarni * fields enclosed by brackets "[]" replaced with your own identifying
17*14b24e2bSVaishali Kulkarni * information: Portions Copyright [yyyy] [name of copyright owner]
18*14b24e2bSVaishali Kulkarni *
19*14b24e2bSVaishali Kulkarni * CDDL HEADER END
20*14b24e2bSVaishali Kulkarni */
21*14b24e2bSVaishali Kulkarni 
22*14b24e2bSVaishali Kulkarni /*
23*14b24e2bSVaishali Kulkarni * Copyright 2014-2017 Cavium, Inc.
24*14b24e2bSVaishali Kulkarni * The contents of this file are subject to the terms of the Common Development
25*14b24e2bSVaishali Kulkarni * and Distribution License, v.1,  (the "License").
26*14b24e2bSVaishali Kulkarni 
27*14b24e2bSVaishali Kulkarni * You may not use this file except in compliance with the License.
28*14b24e2bSVaishali Kulkarni 
29*14b24e2bSVaishali Kulkarni * You can obtain a copy of the License at available
30*14b24e2bSVaishali Kulkarni * at http://opensource.org/licenses/CDDL-1.0
31*14b24e2bSVaishali Kulkarni 
32*14b24e2bSVaishali Kulkarni * See the License for the specific language governing permissions and
33*14b24e2bSVaishali Kulkarni * limitations under the License.
34*14b24e2bSVaishali Kulkarni */
35*14b24e2bSVaishali Kulkarni 
36*14b24e2bSVaishali Kulkarni #ifndef __ECORE_L2_API_H__
37*14b24e2bSVaishali Kulkarni #define __ECORE_L2_API_H__
38*14b24e2bSVaishali Kulkarni 
39*14b24e2bSVaishali Kulkarni #include "ecore_status.h"
40*14b24e2bSVaishali Kulkarni #include "ecore_sp_api.h"
41*14b24e2bSVaishali Kulkarni #include "ecore_int_api.h"
42*14b24e2bSVaishali Kulkarni 
43*14b24e2bSVaishali Kulkarni #ifndef __EXTRACT__LINUX__
44*14b24e2bSVaishali Kulkarni enum ecore_rss_caps {
45*14b24e2bSVaishali Kulkarni 	ECORE_RSS_IPV4		= 0x1,
46*14b24e2bSVaishali Kulkarni 	ECORE_RSS_IPV6		= 0x2,
47*14b24e2bSVaishali Kulkarni 	ECORE_RSS_IPV4_TCP	= 0x4,
48*14b24e2bSVaishali Kulkarni 	ECORE_RSS_IPV6_TCP	= 0x8,
49*14b24e2bSVaishali Kulkarni 	ECORE_RSS_IPV4_UDP	= 0x10,
50*14b24e2bSVaishali Kulkarni 	ECORE_RSS_IPV6_UDP	= 0x20,
51*14b24e2bSVaishali Kulkarni };
52*14b24e2bSVaishali Kulkarni 
53*14b24e2bSVaishali Kulkarni /* Should be the same as ETH_RSS_IND_TABLE_ENTRIES_NUM */
54*14b24e2bSVaishali Kulkarni #define ECORE_RSS_IND_TABLE_SIZE 128
55*14b24e2bSVaishali Kulkarni #define ECORE_RSS_KEY_SIZE 10 /* size in 32b chunks */
56*14b24e2bSVaishali Kulkarni 
57*14b24e2bSVaishali Kulkarni #define ECORE_MAX_PHC_DRIFT_PPB	291666666
58*14b24e2bSVaishali Kulkarni 
59*14b24e2bSVaishali Kulkarni enum ecore_ptp_filter_type {
60*14b24e2bSVaishali Kulkarni 	ECORE_PTP_FILTER_L2,
61*14b24e2bSVaishali Kulkarni 	ECORE_PTP_FILTER_IPV4,
62*14b24e2bSVaishali Kulkarni 	ECORE_PTP_FILTER_IPV4_IPV6,
63*14b24e2bSVaishali Kulkarni 	ECORE_PTP_FILTER_L2_IPV4_IPV6
64*14b24e2bSVaishali Kulkarni };
65*14b24e2bSVaishali Kulkarni 
66*14b24e2bSVaishali Kulkarni #endif
67*14b24e2bSVaishali Kulkarni 
68*14b24e2bSVaishali Kulkarni #ifndef __EXTRACT__LINUX__
69*14b24e2bSVaishali Kulkarni struct ecore_queue_start_common_params {
70*14b24e2bSVaishali Kulkarni 	/* Should always be relative to entity sending this. */
71*14b24e2bSVaishali Kulkarni 	u8 vport_id;
72*14b24e2bSVaishali Kulkarni 	u16 queue_id;
73*14b24e2bSVaishali Kulkarni 
74*14b24e2bSVaishali Kulkarni 	/* Relative, but relevant only for PFs */
75*14b24e2bSVaishali Kulkarni 	u8 stats_id;
76*14b24e2bSVaishali Kulkarni 
77*14b24e2bSVaishali Kulkarni 	struct ecore_sb_info *p_sb;
78*14b24e2bSVaishali Kulkarni 	u8 sb_idx;
79*14b24e2bSVaishali Kulkarni };
80*14b24e2bSVaishali Kulkarni 
81*14b24e2bSVaishali Kulkarni struct ecore_rxq_start_ret_params {
82*14b24e2bSVaishali Kulkarni 	void OSAL_IOMEM *p_prod;
83*14b24e2bSVaishali Kulkarni 	void *p_handle;
84*14b24e2bSVaishali Kulkarni };
85*14b24e2bSVaishali Kulkarni 
86*14b24e2bSVaishali Kulkarni struct ecore_txq_start_ret_params {
87*14b24e2bSVaishali Kulkarni 	void OSAL_IOMEM *p_doorbell;
88*14b24e2bSVaishali Kulkarni 	void *p_handle;
89*14b24e2bSVaishali Kulkarni };
90*14b24e2bSVaishali Kulkarni #endif
91*14b24e2bSVaishali Kulkarni 
92*14b24e2bSVaishali Kulkarni struct ecore_rss_params {
93*14b24e2bSVaishali Kulkarni 	u8 update_rss_config;
94*14b24e2bSVaishali Kulkarni 	u8 rss_enable;
95*14b24e2bSVaishali Kulkarni 	u8 rss_eng_id;
96*14b24e2bSVaishali Kulkarni 	u8 update_rss_capabilities;
97*14b24e2bSVaishali Kulkarni 	u8 update_rss_ind_table;
98*14b24e2bSVaishali Kulkarni 	u8 update_rss_key;
99*14b24e2bSVaishali Kulkarni 	u8 rss_caps;
100*14b24e2bSVaishali Kulkarni 	u8 rss_table_size_log; /* The table size is 2 ^ rss_table_size_log */
101*14b24e2bSVaishali Kulkarni 
102*14b24e2bSVaishali Kulkarni 	/* Indirection table consist of rx queue handles */
103*14b24e2bSVaishali Kulkarni 	void *rss_ind_table[ECORE_RSS_IND_TABLE_SIZE];
104*14b24e2bSVaishali Kulkarni 	u32 rss_key[ECORE_RSS_KEY_SIZE];
105*14b24e2bSVaishali Kulkarni };
106*14b24e2bSVaishali Kulkarni 
107*14b24e2bSVaishali Kulkarni struct ecore_sge_tpa_params {
108*14b24e2bSVaishali Kulkarni 	u8 max_buffers_per_cqe;
109*14b24e2bSVaishali Kulkarni 
110*14b24e2bSVaishali Kulkarni 	u8 update_tpa_en_flg;
111*14b24e2bSVaishali Kulkarni 	u8 tpa_ipv4_en_flg;
112*14b24e2bSVaishali Kulkarni 	u8 tpa_ipv6_en_flg;
113*14b24e2bSVaishali Kulkarni 	u8 tpa_ipv4_tunn_en_flg;
114*14b24e2bSVaishali Kulkarni 	u8 tpa_ipv6_tunn_en_flg;
115*14b24e2bSVaishali Kulkarni 
116*14b24e2bSVaishali Kulkarni 	u8 update_tpa_param_flg;
117*14b24e2bSVaishali Kulkarni 	u8 tpa_pkt_split_flg;
118*14b24e2bSVaishali Kulkarni 	u8 tpa_hdr_data_split_flg;
119*14b24e2bSVaishali Kulkarni 	u8 tpa_gro_consistent_flg;
120*14b24e2bSVaishali Kulkarni 	u8 tpa_max_aggs_num;
121*14b24e2bSVaishali Kulkarni 	u16 tpa_max_size;
122*14b24e2bSVaishali Kulkarni 	u16 tpa_min_size_to_start;
123*14b24e2bSVaishali Kulkarni 	u16 tpa_min_size_to_cont;
124*14b24e2bSVaishali Kulkarni };
125*14b24e2bSVaishali Kulkarni 
126*14b24e2bSVaishali Kulkarni enum ecore_filter_opcode {
127*14b24e2bSVaishali Kulkarni 	ECORE_FILTER_ADD,
128*14b24e2bSVaishali Kulkarni 	ECORE_FILTER_REMOVE,
129*14b24e2bSVaishali Kulkarni 	ECORE_FILTER_MOVE,
130*14b24e2bSVaishali Kulkarni 	ECORE_FILTER_REPLACE, /* Delete all MACs and add new one instead */
131*14b24e2bSVaishali Kulkarni 	ECORE_FILTER_FLUSH, /* Removes all filters */
132*14b24e2bSVaishali Kulkarni };
133*14b24e2bSVaishali Kulkarni 
134*14b24e2bSVaishali Kulkarni enum ecore_filter_ucast_type {
135*14b24e2bSVaishali Kulkarni 	ECORE_FILTER_MAC,
136*14b24e2bSVaishali Kulkarni 	ECORE_FILTER_VLAN,
137*14b24e2bSVaishali Kulkarni 	ECORE_FILTER_MAC_VLAN,
138*14b24e2bSVaishali Kulkarni 	ECORE_FILTER_INNER_MAC,
139*14b24e2bSVaishali Kulkarni 	ECORE_FILTER_INNER_VLAN,
140*14b24e2bSVaishali Kulkarni 	ECORE_FILTER_INNER_PAIR,
141*14b24e2bSVaishali Kulkarni 	ECORE_FILTER_INNER_MAC_VNI_PAIR,
142*14b24e2bSVaishali Kulkarni 	ECORE_FILTER_MAC_VNI_PAIR,
143*14b24e2bSVaishali Kulkarni 	ECORE_FILTER_VNI,
144*14b24e2bSVaishali Kulkarni };
145*14b24e2bSVaishali Kulkarni 
146*14b24e2bSVaishali Kulkarni struct ecore_filter_ucast {
147*14b24e2bSVaishali Kulkarni 	enum ecore_filter_opcode opcode;
148*14b24e2bSVaishali Kulkarni 	enum ecore_filter_ucast_type type;
149*14b24e2bSVaishali Kulkarni 	u8 is_rx_filter;
150*14b24e2bSVaishali Kulkarni 	u8 is_tx_filter;
151*14b24e2bSVaishali Kulkarni 	u8 vport_to_add_to;
152*14b24e2bSVaishali Kulkarni 	u8 vport_to_remove_from;
153*14b24e2bSVaishali Kulkarni 	unsigned char mac[ETH_ALEN];
154*14b24e2bSVaishali Kulkarni 	u8 assert_on_error;
155*14b24e2bSVaishali Kulkarni 	u16 vlan;
156*14b24e2bSVaishali Kulkarni 	u32 vni;
157*14b24e2bSVaishali Kulkarni };
158*14b24e2bSVaishali Kulkarni 
159*14b24e2bSVaishali Kulkarni struct ecore_filter_mcast {
160*14b24e2bSVaishali Kulkarni 	/* MOVE is not supported for multicast */
161*14b24e2bSVaishali Kulkarni 	enum ecore_filter_opcode opcode;
162*14b24e2bSVaishali Kulkarni 	u8 vport_to_add_to;
163*14b24e2bSVaishali Kulkarni 	u8 vport_to_remove_from;
164*14b24e2bSVaishali Kulkarni 	u8	num_mc_addrs;
165*14b24e2bSVaishali Kulkarni #define ECORE_MAX_MC_ADDRS	64
166*14b24e2bSVaishali Kulkarni 	unsigned char mac[ECORE_MAX_MC_ADDRS][ETH_ALEN];
167*14b24e2bSVaishali Kulkarni };
168*14b24e2bSVaishali Kulkarni 
169*14b24e2bSVaishali Kulkarni struct ecore_filter_accept_flags {
170*14b24e2bSVaishali Kulkarni 	u8 update_rx_mode_config;
171*14b24e2bSVaishali Kulkarni 	u8 update_tx_mode_config;
172*14b24e2bSVaishali Kulkarni 	u8 rx_accept_filter;
173*14b24e2bSVaishali Kulkarni 	u8 tx_accept_filter;
174*14b24e2bSVaishali Kulkarni #define	ECORE_ACCEPT_NONE		0x01
175*14b24e2bSVaishali Kulkarni #define ECORE_ACCEPT_UCAST_MATCHED	0x02
176*14b24e2bSVaishali Kulkarni #define ECORE_ACCEPT_UCAST_UNMATCHED	0x04
177*14b24e2bSVaishali Kulkarni #define ECORE_ACCEPT_MCAST_MATCHED	0x08
178*14b24e2bSVaishali Kulkarni #define ECORE_ACCEPT_MCAST_UNMATCHED	0x10
179*14b24e2bSVaishali Kulkarni #define ECORE_ACCEPT_BCAST		0x20
180*14b24e2bSVaishali Kulkarni };
181*14b24e2bSVaishali Kulkarni 
182*14b24e2bSVaishali Kulkarni struct ecore_arfs_config_params {
183*14b24e2bSVaishali Kulkarni 	bool tcp;
184*14b24e2bSVaishali Kulkarni 	bool udp;
185*14b24e2bSVaishali Kulkarni 	bool ipv4;
186*14b24e2bSVaishali Kulkarni 	bool ipv6;
187*14b24e2bSVaishali Kulkarni 	bool arfs_enable;	/* Enable or disable arfs mode */
188*14b24e2bSVaishali Kulkarni };
189*14b24e2bSVaishali Kulkarni 
190*14b24e2bSVaishali Kulkarni /* Add / remove / move / remove-all unicast MAC-VLAN filters.
191*14b24e2bSVaishali Kulkarni  * FW will assert in the following cases, so driver should take care...:
192*14b24e2bSVaishali Kulkarni  * 1. Adding a filter to a full table.
193*14b24e2bSVaishali Kulkarni  * 2. Adding a filter which already exists on that vport.
194*14b24e2bSVaishali Kulkarni  * 3. Removing a filter which doesn't exist.
195*14b24e2bSVaishali Kulkarni  */
196*14b24e2bSVaishali Kulkarni 
197*14b24e2bSVaishali Kulkarni enum _ecore_status_t
198*14b24e2bSVaishali Kulkarni ecore_filter_ucast_cmd(struct ecore_dev *p_dev,
199*14b24e2bSVaishali Kulkarni 		       struct ecore_filter_ucast *p_filter_cmd,
200*14b24e2bSVaishali Kulkarni 		       enum spq_mode comp_mode,
201*14b24e2bSVaishali Kulkarni 		       struct ecore_spq_comp_cb *p_comp_data);
202*14b24e2bSVaishali Kulkarni 
203*14b24e2bSVaishali Kulkarni /* Add / remove / move multicast MAC filters. */
204*14b24e2bSVaishali Kulkarni enum _ecore_status_t
205*14b24e2bSVaishali Kulkarni ecore_filter_mcast_cmd(struct ecore_dev *p_dev,
206*14b24e2bSVaishali Kulkarni 		       struct ecore_filter_mcast *p_filter_cmd,
207*14b24e2bSVaishali Kulkarni 		       enum spq_mode comp_mode,
208*14b24e2bSVaishali Kulkarni 		       struct ecore_spq_comp_cb *p_comp_data);
209*14b24e2bSVaishali Kulkarni 
210*14b24e2bSVaishali Kulkarni /* Set "accept" filters */
211*14b24e2bSVaishali Kulkarni enum _ecore_status_t
212*14b24e2bSVaishali Kulkarni ecore_filter_accept_cmd(
213*14b24e2bSVaishali Kulkarni 	struct ecore_dev		 *p_dev,
214*14b24e2bSVaishali Kulkarni 	u8				 vport,
215*14b24e2bSVaishali Kulkarni 	struct ecore_filter_accept_flags accept_flags,
216*14b24e2bSVaishali Kulkarni 	u8				 update_accept_any_vlan,
217*14b24e2bSVaishali Kulkarni 	u8				 accept_any_vlan,
218*14b24e2bSVaishali Kulkarni 	enum spq_mode			 comp_mode,
219*14b24e2bSVaishali Kulkarni 	struct ecore_spq_comp_cb	 *p_comp_data);
220*14b24e2bSVaishali Kulkarni 
221*14b24e2bSVaishali Kulkarni /**
222*14b24e2bSVaishali Kulkarni  * @brief ecore_eth_rx_queue_start - RX Queue Start Ramrod
223*14b24e2bSVaishali Kulkarni  *
224*14b24e2bSVaishali Kulkarni  * This ramrod initializes an RX Queue for a VPort. An Assert is generated if
225*14b24e2bSVaishali Kulkarni  * the VPort ID is not currently initialized.
226*14b24e2bSVaishali Kulkarni  *
227*14b24e2bSVaishali Kulkarni  * @param p_hwfn
228*14b24e2bSVaishali Kulkarni  * @param opaque_fid
229*14b24e2bSVaishali Kulkarni  * @p_params			Inputs; Relative for PF [SB being an exception]
230*14b24e2bSVaishali Kulkarni  * @param bd_max_bytes 		Maximum bytes that can be placed on a BD
231*14b24e2bSVaishali Kulkarni  * @param bd_chain_phys_addr	Physical address of BDs for receive.
232*14b24e2bSVaishali Kulkarni  * @param cqe_pbl_addr		Physical address of the CQE PBL Table.
233*14b24e2bSVaishali Kulkarni  * @param cqe_pbl_size 		Size of the CQE PBL Table
234*14b24e2bSVaishali Kulkarni  * @param p_ret_params		Pointed struct to be filled with outputs.
235*14b24e2bSVaishali Kulkarni  *
236*14b24e2bSVaishali Kulkarni  * @return enum _ecore_status_t
237*14b24e2bSVaishali Kulkarni  */
238*14b24e2bSVaishali Kulkarni enum _ecore_status_t
239*14b24e2bSVaishali Kulkarni ecore_eth_rx_queue_start(struct ecore_hwfn *p_hwfn,
240*14b24e2bSVaishali Kulkarni 			 u16 opaque_fid,
241*14b24e2bSVaishali Kulkarni 			 struct ecore_queue_start_common_params *p_params,
242*14b24e2bSVaishali Kulkarni 			 u16 bd_max_bytes,
243*14b24e2bSVaishali Kulkarni 			 dma_addr_t bd_chain_phys_addr,
244*14b24e2bSVaishali Kulkarni 			 dma_addr_t cqe_pbl_addr,
245*14b24e2bSVaishali Kulkarni 			 u16 cqe_pbl_size,
246*14b24e2bSVaishali Kulkarni 			 struct ecore_rxq_start_ret_params *p_ret_params);
247*14b24e2bSVaishali Kulkarni 
248*14b24e2bSVaishali Kulkarni /**
249*14b24e2bSVaishali Kulkarni  * @brief ecore_eth_rx_queue_stop - This ramrod closes an Rx queue
250*14b24e2bSVaishali Kulkarni  *
251*14b24e2bSVaishali Kulkarni  * @param p_hwfn
252*14b24e2bSVaishali Kulkarni  * @param p_rxq			Handler of queue to close
253*14b24e2bSVaishali Kulkarni  * @param eq_completion_only	If True completion will be on
254*14b24e2bSVaishali Kulkarni  *				EQe, if False completion will be
255*14b24e2bSVaishali Kulkarni  *				on EQe if p_hwfn opaque
256*14b24e2bSVaishali Kulkarni  *				different from the RXQ opaque
257*14b24e2bSVaishali Kulkarni  *				otherwise on CQe.
258*14b24e2bSVaishali Kulkarni  * @param cqe_completion	If True completion will be
259*14b24e2bSVaishali Kulkarni  *				recieve on CQe.
260*14b24e2bSVaishali Kulkarni  * @return enum _ecore_status_t
261*14b24e2bSVaishali Kulkarni  */
262*14b24e2bSVaishali Kulkarni enum _ecore_status_t
263*14b24e2bSVaishali Kulkarni ecore_eth_rx_queue_stop(struct ecore_hwfn *p_hwfn,
264*14b24e2bSVaishali Kulkarni 			void *p_rxq,
265*14b24e2bSVaishali Kulkarni 			bool eq_completion_only,
266*14b24e2bSVaishali Kulkarni 			bool cqe_completion);
267*14b24e2bSVaishali Kulkarni 
268*14b24e2bSVaishali Kulkarni /**
269*14b24e2bSVaishali Kulkarni  * @brief - TX Queue Start Ramrod
270*14b24e2bSVaishali Kulkarni  *
271*14b24e2bSVaishali Kulkarni  * This ramrod initializes a TX Queue for a VPort. An Assert is generated if
272*14b24e2bSVaishali Kulkarni  * the VPort is not currently initialized.
273*14b24e2bSVaishali Kulkarni  *
274*14b24e2bSVaishali Kulkarni  * @param p_hwfn
275*14b24e2bSVaishali Kulkarni  * @param opaque_fid
276*14b24e2bSVaishali Kulkarni  * @p_params
277*14b24e2bSVaishali Kulkarni  * @param tc			traffic class to use with this L2 txq
278*14b24e2bSVaishali Kulkarni  * @param pbl_addr		address of the pbl array
279*14b24e2bSVaishali Kulkarni  * @param pbl_size 		number of entries in pbl
280*14b24e2bSVaishali Kulkarni  * @oaram p_ret_params		Pointer to fill the return parameters in.
281*14b24e2bSVaishali Kulkarni  *
282*14b24e2bSVaishali Kulkarni  * @return enum _ecore_status_t
283*14b24e2bSVaishali Kulkarni  */
284*14b24e2bSVaishali Kulkarni enum _ecore_status_t
285*14b24e2bSVaishali Kulkarni ecore_eth_tx_queue_start(struct ecore_hwfn *p_hwfn,
286*14b24e2bSVaishali Kulkarni 			 u16 opaque_fid,
287*14b24e2bSVaishali Kulkarni 			 struct ecore_queue_start_common_params *p_params,
288*14b24e2bSVaishali Kulkarni 			 u8 tc,
289*14b24e2bSVaishali Kulkarni 			 dma_addr_t pbl_addr,
290*14b24e2bSVaishali Kulkarni 			 u16 pbl_size,
291*14b24e2bSVaishali Kulkarni 			 struct ecore_txq_start_ret_params *p_ret_params);
292*14b24e2bSVaishali Kulkarni 
293*14b24e2bSVaishali Kulkarni /**
294*14b24e2bSVaishali Kulkarni  * @brief ecore_eth_tx_queue_stop - closes a Tx queue
295*14b24e2bSVaishali Kulkarni  *
296*14b24e2bSVaishali Kulkarni  * @param p_hwfn
297*14b24e2bSVaishali Kulkarni  * @param p_txq - handle to Tx queue needed to be closed
298*14b24e2bSVaishali Kulkarni  *
299*14b24e2bSVaishali Kulkarni  * @return enum _ecore_status_t
300*14b24e2bSVaishali Kulkarni  */
301*14b24e2bSVaishali Kulkarni enum _ecore_status_t ecore_eth_tx_queue_stop(struct ecore_hwfn *p_hwfn,
302*14b24e2bSVaishali Kulkarni 					     void *p_txq);
303*14b24e2bSVaishali Kulkarni 
304*14b24e2bSVaishali Kulkarni enum ecore_tpa_mode	{
305*14b24e2bSVaishali Kulkarni 	ECORE_TPA_MODE_NONE,
306*14b24e2bSVaishali Kulkarni 	ECORE_TPA_MODE_RSC,
307*14b24e2bSVaishali Kulkarni 	ECORE_TPA_MODE_GRO,
308*14b24e2bSVaishali Kulkarni 	ECORE_TPA_MODE_MAX
309*14b24e2bSVaishali Kulkarni };
310*14b24e2bSVaishali Kulkarni 
311*14b24e2bSVaishali Kulkarni struct ecore_sp_vport_start_params {
312*14b24e2bSVaishali Kulkarni 	enum ecore_tpa_mode tpa_mode;
313*14b24e2bSVaishali Kulkarni 	bool remove_inner_vlan;	/* Inner VLAN removal is enabled */
314*14b24e2bSVaishali Kulkarni 	bool tx_switching;	/* Vport supports tx-switching */
315*14b24e2bSVaishali Kulkarni 	bool handle_ptp_pkts;	/* Handle PTP packets */
316*14b24e2bSVaishali Kulkarni 	bool only_untagged;	/* Untagged pkt control */
317*14b24e2bSVaishali Kulkarni 	bool drop_ttl0;		/* Drop packets with TTL = 0 */
318*14b24e2bSVaishali Kulkarni 	u8 max_buffers_per_cqe;
319*14b24e2bSVaishali Kulkarni 	u32 concrete_fid;
320*14b24e2bSVaishali Kulkarni 	u16 opaque_fid;
321*14b24e2bSVaishali Kulkarni 	u8 vport_id;		/* VPORT ID */
322*14b24e2bSVaishali Kulkarni 	u16 mtu;		/* VPORT MTU */
323*14b24e2bSVaishali Kulkarni 	bool zero_placement_offset;
324*14b24e2bSVaishali Kulkarni 	bool check_mac;
325*14b24e2bSVaishali Kulkarni 	bool check_ethtype;
326*14b24e2bSVaishali Kulkarni 
327*14b24e2bSVaishali Kulkarni 	/* Strict behavior on transmission errors */
328*14b24e2bSVaishali Kulkarni 	bool b_err_illegal_vlan_mode;
329*14b24e2bSVaishali Kulkarni 	bool b_err_illegal_inband_mode;
330*14b24e2bSVaishali Kulkarni 	bool b_err_vlan_insert_with_inband;
331*14b24e2bSVaishali Kulkarni 	bool b_err_small_pkt;
332*14b24e2bSVaishali Kulkarni 	bool b_err_big_pkt;
333*14b24e2bSVaishali Kulkarni 	bool b_err_anti_spoof;
334*14b24e2bSVaishali Kulkarni 	bool b_err_ctrl_frame;
335*14b24e2bSVaishali Kulkarni };
336*14b24e2bSVaishali Kulkarni 
337*14b24e2bSVaishali Kulkarni /**
338*14b24e2bSVaishali Kulkarni  * @brief ecore_sp_vport_start -
339*14b24e2bSVaishali Kulkarni  *
340*14b24e2bSVaishali Kulkarni  * This ramrod initializes a VPort. An Assert if generated if the Function ID
341*14b24e2bSVaishali Kulkarni  * of the VPort is not enabled.
342*14b24e2bSVaishali Kulkarni  *
343*14b24e2bSVaishali Kulkarni  * @param p_hwfn
344*14b24e2bSVaishali Kulkarni  * @param p_params		VPORT start params
345*14b24e2bSVaishali Kulkarni  *
346*14b24e2bSVaishali Kulkarni  * @return enum _ecore_status_t
347*14b24e2bSVaishali Kulkarni  */
348*14b24e2bSVaishali Kulkarni enum _ecore_status_t
349*14b24e2bSVaishali Kulkarni ecore_sp_vport_start(struct ecore_hwfn *p_hwfn,
350*14b24e2bSVaishali Kulkarni 		     struct ecore_sp_vport_start_params *p_params);
351*14b24e2bSVaishali Kulkarni 
352*14b24e2bSVaishali Kulkarni struct ecore_sp_vport_update_params {
353*14b24e2bSVaishali Kulkarni 	u16			opaque_fid;
354*14b24e2bSVaishali Kulkarni 	u8			vport_id;
355*14b24e2bSVaishali Kulkarni 	u8			update_vport_active_rx_flg;
356*14b24e2bSVaishali Kulkarni 	u8			vport_active_rx_flg;
357*14b24e2bSVaishali Kulkarni 	u8			update_vport_active_tx_flg;
358*14b24e2bSVaishali Kulkarni 	u8			vport_active_tx_flg;
359*14b24e2bSVaishali Kulkarni 	u8			update_inner_vlan_removal_flg;
360*14b24e2bSVaishali Kulkarni 	u8			inner_vlan_removal_flg;
361*14b24e2bSVaishali Kulkarni 	u8			silent_vlan_removal_flg;
362*14b24e2bSVaishali Kulkarni 	u8			update_default_vlan_enable_flg;
363*14b24e2bSVaishali Kulkarni 	u8			default_vlan_enable_flg;
364*14b24e2bSVaishali Kulkarni 	u8			update_default_vlan_flg;
365*14b24e2bSVaishali Kulkarni 	u16			default_vlan;
366*14b24e2bSVaishali Kulkarni 	u8			update_tx_switching_flg;
367*14b24e2bSVaishali Kulkarni 	u8			tx_switching_flg;
368*14b24e2bSVaishali Kulkarni 	u8			update_approx_mcast_flg;
369*14b24e2bSVaishali Kulkarni 	u8			update_anti_spoofing_en_flg;
370*14b24e2bSVaishali Kulkarni 	u8			anti_spoofing_en;
371*14b24e2bSVaishali Kulkarni 	u8			update_accept_any_vlan_flg;
372*14b24e2bSVaishali Kulkarni 	u8			accept_any_vlan;
373*14b24e2bSVaishali Kulkarni 	unsigned long		bins[8];
374*14b24e2bSVaishali Kulkarni 	struct ecore_rss_params	*rss_params;
375*14b24e2bSVaishali Kulkarni 	struct ecore_filter_accept_flags accept_flags;
376*14b24e2bSVaishali Kulkarni 	struct ecore_sge_tpa_params *sge_tpa_params;
377*14b24e2bSVaishali Kulkarni };
378*14b24e2bSVaishali Kulkarni 
379*14b24e2bSVaishali Kulkarni /**
380*14b24e2bSVaishali Kulkarni  * @brief ecore_sp_vport_update -
381*14b24e2bSVaishali Kulkarni  *
382*14b24e2bSVaishali Kulkarni  * This ramrod updates the parameters of the VPort. Every field can be updated
383*14b24e2bSVaishali Kulkarni  * independently, according to flags.
384*14b24e2bSVaishali Kulkarni  *
385*14b24e2bSVaishali Kulkarni  * This ramrod is also used to set the VPort state to active after creation.
386*14b24e2bSVaishali Kulkarni  * An Assert is generated if the VPort does not contain an RX queue.
387*14b24e2bSVaishali Kulkarni  *
388*14b24e2bSVaishali Kulkarni  * @param p_hwfn
389*14b24e2bSVaishali Kulkarni  * @param p_params
390*14b24e2bSVaishali Kulkarni  *
391*14b24e2bSVaishali Kulkarni  * @return enum _ecore_status_t
392*14b24e2bSVaishali Kulkarni  */
393*14b24e2bSVaishali Kulkarni enum _ecore_status_t
394*14b24e2bSVaishali Kulkarni ecore_sp_vport_update(struct ecore_hwfn *p_hwfn,
395*14b24e2bSVaishali Kulkarni 		      struct ecore_sp_vport_update_params *p_params,
396*14b24e2bSVaishali Kulkarni 		      enum spq_mode comp_mode,
397*14b24e2bSVaishali Kulkarni 		      struct ecore_spq_comp_cb *p_comp_data);
398*14b24e2bSVaishali Kulkarni /**
399*14b24e2bSVaishali Kulkarni  * @brief ecore_sp_vport_stop -
400*14b24e2bSVaishali Kulkarni  *
401*14b24e2bSVaishali Kulkarni  * This ramrod closes a VPort after all its RX and TX queues are terminated.
402*14b24e2bSVaishali Kulkarni  * An Assert is generated if any queues are left open.
403*14b24e2bSVaishali Kulkarni  *
404*14b24e2bSVaishali Kulkarni  * @param p_hwfn
405*14b24e2bSVaishali Kulkarni  * @param opaque_fid
406*14b24e2bSVaishali Kulkarni  * @param vport_id VPort ID
407*14b24e2bSVaishali Kulkarni  *
408*14b24e2bSVaishali Kulkarni  * @return enum _ecore_status_t
409*14b24e2bSVaishali Kulkarni  */
410*14b24e2bSVaishali Kulkarni enum _ecore_status_t ecore_sp_vport_stop(struct ecore_hwfn *p_hwfn,
411*14b24e2bSVaishali Kulkarni 					 u16 opaque_fid,
412*14b24e2bSVaishali Kulkarni 					 u8 vport_id);
413*14b24e2bSVaishali Kulkarni 
414*14b24e2bSVaishali Kulkarni enum _ecore_status_t
415*14b24e2bSVaishali Kulkarni ecore_sp_eth_filter_ucast(struct ecore_hwfn *p_hwfn,
416*14b24e2bSVaishali Kulkarni 			  u16 opaque_fid,
417*14b24e2bSVaishali Kulkarni 			  struct ecore_filter_ucast *p_filter_cmd,
418*14b24e2bSVaishali Kulkarni 			  enum spq_mode comp_mode,
419*14b24e2bSVaishali Kulkarni 			  struct ecore_spq_comp_cb *p_comp_data);
420*14b24e2bSVaishali Kulkarni 
421*14b24e2bSVaishali Kulkarni /**
422*14b24e2bSVaishali Kulkarni  * @brief ecore_sp_rx_eth_queues_update -
423*14b24e2bSVaishali Kulkarni  *
424*14b24e2bSVaishali Kulkarni  * This ramrod updates an RX queue. It is used for setting the active state
425*14b24e2bSVaishali Kulkarni  * of the queue and updating the TPA and SGE parameters.
426*14b24e2bSVaishali Kulkarni  *
427*14b24e2bSVaishali Kulkarni  * @note Final phase API.
428*14b24e2bSVaishali Kulkarni  *
429*14b24e2bSVaishali Kulkarni  * @param p_hwfn
430*14b24e2bSVaishali Kulkarni  * @param pp_rxq_handlers	An array of queue handlers to be updated.
431*14b24e2bSVaishali Kulkarni  * @param num_rxqs              number of queues to update.
432*14b24e2bSVaishali Kulkarni  * @param complete_cqe_flg	Post completion to the CQE Ring if set
433*14b24e2bSVaishali Kulkarni  * @param complete_event_flg	Post completion to the Event Ring if set
434*14b24e2bSVaishali Kulkarni  * @param comp_mode
435*14b24e2bSVaishali Kulkarni  * @param p_comp_data
436*14b24e2bSVaishali Kulkarni  *
437*14b24e2bSVaishali Kulkarni  * @return enum _ecore_status_t
438*14b24e2bSVaishali Kulkarni  */
439*14b24e2bSVaishali Kulkarni 
440*14b24e2bSVaishali Kulkarni enum _ecore_status_t
441*14b24e2bSVaishali Kulkarni ecore_sp_eth_rx_queues_update(struct ecore_hwfn *p_hwfn,
442*14b24e2bSVaishali Kulkarni 			      void **pp_rxq_handlers,
443*14b24e2bSVaishali Kulkarni 			      u8 num_rxqs,
444*14b24e2bSVaishali Kulkarni 			      u8 complete_cqe_flg,
445*14b24e2bSVaishali Kulkarni 			      u8 complete_event_flg,
446*14b24e2bSVaishali Kulkarni 			      enum spq_mode comp_mode,
447*14b24e2bSVaishali Kulkarni 			      struct ecore_spq_comp_cb *p_comp_data);
448*14b24e2bSVaishali Kulkarni 
449*14b24e2bSVaishali Kulkarni void __ecore_get_vport_stats(struct ecore_hwfn *p_hwfn,
450*14b24e2bSVaishali Kulkarni 			     struct ecore_ptt *p_ptt,
451*14b24e2bSVaishali Kulkarni 			     struct ecore_eth_stats *stats,
452*14b24e2bSVaishali Kulkarni 			     u16 statistics_bin, bool b_get_port_stats);
453*14b24e2bSVaishali Kulkarni 
454*14b24e2bSVaishali Kulkarni void ecore_get_vport_stats(struct ecore_dev *p_dev,
455*14b24e2bSVaishali Kulkarni 			   struct ecore_eth_stats *stats);
456*14b24e2bSVaishali Kulkarni 
457*14b24e2bSVaishali Kulkarni void ecore_reset_vport_stats(struct ecore_dev *p_dev);
458*14b24e2bSVaishali Kulkarni 
459*14b24e2bSVaishali Kulkarni /**
460*14b24e2bSVaishali Kulkarni  *@brief ecore_arfs_mode_configure -
461*14b24e2bSVaishali Kulkarni  *
462*14b24e2bSVaishali Kulkarni  *Enable or disable rfs mode. It must accept atleast one of tcp or udp true
463*14b24e2bSVaishali Kulkarni  *and atleast one of ipv4 or ipv6 true to enable rfs mode.
464*14b24e2bSVaishali Kulkarni  *
465*14b24e2bSVaishali Kulkarni  *@param p_hwfn
466*14b24e2bSVaishali Kulkarni  *@param p_ptt
467*14b24e2bSVaishali Kulkarni  *@param p_cfg_params		arfs mode configuration parameters.
468*14b24e2bSVaishali Kulkarni  *
469*14b24e2bSVaishali Kulkarni  */
470*14b24e2bSVaishali Kulkarni void ecore_arfs_mode_configure(struct ecore_hwfn *p_hwfn,
471*14b24e2bSVaishali Kulkarni 			       struct ecore_ptt *p_ptt,
472*14b24e2bSVaishali Kulkarni 			       struct ecore_arfs_config_params *p_cfg_params);
473*14b24e2bSVaishali Kulkarni #endif