Bruce Allan [Wed, 1 Feb 2012 10:53:05 +0000 (10:53 +0000)]
e1000e: pass pointer to hw struct for e1000_init_mac_params_XXX()
The e1000_init_mac_params_XXX() functions (where XXX is one of the three
MAC-family types 80003es2lan, 82571 and ich8lan) was not meant to require a
pointer to the adapter struct but does require a pointer to the hw struct.
Pass that pointer in to the functions instead.
(cherry picked from commit ec34c170da8798f521f0d40cad54580ff93cea3a) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Bruce Allan [Tue, 31 Jan 2012 07:03:02 +0000 (07:03 +0000)]
e1000e: use true/false for bool autoneg_false
v2 - replaced mac->autoneg_failed == false with !mac->autoneg_failed
(cherry picked from commit 07914ee3ccbf93ce688f1aaba15d8b01f19c5d77) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Bruce Allan [Tue, 31 Jan 2012 07:02:56 +0000 (07:02 +0000)]
e1000e: remove unnecessary parentheses
(cherry picked from commit 668018d74762741c3fe5a54f0eea1bd65dcabd7e) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Bruce Allan [Tue, 31 Jan 2012 06:37:54 +0000 (06:37 +0000)]
e1000e: remove unnecessary returns from void functions
...and convert some goto's which simply return to just return.
(cherry picked from commit fe1e980f24697edb7d4e17cd74bbeae4a0388525) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Bruce Allan [Tue, 31 Jan 2012 06:37:59 +0000 (06:37 +0000)]
e1000e: remove test that is always false
warning: comparison of unsigned expression < 0 is always false
Remove an unnecessary test that is reported when compiling driver with W=1.
The test is unnecessary because Intel wired GbE hardware older (i.e. less)
than 82571 is not supported by this driver.
(cherry picked from commit 4bcf053baf6b255e8c82c7ecd0d15954adb0379b) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Joe Jin [Thu, 17 May 2012 07:46:14 +0000 (15:46 +0800)]
e1000e: WoL fails on device ID 0x1501
PCI device ID 0x1501 has a hardware bug when the link downshifts for
whatever reason which requires a workaround. The workaround already exists
for other similar devices but is not called for 0x1501 (it should be called
for any ICH8-based device that uses a GbE PHY). There is also one other
instance when the workaround should be called - after disabling gigabit
speed when going to Sx.
(backported from commit 462d599449c1047259ec56bfdcca4f55f7a93038) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Bruce Allan [Fri, 30 Sep 2011 08:07:05 +0000 (08:07 +0000)]
e1000e: WoL can fail on 82578DM
During suspend, the PHY must be reset for workaround updates to take effect
without restarting auto-negotiation. Also, set the disable GbE and enable
Low Power Link Up (LPLU) if the EEPROM is configured to do likewise in
either D0 or non-D0a instead of just the latter.
(cherry picked from commit 03299e46c9e857b885bf66c47bebc1bcac5dba55) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
(cherry picked from commit 7ff1c8bb7c4fd81b627eedec4f30973c269fd8d8) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Bruce Allan [Tue, 31 Jan 2012 06:37:11 +0000 (06:37 +0000)]
e1000e: minor whitespace and indentation cleanup
Cleanup of some whitespace and indentation of a single code block.
(cherry picked from commit 0e15df490eef6f5080b84533dcd3068a78122768) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Bruce Allan [Tue, 31 Jan 2012 06:37:32 +0000 (06:37 +0000)]
e1000e: fix sparse warnings with -D__CHECK_ENDIAN__
(cherry picked from commit e885d762b7f73e811432f67608a6f0affa861029) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Bruce Allan [Tue, 31 Jan 2012 06:37:17 +0000 (06:37 +0000)]
e1000e: fix checkpatch warning from MINMAX test
WARNING: min() should probably be min_t(unsigned int, 4, skb->data_len)
(cherry picked from commit a2a5b3235d0dce0feaadf4e76727adea1caa6869) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Bruce Allan [Tue, 31 Jan 2012 06:37:22 +0000 (06:37 +0000)]
e1000e: cleanup - use braces in both branches of a conditional statement
(cherry picked from commit 24b706b2f4bb28c34d32f9d333d8a118215a38cc) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Bruce Allan [Tue, 31 Jan 2012 06:37:38 +0000 (06:37 +0000)]
e1000e: cleanup e1000_set_phys_id
Use the existing hw pointer.
(cherry picked from commit f23efdff77bbc1207255ccebe04771970604bbd9) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Bruce Allan [Tue, 31 Jan 2012 06:37:48 +0000 (06:37 +0000)]
e1000e: cleanup e1000_init_mac_params_82571()
Combine two switch statements into one, convert a nebulous pointer to one
that is a bit more in keeping with the rest of the driver code and cleanup
some coding style. No change in functionality, just cosmetic changes.
(cherry picked from commit 66092f59252cb53e5a997e1222ad203b78c8aa97) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Combine two switch statements into one, convert a nebulous pointer to one
that is a bit more in keeping with the rest of the driver code and remove
some dead code (there are no 80003es2lan devices with fiber). No change in
functionality, just cosmetic changes.
(cherry picked from commit e68782ed789a8e52af410368a185b3768fa64614) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
The majority of the e1000e code checks most function return values using a
test like 'if (ret_val)' or 'if (!ret_val)' but there are a few instances
of 'if (ret_val == 0)'. This patch converts the latter to the former for
consistency.
(cherry picked from commit 9e2d7657e2a8fb40f732563dffb05151ea2d7e01) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Bruce Allan [Tue, 31 Jan 2012 06:38:04 +0000 (06:38 +0000)]
e1000e: add missing initializers reported when compiling with W=1
warning: missing initializer
(cherry picked from commit f36bb6cacd3bcbab9605e06f585ee8f1ea450876) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Bruce Allan [Sun, 1 Jan 2012 16:00:03 +0000 (16:00 +0000)]
e1000e: update copyright year
(cherry picked from commit f5e261e626eb3fe07adf484aaad2ecfc757feba3) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Bruce Allan [Wed, 21 Dec 2011 09:47:10 +0000 (09:47 +0000)]
e1000e: split lib.c into three more-appropriate files
The generic lib.c file contains code relative to the various MACs, NVM and
Manageability supported by the driver. This patch splits the file into
three which are specific to those areas similar to how the PHY-specific
code is in phy.c and code specific to the 80003es2lan, 8257x, and ichX
MAC families are in their own files. The generic code that is applicable
to all MAC/PHY parts supported by the driver remains in netdev.c, param.c
and ethtool.c files. No change in functionality, just moving code
around for ease of maintenance, with some whitespace and other checkpatch
cleanups.
(cherry picked from commit fe2ddfb510f9d305a6654c7538c5c8faf326a16c) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Bruce Allan [Sat, 17 Dec 2011 08:32:57 +0000 (08:32 +0000)]
e1000e: call er16flash() instead of __er16flash()
__er16flash() is not meant to be called directly.
(cherry picked from commit c8243ee0488d9bc12995ca7ea02f651db820622e) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Bruce Allan [Fri, 16 Dec 2011 00:46:59 +0000 (00:46 +0000)]
e1000e: convert final strncpy() to strlcpy()
Convert the last instances of strncpy() to the preferred strlcpy().
(cherry picked from commit f2315bf1d1c6e9e0e05262b7910a8f1491d2d60e) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Bruce Allan [Fri, 16 Dec 2011 00:46:54 +0000 (00:46 +0000)]
e1000e: concatenate long debug strings which span multiple lines
To ease searching for debug message strings, concatenate strings that span
multiple lines even if the resulting line exceeds 80 columns; these will
not cause checkpatch warnings.
Also, add '\n' and remove unnecessary '\r' from a few debug strings.
(cherry picked from commit 434f1392ae3a3934a33d2d16987d857c97951c3d) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Bruce Allan [Fri, 16 Dec 2011 00:46:49 +0000 (00:46 +0000)]
e1000e: conditionally restart autoneg on 82577/8/9 when setting LPLU state
When setting the Low Power Link Up (LPLU, a.k.a. reverse auto-negotiation)
on 82577/8278/82579, do not restart auto-negotiation if reset of the Phy is
blocked by the Manageability Engine.
(cherry picked from commit 464c85e37e6b2d2ad4f3bea23a59408c5595db15) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Bruce Allan [Fri, 16 Dec 2011 00:46:43 +0000 (00:46 +0000)]
e1000e: increase Rx PBA to prevent dropping received packets on 82566/82567
During bi-directional stress on some 82566/82567 devices, some received
packets were dropped. Increasing the Receive Packet Buffer Allocation
resolves this.
(cherry picked from commit 7f1557e1422a4cc842af641c6716714751c06865) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Joe Jin [Thu, 17 May 2012 07:08:07 +0000 (15:08 +0800)]
e1000e: ICHx/PCHx LOMs should use LPLU setting in NVM when going to Sx
When going to Sx with an ICHx/PCH device, the default Low Power Link Up
(LPLU, a.k.a. reverse auto-negotiation) behavior should be whatever is set
in the NVM. However, the function e1000_suspend_workarounds_ich8lan()
called when going to Sx always enabled LPLU in all power states.
(backported from commit c077a9065b8d4612e4d55bd53c3563ca10d5c944) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Bruce Allan [Fri, 16 Dec 2011 00:46:33 +0000 (00:46 +0000)]
e1000e: update workaround for 82579 intermittently disabled during S0->Sx
The workaround which toggles the LANPHYPC (LAN PHY Power Control) value bit
to force the MAC-Phy interconnect into PCIe mode from SMBus mode during
driver load and resume should always be done except if PHY resets are
blocked by the Manageability Engine (ME). Previously, the toggle was done
only if PHY resets are blocked and the ME was disabled.
The rest of the patch is just indentation changes as a consequence of the
updated workaround.
(cherry picked from commit 90b82984a4ce689d7b1d7132e50bc61ac6f8b74f) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Bruce Allan [Fri, 16 Dec 2011 00:46:27 +0000 (00:46 +0000)]
e1000e: disable Early Receive DMA on ICH LOMs
Internal stress testing with jumbo frames shows the reliability of ICH9 and
ICH10D devices is improved in certain corner cases by disabling the Early
Receive feature. To reduce the performance impact caused by disabling this
feature, the packet buffer sizes and relevant flow control settings are
modified accordingly.
(cherry picked from commit 79d4e9087a6ecd6bf2103bf378bf8e0d79278b5a) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
David S. Miller [Thu, 26 Jan 2012 21:25:55 +0000 (16:25 -0500)]
e1000e: Need to include vmalloc.h
Otherwise (on sparc64):
drivers/net/e1000e/ethtool.c:657:3: error: implicit declaration of function 'vmalloc' [-Werror=implicit-function-declaration]
(cherry picked from commit c85c21ad1fe18daf26bfe8684df974d88cec50b7) Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Bruce Allan [Fri, 16 Dec 2011 00:46:22 +0000 (00:46 +0000)]
e1000e: 82574/82583 Tx hang workaround
On 82574/82583, there is a hardware bug which might cause a Tx hang when
the internal buffer is full. Setting this bit enables a hardware fix to
work around the issue.
(cherry picked from commit d6cb17d5f8015717f6963d24d52b06292a4cb40a) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Bruce Allan [Fri, 16 Dec 2011 00:46:17 +0000 (00:46 +0000)]
e1000e: use hardware default values for Transmit Control register
This code snippet is simply writing default values to the register which is
unnecessary since the values are programmed into the register by default.
There is a special case for 80003es2lan needing the Retransmit on Late
Collision bit set but that is also done in e1000_init_hw_80003es2lan().
(cherry picked from commit c550b121854eb1300148da1c2c8df6ed0dabdc66) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Bruce Allan [Fri, 16 Dec 2011 00:46:12 +0000 (00:46 +0000)]
e1000e: use default settings for Tx Inter Packet Gap timer
Use the default hardware values for TIPG except for es2lan(*). The
code that is removed in this patch is either unnecessarily writing the TIPG
register with the hardware default values for some devices (82571/2/3/4) or
writing the wrong value for others (ICH/PCH LOMs). The only change in
functionality is setting the correct default TIPG for the latter devices.
(*) The correct value for es2lan is already set properly in
e1000_init_hw_80003es2lan() and e1000_cfg_kmrn_{10_100|1000}_80003es2lan(),
and the unused flag FLAG_TIPG_MEDIUM_FOR_80003ESLAN is removed.
(cherry picked from commit 6a92f732f557401ca8cc0b16f8e8914c133cf6c6) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Bruce Allan [Fri, 16 Dec 2011 00:46:06 +0000 (00:46 +0000)]
e1000e: 82579: workaround for link drop issue
When connected to certain switches, the 82579 PHY might drop link
unexpectedly. Work around the issue by setting the Mean Square Error
higher than the hardware default.
(cherry picked from commit 4d24136c8ea03ecfdb6b8256571da8b520b92d8b) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Bruce Allan [Fri, 16 Dec 2011 00:46:01 +0000 (00:46 +0000)]
e1000e: always set transmit descriptor control registers the same
The hardware erratum workaround where the TXDCTL register must be the same
setting for both queues should always be done.
(cherry picked from commit 56032be77c7eab50e2020247ffa35ca61850503f) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Bruce Allan [Fri, 16 Dec 2011 00:45:51 +0000 (00:45 +0000)]
e1000e: re-factor ethtool get/set ring parameter
Make it more like how igb does it, with some additional error checking.
(cherry picked from commit 508da4264add2eb13bd4d32bb896e79e6f8821fc) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Joe Jin [Thu, 17 May 2012 07:02:04 +0000 (15:02 +0800)]
e1000e: pass pointer to ring struct instead of adapter struct
For ring-specific functions, pass a pointer to the ring struct instead of a
pointer to the adapter struct.
(backported from commit 55aa69854a93d7aaf123a882b0b1f93c86cf3c7e) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Joe Jin [Thu, 17 May 2012 06:58:22 +0000 (14:58 +0800)]
e1000e: add Receive Packet Steering (RPS) support
Enable RPS by default. Disallow jumbo frames when both receive checksum
and receive hashing are enabled because the hardware cannot do both IP
payload checksum (enabled when receive checksum is enabled when using
packet split which is used for jumbo frames) and provide RSS hash at the
same time.
v2: added ethtool command to query flow hashing behavior per Ben Hutchings
and changed the type of rsskey to cleanup the setting of the register
array and avoid unnecessary casts (as pointed out by Joe Perches).
The long error messages are not changed since there is nothing in
the kernel ./Documentation that suggests the preferred method for
dealing with long messages other than to never break strings; leaving
them as-is for now.
(backported from commit 70495a500d787c0c90a136acf454cb7d0eecd82e) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Joe Jin [Thu, 17 May 2012 06:55:14 +0000 (14:55 +0800)]
e1000e: convert to netdev features/hw_features API
Private rx_csum flags are now duplicate of netdev->features &
NETIF_F_RXCSUM. Remove those duplicates and use the net_device_ops
ndo_set_features. This is based on the original patch submitted by
Michał Mirosław <mirq-linux@rere.qmqm.pl>
(backported from commit dc221294719ae0f28cc260cc37edd439161088a9) Cc: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Bruce Allan [Thu, 5 Jan 2012 00:34:05 +0000 (00:34 +0000)]
e1000e: cleanup Rx checksum offload code
1) cleanup whitespace in e1000_rx_checksum() function header comment
2) do not check hardware checksum when Rx checksum is disabled
3) reduce duplicated calls to le16_to_cpu() by just using it within
e1000_rx_checksum() instead of in each call to the function
v2: use swab16 instead of le16_to_cpu & htons and corrected type for the
passed-in csum
(cherry picked from commit afd12939a09ca8f96cf8349c913dc143471c9b3c) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Bruce Allan [Fri, 16 Dec 2011 00:45:40 +0000 (00:45 +0000)]
e1000e: convert head, tail and itr_register offsets to __iomem pointers
The Tx/Rx head and tail registers and itr_register are always at known
addresses based on the __iomem address at which the PCI region (from BAR 0)
is mapped and known offsets within the region for each of these registers.
Store and use the full address rather than just the region offset to reduce
unnecessary address calculations. Also, change current u8 __iomem pointers
to void __iomem pointers.
(cherry picked from commit c5083cf6d286e4d3485eaf7904e5d60a2d9df6f5) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Bruce Allan [Fri, 16 Dec 2011 00:45:35 +0000 (00:45 +0000)]
e1000e: re-enable alternate MAC address for all devices which support it
(cherry picked from commit 7ee913562fb7937595ba97f9b9adbf294b657d5b) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Bruce Allan [Fri, 16 Dec 2011 00:45:56 +0000 (00:45 +0000)]
e1000e: default IntMode based on kernel config & available hardware support
Based on a patch from Prabhakar Kushwaha <prabhakar@freescale.com>, set
appropriate default interrupt mode dependent on whether CONFIG_PCI_MSI
is enabled in the kernel configuration and if the hardware supports
MSI-X. Set the module parameter log message accordingly.
(cherry picked from commit b6fbca2af36530ef307069cff0fe3b1f387c00a9) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Cc: Jin Qing <b24347@freescale.com> Cc: Prabhakar Kushwaha <prabhakar@freescale.com> Cc: Jin Qing <b24347@freescale.com> Cc: Kumar Gala <galak@kernel.crashing.org> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Joe Jin [Thu, 17 May 2012 05:55:15 +0000 (13:55 +0800)]
e1000e: convert to real ndo_set_rx_mode
Commit afc4b13d (net: remove use of ndo_set_multicast_list in
drivers) changed e1000e to use the ndo_set_rx_mode entry point,
but didn't implement the unicast address programming
functionality. Implement it to achieve the ability to add unicast
addresses.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(backported from commit ef9b965a1c4ebd0f0ee961dbc328e1222dc8f487)
Joe Jin [Thu, 17 May 2012 06:16:29 +0000 (14:16 +0800)]
net: introduce IFF_UNICAST_FLT private flag
Use IFF_UNICAST_FTL to find out if driver handles unicast address
filtering. In case it does not, promisc mode is entered.
Patch also fixes following drivers:
stmmac, niu: support uc filtering and yet it propagated
ndo_set_multicast_list
bna, benet, pxa168_eth, ks8851, ks8851_mll, ksz884x : has set
ndo_set_rx_mode but do not support uc filtering
Signed-off-by: Jiri Pirko <jpirko@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(backported from commit 01789349ee52e4a3faf376f1485303d9723c4f1f)
Joe Jin [Thu, 17 May 2012 05:50:36 +0000 (13:50 +0800)]
e1000e: remove use of ndo_set_multicast_list in drivers
replace it by ndo_set_rx_mode
(backported from commit afc4b13df143122f99a0eb10bfefb216c2806de0) Signed-off-by: Jiri Pirko <jpirko@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Jeff Kirsher [Thu, 3 Nov 2011 11:40:28 +0000 (11:40 +0000)]
e1000e: Convert printks to pr_<level>
Based on the original patch from Joe Perches.
Use the current logging styles.
pr_<level> conversions are now prefixed with "e1000e:"
Correct a couple of defects where the trailing NTU may have
been printed on a separate line because of an interleaving
hex_dump.
Remove unnecessary uses of KERN_CONT and use single pr_info()s
to avoid any possible output interleaving from other modules.
Coalesce formats as appropriate.
Remove an extra space from a broken across lines
coalescing of "Link Status " and " Change".
-v2 Remove changes to Copyright string
CC: Joe Perches <joe@perches.com>
(cherry picked from commit ef456f858919ef7f40217ad8a5ed4e1e27c7ae6f) Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Bruce Allan [Fri, 21 Oct 2011 04:33:47 +0000 (04:33 +0000)]
e1000e: demote a debugging WARN to a debug log message
This debugging message was recently added but it does not need to be as
alarming as a WARN.
(cherry picked from commit 34c9ef8bc66e21bdecb215b2fb7d93092468d27d) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Eric Dumazet [Thu, 13 Oct 2011 08:03:36 +0000 (08:03 +0000)]
e1000e: fix skb truesize underestimation
e1000e allocates a page per skb fragment. We must account
PAGE_SIZE increments on skb->truesize, not the actual frag length.
(cherry picked from commit 98a045d7e4a59db0865a59eea2140fe36bc7c220) Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> CC: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Commit 67fd4fcb (e1000e: convert to stats64) added the ability to update
statistics more accurately and on-demand through the net_device_ops
.ndo_get_stats64 hook, but introduced a locking bug on 82577/8/9 when
linked at half-duplex (seen on kernels with CONFIG_DEBUG_ATOMIC_SLEEP=y and
CONFIG_PROVE_LOCKING=y). The commit introduced code paths that caused a
mutex to be locked in atomic contexts, e.g. an rcu_read_lock is held when
irqbalance reads the stats from /sys/class/net/ethX/statistics causing the
mutex to be locked to read the Phy half-duplex statistics registers.
The mutex was originally introduced to prevent concurrent accesses of
resources (the NVM and Phy) shared by the driver, firmware and hardware
a few years back when there was an issue with the NVM getting corrupted.
It was later split into two mutexes - one for the NVM and one for the Phy
when it was determined the NVM, unlike the Phy, should not be protected by
the software/firmware/hardware semaphore (arbitration of which is done in
part with the SWFLAG bit in the EXTCNF_CTRL register). This latter
semaphore should be sufficient to prevent resource contention of the Phy in
the driver (i.e. the mutex for Phy accesses is not needed), but to be sure
the mutex is replaced with an atomic bit flag which will warn if any
contention is possible.
Also add additional debug output to help determine when the sw/fw/hw
semaphore is owned by the firmware or hardware.
(cherry picked from commit a90b412cb8c7ccc1689f9ea130883d00a1f0a5bb) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Reported-by: Francois Romieu <romieu@fr.zoreil.com> Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Bruce Allan [Fri, 30 Sep 2011 08:07:00 +0000 (08:07 +0000)]
e1000e: bad short packets received when jumbos enabled on 82579
When short packets are received with jumbos enabled on 82579, they can be
interpreted to have a receive address that does not match any configured
address. This is due to a hardware bug that can be worked around by
reducing the number of IPG octets added when the packet is transferred from
the PHY to the MAC.
(cherry picked from commit b64e9dd5d04561c2cee7e9d9d70bd6d45cc01e7c) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Joe Jin [Thu, 17 May 2012 05:33:45 +0000 (13:33 +0800)]
e1000e: convert driver to use extended descriptors
Some features currently not supported by the driver (e.g. RSS) require the
use of extended descriptors, but the driver is setup to only use legacy
descriptors in all modes except for when jumbo frames are enabled on some
parts. Convert the driver to always use extended descriptors in order to
enable the forthcoming support of these other features.
(backported from commit 5f450212f281272f4ef81d96b79bf68cebdbc210) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Joe Jin [Thu, 17 May 2012 05:27:55 +0000 (13:27 +0800)]
drivers/net: Add module.h to drivers who were implicitly using it
The device.h header was including module.h, making it present for
most of these drivers. But we want to clean that up. Call out the
include of module.h in the modular network drivers.
Bruce Allan [Tue, 29 Nov 2011 08:09:19 +0000 (08:09 +0000)]
e1000e: hitting BUG_ON() from napi_enable
Based on a patch from Mike McElroy created against the out-of-tree e1000e
driver:
Hitting the BUG_ON in napi_enable(). Code inspection shows that this can
only be triggered by calling napi_enable() twice without an intervening
napi_disable().
I saw the following sequence of events in the stack trace:
1) We simulated a cable pull using an Extreme switch.
2) e1000_tx_timeout() was entered.
3) e1000_reset_task() was called. Saw the message from e_err() in the
console log.
4) e1000_reinit_locked was called. This function calls e1000_down() and
e1000_up(). These functions call napi_disable() and napi_enable()
respectively.
5) Then on another thread, a monitor task saw carrier was down and executed
'ip set link down' and 'ip set link up' commands.
6) Saw the '_E1000_RESETTING'warning fron the e1000_close function.
7) Either the e1000_open() executed between the e1000_down() and e1000_up()
calls in step 4 or the e1000_open() call executed after the e1000_up()
call. In either case, napi_enable() is called twice which triggers the
BUG_ON.
(cherry picked from commit 5f4a780ddd453c4918555fed9d9c5f2d455a087d) Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Cc: Mike McElroy <mike.mcelroy@stratus.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Andrei Emeltchenko [Sun, 25 Mar 2012 17:49:25 +0000 (17:49 +0000)]
e1000: Silence sparse warnings by correcting type
Silence sparse warnings shown below:
...
drivers/net/e1000/e1000_main.c:3435:17: warning:
cast to restricted __le64
drivers/net/e1000/e1000_main.c:3435:17: warning:
cast to restricted __le64
...
(cherry picked from commit dd7f5c9e5cb24f72140206d3e5961b4cc5a84034) Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Tushar Dave [Fri, 10 Feb 2012 08:06:36 +0000 (08:06 +0000)]
v2 e1000: Neaten e1000_dump function
Use pr_<level> for printk
Use temporary instead of multiple pr_conts
Coalesce formats.
Save a few bytes of object code too:
$ size drivers/net/e1000/e1000_main.o*
text data bss dec hex filename
60507 369 14120 74996 124f4
drivers/net/e1000/e1000_main.o.new
60717 369 14176 75262 125fe
drivers/net/e1000/e1000_main.o.old
Removed printing of pktdata.
(cherry picked from commit e29b5d8f0896bfe908c0036f2614a89e71bdf42c) Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Tushar Dave <tushar.n.dave@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Joe Perches [Fri, 10 Feb 2012 12:07:36 +0000 (12:07 +0000)]
e1000: Neaten e1000_config_dsp_after_link_change
Separate a complicated bit of e1000_config_dsp_after_link_change
into a new static function e1000_1000Mb_check_cable_length.
Reduces indentation and adds a bit of clarity.
(cherry picked from commit 542c3f4ea90fb6de47cce13df1da9ed9b1563981) Signed-off-by: Joe Perches <joe@perches.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Joe Jin [Thu, 17 May 2012 04:49:16 +0000 (12:49 +0800)]
e1000: fix vlan processing regression
This patch fixes a regression introduced by commit "e1000: do vlan
cleanup (799d531)".
Apparently some e1000 chips (not mine) are sensitive about the order of
setting vlan filter and vlan stripping/inserting functionality. So this
patch changes the order so it's the same as before vlan cleanup.
Reported-by: Ben Greear <greearb@candelatech.com>
(backported from commit 52f5509fe8ccb607ff9b84ad618f244262336475) Signed-off-by: Jiri Pirko <jpirko@redhat.com> Tested-by: Ben Greear <greearb@candelatech.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
CC: stable@vger.stable.org Reported-by: Tobias Klausmann <klausman@schwarzvogel.de>
(cherry picked from commit b868179c47e9e8eadcd04c1f3105998e528988a3) Signed-off-by: Dean Nelson <dnelson@redhat.com> Tested-by: Tobias Klausmann <klausman@schwarzvogel.de> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Tushar Dave [Fri, 27 Jan 2012 09:00:46 +0000 (09:00 +0000)]
e1000: Adding e1000_dump function
When TX hang occurs e1000_dump prints TX ring, RX ring and Device registers.
(cherry picked from commit b04e36bac5075ceeacf11b639fbf0cb69aa68996) Signed-off-by: Tushar Dave <tushar.n.dave@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Dean Nelson [Fri, 16 Sep 2011 16:52:54 +0000 (16:52 +0000)]
e1000: don't enable dma receives until after dma address has been setup
Doing an 'ifconfig ethN down' followed by an 'ifconfig ethN up' on a qemu-kvm
guest system configured with two e1000 NICs can result in an 'unable to handle
kernel paging request at 0000000100000000' or 'bad page map in process ...' or
something similar.
These result from a 4096-byte page being corrupted with the following two-word
pattern (16-bytes) repeated throughout the entire page:
0x0000000000000000
0x0000000100000000
There can be other bits set as well. What is a constant is that the 2nd word
has the 32nd bit set. So one could see:
Which came from from a process' page table I dumped out when the marked line
was seen as bad by print_bad_pte().
The repeating pattern represents the e1000's two-word receive descriptor:
struct e1000_rx_desc {
__le64 buffer_addr; /* Address of the descriptor's data buffer */
__le16 length; /* Length of data DMAed into data buffer */
__le16 csum; /* Packet checksum */
u8 status; /* Descriptor status */
u8 errors; /* Descriptor Errors */
__le16 special;
};
And the 32nd bit of the 2nd word maps to the 'u8 status' member, and
corresponds to E1000_RXD_STAT_DD which indicates the descriptor is done.
The corruption appears to result from the following...
. An 'ifconfig ethN down' gets us into e1000_close(), which through a number
of subfunctions results in:
1. E1000_RCTL_EN being cleared in RCTL register. [e1000_down()]
2. dma_free_coherent() being called. [e1000_free_rx_resources()]
. An 'ifconfig ethN up' gets us into e1000_open(), which through a number of
subfunctions results in:
1. dma_alloc_coherent() being called. [e1000_setup_rx_resources()]
2. E1000_RCTL_EN being set in RCTL register. [e1000_setup_rctl()]
3. E1000_RCTL_EN being cleared in RCTL register. [e1000_configure_rx()]
4. RDLEN, RDBAH and RDBAL registers being set to reflect the dma page
allocated in step 1. [e1000_configure_rx()]
5. E1000_RCTL_EN being set in RCTL register. [e1000_configure_rx()]
During the 'ifconfig ethN up' there is a window opened, starting in step 2
where the receives are enabled up until they are disabled in step 3, in which
the address of the receive descriptor dma page known by the NIC is still the
previous one which was freed during the 'ifconfig ethN down'. If this memory
has been reallocated for some other use and the NIC feels so inclined, it will
write to that former dma page with predictably unpleasant results.
I realize that in the guest, we're dealing with an e1000 NIC that is software
emulated by qemu-kvm. The problem doesn't appear to occur on bare-metal. Andy
suspects that this is because in the emulator link-up is essentially instant
and traffic can start flowing immediately. Whereas on bare-metal, link-up
usually seems to take at least a few milliseconds. And this might be enough
to prevent traffic from flowing into the device inside the window where
E1000_RCTL_EN is set.
So perhaps a modification needs to be made to the qemu-kvm e1000 NIC emulator
to delay the link-up. But in defense of the emulator, it seems like a bad idea
to enable dma operations before the address of the memory to be involved has
been made known.
The following patch no longer enables receives in e1000_setup_rctl() but leaves
them however they were. It only enables receives in e1000_configure_rx(), and
only after the dma address has been made known to the hardware.
There are two places where e1000_setup_rctl() gets called. The one in
e1000_configure() is followed immediately by a call to e1000_configure_rx(), so
there's really no change functionally (except for the removal of the problem
window. The other is in __e1000_shutdown() and is not followed by a call to
e1000_configure_rx(), so there is a change functionally. But consider...
. An 'ifconfig ethN down' (just as described above).
. A 'suspend' of the system, which (I'm assuming) will find its way into
e1000_suspend() which calls __e1000_shutdown() resulting in:
1. E1000_RCTL_EN being set in RCTL register. [e1000_setup_rctl()]
And again we've re-opened the problem window for some unknown amount of time.
(cherry picked from commit d5bc77a223b0e9b9dfb002048d2b34a79e7d0b48) Signed-off-by: Andy Gospodarek <andy@greyhouse.net> Signed-off-by: Dean Nelson <dnelson@redhat.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Dean Nelson [Thu, 25 Aug 2011 14:39:24 +0000 (14:39 +0000)]
e1000: save skb counts in TX to avoid cache misses
Virtual Machines with emulated e1000 network adapter running on Parallels'
server were seeing kernel panics due to the e1000 driver dereferencing an
unexpected NULL pointer retrieved from buffer_info->skb.
The problem has been addressed for the e1000e driver, but not for the e1000.
Since the two drivers share similar code in the affected area, a port of the
following e1000e driver commit solves the issue for the e1000 driver:
e1000e: save skb counts in TX to avoid cache misses
In e1000_tx_map, precompute number of segements and bytecounts which
are derived from fields in skb; these are stored in buffer_info. When
cleaning tx in e1000_clean_tx_irq use the values in the associated
buffer_info for statistics counting, this eliminates cache misses
on skb fields.
(cherry picked from commit 31c15a2f24ebdab14333d9bf5df49757842ae2ec) Signed-off-by: Dean Nelson <dnelson@redhat.com> Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Florian Fainelli [Wed, 4 Jan 2012 20:23:35 +0000 (20:23 +0000)]
e1000: cleanup CE4100 MDIO registers access
A global variable is currently used to hold the virtual address of the
CE4100 MDIO base register address. Store the address in the e1000_hw
structure and update macros accordingly.
(cherry picked from commit 13acde8fffc0afbe8341fe08d2c594243f905c1f) Signed-off-by: Florian Fainelli <ffainelli@freebox.fr> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Florian Fainelli [Wed, 4 Jan 2012 20:23:34 +0000 (20:23 +0000)]
e1000: unmap ce4100_gbe_mdio_base_virt in e1000_remove
We are not unmapping ce4100_gbe_mdio_base_virt in exit path in case
we are running on a CE4100 adapter, fix that.
(cherry picked from commit 1c26750c485de20a3bd68ec5d396887650b53976) Signed-off-by: Florian Fainelli <ffainelli@freebox.fr> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Jesse Brandeburg [Wed, 4 Jan 2012 20:23:33 +0000 (20:23 +0000)]
e1000: fix lockdep splat in shutdown handler
As reported by Steven Rostedt, e1000 has a lockdep splat added
during the recent merge window. The issue is that
cancel_delayed_work is called while holding our private mutex.
There is no reason that I can see to hold the mutex during pci
shutdown, it was more just paranoia that I put the mutex_lock
around the call to e1000_down.
In a quick survey lots of drivers handle locking differently when
being called by the pci layer. The assumption here is that we
don't need the mutexes' protection in this function because
the driver could not be unloaded while in the shutdown handler
which is only called at reboot or poweroff.
Reported-by: Steven Rostedt <rostedt@goodmis.org>
(cherry picked from commit 3a3847e007aae732d64d8fd1374126393e9879a3) Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com> Tested-by: Steven Rostedt <rostedt@goodmis.org> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Joe Jin <joe.jin@oracle.com>
I merely installed coccinelle, read the documentation and took credit.
(backported from commit 3db1cd5c05f35fb43eb134df6f321de4e63141f2) Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Joe Perches [Tue, 20 Sep 2011 15:32:52 +0000 (15:32 +0000)]
intel: Convert <FOO>_LENGTH_OF_ADDRESS to ETH_ALEN
Use the normal #defines not module specific ones.
(cherry picked from commit ea99d832cce7e724ba37c488e0571a00cb14d430) Signed-off-by: Joe Perches <joe@perches.com> Tested-by: Stephen Ko <stephen.s.ko@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Eric Dumazet [Thu, 13 Oct 2011 07:53:42 +0000 (07:53 +0000)]
e1000: fix skb truesize underestimation
e1000 allocates a full page per skb fragment. We must account PAGE_SIZE
increments on skb->truesize, not the actual frag length.
(cherry picked from commit ed64b3cc11502f50e1401f12e33d021592800bca) Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Jesse Brandeburg [Wed, 5 Oct 2011 07:24:51 +0000 (07:24 +0000)]
e1000: convert to private mutex from rtnl
The e1000 driver when running with lockdep could run into
some possible deadlocks between the work items acquiring
rtnl and the rtnl lock being acquired before work items
were cancelled.
Use a private mutex to make sure lock ordering isn't violated.
The private mutex is only used to protect areas not generally
covered by the rtnl lock already.
(cherry picked from commit 0ef4eedc2e98edd51cd106e1f6a27178622b7e57) Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com> CC: Thomas Gleixner <tglx@linutronix.de> CC: Tushar Dave <tushar.n.dave@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Jesse Brandeburg [Wed, 5 Oct 2011 07:24:46 +0000 (07:24 +0000)]
e1000: convert mdelay to msleep
With the previous commit, there are several functions
that are only ever called from thread context, and are
able to sleep with msleep instead of mdelay.
(cherry picked from commit 4e0d8f7d97f9150bdd07f6355e5c1486967dce79) Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com> CC: Thomas Gleixner <tglx@linutronix.de> CC: Tushar Dave <tushar.n.dave@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Jesse Brandeburg [Wed, 5 Oct 2011 07:24:41 +0000 (07:24 +0000)]
e1000: convert hardware management from timers to threads
Thomas Gleixner (tglx) reported that e1000 was delaying for many milliseconds
(using mdelay) from inside timer/interrupt context. None of these paths are
performance critical and can be moved into threads/work items. This patch
implements the work items and the next patch changes the mdelays to msleeps.
(cherry picked from commit a4010afef585b7142eb605e3a6e4210c0e1b2957) Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com> CC: Thomas Gleixner <tglx@linutronix.de> CC: Tushar Dave <tushar.n.dave@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Joe Jin [Thu, 17 May 2012 03:02:23 +0000 (11:02 +0800)]
e100: Remove alloc_etherdev error messages
alloc_etherdev has a generic OOM/unable to alloc message.
Remove the duplicative messages after alloc_etherdev calls.
(backported from commit 41de8d4cff21a2e81e3d9ff66f5f7c903f9c3ab1) Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Joe Jin [Thu, 17 May 2012 02:52:30 +0000 (10:52 +0800)]
net: Remove Intel NICs unnecessary driver assignments of ethtool_ringparam fields to zero
For e100/e1000/e1000e/igb/igbvf/ixgb/ixgbe/ixgbevf
Per comments from Ben Hutchings on a previous patch, sweep the floors
a little removing unnecessary assignments of zero to fields of struct
ethtool_ringparam in driver code supporting ethtool -g.
(backported from commit 8b0c11679fd37522d8d34a76101319a085d80912) Signed-off-by: Rick Jones <rick.jones2@hp.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Ben Greear [Fri, 17 Feb 2012 13:44:28 +0000 (13:44 +0000)]
e100: Show short v/s long rx length errors in ethtool stats.
(cherry picked from commit 6f66342c1ecd59467d4579176dd81a4e837a06ef) Signed-off-by: Ben Greear <greearb@candelatech.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Ben Greear [Fri, 17 Feb 2012 13:44:23 +0000 (13:44 +0000)]
e100: Fix rx-over-length statistics.
The old code would += the total errors every time
stats were gathered. Instead, keep a count of short-pkt
and long-pkt counters and then simply add them together
for the rx-over-length stat.
(cherry picked from commit d24d65eda97fe51f2996538148e85d309e2460e4) Signed-off-by: Ben Greear <greearb@candelatech.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Jesse Brandeburg [Sat, 22 Oct 2011 05:18:10 +0000 (05:18 +0000)]
e100: make sure vlan support isn't advertised on old adapters
e100 parts don't support vlan offload but they generally do
allow use of vlans in higher software layers via the 8021q module.
That said, there are a couple of really old revisions of e100
hardware that don't even allow the longer frame sizes
required for vlan use with standard MTU.
Use the VLAN_CHALLENGED flag to prevent vlan binding to these
devices.
Reported-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit 243559f436f26b571ea3a4e70ff082892dc58f16) Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com> CC: Michael Tokarev <mjt@tls.msk.ru> CC: David Lamparter <equinox@diac24.net> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Jason Wang [Fri, 30 Dec 2011 23:44:42 +0000 (23:44 +0000)]
8139cp: properly config rx mode after resuming
Rx mode should be reset after resming, so unconditionally updating rx
mode rather than conditionally updating based on the value we
remembered, otherwise unexpected value may be used by the nic after
resuming.
btw. I find and test this when debugging guest hibernation in qemu, as
I did not have a 8139cp card in hand, this patch is untested in a
physical 8139cp card, plase review it carefully.
(cherry picked from commit f872b237c1750221932e715da2552225afe4a95c) Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Joe Jin <joe.jin@oracle.com>
Neil Horman [Fri, 9 Mar 2012 22:50:13 +0000 (14:50 -0800)]
bnx2fc: Remove bh disable in softirq context
As with the fcoe sw transport, the bnx2fc packet handler function runs only in
softirq context. Theres no need to disable bottom halves here
Signed-off-by: Neil Horman <nhorman@tuxdriver.com> Acked-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit fc05ab74b78a9e16b0faa9f0dc3c87f3f30d3231)
Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 1101a0d87a8e336914d2f31b528748a231c375ed)
bnx2fc: NPIV ports go offline when interface is brought down & up
When there are 255 NPIV ports, and the interface is brought down & up, both
physical and NPIV ports are logged off and never logged back in. Since
discovery happens on single CPU, XID resources on that CPU will be limited,
which when exhausted the discovery fails. Increase the XID resource range to
ensure that the discovery completes successfully. Also ensure that
fc_exch_mgr_alloc() doesn't fail on the system that has lower number of CPUs.
Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 7d742f659e00f08016a4446a9134036e47f9a0cf)
Host drops sessions when flood of unsolicited LOGOs are received from the
target. Because of unsufficient PLOGI retries, upon exceeding the retry count
of 3, the target sessions are dropped. Increased the retry count to 255 to
allow sufficient retries in this scenario.
Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 44c570b5b09d1d1cc3167834f89f754f1bc5ac14)
System panics while accessing stale pointer - timer_work_queue - in the IO path
before bnx2fc_stop is called. Fix is to destroy the workqueue after the destroy
operation is complete.
Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 2a7b29c5f267c143e280c1a5174a0d930bd6c1e3)
When SRR LS_ACC is dropped, the driver was not issuing ABTS for SRR when it
times out. Since the target received SRR, it was able to send the XFER_RDY and
the the original IO request completed successfully. In this condition ABTS was
not sent during bnx2fc_srr_compl(). Fix this by first checking for ELS timeout
and issue ABTS before checking if original IO request is complete.
Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 32c30454507b4f5f00661ac12ddbcc150983b9ff)
If the IO and the corresponding ABTS are not responded by a target, cleanup the
IO and issue explicit logout when ulp timer expires while waiting for ABTS to
complete. Wait for the session to be ready before returning to the SCSI layer.
If the session is not ready let the SCSI-ml escalate the error recovery.
Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 99cc600cdd6f938633394523447378f7a43f4340)
bnx2fc: call ctlr_link_up only when the interface is enabled
Link may not be up when the driver receives ulp_start event, and hence
fcoe_ctlr_link_up is not called. Call fcoe_ctlr_link_up during
indicate_netevent only when the interface is enabled. (It has to be called when
enabled because that is an indication that the vlan discovery is completed).
Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit fd8fa9071e49a56cc91f739813ea88f16b7c1240)
Firmware asserts when the same CQE is armed twice. This scenario happens during
RSCN stress tests as driver incorrects arms the CQ after the session is
offloaded.
Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit a96e8e11635773dd88dbe1307f9482146cfe0562)
bnx2fc: Fix panic caused because of incorrect errror handling in create().
Driver incorrectly calls bnx2fc_interface_cleanup() when bnx2fc_if_create fails
which accesses bad pointer. Handle bnx2fc_if_create failure by directly calling
bnx2fc_net_cleanup.
Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 013068fa6f65f7037adedc141fbd27afc99ab1bb)
bnx2fc: Avoid calling bnx2fc_if_destroy with unnecessary locks
It is not required to hold rtnl_lock and bnx2fc_dev_lock when calling
bnx2fc_if_destroy, as the locking is only required to serialize creation and
deletion of fcoe instances. More importantly, this unnecessary locking causes
deadlock as bnx2fc_if_destroy calls fc_remove_host holding rtnl_lock.
Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 0cbf32e1681d870632a1772601cbaadd996dc978)
bnx2fc: Validate vlan id in NETDEV_UNREGISTER handler
When bnx2fc receives an UNREGISTER event on a vlan interface it calls
destroy on all interfaces that matches the physical interface. Add
vlan_id check to destroy only the vlan interface that generated the
event.
Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com> Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit 26b2982f78c1fc6f486a67271b1d0a0d305dd54b)
ABTS was not issued for timed out REC, as REC completion handler exits out if
the IO completed. Check for timed out REC and issue ABTS before proceeding with
further processing in REC completion handler. Also, initialize rec_retry and
srr_retry before starting the IO.
Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
(cherry picked from commit c1c16bd51a29eea8843f20161ddd32cddc524142)