Skip to contentSkip to conversation

e100, e1000, ixgb updates

PATCH In review Kok, Auke 3 participants 44 messages Aug 29, 2006 – Aug 31, 2006 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Kok, Auke

author
#0 lore raw

cover e100, e1000, ixgb updates

Hi,

Here are updates targeted to branch #upstream from netdev-2.6, including updates to e100, e1000 and ixgb.

These changes are available through git.

git pull git://lost.foo-projects.org/~ahkok/git/netdev-2.6 upstream

and against
netdev-2.6#upstream 699a71238856b19091503c671bac8abb1e3f9a3a

Summary:

Vasily Averin <[email protected]>
e1000: IRQ resources cleanup
e1000: e1000_probe resources cleanup
e1000: ring buffers resources cleanup

Jesse Brandeburg <[email protected]>
e1000: unify WoL capability detection code
e1000: Add PCI ID 0x10a4 for our new 4-port PCI-Express device
ixgb: Set a constant blink rate for ixgb adapter identify (1sec on, 1sec off)
ixgb: Cache-align all TX components of the adapter struct.
ixgb: Add buffer_info and test like e1000 has.

Christoph Hellwig <[email protected]>
e1000: clean up skb allocation code, patch submitted by Christoph

Jeff Kirsher <[email protected]>
e1000: Deprecate mii-tool SIOCMIIREG ioctl

Auke Kok <[email protected]>
e1000: Whitespace cleanup, cosmetic changes
e1000: error out if we cannot enable PCI device on resume
e1000: remove unused part_num reading code
e1000: Use module param array code
e1000: Increment driver version to 7.2.7-k2
e100: Convert e100 to use netdev_alloc_skb().
e100: reduce time under spinlock
e100: remove skb->dev assignment
e100: increment version to 3.5.16-k2
ixgb: Convert dev_alloc_skb to netdev_alloc_skb.
ixgb: convert dev->priv to netdev_priv(dev).
ixgb: recalculate after how many descriptors to wake the queue
ixgb: remove skb->dev assignment
ixgb: Increment version to 1.0.112-k2

Linas Vepstas <[email protected]>
e100: fix error recovery
ixgb: Add PCI Error recovery callbacks

Cheers,

Auke

---

 drivers/net/e100.c                |   12
 drivers/net/e1000/e1000.h         |    6
 drivers/net/e1000/e1000_ethtool.c |  219 ++++---
 drivers/net/e1000/e1000_hw.c      | 1059 ++++++++++++++++++--------------------
 drivers/net/e1000/e1000_hw.h      |   26
 drivers/net/e1000/e1000_main.c    |  214 +++----
 drivers/net/e1000/e1000_param.c   |  161 +++--
 drivers/net/ixgb/ixgb.h           |    5
 drivers/net/ixgb/ixgb_ethtool.c   |    6
 drivers/net/ixgb/ixgb_main.c      |  140 ++++-
 10 files changed, 981 insertions(+), 867 deletions(-)

---
Auke Kok <[email protected]>

author
#1 lore raw

PATCH 2/26 e1000: IRQ resources cleanup

irq leak was found in 2.6.18-rc4 and e1000 7.2.7 from sourceforge: if e1000_up fails in e1000_open() we do not free allocated irq

---

 drivers/net/e1000/e1000_main.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/net/e1000/e1000_main.c +4 -1
index 610a0cd..354d778 100644
@@ -1207,7 +1207,7 @@ e1000_open(struct net_device *netdev)
 
 	err = e1000_request_irq(adapter);
 	if (err)
-		goto err_up;
+		goto err_req_irq;
 
 	e1000_power_up_phy(adapter);
 
@@ -1228,6 +1228,9 @@ e1000_open(struct net_device *netdev)
 	return E1000_SUCCESS;
 
 err_up:
+	e1000_power_down_phy(adapter);
+	e1000_free_irq(adapter);
+err_req_irq:
 	e1000_free_all_rx_resources(adapter);
 err_setup_rx:
 	e1000_free_all_tx_resources(adapter);

---
Auke Kok <[email protected]>

author
#2 lore raw

PATCH 3/26 e1000: e1000_probe resources cleanup

In reply to Kok, Auke

Fix resources cleanup in e1000_probe()

---

 drivers/net/e1000/e1000_main.c |   44 +++++++++++++++++++++++++---------------
 1 files changed, 28 insertions(+), 16 deletions(-)
drivers/net/e1000/e1000_main.c +28 -16
index 354d778..c273b45 100644
@@ -695,21 +695,20 @@ e1000_probe(struct pci_dev *pdev,
 		if ((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK)) &&
 		    (err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK))) {
 			E1000_ERR("No usable DMA configuration, aborting\n");
-			return err;
+			goto err_dma;
 		}
 		pci_using_dac = 0;
 	}
 
 	if ((err = pci_request_regions(pdev, e1000_driver_name)))
-		return err;
+		goto err_pci_reg;
 
 	pci_set_master(pdev);
 
+	err = -ENOMEM;
 	netdev = alloc_etherdev(sizeof(struct e1000_adapter));
-	if (!netdev) {
-		err = -ENOMEM;
+	if (!netdev)
 		goto err_alloc_etherdev;
-	}
 
 	SET_MODULE_OWNER(netdev);
 	SET_NETDEV_DEV(netdev, &pdev->dev);
@@ -724,11 +723,10 @@ e1000_probe(struct pci_dev *pdev,
 	mmio_start = pci_resource_start(pdev, BAR_0);
 	mmio_len = pci_resource_len(pdev, BAR_0);
 
+	err = -EIO;
 	adapter->hw.hw_addr = ioremap(mmio_start, mmio_len);
-	if (!adapter->hw.hw_addr) {
-		err = -EIO;
+	if (!adapter->hw.hw_addr)
 		goto err_ioremap;
-	}
 
 	for (i = BAR_1; i <= BAR_5; i++) {
 		if (pci_resource_len(pdev, i) == 0)
@@ -773,6 +771,7 @@ e1000_probe(struct pci_dev *pdev,
 	if ((err = e1000_sw_init(adapter)))
 		goto err_sw_init;
 
+	err = -EIO;
 	/* Flash BAR mapping must happen after e1000_sw_init
 	 * because it depends on mac_type */
 	if ((adapter->hw.mac_type == e1000_ich8lan) &&
@@ -780,13 +779,11 @@ e1000_probe(struct pci_dev *pdev,
 		flash_start = pci_resource_start(pdev, 1);
 		flash_len = pci_resource_len(pdev, 1);
 		adapter->hw.flash_address = ioremap(flash_start, flash_len);
-		if (!adapter->hw.flash_address) {
-			err = -EIO;
+		if (!adapter->hw.flash_address)
 			goto err_flashmap;
-		}
 	}
 
-	if ((err = e1000_check_phy_reset_block(&adapter->hw)))
+	if (e1000_check_phy_reset_block(&adapter->hw))
 		DPRINTK(PROBE, INFO, "PHY reset is blocked due to SOL/IDER session.\n");
 
 	/* if ksp3, indicate if it's port a being setup */
@@ -829,7 +826,7 @@ e1000_probe(struct pci_dev *pdev,
 
 	if (e1000_init_eeprom_params(&adapter->hw)) {
 		E1000_ERR("EEPROM initialization failed\n");
-		return -EIO;
+		goto err_eeprom;
 	}
 
 	/* before reading the EEPROM, reset the controller to
@@ -841,7 +838,6 @@ e1000_probe(struct pci_dev *pdev,
 
 	if (e1000_validate_eeprom_checksum(&adapter->hw) < 0) {
 		DPRINTK(PROBE, ERR, "The EEPROM Checksum Is Not Valid\n");
-		err = -EIO;
 		goto err_eeprom;
 	}
 
@@ -854,7 +850,6 @@ e1000_probe(struct pci_dev *pdev,
 
 	if (!is_valid_ether_addr(netdev->perm_addr)) {
 		DPRINTK(PROBE, ERR, "Invalid MAC Address\n");
-		err = -EIO;
 		goto err_eeprom;
 	}
 
@@ -963,16 +958,33 @@ e1000_probe(struct pci_dev *pdev,
 	return 0;
 
 err_register:
+	e1000_release_hw_control(adapter);
+err_eeprom:
+	if (!e1000_check_phy_reset_block(&adapter->hw))
+		e1000_phy_hw_reset(&adapter->hw);
+
 	if (adapter->hw.flash_address)
 		iounmap(adapter->hw.flash_address);
 err_flashmap:
+#ifdef CONFIG_E1000_NAPI
+	for (i = 0; i < adapter->num_rx_queues; i++)
+		dev_put(&adapter->polling_netdev[i]);
+#endif
+
+	kfree(adapter->tx_ring);
+	kfree(adapter->rx_ring);
+#ifdef CONFIG_E1000_NAPI
+	kfree(adapter->polling_netdev);
+#endif
 err_sw_init:
-err_eeprom:
 	iounmap(adapter->hw.hw_addr);
 err_ioremap:
 	free_netdev(netdev);
 err_alloc_etherdev:
 	pci_release_regions(pdev);
+err_pci_reg:
+err_dma:
+	pci_disable_device(pdev);
 	return err;
 }
 

---
Auke Kok <[email protected]>

author
#3 lore raw

PATCH 4/26 e1000: ring buffers resources cleanup

In reply to Kok, Auke

Memory leak was found in 2.6.18-rc4 and e1000 7.2.7 from sourceforge: We should free resources allocated for previous rings if following allocation fails.

---

 drivers/net/e1000/e1000_main.c |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)
drivers/net/e1000/e1000_main.c +6 -8
index c273b45..426811a 100644
@@ -1395,10 +1395,6 @@ setup_tx_desc_die:
  * 				  (Descriptors) for all queues
  * @adapter: board private structure
  *
- * If this function returns with an error, then it's possible one or
- * more of the rings is populated (while the rest are not).  It is the
- * callers duty to clean those orphaned rings.
- *
  * Return 0 on success, negative on failure
  **/
 
@@ -1412,6 +1408,9 @@ e1000_setup_all_tx_resources(struct e100
 		if (err) {
 			DPRINTK(PROBE, ERR,
 				"Allocation for Tx Queue %u failed\n", i);
+			for (i-- ; i >= 0; i--)
+				e1000_free_tx_resources(adapter,
+							&adapter->tx_ring[i]);
 			break;
 		}
 	}
@@ -1651,10 +1650,6 @@ setup_rx_desc_die:
  * 				  (Descriptors) for all queues
  * @adapter: board private structure
  *
- * If this function returns with an error, then it's possible one or
- * more of the rings is populated (while the rest are not).  It is the
- * callers duty to clean those orphaned rings.
- *
  * Return 0 on success, negative on failure
  **/
 
@@ -1668,6 +1663,9 @@ e1000_setup_all_rx_resources(struct e100
 		if (err) {
 			DPRINTK(PROBE, ERR,
 				"Allocation for Rx Queue %u failed\n", i);
+			for (i-- ; i >= 0; i--)
+				e1000_free_rx_resources(adapter,
+							&adapter->rx_ring[i]);
 			break;
 		}
 	}

---
Auke Kok <[email protected]>

author
#4 lore raw

PATCH 5/26 e1000: error out if we cannot enable PCI device on resume

In reply to Kok, Auke

Do not ignore errors returned by pci_enable_device, instead error out.

---

 drivers/net/e1000/e1000_main.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
drivers/net/e1000/e1000_main.c +5 -2
index 426811a..630fe60 100644
@@ -4709,11 +4709,14 @@ e1000_resume(struct pci_dev *pdev)
 {
 	struct net_device *netdev = pci_get_drvdata(pdev);
 	struct e1000_adapter *adapter = netdev_priv(netdev);
-	uint32_t manc, ret_val;
+	uint32_t manc, err;
 
 	pci_set_power_state(pdev, PCI_D0);
 	e1000_pci_restore_state(adapter);
-	ret_val = pci_enable_device(pdev);
+	if ((err = pci_enable_device(pdev))) {
+		printk(KERN_ERR "e1000: Cannot enable PCI device from suspend\n");
+		return err;
+	}
 	pci_set_master(pdev);
 
 	pci_enable_wake(pdev, PCI_D3hot, 0);

---
Auke Kok <[email protected]>

author
#5 lore raw

PATCH 6/26 e1000: remove unused part_num reading code

In reply to Kok, Auke

Remove the code that reads part_num from the EEPROM. This part number is never displayed or queryable by the user.

---

 drivers/net/e1000/e1000.h      |    1 -
 drivers/net/e1000/e1000_hw.c   |   34 ----------------------------------
 drivers/net/e1000/e1000_main.c |    2 --
 3 files changed, 0 insertions(+), 37 deletions(-)
drivers/net/e1000/e1000.h +0 -1
index c110781..70ba378 100644
@@ -245,7 +245,6 @@ struct e1000_adapter {
 	uint16_t mng_vlan_id;
 	uint32_t bd_number;
 	uint32_t rx_buffer_len;
-	uint32_t part_num;
 	uint32_t wol;
 	uint32_t ksp3_port_a;
 	uint32_t smartspeed;
drivers/net/e1000/e1000_hw.c +0 -34
index 57749eb..f56d4cd 100644
@@ -5556,40 +5556,6 @@ e1000_commit_shadow_ram(struct e1000_hw 
 }
 
 /******************************************************************************
- * Reads the adapter's part number from the EEPROM
- *
- * hw - Struct containing variables accessed by shared code
- * part_num - Adapter's part number
- *****************************************************************************/
-int32_t
-e1000_read_part_num(struct e1000_hw *hw,
-                    uint32_t *part_num)
-{
-    uint16_t offset = EEPROM_PBA_BYTE_1;
-    uint16_t eeprom_data;
-
-    DEBUGFUNC("e1000_read_part_num");
-
-    /* Get word 0 from EEPROM */
-    if (e1000_read_eeprom(hw, offset, 1, &eeprom_data) < 0) {
-        DEBUGOUT("EEPROM Read Error\n");
-        return -E1000_ERR_EEPROM;
-    }
-    /* Save word 0 in upper half of part_num */
-    *part_num = (uint32_t) (eeprom_data << 16);
-
-    /* Get word 1 from EEPROM */
-    if (e1000_read_eeprom(hw, ++offset, 1, &eeprom_data) < 0) {
-        DEBUGOUT("EEPROM Read Error\n");
-        return -E1000_ERR_EEPROM;
-    }
-    /* Save word 1 in lower half of part_num */
-    *part_num |= eeprom_data;
-
-    return E1000_SUCCESS;
-}
-
-/******************************************************************************
  * Reads the adapter's MAC address from the EEPROM and inverts the LSB for the
  * second function of dual function devices
  *
drivers/net/e1000/e1000_main.c +0 -2
index 630fe60..c128f62 100644
@@ -853,8 +853,6 @@ e1000_probe(struct pci_dev *pdev,
 		goto err_eeprom;
 	}
 
-	e1000_read_part_num(&adapter->hw, &(adapter->part_num));
-
 	e1000_get_bus_info(&adapter->hw);
 
 	init_timer(&adapter->tx_fifo_stall_timer);

---
Auke Kok <[email protected]>

author
#6 lore raw

PATCH 7/26 e1000: Use module param array code

In reply to Kok, Auke

Use module param array code to distinguish between defaults and user specified values.

---

 drivers/net/e1000/e1000_param.c |  161 +++++++++++++++++++++++++++------------
 1 files changed, 110 insertions(+), 51 deletions(-)
drivers/net/e1000/e1000_param.c +110 -51
index 0ef4131..2128427 100644
@@ -324,7 +324,6 @@ e1000_check_options(struct e1000_adapter
 		DPRINTK(PROBE, NOTICE,
 		       "Warning: no configuration for board #%i\n", bd);
 		DPRINTK(PROBE, NOTICE, "Using defaults for all values\n");
-		bd = E1000_MAX_NIC;
 	}
 
 	{ /* Transmit Descriptor Count */
@@ -342,9 +341,14 @@ e1000_check_options(struct e1000_adapter
 		opt.arg.r.max = mac_type < e1000_82544 ?
 			E1000_MAX_TXD : E1000_MAX_82544_TXD;
 
-		tx_ring->count = TxDescriptors[bd];
-		e1000_validate_option(&tx_ring->count, &opt, adapter);
-		E1000_ROUNDUP(tx_ring->count, REQ_TX_DESCRIPTOR_MULTIPLE);
+		if (num_TxDescriptors > bd) {
+			tx_ring->count = TxDescriptors[bd];
+			e1000_validate_option(&tx_ring->count, &opt, adapter);
+			E1000_ROUNDUP(tx_ring->count,
+						REQ_TX_DESCRIPTOR_MULTIPLE);
+		} else {
+			tx_ring->count = opt.def;
+		}
 		for (i = 0; i < adapter->num_tx_queues; i++)
 			tx_ring[i].count = tx_ring->count;
 	}
@@ -363,9 +367,14 @@ e1000_check_options(struct e1000_adapter
 		opt.arg.r.max = mac_type < e1000_82544 ? E1000_MAX_RXD :
 			E1000_MAX_82544_RXD;
 
-		rx_ring->count = RxDescriptors[bd];
-		e1000_validate_option(&rx_ring->count, &opt, adapter);
-		E1000_ROUNDUP(rx_ring->count, REQ_RX_DESCRIPTOR_MULTIPLE);
+		if (num_RxDescriptors > bd) {
+			rx_ring->count = RxDescriptors[bd];
+			e1000_validate_option(&rx_ring->count, &opt, adapter);
+			E1000_ROUNDUP(rx_ring->count,
+						REQ_RX_DESCRIPTOR_MULTIPLE);
+		} else {
+			rx_ring->count = opt.def;
+		}
 		for (i = 0; i < adapter->num_rx_queues; i++)
 			rx_ring[i].count = rx_ring->count;
 	}
@@ -377,9 +386,13 @@ e1000_check_options(struct e1000_adapter
 			.def  = OPTION_ENABLED
 		};
 
-		int rx_csum = XsumRX[bd];
-		e1000_validate_option(&rx_csum, &opt, adapter);
-		adapter->rx_csum = rx_csum;
+		if (num_XsumRX > bd) {
+			int rx_csum = XsumRX[bd];
+			e1000_validate_option(&rx_csum, &opt, adapter);
+			adapter->rx_csum = rx_csum;
+		} else {
+			adapter->rx_csum = opt.def;
+		}
 	}
 	{ /* Flow Control */
 
@@ -399,9 +412,13 @@ e1000_check_options(struct e1000_adapter
 					 .p = fc_list }}
 		};
 
-		int fc = FlowControl[bd];
-		e1000_validate_option(&fc, &opt, adapter);
-		adapter->hw.fc = adapter->hw.original_fc = fc;
+		if (num_FlowControl > bd) {
+			int fc = FlowControl[bd];
+			e1000_validate_option(&fc, &opt, adapter);
+			adapter->hw.fc = adapter->hw.original_fc = fc;
+		} else {
+			adapter->hw.fc = adapter->hw.original_fc = opt.def;
+		}
 	}
 	{ /* Transmit Interrupt Delay */
 		struct e1000_option opt = {
@@ -413,8 +430,13 @@ e1000_check_options(struct e1000_adapter
 					 .max = MAX_TXDELAY }}
 		};
 
-		adapter->tx_int_delay = TxIntDelay[bd];
-		e1000_validate_option(&adapter->tx_int_delay, &opt, adapter);
+		if (num_TxIntDelay > bd) {
+			adapter->tx_int_delay = TxIntDelay[bd];
+			e1000_validate_option(&adapter->tx_int_delay, &opt,
+			                      adapter);
+		} else {
+			adapter->tx_int_delay = opt.def;
+		}
 	}
 	{ /* Transmit Absolute Interrupt Delay */
 		struct e1000_option opt = {
@@ -426,9 +448,13 @@ e1000_check_options(struct e1000_adapter
 					 .max = MAX_TXABSDELAY }}
 		};
 
-		adapter->tx_abs_int_delay = TxAbsIntDelay[bd];
-		e1000_validate_option(&adapter->tx_abs_int_delay, &opt,
-		                      adapter);
+		if (num_TxAbsIntDelay > bd) {
+			adapter->tx_abs_int_delay = TxAbsIntDelay[bd];
+			e1000_validate_option(&adapter->tx_abs_int_delay, &opt,
+			                      adapter);
+		} else {
+			adapter->tx_abs_int_delay = opt.def;
+		}
 	}
 	{ /* Receive Interrupt Delay */
 		struct e1000_option opt = {
@@ -440,8 +466,13 @@ e1000_check_options(struct e1000_adapter
 					 .max = MAX_RXDELAY }}
 		};
 
-		adapter->rx_int_delay = RxIntDelay[bd];
-		e1000_validate_option(&adapter->rx_int_delay, &opt, adapter);
+		if (num_RxIntDelay > bd) {
+			adapter->rx_int_delay = RxIntDelay[bd];
+			e1000_validate_option(&adapter->rx_int_delay, &opt,
+			                      adapter);
+		} else {
+			adapter->rx_int_delay = opt.def;
+		}
 	}
 	{ /* Receive Absolute Interrupt Delay */
 		struct e1000_option opt = {
@@ -453,9 +484,13 @@ e1000_check_options(struct e1000_adapter
 					 .max = MAX_RXABSDELAY }}
 		};
 
-		adapter->rx_abs_int_delay = RxAbsIntDelay[bd];
-		e1000_validate_option(&adapter->rx_abs_int_delay, &opt,
-		                      adapter);
+		if (num_RxAbsIntDelay > bd) {
+			adapter->rx_abs_int_delay = RxAbsIntDelay[bd];
+			e1000_validate_option(&adapter->rx_abs_int_delay, &opt,
+			                      adapter);
+		} else {
+			adapter->rx_abs_int_delay = opt.def;
+		}
 	}
 	{ /* Interrupt Throttling Rate */
 		struct e1000_option opt = {
@@ -467,18 +502,24 @@ e1000_check_options(struct e1000_adapter
 					 .max = MAX_ITR }}
 		};
 
-		adapter->itr = InterruptThrottleRate[bd];
-		switch (adapter->itr) {
-		case 0:
-			DPRINTK(PROBE, INFO, "%s turned off\n", opt.name);
-			break;
-		case 1:
-			DPRINTK(PROBE, INFO, "%s set to dynamic mode\n",
-				opt.name);
-			break;
-		default:
-			e1000_validate_option(&adapter->itr, &opt, adapter);
-			break;
+		if (num_InterruptThrottleRate > bd) {
+			adapter->itr = InterruptThrottleRate[bd];
+			switch (adapter->itr) {
+			case 0:
+				DPRINTK(PROBE, INFO, "%s turned off\n",
+				        opt.name);
+				break;
+			case 1:
+				DPRINTK(PROBE, INFO, "%s set to dynamic mode\n",
+				        opt.name);
+				break;
+			default:
+				e1000_validate_option(&adapter->itr, &opt,
+				                      adapter);
+				break;
+			}
+		} else {
+			adapter->itr = opt.def;
 		}
 	}
 	{ /* Smart Power Down */
@@ -489,9 +530,13 @@ e1000_check_options(struct e1000_adapter
 			.def  = OPTION_DISABLED
 		};
 
-		int spd = SmartPowerDownEnable[bd];
-		e1000_validate_option(&spd, &opt, adapter);
-		adapter->smart_power_down = spd;
+		if (num_SmartPowerDownEnable > bd) {
+			int spd = SmartPowerDownEnable[bd];
+			e1000_validate_option(&spd, &opt, adapter);
+			adapter->smart_power_down = spd;
+		} else {
+			adapter->smart_power_down = opt.def;
+		}
 	}
 	{ /* Kumeran Lock Loss Workaround */
 		struct e1000_option opt = {
@@ -501,9 +546,13 @@ e1000_check_options(struct e1000_adapter
 			.def  = OPTION_ENABLED
 		};
 
+		if (num_KumeranLockLoss > bd) {
 			int kmrn_lock_loss = KumeranLockLoss[bd];
 			e1000_validate_option(&kmrn_lock_loss, &opt, adapter);
 			adapter->hw.kmrn_lock_loss_workaround_disabled = !kmrn_lock_loss;
+		} else {
+			adapter->hw.kmrn_lock_loss_workaround_disabled = !opt.def;
+		}
 	}
 
 	switch (adapter->hw.media_type) {
@@ -530,18 +579,17 @@ static void __devinit
 e1000_check_fiber_options(struct e1000_adapter *adapter)
 {
 	int bd = adapter->bd_number;
-	bd = bd > E1000_MAX_NIC ? E1000_MAX_NIC : bd;
-	if ((Speed[bd] != OPTION_UNSET)) {
+	if (num_Speed > bd) {
 		DPRINTK(PROBE, INFO, "Speed not valid for fiber adapters, "
 		       "parameter ignored\n");
 	}
 
-	if ((Duplex[bd] != OPTION_UNSET)) {
+	if (num_Duplex > bd) {
 		DPRINTK(PROBE, INFO, "Duplex not valid for fiber adapters, "
 		       "parameter ignored\n");
 	}
 
-	if ((AutoNeg[bd] != OPTION_UNSET) && (AutoNeg[bd] != 0x20)) {
+	if ((num_AutoNeg > bd) && (AutoNeg[bd] != 0x20)) {
 		DPRINTK(PROBE, INFO, "AutoNeg other than 1000/Full is "
 				 "not valid for fiber adapters, "
 				 "parameter ignored\n");
@@ -560,7 +608,6 @@ e1000_check_copper_options(struct e1000_
 {
 	int speed, dplx, an;
 	int bd = adapter->bd_number;
-	bd = bd > E1000_MAX_NIC ? E1000_MAX_NIC : bd;
 
 	{ /* Speed */
 		struct e1000_opt_list speed_list[] = {{          0, "" },
@@ -577,8 +624,12 @@ e1000_check_copper_options(struct e1000_
 					 .p = speed_list }}
 		};
 
-		speed = Speed[bd];
-		e1000_validate_option(&speed, &opt, adapter);
+		if (num_Speed > bd) {
+			speed = Speed[bd];
+			e1000_validate_option(&speed, &opt, adapter);
+		} else {
+			speed = opt.def;
+		}
 	}
 	{ /* Duplex */
 		struct e1000_opt_list dplx_list[] = {{           0, "" },
@@ -600,11 +651,15 @@ e1000_check_copper_options(struct e1000_
 			        "Speed/Duplex/AutoNeg parameter ignored.\n");
 			return;
 		}
-		dplx = Duplex[bd];
-		e1000_validate_option(&dplx, &opt, adapter);
+		if (num_Duplex > bd) {
+			dplx = Duplex[bd];
+			e1000_validate_option(&dplx, &opt, adapter);
+		} else {
+			dplx = opt.def;
+		}
 	}
 
-	if (AutoNeg[bd] != OPTION_UNSET && (speed != 0 || dplx != 0)) {
+	if ((num_AutoNeg > bd) && (speed != 0 || dplx != 0)) {
 		DPRINTK(PROBE, INFO,
 		       "AutoNeg specified along with Speed or Duplex, "
 		       "parameter ignored\n");
@@ -653,15 +708,19 @@ e1000_check_copper_options(struct e1000_
 					 .p = an_list }}
 		};
 
-		an = AutoNeg[bd];
-		e1000_validate_option(&an, &opt, adapter);
+		if (num_AutoNeg > bd) {
+			an = AutoNeg[bd];
+			e1000_validate_option(&an, &opt, adapter);
+		} else {
+			an = opt.def;
+		}
 		adapter->hw.autoneg_advertised = an;
 	}
 
 	switch (speed + dplx) {
 	case 0:
 		adapter->hw.autoneg = adapter->fc_autoneg = 1;
-		if (Speed[bd] != OPTION_UNSET || Duplex[bd] != OPTION_UNSET)
+		if ((num_Speed > bd) && (speed != 0 || dplx != 0))
 			DPRINTK(PROBE, INFO,
 			       "Speed and duplex autonegotiation enabled\n");
 		break;

---
Auke Kok <[email protected]>

author
#8 lore raw

PATCH 8/26 e1000: Deprecate mii-tool SIOCMIIREG ioctl

In reply to Kok, Auke

Deprecate mii-tool SIOCMIIREG ioctl. This ioctl is broken in e1000 and ethtool has this functionality in working order.

---

 drivers/net/e1000/e1000_main.c |   69 ----------------------------------------
 1 files changed, 0 insertions(+), 69 deletions(-)
drivers/net/e1000/e1000_main.c +0 -69
index c128f62..70d0acd 100644
@@ -4263,9 +4263,6 @@ e1000_mii_ioctl(struct net_device *netde
 {
 	struct e1000_adapter *adapter = netdev_priv(netdev);
 	struct mii_ioctl_data *data = if_mii(ifr);
-	int retval;
-	uint16_t mii_reg;
-	uint16_t spddplx;
 	unsigned long flags;
 
 	if (adapter->hw.media_type != e1000_media_type_copper)
@@ -4287,72 +4284,6 @@ e1000_mii_ioctl(struct net_device *netde
 		spin_unlock_irqrestore(&adapter->stats_lock, flags);
 		break;
 	case SIOCSMIIREG:
-		if (!capable(CAP_NET_ADMIN))
-			return -EPERM;
-		if (data->reg_num & ~(0x1F))
-			return -EFAULT;
-		mii_reg = data->val_in;
-		spin_lock_irqsave(&adapter->stats_lock, flags);
-		if (e1000_write_phy_reg(&adapter->hw, data->reg_num,
-					mii_reg)) {
-			spin_unlock_irqrestore(&adapter->stats_lock, flags);
-			return -EIO;
-		}
-		if (adapter->hw.media_type == e1000_media_type_copper) {
-			switch (data->reg_num) {
-			case PHY_CTRL:
-				if (mii_reg & MII_CR_POWER_DOWN)
-					break;
-				if (mii_reg & MII_CR_AUTO_NEG_EN) {
-					adapter->hw.autoneg = 1;
-					adapter->hw.autoneg_advertised = 0x2F;
-				} else {
-					if (mii_reg & 0x40)
-						spddplx = SPEED_1000;
-					else if (mii_reg & 0x2000)
-						spddplx = SPEED_100;
-					else
-						spddplx = SPEED_10;
-					spddplx += (mii_reg & 0x100)
-						   ? DUPLEX_FULL :
-						   DUPLEX_HALF;
-					retval = e1000_set_spd_dplx(adapter,
-								    spddplx);
-					if (retval) {
-						spin_unlock_irqrestore(
-							&adapter->stats_lock,
-							flags);
-						return retval;
-					}
-				}
-				if (netif_running(adapter->netdev))
-					e1000_reinit_locked(adapter);
-				else
-					e1000_reset(adapter);
-				break;
-			case M88E1000_PHY_SPEC_CTRL:
-			case M88E1000_EXT_PHY_SPEC_CTRL:
-				if (e1000_phy_reset(&adapter->hw)) {
-					spin_unlock_irqrestore(
-						&adapter->stats_lock, flags);
-					return -EIO;
-				}
-				break;
-			}
-		} else {
-			switch (data->reg_num) {
-			case PHY_CTRL:
-				if (mii_reg & MII_CR_POWER_DOWN)
-					break;
-				if (netif_running(adapter->netdev))
-					e1000_reinit_locked(adapter);
-				else
-					e1000_reset(adapter);
-				break;
-			}
-		}
-		spin_unlock_irqrestore(&adapter->stats_lock, flags);
-		break;
 	default:
 		return -EOPNOTSUPP;
 	}

---
Auke Kok <[email protected]>

author
#10 lore raw

PATCH 9/26 e1000: unify WoL capability detection code

In reply to Kok, Auke

WoL is constantly giving problems and needed a rewrite. Consolidates all WoL capabilities into a single function, and disables WoL for all other ports on the device except for port A.

---

 drivers/net/e1000/e1000.h         |    3 -
 drivers/net/e1000/e1000_ethtool.c |  164 ++++++++++++++++++++-----------------
 drivers/net/e1000/e1000_main.c    |   47 ++++++++---
 3 files changed, 126 insertions(+), 88 deletions(-)
drivers/net/e1000/e1000.h +2 -1
index 70ba378..98afa9c 100644
@@ -246,7 +246,6 @@ struct e1000_adapter {
 	uint32_t bd_number;
 	uint32_t rx_buffer_len;
 	uint32_t wol;
-	uint32_t ksp3_port_a;
 	uint32_t smartspeed;
 	uint32_t en_mng_pt;
 	uint16_t link_speed;
@@ -341,7 +340,9 @@ struct e1000_adapter {
 	boolean_t tso_force;
 #endif
 	boolean_t smart_power_down;	/* phy smart power down */
+	boolean_t quad_port_a;
 	unsigned long flags;
+	uint32_t eeprom_wol;
 };
 
 enum e1000_state_t {
drivers/net/e1000/e1000_ethtool.c +90 -74

207 lines not on this page · raw message

drivers/net/e1000/e1000_main.c +34 -13

72 lines not on this page · raw message

---
Auke Kok <[email protected]>

author
#13 lore raw

PATCH 10/26 e1000: Add PCI ID 0x10a4 for our new 4-port PCI-Express device

In reply to Kok, Auke

Device 0x10a4 is a double 82571 on a single PCI-Express card and has 4 gigabit capable ports.

---

 drivers/net/e1000/e1000_ethtool.c |    1 +
 drivers/net/e1000/e1000_hw.c      |    1 +
 drivers/net/e1000/e1000_hw.h      |    1 +
 drivers/net/e1000/e1000_main.c    |    2 ++
 4 files changed, 5 insertions(+), 0 deletions(-)
drivers/net/e1000/e1000_ethtool.c +1 -0
index 0403072..3fccffd 100644
@@ -1705,6 +1705,7 @@ static int e1000_wol_exclusion(struct e1
 		/* return success for non excluded adapter ports */
 		retval = 0;
 		break;
+	case E1000_DEV_ID_82571EB_QUAD_COPPER:
 	case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3:
 		/* quad port adapters only support WoL on port A */
 		if (!adapter->quad_port_a) {
drivers/net/e1000/e1000_hw.c +1 -0
index f56d4cd..4b54c48 100644
@@ -389,6 +389,7 @@ e1000_set_mac_type(struct e1000_hw *hw)
     case E1000_DEV_ID_82571EB_COPPER:
     case E1000_DEV_ID_82571EB_FIBER:
     case E1000_DEV_ID_82571EB_SERDES:
+    case E1000_DEV_ID_82571EB_QUAD_COPPER:
             hw->mac_type = e1000_82571;
         break;
     case E1000_DEV_ID_82572EI_COPPER:
drivers/net/e1000/e1000_hw.h +1 -0
index 4f74242..a170e96 100644
@@ -470,6 +470,7 @@ int32_t e1000_check_phy_reset_block(stru
 #define E1000_DEV_ID_82571EB_COPPER      0x105E
 #define E1000_DEV_ID_82571EB_FIBER       0x105F
 #define E1000_DEV_ID_82571EB_SERDES      0x1060
+#define E1000_DEV_ID_82571EB_QUAD_COPPER 0x10A4
 #define E1000_DEV_ID_82572EI_COPPER      0x107D
 #define E1000_DEV_ID_82572EI_FIBER       0x107E
 #define E1000_DEV_ID_82572EI_SERDES      0x107F
drivers/net/e1000/e1000_main.c +2 -0
index 6dbafb1..87a562f 100644
@@ -98,6 +98,7 @@ static struct pci_device_id e1000_pci_tb
 	INTEL_E1000_ETHERNET_DEVICE(0x1098),
 	INTEL_E1000_ETHERNET_DEVICE(0x1099),
 	INTEL_E1000_ETHERNET_DEVICE(0x109A),
+	INTEL_E1000_ETHERNET_DEVICE(0x10A4),
 	INTEL_E1000_ETHERNET_DEVICE(0x10B5),
 	INTEL_E1000_ETHERNET_DEVICE(0x10B9),
 	INTEL_E1000_ETHERNET_DEVICE(0x10BA),
@@ -922,6 +923,7 @@ e1000_probe(struct pci_dev *pdev,
 			adapter->eeprom_wol = 0;
 		break;
 	case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3:
+	case E1000_DEV_ID_82571EB_QUAD_COPPER:
 		/* if quad port adapter, disable WoL on all but port A */
 		if (global_quad_port_a != 0)
 			adapter->eeprom_wol = 0;

---
Auke Kok <[email protected]>

author
#14 lore raw

PATCH 11/26 e1000: clean up skb allocation code, patch submitted by Christoph

In reply to Kok, Auke

---

 drivers/net/e1000/e1000_main.c |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)
drivers/net/e1000/e1000_main.c +6 -11
index 87a562f..656db12 100644
@@ -3741,7 +3741,6 @@ e1000_clean_rx_irq(struct e1000_adapter 
 			    netdev_alloc_skb(netdev, length + NET_IP_ALIGN);
 			if (new_skb) {
 				skb_reserve(new_skb, NET_IP_ALIGN);
-				new_skb->dev = netdev;
 				memcpy(new_skb->data - NET_IP_ALIGN,
 				       skb->data - NET_IP_ALIGN,
 				       length + NET_IP_ALIGN);
@@ -4008,13 +4007,13 @@ e1000_alloc_rx_buffers(struct e1000_adap
 	buffer_info = &rx_ring->buffer_info[i];
 
 	while (cleaned_count--) {
-		if (!(skb = buffer_info->skb))
-			skb = netdev_alloc_skb(netdev, bufsz);
-		else {
+		skb = buffer_info->skb;
+		if (skb) {
 			skb_trim(skb, 0);
 			goto map_skb;
 		}
 
+		skb = netdev_alloc_skb(netdev, bufsz);
 		if (unlikely(!skb)) {
 			/* Better luck next round */
 			adapter->alloc_rx_buff_failed++;
@@ -4039,10 +4038,10 @@ e1000_alloc_rx_buffers(struct e1000_adap
 				dev_kfree_skb(skb);
 				dev_kfree_skb(oldskb);
 				break; /* while !buffer_info->skb */
-			} else {
-				/* Use new allocation */
-				dev_kfree_skb(oldskb);
 			}
+
+			/* Use new allocation */
+			dev_kfree_skb(oldskb);
 		}
 		/* Make buffer alignment 2 beyond a 16 byte boundary
 		 * this will result in a 16 byte aligned IP header after
@@ -4050,8 +4049,6 @@ e1000_alloc_rx_buffers(struct e1000_adap
 		 */
 		skb_reserve(skb, NET_IP_ALIGN);
 
-		skb->dev = netdev;
-
 		buffer_info->skb = skb;
 		buffer_info->length = adapter->rx_buffer_len;
 map_skb:
@@ -4165,8 +4162,6 @@ e1000_alloc_rx_buffers_ps(struct e1000_a
 		 */
 		skb_reserve(skb, NET_IP_ALIGN);
 
-		skb->dev = netdev;
-
 		buffer_info->skb = skb;
 		buffer_info->length = adapter->rx_ps_bsize0;
 		buffer_info->dma = pci_map_single(pdev, skb->data,

---
Auke Kok <[email protected]>

author
#17 lore raw

PATCH 12/26 e1000: Increment driver version to 7.2.7-k2

In reply to Kok, Auke

---

 drivers/net/e1000/e1000_main.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/e1000/e1000_main.c +1 -1
index 656db12..0128d01 100644
@@ -36,7 +36,7 @@ static char e1000_driver_string[] = "Int
 #else
 #define DRIVERNAPI "-NAPI"
 #endif
-#define DRV_VERSION "7.1.9-k6"DRIVERNAPI
+#define DRV_VERSION "7.2.7-k2"DRIVERNAPI
 char e1000_driver_version[] = DRV_VERSION;
 static char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation.";
 

---
Auke Kok <[email protected]>

author
#18 lore raw

PATCH 13/26 e100: Convert e100 to use netdev_alloc_skb().

In reply to Kok, Auke

---

 drivers/net/e100.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/e100.c +2 -2
index b42ad76..458af6a 100644
@@ -1759,7 +1759,7 @@ static inline void e100_start_receiver(s
 #define RFD_BUF_LEN (sizeof(struct rfd) + VLAN_ETH_FRAME_LEN)
 static int e100_rx_alloc_skb(struct nic *nic, struct rx *rx)
 {
-	if(!(rx->skb = dev_alloc_skb(RFD_BUF_LEN + NET_IP_ALIGN)))
+	if(!(rx->skb = netdev_alloc_skb(nic->netdev, RFD_BUF_LEN + NET_IP_ALIGN)))
 		return -ENOMEM;
 
 	/* Align, init, and map the RFD. */
@@ -2139,7 +2139,7 @@ static int e100_loopback_test(struct nic
 
 	e100_start_receiver(nic, NULL);
 
-	if(!(skb = dev_alloc_skb(ETH_DATA_LEN))) {
+	if(!(skb = netdev_alloc_skb(nic->netdev, ETH_DATA_LEN))) {
 		err = -ENOMEM;
 		goto err_loopback_none;
 	}

---
Auke Kok <[email protected]>

author
#19 lore raw

PATCH 14/26 e100: fix error recovery

In reply to Kok, Auke

A recent patch in -mm3 titled "gregkh-pci-pci-don-t-enable-device-if-already-enabled.patch" causes pci_enable_device() to be a no-op if the kernel thinks that the device is already enabled. This change breaks the PCI error recovery mechanism in the e100 device driver, since, after PCI slot reset, the card is no longer enabled. This is a trivial fix for this problem. Tested.

---

 drivers/net/e100.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/net/e100.c +1 -0
index 458af6a..e12cc68 100644
@@ -2791,6 +2791,7 @@ static pci_ers_result_t e100_io_error_de
 	/* Detach; put netif into state similar to hotplug unplug. */
 	netif_poll_enable(netdev);
 	netif_device_detach(netdev);
+	pci_disable_device(pdev);
 
 	/* Request a slot reset. */
 	return PCI_ERS_RESULT_NEED_RESET;

---
Auke Kok <[email protected]>

author
#21 lore raw

PATCH 15/26 e100: reduce time under spinlock

In reply to Kok, Auke

We're waiting for a write flush to finish before unlocking, which is not needed. Release the spinlock after the write command.

---

 drivers/net/e100.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/e100.c +2 -2
index e12cc68..eb467f8 100644
@@ -597,8 +597,8 @@ static void e100_enable_irq(struct nic *
 
 	spin_lock_irqsave(&nic->cmd_lock, flags);
 	writeb(irq_mask_none, &nic->csr->scb.cmd_hi);
-	e100_write_flush(nic);
 	spin_unlock_irqrestore(&nic->cmd_lock, flags);
+	e100_write_flush(nic);
 }
 
 static void e100_disable_irq(struct nic *nic)
@@ -607,8 +607,8 @@ static void e100_disable_irq(struct nic 
 
 	spin_lock_irqsave(&nic->cmd_lock, flags);
 	writeb(irq_mask_all, &nic->csr->scb.cmd_hi);
-	e100_write_flush(nic);
 	spin_unlock_irqrestore(&nic->cmd_lock, flags);
+	e100_write_flush(nic);
 }
 
 static void e100_hw_reset(struct nic *nic)

---
Auke Kok <[email protected]>

author
#24 lore raw

PATCH 16/26 e100: remove skb->dev assignment

In reply to Kok, Auke

---

 drivers/net/e100.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/net/e100.c +0 -1
index eb467f8..a98e23a 100644
@@ -1763,7 +1763,6 @@ static int e100_rx_alloc_skb(struct nic 
 		return -ENOMEM;
 
 	/* Align, init, and map the RFD. */
-	rx->skb->dev = nic->netdev;
 	skb_reserve(rx->skb, NET_IP_ALIGN);
 	memcpy(rx->skb->data, &nic->blank_rfd, sizeof(struct rfd));
 	rx->dma_addr = pci_map_single(nic->pdev, rx->skb->data,

---
Auke Kok <[email protected]>

author
#25 lore raw

PATCH 17/26 e100: increment version to 3.5.16-k2

In reply to Kok, Auke

Increment the version of e100 to 3.5.16-k2, increment dates.

---

 drivers/net/e100.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/e100.c +1 -1
index a98e23a..23afdff 100644
@@ -159,7 +159,7 @@
 
 #define DRV_NAME		"e100"
 #define DRV_EXT			"-NAPI"
-#define DRV_VERSION		"3.5.10-k4"DRV_EXT
+#define DRV_VERSION		"3.5.16-k2"DRV_EXT
 #define DRV_DESCRIPTION		"Intel(R) PRO/100 Network Driver"
 #define DRV_COPYRIGHT		"Copyright(c) 1999-2006 Intel Corporation"
 #define PFX			DRV_NAME ": "

---
Auke Kok <[email protected]>

author
#26 lore raw

PATCH 18/26 ixgb: Convert dev_alloc_skb to netdev_alloc_skb.

In reply to Kok, Auke

---

 drivers/net/ixgb/ixgb_main.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ixgb/ixgb_main.c +2 -2
index 346273d..6959735 100644
@@ -1948,7 +1948,7 @@ ixgb_clean_rx_irq(struct ixgb_adapter *a
 #define IXGB_CB_LENGTH 256
 		if (length < IXGB_CB_LENGTH) {
 			struct sk_buff *new_skb =
-			    dev_alloc_skb(length + NET_IP_ALIGN);
+			    netdev_alloc_skb(netdev, length + NET_IP_ALIGN);
 			if (new_skb) {
 				skb_reserve(new_skb, NET_IP_ALIGN);
 				new_skb->dev = netdev;
@@ -2032,7 +2032,7 @@ ixgb_alloc_rx_buffers(struct ixgb_adapte
 	while(--cleancount > 2) {
 		/* recycle! its good for you */
 		if (!(skb = buffer_info->skb))
-			skb = dev_alloc_skb(adapter->rx_buffer_len
+			skb = netdev_alloc_skb(netdev, adapter->rx_buffer_len
 			                    + NET_IP_ALIGN);
 		else {
 			skb_trim(skb, 0);

---
Auke Kok <[email protected]>

author
#27 lore raw

PATCH 19/26 ixgb: convert dev->priv to netdev_priv(dev).

In reply to Kok, Auke

---

 drivers/net/ixgb/ixgb_main.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/ixgb/ixgb_main.c +1 -1
index 6959735..fee4c5a 100644
@@ -2190,7 +2190,7 @@ ixgb_restore_vlan(struct ixgb_adapter *a
 
 static void ixgb_netpoll(struct net_device *dev)
 {
-	struct ixgb_adapter *adapter = dev->priv;
+	struct ixgb_adapter *adapter = netdev_priv(dev);
 
 	disable_irq(adapter->pdev->irq);
 	ixgb_intr(adapter->pdev->irq, dev, NULL);

---
Auke Kok <[email protected]>

author
#28 lore raw

PATCH 20/26 ixgb: Set a constant blink rate for ixgb adapter identify (1sec on, 1sec off)

In reply to Kok, Auke

---

 drivers/net/ixgb/ixgb_ethtool.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
drivers/net/ixgb/ixgb_ethtool.c +1 -5
index cf19b89..ba62108 100644
@@ -654,11 +654,7 @@ ixgb_phys_id(struct net_device *netdev, 
 
 	mod_timer(&adapter->blink_timer, jiffies);
 
-	if (data)
-		schedule_timeout_interruptible(data * HZ);
-	else
-		schedule_timeout_interruptible(MAX_SCHEDULE_TIMEOUT);
-
+	msleep_interruptible(data * 1000);
 	del_timer_sync(&adapter->blink_timer);
 	ixgb_led_off(&adapter->hw);
 	clear_bit(IXGB_LED_ON, &adapter->led_status);

---
Auke Kok <[email protected]>

author
#29 lore raw

PATCH 21/26 ixgb: recalculate after how many descriptors to wake the queue

In reply to Kok, Auke

Recalculate when to wake the queue using DESC_NEEDED instead of a static hardcoded number.

---

 drivers/net/ixgb/ixgb.h      |    3 ---
 drivers/net/ixgb/ixgb_main.c |    2 +-
 2 files changed, 1 insertions(+), 4 deletions(-)
drivers/net/ixgb/ixgb.h +0 -3
index 82b67af..a4bee8c 100644
@@ -110,9 +110,6 @@ struct ixgb_adapter;
 #define IXGB_RXBUFFER_8192  8192
 #define IXGB_RXBUFFER_16384 16384
 
-/* How many Tx Descriptors do we need to call netif_wake_queue? */
-#define IXGB_TX_QUEUE_WAKE 16
-
 /* How many Rx Buffers do we bundle into one write to the hardware ? */
 #define IXGB_RX_BUFFER_WRITE	4	/* Must be power of 2 */
 
drivers/net/ixgb/ixgb_main.c +1 -1
index fee4c5a..960b44b 100644
@@ -1787,7 +1787,7 @@ ixgb_clean_tx_irq(struct ixgb_adapter *a
 	if (unlikely(netif_queue_stopped(netdev))) {
 		spin_lock(&adapter->tx_lock);
 		if (netif_queue_stopped(netdev) && netif_carrier_ok(netdev) &&
-		    (IXGB_DESC_UNUSED(tx_ring) > IXGB_TX_QUEUE_WAKE))
+		    (IXGB_DESC_UNUSED(tx_ring) >= DESC_NEEDED))
 			netif_wake_queue(netdev);
 		spin_unlock(&adapter->tx_lock);
 	}

---
Auke Kok <[email protected]>

author
#31 lore raw

PATCH 22/26 ixgb: Cache-align all TX components of the adapter struct.

In reply to Kok, Auke

---

 drivers/net/ixgb/ixgb.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/ixgb/ixgb.h +1 -1
index a4bee8c..e157247 100644
@@ -170,7 +170,7 @@ struct ixgb_adapter {
 	unsigned long led_status;
 
 	/* TX */
-	struct ixgb_desc_ring tx_ring;
+	struct ixgb_desc_ring tx_ring ____cacheline_aligned;
 	unsigned long timeo_start;
 	uint32_t tx_cmd_type;
 	uint64_t hw_csum_tx_good;

---
Auke Kok <[email protected]>

author
#36 lore raw

PATCH 23/26 ixgb: Add buffer_info and test like e1000 has.

In reply to Kok, Auke

---

 drivers/net/ixgb/ixgb_main.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
drivers/net/ixgb/ixgb_main.c +7 -0
index 960b44b..a5da48a 100644
@@ -1174,6 +1174,7 @@ ixgb_tso(struct ixgb_adapter *adapter, s
 	int err;
 
 	if (likely(skb_is_gso(skb))) {
+		struct ixgb_buffer *buffer_info;
 		if (skb_header_cloned(skb)) {
 			err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
 			if (err)
@@ -1196,6 +1197,8 @@ ixgb_tso(struct ixgb_adapter *adapter, s
 
 		i = adapter->tx_ring.next_to_use;
 		context_desc = IXGB_CONTEXT_DESC(adapter->tx_ring, i);
+		buffer_info = &adapter->tx_ring.buffer_info[i];
+		WARN_ON(buffer_info->dma != 0);
 
 		context_desc->ipcss = ipcss;
 		context_desc->ipcso = ipcso;
@@ -1233,11 +1236,14 @@ ixgb_tx_csum(struct ixgb_adapter *adapte
 	uint8_t css, cso;
 
 	if(likely(skb->ip_summed == CHECKSUM_HW)) {
+		struct ixgb_buffer *buffer_info;
 		css = skb->h.raw - skb->data;
 		cso = (skb->h.raw + skb->csum) - skb->data;
 
 		i = adapter->tx_ring.next_to_use;
 		context_desc = IXGB_CONTEXT_DESC(adapter->tx_ring, i);
+		buffer_info = &adapter->tx_ring.buffer_info[i];
+		WARN_ON(buffer_info->dma != 0);
 
 		context_desc->tucss = css;
 		context_desc->tucso = cso;
@@ -1283,6 +1289,7 @@ ixgb_tx_map(struct ixgb_adapter *adapter
 		buffer_info = &tx_ring->buffer_info[i];
 		size = min(len, IXGB_MAX_DATA_PER_TXD);
 		buffer_info->length = size;
+		WARN_ON(buffer_info->dma != 0);
 		buffer_info->dma =
 			pci_map_single(adapter->pdev,
 				skb->data + offset,

---
Auke Kok <[email protected]>

author
#37 lore raw

PATCH 24/26 ixgb: Add PCI Error recovery callbacks

In reply to Kok, Auke

Adds PCI Error recovery callbacks to the Intel 10-gigabit ethernet ixgb device driver. Lightly tested, works.

"Zhang, Yanmin" <[email protected]> wrote:

Both pci_disable_device and ixgb_down would access the device. It doesn't follow Documentation/pci-error-recovery.txt that error_detected shouldn't do any access to the device.

---

 drivers/net/ixgb/ixgb_main.c |  112 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 111 insertions(+), 1 deletions(-)
drivers/net/ixgb/ixgb_main.c +111 -1
index a5da48a..abca75f 100644
@@ -118,15 +118,26 @@ static void ixgb_restore_vlan(struct ixg
 static void ixgb_netpoll(struct net_device *dev);
 #endif
 
-/* Exported from other modules */
+static pci_ers_result_t ixgb_io_error_detected (struct pci_dev *pdev,
+	                     enum pci_channel_state state);
+static pci_ers_result_t ixgb_io_slot_reset (struct pci_dev *pdev);
+static void ixgb_io_resume (struct pci_dev *pdev);
 
+/* Exported from other modules */
 extern void ixgb_check_options(struct ixgb_adapter *adapter);
 
+static struct pci_error_handlers ixgb_err_handler = {
+	.error_detected = ixgb_io_error_detected,
+	.slot_reset = ixgb_io_slot_reset,
+	.resume = ixgb_io_resume,
+};
+
 static struct pci_driver ixgb_driver = {
 	.name     = ixgb_driver_name,
 	.id_table = ixgb_pci_tbl,
 	.probe    = ixgb_probe,
 	.remove   = __devexit_p(ixgb_remove),
+	.err_handler = &ixgb_err_handler
 };
 
 MODULE_AUTHOR("Intel Corporation, <[email protected]>");
@@ -1550,6 +1561,11 @@ void
 ixgb_update_stats(struct ixgb_adapter *adapter)
 {
 	struct net_device *netdev = adapter->netdev;
+	struct pci_dev *pdev = adapter->pdev;
+
+	/* Prevent stats update while adapter is being reset */
+	if (pdev->error_state && pdev->error_state != pci_channel_io_normal)
+		return;
 
 	if((netdev->flags & IFF_PROMISC) || (netdev->flags & IFF_ALLMULTI) ||
 	   (netdev->mc_count > IXGB_MAX_NUM_MULTICAST_ADDRESSES)) {
@@ -2205,4 +2221,98 @@ static void ixgb_netpoll(struct net_devi
 }
 #endif
 
+/**
+ * ixgb_io_error_detected() - called when PCI error is detected
+ * @pdev    pointer to pci device with error
+ * @state   pci channel state after error
+ *
+ * This callback is called by the PCI subsystem whenever
+ * a PCI bus error is detected.
+ */
+static pci_ers_result_t ixgb_io_error_detected (struct pci_dev *pdev,
+			             enum pci_channel_state state)
+{
+	struct net_device *netdev = pci_get_drvdata(pdev);
+	struct ixgb_adapter *adapter = netdev->priv;
+
+	if(netif_running(netdev))
+		ixgb_down(adapter, TRUE);
+
+	pci_disable_device(pdev);
+
+	/* Request a slot reset. */
+	return PCI_ERS_RESULT_NEED_RESET;
+}
+
+/**
+ * ixgb_io_slot_reset - called after the pci bus has been reset.
+ * @pdev    pointer to pci device with error
+ *
+ * This callback is called after the PCI buss has been reset.
+ * Basically, this tries to restart the card from scratch.
+ * This is a shortened version of the device probe/discovery code,
+ * it resembles the first-half of the ixgb_probe() routine.
+ */
+static pci_ers_result_t ixgb_io_slot_reset (struct pci_dev *pdev)
+{
+	struct net_device *netdev = pci_get_drvdata(pdev);
+	struct ixgb_adapter *adapter = netdev->priv;
+
+	if(pci_enable_device(pdev)) {
+		DPRINTK(PROBE, ERR, "Cannot re-enable PCI device after reset.\n");
+		return PCI_ERS_RESULT_DISCONNECT;
+	}
+
+	/* Perform card reset only on one instance of the card */
+	if (0 != PCI_FUNC (pdev->devfn))
+		return PCI_ERS_RESULT_RECOVERED;
+
+	pci_set_master(pdev);
+
+	netif_carrier_off(netdev);
+	netif_stop_queue(netdev);
+	ixgb_reset(adapter);
+
+	/* Make sure the EEPROM is good */
+	if(!ixgb_validate_eeprom_checksum(&adapter->hw)) {
+		DPRINTK(PROBE, ERR, "After reset, the EEPROM checksum is not valid.\n");
+		return PCI_ERS_RESULT_DISCONNECT;
+	}
+	ixgb_get_ee_mac_addr(&adapter->hw, netdev->dev_addr);
+	memcpy(netdev->perm_addr, netdev->dev_addr, netdev->addr_len);
+
+	if(!is_valid_ether_addr(netdev->perm_addr)) {
+		DPRINTK(PROBE, ERR, "After reset, invalid MAC address.\n");
+		return PCI_ERS_RESULT_DISCONNECT;
+	}
+
+	return PCI_ERS_RESULT_RECOVERED;
+}
+
+/**
+ * ixgb_io_resume - called when its OK to resume normal operations
+ * @pdev    pointer to pci device with error
+ *
+ * The error recovery driver tells us that its OK to resume
+ * normal operation. Implementation resembles the second-half
+ * of the ixgb_probe() routine.
+ */
+static void ixgb_io_resume (struct pci_dev *pdev)
+{
+	struct net_device *netdev = pci_get_drvdata(pdev);
+	struct ixgb_adapter *adapter = netdev->priv;
+
+	pci_set_master(pdev);
+
+	if(netif_running(netdev)) {
+		if(ixgb_up(adapter)) {
+			printk ("ixgb: can't bring device back up after reset\n");
+			return;
+		}
+	}
+
+	netif_device_attach(netdev);
+	mod_timer(&adapter->watchdog_timer, jiffies);
+}
+
 /* ixgb_main.c */

---
Auke Kok <[email protected]>

author
#38 lore raw

PATCH 25/26 ixgb: remove skb->dev assignment

In reply to Kok, Auke

Same change as e1000: remove skb->dev assignment, it's now done by netdev_alloc_skb.

---

 drivers/net/ixgb/ixgb_main.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)
drivers/net/ixgb/ixgb_main.c +4 -7
index abca75f..ee12a85 100644
@@ -1974,7 +1974,6 @@ ixgb_clean_rx_irq(struct ixgb_adapter *a
 			    netdev_alloc_skb(netdev, length + NET_IP_ALIGN);
 			if (new_skb) {
 				skb_reserve(new_skb, NET_IP_ALIGN);
-				new_skb->dev = netdev;
 				memcpy(new_skb->data - NET_IP_ALIGN,
 				       skb->data - NET_IP_ALIGN,
 				       length + NET_IP_ALIGN);
@@ -2054,14 +2053,14 @@ ixgb_alloc_rx_buffers(struct ixgb_adapte
 	/* leave three descriptors unused */
 	while(--cleancount > 2) {
 		/* recycle! its good for you */
-		if (!(skb = buffer_info->skb))
-			skb = netdev_alloc_skb(netdev, adapter->rx_buffer_len
-			                    + NET_IP_ALIGN);
-		else {
+		skb = buffer_info->skb;
+		if (skb) {
 			skb_trim(skb, 0);
 			goto map_skb;
 		}
 
+		skb = netdev_alloc_skb(netdev, adapter->rx_buffer_len
+			               + NET_IP_ALIGN);
 		if (unlikely(!skb)) {
 			/* Better luck next round */
 			adapter->alloc_rx_buff_failed++;
@@ -2074,8 +2073,6 @@ ixgb_alloc_rx_buffers(struct ixgb_adapte
 		 */
 		skb_reserve(skb, NET_IP_ALIGN);
 
-		skb->dev = netdev;
-
 		buffer_info->skb = skb;
 		buffer_info->length = adapter->rx_buffer_len;
 map_skb:

---
Auke Kok <[email protected]>

author
#39 lore raw

PATCH 26/26 ixgb: Increment version to 1.0.112-k2

In reply to Kok, Auke

---

 drivers/net/ixgb/ixgb_main.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/ixgb/ixgb_main.c +1 -1
index ee12a85..e36dee1 100644
@@ -36,7 +36,7 @@ static char ixgb_driver_string[] = "Inte
 #else
 #define DRIVERNAPI "-NAPI"
 #endif
-#define DRV_VERSION		"1.0.109-k4"DRIVERNAPI
+#define DRV_VERSION		"1.0.112-k2"DRIVERNAPI
 char ixgb_driver_version[] = DRV_VERSION;
 static char ixgb_copyright[] = "Copyright (c) 1999-2006 Intel Corporation.";
 

---
Auke Kok <[email protected]>

author
#42 lore raw

Re: [PATCH 01/26] e1000: Whitespace cleanup, cosmetic changes

In reply to a message not in the archive
#32 lore raw

Re: [PATCH 22/26] ixgb: Cache-align all TX components of the adapter struct.

In reply to Kok, Auke

drivers/net/ixgb/ixgb.h struct ixgb_adapter { · line 174

Quoted 5 lines · Auke
drivers/net/ixgb/ixgb.h +1 -1
 	/* TX */
-	struct ixgb_desc_ring tx_ring;
+	struct ixgb_desc_ring tx_ring ____cacheline_aligned;
 	unsigned long timeo_start;

On UP, this would only enlarge the size of structure and might consume more cache lines...

I guess ____cacheline_aligned_in_smp is preferred here.

(see include/linux/netdevice.h)

Eric

#9 lore raw

Re: [PATCH 08/26] e1000: Deprecate mii-tool SIOCMIIREG ioctl

In reply to Kok, Auke
Quoted 5 lines · Auke

Deprecate mii-tool SIOCMIIREG ioctl. This ioctl is broken in e1000 and ethtool has this functionality in working order.

This doesn't "deprecated" anything, it changes the ABI on a user's machine by _removing_ ioctl handling code that used to be there.

What's broken, and what is needed to fix? Perhaps e1000 should instead be limited to 10/100 networks/speeds?

Jeff

#11 lore raw

Re: [PATCH 09/26] e1000: unify WoL capability detection code

In reply to Kok, Auke
Quoted 3 lines · Auke

WoL is constantly giving problems and needed a rewrite. Consolidates all WoL capabilities into a single function, and disables WoL for all other ports on the device except for port A.

Is this a behavior change that affects users in the field?

i.e. if they are using WoL via port B, and upgrade to this driver, their setup suddenly breaks, right?

Jeff

#15 lore raw

Re: [PATCH 11/26] e1000: clean up skb allocation code, patch submitted by Christoph

In reply to Kok, Auke
Quoted 3 lines · Auke

ACK, but please don't include attribution in the subject line.

Add a "From: ...author..." as the first line of your patch description instead.

See #12 of Documentation/SubmittingPatches for more info.

Jeff

#22 lore raw

Re: [PATCH 15/26] e100: reduce time under spinlock

In reply to Kok, Auke
Quoted 4 lines · Auke

We're waiting for a write flush to finish before unlocking, which is not needed. Release the spinlock after the write command.

This undoes the following change:

commit ad8c48ad3bbef078616ed4d2652d362dfd962f09

Author: Catalin(ux aka Dino) BOIE <[email protected]>
Date:   Sat Mar 4 12:18:59 2006 -0500

Fix io ordering problems in e100

Checking e100.c code against Documentation/io_ordering.txt I found the following problem:

spin_lock_irq...
write
spin-unlock
e100_write_flush

The attached patch fix the code like this:

spin_lock_irq...
write
e100_write_flush
spin-unlock

#33 lore raw

Re: [PATCH 22/26] ixgb: Cache-align all TX components of the adapter struct.

In reply to Eric Dumazet
Quoted 11 lines · Eric Dumazet

drivers/net/ixgb/ixgb.h struct ixgb_adapter { · line 174

Quoted 4 lines · Auke
drivers/net/ixgb/ixgb.h +1 -1
 	/* TX */
-	struct ixgb_desc_ring tx_ring;
+	struct ixgb_desc_ring tx_ring ____cacheline_aligned;
 	unsigned long timeo_start;

On UP, this would only enlarge the size of structure and might consume more cache lines...

I guess ____cacheline_aligned_in_smp is preferred here.

(see include/linux/netdevice.h)

Agreed.

Jeff

author
#34 lore raw

Re: [PATCH 22/26] ixgb: Cache-align all TX components of the adapter struct.

In reply to Jeff Garzik
Quoted 7 lines · Jeff Garzik
Quoted 6 lines · Eric Dumazet
Quoted 4 lines · Auke
     /* TX */
drivers/net/ixgb/ixgb.h +1 -1
-    struct ixgb_desc_ring tx_ring;
+    struct ixgb_desc_ring tx_ring ____cacheline_aligned;
     unsigned long timeo_start;
Quoted 7 lines
Quoted 5 lines

On UP, this would only enlarge the size of structure and might consume more cache lines...

I guess ____cacheline_aligned_in_smp is preferred here.

(see include/linux/netdevice.h)

Agreed.

No objections. I can rework my tree if needed, but lets wait what else comes up first.

Auke

author
#12 lore raw

Re: [PATCH 09/26] e1000: unify WoL capability detection code

In reply to Jeff Garzik
Quoted 8 lines · Jeff Garzik
Quoted 3 lines · Auke

WoL is constantly giving problems and needed a rewrite. Consolidates all WoL capabilities into a single function, and disables WoL for all other ports on the device except for port A.

Is this a behavior change that affects users in the field?

i.e. if they are using WoL via port B, and upgrade to this driver, their setup suddenly breaks, right?

it's rather the other way around:

The problem is that the adapters involved (dual- and quad- port NIC adapters, not the dual port onboard adapters) have known issues (as in: wol does not work) with WoL on port b, c, d. Formerly the code was trying to enable WoL on ports that were not capable of doing so (82546, 82571). This fix explicitly still allows the properly working (as in: wol works correctly on port b) dual-port adapters that have WoL enabled for port b in the EEPROM enabled to function with WoL on those ports (i.e. most adapters).

The users who have those boards should have noticed that their adapter didn't function with WoL on those ports. This all comes back to a hardware errata that has been out here for a while. This patch brings the code up to spec with that. Now users will see that WoL will not work on those ports if they attempt to enable it, where previously it was enabled in software but didn't do anything. We make sure to return -EOPNOTSUPP through ethtool as well for all cases.

Cheers

Auke

author
#23 lore raw

Re: [PATCH 15/26] e100: reduce time under spinlock

In reply to Jeff Garzik
Quoted 7 lines · Jeff Garzik
Quoted 4 lines · Auke

We're waiting for a write flush to finish before unlocking, which is not needed. Release the spinlock after the write command.

This undoes the following change:

ack, not good. Dropped it from the tree.

Auke

Quoted 25 lines

commit ad8c48ad3bbef078616ed4d2652d362dfd962f09

Author: Catalin(ux aka Dino) BOIE <[email protected]>
Date:   Sat Mar 4 12:18:59 2006 -0500

Fix io ordering problems in e100

Checking e100.c code against Documentation/io_ordering.txt I found the following problem:

spin_lock_irq...
write
spin-unlock
e100_write_flush

The attached patch fix the code like this:

spin_lock_irq...
write
e100_write_flush
spin-unlock

author
#16 lore raw

Re: [PATCH 11/26] e1000: clean up skb allocation code, patch submitted by Christoph

In reply to Jeff Garzik
Quoted 8 lines · Jeff Garzik
Quoted 3 lines · Auke

ACK, but please don't include attribution in the subject line.

Add a "From: ...author..." as the first line of your patch description instead.

that was already done :) (I figured out how to do this recently and all the community submissions will keep authorship in our tree).

Fixed in the tree.

Auke

author
#35 lore raw

Re: [PATCH 22/26] ixgb: Cache-align all TX components of the adapter struct.

In reply to Jeff Garzik
Quoted 7 lines · Jeff Garzik
Quoted 6 lines · Eric Dumazet
Quoted 4 lines · Auke
     /* TX */
drivers/net/ixgb/ixgb.h +1 -1
-    struct ixgb_desc_ring tx_ring;
+    struct ixgb_desc_ring tx_ring ____cacheline_aligned;
     unsigned long timeo_start;
Quoted 5 lines
Quoted 5 lines

On UP, this would only enlarge the size of structure and might consume more cache lines...

I guess ____cacheline_aligned_in_smp is preferred here.

(see include/linux/netdevice.h)

changed in our tree to ____cacheline_aligned_in_smp.

Thanks,

Auke

author
#43 lore raw
In reply to Kok, Auke

Jeff,

I have adjusted several things in our queue after comments. Here is a summary of those changes against the original summary.

These changes are available through git.

Please pull:
git pull git://lost.foo-projects.org/~ahkok/git/netdev-2.6 upstream

(against netdev-2.6#upstream 699a71238856b19091503c671bac8abb1e3f9a3a)

Cheers,

Auke

Quoted 7 lines · Auke

Vasily Averin <[email protected]>
e1000: IRQ resources cleanup
e1000: e1000_probe resources cleanup
e1000: ring buffers resources cleanup

Jesse Brandeburg <[email protected]>
e1000: unify WoL capability detection code

all unchanged

Quoted 1 line
     e1000: Add PCI ID 0x10a4 for our new 4-port PCI-Express device

This patch was not Acked but I assume no objections exist.

Quoted 1 line

ixgb: Set a constant blink rate for ixgb adapter identify (1sec on, 1sec off)

unchanged

Quoted 1 line

ixgb: Cache-align all TX components of the adapter struct.

modified per comments to include "_in_smp"

Quoted 1 line

ixgb: Add buffer_info and test like e1000 has.

unchanged

Quoted 2 lines

Christoph Hellwig <[email protected]>
e1000: clean up skb allocation code, patch submitted by Christoph

Changed topic as attribution is already in the patch correctly

Quoted 2 lines

Jeff Kirsher <[email protected]>
e1000: Deprecate mii-tool SIOCMIIREG ioctl

Dropped patch.

Quoted 7 lines

Auke Kok <[email protected]>
e1000: Whitespace cleanup, cosmetic changes
e1000: error out if we cannot enable PCI device on resume
e1000: remove unused part_num reading code
e1000: Use module param array code
e1000: Increment driver version to 7.2.7-k2
e100: Convert e100 to use netdev_alloc_skb().

all unchanged

Quoted 1 line

e100: reduce time under spinlock

Dropped patch.

Quoted 11 lines
     e100: remove skb->dev assignment
     e100: increment version to 3.5.16-k2
     ixgb: Convert dev_alloc_skb to netdev_alloc_skb.
     ixgb: convert dev->priv to netdev_priv(dev).
     ixgb: recalculate after how many descriptors to wake the queue
     ixgb: remove skb->dev assignment
     ixgb: Increment version to 1.0.112-k2

Linas Vepstas <[email protected]>
e100: fix error recovery
ixgb: Add PCI Error recovery callbacks

all unchanged

Cheers,

Auke

---
 drivers/net/e100.c                |    8
 drivers/net/e1000/e1000.h         |    6
 drivers/net/e1000/e1000_ethtool.c |  219 ++++---
 drivers/net/e1000/e1000_hw.c      | 1059 ++++++++++++++++++-------------------
 drivers/net/e1000/e1000_hw.h      |   26
 drivers/net/e1000/e1000_main.c    |  145 +++--
 drivers/net/e1000/e1000_param.c   |  161 +++--
 drivers/net/ixgb/ixgb.h           |    5
 drivers/net/ixgb/ixgb_ethtool.c   |    6
 drivers/net/ixgb/ixgb_main.c      |  140 ++++-
 10 files changed, 979 insertions(+), 796 deletions(-)