Commit f1b714bb authored by David S. Miller's avatar David S. Miller

Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next

Jeff Kirsher says:

====================
Intel Wired LAN Driver Updates 2014-07-25

This series contains updates to e1000e, ixgbe and ixgbevf.

Mark provides all the changes for ixgbe and ixgbevf.  Converts some udelay()
calls to the preferred usleep_range().  Fixes a spurious release of the
semaphore in several functions when there was a failure to acquire the
semaphore in the first place.  Fixes a X540 semaphore error where an
incorrect check was treating success as failure and vice-versa.  Fixed
ixgbe_write_mbx() error when it was being called and there was no
mbx->ops.write method defined, so no error code was returned.  The
corresponding read function would explicitly return an error in such a
case as do other functions.  Cleans up unused (dead) code by removing it.
Finally make return values more direct, eliminating some gotos and
otherwise unneeded conditionals, which allows the removal of some local
variables.

David provides all the changes for e1000e.  Fix CRC errors with jumbo
traffic for 82579, i217 and i218 client parts to increase the gap
between the read and write pointers in the transmit FIFO.  Added code
to check and respond to previously ignored return values from NVM
access functions.  Added support for EEE in Sx states and fixed EEE in
S5 with runtime PM enabled.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 6ceed786 2a7e19af
...@@ -342,6 +342,7 @@ ...@@ -342,6 +342,7 @@
#define E1000_TIPG_IPGR2_SHIFT 20 #define E1000_TIPG_IPGR2_SHIFT 20
#define MAX_JUMBO_FRAME_SIZE 0x3F00 #define MAX_JUMBO_FRAME_SIZE 0x3F00
#define E1000_TX_PTR_GAP 0x1F
/* Extended Configuration Control and Size */ /* Extended Configuration Control and Size */
#define E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP 0x00000020 #define E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP 0x00000020
......
...@@ -2444,7 +2444,7 @@ s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable) ...@@ -2444,7 +2444,7 @@ s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable)
return ret_val; return ret_val;
e1e_rphy(hw, PHY_REG(776, 20), &data); e1e_rphy(hw, PHY_REG(776, 20), &data);
data &= ~(0x3FF << 2); data &= ~(0x3FF << 2);
data |= (0x1A << 2); data |= (E1000_TX_PTR_GAP << 2);
ret_val = e1e_wphy(hw, PHY_REG(776, 20), data); ret_val = e1e_wphy(hw, PHY_REG(776, 20), data);
if (ret_val) if (ret_val)
return ret_val; return ret_val;
...@@ -4605,14 +4605,23 @@ void e1000_suspend_workarounds_ich8lan(struct e1000_hw *hw) ...@@ -4605,14 +4605,23 @@ void e1000_suspend_workarounds_ich8lan(struct e1000_hw *hw)
/* Disable LPLU if both link partners support 100BaseT /* Disable LPLU if both link partners support 100BaseT
* EEE and 100Full is advertised on both ends of the * EEE and 100Full is advertised on both ends of the
* link. * link, and enable Auto Enable LPI since there will
* be no driver to enable LPI while in Sx.
*/ */
if ((eee_advert & I82579_EEE_100_SUPPORTED) && if ((eee_advert & I82579_EEE_100_SUPPORTED) &&
(dev_spec->eee_lp_ability & (dev_spec->eee_lp_ability &
I82579_EEE_100_SUPPORTED) && I82579_EEE_100_SUPPORTED) &&
(hw->phy.autoneg_advertised & ADVERTISE_100_FULL)) (hw->phy.autoneg_advertised & ADVERTISE_100_FULL)) {
phy_ctrl &= ~(E1000_PHY_CTRL_D0A_LPLU | phy_ctrl &= ~(E1000_PHY_CTRL_D0A_LPLU |
E1000_PHY_CTRL_NOND0A_LPLU); E1000_PHY_CTRL_NOND0A_LPLU);
/* Set Auto Enable LPI after link up */
e1e_rphy_locked(hw,
I217_LPI_GPIO_CTRL, &phy_reg);
phy_reg |= I217_LPI_GPIO_CTRL_AUTO_EN_LPI;
e1e_wphy_locked(hw,
I217_LPI_GPIO_CTRL, phy_reg);
}
} }
/* For i217 Intel Rapid Start Technology support, /* For i217 Intel Rapid Start Technology support,
...@@ -4709,6 +4718,11 @@ void e1000_resume_workarounds_pchlan(struct e1000_hw *hw) ...@@ -4709,6 +4718,11 @@ void e1000_resume_workarounds_pchlan(struct e1000_hw *hw)
return; return;
} }
/* Clear Auto Enable LPI after link up */
e1e_rphy_locked(hw, I217_LPI_GPIO_CTRL, &phy_reg);
phy_reg &= ~I217_LPI_GPIO_CTRL_AUTO_EN_LPI;
e1e_wphy_locked(hw, I217_LPI_GPIO_CTRL, phy_reg);
if (!(er32(FWSM) & E1000_ICH_FWSM_FW_VALID)) { if (!(er32(FWSM) & E1000_ICH_FWSM_FW_VALID)) {
/* Restore clear on SMB if no manageability engine /* Restore clear on SMB if no manageability engine
* is present * is present
......
...@@ -217,6 +217,10 @@ ...@@ -217,6 +217,10 @@
#define I217_INBAND_CTRL_LINK_STAT_TX_TIMEOUT_MASK 0x3F00 #define I217_INBAND_CTRL_LINK_STAT_TX_TIMEOUT_MASK 0x3F00
#define I217_INBAND_CTRL_LINK_STAT_TX_TIMEOUT_SHIFT 8 #define I217_INBAND_CTRL_LINK_STAT_TX_TIMEOUT_SHIFT 8
/* Low Power Idle GPIO Control */
#define I217_LPI_GPIO_CTRL PHY_REG(772, 18)
#define I217_LPI_GPIO_CTRL_AUTO_EN_LPI 0x0800
/* PHY Low Power Idle Control */ /* PHY Low Power Idle Control */
#define I82579_LPI_CTRL PHY_REG(772, 20) #define I82579_LPI_CTRL PHY_REG(772, 20)
#define I82579_LPI_CTRL_100_ENABLE 0x2000 #define I82579_LPI_CTRL_100_ENABLE 0x2000
......
...@@ -327,9 +327,12 @@ bool e1000e_enable_mng_pass_thru(struct e1000_hw *hw) ...@@ -327,9 +327,12 @@ bool e1000e_enable_mng_pass_thru(struct e1000_hw *hw)
} else if ((hw->mac.type == e1000_82574) || } else if ((hw->mac.type == e1000_82574) ||
(hw->mac.type == e1000_82583)) { (hw->mac.type == e1000_82583)) {
u16 data; u16 data;
s32 ret_val;
factps = er32(FACTPS); factps = er32(FACTPS);
e1000_read_nvm(hw, NVM_INIT_CONTROL2_REG, 1, &data); ret_val = e1000_read_nvm(hw, NVM_INIT_CONTROL2_REG, 1, &data);
if (ret_val)
return false;
if (!(factps & E1000_FACTPS_MNGCG) && if (!(factps & E1000_FACTPS_MNGCG) &&
((data & E1000_NVM_INIT_CTRL2_MNGM) == ((data & E1000_NVM_INIT_CTRL2_MNGM) ==
......
...@@ -6033,6 +6033,28 @@ static int e1000_init_phy_wakeup(struct e1000_adapter *adapter, u32 wufc) ...@@ -6033,6 +6033,28 @@ static int e1000_init_phy_wakeup(struct e1000_adapter *adapter, u32 wufc)
return retval; return retval;
} }
static void e1000e_flush_lpic(struct pci_dev *pdev)
{
struct net_device *netdev = pci_get_drvdata(pdev);
struct e1000_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw;
u32 ret_val;
pm_runtime_get_sync(netdev->dev.parent);
ret_val = hw->phy.ops.acquire(hw);
if (ret_val)
goto fl_out;
pr_info("EEE TX LPI TIMER: %08X\n",
er32(LPIC) >> E1000_LPIC_LPIET_SHIFT);
hw->phy.ops.release(hw);
fl_out:
pm_runtime_put_sync(netdev->dev.parent);
}
static int e1000e_pm_freeze(struct device *dev) static int e1000e_pm_freeze(struct device *dev)
{ {
struct net_device *netdev = pci_get_drvdata(to_pci_dev(dev)); struct net_device *netdev = pci_get_drvdata(to_pci_dev(dev));
...@@ -6333,6 +6355,8 @@ static int e1000e_pm_suspend(struct device *dev) ...@@ -6333,6 +6355,8 @@ static int e1000e_pm_suspend(struct device *dev)
{ {
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
e1000e_flush_lpic(pdev);
e1000e_pm_freeze(dev); e1000e_pm_freeze(dev);
return __e1000_shutdown(pdev, false); return __e1000_shutdown(pdev, false);
...@@ -6357,9 +6381,14 @@ static int e1000e_pm_runtime_idle(struct device *dev) ...@@ -6357,9 +6381,14 @@ static int e1000e_pm_runtime_idle(struct device *dev)
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
struct net_device *netdev = pci_get_drvdata(pdev); struct net_device *netdev = pci_get_drvdata(pdev);
struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_adapter *adapter = netdev_priv(netdev);
u16 eee_lp;
if (!e1000e_has_link(adapter)) eee_lp = adapter->hw.dev_spec.ich8lan.eee_lp_ability;
if (!e1000e_has_link(adapter)) {
adapter->hw.dev_spec.ich8lan.eee_lp_ability = eee_lp;
pm_schedule_suspend(dev, 5 * MSEC_PER_SEC); pm_schedule_suspend(dev, 5 * MSEC_PER_SEC);
}
return -EBUSY; return -EBUSY;
} }
...@@ -6411,6 +6440,8 @@ static int e1000e_pm_runtime_suspend(struct device *dev) ...@@ -6411,6 +6440,8 @@ static int e1000e_pm_runtime_suspend(struct device *dev)
static void e1000_shutdown(struct pci_dev *pdev) static void e1000_shutdown(struct pci_dev *pdev)
{ {
e1000e_flush_lpic(pdev);
e1000e_pm_freeze(&pdev->dev); e1000e_pm_freeze(&pdev->dev);
__e1000_shutdown(pdev, false); __e1000_shutdown(pdev, false);
...@@ -6708,6 +6739,7 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -6708,6 +6739,7 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
int bars, i, err, pci_using_dac; int bars, i, err, pci_using_dac;
u16 eeprom_data = 0; u16 eeprom_data = 0;
u16 eeprom_apme_mask = E1000_EEPROM_APME; u16 eeprom_apme_mask = E1000_EEPROM_APME;
s32 rval = 0;
if (ei->flags2 & FLAG2_DISABLE_ASPM_L0S) if (ei->flags2 & FLAG2_DISABLE_ASPM_L0S)
aspm_disable_flag = PCIE_LINK_STATE_L0S; aspm_disable_flag = PCIE_LINK_STATE_L0S;
...@@ -6940,15 +6972,19 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -6940,15 +6972,19 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
} else if (adapter->flags & FLAG_APME_IN_CTRL3) { } else if (adapter->flags & FLAG_APME_IN_CTRL3) {
if (adapter->flags & FLAG_APME_CHECK_PORT_B && if (adapter->flags & FLAG_APME_CHECK_PORT_B &&
(adapter->hw.bus.func == 1)) (adapter->hw.bus.func == 1))
e1000_read_nvm(&adapter->hw, NVM_INIT_CONTROL3_PORT_B, rval = e1000_read_nvm(&adapter->hw,
1, &eeprom_data); NVM_INIT_CONTROL3_PORT_B,
1, &eeprom_data);
else else
e1000_read_nvm(&adapter->hw, NVM_INIT_CONTROL3_PORT_A, rval = e1000_read_nvm(&adapter->hw,
1, &eeprom_data); NVM_INIT_CONTROL3_PORT_A,
1, &eeprom_data);
} }
/* fetch WoL from EEPROM */ /* fetch WoL from EEPROM */
if (eeprom_data & eeprom_apme_mask) if (rval)
e_dbg("NVM read error getting WoL initial values: %d\n", rval);
else if (eeprom_data & eeprom_apme_mask)
adapter->eeprom_wol |= E1000_WUFC_MAG; adapter->eeprom_wol |= E1000_WUFC_MAG;
/* now that we have the eeprom settings, apply the special cases /* now that we have the eeprom settings, apply the special cases
...@@ -6967,7 +7003,12 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -6967,7 +7003,12 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
device_wakeup_enable(&pdev->dev); device_wakeup_enable(&pdev->dev);
/* save off EEPROM version number */ /* save off EEPROM version number */
e1000_read_nvm(&adapter->hw, 5, 1, &adapter->eeprom_vers); rval = e1000_read_nvm(&adapter->hw, 5, 1, &adapter->eeprom_vers);
if (rval) {
e_dbg("NVM read error getting EEPROM version: %d\n", rval);
adapter->eeprom_vers = 0;
}
/* reset the hardware with the new settings */ /* reset the hardware with the new settings */
e1000e_reset(adapter); e1000e_reset(adapter);
......
...@@ -327,8 +327,10 @@ s32 e1000e_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) ...@@ -327,8 +327,10 @@ s32 e1000e_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
ew32(EERD, eerd); ew32(EERD, eerd);
ret_val = e1000e_poll_eerd_eewr_done(hw, E1000_NVM_POLL_READ); ret_val = e1000e_poll_eerd_eewr_done(hw, E1000_NVM_POLL_READ);
if (ret_val) if (ret_val) {
e_dbg("NVM read error: %d\n", ret_val);
break; break;
}
data[i] = (er32(EERD) >> E1000_NVM_RW_REG_DATA); data[i] = (er32(EERD) >> E1000_NVM_RW_REG_DATA);
} }
......
/******************************************************************************* /*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver Intel 10 Gigabit PCI Express Linux driver
Copyright(c) 1999 - 2013 Intel Corporation. Copyright(c) 1999 - 2014 Intel Corporation.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License, under the terms and conditions of the GNU General Public License,
...@@ -87,7 +87,6 @@ s32 ixgbe_dcb_calculate_tc_credits(struct ixgbe_hw *hw, ...@@ -87,7 +87,6 @@ s32 ixgbe_dcb_calculate_tc_credits(struct ixgbe_hw *hw,
int min_credit; int min_credit;
int min_multiplier; int min_multiplier;
int min_percent = 100; int min_percent = 100;
s32 ret_val = 0;
/* Initialization values default for Tx settings */ /* Initialization values default for Tx settings */
u32 credit_refill = 0; u32 credit_refill = 0;
u32 credit_max = 0; u32 credit_max = 0;
...@@ -95,10 +94,8 @@ s32 ixgbe_dcb_calculate_tc_credits(struct ixgbe_hw *hw, ...@@ -95,10 +94,8 @@ s32 ixgbe_dcb_calculate_tc_credits(struct ixgbe_hw *hw,
u8 bw_percent = 0; u8 bw_percent = 0;
u8 i; u8 i;
if (dcb_config == NULL) { if (!dcb_config)
ret_val = DCB_ERR_CONFIG; return DCB_ERR_CONFIG;
goto out;
}
min_credit = ((max_frame / 2) + DCB_CREDIT_QUANTUM - 1) / min_credit = ((max_frame / 2) + DCB_CREDIT_QUANTUM - 1) /
DCB_CREDIT_QUANTUM; DCB_CREDIT_QUANTUM;
...@@ -174,8 +171,7 @@ s32 ixgbe_dcb_calculate_tc_credits(struct ixgbe_hw *hw, ...@@ -174,8 +171,7 @@ s32 ixgbe_dcb_calculate_tc_credits(struct ixgbe_hw *hw,
p->data_credits_max = (u16)credit_max; p->data_credits_max = (u16)credit_max;
} }
out: return 0;
return ret_val;
} }
void ixgbe_dcb_unpack_pfc(struct ixgbe_dcb_config *cfg, u8 *pfc_en) void ixgbe_dcb_unpack_pfc(struct ixgbe_dcb_config *cfg, u8 *pfc_en)
...@@ -236,7 +232,7 @@ u8 ixgbe_dcb_get_tc_from_up(struct ixgbe_dcb_config *cfg, int direction, u8 up) ...@@ -236,7 +232,7 @@ u8 ixgbe_dcb_get_tc_from_up(struct ixgbe_dcb_config *cfg, int direction, u8 up)
/* If tc is 0 then DCB is likely not enabled or supported */ /* If tc is 0 then DCB is likely not enabled or supported */
if (!tc) if (!tc)
goto out; return 0;
/* /*
* Test from maximum TC to 1 and report the first match we find. If * Test from maximum TC to 1 and report the first match we find. If
...@@ -247,7 +243,7 @@ u8 ixgbe_dcb_get_tc_from_up(struct ixgbe_dcb_config *cfg, int direction, u8 up) ...@@ -247,7 +243,7 @@ u8 ixgbe_dcb_get_tc_from_up(struct ixgbe_dcb_config *cfg, int direction, u8 up)
if (prio_mask & tc_config[tc].path[direction].up_to_tc_bitmap) if (prio_mask & tc_config[tc].path[direction].up_to_tc_bitmap)
break; break;
} }
out:
return tc; return tc;
} }
...@@ -269,7 +265,6 @@ void ixgbe_dcb_unpack_map(struct ixgbe_dcb_config *cfg, int direction, u8 *map) ...@@ -269,7 +265,6 @@ void ixgbe_dcb_unpack_map(struct ixgbe_dcb_config *cfg, int direction, u8 *map)
s32 ixgbe_dcb_hw_config(struct ixgbe_hw *hw, s32 ixgbe_dcb_hw_config(struct ixgbe_hw *hw,
struct ixgbe_dcb_config *dcb_config) struct ixgbe_dcb_config *dcb_config)
{ {
s32 ret = 0;
u8 pfc_en; u8 pfc_en;
u8 ptype[MAX_TRAFFIC_CLASS]; u8 ptype[MAX_TRAFFIC_CLASS];
u8 bwgid[MAX_TRAFFIC_CLASS]; u8 bwgid[MAX_TRAFFIC_CLASS];
...@@ -287,37 +282,31 @@ s32 ixgbe_dcb_hw_config(struct ixgbe_hw *hw, ...@@ -287,37 +282,31 @@ s32 ixgbe_dcb_hw_config(struct ixgbe_hw *hw,
switch (hw->mac.type) { switch (hw->mac.type) {
case ixgbe_mac_82598EB: case ixgbe_mac_82598EB:
ret = ixgbe_dcb_hw_config_82598(hw, pfc_en, refill, max, return ixgbe_dcb_hw_config_82598(hw, pfc_en, refill, max,
bwgid, ptype); bwgid, ptype);
break;
case ixgbe_mac_82599EB: case ixgbe_mac_82599EB:
case ixgbe_mac_X540: case ixgbe_mac_X540:
ret = ixgbe_dcb_hw_config_82599(hw, pfc_en, refill, max, return ixgbe_dcb_hw_config_82599(hw, pfc_en, refill, max,
bwgid, ptype, prio_tc); bwgid, ptype, prio_tc);
break;
default: default:
break; break;
} }
return ret; return 0;
} }
/* Helper routines to abstract HW specifics from DCB netlink ops */ /* Helper routines to abstract HW specifics from DCB netlink ops */
s32 ixgbe_dcb_hw_pfc_config(struct ixgbe_hw *hw, u8 pfc_en, u8 *prio_tc) s32 ixgbe_dcb_hw_pfc_config(struct ixgbe_hw *hw, u8 pfc_en, u8 *prio_tc)
{ {
int ret = -EINVAL;
switch (hw->mac.type) { switch (hw->mac.type) {
case ixgbe_mac_82598EB: case ixgbe_mac_82598EB:
ret = ixgbe_dcb_config_pfc_82598(hw, pfc_en); return ixgbe_dcb_config_pfc_82598(hw, pfc_en);
break;
case ixgbe_mac_82599EB: case ixgbe_mac_82599EB:
case ixgbe_mac_X540: case ixgbe_mac_X540:
ret = ixgbe_dcb_config_pfc_82599(hw, pfc_en, prio_tc); return ixgbe_dcb_config_pfc_82599(hw, pfc_en, prio_tc);
break;
default: default:
break; break;
} }
return ret; return -EINVAL;
} }
s32 ixgbe_dcb_hw_ets(struct ixgbe_hw *hw, struct ieee_ets *ets, int max_frame) s32 ixgbe_dcb_hw_ets(struct ixgbe_hw *hw, struct ieee_ets *ets, int max_frame)
......
/******************************************************************************* /*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver Intel 10 Gigabit PCI Express Linux driver
Copyright(c) 1999 - 2013 Intel Corporation. Copyright(c) 1999 - 2014 Intel Corporation.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License, under the terms and conditions of the GNU General Public License,
...@@ -153,7 +153,6 @@ static u8 ixgbe_dcbnl_get_state(struct net_device *netdev) ...@@ -153,7 +153,6 @@ static u8 ixgbe_dcbnl_get_state(struct net_device *netdev)
static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state)
{ {
struct ixgbe_adapter *adapter = netdev_priv(netdev); struct ixgbe_adapter *adapter = netdev_priv(netdev);
int err = 0;
/* Fail command if not in CEE mode */ /* Fail command if not in CEE mode */
if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_CEE))
...@@ -161,12 +160,10 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) ...@@ -161,12 +160,10 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state)
/* verify there is something to do, if not then exit */ /* verify there is something to do, if not then exit */
if (!state == !(adapter->flags & IXGBE_FLAG_DCB_ENABLED)) if (!state == !(adapter->flags & IXGBE_FLAG_DCB_ENABLED))
goto out; return 0;
err = ixgbe_setup_tc(netdev, return !!ixgbe_setup_tc(netdev,
state ? adapter->dcb_cfg.num_tcs.pg_tcs : 0); state ? adapter->dcb_cfg.num_tcs.pg_tcs : 0);
out:
return !!err;
} }
static void ixgbe_dcbnl_get_perm_hw_addr(struct net_device *netdev, static void ixgbe_dcbnl_get_perm_hw_addr(struct net_device *netdev,
...@@ -331,12 +328,12 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev) ...@@ -331,12 +328,12 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev)
/* Fail command if not in CEE mode */ /* Fail command if not in CEE mode */
if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_CEE))
return ret; return DCB_NO_HW_CHG;
adapter->dcb_set_bitmap |= ixgbe_copy_dcb_cfg(adapter, adapter->dcb_set_bitmap |= ixgbe_copy_dcb_cfg(adapter,
MAX_TRAFFIC_CLASS); MAX_TRAFFIC_CLASS);
if (!adapter->dcb_set_bitmap) if (!adapter->dcb_set_bitmap)
return ret; return DCB_NO_HW_CHG;
if (adapter->dcb_set_bitmap & (BIT_PG_TX|BIT_PG_RX)) { if (adapter->dcb_set_bitmap & (BIT_PG_TX|BIT_PG_RX)) {
u16 refill[MAX_TRAFFIC_CLASS], max[MAX_TRAFFIC_CLASS]; u16 refill[MAX_TRAFFIC_CLASS], max[MAX_TRAFFIC_CLASS];
...@@ -536,7 +533,7 @@ static int ixgbe_dcbnl_ieee_setets(struct net_device *dev, ...@@ -536,7 +533,7 @@ static int ixgbe_dcbnl_ieee_setets(struct net_device *dev,
{ {
struct ixgbe_adapter *adapter = netdev_priv(dev); struct ixgbe_adapter *adapter = netdev_priv(dev);
int max_frame = dev->mtu + ETH_HLEN + ETH_FCS_LEN; int max_frame = dev->mtu + ETH_HLEN + ETH_FCS_LEN;
int i, err = 0; int i, err;
__u8 max_tc = 0; __u8 max_tc = 0;
__u8 map_chg = 0; __u8 map_chg = 0;
...@@ -573,17 +570,15 @@ static int ixgbe_dcbnl_ieee_setets(struct net_device *dev, ...@@ -573,17 +570,15 @@ static int ixgbe_dcbnl_ieee_setets(struct net_device *dev,
if (max_tc > adapter->dcb_cfg.num_tcs.pg_tcs) if (max_tc > adapter->dcb_cfg.num_tcs.pg_tcs)
return -EINVAL; return -EINVAL;
if (max_tc != netdev_get_num_tc(dev)) if (max_tc != netdev_get_num_tc(dev)) {
err = ixgbe_setup_tc(dev, max_tc); err = ixgbe_setup_tc(dev, max_tc);
else if (map_chg) if (err)
return err;
} else if (map_chg) {
ixgbe_dcbnl_devreset(dev); ixgbe_dcbnl_devreset(dev);
}
if (err) return ixgbe_dcb_hw_ets(&adapter->hw, ets, max_frame);
goto err_out;
err = ixgbe_dcb_hw_ets(&adapter->hw, ets, max_frame);
err_out:
return err;
} }
static int ixgbe_dcbnl_ieee_getpfc(struct net_device *dev, static int ixgbe_dcbnl_ieee_getpfc(struct net_device *dev,
...@@ -647,10 +642,10 @@ static int ixgbe_dcbnl_ieee_setapp(struct net_device *dev, ...@@ -647,10 +642,10 @@ static int ixgbe_dcbnl_ieee_setapp(struct net_device *dev,
struct dcb_app *app) struct dcb_app *app)
{ {
struct ixgbe_adapter *adapter = netdev_priv(dev); struct ixgbe_adapter *adapter = netdev_priv(dev);
int err = -EINVAL; int err;
if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_IEEE)) if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_IEEE))
return err; return -EINVAL;
err = dcb_ieee_setapp(dev, app); err = dcb_ieee_setapp(dev, app);
if (err) if (err)
...@@ -662,7 +657,7 @@ static int ixgbe_dcbnl_ieee_setapp(struct net_device *dev, ...@@ -662,7 +657,7 @@ static int ixgbe_dcbnl_ieee_setapp(struct net_device *dev,
u8 app_mask = dcb_ieee_getapp_mask(dev, app); u8 app_mask = dcb_ieee_getapp_mask(dev, app);
if (app_mask & (1 << adapter->fcoe.up)) if (app_mask & (1 << adapter->fcoe.up))
return err; return 0;
adapter->fcoe.up = app->priority; adapter->fcoe.up = app->priority;
ixgbe_dcbnl_devreset(dev); ixgbe_dcbnl_devreset(dev);
...@@ -705,7 +700,7 @@ static int ixgbe_dcbnl_ieee_delapp(struct net_device *dev, ...@@ -705,7 +700,7 @@ static int ixgbe_dcbnl_ieee_delapp(struct net_device *dev,
u8 app_mask = dcb_ieee_getapp_mask(dev, app); u8 app_mask = dcb_ieee_getapp_mask(dev, app);
if (app_mask & (1 << adapter->fcoe.up)) if (app_mask & (1 << adapter->fcoe.up))
return err; return 0;
adapter->fcoe.up = app_mask ? adapter->fcoe.up = app_mask ?
ffs(app_mask) - 1 : IXGBE_FCOE_DEFTC; ffs(app_mask) - 1 : IXGBE_FCOE_DEFTC;
......
/******************************************************************************* /*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver Intel 10 Gigabit PCI Express Linux driver
Copyright(c) 1999 - 2013 Intel Corporation. Copyright(c) 1999 - 2014 Intel Corporation.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License, under the terms and conditions of the GNU General Public License,
...@@ -67,23 +67,23 @@ static inline void ixgbe_fcoe_clear_ddp(struct ixgbe_fcoe_ddp *ddp) ...@@ -67,23 +67,23 @@ static inline void ixgbe_fcoe_clear_ddp(struct ixgbe_fcoe_ddp *ddp)
*/ */
int ixgbe_fcoe_ddp_put(struct net_device *netdev, u16 xid) int ixgbe_fcoe_ddp_put(struct net_device *netdev, u16 xid)
{ {
int len = 0; int len;
struct ixgbe_fcoe *fcoe; struct ixgbe_fcoe *fcoe;
struct ixgbe_adapter *adapter; struct ixgbe_adapter *adapter;
struct ixgbe_fcoe_ddp *ddp; struct ixgbe_fcoe_ddp *ddp;
u32 fcbuff; u32 fcbuff;
if (!netdev) if (!netdev)
goto out_ddp_put; return 0;
if (xid >= IXGBE_FCOE_DDP_MAX) if (xid >= IXGBE_FCOE_DDP_MAX)
goto out_ddp_put; return 0;
adapter = netdev_priv(netdev); adapter = netdev_priv(netdev);
fcoe = &adapter->fcoe; fcoe = &adapter->fcoe;
ddp = &fcoe->ddp[xid]; ddp = &fcoe->ddp[xid];
if (!ddp->udl) if (!ddp->udl)
goto out_ddp_put; return 0;
len = ddp->len; len = ddp->len;
/* if there an error, force to invalidate ddp context */ /* if there an error, force to invalidate ddp context */
...@@ -114,7 +114,6 @@ int ixgbe_fcoe_ddp_put(struct net_device *netdev, u16 xid) ...@@ -114,7 +114,6 @@ int ixgbe_fcoe_ddp_put(struct net_device *netdev, u16 xid)
ixgbe_fcoe_clear_ddp(ddp); ixgbe_fcoe_clear_ddp(ddp);
out_ddp_put:
return len; return len;
} }
...@@ -394,17 +393,17 @@ int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter, ...@@ -394,17 +393,17 @@ int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter,
xid = be16_to_cpu(fh->fh_rx_id); xid = be16_to_cpu(fh->fh_rx_id);
if (xid >= IXGBE_FCOE_DDP_MAX) if (xid >= IXGBE_FCOE_DDP_MAX)
goto ddp_out; return -EINVAL;
fcoe = &adapter->fcoe; fcoe = &adapter->fcoe;
ddp = &fcoe->ddp[xid]; ddp = &fcoe->ddp[xid];
if (!ddp->udl) if (!ddp->udl)
goto ddp_out; return -EINVAL;
ddp_err = ixgbe_test_staterr(rx_desc, IXGBE_RXDADV_ERR_FCEOFE | ddp_err = ixgbe_test_staterr(rx_desc, IXGBE_RXDADV_ERR_FCEOFE |
IXGBE_RXDADV_ERR_FCERR); IXGBE_RXDADV_ERR_FCERR);
if (ddp_err) if (ddp_err)
goto ddp_out; return -EINVAL;
switch (ixgbe_test_staterr(rx_desc, IXGBE_RXDADV_STAT_FCSTAT)) { switch (ixgbe_test_staterr(rx_desc, IXGBE_RXDADV_STAT_FCSTAT)) {
/* return 0 to bypass going to ULD for DDPed data */ /* return 0 to bypass going to ULD for DDPed data */
...@@ -447,7 +446,7 @@ int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter, ...@@ -447,7 +446,7 @@ int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter,
crc = (struct fcoe_crc_eof *)skb_put(skb, sizeof(*crc)); crc = (struct fcoe_crc_eof *)skb_put(skb, sizeof(*crc));
crc->fcoe_eof = FC_EOF_T; crc->fcoe_eof = FC_EOF_T;
} }
ddp_out:
return rc; return rc;
} }
...@@ -878,7 +877,6 @@ int ixgbe_fcoe_disable(struct net_device *netdev) ...@@ -878,7 +877,6 @@ int ixgbe_fcoe_disable(struct net_device *netdev)
*/ */
int ixgbe_fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type) int ixgbe_fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type)
{ {
int rc = -EINVAL;
u16 prefix = 0xffff; u16 prefix = 0xffff;
struct ixgbe_adapter *adapter = netdev_priv(netdev); struct ixgbe_adapter *adapter = netdev_priv(netdev);
struct ixgbe_mac_info *mac = &adapter->hw.mac; struct ixgbe_mac_info *mac = &adapter->hw.mac;
...@@ -903,9 +901,9 @@ int ixgbe_fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type) ...@@ -903,9 +901,9 @@ int ixgbe_fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type)
((u64) mac->san_addr[3] << 16) | ((u64) mac->san_addr[3] << 16) |
((u64) mac->san_addr[4] << 8) | ((u64) mac->san_addr[4] << 8) |
((u64) mac->san_addr[5]); ((u64) mac->san_addr[5]);
rc = 0; return 0;
} }
return rc; return -EINVAL;
} }
/** /**
......
...@@ -570,7 +570,7 @@ static void ixgbe_dump(struct ixgbe_adapter *adapter) ...@@ -570,7 +570,7 @@ static void ixgbe_dump(struct ixgbe_adapter *adapter)
/* Print TX Ring Summary */ /* Print TX Ring Summary */
if (!netdev || !netif_running(netdev)) if (!netdev || !netif_running(netdev))
goto exit; return;
dev_info(&adapter->pdev->dev, "TX Rings Summary\n"); dev_info(&adapter->pdev->dev, "TX Rings Summary\n");
pr_info(" %s %s %s %s\n", pr_info(" %s %s %s %s\n",
...@@ -685,7 +685,7 @@ static void ixgbe_dump(struct ixgbe_adapter *adapter) ...@@ -685,7 +685,7 @@ static void ixgbe_dump(struct ixgbe_adapter *adapter)
/* Print RX Rings */ /* Print RX Rings */
if (!netif_msg_rx_status(adapter)) if (!netif_msg_rx_status(adapter))
goto exit; return;
dev_info(&adapter->pdev->dev, "RX Rings Dump\n"); dev_info(&adapter->pdev->dev, "RX Rings Dump\n");
...@@ -787,9 +787,6 @@ static void ixgbe_dump(struct ixgbe_adapter *adapter) ...@@ -787,9 +787,6 @@ static void ixgbe_dump(struct ixgbe_adapter *adapter)
} }
} }
exit:
return;
} }
static void ixgbe_release_hw_control(struct ixgbe_adapter *adapter) static void ixgbe_release_hw_control(struct ixgbe_adapter *adapter)
...@@ -1011,7 +1008,6 @@ static inline bool ixgbe_check_tx_hang(struct ixgbe_ring *tx_ring) ...@@ -1011,7 +1008,6 @@ static inline bool ixgbe_check_tx_hang(struct ixgbe_ring *tx_ring)
u32 tx_done = ixgbe_get_tx_completed(tx_ring); u32 tx_done = ixgbe_get_tx_completed(tx_ring);
u32 tx_done_old = tx_ring->tx_stats.tx_done_old; u32 tx_done_old = tx_ring->tx_stats.tx_done_old;
u32 tx_pending = ixgbe_get_tx_pending(tx_ring); u32 tx_pending = ixgbe_get_tx_pending(tx_ring);
bool ret = false;
clear_check_for_tx_hang(tx_ring); clear_check_for_tx_hang(tx_ring);
...@@ -1027,18 +1023,16 @@ static inline bool ixgbe_check_tx_hang(struct ixgbe_ring *tx_ring) ...@@ -1027,18 +1023,16 @@ static inline bool ixgbe_check_tx_hang(struct ixgbe_ring *tx_ring)
* run the check_tx_hang logic with a transmit completion * run the check_tx_hang logic with a transmit completion
* pending but without time to complete it yet. * pending but without time to complete it yet.
*/ */
if ((tx_done_old == tx_done) && tx_pending) { if (tx_done_old == tx_done && tx_pending)
/* make sure it is true for two checks in a row */ /* make sure it is true for two checks in a row */
ret = test_and_set_bit(__IXGBE_HANG_CHECK_ARMED, return test_and_set_bit(__IXGBE_HANG_CHECK_ARMED,
&tx_ring->state); &tx_ring->state);
} else { /* update completed stats and continue */
/* update completed stats and continue */ tx_ring->tx_stats.tx_done_old = tx_done;
tx_ring->tx_stats.tx_done_old = tx_done; /* reset the countdown */
/* reset the countdown */ clear_bit(__IXGBE_HANG_CHECK_ARMED, &tx_ring->state);
clear_bit(__IXGBE_HANG_CHECK_ARMED, &tx_ring->state);
}
return ret; return false;
} }
/** /**
...@@ -4701,18 +4695,18 @@ static int ixgbe_non_sfp_link_config(struct ixgbe_hw *hw) ...@@ -4701,18 +4695,18 @@ static int ixgbe_non_sfp_link_config(struct ixgbe_hw *hw)
ret = hw->mac.ops.check_link(hw, &speed, &link_up, false); ret = hw->mac.ops.check_link(hw, &speed, &link_up, false);
if (ret) if (ret)
goto link_cfg_out; return ret;
speed = hw->phy.autoneg_advertised; speed = hw->phy.autoneg_advertised;
if ((!speed) && (hw->mac.ops.get_link_capabilities)) if ((!speed) && (hw->mac.ops.get_link_capabilities))
ret = hw->mac.ops.get_link_capabilities(hw, &speed, ret = hw->mac.ops.get_link_capabilities(hw, &speed,
&autoneg); &autoneg);
if (ret) if (ret)
goto link_cfg_out; return ret;
if (hw->mac.ops.setup_link) if (hw->mac.ops.setup_link)
ret = hw->mac.ops.setup_link(hw, speed, link_up); ret = hw->mac.ops.setup_link(hw, speed, link_up);
link_cfg_out:
return ret; return ret;
} }
......
/******************************************************************************* /*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver Intel 10 Gigabit PCI Express Linux driver
Copyright(c) 1999 - 2013 Intel Corporation. Copyright(c) 1999 - 2014 Intel Corporation.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License, under the terms and conditions of the GNU General Public License,
...@@ -43,16 +43,15 @@ ...@@ -43,16 +43,15 @@
s32 ixgbe_read_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size, u16 mbx_id) s32 ixgbe_read_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size, u16 mbx_id)
{ {
struct ixgbe_mbx_info *mbx = &hw->mbx; struct ixgbe_mbx_info *mbx = &hw->mbx;
s32 ret_val = IXGBE_ERR_MBX;
/* limit read to size of mailbox */ /* limit read to size of mailbox */
if (size > mbx->size) if (size > mbx->size)
size = mbx->size; size = mbx->size;
if (mbx->ops.read) if (!mbx->ops.read)
ret_val = mbx->ops.read(hw, msg, size, mbx_id); return IXGBE_ERR_MBX;
return ret_val; return mbx->ops.read(hw, msg, size, mbx_id);
} }
/** /**
...@@ -67,15 +66,14 @@ s32 ixgbe_read_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size, u16 mbx_id) ...@@ -67,15 +66,14 @@ s32 ixgbe_read_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size, u16 mbx_id)
s32 ixgbe_write_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size, u16 mbx_id) s32 ixgbe_write_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size, u16 mbx_id)
{ {
struct ixgbe_mbx_info *mbx = &hw->mbx; struct ixgbe_mbx_info *mbx = &hw->mbx;
s32 ret_val = 0;
if (size > mbx->size) if (size > mbx->size)
ret_val = IXGBE_ERR_MBX; return IXGBE_ERR_MBX;
else if (mbx->ops.write) if (!mbx->ops.write)
ret_val = mbx->ops.write(hw, msg, size, mbx_id); return IXGBE_ERR_MBX;
return ret_val; return mbx->ops.write(hw, msg, size, mbx_id);
} }
/** /**
...@@ -88,12 +86,11 @@ s32 ixgbe_write_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size, u16 mbx_id) ...@@ -88,12 +86,11 @@ s32 ixgbe_write_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size, u16 mbx_id)
s32 ixgbe_check_for_msg(struct ixgbe_hw *hw, u16 mbx_id) s32 ixgbe_check_for_msg(struct ixgbe_hw *hw, u16 mbx_id)
{ {
struct ixgbe_mbx_info *mbx = &hw->mbx; struct ixgbe_mbx_info *mbx = &hw->mbx;
s32 ret_val = IXGBE_ERR_MBX;
if (mbx->ops.check_for_msg) if (!mbx->ops.check_for_msg)
ret_val = mbx->ops.check_for_msg(hw, mbx_id); return IXGBE_ERR_MBX;
return ret_val; return mbx->ops.check_for_msg(hw, mbx_id);
} }
/** /**
...@@ -106,12 +103,11 @@ s32 ixgbe_check_for_msg(struct ixgbe_hw *hw, u16 mbx_id) ...@@ -106,12 +103,11 @@ s32 ixgbe_check_for_msg(struct ixgbe_hw *hw, u16 mbx_id)
s32 ixgbe_check_for_ack(struct ixgbe_hw *hw, u16 mbx_id) s32 ixgbe_check_for_ack(struct ixgbe_hw *hw, u16 mbx_id)
{ {
struct ixgbe_mbx_info *mbx = &hw->mbx; struct ixgbe_mbx_info *mbx = &hw->mbx;
s32 ret_val = IXGBE_ERR_MBX;
if (mbx->ops.check_for_ack) if (!mbx->ops.check_for_ack)
ret_val = mbx->ops.check_for_ack(hw, mbx_id); return IXGBE_ERR_MBX;
return ret_val; return mbx->ops.check_for_ack(hw, mbx_id);
} }
/** /**
...@@ -124,12 +120,11 @@ s32 ixgbe_check_for_ack(struct ixgbe_hw *hw, u16 mbx_id) ...@@ -124,12 +120,11 @@ s32 ixgbe_check_for_ack(struct ixgbe_hw *hw, u16 mbx_id)
s32 ixgbe_check_for_rst(struct ixgbe_hw *hw, u16 mbx_id) s32 ixgbe_check_for_rst(struct ixgbe_hw *hw, u16 mbx_id)
{ {
struct ixgbe_mbx_info *mbx = &hw->mbx; struct ixgbe_mbx_info *mbx = &hw->mbx;
s32 ret_val = IXGBE_ERR_MBX;
if (mbx->ops.check_for_rst) if (!mbx->ops.check_for_rst)
ret_val = mbx->ops.check_for_rst(hw, mbx_id); return IXGBE_ERR_MBX;
return ret_val; return mbx->ops.check_for_rst(hw, mbx_id);
} }
/** /**
...@@ -145,17 +140,16 @@ static s32 ixgbe_poll_for_msg(struct ixgbe_hw *hw, u16 mbx_id) ...@@ -145,17 +140,16 @@ static s32 ixgbe_poll_for_msg(struct ixgbe_hw *hw, u16 mbx_id)
int countdown = mbx->timeout; int countdown = mbx->timeout;
if (!countdown || !mbx->ops.check_for_msg) if (!countdown || !mbx->ops.check_for_msg)
goto out; return IXGBE_ERR_MBX;
while (countdown && mbx->ops.check_for_msg(hw, mbx_id)) { while (mbx->ops.check_for_msg(hw, mbx_id)) {
countdown--; countdown--;
if (!countdown) if (!countdown)
break; return IXGBE_ERR_MBX;
udelay(mbx->usec_delay); udelay(mbx->usec_delay);
} }
out: return 0;
return countdown ? 0 : IXGBE_ERR_MBX;
} }
/** /**
...@@ -171,17 +165,16 @@ static s32 ixgbe_poll_for_ack(struct ixgbe_hw *hw, u16 mbx_id) ...@@ -171,17 +165,16 @@ static s32 ixgbe_poll_for_ack(struct ixgbe_hw *hw, u16 mbx_id)
int countdown = mbx->timeout; int countdown = mbx->timeout;
if (!countdown || !mbx->ops.check_for_ack) if (!countdown || !mbx->ops.check_for_ack)
goto out; return IXGBE_ERR_MBX;
while (countdown && mbx->ops.check_for_ack(hw, mbx_id)) { while (mbx->ops.check_for_ack(hw, mbx_id)) {
countdown--; countdown--;
if (!countdown) if (!countdown)
break; return IXGBE_ERR_MBX;
udelay(mbx->usec_delay); udelay(mbx->usec_delay);
} }
out: return 0;
return countdown ? 0 : IXGBE_ERR_MBX;
} }
/** /**
...@@ -198,18 +191,17 @@ static s32 ixgbe_read_posted_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size, ...@@ -198,18 +191,17 @@ static s32 ixgbe_read_posted_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size,
u16 mbx_id) u16 mbx_id)
{ {
struct ixgbe_mbx_info *mbx = &hw->mbx; struct ixgbe_mbx_info *mbx = &hw->mbx;
s32 ret_val = IXGBE_ERR_MBX; s32 ret_val;
if (!mbx->ops.read) if (!mbx->ops.read)
goto out; return IXGBE_ERR_MBX;
ret_val = ixgbe_poll_for_msg(hw, mbx_id); ret_val = ixgbe_poll_for_msg(hw, mbx_id);
if (ret_val)
return ret_val;
/* if ack received read message, otherwise we timed out */ /* if ack received read message */
if (!ret_val) return mbx->ops.read(hw, msg, size, mbx_id);
ret_val = mbx->ops.read(hw, msg, size, mbx_id);
out:
return ret_val;
} }
/** /**
...@@ -226,33 +218,31 @@ static s32 ixgbe_write_posted_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size, ...@@ -226,33 +218,31 @@ static s32 ixgbe_write_posted_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size,
u16 mbx_id) u16 mbx_id)
{ {
struct ixgbe_mbx_info *mbx = &hw->mbx; struct ixgbe_mbx_info *mbx = &hw->mbx;
s32 ret_val = IXGBE_ERR_MBX; s32 ret_val;
/* exit if either we can't write or there isn't a defined timeout */ /* exit if either we can't write or there isn't a defined timeout */
if (!mbx->ops.write || !mbx->timeout) if (!mbx->ops.write || !mbx->timeout)
goto out; return IXGBE_ERR_MBX;
/* send msg */ /* send msg */
ret_val = mbx->ops.write(hw, msg, size, mbx_id); ret_val = mbx->ops.write(hw, msg, size, mbx_id);
if (ret_val)
return ret_val;
/* if msg sent wait until we receive an ack */ /* if msg sent wait until we receive an ack */
if (!ret_val) return ixgbe_poll_for_ack(hw, mbx_id);
ret_val = ixgbe_poll_for_ack(hw, mbx_id);
out:
return ret_val;
} }
static s32 ixgbe_check_for_bit_pf(struct ixgbe_hw *hw, u32 mask, s32 index) static s32 ixgbe_check_for_bit_pf(struct ixgbe_hw *hw, u32 mask, s32 index)
{ {
u32 mbvficr = IXGBE_READ_REG(hw, IXGBE_MBVFICR(index)); u32 mbvficr = IXGBE_READ_REG(hw, IXGBE_MBVFICR(index));
s32 ret_val = IXGBE_ERR_MBX;
if (mbvficr & mask) { if (mbvficr & mask) {
ret_val = 0;
IXGBE_WRITE_REG(hw, IXGBE_MBVFICR(index), mask); IXGBE_WRITE_REG(hw, IXGBE_MBVFICR(index), mask);
return 0;
} }
return ret_val; return IXGBE_ERR_MBX;
} }
/** /**
...@@ -264,17 +254,16 @@ static s32 ixgbe_check_for_bit_pf(struct ixgbe_hw *hw, u32 mask, s32 index) ...@@ -264,17 +254,16 @@ static s32 ixgbe_check_for_bit_pf(struct ixgbe_hw *hw, u32 mask, s32 index)
**/ **/
static s32 ixgbe_check_for_msg_pf(struct ixgbe_hw *hw, u16 vf_number) static s32 ixgbe_check_for_msg_pf(struct ixgbe_hw *hw, u16 vf_number)
{ {
s32 ret_val = IXGBE_ERR_MBX;
s32 index = IXGBE_MBVFICR_INDEX(vf_number); s32 index = IXGBE_MBVFICR_INDEX(vf_number);
u32 vf_bit = vf_number % 16; u32 vf_bit = vf_number % 16;
if (!ixgbe_check_for_bit_pf(hw, IXGBE_MBVFICR_VFREQ_VF1 << vf_bit, if (!ixgbe_check_for_bit_pf(hw, IXGBE_MBVFICR_VFREQ_VF1 << vf_bit,
index)) { index)) {
ret_val = 0;
hw->mbx.stats.reqs++; hw->mbx.stats.reqs++;
return 0;
} }
return ret_val; return IXGBE_ERR_MBX;
} }
/** /**
...@@ -286,17 +275,16 @@ static s32 ixgbe_check_for_msg_pf(struct ixgbe_hw *hw, u16 vf_number) ...@@ -286,17 +275,16 @@ static s32 ixgbe_check_for_msg_pf(struct ixgbe_hw *hw, u16 vf_number)
**/ **/
static s32 ixgbe_check_for_ack_pf(struct ixgbe_hw *hw, u16 vf_number) static s32 ixgbe_check_for_ack_pf(struct ixgbe_hw *hw, u16 vf_number)
{ {
s32 ret_val = IXGBE_ERR_MBX;
s32 index = IXGBE_MBVFICR_INDEX(vf_number); s32 index = IXGBE_MBVFICR_INDEX(vf_number);
u32 vf_bit = vf_number % 16; u32 vf_bit = vf_number % 16;
if (!ixgbe_check_for_bit_pf(hw, IXGBE_MBVFICR_VFACK_VF1 << vf_bit, if (!ixgbe_check_for_bit_pf(hw, IXGBE_MBVFICR_VFACK_VF1 << vf_bit,
index)) { index)) {
ret_val = 0;
hw->mbx.stats.acks++; hw->mbx.stats.acks++;
return 0;
} }
return ret_val; return IXGBE_ERR_MBX;
} }
/** /**
...@@ -311,7 +299,6 @@ static s32 ixgbe_check_for_rst_pf(struct ixgbe_hw *hw, u16 vf_number) ...@@ -311,7 +299,6 @@ static s32 ixgbe_check_for_rst_pf(struct ixgbe_hw *hw, u16 vf_number)
u32 reg_offset = (vf_number < 32) ? 0 : 1; u32 reg_offset = (vf_number < 32) ? 0 : 1;
u32 vf_shift = vf_number % 32; u32 vf_shift = vf_number % 32;
u32 vflre = 0; u32 vflre = 0;
s32 ret_val = IXGBE_ERR_MBX;
switch (hw->mac.type) { switch (hw->mac.type) {
case ixgbe_mac_82599EB: case ixgbe_mac_82599EB:
...@@ -325,12 +312,12 @@ static s32 ixgbe_check_for_rst_pf(struct ixgbe_hw *hw, u16 vf_number) ...@@ -325,12 +312,12 @@ static s32 ixgbe_check_for_rst_pf(struct ixgbe_hw *hw, u16 vf_number)
} }
if (vflre & (1 << vf_shift)) { if (vflre & (1 << vf_shift)) {
ret_val = 0;
IXGBE_WRITE_REG(hw, IXGBE_VFLREC(reg_offset), (1 << vf_shift)); IXGBE_WRITE_REG(hw, IXGBE_VFLREC(reg_offset), (1 << vf_shift));
hw->mbx.stats.rsts++; hw->mbx.stats.rsts++;
return 0;
} }
return ret_val; return IXGBE_ERR_MBX;
} }
/** /**
...@@ -342,7 +329,6 @@ static s32 ixgbe_check_for_rst_pf(struct ixgbe_hw *hw, u16 vf_number) ...@@ -342,7 +329,6 @@ static s32 ixgbe_check_for_rst_pf(struct ixgbe_hw *hw, u16 vf_number)
**/ **/
static s32 ixgbe_obtain_mbx_lock_pf(struct ixgbe_hw *hw, u16 vf_number) static s32 ixgbe_obtain_mbx_lock_pf(struct ixgbe_hw *hw, u16 vf_number)
{ {
s32 ret_val = IXGBE_ERR_MBX;
u32 p2v_mailbox; u32 p2v_mailbox;
/* Take ownership of the buffer */ /* Take ownership of the buffer */
...@@ -351,9 +337,9 @@ static s32 ixgbe_obtain_mbx_lock_pf(struct ixgbe_hw *hw, u16 vf_number) ...@@ -351,9 +337,9 @@ static s32 ixgbe_obtain_mbx_lock_pf(struct ixgbe_hw *hw, u16 vf_number)
/* reserve mailbox for vf use */ /* reserve mailbox for vf use */
p2v_mailbox = IXGBE_READ_REG(hw, IXGBE_PFMAILBOX(vf_number)); p2v_mailbox = IXGBE_READ_REG(hw, IXGBE_PFMAILBOX(vf_number));
if (p2v_mailbox & IXGBE_PFMAILBOX_PFU) if (p2v_mailbox & IXGBE_PFMAILBOX_PFU)
ret_val = 0; return 0;
return ret_val; return IXGBE_ERR_MBX;
} }
/** /**
...@@ -374,7 +360,7 @@ static s32 ixgbe_write_mbx_pf(struct ixgbe_hw *hw, u32 *msg, u16 size, ...@@ -374,7 +360,7 @@ static s32 ixgbe_write_mbx_pf(struct ixgbe_hw *hw, u32 *msg, u16 size,
/* lock the mailbox to prevent pf/vf race condition */ /* lock the mailbox to prevent pf/vf race condition */
ret_val = ixgbe_obtain_mbx_lock_pf(hw, vf_number); ret_val = ixgbe_obtain_mbx_lock_pf(hw, vf_number);
if (ret_val) if (ret_val)
goto out_no_write; return ret_val;
/* flush msg and acks as we are overwriting the message buffer */ /* flush msg and acks as we are overwriting the message buffer */
ixgbe_check_for_msg_pf(hw, vf_number); ixgbe_check_for_msg_pf(hw, vf_number);
...@@ -390,9 +376,7 @@ static s32 ixgbe_write_mbx_pf(struct ixgbe_hw *hw, u32 *msg, u16 size, ...@@ -390,9 +376,7 @@ static s32 ixgbe_write_mbx_pf(struct ixgbe_hw *hw, u32 *msg, u16 size,
/* update stats */ /* update stats */
hw->mbx.stats.msgs_tx++; hw->mbx.stats.msgs_tx++;
out_no_write: return 0;
return ret_val;
} }
/** /**
...@@ -415,7 +399,7 @@ static s32 ixgbe_read_mbx_pf(struct ixgbe_hw *hw, u32 *msg, u16 size, ...@@ -415,7 +399,7 @@ static s32 ixgbe_read_mbx_pf(struct ixgbe_hw *hw, u32 *msg, u16 size,
/* lock the mailbox to prevent pf/vf race condition */ /* lock the mailbox to prevent pf/vf race condition */
ret_val = ixgbe_obtain_mbx_lock_pf(hw, vf_number); ret_val = ixgbe_obtain_mbx_lock_pf(hw, vf_number);
if (ret_val) if (ret_val)
goto out_no_read; return ret_val;
/* copy the message to the mailbox memory buffer */ /* copy the message to the mailbox memory buffer */
for (i = 0; i < size; i++) for (i = 0; i < size; i++)
...@@ -427,8 +411,7 @@ static s32 ixgbe_read_mbx_pf(struct ixgbe_hw *hw, u32 *msg, u16 size, ...@@ -427,8 +411,7 @@ static s32 ixgbe_read_mbx_pf(struct ixgbe_hw *hw, u32 *msg, u16 size,
/* update stats */ /* update stats */
hw->mbx.stats.msgs_rx++; hw->mbx.stats.msgs_rx++;
out_no_read: return 0;
return ret_val;
} }
#ifdef CONFIG_PCI_IOV #ifdef CONFIG_PCI_IOV
......
/******************************************************************************* /*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver Intel 10 Gigabit PCI Express Linux driver
Copyright(c) 1999 - 2013 Intel Corporation. Copyright(c) 1999 - 2014 Intel Corporation.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License, under the terms and conditions of the GNU General Public License,
...@@ -245,10 +245,10 @@ static int ixgbe_pci_sriov_enable(struct pci_dev *dev, int num_vfs) ...@@ -245,10 +245,10 @@ static int ixgbe_pci_sriov_enable(struct pci_dev *dev, int num_vfs)
if (pre_existing_vfs && pre_existing_vfs != num_vfs) if (pre_existing_vfs && pre_existing_vfs != num_vfs)
err = ixgbe_disable_sriov(adapter); err = ixgbe_disable_sriov(adapter);
else if (pre_existing_vfs && pre_existing_vfs == num_vfs) else if (pre_existing_vfs && pre_existing_vfs == num_vfs)
goto out; return num_vfs;
if (err) if (err)
goto err_out; return err;
/* While the SR-IOV capability structure reports total VFs to be /* While the SR-IOV capability structure reports total VFs to be
* 64 we limit the actual number that can be allocated to 63 so * 64 we limit the actual number that can be allocated to 63 so
...@@ -256,16 +256,14 @@ static int ixgbe_pci_sriov_enable(struct pci_dev *dev, int num_vfs) ...@@ -256,16 +256,14 @@ static int ixgbe_pci_sriov_enable(struct pci_dev *dev, int num_vfs)
* PF. The PCI bus driver already checks for other values out of * PF. The PCI bus driver already checks for other values out of
* range. * range.
*/ */
if (num_vfs > IXGBE_MAX_VFS_DRV_LIMIT) { if (num_vfs > IXGBE_MAX_VFS_DRV_LIMIT)
err = -EPERM; return -EPERM;
goto err_out;
}
adapter->num_vfs = num_vfs; adapter->num_vfs = num_vfs;
err = __ixgbe_enable_sriov(adapter); err = __ixgbe_enable_sriov(adapter);
if (err) if (err)
goto err_out; return err;
for (i = 0; i < adapter->num_vfs; i++) for (i = 0; i < adapter->num_vfs; i++)
ixgbe_vf_configuration(dev, (i | 0x10000000)); ixgbe_vf_configuration(dev, (i | 0x10000000));
...@@ -273,17 +271,14 @@ static int ixgbe_pci_sriov_enable(struct pci_dev *dev, int num_vfs) ...@@ -273,17 +271,14 @@ static int ixgbe_pci_sriov_enable(struct pci_dev *dev, int num_vfs)
err = pci_enable_sriov(dev, num_vfs); err = pci_enable_sriov(dev, num_vfs);
if (err) { if (err) {
e_dev_warn("Failed to enable PCI sriov: %d\n", err); e_dev_warn("Failed to enable PCI sriov: %d\n", err);
goto err_out; return err;
} }
ixgbe_sriov_reinit(adapter); ixgbe_sriov_reinit(adapter);
out:
return num_vfs; return num_vfs;
#else
err_out:
return err;
#endif
return 0; return 0;
#endif
} }
static int ixgbe_pci_sriov_disable(struct pci_dev *dev) static int ixgbe_pci_sriov_disable(struct pci_dev *dev)
...@@ -807,7 +802,7 @@ static int ixgbe_set_vf_vlan_msg(struct ixgbe_adapter *adapter, ...@@ -807,7 +802,7 @@ static int ixgbe_set_vf_vlan_msg(struct ixgbe_adapter *adapter,
if (!add && adapter->netdev->flags & IFF_PROMISC) { if (!add && adapter->netdev->flags & IFF_PROMISC) {
reg_ndx = ixgbe_find_vlvf_entry(hw, vid); reg_ndx = ixgbe_find_vlvf_entry(hw, vid);
if (reg_ndx < 0) if (reg_ndx < 0)
goto out; return err;
vlvf = IXGBE_READ_REG(hw, IXGBE_VLVF(reg_ndx)); vlvf = IXGBE_READ_REG(hw, IXGBE_VLVF(reg_ndx));
/* See if any other pools are set for this VLAN filter /* See if any other pools are set for this VLAN filter
* entry other than the PF. * entry other than the PF.
...@@ -833,8 +828,6 @@ static int ixgbe_set_vf_vlan_msg(struct ixgbe_adapter *adapter, ...@@ -833,8 +828,6 @@ static int ixgbe_set_vf_vlan_msg(struct ixgbe_adapter *adapter,
ixgbe_set_vf_vlan(adapter, add, vid, VMDQ_P(0)); ixgbe_set_vf_vlan(adapter, add, vid, VMDQ_P(0));
} }
out:
return err; return err;
} }
...@@ -951,7 +944,7 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf) ...@@ -951,7 +944,7 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf)
/* this is a message we already processed, do nothing */ /* this is a message we already processed, do nothing */
if (msgbuf[0] & (IXGBE_VT_MSGTYPE_ACK | IXGBE_VT_MSGTYPE_NACK)) if (msgbuf[0] & (IXGBE_VT_MSGTYPE_ACK | IXGBE_VT_MSGTYPE_NACK))
return retval; return 0;
/* flush the ack before we write any messages back */ /* flush the ack before we write any messages back */
IXGBE_WRITE_FLUSH(hw); IXGBE_WRITE_FLUSH(hw);
...@@ -966,7 +959,7 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf) ...@@ -966,7 +959,7 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf)
if (!adapter->vfinfo[vf].clear_to_send) { if (!adapter->vfinfo[vf].clear_to_send) {
msgbuf[0] |= IXGBE_VT_MSGTYPE_NACK; msgbuf[0] |= IXGBE_VT_MSGTYPE_NACK;
ixgbe_write_mbx(hw, msgbuf, 1, vf); ixgbe_write_mbx(hw, msgbuf, 1, vf);
return retval; return 0;
} }
switch ((msgbuf[0] & 0xFFFF)) { switch ((msgbuf[0] & 0xFFFF)) {
......
...@@ -2440,25 +2440,6 @@ typedef u32 ixgbe_link_speed; ...@@ -2440,25 +2440,6 @@ typedef u32 ixgbe_link_speed;
IXGBE_LINK_SPEED_1GB_FULL | \ IXGBE_LINK_SPEED_1GB_FULL | \
IXGBE_LINK_SPEED_10GB_FULL) IXGBE_LINK_SPEED_10GB_FULL)
/* Physical layer type */
typedef u32 ixgbe_physical_layer;
#define IXGBE_PHYSICAL_LAYER_UNKNOWN 0
#define IXGBE_PHYSICAL_LAYER_10GBASE_T 0x0001
#define IXGBE_PHYSICAL_LAYER_1000BASE_T 0x0002
#define IXGBE_PHYSICAL_LAYER_100BASE_TX 0x0004
#define IXGBE_PHYSICAL_LAYER_SFP_PLUS_CU 0x0008
#define IXGBE_PHYSICAL_LAYER_10GBASE_LR 0x0010
#define IXGBE_PHYSICAL_LAYER_10GBASE_LRM 0x0020
#define IXGBE_PHYSICAL_LAYER_10GBASE_SR 0x0040
#define IXGBE_PHYSICAL_LAYER_10GBASE_KX4 0x0080
#define IXGBE_PHYSICAL_LAYER_10GBASE_CX4 0x0100
#define IXGBE_PHYSICAL_LAYER_1000BASE_KX 0x0200
#define IXGBE_PHYSICAL_LAYER_1000BASE_BX 0x0400
#define IXGBE_PHYSICAL_LAYER_10GBASE_KR 0x0800
#define IXGBE_PHYSICAL_LAYER_10GBASE_XAUI 0x1000
#define IXGBE_PHYSICAL_LAYER_SFP_ACTIVE_DA 0x2000
/* Flow Control Data Sheet defined values /* Flow Control Data Sheet defined values
* Calculation and defines taken from 802.1bb Annex O * Calculation and defines taken from 802.1bb Annex O
*/ */
...@@ -2860,7 +2841,6 @@ struct ixgbe_mac_operations { ...@@ -2860,7 +2841,6 @@ struct ixgbe_mac_operations {
s32 (*start_hw)(struct ixgbe_hw *); s32 (*start_hw)(struct ixgbe_hw *);
s32 (*clear_hw_cntrs)(struct ixgbe_hw *); s32 (*clear_hw_cntrs)(struct ixgbe_hw *);
enum ixgbe_media_type (*get_media_type)(struct ixgbe_hw *); enum ixgbe_media_type (*get_media_type)(struct ixgbe_hw *);
u32 (*get_supported_physical_layer)(struct ixgbe_hw *);
s32 (*get_mac_addr)(struct ixgbe_hw *, u8 *); s32 (*get_mac_addr)(struct ixgbe_hw *, u8 *);
s32 (*get_san_mac_addr)(struct ixgbe_hw *, u8 *); s32 (*get_san_mac_addr)(struct ixgbe_hw *, u8 *);
s32 (*get_device_caps)(struct ixgbe_hw *, u16 *); s32 (*get_device_caps)(struct ixgbe_hw *, u16 *);
......
...@@ -49,7 +49,6 @@ struct ixgbe_mac_operations { ...@@ -49,7 +49,6 @@ struct ixgbe_mac_operations {
s32 (*start_hw)(struct ixgbe_hw *); s32 (*start_hw)(struct ixgbe_hw *);
s32 (*clear_hw_cntrs)(struct ixgbe_hw *); s32 (*clear_hw_cntrs)(struct ixgbe_hw *);
enum ixgbe_media_type (*get_media_type)(struct ixgbe_hw *); enum ixgbe_media_type (*get_media_type)(struct ixgbe_hw *);
u32 (*get_supported_physical_layer)(struct ixgbe_hw *);
s32 (*get_mac_addr)(struct ixgbe_hw *, u8 *); s32 (*get_mac_addr)(struct ixgbe_hw *, u8 *);
s32 (*stop_adapter)(struct ixgbe_hw *); s32 (*stop_adapter)(struct ixgbe_hw *);
s32 (*get_bus_info)(struct ixgbe_hw *); s32 (*get_bus_info)(struct ixgbe_hw *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment