Skip to content

Commit 7acf631

Browse files
Bernhard KaindlJeff Kirsher
authored andcommitted
igb: remove blocking phy read from inside spinlock
Remove a source of latency spikes (in my case up to 10ms) by not calling code that uses mdelay() for feeding a phy statistic (rx errors for idle symbols - not data -> idle_errors) while being called with a spinlock held. As idle_errors isn't read, this patch only removes unused code and data. Later, more complicated changes may be applied to address the spinlock and allow for some PHY diagnostics by harvesting this PHY stats register fully. This patch is designed to fix the issue and be safe for longterm/stable. For the Intel e1000e driver, the same change was applied in 2008 with commit 23033fa ("e1000e: remove phy read from inside spinlock"). The mdelay is triggered by HW/SW semaphores, thus it depends on the HW. I've HW that triggers it even when idle. Others may trigger it only e.g. when Ethernet ports aquire or loose the link or on ifconfig up / down. We've noticed this first from delays in frame rx/tx due to the mdelay(). Example command for checking if the issue is triggered: cyclictest -Smp1 (Look for occasional "Max:" values > 4000 or use -b 4000 to stop if greater) It was observed with I350 ports connected to other I350 ports, but not if driver and EEPROM was modified to run the I350 in EEPROM-less mode. phy_stats.idle_errors and .receive_errors (isn't touched) occupy 64 not used bits in the adapter struct: Their allocation may be removed as well. Cc: Carolyn Wyborny <carolyn.wyborny@intel.com> Cc: Todd Fujinaka <todd.fujinaka@intel.com> Fixes: 12dcd86 ("igb: fix stats handling") (this added the spin_lock) Signed-off-by: Bernhard Kaindl <bk-linux@use.startmail.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
1 parent 3463de1 commit 7acf631

3 files changed

Lines changed: 0 additions & 18 deletions

File tree

‎drivers/net/ethernet/intel/igb/e1000_hw.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -265,11 +265,6 @@ struct e1000_hw_stats {
265265
u64 b2ogprc;
266266
};
267267

268-
struct e1000_phy_stats {
269-
u32 idle_errors;
270-
u32 receive_errors;
271-
};
272-
273268
struct e1000_host_mng_dhcp_cookie {
274269
u32 signature;
275270
u8 status;

‎drivers/net/ethernet/intel/igb/igb.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,6 @@ struct igb_adapter {
403403
struct e1000_hw hw;
404404
struct e1000_hw_stats stats;
405405
struct e1000_phy_info phy_info;
406-
struct e1000_phy_stats phy_stats;
407406

408407
u32 test_icr;
409408
struct igb_ring test_tx_ring;

‎drivers/net/ethernet/intel/igb/igb_main.c‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5206,14 +5206,11 @@ void igb_update_stats(struct igb_adapter *adapter,
52065206
struct e1000_hw *hw = &adapter->hw;
52075207
struct pci_dev *pdev = adapter->pdev;
52085208
u32 reg, mpc;
5209-
u16 phy_tmp;
52105209
int i;
52115210
u64 bytes, packets;
52125211
unsigned int start;
52135212
u64 _bytes, _packets;
52145213

5215-
#define PHY_IDLE_ERROR_COUNT_MASK 0x00FF
5216-
52175214
/* Prevent stats update while adapter is being reset, or if the pci
52185215
* connection is down.
52195216
*/
@@ -5374,15 +5371,6 @@ void igb_update_stats(struct igb_adapter *adapter,
53745371

53755372
/* Tx Dropped needs to be maintained elsewhere */
53765373

5377-
/* Phy Stats */
5378-
if (hw->phy.media_type == e1000_media_type_copper) {
5379-
if ((adapter->link_speed == SPEED_1000) &&
5380-
(!igb_read_phy_reg(hw, PHY_1000T_STATUS, &phy_tmp))) {
5381-
phy_tmp &= PHY_IDLE_ERROR_COUNT_MASK;
5382-
adapter->phy_stats.idle_errors += phy_tmp;
5383-
}
5384-
}
5385-
53865374
/* Management Stats */
53875375
adapter->stats.mgptc += rd32(E1000_MGTPTC);
53885376
adapter->stats.mgprc += rd32(E1000_MGTPRC);

0 commit comments

Comments
 (0)