Automatic merge of /spare/repo/netdev-2.6 branch ixgb

authored by and committed by Jeff Garzik 09e62666 34812c9e

+70 -116
+1 -1
drivers/net/ixgb/ixgb.h
··· 110 110 #define IXGB_TX_QUEUE_WAKE 16 111 111 112 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 115 /* only works for sizes that are powers of 2 */ 116 116 #define IXGB_ROUNDUP(i, size) ((i) = (((i) + (size) - 1) & ~((size) - 1)))
+12 -12
drivers/net/ixgb/ixgb_ee.c
··· 411 411 ixgb_cleanup_eeprom(hw); 412 412 413 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 416 return; 417 417 } ··· 483 483 DEBUGOUT("ixgb_ee: Checksum invalid.\n"); 484 484 /* clear the init_ctrl_reg_1 to signify that the cache is 485 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 487 return (FALSE); 488 488 } 489 489 ··· 579 579 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; 580 580 581 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 584 return(0); 585 585 } ··· 616 616 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; 617 617 618 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 621 return(0); 622 622 } ··· 635 635 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; 636 636 637 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 640 return(0); 641 641 } ··· 654 654 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; 655 655 656 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 659 return(0); 660 660 } ··· 673 673 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; 674 674 675 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 678 return(0); 679 679 } ··· 692 692 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; 693 693 694 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 697 return(0); 698 698 } ··· 711 711 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; 712 712 713 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 716 return(0); 717 717 } ··· 730 730 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; 731 731 732 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 735 return(0); 736 736 } ··· 749 749 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; 750 750 751 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 754 return(0); 755 755 } ··· 768 768 struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom; 769 769 770 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 773 return(0); 774 774 }
+3 -1
drivers/net/ixgb/ixgb_ethtool.c
··· 252 252 uint32_t *reg_start = reg; 253 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 259 /* General Registers */ 258 260 *reg++ = IXGB_READ_REG(hw, CTRL0); /* 0 */
+53 -100
drivers/net/ixgb/ixgb_main.c
··· 47 47 #else 48 48 #define DRIVERNAPI "-NAPI" 49 49 #endif 50 - char ixgb_driver_version[] = "1.0.90-k2"DRIVERNAPI; 50 + char ixgb_driver_version[] = "1.0.95-k2"DRIVERNAPI; 51 51 char ixgb_copyright[] = "Copyright (c) 1999-2005 Intel Corporation."; 52 52 53 53 /* ixgb_pci_tbl - PCI Device ID Table ··· 103 103 static int ixgb_set_mac(struct net_device *netdev, void *p); 104 104 static irqreturn_t ixgb_intr(int irq, void *data, struct pt_regs *regs); 105 105 static boolean_t ixgb_clean_tx_irq(struct ixgb_adapter *adapter); 106 + 106 107 #ifdef CONFIG_IXGB_NAPI 107 108 static int ixgb_clean(struct net_device *netdev, int *budget); 108 109 static boolean_t ixgb_clean_rx_irq(struct ixgb_adapter *adapter, ··· 121 120 static void ixgb_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid); 122 121 static void ixgb_restore_vlan(struct ixgb_adapter *adapter); 123 122 124 - static int ixgb_notify_reboot(struct notifier_block *, unsigned long event, 125 - void *ptr); 126 - static int ixgb_suspend(struct pci_dev *pdev, uint32_t state); 127 - 128 123 #ifdef CONFIG_NET_POLL_CONTROLLER 129 124 /* for netdump / net console */ 130 125 static void ixgb_netpoll(struct net_device *dev); 131 126 #endif 132 - 133 - struct notifier_block ixgb_notifier_reboot = { 134 - .notifier_call = ixgb_notify_reboot, 135 - .next = NULL, 136 - .priority = 0 137 - }; 138 127 139 128 /* Exported from other modules */ 140 129 141 130 extern void ixgb_check_options(struct ixgb_adapter *adapter); 142 131 143 132 static struct pci_driver ixgb_driver = { 144 - .name = ixgb_driver_name, 133 + .name = ixgb_driver_name, 145 134 .id_table = ixgb_pci_tbl, 146 - .probe = ixgb_probe, 147 - .remove = __devexit_p(ixgb_remove), 148 - /* Power Managment Hooks */ 149 - .suspend = NULL, 150 - .resume = NULL 135 + .probe = ixgb_probe, 136 + .remove = __devexit_p(ixgb_remove), 151 137 }; 152 138 153 139 MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>"); ··· 157 169 static int __init 158 170 ixgb_init_module(void) 159 171 { 160 - int ret; 161 172 printk(KERN_INFO "%s - version %s\n", 162 173 ixgb_driver_string, ixgb_driver_version); 163 174 164 175 printk(KERN_INFO "%s\n", ixgb_copyright); 165 176 166 - ret = pci_module_init(&ixgb_driver); 167 - if(ret >= 0) { 168 - register_reboot_notifier(&ixgb_notifier_reboot); 169 - } 170 - return ret; 177 + return pci_module_init(&ixgb_driver); 171 178 } 172 179 173 180 module_init(ixgb_init_module); ··· 177 194 static void __exit 178 195 ixgb_exit_module(void) 179 196 { 180 - unregister_reboot_notifier(&ixgb_notifier_reboot); 181 197 pci_unregister_driver(&ixgb_driver); 182 198 } 183 199 ··· 206 224 { 207 225 if(atomic_dec_and_test(&adapter->irq_sem)) { 208 226 IXGB_WRITE_REG(&adapter->hw, IMS, 209 - IXGB_INT_RXT0 | IXGB_INT_RXDMT0 | IXGB_INT_TXDW | 210 - IXGB_INT_RXO | IXGB_INT_LSC); 227 + IXGB_INT_RXT0 | IXGB_INT_RXDMT0 | IXGB_INT_TXDW | 228 + IXGB_INT_LSC); 211 229 IXGB_WRITE_FLUSH(&adapter->hw); 212 230 } 213 231 } ··· 1191 1209 | IXGB_CONTEXT_DESC_CMD_TSE 1192 1210 | IXGB_CONTEXT_DESC_CMD_IP 1193 1211 | IXGB_CONTEXT_DESC_CMD_TCP 1194 - | IXGB_CONTEXT_DESC_CMD_RS 1195 1212 | IXGB_CONTEXT_DESC_CMD_IDE 1196 1213 | (skb->len - (hdr_len))); 1214 + 1197 1215 1198 1216 if(++i == adapter->tx_ring.count) i = 0; 1199 1217 adapter->tx_ring.next_to_use = i; ··· 1229 1247 context_desc->mss = 0; 1230 1248 context_desc->cmd_type_len = 1231 1249 cpu_to_le32(IXGB_CONTEXT_DESC_TYPE 1232 - | IXGB_TX_DESC_CMD_RS 1233 - | IXGB_TX_DESC_CMD_IDE); 1250 + | IXGB_TX_DESC_CMD_IDE); 1234 1251 1235 1252 if(++i == adapter->tx_ring.count) i = 0; 1236 1253 adapter->tx_ring.next_to_use = i; ··· 1254 1273 1255 1274 unsigned int nr_frags = skb_shinfo(skb)->nr_frags; 1256 1275 unsigned int f; 1276 + 1257 1277 len -= skb->data_len; 1258 1278 1259 1279 i = tx_ring->next_to_use; ··· 1508 1526 void 1509 1527 ixgb_update_stats(struct ixgb_adapter *adapter) 1510 1528 { 1529 + struct net_device *netdev = adapter->netdev; 1530 + 1531 + if((netdev->flags & IFF_PROMISC) || (netdev->flags & IFF_ALLMULTI) || 1532 + (netdev->mc_count > IXGB_MAX_NUM_MULTICAST_ADDRESSES)) { 1533 + u64 multi = IXGB_READ_REG(&adapter->hw, MPRCL); 1534 + u32 bcast_l = IXGB_READ_REG(&adapter->hw, BPRCL); 1535 + u32 bcast_h = IXGB_READ_REG(&adapter->hw, BPRCH); 1536 + u64 bcast = ((u64)bcast_h << 32) | bcast_l; 1537 + 1538 + multi |= ((u64)IXGB_READ_REG(&adapter->hw, MPRCH) << 32); 1539 + /* fix up multicast stats by removing broadcasts */ 1540 + multi -= bcast; 1541 + 1542 + adapter->stats.mprcl += (multi & 0xFFFFFFFF); 1543 + adapter->stats.mprch += (multi >> 32); 1544 + adapter->stats.bprcl += bcast_l; 1545 + adapter->stats.bprch += bcast_h; 1546 + } else { 1547 + adapter->stats.mprcl += IXGB_READ_REG(&adapter->hw, MPRCL); 1548 + adapter->stats.mprch += IXGB_READ_REG(&adapter->hw, MPRCH); 1549 + adapter->stats.bprcl += IXGB_READ_REG(&adapter->hw, BPRCL); 1550 + adapter->stats.bprch += IXGB_READ_REG(&adapter->hw, BPRCH); 1551 + } 1511 1552 adapter->stats.tprl += IXGB_READ_REG(&adapter->hw, TPRL); 1512 1553 adapter->stats.tprh += IXGB_READ_REG(&adapter->hw, TPRH); 1513 1554 adapter->stats.gprcl += IXGB_READ_REG(&adapter->hw, GPRCL); 1514 1555 adapter->stats.gprch += IXGB_READ_REG(&adapter->hw, GPRCH); 1515 - adapter->stats.bprcl += IXGB_READ_REG(&adapter->hw, BPRCL); 1516 - adapter->stats.bprch += IXGB_READ_REG(&adapter->hw, BPRCH); 1517 - adapter->stats.mprcl += IXGB_READ_REG(&adapter->hw, MPRCL); 1518 - adapter->stats.mprch += IXGB_READ_REG(&adapter->hw, MPRCH); 1519 1556 adapter->stats.uprcl += IXGB_READ_REG(&adapter->hw, UPRCL); 1520 1557 adapter->stats.uprch += IXGB_READ_REG(&adapter->hw, UPRCH); 1521 1558 adapter->stats.vprcl += IXGB_READ_REG(&adapter->hw, VPRCL); ··· 1824 1823 struct pci_dev *pdev = adapter->pdev; 1825 1824 struct ixgb_rx_desc *rx_desc, *next_rxd; 1826 1825 struct ixgb_buffer *buffer_info, *next_buffer, *next2_buffer; 1827 - struct sk_buff *skb, *next_skb; 1828 1826 uint32_t length; 1829 1827 unsigned int i, j; 1830 1828 boolean_t cleaned = FALSE; ··· 1833 1833 buffer_info = &rx_ring->buffer_info[i]; 1834 1834 1835 1835 while(rx_desc->status & IXGB_RX_DESC_STATUS_DD) { 1836 + struct sk_buff *skb, *next_skb; 1837 + u8 status; 1836 1838 1837 1839 #ifdef CONFIG_IXGB_NAPI 1838 1840 if(*work_done >= work_to_do) ··· 1842 1840 1843 1841 (*work_done)++; 1844 1842 #endif 1843 + status = rx_desc->status; 1845 1844 skb = buffer_info->skb; 1845 + 1846 1846 prefetch(skb->data); 1847 1847 1848 1848 if(++i == rx_ring->count) i = 0; ··· 1859 1855 next_skb = next_buffer->skb; 1860 1856 prefetch(next_skb); 1861 1857 1862 - 1863 1858 cleaned = TRUE; 1864 1859 1865 1860 pci_unmap_single(pdev, ··· 1868 1865 1869 1866 length = le16_to_cpu(rx_desc->length); 1870 1867 1871 - if(unlikely(!(rx_desc->status & IXGB_RX_DESC_STATUS_EOP))) { 1868 + if(unlikely(!(status & IXGB_RX_DESC_STATUS_EOP))) { 1872 1869 1873 1870 /* All receives must fit into a single buffer */ 1874 1871 ··· 1876 1873 "length<%x>\n", length); 1877 1874 1878 1875 dev_kfree_skb_irq(skb); 1879 - rx_desc->status = 0; 1880 - buffer_info->skb = NULL; 1881 - 1882 - rx_desc = next_rxd; 1883 - buffer_info = next_buffer; 1884 - continue; 1876 + goto rxdesc_done; 1885 1877 } 1886 1878 1887 1879 if (unlikely(rx_desc->errors ··· 1885 1887 IXGB_RX_DESC_ERRORS_RXE))) { 1886 1888 1887 1889 dev_kfree_skb_irq(skb); 1888 - rx_desc->status = 0; 1889 - buffer_info->skb = NULL; 1890 - 1891 - rx_desc = next_rxd; 1892 - buffer_info = next_buffer; 1893 - continue; 1890 + goto rxdesc_done; 1894 1891 } 1895 1892 1896 1893 /* Good Receive */ ··· 1896 1903 1897 1904 skb->protocol = eth_type_trans(skb, netdev); 1898 1905 #ifdef CONFIG_IXGB_NAPI 1899 - if(adapter->vlgrp && (rx_desc->status & IXGB_RX_DESC_STATUS_VP)) { 1906 + if(adapter->vlgrp && (status & IXGB_RX_DESC_STATUS_VP)) { 1900 1907 vlan_hwaccel_receive_skb(skb, adapter->vlgrp, 1901 1908 le16_to_cpu(rx_desc->special) & 1902 1909 IXGB_RX_DESC_SPECIAL_VLAN_MASK); ··· 1904 1911 netif_receive_skb(skb); 1905 1912 } 1906 1913 #else /* CONFIG_IXGB_NAPI */ 1907 - if(adapter->vlgrp && (rx_desc->status & IXGB_RX_DESC_STATUS_VP)) { 1914 + if(adapter->vlgrp && (status & IXGB_RX_DESC_STATUS_VP)) { 1908 1915 vlan_hwaccel_rx(skb, adapter->vlgrp, 1909 1916 le16_to_cpu(rx_desc->special) & 1910 1917 IXGB_RX_DESC_SPECIAL_VLAN_MASK); ··· 1914 1921 #endif /* CONFIG_IXGB_NAPI */ 1915 1922 netdev->last_rx = jiffies; 1916 1923 1924 + rxdesc_done: 1925 + /* clean up descriptor, might be written over by hw */ 1917 1926 rx_desc->status = 0; 1918 1927 buffer_info->skb = NULL; 1919 1928 1929 + /* use prefetched values */ 1920 1930 rx_desc = next_rxd; 1921 1931 buffer_info = next_buffer; 1922 1932 } ··· 1955 1959 1956 1960 num_group_tail_writes = IXGB_RX_BUFFER_WRITE; 1957 1961 1958 - /* leave one descriptor unused */ 1959 - while(--cleancount > 0) { 1962 + /* leave three descriptors unused */ 1963 + while(--cleancount > 2) { 1960 1964 rx_desc = IXGB_RX_DESC(*rx_ring, i); 1961 1965 1962 1966 skb = dev_alloc_skb(adapter->rx_buffer_len + NET_IP_ALIGN); ··· 1983 1987 PCI_DMA_FROMDEVICE); 1984 1988 1985 1989 rx_desc->buff_addr = cpu_to_le64(buffer_info->dma); 1990 + /* guarantee DD bit not set now before h/w gets descriptor 1991 + * this is the rest of the workaround for h/w double 1992 + * writeback. */ 1993 + rx_desc->status = 0; 1986 1994 1987 1995 if((i & ~(num_group_tail_writes- 1)) == i) { 1988 1996 /* Force memory writes to complete before letting h/w ··· 2099 2099 } 2100 2100 } 2101 2101 2102 - /** 2103 - * ixgb_notify_reboot - handles OS notification of reboot event. 2104 - * @param nb notifier block, unused 2105 - * @param event Event being passed to driver to act upon 2106 - * @param p A pointer to our net device 2107 - **/ 2108 - static int 2109 - ixgb_notify_reboot(struct notifier_block *nb, unsigned long event, void *p) 2110 - { 2111 - struct pci_dev *pdev = NULL; 2112 - 2113 - switch(event) { 2114 - case SYS_DOWN: 2115 - case SYS_HALT: 2116 - case SYS_POWER_OFF: 2117 - while ((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev))) { 2118 - if (pci_dev_driver(pdev) == &ixgb_driver) 2119 - ixgb_suspend(pdev, 3); 2120 - } 2121 - } 2122 - return NOTIFY_DONE; 2123 - } 2124 - 2125 - /** 2126 - * ixgb_suspend - driver suspend function called from notify. 2127 - * @param pdev pci driver structure used for passing to 2128 - * @param state power state to enter 2129 - **/ 2130 - static int 2131 - ixgb_suspend(struct pci_dev *pdev, uint32_t state) 2132 - { 2133 - struct net_device *netdev = pci_get_drvdata(pdev); 2134 - struct ixgb_adapter *adapter = netdev->priv; 2135 - 2136 - netif_device_detach(netdev); 2137 - 2138 - if(netif_running(netdev)) 2139 - ixgb_down(adapter, TRUE); 2140 - 2141 - pci_save_state(pdev); 2142 - 2143 - state = (state > 0) ? 3 : 0; 2144 - pci_set_power_state(pdev, state); 2145 - msec_delay(200); 2146 - 2147 - return 0; 2148 - } 2149 - 2150 2102 #ifdef CONFIG_NET_POLL_CONTROLLER 2151 2103 /* 2152 2104 * Polling 'interrupt' - used by things like netconsole to send skbs ··· 2109 2157 static void ixgb_netpoll(struct net_device *dev) 2110 2158 { 2111 2159 struct ixgb_adapter *adapter = dev->priv; 2160 + 2112 2161 disable_irq(adapter->pdev->irq); 2113 2162 ixgb_intr(adapter->pdev->irq, dev, NULL); 2114 2163 enable_irq(adapter->pdev->irq);
+1 -2
drivers/net/ixgb/ixgb_osdep.h
··· 45 45 /* Don't mdelay in interrupt context! */ \ 46 46 BUG(); \ 47 47 } else { \ 48 - set_current_state(TASK_UNINTERRUPTIBLE); \ 49 - schedule_timeout((x * HZ)/1000 + 2); \ 48 + msleep(x); \ 50 49 } } while(0) 51 50 #endif 52 51