1 /*******************************************************************************
4 Copyright(c) 1999 - 2004 Intel Corporation. All rights reserved.
6 This program is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 2 of the License, or (at your option)
11 This program is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 You should have received a copy of the GNU General Public License along with
17 this program; if not, write to the Free Software Foundation, Inc., 59
18 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 The full GNU General Public License is included in this distribution in the
24 Linux NICS <linux.nics@intel.com>
25 Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
27 *******************************************************************************/
31 char ixgb_driver_name[] = "ixgb";
32 char ixgb_driver_string[] = "Intel(R) PRO/10GbE Network Driver";
33 #define DRV_VERSION "1.0.66-k2"
34 char ixgb_driver_version[] = DRV_VERSION;
35 char ixgb_copyright[] = "Copyright (c) 2001-2004 Intel Corporation.";
37 /* ixgb_pci_tbl - PCI Device ID Table
39 * Wildcard entries (PCI_ANY_ID) should come last
40 * Last entry must be all 0s
42 * { Vendor ID, Device ID, SubVendor ID, SubDevice ID,
43 * Class, Class Mask, private data (not used) }
45 static struct pci_device_id ixgb_pci_tbl[] = {
46 {INTEL_VENDOR_ID, IXGB_DEVICE_ID_82597EX,
47 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
48 {INTEL_VENDOR_ID, IXGB_DEVICE_ID_82597EX_SR,
49 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
51 /* required last entry */
55 MODULE_DEVICE_TABLE(pci, ixgb_pci_tbl);
57 /* Local Function Prototypes */
59 static inline void ixgb_irq_disable(struct ixgb_adapter *adapter);
60 static inline void ixgb_irq_enable(struct ixgb_adapter *adapter);
61 int ixgb_up(struct ixgb_adapter *adapter);
62 void ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog);
63 void ixgb_reset(struct ixgb_adapter *adapter);
65 static int ixgb_init_module(void);
66 static void ixgb_exit_module(void);
67 static int ixgb_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
68 static void __devexit ixgb_remove(struct pci_dev *pdev);
69 static int ixgb_sw_init(struct ixgb_adapter *adapter);
70 static int ixgb_open(struct net_device *netdev);
71 static int ixgb_close(struct net_device *netdev);
72 static int ixgb_setup_tx_resources(struct ixgb_adapter *adapter);
73 static int ixgb_setup_rx_resources(struct ixgb_adapter *adapter);
74 static void ixgb_configure_tx(struct ixgb_adapter *adapter);
75 static void ixgb_configure_rx(struct ixgb_adapter *adapter);
76 static void ixgb_setup_rctl(struct ixgb_adapter *adapter);
77 static void ixgb_clean_tx_ring(struct ixgb_adapter *adapter);
78 static void ixgb_clean_rx_ring(struct ixgb_adapter *adapter);
79 static void ixgb_free_tx_resources(struct ixgb_adapter *adapter);
80 static void ixgb_free_rx_resources(struct ixgb_adapter *adapter);
81 static void ixgb_set_multi(struct net_device *netdev);
82 static void ixgb_watchdog(unsigned long data);
83 static int ixgb_xmit_frame(struct sk_buff *skb, struct net_device *netdev);
84 static struct net_device_stats *ixgb_get_stats(struct net_device *netdev);
85 static int ixgb_change_mtu(struct net_device *netdev, int new_mtu);
86 static int ixgb_set_mac(struct net_device *netdev, void *p);
87 static void ixgb_update_stats(struct ixgb_adapter *adapter);
88 static irqreturn_t ixgb_intr(int irq, void *data, struct pt_regs *regs);
89 static boolean_t ixgb_clean_tx_irq(struct ixgb_adapter *adapter);
90 static inline void ixgb_rx_checksum(struct ixgb_adapter *adapter,
91 struct ixgb_rx_desc *rx_desc,
93 #ifdef CONFIG_IXGB_NAPI
94 static int ixgb_clean(struct net_device *netdev, int *budget);
95 static boolean_t ixgb_clean_rx_irq(struct ixgb_adapter *adapter,
96 int *work_done, int work_to_do);
98 static boolean_t ixgb_clean_rx_irq(struct ixgb_adapter *adapter);
100 static void ixgb_alloc_rx_buffers(struct ixgb_adapter *adapter);
101 static void ixgb_tx_timeout(struct net_device *dev);
102 static void ixgb_tx_timeout_task(struct net_device *dev);
103 static void ixgb_vlan_rx_register(struct net_device *netdev,
104 struct vlan_group *grp);
105 static void ixgb_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid);
106 static void ixgb_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid);
107 static void ixgb_restore_vlan(struct ixgb_adapter *adapter);
109 static int ixgb_notify_reboot(struct notifier_block *, unsigned long event,
111 static int ixgb_suspend(struct pci_dev *pdev, uint32_t state);
113 #ifdef CONFIG_NET_POLL_CONTROLLER
114 /* for netdump / net console */
115 static void ixgb_netpoll(struct net_device *dev);
118 struct notifier_block ixgb_notifier_reboot = {
119 .notifier_call = ixgb_notify_reboot,
124 /* Exported from other modules */
126 extern void ixgb_check_options(struct ixgb_adapter *adapter);
127 extern struct ethtool_ops ixgb_ethtool_ops;
129 static struct pci_driver ixgb_driver = {
130 .name = ixgb_driver_name,
131 .id_table = ixgb_pci_tbl,
133 .remove = __devexit_p(ixgb_remove),
134 /* Power Managment Hooks */
139 MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>");
140 MODULE_DESCRIPTION("Intel(R) PRO/10GbE Network Driver");
141 MODULE_LICENSE("GPL");
142 MODULE_VERSION(DRV_VERSION);
144 /* some defines for controlling descriptor fetches in h/w */
145 #define RXDCTL_PTHRESH_DEFAULT 128 /* chip considers prefech below this */
146 #define RXDCTL_HTHRESH_DEFAULT 16 /* chip will only prefetch if tail is
147 pushed this many descriptors from head */
148 #define RXDCTL_WTHRESH_DEFAULT 16 /* chip writes back at this many or RXT0 */
151 * ixgb_init_module - Driver Registration Routine
153 * ixgb_init_module is the first routine called when the driver is
154 * loaded. All it does is register with the PCI subsystem.
157 static int __init ixgb_init_module(void)
160 printk(KERN_INFO "%s - version %s\n",
161 ixgb_driver_string, ixgb_driver_version);
163 printk(KERN_INFO "%s\n", ixgb_copyright);
165 ret = pci_module_init(&ixgb_driver);
167 register_reboot_notifier(&ixgb_notifier_reboot);
172 module_init(ixgb_init_module);
175 * ixgb_exit_module - Driver Exit Cleanup Routine
177 * ixgb_exit_module is called just before the driver is removed
181 static void __exit ixgb_exit_module(void)
183 unregister_reboot_notifier(&ixgb_notifier_reboot);
184 pci_unregister_driver(&ixgb_driver);
187 module_exit(ixgb_exit_module);
190 * ixgb_irq_disable - Mask off interrupt generation on the NIC
191 * @adapter: board private structure
194 static inline void ixgb_irq_disable(struct ixgb_adapter *adapter)
196 atomic_inc(&adapter->irq_sem);
197 IXGB_WRITE_REG(&adapter->hw, IMC, ~0);
198 IXGB_WRITE_FLUSH(&adapter->hw);
199 synchronize_irq(adapter->pdev->irq);
203 * ixgb_irq_enable - Enable default interrupt generation settings
204 * @adapter: board private structure
207 static inline void ixgb_irq_enable(struct ixgb_adapter *adapter)
209 if (atomic_dec_and_test(&adapter->irq_sem)) {
210 IXGB_WRITE_REG(&adapter->hw, IMS,
211 IXGB_INT_RXT0 | IXGB_INT_RXDMT0 | IXGB_INT_TXDW |
212 IXGB_INT_RXO | IXGB_INT_LSC);
213 IXGB_WRITE_FLUSH(&adapter->hw);
217 int ixgb_up(struct ixgb_adapter *adapter)
219 struct net_device *netdev = adapter->netdev;
221 int max_frame = netdev->mtu + ENET_HEADER_SIZE + ENET_FCS_LENGTH;
222 struct ixgb_hw *hw = &adapter->hw;
224 /* hardware has been reset, we need to reload some things */
226 ixgb_set_multi(netdev);
228 ixgb_restore_vlan(adapter);
230 ixgb_configure_tx(adapter);
231 ixgb_setup_rctl(adapter);
232 ixgb_configure_rx(adapter);
233 ixgb_alloc_rx_buffers(adapter);
235 if ((err = request_irq(adapter->pdev->irq, &ixgb_intr,
236 SA_SHIRQ | SA_SAMPLE_RANDOM,
237 netdev->name, netdev)))
240 /* disable interrupts and get the hardware into a known state */
241 IXGB_WRITE_REG(&adapter->hw, IMC, 0xffffffff);
243 if ((hw->max_frame_size != max_frame) ||
244 (hw->max_frame_size !=
245 (IXGB_READ_REG(hw, MFS) >> IXGB_MFS_SHIFT))) {
247 hw->max_frame_size = max_frame;
249 IXGB_WRITE_REG(hw, MFS, hw->max_frame_size << IXGB_MFS_SHIFT);
251 if (hw->max_frame_size >
252 IXGB_MAX_ENET_FRAME_SIZE_WITHOUT_FCS + ENET_FCS_LENGTH) {
253 uint32_t ctrl0 = IXGB_READ_REG(hw, CTRL0);
255 if (!(ctrl0 & IXGB_CTRL0_JFE)) {
256 ctrl0 |= IXGB_CTRL0_JFE;
257 IXGB_WRITE_REG(hw, CTRL0, ctrl0);
262 mod_timer(&adapter->watchdog_timer, jiffies);
263 ixgb_irq_enable(adapter);
268 void ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog)
270 struct net_device *netdev = adapter->netdev;
272 ixgb_irq_disable(adapter);
273 free_irq(adapter->pdev->irq, netdev);
275 del_timer_sync(&adapter->watchdog_timer);
276 adapter->link_speed = 0;
277 adapter->link_duplex = 0;
278 netif_carrier_off(netdev);
279 netif_stop_queue(netdev);
282 ixgb_clean_tx_ring(adapter);
283 ixgb_clean_rx_ring(adapter);
286 void ixgb_reset(struct ixgb_adapter *adapter)
289 ixgb_adapter_stop(&adapter->hw);
290 if (!ixgb_init_hw(&adapter->hw))
291 IXGB_DBG("ixgb_init_hw failed.\n");
295 * ixgb_probe - Device Initialization Routine
296 * @pdev: PCI device information struct
297 * @ent: entry in ixgb_pci_tbl
299 * Returns 0 on success, negative on failure
301 * ixgb_probe initializes an adapter identified by a pci_dev structure.
302 * The OS initialization, configuring of the adapter private structure,
303 * and a hardware reset occur.
307 ixgb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
309 struct net_device *netdev = NULL;
310 struct ixgb_adapter *adapter;
311 static int cards_found = 0;
312 unsigned long mmio_start;
318 if ((err = pci_enable_device(pdev)))
321 if (!(err = pci_set_dma_mask(pdev, DMA_64BIT_MASK))) {
324 if ((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK))) {
325 IXGB_ERR("No usable DMA configuration, aborting\n");
331 if ((err = pci_request_regions(pdev, ixgb_driver_name)))
334 pci_set_master(pdev);
336 netdev = alloc_etherdev(sizeof(struct ixgb_adapter));
339 goto err_alloc_etherdev;
342 SET_MODULE_OWNER(netdev);
343 SET_NETDEV_DEV(netdev, &pdev->dev);
345 pci_set_drvdata(pdev, netdev);
346 adapter = netdev->priv;
347 adapter->netdev = netdev;
348 adapter->pdev = pdev;
349 adapter->hw.back = adapter;
351 mmio_start = pci_resource_start(pdev, BAR_0);
352 mmio_len = pci_resource_len(pdev, BAR_0);
354 adapter->hw.hw_addr = ioremap(mmio_start, mmio_len);
355 if (!adapter->hw.hw_addr) {
360 for (i = BAR_1; i <= BAR_5; i++) {
361 if (pci_resource_len(pdev, i) == 0)
363 if (pci_resource_flags(pdev, i) & IORESOURCE_IO) {
364 adapter->hw.io_base = pci_resource_start(pdev, i);
369 netdev->open = &ixgb_open;
370 netdev->stop = &ixgb_close;
371 netdev->hard_start_xmit = &ixgb_xmit_frame;
372 netdev->get_stats = &ixgb_get_stats;
373 netdev->set_multicast_list = &ixgb_set_multi;
374 netdev->set_mac_address = &ixgb_set_mac;
375 netdev->change_mtu = &ixgb_change_mtu;
376 netdev->tx_timeout = &ixgb_tx_timeout;
377 netdev->watchdog_timeo = HZ;
378 SET_ETHTOOL_OPS(netdev, &ixgb_ethtool_ops);
379 #ifdef CONFIG_IXGB_NAPI
380 netdev->poll = &ixgb_clean;
383 netdev->vlan_rx_register = ixgb_vlan_rx_register;
384 netdev->vlan_rx_add_vid = ixgb_vlan_rx_add_vid;
385 netdev->vlan_rx_kill_vid = ixgb_vlan_rx_kill_vid;
386 #ifdef CONFIG_NET_POLL_CONTROLLER
387 netdev->poll_controller = ixgb_netpoll;
390 netdev->mem_start = mmio_start;
391 netdev->mem_end = mmio_start + mmio_len;
392 netdev->base_addr = adapter->hw.io_base;
394 adapter->bd_number = cards_found;
395 adapter->link_speed = 0;
396 adapter->link_duplex = 0;
398 /* setup the private structure */
400 if ((err = ixgb_sw_init(adapter)))
403 netdev->features = NETIF_F_SG |
405 NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER;
407 netdev->features |= NETIF_F_TSO;
411 netdev->features |= NETIF_F_HIGHDMA;
413 /* make sure the EEPROM is good */
415 if (!ixgb_validate_eeprom_checksum(&adapter->hw)) {
416 printk(KERN_ERR "The EEPROM Checksum Is Not Valid\n");
421 ixgb_get_ee_mac_addr(&adapter->hw, netdev->dev_addr);
423 if (!is_valid_ether_addr(netdev->dev_addr)) {
428 adapter->part_num = ixgb_get_ee_pba_number(&adapter->hw);
430 init_timer(&adapter->watchdog_timer);
431 adapter->watchdog_timer.function = &ixgb_watchdog;
432 adapter->watchdog_timer.data = (unsigned long)adapter;
434 INIT_WORK(&adapter->tx_timeout_task,
435 (void (*)(void *))ixgb_tx_timeout_task, netdev);
437 if ((err = register_netdev(netdev)))
440 /* we're going to reset, so assume we have no link for now */
442 netif_carrier_off(netdev);
443 netif_stop_queue(netdev);
445 printk(KERN_INFO "%s: Intel(R) PRO/10GbE Network Connection\n",
447 ixgb_check_options(adapter);
448 /* reset the hardware with the new settings */
458 iounmap(adapter->hw.hw_addr);
462 pci_release_regions(pdev);
467 * ixgb_remove - Device Removal Routine
468 * @pdev: PCI device information struct
470 * ixgb_remove is called by the PCI subsystem to alert the driver
471 * that it should release a PCI device. The could be caused by a
472 * Hot-Plug event, or because the driver is going to be removed from
476 static void __devexit ixgb_remove(struct pci_dev *pdev)
478 struct net_device *netdev = pci_get_drvdata(pdev);
479 struct ixgb_adapter *adapter = netdev->priv;
481 unregister_netdev(netdev);
483 iounmap(adapter->hw.hw_addr);
484 pci_release_regions(pdev);
490 * ixgb_sw_init - Initialize general software structures (struct ixgb_adapter)
491 * @adapter: board private structure to initialize
493 * ixgb_sw_init initializes the Adapter private data structure.
494 * Fields are initialized based on PCI device information and
495 * OS network device settings (MTU size).
498 static int __devinit ixgb_sw_init(struct ixgb_adapter *adapter)
500 struct ixgb_hw *hw = &adapter->hw;
501 struct net_device *netdev = adapter->netdev;
502 struct pci_dev *pdev = adapter->pdev;
504 /* PCI config space info */
506 hw->vendor_id = pdev->vendor;
507 hw->device_id = pdev->device;
508 hw->subsystem_vendor_id = pdev->subsystem_vendor;
509 hw->subsystem_id = pdev->subsystem_device;
511 adapter->rx_buffer_len = IXGB_RXBUFFER_2048;
513 hw->max_frame_size = netdev->mtu + ENET_HEADER_SIZE + ENET_FCS_LENGTH;
515 if ((hw->device_id == IXGB_DEVICE_ID_82597EX)
516 || (hw->device_id == IXGB_DEVICE_ID_82597EX_SR))
517 hw->mac_type = ixgb_82597;
519 /* should never have loaded on this device */
520 printk(KERN_ERR "ixgb: unsupported device id\n");
523 /* enable flow control to be programmed */
526 atomic_set(&adapter->irq_sem, 1);
527 spin_lock_init(&adapter->tx_lock);
533 * ixgb_open - Called when a network interface is made active
534 * @netdev: network interface device structure
536 * Returns 0 on success, negative value on failure
538 * The open entry point is called when a network interface is made
539 * active by the system (IFF_UP). At this point all resources needed
540 * for transmit and receive operations are allocated, the interrupt
541 * handler is registered with the OS, the watchdog timer is started,
542 * and the stack is notified that the interface is ready.
545 static int ixgb_open(struct net_device *netdev)
547 struct ixgb_adapter *adapter = netdev->priv;
550 /* allocate transmit descriptors */
552 if ((err = ixgb_setup_tx_resources(adapter)))
555 /* allocate receive descriptors */
557 if ((err = ixgb_setup_rx_resources(adapter)))
560 if ((err = ixgb_up(adapter)))
566 ixgb_free_rx_resources(adapter);
568 ixgb_free_tx_resources(adapter);
576 * ixgb_close - Disables a network interface
577 * @netdev: network interface device structure
579 * Returns 0, this is not allowed to fail
581 * The close entry point is called when an interface is de-activated
582 * by the OS. The hardware is still under the drivers control, but
583 * needs to be disabled. A global MAC reset is issued to stop the
584 * hardware, and all transmit and receive resources are freed.
587 static int ixgb_close(struct net_device *netdev)
589 struct ixgb_adapter *adapter = netdev->priv;
591 ixgb_down(adapter, TRUE);
593 ixgb_free_tx_resources(adapter);
594 ixgb_free_rx_resources(adapter);
600 * ixgb_setup_tx_resources - allocate Tx resources (Descriptors)
601 * @adapter: board private structure
603 * Return 0 on success, negative on failure
606 static int ixgb_setup_tx_resources(struct ixgb_adapter *adapter)
608 struct ixgb_desc_ring *txdr = &adapter->tx_ring;
609 struct pci_dev *pdev = adapter->pdev;
612 size = sizeof(struct ixgb_buffer) * txdr->count;
613 txdr->buffer_info = kmalloc(size, GFP_KERNEL);
614 if (!txdr->buffer_info) {
617 memset(txdr->buffer_info, 0, size);
619 /* round up to nearest 4K */
621 txdr->size = txdr->count * sizeof(struct ixgb_tx_desc);
622 IXGB_ROUNDUP(txdr->size, 4096);
624 txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma);
626 kfree(txdr->buffer_info);
629 memset(txdr->desc, 0, txdr->size);
631 txdr->next_to_use = 0;
632 txdr->next_to_clean = 0;
638 * ixgb_configure_tx - Configure 82597 Transmit Unit after Reset.
639 * @adapter: board private structure
641 * Configure the Tx unit of the MAC after a reset.
644 static void ixgb_configure_tx(struct ixgb_adapter *adapter)
646 uint64_t tdba = adapter->tx_ring.dma;
647 uint32_t tdlen = adapter->tx_ring.count * sizeof(struct ixgb_tx_desc);
649 struct ixgb_hw *hw = &adapter->hw;
651 /* Setup the Base and Length of the Tx Descriptor Ring
652 * tx_ring.dma can be either a 32 or 64 bit value
655 IXGB_WRITE_REG(hw, TDBAL, (tdba & 0x00000000ffffffffULL));
656 IXGB_WRITE_REG(hw, TDBAH, (tdba >> 32));
658 IXGB_WRITE_REG(hw, TDLEN, tdlen);
660 /* Setup the HW Tx Head and Tail descriptor pointers */
662 IXGB_WRITE_REG(hw, TDH, 0);
663 IXGB_WRITE_REG(hw, TDT, 0);
665 /* don't set up txdctl, it induces performance problems if
666 * configured incorrectly
667 txdctl = TXDCTL_PTHRESH_DEFAULT; // prefetch txds below this threshold
668 txdctl |= (TXDCTL_HTHRESH_DEFAULT // only prefetch if there are this many ready
669 << IXGB_TXDCTL_HTHRESH_SHIFT);
670 IXGB_WRITE_REG (hw, TXDCTL, txdctl);
673 /* Set the Tx Interrupt Delay register */
675 IXGB_WRITE_REG(hw, TIDV, adapter->tx_int_delay);
677 /* Program the Transmit Control Register */
679 tctl = IXGB_TCTL_TCE | IXGB_TCTL_TXEN | IXGB_TCTL_TPDE;
680 IXGB_WRITE_REG(hw, TCTL, tctl);
682 /* Setup Transmit Descriptor Settings for this adapter */
683 adapter->tx_cmd_type =
685 | (adapter->tx_int_delay_enable ? IXGB_TX_DESC_CMD_IDE : 0);
689 * ixgb_setup_rx_resources - allocate Rx resources (Descriptors)
690 * @adapter: board private structure
692 * Returns 0 on success, negative on failure
695 static int ixgb_setup_rx_resources(struct ixgb_adapter *adapter)
697 struct ixgb_desc_ring *rxdr = &adapter->rx_ring;
698 struct pci_dev *pdev = adapter->pdev;
701 size = sizeof(struct ixgb_buffer) * rxdr->count;
702 rxdr->buffer_info = kmalloc(size, GFP_KERNEL);
703 if (!rxdr->buffer_info) {
706 memset(rxdr->buffer_info, 0, size);
708 /* Round up to nearest 4K */
710 rxdr->size = rxdr->count * sizeof(struct ixgb_rx_desc);
711 IXGB_ROUNDUP(rxdr->size, 4096);
713 rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma);
716 kfree(rxdr->buffer_info);
719 memset(rxdr->desc, 0, rxdr->size);
721 rxdr->next_to_clean = 0;
722 rxdr->next_to_use = 0;
728 * ixgb_setup_rctl - configure the receive control register
729 * @adapter: Board private structure
732 static void ixgb_setup_rctl(struct ixgb_adapter *adapter)
736 rctl = IXGB_READ_REG(&adapter->hw, RCTL);
738 rctl &= ~(3 << IXGB_RCTL_MO_SHIFT);
741 IXGB_RCTL_BAM | IXGB_RCTL_RDMTS_1_2 |
742 IXGB_RCTL_RXEN | IXGB_RCTL_CFF |
743 (adapter->hw.mc_filter_type << IXGB_RCTL_MO_SHIFT);
745 rctl |= IXGB_RCTL_SECRC;
747 switch (adapter->rx_buffer_len) {
748 case IXGB_RXBUFFER_2048:
750 rctl |= IXGB_RCTL_BSIZE_2048;
752 case IXGB_RXBUFFER_4096:
753 rctl |= IXGB_RCTL_BSIZE_4096;
755 case IXGB_RXBUFFER_8192:
756 rctl |= IXGB_RCTL_BSIZE_8192;
758 case IXGB_RXBUFFER_16384:
759 rctl |= IXGB_RCTL_BSIZE_16384;
763 IXGB_WRITE_REG(&adapter->hw, RCTL, rctl);
767 * ixgb_configure_rx - Configure 82597 Receive Unit after Reset.
768 * @adapter: board private structure
770 * Configure the Rx unit of the MAC after a reset.
773 static void ixgb_configure_rx(struct ixgb_adapter *adapter)
775 uint64_t rdba = adapter->rx_ring.dma;
776 uint32_t rdlen = adapter->rx_ring.count * sizeof(struct ixgb_rx_desc);
777 struct ixgb_hw *hw = &adapter->hw;
782 /* make sure receives are disabled while setting up the descriptors */
784 rctl = IXGB_READ_REG(hw, RCTL);
785 IXGB_WRITE_REG(hw, RCTL, rctl & ~IXGB_RCTL_RXEN);
787 /* set the Receive Delay Timer Register */
789 IXGB_WRITE_REG(hw, RDTR, adapter->rx_int_delay);
791 /* Setup the Base and Length of the Rx Descriptor Ring */
793 IXGB_WRITE_REG(hw, RDBAL, (rdba & 0x00000000ffffffffULL));
794 IXGB_WRITE_REG(hw, RDBAH, (rdba >> 32));
796 IXGB_WRITE_REG(hw, RDLEN, rdlen);
798 /* Setup the HW Rx Head and Tail Descriptor Pointers */
799 IXGB_WRITE_REG(hw, RDH, 0);
800 IXGB_WRITE_REG(hw, RDT, 0);
802 /* burst 16 or burst when RXT0 */
803 rxdctl = RXDCTL_WTHRESH_DEFAULT << IXGB_RXDCTL_WTHRESH_SHIFT
804 | RXDCTL_HTHRESH_DEFAULT << IXGB_RXDCTL_HTHRESH_SHIFT
805 | RXDCTL_PTHRESH_DEFAULT << IXGB_RXDCTL_PTHRESH_SHIFT;
806 IXGB_WRITE_REG(hw, RXDCTL, rxdctl);
808 if (adapter->raidc) {
810 uint8_t poll_threshold;
812 /* Poll every rx_int_delay period, if RBD exists
813 * Receive Backlog Detection is set to <threshold>
815 * max is 0x3F == set to poll when 504 RxDesc left
818 /* polling times are 1 == 0.8192us
824 #define IXGB_RAIDC_POLL_DEFAULT 122 /* set to poll every ~100 us under load
825 also known as 10000 interrupts / sec */
827 /* divide this by 2^3 (8) to get a register size count */
828 poll_threshold = ((adapter->rx_ring.count - 1) >> 3);
829 /* poll at half of that size */
830 poll_threshold >>= 1;
831 /* make sure its not bigger than our max */
832 poll_threshold &= 0x3F;
834 raidc = IXGB_RAIDC_EN | /* turn on raidc style moderation */
835 IXGB_RAIDC_RXT_GATE | /* don't interrupt with rxt0 while
836 in RBD mode (polling) */
837 (IXGB_RAIDC_POLL_DEFAULT << IXGB_RAIDC_POLL_SHIFT) |
838 /* this sets the regular "min interrupt delay" */
839 (adapter->rx_int_delay << IXGB_RAIDC_DELAY_SHIFT) |
842 IXGB_WRITE_REG(hw, RAIDC, raidc);
845 /* Enable Receive Checksum Offload for TCP and UDP */
846 if (adapter->rx_csum == TRUE) {
847 rxcsum = IXGB_READ_REG(hw, RXCSUM);
848 rxcsum |= IXGB_RXCSUM_TUOFL;
849 IXGB_WRITE_REG(hw, RXCSUM, rxcsum);
852 /* Enable Receives */
854 IXGB_WRITE_REG(hw, RCTL, rctl);
858 * ixgb_free_tx_resources - Free Tx Resources
859 * @adapter: board private structure
861 * Free all transmit software resources
864 static void ixgb_free_tx_resources(struct ixgb_adapter *adapter)
866 struct pci_dev *pdev = adapter->pdev;
868 ixgb_clean_tx_ring(adapter);
870 kfree(adapter->tx_ring.buffer_info);
871 adapter->tx_ring.buffer_info = NULL;
873 pci_free_consistent(pdev, adapter->tx_ring.size,
874 adapter->tx_ring.desc, adapter->tx_ring.dma);
876 adapter->tx_ring.desc = NULL;
880 * ixgb_clean_tx_ring - Free Tx Buffers
881 * @adapter: board private structure
884 static void ixgb_clean_tx_ring(struct ixgb_adapter *adapter)
886 struct ixgb_desc_ring *tx_ring = &adapter->tx_ring;
887 struct ixgb_buffer *buffer_info;
888 struct pci_dev *pdev = adapter->pdev;
892 /* Free all the Tx ring sk_buffs */
894 for (i = 0; i < tx_ring->count; i++) {
895 buffer_info = &tx_ring->buffer_info[i];
896 if (buffer_info->skb) {
900 buffer_info->length, PCI_DMA_TODEVICE);
902 dev_kfree_skb(buffer_info->skb);
904 buffer_info->skb = NULL;
908 size = sizeof(struct ixgb_buffer) * tx_ring->count;
909 memset(tx_ring->buffer_info, 0, size);
911 /* Zero out the descriptor ring */
913 memset(tx_ring->desc, 0, tx_ring->size);
915 tx_ring->next_to_use = 0;
916 tx_ring->next_to_clean = 0;
918 IXGB_WRITE_REG(&adapter->hw, TDH, 0);
919 IXGB_WRITE_REG(&adapter->hw, TDT, 0);
923 * ixgb_free_rx_resources - Free Rx Resources
924 * @adapter: board private structure
926 * Free all receive software resources
929 static void ixgb_free_rx_resources(struct ixgb_adapter *adapter)
931 struct ixgb_desc_ring *rx_ring = &adapter->rx_ring;
932 struct pci_dev *pdev = adapter->pdev;
934 ixgb_clean_rx_ring(adapter);
936 kfree(rx_ring->buffer_info);
937 rx_ring->buffer_info = NULL;
939 pci_free_consistent(pdev, rx_ring->size, rx_ring->desc, rx_ring->dma);
941 rx_ring->desc = NULL;
945 * ixgb_clean_rx_ring - Free Rx Buffers
946 * @adapter: board private structure
949 static void ixgb_clean_rx_ring(struct ixgb_adapter *adapter)
951 struct ixgb_desc_ring *rx_ring = &adapter->rx_ring;
952 struct ixgb_buffer *buffer_info;
953 struct pci_dev *pdev = adapter->pdev;
957 /* Free all the Rx ring sk_buffs */
959 for (i = 0; i < rx_ring->count; i++) {
960 buffer_info = &rx_ring->buffer_info[i];
961 if (buffer_info->skb) {
963 pci_unmap_single(pdev,
968 dev_kfree_skb(buffer_info->skb);
970 buffer_info->skb = NULL;
974 size = sizeof(struct ixgb_buffer) * rx_ring->count;
975 memset(rx_ring->buffer_info, 0, size);
977 /* Zero out the descriptor ring */
979 memset(rx_ring->desc, 0, rx_ring->size);
981 rx_ring->next_to_clean = 0;
982 rx_ring->next_to_use = 0;
984 IXGB_WRITE_REG(&adapter->hw, RDH, 0);
985 IXGB_WRITE_REG(&adapter->hw, RDT, 0);
989 * ixgb_set_mac - Change the Ethernet Address of the NIC
990 * @netdev: network interface device structure
991 * @p: pointer to an address structure
993 * Returns 0 on success, negative on failure
996 static int ixgb_set_mac(struct net_device *netdev, void *p)
998 struct ixgb_adapter *adapter = netdev->priv;
999 struct sockaddr *addr = p;
1001 if (!is_valid_ether_addr(addr->sa_data))
1002 return -EADDRNOTAVAIL;
1004 memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
1006 ixgb_rar_set(&adapter->hw, addr->sa_data, 0);
1012 * ixgb_set_multi - Multicast and Promiscuous mode set
1013 * @netdev: network interface device structure
1015 * The set_multi entry point is called whenever the multicast address
1016 * list or the network interface flags are updated. This routine is
1017 * responsible for configuring the hardware for proper multicast,
1018 * promiscuous mode, and all-multi behavior.
1021 static void ixgb_set_multi(struct net_device *netdev)
1023 struct ixgb_adapter *adapter = netdev->priv;
1024 struct ixgb_hw *hw = &adapter->hw;
1025 struct dev_mc_list *mc_ptr;
1029 /* Check for Promiscuous and All Multicast modes */
1031 rctl = IXGB_READ_REG(hw, RCTL);
1033 if (netdev->flags & IFF_PROMISC) {
1034 rctl |= (IXGB_RCTL_UPE | IXGB_RCTL_MPE);
1035 } else if (netdev->flags & IFF_ALLMULTI) {
1036 rctl |= IXGB_RCTL_MPE;
1037 rctl &= ~IXGB_RCTL_UPE;
1039 rctl &= ~(IXGB_RCTL_UPE | IXGB_RCTL_MPE);
1042 if (netdev->mc_count > IXGB_MAX_NUM_MULTICAST_ADDRESSES) {
1043 rctl |= IXGB_RCTL_MPE;
1044 IXGB_WRITE_REG(hw, RCTL, rctl);
1046 uint8_t mta[netdev->mc_count * IXGB_ETH_LENGTH_OF_ADDRESS];
1048 IXGB_WRITE_REG(hw, RCTL, rctl);
1050 for (i = 0, mc_ptr = netdev->mc_list; mc_ptr;
1051 i++, mc_ptr = mc_ptr->next)
1052 memcpy(&mta[i * IXGB_ETH_LENGTH_OF_ADDRESS],
1053 mc_ptr->dmi_addr, IXGB_ETH_LENGTH_OF_ADDRESS);
1055 ixgb_mc_addr_list_update(hw, mta, netdev->mc_count, 0);
1060 * ixgb_watchdog - Timer Call-back
1061 * @data: pointer to netdev cast into an unsigned long
1064 static void ixgb_watchdog(unsigned long data)
1066 struct ixgb_adapter *adapter = (struct ixgb_adapter *)data;
1067 struct net_device *netdev = adapter->netdev;
1068 struct ixgb_desc_ring *txdr = &adapter->tx_ring;
1071 ixgb_check_for_link(&adapter->hw);
1073 if (ixgb_check_for_bad_link(&adapter->hw)) {
1074 /* force the reset path */
1075 netif_stop_queue(netdev);
1078 if (adapter->hw.link_up) {
1079 if (!netif_carrier_ok(netdev)) {
1080 printk(KERN_INFO "ixgb: %s NIC Link is Up %d Mbps %s\n",
1081 netdev->name, 10000, "Full Duplex");
1082 adapter->link_speed = 10000;
1083 adapter->link_duplex = FULL_DUPLEX;
1084 netif_carrier_on(netdev);
1085 netif_wake_queue(netdev);
1088 if (netif_carrier_ok(netdev)) {
1089 adapter->link_speed = 0;
1090 adapter->link_duplex = 0;
1092 "ixgb: %s NIC Link is Down\n", netdev->name);
1093 netif_carrier_off(netdev);
1094 netif_stop_queue(netdev);
1099 ixgb_update_stats(adapter);
1101 if (!netif_carrier_ok(netdev)) {
1102 if (IXGB_DESC_UNUSED(txdr) + 1 < txdr->count) {
1103 /* We've lost link, so the controller stops DMA,
1104 * but we've got queued Tx work that's never going
1105 * to get done, so reset controller to flush Tx.
1106 * (Do the reset outside of interrupt context). */
1107 schedule_work(&adapter->tx_timeout_task);
1111 /* Early detection of hung controller */
1112 i = txdr->next_to_clean;
1113 if (txdr->buffer_info[i].dma &&
1114 time_after(jiffies, txdr->buffer_info[i].time_stamp + HZ) &&
1115 !(IXGB_READ_REG(&adapter->hw, STATUS) & IXGB_STATUS_TXOFF))
1116 netif_stop_queue(netdev);
1118 /* generate an interrupt to force clean up of any stragglers */
1119 IXGB_WRITE_REG(&adapter->hw, ICS, IXGB_INT_TXDW);
1121 /* Reset the timer */
1122 mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ);
1125 #define IXGB_TX_FLAGS_CSUM 0x00000001
1126 #define IXGB_TX_FLAGS_VLAN 0x00000002
1127 #define IXGB_TX_FLAGS_TSO 0x00000004
1129 static inline boolean_t
1130 ixgb_tso(struct ixgb_adapter *adapter, struct sk_buff *skb)
1133 struct ixgb_context_desc *context_desc;
1135 uint8_t ipcss, ipcso, tucss, tucso, hdr_len;
1136 uint16_t ipcse, tucse, mss;
1138 if (likely(skb_shinfo(skb)->tso_size)) {
1139 hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2));
1140 mss = skb_shinfo(skb)->tso_size;
1141 skb->nh.iph->tot_len = 0;
1142 skb->nh.iph->check = 0;
1143 skb->h.th->check = ~csum_tcpudp_magic(skb->nh.iph->saddr,
1146 ipcss = skb->nh.raw - skb->data;
1147 ipcso = (void *)&(skb->nh.iph->check) - (void *)skb->data;
1148 ipcse = skb->h.raw - skb->data - 1;
1149 tucss = skb->h.raw - skb->data;
1150 tucso = (void *)&(skb->h.th->check) - (void *)skb->data;
1153 i = adapter->tx_ring.next_to_use;
1154 context_desc = IXGB_CONTEXT_DESC(adapter->tx_ring, i);
1156 context_desc->ipcss = ipcss;
1157 context_desc->ipcso = ipcso;
1158 context_desc->ipcse = cpu_to_le16(ipcse);
1159 context_desc->tucss = tucss;
1160 context_desc->tucso = tucso;
1161 context_desc->tucse = cpu_to_le16(tucse);
1162 context_desc->mss = cpu_to_le16(mss);
1163 context_desc->hdr_len = hdr_len;
1164 context_desc->status = 0;
1165 context_desc->cmd_type_len = cpu_to_le32(IXGB_CONTEXT_DESC_TYPE
1167 IXGB_CONTEXT_DESC_CMD_TSE
1169 IXGB_CONTEXT_DESC_CMD_IP
1171 IXGB_CONTEXT_DESC_CMD_TCP
1173 IXGB_CONTEXT_DESC_CMD_RS
1175 IXGB_CONTEXT_DESC_CMD_IDE
1179 if (++i == adapter->tx_ring.count)
1181 adapter->tx_ring.next_to_use = i;
1190 static inline boolean_t
1191 ixgb_tx_csum(struct ixgb_adapter *adapter, struct sk_buff *skb)
1193 struct ixgb_context_desc *context_desc;
1197 if (likely(skb->ip_summed == CHECKSUM_HW)) {
1198 css = skb->h.raw - skb->data;
1199 cso = (skb->h.raw + skb->csum) - skb->data;
1201 i = adapter->tx_ring.next_to_use;
1202 context_desc = IXGB_CONTEXT_DESC(adapter->tx_ring, i);
1204 context_desc->tucss = css;
1205 context_desc->tucso = cso;
1206 context_desc->tucse = 0;
1207 /* zero out any previously existing data in one instruction */
1208 *(uint32_t *) & (context_desc->ipcss) = 0;
1209 context_desc->status = 0;
1210 context_desc->hdr_len = 0;
1211 context_desc->mss = 0;
1212 context_desc->cmd_type_len =
1213 cpu_to_le32(IXGB_CONTEXT_DESC_TYPE
1214 | IXGB_TX_DESC_CMD_RS | IXGB_TX_DESC_CMD_IDE);
1216 if (++i == adapter->tx_ring.count)
1218 adapter->tx_ring.next_to_use = i;
1226 #define IXGB_MAX_TXD_PWR 14
1227 #define IXGB_MAX_DATA_PER_TXD (1<<IXGB_MAX_TXD_PWR)
1230 ixgb_tx_map(struct ixgb_adapter *adapter, struct sk_buff *skb,
1233 struct ixgb_desc_ring *tx_ring = &adapter->tx_ring;
1234 struct ixgb_buffer *buffer_info;
1236 unsigned int offset = 0, size, count = 0, i;
1238 unsigned int nr_frags = skb_shinfo(skb)->nr_frags;
1240 len -= skb->data_len;
1242 i = tx_ring->next_to_use;
1245 buffer_info = &tx_ring->buffer_info[i];
1246 size = min(len, IXGB_MAX_JUMBO_FRAME_SIZE);
1247 buffer_info->length = size;
1249 pci_map_single(adapter->pdev,
1250 skb->data + offset, size, PCI_DMA_TODEVICE);
1251 buffer_info->time_stamp = jiffies;
1256 if (++i == tx_ring->count)
1260 for (f = 0; f < nr_frags; f++) {
1261 struct skb_frag_struct *frag;
1263 frag = &skb_shinfo(skb)->frags[f];
1268 buffer_info = &tx_ring->buffer_info[i];
1269 size = min(len, IXGB_MAX_JUMBO_FRAME_SIZE);
1270 buffer_info->length = size;
1272 pci_map_page(adapter->pdev,
1274 frag->page_offset + offset,
1275 size, PCI_DMA_TODEVICE);
1276 buffer_info->time_stamp = jiffies;
1281 if (++i == tx_ring->count)
1285 i = (i == 0) ? tx_ring->count - 1 : i - 1;
1286 tx_ring->buffer_info[i].skb = skb;
1287 tx_ring->buffer_info[first].next_to_watch = i;
1293 ixgb_tx_queue(struct ixgb_adapter *adapter, int count, int vlan_id,
1296 struct ixgb_desc_ring *tx_ring = &adapter->tx_ring;
1297 struct ixgb_tx_desc *tx_desc = NULL;
1298 struct ixgb_buffer *buffer_info;
1299 uint32_t cmd_type_len = adapter->tx_cmd_type;
1304 if (tx_flags & IXGB_TX_FLAGS_TSO) {
1305 cmd_type_len |= IXGB_TX_DESC_CMD_TSE;
1306 popts |= (IXGB_TX_DESC_POPTS_IXSM | IXGB_TX_DESC_POPTS_TXSM);
1309 if (tx_flags & IXGB_TX_FLAGS_CSUM)
1310 popts |= IXGB_TX_DESC_POPTS_TXSM;
1312 if (tx_flags & IXGB_TX_FLAGS_VLAN) {
1313 cmd_type_len |= IXGB_TX_DESC_CMD_VLE;
1316 i = tx_ring->next_to_use;
1319 buffer_info = &tx_ring->buffer_info[i];
1320 tx_desc = IXGB_TX_DESC(*tx_ring, i);
1321 tx_desc->buff_addr = cpu_to_le64(buffer_info->dma);
1322 tx_desc->cmd_type_len =
1323 cpu_to_le32(cmd_type_len | buffer_info->length);
1324 tx_desc->status = status;
1325 tx_desc->popts = popts;
1326 tx_desc->vlan = cpu_to_le16(vlan_id);
1328 if (++i == tx_ring->count)
1332 tx_desc->cmd_type_len |= cpu_to_le32(IXGB_TX_DESC_CMD_EOP
1333 | IXGB_TX_DESC_CMD_RS);
1335 /* Force memory writes to complete before letting h/w
1336 * know there are new descriptors to fetch. (Only
1337 * applicable for weak-ordered memory model archs,
1338 * such as IA-64). */
1341 tx_ring->next_to_use = i;
1342 IXGB_WRITE_REG(&adapter->hw, TDT, i);
1345 /* Tx Descriptors needed, worst case */
1346 #define TXD_USE_COUNT(S) (((S) >> IXGB_MAX_TXD_PWR) + \
1347 (((S) & (IXGB_MAX_DATA_PER_TXD - 1)) ? 1 : 0))
1348 #define DESC_NEEDED TXD_USE_COUNT(IXGB_MAX_DATA_PER_TXD) + \
1349 MAX_SKB_FRAGS * TXD_USE_COUNT(PAGE_SIZE) + 1
1351 static int ixgb_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1353 struct ixgb_adapter *adapter = netdev->priv;
1355 unsigned int tx_flags = 0;
1356 unsigned long flags;
1359 if (skb->len <= 0) {
1360 dev_kfree_skb_any(skb);
1364 spin_lock_irqsave(&adapter->tx_lock, flags);
1365 if (unlikely(IXGB_DESC_UNUSED(&adapter->tx_ring) < DESC_NEEDED)) {
1366 netif_stop_queue(netdev);
1367 spin_unlock_irqrestore(&adapter->tx_lock, flags);
1370 spin_unlock_irqrestore(&adapter->tx_lock, flags);
1372 if (adapter->vlgrp && vlan_tx_tag_present(skb)) {
1373 tx_flags |= IXGB_TX_FLAGS_VLAN;
1374 vlan_id = vlan_tx_tag_get(skb);
1377 first = adapter->tx_ring.next_to_use;
1379 if (ixgb_tso(adapter, skb))
1380 tx_flags |= IXGB_TX_FLAGS_TSO;
1381 else if (ixgb_tx_csum(adapter, skb))
1382 tx_flags |= IXGB_TX_FLAGS_CSUM;
1384 ixgb_tx_queue(adapter, ixgb_tx_map(adapter, skb, first), vlan_id,
1387 netdev->trans_start = jiffies;
1393 * ixgb_tx_timeout - Respond to a Tx Hang
1394 * @netdev: network interface device structure
1397 static void ixgb_tx_timeout(struct net_device *netdev)
1399 struct ixgb_adapter *adapter = netdev->priv;
1401 /* Do the reset outside of interrupt context */
1402 schedule_work(&adapter->tx_timeout_task);
1405 static void ixgb_tx_timeout_task(struct net_device *netdev)
1407 struct ixgb_adapter *adapter = netdev->priv;
1409 netif_device_detach(netdev);
1410 ixgb_down(adapter, TRUE);
1412 netif_device_attach(netdev);
1416 * ixgb_get_stats - Get System Network Statistics
1417 * @netdev: network interface device structure
1419 * Returns the address of the device statistics structure.
1420 * The statistics are actually updated from the timer callback.
1423 static struct net_device_stats *ixgb_get_stats(struct net_device *netdev)
1425 struct ixgb_adapter *adapter = netdev->priv;
1427 return &adapter->net_stats;
1431 * ixgb_change_mtu - Change the Maximum Transfer Unit
1432 * @netdev: network interface device structure
1433 * @new_mtu: new value for maximum frame size
1435 * Returns 0 on success, negative on failure
1438 static int ixgb_change_mtu(struct net_device *netdev, int new_mtu)
1440 struct ixgb_adapter *adapter = netdev->priv;
1441 uint32_t old_mtu = adapter->rx_buffer_len;
1442 int max_frame = new_mtu + ENET_HEADER_SIZE + ENET_FCS_LENGTH;
1444 if ((max_frame < IXGB_MIN_ENET_FRAME_SIZE_WITHOUT_FCS + ENET_FCS_LENGTH)
1445 || (max_frame > IXGB_MAX_JUMBO_FRAME_SIZE + ENET_FCS_LENGTH)) {
1446 IXGB_ERR("Invalid MTU setting\n");
1451 IXGB_MAX_ENET_FRAME_SIZE_WITHOUT_FCS + ENET_FCS_LENGTH)
1452 || (max_frame <= IXGB_RXBUFFER_2048)) {
1453 adapter->rx_buffer_len = IXGB_RXBUFFER_2048;
1455 } else if (max_frame <= IXGB_RXBUFFER_4096) {
1456 adapter->rx_buffer_len = IXGB_RXBUFFER_4096;
1458 } else if (max_frame <= IXGB_RXBUFFER_8192) {
1459 adapter->rx_buffer_len = IXGB_RXBUFFER_8192;
1462 adapter->rx_buffer_len = IXGB_RXBUFFER_16384;
1465 netdev->mtu = new_mtu;
1467 if (old_mtu != adapter->rx_buffer_len && netif_running(netdev)) {
1469 ixgb_down(adapter, TRUE);
1477 * ixgb_update_stats - Update the board statistics counters.
1478 * @adapter: board private structure
1481 static void ixgb_update_stats(struct ixgb_adapter *adapter)
1483 adapter->stats.tprl += IXGB_READ_REG(&adapter->hw, TPRL);
1484 adapter->stats.tprh += IXGB_READ_REG(&adapter->hw, TPRH);
1485 adapter->stats.gprcl += IXGB_READ_REG(&adapter->hw, GPRCL);
1486 adapter->stats.gprch += IXGB_READ_REG(&adapter->hw, GPRCH);
1487 adapter->stats.bprcl += IXGB_READ_REG(&adapter->hw, BPRCL);
1488 adapter->stats.bprch += IXGB_READ_REG(&adapter->hw, BPRCH);
1489 adapter->stats.mprcl += IXGB_READ_REG(&adapter->hw, MPRCL);
1490 adapter->stats.mprch += IXGB_READ_REG(&adapter->hw, MPRCH);
1491 adapter->stats.uprcl += IXGB_READ_REG(&adapter->hw, UPRCL);
1492 adapter->stats.uprch += IXGB_READ_REG(&adapter->hw, UPRCH);
1493 adapter->stats.vprcl += IXGB_READ_REG(&adapter->hw, VPRCL);
1494 adapter->stats.vprch += IXGB_READ_REG(&adapter->hw, VPRCH);
1495 adapter->stats.jprcl += IXGB_READ_REG(&adapter->hw, JPRCL);
1496 adapter->stats.jprch += IXGB_READ_REG(&adapter->hw, JPRCH);
1497 adapter->stats.gorcl += IXGB_READ_REG(&adapter->hw, GORCL);
1498 adapter->stats.gorch += IXGB_READ_REG(&adapter->hw, GORCH);
1499 adapter->stats.torl += IXGB_READ_REG(&adapter->hw, TORL);
1500 adapter->stats.torh += IXGB_READ_REG(&adapter->hw, TORH);
1501 adapter->stats.rnbc += IXGB_READ_REG(&adapter->hw, RNBC);
1502 adapter->stats.ruc += IXGB_READ_REG(&adapter->hw, RUC);
1503 adapter->stats.roc += IXGB_READ_REG(&adapter->hw, ROC);
1504 adapter->stats.rlec += IXGB_READ_REG(&adapter->hw, RLEC);
1505 adapter->stats.crcerrs += IXGB_READ_REG(&adapter->hw, CRCERRS);
1506 adapter->stats.icbc += IXGB_READ_REG(&adapter->hw, ICBC);
1507 adapter->stats.ecbc += IXGB_READ_REG(&adapter->hw, ECBC);
1508 adapter->stats.mpc += IXGB_READ_REG(&adapter->hw, MPC);
1509 adapter->stats.tptl += IXGB_READ_REG(&adapter->hw, TPTL);
1510 adapter->stats.tpth += IXGB_READ_REG(&adapter->hw, TPTH);
1511 adapter->stats.gptcl += IXGB_READ_REG(&adapter->hw, GPTCL);
1512 adapter->stats.gptch += IXGB_READ_REG(&adapter->hw, GPTCH);
1513 adapter->stats.bptcl += IXGB_READ_REG(&adapter->hw, BPTCL);
1514 adapter->stats.bptch += IXGB_READ_REG(&adapter->hw, BPTCH);
1515 adapter->stats.mptcl += IXGB_READ_REG(&adapter->hw, MPTCL);
1516 adapter->stats.mptch += IXGB_READ_REG(&adapter->hw, MPTCH);
1517 adapter->stats.uptcl += IXGB_READ_REG(&adapter->hw, UPTCL);
1518 adapter->stats.uptch += IXGB_READ_REG(&adapter->hw, UPTCH);
1519 adapter->stats.vptcl += IXGB_READ_REG(&adapter->hw, VPTCL);
1520 adapter->stats.vptch += IXGB_READ_REG(&adapter->hw, VPTCH);
1521 adapter->stats.jptcl += IXGB_READ_REG(&adapter->hw, JPTCL);
1522 adapter->stats.jptch += IXGB_READ_REG(&adapter->hw, JPTCH);
1523 adapter->stats.gotcl += IXGB_READ_REG(&adapter->hw, GOTCL);
1524 adapter->stats.gotch += IXGB_READ_REG(&adapter->hw, GOTCH);
1525 adapter->stats.totl += IXGB_READ_REG(&adapter->hw, TOTL);
1526 adapter->stats.toth += IXGB_READ_REG(&adapter->hw, TOTH);
1527 adapter->stats.dc += IXGB_READ_REG(&adapter->hw, DC);
1528 adapter->stats.plt64c += IXGB_READ_REG(&adapter->hw, PLT64C);
1529 adapter->stats.tsctc += IXGB_READ_REG(&adapter->hw, TSCTC);
1530 adapter->stats.tsctfc += IXGB_READ_REG(&adapter->hw, TSCTFC);
1531 adapter->stats.ibic += IXGB_READ_REG(&adapter->hw, IBIC);
1532 adapter->stats.rfc += IXGB_READ_REG(&adapter->hw, RFC);
1533 adapter->stats.lfc += IXGB_READ_REG(&adapter->hw, LFC);
1534 adapter->stats.pfrc += IXGB_READ_REG(&adapter->hw, PFRC);
1535 adapter->stats.pftc += IXGB_READ_REG(&adapter->hw, PFTC);
1536 adapter->stats.mcfrc += IXGB_READ_REG(&adapter->hw, MCFRC);
1537 adapter->stats.mcftc += IXGB_READ_REG(&adapter->hw, MCFTC);
1538 adapter->stats.xonrxc += IXGB_READ_REG(&adapter->hw, XONRXC);
1539 adapter->stats.xontxc += IXGB_READ_REG(&adapter->hw, XONTXC);
1540 adapter->stats.xoffrxc += IXGB_READ_REG(&adapter->hw, XOFFRXC);
1541 adapter->stats.xofftxc += IXGB_READ_REG(&adapter->hw, XOFFTXC);
1542 adapter->stats.rjc += IXGB_READ_REG(&adapter->hw, RJC);
1544 /* Fill out the OS statistics structure */
1546 adapter->net_stats.rx_packets = adapter->stats.gprcl;
1547 adapter->net_stats.tx_packets = adapter->stats.gptcl;
1548 adapter->net_stats.rx_bytes = adapter->stats.gorcl;
1549 adapter->net_stats.tx_bytes = adapter->stats.gotcl;
1550 adapter->net_stats.multicast = adapter->stats.mprcl;
1551 adapter->net_stats.collisions = 0;
1553 /* ignore RLEC as it reports errors for padded (<64bytes) frames
1554 * with a length in the type/len field */
1555 adapter->net_stats.rx_errors =
1556 /* adapter->stats.rnbc + */ adapter->stats.crcerrs +
1557 adapter->stats.ruc +
1558 adapter->stats.roc /*+ adapter->stats.rlec */ +
1559 adapter->stats.icbc +
1560 adapter->stats.ecbc + adapter->stats.mpc;
1562 adapter->net_stats.rx_dropped = adapter->stats.mpc;
1565 * adapter->net_stats.rx_length_errors = adapter->stats.rlec;
1568 adapter->net_stats.rx_crc_errors = adapter->stats.crcerrs;
1569 adapter->net_stats.rx_fifo_errors = adapter->stats.mpc;
1570 adapter->net_stats.rx_missed_errors = adapter->stats.mpc;
1571 adapter->net_stats.rx_over_errors = adapter->stats.mpc;
1573 adapter->net_stats.tx_errors = 0;
1574 adapter->net_stats.rx_frame_errors = 0;
1575 adapter->net_stats.tx_aborted_errors = 0;
1576 adapter->net_stats.tx_carrier_errors = 0;
1577 adapter->net_stats.tx_fifo_errors = 0;
1578 adapter->net_stats.tx_heartbeat_errors = 0;
1579 adapter->net_stats.tx_window_errors = 0;
1582 #define IXGB_MAX_INTR 10
1584 * ixgb_intr - Interrupt Handler
1585 * @irq: interrupt number
1586 * @data: pointer to a network interface device structure
1587 * @pt_regs: CPU registers structure
1590 static irqreturn_t ixgb_intr(int irq, void *data, struct pt_regs *regs)
1592 struct net_device *netdev = data;
1593 struct ixgb_adapter *adapter = netdev->priv;
1594 struct ixgb_hw *hw = &adapter->hw;
1595 uint32_t icr = IXGB_READ_REG(&adapter->hw, ICR);
1596 #ifndef CONFIG_IXGB_NAPI
1601 return IRQ_NONE; /* Not our interrupt */
1603 if (unlikely(icr & (IXGB_INT_RXSEQ | IXGB_INT_LSC))) {
1604 mod_timer(&adapter->watchdog_timer, jiffies);
1606 #ifdef CONFIG_IXGB_NAPI
1607 if (netif_rx_schedule_prep(netdev)) {
1609 /* Disable interrupts and register for poll. The flush
1610 of the posted write is intentionally left out.
1613 atomic_inc(&adapter->irq_sem);
1614 IXGB_WRITE_REG(hw, IMC, ~0);
1615 __netif_rx_schedule(netdev);
1618 /* yes, that is actually a & and it is meant to make sure that
1619 * every pass through this for loop checks both receive and
1620 * transmit queues for completed descriptors, intended to
1621 * avoid starvation issues and assist tx/rx fairness. */
1622 for(i = 0; i < IXGB_MAX_INTR; i++)
1623 if(!ixgb_clean_rx_irq(adapter) &
1624 !ixgb_clean_tx_irq(adapter))
1626 /* if RAIDC:EN == 1 and ICR:RXDMT0 == 1, we need to
1627 * set IMS:RXDMT0 to 1 to restart the RBD timer (POLL)
1629 if ((icr & IXGB_INT_RXDMT0) && adapter->raidc) {
1630 /* ready the timer by writing the clear reg */
1631 IXGB_WRITE_REG(hw, IMC, IXGB_INT_RXDMT0);
1632 /* now restart it, h/w will decide if its necessary */
1633 IXGB_WRITE_REG(hw, IMS, IXGB_INT_RXDMT0);
1639 #ifdef CONFIG_IXGB_NAPI
1641 * ixgb_clean - NAPI Rx polling callback
1642 * @adapter: board private structure
1645 static int ixgb_clean(struct net_device *netdev, int *budget)
1647 struct ixgb_adapter *adapter = netdev->priv;
1648 int work_to_do = min(*budget, netdev->quota);
1651 ixgb_clean_tx_irq(adapter);
1652 ixgb_clean_rx_irq(adapter, &work_done, work_to_do);
1654 *budget -= work_done;
1655 netdev->quota -= work_done;
1657 if (work_done < work_to_do || !netif_running(netdev)) {
1658 netif_rx_complete(netdev);
1659 /* RAIDC will be automatically restarted by irq_enable */
1660 ixgb_irq_enable(adapter);
1663 return (work_done >= work_to_do);
1668 * ixgb_clean_tx_irq - Reclaim resources after transmit completes
1669 * @adapter: board private structure
1672 static boolean_t ixgb_clean_tx_irq(struct ixgb_adapter *adapter)
1674 struct ixgb_desc_ring *tx_ring = &adapter->tx_ring;
1675 struct net_device *netdev = adapter->netdev;
1676 struct pci_dev *pdev = adapter->pdev;
1677 struct ixgb_tx_desc *tx_desc, *eop_desc;
1678 struct ixgb_buffer *buffer_info;
1679 unsigned int i, eop;
1680 boolean_t cleaned = FALSE;
1682 i = tx_ring->next_to_clean;
1683 eop = tx_ring->buffer_info[i].next_to_watch;
1684 eop_desc = IXGB_TX_DESC(*tx_ring, eop);
1686 while (eop_desc->status & IXGB_TX_DESC_STATUS_DD) {
1688 for (cleaned = FALSE; !cleaned;) {
1689 tx_desc = IXGB_TX_DESC(*tx_ring, i);
1690 buffer_info = &tx_ring->buffer_info[i];
1693 & (IXGB_TX_DESC_POPTS_TXSM |
1694 IXGB_TX_DESC_POPTS_IXSM))
1695 adapter->hw_csum_tx_good++;
1697 if (buffer_info->dma) {
1699 pci_unmap_page(pdev,
1701 buffer_info->length,
1704 buffer_info->dma = 0;
1707 if (buffer_info->skb) {
1709 dev_kfree_skb_any(buffer_info->skb);
1711 buffer_info->skb = NULL;
1714 *(uint32_t *) & (tx_desc->status) = 0;
1716 cleaned = (i == eop);
1717 if (++i == tx_ring->count)
1721 eop = tx_ring->buffer_info[i].next_to_watch;
1722 eop_desc = IXGB_TX_DESC(*tx_ring, eop);
1725 tx_ring->next_to_clean = i;
1727 spin_lock(&adapter->tx_lock);
1728 if (cleaned && netif_queue_stopped(netdev) && netif_carrier_ok(netdev)
1729 && (IXGB_DESC_UNUSED(tx_ring) > IXGB_TX_QUEUE_WAKE)) {
1731 netif_wake_queue(netdev);
1733 spin_unlock(&adapter->tx_lock);
1739 * ixgb_rx_checksum - Receive Checksum Offload for 82597.
1740 * @adapter: board private structure
1741 * @rx_desc: receive descriptor
1742 * @sk_buff: socket buffer with received data
1746 ixgb_rx_checksum(struct ixgb_adapter *adapter,
1747 struct ixgb_rx_desc *rx_desc, struct sk_buff *skb)
1749 /* Ignore Checksum bit is set OR
1750 * TCP Checksum has not been calculated
1752 if ((rx_desc->status & IXGB_RX_DESC_STATUS_IXSM) ||
1753 (!(rx_desc->status & IXGB_RX_DESC_STATUS_TCPCS))) {
1754 skb->ip_summed = CHECKSUM_NONE;
1758 /* At this point we know the hardware did the TCP checksum */
1759 /* now look at the TCP checksum error bit */
1760 if (rx_desc->errors & IXGB_RX_DESC_ERRORS_TCPE) {
1761 /* let the stack verify checksum errors */
1762 skb->ip_summed = CHECKSUM_NONE;
1763 adapter->hw_csum_rx_error++;
1765 /* TCP checksum is good */
1766 skb->ip_summed = CHECKSUM_UNNECESSARY;
1767 adapter->hw_csum_rx_good++;
1772 * ixgb_clean_rx_irq - Send received data up the network stack,
1773 * @adapter: board private structure
1777 #ifdef CONFIG_IXGB_NAPI
1778 ixgb_clean_rx_irq(struct ixgb_adapter *adapter, int *work_done, int work_to_do)
1780 ixgb_clean_rx_irq(struct ixgb_adapter *adapter)
1783 struct ixgb_desc_ring *rx_ring = &adapter->rx_ring;
1784 struct net_device *netdev = adapter->netdev;
1785 struct pci_dev *pdev = adapter->pdev;
1786 struct ixgb_rx_desc *rx_desc, *next_rxd;
1787 struct ixgb_buffer *buffer_info, *next_buffer, *next2_buffer;
1788 struct sk_buff *skb, *next_skb;
1791 boolean_t cleaned = FALSE;
1793 i = rx_ring->next_to_clean;
1794 rx_desc = IXGB_RX_DESC(*rx_ring, i);
1795 buffer_info = &rx_ring->buffer_info[i];
1797 while (rx_desc->status & IXGB_RX_DESC_STATUS_DD) {
1799 skb = buffer_info->skb;
1800 prefetch(skb->data);
1802 if (++i == rx_ring->count)
1804 next_rxd = IXGB_RX_DESC(*rx_ring, i);
1807 if ((j = i + 1) == rx_ring->count)
1809 next2_buffer = &rx_ring->buffer_info[j];
1810 prefetch(next2_buffer);
1812 next_buffer = &rx_ring->buffer_info[i];
1813 next_skb = next_buffer->skb;
1816 #ifdef CONFIG_IXGB_NAPI
1817 if (*work_done >= work_to_do)
1825 pci_unmap_single(pdev,
1827 buffer_info->length, PCI_DMA_FROMDEVICE);
1829 length = le16_to_cpu(rx_desc->length);
1831 if (unlikely(!(rx_desc->status & IXGB_RX_DESC_STATUS_EOP))) {
1833 /* All receives must fit into a single buffer */
1835 IXGB_DBG("Receive packet consumed multiple buffers "
1836 "length<%x>\n", length);
1838 dev_kfree_skb_irq(skb);
1839 rx_desc->status = 0;
1840 buffer_info->skb = NULL;
1843 buffer_info = next_buffer;
1847 if (unlikely(rx_desc->errors
1848 & (IXGB_RX_DESC_ERRORS_CE | IXGB_RX_DESC_ERRORS_SE
1849 | IXGB_RX_DESC_ERRORS_P |
1850 IXGB_RX_DESC_ERRORS_RXE))) {
1852 dev_kfree_skb_irq(skb);
1853 rx_desc->status = 0;
1854 buffer_info->skb = NULL;
1857 buffer_info = next_buffer;
1862 skb_put(skb, length);
1864 /* Receive Checksum Offload */
1865 ixgb_rx_checksum(adapter, rx_desc, skb);
1867 skb->protocol = eth_type_trans(skb, netdev);
1868 #ifdef CONFIG_IXGB_NAPI
1870 && (rx_desc->status & IXGB_RX_DESC_STATUS_VP)) {
1871 vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
1872 le16_to_cpu(rx_desc->
1874 IXGB_RX_DESC_SPECIAL_VLAN_MASK));
1876 netif_receive_skb(skb);
1878 #else /* CONFIG_IXGB_NAPI */
1880 && (rx_desc->status & IXGB_RX_DESC_STATUS_VP)) {
1881 vlan_hwaccel_rx(skb, adapter->vlgrp,
1882 le16_to_cpu(rx_desc->
1884 IXGB_RX_DESC_SPECIAL_VLAN_MASK));
1888 #endif /* CONFIG_IXGB_NAPI */
1889 netdev->last_rx = jiffies;
1891 rx_desc->status = 0;
1892 buffer_info->skb = NULL;
1895 buffer_info = next_buffer;
1898 rx_ring->next_to_clean = i;
1900 ixgb_alloc_rx_buffers(adapter);
1906 * ixgb_alloc_rx_buffers - Replace used receive buffers
1907 * @adapter: address of board private structure
1910 static void ixgb_alloc_rx_buffers(struct ixgb_adapter *adapter)
1912 struct ixgb_desc_ring *rx_ring = &adapter->rx_ring;
1913 struct net_device *netdev = adapter->netdev;
1914 struct pci_dev *pdev = adapter->pdev;
1915 struct ixgb_rx_desc *rx_desc;
1916 struct ixgb_buffer *buffer_info;
1917 struct sk_buff *skb;
1919 int num_group_tail_writes;
1922 i = rx_ring->next_to_use;
1923 buffer_info = &rx_ring->buffer_info[i];
1924 cleancount = IXGB_DESC_UNUSED(rx_ring);
1926 /* lessen this to 4 if we're
1927 * in the midst of raidc and rbd is occuring
1928 * because we don't want to delay returning buffers when low
1930 num_group_tail_writes = adapter->raidc ? 4 : IXGB_RX_BUFFER_WRITE;
1932 /* leave one descriptor unused */
1933 while (--cleancount > 0) {
1934 rx_desc = IXGB_RX_DESC(*rx_ring, i);
1936 skb = dev_alloc_skb(adapter->rx_buffer_len + NET_IP_ALIGN);
1938 if (unlikely(!skb)) {
1939 /* Better luck next round */
1943 /* Make buffer alignment 2 beyond a 16 byte boundary
1944 * this will result in a 16 byte aligned IP header after
1945 * the 14 byte MAC header is removed
1947 skb_reserve(skb, NET_IP_ALIGN);
1951 buffer_info->skb = skb;
1952 buffer_info->length = adapter->rx_buffer_len;
1954 pci_map_single(pdev,
1956 adapter->rx_buffer_len, PCI_DMA_FROMDEVICE);
1958 rx_desc->buff_addr = cpu_to_le64(buffer_info->dma);
1960 if ((i & ~(num_group_tail_writes - 1)) == i) {
1961 /* Force memory writes to complete before letting h/w
1962 * know there are new descriptors to fetch. (Only
1963 * applicable for weak-ordered memory model archs,
1964 * such as IA-64). */
1967 IXGB_WRITE_REG(&adapter->hw, RDT, i);
1970 if (++i == rx_ring->count)
1972 buffer_info = &rx_ring->buffer_info[i];
1975 rx_ring->next_to_use = i;
1979 * ixgb_vlan_rx_register - enables or disables vlan tagging/stripping.
1981 * @param netdev network interface device structure
1982 * @param grp indicates to enable or disable tagging/stripping
1985 ixgb_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
1987 struct ixgb_adapter *adapter = netdev->priv;
1988 uint32_t ctrl, rctl;
1990 ixgb_irq_disable(adapter);
1991 adapter->vlgrp = grp;
1994 /* enable VLAN tag insert/strip */
1995 ctrl = IXGB_READ_REG(&adapter->hw, CTRL0);
1996 ctrl |= IXGB_CTRL0_VME;
1997 IXGB_WRITE_REG(&adapter->hw, CTRL0, ctrl);
1999 /* enable VLAN receive filtering */
2001 rctl = IXGB_READ_REG(&adapter->hw, RCTL);
2002 rctl |= IXGB_RCTL_VFE;
2003 rctl &= ~IXGB_RCTL_CFIEN;
2004 IXGB_WRITE_REG(&adapter->hw, RCTL, rctl);
2006 /* disable VLAN tag insert/strip */
2008 ctrl = IXGB_READ_REG(&adapter->hw, CTRL0);
2009 ctrl &= ~IXGB_CTRL0_VME;
2010 IXGB_WRITE_REG(&adapter->hw, CTRL0, ctrl);
2012 /* disable VLAN filtering */
2014 rctl = IXGB_READ_REG(&adapter->hw, RCTL);
2015 rctl &= ~IXGB_RCTL_VFE;
2016 IXGB_WRITE_REG(&adapter->hw, RCTL, rctl);
2019 ixgb_irq_enable(adapter);
2022 static void ixgb_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid)
2024 struct ixgb_adapter *adapter = netdev->priv;
2025 uint32_t vfta, index;
2027 /* add VID to filter table */
2029 index = (vid >> 5) & 0x7F;
2030 vfta = IXGB_READ_REG_ARRAY(&adapter->hw, VFTA, index);
2031 vfta |= (1 << (vid & 0x1F));
2032 ixgb_write_vfta(&adapter->hw, index, vfta);
2035 static void ixgb_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid)
2037 struct ixgb_adapter *adapter = netdev->priv;
2038 uint32_t vfta, index;
2040 ixgb_irq_disable(adapter);
2043 adapter->vlgrp->vlan_devices[vid] = NULL;
2045 ixgb_irq_enable(adapter);
2047 /* remove VID from filter table */
2049 index = (vid >> 5) & 0x7F;
2050 vfta = IXGB_READ_REG_ARRAY(&adapter->hw, VFTA, index);
2051 vfta &= ~(1 << (vid & 0x1F));
2052 ixgb_write_vfta(&adapter->hw, index, vfta);
2055 static void ixgb_restore_vlan(struct ixgb_adapter *adapter)
2057 ixgb_vlan_rx_register(adapter->netdev, adapter->vlgrp);
2059 if (adapter->vlgrp) {
2061 for (vid = 0; vid < VLAN_GROUP_ARRAY_LEN; vid++) {
2062 if (!adapter->vlgrp->vlan_devices[vid])
2064 ixgb_vlan_rx_add_vid(adapter->netdev, vid);
2070 * ixgb_notify_reboot - handles OS notification of reboot event.
2071 * @param nb notifier block, unused
2072 * @param event Event being passed to driver to act upon
2073 * @param p A pointer to our net device
2076 ixgb_notify_reboot(struct notifier_block *nb, unsigned long event, void *p)
2078 struct pci_dev *pdev = NULL;
2084 while ((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev))) {
2085 if (pci_dev_driver(pdev) == &ixgb_driver)
2086 ixgb_suspend(pdev, 3);
2093 * ixgb_suspend - driver suspend function called from notify.
2094 * @param pdev pci driver structure used for passing to
2095 * @param state power state to enter
2097 static int ixgb_suspend(struct pci_dev *pdev, uint32_t state)
2099 struct net_device *netdev = pci_get_drvdata(pdev);
2100 struct ixgb_adapter *adapter = netdev->priv;
2102 netif_device_detach(netdev);
2104 if (netif_running(netdev))
2105 ixgb_down(adapter, TRUE);
2107 pci_save_state(pdev);
2109 state = (state > 0) ? 3 : 0;
2110 pci_set_power_state(pdev, state);
2116 #ifdef CONFIG_NET_POLL_CONTROLLER
2118 * Polling 'interrupt' - used by things like netconsole to send skbs
2119 * without having to re-enable interrupts. It's not called while
2120 * the interrupt routine is executing.
2123 static void ixgb_netpoll(struct net_device *dev)
2125 struct ixgb_adapter *adapter = dev->priv;
2126 disable_irq(adapter->pdev->irq);
2127 ixgb_intr(adapter->pdev->irq, dev, NULL);
2128 enable_irq(adapter->pdev->irq);