xref: /OK3568_Linux_fs/kernel/drivers/net/ethernet/sfc/nic.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-only */
2*4882a593Smuzhiyun /****************************************************************************
3*4882a593Smuzhiyun  * Driver for Solarflare network controllers and boards
4*4882a593Smuzhiyun  * Copyright 2005-2006 Fen Systems Ltd.
5*4882a593Smuzhiyun  * Copyright 2006-2013 Solarflare Communications Inc.
6*4882a593Smuzhiyun  */
7*4882a593Smuzhiyun 
8*4882a593Smuzhiyun #ifndef EFX_NIC_H
9*4882a593Smuzhiyun #define EFX_NIC_H
10*4882a593Smuzhiyun 
11*4882a593Smuzhiyun #include "nic_common.h"
12*4882a593Smuzhiyun #include "efx.h"
13*4882a593Smuzhiyun 
14*4882a593Smuzhiyun u32 efx_farch_fpga_ver(struct efx_nic *efx);
15*4882a593Smuzhiyun 
16*4882a593Smuzhiyun enum {
17*4882a593Smuzhiyun 	PHY_TYPE_NONE = 0,
18*4882a593Smuzhiyun 	PHY_TYPE_TXC43128 = 1,
19*4882a593Smuzhiyun 	PHY_TYPE_88E1111 = 2,
20*4882a593Smuzhiyun 	PHY_TYPE_SFX7101 = 3,
21*4882a593Smuzhiyun 	PHY_TYPE_QT2022C2 = 4,
22*4882a593Smuzhiyun 	PHY_TYPE_PM8358 = 6,
23*4882a593Smuzhiyun 	PHY_TYPE_SFT9001A = 8,
24*4882a593Smuzhiyun 	PHY_TYPE_QT2025C = 9,
25*4882a593Smuzhiyun 	PHY_TYPE_SFT9001B = 10,
26*4882a593Smuzhiyun };
27*4882a593Smuzhiyun 
28*4882a593Smuzhiyun enum {
29*4882a593Smuzhiyun 	SIENA_STAT_tx_bytes = GENERIC_STAT_COUNT,
30*4882a593Smuzhiyun 	SIENA_STAT_tx_good_bytes,
31*4882a593Smuzhiyun 	SIENA_STAT_tx_bad_bytes,
32*4882a593Smuzhiyun 	SIENA_STAT_tx_packets,
33*4882a593Smuzhiyun 	SIENA_STAT_tx_bad,
34*4882a593Smuzhiyun 	SIENA_STAT_tx_pause,
35*4882a593Smuzhiyun 	SIENA_STAT_tx_control,
36*4882a593Smuzhiyun 	SIENA_STAT_tx_unicast,
37*4882a593Smuzhiyun 	SIENA_STAT_tx_multicast,
38*4882a593Smuzhiyun 	SIENA_STAT_tx_broadcast,
39*4882a593Smuzhiyun 	SIENA_STAT_tx_lt64,
40*4882a593Smuzhiyun 	SIENA_STAT_tx_64,
41*4882a593Smuzhiyun 	SIENA_STAT_tx_65_to_127,
42*4882a593Smuzhiyun 	SIENA_STAT_tx_128_to_255,
43*4882a593Smuzhiyun 	SIENA_STAT_tx_256_to_511,
44*4882a593Smuzhiyun 	SIENA_STAT_tx_512_to_1023,
45*4882a593Smuzhiyun 	SIENA_STAT_tx_1024_to_15xx,
46*4882a593Smuzhiyun 	SIENA_STAT_tx_15xx_to_jumbo,
47*4882a593Smuzhiyun 	SIENA_STAT_tx_gtjumbo,
48*4882a593Smuzhiyun 	SIENA_STAT_tx_collision,
49*4882a593Smuzhiyun 	SIENA_STAT_tx_single_collision,
50*4882a593Smuzhiyun 	SIENA_STAT_tx_multiple_collision,
51*4882a593Smuzhiyun 	SIENA_STAT_tx_excessive_collision,
52*4882a593Smuzhiyun 	SIENA_STAT_tx_deferred,
53*4882a593Smuzhiyun 	SIENA_STAT_tx_late_collision,
54*4882a593Smuzhiyun 	SIENA_STAT_tx_excessive_deferred,
55*4882a593Smuzhiyun 	SIENA_STAT_tx_non_tcpudp,
56*4882a593Smuzhiyun 	SIENA_STAT_tx_mac_src_error,
57*4882a593Smuzhiyun 	SIENA_STAT_tx_ip_src_error,
58*4882a593Smuzhiyun 	SIENA_STAT_rx_bytes,
59*4882a593Smuzhiyun 	SIENA_STAT_rx_good_bytes,
60*4882a593Smuzhiyun 	SIENA_STAT_rx_bad_bytes,
61*4882a593Smuzhiyun 	SIENA_STAT_rx_packets,
62*4882a593Smuzhiyun 	SIENA_STAT_rx_good,
63*4882a593Smuzhiyun 	SIENA_STAT_rx_bad,
64*4882a593Smuzhiyun 	SIENA_STAT_rx_pause,
65*4882a593Smuzhiyun 	SIENA_STAT_rx_control,
66*4882a593Smuzhiyun 	SIENA_STAT_rx_unicast,
67*4882a593Smuzhiyun 	SIENA_STAT_rx_multicast,
68*4882a593Smuzhiyun 	SIENA_STAT_rx_broadcast,
69*4882a593Smuzhiyun 	SIENA_STAT_rx_lt64,
70*4882a593Smuzhiyun 	SIENA_STAT_rx_64,
71*4882a593Smuzhiyun 	SIENA_STAT_rx_65_to_127,
72*4882a593Smuzhiyun 	SIENA_STAT_rx_128_to_255,
73*4882a593Smuzhiyun 	SIENA_STAT_rx_256_to_511,
74*4882a593Smuzhiyun 	SIENA_STAT_rx_512_to_1023,
75*4882a593Smuzhiyun 	SIENA_STAT_rx_1024_to_15xx,
76*4882a593Smuzhiyun 	SIENA_STAT_rx_15xx_to_jumbo,
77*4882a593Smuzhiyun 	SIENA_STAT_rx_gtjumbo,
78*4882a593Smuzhiyun 	SIENA_STAT_rx_bad_gtjumbo,
79*4882a593Smuzhiyun 	SIENA_STAT_rx_overflow,
80*4882a593Smuzhiyun 	SIENA_STAT_rx_false_carrier,
81*4882a593Smuzhiyun 	SIENA_STAT_rx_symbol_error,
82*4882a593Smuzhiyun 	SIENA_STAT_rx_align_error,
83*4882a593Smuzhiyun 	SIENA_STAT_rx_length_error,
84*4882a593Smuzhiyun 	SIENA_STAT_rx_internal_error,
85*4882a593Smuzhiyun 	SIENA_STAT_rx_nodesc_drop_cnt,
86*4882a593Smuzhiyun 	SIENA_STAT_COUNT
87*4882a593Smuzhiyun };
88*4882a593Smuzhiyun 
89*4882a593Smuzhiyun /**
90*4882a593Smuzhiyun  * struct siena_nic_data - Siena NIC state
91*4882a593Smuzhiyun  * @efx: Pointer back to main interface structure
92*4882a593Smuzhiyun  * @wol_filter_id: Wake-on-LAN packet filter id
93*4882a593Smuzhiyun  * @stats: Hardware statistics
94*4882a593Smuzhiyun  * @vf: Array of &struct siena_vf objects
95*4882a593Smuzhiyun  * @vf_buftbl_base: The zeroth buffer table index used to back VF queues.
96*4882a593Smuzhiyun  * @vfdi_status: Common VFDI status page to be dmad to VF address space.
97*4882a593Smuzhiyun  * @local_addr_list: List of local addresses. Protected by %local_lock.
98*4882a593Smuzhiyun  * @local_page_list: List of DMA addressable pages used to broadcast
99*4882a593Smuzhiyun  *	%local_addr_list. Protected by %local_lock.
100*4882a593Smuzhiyun  * @local_lock: Mutex protecting %local_addr_list and %local_page_list.
101*4882a593Smuzhiyun  * @peer_work: Work item to broadcast peer addresses to VMs.
102*4882a593Smuzhiyun  */
103*4882a593Smuzhiyun struct siena_nic_data {
104*4882a593Smuzhiyun 	struct efx_nic *efx;
105*4882a593Smuzhiyun 	int wol_filter_id;
106*4882a593Smuzhiyun 	u64 stats[SIENA_STAT_COUNT];
107*4882a593Smuzhiyun #ifdef CONFIG_SFC_SRIOV
108*4882a593Smuzhiyun 	struct siena_vf *vf;
109*4882a593Smuzhiyun 	struct efx_channel *vfdi_channel;
110*4882a593Smuzhiyun 	unsigned vf_buftbl_base;
111*4882a593Smuzhiyun 	struct efx_buffer vfdi_status;
112*4882a593Smuzhiyun 	struct list_head local_addr_list;
113*4882a593Smuzhiyun 	struct list_head local_page_list;
114*4882a593Smuzhiyun 	struct mutex local_lock;
115*4882a593Smuzhiyun 	struct work_struct peer_work;
116*4882a593Smuzhiyun #endif
117*4882a593Smuzhiyun };
118*4882a593Smuzhiyun 
119*4882a593Smuzhiyun enum {
120*4882a593Smuzhiyun 	EF10_STAT_port_tx_bytes = GENERIC_STAT_COUNT,
121*4882a593Smuzhiyun 	EF10_STAT_port_tx_packets,
122*4882a593Smuzhiyun 	EF10_STAT_port_tx_pause,
123*4882a593Smuzhiyun 	EF10_STAT_port_tx_control,
124*4882a593Smuzhiyun 	EF10_STAT_port_tx_unicast,
125*4882a593Smuzhiyun 	EF10_STAT_port_tx_multicast,
126*4882a593Smuzhiyun 	EF10_STAT_port_tx_broadcast,
127*4882a593Smuzhiyun 	EF10_STAT_port_tx_lt64,
128*4882a593Smuzhiyun 	EF10_STAT_port_tx_64,
129*4882a593Smuzhiyun 	EF10_STAT_port_tx_65_to_127,
130*4882a593Smuzhiyun 	EF10_STAT_port_tx_128_to_255,
131*4882a593Smuzhiyun 	EF10_STAT_port_tx_256_to_511,
132*4882a593Smuzhiyun 	EF10_STAT_port_tx_512_to_1023,
133*4882a593Smuzhiyun 	EF10_STAT_port_tx_1024_to_15xx,
134*4882a593Smuzhiyun 	EF10_STAT_port_tx_15xx_to_jumbo,
135*4882a593Smuzhiyun 	EF10_STAT_port_rx_bytes,
136*4882a593Smuzhiyun 	EF10_STAT_port_rx_bytes_minus_good_bytes,
137*4882a593Smuzhiyun 	EF10_STAT_port_rx_good_bytes,
138*4882a593Smuzhiyun 	EF10_STAT_port_rx_bad_bytes,
139*4882a593Smuzhiyun 	EF10_STAT_port_rx_packets,
140*4882a593Smuzhiyun 	EF10_STAT_port_rx_good,
141*4882a593Smuzhiyun 	EF10_STAT_port_rx_bad,
142*4882a593Smuzhiyun 	EF10_STAT_port_rx_pause,
143*4882a593Smuzhiyun 	EF10_STAT_port_rx_control,
144*4882a593Smuzhiyun 	EF10_STAT_port_rx_unicast,
145*4882a593Smuzhiyun 	EF10_STAT_port_rx_multicast,
146*4882a593Smuzhiyun 	EF10_STAT_port_rx_broadcast,
147*4882a593Smuzhiyun 	EF10_STAT_port_rx_lt64,
148*4882a593Smuzhiyun 	EF10_STAT_port_rx_64,
149*4882a593Smuzhiyun 	EF10_STAT_port_rx_65_to_127,
150*4882a593Smuzhiyun 	EF10_STAT_port_rx_128_to_255,
151*4882a593Smuzhiyun 	EF10_STAT_port_rx_256_to_511,
152*4882a593Smuzhiyun 	EF10_STAT_port_rx_512_to_1023,
153*4882a593Smuzhiyun 	EF10_STAT_port_rx_1024_to_15xx,
154*4882a593Smuzhiyun 	EF10_STAT_port_rx_15xx_to_jumbo,
155*4882a593Smuzhiyun 	EF10_STAT_port_rx_gtjumbo,
156*4882a593Smuzhiyun 	EF10_STAT_port_rx_bad_gtjumbo,
157*4882a593Smuzhiyun 	EF10_STAT_port_rx_overflow,
158*4882a593Smuzhiyun 	EF10_STAT_port_rx_align_error,
159*4882a593Smuzhiyun 	EF10_STAT_port_rx_length_error,
160*4882a593Smuzhiyun 	EF10_STAT_port_rx_nodesc_drops,
161*4882a593Smuzhiyun 	EF10_STAT_port_rx_pm_trunc_bb_overflow,
162*4882a593Smuzhiyun 	EF10_STAT_port_rx_pm_discard_bb_overflow,
163*4882a593Smuzhiyun 	EF10_STAT_port_rx_pm_trunc_vfifo_full,
164*4882a593Smuzhiyun 	EF10_STAT_port_rx_pm_discard_vfifo_full,
165*4882a593Smuzhiyun 	EF10_STAT_port_rx_pm_trunc_qbb,
166*4882a593Smuzhiyun 	EF10_STAT_port_rx_pm_discard_qbb,
167*4882a593Smuzhiyun 	EF10_STAT_port_rx_pm_discard_mapping,
168*4882a593Smuzhiyun 	EF10_STAT_port_rx_dp_q_disabled_packets,
169*4882a593Smuzhiyun 	EF10_STAT_port_rx_dp_di_dropped_packets,
170*4882a593Smuzhiyun 	EF10_STAT_port_rx_dp_streaming_packets,
171*4882a593Smuzhiyun 	EF10_STAT_port_rx_dp_hlb_fetch,
172*4882a593Smuzhiyun 	EF10_STAT_port_rx_dp_hlb_wait,
173*4882a593Smuzhiyun 	EF10_STAT_rx_unicast,
174*4882a593Smuzhiyun 	EF10_STAT_rx_unicast_bytes,
175*4882a593Smuzhiyun 	EF10_STAT_rx_multicast,
176*4882a593Smuzhiyun 	EF10_STAT_rx_multicast_bytes,
177*4882a593Smuzhiyun 	EF10_STAT_rx_broadcast,
178*4882a593Smuzhiyun 	EF10_STAT_rx_broadcast_bytes,
179*4882a593Smuzhiyun 	EF10_STAT_rx_bad,
180*4882a593Smuzhiyun 	EF10_STAT_rx_bad_bytes,
181*4882a593Smuzhiyun 	EF10_STAT_rx_overflow,
182*4882a593Smuzhiyun 	EF10_STAT_tx_unicast,
183*4882a593Smuzhiyun 	EF10_STAT_tx_unicast_bytes,
184*4882a593Smuzhiyun 	EF10_STAT_tx_multicast,
185*4882a593Smuzhiyun 	EF10_STAT_tx_multicast_bytes,
186*4882a593Smuzhiyun 	EF10_STAT_tx_broadcast,
187*4882a593Smuzhiyun 	EF10_STAT_tx_broadcast_bytes,
188*4882a593Smuzhiyun 	EF10_STAT_tx_bad,
189*4882a593Smuzhiyun 	EF10_STAT_tx_bad_bytes,
190*4882a593Smuzhiyun 	EF10_STAT_tx_overflow,
191*4882a593Smuzhiyun 	EF10_STAT_V1_COUNT,
192*4882a593Smuzhiyun 	EF10_STAT_fec_uncorrected_errors = EF10_STAT_V1_COUNT,
193*4882a593Smuzhiyun 	EF10_STAT_fec_corrected_errors,
194*4882a593Smuzhiyun 	EF10_STAT_fec_corrected_symbols_lane0,
195*4882a593Smuzhiyun 	EF10_STAT_fec_corrected_symbols_lane1,
196*4882a593Smuzhiyun 	EF10_STAT_fec_corrected_symbols_lane2,
197*4882a593Smuzhiyun 	EF10_STAT_fec_corrected_symbols_lane3,
198*4882a593Smuzhiyun 	EF10_STAT_ctpio_vi_busy_fallback,
199*4882a593Smuzhiyun 	EF10_STAT_ctpio_long_write_success,
200*4882a593Smuzhiyun 	EF10_STAT_ctpio_missing_dbell_fail,
201*4882a593Smuzhiyun 	EF10_STAT_ctpio_overflow_fail,
202*4882a593Smuzhiyun 	EF10_STAT_ctpio_underflow_fail,
203*4882a593Smuzhiyun 	EF10_STAT_ctpio_timeout_fail,
204*4882a593Smuzhiyun 	EF10_STAT_ctpio_noncontig_wr_fail,
205*4882a593Smuzhiyun 	EF10_STAT_ctpio_frm_clobber_fail,
206*4882a593Smuzhiyun 	EF10_STAT_ctpio_invalid_wr_fail,
207*4882a593Smuzhiyun 	EF10_STAT_ctpio_vi_clobber_fallback,
208*4882a593Smuzhiyun 	EF10_STAT_ctpio_unqualified_fallback,
209*4882a593Smuzhiyun 	EF10_STAT_ctpio_runt_fallback,
210*4882a593Smuzhiyun 	EF10_STAT_ctpio_success,
211*4882a593Smuzhiyun 	EF10_STAT_ctpio_fallback,
212*4882a593Smuzhiyun 	EF10_STAT_ctpio_poison,
213*4882a593Smuzhiyun 	EF10_STAT_ctpio_erase,
214*4882a593Smuzhiyun 	EF10_STAT_COUNT
215*4882a593Smuzhiyun };
216*4882a593Smuzhiyun 
217*4882a593Smuzhiyun /* Maximum number of TX PIO buffers we may allocate to a function.
218*4882a593Smuzhiyun  * This matches the total number of buffers on each SFC9100-family
219*4882a593Smuzhiyun  * controller.
220*4882a593Smuzhiyun  */
221*4882a593Smuzhiyun #define EF10_TX_PIOBUF_COUNT 16
222*4882a593Smuzhiyun 
223*4882a593Smuzhiyun /**
224*4882a593Smuzhiyun  * struct efx_ef10_nic_data - EF10 architecture NIC state
225*4882a593Smuzhiyun  * @mcdi_buf: DMA buffer for MCDI
226*4882a593Smuzhiyun  * @warm_boot_count: Last seen MC warm boot count
227*4882a593Smuzhiyun  * @vi_base: Absolute index of first VI in this function
228*4882a593Smuzhiyun  * @n_allocated_vis: Number of VIs allocated to this function
229*4882a593Smuzhiyun  * @n_piobufs: Number of PIO buffers allocated to this function
230*4882a593Smuzhiyun  * @wc_membase: Base address of write-combining mapping of the memory BAR
231*4882a593Smuzhiyun  * @pio_write_base: Base address for writing PIO buffers
232*4882a593Smuzhiyun  * @pio_write_vi_base: Relative VI number for @pio_write_base
233*4882a593Smuzhiyun  * @piobuf_handle: Handle of each PIO buffer allocated
234*4882a593Smuzhiyun  * @piobuf_size: size of a single PIO buffer
235*4882a593Smuzhiyun  * @must_restore_piobufs: Flag: PIO buffers have yet to be restored after MC
236*4882a593Smuzhiyun  *	reboot
237*4882a593Smuzhiyun  * @mc_stats: Scratch buffer for converting statistics to the kernel's format
238*4882a593Smuzhiyun  * @stats: Hardware statistics
239*4882a593Smuzhiyun  * @workaround_35388: Flag: firmware supports workaround for bug 35388
240*4882a593Smuzhiyun  * @workaround_26807: Flag: firmware supports workaround for bug 26807
241*4882a593Smuzhiyun  * @workaround_61265: Flag: firmware supports workaround for bug 61265
242*4882a593Smuzhiyun  * @must_check_datapath_caps: Flag: @datapath_caps needs to be revalidated
243*4882a593Smuzhiyun  *	after MC reboot
244*4882a593Smuzhiyun  * @datapath_caps: Capabilities of datapath firmware (FLAGS1 field of
245*4882a593Smuzhiyun  *	%MC_CMD_GET_CAPABILITIES response)
246*4882a593Smuzhiyun  * @datapath_caps2: Further Capabilities of datapath firmware (FLAGS2 field of
247*4882a593Smuzhiyun  * %MC_CMD_GET_CAPABILITIES response)
248*4882a593Smuzhiyun  * @rx_dpcpu_fw_id: Firmware ID of the RxDPCPU
249*4882a593Smuzhiyun  * @tx_dpcpu_fw_id: Firmware ID of the TxDPCPU
250*4882a593Smuzhiyun  * @must_probe_vswitching: Flag: vswitching has yet to be setup after MC reboot
251*4882a593Smuzhiyun  * @pf_index: The number for this PF, or the parent PF if this is a VF
252*4882a593Smuzhiyun #ifdef CONFIG_SFC_SRIOV
253*4882a593Smuzhiyun  * @vf: Pointer to VF data structure
254*4882a593Smuzhiyun #endif
255*4882a593Smuzhiyun  * @vport_mac: The MAC address on the vport, only for PFs; VFs will be zero
256*4882a593Smuzhiyun  * @vlan_list: List of VLANs added over the interface. Serialised by vlan_lock.
257*4882a593Smuzhiyun  * @vlan_lock: Lock to serialize access to vlan_list.
258*4882a593Smuzhiyun  * @udp_tunnels: UDP tunnel port numbers and types.
259*4882a593Smuzhiyun  * @udp_tunnels_dirty: flag indicating a reboot occurred while pushing
260*4882a593Smuzhiyun  *	@udp_tunnels to hardware and thus the push must be re-done.
261*4882a593Smuzhiyun  * @udp_tunnels_lock: Serialises writes to @udp_tunnels and @udp_tunnels_dirty.
262*4882a593Smuzhiyun  */
263*4882a593Smuzhiyun struct efx_ef10_nic_data {
264*4882a593Smuzhiyun 	struct efx_buffer mcdi_buf;
265*4882a593Smuzhiyun 	u16 warm_boot_count;
266*4882a593Smuzhiyun 	unsigned int vi_base;
267*4882a593Smuzhiyun 	unsigned int n_allocated_vis;
268*4882a593Smuzhiyun 	unsigned int n_piobufs;
269*4882a593Smuzhiyun 	void __iomem *wc_membase, *pio_write_base;
270*4882a593Smuzhiyun 	unsigned int pio_write_vi_base;
271*4882a593Smuzhiyun 	unsigned int piobuf_handle[EF10_TX_PIOBUF_COUNT];
272*4882a593Smuzhiyun 	u16 piobuf_size;
273*4882a593Smuzhiyun 	bool must_restore_piobufs;
274*4882a593Smuzhiyun 	__le64 *mc_stats;
275*4882a593Smuzhiyun 	u64 stats[EF10_STAT_COUNT];
276*4882a593Smuzhiyun 	bool workaround_35388;
277*4882a593Smuzhiyun 	bool workaround_26807;
278*4882a593Smuzhiyun 	bool workaround_61265;
279*4882a593Smuzhiyun 	bool must_check_datapath_caps;
280*4882a593Smuzhiyun 	u32 datapath_caps;
281*4882a593Smuzhiyun 	u32 datapath_caps2;
282*4882a593Smuzhiyun 	unsigned int rx_dpcpu_fw_id;
283*4882a593Smuzhiyun 	unsigned int tx_dpcpu_fw_id;
284*4882a593Smuzhiyun 	bool must_probe_vswitching;
285*4882a593Smuzhiyun 	unsigned int pf_index;
286*4882a593Smuzhiyun 	u8 port_id[ETH_ALEN];
287*4882a593Smuzhiyun #ifdef CONFIG_SFC_SRIOV
288*4882a593Smuzhiyun 	unsigned int vf_index;
289*4882a593Smuzhiyun 	struct ef10_vf *vf;
290*4882a593Smuzhiyun #endif
291*4882a593Smuzhiyun 	u8 vport_mac[ETH_ALEN];
292*4882a593Smuzhiyun 	struct list_head vlan_list;
293*4882a593Smuzhiyun 	struct mutex vlan_lock;
294*4882a593Smuzhiyun 	struct efx_udp_tunnel udp_tunnels[16];
295*4882a593Smuzhiyun 	bool udp_tunnels_dirty;
296*4882a593Smuzhiyun 	struct mutex udp_tunnels_lock;
297*4882a593Smuzhiyun 	u64 licensed_features;
298*4882a593Smuzhiyun };
299*4882a593Smuzhiyun 
300*4882a593Smuzhiyun /* TSOv2 */
301*4882a593Smuzhiyun int efx_ef10_tx_tso_desc(struct efx_tx_queue *tx_queue, struct sk_buff *skb,
302*4882a593Smuzhiyun 			 bool *data_mapped);
303*4882a593Smuzhiyun 
304*4882a593Smuzhiyun int efx_init_sriov(void);
305*4882a593Smuzhiyun void efx_fini_sriov(void);
306*4882a593Smuzhiyun 
307*4882a593Smuzhiyun extern const struct efx_nic_type siena_a0_nic_type;
308*4882a593Smuzhiyun extern const struct efx_nic_type efx_hunt_a0_nic_type;
309*4882a593Smuzhiyun extern const struct efx_nic_type efx_hunt_a0_vf_nic_type;
310*4882a593Smuzhiyun 
311*4882a593Smuzhiyun int falcon_probe_board(struct efx_nic *efx, u16 revision_info);
312*4882a593Smuzhiyun 
313*4882a593Smuzhiyun /* Falcon/Siena queue operations */
314*4882a593Smuzhiyun int efx_farch_tx_probe(struct efx_tx_queue *tx_queue);
315*4882a593Smuzhiyun void efx_farch_tx_init(struct efx_tx_queue *tx_queue);
316*4882a593Smuzhiyun void efx_farch_tx_fini(struct efx_tx_queue *tx_queue);
317*4882a593Smuzhiyun void efx_farch_tx_remove(struct efx_tx_queue *tx_queue);
318*4882a593Smuzhiyun void efx_farch_tx_write(struct efx_tx_queue *tx_queue);
319*4882a593Smuzhiyun unsigned int efx_farch_tx_limit_len(struct efx_tx_queue *tx_queue,
320*4882a593Smuzhiyun 				    dma_addr_t dma_addr, unsigned int len);
321*4882a593Smuzhiyun int efx_farch_rx_probe(struct efx_rx_queue *rx_queue);
322*4882a593Smuzhiyun void efx_farch_rx_init(struct efx_rx_queue *rx_queue);
323*4882a593Smuzhiyun void efx_farch_rx_fini(struct efx_rx_queue *rx_queue);
324*4882a593Smuzhiyun void efx_farch_rx_remove(struct efx_rx_queue *rx_queue);
325*4882a593Smuzhiyun void efx_farch_rx_write(struct efx_rx_queue *rx_queue);
326*4882a593Smuzhiyun void efx_farch_rx_defer_refill(struct efx_rx_queue *rx_queue);
327*4882a593Smuzhiyun int efx_farch_ev_probe(struct efx_channel *channel);
328*4882a593Smuzhiyun int efx_farch_ev_init(struct efx_channel *channel);
329*4882a593Smuzhiyun void efx_farch_ev_fini(struct efx_channel *channel);
330*4882a593Smuzhiyun void efx_farch_ev_remove(struct efx_channel *channel);
331*4882a593Smuzhiyun int efx_farch_ev_process(struct efx_channel *channel, int quota);
332*4882a593Smuzhiyun void efx_farch_ev_read_ack(struct efx_channel *channel);
333*4882a593Smuzhiyun void efx_farch_ev_test_generate(struct efx_channel *channel);
334*4882a593Smuzhiyun 
335*4882a593Smuzhiyun /* Falcon/Siena filter operations */
336*4882a593Smuzhiyun int efx_farch_filter_table_probe(struct efx_nic *efx);
337*4882a593Smuzhiyun void efx_farch_filter_table_restore(struct efx_nic *efx);
338*4882a593Smuzhiyun void efx_farch_filter_table_remove(struct efx_nic *efx);
339*4882a593Smuzhiyun void efx_farch_filter_update_rx_scatter(struct efx_nic *efx);
340*4882a593Smuzhiyun s32 efx_farch_filter_insert(struct efx_nic *efx, struct efx_filter_spec *spec,
341*4882a593Smuzhiyun 			    bool replace);
342*4882a593Smuzhiyun int efx_farch_filter_remove_safe(struct efx_nic *efx,
343*4882a593Smuzhiyun 				 enum efx_filter_priority priority,
344*4882a593Smuzhiyun 				 u32 filter_id);
345*4882a593Smuzhiyun int efx_farch_filter_get_safe(struct efx_nic *efx,
346*4882a593Smuzhiyun 			      enum efx_filter_priority priority, u32 filter_id,
347*4882a593Smuzhiyun 			      struct efx_filter_spec *);
348*4882a593Smuzhiyun int efx_farch_filter_clear_rx(struct efx_nic *efx,
349*4882a593Smuzhiyun 			      enum efx_filter_priority priority);
350*4882a593Smuzhiyun u32 efx_farch_filter_count_rx_used(struct efx_nic *efx,
351*4882a593Smuzhiyun 				   enum efx_filter_priority priority);
352*4882a593Smuzhiyun u32 efx_farch_filter_get_rx_id_limit(struct efx_nic *efx);
353*4882a593Smuzhiyun s32 efx_farch_filter_get_rx_ids(struct efx_nic *efx,
354*4882a593Smuzhiyun 				enum efx_filter_priority priority, u32 *buf,
355*4882a593Smuzhiyun 				u32 size);
356*4882a593Smuzhiyun #ifdef CONFIG_RFS_ACCEL
357*4882a593Smuzhiyun bool efx_farch_filter_rfs_expire_one(struct efx_nic *efx, u32 flow_id,
358*4882a593Smuzhiyun 				     unsigned int index);
359*4882a593Smuzhiyun #endif
360*4882a593Smuzhiyun void efx_farch_filter_sync_rx_mode(struct efx_nic *efx);
361*4882a593Smuzhiyun 
362*4882a593Smuzhiyun /* Falcon/Siena interrupts */
363*4882a593Smuzhiyun void efx_farch_irq_enable_master(struct efx_nic *efx);
364*4882a593Smuzhiyun int efx_farch_irq_test_generate(struct efx_nic *efx);
365*4882a593Smuzhiyun void efx_farch_irq_disable_master(struct efx_nic *efx);
366*4882a593Smuzhiyun irqreturn_t efx_farch_msi_interrupt(int irq, void *dev_id);
367*4882a593Smuzhiyun irqreturn_t efx_farch_legacy_interrupt(int irq, void *dev_id);
368*4882a593Smuzhiyun irqreturn_t efx_farch_fatal_interrupt(struct efx_nic *efx);
369*4882a593Smuzhiyun 
370*4882a593Smuzhiyun /* Global Resources */
371*4882a593Smuzhiyun void siena_prepare_flush(struct efx_nic *efx);
372*4882a593Smuzhiyun int efx_farch_fini_dmaq(struct efx_nic *efx);
373*4882a593Smuzhiyun void efx_farch_finish_flr(struct efx_nic *efx);
374*4882a593Smuzhiyun void siena_finish_flush(struct efx_nic *efx);
375*4882a593Smuzhiyun void falcon_start_nic_stats(struct efx_nic *efx);
376*4882a593Smuzhiyun void falcon_stop_nic_stats(struct efx_nic *efx);
377*4882a593Smuzhiyun int falcon_reset_xaui(struct efx_nic *efx);
378*4882a593Smuzhiyun void efx_farch_dimension_resources(struct efx_nic *efx, unsigned sram_lim_qw);
379*4882a593Smuzhiyun void efx_farch_init_common(struct efx_nic *efx);
380*4882a593Smuzhiyun void efx_farch_rx_push_indir_table(struct efx_nic *efx);
381*4882a593Smuzhiyun void efx_farch_rx_pull_indir_table(struct efx_nic *efx);
382*4882a593Smuzhiyun 
383*4882a593Smuzhiyun /* Tests */
384*4882a593Smuzhiyun struct efx_farch_register_test {
385*4882a593Smuzhiyun 	unsigned address;
386*4882a593Smuzhiyun 	efx_oword_t mask;
387*4882a593Smuzhiyun };
388*4882a593Smuzhiyun 
389*4882a593Smuzhiyun int efx_farch_test_registers(struct efx_nic *efx,
390*4882a593Smuzhiyun 			     const struct efx_farch_register_test *regs,
391*4882a593Smuzhiyun 			     size_t n_regs);
392*4882a593Smuzhiyun 
393*4882a593Smuzhiyun void efx_farch_generate_event(struct efx_nic *efx, unsigned int evq,
394*4882a593Smuzhiyun 			      efx_qword_t *event);
395*4882a593Smuzhiyun 
396*4882a593Smuzhiyun #endif /* EFX_NIC_H */
397