e1000e: Failure to write SHRA turns on PROMISC mode
authorDavid Ertman <davidx.m.ertman@intel.com>
Tue, 6 May 2014 03:50:17 +0000 (03:50 +0000)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Tue, 27 May 2014 06:53:11 +0000 (23:53 -0700)
commitb3e5bf1ff32cbc58c56675498565020460c683cd
treea66a9dd9195d1f6765c803cc5c30c3696b7a9d20
parenta0cccce2cec76568190090f7bb028916d8b3210e
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>
drivers/net/ethernet/intel/e1000e/80003es2lan.c
drivers/net/ethernet/intel/e1000e/82571.c
drivers/net/ethernet/intel/e1000e/hw.h
drivers/net/ethernet/intel/e1000e/ich8lan.c
drivers/net/ethernet/intel/e1000e/mac.c
drivers/net/ethernet/intel/e1000e/mac.h
drivers/net/ethernet/intel/e1000e/netdev.c