aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorBruce Allan <bruce.w.allan@intel.com>2008-11-21 20:00:22 -0500
committerDavid S. Miller <davem@davemloft.net>2008-11-21 20:00:22 -0500
commit8452759060ad46fc071a7d5bbf1647df5ea2ceab (patch)
treed6dc357a82e32e1c021773dfe9163e053fbdd711 /drivers/net
parent0285c8dcaeaa73ddadc4f38383e5bbc03c394a29 (diff)
e1000e: store EEPROM version number to prevent unnecessary NVM reads
Rather than reading the NVM to get the EEPROM version number everytime the ethool get_drvinfo function is called, read it once during probe and save it for future reference. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/e1000e/e1000.h1
-rw-r--r--drivers/net/e1000e/ethtool.c8
-rw-r--r--drivers/net/e1000e/netdev.c3
3 files changed, 7 insertions, 5 deletions
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h
index c55fd6fdb91c..473c41479ece 100644
--- a/drivers/net/e1000e/e1000.h
+++ b/drivers/net/e1000e/e1000.h
@@ -193,6 +193,7 @@ struct e1000_adapter {
193 u16 mng_vlan_id; 193 u16 mng_vlan_id;
194 u16 link_speed; 194 u16 link_speed;
195 u16 link_duplex; 195 u16 link_duplex;
196 u16 eeprom_vers;
196 197
197 spinlock_t tx_queue_lock; /* prevent concurrent tail updates */ 198 spinlock_t tx_queue_lock; /* prevent concurrent tail updates */
198 199
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index 875d769531fd..840e8c4fb753 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -588,7 +588,6 @@ static void e1000_get_drvinfo(struct net_device *netdev,
588{ 588{
589 struct e1000_adapter *adapter = netdev_priv(netdev); 589 struct e1000_adapter *adapter = netdev_priv(netdev);
590 char firmware_version[32]; 590 char firmware_version[32];
591 u16 eeprom_data;
592 591
593 strncpy(drvinfo->driver, e1000e_driver_name, 32); 592 strncpy(drvinfo->driver, e1000e_driver_name, 32);
594 strncpy(drvinfo->version, e1000e_driver_version, 32); 593 strncpy(drvinfo->version, e1000e_driver_version, 32);
@@ -597,11 +596,10 @@ static void e1000_get_drvinfo(struct net_device *netdev,
597 * EEPROM image version # is reported as firmware version # for 596 * EEPROM image version # is reported as firmware version # for
598 * PCI-E controllers 597 * PCI-E controllers
599 */ 598 */
600 e1000_read_nvm(&adapter->hw, 5, 1, &eeprom_data);
601 sprintf(firmware_version, "%d.%d-%d", 599 sprintf(firmware_version, "%d.%d-%d",
602 (eeprom_data & 0xF000) >> 12, 600 (adapter->eeprom_vers & 0xF000) >> 12,
603 (eeprom_data & 0x0FF0) >> 4, 601 (adapter->eeprom_vers & 0x0FF0) >> 4,
604 eeprom_data & 0x000F); 602 (adapter->eeprom_vers & 0x000F));
605 603
606 strncpy(drvinfo->fw_version, firmware_version, 32); 604 strncpy(drvinfo->fw_version, firmware_version, 32);
607 strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 32); 605 strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 32);
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index f10252b055d4..b3f0b4797016 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -5025,6 +5025,9 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
5025 adapter->wol = adapter->eeprom_wol; 5025 adapter->wol = adapter->eeprom_wol;
5026 device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); 5026 device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol);
5027 5027
5028 /* save off EEPROM version number */
5029 e1000_read_nvm(&adapter->hw, 5, 1, &adapter->eeprom_vers);
5030
5028 /* reset the hardware with the new settings */ 5031 /* reset the hardware with the new settings */
5029 e1000e_reset(adapter); 5032 e1000e_reset(adapter);
5030 5033