xref: /freebsd/sys/dev/ixl/ixl_pf.h (revision b8f51b8c5423af0795429836a00f2a968e791f6e)
161ae650dSJack F Vogel /******************************************************************************
261ae650dSJack F Vogel 
3f4cc2d17SEric Joyner   Copyright (c) 2013-2018, Intel Corporation
461ae650dSJack F Vogel   All rights reserved.
561ae650dSJack F Vogel 
661ae650dSJack F Vogel   Redistribution and use in source and binary forms, with or without
761ae650dSJack F Vogel   modification, are permitted provided that the following conditions are met:
861ae650dSJack F Vogel 
961ae650dSJack F Vogel    1. Redistributions of source code must retain the above copyright notice,
1061ae650dSJack F Vogel       this list of conditions and the following disclaimer.
1161ae650dSJack F Vogel 
1261ae650dSJack F Vogel    2. Redistributions in binary form must reproduce the above copyright
1361ae650dSJack F Vogel       notice, this list of conditions and the following disclaimer in the
1461ae650dSJack F Vogel       documentation and/or other materials provided with the distribution.
1561ae650dSJack F Vogel 
1661ae650dSJack F Vogel    3. Neither the name of the Intel Corporation nor the names of its
1761ae650dSJack F Vogel       contributors may be used to endorse or promote products derived from
1861ae650dSJack F Vogel       this software without specific prior written permission.
1961ae650dSJack F Vogel 
2061ae650dSJack F Vogel   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2161ae650dSJack F Vogel   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2261ae650dSJack F Vogel   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2361ae650dSJack F Vogel   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
2461ae650dSJack F Vogel   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2561ae650dSJack F Vogel   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2661ae650dSJack F Vogel   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2761ae650dSJack F Vogel   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2861ae650dSJack F Vogel   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2961ae650dSJack F Vogel   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3061ae650dSJack F Vogel   POSSIBILITY OF SUCH DAMAGE.
3161ae650dSJack F Vogel 
3261ae650dSJack F Vogel ******************************************************************************/
3361ae650dSJack F Vogel /*$FreeBSD$*/
3461ae650dSJack F Vogel 
3561ae650dSJack F Vogel 
3661ae650dSJack F Vogel #ifndef _IXL_PF_H_
3761ae650dSJack F Vogel #define _IXL_PF_H_
3861ae650dSJack F Vogel 
39b4a7ce06SEric Joyner #include "i40e_dcb.h"
40b4a7ce06SEric Joyner 
414294f337SSean Bruno #include "ixl.h"
424294f337SSean Bruno #include "ixl_pf_qmgr.h"
434294f337SSean Bruno 
4456c2c47bSJack F Vogel #define	VF_FLAG_ENABLED			0x01
4556c2c47bSJack F Vogel #define	VF_FLAG_SET_MAC_CAP		0x02
4656c2c47bSJack F Vogel #define	VF_FLAG_VLAN_CAP		0x04
4756c2c47bSJack F Vogel #define	VF_FLAG_PROMISC_CAP		0x08
4856c2c47bSJack F Vogel #define	VF_FLAG_MAC_ANTI_SPOOF		0x10
4956c2c47bSJack F Vogel 
501031d839SEric Joyner #define IXL_ICR0_CRIT_ERR_MASK 			\
511031d839SEric Joyner     (I40E_PFINT_ICR0_PCI_EXCEPTION_MASK | 	\
521031d839SEric Joyner      I40E_PFINT_ICR0_ECC_ERR_MASK | 		\
531031d839SEric Joyner      I40E_PFINT_ICR0_PE_CRITERR_MASK)
541031d839SEric Joyner 
551031d839SEric Joyner /* VF Interrupts */
561031d839SEric Joyner #define IXL_VPINT_LNKLSTN_REG(hw, vector, vf_num) \
571031d839SEric Joyner 	I40E_VPINT_LNKLSTN(((vector) - 1) + \
581031d839SEric Joyner 	    (((hw)->func_caps.num_msix_vectors_vf - 1) * (vf_num)))
591031d839SEric Joyner 
601031d839SEric Joyner #define IXL_VFINT_DYN_CTLN_REG(hw, vector, vf_num) \
611031d839SEric Joyner 	I40E_VFINT_DYN_CTLN(((vector) - 1) + \
621031d839SEric Joyner 	    (((hw)->func_caps.num_msix_vectors_vf - 1) * (vf_num)))
631031d839SEric Joyner 
64b4a7ce06SEric Joyner enum ixl_fw_mode {
65b4a7ce06SEric Joyner 	IXL_FW_MODE_NORMAL,
66b4a7ce06SEric Joyner 	IXL_FW_MODE_RECOVERY,
67b4a7ce06SEric Joyner 	IXL_FW_MODE_UEMPR
68b4a7ce06SEric Joyner };
69b4a7ce06SEric Joyner 
70b4a7ce06SEric Joyner enum ixl_i2c_access_method_t {
71b4a7ce06SEric Joyner 	IXL_I2C_ACCESS_METHOD_BEST_AVAILABLE = 0,
72b4a7ce06SEric Joyner 	IXL_I2C_ACCESS_METHOD_BIT_BANG_I2CPARAMS = 1,
73b4a7ce06SEric Joyner 	IXL_I2C_ACCESS_METHOD_REGISTER_I2CCMD = 2,
74b4a7ce06SEric Joyner 	IXL_I2C_ACCESS_METHOD_AQ = 3,
75b4a7ce06SEric Joyner 	IXL_I2C_ACCESS_METHOD_TYPE_LENGTH = 4
76b4a7ce06SEric Joyner };
77b4a7ce06SEric Joyner 
781031d839SEric Joyner /* Used in struct ixl_pf's state field */
79*b8f51b8cSPiotr Kubaj enum ixl_state {
80*b8f51b8cSPiotr Kubaj 	IXL_STATE_RECOVERY_MODE	= 0,
81*b8f51b8cSPiotr Kubaj 	IXL_STATE_RESETTING		= 1,
82*b8f51b8cSPiotr Kubaj 	IXL_STATE_MDD_PENDING	= 2,
83*b8f51b8cSPiotr Kubaj 	IXL_STATE_PF_RESET_REQ	= 3,
84*b8f51b8cSPiotr Kubaj 	IXL_STATE_VF_RESET_REQ	= 4,
85*b8f51b8cSPiotr Kubaj 	IXL_STATE_PF_CRIT_ERR	= 5,
86*b8f51b8cSPiotr Kubaj 	IXL_STATE_CORE_RESET_REQ	= 6,
87*b8f51b8cSPiotr Kubaj 	IXL_STATE_GLOB_RESET_REQ	= 7,
88*b8f51b8cSPiotr Kubaj 	IXL_STATE_EMP_RESET_REQ	= 8,
89*b8f51b8cSPiotr Kubaj 	IXL_STATE_FW_LLDP_DISABLED	= 9,
90*b8f51b8cSPiotr Kubaj 	IXL_STATE_EEE_ENABLED	= 10,
91*b8f51b8cSPiotr Kubaj 	IXL_STATE_LINK_ACTIVE_ON_DOWN = 11,
921031d839SEric Joyner };
93fdb6f38aSEric Joyner 
94b4a7ce06SEric Joyner #define IXL_PF_IN_RECOVERY_MODE(pf)	\
95*b8f51b8cSPiotr Kubaj 	ixl_test_state(&pf->state, IXL_STATE_RECOVERY_MODE)
96b4a7ce06SEric Joyner 
977d4dceecSKrzysztof Galazka #define IXL_PF_IS_RESETTING(pf)	\
98*b8f51b8cSPiotr Kubaj 	ixl_test_state(&pf->state, IXL_STATE_RESETTING)
99b4a7ce06SEric Joyner 
10056c2c47bSJack F Vogel struct ixl_vf {
10156c2c47bSJack F Vogel 	struct ixl_vsi		vsi;
1021031d839SEric Joyner 	u32			vf_flags;
1031031d839SEric Joyner 	u32			num_mdd_events;
10456c2c47bSJack F Vogel 
1051031d839SEric Joyner 	u8			mac[ETHER_ADDR_LEN];
1061031d839SEric Joyner 	u16			vf_num;
107b4a7ce06SEric Joyner 	struct virtchnl_version_info version;
10856c2c47bSJack F Vogel 
1094294f337SSean Bruno 	struct ixl_pf_qtag	qtag;
11056c2c47bSJack F Vogel };
11156c2c47bSJack F Vogel 
11261ae650dSJack F Vogel /* Physical controller structure */
11361ae650dSJack F Vogel struct ixl_pf {
1141031d839SEric Joyner 	struct ixl_vsi		vsi;
1151031d839SEric Joyner 
11661ae650dSJack F Vogel 	struct i40e_hw		hw;
11761ae650dSJack F Vogel 	struct i40e_osdep	osdep;
118bd937497SJean-Sébastien Pédron 	device_t		dev;
11961ae650dSJack F Vogel 
12061ae650dSJack F Vogel 	struct resource		*pci_mem;
12161ae650dSJack F Vogel 
122cb6b8299SEric Joyner #ifdef IXL_IW
123cb6b8299SEric Joyner 	int			iw_msix;
124cb6b8299SEric Joyner 	bool			iw_enabled;
125cb6b8299SEric Joyner #endif
1261031d839SEric Joyner 	u32			state;
127cb6b8299SEric Joyner 	u8			supported_speeds;
12861ae650dSJack F Vogel 
1294294f337SSean Bruno 	struct ixl_pf_qmgr	qmgr;
1304294f337SSean Bruno 	struct ixl_pf_qtag	qtag;
1314294f337SSean Bruno 
132b4a7ce06SEric Joyner 	char admin_mtx_name[16]; /* name of the admin mutex */
133b4a7ce06SEric Joyner 	struct mtx admin_mtx; /* mutex to protect the admin timer */
134b4a7ce06SEric Joyner 	struct callout admin_timer; /* timer to trigger admin task */
135b4a7ce06SEric Joyner 
1364294f337SSean Bruno 	/* Tunable values */
137b4a7ce06SEric Joyner #ifdef IXL_DEBUG_FC
1384294f337SSean Bruno 	bool			enable_tx_fc_filter;
139b4a7ce06SEric Joyner #endif
140b4a7ce06SEric Joyner #ifdef IXL_DEBUG
141b4a7ce06SEric Joyner 	bool			recovery_mode;
142b4a7ce06SEric Joyner #endif
1434294f337SSean Bruno 	int			dynamic_rx_itr;
1444294f337SSean Bruno 	int			dynamic_tx_itr;
1454294f337SSean Bruno 	int			tx_itr;
1464294f337SSean Bruno 	int			rx_itr;
14777c1fcecSEric Joyner 	int			enable_vf_loopback;
1484294f337SSean Bruno 
14956c2c47bSJack F Vogel 	bool			link_up;
15061ae650dSJack F Vogel 	int			advertised_speed;
1514294f337SSean Bruno 	int			fc; /* link flow ctrl setting */
1524294f337SSean Bruno 	enum ixl_dbg_mask	dbg_mask;
153cb6b8299SEric Joyner 	bool			has_i2c;
15461ae650dSJack F Vogel 
15561ae650dSJack F Vogel 	/* Misc stats maintained by the driver */
15661ae650dSJack F Vogel 	u64			admin_irq;
15761ae650dSJack F Vogel 
15861ae650dSJack F Vogel 	/* Statistics from hw */
15961ae650dSJack F Vogel 	struct i40e_hw_port_stats 	stats;
16061ae650dSJack F Vogel 	struct i40e_hw_port_stats	stats_offsets;
16161ae650dSJack F Vogel 	bool 				stat_offsets_loaded;
16256c2c47bSJack F Vogel 
1631031d839SEric Joyner 	/* I2C access methods */
164b4a7ce06SEric Joyner 	enum ixl_i2c_access_method_t i2c_access_method;
1651031d839SEric Joyner 	s32 (*read_i2c_byte)(struct ixl_pf *pf, u8 byte_offset,
1661031d839SEric Joyner 	    u8 dev_addr, u8 *data);
1671031d839SEric Joyner 	s32 (*write_i2c_byte)(struct ixl_pf *pf, u8 byte_offset,
1681031d839SEric Joyner 	    u8 dev_addr, u8 data);
1691031d839SEric Joyner 
1704294f337SSean Bruno 	/* SR-IOV */
17156c2c47bSJack F Vogel 	struct ixl_vf		*vfs;
17256c2c47bSJack F Vogel 	int			num_vfs;
17356c2c47bSJack F Vogel 	uint16_t		veb_seid;
174b4a7ce06SEric Joyner 	int			vc_debug_lvl;
17561ae650dSJack F Vogel };
17661ae650dSJack F Vogel 
177223d846dSEric Joyner /*
178223d846dSEric Joyner  * Defines used for NVM update ioctls.
179223d846dSEric Joyner  * This value is used in the Solaris tool, too.
180223d846dSEric Joyner  */
181223d846dSEric Joyner #define I40E_NVM_ACCESS \
182223d846dSEric Joyner      (((((((('E' << 4) + '1') << 4) + 'K') << 4) + 'G') << 4) | 5)
183223d846dSEric Joyner 
1847f70bec6SEric Joyner #define IXL_DEFAULT_PHY_INT_MASK \
18595bb0504SEric Joyner      ((~(I40E_AQ_EVENT_LINK_UPDOWN | I40E_AQ_EVENT_MODULE_QUAL_FAIL \
18695bb0504SEric Joyner       | I40E_AQ_EVENT_MEDIA_NA)) & 0x3FF)
1877f70bec6SEric Joyner 
1881d767a8eSEric Joyner /*** Sysctl help messages; displayed with "sysctl -d" ***/
1891d767a8eSEric Joyner 
19095bb0504SEric Joyner #define IXL_SYSCTL_HELP_SET_ADVERTISE	\
19195bb0504SEric Joyner "\nControl advertised link speed.\n"	\
19295bb0504SEric Joyner "Flags:\n"				\
19395bb0504SEric Joyner "\t 0x1 - advertise 100M\n"		\
19495bb0504SEric Joyner "\t 0x2 - advertise 1G\n"		\
19595bb0504SEric Joyner "\t 0x4 - advertise 10G\n"		\
1961d767a8eSEric Joyner "\t 0x8 - advertise 20G\n"		\
197cb6b8299SEric Joyner "\t0x10 - advertise 25G\n"		\
1982984a8ddSEric Joyner "\t0x20 - advertise 40G\n"		\
1992984a8ddSEric Joyner "\t0x40 - advertise 2.5G\n"		\
2002984a8ddSEric Joyner "\t0x80 - advertise 5G\n\n"		\
201cb6b8299SEric Joyner "Set to 0 to disable link.\n"		\
202cb6b8299SEric Joyner "Use \"sysctl -x\" to view flags properly."
20395bb0504SEric Joyner 
204ceebc2f3SEric Joyner #define IXL_SYSCTL_HELP_SUPPORTED_SPEED	\
205ceebc2f3SEric Joyner "\nSupported link speeds.\n"		\
206ceebc2f3SEric Joyner "Flags:\n"				\
207ceebc2f3SEric Joyner "\t 0x1 - 100M\n"			\
208ceebc2f3SEric Joyner "\t 0x2 - 1G\n"				\
209ceebc2f3SEric Joyner "\t 0x4 - 10G\n"			\
210ceebc2f3SEric Joyner "\t 0x8 - 20G\n"			\
211ceebc2f3SEric Joyner "\t0x10 - 25G\n"			\
2122984a8ddSEric Joyner "\t0x20 - 40G\n"			\
2132984a8ddSEric Joyner "\t0x40 - 2.5G\n"			\
2142984a8ddSEric Joyner "\t0x80 - 5G\n\n"			\
215ceebc2f3SEric Joyner "Use \"sysctl -x\" to view flags properly."
216ceebc2f3SEric Joyner 
21795bb0504SEric Joyner #define IXL_SYSCTL_HELP_FC				\
21895bb0504SEric Joyner "\nSet flow control mode using the values below.\n" 	\
21995bb0504SEric Joyner "\t0 - off\n" 						\
22095bb0504SEric Joyner "\t1 - rx pause\n" 					\
22195bb0504SEric Joyner "\t2 - tx pause\n"					\
22295bb0504SEric Joyner "\t3 - tx and rx pause"
22395bb0504SEric Joyner 
22495bb0504SEric Joyner #define IXL_SYSCTL_HELP_LINK_STATUS					\
22595bb0504SEric Joyner "\nExecutes a \"Get Link Status\" command on the Admin Queue, and displays" \
2261031d839SEric Joyner " the response."
22756c2c47bSJack F Vogel 
228ceebc2f3SEric Joyner #define IXL_SYSCTL_HELP_FW_LLDP		\
229ceebc2f3SEric Joyner "\nFW LLDP engine:\n"			\
230ceebc2f3SEric Joyner "\t0 - disable\n"			\
231ceebc2f3SEric Joyner "\t1 - enable\n"
232ceebc2f3SEric Joyner 
23321802a12SKrzysztof Galazka #define IXL_SYSCTL_HELP_SET_LINK_ACTIVE			\
23421802a12SKrzysztof Galazka "\nKeep link active after setting interface down:\n"	\
23521802a12SKrzysztof Galazka "\t0 - disable\n"					\
23621802a12SKrzysztof Galazka "\t1 - enable\n"
23721802a12SKrzysztof Galazka 
2381031d839SEric Joyner #define IXL_SYSCTL_HELP_READ_I2C		\
2391031d839SEric Joyner "\nRead a byte from I2C bus\n"			\
2401031d839SEric Joyner "Input: 32-bit value\n"				\
2411031d839SEric Joyner "\tbits 0-7:   device address (0xA0 or 0xA2)\n"	\
2421031d839SEric Joyner "\tbits 8-15:  offset (0-255)\n"		\
2431031d839SEric Joyner "\tbits 16-31: unused\n"			\
2441031d839SEric Joyner "Output: 8-bit value read"
2451031d839SEric Joyner 
2461031d839SEric Joyner #define IXL_SYSCTL_HELP_WRITE_I2C		\
2471031d839SEric Joyner "\nWrite a byte to the I2C bus\n"		\
2481031d839SEric Joyner "Input: 32-bit value\n"				\
2491031d839SEric Joyner "\tbits 0-7:   device address (0xA0 or 0xA2)\n"	\
2501031d839SEric Joyner "\tbits 8-15:  offset (0-255)\n"		\
2511031d839SEric Joyner "\tbits 16-23: value to write\n"		\
2521031d839SEric Joyner "\tbits 24-31: unused\n"			\
2531031d839SEric Joyner "Output: 8-bit value written"
2541031d839SEric Joyner 
2551031d839SEric Joyner #define IXL_SYSCTL_HELP_I2C_METHOD		\
2561031d839SEric Joyner "\nI2C access method that driver will use:\n"	\
2571031d839SEric Joyner "\t0 - best available method\n"			\
2581031d839SEric Joyner "\t1 - bit bang via I2CPARAMS register\n"	\
2591031d839SEric Joyner "\t2 - register read/write via I2CCMD register\n" \
2601031d839SEric Joyner "\t3 - Use Admin Queue command (best)\n"	\
2611031d839SEric Joyner "Using the Admin Queue is only supported on 710 devices with FW version 1.7 or higher"
2621031d839SEric Joyner 
26377c1fcecSEric Joyner #define IXL_SYSCTL_HELP_VF_LOOPBACK		\
26477c1fcecSEric Joyner "\nDetermines mode that embedded device switch will use when SR-IOV is initialized:\n"	\
26577c1fcecSEric Joyner "\t0 - Disable (VEPA)\n"			\
26677c1fcecSEric Joyner "\t1 - Enable (VEB)\n"				\
26777c1fcecSEric Joyner "Enabling this will allow VFs in separate VMs to communicate over the hardware bridge."
26877c1fcecSEric Joyner 
2691d767a8eSEric Joyner /*** Functions / Macros ***/
270cb6b8299SEric Joyner /* Adjust the level here to 10 or over to print stats messages */
271cb6b8299SEric Joyner #define	I40E_VC_DEBUG(p, level, ...)				\
27256c2c47bSJack F Vogel 	do {							\
273cb6b8299SEric Joyner 		if (level < 10)					\
274cb6b8299SEric Joyner 			ixl_dbg(p, IXL_DBG_IOV_VC, ##__VA_ARGS__); \
27556c2c47bSJack F Vogel 	} while (0)
27656c2c47bSJack F Vogel 
27756c2c47bSJack F Vogel #define	i40e_send_vf_nack(pf, vf, op, st) \
27856c2c47bSJack F Vogel 	ixl_send_vf_nack_msg((pf), (vf), (op), (st), __FILE__, __LINE__)
27961ae650dSJack F Vogel 
280cb6b8299SEric Joyner /* Debug printing */
281b4a7ce06SEric Joyner #define ixl_dbg(pf, m, s, ...) ixl_debug_core((pf)->dev, (pf)->dbg_mask, m, s, ##__VA_ARGS__)
282b4a7ce06SEric Joyner #define ixl_dbg_info(pf, s, ...) ixl_debug_core((pf)->dev, (pf)->dbg_mask, IXL_DBG_INFO, s, ##__VA_ARGS__)
283b4a7ce06SEric Joyner #define ixl_dbg_filter(pf, s, ...) ixl_debug_core((pf)->dev, (pf)->dbg_mask, IXL_DBG_FILTER, s, ##__VA_ARGS__)
284b4a7ce06SEric Joyner #define ixl_dbg_iov(pf, s, ...) ixl_debug_core((pf)->dev, (pf)->dbg_mask, IXL_DBG_IOV, s, ##__VA_ARGS__)
285cb6b8299SEric Joyner 
2861031d839SEric Joyner /* PF-only function declarations */
287*b8f51b8cSPiotr Kubaj void	ixl_set_state(volatile u32 *s, enum ixl_state bit);
288*b8f51b8cSPiotr Kubaj void	ixl_clear_state(volatile u32 *s, enum ixl_state bit);
289*b8f51b8cSPiotr Kubaj bool	ixl_test_state(volatile u32 *s, enum ixl_state bit);
290*b8f51b8cSPiotr Kubaj u32	ixl_testandset_state(volatile u32 *s, enum ixl_state bit);
2911031d839SEric Joyner int	ixl_setup_interface(device_t, struct ixl_pf *);
2924294f337SSean Bruno void	ixl_print_nvm_cmd(device_t, struct i40e_nvm_access *);
2934294f337SSean Bruno 
2944294f337SSean Bruno void	ixl_handle_que(void *context, int pending);
2954294f337SSean Bruno 
2964294f337SSean Bruno void	ixl_init(void *);
29786803260SJustin Hibbits void	ixl_register_vlan(void *, if_t, u16);
29886803260SJustin Hibbits void	ixl_unregister_vlan(void *, if_t, u16);
2991031d839SEric Joyner int	ixl_intr(void *);
3001031d839SEric Joyner int	ixl_msix_que(void *);
3011031d839SEric Joyner int	ixl_msix_adminq(void *);
3024294f337SSean Bruno void	ixl_do_adminq(void *, int);
3034294f337SSean Bruno 
3044294f337SSean Bruno int	ixl_res_alloc_cmp(const void *, const void *);
305b4a7ce06SEric Joyner const char *	ixl_switch_res_type_string(u8);
3064294f337SSean Bruno void	ixl_add_sysctls_mac_stats(struct sysctl_ctx_list *,
3074294f337SSean Bruno 		    struct sysctl_oid_list *, struct i40e_hw_port_stats *);
3084294f337SSean Bruno 
30986803260SJustin Hibbits void    ixl_media_status(if_t, struct ifmediareq *);
31086803260SJustin Hibbits int     ixl_media_change(if_t);
31186803260SJustin Hibbits int     ixl_ioctl(if_t, u_long, caddr_t);
3124294f337SSean Bruno 
3134294f337SSean Bruno void	ixl_enable_queue(struct i40e_hw *, int);
3144294f337SSean Bruno void	ixl_disable_queue(struct i40e_hw *, int);
315cb6b8299SEric Joyner void	ixl_enable_intr0(struct i40e_hw *);
316cb6b8299SEric Joyner void	ixl_disable_intr0(struct i40e_hw *);
3174294f337SSean Bruno void	ixl_nvm_version_str(struct i40e_hw *hw, struct sbuf *buf);
3184294f337SSean Bruno void	ixl_stat_update48(struct i40e_hw *, u32, u32, bool,
3194294f337SSean Bruno 		    u64 *, u64 *);
3204294f337SSean Bruno void	ixl_stat_update32(struct i40e_hw *, u32, bool,
3214294f337SSean Bruno 		    u64 *, u64 *);
3224294f337SSean Bruno 
3234294f337SSean Bruno void	ixl_stop(struct ixl_pf *);
324b4a7ce06SEric Joyner void	ixl_vsi_add_sysctls(struct ixl_vsi *, const char *, bool);
3254294f337SSean Bruno int	ixl_get_hw_capabilities(struct ixl_pf *);
326cb6b8299SEric Joyner void	ixl_link_up_msg(struct ixl_pf *);
3274294f337SSean Bruno void    ixl_update_link_status(struct ixl_pf *);
3284294f337SSean Bruno int	ixl_setup_stations(struct ixl_pf *);
3294294f337SSean Bruno int	ixl_switch_config(struct ixl_pf *);
3304294f337SSean Bruno void	ixl_stop_locked(struct ixl_pf *);
3314294f337SSean Bruno int	ixl_teardown_hw_structs(struct ixl_pf *);
3324294f337SSean Bruno void	ixl_init_locked(struct ixl_pf *);
3334294f337SSean Bruno void	ixl_set_rss_key(struct ixl_pf *);
3344294f337SSean Bruno void	ixl_set_rss_pctypes(struct ixl_pf *);
3354294f337SSean Bruno void	ixl_set_rss_hlut(struct ixl_pf *);
3364294f337SSean Bruno int	ixl_setup_adminq_msix(struct ixl_pf *);
3374294f337SSean Bruno int	ixl_setup_adminq_tq(struct ixl_pf *);
338b4a7ce06SEric Joyner void	ixl_teardown_adminq_msix(struct ixl_pf *);
3394294f337SSean Bruno void	ixl_configure_intr0_msix(struct ixl_pf *);
3404294f337SSean Bruno void	ixl_configure_queue_intr_msix(struct ixl_pf *);
3414294f337SSean Bruno void	ixl_free_adminq_tq(struct ixl_pf *);
342cb6b8299SEric Joyner int	ixl_setup_legacy(struct ixl_pf *);
3434294f337SSean Bruno int	ixl_init_msix(struct ixl_pf *);
344b4a7ce06SEric Joyner void	ixl_configure_tx_itr(struct ixl_pf *);
345b4a7ce06SEric Joyner void	ixl_configure_rx_itr(struct ixl_pf *);
3464294f337SSean Bruno void	ixl_configure_itr(struct ixl_pf *);
3474294f337SSean Bruno void	ixl_configure_legacy(struct ixl_pf *);
3484294f337SSean Bruno void	ixl_free_pci_resources(struct ixl_pf *);
3494294f337SSean Bruno void	ixl_link_event(struct ixl_pf *, struct i40e_arq_event_info *);
3504294f337SSean Bruno void	ixl_config_rss(struct ixl_pf *);
351ceebc2f3SEric Joyner int	ixl_set_advertised_speeds(struct ixl_pf *, int, bool);
352ceebc2f3SEric Joyner void	ixl_set_initial_advertised_speeds(struct ixl_pf *);
3534294f337SSean Bruno void	ixl_print_nvm_version(struct ixl_pf *pf);
354b4a7ce06SEric Joyner void	ixl_add_sysctls_recovery_mode(struct ixl_pf *);
3554294f337SSean Bruno void	ixl_add_device_sysctls(struct ixl_pf *);
3564294f337SSean Bruno void	ixl_handle_mdd_event(struct ixl_pf *);
3574294f337SSean Bruno void	ixl_add_hw_stats(struct ixl_pf *);
3584294f337SSean Bruno void	ixl_update_stats_counters(struct ixl_pf *);
3594294f337SSean Bruno void	ixl_pf_reset_stats(struct ixl_pf *);
360cb6b8299SEric Joyner void	ixl_get_bus_info(struct ixl_pf *pf);
361cb6b8299SEric Joyner int	ixl_aq_get_link_status(struct ixl_pf *,
362cb6b8299SEric Joyner     struct i40e_aqc_get_link_status *);
36321802a12SKrzysztof Galazka void	ixl_set_link(struct ixl_pf *, bool);
3644294f337SSean Bruno 
3654294f337SSean Bruno int	ixl_handle_nvmupd_cmd(struct ixl_pf *, struct ifdrv *);
366b4a7ce06SEric Joyner int	ixl_handle_i2c_eeprom_read_cmd(struct ixl_pf *, struct ifreq *ifr);
367b4a7ce06SEric Joyner 
368b4a7ce06SEric Joyner int	ixl_setup_hmc(struct ixl_pf *);
369b4a7ce06SEric Joyner void	ixl_shutdown_hmc(struct ixl_pf *);
3704294f337SSean Bruno void	ixl_handle_empr_reset(struct ixl_pf *);
371ceebc2f3SEric Joyner int	ixl_prepare_for_reset(struct ixl_pf *pf, bool is_up);
372b4a7ce06SEric Joyner int	ixl_rebuild_hw_structs_after_reset(struct ixl_pf *, bool is_up);
373b4a7ce06SEric Joyner int	ixl_pf_reset(struct ixl_pf *);
3744294f337SSean Bruno 
3751031d839SEric Joyner void	ixl_set_queue_rx_itr(struct ixl_rx_queue *);
3761031d839SEric Joyner void	ixl_set_queue_tx_itr(struct ixl_tx_queue *);
3774294f337SSean Bruno 
37833c66d8aSRyan Libby void	ixl_add_filter(struct ixl_vsi *, const u8 *, s16 vlan);
37933c66d8aSRyan Libby void	ixl_del_filter(struct ixl_vsi *, const u8 *, s16 vlan);
3807d4dceecSKrzysztof Galazka void	ixl_add_vlan_filters(struct ixl_vsi *, const u8 *);
3817d4dceecSKrzysztof Galazka void	ixl_del_all_vlan_filters(struct ixl_vsi *, const u8 *);
3824294f337SSean Bruno void	ixl_reconfigure_filters(struct ixl_vsi *vsi);
3834294f337SSean Bruno 
38477c1fcecSEric Joyner int	ixl_disable_rings(struct ixl_pf *, struct ixl_vsi *, struct ixl_pf_qtag *);
3854294f337SSean Bruno int	ixl_disable_tx_ring(struct ixl_pf *, struct ixl_pf_qtag *, u16);
3864294f337SSean Bruno int	ixl_disable_rx_ring(struct ixl_pf *, struct ixl_pf_qtag *, u16);
3874294f337SSean Bruno int	ixl_disable_ring(struct ixl_pf *pf, struct ixl_pf_qtag *, u16);
3884294f337SSean Bruno 
3894294f337SSean Bruno int	ixl_enable_rings(struct ixl_vsi *);
3904294f337SSean Bruno int	ixl_enable_tx_ring(struct ixl_pf *, struct ixl_pf_qtag *, u16);
3914294f337SSean Bruno int	ixl_enable_rx_ring(struct ixl_pf *, struct ixl_pf_qtag *, u16);
3924294f337SSean Bruno int	ixl_enable_ring(struct ixl_pf *pf, struct ixl_pf_qtag *, u16);
3934294f337SSean Bruno 
3944294f337SSean Bruno void	ixl_update_eth_stats(struct ixl_vsi *);
39586803260SJustin Hibbits void	ixl_cap_txcsum_tso(struct ixl_vsi *, if_t, int);
3964294f337SSean Bruno int	ixl_initialize_vsi(struct ixl_vsi *);
397b4a7ce06SEric Joyner void	ixl_add_ifmedia(struct ifmedia *, u64);
3984294f337SSean Bruno int	ixl_setup_queue_msix(struct ixl_vsi *);
3994294f337SSean Bruno int	ixl_setup_queue_tqs(struct ixl_vsi *);
4004294f337SSean Bruno int	ixl_teardown_queue_msix(struct ixl_vsi *);
4014294f337SSean Bruno void	ixl_free_queue_tqs(struct ixl_vsi *);
4024294f337SSean Bruno void	ixl_enable_intr(struct ixl_vsi *);
4034294f337SSean Bruno void	ixl_disable_rings_intr(struct ixl_vsi *);
4044294f337SSean Bruno void	ixl_set_promisc(struct ixl_vsi *);
4054294f337SSean Bruno void	ixl_add_multi(struct ixl_vsi *);
4067d4dceecSKrzysztof Galazka void	ixl_del_multi(struct ixl_vsi *, bool);
4074294f337SSean Bruno void	ixl_setup_vlan_filters(struct ixl_vsi *);
4084294f337SSean Bruno void	ixl_init_filters(struct ixl_vsi *);
4097d4dceecSKrzysztof Galazka void	ixl_free_filters(struct ixl_ftl_head *);
4107d4dceecSKrzysztof Galazka void	ixl_add_hw_filters(struct ixl_vsi *, struct ixl_ftl_head *, int);
4117d4dceecSKrzysztof Galazka void	ixl_del_hw_filters(struct ixl_vsi *, struct ixl_ftl_head *, int);
41277c1fcecSEric Joyner void	ixl_del_default_hw_filters(struct ixl_vsi *);
4134294f337SSean Bruno struct ixl_mac_filter *
4147d4dceecSKrzysztof Galazka 		ixl_find_filter(struct ixl_ftl_head *, const u8 *, s16);
4154294f337SSean Bruno void	ixl_update_vsi_stats(struct ixl_vsi *);
4164294f337SSean Bruno void	ixl_vsi_reset_stats(struct ixl_vsi *);
4174294f337SSean Bruno 
418ceebc2f3SEric Joyner void	ixl_vsi_free_queues(struct ixl_vsi *vsi);
419ceebc2f3SEric Joyner 
4201031d839SEric Joyner void	 ixl_if_init(if_ctx_t ctx);
4211031d839SEric Joyner void	 ixl_if_stop(if_ctx_t ctx);
4221031d839SEric Joyner 
423cb6b8299SEric Joyner /*
424cb6b8299SEric Joyner  * I2C Function prototypes
425cb6b8299SEric Joyner  */
426cb6b8299SEric Joyner int	ixl_find_i2c_interface(struct ixl_pf *);
4271031d839SEric Joyner s32	ixl_read_i2c_byte_bb(struct ixl_pf *pf, u8 byte_offset,
428cb6b8299SEric Joyner 	    u8 dev_addr, u8 *data);
4291031d839SEric Joyner s32	ixl_write_i2c_byte_bb(struct ixl_pf *pf, u8 byte_offset,
4301031d839SEric Joyner 	    u8 dev_addr, u8 data);
4311031d839SEric Joyner s32	ixl_read_i2c_byte_reg(struct ixl_pf *pf, u8 byte_offset,
4321031d839SEric Joyner 	    u8 dev_addr, u8 *data);
4331031d839SEric Joyner s32	ixl_write_i2c_byte_reg(struct ixl_pf *pf, u8 byte_offset,
4341031d839SEric Joyner 	    u8 dev_addr, u8 data);
4351031d839SEric Joyner s32	ixl_read_i2c_byte_aq(struct ixl_pf *pf, u8 byte_offset,
4361031d839SEric Joyner 	    u8 dev_addr, u8 *data);
4371031d839SEric Joyner s32	ixl_write_i2c_byte_aq(struct ixl_pf *pf, u8 byte_offset,
438cb6b8299SEric Joyner 	    u8 dev_addr, u8 data);
439cb6b8299SEric Joyner 
44077c1fcecSEric Joyner u64	ixl_max_aq_speed_to_value(u8);
441b4a7ce06SEric Joyner int	ixl_attach_get_link_status(struct ixl_pf *);
442b4a7ce06SEric Joyner int	ixl_sysctl_set_flowcntl(SYSCTL_HANDLER_ARGS);
443ceebc2f3SEric Joyner 
44461ae650dSJack F Vogel #endif /* _IXL_PF_H_ */
445