aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/e1000e/netdev.c
diff options
context:
space:
mode:
authorDavid Ertman <davidx.m.ertman@intel.com>2014-05-05 23:50:17 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2014-05-27 02:53:11 -0400
commitb3e5bf1ff32cbc58c56675498565020460c683cd (patch)
treea66a9dd9195d1f6765c803cc5c30c3696b7a9d20 /drivers/net/ethernet/intel/e1000e/netdev.c
parenta0cccce2cec76568190090f7bb028916d8b3210e (diff)
e1000e: Failure to write SHRA turns on PROMISC mode
Previously, the check to turn on promiscuous mode only took into account the total number of SHared Receive Address (SHRA) registers and if the request was for a register within that range. It is possible that the Management Engine might have locked a number of SHRA and not allowed a new address to be written to the requested register. Add a function to determine the number of unlocked SHRA registers. Then determine if the number of registers available is sufficient for our needs, if not then return -ENOMEM so that UNICAST PROMISC mode is activated. Since the method by which ME claims SHRA registers is non-deterministic, also add a return value to the function attempting to write an address to a SHRA, and return a -E1000_ERR_CONFIG if the write fails. The error will be passed up the function chain and allow the driver to also set UNICAST PROMISC when this happens. Cc: Vlad Yasevich <vyasevic@redhat.com> Signed-off-by: Dave Ertman <davidx.m.ertman@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/e1000e/netdev.c')
-rw-r--r--drivers/net/ethernet/intel/e1000e/netdev.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index e4207efd13f8..6084e6ba45c2 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -3311,9 +3311,11 @@ static int e1000e_write_uc_addr_list(struct net_device *netdev)
3311{ 3311{
3312 struct e1000_adapter *adapter = netdev_priv(netdev); 3312 struct e1000_adapter *adapter = netdev_priv(netdev);
3313 struct e1000_hw *hw = &adapter->hw; 3313 struct e1000_hw *hw = &adapter->hw;
3314 unsigned int rar_entries = hw->mac.rar_entry_count; 3314 unsigned int rar_entries;
3315 int count = 0; 3315 int count = 0;
3316 3316
3317 rar_entries = hw->mac.ops.rar_get_count(hw);
3318
3317 /* save a rar entry for our hardware address */ 3319 /* save a rar entry for our hardware address */
3318 rar_entries--; 3320 rar_entries--;
3319 3321
@@ -3332,9 +3334,13 @@ static int e1000e_write_uc_addr_list(struct net_device *netdev)
3332 * combining 3334 * combining
3333 */ 3335 */
3334 netdev_for_each_uc_addr(ha, netdev) { 3336 netdev_for_each_uc_addr(ha, netdev) {
3337 int rval;
3338
3335 if (!rar_entries) 3339 if (!rar_entries)
3336 break; 3340 break;
3337 hw->mac.ops.rar_set(hw, ha->addr, rar_entries--); 3341 rval = hw->mac.ops.rar_set(hw, ha->addr, rar_entries--);
3342 if (rval < 0)
3343 return -ENOMEM;
3338 count++; 3344 count++;
3339 } 3345 }
3340 } 3346 }