Home | History | Annotate | Line # | Download | only in ixgbe
ixgbe_api.c revision 1.26
      1  1.26   msaitoh /* $NetBSD: ixgbe_api.c,v 1.26 2021/12/10 11:31:22 msaitoh Exp $ */
      2  1.17   msaitoh 
      3   1.1    dyoung /******************************************************************************
      4  1.18   msaitoh   SPDX-License-Identifier: BSD-3-Clause
      5   1.1    dyoung 
      6  1.17   msaitoh   Copyright (c) 2001-2017, Intel Corporation
      7   1.1    dyoung   All rights reserved.
      8  1.17   msaitoh 
      9  1.17   msaitoh   Redistribution and use in source and binary forms, with or without
     10   1.1    dyoung   modification, are permitted provided that the following conditions are met:
     11  1.17   msaitoh 
     12  1.17   msaitoh    1. Redistributions of source code must retain the above copyright notice,
     13   1.1    dyoung       this list of conditions and the following disclaimer.
     14  1.17   msaitoh 
     15  1.17   msaitoh    2. Redistributions in binary form must reproduce the above copyright
     16  1.17   msaitoh       notice, this list of conditions and the following disclaimer in the
     17   1.1    dyoung       documentation and/or other materials provided with the distribution.
     18  1.17   msaitoh 
     19  1.17   msaitoh    3. Neither the name of the Intel Corporation nor the names of its
     20  1.17   msaitoh       contributors may be used to endorse or promote products derived from
     21   1.1    dyoung       this software without specific prior written permission.
     22  1.17   msaitoh 
     23   1.1    dyoung   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     24  1.17   msaitoh   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     25  1.17   msaitoh   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     26  1.17   msaitoh   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
     27  1.17   msaitoh   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     28  1.17   msaitoh   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     29  1.17   msaitoh   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     30  1.17   msaitoh   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     31  1.17   msaitoh   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     32   1.1    dyoung   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     33   1.1    dyoung   POSSIBILITY OF SUCH DAMAGE.
     34   1.1    dyoung 
     35   1.1    dyoung ******************************************************************************/
     36  1.20   msaitoh /*$FreeBSD: head/sys/dev/ixgbe/ixgbe_api.c 331224 2018-03-19 20:55:05Z erj $*/
     37   1.1    dyoung 
     38  1.25   msaitoh #include <sys/cdefs.h>
     39  1.26   msaitoh __KERNEL_RCSID(0, "$NetBSD: ixgbe_api.c,v 1.26 2021/12/10 11:31:22 msaitoh Exp $");
     40  1.25   msaitoh 
     41   1.1    dyoung #include "ixgbe_api.h"
     42   1.1    dyoung #include "ixgbe_common.h"
     43   1.1    dyoung 
     44  1.16   msaitoh #define IXGBE_EMPTY_PARAM
     45  1.16   msaitoh 
     46  1.13   msaitoh static const u32 ixgbe_mvals_base[IXGBE_MVALS_IDX_LIMIT] = {
     47  1.16   msaitoh 	IXGBE_MVALS_INIT(IXGBE_EMPTY_PARAM)
     48  1.13   msaitoh };
     49  1.13   msaitoh 
     50  1.13   msaitoh static const u32 ixgbe_mvals_X540[IXGBE_MVALS_IDX_LIMIT] = {
     51  1.13   msaitoh 	IXGBE_MVALS_INIT(_X540)
     52  1.13   msaitoh };
     53  1.13   msaitoh 
     54  1.13   msaitoh static const u32 ixgbe_mvals_X550[IXGBE_MVALS_IDX_LIMIT] = {
     55  1.13   msaitoh 	IXGBE_MVALS_INIT(_X550)
     56  1.13   msaitoh };
     57  1.13   msaitoh 
     58  1.13   msaitoh static const u32 ixgbe_mvals_X550EM_x[IXGBE_MVALS_IDX_LIMIT] = {
     59  1.13   msaitoh 	IXGBE_MVALS_INIT(_X550EM_x)
     60  1.13   msaitoh };
     61  1.13   msaitoh 
     62  1.17   msaitoh static const u32 ixgbe_mvals_X550EM_a[IXGBE_MVALS_IDX_LIMIT] = {
     63  1.17   msaitoh 	IXGBE_MVALS_INIT(_X550EM_a)
     64  1.17   msaitoh };
     65  1.17   msaitoh 
     66   1.1    dyoung /**
     67   1.8   msaitoh  * ixgbe_dcb_get_rtrup2tc - read rtrup2tc reg
     68   1.8   msaitoh  * @hw: pointer to hardware structure
     69   1.8   msaitoh  * @map: pointer to u8 arr for returning map
     70   1.8   msaitoh  *
     71   1.8   msaitoh  * Read the rtrup2tc HW register and resolve its content into map
     72   1.8   msaitoh  **/
     73   1.8   msaitoh void ixgbe_dcb_get_rtrup2tc(struct ixgbe_hw *hw, u8 *map)
     74   1.8   msaitoh {
     75   1.8   msaitoh 	if (hw->mac.ops.get_rtrup2tc)
     76   1.8   msaitoh 		hw->mac.ops.get_rtrup2tc(hw, map);
     77   1.8   msaitoh }
     78   1.8   msaitoh 
     79   1.8   msaitoh /**
     80  1.26   msaitoh  * ixgbe_init_shared_code - Initialize the shared code
     81  1.26   msaitoh  * @hw: pointer to hardware structure
     82   1.1    dyoung  *
     83  1.26   msaitoh  * This will assign function pointers and assign the MAC type and PHY code.
     84  1.26   msaitoh  * Does not touch the hardware. This function must be called prior to any
     85  1.26   msaitoh  * other function in the shared code. The ixgbe_hw structure should be
     86  1.26   msaitoh  * memset to 0 prior to calling this function.  The following fields in
     87  1.26   msaitoh  * hw structure should be filled in prior to calling this function:
     88  1.26   msaitoh  * back, device_id, vendor_id, subsystem_device_id,
     89  1.26   msaitoh  * subsystem_vendor_id, and revision_id
     90   1.1    dyoung  **/
     91   1.1    dyoung s32 ixgbe_init_shared_code(struct ixgbe_hw *hw)
     92   1.1    dyoung {
     93   1.1    dyoung 	s32 status;
     94   1.1    dyoung 
     95   1.1    dyoung 	DEBUGFUNC("ixgbe_init_shared_code");
     96   1.1    dyoung 
     97   1.1    dyoung 	/*
     98   1.1    dyoung 	 * Set the mac type
     99   1.1    dyoung 	 */
    100   1.1    dyoung 	ixgbe_set_mac_type(hw);
    101   1.1    dyoung 
    102   1.1    dyoung 	switch (hw->mac.type) {
    103   1.1    dyoung 	case ixgbe_mac_82598EB:
    104   1.1    dyoung 		status = ixgbe_init_ops_82598(hw);
    105   1.1    dyoung 		break;
    106   1.1    dyoung 	case ixgbe_mac_82599EB:
    107   1.1    dyoung 		status = ixgbe_init_ops_82599(hw);
    108   1.1    dyoung 		break;
    109  1.12   msaitoh 	case ixgbe_mac_X540:
    110  1.12   msaitoh 		status = ixgbe_init_ops_X540(hw);
    111  1.12   msaitoh 		break;
    112  1.12   msaitoh 	case ixgbe_mac_X550:
    113  1.12   msaitoh 		status = ixgbe_init_ops_X550(hw);
    114  1.12   msaitoh 		break;
    115  1.12   msaitoh 	case ixgbe_mac_X550EM_x:
    116  1.17   msaitoh 		status = ixgbe_init_ops_X550EM_x(hw);
    117  1.12   msaitoh 		break;
    118  1.17   msaitoh 	case ixgbe_mac_X550EM_a:
    119  1.17   msaitoh 		status = ixgbe_init_ops_X550EM_a(hw);
    120   1.1    dyoung 		break;
    121   1.1    dyoung 	default:
    122   1.1    dyoung 		status = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
    123   1.1    dyoung 		break;
    124   1.1    dyoung 	}
    125  1.14   msaitoh 	hw->mac.max_link_up_time = IXGBE_LINK_UP_TIME;
    126   1.1    dyoung 
    127   1.1    dyoung 	return status;
    128   1.1    dyoung }
    129   1.1    dyoung 
    130   1.1    dyoung /**
    131  1.26   msaitoh  * ixgbe_set_mac_type - Sets MAC type
    132  1.26   msaitoh  * @hw: pointer to the HW structure
    133   1.1    dyoung  *
    134  1.26   msaitoh  * This function sets the mac type of the adapter based on the
    135  1.26   msaitoh  * vendor ID and device ID stored in the hw structure.
    136   1.1    dyoung  **/
    137   1.1    dyoung s32 ixgbe_set_mac_type(struct ixgbe_hw *hw)
    138   1.1    dyoung {
    139   1.1    dyoung 	s32 ret_val = IXGBE_SUCCESS;
    140   1.1    dyoung 
    141   1.1    dyoung 	DEBUGFUNC("ixgbe_set_mac_type\n");
    142   1.1    dyoung 
    143   1.8   msaitoh 	if (hw->vendor_id != IXGBE_INTEL_VENDOR_ID) {
    144   1.8   msaitoh 		ERROR_REPORT2(IXGBE_ERROR_UNSUPPORTED,
    145   1.8   msaitoh 			     "Unsupported vendor id: %x", hw->vendor_id);
    146   1.8   msaitoh 		return IXGBE_ERR_DEVICE_NOT_SUPPORTED;
    147   1.8   msaitoh 	}
    148   1.8   msaitoh 
    149  1.13   msaitoh 	hw->mvals = ixgbe_mvals_base;
    150  1.13   msaitoh 
    151   1.7   msaitoh 	switch (hw->device_id) {
    152   1.7   msaitoh 	case IXGBE_DEV_ID_82598:
    153   1.7   msaitoh 	case IXGBE_DEV_ID_82598_BX:
    154   1.7   msaitoh 	case IXGBE_DEV_ID_82598AF_SINGLE_PORT:
    155   1.7   msaitoh 	case IXGBE_DEV_ID_82598AF_DUAL_PORT:
    156   1.7   msaitoh 	case IXGBE_DEV_ID_82598AT:
    157   1.7   msaitoh 	case IXGBE_DEV_ID_82598AT2:
    158   1.7   msaitoh 	case IXGBE_DEV_ID_82598EB_CX4:
    159   1.7   msaitoh 	case IXGBE_DEV_ID_82598_CX4_DUAL_PORT:
    160   1.7   msaitoh 	case IXGBE_DEV_ID_82598_DA_DUAL_PORT:
    161   1.7   msaitoh 	case IXGBE_DEV_ID_82598_SR_DUAL_PORT_EM:
    162   1.7   msaitoh 	case IXGBE_DEV_ID_82598EB_XF_LR:
    163   1.7   msaitoh 	case IXGBE_DEV_ID_82598EB_SFP_LOM:
    164   1.7   msaitoh 		hw->mac.type = ixgbe_mac_82598EB;
    165   1.7   msaitoh 		break;
    166   1.7   msaitoh 	case IXGBE_DEV_ID_82599_KX4:
    167   1.7   msaitoh 	case IXGBE_DEV_ID_82599_KX4_MEZZ:
    168   1.7   msaitoh 	case IXGBE_DEV_ID_82599_XAUI_LOM:
    169   1.7   msaitoh 	case IXGBE_DEV_ID_82599_COMBO_BACKPLANE:
    170   1.7   msaitoh 	case IXGBE_DEV_ID_82599_KR:
    171   1.7   msaitoh 	case IXGBE_DEV_ID_82599_SFP:
    172   1.7   msaitoh 	case IXGBE_DEV_ID_82599_BACKPLANE_FCOE:
    173   1.7   msaitoh 	case IXGBE_DEV_ID_82599_SFP_FCOE:
    174   1.7   msaitoh 	case IXGBE_DEV_ID_82599_SFP_EM:
    175   1.7   msaitoh 	case IXGBE_DEV_ID_82599_SFP_SF2:
    176   1.7   msaitoh 	case IXGBE_DEV_ID_82599_SFP_SF_QP:
    177  1.12   msaitoh 	case IXGBE_DEV_ID_82599_QSFP_SF_QP:
    178   1.7   msaitoh 	case IXGBE_DEV_ID_82599EN_SFP:
    179   1.7   msaitoh 	case IXGBE_DEV_ID_82599_CX4:
    180   1.7   msaitoh 	case IXGBE_DEV_ID_82599_BYPASS:
    181   1.7   msaitoh 	case IXGBE_DEV_ID_82599_T3_LOM:
    182   1.7   msaitoh 		hw->mac.type = ixgbe_mac_82599EB;
    183   1.7   msaitoh 		break;
    184   1.7   msaitoh 	case IXGBE_DEV_ID_X540T:
    185  1.12   msaitoh 	case IXGBE_DEV_ID_X540T1:
    186   1.7   msaitoh 	case IXGBE_DEV_ID_X540_BYPASS:
    187   1.7   msaitoh 		hw->mac.type = ixgbe_mac_X540;
    188  1.13   msaitoh 		hw->mvals = ixgbe_mvals_X540;
    189   1.7   msaitoh 		break;
    190  1.12   msaitoh 	case IXGBE_DEV_ID_X550T:
    191  1.14   msaitoh 	case IXGBE_DEV_ID_X550T1:
    192  1.12   msaitoh 		hw->mac.type = ixgbe_mac_X550;
    193  1.13   msaitoh 		hw->mvals = ixgbe_mvals_X550;
    194  1.12   msaitoh 		break;
    195  1.12   msaitoh 	case IXGBE_DEV_ID_X550EM_X_KX4:
    196  1.12   msaitoh 	case IXGBE_DEV_ID_X550EM_X_KR:
    197  1.12   msaitoh 	case IXGBE_DEV_ID_X550EM_X_10G_T:
    198  1.12   msaitoh 	case IXGBE_DEV_ID_X550EM_X_1G_T:
    199  1.12   msaitoh 	case IXGBE_DEV_ID_X550EM_X_SFP:
    200  1.17   msaitoh 	case IXGBE_DEV_ID_X550EM_X_XFI:
    201  1.12   msaitoh 		hw->mac.type = ixgbe_mac_X550EM_x;
    202  1.13   msaitoh 		hw->mvals = ixgbe_mvals_X550EM_x;
    203  1.12   msaitoh 		break;
    204  1.17   msaitoh 	case IXGBE_DEV_ID_X550EM_A_KR:
    205  1.17   msaitoh 	case IXGBE_DEV_ID_X550EM_A_KR_L:
    206  1.17   msaitoh 	case IXGBE_DEV_ID_X550EM_A_SFP_N:
    207  1.17   msaitoh 	case IXGBE_DEV_ID_X550EM_A_SGMII:
    208  1.17   msaitoh 	case IXGBE_DEV_ID_X550EM_A_SGMII_L:
    209  1.17   msaitoh 	case IXGBE_DEV_ID_X550EM_A_1G_T:
    210  1.17   msaitoh 	case IXGBE_DEV_ID_X550EM_A_1G_T_L:
    211  1.17   msaitoh 	case IXGBE_DEV_ID_X550EM_A_10G_T:
    212  1.17   msaitoh 	case IXGBE_DEV_ID_X550EM_A_QSFP:
    213  1.17   msaitoh 	case IXGBE_DEV_ID_X550EM_A_QSFP_N:
    214  1.17   msaitoh 	case IXGBE_DEV_ID_X550EM_A_SFP:
    215  1.17   msaitoh 		hw->mac.type = ixgbe_mac_X550EM_a;
    216  1.17   msaitoh 		hw->mvals = ixgbe_mvals_X550EM_a;
    217  1.12   msaitoh 		break;
    218   1.7   msaitoh 	default:
    219   1.8   msaitoh 		ret_val = IXGBE_ERR_DEVICE_NOT_SUPPORTED;
    220   1.8   msaitoh 		ERROR_REPORT2(IXGBE_ERROR_UNSUPPORTED,
    221   1.8   msaitoh 			     "Unsupported device id: %x",
    222   1.8   msaitoh 			     hw->device_id);
    223   1.7   msaitoh 		break;
    224   1.9   msaitoh 	}
    225   1.1    dyoung 
    226   1.1    dyoung 	DEBUGOUT2("ixgbe_set_mac_type found mac: %d, returns: %d\n",
    227   1.5   msaitoh 		  hw->mac.type, ret_val);
    228   1.1    dyoung 	return ret_val;
    229   1.1    dyoung }
    230   1.1    dyoung 
    231   1.1    dyoung /**
    232  1.26   msaitoh  * ixgbe_init_hw - Initialize the hardware
    233  1.26   msaitoh  * @hw: pointer to hardware structure
    234   1.1    dyoung  *
    235  1.26   msaitoh  * Initialize the hardware by resetting and then starting the hardware
    236   1.1    dyoung  **/
    237   1.1    dyoung s32 ixgbe_init_hw(struct ixgbe_hw *hw)
    238   1.1    dyoung {
    239   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.init_hw, (hw),
    240   1.5   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
    241   1.1    dyoung }
    242   1.1    dyoung 
    243   1.1    dyoung /**
    244  1.26   msaitoh  * ixgbe_reset_hw - Performs a hardware reset
    245  1.26   msaitoh  * @hw: pointer to hardware structure
    246   1.1    dyoung  *
    247  1.26   msaitoh  * Resets the hardware by resetting the transmit and receive units, masks and
    248  1.26   msaitoh  * clears all interrupts, performs a PHY reset, and performs a MAC reset
    249   1.1    dyoung  **/
    250   1.1    dyoung s32 ixgbe_reset_hw(struct ixgbe_hw *hw)
    251   1.1    dyoung {
    252   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.reset_hw, (hw),
    253   1.5   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
    254   1.1    dyoung }
    255   1.1    dyoung 
    256   1.1    dyoung /**
    257  1.26   msaitoh  * ixgbe_start_hw - Prepares hardware for Rx/Tx
    258  1.26   msaitoh  * @hw: pointer to hardware structure
    259   1.1    dyoung  *
    260  1.26   msaitoh  * Starts the hardware by filling the bus info structure and media type,
    261  1.26   msaitoh  * clears all on chip counters, initializes receive address registers,
    262  1.26   msaitoh  * multicast table, VLAN filter table, calls routine to setup link and
    263  1.26   msaitoh  * flow control settings, and leaves transmit and receive units disabled
    264  1.26   msaitoh  * and uninitialized.
    265   1.1    dyoung  **/
    266   1.1    dyoung s32 ixgbe_start_hw(struct ixgbe_hw *hw)
    267   1.1    dyoung {
    268   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.start_hw, (hw),
    269   1.5   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
    270   1.1    dyoung }
    271   1.1    dyoung 
    272   1.1    dyoung /**
    273  1.26   msaitoh  * ixgbe_enable_relaxed_ordering - Enables tx relaxed ordering,
    274  1.26   msaitoh  * which is disabled by default in ixgbe_start_hw();
    275   1.1    dyoung  *
    276  1.26   msaitoh  * @hw: pointer to hardware structure
    277   1.1    dyoung  *
    278  1.26   msaitoh  *  Enable relaxed ordering;
    279   1.1    dyoung  **/
    280   1.1    dyoung void ixgbe_enable_relaxed_ordering(struct ixgbe_hw *hw)
    281   1.1    dyoung {
    282   1.1    dyoung 	if (hw->mac.ops.enable_relaxed_ordering)
    283   1.1    dyoung 		hw->mac.ops.enable_relaxed_ordering(hw);
    284   1.1    dyoung }
    285   1.1    dyoung 
    286   1.1    dyoung /**
    287  1.26   msaitoh  * ixgbe_clear_hw_cntrs - Clear hardware counters
    288  1.26   msaitoh  * @hw: pointer to hardware structure
    289   1.1    dyoung  *
    290  1.26   msaitoh  * Clears all hardware statistics counters by reading them from the hardware
    291  1.26   msaitoh  * Statistics counters are clear on read.
    292   1.1    dyoung  **/
    293   1.1    dyoung s32 ixgbe_clear_hw_cntrs(struct ixgbe_hw *hw)
    294   1.1    dyoung {
    295   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.clear_hw_cntrs, (hw),
    296   1.5   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
    297   1.1    dyoung }
    298   1.1    dyoung 
    299   1.1    dyoung /**
    300  1.26   msaitoh  * ixgbe_get_media_type - Get media type
    301  1.26   msaitoh  * @hw: pointer to hardware structure
    302   1.1    dyoung  *
    303  1.26   msaitoh  * Returns the media type (fiber, copper, backplane)
    304   1.1    dyoung  **/
    305   1.1    dyoung enum ixgbe_media_type ixgbe_get_media_type(struct ixgbe_hw *hw)
    306   1.1    dyoung {
    307   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.get_media_type, (hw),
    308   1.5   msaitoh 			       ixgbe_media_type_unknown);
    309   1.1    dyoung }
    310   1.1    dyoung 
    311   1.1    dyoung /**
    312  1.26   msaitoh  * ixgbe_get_mac_addr - Get MAC address
    313  1.26   msaitoh  * @hw: pointer to hardware structure
    314  1.26   msaitoh  * @mac_addr: Adapter MAC address
    315  1.26   msaitoh  *
    316  1.26   msaitoh  * Reads the adapter's MAC address from the first Receive Address Register
    317  1.26   msaitoh  * (RAR0) A reset of the adapter must have been performed prior to calling
    318  1.26   msaitoh  * this function in order for the MAC address to have been loaded from the
    319  1.26   msaitoh  * EEPROM into RAR0
    320   1.1    dyoung  **/
    321   1.1    dyoung s32 ixgbe_get_mac_addr(struct ixgbe_hw *hw, u8 *mac_addr)
    322   1.1    dyoung {
    323   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.get_mac_addr,
    324   1.5   msaitoh 			       (hw, mac_addr), IXGBE_NOT_IMPLEMENTED);
    325   1.1    dyoung }
    326   1.1    dyoung 
    327   1.1    dyoung /**
    328  1.26   msaitoh  * ixgbe_get_san_mac_addr - Get SAN MAC address
    329  1.26   msaitoh  * @hw: pointer to hardware structure
    330  1.26   msaitoh  * @san_mac_addr: SAN MAC address
    331   1.1    dyoung  *
    332  1.26   msaitoh  * Reads the SAN MAC address from the EEPROM, if it's available.  This is
    333  1.26   msaitoh  * per-port, so set_lan_id() must be called before reading the addresses.
    334   1.1    dyoung  **/
    335   1.1    dyoung s32 ixgbe_get_san_mac_addr(struct ixgbe_hw *hw, u8 *san_mac_addr)
    336   1.1    dyoung {
    337   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.get_san_mac_addr,
    338   1.5   msaitoh 			       (hw, san_mac_addr), IXGBE_NOT_IMPLEMENTED);
    339   1.1    dyoung }
    340   1.1    dyoung 
    341   1.1    dyoung /**
    342  1.26   msaitoh  * ixgbe_set_san_mac_addr - Write a SAN MAC address
    343  1.26   msaitoh  * @hw: pointer to hardware structure
    344  1.26   msaitoh  * @san_mac_addr: SAN MAC address
    345   1.1    dyoung  *
    346  1.26   msaitoh  * Writes A SAN MAC address to the EEPROM.
    347   1.1    dyoung  **/
    348   1.1    dyoung s32 ixgbe_set_san_mac_addr(struct ixgbe_hw *hw, u8 *san_mac_addr)
    349   1.1    dyoung {
    350   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.set_san_mac_addr,
    351   1.5   msaitoh 			       (hw, san_mac_addr), IXGBE_NOT_IMPLEMENTED);
    352   1.1    dyoung }
    353   1.1    dyoung 
    354   1.1    dyoung /**
    355  1.26   msaitoh  * ixgbe_get_device_caps - Get additional device capabilities
    356  1.26   msaitoh  * @hw: pointer to hardware structure
    357  1.26   msaitoh  * @device_caps: the EEPROM word for device capabilities
    358   1.1    dyoung  *
    359  1.26   msaitoh  * Reads the extra device capabilities from the EEPROM
    360   1.1    dyoung  **/
    361   1.1    dyoung s32 ixgbe_get_device_caps(struct ixgbe_hw *hw, u16 *device_caps)
    362   1.1    dyoung {
    363   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.get_device_caps,
    364   1.5   msaitoh 			       (hw, device_caps), IXGBE_NOT_IMPLEMENTED);
    365   1.1    dyoung }
    366   1.1    dyoung 
    367   1.1    dyoung /**
    368  1.26   msaitoh  * ixgbe_get_wwn_prefix - Get alternative WWNN/WWPN prefix from the EEPROM
    369  1.26   msaitoh  * @hw: pointer to hardware structure
    370  1.26   msaitoh  * @wwnn_prefix: the alternative WWNN prefix
    371  1.26   msaitoh  * @wwpn_prefix: the alternative WWPN prefix
    372   1.1    dyoung  *
    373  1.26   msaitoh  * This function will read the EEPROM from the alternative SAN MAC address
    374  1.26   msaitoh  * block to check the support for the alternative WWNN/WWPN prefix support.
    375   1.1    dyoung  **/
    376   1.1    dyoung s32 ixgbe_get_wwn_prefix(struct ixgbe_hw *hw, u16 *wwnn_prefix,
    377   1.5   msaitoh 			 u16 *wwpn_prefix)
    378   1.1    dyoung {
    379   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.get_wwn_prefix,
    380   1.5   msaitoh 			       (hw, wwnn_prefix, wwpn_prefix),
    381   1.5   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
    382   1.1    dyoung }
    383   1.1    dyoung 
    384   1.1    dyoung /**
    385  1.26   msaitoh  * ixgbe_get_fcoe_boot_status -  Get FCOE boot status from EEPROM
    386  1.26   msaitoh  * @hw: pointer to hardware structure
    387  1.26   msaitoh  * @bs: the fcoe boot status
    388   1.1    dyoung  *
    389  1.26   msaitoh  * This function will read the FCOE boot status from the iSCSI FCOE block
    390   1.1    dyoung  **/
    391   1.1    dyoung s32 ixgbe_get_fcoe_boot_status(struct ixgbe_hw *hw, u16 *bs)
    392   1.1    dyoung {
    393   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.get_fcoe_boot_status,
    394   1.5   msaitoh 			       (hw, bs),
    395   1.5   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
    396   1.1    dyoung }
    397   1.1    dyoung 
    398   1.1    dyoung /**
    399  1.26   msaitoh  * ixgbe_get_bus_info - Set PCI bus info
    400  1.26   msaitoh  * @hw: pointer to hardware structure
    401   1.1    dyoung  *
    402  1.26   msaitoh  * Sets the PCI bus info (speed, width, type) within the ixgbe_hw structure
    403   1.1    dyoung  **/
    404   1.1    dyoung s32 ixgbe_get_bus_info(struct ixgbe_hw *hw)
    405   1.1    dyoung {
    406   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.get_bus_info, (hw),
    407   1.5   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
    408   1.1    dyoung }
    409   1.1    dyoung 
    410   1.1    dyoung /**
    411  1.26   msaitoh  * ixgbe_get_num_of_tx_queues - Get Tx queues
    412  1.26   msaitoh  * @hw: pointer to hardware structure
    413   1.1    dyoung  *
    414  1.26   msaitoh  * Returns the number of transmit queues for the given adapter.
    415   1.1    dyoung  **/
    416   1.1    dyoung u32 ixgbe_get_num_of_tx_queues(struct ixgbe_hw *hw)
    417   1.1    dyoung {
    418   1.1    dyoung 	return hw->mac.max_tx_queues;
    419   1.1    dyoung }
    420   1.1    dyoung 
    421   1.1    dyoung /**
    422  1.26   msaitoh  * ixgbe_get_num_of_rx_queues - Get Rx queues
    423  1.26   msaitoh  * @hw: pointer to hardware structure
    424   1.1    dyoung  *
    425  1.26   msaitoh  * Returns the number of receive queues for the given adapter.
    426   1.1    dyoung  **/
    427   1.1    dyoung u32 ixgbe_get_num_of_rx_queues(struct ixgbe_hw *hw)
    428   1.1    dyoung {
    429   1.1    dyoung 	return hw->mac.max_rx_queues;
    430   1.1    dyoung }
    431   1.1    dyoung 
    432   1.1    dyoung /**
    433  1.26   msaitoh  * ixgbe_stop_adapter - Disable Rx/Tx units
    434  1.26   msaitoh  * @hw: pointer to hardware structure
    435   1.1    dyoung  *
    436  1.26   msaitoh  * Sets the adapter_stopped flag within ixgbe_hw struct. Clears interrupts,
    437  1.26   msaitoh  * disables transmit and receive units. The adapter_stopped flag is used by
    438  1.26   msaitoh  * the shared code and drivers to determine if the adapter is in a stopped
    439  1.26   msaitoh  * state and should not touch the hardware.
    440   1.1    dyoung  **/
    441   1.1    dyoung s32 ixgbe_stop_adapter(struct ixgbe_hw *hw)
    442   1.1    dyoung {
    443   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.stop_adapter, (hw),
    444   1.5   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
    445   1.1    dyoung }
    446   1.1    dyoung 
    447   1.1    dyoung /**
    448  1.26   msaitoh  * ixgbe_read_pba_string - Reads part number string from EEPROM
    449  1.26   msaitoh  * @hw: pointer to hardware structure
    450  1.26   msaitoh  * @pba_num: stores the part number string from the EEPROM
    451  1.26   msaitoh  * @pba_num_size: part number string buffer length
    452   1.1    dyoung  *
    453  1.26   msaitoh  * Reads the part number string from the EEPROM.
    454   1.1    dyoung  **/
    455   1.1    dyoung s32 ixgbe_read_pba_string(struct ixgbe_hw *hw, u8 *pba_num, u32 pba_num_size)
    456   1.1    dyoung {
    457   1.1    dyoung 	return ixgbe_read_pba_string_generic(hw, pba_num, pba_num_size);
    458   1.1    dyoung }
    459   1.1    dyoung 
    460   1.1    dyoung /**
    461  1.26   msaitoh  * ixgbe_read_pba_num - Reads part number from EEPROM
    462  1.26   msaitoh  * @hw: pointer to hardware structure
    463  1.26   msaitoh  * @pba_num: stores the part number from the EEPROM
    464   1.1    dyoung  *
    465  1.26   msaitoh  * Reads the part number from the EEPROM.
    466   1.1    dyoung  **/
    467   1.1    dyoung s32 ixgbe_read_pba_num(struct ixgbe_hw *hw, u32 *pba_num)
    468   1.1    dyoung {
    469   1.1    dyoung 	return ixgbe_read_pba_num_generic(hw, pba_num);
    470   1.1    dyoung }
    471   1.1    dyoung 
    472   1.1    dyoung /**
    473  1.26   msaitoh  * ixgbe_identify_phy - Get PHY type
    474  1.26   msaitoh  * @hw: pointer to hardware structure
    475   1.1    dyoung  *
    476  1.26   msaitoh  * Determines the physical layer module found on the current adapter.
    477   1.1    dyoung  **/
    478   1.1    dyoung s32 ixgbe_identify_phy(struct ixgbe_hw *hw)
    479   1.1    dyoung {
    480   1.1    dyoung 	s32 status = IXGBE_SUCCESS;
    481   1.1    dyoung 
    482   1.1    dyoung 	if (hw->phy.type == ixgbe_phy_unknown) {
    483   1.1    dyoung 		status = ixgbe_call_func(hw, hw->phy.ops.identify, (hw),
    484   1.5   msaitoh 					 IXGBE_NOT_IMPLEMENTED);
    485   1.1    dyoung 	}
    486   1.1    dyoung 
    487   1.1    dyoung 	return status;
    488   1.1    dyoung }
    489   1.1    dyoung 
    490   1.1    dyoung /**
    491  1.26   msaitoh  * ixgbe_reset_phy - Perform a PHY reset
    492  1.26   msaitoh  * @hw: pointer to hardware structure
    493   1.1    dyoung  **/
    494   1.1    dyoung s32 ixgbe_reset_phy(struct ixgbe_hw *hw)
    495   1.1    dyoung {
    496   1.1    dyoung 	s32 status = IXGBE_SUCCESS;
    497   1.1    dyoung 
    498   1.1    dyoung 	if (hw->phy.type == ixgbe_phy_unknown) {
    499   1.1    dyoung 		if (ixgbe_identify_phy(hw) != IXGBE_SUCCESS)
    500   1.1    dyoung 			status = IXGBE_ERR_PHY;
    501   1.1    dyoung 	}
    502   1.1    dyoung 
    503   1.1    dyoung 	if (status == IXGBE_SUCCESS) {
    504   1.1    dyoung 		status = ixgbe_call_func(hw, hw->phy.ops.reset, (hw),
    505   1.5   msaitoh 					 IXGBE_NOT_IMPLEMENTED);
    506   1.1    dyoung 	}
    507   1.1    dyoung 	return status;
    508   1.1    dyoung }
    509   1.1    dyoung 
    510   1.1    dyoung /**
    511  1.26   msaitoh  * ixgbe_get_phy_firmware_version -
    512  1.26   msaitoh  * @hw: pointer to hardware structure
    513  1.26   msaitoh  * @firmware_version: pointer to firmware version
    514   1.1    dyoung  **/
    515   1.1    dyoung s32 ixgbe_get_phy_firmware_version(struct ixgbe_hw *hw, u16 *firmware_version)
    516   1.1    dyoung {
    517   1.1    dyoung 	s32 status = IXGBE_SUCCESS;
    518   1.1    dyoung 
    519   1.1    dyoung 	status = ixgbe_call_func(hw, hw->phy.ops.get_firmware_version,
    520   1.5   msaitoh 				 (hw, firmware_version),
    521   1.5   msaitoh 				 IXGBE_NOT_IMPLEMENTED);
    522   1.1    dyoung 	return status;
    523   1.1    dyoung }
    524   1.1    dyoung 
    525   1.1    dyoung /**
    526  1.26   msaitoh  * ixgbe_read_phy_reg - Read PHY register
    527  1.26   msaitoh  * @hw: pointer to hardware structure
    528  1.26   msaitoh  * @reg_addr: 32 bit address of PHY register to read
    529  1.26   msaitoh  * @device_type: type of device you want to communicate with
    530  1.26   msaitoh  * @phy_data: Pointer to read data from PHY register
    531   1.1    dyoung  *
    532  1.26   msaitoh  * Reads a value from a specified PHY register
    533   1.1    dyoung  **/
    534   1.1    dyoung s32 ixgbe_read_phy_reg(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type,
    535   1.5   msaitoh 		       u16 *phy_data)
    536   1.1    dyoung {
    537   1.1    dyoung 	if (hw->phy.id == 0)
    538   1.1    dyoung 		ixgbe_identify_phy(hw);
    539   1.1    dyoung 
    540   1.1    dyoung 	return ixgbe_call_func(hw, hw->phy.ops.read_reg, (hw, reg_addr,
    541   1.5   msaitoh 			       device_type, phy_data), IXGBE_NOT_IMPLEMENTED);
    542   1.1    dyoung }
    543   1.1    dyoung 
    544   1.1    dyoung /**
    545  1.26   msaitoh  * ixgbe_write_phy_reg - Write PHY register
    546  1.26   msaitoh  * @hw: pointer to hardware structure
    547  1.26   msaitoh  * @reg_addr: 32 bit PHY register to write
    548  1.26   msaitoh  * @device_type: type of device you want to communicate with
    549  1.26   msaitoh  * @phy_data: Data to write to the PHY register
    550   1.1    dyoung  *
    551  1.26   msaitoh  * Writes a value to specified PHY register
    552   1.1    dyoung  **/
    553   1.1    dyoung s32 ixgbe_write_phy_reg(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type,
    554   1.5   msaitoh 			u16 phy_data)
    555   1.1    dyoung {
    556   1.1    dyoung 	if (hw->phy.id == 0)
    557   1.1    dyoung 		ixgbe_identify_phy(hw);
    558   1.1    dyoung 
    559   1.1    dyoung 	return ixgbe_call_func(hw, hw->phy.ops.write_reg, (hw, reg_addr,
    560   1.5   msaitoh 			       device_type, phy_data), IXGBE_NOT_IMPLEMENTED);
    561   1.1    dyoung }
    562   1.1    dyoung 
    563   1.1    dyoung /**
    564  1.26   msaitoh  * ixgbe_setup_phy_link - Restart PHY autoneg
    565  1.26   msaitoh  * @hw: pointer to hardware structure
    566   1.1    dyoung  *
    567  1.26   msaitoh  * Restart autonegotiation and PHY and waits for completion.
    568   1.1    dyoung  **/
    569   1.1    dyoung s32 ixgbe_setup_phy_link(struct ixgbe_hw *hw)
    570   1.1    dyoung {
    571   1.1    dyoung 	return ixgbe_call_func(hw, hw->phy.ops.setup_link, (hw),
    572   1.5   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
    573   1.1    dyoung }
    574   1.1    dyoung 
    575   1.1    dyoung /**
    576  1.12   msaitoh  * ixgbe_setup_internal_phy - Configure integrated PHY
    577  1.12   msaitoh  * @hw: pointer to hardware structure
    578  1.12   msaitoh  *
    579  1.12   msaitoh  * Reconfigure the integrated PHY in order to enable talk to the external PHY.
    580  1.12   msaitoh  * Returns success if not implemented, since nothing needs to be done in this
    581  1.12   msaitoh  * case.
    582  1.12   msaitoh  */
    583  1.12   msaitoh s32 ixgbe_setup_internal_phy(struct ixgbe_hw *hw)
    584  1.12   msaitoh {
    585  1.12   msaitoh 	return ixgbe_call_func(hw, hw->phy.ops.setup_internal_link, (hw),
    586  1.12   msaitoh 			       IXGBE_SUCCESS);
    587  1.12   msaitoh }
    588  1.12   msaitoh 
    589  1.12   msaitoh /**
    590  1.26   msaitoh  * ixgbe_check_phy_link - Determine link and speed status
    591  1.26   msaitoh  * @hw: pointer to hardware structure
    592  1.26   msaitoh  * @speed: link speed
    593  1.26   msaitoh  * @link_up: TRUE when link is up
    594   1.1    dyoung  *
    595  1.26   msaitoh  * Reads a PHY register to determine if link is up and the current speed for
    596  1.26   msaitoh  * the PHY.
    597   1.1    dyoung  **/
    598   1.1    dyoung s32 ixgbe_check_phy_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
    599   1.5   msaitoh 			 bool *link_up)
    600   1.1    dyoung {
    601   1.1    dyoung 	return ixgbe_call_func(hw, hw->phy.ops.check_link, (hw, speed,
    602   1.5   msaitoh 			       link_up), IXGBE_NOT_IMPLEMENTED);
    603   1.1    dyoung }
    604   1.1    dyoung 
    605   1.1    dyoung /**
    606  1.26   msaitoh  * ixgbe_setup_phy_link_speed - Set auto advertise
    607  1.26   msaitoh  * @hw: pointer to hardware structure
    608  1.26   msaitoh  * @speed: new link speed
    609  1.26   msaitoh  * @autoneg_wait_to_complete: TRUE when waiting for completion is needed
    610   1.1    dyoung  *
    611  1.26   msaitoh  * Sets the auto advertised capabilities
    612   1.1    dyoung  **/
    613   1.1    dyoung s32 ixgbe_setup_phy_link_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed,
    614   1.5   msaitoh 			       bool autoneg_wait_to_complete)
    615   1.1    dyoung {
    616   1.1    dyoung 	return ixgbe_call_func(hw, hw->phy.ops.setup_link_speed, (hw, speed,
    617   1.7   msaitoh 			       autoneg_wait_to_complete),
    618   1.5   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
    619   1.1    dyoung }
    620   1.1    dyoung 
    621   1.1    dyoung /**
    622  1.12   msaitoh  * ixgbe_set_phy_power - Control the phy power state
    623  1.12   msaitoh  * @hw: pointer to hardware structure
    624  1.12   msaitoh  * @on: TRUE for on, FALSE for off
    625  1.12   msaitoh  */
    626  1.12   msaitoh s32 ixgbe_set_phy_power(struct ixgbe_hw *hw, bool on)
    627  1.12   msaitoh {
    628  1.12   msaitoh 	return ixgbe_call_func(hw, hw->phy.ops.set_phy_power, (hw, on),
    629  1.12   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
    630  1.12   msaitoh }
    631  1.12   msaitoh 
    632  1.12   msaitoh /**
    633  1.26   msaitoh  * ixgbe_check_link - Get link and speed status
    634  1.26   msaitoh  * @hw: pointer to hardware structure
    635  1.26   msaitoh  * @speed: pointer to link speed
    636  1.26   msaitoh  * @link_up: TRUE when link is up
    637  1.26   msaitoh  * @link_up_wait_to_complete: bool used to wait for link up or not
    638   1.1    dyoung  *
    639  1.26   msaitoh  * Reads the links register to determine if link is up and the current speed
    640   1.1    dyoung  **/
    641   1.1    dyoung s32 ixgbe_check_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
    642   1.5   msaitoh 		     bool *link_up, bool link_up_wait_to_complete)
    643   1.1    dyoung {
    644   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.check_link, (hw, speed,
    645   1.5   msaitoh 			       link_up, link_up_wait_to_complete),
    646   1.5   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
    647   1.1    dyoung }
    648   1.1    dyoung 
    649   1.1    dyoung /**
    650  1.26   msaitoh  * ixgbe_disable_tx_laser - Disable Tx laser
    651  1.26   msaitoh  * @hw: pointer to hardware structure
    652   1.1    dyoung  *
    653  1.26   msaitoh  * If the driver needs to disable the laser on SFI optics.
    654   1.1    dyoung  **/
    655   1.1    dyoung void ixgbe_disable_tx_laser(struct ixgbe_hw *hw)
    656   1.1    dyoung {
    657   1.1    dyoung 	if (hw->mac.ops.disable_tx_laser)
    658   1.1    dyoung 		hw->mac.ops.disable_tx_laser(hw);
    659   1.1    dyoung }
    660   1.1    dyoung 
    661   1.1    dyoung /**
    662  1.26   msaitoh  * ixgbe_enable_tx_laser - Enable Tx laser
    663  1.26   msaitoh  * @hw: pointer to hardware structure
    664   1.1    dyoung  *
    665  1.26   msaitoh  * If the driver needs to enable the laser on SFI optics.
    666   1.1    dyoung  **/
    667   1.1    dyoung void ixgbe_enable_tx_laser(struct ixgbe_hw *hw)
    668   1.1    dyoung {
    669   1.1    dyoung 	if (hw->mac.ops.enable_tx_laser)
    670   1.1    dyoung 		hw->mac.ops.enable_tx_laser(hw);
    671   1.1    dyoung }
    672   1.1    dyoung 
    673   1.1    dyoung /**
    674  1.26   msaitoh  * ixgbe_flap_tx_laser - flap Tx laser to start autotry process
    675  1.26   msaitoh  * @hw: pointer to hardware structure
    676   1.1    dyoung  *
    677  1.26   msaitoh  * When the driver changes the link speeds that it can support then
    678  1.26   msaitoh  * flap the tx laser to alert the link partner to start autotry
    679  1.26   msaitoh  * process on its end.
    680   1.1    dyoung  **/
    681   1.1    dyoung void ixgbe_flap_tx_laser(struct ixgbe_hw *hw)
    682   1.1    dyoung {
    683   1.1    dyoung 	if (hw->mac.ops.flap_tx_laser)
    684   1.1    dyoung 		hw->mac.ops.flap_tx_laser(hw);
    685   1.1    dyoung }
    686   1.1    dyoung 
    687   1.1    dyoung /**
    688  1.26   msaitoh  * ixgbe_setup_link - Set link speed
    689  1.26   msaitoh  * @hw: pointer to hardware structure
    690  1.26   msaitoh  * @speed: new link speed
    691  1.26   msaitoh  * @autoneg_wait_to_complete: TRUE when waiting for completion is needed
    692   1.1    dyoung  *
    693  1.26   msaitoh  * Configures link settings.  Restarts the link.
    694  1.26   msaitoh  * Performs autonegotiation if needed.
    695   1.1    dyoung  **/
    696   1.1    dyoung s32 ixgbe_setup_link(struct ixgbe_hw *hw, ixgbe_link_speed speed,
    697   1.5   msaitoh 		     bool autoneg_wait_to_complete)
    698   1.1    dyoung {
    699   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.setup_link, (hw, speed,
    700   1.7   msaitoh 			       autoneg_wait_to_complete),
    701   1.5   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
    702   1.1    dyoung }
    703   1.1    dyoung 
    704   1.1    dyoung /**
    705  1.26   msaitoh  * ixgbe_setup_mac_link - Set link speed
    706  1.26   msaitoh  * @hw: pointer to hardware structure
    707  1.26   msaitoh  * @speed: new link speed
    708  1.26   msaitoh  * @autoneg_wait_to_complete: TRUE when waiting for completion is needed
    709  1.12   msaitoh  *
    710  1.26   msaitoh  * Configures link settings.  Restarts the link.
    711  1.26   msaitoh  * Performs autonegotiation if needed.
    712  1.12   msaitoh  **/
    713  1.12   msaitoh s32 ixgbe_setup_mac_link(struct ixgbe_hw *hw, ixgbe_link_speed speed,
    714  1.12   msaitoh 			 bool autoneg_wait_to_complete)
    715  1.12   msaitoh {
    716  1.12   msaitoh 	return ixgbe_call_func(hw, hw->mac.ops.setup_mac_link, (hw, speed,
    717  1.12   msaitoh 			       autoneg_wait_to_complete),
    718  1.12   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
    719  1.12   msaitoh }
    720  1.12   msaitoh 
    721  1.12   msaitoh /**
    722  1.26   msaitoh  * ixgbe_get_link_capabilities - Returns link capabilities
    723  1.26   msaitoh  * @hw: pointer to hardware structure
    724  1.26   msaitoh  * @speed: link speed capabilities
    725  1.26   msaitoh  * @autoneg: TRUE when autoneg or autotry is enabled
    726   1.1    dyoung  *
    727  1.26   msaitoh  * Determines the link capabilities of the current configuration.
    728   1.1    dyoung  **/
    729   1.1    dyoung s32 ixgbe_get_link_capabilities(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
    730   1.5   msaitoh 				bool *autoneg)
    731   1.1    dyoung {
    732   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.get_link_capabilities, (hw,
    733   1.5   msaitoh 			       speed, autoneg), IXGBE_NOT_IMPLEMENTED);
    734   1.1    dyoung }
    735   1.1    dyoung 
    736   1.1    dyoung /**
    737  1.26   msaitoh  * ixgbe_led_on - Turn on LEDs
    738  1.26   msaitoh  * @hw: pointer to hardware structure
    739  1.26   msaitoh  * @index: led number to turn on
    740   1.1    dyoung  *
    741  1.26   msaitoh  * Turns on the software controllable LEDs.
    742   1.1    dyoung  **/
    743   1.1    dyoung s32 ixgbe_led_on(struct ixgbe_hw *hw, u32 index)
    744   1.1    dyoung {
    745   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.led_on, (hw, index),
    746   1.5   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
    747   1.1    dyoung }
    748   1.1    dyoung 
    749   1.1    dyoung /**
    750  1.26   msaitoh  * ixgbe_led_off - Turn off LEDs
    751  1.26   msaitoh  * @hw: pointer to hardware structure
    752  1.26   msaitoh  * @index: led number to turn off
    753   1.1    dyoung  *
    754  1.26   msaitoh  * Turns off the software controllable LEDs.
    755   1.1    dyoung  **/
    756   1.1    dyoung s32 ixgbe_led_off(struct ixgbe_hw *hw, u32 index)
    757   1.1    dyoung {
    758   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.led_off, (hw, index),
    759   1.5   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
    760   1.1    dyoung }
    761   1.1    dyoung 
    762   1.1    dyoung /**
    763  1.26   msaitoh  * ixgbe_blink_led_start - Blink LEDs
    764  1.26   msaitoh  * @hw: pointer to hardware structure
    765  1.26   msaitoh  * @index: led number to blink
    766   1.1    dyoung  *
    767  1.26   msaitoh  * Blink LED based on index.
    768   1.1    dyoung  **/
    769   1.1    dyoung s32 ixgbe_blink_led_start(struct ixgbe_hw *hw, u32 index)
    770   1.1    dyoung {
    771   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.blink_led_start, (hw, index),
    772   1.5   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
    773   1.1    dyoung }
    774   1.1    dyoung 
    775   1.1    dyoung /**
    776  1.26   msaitoh  * ixgbe_blink_led_stop - Stop blinking LEDs
    777  1.26   msaitoh  * @hw: pointer to hardware structure
    778  1.26   msaitoh  * @index: led number to stop
    779   1.1    dyoung  *
    780  1.26   msaitoh  * Stop blinking LED based on index.
    781   1.1    dyoung  **/
    782   1.1    dyoung s32 ixgbe_blink_led_stop(struct ixgbe_hw *hw, u32 index)
    783   1.1    dyoung {
    784   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.blink_led_stop, (hw, index),
    785   1.5   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
    786   1.1    dyoung }
    787   1.1    dyoung 
    788   1.1    dyoung /**
    789  1.26   msaitoh  * ixgbe_init_eeprom_params - Initialize EEPROM parameters
    790  1.26   msaitoh  * @hw: pointer to hardware structure
    791   1.1    dyoung  *
    792  1.26   msaitoh  * Initializes the EEPROM parameters ixgbe_eeprom_info within the
    793  1.26   msaitoh  * ixgbe_hw struct in order to set up EEPROM access.
    794   1.1    dyoung  **/
    795   1.1    dyoung s32 ixgbe_init_eeprom_params(struct ixgbe_hw *hw)
    796   1.1    dyoung {
    797   1.1    dyoung 	return ixgbe_call_func(hw, hw->eeprom.ops.init_params, (hw),
    798   1.5   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
    799   1.1    dyoung }
    800   1.1    dyoung 
    801   1.1    dyoung 
    802   1.1    dyoung /**
    803  1.26   msaitoh  * ixgbe_write_eeprom - Write word to EEPROM
    804  1.26   msaitoh  * @hw: pointer to hardware structure
    805  1.26   msaitoh  * @offset: offset within the EEPROM to be written to
    806  1.26   msaitoh  * @data: 16 bit word to be written to the EEPROM
    807  1.26   msaitoh  *
    808  1.26   msaitoh  * Writes 16 bit value to EEPROM. If ixgbe_eeprom_update_checksum is not
    809  1.26   msaitoh  * called after this function, the EEPROM will most likely contain an
    810  1.26   msaitoh  * invalid checksum.
    811   1.1    dyoung  **/
    812   1.1    dyoung s32 ixgbe_write_eeprom(struct ixgbe_hw *hw, u16 offset, u16 data)
    813   1.1    dyoung {
    814   1.1    dyoung 	return ixgbe_call_func(hw, hw->eeprom.ops.write, (hw, offset, data),
    815   1.5   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
    816   1.5   msaitoh }
    817   1.5   msaitoh 
    818   1.5   msaitoh /**
    819  1.26   msaitoh  * ixgbe_write_eeprom_buffer - Write word(s) to EEPROM
    820  1.26   msaitoh  * @hw: pointer to hardware structure
    821  1.26   msaitoh  * @offset: offset within the EEPROM to be written to
    822  1.26   msaitoh  * @data: 16 bit word(s) to be written to the EEPROM
    823  1.26   msaitoh  * @words: number of words
    824  1.26   msaitoh  *
    825  1.26   msaitoh  * Writes 16 bit word(s) to EEPROM. If ixgbe_eeprom_update_checksum is not
    826  1.26   msaitoh  * called after this function, the EEPROM will most likely contain an
    827  1.26   msaitoh  * invalid checksum.
    828   1.5   msaitoh  **/
    829   1.5   msaitoh s32 ixgbe_write_eeprom_buffer(struct ixgbe_hw *hw, u16 offset, u16 words,
    830   1.5   msaitoh 			      u16 *data)
    831   1.5   msaitoh {
    832   1.5   msaitoh 	return ixgbe_call_func(hw, hw->eeprom.ops.write_buffer,
    833   1.5   msaitoh 			       (hw, offset, words, data),
    834   1.5   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
    835   1.1    dyoung }
    836   1.1    dyoung 
    837   1.1    dyoung /**
    838  1.26   msaitoh  * ixgbe_read_eeprom - Read word from EEPROM
    839  1.26   msaitoh  * @hw: pointer to hardware structure
    840  1.26   msaitoh  * @offset: offset within the EEPROM to be read
    841  1.26   msaitoh  * @data: read 16 bit value from EEPROM
    842   1.1    dyoung  *
    843  1.26   msaitoh  * Reads 16 bit value from EEPROM
    844   1.1    dyoung  **/
    845   1.1    dyoung s32 ixgbe_read_eeprom(struct ixgbe_hw *hw, u16 offset, u16 *data)
    846   1.1    dyoung {
    847   1.1    dyoung 	return ixgbe_call_func(hw, hw->eeprom.ops.read, (hw, offset, data),
    848   1.5   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
    849   1.5   msaitoh }
    850   1.5   msaitoh 
    851   1.5   msaitoh /**
    852  1.26   msaitoh  * ixgbe_read_eeprom_buffer - Read word(s) from EEPROM
    853  1.26   msaitoh  * @hw: pointer to hardware structure
    854  1.26   msaitoh  * @offset: offset within the EEPROM to be read
    855  1.26   msaitoh  * @data: read 16 bit word(s) from EEPROM
    856  1.26   msaitoh  * @words: number of words
    857   1.5   msaitoh  *
    858  1.26   msaitoh  * Reads 16 bit word(s) from EEPROM
    859   1.5   msaitoh  **/
    860   1.5   msaitoh s32 ixgbe_read_eeprom_buffer(struct ixgbe_hw *hw, u16 offset,
    861   1.5   msaitoh 			     u16 words, u16 *data)
    862   1.5   msaitoh {
    863   1.5   msaitoh 	return ixgbe_call_func(hw, hw->eeprom.ops.read_buffer,
    864   1.5   msaitoh 			       (hw, offset, words, data),
    865   1.5   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
    866   1.1    dyoung }
    867   1.1    dyoung 
    868   1.1    dyoung /**
    869  1.26   msaitoh  * ixgbe_validate_eeprom_checksum - Validate EEPROM checksum
    870  1.26   msaitoh  * @hw: pointer to hardware structure
    871  1.26   msaitoh  * @checksum_val: calculated checksum
    872   1.1    dyoung  *
    873  1.26   msaitoh  * Performs checksum calculation and validates the EEPROM checksum
    874   1.1    dyoung  **/
    875   1.1    dyoung s32 ixgbe_validate_eeprom_checksum(struct ixgbe_hw *hw, u16 *checksum_val)
    876   1.1    dyoung {
    877   1.1    dyoung 	return ixgbe_call_func(hw, hw->eeprom.ops.validate_checksum,
    878   1.5   msaitoh 			       (hw, checksum_val), IXGBE_NOT_IMPLEMENTED);
    879   1.1    dyoung }
    880   1.1    dyoung 
    881   1.1    dyoung /**
    882  1.26   msaitoh  * ixgbe_eeprom_update_checksum - Updates the EEPROM checksum
    883  1.26   msaitoh  * @hw: pointer to hardware structure
    884   1.1    dyoung  **/
    885   1.1    dyoung s32 ixgbe_update_eeprom_checksum(struct ixgbe_hw *hw)
    886   1.1    dyoung {
    887   1.1    dyoung 	return ixgbe_call_func(hw, hw->eeprom.ops.update_checksum, (hw),
    888   1.5   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
    889   1.1    dyoung }
    890   1.1    dyoung 
    891   1.1    dyoung /**
    892  1.26   msaitoh  * ixgbe_insert_mac_addr - Find a RAR for this mac address
    893  1.26   msaitoh  * @hw: pointer to hardware structure
    894  1.26   msaitoh  * @addr: Address to put into receive address register
    895  1.26   msaitoh  * @vmdq: VMDq pool to assign
    896   1.1    dyoung  *
    897  1.26   msaitoh  * Puts an ethernet address into a receive address register, or
    898  1.26   msaitoh  * finds the rar that it is already in; adds to the pool list
    899   1.1    dyoung  **/
    900   1.1    dyoung s32 ixgbe_insert_mac_addr(struct ixgbe_hw *hw, u8 *addr, u32 vmdq)
    901   1.1    dyoung {
    902   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.insert_mac_addr,
    903   1.5   msaitoh 			       (hw, addr, vmdq),
    904   1.1    dyoung 			       IXGBE_NOT_IMPLEMENTED);
    905   1.1    dyoung }
    906   1.1    dyoung 
    907   1.1    dyoung /**
    908  1.26   msaitoh  * ixgbe_set_rar - Set Rx address register
    909  1.26   msaitoh  * @hw: pointer to hardware structure
    910  1.26   msaitoh  * @index: Receive address register to write
    911  1.26   msaitoh  * @addr: Address to put into receive address register
    912  1.26   msaitoh  * @vmdq: VMDq "set"
    913  1.26   msaitoh  * @enable_addr: set flag that address is active
    914   1.1    dyoung  *
    915  1.26   msaitoh  * Puts an ethernet address into a receive address register.
    916   1.1    dyoung  **/
    917   1.1    dyoung s32 ixgbe_set_rar(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq,
    918   1.5   msaitoh 		  u32 enable_addr)
    919   1.1    dyoung {
    920   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.set_rar, (hw, index, addr, vmdq,
    921   1.5   msaitoh 			       enable_addr), IXGBE_NOT_IMPLEMENTED);
    922   1.1    dyoung }
    923   1.1    dyoung 
    924   1.1    dyoung /**
    925  1.26   msaitoh  * ixgbe_clear_rar - Clear Rx address register
    926  1.26   msaitoh  * @hw: pointer to hardware structure
    927  1.26   msaitoh  * @index: Receive address register to write
    928   1.1    dyoung  *
    929  1.26   msaitoh  * Puts an ethernet address into a receive address register.
    930   1.1    dyoung  **/
    931   1.1    dyoung s32 ixgbe_clear_rar(struct ixgbe_hw *hw, u32 index)
    932   1.1    dyoung {
    933   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.clear_rar, (hw, index),
    934   1.5   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
    935   1.1    dyoung }
    936   1.1    dyoung 
    937   1.1    dyoung /**
    938  1.26   msaitoh  * ixgbe_set_vmdq - Associate a VMDq index with a receive address
    939  1.26   msaitoh  * @hw: pointer to hardware structure
    940  1.26   msaitoh  * @rar: receive address register index to associate with VMDq index
    941  1.26   msaitoh  * @vmdq: VMDq set or pool index
    942   1.1    dyoung  **/
    943   1.1    dyoung s32 ixgbe_set_vmdq(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
    944   1.1    dyoung {
    945   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.set_vmdq, (hw, rar, vmdq),
    946   1.5   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
    947   1.6   msaitoh 
    948   1.6   msaitoh }
    949   1.6   msaitoh 
    950   1.6   msaitoh /**
    951  1.26   msaitoh  * ixgbe_set_vmdq_san_mac - Associate VMDq index 127 with a receive address
    952  1.26   msaitoh  * @hw: pointer to hardware structure
    953  1.26   msaitoh  * @vmdq: VMDq default pool index
    954   1.6   msaitoh  **/
    955   1.6   msaitoh s32 ixgbe_set_vmdq_san_mac(struct ixgbe_hw *hw, u32 vmdq)
    956   1.6   msaitoh {
    957   1.6   msaitoh 	return ixgbe_call_func(hw, hw->mac.ops.set_vmdq_san_mac,
    958   1.6   msaitoh 			       (hw, vmdq), IXGBE_NOT_IMPLEMENTED);
    959   1.1    dyoung }
    960   1.1    dyoung 
    961   1.1    dyoung /**
    962  1.26   msaitoh  * ixgbe_clear_vmdq - Disassociate a VMDq index from a receive address
    963  1.26   msaitoh  * @hw: pointer to hardware structure
    964  1.26   msaitoh  * @rar: receive address register index to disassociate with VMDq index
    965  1.26   msaitoh  * @vmdq: VMDq set or pool index
    966   1.1    dyoung  **/
    967   1.1    dyoung s32 ixgbe_clear_vmdq(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
    968   1.1    dyoung {
    969   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.clear_vmdq, (hw, rar, vmdq),
    970   1.5   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
    971   1.1    dyoung }
    972   1.1    dyoung 
    973   1.1    dyoung /**
    974  1.26   msaitoh  * ixgbe_init_rx_addrs - Initializes receive address filters.
    975  1.26   msaitoh  * @hw: pointer to hardware structure
    976   1.1    dyoung  *
    977  1.26   msaitoh  * Places the MAC address in receive address register 0 and clears the rest
    978  1.26   msaitoh  * of the receive address registers. Clears the multicast table. Assumes
    979  1.26   msaitoh  * the receiver is in reset when the routine is called.
    980   1.1    dyoung  **/
    981   1.1    dyoung s32 ixgbe_init_rx_addrs(struct ixgbe_hw *hw)
    982   1.1    dyoung {
    983   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.init_rx_addrs, (hw),
    984   1.5   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
    985   1.1    dyoung }
    986   1.1    dyoung 
    987   1.1    dyoung /**
    988  1.26   msaitoh  * ixgbe_get_num_rx_addrs - Returns the number of RAR entries.
    989  1.26   msaitoh  * @hw: pointer to hardware structure
    990   1.1    dyoung  **/
    991   1.1    dyoung u32 ixgbe_get_num_rx_addrs(struct ixgbe_hw *hw)
    992   1.1    dyoung {
    993   1.1    dyoung 	return hw->mac.num_rar_entries;
    994   1.1    dyoung }
    995   1.1    dyoung 
    996   1.1    dyoung /**
    997  1.26   msaitoh  * ixgbe_update_uc_addr_list - Updates the MAC's list of secondary addresses
    998  1.26   msaitoh  * @hw: pointer to hardware structure
    999  1.26   msaitoh  * @addr_list: the list of new multicast addresses
   1000  1.26   msaitoh  * @addr_count: number of addresses
   1001  1.26   msaitoh  * @func: iterator function to walk the multicast address list
   1002  1.26   msaitoh  *
   1003  1.26   msaitoh  * The given list replaces any existing list. Clears the secondary addrs from
   1004  1.26   msaitoh  * receive address registers. Uses unused receive address registers for the
   1005  1.26   msaitoh  * first secondary addresses, and falls back to promiscuous mode as needed.
   1006   1.1    dyoung  **/
   1007   1.1    dyoung s32 ixgbe_update_uc_addr_list(struct ixgbe_hw *hw, u8 *addr_list,
   1008   1.5   msaitoh 			      u32 addr_count, ixgbe_mc_addr_itr func)
   1009   1.1    dyoung {
   1010   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.update_uc_addr_list, (hw,
   1011   1.5   msaitoh 			       addr_list, addr_count, func),
   1012   1.5   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
   1013   1.1    dyoung }
   1014   1.1    dyoung 
   1015   1.1    dyoung /**
   1016  1.26   msaitoh  * ixgbe_update_mc_addr_list - Updates the MAC's list of multicast addresses
   1017  1.26   msaitoh  * @hw: pointer to hardware structure
   1018  1.26   msaitoh  * @mc_addr_list: the list of new multicast addresses
   1019  1.26   msaitoh  * @mc_addr_count: number of addresses
   1020  1.26   msaitoh  * @func: iterator function to walk the multicast address list
   1021  1.26   msaitoh  * @clear: flag, when set clears the table beforehand
   1022  1.26   msaitoh  *
   1023  1.26   msaitoh  * The given list replaces any existing list. Clears the MC addrs from receive
   1024  1.26   msaitoh  * address registers and the multicast table. Uses unused receive address
   1025  1.26   msaitoh  * registers for the first multicast addresses, and hashes the rest into the
   1026  1.26   msaitoh  * multicast table.
   1027   1.1    dyoung  **/
   1028   1.1    dyoung s32 ixgbe_update_mc_addr_list(struct ixgbe_hw *hw, u8 *mc_addr_list,
   1029   1.5   msaitoh 			      u32 mc_addr_count, ixgbe_mc_addr_itr func,
   1030   1.5   msaitoh 			      bool clear)
   1031   1.1    dyoung {
   1032   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.update_mc_addr_list, (hw,
   1033   1.5   msaitoh 			       mc_addr_list, mc_addr_count, func, clear),
   1034   1.5   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
   1035   1.1    dyoung }
   1036   1.1    dyoung 
   1037   1.1    dyoung /**
   1038  1.26   msaitoh  * ixgbe_enable_mc - Enable multicast address in RAR
   1039  1.26   msaitoh  * @hw: pointer to hardware structure
   1040   1.1    dyoung  *
   1041  1.26   msaitoh  * Enables multicast address in RAR and the use of the multicast hash table.
   1042   1.1    dyoung  **/
   1043   1.1    dyoung s32 ixgbe_enable_mc(struct ixgbe_hw *hw)
   1044   1.1    dyoung {
   1045   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.enable_mc, (hw),
   1046   1.5   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
   1047   1.1    dyoung }
   1048   1.1    dyoung 
   1049   1.1    dyoung /**
   1050  1.26   msaitoh  * ixgbe_disable_mc - Disable multicast address in RAR
   1051  1.26   msaitoh  * @hw: pointer to hardware structure
   1052   1.1    dyoung  *
   1053  1.26   msaitoh  * Disables multicast address in RAR and the use of the multicast hash table.
   1054   1.1    dyoung  **/
   1055   1.1    dyoung s32 ixgbe_disable_mc(struct ixgbe_hw *hw)
   1056   1.1    dyoung {
   1057   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.disable_mc, (hw),
   1058   1.5   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
   1059   1.1    dyoung }
   1060   1.1    dyoung 
   1061   1.1    dyoung /**
   1062  1.26   msaitoh  * ixgbe_clear_vfta - Clear VLAN filter table
   1063  1.26   msaitoh  * @hw: pointer to hardware structure
   1064   1.1    dyoung  *
   1065  1.26   msaitoh  * Clears the VLAN filer table, and the VMDq index associated with the filter
   1066   1.1    dyoung  **/
   1067   1.1    dyoung s32 ixgbe_clear_vfta(struct ixgbe_hw *hw)
   1068   1.1    dyoung {
   1069   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.clear_vfta, (hw),
   1070   1.5   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
   1071   1.1    dyoung }
   1072   1.1    dyoung 
   1073   1.1    dyoung /**
   1074  1.26   msaitoh  * ixgbe_set_vfta - Set VLAN filter table
   1075  1.26   msaitoh  * @hw: pointer to hardware structure
   1076  1.26   msaitoh  * @vlan: VLAN id to write to VLAN filter
   1077  1.26   msaitoh  * @vind: VMDq output index that maps queue to VLAN id in VLVFB
   1078  1.26   msaitoh  * @vlan_on: boolean flag to turn on/off VLAN
   1079  1.26   msaitoh  * @vlvf_bypass: boolean flag indicating updating the default pool is okay
   1080   1.1    dyoung  *
   1081  1.26   msaitoh  * Turn on/off specified VLAN in the VLAN filter table.
   1082   1.1    dyoung  **/
   1083  1.17   msaitoh s32 ixgbe_set_vfta(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on,
   1084  1.17   msaitoh 		   bool vlvf_bypass)
   1085   1.1    dyoung {
   1086   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.set_vfta, (hw, vlan, vind,
   1087  1.17   msaitoh 			       vlan_on, vlvf_bypass), IXGBE_NOT_IMPLEMENTED);
   1088   1.5   msaitoh }
   1089   1.5   msaitoh 
   1090   1.5   msaitoh /**
   1091  1.26   msaitoh  * ixgbe_set_vlvf - Set VLAN Pool Filter
   1092  1.26   msaitoh  * @hw: pointer to hardware structure
   1093  1.26   msaitoh  * @vlan: VLAN id to write to VLAN filter
   1094  1.26   msaitoh  * @vind: VMDq output index that maps queue to VLAN id in VLVFB
   1095  1.26   msaitoh  * @vlan_on: boolean flag to turn on/off VLAN in VLVF
   1096  1.26   msaitoh  * @vfta_delta: pointer to the difference between the current value of VFTA
   1097  1.17   msaitoh  *		 and the desired value
   1098  1.26   msaitoh  * @vfta: the desired value of the VFTA
   1099  1.26   msaitoh  * @vlvf_bypass: boolean flag indicating updating the default pool is okay
   1100   1.5   msaitoh  *
   1101  1.26   msaitoh  * Turn on/off specified bit in VLVF table.
   1102   1.5   msaitoh  **/
   1103   1.5   msaitoh s32 ixgbe_set_vlvf(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on,
   1104  1.17   msaitoh 		   u32 *vfta_delta, u32 vfta, bool vlvf_bypass)
   1105   1.5   msaitoh {
   1106   1.5   msaitoh 	return ixgbe_call_func(hw, hw->mac.ops.set_vlvf, (hw, vlan, vind,
   1107  1.17   msaitoh 			       vlan_on, vfta_delta, vfta, vlvf_bypass),
   1108  1.17   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
   1109   1.1    dyoung }
   1110   1.1    dyoung 
   1111   1.1    dyoung /**
   1112  1.26   msaitoh  * ixgbe_toggle_txdctl - Toggle VF's queues
   1113  1.26   msaitoh  * @hw: pointer to hardware structure
   1114  1.26   msaitoh  * @vind: VMDq pool index
   1115  1.23   msaitoh  *
   1116  1.26   msaitoh  * Enable and disable each queue in VF.
   1117  1.23   msaitoh  */
   1118  1.23   msaitoh s32 ixgbe_toggle_txdctl(struct ixgbe_hw *hw, u32 vind)
   1119  1.23   msaitoh {
   1120  1.23   msaitoh 	return ixgbe_call_func(hw, hw->mac.ops.toggle_txdctl, (hw,
   1121  1.23   msaitoh 			       vind), IXGBE_NOT_IMPLEMENTED);
   1122  1.23   msaitoh }
   1123  1.23   msaitoh 
   1124  1.23   msaitoh /**
   1125  1.26   msaitoh  * ixgbe_fc_enable - Enable flow control
   1126  1.26   msaitoh  * @hw: pointer to hardware structure
   1127   1.1    dyoung  *
   1128  1.26   msaitoh  * Configures the flow control settings based on SW configuration.
   1129   1.1    dyoung  **/
   1130   1.6   msaitoh s32 ixgbe_fc_enable(struct ixgbe_hw *hw)
   1131   1.1    dyoung {
   1132   1.6   msaitoh 	return ixgbe_call_func(hw, hw->mac.ops.fc_enable, (hw),
   1133   1.5   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
   1134   1.5   msaitoh }
   1135   1.5   msaitoh 
   1136   1.5   msaitoh /**
   1137  1.26   msaitoh  * ixgbe_setup_fc - Set up flow control
   1138  1.26   msaitoh  * @hw: pointer to hardware structure
   1139  1.12   msaitoh  *
   1140  1.26   msaitoh  * Called at init time to set up flow control.
   1141  1.12   msaitoh  **/
   1142  1.12   msaitoh s32 ixgbe_setup_fc(struct ixgbe_hw *hw)
   1143  1.12   msaitoh {
   1144  1.12   msaitoh 	return ixgbe_call_func(hw, hw->mac.ops.setup_fc, (hw),
   1145  1.12   msaitoh 		IXGBE_NOT_IMPLEMENTED);
   1146  1.12   msaitoh }
   1147  1.12   msaitoh 
   1148  1.12   msaitoh /**
   1149   1.5   msaitoh  * ixgbe_set_fw_drv_ver - Try to send the driver version number FW
   1150   1.5   msaitoh  * @hw: pointer to hardware structure
   1151   1.5   msaitoh  * @maj: driver major number to be sent to firmware
   1152  1.11  riastrad  * @minr: driver minor number to be sent to firmware
   1153   1.5   msaitoh  * @build: driver build number to be sent to firmware
   1154   1.5   msaitoh  * @ver: driver version number to be sent to firmware
   1155  1.17   msaitoh  * @len: length of driver_ver string
   1156  1.17   msaitoh  * @driver_ver: driver string
   1157   1.5   msaitoh  **/
   1158  1.10  riastrad s32 ixgbe_set_fw_drv_ver(struct ixgbe_hw *hw, u8 maj, u8 minr, u8 build,
   1159  1.17   msaitoh 			 u8 ver, u16 len, char *driver_ver)
   1160   1.5   msaitoh {
   1161  1.10  riastrad 	return ixgbe_call_func(hw, hw->mac.ops.set_fw_drv_ver, (hw, maj, minr,
   1162  1.17   msaitoh 			       build, ver, len, driver_ver),
   1163  1.17   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
   1164   1.1    dyoung }
   1165   1.1    dyoung 
   1166   1.5   msaitoh 
   1167   1.8   msaitoh 
   1168  1.12   msaitoh /**
   1169  1.26   msaitoh  * ixgbe_dmac_config - Configure DMA Coalescing registers.
   1170  1.26   msaitoh  * @hw: pointer to hardware structure
   1171  1.12   msaitoh  *
   1172  1.26   msaitoh  * Configure DMA coalescing. If enabling dmac, dmac is activated.
   1173  1.26   msaitoh  * When disabling dmac, dmac enable dmac bit is cleared.
   1174  1.12   msaitoh  **/
   1175  1.12   msaitoh s32 ixgbe_dmac_config(struct ixgbe_hw *hw)
   1176  1.12   msaitoh {
   1177  1.12   msaitoh 	return ixgbe_call_func(hw, hw->mac.ops.dmac_config, (hw),
   1178  1.12   msaitoh 				IXGBE_NOT_IMPLEMENTED);
   1179  1.12   msaitoh }
   1180  1.12   msaitoh 
   1181  1.12   msaitoh /**
   1182  1.26   msaitoh  * ixgbe_dmac_update_tcs - Configure DMA Coalescing registers.
   1183  1.26   msaitoh  * @hw: pointer to hardware structure
   1184  1.12   msaitoh  *
   1185  1.26   msaitoh  * Disables dmac, updates per TC settings, and then enable dmac.
   1186  1.12   msaitoh  **/
   1187  1.12   msaitoh s32 ixgbe_dmac_update_tcs(struct ixgbe_hw *hw)
   1188  1.12   msaitoh {
   1189  1.12   msaitoh 	return ixgbe_call_func(hw, hw->mac.ops.dmac_update_tcs, (hw),
   1190  1.12   msaitoh 				IXGBE_NOT_IMPLEMENTED);
   1191  1.12   msaitoh }
   1192  1.12   msaitoh 
   1193  1.12   msaitoh /**
   1194  1.26   msaitoh  * ixgbe_dmac_config_tcs - Configure DMA Coalescing registers.
   1195  1.26   msaitoh  * @hw: pointer to hardware structure
   1196  1.12   msaitoh  *
   1197  1.26   msaitoh  * Configure DMA coalescing threshold per TC and set high priority bit for
   1198  1.26   msaitoh  * FCOE TC. The dmac enable bit must be cleared before configuring.
   1199  1.12   msaitoh  **/
   1200  1.12   msaitoh s32 ixgbe_dmac_config_tcs(struct ixgbe_hw *hw)
   1201  1.12   msaitoh {
   1202  1.12   msaitoh 	return ixgbe_call_func(hw, hw->mac.ops.dmac_config_tcs, (hw),
   1203  1.12   msaitoh 				IXGBE_NOT_IMPLEMENTED);
   1204  1.12   msaitoh }
   1205  1.12   msaitoh 
   1206  1.12   msaitoh /**
   1207  1.26   msaitoh  * ixgbe_setup_eee - Enable/disable EEE support
   1208  1.26   msaitoh  * @hw: pointer to the HW structure
   1209  1.26   msaitoh  * @enable_eee: boolean flag to enable EEE
   1210  1.26   msaitoh  *
   1211  1.26   msaitoh  * Enable/disable EEE based on enable_ee flag.
   1212  1.26   msaitoh  * Auto-negotiation must be started after BASE-T EEE bits in PHY register 7.3C
   1213  1.26   msaitoh  * are modified.
   1214  1.12   msaitoh  *
   1215  1.12   msaitoh  **/
   1216  1.12   msaitoh s32 ixgbe_setup_eee(struct ixgbe_hw *hw, bool enable_eee)
   1217  1.12   msaitoh {
   1218  1.12   msaitoh 	return ixgbe_call_func(hw, hw->mac.ops.setup_eee, (hw, enable_eee),
   1219  1.12   msaitoh 			IXGBE_NOT_IMPLEMENTED);
   1220  1.12   msaitoh }
   1221  1.12   msaitoh 
   1222  1.12   msaitoh /**
   1223  1.12   msaitoh  * ixgbe_set_source_address_pruning - Enable/Disable source address pruning
   1224  1.12   msaitoh  * @hw: pointer to hardware structure
   1225  1.20   msaitoh  * @enable: enable or disable source address pruning
   1226  1.12   msaitoh  * @pool: Rx pool - Rx pool to toggle source address pruning
   1227  1.12   msaitoh  **/
   1228  1.12   msaitoh void ixgbe_set_source_address_pruning(struct ixgbe_hw *hw, bool enable,
   1229  1.12   msaitoh 				      unsigned int pool)
   1230  1.12   msaitoh {
   1231  1.12   msaitoh 	if (hw->mac.ops.set_source_address_pruning)
   1232  1.12   msaitoh 		hw->mac.ops.set_source_address_pruning(hw, enable, pool);
   1233  1.12   msaitoh }
   1234  1.12   msaitoh 
   1235  1.12   msaitoh /**
   1236  1.26   msaitoh  * ixgbe_set_ethertype_anti_spoofing - Enable/Disable Ethertype anti-spoofing
   1237  1.26   msaitoh  * @hw: pointer to hardware structure
   1238  1.26   msaitoh  * @enable: enable or disable switch for Ethertype anti-spoofing
   1239  1.26   msaitoh  * @vf: Virtual Function pool - VF Pool to set for Ethertype anti-spoofing
   1240  1.12   msaitoh  *
   1241  1.12   msaitoh  **/
   1242  1.12   msaitoh void ixgbe_set_ethertype_anti_spoofing(struct ixgbe_hw *hw, bool enable, int vf)
   1243  1.12   msaitoh {
   1244  1.12   msaitoh 	if (hw->mac.ops.set_ethertype_anti_spoofing)
   1245  1.12   msaitoh 		hw->mac.ops.set_ethertype_anti_spoofing(hw, enable, vf);
   1246  1.12   msaitoh }
   1247  1.12   msaitoh 
   1248  1.12   msaitoh /**
   1249  1.26   msaitoh  * ixgbe_read_iosf_sb_reg - Read 32 bit PHY register
   1250  1.26   msaitoh  * @hw: pointer to hardware structure
   1251  1.26   msaitoh  * @reg_addr: 32 bit address of PHY register to read
   1252  1.26   msaitoh  * @device_type: type of device you want to communicate with
   1253  1.26   msaitoh  * @phy_data: Pointer to read data from PHY register
   1254  1.12   msaitoh  *
   1255  1.26   msaitoh  * Reads a value from a specified PHY register
   1256  1.12   msaitoh  **/
   1257  1.12   msaitoh s32 ixgbe_read_iosf_sb_reg(struct ixgbe_hw *hw, u32 reg_addr,
   1258  1.12   msaitoh 			   u32 device_type, u32 *phy_data)
   1259  1.12   msaitoh {
   1260  1.12   msaitoh 	return ixgbe_call_func(hw, hw->mac.ops.read_iosf_sb_reg, (hw, reg_addr,
   1261  1.12   msaitoh 			       device_type, phy_data), IXGBE_NOT_IMPLEMENTED);
   1262  1.12   msaitoh }
   1263  1.12   msaitoh 
   1264  1.12   msaitoh /**
   1265  1.26   msaitoh  * ixgbe_write_iosf_sb_reg - Write 32 bit register through IOSF Sideband
   1266  1.26   msaitoh  * @hw: pointer to hardware structure
   1267  1.26   msaitoh  * @reg_addr: 32 bit PHY register to write
   1268  1.26   msaitoh  * @device_type: type of device you want to communicate with
   1269  1.26   msaitoh  * @phy_data: Data to write to the PHY register
   1270  1.12   msaitoh  *
   1271  1.26   msaitoh  * Writes a value to specified PHY register
   1272  1.12   msaitoh  **/
   1273  1.12   msaitoh s32 ixgbe_write_iosf_sb_reg(struct ixgbe_hw *hw, u32 reg_addr,
   1274  1.12   msaitoh 			    u32 device_type, u32 phy_data)
   1275  1.12   msaitoh {
   1276  1.12   msaitoh 	return ixgbe_call_func(hw, hw->mac.ops.write_iosf_sb_reg, (hw, reg_addr,
   1277  1.12   msaitoh 			       device_type, phy_data), IXGBE_NOT_IMPLEMENTED);
   1278  1.12   msaitoh }
   1279  1.12   msaitoh 
   1280  1.12   msaitoh /**
   1281  1.26   msaitoh  * ixgbe_disable_mdd - Disable malicious driver detection
   1282  1.26   msaitoh  * @hw: pointer to hardware structure
   1283  1.12   msaitoh  *
   1284  1.12   msaitoh  **/
   1285  1.12   msaitoh void ixgbe_disable_mdd(struct ixgbe_hw *hw)
   1286  1.12   msaitoh {
   1287  1.12   msaitoh 	if (hw->mac.ops.disable_mdd)
   1288  1.12   msaitoh 		hw->mac.ops.disable_mdd(hw);
   1289  1.12   msaitoh }
   1290  1.12   msaitoh 
   1291  1.12   msaitoh /**
   1292  1.26   msaitoh  * ixgbe_enable_mdd - Enable malicious driver detection
   1293  1.26   msaitoh  * @hw: pointer to hardware structure
   1294  1.12   msaitoh  *
   1295  1.12   msaitoh  **/
   1296  1.12   msaitoh void ixgbe_enable_mdd(struct ixgbe_hw *hw)
   1297  1.12   msaitoh {
   1298  1.12   msaitoh 	if (hw->mac.ops.enable_mdd)
   1299  1.12   msaitoh 		hw->mac.ops.enable_mdd(hw);
   1300  1.12   msaitoh }
   1301  1.12   msaitoh 
   1302  1.12   msaitoh /**
   1303  1.26   msaitoh  * ixgbe_mdd_event - Handle malicious driver detection event
   1304  1.26   msaitoh  * @hw: pointer to hardware structure
   1305  1.26   msaitoh  * @vf_bitmap: vf bitmap of malicious vfs
   1306  1.12   msaitoh  *
   1307  1.12   msaitoh  **/
   1308  1.12   msaitoh void ixgbe_mdd_event(struct ixgbe_hw *hw, u32 *vf_bitmap)
   1309  1.12   msaitoh {
   1310  1.12   msaitoh 	if (hw->mac.ops.mdd_event)
   1311  1.12   msaitoh 		hw->mac.ops.mdd_event(hw, vf_bitmap);
   1312  1.12   msaitoh }
   1313  1.12   msaitoh 
   1314  1.12   msaitoh /**
   1315  1.26   msaitoh  * ixgbe_restore_mdd_vf - Restore VF that was disabled during malicious driver
   1316  1.26   msaitoh  * detection event
   1317  1.26   msaitoh  * @hw: pointer to hardware structure
   1318  1.26   msaitoh  * @vf: vf index
   1319  1.12   msaitoh  *
   1320  1.12   msaitoh  **/
   1321  1.12   msaitoh void ixgbe_restore_mdd_vf(struct ixgbe_hw *hw, u32 vf)
   1322  1.12   msaitoh {
   1323  1.12   msaitoh 	if (hw->mac.ops.restore_mdd_vf)
   1324  1.12   msaitoh 		hw->mac.ops.restore_mdd_vf(hw, vf);
   1325  1.12   msaitoh }
   1326  1.12   msaitoh 
   1327  1.12   msaitoh /**
   1328  1.26   msaitoh  * ixgbe_fw_recovery_mode - Check if in FW NVM recovery mode
   1329  1.26   msaitoh  * @hw: pointer to hardware structure
   1330  1.22   msaitoh  *
   1331  1.22   msaitoh  **/
   1332  1.22   msaitoh bool ixgbe_fw_recovery_mode(struct ixgbe_hw *hw)
   1333  1.22   msaitoh {
   1334  1.22   msaitoh 	if (hw->mac.ops.fw_recovery_mode)
   1335  1.22   msaitoh 		return hw->mac.ops.fw_recovery_mode(hw);
   1336  1.22   msaitoh 	return FALSE;
   1337  1.22   msaitoh }
   1338  1.22   msaitoh 
   1339  1.22   msaitoh /**
   1340  1.26   msaitoh  * ixgbe_enter_lplu - Transition to low power states
   1341  1.26   msaitoh  * @hw: pointer to hardware structure
   1342  1.12   msaitoh  *
   1343  1.12   msaitoh  * Configures Low Power Link Up on transition to low power states
   1344  1.12   msaitoh  * (from D0 to non-D0).
   1345  1.12   msaitoh  **/
   1346  1.12   msaitoh s32 ixgbe_enter_lplu(struct ixgbe_hw *hw)
   1347  1.12   msaitoh {
   1348  1.12   msaitoh 	return ixgbe_call_func(hw, hw->phy.ops.enter_lplu, (hw),
   1349  1.12   msaitoh 				IXGBE_NOT_IMPLEMENTED);
   1350  1.12   msaitoh }
   1351   1.8   msaitoh 
   1352   1.1    dyoung /**
   1353  1.13   msaitoh  * ixgbe_handle_lasi - Handle external Base T PHY interrupt
   1354  1.13   msaitoh  * @hw: pointer to hardware structure
   1355  1.13   msaitoh  *
   1356  1.13   msaitoh  * Handle external Base T PHY interrupt. If high temperature
   1357  1.13   msaitoh  * failure alarm then return error, else if link status change
   1358  1.13   msaitoh  * then setup internal/external PHY link
   1359  1.13   msaitoh  *
   1360  1.13   msaitoh  * Return IXGBE_ERR_OVERTEMP if interrupt is high temperature
   1361  1.13   msaitoh  * failure alarm, else return PHY access status.
   1362  1.13   msaitoh  */
   1363  1.13   msaitoh s32 ixgbe_handle_lasi(struct ixgbe_hw *hw)
   1364  1.13   msaitoh {
   1365  1.13   msaitoh 	return ixgbe_call_func(hw, hw->phy.ops.handle_lasi, (hw),
   1366  1.13   msaitoh 				IXGBE_NOT_IMPLEMENTED);
   1367  1.13   msaitoh }
   1368  1.13   msaitoh 
   1369  1.13   msaitoh /**
   1370  1.26   msaitoh  * ixgbe_bypass_rw - Bit bang data into by_pass FW
   1371  1.26   msaitoh  * @hw: pointer to hardware structure
   1372  1.26   msaitoh  * @cmd: Command we send to the FW
   1373  1.26   msaitoh  * @status: The reply from the FW
   1374  1.17   msaitoh  *
   1375  1.26   msaitoh  * Bit-bangs the cmd to the by_pass FW status points to what is returned.
   1376  1.17   msaitoh  **/
   1377  1.17   msaitoh s32 ixgbe_bypass_rw(struct ixgbe_hw *hw, u32 cmd, u32 *status)
   1378  1.17   msaitoh {
   1379  1.17   msaitoh 	return ixgbe_call_func(hw, hw->mac.ops.bypass_rw, (hw, cmd, status),
   1380  1.17   msaitoh 				IXGBE_NOT_IMPLEMENTED);
   1381  1.17   msaitoh }
   1382  1.17   msaitoh 
   1383  1.17   msaitoh /**
   1384  1.17   msaitoh  * ixgbe_bypass_valid_rd - Verify valid return from bit-bang.
   1385  1.26   msaitoh  * @hw: pointer to hardware structure
   1386  1.26   msaitoh  * @in_reg: The register cmd for the bit-bang read.
   1387  1.26   msaitoh  * @out_reg: The register returned from a bit-bang read.
   1388  1.17   msaitoh  *
   1389  1.17   msaitoh  * If we send a write we can't be sure it took until we can read back
   1390  1.24  pgoyette  * that same register.  It can be a problem as some of the fields may
   1391  1.24  pgoyette  * for valid reasons change in-between the time wrote the register and
   1392  1.17   msaitoh  * we read it again to verify.  So this function check everything we
   1393  1.17   msaitoh  * can check and then assumes it worked.
   1394  1.17   msaitoh  **/
   1395  1.17   msaitoh bool ixgbe_bypass_valid_rd(struct ixgbe_hw *hw, u32 in_reg, u32 out_reg)
   1396  1.17   msaitoh {
   1397  1.17   msaitoh 	return ixgbe_call_func(hw, hw->mac.ops.bypass_valid_rd,
   1398  1.17   msaitoh 			       (in_reg, out_reg), IXGBE_NOT_IMPLEMENTED);
   1399  1.17   msaitoh }
   1400  1.17   msaitoh 
   1401  1.17   msaitoh /**
   1402  1.26   msaitoh  * ixgbe_bypass_set - Set a bypass field in the FW CTRL Register.
   1403  1.26   msaitoh  * @hw: pointer to hardware structure
   1404  1.26   msaitoh  * @cmd: The control word we are setting.
   1405  1.26   msaitoh  * @event: The event we are setting in the FW.  This also happens to
   1406  1.26   msaitoh  *         be the mask for the event we are setting (handy)
   1407  1.26   msaitoh  * @action: The action we set the event to in the FW. This is in a
   1408  1.26   msaitoh  *          bit field that happens to be what we want to put in
   1409  1.26   msaitoh  *          the event spot (also handy)
   1410  1.17   msaitoh  *
   1411  1.26   msaitoh  * Writes to the cmd control the bits in actions.
   1412  1.17   msaitoh  **/
   1413  1.17   msaitoh s32 ixgbe_bypass_set(struct ixgbe_hw *hw, u32 cmd, u32 event, u32 action)
   1414  1.17   msaitoh {
   1415  1.17   msaitoh 	return ixgbe_call_func(hw, hw->mac.ops.bypass_set,
   1416  1.17   msaitoh 			       (hw, cmd, event, action),
   1417  1.17   msaitoh 				IXGBE_NOT_IMPLEMENTED);
   1418  1.17   msaitoh }
   1419  1.17   msaitoh 
   1420  1.17   msaitoh /**
   1421  1.26   msaitoh  * ixgbe_bypass_rd_eep - Read the bypass FW eeprom address
   1422  1.26   msaitoh  * @hw: pointer to hardware structure
   1423  1.26   msaitoh  * @addr: The bypass eeprom address to read.
   1424  1.26   msaitoh  * @value: The 8b of data at the address above.
   1425  1.17   msaitoh  **/
   1426  1.17   msaitoh s32 ixgbe_bypass_rd_eep(struct ixgbe_hw *hw, u32 addr, u8 *value)
   1427  1.17   msaitoh {
   1428  1.17   msaitoh 	return ixgbe_call_func(hw, hw->mac.ops.bypass_rd_eep,
   1429  1.17   msaitoh 			       (hw, addr, value), IXGBE_NOT_IMPLEMENTED);
   1430  1.17   msaitoh }
   1431  1.17   msaitoh 
   1432  1.17   msaitoh /**
   1433  1.26   msaitoh  * ixgbe_read_analog_reg8 - Reads 8 bit analog register
   1434  1.26   msaitoh  * @hw: pointer to hardware structure
   1435  1.26   msaitoh  * @reg: analog register to read
   1436  1.26   msaitoh  * @val: read value
   1437   1.1    dyoung  *
   1438  1.26   msaitoh  * Performs write operation to analog register specified.
   1439   1.1    dyoung  **/
   1440   1.1    dyoung s32 ixgbe_read_analog_reg8(struct ixgbe_hw *hw, u32 reg, u8 *val)
   1441   1.1    dyoung {
   1442   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.read_analog_reg8, (hw, reg,
   1443   1.5   msaitoh 			       val), IXGBE_NOT_IMPLEMENTED);
   1444   1.1    dyoung }
   1445   1.1    dyoung 
   1446   1.1    dyoung /**
   1447  1.26   msaitoh  * ixgbe_write_analog_reg8 - Writes 8 bit analog register
   1448  1.26   msaitoh  * @hw: pointer to hardware structure
   1449  1.26   msaitoh  * @reg: analog register to write
   1450  1.26   msaitoh  * @val: value to write
   1451   1.1    dyoung  *
   1452  1.26   msaitoh  * Performs write operation to Atlas analog register specified.
   1453   1.1    dyoung  **/
   1454   1.1    dyoung s32 ixgbe_write_analog_reg8(struct ixgbe_hw *hw, u32 reg, u8 val)
   1455   1.1    dyoung {
   1456   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.write_analog_reg8, (hw, reg,
   1457   1.5   msaitoh 			       val), IXGBE_NOT_IMPLEMENTED);
   1458   1.1    dyoung }
   1459   1.1    dyoung 
   1460   1.1    dyoung /**
   1461  1.26   msaitoh  * ixgbe_init_uta_tables - Initializes Unicast Table Arrays.
   1462  1.26   msaitoh  * @hw: pointer to hardware structure
   1463   1.1    dyoung  *
   1464  1.26   msaitoh  * Initializes the Unicast Table Arrays to zero on device load.  This
   1465  1.26   msaitoh  * is part of the Rx init addr execution path.
   1466   1.1    dyoung  **/
   1467   1.1    dyoung s32 ixgbe_init_uta_tables(struct ixgbe_hw *hw)
   1468   1.1    dyoung {
   1469   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.init_uta_tables, (hw),
   1470   1.5   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
   1471   1.1    dyoung }
   1472   1.1    dyoung 
   1473   1.1    dyoung /**
   1474  1.26   msaitoh  * ixgbe_read_i2c_byte - Reads 8 bit word over I2C at specified device address
   1475  1.26   msaitoh  * @hw: pointer to hardware structure
   1476  1.26   msaitoh  * @byte_offset: byte offset to read
   1477  1.26   msaitoh  * @dev_addr: I2C bus address to read from
   1478  1.26   msaitoh  * @data: value read
   1479   1.1    dyoung  *
   1480  1.26   msaitoh  * Performs byte read operation to SFP module's EEPROM over I2C interface.
   1481   1.1    dyoung  **/
   1482   1.1    dyoung s32 ixgbe_read_i2c_byte(struct ixgbe_hw *hw, u8 byte_offset, u8 dev_addr,
   1483   1.5   msaitoh 			u8 *data)
   1484   1.1    dyoung {
   1485   1.1    dyoung 	return ixgbe_call_func(hw, hw->phy.ops.read_i2c_byte, (hw, byte_offset,
   1486   1.5   msaitoh 			       dev_addr, data), IXGBE_NOT_IMPLEMENTED);
   1487   1.1    dyoung }
   1488   1.1    dyoung 
   1489   1.1    dyoung /**
   1490  1.26   msaitoh  * ixgbe_read_i2c_byte_unlocked - Reads 8 bit word via I2C from device address
   1491  1.26   msaitoh  * @hw: pointer to hardware structure
   1492  1.26   msaitoh  * @byte_offset: byte offset to read
   1493  1.26   msaitoh  * @dev_addr: I2C bus address to read from
   1494  1.26   msaitoh  * @data: value read
   1495  1.13   msaitoh  *
   1496  1.26   msaitoh  * Performs byte read operation to SFP module's EEPROM over I2C interface.
   1497  1.13   msaitoh  **/
   1498  1.13   msaitoh s32 ixgbe_read_i2c_byte_unlocked(struct ixgbe_hw *hw, u8 byte_offset,
   1499  1.13   msaitoh 				 u8 dev_addr, u8 *data)
   1500  1.13   msaitoh {
   1501  1.13   msaitoh 	return ixgbe_call_func(hw, hw->phy.ops.read_i2c_byte_unlocked,
   1502  1.13   msaitoh 			       (hw, byte_offset, dev_addr, data),
   1503  1.13   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
   1504  1.13   msaitoh }
   1505  1.13   msaitoh 
   1506  1.13   msaitoh /**
   1507  1.17   msaitoh  * ixgbe_read_link - Perform read operation on link device
   1508  1.12   msaitoh  * @hw: pointer to the hardware structure
   1509  1.17   msaitoh  * @addr: bus address to read from
   1510  1.17   msaitoh  * @reg: device register to read from
   1511  1.12   msaitoh  * @val: pointer to location to receive read value
   1512  1.12   msaitoh  *
   1513  1.12   msaitoh  * Returns an error code on error.
   1514  1.12   msaitoh  */
   1515  1.17   msaitoh s32 ixgbe_read_link(struct ixgbe_hw *hw, u8 addr, u16 reg, u16 *val)
   1516  1.12   msaitoh {
   1517  1.17   msaitoh 	return ixgbe_call_func(hw, hw->link.ops.read_link, (hw, addr,
   1518  1.12   msaitoh 			       reg, val), IXGBE_NOT_IMPLEMENTED);
   1519  1.12   msaitoh }
   1520  1.12   msaitoh 
   1521  1.12   msaitoh /**
   1522  1.17   msaitoh  * ixgbe_read_link_unlocked - Perform read operation on link device
   1523  1.13   msaitoh  * @hw: pointer to the hardware structure
   1524  1.17   msaitoh  * @addr: bus address to read from
   1525  1.17   msaitoh  * @reg: device register to read from
   1526  1.13   msaitoh  * @val: pointer to location to receive read value
   1527  1.13   msaitoh  *
   1528  1.13   msaitoh  * Returns an error code on error.
   1529  1.13   msaitoh  **/
   1530  1.17   msaitoh s32 ixgbe_read_link_unlocked(struct ixgbe_hw *hw, u8 addr, u16 reg, u16 *val)
   1531  1.13   msaitoh {
   1532  1.17   msaitoh 	return ixgbe_call_func(hw, hw->link.ops.read_link_unlocked,
   1533  1.17   msaitoh 			       (hw, addr, reg, val), IXGBE_NOT_IMPLEMENTED);
   1534  1.13   msaitoh }
   1535  1.13   msaitoh 
   1536  1.13   msaitoh /**
   1537  1.26   msaitoh  * ixgbe_write_i2c_byte - Writes 8 bit word over I2C
   1538  1.26   msaitoh  * @hw: pointer to hardware structure
   1539  1.26   msaitoh  * @byte_offset: byte offset to write
   1540  1.26   msaitoh  * @dev_addr: I2C bus address to write to
   1541  1.26   msaitoh  * @data: value to write
   1542   1.1    dyoung  *
   1543  1.26   msaitoh  * Performs byte write operation to SFP module's EEPROM over I2C interface
   1544  1.26   msaitoh  * at a specified device address.
   1545   1.1    dyoung  **/
   1546   1.1    dyoung s32 ixgbe_write_i2c_byte(struct ixgbe_hw *hw, u8 byte_offset, u8 dev_addr,
   1547   1.5   msaitoh 			 u8 data)
   1548   1.1    dyoung {
   1549   1.1    dyoung 	return ixgbe_call_func(hw, hw->phy.ops.write_i2c_byte, (hw, byte_offset,
   1550   1.5   msaitoh 			       dev_addr, data), IXGBE_NOT_IMPLEMENTED);
   1551   1.1    dyoung }
   1552   1.1    dyoung 
   1553   1.1    dyoung /**
   1554  1.26   msaitoh  * ixgbe_write_i2c_byte_unlocked - Writes 8 bit word over I2C
   1555  1.26   msaitoh  * @hw: pointer to hardware structure
   1556  1.26   msaitoh  * @byte_offset: byte offset to write
   1557  1.26   msaitoh  * @dev_addr: I2C bus address to write to
   1558  1.26   msaitoh  * @data: value to write
   1559  1.13   msaitoh  *
   1560  1.26   msaitoh  * Performs byte write operation to SFP module's EEPROM over I2C interface
   1561  1.26   msaitoh  * at a specified device address.
   1562  1.13   msaitoh  **/
   1563  1.13   msaitoh s32 ixgbe_write_i2c_byte_unlocked(struct ixgbe_hw *hw, u8 byte_offset,
   1564  1.13   msaitoh 				  u8 dev_addr, u8 data)
   1565  1.13   msaitoh {
   1566  1.13   msaitoh 	return ixgbe_call_func(hw, hw->phy.ops.write_i2c_byte_unlocked,
   1567  1.13   msaitoh 			       (hw, byte_offset, dev_addr, data),
   1568  1.13   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
   1569  1.13   msaitoh }
   1570  1.13   msaitoh 
   1571  1.13   msaitoh /**
   1572  1.17   msaitoh  * ixgbe_write_link - Perform write operation on link device
   1573  1.12   msaitoh  * @hw: pointer to the hardware structure
   1574  1.17   msaitoh  * @addr: bus address to write to
   1575  1.17   msaitoh  * @reg: device register to write to
   1576  1.12   msaitoh  * @val: value to write
   1577  1.12   msaitoh  *
   1578  1.12   msaitoh  * Returns an error code on error.
   1579  1.12   msaitoh  */
   1580  1.17   msaitoh s32 ixgbe_write_link(struct ixgbe_hw *hw, u8 addr, u16 reg, u16 val)
   1581  1.12   msaitoh {
   1582  1.17   msaitoh 	return ixgbe_call_func(hw, hw->link.ops.write_link,
   1583  1.17   msaitoh 			       (hw, addr, reg, val), IXGBE_NOT_IMPLEMENTED);
   1584  1.12   msaitoh }
   1585  1.12   msaitoh 
   1586  1.12   msaitoh /**
   1587  1.17   msaitoh  * ixgbe_write_link_unlocked - Perform write operation on link device
   1588  1.13   msaitoh  * @hw: pointer to the hardware structure
   1589  1.17   msaitoh  * @addr: bus address to write to
   1590  1.17   msaitoh  * @reg: device register to write to
   1591  1.13   msaitoh  * @val: value to write
   1592  1.13   msaitoh  *
   1593  1.13   msaitoh  * Returns an error code on error.
   1594  1.13   msaitoh  **/
   1595  1.17   msaitoh s32 ixgbe_write_link_unlocked(struct ixgbe_hw *hw, u8 addr, u16 reg, u16 val)
   1596  1.13   msaitoh {
   1597  1.17   msaitoh 	return ixgbe_call_func(hw, hw->link.ops.write_link_unlocked,
   1598  1.13   msaitoh 			       (hw, addr, reg, val), IXGBE_NOT_IMPLEMENTED);
   1599  1.13   msaitoh }
   1600  1.13   msaitoh 
   1601  1.13   msaitoh /**
   1602  1.26   msaitoh  * ixgbe_write_i2c_eeprom - Writes 8 bit EEPROM word over I2C interface
   1603  1.26   msaitoh  * @hw: pointer to hardware structure
   1604  1.26   msaitoh  * @byte_offset: EEPROM byte offset to write
   1605  1.26   msaitoh  * @eeprom_data: value to write
   1606   1.1    dyoung  *
   1607  1.26   msaitoh  * Performs byte write operation to SFP module's EEPROM over I2C interface.
   1608   1.1    dyoung  **/
   1609   1.1    dyoung s32 ixgbe_write_i2c_eeprom(struct ixgbe_hw *hw,
   1610   1.5   msaitoh 			   u8 byte_offset, u8 eeprom_data)
   1611   1.1    dyoung {
   1612   1.1    dyoung 	return ixgbe_call_func(hw, hw->phy.ops.write_i2c_eeprom,
   1613   1.5   msaitoh 			       (hw, byte_offset, eeprom_data),
   1614   1.5   msaitoh 			       IXGBE_NOT_IMPLEMENTED);
   1615   1.1    dyoung }
   1616   1.1    dyoung 
   1617   1.1    dyoung /**
   1618  1.26   msaitoh  * ixgbe_read_i2c_eeprom - Reads 8 bit EEPROM word over I2C interface
   1619  1.26   msaitoh  * @hw: pointer to hardware structure
   1620  1.26   msaitoh  * @byte_offset: EEPROM byte offset to read
   1621  1.26   msaitoh  * @eeprom_data: value read
   1622   1.1    dyoung  *
   1623  1.26   msaitoh  * Performs byte read operation to SFP module's EEPROM over I2C interface.
   1624   1.1    dyoung  **/
   1625   1.1    dyoung s32 ixgbe_read_i2c_eeprom(struct ixgbe_hw *hw, u8 byte_offset, u8 *eeprom_data)
   1626   1.1    dyoung {
   1627   1.1    dyoung 	return ixgbe_call_func(hw, hw->phy.ops.read_i2c_eeprom,
   1628   1.5   msaitoh 			      (hw, byte_offset, eeprom_data),
   1629   1.5   msaitoh 			      IXGBE_NOT_IMPLEMENTED);
   1630   1.1    dyoung }
   1631   1.1    dyoung 
   1632   1.1    dyoung /**
   1633  1.26   msaitoh  * ixgbe_get_supported_physical_layer - Returns physical layer type
   1634  1.26   msaitoh  * @hw: pointer to hardware structure
   1635   1.1    dyoung  *
   1636  1.26   msaitoh  * Determines physical layer capabilities of the current configuration.
   1637   1.1    dyoung  **/
   1638  1.17   msaitoh u64 ixgbe_get_supported_physical_layer(struct ixgbe_hw *hw)
   1639   1.1    dyoung {
   1640   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.get_supported_physical_layer,
   1641   1.5   msaitoh 			       (hw), IXGBE_PHYSICAL_LAYER_UNKNOWN);
   1642   1.1    dyoung }
   1643   1.1    dyoung 
   1644   1.1    dyoung /**
   1645  1.26   msaitoh  * ixgbe_enable_rx_dma - Enables Rx DMA unit, dependent on device specifics
   1646  1.26   msaitoh  * @hw: pointer to hardware structure
   1647  1.26   msaitoh  * @regval: bitfield to write to the Rx DMA register
   1648   1.1    dyoung  *
   1649  1.26   msaitoh  * Enables the Rx DMA unit of the device.
   1650   1.1    dyoung  **/
   1651   1.1    dyoung s32 ixgbe_enable_rx_dma(struct ixgbe_hw *hw, u32 regval)
   1652   1.1    dyoung {
   1653   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.enable_rx_dma,
   1654   1.5   msaitoh 			       (hw, regval), IXGBE_NOT_IMPLEMENTED);
   1655   1.5   msaitoh }
   1656   1.5   msaitoh 
   1657   1.5   msaitoh /**
   1658  1.26   msaitoh  * ixgbe_disable_sec_rx_path - Stops the receive data path
   1659  1.26   msaitoh  * @hw: pointer to hardware structure
   1660   1.5   msaitoh  *
   1661  1.26   msaitoh  * Stops the receive data path.
   1662   1.5   msaitoh  **/
   1663   1.5   msaitoh s32 ixgbe_disable_sec_rx_path(struct ixgbe_hw *hw)
   1664   1.5   msaitoh {
   1665   1.5   msaitoh 	return ixgbe_call_func(hw, hw->mac.ops.disable_sec_rx_path,
   1666   1.5   msaitoh 				(hw), IXGBE_NOT_IMPLEMENTED);
   1667   1.5   msaitoh }
   1668   1.5   msaitoh 
   1669   1.5   msaitoh /**
   1670  1.26   msaitoh  * ixgbe_enable_sec_rx_path - Enables the receive data path
   1671  1.26   msaitoh  * @hw: pointer to hardware structure
   1672   1.5   msaitoh  *
   1673  1.26   msaitoh  * Enables the receive data path.
   1674   1.5   msaitoh  **/
   1675   1.5   msaitoh s32 ixgbe_enable_sec_rx_path(struct ixgbe_hw *hw)
   1676   1.5   msaitoh {
   1677   1.5   msaitoh 	return ixgbe_call_func(hw, hw->mac.ops.enable_sec_rx_path,
   1678   1.5   msaitoh 				(hw), IXGBE_NOT_IMPLEMENTED);
   1679   1.1    dyoung }
   1680   1.1    dyoung 
   1681   1.1    dyoung /**
   1682  1.26   msaitoh  * ixgbe_acquire_swfw_semaphore - Acquire SWFW semaphore
   1683  1.26   msaitoh  * @hw: pointer to hardware structure
   1684  1.26   msaitoh  * @mask: Mask to specify which semaphore to acquire
   1685   1.1    dyoung  *
   1686  1.26   msaitoh  * Acquires the SWFW semaphore through SW_FW_SYNC register for the specified
   1687  1.26   msaitoh  * function (CSR, PHY0, PHY1, EEPROM, Flash)
   1688   1.1    dyoung  **/
   1689  1.12   msaitoh s32 ixgbe_acquire_swfw_semaphore(struct ixgbe_hw *hw, u32 mask)
   1690   1.1    dyoung {
   1691   1.1    dyoung 	return ixgbe_call_func(hw, hw->mac.ops.acquire_swfw_sync,
   1692   1.5   msaitoh 			       (hw, mask), IXGBE_NOT_IMPLEMENTED);
   1693   1.1    dyoung }
   1694   1.1    dyoung 
   1695   1.1    dyoung /**
   1696  1.26   msaitoh  * ixgbe_release_swfw_semaphore - Release SWFW semaphore
   1697  1.26   msaitoh  * @hw: pointer to hardware structure
   1698  1.26   msaitoh  * @mask: Mask to specify which semaphore to release
   1699   1.1    dyoung  *
   1700  1.26   msaitoh  * Releases the SWFW semaphore through SW_FW_SYNC register for the specified
   1701  1.26   msaitoh  * function (CSR, PHY0, PHY1, EEPROM, Flash)
   1702   1.1    dyoung  **/
   1703  1.12   msaitoh void ixgbe_release_swfw_semaphore(struct ixgbe_hw *hw, u32 mask)
   1704   1.1    dyoung {
   1705   1.1    dyoung 	if (hw->mac.ops.release_swfw_sync)
   1706   1.1    dyoung 		hw->mac.ops.release_swfw_sync(hw, mask);
   1707   1.1    dyoung }
   1708   1.1    dyoung 
   1709  1.17   msaitoh /**
   1710  1.26   msaitoh  * ixgbe_init_swfw_semaphore - Clean up SWFW semaphore
   1711  1.26   msaitoh  * @hw: pointer to hardware structure
   1712  1.17   msaitoh  *
   1713  1.26   msaitoh  * Attempts to acquire the SWFW semaphore through SW_FW_SYNC register.
   1714  1.26   msaitoh  * Regardless of whether is succeeds or not it then release the semaphore.
   1715  1.26   msaitoh  * This is function is called to recover from catastrophic failures that
   1716  1.26   msaitoh  * may have left the semaphore locked.
   1717  1.17   msaitoh  **/
   1718  1.17   msaitoh void ixgbe_init_swfw_semaphore(struct ixgbe_hw *hw)
   1719  1.17   msaitoh {
   1720  1.17   msaitoh 	if (hw->mac.ops.init_swfw_sync)
   1721  1.17   msaitoh 		hw->mac.ops.init_swfw_sync(hw);
   1722  1.17   msaitoh }
   1723  1.17   msaitoh 
   1724  1.12   msaitoh 
   1725  1.12   msaitoh void ixgbe_disable_rx(struct ixgbe_hw *hw)
   1726  1.12   msaitoh {
   1727  1.12   msaitoh 	if (hw->mac.ops.disable_rx)
   1728  1.12   msaitoh 		hw->mac.ops.disable_rx(hw);
   1729  1.12   msaitoh }
   1730  1.12   msaitoh 
   1731  1.12   msaitoh void ixgbe_enable_rx(struct ixgbe_hw *hw)
   1732  1.12   msaitoh {
   1733  1.12   msaitoh 	if (hw->mac.ops.enable_rx)
   1734  1.12   msaitoh 		hw->mac.ops.enable_rx(hw);
   1735  1.12   msaitoh }
   1736  1.12   msaitoh 
   1737  1.12   msaitoh /**
   1738  1.26   msaitoh  * ixgbe_set_rate_select_speed - Set module link speed
   1739  1.26   msaitoh  * @hw: pointer to hardware structure
   1740  1.26   msaitoh  * @speed: link speed to set
   1741  1.12   msaitoh  *
   1742  1.26   msaitoh  * Set module link speed via the rate select.
   1743  1.12   msaitoh  */
   1744  1.12   msaitoh void ixgbe_set_rate_select_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed)
   1745  1.12   msaitoh {
   1746  1.12   msaitoh 	if (hw->mac.ops.set_rate_select_speed)
   1747  1.12   msaitoh 		hw->mac.ops.set_rate_select_speed(hw, speed);
   1748  1.12   msaitoh }
   1749