[net-next v2 0/4]
Subsystems (3)
v2 cover [net-next v2 0/4]
Mark updates ixgbe for LER / adapter removal. He restores the HW address in the recovery path so the device is not perpetually removed, fixes up some removed state ethtool results and adds checks related to config space access.
Jacob adds support for the new SIOCGHWTSTAMP ioctl.
Mark Rustad (3):
ixgbe: Restore hw_addr in LER recovery paths
ixgbe: Fix up some ethtool results when adapter is removed
ixgbe: Check config reads for removal
Jacob Keller (1):
ixgbe: implement SIOCGHWTSTAMP ioctl
drivers/net/ethernet/intel/ixgbe/ixgbe.h | 5 +- drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c | 10 ++-- drivers/net/ethernet/intel/ixgbe/ixgbe_common.c | 16 +++--- drivers/net/ethernet/intel/ixgbe/ixgbe_common.h | 6 ++- drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 9 +++- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 68 +++++++++++++++++++++--- drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c | 23 ++++++-- 7 files changed, 111 insertions(+), 26 deletions(-)
Signature · 1 line
1.8.5.GIT
PATCH v2 1/4 ixgbe: Restore hw_addr in LER recovery paths
From: Mark Rustad <[email protected]>
The hw_addr needs to be restored in the pcie recovery path or else the device will be perpetually removed. Also restore the value in the resume path.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +4 -2
@@ -1,7 +1,7 @@/******************************************************************************* Intel 10 Gigabit PCI Express Linux driver -Copyright(c) 1999 - 2013 Intel Corporation. +Copyright(c) 1999 - 2014 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License,
@@ -67,7 +67,7 @@ static char ixgbe_default_device_descr[] =#define DRV_VERSION "3.19.1-k"const char ixgbe_driver_version[] =DRV_VERSION ;static const char ixgbe_copyright[] = -"Copyright (c) 1999-2013 Intel Corporation." ; +"Copyright (c) 1999-2014 Intel Corporation." ;static const struct ixgbe_info *ixgbe_info_tbl[] = { [board_82598] = &ixgbe_82598_info,
@@ -5508,6 +5508,7 @@ static int ixgbe_resume(struct pci_dev *pdev)struct net_device *netdev = adapter->netdev;u32 err; + adapter->hw.hw_addr = adapter->io_addr;pci_set_power_state (pdev,PCI_D0 );pci_restore_state (pdev);/*
@@ -8453,6 +8454,7 @@ static pci_ers_result_t ixgbe_io_slot_reset(struct pci_dev *pdev)e_err (probe,"Cannot re-enable PCI device after reset.\n" ); result =PCI_ERS_RESULT_DISCONNECT ; }else { + adapter->hw.hw_addr = adapter->io_addr;pci_set_master (pdev);pci_restore_state (pdev);pci_save_state (pdev);
Signature · 1 line
1.8.5.GIT
PATCH v2 2/4 ixgbe: Fix up some ethtool results when adapter is removed
In reply to Aaron BrownFrom: Mark Rustad <[email protected]>
Some ethtool tests returned apparently good results when the adapter was in a removed state. Fix that by checking for removal. This also fixes two paths that could return uninitialized memory in data[4].
--- drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +8 -1
@@ -1,7 +1,7 @@/******************************************************************************* Intel 10 Gigabit PCI Express Linux driver -Copyright(c) 1999 - 2013 Intel Corporation. +Copyright(c) 1999 - 2014 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License,
@@ -1247,6 +1247,11 @@ static int ixgbe_link_test(struct ixgbe_adapter *adapter, u64 *data)struct ixgbe_hw *hw = &adapter->hw;bool link_up;u32 link_speed =0 ; + +if (ixgbe_removed (hw->hw_addr)) { + *data =1 ; +return 1 ; + } *data =0 ; hw->mac.ops.check_link (hw, &link_speed, &link_up, true);
@@ -1969,6 +1974,7 @@ static void ixgbe_diag_test(struct net_device *netdev, data[1 ] =1 ; data[2 ] =1 ; data[3 ] =1 ; + data[4 ] =1 ; eth_test->flags |=ETH_TEST_FL_FAILED ;return ; }
@@ -1988,6 +1994,7 @@ static void ixgbe_diag_test(struct net_device *netdev, data[1 ] =1 ; data[2 ] =1 ; data[3 ] =1 ; + data[4 ] =1 ; eth_test->flags |=ETH_TEST_FL_FAILED ;clear_bit (__IXGBE_TESTING, &adapter->state);
Signature · 1 line
1.8.5.GIT
PATCH v2 3/4 ixgbe: Check config reads for removal
In reply to Aaron BrownFrom: Mark Rustad <[email protected]>
Configuration space reads should also be checked for removal. So add some checks related to config space accesses.
v2:
* Fixed indent
--- drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c | 10 +++-- drivers/net/ethernet/intel/ixgbe/ixgbe_common.c | 16 ++++--- drivers/net/ethernet/intel/ixgbe/ixgbe_common.h | 6 ++- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 58 +++++++++++++++++++++++-- 4 files changed, 75 insertions(+), 15 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c +7 -3
@@ -1,7 +1,7 @@/******************************************************************************* Intel 10 Gigabit PCI Express Linux driver -Copyright(c) 1999 - 2013 Intel Corporation. +Copyright(c) 1999 - 2014 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License,
@@ -61,6 +61,9 @@ static void ixgbe_set_pcie_completion_timeout(struct ixgbe_hw *hw)u32 gcr =IXGBE_READ_REG (hw,IXGBE_GCR );u16 pcie_devctl2; +if (ixgbe_removed (hw->hw_addr)) +return ; +/* only take action if timeout value is defaulted to 0 */ if (gcr &IXGBE_GCR_CMPL_TMOUT_MASK ) goto out;
@@ -79,8 +82,9 @@ static void ixgbe_set_pcie_completion_timeout(struct ixgbe_hw *hw)* directly in order to set the completion timeout value for * 16ms to 55ms */ -pci_read_config_word (adapter->pdev, -IXGBE_PCI_DEVICE_CONTROL2 , &pcie_devctl2); + pcie_devctl2 =ixgbe_read_pci_cfg_word (hw,IXGBE_PCI_DEVICE_CONTROL2 ); +if (ixgbe_removed (hw->hw_addr)) +return ; pcie_devctl2 |= IXGBE_PCI_DEVICE_CONTROL2_16ms;pci_write_config_word (adapter->pdev,IXGBE_PCI_DEVICE_CONTROL2 , pcie_devctl2);
drivers/net/ethernet/intel/ixgbe/ixgbe_common.c +9 -7
@@ -1,7 +1,7 @@/******************************************************************************* Intel 10 Gigabit PCI Express Linux driver -Copyright(c) 1999 - 2013 Intel Corporation. +Copyright(c) 1999 - 2014 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License,
@@ -2487,7 +2487,6 @@ static u32 ixgbe_pcie_timeout_poll(struct ixgbe_hw *hw)**/ static s32 ixgbe_disable_pcie_master (struct ixgbe_hw *hw) { -struct ixgbe_adapter *adapter = hw->back;s32 status =0 ;u32 i, poll;u16 value;
@@ -2496,7 +2495,8 @@ static s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw)IXGBE_WRITE_REG (hw,IXGBE_CTRL ,IXGBE_CTRL_GIO_DIS );/* Exit if master requests are blocked */ -if (!(IXGBE_READ_REG (hw,IXGBE_STATUS ) &IXGBE_STATUS_GIO )) +if (!(IXGBE_READ_REG (hw,IXGBE_STATUS ) &IXGBE_STATUS_GIO ) || +ixgbe_removed (hw->hw_addr)) goto out;/* Poll for master request bit to clear */
@@ -2524,8 +2524,9 @@ static s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw) poll =ixgbe_pcie_timeout_poll (hw);for (i =0 ; i < poll; i++) {udelay (100 ); -pci_read_config_word (adapter->pdev,IXGBE_PCI_DEVICE_STATUS , - &value); + value =ixgbe_read_pci_cfg_word (hw,IXGBE_PCI_DEVICE_STATUS ); +if (ixgbe_removed (hw->hw_addr)) + goto out;if (!(value &IXGBE_PCI_DEVICE_STATUS_TRANSACTION_PENDING )) goto out; }
@@ -2867,7 +2868,6 @@ san_mac_addr_clr:**/ u16 ixgbe_get_pcie_msix_count_generic (struct ixgbe_hw *hw) { -struct ixgbe_adapter *adapter = hw->back;u16 msix_count =1 ;u16 max_msix_count;u16 pcie_offset;
@@ -2886,7 +2886,9 @@ u16 ixgbe_get_pcie_msix_count_generic(struct ixgbe_hw *hw)return msix_count; } -pci_read_config_word (adapter->pdev, pcie_offset, &msix_count); + msix_count =ixgbe_read_pci_cfg_word (hw, pcie_offset); +if (ixgbe_removed (hw->hw_addr)) + msix_count =0 ; msix_count &=IXGBE_PCIE_MSIX_TBL_SZ_MASK ;/* MSI-X count is zero-based in HW */
drivers/net/ethernet/intel/ixgbe/ixgbe_common.h +5 -1
@@ -1,7 +1,7 @@/******************************************************************************* Intel 10 Gigabit PCI Express Linux driver -Copyright(c) 1999 - 2013 Intel Corporation. +Copyright(c) 1999 - 2014 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License,
@@ -128,6 +128,10 @@ s32 ixgbe_get_thermal_sensor_data_generic(struct ixgbe_hw *hw);s32 ixgbe_init_thermal_sensor_thresh_generic (struct ixgbe_hw *hw);#define IXGBE_FAILED_READ_REG 0xffffffffU +#define IXGBE_FAILED_READ_CFG_DWORD 0xffffffffU +#define IXGBE_FAILED_READ_CFG_WORD 0xffffU + +u16 ixgbe_read_pci_cfg_word (struct ixgbe_hw *hw,u32 reg);static inline bool ixgbe_removed (void __iomem *addr) {
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +54 -4
88 lines not on this page · raw message
Signature · 1 line
1.8.5.GIT
PATCH v2 4/4 ixgbe: implement SIOCGHWTSTAMP ioctl
In reply to Aaron BrownFrom: Jacob Keller <[email protected]>
This patch adds support for the new SIOCGHWTSTAMP ioctl, which enables a process to determine the current timestamp configuration. In order to implement this, store a copy of the timestamp configuration. In addition, we can remove the 'int cmd' parameter as the new set_ts_config function doesn't use it. I also fixed a typo in the function description.
-v2
* Only save the settings after validating them
--- drivers/net/ethernet/intel/ixgbe/ixgbe.h | 5 +++-- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 4 +++- drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c | 23 ++++++++++++++++++----- 3 files changed, 24 insertions(+), 8 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe.h +3 -2
@@ -765,6 +765,7 @@ struct ixgbe_adapter {struct ptp_clock_info ptp_caps;struct work_struct ptp_tx_work;struct sk_buff *ptp_tx_skb; +struct hwtstamp_config tstamp_config;unsigned long ptp_tx_start;unsigned long last_overflow_check;unsigned long last_rx_ptp_check;
@@ -957,8 +958,8 @@ static inline void ixgbe_ptp_rx_hwtstamp(struct ixgbe_ring *rx_ring, rx_ring->last_rx_timestamp = jiffies; } -int ixgbe_ptp_hwtstamp_ioctl (struct ixgbe_adapter *adapter,struct ifreq *ifr, -int cmd); +int ixgbe_ptp_set_ts_config (struct ixgbe_adapter *adapter,struct ifreq *ifr); +int ixgbe_ptp_get_ts_config (struct ixgbe_adapter *adapter,struct ifreq *ifr);void ixgbe_ptp_start_cyclecounter (struct ixgbe_adapter *adapter);void ixgbe_ptp_reset (struct ixgbe_adapter *adapter);void ixgbe_ptp_check_pps_event (struct ixgbe_adapter *adapter,u32 eicr);
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +3 -1
@@ -7197,7 +7197,9 @@ static int ixgbe_ioctl(struct net_device *netdev, struct ifreq *req, int cmd)switch (cmd) {case SIOCSHWTSTAMP : -return ixgbe_ptp_hwtstamp_ioctl (adapter, req, cmd); +return ixgbe_ptp_set_ts_config (adapter, req); +case SIOCGHWTSTAMP : +return ixgbe_ptp_get_ts_config (adapter, req);default :return mdio_mii_ioctl (&adapter->hw.phy.mdio,if_mii (req), cmd); }
drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c +18 -5
@@ -576,14 +576,21 @@ void __ixgbe_ptp_rx_hwtstamp(struct ixgbe_q_vector *q_vector, shhwtstamps->hwtstamp =ns_to_ktime (ns); } +int ixgbe_ptp_get_ts_config (struct ixgbe_adapter *adapter,struct ifreq *ifr) +{ +struct hwtstamp_config *config = &adapter->tstamp_config; + +return copy_to_user (ifr->ifr_data, config, +sizeof (*config)) ? -EFAULT :0 ; +} +/** -* ixgbe_ptp_hwtstamp_ioctl - control hardware time stamping +* ixgbe_ptp_set_ts_config - control hardware time stamping * @adapter: pointer to adapter struct * @ifreq: ioctl data -* @cmd: particular ioctl requested * * Outgoing time stamping can be enabled and disabled. Play nice and -* disable it when requested, although it shouldn't case any overhead +* disable it when requested, although it shouldn't cause any overhead * when no packet needs it. At most one packet in the queue may be * marked for time stamping, otherwise it would be impossible to tell * for sure to which packet the hardware time stamp belongs.
@@ -599,8 +606,7 @@ void __ixgbe_ptp_rx_hwtstamp(struct ixgbe_q_vector *q_vector,* Event mode. This more accurately tells the user what the hardware is going * to do anyways. */ -int ixgbe_ptp_hwtstamp_ioctl (struct ixgbe_adapter *adapter, -struct ifreq *ifr,int cmd) +int ixgbe_ptp_set_ts_config (struct ixgbe_adapter *adapter,struct ifreq *ifr) {struct ixgbe_hw *hw = &adapter->hw;struct hwtstamp_config config;
@@ -702,6 +708,10 @@ int ixgbe_ptp_hwtstamp_ioctl(struct ixgbe_adapter *adapter, regval =IXGBE_READ_REG (hw,IXGBE_TXSTMPH ); regval =IXGBE_READ_REG (hw,IXGBE_RXSTMPH ); +/* save these settings for future reference */ +memcpy (&adapter->tstamp_config, &config, +sizeof (adapter->tstamp_config)); +return copy_to_user (ifr->ifr_data, &config,sizeof (config)) ? -EFAULT :0 ; }
@@ -809,6 +819,9 @@ void ixgbe_ptp_reset(struct ixgbe_adapter *adapter)IXGBE_WRITE_REG (hw,IXGBE_SYSTIMH ,0x00000000 );IXGBE_WRITE_FLUSH (hw); +/* Reset the saved tstamp_config */ +memset (&adapter->tstamp_config,0 ,sizeof (adapter->tstamp_config)); +ixgbe_ptp_start_cyclecounter (adapter);spin_lock_irqsave (&adapter->tmreg_lock, flags);
Signature · 1 line
1.8.5.GIT
David Miller
maintainerFrom: Aaron Brown <[email protected]>
Date: Fri, 28 Feb 2014 15:48:54 -0800
Quoted 6 lines
Mark updates ixgbe for LER / adapter removal. He restores the HW address in the recovery path so the device is not perpetually removed, fixes up some removed state ethtool results and adds checks related to config space access.
Jacob adds support for the new SIOCGHWTSTAMP ioctl.
[ Note, empty subject ]
Series applied, thanks.
Quoted 11 lines · David Miller
From: Aaron Brown <[email protected]>
Date: Fri, 28 Feb 2014 15:48:54 -0800Quoted 6 lines
Mark updates ixgbe for LER / adapter removal. He restores the HW address in the recovery path so the device is not perpetually removed, fixes up some removed state ethtool results and adds checks related to config space access.
Jacob adds support for the new SIOCGHWTSTAMP ioctl.
[ Note, empty subject ]
Don't worry, Aaron will get 40 lashings for the empty subject. :-) By the way, I am back from sabbatical now.
David Miller
maintainerFrom: Jeff Kirsher <[email protected]>
Date: Mon, 3 Mar 2014 13:15:40 -0800
Quoted 1 line
By the way, I am back from sabbatical now.
Welcome back.