Skip to contentSkip to conversation

Intel Wired LAN Driver Updates 2021-03-11

GIT PULL New Tony Nguyen 2 participants 8 messages Mar 11, 2021 – Mar 12, 2021

Subsystems (3)
lore
Share & tools
lore

Tony Nguyen

author maintainer
#0 lore raw

This series contains updates to igc and e1000e drivers.

Sasha adds locking to reset task to prevent race condition for igc.

Muhammad fixes reporting of supported pause frame as well as advertised pause frame for Tx/Rx off for igc.

Andre fixes timestamp retrieval from the wrong timer for igc.

Vitaly adds locking to reset task to prevent race condition for e1000e.

Dinghao Liu adds a missed check to return on error in e1000_set_d0_lplu_state_82571.

The following are changes since commit 47142ed6c34d544ae9f0463e58d482289cbe0d46:
net: dsa: bcm_sf2: Qualify phydev->dev_flags based on port
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue 1GbE

Andre Guedes (1):
igc: Fix igc_ptp_rx_pktstamp()

Dinghao Liu (1):
e1000e: Fix error handling in e1000_set_d0_lplu_state_82571

Muhammad Husaini Zulkifli (2):
igc: Fix Pause Frame Advertising
igc: Fix Supported Pause Frame Link Setting

Sasha Neftin (1):
igc: reinit_locked() should be called with rtnl_lock

Vitaly Lifshits (1):
e1000e: add rtnl_lock() to e1000_reset_task

 drivers/net/ethernet/intel/e1000e/82571.c    |  2 +
 drivers/net/ethernet/intel/e1000e/netdev.c   |  6 +-
 drivers/net/ethernet/intel/igc/igc.h         |  2 +-
 drivers/net/ethernet/intel/igc/igc_ethtool.c |  7 +-
 drivers/net/ethernet/intel/igc/igc_main.c    |  9 +++
 drivers/net/ethernet/intel/igc/igc_ptp.c     | 72 +++++++++++---------
 6 files changed, 61 insertions(+), 37 deletions(-)
Signature · 1 line
2.26.2
author maintainer
#1 lore raw

PATCH 1/6 igc: reinit_locked() should be called with rtnl_lock

From: Sasha Neftin <[email protected]>

This commit applies to the igc_reset_task the same changes that were applied to the igb driver in commit 024a8168b749 ("igb:
reinit_locked() should be called with rtnl_lock")
and fix possible race in reset subtask.

Fixes 0507ef8a0372 ("igc: Add transmit and receive fastpath and interrupt handlers")
---
 drivers/net/ethernet/intel/igc/igc_main.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/net/ethernet/intel/igc/igc_main.c +9 -0
index 7ac9597ddb84..4d989ebc9713 100644
@@ -3831,10 +3831,19 @@ static void igc_reset_task(struct work_struct *work)
 
 	adapter = container_of(work, struct igc_adapter, reset_task);
 
+	rtnl_lock();
+	/* If we're already down or resetting, just bail */
+	if (test_bit(__IGC_DOWN, &adapter->state) ||
+	    test_bit(__IGC_RESETTING, &adapter->state)) {
+		rtnl_unlock();
+		return;
+	}
+
 	igc_rings_dump(adapter);
 	igc_regs_dump(adapter);
 	netdev_err(adapter->netdev, "Reset adapter\n");
 	igc_reinit_locked(adapter);
+	rtnl_unlock();
 }
 
 /**
Signature · 1 line
2.26.2
author maintainer
#2 lore raw

PATCH 2/6 igc: Fix Pause Frame Advertising

In reply to Tony Nguyen

From: Muhammad Husaini Zulkifli <[email protected]>

Fix Pause Frame Advertising when getting the advertisement via ethtool. Remove setting the "advertising" bit in link_ksettings during default case when Tx and Rx are in off state with Auto Negotiate off.

Below is the original output of advertisement link during Tx and Rx off:
Advertised pause frame use: Symmetric Receive-only

Expected output:
Advertised pause frame use: No

---
 drivers/net/ethernet/intel/igc/igc_ethtool.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/intel/igc/igc_ethtool.c +1 -3
index 824a6c454bca..67a4aed45fc2 100644
@@ -1725,9 +1725,7 @@ static int igc_ethtool_get_link_ksettings(struct net_device *netdev,
 						     Asym_Pause);
 		break;
 	default:
-		ethtool_link_ksettings_add_link_mode(cmd, advertising, Pause);
-		ethtool_link_ksettings_add_link_mode(cmd, advertising,
-						     Asym_Pause);
+		break;
 	}
 
 	status = pm_runtime_suspended(&adapter->pdev->dev) ?
Signature · 1 line
2.26.2
author maintainer
#3 lore raw

PATCH 3/6 igc: Fix Supported Pause Frame Link Setting

In reply to Tony Nguyen

From: Muhammad Husaini Zulkifli <[email protected]>

The Supported Pause Frame always display "No" even though the Advertised pause frame showing the correct setting based on the pause parameters via ethtool. Set bit in link_ksettings to "Supported" for Pause Frame.

Before output:
Supported pause frame use: No

Expected output:
Supported pause frame use: Symmetric

---
 drivers/net/ethernet/intel/igc/igc_ethtool.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/ethernet/intel/igc/igc_ethtool.c +3 -0
index 67a4aed45fc2..8722294ab90c 100644
@@ -1711,6 +1711,9 @@ static int igc_ethtool_get_link_ksettings(struct net_device *netdev,
 						     Autoneg);
 	}
 
+	/* Set pause flow control settings */
+	ethtool_link_ksettings_add_link_mode(cmd, supported, Pause);
+
 	switch (hw->fc.requested_mode) {
 	case igc_fc_full:
 		ethtool_link_ksettings_add_link_mode(cmd, advertising, Pause);
Signature · 1 line
2.26.2
author maintainer
#4 lore raw

PATCH 4/6 igc: Fix igc_ptp_rx_pktstamp()

In reply to Tony Nguyen

From: Andre Guedes <[email protected]>

The comment describing the timestamps layout in the packet buffer is wrong and the code is actually retrieving the timestamp in Timer 1 reference instead of Timer 0. This hasn't been a big issue so far because hardware is configured to report both timestamps using Timer 0 (see IGC_SRRCTL register configuration in igc_ptp_enable_rx_timestamp() helper). This patch fixes the comment and the code so we retrieve the timestamp in Timer 0 reference as expected.

This patch also takes the opportunity to get rid of the hw.mac.type check since it is not required.

Fixes 81b055205e8ba ("igc: Add support for RX timestamping")
---
 drivers/net/ethernet/intel/igc/igc.h     |  2 +-
 drivers/net/ethernet/intel/igc/igc_ptp.c | 72 +++++++++++++-----------
 2 files changed, 41 insertions(+), 33 deletions(-)
drivers/net/ethernet/intel/igc/igc.h +1 -1
index 5d2809dfd06a..1b08a7dc7bc4 100644
@@ -547,7 +547,7 @@ void igc_ptp_init(struct igc_adapter *adapter);
 void igc_ptp_reset(struct igc_adapter *adapter);
 void igc_ptp_suspend(struct igc_adapter *adapter);
 void igc_ptp_stop(struct igc_adapter *adapter);
-void igc_ptp_rx_pktstamp(struct igc_q_vector *q_vector, void *va,
+void igc_ptp_rx_pktstamp(struct igc_q_vector *q_vector, __le32 *va,
 			 struct sk_buff *skb);
 int igc_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr);
 int igc_ptp_get_ts_config(struct net_device *netdev, struct ifreq *ifr);
drivers/net/ethernet/intel/igc/igc_ptp.c +40 -32

86 lines not on this page · raw message

Signature · 1 line
2.26.2
author maintainer
#5 lore raw

PATCH 5/6 e1000e: add rtnl_lock() to e1000_reset_task

In reply to Tony Nguyen

From: Vitaly Lifshits <[email protected]>

A possible race condition was found in e1000_reset_task, after discovering a similar issue in igb driver via commit 024a8168b749 ("igb: reinit_locked() should be called with rtnl_lock").

Added rtnl_lock() and rtnl_unlock() to avoid this.

Fixes bc7f75fa9788 ("[E1000E]: New pci-express e1000 driver (currently for ICH9 devices only)")
---
 drivers/net/ethernet/intel/e1000e/netdev.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/e1000e/netdev.c +5 -1
index e9b82c209c2d..a0948002ddf8 100644
@@ -5974,15 +5974,19 @@ static void e1000_reset_task(struct work_struct *work)
 	struct e1000_adapter *adapter;
 	adapter = container_of(work, struct e1000_adapter, reset_task);
 
+	rtnl_lock();
 	/* don't run the task if already down */
-	if (test_bit(__E1000_DOWN, &adapter->state))
+	if (test_bit(__E1000_DOWN, &adapter->state)) {
+		rtnl_unlock();
 		return;
+	}
 
 	if (!(adapter->flags & FLAG_RESTART_NOW)) {
 		e1000e_dump(adapter);
 		e_err("Reset adapter unexpectedly\n");
 	}
 	e1000e_reinit_locked(adapter);
+	rtnl_unlock();
 }
 
 /**
Signature · 1 line
2.26.2
author maintainer
#6 lore raw

PATCH 6/6 e1000e: Fix error handling in e1000_set_d0_lplu_state_82571

In reply to Tony Nguyen

From: Dinghao Liu <[email protected]>

There is one e1e_wphy() call in e1000_set_d0_lplu_state_82571 that we have caught its return value but lack further handling. Check and terminate the execution flow just like other e1e_wphy() in this function.

Fixes bc7f75fa9788 ("[E1000E]: New pci-express e1000 driver (currently for ICH9 devices only)")
---
 drivers/net/ethernet/intel/e1000e/82571.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/intel/e1000e/82571.c +2 -0
index 88faf05e23ba..0b1e890dd583 100644
@@ -899,6 +899,8 @@ static s32 e1000_set_d0_lplu_state_82571(struct e1000_hw *hw, bool active)
 	} else {
 		data &= ~IGP02E1000_PM_D0_LPLU;
 		ret_val = e1e_wphy(hw, IGP02E1000_PHY_POWER_MGMT, data);
+		if (ret_val)
+			return ret_val;
 		/* LPLU and SmartSpeed are mutually exclusive.  LPLU is used
 		 * during Dx states where the power conservation is most
 		 * important.  During driver activity we should enable
Signature · 1 line
2.26.2
#7 lore raw
In reply to Tony Nguyen
This series was applied to netdev/net.git (refs/heads/master):

Hello:

This series was applied to netdev/net.git (refs/heads/master):

Quoted 8 lines · On Thu, 11 Mar 2021 10:09:09 -0800 you wrote:

This series contains updates to igc and e1000e drivers.

Sasha adds locking to reset task to prevent race condition for igc.

Muhammad fixes reporting of supported pause frame as well as advertised pause frame for Tx/Rx off for igc.

[...]

Here is the summary with links:
- [net,1/6] igc: reinit_locked() should be called with rtnl_lock

    https://git.kernel.org/netdev/net/c/6da262378c99
  - [net,2/6] igc: Fix Pause Frame Advertising
    https://git.kernel.org/netdev/net/c/8876529465c3
  - [net,3/6] igc: Fix Supported Pause Frame Link Setting
    https://git.kernel.org/netdev/net/c/9a4a1cdc5ab5
  - [net,4/6] igc: Fix igc_ptp_rx_pktstamp()
    https://git.kernel.org/netdev/net/c/fc9e5020971d
  - [net,5/6] e1000e: add rtnl_lock() to e1000_reset_task
    https://git.kernel.org/netdev/net/c/21f857f0321d
  - [net,6/6] e1000e: Fix error handling in e1000_set_d0_lplu_state_82571
    https://git.kernel.org/netdev/net/c/b52912b8293f

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html