xref: /freebsd/sys/dev/qlnx/qlnxe/ecore_l2_api.h (revision 95ee2897)
111e25f0dSDavid C Somayajulu /*
211e25f0dSDavid C Somayajulu  * Copyright (c) 2017-2018 Cavium, Inc.
311e25f0dSDavid C Somayajulu  * All rights reserved.
411e25f0dSDavid C Somayajulu  *
511e25f0dSDavid C Somayajulu  *  Redistribution and use in source and binary forms, with or without
611e25f0dSDavid C Somayajulu  *  modification, are permitted provided that the following conditions
711e25f0dSDavid C Somayajulu  *  are met:
811e25f0dSDavid C Somayajulu  *
911e25f0dSDavid C Somayajulu  *  1. Redistributions of source code must retain the above copyright
1011e25f0dSDavid C Somayajulu  *     notice, this list of conditions and the following disclaimer.
1111e25f0dSDavid C Somayajulu  *  2. Redistributions in binary form must reproduce the above copyright
1211e25f0dSDavid C Somayajulu  *     notice, this list of conditions and the following disclaimer in the
1311e25f0dSDavid C Somayajulu  *     documentation and/or other materials provided with the distribution.
1411e25f0dSDavid C Somayajulu  *
1511e25f0dSDavid C Somayajulu  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
1611e25f0dSDavid C Somayajulu  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1711e25f0dSDavid C Somayajulu  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1811e25f0dSDavid C Somayajulu  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
1911e25f0dSDavid C Somayajulu  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2011e25f0dSDavid C Somayajulu  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2111e25f0dSDavid C Somayajulu  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2211e25f0dSDavid C Somayajulu  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2311e25f0dSDavid C Somayajulu  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2411e25f0dSDavid C Somayajulu  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2511e25f0dSDavid C Somayajulu  *  POSSIBILITY OF SUCH DAMAGE.
2611e25f0dSDavid C Somayajulu  *
2711e25f0dSDavid C Somayajulu  */
2811e25f0dSDavid C Somayajulu 
2911e25f0dSDavid C Somayajulu #ifndef __ECORE_L2_API_H__
3011e25f0dSDavid C Somayajulu #define __ECORE_L2_API_H__
3111e25f0dSDavid C Somayajulu 
3211e25f0dSDavid C Somayajulu #include "ecore_status.h"
3311e25f0dSDavid C Somayajulu #include "ecore_sp_api.h"
3411e25f0dSDavid C Somayajulu #include "ecore_int_api.h"
3511e25f0dSDavid C Somayajulu 
36217ec208SDavid C Somayajulu #ifndef __EXTRACT__LINUX__
3711e25f0dSDavid C Somayajulu enum ecore_rss_caps {
3811e25f0dSDavid C Somayajulu 	ECORE_RSS_IPV4		= 0x1,
3911e25f0dSDavid C Somayajulu 	ECORE_RSS_IPV6		= 0x2,
4011e25f0dSDavid C Somayajulu 	ECORE_RSS_IPV4_TCP	= 0x4,
4111e25f0dSDavid C Somayajulu 	ECORE_RSS_IPV6_TCP	= 0x8,
4211e25f0dSDavid C Somayajulu 	ECORE_RSS_IPV4_UDP	= 0x10,
4311e25f0dSDavid C Somayajulu 	ECORE_RSS_IPV6_UDP	= 0x20,
4411e25f0dSDavid C Somayajulu };
4511e25f0dSDavid C Somayajulu 
4611e25f0dSDavid C Somayajulu /* Should be the same as ETH_RSS_IND_TABLE_ENTRIES_NUM */
4711e25f0dSDavid C Somayajulu #define ECORE_RSS_IND_TABLE_SIZE 128
4811e25f0dSDavid C Somayajulu #define ECORE_RSS_KEY_SIZE 10 /* size in 32b chunks */
4911e25f0dSDavid C Somayajulu 
5011e25f0dSDavid C Somayajulu #define ECORE_MAX_PHC_DRIFT_PPB	291666666
5111e25f0dSDavid C Somayajulu 
5211e25f0dSDavid C Somayajulu enum ecore_ptp_filter_type {
539efd0ba7SDavid C Somayajulu 	ECORE_PTP_FILTER_NONE,
549efd0ba7SDavid C Somayajulu 	ECORE_PTP_FILTER_ALL,
559efd0ba7SDavid C Somayajulu 	ECORE_PTP_FILTER_V1_L4_EVENT,
569efd0ba7SDavid C Somayajulu 	ECORE_PTP_FILTER_V1_L4_GEN,
579efd0ba7SDavid C Somayajulu 	ECORE_PTP_FILTER_V2_L4_EVENT,
589efd0ba7SDavid C Somayajulu 	ECORE_PTP_FILTER_V2_L4_GEN,
599efd0ba7SDavid C Somayajulu 	ECORE_PTP_FILTER_V2_L2_EVENT,
609efd0ba7SDavid C Somayajulu 	ECORE_PTP_FILTER_V2_L2_GEN,
619efd0ba7SDavid C Somayajulu 	ECORE_PTP_FILTER_V2_EVENT,
629efd0ba7SDavid C Somayajulu 	ECORE_PTP_FILTER_V2_GEN
639efd0ba7SDavid C Somayajulu };
649efd0ba7SDavid C Somayajulu 
659efd0ba7SDavid C Somayajulu enum ecore_ptp_hwtstamp_tx_type {
669efd0ba7SDavid C Somayajulu 	ECORE_PTP_HWTSTAMP_TX_OFF,
679efd0ba7SDavid C Somayajulu 	ECORE_PTP_HWTSTAMP_TX_ON,
6811e25f0dSDavid C Somayajulu };
69217ec208SDavid C Somayajulu #endif
7011e25f0dSDavid C Somayajulu 
71217ec208SDavid C Somayajulu #ifndef __EXTRACT__LINUX__
7211e25f0dSDavid C Somayajulu struct ecore_queue_start_common_params {
7311e25f0dSDavid C Somayajulu 	/* Should always be relative to entity sending this. */
7411e25f0dSDavid C Somayajulu 	u8 vport_id;
7511e25f0dSDavid C Somayajulu 	u16 queue_id;
7611e25f0dSDavid C Somayajulu 
7711e25f0dSDavid C Somayajulu 	/* Relative, but relevant only for PFs */
7811e25f0dSDavid C Somayajulu 	u8 stats_id;
7911e25f0dSDavid C Somayajulu 
8011e25f0dSDavid C Somayajulu 	struct ecore_sb_info *p_sb;
8111e25f0dSDavid C Somayajulu 	u8 sb_idx;
82217ec208SDavid C Somayajulu 
83217ec208SDavid C Somayajulu 	u8 tc;
8411e25f0dSDavid C Somayajulu };
8511e25f0dSDavid C Somayajulu 
8611e25f0dSDavid C Somayajulu struct ecore_rxq_start_ret_params {
8711e25f0dSDavid C Somayajulu 	void OSAL_IOMEM *p_prod;
8811e25f0dSDavid C Somayajulu 	void *p_handle;
8911e25f0dSDavid C Somayajulu };
9011e25f0dSDavid C Somayajulu 
9111e25f0dSDavid C Somayajulu struct ecore_txq_start_ret_params {
9211e25f0dSDavid C Somayajulu 	void OSAL_IOMEM *p_doorbell;
9311e25f0dSDavid C Somayajulu 	void *p_handle;
9411e25f0dSDavid C Somayajulu };
95217ec208SDavid C Somayajulu #endif
9611e25f0dSDavid C Somayajulu 
9711e25f0dSDavid C Somayajulu struct ecore_rss_params {
9811e25f0dSDavid C Somayajulu 	u8 update_rss_config;
9911e25f0dSDavid C Somayajulu 	u8 rss_enable;
10011e25f0dSDavid C Somayajulu 	u8 rss_eng_id;
10111e25f0dSDavid C Somayajulu 	u8 update_rss_capabilities;
10211e25f0dSDavid C Somayajulu 	u8 update_rss_ind_table;
10311e25f0dSDavid C Somayajulu 	u8 update_rss_key;
10411e25f0dSDavid C Somayajulu 	u8 rss_caps;
10511e25f0dSDavid C Somayajulu 	u8 rss_table_size_log; /* The table size is 2 ^ rss_table_size_log */
10611e25f0dSDavid C Somayajulu 
10711e25f0dSDavid C Somayajulu 	/* Indirection table consist of rx queue handles */
10811e25f0dSDavid C Somayajulu 	void *rss_ind_table[ECORE_RSS_IND_TABLE_SIZE];
10911e25f0dSDavid C Somayajulu 	u32 rss_key[ECORE_RSS_KEY_SIZE];
11011e25f0dSDavid C Somayajulu };
11111e25f0dSDavid C Somayajulu 
11211e25f0dSDavid C Somayajulu struct ecore_sge_tpa_params {
11311e25f0dSDavid C Somayajulu 	u8 max_buffers_per_cqe;
11411e25f0dSDavid C Somayajulu 
11511e25f0dSDavid C Somayajulu 	u8 update_tpa_en_flg;
11611e25f0dSDavid C Somayajulu 	u8 tpa_ipv4_en_flg;
11711e25f0dSDavid C Somayajulu 	u8 tpa_ipv6_en_flg;
11811e25f0dSDavid C Somayajulu 	u8 tpa_ipv4_tunn_en_flg;
11911e25f0dSDavid C Somayajulu 	u8 tpa_ipv6_tunn_en_flg;
12011e25f0dSDavid C Somayajulu 
12111e25f0dSDavid C Somayajulu 	u8 update_tpa_param_flg;
12211e25f0dSDavid C Somayajulu 	u8 tpa_pkt_split_flg;
12311e25f0dSDavid C Somayajulu 	u8 tpa_hdr_data_split_flg;
12411e25f0dSDavid C Somayajulu 	u8 tpa_gro_consistent_flg;
12511e25f0dSDavid C Somayajulu 	u8 tpa_max_aggs_num;
12611e25f0dSDavid C Somayajulu 	u16 tpa_max_size;
12711e25f0dSDavid C Somayajulu 	u16 tpa_min_size_to_start;
12811e25f0dSDavid C Somayajulu 	u16 tpa_min_size_to_cont;
12911e25f0dSDavid C Somayajulu };
13011e25f0dSDavid C Somayajulu 
13111e25f0dSDavid C Somayajulu enum ecore_filter_opcode {
13211e25f0dSDavid C Somayajulu 	ECORE_FILTER_ADD,
13311e25f0dSDavid C Somayajulu 	ECORE_FILTER_REMOVE,
13411e25f0dSDavid C Somayajulu 	ECORE_FILTER_MOVE,
13511e25f0dSDavid C Somayajulu 	ECORE_FILTER_REPLACE, /* Delete all MACs and add new one instead */
13611e25f0dSDavid C Somayajulu 	ECORE_FILTER_FLUSH, /* Removes all filters */
13711e25f0dSDavid C Somayajulu };
13811e25f0dSDavid C Somayajulu 
13911e25f0dSDavid C Somayajulu enum ecore_filter_ucast_type {
14011e25f0dSDavid C Somayajulu 	ECORE_FILTER_MAC,
14111e25f0dSDavid C Somayajulu 	ECORE_FILTER_VLAN,
14211e25f0dSDavid C Somayajulu 	ECORE_FILTER_MAC_VLAN,
14311e25f0dSDavid C Somayajulu 	ECORE_FILTER_INNER_MAC,
14411e25f0dSDavid C Somayajulu 	ECORE_FILTER_INNER_VLAN,
14511e25f0dSDavid C Somayajulu 	ECORE_FILTER_INNER_PAIR,
14611e25f0dSDavid C Somayajulu 	ECORE_FILTER_INNER_MAC_VNI_PAIR,
14711e25f0dSDavid C Somayajulu 	ECORE_FILTER_MAC_VNI_PAIR,
14811e25f0dSDavid C Somayajulu 	ECORE_FILTER_VNI,
14911e25f0dSDavid C Somayajulu };
15011e25f0dSDavid C Somayajulu 
15111e25f0dSDavid C Somayajulu struct ecore_filter_ucast {
15211e25f0dSDavid C Somayajulu 	enum ecore_filter_opcode opcode;
15311e25f0dSDavid C Somayajulu 	enum ecore_filter_ucast_type type;
15411e25f0dSDavid C Somayajulu 	u8 is_rx_filter;
15511e25f0dSDavid C Somayajulu 	u8 is_tx_filter;
15611e25f0dSDavid C Somayajulu 	u8 vport_to_add_to;
15711e25f0dSDavid C Somayajulu 	u8 vport_to_remove_from;
15811e25f0dSDavid C Somayajulu 	unsigned char mac[ETH_ALEN];
15911e25f0dSDavid C Somayajulu 	u8 assert_on_error;
16011e25f0dSDavid C Somayajulu 	u16 vlan;
16111e25f0dSDavid C Somayajulu 	u32 vni;
16211e25f0dSDavid C Somayajulu };
16311e25f0dSDavid C Somayajulu 
16411e25f0dSDavid C Somayajulu struct ecore_filter_mcast {
16511e25f0dSDavid C Somayajulu 	/* MOVE is not supported for multicast */
16611e25f0dSDavid C Somayajulu 	enum ecore_filter_opcode opcode;
16711e25f0dSDavid C Somayajulu 	u8 vport_to_add_to;
16811e25f0dSDavid C Somayajulu 	u8 vport_to_remove_from;
16911e25f0dSDavid C Somayajulu 	u8	num_mc_addrs;
17011e25f0dSDavid C Somayajulu #define ECORE_MAX_MC_ADDRS	64
17111e25f0dSDavid C Somayajulu 	unsigned char mac[ECORE_MAX_MC_ADDRS][ETH_ALEN];
17211e25f0dSDavid C Somayajulu };
17311e25f0dSDavid C Somayajulu 
17411e25f0dSDavid C Somayajulu struct ecore_filter_accept_flags {
17511e25f0dSDavid C Somayajulu 	u8 update_rx_mode_config;
17611e25f0dSDavid C Somayajulu 	u8 update_tx_mode_config;
17711e25f0dSDavid C Somayajulu 	u8 rx_accept_filter;
17811e25f0dSDavid C Somayajulu 	u8 tx_accept_filter;
17911e25f0dSDavid C Somayajulu #define	ECORE_ACCEPT_NONE		0x01
18011e25f0dSDavid C Somayajulu #define ECORE_ACCEPT_UCAST_MATCHED	0x02
18111e25f0dSDavid C Somayajulu #define ECORE_ACCEPT_UCAST_UNMATCHED	0x04
18211e25f0dSDavid C Somayajulu #define ECORE_ACCEPT_MCAST_MATCHED	0x08
18311e25f0dSDavid C Somayajulu #define ECORE_ACCEPT_MCAST_UNMATCHED	0x10
18411e25f0dSDavid C Somayajulu #define ECORE_ACCEPT_BCAST		0x20
18511e25f0dSDavid C Somayajulu };
18611e25f0dSDavid C Somayajulu 
187217ec208SDavid C Somayajulu #ifndef __EXTRACT__LINUX__
188217ec208SDavid C Somayajulu enum ecore_filter_config_mode {
189217ec208SDavid C Somayajulu 	ECORE_FILTER_CONFIG_MODE_DISABLE,
190217ec208SDavid C Somayajulu 	ECORE_FILTER_CONFIG_MODE_5_TUPLE,
191217ec208SDavid C Somayajulu 	ECORE_FILTER_CONFIG_MODE_L4_PORT,
192217ec208SDavid C Somayajulu 	ECORE_FILTER_CONFIG_MODE_IP_DEST,
193217ec208SDavid C Somayajulu };
194217ec208SDavid C Somayajulu #endif
195217ec208SDavid C Somayajulu 
19611e25f0dSDavid C Somayajulu struct ecore_arfs_config_params {
19711e25f0dSDavid C Somayajulu 	bool tcp;
19811e25f0dSDavid C Somayajulu 	bool udp;
19911e25f0dSDavid C Somayajulu 	bool ipv4;
20011e25f0dSDavid C Somayajulu 	bool ipv6;
201217ec208SDavid C Somayajulu 	enum ecore_filter_config_mode mode;
20211e25f0dSDavid C Somayajulu };
20311e25f0dSDavid C Somayajulu 
20411e25f0dSDavid C Somayajulu /* Add / remove / move / remove-all unicast MAC-VLAN filters.
20511e25f0dSDavid C Somayajulu  * FW will assert in the following cases, so driver should take care...:
20611e25f0dSDavid C Somayajulu  * 1. Adding a filter to a full table.
20711e25f0dSDavid C Somayajulu  * 2. Adding a filter which already exists on that vport.
20811e25f0dSDavid C Somayajulu  * 3. Removing a filter which doesn't exist.
20911e25f0dSDavid C Somayajulu  */
21011e25f0dSDavid C Somayajulu 
21111e25f0dSDavid C Somayajulu enum _ecore_status_t
21211e25f0dSDavid C Somayajulu ecore_filter_ucast_cmd(struct ecore_dev *p_dev,
21311e25f0dSDavid C Somayajulu 		       struct ecore_filter_ucast *p_filter_cmd,
21411e25f0dSDavid C Somayajulu 		       enum spq_mode comp_mode,
21511e25f0dSDavid C Somayajulu 		       struct ecore_spq_comp_cb *p_comp_data);
21611e25f0dSDavid C Somayajulu 
21711e25f0dSDavid C Somayajulu /* Add / remove / move multicast MAC filters. */
21811e25f0dSDavid C Somayajulu enum _ecore_status_t
21911e25f0dSDavid C Somayajulu ecore_filter_mcast_cmd(struct ecore_dev *p_dev,
22011e25f0dSDavid C Somayajulu 		       struct ecore_filter_mcast *p_filter_cmd,
22111e25f0dSDavid C Somayajulu 		       enum spq_mode comp_mode,
22211e25f0dSDavid C Somayajulu 		       struct ecore_spq_comp_cb *p_comp_data);
22311e25f0dSDavid C Somayajulu 
22411e25f0dSDavid C Somayajulu /* Set "accept" filters */
22511e25f0dSDavid C Somayajulu enum _ecore_status_t
22611e25f0dSDavid C Somayajulu ecore_filter_accept_cmd(
22711e25f0dSDavid C Somayajulu 	struct ecore_dev		 *p_dev,
22811e25f0dSDavid C Somayajulu 	u8				 vport,
22911e25f0dSDavid C Somayajulu 	struct ecore_filter_accept_flags accept_flags,
23011e25f0dSDavid C Somayajulu 	u8				 update_accept_any_vlan,
23111e25f0dSDavid C Somayajulu 	u8				 accept_any_vlan,
23211e25f0dSDavid C Somayajulu 	enum spq_mode			 comp_mode,
23311e25f0dSDavid C Somayajulu 	struct ecore_spq_comp_cb	 *p_comp_data);
23411e25f0dSDavid C Somayajulu 
23511e25f0dSDavid C Somayajulu /**
23611e25f0dSDavid C Somayajulu  * @brief ecore_eth_rx_queue_start - RX Queue Start Ramrod
23711e25f0dSDavid C Somayajulu  *
23811e25f0dSDavid C Somayajulu  * This ramrod initializes an RX Queue for a VPort. An Assert is generated if
23911e25f0dSDavid C Somayajulu  * the VPort ID is not currently initialized.
24011e25f0dSDavid C Somayajulu  *
24111e25f0dSDavid C Somayajulu  * @param p_hwfn
24211e25f0dSDavid C Somayajulu  * @param opaque_fid
24311e25f0dSDavid C Somayajulu  * @p_params			Inputs; Relative for PF [SB being an exception]
24411e25f0dSDavid C Somayajulu  * @param bd_max_bytes 		Maximum bytes that can be placed on a BD
24511e25f0dSDavid C Somayajulu  * @param bd_chain_phys_addr	Physical address of BDs for receive.
24611e25f0dSDavid C Somayajulu  * @param cqe_pbl_addr		Physical address of the CQE PBL Table.
24711e25f0dSDavid C Somayajulu  * @param cqe_pbl_size 		Size of the CQE PBL Table
24811e25f0dSDavid C Somayajulu  * @param p_ret_params		Pointed struct to be filled with outputs.
24911e25f0dSDavid C Somayajulu  *
25011e25f0dSDavid C Somayajulu  * @return enum _ecore_status_t
25111e25f0dSDavid C Somayajulu  */
25211e25f0dSDavid C Somayajulu enum _ecore_status_t
25311e25f0dSDavid C Somayajulu ecore_eth_rx_queue_start(struct ecore_hwfn *p_hwfn,
25411e25f0dSDavid C Somayajulu 			 u16 opaque_fid,
25511e25f0dSDavid C Somayajulu 			 struct ecore_queue_start_common_params *p_params,
25611e25f0dSDavid C Somayajulu 			 u16 bd_max_bytes,
25711e25f0dSDavid C Somayajulu 			 dma_addr_t bd_chain_phys_addr,
25811e25f0dSDavid C Somayajulu 			 dma_addr_t cqe_pbl_addr,
25911e25f0dSDavid C Somayajulu 			 u16 cqe_pbl_size,
26011e25f0dSDavid C Somayajulu 			 struct ecore_rxq_start_ret_params *p_ret_params);
26111e25f0dSDavid C Somayajulu 
26211e25f0dSDavid C Somayajulu /**
26311e25f0dSDavid C Somayajulu  * @brief ecore_eth_rx_queue_stop - This ramrod closes an Rx queue
26411e25f0dSDavid C Somayajulu  *
26511e25f0dSDavid C Somayajulu  * @param p_hwfn
26611e25f0dSDavid C Somayajulu  * @param p_rxq			Handler of queue to close
26711e25f0dSDavid C Somayajulu  * @param eq_completion_only	If True completion will be on
26811e25f0dSDavid C Somayajulu  *				EQe, if False completion will be
26911e25f0dSDavid C Somayajulu  *				on EQe if p_hwfn opaque
27011e25f0dSDavid C Somayajulu  *				different from the RXQ opaque
27111e25f0dSDavid C Somayajulu  *				otherwise on CQe.
27211e25f0dSDavid C Somayajulu  * @param cqe_completion	If True completion will be
2739efd0ba7SDavid C Somayajulu  *				recieve on CQe.
27411e25f0dSDavid C Somayajulu  * @return enum _ecore_status_t
27511e25f0dSDavid C Somayajulu  */
27611e25f0dSDavid C Somayajulu enum _ecore_status_t
27711e25f0dSDavid C Somayajulu ecore_eth_rx_queue_stop(struct ecore_hwfn *p_hwfn,
27811e25f0dSDavid C Somayajulu 			void *p_rxq,
27911e25f0dSDavid C Somayajulu 			bool eq_completion_only,
28011e25f0dSDavid C Somayajulu 			bool cqe_completion);
28111e25f0dSDavid C Somayajulu 
28211e25f0dSDavid C Somayajulu /**
28311e25f0dSDavid C Somayajulu  * @brief - TX Queue Start Ramrod
28411e25f0dSDavid C Somayajulu  *
28511e25f0dSDavid C Somayajulu  * This ramrod initializes a TX Queue for a VPort. An Assert is generated if
28611e25f0dSDavid C Somayajulu  * the VPort is not currently initialized.
28711e25f0dSDavid C Somayajulu  *
28811e25f0dSDavid C Somayajulu  * @param p_hwfn
28911e25f0dSDavid C Somayajulu  * @param opaque_fid
29011e25f0dSDavid C Somayajulu  * @p_params
29111e25f0dSDavid C Somayajulu  * @param tc			traffic class to use with this L2 txq
29211e25f0dSDavid C Somayajulu  * @param pbl_addr		address of the pbl array
29311e25f0dSDavid C Somayajulu  * @param pbl_size 		number of entries in pbl
29411e25f0dSDavid C Somayajulu  * @oaram p_ret_params		Pointer to fill the return parameters in.
29511e25f0dSDavid C Somayajulu  *
29611e25f0dSDavid C Somayajulu  * @return enum _ecore_status_t
29711e25f0dSDavid C Somayajulu  */
29811e25f0dSDavid C Somayajulu enum _ecore_status_t
29911e25f0dSDavid C Somayajulu ecore_eth_tx_queue_start(struct ecore_hwfn *p_hwfn,
30011e25f0dSDavid C Somayajulu 			 u16 opaque_fid,
30111e25f0dSDavid C Somayajulu 			 struct ecore_queue_start_common_params *p_params,
30211e25f0dSDavid C Somayajulu 			 u8 tc,
30311e25f0dSDavid C Somayajulu 			 dma_addr_t pbl_addr,
30411e25f0dSDavid C Somayajulu 			 u16 pbl_size,
30511e25f0dSDavid C Somayajulu 			 struct ecore_txq_start_ret_params *p_ret_params);
30611e25f0dSDavid C Somayajulu 
30711e25f0dSDavid C Somayajulu /**
30811e25f0dSDavid C Somayajulu  * @brief ecore_eth_tx_queue_stop - closes a Tx queue
30911e25f0dSDavid C Somayajulu  *
31011e25f0dSDavid C Somayajulu  * @param p_hwfn
31111e25f0dSDavid C Somayajulu  * @param p_txq - handle to Tx queue needed to be closed
31211e25f0dSDavid C Somayajulu  *
31311e25f0dSDavid C Somayajulu  * @return enum _ecore_status_t
31411e25f0dSDavid C Somayajulu  */
31511e25f0dSDavid C Somayajulu enum _ecore_status_t ecore_eth_tx_queue_stop(struct ecore_hwfn *p_hwfn,
31611e25f0dSDavid C Somayajulu 					     void *p_txq);
31711e25f0dSDavid C Somayajulu 
31811e25f0dSDavid C Somayajulu enum ecore_tpa_mode	{
31911e25f0dSDavid C Somayajulu 	ECORE_TPA_MODE_NONE,
32011e25f0dSDavid C Somayajulu 	ECORE_TPA_MODE_RSC,
32111e25f0dSDavid C Somayajulu 	ECORE_TPA_MODE_GRO,
32211e25f0dSDavid C Somayajulu 	ECORE_TPA_MODE_MAX
32311e25f0dSDavid C Somayajulu };
32411e25f0dSDavid C Somayajulu 
32511e25f0dSDavid C Somayajulu struct ecore_sp_vport_start_params {
32611e25f0dSDavid C Somayajulu 	enum ecore_tpa_mode tpa_mode;
32711e25f0dSDavid C Somayajulu 	bool remove_inner_vlan;	/* Inner VLAN removal is enabled */
32811e25f0dSDavid C Somayajulu 	bool tx_switching;	/* Vport supports tx-switching */
32911e25f0dSDavid C Somayajulu 	bool handle_ptp_pkts;	/* Handle PTP packets */
33011e25f0dSDavid C Somayajulu 	bool only_untagged;	/* Untagged pkt control */
33111e25f0dSDavid C Somayajulu 	bool drop_ttl0;		/* Drop packets with TTL = 0 */
33211e25f0dSDavid C Somayajulu 	u8 max_buffers_per_cqe;
33311e25f0dSDavid C Somayajulu 	u32 concrete_fid;
33411e25f0dSDavid C Somayajulu 	u16 opaque_fid;
33511e25f0dSDavid C Somayajulu 	u8 vport_id;		/* VPORT ID */
33611e25f0dSDavid C Somayajulu 	u16 mtu;		/* VPORT MTU */
33711e25f0dSDavid C Somayajulu 	bool zero_placement_offset;
33811e25f0dSDavid C Somayajulu 	bool check_mac;
33911e25f0dSDavid C Somayajulu 	bool check_ethtype;
34011e25f0dSDavid C Somayajulu 
34111e25f0dSDavid C Somayajulu 	/* Strict behavior on transmission errors */
34211e25f0dSDavid C Somayajulu 	bool b_err_illegal_vlan_mode;
34311e25f0dSDavid C Somayajulu 	bool b_err_illegal_inband_mode;
34411e25f0dSDavid C Somayajulu 	bool b_err_vlan_insert_with_inband;
34511e25f0dSDavid C Somayajulu 	bool b_err_small_pkt;
34611e25f0dSDavid C Somayajulu 	bool b_err_big_pkt;
34711e25f0dSDavid C Somayajulu 	bool b_err_anti_spoof;
34811e25f0dSDavid C Somayajulu 	bool b_err_ctrl_frame;
34911e25f0dSDavid C Somayajulu };
35011e25f0dSDavid C Somayajulu 
35111e25f0dSDavid C Somayajulu /**
35211e25f0dSDavid C Somayajulu  * @brief ecore_sp_vport_start -
35311e25f0dSDavid C Somayajulu  *
35411e25f0dSDavid C Somayajulu  * This ramrod initializes a VPort. An Assert if generated if the Function ID
35511e25f0dSDavid C Somayajulu  * of the VPort is not enabled.
35611e25f0dSDavid C Somayajulu  *
35711e25f0dSDavid C Somayajulu  * @param p_hwfn
35811e25f0dSDavid C Somayajulu  * @param p_params		VPORT start params
35911e25f0dSDavid C Somayajulu  *
36011e25f0dSDavid C Somayajulu  * @return enum _ecore_status_t
36111e25f0dSDavid C Somayajulu  */
36211e25f0dSDavid C Somayajulu enum _ecore_status_t
36311e25f0dSDavid C Somayajulu ecore_sp_vport_start(struct ecore_hwfn *p_hwfn,
36411e25f0dSDavid C Somayajulu 		     struct ecore_sp_vport_start_params *p_params);
36511e25f0dSDavid C Somayajulu 
36611e25f0dSDavid C Somayajulu struct ecore_sp_vport_update_params {
36711e25f0dSDavid C Somayajulu 	u16			opaque_fid;
36811e25f0dSDavid C Somayajulu 	u8			vport_id;
36911e25f0dSDavid C Somayajulu 	u8			update_vport_active_rx_flg;
37011e25f0dSDavid C Somayajulu 	u8			vport_active_rx_flg;
37111e25f0dSDavid C Somayajulu 	u8			update_vport_active_tx_flg;
37211e25f0dSDavid C Somayajulu 	u8			vport_active_tx_flg;
37311e25f0dSDavid C Somayajulu 	u8			update_inner_vlan_removal_flg;
37411e25f0dSDavid C Somayajulu 	u8			inner_vlan_removal_flg;
37511e25f0dSDavid C Somayajulu 	u8			silent_vlan_removal_flg;
37611e25f0dSDavid C Somayajulu 	u8			update_default_vlan_enable_flg;
37711e25f0dSDavid C Somayajulu 	u8			default_vlan_enable_flg;
37811e25f0dSDavid C Somayajulu 	u8			update_default_vlan_flg;
37911e25f0dSDavid C Somayajulu 	u16			default_vlan;
38011e25f0dSDavid C Somayajulu 	u8			update_tx_switching_flg;
38111e25f0dSDavid C Somayajulu 	u8			tx_switching_flg;
38211e25f0dSDavid C Somayajulu 	u8			update_approx_mcast_flg;
38311e25f0dSDavid C Somayajulu 	u8			update_anti_spoofing_en_flg;
38411e25f0dSDavid C Somayajulu 	u8			anti_spoofing_en;
38511e25f0dSDavid C Somayajulu 	u8			update_accept_any_vlan_flg;
38611e25f0dSDavid C Somayajulu 	u8			accept_any_vlan;
387217ec208SDavid C Somayajulu 	u32			bins[8];
38811e25f0dSDavid C Somayajulu 	struct ecore_rss_params	*rss_params;
38911e25f0dSDavid C Somayajulu 	struct ecore_filter_accept_flags accept_flags;
39011e25f0dSDavid C Somayajulu 	struct ecore_sge_tpa_params *sge_tpa_params;
39111e25f0dSDavid C Somayajulu };
39211e25f0dSDavid C Somayajulu 
39311e25f0dSDavid C Somayajulu /**
39411e25f0dSDavid C Somayajulu  * @brief ecore_sp_vport_update -
39511e25f0dSDavid C Somayajulu  *
39611e25f0dSDavid C Somayajulu  * This ramrod updates the parameters of the VPort. Every field can be updated
39711e25f0dSDavid C Somayajulu  * independently, according to flags.
39811e25f0dSDavid C Somayajulu  *
39911e25f0dSDavid C Somayajulu  * This ramrod is also used to set the VPort state to active after creation.
40011e25f0dSDavid C Somayajulu  * An Assert is generated if the VPort does not contain an RX queue.
40111e25f0dSDavid C Somayajulu  *
40211e25f0dSDavid C Somayajulu  * @param p_hwfn
40311e25f0dSDavid C Somayajulu  * @param p_params
40411e25f0dSDavid C Somayajulu  *
40511e25f0dSDavid C Somayajulu  * @return enum _ecore_status_t
40611e25f0dSDavid C Somayajulu  */
40711e25f0dSDavid C Somayajulu enum _ecore_status_t
40811e25f0dSDavid C Somayajulu ecore_sp_vport_update(struct ecore_hwfn *p_hwfn,
40911e25f0dSDavid C Somayajulu 		      struct ecore_sp_vport_update_params *p_params,
41011e25f0dSDavid C Somayajulu 		      enum spq_mode comp_mode,
41111e25f0dSDavid C Somayajulu 		      struct ecore_spq_comp_cb *p_comp_data);
41211e25f0dSDavid C Somayajulu /**
41311e25f0dSDavid C Somayajulu  * @brief ecore_sp_vport_stop -
41411e25f0dSDavid C Somayajulu  *
41511e25f0dSDavid C Somayajulu  * This ramrod closes a VPort after all its RX and TX queues are terminated.
41611e25f0dSDavid C Somayajulu  * An Assert is generated if any queues are left open.
41711e25f0dSDavid C Somayajulu  *
41811e25f0dSDavid C Somayajulu  * @param p_hwfn
41911e25f0dSDavid C Somayajulu  * @param opaque_fid
42011e25f0dSDavid C Somayajulu  * @param vport_id VPort ID
42111e25f0dSDavid C Somayajulu  *
42211e25f0dSDavid C Somayajulu  * @return enum _ecore_status_t
42311e25f0dSDavid C Somayajulu  */
42411e25f0dSDavid C Somayajulu enum _ecore_status_t ecore_sp_vport_stop(struct ecore_hwfn *p_hwfn,
42511e25f0dSDavid C Somayajulu 					 u16 opaque_fid,
42611e25f0dSDavid C Somayajulu 					 u8 vport_id);
42711e25f0dSDavid C Somayajulu 
42811e25f0dSDavid C Somayajulu enum _ecore_status_t
42911e25f0dSDavid C Somayajulu ecore_sp_eth_filter_ucast(struct ecore_hwfn *p_hwfn,
43011e25f0dSDavid C Somayajulu 			  u16 opaque_fid,
43111e25f0dSDavid C Somayajulu 			  struct ecore_filter_ucast *p_filter_cmd,
43211e25f0dSDavid C Somayajulu 			  enum spq_mode comp_mode,
43311e25f0dSDavid C Somayajulu 			  struct ecore_spq_comp_cb *p_comp_data);
43411e25f0dSDavid C Somayajulu 
43511e25f0dSDavid C Somayajulu /**
43611e25f0dSDavid C Somayajulu  * @brief ecore_sp_rx_eth_queues_update -
43711e25f0dSDavid C Somayajulu  *
43811e25f0dSDavid C Somayajulu  * This ramrod updates an RX queue. It is used for setting the active state
43911e25f0dSDavid C Somayajulu  * of the queue and updating the TPA and SGE parameters.
44011e25f0dSDavid C Somayajulu  *
44111e25f0dSDavid C Somayajulu  * @note Final phase API.
44211e25f0dSDavid C Somayajulu  *
44311e25f0dSDavid C Somayajulu  * @param p_hwfn
44411e25f0dSDavid C Somayajulu  * @param pp_rxq_handlers	An array of queue handlers to be updated.
44511e25f0dSDavid C Somayajulu  * @param num_rxqs              number of queues to update.
44611e25f0dSDavid C Somayajulu  * @param complete_cqe_flg	Post completion to the CQE Ring if set
44711e25f0dSDavid C Somayajulu  * @param complete_event_flg	Post completion to the Event Ring if set
44811e25f0dSDavid C Somayajulu  * @param comp_mode
44911e25f0dSDavid C Somayajulu  * @param p_comp_data
45011e25f0dSDavid C Somayajulu  *
45111e25f0dSDavid C Somayajulu  * @return enum _ecore_status_t
45211e25f0dSDavid C Somayajulu  */
45311e25f0dSDavid C Somayajulu 
45411e25f0dSDavid C Somayajulu enum _ecore_status_t
45511e25f0dSDavid C Somayajulu ecore_sp_eth_rx_queues_update(struct ecore_hwfn *p_hwfn,
45611e25f0dSDavid C Somayajulu 			      void **pp_rxq_handlers,
45711e25f0dSDavid C Somayajulu 			      u8 num_rxqs,
45811e25f0dSDavid C Somayajulu 			      u8 complete_cqe_flg,
45911e25f0dSDavid C Somayajulu 			      u8 complete_event_flg,
46011e25f0dSDavid C Somayajulu 			      enum spq_mode comp_mode,
46111e25f0dSDavid C Somayajulu 			      struct ecore_spq_comp_cb *p_comp_data);
46211e25f0dSDavid C Somayajulu 
463217ec208SDavid C Somayajulu /**
464217ec208SDavid C Somayajulu  * @brief ecore_sp_eth_rx_queues_set_default -
465217ec208SDavid C Somayajulu  *
466217ec208SDavid C Somayajulu  * This ramrod sets RSS RX queue as default one.
467217ec208SDavid C Somayajulu  *
468217ec208SDavid C Somayajulu  * @note Final phase API.
469217ec208SDavid C Somayajulu  *
470217ec208SDavid C Somayajulu  * @param p_hwfn
471217ec208SDavid C Somayajulu  * @param p_rxq_handlers	queue handlers to be updated.
472217ec208SDavid C Somayajulu  * @param comp_mode
473217ec208SDavid C Somayajulu  * @param p_comp_data
474217ec208SDavid C Somayajulu  *
475217ec208SDavid C Somayajulu  * @return enum _ecore_status_t
476217ec208SDavid C Somayajulu  */
477217ec208SDavid C Somayajulu 
478217ec208SDavid C Somayajulu enum _ecore_status_t
479217ec208SDavid C Somayajulu ecore_sp_eth_rx_queues_set_default(struct ecore_hwfn *p_hwfn,
480217ec208SDavid C Somayajulu 				   void *p_rxq_handler,
481217ec208SDavid C Somayajulu 				   enum spq_mode comp_mode,
482217ec208SDavid C Somayajulu 				   struct ecore_spq_comp_cb *p_comp_data);
483217ec208SDavid C Somayajulu 
48411e25f0dSDavid C Somayajulu void __ecore_get_vport_stats(struct ecore_hwfn *p_hwfn,
48511e25f0dSDavid C Somayajulu 			     struct ecore_ptt *p_ptt,
48611e25f0dSDavid C Somayajulu 			     struct ecore_eth_stats *stats,
48711e25f0dSDavid C Somayajulu 			     u16 statistics_bin, bool b_get_port_stats);
48811e25f0dSDavid C Somayajulu 
48911e25f0dSDavid C Somayajulu void ecore_get_vport_stats(struct ecore_dev *p_dev,
49011e25f0dSDavid C Somayajulu 			   struct ecore_eth_stats *stats);
49111e25f0dSDavid C Somayajulu 
49211e25f0dSDavid C Somayajulu void ecore_reset_vport_stats(struct ecore_dev *p_dev);
49311e25f0dSDavid C Somayajulu 
49411e25f0dSDavid C Somayajulu /**
49511e25f0dSDavid C Somayajulu  *@brief ecore_arfs_mode_configure -
49611e25f0dSDavid C Somayajulu  *
49711e25f0dSDavid C Somayajulu  *Enable or disable rfs mode. It must accept atleast one of tcp or udp true
49811e25f0dSDavid C Somayajulu  *and atleast one of ipv4 or ipv6 true to enable rfs mode.
49911e25f0dSDavid C Somayajulu  *
50011e25f0dSDavid C Somayajulu  *@param p_hwfn
50111e25f0dSDavid C Somayajulu  *@param p_ptt
50211e25f0dSDavid C Somayajulu  *@param p_cfg_params		arfs mode configuration parameters.
50311e25f0dSDavid C Somayajulu  *
50411e25f0dSDavid C Somayajulu  */
50511e25f0dSDavid C Somayajulu void ecore_arfs_mode_configure(struct ecore_hwfn *p_hwfn,
50611e25f0dSDavid C Somayajulu 			       struct ecore_ptt *p_ptt,
50711e25f0dSDavid C Somayajulu 			       struct ecore_arfs_config_params *p_cfg_params);
5089efd0ba7SDavid C Somayajulu 
509217ec208SDavid C Somayajulu #ifndef __EXTRACT__LINUX__
510217ec208SDavid C Somayajulu struct ecore_ntuple_filter_params {
511217ec208SDavid C Somayajulu 	/* Physically mapped address containing header of buffer to be used
512217ec208SDavid C Somayajulu 	 * as filter.
513217ec208SDavid C Somayajulu 	 */
514217ec208SDavid C Somayajulu 	dma_addr_t addr;
515217ec208SDavid C Somayajulu 
516217ec208SDavid C Somayajulu 	/* Length of header in bytes */
517217ec208SDavid C Somayajulu 	u16 length;
518217ec208SDavid C Somayajulu 
519217ec208SDavid C Somayajulu 	/* Relative queue-id to receive classified packet */
520217ec208SDavid C Somayajulu #define ECORE_RFS_NTUPLE_QID_RSS ((u16)-1)
521217ec208SDavid C Somayajulu 	u16 qid;
522217ec208SDavid C Somayajulu 
523217ec208SDavid C Somayajulu 	/* Identifier can either be according to vport-id or vfid */
524217ec208SDavid C Somayajulu 	bool b_is_vf;
525217ec208SDavid C Somayajulu 	u8 vport_id;
526217ec208SDavid C Somayajulu 	u8 vf_id;
527217ec208SDavid C Somayajulu 
528217ec208SDavid C Somayajulu 	/* true iff this filter is to be added. Else to be removed */
529217ec208SDavid C Somayajulu 	bool b_is_add;
530217ec208SDavid C Somayajulu };
531217ec208SDavid C Somayajulu #endif
532217ec208SDavid C Somayajulu 
5339efd0ba7SDavid C Somayajulu /**
5349efd0ba7SDavid C Somayajulu  * @brief - ecore_configure_rfs_ntuple_filter
5359efd0ba7SDavid C Somayajulu  *
5369efd0ba7SDavid C Somayajulu  * This ramrod should be used to add or remove arfs hw filter
5379efd0ba7SDavid C Somayajulu  *
5389efd0ba7SDavid C Somayajulu  * @params p_hwfn
5399efd0ba7SDavid C Somayajulu  * @params p_cb		Used for ECORE_SPQ_MODE_CB,where client would initialize
5409efd0ba7SDavid C Somayajulu  *			it with cookie and callback function address, if not
5419efd0ba7SDavid C Somayajulu  *			using this mode then client must pass NULL.
542217ec208SDavid C Somayajulu  * @params p_params
5439efd0ba7SDavid C Somayajulu  */
5449efd0ba7SDavid C Somayajulu enum _ecore_status_t
5459efd0ba7SDavid C Somayajulu ecore_configure_rfs_ntuple_filter(struct ecore_hwfn *p_hwfn,
5469efd0ba7SDavid C Somayajulu 				  struct ecore_spq_comp_cb *p_cb,
547217ec208SDavid C Somayajulu 				  struct ecore_ntuple_filter_params *p_params);
54811e25f0dSDavid C Somayajulu #endif
549