Skip to contentSkip to conversation

Intel Wired LAN Driver Updates

PATCH In review Aaron Brown 4 participants 10 messages Feb 13, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Intel Wired LAN Driver Updates

This series contains updates to the ixgbe driver.

Don makes recovery from a HW ECC error just schedule a reset as it turns out the previous behaviour of forcing the user to reload is not necessary.

Jacob adds support for the new SIOCGHWTSTAMP ioctl, removes a magic number from the ptp_caps.name assignment and makes a warning message much more useful.

Mark add WOL support for a new part.

Don Skidmore (1):
ixgbe: modify behavior on receiving a HW ECC error.

Jacob Keller (3):
ixgbe: implement SIOCGHWTSTAMP ioctl
ixgbe: don't use magic size number to assign ptp_caps.name
ixgbe: fixup warning regarding max_vfs parameter

Mark Rustad (1):
ixgbe: Add WoL support for a new device

 drivers/net/ethernet/intel/ixgbe/ixgbe.h      |  5 ++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 37 +++++++++++++++++------
 drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c  | 43 +++++++++++++++++----------
 drivers/net/ethernet/intel/ixgbe/ixgbe_type.h |  1 +
 4 files changed, 60 insertions(+), 26 deletions(-)
Signature · 1 line
1.8.5.GIT
#1 lore raw

PATCH 1/5 ixgbe: modify behavior on receiving a HW ECC error.

From: Don Skidmore <[email protected]>

Currently when we noticed a HW ECC error we would request the use reload the driver to force a reset of the part. This was done due to the mistaken believe that a normal reset would not be sufficient. Well it turns out it would be so now we just schedule a reset upon seeing the ECC.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +12 -6
index 6d4ada7..7824559 100644
@@ -2630,9 +2630,12 @@ static irqreturn_t ixgbe_msix_other(int irq, void *data)
 	switch (hw->mac.type) {
 	case ixgbe_mac_82599EB:
 	case ixgbe_mac_X540:
-		if (eicr & IXGBE_EICR_ECC)
-			e_info(link, "Received unrecoverable ECC Err, please "
-			       "reboot\n");
+		if (eicr & IXGBE_EICR_ECC) {
+			e_info(link, "Received ECC Err, initiating reset\n");
+			adapter->flags2 |= IXGBE_FLAG2_RESET_REQUESTED;
+			ixgbe_service_event_schedule(adapter);
+			IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_ECC);
+		}
 		/* Handle Flow Director Full threshold interrupt */
 		if (eicr & IXGBE_EICR_FLOW_DIR) {
 			int reinit_count = 0;
@@ -2846,9 +2849,12 @@ static irqreturn_t ixgbe_intr(int irq, void *data)
 		ixgbe_check_sfp_event(adapter, eicr);
 		/* Fall through */
 	case ixgbe_mac_X540:
-		if (eicr & IXGBE_EICR_ECC)
-			e_info(link, "Received unrecoverable ECC err, please "
-				     "reboot\n");
+		if (eicr & IXGBE_EICR_ECC) {
+			e_info(link, "Received ECC Err, initiating reset\n");
+			adapter->flags2 |= IXGBE_FLAG2_RESET_REQUESTED;
+			ixgbe_service_event_schedule(adapter);
+			IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_ECC);
+		}
 		ixgbe_check_overtemp_event(adapter, eicr);
 		break;
 	default:
Signature · 1 line
1.8.5.GIT
#2 lore raw

PATCH 2/5 ixgbe: implement SIOCGHWTSTAMP ioctl

In reply to Aaron Brown

From: 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.

---
 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  | 35 +++++++++++++++++----------
 3 files changed, 28 insertions(+), 16 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe.h +3 -2
index 0186ea2..d7c7f13 100644
@@ -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;
@@ -958,8 +959,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
index 7824559..84ca49b 100644
@@ -7149,7 +7149,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 +22 -13
index 5184e2a..95ed8ea 100644
@@ -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,25 +606,24 @@ 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;
+	struct hwtstamp_config *config = &adapter->tstamp_config;
 	u32 tsync_tx_ctl = IXGBE_TSYNCTXCTL_ENABLED;
 	u32 tsync_rx_ctl = IXGBE_TSYNCRXCTL_ENABLED;
 	u32 tsync_rx_mtrl = PTP_EV_PORT << 16;
 	bool is_l2 = false;
 	u32 regval;
 
-	if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
+	if (copy_from_user(config, ifr->ifr_data, sizeof(*config)))
 		return -EFAULT;
 
 	/* reserved for future extensions */
-	if (config.flags)
+	if (config->flags)
 		return -EINVAL;
 
-	switch (config.tx_type) {
+	switch (config->tx_type) {
 	case HWTSTAMP_TX_OFF:
 		tsync_tx_ctl = 0;
 	case HWTSTAMP_TX_ON:
@@ -626,7 +632,7 @@ int ixgbe_ptp_hwtstamp_ioctl(struct ixgbe_adapter *adapter,
 		return -ERANGE;
 	}
 
-	switch (config.rx_filter) {
+	switch (config->rx_filter) {
 	case HWTSTAMP_FILTER_NONE:
 		tsync_rx_ctl = 0;
 		tsync_rx_mtrl = 0;
@@ -650,7 +656,7 @@ int ixgbe_ptp_hwtstamp_ioctl(struct ixgbe_adapter *adapter,
 	case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ:
 		tsync_rx_ctl |= IXGBE_TSYNCRXCTL_TYPE_EVENT_V2;
 		is_l2 = true;
-		config.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
+		config->rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
 		break;
 	case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
 	case HWTSTAMP_FILTER_ALL:
@@ -661,7 +667,7 @@ int ixgbe_ptp_hwtstamp_ioctl(struct ixgbe_adapter *adapter,
 		 * Delay_Req messages and hardware does not support
 		 * timestamping all packets => return error
 		 */
-		config.rx_filter = HWTSTAMP_FILTER_NONE;
+		config->rx_filter = HWTSTAMP_FILTER_NONE;
 		return -ERANGE;
 	}
 
@@ -702,7 +708,7 @@ int ixgbe_ptp_hwtstamp_ioctl(struct ixgbe_adapter *adapter,
 	regval = IXGBE_READ_REG(hw, IXGBE_TXSTMPH);
 	regval = IXGBE_READ_REG(hw, IXGBE_RXSTMPH);
 
-	return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ?
+	return copy_to_user(ifr->ifr_data, config, sizeof(*config)) ?
 		-EFAULT : 0;
 }
 
@@ -809,6 +815,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
#3 lore raw

Re: [net-next 2/5] ixgbe: implement SIOCGHWTSTAMP ioctl

On Thu, 2014-02-13 at 00:00 -0800, Aaron Brown wrote:
[...]

Quoted 4 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c +1 -1
+int ixgbe_ptp_set_ts_config(struct ixgbe_adapter *adapter, struct ifreq *ifr)
 {
 	struct ixgbe_hw *hw = &adapter->hw;
-	struct hwtstamp_config config;

drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c void __ixgbe_ptp_rx_hwtstamp(struct ixgbe_q_vector *q_vector, · line 620

Quoted 10 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c +2 -1
+	struct hwtstamp_config *config = &adapter->tstamp_config;
 	u32 tsync_tx_ctl = IXGBE_TSYNCTXCTL_ENABLED;
 	u32 tsync_rx_ctl = IXGBE_TSYNCRXCTL_ENABLED;
 	u32 tsync_rx_mtrl = PTP_EV_PORT << 16;
 	bool is_l2 = false;
 	u32 regval;
 
-	if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
+	if (copy_from_user(config, ifr->ifr_data, sizeof(*config)))
 		return -EFAULT;

[...]

This is wrong. You overwrite the current config before validating it.

Ben.

Signature · 2 lines
Ben Hutchings
The world is coming to an end.	Please log off.
#4 lore raw

Re: [net-next 2/5] ixgbe: implement SIOCGHWTSTAMP ioctl

Quoted 13 lines · Ben Hutchings

On Thu, 2014-02-13 at 00:00 -0800, Aaron Brown wrote:
[...]

Quoted 11 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c +2 -1
+int ixgbe_ptp_set_ts_config(struct ixgbe_adapter *adapter, struct ifreq *ifr)
 {
 	struct ixgbe_hw *hw = &adapter->hw;
-	struct hwtstamp_config config;
+	struct hwtstamp_config *config = &adapter->tstamp_config;
 	u32 tsync_tx_ctl = IXGBE_TSYNCTXCTL_ENABLED;
 	u32 tsync_rx_ctl = IXGBE_TSYNCRXCTL_ENABLED;
 	u32 tsync_rx_mtrl = PTP_EV_PORT << 16;
 	bool is_l2 = false;
 	u32 regval;
Quoted 9 lines

drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c void __ixgbe_ptp_rx_hwtstamp(struct ixgbe_q_vector *q_vector, · line 620

Quoted 3 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c +1 -1
-	if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
+	if (copy_from_user(config, ifr->ifr_data, sizeof(*config)))
 		return -EFAULT;

[...]

This is wrong. You overwrite the current config before validating it.

Ben.

Oops. Thanks for the catch. I'll respin this.

Regards,
Jake

#5 lore raw

PATCH 3/5 ixgbe: don't use magic size number to assign ptp_caps.name

In reply to Aaron Brown

From: Jacob Keller <[email protected]>

Rather than using a magic size number, just use sizeof since that will work and is more robust to future changes.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c +6 -2
index 95ed8ea..5697214 100644
@@ -849,7 +849,9 @@ void ixgbe_ptp_init(struct ixgbe_adapter *adapter)
 
 	switch (adapter->hw.mac.type) {
 	case ixgbe_mac_X540:
-		snprintf(adapter->ptp_caps.name, 16, "%s", netdev->name);
+		snprintf(adapter->ptp_caps.name,
+			 sizeof(adapter->ptp_caps.name),
+			 "%s", netdev->name);
 		adapter->ptp_caps.owner = THIS_MODULE;
 		adapter->ptp_caps.max_adj = 250000000;
 		adapter->ptp_caps.n_alarm = 0;
@@ -863,7 +865,9 @@ void ixgbe_ptp_init(struct ixgbe_adapter *adapter)
 		adapter->ptp_caps.enable = ixgbe_ptp_enable;
 		break;
 	case ixgbe_mac_82599EB:
-		snprintf(adapter->ptp_caps.name, 16, "%s", netdev->name);
+		snprintf(adapter->ptp_caps.name,
+			 sizeof(adapter->ptp_caps.name),
+			 "%s", netdev->name);
 		adapter->ptp_caps.owner = THIS_MODULE;
 		adapter->ptp_caps.max_adj = 250000000;
 		adapter->ptp_caps.n_alarm = 0;
Signature · 1 line
1.8.5.GIT
#6 lore raw

PATCH 4/5 ixgbe: Add WoL support for a new device

In reply to Aaron Brown

From: Mark Rustad <[email protected]>

Add WoL support for port 0 of a new 82599-based device.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 1 +
 drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | 1 +
 2 files changed, 2 insertions(+)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +1 -0
index 84ca49b..e65a5be 100644
@@ -7800,6 +7800,7 @@ int ixgbe_wol_supported(struct ixgbe_adapter *adapter, u16 device_id,
 	case IXGBE_DEV_ID_82599_SFP:
 		/* Only these subdevices could supports WOL */
 		switch (subdevice_id) {
+		case IXGBE_SUBDEV_ID_82599_SFP_WOL0:
 		case IXGBE_SUBDEV_ID_82599_560FLR:
 			/* only support first port */
 			if (hw->bus.func != 0)
drivers/net/ethernet/intel/ixgbe/ixgbe_type.h +1 -0
index 0d39cfc..9283cff 100644
@@ -54,6 +54,7 @@
 #define IXGBE_DEV_ID_82599_BACKPLANE_FCOE       0x152a
 #define IXGBE_DEV_ID_82599_SFP_FCOE      0x1529
 #define IXGBE_SUBDEV_ID_82599_SFP        0x11A9
+#define IXGBE_SUBDEV_ID_82599_SFP_WOL0   0x1071
 #define IXGBE_SUBDEV_ID_82599_RNDC       0x1F72
 #define IXGBE_SUBDEV_ID_82599_560FLR     0x17D0
 #define IXGBE_SUBDEV_ID_82599_SP_560FLR  0x211B
Signature · 1 line
1.8.5.GIT
#7 lore raw

PATCH 5/5 ixgbe: fixup warning regarding max_vfs parameter

In reply to Aaron Brown

From: Jacob Keller <[email protected]>

The max_vfs parameter for ixgbe is deprecated in favor of using the sysfs sriov_numvfs field to assign VFs as needed, instead of fixing the value at module load time. The current message only indicates that you should use this, without adequately explaining how to do so.

This patch modifies the warning message to include the command necessary to spawn VFs via sysfs, and points users to the Documentation for more information.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +12 -2
index e65a5be..bbd41a1 100644
@@ -5068,8 +5068,18 @@ static int ixgbe_sw_init(struct ixgbe_adapter *adapter)
 	hw->fc.disable_fc_autoneg = ixgbe_device_supports_autoneg_fc(hw);
 
 #ifdef CONFIG_PCI_IOV
-	if (max_vfs > 0)
-		e_dev_warn("Enabling SR-IOV VFs using the max_vfs module parameter is deprecated - please use the pci sysfs interface instead.\n");
+	if (max_vfs > 0) {
+		e_dev_warn("Enabling SR-IOV VFs using the max_vfs module parameter is deprecated.\n");
+		e_dev_warn("Please use the pci sysfs interface instead. Ex:\n");
+		e_dev_warn("echo '%d' > /sys/bus/pci/devices/%04x:%02x:%02x.%1x/sriov_numvfs\n",
+			   max_vfs,
+			   pci_domain_nr(pdev->bus),
+			   pdev->bus->number,
+			   PCI_SLOT(pdev->devfn),
+			   PCI_FUNC(pdev->devfn)
+			   );
+		e_dev_warn("See 'Documentation/PCI/pci-iov-howto.txt for more information.\n");
+	}
 
 	/* assign number of SR-IOV VFs */
 	if (hw->mac.type != ixgbe_mac_82598EB) {
Signature · 1 line
1.8.5.GIT
#8 lore raw

Re: [net-next 5/5] ixgbe: fixup warning regarding max_vfs parameter

Quoted 6 lines · Aaron Brown

From: Jacob Keller <[email protected]>

The max_vfs parameter for ixgbe is deprecated in favor of using the sysfs sriov_numvfs field to assign VFs as needed, instead of fixing the value at module load time. The current message only indicates that you should use this, without adequately explaining how to do so.

I don't think the kernel log is the correct place to put documentation. A reference alone should be enough.

[...]

Quoted 1 line

+ e_dev_warn("See 'Documentation/PCI/pci-iov-howto.txt for more information.\n");

[...]

This doesn't seem very helpful to non-developers. You could instead give the URL:

https://www.kernel.org/doc/Documentation/PCI/pci-iov-howto.txt

Ben.

Signature · 2 lines
Ben Hutchings
The world is coming to an end.	Please log off.
maintainer
#9 lore raw

Re: [net-next 5/5] ixgbe: fixup warning regarding max_vfs parameter

From: Ben Hutchings <[email protected]>
Date: Thu, 13 Feb 2014 20:01:32 +0000

Quoted 11 lines · Aaron Brown
Quoted 6 lines

From: Jacob Keller <[email protected]>

The max_vfs parameter for ixgbe is deprecated in favor of using the sysfs sriov_numvfs field to assign VFs as needed, instead of fixing the value at module load time. The current message only indicates that you should use this, without adequately explaining how to do so.

I don't think the kernel log is the correct place to put documentation. A reference alone should be enough.

Quoted 8 lines

[...]

Quoted 1 line

+ e_dev_warn("See 'Documentation/PCI/pci-iov-howto.txt for more information.\n");

[...]

This doesn't seem very helpful to non-developers. You could instead give the URL:

https://www.kernel.org/doc/Documentation/PCI/pci-iov-howto.txt

I even think this is not desirable. The kernel log isn't supposed to be a hyper-linked "all the information you could possibly need" repository for every interesting situation the kernel encounters.

Just say plainly what the problem is, people need a certainly level of understanding to interpret kernel messages properly.