aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgb
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pretzel.yyz.us>2005-06-26 17:11:03 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-06-26 17:11:03 -0400
commit8b0ee07e108b2eefdab5bb73f33223f18926c3b2 (patch)
treef68ca04180c5488301a40ec212ef2eb2467cf56c /drivers/net/ixgb
parent4638aef40ba9ebb9734caeed1f373c24015259fd (diff)
parent8678887e7fb43cd6c9be6c9807b05e77848e0920 (diff)
Merge upstream (approx. 2.6.12-git8) into 'janitor' branch of netdev-2.6.
Diffstat (limited to 'drivers/net/ixgb')
-rw-r--r--drivers/net/ixgb/ixgb.h2
-rw-r--r--drivers/net/ixgb/ixgb_ee.c24
-rw-r--r--drivers/net/ixgb/ixgb_ethtool.c4
-rw-r--r--drivers/net/ixgb/ixgb_main.c154
-rw-r--r--drivers/net/ixgb/ixgb_osdep.h3
5 files changed, 71 insertions, 116 deletions
diff --git a/drivers/net/ixgb/ixgb.h b/drivers/net/ixgb/ixgb.h
index 26c4f15f7fc..f8d3385c784 100644
--- a/drivers/net/ixgb/ixgb.h
+++ b/drivers/net/ixgb/ixgb.h
@@ -110,7 +110,7 @@ struct ixgb_adapter;
110#define IXGB_TX_QUEUE_WAKE 16 110#define IXGB_TX_QUEUE_WAKE 16
111 111
112/* How many Rx Buffers do we bundle into one write to the hardware ? */ 112/* How many Rx Buffers do we bundle into one write to the hardware ? */
113#define IXGB_RX_BUFFER_WRITE 16 /* Must be power of 2 */ 113#define IXGB_RX_BUFFER_WRITE 4 /* Must be power of 2 */
114 114
115/* only works for sizes that are powers of 2 */ 115/* only works for sizes that are powers of 2 */
116#define IXGB_ROUNDUP(i, size) ((i) = (((i) + (size) - 1) & ~((size) - 1))) 116#define IXGB_ROUNDUP(i, size) ((i) = (((i) + (size) - 1) & ~((size) - 1)))
diff --git a/drivers/net/ixgb/ixgb_ee.c b/drivers/net/ixgb/ixgb_ee.c
index 653e99f919c..3aae110c556 100644
--- a/drivers/net/ixgb/ixgb_ee.c
+++ b/drivers/net/ixgb/ixgb_ee.c
@@ -411,7 +411,7 @@ ixgb_write_eeprom(struct ixgb_hw *hw, uint16_t offset, uint16_t data)
411 ixgb_cleanup_eeprom(hw); 411 ixgb_cleanup_eeprom(hw);
412 412
413 /* clear the init_ctrl_reg_1 to signify that the cache is invalidated */ 413 /* clear the init_ctrl_reg_1 to signify that the cache is invalidated */
414 ee_map->init_ctrl_reg_1 = EEPROM_ICW1_SIGNATURE_CLEAR; 414 ee_map->init_ctrl_reg_1 = le16_to_cpu(EEPROM_ICW1_SIGNATURE_CLEAR);
415 415
416 return; 416 return;
417} 417}
@@ -483,7 +483,7 @@ ixgb_get_eeprom_data(struct ixgb_hw *hw)
483 DEBUGOUT("ixgb_ee: Checksum invalid.\n"); 483 DEBUGOUT("ixgb_ee: Checksum invalid.\n");
484 /* clear the init_ctrl_reg_1 to signify that the cache is 484 /* clear the init_ctrl_reg_1 to signify that the cache is
485 * invalidated */ 485 * invalidated */
486 ee_map->init_ctrl_reg_1 = EEPROM_ICW1_SIGNATURE_CLEAR; 486 ee_map->init_ctrl_reg_1 = le16_to_cpu(EEPROM_ICW1_SIGNATURE_CLEAR);
487 return (FALSE); 487 return (FALSE);
488 } 488 }
489 489
@@ -579,7 +579,7 @@ ixgb_get_ee_compatibility(struct ixgb_hw *hw)
579 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; 579 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
580 580
581 if(ixgb_check_and_get_eeprom_data(hw) == TRUE) 581 if(ixgb_check_and_get_eeprom_data(hw) == TRUE)
582 return(ee_map->compatibility); 582 return (le16_to_cpu(ee_map->compatibility));
583 583
584 return(0); 584 return(0);
585} 585}
@@ -616,7 +616,7 @@ ixgb_get_ee_init_ctrl_reg_1(struct ixgb_hw *hw)
616 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; 616 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
617 617
618 if(ixgb_check_and_get_eeprom_data(hw) == TRUE) 618 if(ixgb_check_and_get_eeprom_data(hw) == TRUE)
619 return(ee_map->init_ctrl_reg_1); 619 return (le16_to_cpu(ee_map->init_ctrl_reg_1));
620 620
621 return(0); 621 return(0);
622} 622}
@@ -635,7 +635,7 @@ ixgb_get_ee_init_ctrl_reg_2(struct ixgb_hw *hw)
635 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; 635 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
636 636
637 if(ixgb_check_and_get_eeprom_data(hw) == TRUE) 637 if(ixgb_check_and_get_eeprom_data(hw) == TRUE)
638 return(ee_map->init_ctrl_reg_2); 638 return (le16_to_cpu(ee_map->init_ctrl_reg_2));
639 639
640 return(0); 640 return(0);
641} 641}
@@ -654,7 +654,7 @@ ixgb_get_ee_subsystem_id(struct ixgb_hw *hw)
654 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; 654 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
655 655
656 if(ixgb_check_and_get_eeprom_data(hw) == TRUE) 656 if(ixgb_check_and_get_eeprom_data(hw) == TRUE)
657 return(ee_map->subsystem_id); 657 return (le16_to_cpu(ee_map->subsystem_id));
658 658
659 return(0); 659 return(0);
660} 660}
@@ -673,7 +673,7 @@ ixgb_get_ee_subvendor_id(struct ixgb_hw *hw)
673 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; 673 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
674 674
675 if(ixgb_check_and_get_eeprom_data(hw) == TRUE) 675 if(ixgb_check_and_get_eeprom_data(hw) == TRUE)
676 return(ee_map->subvendor_id); 676 return (le16_to_cpu(ee_map->subvendor_id));
677 677
678 return(0); 678 return(0);
679} 679}
@@ -692,7 +692,7 @@ ixgb_get_ee_device_id(struct ixgb_hw *hw)
692 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; 692 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
693 693
694 if(ixgb_check_and_get_eeprom_data(hw) == TRUE) 694 if(ixgb_check_and_get_eeprom_data(hw) == TRUE)
695 return(ee_map->device_id); 695 return (le16_to_cpu(ee_map->device_id));
696 696
697 return(0); 697 return(0);
698} 698}
@@ -711,7 +711,7 @@ ixgb_get_ee_vendor_id(struct ixgb_hw *hw)
711 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; 711 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
712 712
713 if(ixgb_check_and_get_eeprom_data(hw) == TRUE) 713 if(ixgb_check_and_get_eeprom_data(hw) == TRUE)
714 return(ee_map->vendor_id); 714 return (le16_to_cpu(ee_map->vendor_id));
715 715
716 return(0); 716 return(0);
717} 717}
@@ -730,7 +730,7 @@ ixgb_get_ee_swdpins_reg(struct ixgb_hw *hw)
730 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; 730 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
731 731
732 if(ixgb_check_and_get_eeprom_data(hw) == TRUE) 732 if(ixgb_check_and_get_eeprom_data(hw) == TRUE)
733 return(ee_map->swdpins_reg); 733 return (le16_to_cpu(ee_map->swdpins_reg));
734 734
735 return(0); 735 return(0);
736} 736}
@@ -749,7 +749,7 @@ ixgb_get_ee_d3_power(struct ixgb_hw *hw)
749 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; 749 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
750 750
751 if(ixgb_check_and_get_eeprom_data(hw) == TRUE) 751 if(ixgb_check_and_get_eeprom_data(hw) == TRUE)
752 return(ee_map->d3_power); 752 return (le16_to_cpu(ee_map->d3_power));
753 753
754 return(0); 754 return(0);
755} 755}
@@ -768,7 +768,7 @@ ixgb_get_ee_d0_power(struct ixgb_hw *hw)
768 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; 768 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
769 769
770 if(ixgb_check_and_get_eeprom_data(hw) == TRUE) 770 if(ixgb_check_and_get_eeprom_data(hw) == TRUE)
771 return(ee_map->d0_power); 771 return (le16_to_cpu(ee_map->d0_power));
772 772
773 return(0); 773 return(0);
774} 774}
diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c
index aea10e8aaa7..3fa113854ee 100644
--- a/drivers/net/ixgb/ixgb_ethtool.c
+++ b/drivers/net/ixgb/ixgb_ethtool.c
@@ -252,7 +252,9 @@ ixgb_get_regs(struct net_device *netdev,
252 uint32_t *reg_start = reg; 252 uint32_t *reg_start = reg;
253 uint8_t i; 253 uint8_t i;
254 254
255 regs->version = (adapter->hw.device_id << 16) | adapter->hw.subsystem_id; 255 /* the 1 (one) below indicates an attempt at versioning, if the
256 * interface in ethtool or the driver this 1 should be incremented */
257 regs->version = (1<<24) | hw->revision_id << 16 | hw->device_id;
256 258
257 /* General Registers */ 259 /* General Registers */
258 *reg++ = IXGB_READ_REG(hw, CTRL0); /* 0 */ 260 *reg++ = IXGB_READ_REG(hw, CTRL0); /* 0 */
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index a6af9d9e340..097b90ccf57 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -47,7 +47,8 @@ char ixgb_driver_string[] = "Intel(R) PRO/10GbE Network Driver";
47#else 47#else
48#define DRIVERNAPI "-NAPI" 48#define DRIVERNAPI "-NAPI"
49#endif 49#endif
50#define DRV_VERSION "1.0.90-k2"DRIVERNAPI 50
51#define DRV_VERSION "1.0.95-k2"DRIVERNAPI
51char ixgb_driver_version[] = DRV_VERSION; 52char ixgb_driver_version[] = DRV_VERSION;
52char ixgb_copyright[] = "Copyright (c) 1999-2005 Intel Corporation."; 53char ixgb_copyright[] = "Copyright (c) 1999-2005 Intel Corporation.";
53 54
@@ -104,6 +105,7 @@ static int ixgb_change_mtu(struct net_device *netdev, int new_mtu);
104static int ixgb_set_mac(struct net_device *netdev, void *p); 105static int ixgb_set_mac(struct net_device *netdev, void *p);
105static irqreturn_t ixgb_intr(int irq, void *data, struct pt_regs *regs); 106static irqreturn_t ixgb_intr(int irq, void *data, struct pt_regs *regs);
106static boolean_t ixgb_clean_tx_irq(struct ixgb_adapter *adapter); 107static boolean_t ixgb_clean_tx_irq(struct ixgb_adapter *adapter);
108
107#ifdef CONFIG_IXGB_NAPI 109#ifdef CONFIG_IXGB_NAPI
108static int ixgb_clean(struct net_device *netdev, int *budget); 110static int ixgb_clean(struct net_device *netdev, int *budget);
109static boolean_t ixgb_clean_rx_irq(struct ixgb_adapter *adapter, 111static boolean_t ixgb_clean_rx_irq(struct ixgb_adapter *adapter,
@@ -121,33 +123,20 @@ static void ixgb_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid);
121static void ixgb_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid); 123static void ixgb_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid);
122static void ixgb_restore_vlan(struct ixgb_adapter *adapter); 124static void ixgb_restore_vlan(struct ixgb_adapter *adapter);
123 125
124static int ixgb_notify_reboot(struct notifier_block *, unsigned long event,
125 void *ptr);
126static int ixgb_suspend(struct pci_dev *pdev, uint32_t state);
127
128#ifdef CONFIG_NET_POLL_CONTROLLER 126#ifdef CONFIG_NET_POLL_CONTROLLER
129/* for netdump / net console */ 127/* for netdump / net console */
130static void ixgb_netpoll(struct net_device *dev); 128static void ixgb_netpoll(struct net_device *dev);
131#endif 129#endif
132 130
133struct notifier_block ixgb_notifier_reboot = {
134 .notifier_call = ixgb_notify_reboot,
135 .next = NULL,
136 .priority = 0
137};
138
139/* Exported from other modules */ 131/* Exported from other modules */
140 132
141extern void ixgb_check_options(struct ixgb_adapter *adapter); 133extern void ixgb_check_options(struct ixgb_adapter *adapter);
142 134
143static struct pci_driver ixgb_driver = { 135static struct pci_driver ixgb_driver = {
144 .name = ixgb_driver_name, 136 .name = ixgb_driver_name,
145 .id_table = ixgb_pci_tbl, 137 .id_table = ixgb_pci_tbl,
146 .probe = ixgb_probe, 138 .probe = ixgb_probe,
147 .remove = __devexit_p(ixgb_remove), 139 .remove = __devexit_p(ixgb_remove),
148 /* Power Managment Hooks */
149 .suspend = NULL,
150 .resume = NULL
151}; 140};
152 141
153MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>"); 142MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>");
@@ -171,17 +160,12 @@ MODULE_VERSION(DRV_VERSION);
171static int __init 160static int __init
172ixgb_init_module(void) 161ixgb_init_module(void)
173{ 162{
174 int ret;
175 printk(KERN_INFO "%s - version %s\n", 163 printk(KERN_INFO "%s - version %s\n",
176 ixgb_driver_string, ixgb_driver_version); 164 ixgb_driver_string, ixgb_driver_version);
177 165
178 printk(KERN_INFO "%s\n", ixgb_copyright); 166 printk(KERN_INFO "%s\n", ixgb_copyright);
179 167
180 ret = pci_module_init(&ixgb_driver); 168 return pci_module_init(&ixgb_driver);
181 if(ret >= 0) {
182 register_reboot_notifier(&ixgb_notifier_reboot);
183 }
184 return ret;
185} 169}
186 170
187module_init(ixgb_init_module); 171module_init(ixgb_init_module);
@@ -196,7 +180,6 @@ module_init(ixgb_init_module);
196static void __exit 180static void __exit
197ixgb_exit_module(void) 181ixgb_exit_module(void)
198{ 182{
199 unregister_reboot_notifier(&ixgb_notifier_reboot);
200 pci_unregister_driver(&ixgb_driver); 183 pci_unregister_driver(&ixgb_driver);
201} 184}
202 185
@@ -226,8 +209,8 @@ ixgb_irq_enable(struct ixgb_adapter *adapter)
226{ 209{
227 if(atomic_dec_and_test(&adapter->irq_sem)) { 210 if(atomic_dec_and_test(&adapter->irq_sem)) {
228 IXGB_WRITE_REG(&adapter->hw, IMS, 211 IXGB_WRITE_REG(&adapter->hw, IMS,
229 IXGB_INT_RXT0 | IXGB_INT_RXDMT0 | IXGB_INT_TXDW | 212 IXGB_INT_RXT0 | IXGB_INT_RXDMT0 | IXGB_INT_TXDW |
230 IXGB_INT_RXO | IXGB_INT_LSC); 213 IXGB_INT_LSC);
231 IXGB_WRITE_FLUSH(&adapter->hw); 214 IXGB_WRITE_FLUSH(&adapter->hw);
232 } 215 }
233} 216}
@@ -1211,10 +1194,10 @@ ixgb_tso(struct ixgb_adapter *adapter, struct sk_buff *skb)
1211 | IXGB_CONTEXT_DESC_CMD_TSE 1194 | IXGB_CONTEXT_DESC_CMD_TSE
1212 | IXGB_CONTEXT_DESC_CMD_IP 1195 | IXGB_CONTEXT_DESC_CMD_IP
1213 | IXGB_CONTEXT_DESC_CMD_TCP 1196 | IXGB_CONTEXT_DESC_CMD_TCP
1214 | IXGB_CONTEXT_DESC_CMD_RS
1215 | IXGB_CONTEXT_DESC_CMD_IDE 1197 | IXGB_CONTEXT_DESC_CMD_IDE
1216 | (skb->len - (hdr_len))); 1198 | (skb->len - (hdr_len)));
1217 1199
1200
1218 if(++i == adapter->tx_ring.count) i = 0; 1201 if(++i == adapter->tx_ring.count) i = 0;
1219 adapter->tx_ring.next_to_use = i; 1202 adapter->tx_ring.next_to_use = i;
1220 1203
@@ -1249,8 +1232,7 @@ ixgb_tx_csum(struct ixgb_adapter *adapter, struct sk_buff *skb)
1249 context_desc->mss = 0; 1232 context_desc->mss = 0;
1250 context_desc->cmd_type_len = 1233 context_desc->cmd_type_len =
1251 cpu_to_le32(IXGB_CONTEXT_DESC_TYPE 1234 cpu_to_le32(IXGB_CONTEXT_DESC_TYPE
1252 | IXGB_TX_DESC_CMD_RS 1235 | IXGB_TX_DESC_CMD_IDE);
1253 | IXGB_TX_DESC_CMD_IDE);
1254 1236
1255 if(++i == adapter->tx_ring.count) i = 0; 1237 if(++i == adapter->tx_ring.count) i = 0;
1256 adapter->tx_ring.next_to_use = i; 1238 adapter->tx_ring.next_to_use = i;
@@ -1275,6 +1257,7 @@ ixgb_tx_map(struct ixgb_adapter *adapter, struct sk_buff *skb,
1275 1257
1276 unsigned int nr_frags = skb_shinfo(skb)->nr_frags; 1258 unsigned int nr_frags = skb_shinfo(skb)->nr_frags;
1277 unsigned int f; 1259 unsigned int f;
1260
1278 len -= skb->data_len; 1261 len -= skb->data_len;
1279 1262
1280 i = tx_ring->next_to_use; 1263 i = tx_ring->next_to_use;
@@ -1528,14 +1511,33 @@ ixgb_change_mtu(struct net_device *netdev, int new_mtu)
1528void 1511void
1529ixgb_update_stats(struct ixgb_adapter *adapter) 1512ixgb_update_stats(struct ixgb_adapter *adapter)
1530{ 1513{
1514 struct net_device *netdev = adapter->netdev;
1515
1516 if((netdev->flags & IFF_PROMISC) || (netdev->flags & IFF_ALLMULTI) ||
1517 (netdev->mc_count > IXGB_MAX_NUM_MULTICAST_ADDRESSES)) {
1518 u64 multi = IXGB_READ_REG(&adapter->hw, MPRCL);
1519 u32 bcast_l = IXGB_READ_REG(&adapter->hw, BPRCL);
1520 u32 bcast_h = IXGB_READ_REG(&adapter->hw, BPRCH);
1521 u64 bcast = ((u64)bcast_h << 32) | bcast_l;
1522
1523 multi |= ((u64)IXGB_READ_REG(&adapter->hw, MPRCH) << 32);
1524 /* fix up multicast stats by removing broadcasts */
1525 multi -= bcast;
1526
1527 adapter->stats.mprcl += (multi & 0xFFFFFFFF);
1528 adapter->stats.mprch += (multi >> 32);
1529 adapter->stats.bprcl += bcast_l;
1530 adapter->stats.bprch += bcast_h;
1531 } else {
1532 adapter->stats.mprcl += IXGB_READ_REG(&adapter->hw, MPRCL);
1533 adapter->stats.mprch += IXGB_READ_REG(&adapter->hw, MPRCH);
1534 adapter->stats.bprcl += IXGB_READ_REG(&adapter->hw, BPRCL);
1535 adapter->stats.bprch += IXGB_READ_REG(&adapter->hw, BPRCH);
1536 }
1531 adapter->stats.tprl += IXGB_READ_REG(&adapter->hw, TPRL); 1537 adapter->stats.tprl += IXGB_READ_REG(&adapter->hw, TPRL);
1532 adapter->stats.tprh += IXGB_READ_REG(&adapter->hw, TPRH); 1538 adapter->stats.tprh += IXGB_READ_REG(&adapter->hw, TPRH);
1533 adapter->stats.gprcl += IXGB_READ_REG(&adapter->hw, GPRCL); 1539 adapter->stats.gprcl += IXGB_READ_REG(&adapter->hw, GPRCL);
1534 adapter->stats.gprch += IXGB_READ_REG(&adapter->hw, GPRCH); 1540 adapter->stats.gprch += IXGB_READ_REG(&adapter->hw, GPRCH);
1535 adapter->stats.bprcl += IXGB_READ_REG(&adapter->hw, BPRCL);
1536 adapter->stats.bprch += IXGB_READ_REG(&adapter->hw, BPRCH);
1537 adapter->stats.mprcl += IXGB_READ_REG(&adapter->hw, MPRCL);
1538 adapter->stats.mprch += IXGB_READ_REG(&adapter->hw, MPRCH);
1539 adapter->stats.uprcl += IXGB_READ_REG(&adapter->hw, UPRCL); 1541 adapter->stats.uprcl += IXGB_READ_REG(&adapter->hw, UPRCL);
1540 adapter->stats.uprch += IXGB_READ_REG(&adapter->hw, UPRCH); 1542 adapter->stats.uprch += IXGB_READ_REG(&adapter->hw, UPRCH);
1541 adapter->stats.vprcl += IXGB_READ_REG(&adapter->hw, VPRCL); 1543 adapter->stats.vprcl += IXGB_READ_REG(&adapter->hw, VPRCL);
@@ -1825,7 +1827,6 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter)
1825 struct pci_dev *pdev = adapter->pdev; 1827 struct pci_dev *pdev = adapter->pdev;
1826 struct ixgb_rx_desc *rx_desc, *next_rxd; 1828 struct ixgb_rx_desc *rx_desc, *next_rxd;
1827 struct ixgb_buffer *buffer_info, *next_buffer, *next2_buffer; 1829 struct ixgb_buffer *buffer_info, *next_buffer, *next2_buffer;
1828 struct sk_buff *skb, *next_skb;
1829 uint32_t length; 1830 uint32_t length;
1830 unsigned int i, j; 1831 unsigned int i, j;
1831 boolean_t cleaned = FALSE; 1832 boolean_t cleaned = FALSE;
@@ -1835,6 +1836,8 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter)
1835 buffer_info = &rx_ring->buffer_info[i]; 1836 buffer_info = &rx_ring->buffer_info[i];
1836 1837
1837 while(rx_desc->status & IXGB_RX_DESC_STATUS_DD) { 1838 while(rx_desc->status & IXGB_RX_DESC_STATUS_DD) {
1839 struct sk_buff *skb, *next_skb;
1840 u8 status;
1838 1841
1839#ifdef CONFIG_IXGB_NAPI 1842#ifdef CONFIG_IXGB_NAPI
1840 if(*work_done >= work_to_do) 1843 if(*work_done >= work_to_do)
@@ -1842,7 +1845,9 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter)
1842 1845
1843 (*work_done)++; 1846 (*work_done)++;
1844#endif 1847#endif
1848 status = rx_desc->status;
1845 skb = buffer_info->skb; 1849 skb = buffer_info->skb;
1850
1846 prefetch(skb->data); 1851 prefetch(skb->data);
1847 1852
1848 if(++i == rx_ring->count) i = 0; 1853 if(++i == rx_ring->count) i = 0;
@@ -1857,7 +1862,6 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter)
1857 next_skb = next_buffer->skb; 1862 next_skb = next_buffer->skb;
1858 prefetch(next_skb); 1863 prefetch(next_skb);
1859 1864
1860
1861 cleaned = TRUE; 1865 cleaned = TRUE;
1862 1866
1863 pci_unmap_single(pdev, 1867 pci_unmap_single(pdev,
@@ -1867,7 +1871,7 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter)
1867 1871
1868 length = le16_to_cpu(rx_desc->length); 1872 length = le16_to_cpu(rx_desc->length);
1869 1873
1870 if(unlikely(!(rx_desc->status & IXGB_RX_DESC_STATUS_EOP))) { 1874 if(unlikely(!(status & IXGB_RX_DESC_STATUS_EOP))) {
1871 1875
1872 /* All receives must fit into a single buffer */ 1876 /* All receives must fit into a single buffer */
1873 1877
@@ -1875,12 +1879,7 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter)
1875 "length<%x>\n", length); 1879 "length<%x>\n", length);
1876 1880
1877 dev_kfree_skb_irq(skb); 1881 dev_kfree_skb_irq(skb);
1878 rx_desc->status = 0; 1882 goto rxdesc_done;
1879 buffer_info->skb = NULL;
1880
1881 rx_desc = next_rxd;
1882 buffer_info = next_buffer;
1883 continue;
1884 } 1883 }
1885 1884
1886 if (unlikely(rx_desc->errors 1885 if (unlikely(rx_desc->errors
@@ -1889,12 +1888,7 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter)
1889 IXGB_RX_DESC_ERRORS_RXE))) { 1888 IXGB_RX_DESC_ERRORS_RXE))) {
1890 1889
1891 dev_kfree_skb_irq(skb); 1890 dev_kfree_skb_irq(skb);
1892 rx_desc->status = 0; 1891 goto rxdesc_done;
1893 buffer_info->skb = NULL;
1894
1895 rx_desc = next_rxd;
1896 buffer_info = next_buffer;
1897 continue;
1898 } 1892 }
1899 1893
1900 /* Good Receive */ 1894 /* Good Receive */
@@ -1905,7 +1899,7 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter)
1905 1899
1906 skb->protocol = eth_type_trans(skb, netdev); 1900 skb->protocol = eth_type_trans(skb, netdev);
1907#ifdef CONFIG_IXGB_NAPI 1901#ifdef CONFIG_IXGB_NAPI
1908 if(adapter->vlgrp && (rx_desc->status & IXGB_RX_DESC_STATUS_VP)) { 1902 if(adapter->vlgrp && (status & IXGB_RX_DESC_STATUS_VP)) {
1909 vlan_hwaccel_receive_skb(skb, adapter->vlgrp, 1903 vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
1910 le16_to_cpu(rx_desc->special) & 1904 le16_to_cpu(rx_desc->special) &
1911 IXGB_RX_DESC_SPECIAL_VLAN_MASK); 1905 IXGB_RX_DESC_SPECIAL_VLAN_MASK);
@@ -1913,7 +1907,7 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter)
1913 netif_receive_skb(skb); 1907 netif_receive_skb(skb);
1914 } 1908 }
1915#else /* CONFIG_IXGB_NAPI */ 1909#else /* CONFIG_IXGB_NAPI */
1916 if(adapter->vlgrp && (rx_desc->status & IXGB_RX_DESC_STATUS_VP)) { 1910 if(adapter->vlgrp && (status & IXGB_RX_DESC_STATUS_VP)) {
1917 vlan_hwaccel_rx(skb, adapter->vlgrp, 1911 vlan_hwaccel_rx(skb, adapter->vlgrp,
1918 le16_to_cpu(rx_desc->special) & 1912 le16_to_cpu(rx_desc->special) &
1919 IXGB_RX_DESC_SPECIAL_VLAN_MASK); 1913 IXGB_RX_DESC_SPECIAL_VLAN_MASK);
@@ -1923,9 +1917,12 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter)
1923#endif /* CONFIG_IXGB_NAPI */ 1917#endif /* CONFIG_IXGB_NAPI */
1924 netdev->last_rx = jiffies; 1918 netdev->last_rx = jiffies;
1925 1919
1920rxdesc_done:
1921 /* clean up descriptor, might be written over by hw */
1926 rx_desc->status = 0; 1922 rx_desc->status = 0;
1927 buffer_info->skb = NULL; 1923 buffer_info->skb = NULL;
1928 1924
1925 /* use prefetched values */
1929 rx_desc = next_rxd; 1926 rx_desc = next_rxd;
1930 buffer_info = next_buffer; 1927 buffer_info = next_buffer;
1931 } 1928 }
@@ -1961,8 +1958,8 @@ ixgb_alloc_rx_buffers(struct ixgb_adapter *adapter)
1961 1958
1962 num_group_tail_writes = IXGB_RX_BUFFER_WRITE; 1959 num_group_tail_writes = IXGB_RX_BUFFER_WRITE;
1963 1960
1964 /* leave one descriptor unused */ 1961 /* leave three descriptors unused */
1965 while(--cleancount > 0) { 1962 while(--cleancount > 2) {
1966 rx_desc = IXGB_RX_DESC(*rx_ring, i); 1963 rx_desc = IXGB_RX_DESC(*rx_ring, i);
1967 1964
1968 skb = dev_alloc_skb(adapter->rx_buffer_len + NET_IP_ALIGN); 1965 skb = dev_alloc_skb(adapter->rx_buffer_len + NET_IP_ALIGN);
@@ -1989,6 +1986,10 @@ ixgb_alloc_rx_buffers(struct ixgb_adapter *adapter)
1989 PCI_DMA_FROMDEVICE); 1986 PCI_DMA_FROMDEVICE);
1990 1987
1991 rx_desc->buff_addr = cpu_to_le64(buffer_info->dma); 1988 rx_desc->buff_addr = cpu_to_le64(buffer_info->dma);
1989 /* guarantee DD bit not set now before h/w gets descriptor
1990 * this is the rest of the workaround for h/w double
1991 * writeback. */
1992 rx_desc->status = 0;
1992 1993
1993 if((i & ~(num_group_tail_writes- 1)) == i) { 1994 if((i & ~(num_group_tail_writes- 1)) == i) {
1994 /* Force memory writes to complete before letting h/w 1995 /* Force memory writes to complete before letting h/w
@@ -2101,54 +2102,6 @@ ixgb_restore_vlan(struct ixgb_adapter *adapter)
2101 } 2102 }
2102} 2103}
2103 2104
2104/**
2105 * ixgb_notify_reboot - handles OS notification of reboot event.
2106 * @param nb notifier block, unused
2107 * @param event Event being passed to driver to act upon
2108 * @param p A pointer to our net device
2109 **/
2110static int
2111ixgb_notify_reboot(struct notifier_block *nb, unsigned long event, void *p)
2112{
2113 struct pci_dev *pdev = NULL;
2114
2115 switch(event) {
2116 case SYS_DOWN:
2117 case SYS_HALT:
2118 case SYS_POWER_OFF:
2119 while ((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev))) {
2120 if (pci_dev_driver(pdev) == &ixgb_driver)
2121 ixgb_suspend(pdev, 3);
2122 }
2123 }
2124 return NOTIFY_DONE;
2125}
2126
2127/**
2128 * ixgb_suspend - driver suspend function called from notify.
2129 * @param pdev pci driver structure used for passing to
2130 * @param state power state to enter
2131 **/
2132static int
2133ixgb_suspend(struct pci_dev *pdev, uint32_t state)
2134{
2135 struct net_device *netdev = pci_get_drvdata(pdev);
2136 struct ixgb_adapter *adapter = netdev->priv;
2137
2138 netif_device_detach(netdev);
2139
2140 if(netif_running(netdev))
2141 ixgb_down(adapter, TRUE);
2142
2143 pci_save_state(pdev);
2144
2145 state = (state > 0) ? 3 : 0;
2146 pci_set_power_state(pdev, state);
2147 msec_delay(200);
2148
2149 return 0;
2150}
2151
2152#ifdef CONFIG_NET_POLL_CONTROLLER 2105#ifdef CONFIG_NET_POLL_CONTROLLER
2153/* 2106/*
2154 * Polling 'interrupt' - used by things like netconsole to send skbs 2107 * Polling 'interrupt' - used by things like netconsole to send skbs
@@ -2159,6 +2112,7 @@ ixgb_suspend(struct pci_dev *pdev, uint32_t state)
2159static void ixgb_netpoll(struct net_device *dev) 2112static void ixgb_netpoll(struct net_device *dev)
2160{ 2113{
2161 struct ixgb_adapter *adapter = dev->priv; 2114 struct ixgb_adapter *adapter = dev->priv;
2115
2162 disable_irq(adapter->pdev->irq); 2116 disable_irq(adapter->pdev->irq);
2163 ixgb_intr(adapter->pdev->irq, dev, NULL); 2117 ixgb_intr(adapter->pdev->irq, dev, NULL);
2164 enable_irq(adapter->pdev->irq); 2118 enable_irq(adapter->pdev->irq);
diff --git a/drivers/net/ixgb/ixgb_osdep.h b/drivers/net/ixgb/ixgb_osdep.h
index 9eba9289190..dba20481ee8 100644
--- a/drivers/net/ixgb/ixgb_osdep.h
+++ b/drivers/net/ixgb/ixgb_osdep.h
@@ -45,8 +45,7 @@
45 /* Don't mdelay in interrupt context! */ \ 45 /* Don't mdelay in interrupt context! */ \
46 BUG(); \ 46 BUG(); \
47 } else { \ 47 } else { \
48 set_current_state(TASK_UNINTERRUPTIBLE); \ 48 msleep(x); \
49 schedule_timeout((x * HZ)/1000 + 2); \
50 } } while(0) 49 } } while(0)
51#endif 50#endif
52 51