xref: /freebsd/sys/dev/ixgbe/ixgbe_api.c (revision f72de14ea13259db78b06c50da6c864dea698668)
19ca4041bSJack F Vogel /******************************************************************************
27282444bSPedro F. Giffuni   SPDX-License-Identifier: BSD-3-Clause
313705f88SJack F Vogel 
48455e365SKevin Bowling   Copyright (c) 2001-2020, Intel Corporation
513705f88SJack F Vogel   All rights reserved.
613705f88SJack F Vogel 
713705f88SJack F Vogel   Redistribution and use in source and binary forms, with or without
813705f88SJack F Vogel   modification, are permitted provided that the following conditions are met:
913705f88SJack F Vogel 
1013705f88SJack F Vogel    1. Redistributions of source code must retain the above copyright notice,
1113705f88SJack F Vogel       this list of conditions and the following disclaimer.
1213705f88SJack F Vogel 
1313705f88SJack F Vogel    2. Redistributions in binary form must reproduce the above copyright
1413705f88SJack F Vogel       notice, this list of conditions and the following disclaimer in the
1513705f88SJack F Vogel       documentation and/or other materials provided with the distribution.
1613705f88SJack F Vogel 
1713705f88SJack F Vogel    3. Neither the name of the Intel Corporation nor the names of its
1813705f88SJack F Vogel       contributors may be used to endorse or promote products derived from
1913705f88SJack F Vogel       this software without specific prior written permission.
2013705f88SJack F Vogel 
2113705f88SJack F Vogel   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2213705f88SJack F Vogel   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2313705f88SJack F Vogel   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2413705f88SJack F Vogel   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
2513705f88SJack F Vogel   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2613705f88SJack F Vogel   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2713705f88SJack F Vogel   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2813705f88SJack F Vogel   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2913705f88SJack F Vogel   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
3013705f88SJack F Vogel   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3113705f88SJack F Vogel   POSSIBILITY OF SUCH DAMAGE.
3213705f88SJack F Vogel 
339ca4041bSJack F Vogel ******************************************************************************/
3413705f88SJack F Vogel 
3513705f88SJack F Vogel #include "ixgbe_api.h"
3613705f88SJack F Vogel #include "ixgbe_common.h"
3713705f88SJack F Vogel 
38a9ca1c79SSean Bruno #define IXGBE_EMPTY_PARAM
39a9ca1c79SSean Bruno 
406f37f232SEric Joyner static const u32 ixgbe_mvals_base[IXGBE_MVALS_IDX_LIMIT] = {
41a9ca1c79SSean Bruno 	IXGBE_MVALS_INIT(IXGBE_EMPTY_PARAM)
426f37f232SEric Joyner };
436f37f232SEric Joyner 
446f37f232SEric Joyner static const u32 ixgbe_mvals_X540[IXGBE_MVALS_IDX_LIMIT] = {
456f37f232SEric Joyner 	IXGBE_MVALS_INIT(_X540)
466f37f232SEric Joyner };
476f37f232SEric Joyner 
486f37f232SEric Joyner static const u32 ixgbe_mvals_X550[IXGBE_MVALS_IDX_LIMIT] = {
496f37f232SEric Joyner 	IXGBE_MVALS_INIT(_X550)
506f37f232SEric Joyner };
516f37f232SEric Joyner 
526f37f232SEric Joyner static const u32 ixgbe_mvals_X550EM_x[IXGBE_MVALS_IDX_LIMIT] = {
536f37f232SEric Joyner 	IXGBE_MVALS_INIT(_X550EM_x)
546f37f232SEric Joyner };
556f37f232SEric Joyner 
568eb6488eSEric Joyner static const u32 ixgbe_mvals_X550EM_a[IXGBE_MVALS_IDX_LIMIT] = {
578eb6488eSEric Joyner 	IXGBE_MVALS_INIT(_X550EM_a)
588eb6488eSEric Joyner };
598eb6488eSEric Joyner 
6013705f88SJack F Vogel /**
61fd75b91dSJack F Vogel  * ixgbe_dcb_get_rtrup2tc - read rtrup2tc reg
62fd75b91dSJack F Vogel  * @hw: pointer to hardware structure
63fd75b91dSJack F Vogel  * @map: pointer to u8 arr for returning map
64fd75b91dSJack F Vogel  *
65fd75b91dSJack F Vogel  * Read the rtrup2tc HW register and resolve its content into map
66fd75b91dSJack F Vogel  **/
ixgbe_dcb_get_rtrup2tc(struct ixgbe_hw * hw,u8 * map)67fd75b91dSJack F Vogel void ixgbe_dcb_get_rtrup2tc(struct ixgbe_hw *hw, u8 *map)
68fd75b91dSJack F Vogel {
69fd75b91dSJack F Vogel 	if (hw->mac.ops.get_rtrup2tc)
70fd75b91dSJack F Vogel 		hw->mac.ops.get_rtrup2tc(hw, map);
71fd75b91dSJack F Vogel }
72fd75b91dSJack F Vogel 
73fd75b91dSJack F Vogel /**
7413705f88SJack F Vogel  * ixgbe_init_shared_code - Initialize the shared code
7513705f88SJack F Vogel  * @hw: pointer to hardware structure
7613705f88SJack F Vogel  *
7713705f88SJack F Vogel  * This will assign function pointers and assign the MAC type and PHY code.
7813705f88SJack F Vogel  * Does not touch the hardware. This function must be called prior to any
7913705f88SJack F Vogel  * other function in the shared code. The ixgbe_hw structure should be
8013705f88SJack F Vogel  * memset to 0 prior to calling this function.  The following fields in
8113705f88SJack F Vogel  * hw structure should be filled in prior to calling this function:
8213705f88SJack F Vogel  * hw_addr, back, device_id, vendor_id, subsystem_device_id,
8313705f88SJack F Vogel  * subsystem_vendor_id, and revision_id
8413705f88SJack F Vogel  **/
ixgbe_init_shared_code(struct ixgbe_hw * hw)8513705f88SJack F Vogel s32 ixgbe_init_shared_code(struct ixgbe_hw *hw)
8613705f88SJack F Vogel {
873ec35e52SJack F Vogel 	s32 status;
8813705f88SJack F Vogel 
892969bf0eSJack F Vogel 	DEBUGFUNC("ixgbe_init_shared_code");
902969bf0eSJack F Vogel 
9113705f88SJack F Vogel 	/*
923ec35e52SJack F Vogel 	 * Set the mac type
933ec35e52SJack F Vogel 	 */
943ec35e52SJack F Vogel 	ixgbe_set_mac_type(hw);
953ec35e52SJack F Vogel 
963ec35e52SJack F Vogel 	switch (hw->mac.type) {
973ec35e52SJack F Vogel 	case ixgbe_mac_82598EB:
989ca4041bSJack F Vogel 		status = ixgbe_init_ops_82598(hw);
9913705f88SJack F Vogel 		break;
1000ac6dfecSJack F Vogel 	case ixgbe_mac_82599EB:
1010ac6dfecSJack F Vogel 		status = ixgbe_init_ops_82599(hw);
1020ac6dfecSJack F Vogel 		break;
10385d0a26eSJack F Vogel 	case ixgbe_mac_X540:
10485d0a26eSJack F Vogel 		status = ixgbe_init_ops_X540(hw);
10585d0a26eSJack F Vogel 		break;
106758cc3dcSJack F Vogel 	case ixgbe_mac_X550:
107758cc3dcSJack F Vogel 		status = ixgbe_init_ops_X550(hw);
108758cc3dcSJack F Vogel 		break;
109758cc3dcSJack F Vogel 	case ixgbe_mac_X550EM_x:
1108eb6488eSEric Joyner 		status = ixgbe_init_ops_X550EM_x(hw);
111758cc3dcSJack F Vogel 		break;
1128eb6488eSEric Joyner 	case ixgbe_mac_X550EM_a:
1138eb6488eSEric Joyner 		status = ixgbe_init_ops_X550EM_a(hw);
114758cc3dcSJack F Vogel 		break;
1153f66b96dSKevin Bowling 	case ixgbe_mac_82599_vf:
1163f66b96dSKevin Bowling 	case ixgbe_mac_X540_vf:
1173f66b96dSKevin Bowling 	case ixgbe_mac_X550_vf:
1183f66b96dSKevin Bowling 	case ixgbe_mac_X550EM_x_vf:
1193f66b96dSKevin Bowling 	case ixgbe_mac_X550EM_a_vf:
1203f66b96dSKevin Bowling 		status = ixgbe_init_ops_vf(hw);
1213f66b96dSKevin Bowling 		break;
12213705f88SJack F Vogel 	default:
12313705f88SJack F Vogel 		status = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
12413705f88SJack F Vogel 		break;
12513705f88SJack F Vogel 	}
126a9ca1c79SSean Bruno 	hw->mac.max_link_up_time = IXGBE_LINK_UP_TIME;
12713705f88SJack F Vogel 
12813705f88SJack F Vogel 	return status;
12913705f88SJack F Vogel }
13013705f88SJack F Vogel 
13113705f88SJack F Vogel /**
1323ec35e52SJack F Vogel  * ixgbe_set_mac_type - Sets MAC type
1333ec35e52SJack F Vogel  * @hw: pointer to the HW structure
1343ec35e52SJack F Vogel  *
1353ec35e52SJack F Vogel  * This function sets the mac type of the adapter based on the
1363ec35e52SJack F Vogel  * vendor ID and device ID stored in the hw structure.
1373ec35e52SJack F Vogel  **/
ixgbe_set_mac_type(struct ixgbe_hw * hw)1383ec35e52SJack F Vogel s32 ixgbe_set_mac_type(struct ixgbe_hw *hw)
1393ec35e52SJack F Vogel {
1403ec35e52SJack F Vogel 	s32 ret_val = IXGBE_SUCCESS;
1413ec35e52SJack F Vogel 
1429ca4041bSJack F Vogel 	DEBUGFUNC("ixgbe_set_mac_type\n");
1433ec35e52SJack F Vogel 
144fd75b91dSJack F Vogel 	if (hw->vendor_id != IXGBE_INTEL_VENDOR_ID) {
145fd75b91dSJack F Vogel 		ERROR_REPORT2(IXGBE_ERROR_UNSUPPORTED,
146fd75b91dSJack F Vogel 			     "Unsupported vendor id: %x", hw->vendor_id);
147fd75b91dSJack F Vogel 		return IXGBE_ERR_DEVICE_NOT_SUPPORTED;
148fd75b91dSJack F Vogel 	}
149fd75b91dSJack F Vogel 
1506f37f232SEric Joyner 	hw->mvals = ixgbe_mvals_base;
1516f37f232SEric Joyner 
1523ec35e52SJack F Vogel 	switch (hw->device_id) {
1531b6e0dbaSJack F Vogel 	case IXGBE_DEV_ID_82598:
1540ac6dfecSJack F Vogel 	case IXGBE_DEV_ID_82598_BX:
1553ec35e52SJack F Vogel 	case IXGBE_DEV_ID_82598AF_SINGLE_PORT:
1563ec35e52SJack F Vogel 	case IXGBE_DEV_ID_82598AF_DUAL_PORT:
1579ca4041bSJack F Vogel 	case IXGBE_DEV_ID_82598AT:
1582969bf0eSJack F Vogel 	case IXGBE_DEV_ID_82598AT2:
1593ec35e52SJack F Vogel 	case IXGBE_DEV_ID_82598EB_CX4:
1609ca4041bSJack F Vogel 	case IXGBE_DEV_ID_82598_CX4_DUAL_PORT:
1611b6e0dbaSJack F Vogel 	case IXGBE_DEV_ID_82598_DA_DUAL_PORT:
1621b6e0dbaSJack F Vogel 	case IXGBE_DEV_ID_82598_SR_DUAL_PORT_EM:
1639ca4041bSJack F Vogel 	case IXGBE_DEV_ID_82598EB_XF_LR:
1641b6e0dbaSJack F Vogel 	case IXGBE_DEV_ID_82598EB_SFP_LOM:
1653ec35e52SJack F Vogel 		hw->mac.type = ixgbe_mac_82598EB;
1663ec35e52SJack F Vogel 		break;
1670ac6dfecSJack F Vogel 	case IXGBE_DEV_ID_82599_KX4:
1682969bf0eSJack F Vogel 	case IXGBE_DEV_ID_82599_KX4_MEZZ:
169d8602bb9SJack F Vogel 	case IXGBE_DEV_ID_82599_XAUI_LOM:
1702969bf0eSJack F Vogel 	case IXGBE_DEV_ID_82599_COMBO_BACKPLANE:
17185d0a26eSJack F Vogel 	case IXGBE_DEV_ID_82599_KR:
1720ac6dfecSJack F Vogel 	case IXGBE_DEV_ID_82599_SFP:
1731a4e3449SJack F Vogel 	case IXGBE_DEV_ID_82599_BACKPLANE_FCOE:
1741a4e3449SJack F Vogel 	case IXGBE_DEV_ID_82599_SFP_FCOE:
17585d0a26eSJack F Vogel 	case IXGBE_DEV_ID_82599_SFP_EM:
176a621e3c8SJack F Vogel 	case IXGBE_DEV_ID_82599_SFP_SF2:
1770ecc2ff0SJack F Vogel 	case IXGBE_DEV_ID_82599_SFP_SF_QP:
178758cc3dcSJack F Vogel 	case IXGBE_DEV_ID_82599_QSFP_SF_QP:
17985d0a26eSJack F Vogel 	case IXGBE_DEV_ID_82599EN_SFP:
1800ac6dfecSJack F Vogel 	case IXGBE_DEV_ID_82599_CX4:
1810ecc2ff0SJack F Vogel 	case IXGBE_DEV_ID_82599_BYPASS:
182c0014855SJack F Vogel 	case IXGBE_DEV_ID_82599_T3_LOM:
1830ac6dfecSJack F Vogel 		hw->mac.type = ixgbe_mac_82599EB;
1840ac6dfecSJack F Vogel 		break;
1853f66b96dSKevin Bowling 	case IXGBE_DEV_ID_82599_VF:
1863f66b96dSKevin Bowling 	case IXGBE_DEV_ID_82599_VF_HV:
1873f66b96dSKevin Bowling 		hw->mac.type = ixgbe_mac_82599_vf;
1883f66b96dSKevin Bowling 		break;
1893f66b96dSKevin Bowling 	case IXGBE_DEV_ID_X540_VF:
1903f66b96dSKevin Bowling 	case IXGBE_DEV_ID_X540_VF_HV:
1913f66b96dSKevin Bowling 		hw->mac.type = ixgbe_mac_X540_vf;
1923f66b96dSKevin Bowling 		hw->mvals = ixgbe_mvals_X540;
1933f66b96dSKevin Bowling 		break;
19485d0a26eSJack F Vogel 	case IXGBE_DEV_ID_X540T:
195758cc3dcSJack F Vogel 	case IXGBE_DEV_ID_X540T1:
1960ecc2ff0SJack F Vogel 	case IXGBE_DEV_ID_X540_BYPASS:
19785d0a26eSJack F Vogel 		hw->mac.type = ixgbe_mac_X540;
1986f37f232SEric Joyner 		hw->mvals = ixgbe_mvals_X540;
19985d0a26eSJack F Vogel 		break;
200758cc3dcSJack F Vogel 	case IXGBE_DEV_ID_X550T:
201a9ca1c79SSean Bruno 	case IXGBE_DEV_ID_X550T1:
202758cc3dcSJack F Vogel 		hw->mac.type = ixgbe_mac_X550;
2036f37f232SEric Joyner 		hw->mvals = ixgbe_mvals_X550;
204758cc3dcSJack F Vogel 		break;
205758cc3dcSJack F Vogel 	case IXGBE_DEV_ID_X550EM_X_KX4:
206758cc3dcSJack F Vogel 	case IXGBE_DEV_ID_X550EM_X_KR:
207758cc3dcSJack F Vogel 	case IXGBE_DEV_ID_X550EM_X_10G_T:
208758cc3dcSJack F Vogel 	case IXGBE_DEV_ID_X550EM_X_1G_T:
209758cc3dcSJack F Vogel 	case IXGBE_DEV_ID_X550EM_X_SFP:
2108eb6488eSEric Joyner 	case IXGBE_DEV_ID_X550EM_X_XFI:
211758cc3dcSJack F Vogel 		hw->mac.type = ixgbe_mac_X550EM_x;
2126f37f232SEric Joyner 		hw->mvals = ixgbe_mvals_X550EM_x;
213758cc3dcSJack F Vogel 		break;
2148eb6488eSEric Joyner 	case IXGBE_DEV_ID_X550EM_A_KR:
2158eb6488eSEric Joyner 	case IXGBE_DEV_ID_X550EM_A_KR_L:
2168eb6488eSEric Joyner 	case IXGBE_DEV_ID_X550EM_A_SFP_N:
2178eb6488eSEric Joyner 	case IXGBE_DEV_ID_X550EM_A_SGMII:
2188eb6488eSEric Joyner 	case IXGBE_DEV_ID_X550EM_A_SGMII_L:
2198eb6488eSEric Joyner 	case IXGBE_DEV_ID_X550EM_A_1G_T:
2208eb6488eSEric Joyner 	case IXGBE_DEV_ID_X550EM_A_1G_T_L:
2218eb6488eSEric Joyner 	case IXGBE_DEV_ID_X550EM_A_10G_T:
2228eb6488eSEric Joyner 	case IXGBE_DEV_ID_X550EM_A_QSFP:
2238eb6488eSEric Joyner 	case IXGBE_DEV_ID_X550EM_A_QSFP_N:
2248eb6488eSEric Joyner 	case IXGBE_DEV_ID_X550EM_A_SFP:
2258eb6488eSEric Joyner 		hw->mac.type = ixgbe_mac_X550EM_a;
2268eb6488eSEric Joyner 		hw->mvals = ixgbe_mvals_X550EM_a;
227758cc3dcSJack F Vogel 		break;
2283f66b96dSKevin Bowling 	case IXGBE_DEV_ID_X550_VF:
2293f66b96dSKevin Bowling 	case IXGBE_DEV_ID_X550_VF_HV:
2303f66b96dSKevin Bowling 		hw->mac.type = ixgbe_mac_X550_vf;
2313f66b96dSKevin Bowling 		hw->mvals = ixgbe_mvals_X550;
2323f66b96dSKevin Bowling 		break;
2333f66b96dSKevin Bowling 	case IXGBE_DEV_ID_X550EM_X_VF:
2343f66b96dSKevin Bowling 	case IXGBE_DEV_ID_X550EM_X_VF_HV:
2353f66b96dSKevin Bowling 		hw->mac.type = ixgbe_mac_X550EM_x_vf;
2363f66b96dSKevin Bowling 		hw->mvals = ixgbe_mvals_X550EM_x;
2373f66b96dSKevin Bowling 		break;
2383f66b96dSKevin Bowling 	case IXGBE_DEV_ID_X550EM_A_VF:
2393f66b96dSKevin Bowling 	case IXGBE_DEV_ID_X550EM_A_VF_HV:
2403f66b96dSKevin Bowling 		hw->mac.type = ixgbe_mac_X550EM_a_vf;
2413f66b96dSKevin Bowling 		hw->mvals = ixgbe_mvals_X550EM_a;
2423f66b96dSKevin Bowling 		break;
2433ec35e52SJack F Vogel 	default:
2443ec35e52SJack F Vogel 		ret_val = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
245fd75b91dSJack F Vogel 		ERROR_REPORT2(IXGBE_ERROR_UNSUPPORTED,
246fd75b91dSJack F Vogel 			     "Unsupported device id: %x",
247fd75b91dSJack F Vogel 			     hw->device_id);
2483ec35e52SJack F Vogel 		break;
2493ec35e52SJack F Vogel 	}
2503ec35e52SJack F Vogel 
2519ca4041bSJack F Vogel 	DEBUGOUT2("ixgbe_set_mac_type found mac: %d, returns: %d\n",
2529ca4041bSJack F Vogel 		  hw->mac.type, ret_val);
2533ec35e52SJack F Vogel 	return ret_val;
2543ec35e52SJack F Vogel }
2553ec35e52SJack F Vogel 
2563ec35e52SJack F Vogel /**
25713705f88SJack F Vogel  * ixgbe_init_hw - Initialize the hardware
25813705f88SJack F Vogel  * @hw: pointer to hardware structure
25913705f88SJack F Vogel  *
26013705f88SJack F Vogel  * Initialize the hardware by resetting and then starting the hardware
26113705f88SJack F Vogel  **/
ixgbe_init_hw(struct ixgbe_hw * hw)26213705f88SJack F Vogel s32 ixgbe_init_hw(struct ixgbe_hw *hw)
26313705f88SJack F Vogel {
2649ca4041bSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.init_hw, (hw),
26513705f88SJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
26613705f88SJack F Vogel }
26713705f88SJack F Vogel 
26813705f88SJack F Vogel /**
26913705f88SJack F Vogel  * ixgbe_reset_hw - Performs a hardware reset
27013705f88SJack F Vogel  * @hw: pointer to hardware structure
27113705f88SJack F Vogel  *
27213705f88SJack F Vogel  * Resets the hardware by resetting the transmit and receive units, masks and
27313705f88SJack F Vogel  * clears all interrupts, performs a PHY reset, and performs a MAC reset
27413705f88SJack F Vogel  **/
ixgbe_reset_hw(struct ixgbe_hw * hw)27513705f88SJack F Vogel s32 ixgbe_reset_hw(struct ixgbe_hw *hw)
27613705f88SJack F Vogel {
2779ca4041bSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.reset_hw, (hw),
27813705f88SJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
27913705f88SJack F Vogel }
28013705f88SJack F Vogel 
28113705f88SJack F Vogel /**
2829ca4041bSJack F Vogel  * ixgbe_start_hw - Prepares hardware for Rx/Tx
28313705f88SJack F Vogel  * @hw: pointer to hardware structure
28413705f88SJack F Vogel  *
28513705f88SJack F Vogel  * Starts the hardware by filling the bus info structure and media type,
28613705f88SJack F Vogel  * clears all on chip counters, initializes receive address registers,
28713705f88SJack F Vogel  * multicast table, VLAN filter table, calls routine to setup link and
28813705f88SJack F Vogel  * flow control settings, and leaves transmit and receive units disabled
28913705f88SJack F Vogel  * and uninitialized.
29013705f88SJack F Vogel  **/
ixgbe_start_hw(struct ixgbe_hw * hw)29113705f88SJack F Vogel s32 ixgbe_start_hw(struct ixgbe_hw *hw)
29213705f88SJack F Vogel {
2939ca4041bSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.start_hw, (hw),
29413705f88SJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
29513705f88SJack F Vogel }
29613705f88SJack F Vogel 
29713705f88SJack F Vogel /**
298c0014855SJack F Vogel  * ixgbe_enable_relaxed_ordering - Enables tx relaxed ordering,
299c0014855SJack F Vogel  * which is disabled by default in ixgbe_start_hw();
300c0014855SJack F Vogel  *
301c0014855SJack F Vogel  * @hw: pointer to hardware structure
302c0014855SJack F Vogel  *
303c0014855SJack F Vogel  *  Enable relaxed ordering;
304c0014855SJack F Vogel  **/
ixgbe_enable_relaxed_ordering(struct ixgbe_hw * hw)305c0014855SJack F Vogel void ixgbe_enable_relaxed_ordering(struct ixgbe_hw *hw)
306c0014855SJack F Vogel {
307c0014855SJack F Vogel 	if (hw->mac.ops.enable_relaxed_ordering)
308c0014855SJack F Vogel 		hw->mac.ops.enable_relaxed_ordering(hw);
309c0014855SJack F Vogel }
310c0014855SJack F Vogel 
311c0014855SJack F Vogel /**
31213705f88SJack F Vogel  * ixgbe_clear_hw_cntrs - Clear hardware counters
31313705f88SJack F Vogel  * @hw: pointer to hardware structure
31413705f88SJack F Vogel  *
31513705f88SJack F Vogel  * Clears all hardware statistics counters by reading them from the hardware
31613705f88SJack F Vogel  * Statistics counters are clear on read.
31713705f88SJack F Vogel  **/
ixgbe_clear_hw_cntrs(struct ixgbe_hw * hw)31813705f88SJack F Vogel s32 ixgbe_clear_hw_cntrs(struct ixgbe_hw *hw)
31913705f88SJack F Vogel {
3209ca4041bSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.clear_hw_cntrs, (hw),
32113705f88SJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
32213705f88SJack F Vogel }
32313705f88SJack F Vogel 
32413705f88SJack F Vogel /**
32513705f88SJack F Vogel  * ixgbe_get_media_type - Get media type
32613705f88SJack F Vogel  * @hw: pointer to hardware structure
32713705f88SJack F Vogel  *
32813705f88SJack F Vogel  * Returns the media type (fiber, copper, backplane)
32913705f88SJack F Vogel  **/
ixgbe_get_media_type(struct ixgbe_hw * hw)33013705f88SJack F Vogel enum ixgbe_media_type ixgbe_get_media_type(struct ixgbe_hw *hw)
33113705f88SJack F Vogel {
3329ca4041bSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.get_media_type, (hw),
33313705f88SJack F Vogel 			       ixgbe_media_type_unknown);
33413705f88SJack F Vogel }
33513705f88SJack F Vogel 
33613705f88SJack F Vogel /**
33713705f88SJack F Vogel  * ixgbe_get_mac_addr - Get MAC address
33813705f88SJack F Vogel  * @hw: pointer to hardware structure
33913705f88SJack F Vogel  * @mac_addr: Adapter MAC address
34013705f88SJack F Vogel  *
34113705f88SJack F Vogel  * Reads the adapter's MAC address from the first Receive Address Register
3429ca4041bSJack F Vogel  * (RAR0) A reset of the adapter must have been performed prior to calling
3439ca4041bSJack F Vogel  * this function in order for the MAC address to have been loaded from the
3449ca4041bSJack F Vogel  * EEPROM into RAR0
34513705f88SJack F Vogel  **/
ixgbe_get_mac_addr(struct ixgbe_hw * hw,u8 * mac_addr)34613705f88SJack F Vogel s32 ixgbe_get_mac_addr(struct ixgbe_hw *hw, u8 *mac_addr)
34713705f88SJack F Vogel {
3489ca4041bSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.get_mac_addr,
34913705f88SJack F Vogel 			       (hw, mac_addr), IXGBE_NOT_IMPLEMENTED);
35013705f88SJack F Vogel }
35113705f88SJack F Vogel 
35213705f88SJack F Vogel /**
3530ac6dfecSJack F Vogel  * ixgbe_get_san_mac_addr - Get SAN MAC address
3540ac6dfecSJack F Vogel  * @hw: pointer to hardware structure
3550ac6dfecSJack F Vogel  * @san_mac_addr: SAN MAC address
3560ac6dfecSJack F Vogel  *
3570ac6dfecSJack F Vogel  * Reads the SAN MAC address from the EEPROM, if it's available.  This is
3580ac6dfecSJack F Vogel  * per-port, so set_lan_id() must be called before reading the addresses.
3590ac6dfecSJack F Vogel  **/
ixgbe_get_san_mac_addr(struct ixgbe_hw * hw,u8 * san_mac_addr)3600ac6dfecSJack F Vogel s32 ixgbe_get_san_mac_addr(struct ixgbe_hw *hw, u8 *san_mac_addr)
3610ac6dfecSJack F Vogel {
3620ac6dfecSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.get_san_mac_addr,
3630ac6dfecSJack F Vogel 			       (hw, san_mac_addr), IXGBE_NOT_IMPLEMENTED);
3640ac6dfecSJack F Vogel }
3650ac6dfecSJack F Vogel 
3660ac6dfecSJack F Vogel /**
3670ac6dfecSJack F Vogel  * ixgbe_set_san_mac_addr - Write a SAN MAC address
3680ac6dfecSJack F Vogel  * @hw: pointer to hardware structure
3690ac6dfecSJack F Vogel  * @san_mac_addr: SAN MAC address
3700ac6dfecSJack F Vogel  *
3710ac6dfecSJack F Vogel  * Writes A SAN MAC address to the EEPROM.
3720ac6dfecSJack F Vogel  **/
ixgbe_set_san_mac_addr(struct ixgbe_hw * hw,u8 * san_mac_addr)3730ac6dfecSJack F Vogel s32 ixgbe_set_san_mac_addr(struct ixgbe_hw *hw, u8 *san_mac_addr)
3740ac6dfecSJack F Vogel {
3750ac6dfecSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.set_san_mac_addr,
3760ac6dfecSJack F Vogel 			       (hw, san_mac_addr), IXGBE_NOT_IMPLEMENTED);
3770ac6dfecSJack F Vogel }
3780ac6dfecSJack F Vogel 
3790ac6dfecSJack F Vogel /**
3800ac6dfecSJack F Vogel  * ixgbe_get_device_caps - Get additional device capabilities
3810ac6dfecSJack F Vogel  * @hw: pointer to hardware structure
3820ac6dfecSJack F Vogel  * @device_caps: the EEPROM word for device capabilities
3830ac6dfecSJack F Vogel  *
3840ac6dfecSJack F Vogel  * Reads the extra device capabilities from the EEPROM
3850ac6dfecSJack F Vogel  **/
ixgbe_get_device_caps(struct ixgbe_hw * hw,u16 * device_caps)3860ac6dfecSJack F Vogel s32 ixgbe_get_device_caps(struct ixgbe_hw *hw, u16 *device_caps)
3870ac6dfecSJack F Vogel {
3880ac6dfecSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.get_device_caps,
3890ac6dfecSJack F Vogel 			       (hw, device_caps), IXGBE_NOT_IMPLEMENTED);
3900ac6dfecSJack F Vogel }
3910ac6dfecSJack F Vogel 
3920ac6dfecSJack F Vogel /**
3932969bf0eSJack F Vogel  * ixgbe_get_wwn_prefix - Get alternative WWNN/WWPN prefix from the EEPROM
3942969bf0eSJack F Vogel  * @hw: pointer to hardware structure
3952969bf0eSJack F Vogel  * @wwnn_prefix: the alternative WWNN prefix
3962969bf0eSJack F Vogel  * @wwpn_prefix: the alternative WWPN prefix
3972969bf0eSJack F Vogel  *
3982969bf0eSJack F Vogel  * This function will read the EEPROM from the alternative SAN MAC address
3992969bf0eSJack F Vogel  * block to check the support for the alternative WWNN/WWPN prefix support.
4002969bf0eSJack F Vogel  **/
ixgbe_get_wwn_prefix(struct ixgbe_hw * hw,u16 * wwnn_prefix,u16 * wwpn_prefix)4012969bf0eSJack F Vogel s32 ixgbe_get_wwn_prefix(struct ixgbe_hw *hw, u16 *wwnn_prefix,
4022969bf0eSJack F Vogel 			 u16 *wwpn_prefix)
4032969bf0eSJack F Vogel {
4042969bf0eSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.get_wwn_prefix,
4052969bf0eSJack F Vogel 			       (hw, wwnn_prefix, wwpn_prefix),
4062969bf0eSJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
4072969bf0eSJack F Vogel }
4082969bf0eSJack F Vogel 
4092969bf0eSJack F Vogel /**
4101a4e3449SJack F Vogel  * ixgbe_get_fcoe_boot_status -  Get FCOE boot status from EEPROM
4111a4e3449SJack F Vogel  * @hw: pointer to hardware structure
4121a4e3449SJack F Vogel  * @bs: the fcoe boot status
4131a4e3449SJack F Vogel  *
4141a4e3449SJack F Vogel  * This function will read the FCOE boot status from the iSCSI FCOE block
4151a4e3449SJack F Vogel  **/
ixgbe_get_fcoe_boot_status(struct ixgbe_hw * hw,u16 * bs)4161a4e3449SJack F Vogel s32 ixgbe_get_fcoe_boot_status(struct ixgbe_hw *hw, u16 *bs)
4171a4e3449SJack F Vogel {
4181a4e3449SJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.get_fcoe_boot_status,
4191a4e3449SJack F Vogel 			       (hw, bs),
4201a4e3449SJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
4211a4e3449SJack F Vogel }
4221a4e3449SJack F Vogel 
4231a4e3449SJack F Vogel /**
42413705f88SJack F Vogel  * ixgbe_get_bus_info - Set PCI bus info
42513705f88SJack F Vogel  * @hw: pointer to hardware structure
42613705f88SJack F Vogel  *
42713705f88SJack F Vogel  * Sets the PCI bus info (speed, width, type) within the ixgbe_hw structure
42813705f88SJack F Vogel  **/
ixgbe_get_bus_info(struct ixgbe_hw * hw)42913705f88SJack F Vogel s32 ixgbe_get_bus_info(struct ixgbe_hw *hw)
43013705f88SJack F Vogel {
4319ca4041bSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.get_bus_info, (hw),
43213705f88SJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
43313705f88SJack F Vogel }
43413705f88SJack F Vogel 
43513705f88SJack F Vogel /**
4369ca4041bSJack F Vogel  * ixgbe_get_num_of_tx_queues - Get Tx queues
43713705f88SJack F Vogel  * @hw: pointer to hardware structure
43813705f88SJack F Vogel  *
43913705f88SJack F Vogel  * Returns the number of transmit queues for the given adapter.
44013705f88SJack F Vogel  **/
ixgbe_get_num_of_tx_queues(struct ixgbe_hw * hw)44113705f88SJack F Vogel u32 ixgbe_get_num_of_tx_queues(struct ixgbe_hw *hw)
44213705f88SJack F Vogel {
4439ca4041bSJack F Vogel 	return hw->mac.max_tx_queues;
44413705f88SJack F Vogel }
44513705f88SJack F Vogel 
44613705f88SJack F Vogel /**
4479ca4041bSJack F Vogel  * ixgbe_get_num_of_rx_queues - Get Rx queues
44813705f88SJack F Vogel  * @hw: pointer to hardware structure
44913705f88SJack F Vogel  *
45013705f88SJack F Vogel  * Returns the number of receive queues for the given adapter.
45113705f88SJack F Vogel  **/
ixgbe_get_num_of_rx_queues(struct ixgbe_hw * hw)45213705f88SJack F Vogel u32 ixgbe_get_num_of_rx_queues(struct ixgbe_hw *hw)
45313705f88SJack F Vogel {
4549ca4041bSJack F Vogel 	return hw->mac.max_rx_queues;
45513705f88SJack F Vogel }
45613705f88SJack F Vogel 
45713705f88SJack F Vogel /**
4589ca4041bSJack F Vogel  * ixgbe_stop_adapter - Disable Rx/Tx units
45913705f88SJack F Vogel  * @hw: pointer to hardware structure
46013705f88SJack F Vogel  *
46113705f88SJack F Vogel  * Sets the adapter_stopped flag within ixgbe_hw struct. Clears interrupts,
46213705f88SJack F Vogel  * disables transmit and receive units. The adapter_stopped flag is used by
46313705f88SJack F Vogel  * the shared code and drivers to determine if the adapter is in a stopped
46413705f88SJack F Vogel  * state and should not touch the hardware.
46513705f88SJack F Vogel  **/
ixgbe_stop_adapter(struct ixgbe_hw * hw)46613705f88SJack F Vogel s32 ixgbe_stop_adapter(struct ixgbe_hw *hw)
46713705f88SJack F Vogel {
4689ca4041bSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.stop_adapter, (hw),
46913705f88SJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
47013705f88SJack F Vogel }
47113705f88SJack F Vogel 
47213705f88SJack F Vogel /**
4731a4e3449SJack F Vogel  * ixgbe_read_pba_string - Reads part number string from EEPROM
4741a4e3449SJack F Vogel  * @hw: pointer to hardware structure
4751a4e3449SJack F Vogel  * @pba_num: stores the part number string from the EEPROM
4761a4e3449SJack F Vogel  * @pba_num_size: part number string buffer length
4771a4e3449SJack F Vogel  *
4781a4e3449SJack F Vogel  * Reads the part number string from the EEPROM.
4791a4e3449SJack F Vogel  **/
ixgbe_read_pba_string(struct ixgbe_hw * hw,u8 * pba_num,u32 pba_num_size)4801a4e3449SJack F Vogel s32 ixgbe_read_pba_string(struct ixgbe_hw *hw, u8 *pba_num, u32 pba_num_size)
4811a4e3449SJack F Vogel {
4821a4e3449SJack F Vogel 	return ixgbe_read_pba_string_generic(hw, pba_num, pba_num_size);
4831a4e3449SJack F Vogel }
4841a4e3449SJack F Vogel 
4851a4e3449SJack F Vogel /**
4869ca4041bSJack F Vogel  * ixgbe_read_pba_num - Reads part number from EEPROM
4879ca4041bSJack F Vogel  * @hw: pointer to hardware structure
4889ca4041bSJack F Vogel  * @pba_num: stores the part number from the EEPROM
4899ca4041bSJack F Vogel  *
4909ca4041bSJack F Vogel  * Reads the part number from the EEPROM.
4919ca4041bSJack F Vogel  **/
ixgbe_read_pba_num(struct ixgbe_hw * hw,u32 * pba_num)4929ca4041bSJack F Vogel s32 ixgbe_read_pba_num(struct ixgbe_hw *hw, u32 *pba_num)
4939ca4041bSJack F Vogel {
4949ca4041bSJack F Vogel 	return ixgbe_read_pba_num_generic(hw, pba_num);
4959ca4041bSJack F Vogel }
4969ca4041bSJack F Vogel 
4979ca4041bSJack F Vogel /**
49813705f88SJack F Vogel  * ixgbe_identify_phy - Get PHY type
49913705f88SJack F Vogel  * @hw: pointer to hardware structure
50013705f88SJack F Vogel  *
50113705f88SJack F Vogel  * Determines the physical layer module found on the current adapter.
50213705f88SJack F Vogel  **/
ixgbe_identify_phy(struct ixgbe_hw * hw)50313705f88SJack F Vogel s32 ixgbe_identify_phy(struct ixgbe_hw *hw)
50413705f88SJack F Vogel {
50513705f88SJack F Vogel 	s32 status = IXGBE_SUCCESS;
50613705f88SJack F Vogel 
50713705f88SJack F Vogel 	if (hw->phy.type == ixgbe_phy_unknown) {
5081a4e3449SJack F Vogel 		status = ixgbe_call_func(hw, hw->phy.ops.identify, (hw),
50913705f88SJack F Vogel 					 IXGBE_NOT_IMPLEMENTED);
51013705f88SJack F Vogel 	}
51113705f88SJack F Vogel 
51213705f88SJack F Vogel 	return status;
51313705f88SJack F Vogel }
51413705f88SJack F Vogel 
51513705f88SJack F Vogel /**
51613705f88SJack F Vogel  * ixgbe_reset_phy - Perform a PHY reset
51713705f88SJack F Vogel  * @hw: pointer to hardware structure
51813705f88SJack F Vogel  **/
ixgbe_reset_phy(struct ixgbe_hw * hw)51913705f88SJack F Vogel s32 ixgbe_reset_phy(struct ixgbe_hw *hw)
52013705f88SJack F Vogel {
52113705f88SJack F Vogel 	s32 status = IXGBE_SUCCESS;
52213705f88SJack F Vogel 
52313705f88SJack F Vogel 	if (hw->phy.type == ixgbe_phy_unknown) {
5241b6e0dbaSJack F Vogel 		if (ixgbe_identify_phy(hw) != IXGBE_SUCCESS)
52513705f88SJack F Vogel 			status = IXGBE_ERR_PHY;
52613705f88SJack F Vogel 	}
52713705f88SJack F Vogel 
52813705f88SJack F Vogel 	if (status == IXGBE_SUCCESS) {
5299ca4041bSJack F Vogel 		status = ixgbe_call_func(hw, hw->phy.ops.reset, (hw),
53013705f88SJack F Vogel 					 IXGBE_NOT_IMPLEMENTED);
53113705f88SJack F Vogel 	}
53213705f88SJack F Vogel 	return status;
53313705f88SJack F Vogel }
53413705f88SJack F Vogel 
53513705f88SJack F Vogel /**
5369ca4041bSJack F Vogel  * ixgbe_get_phy_firmware_version -
5379ca4041bSJack F Vogel  * @hw: pointer to hardware structure
5389ca4041bSJack F Vogel  * @firmware_version: pointer to firmware version
5399ca4041bSJack F Vogel  **/
ixgbe_get_phy_firmware_version(struct ixgbe_hw * hw,u16 * firmware_version)5409ca4041bSJack F Vogel s32 ixgbe_get_phy_firmware_version(struct ixgbe_hw *hw, u16 *firmware_version)
5419ca4041bSJack F Vogel {
5429ca4041bSJack F Vogel 	s32 status = IXGBE_SUCCESS;
5439ca4041bSJack F Vogel 
5449ca4041bSJack F Vogel 	status = ixgbe_call_func(hw, hw->phy.ops.get_firmware_version,
5459ca4041bSJack F Vogel 				 (hw, firmware_version),
5469ca4041bSJack F Vogel 				 IXGBE_NOT_IMPLEMENTED);
5479ca4041bSJack F Vogel 	return status;
5489ca4041bSJack F Vogel }
5499ca4041bSJack F Vogel 
5509ca4041bSJack F Vogel /**
55113705f88SJack F Vogel  * ixgbe_read_phy_reg - Read PHY register
55213705f88SJack F Vogel  * @hw: pointer to hardware structure
55313705f88SJack F Vogel  * @reg_addr: 32 bit address of PHY register to read
5547d48aa4cSEric Joyner  * @device_type: type of device you want to communicate with
55513705f88SJack F Vogel  * @phy_data: Pointer to read data from PHY register
55613705f88SJack F Vogel  *
55713705f88SJack F Vogel  * Reads a value from a specified PHY register
55813705f88SJack F Vogel  **/
ixgbe_read_phy_reg(struct ixgbe_hw * hw,u32 reg_addr,u32 device_type,u16 * phy_data)55913705f88SJack F Vogel s32 ixgbe_read_phy_reg(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type,
56013705f88SJack F Vogel 		       u16 *phy_data)
56113705f88SJack F Vogel {
5620ac6dfecSJack F Vogel 	if (hw->phy.id == 0)
5630ac6dfecSJack F Vogel 		ixgbe_identify_phy(hw);
5640ac6dfecSJack F Vogel 
5659ca4041bSJack F Vogel 	return ixgbe_call_func(hw, hw->phy.ops.read_reg, (hw, reg_addr,
5669ca4041bSJack F Vogel 			       device_type, phy_data), IXGBE_NOT_IMPLEMENTED);
56713705f88SJack F Vogel }
56813705f88SJack F Vogel 
56913705f88SJack F Vogel /**
57013705f88SJack F Vogel  * ixgbe_write_phy_reg - Write PHY register
57113705f88SJack F Vogel  * @hw: pointer to hardware structure
57213705f88SJack F Vogel  * @reg_addr: 32 bit PHY register to write
5737d48aa4cSEric Joyner  * @device_type: type of device you want to communicate with
57413705f88SJack F Vogel  * @phy_data: Data to write to the PHY register
57513705f88SJack F Vogel  *
57613705f88SJack F Vogel  * Writes a value to specified PHY register
57713705f88SJack F Vogel  **/
ixgbe_write_phy_reg(struct ixgbe_hw * hw,u32 reg_addr,u32 device_type,u16 phy_data)57813705f88SJack F Vogel s32 ixgbe_write_phy_reg(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type,
57913705f88SJack F Vogel 			u16 phy_data)
58013705f88SJack F Vogel {
5810ac6dfecSJack F Vogel 	if (hw->phy.id == 0)
5820ac6dfecSJack F Vogel 		ixgbe_identify_phy(hw);
5830ac6dfecSJack F Vogel 
5849ca4041bSJack F Vogel 	return ixgbe_call_func(hw, hw->phy.ops.write_reg, (hw, reg_addr,
5859ca4041bSJack F Vogel 			       device_type, phy_data), IXGBE_NOT_IMPLEMENTED);
58613705f88SJack F Vogel }
58713705f88SJack F Vogel 
5889ca4041bSJack F Vogel /**
5899ca4041bSJack F Vogel  * ixgbe_setup_phy_link - Restart PHY autoneg
5909ca4041bSJack F Vogel  * @hw: pointer to hardware structure
5919ca4041bSJack F Vogel  *
5929ca4041bSJack F Vogel  * Restart autonegotiation and PHY and waits for completion.
5939ca4041bSJack F Vogel  **/
ixgbe_setup_phy_link(struct ixgbe_hw * hw)5949ca4041bSJack F Vogel s32 ixgbe_setup_phy_link(struct ixgbe_hw *hw)
5959ca4041bSJack F Vogel {
5969ca4041bSJack F Vogel 	return ixgbe_call_func(hw, hw->phy.ops.setup_link, (hw),
59713705f88SJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
59813705f88SJack F Vogel }
5999ca4041bSJack F Vogel 
6009ca4041bSJack F Vogel /**
601758cc3dcSJack F Vogel  * ixgbe_setup_internal_phy - Configure integrated PHY
602758cc3dcSJack F Vogel  * @hw: pointer to hardware structure
603758cc3dcSJack F Vogel  *
604758cc3dcSJack F Vogel  * Reconfigure the integrated PHY in order to enable talk to the external PHY.
605758cc3dcSJack F Vogel  * Returns success if not implemented, since nothing needs to be done in this
606758cc3dcSJack F Vogel  * case.
607758cc3dcSJack F Vogel  */
ixgbe_setup_internal_phy(struct ixgbe_hw * hw)608758cc3dcSJack F Vogel s32 ixgbe_setup_internal_phy(struct ixgbe_hw *hw)
609758cc3dcSJack F Vogel {
610758cc3dcSJack F Vogel 	return ixgbe_call_func(hw, hw->phy.ops.setup_internal_link, (hw),
611758cc3dcSJack F Vogel 			       IXGBE_SUCCESS);
612758cc3dcSJack F Vogel }
613758cc3dcSJack F Vogel 
614758cc3dcSJack F Vogel /**
6159ca4041bSJack F Vogel  * ixgbe_check_phy_link - Determine link and speed status
6169ca4041bSJack F Vogel  * @hw: pointer to hardware structure
6177d48aa4cSEric Joyner  * @speed: link speed
61879b36ec9SKevin Bowling  * @link_up: true when link is up
6199ca4041bSJack F Vogel  *
6209ca4041bSJack F Vogel  * Reads a PHY register to determine if link is up and the current speed for
6219ca4041bSJack F Vogel  * the PHY.
6229ca4041bSJack F Vogel  **/
ixgbe_check_phy_link(struct ixgbe_hw * hw,ixgbe_link_speed * speed,bool * link_up)6239ca4041bSJack F Vogel s32 ixgbe_check_phy_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
6249ca4041bSJack F Vogel 			 bool *link_up)
6259ca4041bSJack F Vogel {
6269ca4041bSJack F Vogel 	return ixgbe_call_func(hw, hw->phy.ops.check_link, (hw, speed,
6279ca4041bSJack F Vogel 			       link_up), IXGBE_NOT_IMPLEMENTED);
6289ca4041bSJack F Vogel }
6299ca4041bSJack F Vogel 
6309ca4041bSJack F Vogel /**
6319ca4041bSJack F Vogel  * ixgbe_setup_phy_link_speed - Set auto advertise
6329ca4041bSJack F Vogel  * @hw: pointer to hardware structure
6339ca4041bSJack F Vogel  * @speed: new link speed
63479b36ec9SKevin Bowling  * @autoneg_wait_to_complete: true when waiting for completion is needed
6359ca4041bSJack F Vogel  *
6369ca4041bSJack F Vogel  * Sets the auto advertised capabilities
6379ca4041bSJack F Vogel  **/
ixgbe_setup_phy_link_speed(struct ixgbe_hw * hw,ixgbe_link_speed speed,bool autoneg_wait_to_complete)6389ca4041bSJack F Vogel s32 ixgbe_setup_phy_link_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed,
6399ca4041bSJack F Vogel 			       bool autoneg_wait_to_complete)
6409ca4041bSJack F Vogel {
6419ca4041bSJack F Vogel 	return ixgbe_call_func(hw, hw->phy.ops.setup_link_speed, (hw, speed,
6420ecc2ff0SJack F Vogel 			       autoneg_wait_to_complete),
6439ca4041bSJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
64413705f88SJack F Vogel }
64513705f88SJack F Vogel 
64613705f88SJack F Vogel /**
647758cc3dcSJack F Vogel  * ixgbe_set_phy_power - Control the phy power state
648758cc3dcSJack F Vogel  * @hw: pointer to hardware structure
64979b36ec9SKevin Bowling  * @on: true for on, false for off
650758cc3dcSJack F Vogel  */
ixgbe_set_phy_power(struct ixgbe_hw * hw,bool on)651758cc3dcSJack F Vogel s32 ixgbe_set_phy_power(struct ixgbe_hw *hw, bool on)
652758cc3dcSJack F Vogel {
653758cc3dcSJack F Vogel 	return ixgbe_call_func(hw, hw->phy.ops.set_phy_power, (hw, on),
654758cc3dcSJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
655758cc3dcSJack F Vogel }
656758cc3dcSJack F Vogel 
657758cc3dcSJack F Vogel /**
65813705f88SJack F Vogel  * ixgbe_check_link - Get link and speed status
65913705f88SJack F Vogel  * @hw: pointer to hardware structure
6607d48aa4cSEric Joyner  * @speed: pointer to link speed
66179b36ec9SKevin Bowling  * @link_up: true when link is up
6627d48aa4cSEric Joyner  * @link_up_wait_to_complete: bool used to wait for link up or not
66313705f88SJack F Vogel  *
66413705f88SJack F Vogel  * Reads the links register to determine if link is up and the current speed
66513705f88SJack F Vogel  **/
ixgbe_check_link(struct ixgbe_hw * hw,ixgbe_link_speed * speed,bool * link_up,bool link_up_wait_to_complete)66613705f88SJack F Vogel s32 ixgbe_check_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
6679ca4041bSJack F Vogel 		     bool *link_up, bool link_up_wait_to_complete)
66813705f88SJack F Vogel {
6699ca4041bSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.check_link, (hw, speed,
6709ca4041bSJack F Vogel 			       link_up, link_up_wait_to_complete),
67113705f88SJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
67213705f88SJack F Vogel }
67313705f88SJack F Vogel 
67413705f88SJack F Vogel /**
6751a4e3449SJack F Vogel  * ixgbe_disable_tx_laser - Disable Tx laser
6761a4e3449SJack F Vogel  * @hw: pointer to hardware structure
6771a4e3449SJack F Vogel  *
6781a4e3449SJack F Vogel  * If the driver needs to disable the laser on SFI optics.
6791a4e3449SJack F Vogel  **/
ixgbe_disable_tx_laser(struct ixgbe_hw * hw)6801a4e3449SJack F Vogel void ixgbe_disable_tx_laser(struct ixgbe_hw *hw)
6811a4e3449SJack F Vogel {
6821a4e3449SJack F Vogel 	if (hw->mac.ops.disable_tx_laser)
6831a4e3449SJack F Vogel 		hw->mac.ops.disable_tx_laser(hw);
6841a4e3449SJack F Vogel }
6851a4e3449SJack F Vogel 
6861a4e3449SJack F Vogel /**
6871a4e3449SJack F Vogel  * ixgbe_enable_tx_laser - Enable Tx laser
6881a4e3449SJack F Vogel  * @hw: pointer to hardware structure
6891a4e3449SJack F Vogel  *
6901a4e3449SJack F Vogel  * If the driver needs to enable the laser on SFI optics.
6911a4e3449SJack F Vogel  **/
ixgbe_enable_tx_laser(struct ixgbe_hw * hw)6921a4e3449SJack F Vogel void ixgbe_enable_tx_laser(struct ixgbe_hw *hw)
6931a4e3449SJack F Vogel {
6941a4e3449SJack F Vogel 	if (hw->mac.ops.enable_tx_laser)
6951a4e3449SJack F Vogel 		hw->mac.ops.enable_tx_laser(hw);
6961a4e3449SJack F Vogel }
6971a4e3449SJack F Vogel 
6981a4e3449SJack F Vogel /**
6991a4e3449SJack F Vogel  * ixgbe_flap_tx_laser - flap Tx laser to start autotry process
7001a4e3449SJack F Vogel  * @hw: pointer to hardware structure
7011a4e3449SJack F Vogel  *
7021a4e3449SJack F Vogel  * When the driver changes the link speeds that it can support then
7031a4e3449SJack F Vogel  * flap the tx laser to alert the link partner to start autotry
7041a4e3449SJack F Vogel  * process on its end.
7051a4e3449SJack F Vogel  **/
ixgbe_flap_tx_laser(struct ixgbe_hw * hw)7061a4e3449SJack F Vogel void ixgbe_flap_tx_laser(struct ixgbe_hw *hw)
7071a4e3449SJack F Vogel {
7081a4e3449SJack F Vogel 	if (hw->mac.ops.flap_tx_laser)
7091a4e3449SJack F Vogel 		hw->mac.ops.flap_tx_laser(hw);
7101a4e3449SJack F Vogel }
7111a4e3449SJack F Vogel 
7121a4e3449SJack F Vogel /**
7132969bf0eSJack F Vogel  * ixgbe_setup_link - Set link speed
71413705f88SJack F Vogel  * @hw: pointer to hardware structure
71513705f88SJack F Vogel  * @speed: new link speed
71679b36ec9SKevin Bowling  * @autoneg_wait_to_complete: true when waiting for completion is needed
71713705f88SJack F Vogel  *
7182969bf0eSJack F Vogel  * Configures link settings.  Restarts the link.
7192969bf0eSJack F Vogel  * Performs autonegotiation if needed.
72013705f88SJack F Vogel  **/
ixgbe_setup_link(struct ixgbe_hw * hw,ixgbe_link_speed speed,bool autoneg_wait_to_complete)7212969bf0eSJack F Vogel s32 ixgbe_setup_link(struct ixgbe_hw *hw, ixgbe_link_speed speed,
72213705f88SJack F Vogel 		     bool autoneg_wait_to_complete)
72313705f88SJack F Vogel {
7242969bf0eSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.setup_link, (hw, speed,
7250ecc2ff0SJack F Vogel 			       autoneg_wait_to_complete),
72613705f88SJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
72713705f88SJack F Vogel }
72813705f88SJack F Vogel 
72913705f88SJack F Vogel /**
730758cc3dcSJack F Vogel  * ixgbe_setup_mac_link - Set link speed
731758cc3dcSJack F Vogel  * @hw: pointer to hardware structure
732758cc3dcSJack F Vogel  * @speed: new link speed
73379b36ec9SKevin Bowling  * @autoneg_wait_to_complete: true when waiting for completion is needed
734758cc3dcSJack F Vogel  *
735758cc3dcSJack F Vogel  * Configures link settings.  Restarts the link.
736758cc3dcSJack F Vogel  * Performs autonegotiation if needed.
737758cc3dcSJack F Vogel  **/
ixgbe_setup_mac_link(struct ixgbe_hw * hw,ixgbe_link_speed speed,bool autoneg_wait_to_complete)738758cc3dcSJack F Vogel s32 ixgbe_setup_mac_link(struct ixgbe_hw *hw, ixgbe_link_speed speed,
739758cc3dcSJack F Vogel 			 bool autoneg_wait_to_complete)
740758cc3dcSJack F Vogel {
741758cc3dcSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.setup_mac_link, (hw, speed,
742758cc3dcSJack F Vogel 			       autoneg_wait_to_complete),
743758cc3dcSJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
744758cc3dcSJack F Vogel }
745758cc3dcSJack F Vogel 
746758cc3dcSJack F Vogel /**
7479ca4041bSJack F Vogel  * ixgbe_get_link_capabilities - Returns link capabilities
74813705f88SJack F Vogel  * @hw: pointer to hardware structure
7497d48aa4cSEric Joyner  * @speed: link speed capabilities
75079b36ec9SKevin Bowling  * @autoneg: true when autoneg or autotry is enabled
75113705f88SJack F Vogel  *
7529ca4041bSJack F Vogel  * Determines the link capabilities of the current configuration.
75313705f88SJack F Vogel  **/
ixgbe_get_link_capabilities(struct ixgbe_hw * hw,ixgbe_link_speed * speed,bool * autoneg)7549ca4041bSJack F Vogel s32 ixgbe_get_link_capabilities(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
75513705f88SJack F Vogel 				bool *autoneg)
75613705f88SJack F Vogel {
7579ca4041bSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.get_link_capabilities, (hw,
7589ca4041bSJack F Vogel 			       speed, autoneg), IXGBE_NOT_IMPLEMENTED);
75913705f88SJack F Vogel }
76013705f88SJack F Vogel 
76113705f88SJack F Vogel /**
7629ca4041bSJack F Vogel  * ixgbe_led_on - Turn on LEDs
76313705f88SJack F Vogel  * @hw: pointer to hardware structure
76413705f88SJack F Vogel  * @index: led number to turn on
76513705f88SJack F Vogel  *
76613705f88SJack F Vogel  * Turns on the software controllable LEDs.
76713705f88SJack F Vogel  **/
ixgbe_led_on(struct ixgbe_hw * hw,u32 index)76813705f88SJack F Vogel s32 ixgbe_led_on(struct ixgbe_hw *hw, u32 index)
76913705f88SJack F Vogel {
7709ca4041bSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.led_on, (hw, index),
77113705f88SJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
77213705f88SJack F Vogel }
77313705f88SJack F Vogel 
77413705f88SJack F Vogel /**
7759ca4041bSJack F Vogel  * ixgbe_led_off - Turn off LEDs
77613705f88SJack F Vogel  * @hw: pointer to hardware structure
77713705f88SJack F Vogel  * @index: led number to turn off
77813705f88SJack F Vogel  *
77913705f88SJack F Vogel  * Turns off the software controllable LEDs.
78013705f88SJack F Vogel  **/
ixgbe_led_off(struct ixgbe_hw * hw,u32 index)78113705f88SJack F Vogel s32 ixgbe_led_off(struct ixgbe_hw *hw, u32 index)
78213705f88SJack F Vogel {
7839ca4041bSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.led_off, (hw, index),
78413705f88SJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
78513705f88SJack F Vogel }
78613705f88SJack F Vogel 
78713705f88SJack F Vogel /**
7889ca4041bSJack F Vogel  * ixgbe_blink_led_start - Blink LEDs
78913705f88SJack F Vogel  * @hw: pointer to hardware structure
79013705f88SJack F Vogel  * @index: led number to blink
79113705f88SJack F Vogel  *
79213705f88SJack F Vogel  * Blink LED based on index.
79313705f88SJack F Vogel  **/
ixgbe_blink_led_start(struct ixgbe_hw * hw,u32 index)79413705f88SJack F Vogel s32 ixgbe_blink_led_start(struct ixgbe_hw *hw, u32 index)
79513705f88SJack F Vogel {
7969ca4041bSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.blink_led_start, (hw, index),
79713705f88SJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
79813705f88SJack F Vogel }
79913705f88SJack F Vogel 
80013705f88SJack F Vogel /**
8019ca4041bSJack F Vogel  * ixgbe_blink_led_stop - Stop blinking LEDs
80213705f88SJack F Vogel  * @hw: pointer to hardware structure
8037d48aa4cSEric Joyner  * @index: led number to stop
80413705f88SJack F Vogel  *
80513705f88SJack F Vogel  * Stop blinking LED based on index.
80613705f88SJack F Vogel  **/
ixgbe_blink_led_stop(struct ixgbe_hw * hw,u32 index)80713705f88SJack F Vogel s32 ixgbe_blink_led_stop(struct ixgbe_hw *hw, u32 index)
80813705f88SJack F Vogel {
8099ca4041bSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.blink_led_stop, (hw, index),
81013705f88SJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
81113705f88SJack F Vogel }
81213705f88SJack F Vogel 
81313705f88SJack F Vogel /**
8149ca4041bSJack F Vogel  * ixgbe_init_eeprom_params - Initialize EEPROM parameters
81513705f88SJack F Vogel  * @hw: pointer to hardware structure
81613705f88SJack F Vogel  *
81713705f88SJack F Vogel  * Initializes the EEPROM parameters ixgbe_eeprom_info within the
81813705f88SJack F Vogel  * ixgbe_hw struct in order to set up EEPROM access.
81913705f88SJack F Vogel  **/
ixgbe_init_eeprom_params(struct ixgbe_hw * hw)82013705f88SJack F Vogel s32 ixgbe_init_eeprom_params(struct ixgbe_hw *hw)
82113705f88SJack F Vogel {
8229ca4041bSJack F Vogel 	return ixgbe_call_func(hw, hw->eeprom.ops.init_params, (hw),
82313705f88SJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
82413705f88SJack F Vogel }
82513705f88SJack F Vogel 
82613705f88SJack F Vogel 
82713705f88SJack F Vogel /**
82813705f88SJack F Vogel  * ixgbe_write_eeprom - Write word to EEPROM
82913705f88SJack F Vogel  * @hw: pointer to hardware structure
83013705f88SJack F Vogel  * @offset: offset within the EEPROM to be written to
83113705f88SJack F Vogel  * @data: 16 bit word to be written to the EEPROM
83213705f88SJack F Vogel  *
83313705f88SJack F Vogel  * Writes 16 bit value to EEPROM. If ixgbe_eeprom_update_checksum is not
83413705f88SJack F Vogel  * called after this function, the EEPROM will most likely contain an
83513705f88SJack F Vogel  * invalid checksum.
83613705f88SJack F Vogel  **/
ixgbe_write_eeprom(struct ixgbe_hw * hw,u16 offset,u16 data)83713705f88SJack F Vogel s32 ixgbe_write_eeprom(struct ixgbe_hw *hw, u16 offset, u16 data)
83813705f88SJack F Vogel {
8399ca4041bSJack F Vogel 	return ixgbe_call_func(hw, hw->eeprom.ops.write, (hw, offset, data),
84013705f88SJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
84113705f88SJack F Vogel }
84213705f88SJack F Vogel 
84313705f88SJack F Vogel /**
84485d0a26eSJack F Vogel  * ixgbe_write_eeprom_buffer - Write word(s) to EEPROM
84585d0a26eSJack F Vogel  * @hw: pointer to hardware structure
84685d0a26eSJack F Vogel  * @offset: offset within the EEPROM to be written to
84785d0a26eSJack F Vogel  * @data: 16 bit word(s) to be written to the EEPROM
84885d0a26eSJack F Vogel  * @words: number of words
84985d0a26eSJack F Vogel  *
85085d0a26eSJack F Vogel  * Writes 16 bit word(s) to EEPROM. If ixgbe_eeprom_update_checksum is not
85185d0a26eSJack F Vogel  * called after this function, the EEPROM will most likely contain an
85285d0a26eSJack F Vogel  * invalid checksum.
85385d0a26eSJack F Vogel  **/
ixgbe_write_eeprom_buffer(struct ixgbe_hw * hw,u16 offset,u16 words,u16 * data)85485d0a26eSJack F Vogel s32 ixgbe_write_eeprom_buffer(struct ixgbe_hw *hw, u16 offset, u16 words,
85585d0a26eSJack F Vogel 			      u16 *data)
85685d0a26eSJack F Vogel {
85785d0a26eSJack F Vogel 	return ixgbe_call_func(hw, hw->eeprom.ops.write_buffer,
85885d0a26eSJack F Vogel 			       (hw, offset, words, data),
85985d0a26eSJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
86085d0a26eSJack F Vogel }
86185d0a26eSJack F Vogel 
86285d0a26eSJack F Vogel /**
86313705f88SJack F Vogel  * ixgbe_read_eeprom - Read word from EEPROM
86413705f88SJack F Vogel  * @hw: pointer to hardware structure
86513705f88SJack F Vogel  * @offset: offset within the EEPROM to be read
86613705f88SJack F Vogel  * @data: read 16 bit value from EEPROM
86713705f88SJack F Vogel  *
86813705f88SJack F Vogel  * Reads 16 bit value from EEPROM
86913705f88SJack F Vogel  **/
ixgbe_read_eeprom(struct ixgbe_hw * hw,u16 offset,u16 * data)87013705f88SJack F Vogel s32 ixgbe_read_eeprom(struct ixgbe_hw *hw, u16 offset, u16 *data)
87113705f88SJack F Vogel {
8729ca4041bSJack F Vogel 	return ixgbe_call_func(hw, hw->eeprom.ops.read, (hw, offset, data),
87313705f88SJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
87413705f88SJack F Vogel }
87513705f88SJack F Vogel 
87613705f88SJack F Vogel /**
87785d0a26eSJack F Vogel  * ixgbe_read_eeprom_buffer - Read word(s) from EEPROM
87885d0a26eSJack F Vogel  * @hw: pointer to hardware structure
87985d0a26eSJack F Vogel  * @offset: offset within the EEPROM to be read
88085d0a26eSJack F Vogel  * @data: read 16 bit word(s) from EEPROM
88185d0a26eSJack F Vogel  * @words: number of words
88285d0a26eSJack F Vogel  *
88385d0a26eSJack F Vogel  * Reads 16 bit word(s) from EEPROM
88485d0a26eSJack F Vogel  **/
ixgbe_read_eeprom_buffer(struct ixgbe_hw * hw,u16 offset,u16 words,u16 * data)88585d0a26eSJack F Vogel s32 ixgbe_read_eeprom_buffer(struct ixgbe_hw *hw, u16 offset,
88685d0a26eSJack F Vogel 			     u16 words, u16 *data)
88785d0a26eSJack F Vogel {
88885d0a26eSJack F Vogel 	return ixgbe_call_func(hw, hw->eeprom.ops.read_buffer,
88985d0a26eSJack F Vogel 			       (hw, offset, words, data),
89085d0a26eSJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
89185d0a26eSJack F Vogel }
89285d0a26eSJack F Vogel 
89385d0a26eSJack F Vogel /**
89413705f88SJack F Vogel  * ixgbe_validate_eeprom_checksum - Validate EEPROM checksum
89513705f88SJack F Vogel  * @hw: pointer to hardware structure
89613705f88SJack F Vogel  * @checksum_val: calculated checksum
89713705f88SJack F Vogel  *
89813705f88SJack F Vogel  * Performs checksum calculation and validates the EEPROM checksum
89913705f88SJack F Vogel  **/
ixgbe_validate_eeprom_checksum(struct ixgbe_hw * hw,u16 * checksum_val)90013705f88SJack F Vogel s32 ixgbe_validate_eeprom_checksum(struct ixgbe_hw *hw, u16 *checksum_val)
90113705f88SJack F Vogel {
9029ca4041bSJack F Vogel 	return ixgbe_call_func(hw, hw->eeprom.ops.validate_checksum,
90313705f88SJack F Vogel 			       (hw, checksum_val), IXGBE_NOT_IMPLEMENTED);
90413705f88SJack F Vogel }
90513705f88SJack F Vogel 
90613705f88SJack F Vogel /**
907edef2769SRadoslaw Tyl  * ixgbe_update_eeprom_checksum - Updates the EEPROM checksum
90813705f88SJack F Vogel  * @hw: pointer to hardware structure
90913705f88SJack F Vogel  **/
ixgbe_update_eeprom_checksum(struct ixgbe_hw * hw)91013705f88SJack F Vogel s32 ixgbe_update_eeprom_checksum(struct ixgbe_hw *hw)
91113705f88SJack F Vogel {
9129ca4041bSJack F Vogel 	return ixgbe_call_func(hw, hw->eeprom.ops.update_checksum, (hw),
91313705f88SJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
91413705f88SJack F Vogel }
91513705f88SJack F Vogel 
91613705f88SJack F Vogel /**
9170ac6dfecSJack F Vogel  * ixgbe_insert_mac_addr - Find a RAR for this mac address
9180ac6dfecSJack F Vogel  * @hw: pointer to hardware structure
9190ac6dfecSJack F Vogel  * @addr: Address to put into receive address register
9200ac6dfecSJack F Vogel  * @vmdq: VMDq pool to assign
9210ac6dfecSJack F Vogel  *
9220ac6dfecSJack F Vogel  * Puts an ethernet address into a receive address register, or
923363089d8SPedro F. Giffuni  * finds the rar that it is already in; adds to the pool list
9240ac6dfecSJack F Vogel  **/
ixgbe_insert_mac_addr(struct ixgbe_hw * hw,u8 * addr,u32 vmdq)9250ac6dfecSJack F Vogel s32 ixgbe_insert_mac_addr(struct ixgbe_hw *hw, u8 *addr, u32 vmdq)
9260ac6dfecSJack F Vogel {
9270ac6dfecSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.insert_mac_addr,
9280ac6dfecSJack F Vogel 			       (hw, addr, vmdq),
9290ac6dfecSJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
9300ac6dfecSJack F Vogel }
9310ac6dfecSJack F Vogel 
9320ac6dfecSJack F Vogel /**
9339ca4041bSJack F Vogel  * ixgbe_set_rar - Set Rx address register
93413705f88SJack F Vogel  * @hw: pointer to hardware structure
93513705f88SJack F Vogel  * @index: Receive address register to write
9369ca4041bSJack F Vogel  * @addr: Address to put into receive address register
9379ca4041bSJack F Vogel  * @vmdq: VMDq "set"
93813705f88SJack F Vogel  * @enable_addr: set flag that address is active
93913705f88SJack F Vogel  *
94013705f88SJack F Vogel  * Puts an ethernet address into a receive address register.
94113705f88SJack F Vogel  **/
ixgbe_set_rar(struct ixgbe_hw * hw,u32 index,u8 * addr,u32 vmdq,u32 enable_addr)9429ca4041bSJack F Vogel s32 ixgbe_set_rar(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq,
94313705f88SJack F Vogel 		  u32 enable_addr)
94413705f88SJack F Vogel {
9459ca4041bSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.set_rar, (hw, index, addr, vmdq,
94613705f88SJack F Vogel 			       enable_addr), IXGBE_NOT_IMPLEMENTED);
94713705f88SJack F Vogel }
94813705f88SJack F Vogel 
94913705f88SJack F Vogel /**
9505b7f4cedSJack F Vogel  * ixgbe_clear_rar - Clear Rx address register
9515b7f4cedSJack F Vogel  * @hw: pointer to hardware structure
9525b7f4cedSJack F Vogel  * @index: Receive address register to write
9535b7f4cedSJack F Vogel  *
9545b7f4cedSJack F Vogel  * Puts an ethernet address into a receive address register.
9555b7f4cedSJack F Vogel  **/
ixgbe_clear_rar(struct ixgbe_hw * hw,u32 index)9565b7f4cedSJack F Vogel s32 ixgbe_clear_rar(struct ixgbe_hw *hw, u32 index)
9575b7f4cedSJack F Vogel {
9585b7f4cedSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.clear_rar, (hw, index),
9595b7f4cedSJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
9605b7f4cedSJack F Vogel }
9615b7f4cedSJack F Vogel 
9625b7f4cedSJack F Vogel /**
9639ca4041bSJack F Vogel  * ixgbe_set_vmdq - Associate a VMDq index with a receive address
9649ca4041bSJack F Vogel  * @hw: pointer to hardware structure
9659ca4041bSJack F Vogel  * @rar: receive address register index to associate with VMDq index
9669ca4041bSJack F Vogel  * @vmdq: VMDq set or pool index
9679ca4041bSJack F Vogel  **/
ixgbe_set_vmdq(struct ixgbe_hw * hw,u32 rar,u32 vmdq)9689ca4041bSJack F Vogel s32 ixgbe_set_vmdq(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
9699ca4041bSJack F Vogel {
9709ca4041bSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.set_vmdq, (hw, rar, vmdq),
9719ca4041bSJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
972a621e3c8SJack F Vogel 
973a621e3c8SJack F Vogel }
974a621e3c8SJack F Vogel 
975a621e3c8SJack F Vogel /**
976a621e3c8SJack F Vogel  * ixgbe_set_vmdq_san_mac - Associate VMDq index 127 with a receive address
977a621e3c8SJack F Vogel  * @hw: pointer to hardware structure
978a621e3c8SJack F Vogel  * @vmdq: VMDq default pool index
979a621e3c8SJack F Vogel  **/
ixgbe_set_vmdq_san_mac(struct ixgbe_hw * hw,u32 vmdq)980a621e3c8SJack F Vogel s32 ixgbe_set_vmdq_san_mac(struct ixgbe_hw *hw, u32 vmdq)
981a621e3c8SJack F Vogel {
982a621e3c8SJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.set_vmdq_san_mac,
983a621e3c8SJack F Vogel 			       (hw, vmdq), IXGBE_NOT_IMPLEMENTED);
9849ca4041bSJack F Vogel }
9859ca4041bSJack F Vogel 
9869ca4041bSJack F Vogel /**
9875b7f4cedSJack F Vogel  * ixgbe_clear_vmdq - Disassociate a VMDq index from a receive address
9885b7f4cedSJack F Vogel  * @hw: pointer to hardware structure
9895b7f4cedSJack F Vogel  * @rar: receive address register index to disassociate with VMDq index
9905b7f4cedSJack F Vogel  * @vmdq: VMDq set or pool index
9915b7f4cedSJack F Vogel  **/
ixgbe_clear_vmdq(struct ixgbe_hw * hw,u32 rar,u32 vmdq)9925b7f4cedSJack F Vogel s32 ixgbe_clear_vmdq(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
9935b7f4cedSJack F Vogel {
9945b7f4cedSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.clear_vmdq, (hw, rar, vmdq),
9955b7f4cedSJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
9965b7f4cedSJack F Vogel }
9975b7f4cedSJack F Vogel 
9985b7f4cedSJack F Vogel /**
99913705f88SJack F Vogel  * ixgbe_init_rx_addrs - Initializes receive address filters.
100013705f88SJack F Vogel  * @hw: pointer to hardware structure
100113705f88SJack F Vogel  *
100213705f88SJack F Vogel  * Places the MAC address in receive address register 0 and clears the rest
10039ca4041bSJack F Vogel  * of the receive address registers. Clears the multicast table. Assumes
100413705f88SJack F Vogel  * the receiver is in reset when the routine is called.
100513705f88SJack F Vogel  **/
ixgbe_init_rx_addrs(struct ixgbe_hw * hw)100613705f88SJack F Vogel s32 ixgbe_init_rx_addrs(struct ixgbe_hw *hw)
100713705f88SJack F Vogel {
10089ca4041bSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.init_rx_addrs, (hw),
100913705f88SJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
101013705f88SJack F Vogel }
101113705f88SJack F Vogel 
101213705f88SJack F Vogel /**
101313705f88SJack F Vogel  * ixgbe_get_num_rx_addrs - Returns the number of RAR entries.
101413705f88SJack F Vogel  * @hw: pointer to hardware structure
101513705f88SJack F Vogel  **/
ixgbe_get_num_rx_addrs(struct ixgbe_hw * hw)101613705f88SJack F Vogel u32 ixgbe_get_num_rx_addrs(struct ixgbe_hw *hw)
101713705f88SJack F Vogel {
10189ca4041bSJack F Vogel 	return hw->mac.num_rar_entries;
10199ca4041bSJack F Vogel }
10209ca4041bSJack F Vogel 
10219ca4041bSJack F Vogel /**
10229ca4041bSJack F Vogel  * ixgbe_update_uc_addr_list - Updates the MAC's list of secondary addresses
10239ca4041bSJack F Vogel  * @hw: pointer to hardware structure
10249ca4041bSJack F Vogel  * @addr_list: the list of new multicast addresses
10259ca4041bSJack F Vogel  * @addr_count: number of addresses
10269ca4041bSJack F Vogel  * @func: iterator function to walk the multicast address list
10279ca4041bSJack F Vogel  *
10289ca4041bSJack F Vogel  * The given list replaces any existing list. Clears the secondary addrs from
10299ca4041bSJack F Vogel  * receive address registers. Uses unused receive address registers for the
10309ca4041bSJack F Vogel  * first secondary addresses, and falls back to promiscuous mode as needed.
10319ca4041bSJack F Vogel  **/
ixgbe_update_uc_addr_list(struct ixgbe_hw * hw,u8 * addr_list,u32 addr_count,ixgbe_mc_addr_itr func)10329ca4041bSJack F Vogel s32 ixgbe_update_uc_addr_list(struct ixgbe_hw *hw, u8 *addr_list,
10339ca4041bSJack F Vogel 			      u32 addr_count, ixgbe_mc_addr_itr func)
10349ca4041bSJack F Vogel {
10359ca4041bSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.update_uc_addr_list, (hw,
10369ca4041bSJack F Vogel 			       addr_list, addr_count, func),
10379ca4041bSJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
103813705f88SJack F Vogel }
103913705f88SJack F Vogel 
104013705f88SJack F Vogel /**
104113705f88SJack F Vogel  * ixgbe_update_mc_addr_list - Updates the MAC's list of multicast addresses
104213705f88SJack F Vogel  * @hw: pointer to hardware structure
104313705f88SJack F Vogel  * @mc_addr_list: the list of new multicast addresses
104413705f88SJack F Vogel  * @mc_addr_count: number of addresses
10459ca4041bSJack F Vogel  * @func: iterator function to walk the multicast address list
10467d48aa4cSEric Joyner  * @clear: flag, when set clears the table beforehand
104713705f88SJack F Vogel  *
104813705f88SJack F Vogel  * The given list replaces any existing list. Clears the MC addrs from receive
10499ca4041bSJack F Vogel  * address registers and the multicast table. Uses unused receive address
105013705f88SJack F Vogel  * registers for the first multicast addresses, and hashes the rest into the
105113705f88SJack F Vogel  * multicast table.
105213705f88SJack F Vogel  **/
ixgbe_update_mc_addr_list(struct ixgbe_hw * hw,u8 * mc_addr_list,u32 mc_addr_count,ixgbe_mc_addr_itr func,bool clear)105313705f88SJack F Vogel s32 ixgbe_update_mc_addr_list(struct ixgbe_hw *hw, u8 *mc_addr_list,
105485d0a26eSJack F Vogel 			      u32 mc_addr_count, ixgbe_mc_addr_itr func,
105585d0a26eSJack F Vogel 			      bool clear)
105613705f88SJack F Vogel {
10579ca4041bSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.update_mc_addr_list, (hw,
105885d0a26eSJack F Vogel 			       mc_addr_list, mc_addr_count, func, clear),
105913705f88SJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
106013705f88SJack F Vogel }
106113705f88SJack F Vogel 
106213705f88SJack F Vogel /**
106313705f88SJack F Vogel  * ixgbe_enable_mc - Enable multicast address in RAR
106413705f88SJack F Vogel  * @hw: pointer to hardware structure
106513705f88SJack F Vogel  *
106613705f88SJack F Vogel  * Enables multicast address in RAR and the use of the multicast hash table.
106713705f88SJack F Vogel  **/
ixgbe_enable_mc(struct ixgbe_hw * hw)106813705f88SJack F Vogel s32 ixgbe_enable_mc(struct ixgbe_hw *hw)
106913705f88SJack F Vogel {
10709ca4041bSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.enable_mc, (hw),
107113705f88SJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
107213705f88SJack F Vogel }
107313705f88SJack F Vogel 
107413705f88SJack F Vogel /**
107513705f88SJack F Vogel  * ixgbe_disable_mc - Disable multicast address in RAR
107613705f88SJack F Vogel  * @hw: pointer to hardware structure
107713705f88SJack F Vogel  *
107813705f88SJack F Vogel  * Disables multicast address in RAR and the use of the multicast hash table.
107913705f88SJack F Vogel  **/
ixgbe_disable_mc(struct ixgbe_hw * hw)108013705f88SJack F Vogel s32 ixgbe_disable_mc(struct ixgbe_hw *hw)
108113705f88SJack F Vogel {
10829ca4041bSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.disable_mc, (hw),
108313705f88SJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
108413705f88SJack F Vogel }
108513705f88SJack F Vogel 
108613705f88SJack F Vogel /**
108713705f88SJack F Vogel  * ixgbe_clear_vfta - Clear VLAN filter table
108813705f88SJack F Vogel  * @hw: pointer to hardware structure
108913705f88SJack F Vogel  *
1090cd7e11f7SGordon Bergling  * Clears the VLAN filter table, and the VMDq index associated with the filter
109113705f88SJack F Vogel  **/
ixgbe_clear_vfta(struct ixgbe_hw * hw)109213705f88SJack F Vogel s32 ixgbe_clear_vfta(struct ixgbe_hw *hw)
109313705f88SJack F Vogel {
10949ca4041bSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.clear_vfta, (hw),
109513705f88SJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
109613705f88SJack F Vogel }
109713705f88SJack F Vogel 
109813705f88SJack F Vogel /**
109913705f88SJack F Vogel  * ixgbe_set_vfta - Set VLAN filter table
110013705f88SJack F Vogel  * @hw: pointer to hardware structure
110113705f88SJack F Vogel  * @vlan: VLAN id to write to VLAN filter
11028eb6488eSEric Joyner  * @vind: VMDq output index that maps queue to VLAN id in VLVFB
11038eb6488eSEric Joyner  * @vlan_on: boolean flag to turn on/off VLAN
11048eb6488eSEric Joyner  * @vlvf_bypass: boolean flag indicating updating the default pool is okay
110513705f88SJack F Vogel  *
110613705f88SJack F Vogel  * Turn on/off specified VLAN in the VLAN filter table.
110713705f88SJack F Vogel  **/
ixgbe_set_vfta(struct ixgbe_hw * hw,u32 vlan,u32 vind,bool vlan_on,bool vlvf_bypass)11088eb6488eSEric Joyner s32 ixgbe_set_vfta(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on,
11098eb6488eSEric Joyner 		   bool vlvf_bypass)
111013705f88SJack F Vogel {
11119ca4041bSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.set_vfta, (hw, vlan, vind,
11128eb6488eSEric Joyner 			       vlan_on, vlvf_bypass), IXGBE_NOT_IMPLEMENTED);
111313705f88SJack F Vogel }
111413705f88SJack F Vogel 
111513705f88SJack F Vogel /**
111685d0a26eSJack F Vogel  * ixgbe_set_vlvf - Set VLAN Pool Filter
111785d0a26eSJack F Vogel  * @hw: pointer to hardware structure
111885d0a26eSJack F Vogel  * @vlan: VLAN id to write to VLAN filter
11198eb6488eSEric Joyner  * @vind: VMDq output index that maps queue to VLAN id in VLVFB
11208eb6488eSEric Joyner  * @vlan_on: boolean flag to turn on/off VLAN in VLVF
11218eb6488eSEric Joyner  * @vfta_delta: pointer to the difference between the current value of VFTA
11228eb6488eSEric Joyner  *		 and the desired value
11238eb6488eSEric Joyner  * @vfta: the desired value of the VFTA
11248eb6488eSEric Joyner  * @vlvf_bypass: boolean flag indicating updating the default pool is okay
112585d0a26eSJack F Vogel  *
112685d0a26eSJack F Vogel  * Turn on/off specified bit in VLVF table.
112785d0a26eSJack F Vogel  **/
ixgbe_set_vlvf(struct ixgbe_hw * hw,u32 vlan,u32 vind,bool vlan_on,u32 * vfta_delta,u32 vfta,bool vlvf_bypass)112885d0a26eSJack F Vogel s32 ixgbe_set_vlvf(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on,
11298eb6488eSEric Joyner 		   u32 *vfta_delta, u32 vfta, bool vlvf_bypass)
113085d0a26eSJack F Vogel {
113185d0a26eSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.set_vlvf, (hw, vlan, vind,
11328eb6488eSEric Joyner 			       vlan_on, vfta_delta, vfta, vlvf_bypass),
11338eb6488eSEric Joyner 			       IXGBE_NOT_IMPLEMENTED);
113485d0a26eSJack F Vogel }
113585d0a26eSJack F Vogel 
113685d0a26eSJack F Vogel /**
1137*f72de14eSKevin Bowling  * ixgbe_toggle_txdctl - Toggle VF's queues
1138*f72de14eSKevin Bowling  * @hw: pointer to hardware structure
1139*f72de14eSKevin Bowling  * @vind: VMDq pool index
1140*f72de14eSKevin Bowling  *
1141*f72de14eSKevin Bowling  * Enable and disable each queue in VF.
1142*f72de14eSKevin Bowling  */
ixgbe_toggle_txdctl(struct ixgbe_hw * hw,u32 vind)1143*f72de14eSKevin Bowling s32 ixgbe_toggle_txdctl(struct ixgbe_hw *hw, u32 vind)
1144*f72de14eSKevin Bowling {
1145*f72de14eSKevin Bowling 	return ixgbe_call_func(hw, hw->mac.ops.toggle_txdctl, (hw,
1146*f72de14eSKevin Bowling 			       vind), IXGBE_NOT_IMPLEMENTED);
1147*f72de14eSKevin Bowling }
1148*f72de14eSKevin Bowling 
1149*f72de14eSKevin Bowling /**
11500ac6dfecSJack F Vogel  * ixgbe_fc_enable - Enable flow control
115113705f88SJack F Vogel  * @hw: pointer to hardware structure
115213705f88SJack F Vogel  *
115313705f88SJack F Vogel  * Configures the flow control settings based on SW configuration.
115413705f88SJack F Vogel  **/
ixgbe_fc_enable(struct ixgbe_hw * hw)1155a621e3c8SJack F Vogel s32 ixgbe_fc_enable(struct ixgbe_hw *hw)
115613705f88SJack F Vogel {
1157a621e3c8SJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.fc_enable, (hw),
115813705f88SJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
115913705f88SJack F Vogel }
116013705f88SJack F Vogel 
11613ec35e52SJack F Vogel /**
1162758cc3dcSJack F Vogel  * ixgbe_setup_fc - Set up flow control
1163758cc3dcSJack F Vogel  * @hw: pointer to hardware structure
1164758cc3dcSJack F Vogel  *
1165758cc3dcSJack F Vogel  * Called at init time to set up flow control.
1166758cc3dcSJack F Vogel  **/
ixgbe_setup_fc(struct ixgbe_hw * hw)1167758cc3dcSJack F Vogel s32 ixgbe_setup_fc(struct ixgbe_hw *hw)
1168758cc3dcSJack F Vogel {
1169758cc3dcSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.setup_fc, (hw),
1170758cc3dcSJack F Vogel 		IXGBE_NOT_IMPLEMENTED);
1171758cc3dcSJack F Vogel }
1172758cc3dcSJack F Vogel 
1173758cc3dcSJack F Vogel /**
117485d0a26eSJack F Vogel  * ixgbe_set_fw_drv_ver - Try to send the driver version number FW
117585d0a26eSJack F Vogel  * @hw: pointer to hardware structure
117685d0a26eSJack F Vogel  * @maj: driver major number to be sent to firmware
117785d0a26eSJack F Vogel  * @min: driver minor number to be sent to firmware
117885d0a26eSJack F Vogel  * @build: driver build number to be sent to firmware
117985d0a26eSJack F Vogel  * @ver: driver version number to be sent to firmware
11808eb6488eSEric Joyner  * @len: length of driver_ver string
11818eb6488eSEric Joyner  * @driver_ver: driver string
118285d0a26eSJack F Vogel  **/
ixgbe_set_fw_drv_ver(struct ixgbe_hw * hw,u8 maj,u8 min,u8 build,u8 ver,u16 len,char * driver_ver)118385d0a26eSJack F Vogel s32 ixgbe_set_fw_drv_ver(struct ixgbe_hw *hw, u8 maj, u8 min, u8 build,
11848eb6488eSEric Joyner 			 u8 ver, u16 len, char *driver_ver)
118585d0a26eSJack F Vogel {
118685d0a26eSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.set_fw_drv_ver, (hw, maj, min,
11878eb6488eSEric Joyner 			       build, ver, len, driver_ver),
11888eb6488eSEric Joyner 			       IXGBE_NOT_IMPLEMENTED);
118985d0a26eSJack F Vogel }
119085d0a26eSJack F Vogel 
119185d0a26eSJack F Vogel 
11923f66b96dSKevin Bowling /**
11933f66b96dSKevin Bowling  * ixgbe_get_thermal_sensor_data - Gathers thermal sensor data
11943f66b96dSKevin Bowling  * @hw: pointer to hardware structure
11953f66b96dSKevin Bowling  *
11963f66b96dSKevin Bowling  * Updates the temperatures in mac.thermal_sensor_data
11973f66b96dSKevin Bowling  **/
ixgbe_get_thermal_sensor_data(struct ixgbe_hw * hw)11983f66b96dSKevin Bowling s32 ixgbe_get_thermal_sensor_data(struct ixgbe_hw *hw)
11993f66b96dSKevin Bowling {
12003f66b96dSKevin Bowling 	return ixgbe_call_func(hw, hw->mac.ops.get_thermal_sensor_data, (hw),
12013f66b96dSKevin Bowling 				IXGBE_NOT_IMPLEMENTED);
12023f66b96dSKevin Bowling }
12033f66b96dSKevin Bowling 
12043f66b96dSKevin Bowling /**
12053f66b96dSKevin Bowling  * ixgbe_init_thermal_sensor_thresh - Inits thermal sensor thresholds
12063f66b96dSKevin Bowling  * @hw: pointer to hardware structure
12073f66b96dSKevin Bowling  *
12083f66b96dSKevin Bowling  * Inits the thermal sensor thresholds according to the NVM map
12093f66b96dSKevin Bowling  **/
ixgbe_init_thermal_sensor_thresh(struct ixgbe_hw * hw)12103f66b96dSKevin Bowling s32 ixgbe_init_thermal_sensor_thresh(struct ixgbe_hw *hw)
12113f66b96dSKevin Bowling {
12123f66b96dSKevin Bowling 	return ixgbe_call_func(hw, hw->mac.ops.init_thermal_sensor_thresh, (hw),
12133f66b96dSKevin Bowling 				IXGBE_NOT_IMPLEMENTED);
12143f66b96dSKevin Bowling }
1215fd75b91dSJack F Vogel 
1216758cc3dcSJack F Vogel /**
1217758cc3dcSJack F Vogel  * ixgbe_dmac_config - Configure DMA Coalescing registers.
1218758cc3dcSJack F Vogel  * @hw: pointer to hardware structure
1219758cc3dcSJack F Vogel  *
1220758cc3dcSJack F Vogel  * Configure DMA coalescing. If enabling dmac, dmac is activated.
1221758cc3dcSJack F Vogel  * When disabling dmac, dmac enable dmac bit is cleared.
1222758cc3dcSJack F Vogel  **/
ixgbe_dmac_config(struct ixgbe_hw * hw)1223758cc3dcSJack F Vogel s32 ixgbe_dmac_config(struct ixgbe_hw *hw)
1224758cc3dcSJack F Vogel {
1225758cc3dcSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.dmac_config, (hw),
1226758cc3dcSJack F Vogel 				IXGBE_NOT_IMPLEMENTED);
1227758cc3dcSJack F Vogel }
1228758cc3dcSJack F Vogel 
1229758cc3dcSJack F Vogel /**
1230758cc3dcSJack F Vogel  * ixgbe_dmac_update_tcs - Configure DMA Coalescing registers.
1231758cc3dcSJack F Vogel  * @hw: pointer to hardware structure
1232758cc3dcSJack F Vogel  *
1233758cc3dcSJack F Vogel  * Disables dmac, updates per TC settings, and then enable dmac.
1234758cc3dcSJack F Vogel  **/
ixgbe_dmac_update_tcs(struct ixgbe_hw * hw)1235758cc3dcSJack F Vogel s32 ixgbe_dmac_update_tcs(struct ixgbe_hw *hw)
1236758cc3dcSJack F Vogel {
1237758cc3dcSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.dmac_update_tcs, (hw),
1238758cc3dcSJack F Vogel 				IXGBE_NOT_IMPLEMENTED);
1239758cc3dcSJack F Vogel }
1240758cc3dcSJack F Vogel 
1241758cc3dcSJack F Vogel /**
1242758cc3dcSJack F Vogel  * ixgbe_dmac_config_tcs - Configure DMA Coalescing registers.
1243758cc3dcSJack F Vogel  * @hw: pointer to hardware structure
1244758cc3dcSJack F Vogel  *
1245758cc3dcSJack F Vogel  * Configure DMA coalescing threshold per TC and set high priority bit for
1246758cc3dcSJack F Vogel  * FCOE TC. The dmac enable bit must be cleared before configuring.
1247758cc3dcSJack F Vogel  **/
ixgbe_dmac_config_tcs(struct ixgbe_hw * hw)1248758cc3dcSJack F Vogel s32 ixgbe_dmac_config_tcs(struct ixgbe_hw *hw)
1249758cc3dcSJack F Vogel {
1250758cc3dcSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.dmac_config_tcs, (hw),
1251758cc3dcSJack F Vogel 				IXGBE_NOT_IMPLEMENTED);
1252758cc3dcSJack F Vogel }
1253758cc3dcSJack F Vogel 
1254758cc3dcSJack F Vogel /**
1255758cc3dcSJack F Vogel  * ixgbe_setup_eee - Enable/disable EEE support
1256758cc3dcSJack F Vogel  * @hw: pointer to the HW structure
1257758cc3dcSJack F Vogel  * @enable_eee: boolean flag to enable EEE
1258758cc3dcSJack F Vogel  *
1259758cc3dcSJack F Vogel  * Enable/disable EEE based on enable_ee flag.
1260758cc3dcSJack F Vogel  * Auto-negotiation must be started after BASE-T EEE bits in PHY register 7.3C
1261758cc3dcSJack F Vogel  * are modified.
1262758cc3dcSJack F Vogel  *
1263758cc3dcSJack F Vogel  **/
ixgbe_setup_eee(struct ixgbe_hw * hw,bool enable_eee)1264758cc3dcSJack F Vogel s32 ixgbe_setup_eee(struct ixgbe_hw *hw, bool enable_eee)
1265758cc3dcSJack F Vogel {
1266758cc3dcSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.setup_eee, (hw, enable_eee),
1267758cc3dcSJack F Vogel 			IXGBE_NOT_IMPLEMENTED);
1268758cc3dcSJack F Vogel }
1269758cc3dcSJack F Vogel 
1270758cc3dcSJack F Vogel /**
1271758cc3dcSJack F Vogel  * ixgbe_set_source_address_pruning - Enable/Disable source address pruning
1272758cc3dcSJack F Vogel  * @hw: pointer to hardware structure
12737d48aa4cSEric Joyner  * @enable: enable or disable source address pruning
1274758cc3dcSJack F Vogel  * @pool: Rx pool - Rx pool to toggle source address pruning
1275758cc3dcSJack F Vogel  **/
ixgbe_set_source_address_pruning(struct ixgbe_hw * hw,bool enable,unsigned int pool)1276758cc3dcSJack F Vogel void ixgbe_set_source_address_pruning(struct ixgbe_hw *hw, bool enable,
1277758cc3dcSJack F Vogel 				      unsigned int pool)
1278758cc3dcSJack F Vogel {
1279758cc3dcSJack F Vogel 	if (hw->mac.ops.set_source_address_pruning)
1280758cc3dcSJack F Vogel 		hw->mac.ops.set_source_address_pruning(hw, enable, pool);
1281758cc3dcSJack F Vogel }
1282758cc3dcSJack F Vogel 
1283758cc3dcSJack F Vogel /**
1284758cc3dcSJack F Vogel  * ixgbe_set_ethertype_anti_spoofing - Enable/Disable Ethertype anti-spoofing
1285758cc3dcSJack F Vogel  * @hw: pointer to hardware structure
1286758cc3dcSJack F Vogel  * @enable: enable or disable switch for Ethertype anti-spoofing
1287758cc3dcSJack F Vogel  * @vf: Virtual Function pool - VF Pool to set for Ethertype anti-spoofing
1288758cc3dcSJack F Vogel  *
1289758cc3dcSJack F Vogel  **/
ixgbe_set_ethertype_anti_spoofing(struct ixgbe_hw * hw,bool enable,int vf)1290758cc3dcSJack F Vogel void ixgbe_set_ethertype_anti_spoofing(struct ixgbe_hw *hw, bool enable, int vf)
1291758cc3dcSJack F Vogel {
1292758cc3dcSJack F Vogel 	if (hw->mac.ops.set_ethertype_anti_spoofing)
1293758cc3dcSJack F Vogel 		hw->mac.ops.set_ethertype_anti_spoofing(hw, enable, vf);
1294758cc3dcSJack F Vogel }
1295758cc3dcSJack F Vogel 
1296758cc3dcSJack F Vogel /**
1297758cc3dcSJack F Vogel  * ixgbe_read_iosf_sb_reg - Read 32 bit PHY register
1298758cc3dcSJack F Vogel  * @hw: pointer to hardware structure
1299758cc3dcSJack F Vogel  * @reg_addr: 32 bit address of PHY register to read
1300758cc3dcSJack F Vogel  * @device_type: type of device you want to communicate with
1301758cc3dcSJack F Vogel  * @phy_data: Pointer to read data from PHY register
1302758cc3dcSJack F Vogel  *
1303758cc3dcSJack F Vogel  * Reads a value from a specified PHY register
1304758cc3dcSJack F Vogel  **/
ixgbe_read_iosf_sb_reg(struct ixgbe_hw * hw,u32 reg_addr,u32 device_type,u32 * phy_data)1305758cc3dcSJack F Vogel s32 ixgbe_read_iosf_sb_reg(struct ixgbe_hw *hw, u32 reg_addr,
1306758cc3dcSJack F Vogel 			   u32 device_type, u32 *phy_data)
1307758cc3dcSJack F Vogel {
1308758cc3dcSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.read_iosf_sb_reg, (hw, reg_addr,
1309758cc3dcSJack F Vogel 			       device_type, phy_data), IXGBE_NOT_IMPLEMENTED);
1310758cc3dcSJack F Vogel }
1311758cc3dcSJack F Vogel 
1312758cc3dcSJack F Vogel /**
1313758cc3dcSJack F Vogel  * ixgbe_write_iosf_sb_reg - Write 32 bit register through IOSF Sideband
1314758cc3dcSJack F Vogel  * @hw: pointer to hardware structure
1315758cc3dcSJack F Vogel  * @reg_addr: 32 bit PHY register to write
1316758cc3dcSJack F Vogel  * @device_type: type of device you want to communicate with
1317758cc3dcSJack F Vogel  * @phy_data: Data to write to the PHY register
1318758cc3dcSJack F Vogel  *
1319758cc3dcSJack F Vogel  * Writes a value to specified PHY register
1320758cc3dcSJack F Vogel  **/
ixgbe_write_iosf_sb_reg(struct ixgbe_hw * hw,u32 reg_addr,u32 device_type,u32 phy_data)1321758cc3dcSJack F Vogel s32 ixgbe_write_iosf_sb_reg(struct ixgbe_hw *hw, u32 reg_addr,
1322758cc3dcSJack F Vogel 			    u32 device_type, u32 phy_data)
1323758cc3dcSJack F Vogel {
1324758cc3dcSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.write_iosf_sb_reg, (hw, reg_addr,
1325758cc3dcSJack F Vogel 			       device_type, phy_data), IXGBE_NOT_IMPLEMENTED);
1326758cc3dcSJack F Vogel }
1327758cc3dcSJack F Vogel 
1328758cc3dcSJack F Vogel /**
1329758cc3dcSJack F Vogel  * ixgbe_disable_mdd - Disable malicious driver detection
1330758cc3dcSJack F Vogel  * @hw: pointer to hardware structure
1331758cc3dcSJack F Vogel  *
1332758cc3dcSJack F Vogel  **/
ixgbe_disable_mdd(struct ixgbe_hw * hw)1333758cc3dcSJack F Vogel void ixgbe_disable_mdd(struct ixgbe_hw *hw)
1334758cc3dcSJack F Vogel {
1335758cc3dcSJack F Vogel 	if (hw->mac.ops.disable_mdd)
1336758cc3dcSJack F Vogel 		hw->mac.ops.disable_mdd(hw);
1337758cc3dcSJack F Vogel }
1338758cc3dcSJack F Vogel 
1339758cc3dcSJack F Vogel /**
1340758cc3dcSJack F Vogel  * ixgbe_enable_mdd - Enable malicious driver detection
1341758cc3dcSJack F Vogel  * @hw: pointer to hardware structure
1342758cc3dcSJack F Vogel  *
1343758cc3dcSJack F Vogel  **/
ixgbe_enable_mdd(struct ixgbe_hw * hw)1344758cc3dcSJack F Vogel void ixgbe_enable_mdd(struct ixgbe_hw *hw)
1345758cc3dcSJack F Vogel {
1346758cc3dcSJack F Vogel 	if (hw->mac.ops.enable_mdd)
1347758cc3dcSJack F Vogel 		hw->mac.ops.enable_mdd(hw);
1348758cc3dcSJack F Vogel }
1349758cc3dcSJack F Vogel 
1350758cc3dcSJack F Vogel /**
1351758cc3dcSJack F Vogel  * ixgbe_mdd_event - Handle malicious driver detection event
1352758cc3dcSJack F Vogel  * @hw: pointer to hardware structure
1353758cc3dcSJack F Vogel  * @vf_bitmap: vf bitmap of malicious vfs
1354758cc3dcSJack F Vogel  *
1355758cc3dcSJack F Vogel  **/
ixgbe_mdd_event(struct ixgbe_hw * hw,u32 * vf_bitmap)1356758cc3dcSJack F Vogel void ixgbe_mdd_event(struct ixgbe_hw *hw, u32 *vf_bitmap)
1357758cc3dcSJack F Vogel {
1358758cc3dcSJack F Vogel 	if (hw->mac.ops.mdd_event)
1359758cc3dcSJack F Vogel 		hw->mac.ops.mdd_event(hw, vf_bitmap);
1360758cc3dcSJack F Vogel }
1361758cc3dcSJack F Vogel 
1362758cc3dcSJack F Vogel /**
1363758cc3dcSJack F Vogel  * ixgbe_restore_mdd_vf - Restore VF that was disabled during malicious driver
1364758cc3dcSJack F Vogel  * detection event
1365758cc3dcSJack F Vogel  * @hw: pointer to hardware structure
1366758cc3dcSJack F Vogel  * @vf: vf index
1367758cc3dcSJack F Vogel  *
1368758cc3dcSJack F Vogel  **/
ixgbe_restore_mdd_vf(struct ixgbe_hw * hw,u32 vf)1369758cc3dcSJack F Vogel void ixgbe_restore_mdd_vf(struct ixgbe_hw *hw, u32 vf)
1370758cc3dcSJack F Vogel {
1371758cc3dcSJack F Vogel 	if (hw->mac.ops.restore_mdd_vf)
1372758cc3dcSJack F Vogel 		hw->mac.ops.restore_mdd_vf(hw, vf);
1373758cc3dcSJack F Vogel }
1374758cc3dcSJack F Vogel 
1375758cc3dcSJack F Vogel /**
1376b622bdb4SXiaoyun Li  * ixgbe_fw_recovery_mode - Check if in FW NVM recovery mode
1377b622bdb4SXiaoyun Li  * @hw: pointer to hardware structure
1378b622bdb4SXiaoyun Li  *
1379b622bdb4SXiaoyun Li  **/
ixgbe_fw_recovery_mode(struct ixgbe_hw * hw)1380b622bdb4SXiaoyun Li bool ixgbe_fw_recovery_mode(struct ixgbe_hw *hw)
1381b622bdb4SXiaoyun Li {
1382b622bdb4SXiaoyun Li 	if (hw->mac.ops.fw_recovery_mode)
1383b622bdb4SXiaoyun Li 		return hw->mac.ops.fw_recovery_mode(hw);
1384b622bdb4SXiaoyun Li 	return false;
1385b622bdb4SXiaoyun Li }
1386b622bdb4SXiaoyun Li 
1387b622bdb4SXiaoyun Li /**
1388758cc3dcSJack F Vogel  * ixgbe_enter_lplu - Transition to low power states
1389758cc3dcSJack F Vogel  * @hw: pointer to hardware structure
1390758cc3dcSJack F Vogel  *
1391758cc3dcSJack F Vogel  * Configures Low Power Link Up on transition to low power states
1392758cc3dcSJack F Vogel  * (from D0 to non-D0).
1393758cc3dcSJack F Vogel  **/
ixgbe_enter_lplu(struct ixgbe_hw * hw)1394758cc3dcSJack F Vogel s32 ixgbe_enter_lplu(struct ixgbe_hw *hw)
1395758cc3dcSJack F Vogel {
1396758cc3dcSJack F Vogel 	return ixgbe_call_func(hw, hw->phy.ops.enter_lplu, (hw),
1397758cc3dcSJack F Vogel 				IXGBE_NOT_IMPLEMENTED);
1398758cc3dcSJack F Vogel }
1399fd75b91dSJack F Vogel 
140085d0a26eSJack F Vogel /**
14016f37f232SEric Joyner  * ixgbe_handle_lasi - Handle external Base T PHY interrupt
14026f37f232SEric Joyner  * @hw: pointer to hardware structure
14036f37f232SEric Joyner  *
14046f37f232SEric Joyner  * Handle external Base T PHY interrupt. If high temperature
14056f37f232SEric Joyner  * failure alarm then return error, else if link status change
14066f37f232SEric Joyner  * then setup internal/external PHY link
14076f37f232SEric Joyner  *
14086f37f232SEric Joyner  * Return IXGBE_ERR_OVERTEMP if interrupt is high temperature
14096f37f232SEric Joyner  * failure alarm, else return PHY access status.
14106f37f232SEric Joyner  */
ixgbe_handle_lasi(struct ixgbe_hw * hw)14116f37f232SEric Joyner s32 ixgbe_handle_lasi(struct ixgbe_hw *hw)
14126f37f232SEric Joyner {
14136f37f232SEric Joyner 	return ixgbe_call_func(hw, hw->phy.ops.handle_lasi, (hw),
14146f37f232SEric Joyner 				IXGBE_NOT_IMPLEMENTED);
14156f37f232SEric Joyner }
14166f37f232SEric Joyner 
14176f37f232SEric Joyner /**
14188eb6488eSEric Joyner  * ixgbe_bypass_rw - Bit bang data into by_pass FW
14198eb6488eSEric Joyner  * @hw: pointer to hardware structure
14208eb6488eSEric Joyner  * @cmd: Command we send to the FW
14218eb6488eSEric Joyner  * @status: The reply from the FW
14228eb6488eSEric Joyner  *
14238eb6488eSEric Joyner  * Bit-bangs the cmd to the by_pass FW status points to what is returned.
14248eb6488eSEric Joyner  **/
ixgbe_bypass_rw(struct ixgbe_hw * hw,u32 cmd,u32 * status)14258eb6488eSEric Joyner s32 ixgbe_bypass_rw(struct ixgbe_hw *hw, u32 cmd, u32 *status)
14268eb6488eSEric Joyner {
14278eb6488eSEric Joyner 	return ixgbe_call_func(hw, hw->mac.ops.bypass_rw, (hw, cmd, status),
14288eb6488eSEric Joyner 				IXGBE_NOT_IMPLEMENTED);
14298eb6488eSEric Joyner }
14308eb6488eSEric Joyner 
14318eb6488eSEric Joyner /**
14328eb6488eSEric Joyner  * ixgbe_bypass_valid_rd - Verify valid return from bit-bang.
1433*f72de14eSKevin Bowling  * @hw: pointer to hardware structure
1434*f72de14eSKevin Bowling  * @in_reg: The register cmd for the bit-bang read.
1435*f72de14eSKevin Bowling  * @out_reg: The register returned from a bit-bang read.
14368eb6488eSEric Joyner  *
14378eb6488eSEric Joyner  * If we send a write we can't be sure it took until we can read back
143899cb088fSIan Moffett  * that same register.  It can be a problem as some of the fields may
14398eb6488eSEric Joyner  * for valid reasons change inbetween the time wrote the register and
14408eb6488eSEric Joyner  * we read it again to verify.  So this function check everything we
14418eb6488eSEric Joyner  * can check and then assumes it worked.
14428eb6488eSEric Joyner  **/
ixgbe_bypass_valid_rd(struct ixgbe_hw * hw,u32 in_reg,u32 out_reg)14438eb6488eSEric Joyner bool ixgbe_bypass_valid_rd(struct ixgbe_hw *hw, u32 in_reg, u32 out_reg)
14448eb6488eSEric Joyner {
14458eb6488eSEric Joyner 	return ixgbe_call_func(hw, hw->mac.ops.bypass_valid_rd,
14468eb6488eSEric Joyner 			       (in_reg, out_reg), IXGBE_NOT_IMPLEMENTED);
14478eb6488eSEric Joyner }
14488eb6488eSEric Joyner 
14498eb6488eSEric Joyner /**
14508eb6488eSEric Joyner  * ixgbe_bypass_set - Set a bypass field in the FW CTRL Regiter.
14518eb6488eSEric Joyner  * @hw: pointer to hardware structure
14528eb6488eSEric Joyner  * @cmd: The control word we are setting.
14538eb6488eSEric Joyner  * @event: The event we are setting in the FW.  This also happens to
14548eb6488eSEric Joyner  *         be the mask for the event we are setting (handy)
14558eb6488eSEric Joyner  * @action: The action we set the event to in the FW. This is in a
14568eb6488eSEric Joyner  *          bit field that happens to be what we want to put in
14578eb6488eSEric Joyner  *          the event spot (also handy)
14588eb6488eSEric Joyner  *
14598eb6488eSEric Joyner  * Writes to the cmd control the bits in actions.
14608eb6488eSEric Joyner  **/
ixgbe_bypass_set(struct ixgbe_hw * hw,u32 cmd,u32 event,u32 action)14618eb6488eSEric Joyner s32 ixgbe_bypass_set(struct ixgbe_hw *hw, u32 cmd, u32 event, u32 action)
14628eb6488eSEric Joyner {
14638eb6488eSEric Joyner 	return ixgbe_call_func(hw, hw->mac.ops.bypass_set,
14648eb6488eSEric Joyner 			       (hw, cmd, event, action),
14658eb6488eSEric Joyner 				IXGBE_NOT_IMPLEMENTED);
14668eb6488eSEric Joyner }
14678eb6488eSEric Joyner 
14688eb6488eSEric Joyner /**
14698eb6488eSEric Joyner  * ixgbe_bypass_rd_eep - Read the bypass FW eeprom address
14708eb6488eSEric Joyner  * @hw: pointer to hardware structure
14718eb6488eSEric Joyner  * @addr: The bypass eeprom address to read.
14728eb6488eSEric Joyner  * @value: The 8b of data at the address above.
14738eb6488eSEric Joyner  **/
ixgbe_bypass_rd_eep(struct ixgbe_hw * hw,u32 addr,u8 * value)14748eb6488eSEric Joyner s32 ixgbe_bypass_rd_eep(struct ixgbe_hw *hw, u32 addr, u8 *value)
14758eb6488eSEric Joyner {
14768eb6488eSEric Joyner 	return ixgbe_call_func(hw, hw->mac.ops.bypass_rd_eep,
14778eb6488eSEric Joyner 			       (hw, addr, value), IXGBE_NOT_IMPLEMENTED);
14788eb6488eSEric Joyner }
14798eb6488eSEric Joyner 
14808eb6488eSEric Joyner /**
14813ec35e52SJack F Vogel  * ixgbe_read_analog_reg8 - Reads 8 bit analog register
14823ec35e52SJack F Vogel  * @hw: pointer to hardware structure
14833ec35e52SJack F Vogel  * @reg: analog register to read
14843ec35e52SJack F Vogel  * @val: read value
14853ec35e52SJack F Vogel  *
14863ec35e52SJack F Vogel  * Performs write operation to analog register specified.
14873ec35e52SJack F Vogel  **/
ixgbe_read_analog_reg8(struct ixgbe_hw * hw,u32 reg,u8 * val)14883ec35e52SJack F Vogel s32 ixgbe_read_analog_reg8(struct ixgbe_hw *hw, u32 reg, u8 *val)
14893ec35e52SJack F Vogel {
14909ca4041bSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.read_analog_reg8, (hw, reg,
14919ca4041bSJack F Vogel 			       val), IXGBE_NOT_IMPLEMENTED);
14923ec35e52SJack F Vogel }
14933ec35e52SJack F Vogel 
14943ec35e52SJack F Vogel /**
14953ec35e52SJack F Vogel  * ixgbe_write_analog_reg8 - Writes 8 bit analog register
14963ec35e52SJack F Vogel  * @hw: pointer to hardware structure
14973ec35e52SJack F Vogel  * @reg: analog register to write
14983ec35e52SJack F Vogel  * @val: value to write
14993ec35e52SJack F Vogel  *
15003ec35e52SJack F Vogel  * Performs write operation to Atlas analog register specified.
15013ec35e52SJack F Vogel  **/
ixgbe_write_analog_reg8(struct ixgbe_hw * hw,u32 reg,u8 val)15023ec35e52SJack F Vogel s32 ixgbe_write_analog_reg8(struct ixgbe_hw *hw, u32 reg, u8 val)
15033ec35e52SJack F Vogel {
15049ca4041bSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.write_analog_reg8, (hw, reg,
15059ca4041bSJack F Vogel 			       val), IXGBE_NOT_IMPLEMENTED);
15063ec35e52SJack F Vogel }
15073ec35e52SJack F Vogel 
15085b7f4cedSJack F Vogel /**
15095b7f4cedSJack F Vogel  * ixgbe_init_uta_tables - Initializes Unicast Table Arrays.
15105b7f4cedSJack F Vogel  * @hw: pointer to hardware structure
15115b7f4cedSJack F Vogel  *
15125b7f4cedSJack F Vogel  * Initializes the Unicast Table Arrays to zero on device load.  This
15135b7f4cedSJack F Vogel  * is part of the Rx init addr execution path.
15145b7f4cedSJack F Vogel  **/
ixgbe_init_uta_tables(struct ixgbe_hw * hw)15155b7f4cedSJack F Vogel s32 ixgbe_init_uta_tables(struct ixgbe_hw *hw)
15165b7f4cedSJack F Vogel {
15175b7f4cedSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.init_uta_tables, (hw),
15185b7f4cedSJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
15195b7f4cedSJack F Vogel }
15201b6e0dbaSJack F Vogel 
15211b6e0dbaSJack F Vogel /**
15220ac6dfecSJack F Vogel  * ixgbe_read_i2c_byte - Reads 8 bit word over I2C at specified device address
15230ac6dfecSJack F Vogel  * @hw: pointer to hardware structure
15240ac6dfecSJack F Vogel  * @byte_offset: byte offset to read
1525758cc3dcSJack F Vogel  * @dev_addr: I2C bus address to read from
15260ac6dfecSJack F Vogel  * @data: value read
15270ac6dfecSJack F Vogel  *
15280ac6dfecSJack F Vogel  * Performs byte read operation to SFP module's EEPROM over I2C interface.
15290ac6dfecSJack F Vogel  **/
ixgbe_read_i2c_byte(struct ixgbe_hw * hw,u8 byte_offset,u8 dev_addr,u8 * data)15300ac6dfecSJack F Vogel s32 ixgbe_read_i2c_byte(struct ixgbe_hw *hw, u8 byte_offset, u8 dev_addr,
15310ac6dfecSJack F Vogel 			u8 *data)
15320ac6dfecSJack F Vogel {
15330ac6dfecSJack F Vogel 	return ixgbe_call_func(hw, hw->phy.ops.read_i2c_byte, (hw, byte_offset,
15340ac6dfecSJack F Vogel 			       dev_addr, data), IXGBE_NOT_IMPLEMENTED);
15350ac6dfecSJack F Vogel }
15360ac6dfecSJack F Vogel 
15370ac6dfecSJack F Vogel /**
15386f37f232SEric Joyner  * ixgbe_read_i2c_byte_unlocked - Reads 8 bit word via I2C from device address
15396f37f232SEric Joyner  * @hw: pointer to hardware structure
15406f37f232SEric Joyner  * @byte_offset: byte offset to read
15416f37f232SEric Joyner  * @dev_addr: I2C bus address to read from
15426f37f232SEric Joyner  * @data: value read
15436f37f232SEric Joyner  *
15446f37f232SEric Joyner  * Performs byte read operation to SFP module's EEPROM over I2C interface.
15456f37f232SEric Joyner  **/
ixgbe_read_i2c_byte_unlocked(struct ixgbe_hw * hw,u8 byte_offset,u8 dev_addr,u8 * data)15466f37f232SEric Joyner s32 ixgbe_read_i2c_byte_unlocked(struct ixgbe_hw *hw, u8 byte_offset,
15476f37f232SEric Joyner 				 u8 dev_addr, u8 *data)
15486f37f232SEric Joyner {
15496f37f232SEric Joyner 	return ixgbe_call_func(hw, hw->phy.ops.read_i2c_byte_unlocked,
15506f37f232SEric Joyner 			       (hw, byte_offset, dev_addr, data),
15516f37f232SEric Joyner 			       IXGBE_NOT_IMPLEMENTED);
15526f37f232SEric Joyner }
15536f37f232SEric Joyner 
15546f37f232SEric Joyner /**
15558eb6488eSEric Joyner  * ixgbe_read_link - Perform read operation on link device
1556758cc3dcSJack F Vogel  * @hw: pointer to the hardware structure
15578eb6488eSEric Joyner  * @addr: bus address to read from
15588eb6488eSEric Joyner  * @reg: device register to read from
1559758cc3dcSJack F Vogel  * @val: pointer to location to receive read value
1560758cc3dcSJack F Vogel  *
1561758cc3dcSJack F Vogel  * Returns an error code on error.
1562758cc3dcSJack F Vogel  */
ixgbe_read_link(struct ixgbe_hw * hw,u8 addr,u16 reg,u16 * val)15638eb6488eSEric Joyner s32 ixgbe_read_link(struct ixgbe_hw *hw, u8 addr, u16 reg, u16 *val)
1564758cc3dcSJack F Vogel {
15658eb6488eSEric Joyner 	return ixgbe_call_func(hw, hw->link.ops.read_link, (hw, addr,
1566758cc3dcSJack F Vogel 			       reg, val), IXGBE_NOT_IMPLEMENTED);
1567758cc3dcSJack F Vogel }
1568758cc3dcSJack F Vogel 
1569758cc3dcSJack F Vogel /**
15708eb6488eSEric Joyner  * ixgbe_read_link_unlocked - Perform read operation on link device
15716f37f232SEric Joyner  * @hw: pointer to the hardware structure
15728eb6488eSEric Joyner  * @addr: bus address to read from
15738eb6488eSEric Joyner  * @reg: device register to read from
15746f37f232SEric Joyner  * @val: pointer to location to receive read value
15756f37f232SEric Joyner  *
15766f37f232SEric Joyner  * Returns an error code on error.
15776f37f232SEric Joyner  **/
ixgbe_read_link_unlocked(struct ixgbe_hw * hw,u8 addr,u16 reg,u16 * val)15788eb6488eSEric Joyner s32 ixgbe_read_link_unlocked(struct ixgbe_hw *hw, u8 addr, u16 reg, u16 *val)
15796f37f232SEric Joyner {
15808eb6488eSEric Joyner 	return ixgbe_call_func(hw, hw->link.ops.read_link_unlocked,
15818eb6488eSEric Joyner 			       (hw, addr, reg, val), IXGBE_NOT_IMPLEMENTED);
15826f37f232SEric Joyner }
15836f37f232SEric Joyner 
15846f37f232SEric Joyner /**
15850ac6dfecSJack F Vogel  * ixgbe_write_i2c_byte - Writes 8 bit word over I2C
15860ac6dfecSJack F Vogel  * @hw: pointer to hardware structure
15870ac6dfecSJack F Vogel  * @byte_offset: byte offset to write
1588758cc3dcSJack F Vogel  * @dev_addr: I2C bus address to write to
15890ac6dfecSJack F Vogel  * @data: value to write
15900ac6dfecSJack F Vogel  *
15910ac6dfecSJack F Vogel  * Performs byte write operation to SFP module's EEPROM over I2C interface
15920ac6dfecSJack F Vogel  * at a specified device address.
15930ac6dfecSJack F Vogel  **/
ixgbe_write_i2c_byte(struct ixgbe_hw * hw,u8 byte_offset,u8 dev_addr,u8 data)15940ac6dfecSJack F Vogel s32 ixgbe_write_i2c_byte(struct ixgbe_hw *hw, u8 byte_offset, u8 dev_addr,
15950ac6dfecSJack F Vogel 			 u8 data)
15960ac6dfecSJack F Vogel {
15970ac6dfecSJack F Vogel 	return ixgbe_call_func(hw, hw->phy.ops.write_i2c_byte, (hw, byte_offset,
15980ac6dfecSJack F Vogel 			       dev_addr, data), IXGBE_NOT_IMPLEMENTED);
15990ac6dfecSJack F Vogel }
16000ac6dfecSJack F Vogel 
16010ac6dfecSJack F Vogel /**
16026f37f232SEric Joyner  * ixgbe_write_i2c_byte_unlocked - Writes 8 bit word over I2C
16036f37f232SEric Joyner  * @hw: pointer to hardware structure
16046f37f232SEric Joyner  * @byte_offset: byte offset to write
16056f37f232SEric Joyner  * @dev_addr: I2C bus address to write to
16066f37f232SEric Joyner  * @data: value to write
16076f37f232SEric Joyner  *
16086f37f232SEric Joyner  * Performs byte write operation to SFP module's EEPROM over I2C interface
16096f37f232SEric Joyner  * at a specified device address.
16106f37f232SEric Joyner  **/
ixgbe_write_i2c_byte_unlocked(struct ixgbe_hw * hw,u8 byte_offset,u8 dev_addr,u8 data)16116f37f232SEric Joyner s32 ixgbe_write_i2c_byte_unlocked(struct ixgbe_hw *hw, u8 byte_offset,
16126f37f232SEric Joyner 				  u8 dev_addr, u8 data)
16136f37f232SEric Joyner {
16146f37f232SEric Joyner 	return ixgbe_call_func(hw, hw->phy.ops.write_i2c_byte_unlocked,
16156f37f232SEric Joyner 			       (hw, byte_offset, dev_addr, data),
16166f37f232SEric Joyner 			       IXGBE_NOT_IMPLEMENTED);
16176f37f232SEric Joyner }
16186f37f232SEric Joyner 
16196f37f232SEric Joyner /**
16208eb6488eSEric Joyner  * ixgbe_write_link - Perform write operation on link device
1621758cc3dcSJack F Vogel  * @hw: pointer to the hardware structure
16228eb6488eSEric Joyner  * @addr: bus address to write to
16238eb6488eSEric Joyner  * @reg: device register to write to
1624758cc3dcSJack F Vogel  * @val: value to write
1625758cc3dcSJack F Vogel  *
1626758cc3dcSJack F Vogel  * Returns an error code on error.
1627758cc3dcSJack F Vogel  */
ixgbe_write_link(struct ixgbe_hw * hw,u8 addr,u16 reg,u16 val)16288eb6488eSEric Joyner s32 ixgbe_write_link(struct ixgbe_hw *hw, u8 addr, u16 reg, u16 val)
1629758cc3dcSJack F Vogel {
16308eb6488eSEric Joyner 	return ixgbe_call_func(hw, hw->link.ops.write_link,
16318eb6488eSEric Joyner 			       (hw, addr, reg, val), IXGBE_NOT_IMPLEMENTED);
1632758cc3dcSJack F Vogel }
1633758cc3dcSJack F Vogel 
1634758cc3dcSJack F Vogel /**
16358eb6488eSEric Joyner  * ixgbe_write_link_unlocked - Perform write operation on link device
16366f37f232SEric Joyner  * @hw: pointer to the hardware structure
16378eb6488eSEric Joyner  * @addr: bus address to write to
16388eb6488eSEric Joyner  * @reg: device register to write to
16396f37f232SEric Joyner  * @val: value to write
16406f37f232SEric Joyner  *
16416f37f232SEric Joyner  * Returns an error code on error.
16426f37f232SEric Joyner  **/
ixgbe_write_link_unlocked(struct ixgbe_hw * hw,u8 addr,u16 reg,u16 val)16438eb6488eSEric Joyner s32 ixgbe_write_link_unlocked(struct ixgbe_hw *hw, u8 addr, u16 reg, u16 val)
16446f37f232SEric Joyner {
16458eb6488eSEric Joyner 	return ixgbe_call_func(hw, hw->link.ops.write_link_unlocked,
16466f37f232SEric Joyner 			       (hw, addr, reg, val), IXGBE_NOT_IMPLEMENTED);
16476f37f232SEric Joyner }
16486f37f232SEric Joyner 
16496f37f232SEric Joyner /**
16500ac6dfecSJack F Vogel  * ixgbe_write_i2c_eeprom - Writes 8 bit EEPROM word over I2C interface
16510ac6dfecSJack F Vogel  * @hw: pointer to hardware structure
16520ac6dfecSJack F Vogel  * @byte_offset: EEPROM byte offset to write
16530ac6dfecSJack F Vogel  * @eeprom_data: value to write
16540ac6dfecSJack F Vogel  *
16550ac6dfecSJack F Vogel  * Performs byte write operation to SFP module's EEPROM over I2C interface.
16560ac6dfecSJack F Vogel  **/
ixgbe_write_i2c_eeprom(struct ixgbe_hw * hw,u8 byte_offset,u8 eeprom_data)16570ac6dfecSJack F Vogel s32 ixgbe_write_i2c_eeprom(struct ixgbe_hw *hw,
16580ac6dfecSJack F Vogel 			   u8 byte_offset, u8 eeprom_data)
16590ac6dfecSJack F Vogel {
16600ac6dfecSJack F Vogel 	return ixgbe_call_func(hw, hw->phy.ops.write_i2c_eeprom,
16610ac6dfecSJack F Vogel 			       (hw, byte_offset, eeprom_data),
16620ac6dfecSJack F Vogel 			       IXGBE_NOT_IMPLEMENTED);
16630ac6dfecSJack F Vogel }
16640ac6dfecSJack F Vogel 
16650ac6dfecSJack F Vogel /**
16661b6e0dbaSJack F Vogel  * ixgbe_read_i2c_eeprom - Reads 8 bit EEPROM word over I2C interface
16671b6e0dbaSJack F Vogel  * @hw: pointer to hardware structure
16681b6e0dbaSJack F Vogel  * @byte_offset: EEPROM byte offset to read
16691b6e0dbaSJack F Vogel  * @eeprom_data: value read
16701b6e0dbaSJack F Vogel  *
16711b6e0dbaSJack F Vogel  * Performs byte read operation to SFP module's EEPROM over I2C interface.
16721b6e0dbaSJack F Vogel  **/
ixgbe_read_i2c_eeprom(struct ixgbe_hw * hw,u8 byte_offset,u8 * eeprom_data)16731b6e0dbaSJack F Vogel s32 ixgbe_read_i2c_eeprom(struct ixgbe_hw *hw, u8 byte_offset, u8 *eeprom_data)
16741b6e0dbaSJack F Vogel {
16751b6e0dbaSJack F Vogel 	return ixgbe_call_func(hw, hw->phy.ops.read_i2c_eeprom,
16761b6e0dbaSJack F Vogel 			      (hw, byte_offset, eeprom_data),
16771b6e0dbaSJack F Vogel 			      IXGBE_NOT_IMPLEMENTED);
16781b6e0dbaSJack F Vogel }
16791b6e0dbaSJack F Vogel 
16801b6e0dbaSJack F Vogel /**
16811b6e0dbaSJack F Vogel  * ixgbe_get_supported_physical_layer - Returns physical layer type
16821b6e0dbaSJack F Vogel  * @hw: pointer to hardware structure
16831b6e0dbaSJack F Vogel  *
16841b6e0dbaSJack F Vogel  * Determines physical layer capabilities of the current configuration.
16851b6e0dbaSJack F Vogel  **/
ixgbe_get_supported_physical_layer(struct ixgbe_hw * hw)16868eb6488eSEric Joyner u64 ixgbe_get_supported_physical_layer(struct ixgbe_hw *hw)
16871b6e0dbaSJack F Vogel {
16881b6e0dbaSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.get_supported_physical_layer,
16891b6e0dbaSJack F Vogel 			       (hw), IXGBE_PHYSICAL_LAYER_UNKNOWN);
16901b6e0dbaSJack F Vogel }
16910ac6dfecSJack F Vogel 
16920ac6dfecSJack F Vogel /**
1693a621e3c8SJack F Vogel  * ixgbe_enable_rx_dma - Enables Rx DMA unit, dependent on device specifics
16940ac6dfecSJack F Vogel  * @hw: pointer to hardware structure
16950ac6dfecSJack F Vogel  * @regval: bitfield to write to the Rx DMA register
16960ac6dfecSJack F Vogel  *
16970ac6dfecSJack F Vogel  * Enables the Rx DMA unit of the device.
16980ac6dfecSJack F Vogel  **/
ixgbe_enable_rx_dma(struct ixgbe_hw * hw,u32 regval)16990ac6dfecSJack F Vogel s32 ixgbe_enable_rx_dma(struct ixgbe_hw *hw, u32 regval)
17000ac6dfecSJack F Vogel {
17010ac6dfecSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.enable_rx_dma,
17020ac6dfecSJack F Vogel 			       (hw, regval), IXGBE_NOT_IMPLEMENTED);
17030ac6dfecSJack F Vogel }
1704d8602bb9SJack F Vogel 
1705d8602bb9SJack F Vogel /**
170685d0a26eSJack F Vogel  * ixgbe_disable_sec_rx_path - Stops the receive data path
170785d0a26eSJack F Vogel  * @hw: pointer to hardware structure
170885d0a26eSJack F Vogel  *
170985d0a26eSJack F Vogel  * Stops the receive data path.
171085d0a26eSJack F Vogel  **/
ixgbe_disable_sec_rx_path(struct ixgbe_hw * hw)171185d0a26eSJack F Vogel s32 ixgbe_disable_sec_rx_path(struct ixgbe_hw *hw)
171285d0a26eSJack F Vogel {
171385d0a26eSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.disable_sec_rx_path,
171485d0a26eSJack F Vogel 				(hw), IXGBE_NOT_IMPLEMENTED);
171585d0a26eSJack F Vogel }
171685d0a26eSJack F Vogel 
171785d0a26eSJack F Vogel /**
171885d0a26eSJack F Vogel  * ixgbe_enable_sec_rx_path - Enables the receive data path
171985d0a26eSJack F Vogel  * @hw: pointer to hardware structure
172085d0a26eSJack F Vogel  *
172185d0a26eSJack F Vogel  * Enables the receive data path.
172285d0a26eSJack F Vogel  **/
ixgbe_enable_sec_rx_path(struct ixgbe_hw * hw)172385d0a26eSJack F Vogel s32 ixgbe_enable_sec_rx_path(struct ixgbe_hw *hw)
172485d0a26eSJack F Vogel {
172585d0a26eSJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.enable_sec_rx_path,
172685d0a26eSJack F Vogel 				(hw), IXGBE_NOT_IMPLEMENTED);
172785d0a26eSJack F Vogel }
172885d0a26eSJack F Vogel 
172985d0a26eSJack F Vogel /**
1730d8602bb9SJack F Vogel  * ixgbe_acquire_swfw_semaphore - Acquire SWFW semaphore
1731d8602bb9SJack F Vogel  * @hw: pointer to hardware structure
1732d8602bb9SJack F Vogel  * @mask: Mask to specify which semaphore to acquire
1733d8602bb9SJack F Vogel  *
1734d8602bb9SJack F Vogel  * Acquires the SWFW semaphore through SW_FW_SYNC register for the specified
1735d8602bb9SJack F Vogel  * function (CSR, PHY0, PHY1, EEPROM, Flash)
1736d8602bb9SJack F Vogel  **/
ixgbe_acquire_swfw_semaphore(struct ixgbe_hw * hw,u32 mask)1737758cc3dcSJack F Vogel s32 ixgbe_acquire_swfw_semaphore(struct ixgbe_hw *hw, u32 mask)
1738d8602bb9SJack F Vogel {
1739d8602bb9SJack F Vogel 	return ixgbe_call_func(hw, hw->mac.ops.acquire_swfw_sync,
1740d8602bb9SJack F Vogel 			       (hw, mask), IXGBE_NOT_IMPLEMENTED);
1741d8602bb9SJack F Vogel }
1742d8602bb9SJack F Vogel 
1743d8602bb9SJack F Vogel /**
1744d8602bb9SJack F Vogel  * ixgbe_release_swfw_semaphore - Release SWFW semaphore
1745d8602bb9SJack F Vogel  * @hw: pointer to hardware structure
1746d8602bb9SJack F Vogel  * @mask: Mask to specify which semaphore to release
1747d8602bb9SJack F Vogel  *
1748d8602bb9SJack F Vogel  * Releases the SWFW semaphore through SW_FW_SYNC register for the specified
1749d8602bb9SJack F Vogel  * function (CSR, PHY0, PHY1, EEPROM, Flash)
1750d8602bb9SJack F Vogel  **/
ixgbe_release_swfw_semaphore(struct ixgbe_hw * hw,u32 mask)1751758cc3dcSJack F Vogel void ixgbe_release_swfw_semaphore(struct ixgbe_hw *hw, u32 mask)
1752d8602bb9SJack F Vogel {
1753d8602bb9SJack F Vogel 	if (hw->mac.ops.release_swfw_sync)
1754d8602bb9SJack F Vogel 		hw->mac.ops.release_swfw_sync(hw, mask);
1755d8602bb9SJack F Vogel }
1756d8602bb9SJack F Vogel 
17578eb6488eSEric Joyner /**
17588eb6488eSEric Joyner  * ixgbe_init_swfw_semaphore - Clean up SWFW semaphore
17598eb6488eSEric Joyner  * @hw: pointer to hardware structure
17608eb6488eSEric Joyner  *
17618eb6488eSEric Joyner  * Attempts to acquire the SWFW semaphore through SW_FW_SYNC register.
17628eb6488eSEric Joyner  * Regardless of whether is succeeds or not it then release the semaphore.
17638eb6488eSEric Joyner  * This is function is called to recover from catastrophic failures that
17648eb6488eSEric Joyner  * may have left the semaphore locked.
17658eb6488eSEric Joyner  **/
ixgbe_init_swfw_semaphore(struct ixgbe_hw * hw)17668eb6488eSEric Joyner void ixgbe_init_swfw_semaphore(struct ixgbe_hw *hw)
17678eb6488eSEric Joyner {
17688eb6488eSEric Joyner 	if (hw->mac.ops.init_swfw_sync)
17698eb6488eSEric Joyner 		hw->mac.ops.init_swfw_sync(hw);
17708eb6488eSEric Joyner }
17718eb6488eSEric Joyner 
1772758cc3dcSJack F Vogel 
ixgbe_disable_rx(struct ixgbe_hw * hw)1773758cc3dcSJack F Vogel void ixgbe_disable_rx(struct ixgbe_hw *hw)
1774758cc3dcSJack F Vogel {
1775758cc3dcSJack F Vogel 	if (hw->mac.ops.disable_rx)
1776758cc3dcSJack F Vogel 		hw->mac.ops.disable_rx(hw);
1777758cc3dcSJack F Vogel }
1778758cc3dcSJack F Vogel 
ixgbe_enable_rx(struct ixgbe_hw * hw)1779758cc3dcSJack F Vogel void ixgbe_enable_rx(struct ixgbe_hw *hw)
1780758cc3dcSJack F Vogel {
1781758cc3dcSJack F Vogel 	if (hw->mac.ops.enable_rx)
1782758cc3dcSJack F Vogel 		hw->mac.ops.enable_rx(hw);
1783758cc3dcSJack F Vogel }
1784758cc3dcSJack F Vogel 
1785758cc3dcSJack F Vogel /**
1786758cc3dcSJack F Vogel  * ixgbe_set_rate_select_speed - Set module link speed
1787758cc3dcSJack F Vogel  * @hw: pointer to hardware structure
1788758cc3dcSJack F Vogel  * @speed: link speed to set
1789758cc3dcSJack F Vogel  *
1790758cc3dcSJack F Vogel  * Set module link speed via the rate select.
1791758cc3dcSJack F Vogel  */
ixgbe_set_rate_select_speed(struct ixgbe_hw * hw,ixgbe_link_speed speed)1792758cc3dcSJack F Vogel void ixgbe_set_rate_select_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed)
1793758cc3dcSJack F Vogel {
1794758cc3dcSJack F Vogel 	if (hw->mac.ops.set_rate_select_speed)
1795758cc3dcSJack F Vogel 		hw->mac.ops.set_rate_select_speed(hw, speed);
1796758cc3dcSJack F Vogel }
1797