From: Tony Nguyen <anthony.l.nguyen@intel.com> Date: 2021-03-11 18:08:56
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(-)
--
2.26.2
From: Tony Nguyen <anthony.l.nguyen@intel.com> Date: 2021-03-11 18:08:55
From: Sasha Neftin <redacted>
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")
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Neftin <redacted>
Tested-by: Dvora Fuxbrumer <redacted>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
drivers/net/ethernet/intel/igc/igc_main.c | 9 +++++++++
1 file changed, 9 insertions(+)
@@ -3831,10 +3831,19 @@ static void igc_reset_task(struct work_struct *work)adapter=container_of(work,structigc_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();}/**
From: Tony Nguyen <anthony.l.nguyen@intel.com> Date: 2021-03-11 18:08:55
From: Andre Guedes <redacted>
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")
Signed-off-by: Andre Guedes <redacted>
Signed-off-by: Vedang Patel <redacted>
Signed-off-by: Jithu Joseph <redacted>
Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Tested-by: Dvora Fuxbrumer <redacted>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
drivers/net/ethernet/intel/igc/igc.h | 2 +-
drivers/net/ethernet/intel/igc/igc_ptp.c | 72 +++++++++++++-----------
2 files changed, 41 insertions(+), 33 deletions(-)
@@ -152,46 +152,54 @@ static void igc_ptp_systim_to_hwtstamp(struct igc_adapter *adapter,}/**-*igc_ptp_rx_pktstamp-retrieveRxperpackettimestamp+*igc_ptp_rx_pktstamp-RetrievetimestampfromRxpacketbuffer*@q_vector:Pointertointerruptspecificstructure*@va:PointertoaddresscontainingRxbuffer*@skb:Buffercontainingtimestampandpacket*-*Thisfunctionismeanttoretrievethefirsttimestampfromthe-*firstbufferofanincomingframe.Thevalueisstoredinlittle-*endianformatstartingonbyte0.There'sasecondtimestamp-*startingonbyte8.-**/-voidigc_ptp_rx_pktstamp(structigc_q_vector*q_vector,void*va,+*Thisfunctionretrievesthetimestampsavedinthebeginningofpacket+*buffer.Whiletwotimestampsareavailable,oneintimer0referenceandthe+*otherintimer1reference,thisfunctionconsidersonlythetimestampin+*timer0reference.+*/+voidigc_ptp_rx_pktstamp(structigc_q_vector*q_vector,__le32*va,structsk_buff*skb){structigc_adapter*adapter=q_vector->adapter;-__le64*regval=(__le64*)va;-intadjust=0;--/* The timestamp is recorded in little endian format.-*DWORD:|0|1|2|3-*Field:|Timer0Low|Timer0High|Timer1Low|Timer1High+u64regval;+intadjust;++/* Timestamps are saved in little endian at the beginning of the packet+*bufferfollowingthelayout:+*+*DWORD:|0|1|2|3|+*Field:|Timer1SYSTIML|Timer1SYSTIMH|Timer0SYSTIML|Timer0SYSTIMH|+*+*SYSTIMLholdsthenanosecondspartwhileSYSTIMHholdstheseconds+*partofthetimestamp.*/-igc_ptp_systim_to_hwtstamp(adapter,skb_hwtstamps(skb),-le64_to_cpu(regval[0]));--/* adjust timestamp for the RX latency based on link speed */-if(adapter->hw.mac.type==igc_i225){-switch(adapter->link_speed){-caseSPEED_10:-adjust=IGC_I225_RX_LATENCY_10;-break;-caseSPEED_100:-adjust=IGC_I225_RX_LATENCY_100;-break;-caseSPEED_1000:-adjust=IGC_I225_RX_LATENCY_1000;-break;-caseSPEED_2500:-adjust=IGC_I225_RX_LATENCY_2500;-break;-}+regval=le32_to_cpu(va[2]);+regval|=(u64)le32_to_cpu(va[3])<<32;+igc_ptp_systim_to_hwtstamp(adapter,skb_hwtstamps(skb),regval);++/* Adjust timestamp for the RX latency based on link speed */+switch(adapter->link_speed){+caseSPEED_10:+adjust=IGC_I225_RX_LATENCY_10;+break;+caseSPEED_100:+adjust=IGC_I225_RX_LATENCY_100;+break;+caseSPEED_1000:+adjust=IGC_I225_RX_LATENCY_1000;+break;+caseSPEED_2500:+adjust=IGC_I225_RX_LATENCY_2500;+break;+default:+adjust=0;+netdev_warn_once(adapter->netdev,"Imprecise timestamp\n");+break;}skb_hwtstamps(skb)->hwtstamp=ktime_sub_ns(skb_hwtstamps(skb)->hwtstamp,adjust);
From: Tony Nguyen <anthony.l.nguyen@intel.com> Date: 2021-03-11 18:08:55
From: Dinghao Liu <redacted>
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)")
Signed-off-by: Dinghao Liu <redacted>
Acked-by: Sasha Neftin <redacted>
Tested-by: Dvora Fuxbrumer <redacted>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
drivers/net/ethernet/intel/e1000e/82571.c | 2 ++
1 file changed, 2 insertions(+)
From: Tony Nguyen <anthony.l.nguyen@intel.com> Date: 2021-03-11 18:08:55
From: Vitaly Lifshits <redacted>
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)")
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Vitaly Lifshits <redacted>
Tested-by: Dvora Fuxbrumer <redacted>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
drivers/net/ethernet/intel/e1000e/netdev.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
@@ -5974,15 +5974,19 @@ static void e1000_reset_task(struct work_struct *work)structe1000_adapter*adapter;adapter=container_of(work,structe1000_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();}/**
From: Tony Nguyen <anthony.l.nguyen@intel.com> Date: 2021-03-11 18:08:55
From: Muhammad Husaini Zulkifli <redacted>
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
Fixes: 8c5ad0dae93c ("igc: Add ethtool support")
Signed-off-by: Muhammad Husaini Zulkifli <redacted>
Reviewed-by: Malli C <redacted>
Tested-by: Dvora Fuxbrumer <redacted>
Acked-by: Sasha Neftin <redacted>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
drivers/net/ethernet/intel/igc/igc_ethtool.c | 3 +++
1 file changed, 3 insertions(+)
@@ -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){caseigc_fc_full:ethtool_link_ksettings_add_link_mode(cmd,advertising,Pause);
From: Tony Nguyen <anthony.l.nguyen@intel.com> Date: 2021-03-11 18:08:56
From: Muhammad Husaini Zulkifli <redacted>
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
Fixes: 8c5ad0dae93c ("igc: Add ethtool support")
Signed-off-by: Muhammad Husaini Zulkifli <redacted>
Reviewed-by: Malli C <redacted>
Acked-by: Sasha Neftin <redacted>
Tested-by: Dvora Fuxbrumer <redacted>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
drivers/net/ethernet/intel/igc/igc_ethtool.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
Hello:
This series was applied to netdev/net.git (refs/heads/master):
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.
[...]