Merge branch 'upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/shemminger/netdev-2.6

* 'upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/shemminger/netdev-2.6:
[PATCH] bcm43xx: Fix access to non-existent PHY registers
[PATCH] bcm43xx: Fix array overrun in bcm43xx_geo_init
[PATCH] bcm43xx: check for valid MAC address in SPROM
[PATCH] ieee80211: Fix A band channel count (resent)
[PATCH] bcm43xx: fix iwmode crash when down
[PATCH] softmac: make non-operational after being stopped
[PATCH] softmac: don't reassociate if user asked for deauthentication
spidernet: enable support for bcm5461 ethernet phy
spidernet: introduce new setting
Fix RTL8019AS init for Toshiba RBTX49xx boards
au1000_eth.c: use ether_crc() from <linux/crc32.h>
sky2: version 1.3
Add more support for the Yukon Ultra chip found in dual core centino laptops.
sky2: synchronize irq on remove
sky2: dont write status ring
sky2: edge triggered workaround enhancement
sky2: use mask instead of modulo operation
sky2: tx ring index mask fix
sky2: status irq hang fix
sky2: backout NAPI reschedule

+283 -178
+1 -17
drivers/net/au1000_eth.c
··· 52 #include <linux/mii.h> 53 #include <linux/skbuff.h> 54 #include <linux/delay.h> 55 #include <asm/mipsregs.h> 56 #include <asm/irq.h> 57 #include <asm/io.h> ··· 2069 au1000_init(dev); 2070 dev->trans_start = jiffies; 2071 netif_wake_queue(dev); 2072 - } 2073 - 2074 - 2075 - static unsigned const ethernet_polynomial = 0x04c11db7U; 2076 - static inline u32 ether_crc(int length, unsigned char *data) 2077 - { 2078 - int crc = -1; 2079 - 2080 - while(--length >= 0) { 2081 - unsigned char current_octet = *data++; 2082 - int bit; 2083 - for (bit = 0; bit < 8; bit++, current_octet >>= 1) 2084 - crc = (crc << 1) ^ 2085 - ((crc < 0) ^ (current_octet & 1) ? 2086 - ethernet_polynomial : 0); 2087 - } 2088 - return crc; 2089 } 2090 2091 static void set_rx_mode(struct net_device *dev)
··· 52 #include <linux/mii.h> 53 #include <linux/skbuff.h> 54 #include <linux/delay.h> 55 + #include <linux/crc32.h> 56 #include <asm/mipsregs.h> 57 #include <asm/irq.h> 58 #include <asm/io.h> ··· 2068 au1000_init(dev); 2069 dev->trans_start = jiffies; 2070 netif_wake_queue(dev); 2071 } 2072 2073 static void set_rx_mode(struct net_device *dev)
+19 -12
drivers/net/ne.c
··· 139 140 #if defined(CONFIG_PLAT_MAPPI) 141 # define DCR_VAL 0x4b 142 - #elif defined(CONFIG_PLAT_OAKS32R) 143 - # define DCR_VAL 0x48 144 #else 145 # define DCR_VAL 0x49 146 #endif ··· 397 /* We must set the 8390 for word mode. */ 398 outb_p(DCR_VAL, ioaddr + EN0_DCFG); 399 start_page = NESM_START_PG; 400 - stop_page = NESM_STOP_PG; 401 } else { 402 start_page = NE1SM_START_PG; 403 - stop_page = NE1SM_STOP_PG; 404 } 405 406 #if defined(CONFIG_PLAT_MAPPI) || defined(CONFIG_PLAT_OAKS32R) ··· 522 ei_status.name = name; 523 ei_status.tx_start_page = start_page; 524 ei_status.stop_page = stop_page; 525 - #if defined(CONFIG_TOSHIBA_RBTX4927) || defined(CONFIG_TOSHIBA_RBTX4938) 526 - wordlength = 1; 527 - #endif 528 529 - #ifdef CONFIG_PLAT_OAKS32R 530 - ei_status.word16 = 0; 531 - #else 532 - ei_status.word16 = (wordlength == 2); 533 - #endif 534 535 ei_status.rx_start_page = start_page + TX_PAGES; 536 #ifdef PACKETBUF_MEMSIZE
··· 139 140 #if defined(CONFIG_PLAT_MAPPI) 141 # define DCR_VAL 0x4b 142 + #elif defined(CONFIG_PLAT_OAKS32R) || \ 143 + defined(CONFIG_TOSHIBA_RBTX4927) || defined(CONFIG_TOSHIBA_RBTX4938) 144 + # define DCR_VAL 0x48 /* 8-bit mode */ 145 #else 146 # define DCR_VAL 0x49 147 #endif ··· 396 /* We must set the 8390 for word mode. */ 397 outb_p(DCR_VAL, ioaddr + EN0_DCFG); 398 start_page = NESM_START_PG; 399 + 400 + /* 401 + * Realtek RTL8019AS datasheet says that the PSTOP register 402 + * shouldn't exceed 0x60 in 8-bit mode. 403 + * This chip can be identified by reading the signature from 404 + * the remote byte count registers (otherwise write-only)... 405 + */ 406 + if ((DCR_VAL & 0x01) == 0 && /* 8-bit mode */ 407 + inb(ioaddr + EN0_RCNTLO) == 0x50 && 408 + inb(ioaddr + EN0_RCNTHI) == 0x70) 409 + stop_page = 0x60; 410 + else 411 + stop_page = NESM_STOP_PG; 412 } else { 413 start_page = NE1SM_START_PG; 414 + stop_page = NE1SM_STOP_PG; 415 } 416 417 #if defined(CONFIG_PLAT_MAPPI) || defined(CONFIG_PLAT_OAKS32R) ··· 509 ei_status.name = name; 510 ei_status.tx_start_page = start_page; 511 ei_status.stop_page = stop_page; 512 513 + /* Use 16-bit mode only if this wasn't overridden by DCR_VAL */ 514 + ei_status.word16 = (wordlength == 2 && (DCR_VAL & 0x01)); 515 516 ei_status.rx_start_page = start_page + TX_PAGES; 517 #ifdef PACKETBUF_MEMSIZE
+117 -100
drivers/net/sky2.c
··· 51 #include "sky2.h" 52 53 #define DRV_NAME "sky2" 54 - #define DRV_VERSION "1.2" 55 #define PFX DRV_NAME " " 56 57 /* ··· 79 #define NAPI_WEIGHT 64 80 #define PHY_RETRIES 1000 81 82 static const u32 default_msg = 83 NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK 84 | NETIF_MSG_TIMER | NETIF_MSG_TX_ERR | NETIF_MSG_RX_ERR ··· 97 static int disable_msi = 0; 98 module_param(disable_msi, int, 0); 99 MODULE_PARM_DESC(disable_msi, "Disable Message Signaled Interrupt (MSI)"); 100 101 static const struct pci_device_id sky2_id_table[] = { 102 { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9000) }, ··· 304 struct sky2_port *sky2 = netdev_priv(hw->dev[port]); 305 u16 ctrl, ct1000, adv, pg, ledctrl, ledover; 306 307 - if (sky2->autoneg == AUTONEG_ENABLE && hw->chip_id != CHIP_ID_YUKON_XL) { 308 u16 ectrl = gm_phy_read(hw, port, PHY_MARV_EXT_CTRL); 309 310 ectrl &= ~(PHY_M_EC_M_DSC_MSK | PHY_M_EC_S_DSC_MSK | ··· 333 ctrl |= PHY_M_PC_MDI_XMODE(PHY_M_PC_ENA_AUTO); 334 335 if (sky2->autoneg == AUTONEG_ENABLE && 336 - hw->chip_id == CHIP_ID_YUKON_XL) { 337 ctrl &= ~PHY_M_PC_DSC_MSK; 338 ctrl |= PHY_M_PC_DSC(2) | PHY_M_PC_DOWN_S_ENA; 339 } ··· 449 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 3); 450 451 /* set LED Function Control register */ 452 - gm_phy_write(hw, port, PHY_MARV_PHY_CTRL, (PHY_M_LEDC_LOS_CTRL(1) | /* LINK/ACT */ 453 - PHY_M_LEDC_INIT_CTRL(7) | /* 10 Mbps */ 454 - PHY_M_LEDC_STA1_CTRL(7) | /* 100 Mbps */ 455 - PHY_M_LEDC_STA0_CTRL(7))); /* 1000 Mbps */ 456 457 /* set Polarity Control register */ 458 gm_phy_write(hw, port, PHY_MARV_PHY_STAT, ··· 467 /* restore page register */ 468 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, pg); 469 break; 470 471 default: 472 /* set Tx LED (LED_TX) to blink mode on Rx OR Tx activity */ ··· 494 ledover |= PHY_M_LED_MO_RX(MO_LED_OFF); 495 } 496 497 - if (hw->chip_id == CHIP_ID_YUKON_EC_U && hw->chip_rev >= 2) { 498 /* apply fixes in PHY AFE */ 499 - gm_phy_write(hw, port, 22, 255); 500 /* increase differential signal amplitude in 10BASE-T */ 501 - gm_phy_write(hw, port, 24, 0xaa99); 502 - gm_phy_write(hw, port, 23, 0x2011); 503 504 /* fix for IEEE A/B Symmetry failure in 1000BASE-T */ 505 - gm_phy_write(hw, port, 24, 0xa204); 506 - gm_phy_write(hw, port, 23, 0x2002); 507 508 /* set page register to 0 */ 509 - gm_phy_write(hw, port, 22, 0); 510 } else { 511 gm_phy_write(hw, port, PHY_MARV_LED_CTRL, ledctrl); 512 ··· 582 583 if (sky2->duplex == DUPLEX_FULL) 584 reg |= GM_GPCR_DUP_FULL; 585 } else 586 reg = GM_GPCR_SPEED_1000 | GM_GPCR_SPEED_100 | GM_GPCR_DUP_FULL; 587 ··· 753 { 754 struct sky2_tx_le *le = sky2->tx_le + sky2->tx_prod; 755 756 - sky2->tx_prod = (sky2->tx_prod + 1) % TX_RING_SIZE; 757 return le; 758 } 759 ··· 769 static inline struct sky2_rx_le *sky2_next_rx(struct sky2_port *sky2) 770 { 771 struct sky2_rx_le *le = sky2->rx_le + sky2->rx_put; 772 - sky2->rx_put = (sky2->rx_put + 1) % RX_LE_SIZE; 773 return le; 774 } 775 ··· 1112 /* Modular subtraction in ring */ 1113 static inline int tx_dist(unsigned tail, unsigned head) 1114 { 1115 - return (head - tail) % TX_RING_SIZE; 1116 } 1117 1118 /* Number of list elements available for next tx */ ··· 1289 le->opcode = OP_BUFFER | HW_OWNER; 1290 1291 fre = sky2->tx_ring 1292 - + ((re - sky2->tx_ring) + i + 1) % TX_RING_SIZE; 1293 pci_unmap_addr_set(fre, mapaddr, mapping); 1294 } 1295 ··· 1349 1350 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { 1351 struct tx_ring_info *fre; 1352 - fre = sky2->tx_ring + (put + i + 1) % TX_RING_SIZE; 1353 pci_unmap_page(pdev, pci_unmap_addr(fre, mapaddr), 1354 skb_shinfo(skb)->frags[i].size, 1355 PCI_DMA_TODEVICE); ··· 1532 sky2_write8(hw, SK_REG(port, LNK_LED_REG), 1533 LINKLED_ON | LINKLED_BLINK_OFF | LINKLED_LINKSYNC_OFF); 1534 1535 - if (hw->chip_id == CHIP_ID_YUKON_XL) { 1536 u16 pg = gm_phy_read(hw, port, PHY_MARV_EXT_ADR); 1537 1538 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 3); 1539 - gm_phy_write(hw, port, PHY_MARV_PHY_CTRL, PHY_M_LEDC_LOS_CTRL(1) | /* LINK/ACT */ 1540 - PHY_M_LEDC_INIT_CTRL(sky2->speed == 1541 - SPEED_10 ? 7 : 0) | 1542 - PHY_M_LEDC_STA1_CTRL(sky2->speed == 1543 - SPEED_100 ? 7 : 0) | 1544 - PHY_M_LEDC_STA0_CTRL(sky2->speed == 1545 - SPEED_1000 ? 7 : 0)); 1546 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, pg); 1547 } 1548 ··· 1626 sky2->speed = sky2_phy_speed(hw, aux); 1627 1628 /* Pause bits are offset (9..8) */ 1629 - if (hw->chip_id == CHIP_ID_YUKON_XL) 1630 aux >>= 6; 1631 1632 sky2->rx_pause = (aux & PHY_M_PS_RX_P_EN) != 0; ··· 1902 static int sky2_status_intr(struct sky2_hw *hw, int to_do) 1903 { 1904 int work_done = 0; 1905 1906 rmb(); 1907 1908 - for(;;) { 1909 struct sky2_status_le *le = hw->st_le + hw->st_idx; 1910 struct net_device *dev; 1911 struct sky2_port *sky2; 1912 struct sk_buff *skb; 1913 u32 status; 1914 u16 length; 1915 - u8 link, opcode; 1916 1917 - opcode = le->opcode; 1918 - if (!opcode) 1919 - break; 1920 - opcode &= ~HW_OWNER; 1921 1922 - hw->st_idx = (hw->st_idx + 1) % STATUS_RING_SIZE; 1923 - le->opcode = 0; 1924 - 1925 - link = le->link; 1926 - BUG_ON(link >= 2); 1927 - dev = hw->dev[link]; 1928 1929 sky2 = netdev_priv(dev); 1930 length = le->length; 1931 status = le->status; 1932 1933 - switch (opcode) { 1934 case OP_RXSTAT: 1935 skb = sky2_receive(sky2, length, status); 1936 if (!skb) ··· 1963 1964 case OP_TXINDEXLE: 1965 /* TX index reports status for both ports */ 1966 - sky2_tx_done(hw->dev[0], status & 0xffff); 1967 if (hw->dev[1]) 1968 sky2_tx_done(hw->dev[1], 1969 ((status >> 24) & 0xff) ··· 1974 default: 1975 if (net_ratelimit()) 1976 printk(KERN_WARNING PFX 1977 - "unknown status opcode 0x%x\n", opcode); 1978 - break; 1979 } 1980 } 1981 ··· 2126 */ 2127 static void sky2_idle(unsigned long arg) 2128 { 2129 - struct net_device *dev = (struct net_device *) arg; 2130 2131 - local_irq_disable(); 2132 if (__netif_rx_schedule_prep(dev)) 2133 __netif_rx_schedule(dev); 2134 - local_irq_enable(); 2135 } 2136 2137 ··· 2143 int work_done = 0; 2144 u32 status = sky2_read32(hw, B0_Y2_SP_EISR); 2145 2146 - restart_poll: 2147 - if (unlikely(status & ~Y2_IS_STAT_BMU)) { 2148 - if (status & Y2_IS_HW_ERR) 2149 - sky2_hw_intr(hw); 2150 2151 - if (status & Y2_IS_IRQ_PHY1) 2152 - sky2_phy_intr(hw, 0); 2153 2154 - if (status & Y2_IS_IRQ_PHY2) 2155 - sky2_phy_intr(hw, 1); 2156 2157 - if (status & Y2_IS_IRQ_MAC1) 2158 - sky2_mac_intr(hw, 0); 2159 2160 - if (status & Y2_IS_IRQ_MAC2) 2161 - sky2_mac_intr(hw, 1); 2162 2163 - if (status & Y2_IS_CHK_RX1) 2164 - sky2_descriptor_error(hw, 0, "receive", Y2_IS_CHK_RX1); 2165 2166 - if (status & Y2_IS_CHK_RX2) 2167 - sky2_descriptor_error(hw, 1, "receive", Y2_IS_CHK_RX2); 2168 2169 - if (status & Y2_IS_CHK_TXA1) 2170 - sky2_descriptor_error(hw, 0, "transmit", Y2_IS_CHK_TXA1); 2171 2172 - if (status & Y2_IS_CHK_TXA2) 2173 - sky2_descriptor_error(hw, 1, "transmit", Y2_IS_CHK_TXA2); 2174 - } 2175 2176 - if (status & Y2_IS_STAT_BMU) { 2177 - work_done += sky2_status_intr(hw, work_limit - work_done); 2178 - *budget -= work_done; 2179 - dev0->quota -= work_done; 2180 - 2181 - if (work_done >= work_limit) 2182 - return 1; 2183 - 2184 sky2_write32(hw, STAT_CTRL, SC_STAT_CLR_IRQ); 2185 - } 2186 2187 - mod_timer(&hw->idle_timer, jiffies + HZ); 2188 2189 - local_irq_disable(); 2190 - __netif_rx_complete(dev0); 2191 2192 status = sky2_read32(hw, B0_Y2_SP_LISR); 2193 - 2194 - if (unlikely(status)) { 2195 - /* More work pending, try and keep going */ 2196 - if (__netif_rx_schedule_prep(dev0)) { 2197 - __netif_rx_reschedule(dev0, work_done); 2198 - status = sky2_read32(hw, B0_Y2_SP_EISR); 2199 - local_irq_enable(); 2200 - goto restart_poll; 2201 - } 2202 - } 2203 - 2204 - local_irq_enable(); 2205 return 0; 2206 } 2207 ··· 2261 pci_name(hw->pdev), yukon2_name[hw->chip_id - CHIP_ID_YUKON_XL], 2262 hw->chip_id, hw->chip_rev); 2263 return -EOPNOTSUPP; 2264 - } 2265 - 2266 - /* This chip is new and not tested yet */ 2267 - if (hw->chip_id == CHIP_ID_YUKON_EC_U) { 2268 - pr_info(PFX "%s: is a version of Yukon 2 chipset that has not been tested yet.\n", 2269 - pci_name(hw->pdev)); 2270 - pr_info("Please report success/failure to maintainer <shemminger@osdl.org>\n"); 2271 } 2272 2273 /* disable ASF */ ··· 3314 3315 sky2_write32(hw, B0_IMSK, Y2_IS_BASE); 3316 3317 - setup_timer(&hw->idle_timer, sky2_idle, (unsigned long) dev); 3318 3319 pci_set_drvdata(pdev, hw); 3320 ··· 3357 del_timer_sync(&hw->idle_timer); 3358 3359 sky2_write32(hw, B0_IMSK, 0); 3360 dev0 = hw->dev[0]; 3361 dev1 = hw->dev[1]; 3362 if (dev1)
··· 51 #include "sky2.h" 52 53 #define DRV_NAME "sky2" 54 + #define DRV_VERSION "1.3" 55 #define PFX DRV_NAME " " 56 57 /* ··· 79 #define NAPI_WEIGHT 64 80 #define PHY_RETRIES 1000 81 82 + #define RING_NEXT(x,s) (((x)+1) & ((s)-1)) 83 + 84 static const u32 default_msg = 85 NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK 86 | NETIF_MSG_TIMER | NETIF_MSG_TX_ERR | NETIF_MSG_RX_ERR ··· 95 static int disable_msi = 0; 96 module_param(disable_msi, int, 0); 97 MODULE_PARM_DESC(disable_msi, "Disable Message Signaled Interrupt (MSI)"); 98 + 99 + static int idle_timeout = 100; 100 + module_param(idle_timeout, int, 0); 101 + MODULE_PARM_DESC(idle_timeout, "Idle timeout workaround for lost interrupts (ms)"); 102 103 static const struct pci_device_id sky2_id_table[] = { 104 { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9000) }, ··· 298 struct sky2_port *sky2 = netdev_priv(hw->dev[port]); 299 u16 ctrl, ct1000, adv, pg, ledctrl, ledover; 300 301 + if (sky2->autoneg == AUTONEG_ENABLE && 302 + (hw->chip_id != CHIP_ID_YUKON_XL || hw->chip_id == CHIP_ID_YUKON_EC_U)) { 303 u16 ectrl = gm_phy_read(hw, port, PHY_MARV_EXT_CTRL); 304 305 ectrl &= ~(PHY_M_EC_M_DSC_MSK | PHY_M_EC_S_DSC_MSK | ··· 326 ctrl |= PHY_M_PC_MDI_XMODE(PHY_M_PC_ENA_AUTO); 327 328 if (sky2->autoneg == AUTONEG_ENABLE && 329 + (hw->chip_id == CHIP_ID_YUKON_XL || hw->chip_id == CHIP_ID_YUKON_EC_U)) { 330 ctrl &= ~PHY_M_PC_DSC_MSK; 331 ctrl |= PHY_M_PC_DSC(2) | PHY_M_PC_DOWN_S_ENA; 332 } ··· 442 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 3); 443 444 /* set LED Function Control register */ 445 + gm_phy_write(hw, port, PHY_MARV_PHY_CTRL, 446 + (PHY_M_LEDC_LOS_CTRL(1) | /* LINK/ACT */ 447 + PHY_M_LEDC_INIT_CTRL(7) | /* 10 Mbps */ 448 + PHY_M_LEDC_STA1_CTRL(7) | /* 100 Mbps */ 449 + PHY_M_LEDC_STA0_CTRL(7))); /* 1000 Mbps */ 450 451 /* set Polarity Control register */ 452 gm_phy_write(hw, port, PHY_MARV_PHY_STAT, ··· 459 /* restore page register */ 460 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, pg); 461 break; 462 + case CHIP_ID_YUKON_EC_U: 463 + pg = gm_phy_read(hw, port, PHY_MARV_EXT_ADR); 464 + 465 + /* select page 3 to access LED control register */ 466 + gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 3); 467 + 468 + /* set LED Function Control register */ 469 + gm_phy_write(hw, port, PHY_MARV_PHY_CTRL, 470 + (PHY_M_LEDC_LOS_CTRL(1) | /* LINK/ACT */ 471 + PHY_M_LEDC_INIT_CTRL(8) | /* 10 Mbps */ 472 + PHY_M_LEDC_STA1_CTRL(7) | /* 100 Mbps */ 473 + PHY_M_LEDC_STA0_CTRL(7)));/* 1000 Mbps */ 474 + 475 + /* set Blink Rate in LED Timer Control Register */ 476 + gm_phy_write(hw, port, PHY_MARV_INT_MASK, 477 + ledctrl | PHY_M_LED_BLINK_RT(BLINK_84MS)); 478 + /* restore page register */ 479 + gm_phy_write(hw, port, PHY_MARV_EXT_ADR, pg); 480 + break; 481 482 default: 483 /* set Tx LED (LED_TX) to blink mode on Rx OR Tx activity */ ··· 467 ledover |= PHY_M_LED_MO_RX(MO_LED_OFF); 468 } 469 470 + if (hw->chip_id == CHIP_ID_YUKON_EC_U && hw->chip_rev == CHIP_REV_YU_EC_A1) { 471 /* apply fixes in PHY AFE */ 472 + pg = gm_phy_read(hw, port, PHY_MARV_EXT_ADR); 473 + gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 255); 474 + 475 /* increase differential signal amplitude in 10BASE-T */ 476 + gm_phy_write(hw, port, 0x18, 0xaa99); 477 + gm_phy_write(hw, port, 0x17, 0x2011); 478 479 /* fix for IEEE A/B Symmetry failure in 1000BASE-T */ 480 + gm_phy_write(hw, port, 0x18, 0xa204); 481 + gm_phy_write(hw, port, 0x17, 0x2002); 482 483 /* set page register to 0 */ 484 + gm_phy_write(hw, port, PHY_MARV_EXT_ADR, pg); 485 } else { 486 gm_phy_write(hw, port, PHY_MARV_LED_CTRL, ledctrl); 487 ··· 553 554 if (sky2->duplex == DUPLEX_FULL) 555 reg |= GM_GPCR_DUP_FULL; 556 + 557 + /* turn off pause in 10/100mbps half duplex */ 558 + else if (sky2->speed != SPEED_1000 && 559 + hw->chip_id != CHIP_ID_YUKON_EC_U) 560 + sky2->tx_pause = sky2->rx_pause = 0; 561 } else 562 reg = GM_GPCR_SPEED_1000 | GM_GPCR_SPEED_100 | GM_GPCR_DUP_FULL; 563 ··· 719 { 720 struct sky2_tx_le *le = sky2->tx_le + sky2->tx_prod; 721 722 + sky2->tx_prod = RING_NEXT(sky2->tx_prod, TX_RING_SIZE); 723 return le; 724 } 725 ··· 735 static inline struct sky2_rx_le *sky2_next_rx(struct sky2_port *sky2) 736 { 737 struct sky2_rx_le *le = sky2->rx_le + sky2->rx_put; 738 + sky2->rx_put = RING_NEXT(sky2->rx_put, RX_LE_SIZE); 739 return le; 740 } 741 ··· 1078 /* Modular subtraction in ring */ 1079 static inline int tx_dist(unsigned tail, unsigned head) 1080 { 1081 + return (head - tail) & (TX_RING_SIZE - 1); 1082 } 1083 1084 /* Number of list elements available for next tx */ ··· 1255 le->opcode = OP_BUFFER | HW_OWNER; 1256 1257 fre = sky2->tx_ring 1258 + + RING_NEXT((re - sky2->tx_ring) + i, TX_RING_SIZE); 1259 pci_unmap_addr_set(fre, mapaddr, mapping); 1260 } 1261 ··· 1315 1316 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { 1317 struct tx_ring_info *fre; 1318 + fre = sky2->tx_ring + RING_NEXT(put + i, TX_RING_SIZE); 1319 pci_unmap_page(pdev, pci_unmap_addr(fre, mapaddr), 1320 skb_shinfo(skb)->frags[i].size, 1321 PCI_DMA_TODEVICE); ··· 1498 sky2_write8(hw, SK_REG(port, LNK_LED_REG), 1499 LINKLED_ON | LINKLED_BLINK_OFF | LINKLED_LINKSYNC_OFF); 1500 1501 + if (hw->chip_id == CHIP_ID_YUKON_XL || hw->chip_id == CHIP_ID_YUKON_EC_U) { 1502 u16 pg = gm_phy_read(hw, port, PHY_MARV_EXT_ADR); 1503 + u16 led = PHY_M_LEDC_LOS_CTRL(1); /* link active */ 1504 + 1505 + switch(sky2->speed) { 1506 + case SPEED_10: 1507 + led |= PHY_M_LEDC_INIT_CTRL(7); 1508 + break; 1509 + 1510 + case SPEED_100: 1511 + led |= PHY_M_LEDC_STA1_CTRL(7); 1512 + break; 1513 + 1514 + case SPEED_1000: 1515 + led |= PHY_M_LEDC_STA0_CTRL(7); 1516 + break; 1517 + } 1518 1519 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 3); 1520 + gm_phy_write(hw, port, PHY_MARV_PHY_CTRL, led); 1521 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, pg); 1522 } 1523 ··· 1583 sky2->speed = sky2_phy_speed(hw, aux); 1584 1585 /* Pause bits are offset (9..8) */ 1586 + if (hw->chip_id == CHIP_ID_YUKON_XL || hw->chip_id == CHIP_ID_YUKON_EC_U) 1587 aux >>= 6; 1588 1589 sky2->rx_pause = (aux & PHY_M_PS_RX_P_EN) != 0; ··· 1859 static int sky2_status_intr(struct sky2_hw *hw, int to_do) 1860 { 1861 int work_done = 0; 1862 + u16 hwidx = sky2_read16(hw, STAT_PUT_IDX); 1863 1864 rmb(); 1865 1866 + while (hw->st_idx != hwidx) { 1867 struct sky2_status_le *le = hw->st_le + hw->st_idx; 1868 struct net_device *dev; 1869 struct sky2_port *sky2; 1870 struct sk_buff *skb; 1871 u32 status; 1872 u16 length; 1873 1874 + hw->st_idx = RING_NEXT(hw->st_idx, STATUS_RING_SIZE); 1875 1876 + BUG_ON(le->link >= 2); 1877 + dev = hw->dev[le->link]; 1878 1879 sky2 = netdev_priv(dev); 1880 length = le->length; 1881 status = le->status; 1882 1883 + switch (le->opcode & ~HW_OWNER) { 1884 case OP_RXSTAT: 1885 skb = sky2_receive(sky2, length, status); 1886 if (!skb) ··· 1927 1928 case OP_TXINDEXLE: 1929 /* TX index reports status for both ports */ 1930 + BUILD_BUG_ON(TX_RING_SIZE > 0x1000); 1931 + sky2_tx_done(hw->dev[0], status & 0xfff); 1932 if (hw->dev[1]) 1933 sky2_tx_done(hw->dev[1], 1934 ((status >> 24) & 0xff) ··· 1937 default: 1938 if (net_ratelimit()) 1939 printk(KERN_WARNING PFX 1940 + "unknown status opcode 0x%x\n", le->opcode); 1941 + goto exit_loop; 1942 } 1943 } 1944 ··· 2089 */ 2090 static void sky2_idle(unsigned long arg) 2091 { 2092 + struct sky2_hw *hw = (struct sky2_hw *) arg; 2093 + struct net_device *dev = hw->dev[0]; 2094 2095 if (__netif_rx_schedule_prep(dev)) 2096 __netif_rx_schedule(dev); 2097 + 2098 + mod_timer(&hw->idle_timer, jiffies + msecs_to_jiffies(idle_timeout)); 2099 } 2100 2101 ··· 2105 int work_done = 0; 2106 u32 status = sky2_read32(hw, B0_Y2_SP_EISR); 2107 2108 + if (status & Y2_IS_HW_ERR) 2109 + sky2_hw_intr(hw); 2110 2111 + if (status & Y2_IS_IRQ_PHY1) 2112 + sky2_phy_intr(hw, 0); 2113 2114 + if (status & Y2_IS_IRQ_PHY2) 2115 + sky2_phy_intr(hw, 1); 2116 2117 + if (status & Y2_IS_IRQ_MAC1) 2118 + sky2_mac_intr(hw, 0); 2119 2120 + if (status & Y2_IS_IRQ_MAC2) 2121 + sky2_mac_intr(hw, 1); 2122 2123 + if (status & Y2_IS_CHK_RX1) 2124 + sky2_descriptor_error(hw, 0, "receive", Y2_IS_CHK_RX1); 2125 2126 + if (status & Y2_IS_CHK_RX2) 2127 + sky2_descriptor_error(hw, 1, "receive", Y2_IS_CHK_RX2); 2128 2129 + if (status & Y2_IS_CHK_TXA1) 2130 + sky2_descriptor_error(hw, 0, "transmit", Y2_IS_CHK_TXA1); 2131 2132 + if (status & Y2_IS_CHK_TXA2) 2133 + sky2_descriptor_error(hw, 1, "transmit", Y2_IS_CHK_TXA2); 2134 2135 + if (status & Y2_IS_STAT_BMU) 2136 sky2_write32(hw, STAT_CTRL, SC_STAT_CLR_IRQ); 2137 2138 + work_done = sky2_status_intr(hw, work_limit); 2139 + *budget -= work_done; 2140 + dev0->quota -= work_done; 2141 2142 + if (work_done >= work_limit) 2143 + return 1; 2144 + 2145 + netif_rx_complete(dev0); 2146 2147 status = sky2_read32(hw, B0_Y2_SP_LISR); 2148 return 0; 2149 } 2150 ··· 2242 pci_name(hw->pdev), yukon2_name[hw->chip_id - CHIP_ID_YUKON_XL], 2243 hw->chip_id, hw->chip_rev); 2244 return -EOPNOTSUPP; 2245 } 2246 2247 /* disable ASF */ ··· 3302 3303 sky2_write32(hw, B0_IMSK, Y2_IS_BASE); 3304 3305 + setup_timer(&hw->idle_timer, sky2_idle, (unsigned long) hw); 3306 + if (idle_timeout > 0) 3307 + mod_timer(&hw->idle_timer, 3308 + jiffies + msecs_to_jiffies(idle_timeout)); 3309 3310 pci_set_drvdata(pdev, hw); 3311 ··· 3342 del_timer_sync(&hw->idle_timer); 3343 3344 sky2_write32(hw, B0_IMSK, 0); 3345 + synchronize_irq(hw->pdev->irq); 3346 + 3347 dev0 = hw->dev[0]; 3348 dev1 = hw->dev[1]; 3349 if (dev1)
+3
drivers/net/sky2.h
··· 378 CHIP_REV_YU_EC_A1 = 0, /* Chip Rev. for Yukon-EC A1/A0 */ 379 CHIP_REV_YU_EC_A2 = 1, /* Chip Rev. for Yukon-EC A2 */ 380 CHIP_REV_YU_EC_A3 = 2, /* Chip Rev. for Yukon-EC A3 */ 381 }; 382 383 /* B2_Y2_CLK_GATE 8 bit Clock Gating (Yukon-2 only) */
··· 378 CHIP_REV_YU_EC_A1 = 0, /* Chip Rev. for Yukon-EC A1/A0 */ 379 CHIP_REV_YU_EC_A2 = 1, /* Chip Rev. for Yukon-EC A2 */ 380 CHIP_REV_YU_EC_A3 = 2, /* Chip Rev. for Yukon-EC A3 */ 381 + 382 + CHIP_REV_YU_EC_U_A0 = 0, 383 + CHIP_REV_YU_EC_U_A1 = 1, 384 }; 385 386 /* B2_Y2_CLK_GATE 8 bit Clock Gating (Yukon-2 only) */
+3 -9
drivers/net/spider_net.c
··· 1652 { SPIDER_NET_GFTRESTRT, SPIDER_NET_RESTART_VALUE }, 1653 1654 { SPIDER_NET_GMRWOLCTRL, 0 }, 1655 { SPIDER_NET_GTESTMD, 0 }, 1656 1657 { SPIDER_NET_GMACINTEN, 0 }, ··· 1794 if (phy->def->ops->setup_forced) 1795 phy->def->ops->setup_forced(phy, SPEED_1000, DUPLEX_FULL); 1796 1797 - /* the following two writes could be moved to sungem_phy.c */ 1798 - /* enable fiber mode */ 1799 - spider_net_write_phy(card->netdev, 1, MII_NCONFIG, 0x9020); 1800 - /* LEDs active in both modes, autosense prio = fiber */ 1801 - spider_net_write_phy(card->netdev, 1, MII_NCONFIG, 0x945f); 1802 - 1803 - /* switch off fibre autoneg */ 1804 - spider_net_write_phy(card->netdev, 1, MII_NCONFIG, 0xfc01); 1805 - spider_net_write_phy(card->netdev, 1, 0x0b, 0x0004); 1806 1807 phy->def->ops->read_link(phy); 1808 pr_info("Found %s with %i Mbps, %s-duplex.\n", phy->def->name,
··· 1652 { SPIDER_NET_GFTRESTRT, SPIDER_NET_RESTART_VALUE }, 1653 1654 { SPIDER_NET_GMRWOLCTRL, 0 }, 1655 + { SPIDER_NET_GTESTMD, 0x10000000 }, 1656 + { SPIDER_NET_GTTQMSK, 0x00400040 }, 1657 { SPIDER_NET_GTESTMD, 0 }, 1658 1659 { SPIDER_NET_GMACINTEN, 0 }, ··· 1792 if (phy->def->ops->setup_forced) 1793 phy->def->ops->setup_forced(phy, SPEED_1000, DUPLEX_FULL); 1794 1795 + phy->def->ops->enable_fiber(phy); 1796 1797 phy->def->ops->read_link(phy); 1798 pr_info("Found %s with %i Mbps, %s-duplex.\n", phy->def->name,
+2
drivers/net/spider_net.h
··· 120 #define SPIDER_NET_GMRUAFILnR 0x00000500 121 #define SPIDER_NET_GMRUA0FIL15R 0x00000578 122 123 /* RX DMA controller registers, all 0x00000a.. are for DMA controller A, 124 * 0x00000b.. for DMA controller B, etc. */ 125 #define SPIDER_NET_GDADCHA 0x00000a00
··· 120 #define SPIDER_NET_GMRUAFILnR 0x00000500 121 #define SPIDER_NET_GMRUA0FIL15R 0x00000578 122 123 + #define SPIDER_NET_GTTQMSK 0x00000934 124 + 125 /* RX DMA controller registers, all 0x00000a.. are for DMA controller A, 126 * 0x00000b.. for DMA controller B, etc. */ 127 #define SPIDER_NET_GDADCHA 0x00000a00
+45
drivers/net/sungem_phy.c
··· 329 return 0; 330 } 331 332 static int bcm54xx_setup_aneg(struct mii_phy *phy, u32 advertise) 333 { 334 u16 ctl, adv; ··· 786 .setup_forced = bcm54xx_setup_forced, 787 .poll_link = genmii_poll_link, 788 .read_link = bcm54xx_read_link, 789 }; 790 791 static struct mii_phy_def bcm5421_phy_def = { ··· 815 .features = MII_GBIT_FEATURES, 816 .magic_aneg = 1, 817 .ops = &bcm5421k2_phy_ops 818 }; 819 820 /* Broadcom BCM 5462 built-in Vesta */ ··· 901 &bcm5411_phy_def, 902 &bcm5421_phy_def, 903 &bcm5421k2_phy_def, 904 &bcm5462V_phy_def, 905 &marvell_phy_def, 906 &genmii_phy_def,
··· 329 return 0; 330 } 331 332 + static int bcm5421_enable_fiber(struct mii_phy* phy) 333 + { 334 + /* enable fiber mode */ 335 + phy_write(phy, MII_NCONFIG, 0x9020); 336 + /* LEDs active in both modes, autosense prio = fiber */ 337 + phy_write(phy, MII_NCONFIG, 0x945f); 338 + 339 + /* switch off fibre autoneg */ 340 + phy_write(phy, MII_NCONFIG, 0xfc01); 341 + phy_write(phy, 0x0b, 0x0004); 342 + 343 + return 0; 344 + } 345 + 346 + static int bcm5461_enable_fiber(struct mii_phy* phy) 347 + { 348 + phy_write(phy, MII_NCONFIG, 0xfc0c); 349 + phy_write(phy, MII_BMCR, 0x4140); 350 + phy_write(phy, MII_NCONFIG, 0xfc0b); 351 + phy_write(phy, MII_BMCR, 0x0140); 352 + 353 + return 0; 354 + } 355 + 356 static int bcm54xx_setup_aneg(struct mii_phy *phy, u32 advertise) 357 { 358 u16 ctl, adv; ··· 762 .setup_forced = bcm54xx_setup_forced, 763 .poll_link = genmii_poll_link, 764 .read_link = bcm54xx_read_link, 765 + .enable_fiber = bcm5421_enable_fiber, 766 }; 767 768 static struct mii_phy_def bcm5421_phy_def = { ··· 790 .features = MII_GBIT_FEATURES, 791 .magic_aneg = 1, 792 .ops = &bcm5421k2_phy_ops 793 + }; 794 + 795 + static struct mii_phy_ops bcm5461_phy_ops = { 796 + .init = bcm5421_init, 797 + .suspend = generic_suspend, 798 + .setup_aneg = bcm54xx_setup_aneg, 799 + .setup_forced = bcm54xx_setup_forced, 800 + .poll_link = genmii_poll_link, 801 + .read_link = bcm54xx_read_link, 802 + .enable_fiber = bcm5461_enable_fiber, 803 + }; 804 + 805 + static struct mii_phy_def bcm5461_phy_def = { 806 + .phy_id = 0x002060c0, 807 + .phy_id_mask = 0xfffffff0, 808 + .name = "BCM5461", 809 + .features = MII_GBIT_FEATURES, 810 + .magic_aneg = 1, 811 + .ops = &bcm5461_phy_ops 812 }; 813 814 /* Broadcom BCM 5462 built-in Vesta */ ··· 857 &bcm5411_phy_def, 858 &bcm5421_phy_def, 859 &bcm5421k2_phy_def, 860 + &bcm5461_phy_def, 861 &bcm5462V_phy_def, 862 &marvell_phy_def, 863 &genmii_phy_def,
+1
drivers/net/sungem_phy.h
··· 12 int (*setup_forced)(struct mii_phy *phy, int speed, int fd); 13 int (*poll_link)(struct mii_phy *phy); 14 int (*read_link)(struct mii_phy *phy); 15 }; 16 17 /* Structure used to statically define an mii/gii based PHY */
··· 12 int (*setup_forced)(struct mii_phy *phy, int speed, int fd); 13 int (*poll_link)(struct mii_phy *phy); 14 int (*read_link)(struct mii_phy *phy); 15 + int (*enable_fiber)(struct mii_phy *phy); 16 }; 17 18 /* Structure used to statically define an mii/gii based PHY */
+27 -18
drivers/net/wireless/bcm43xx/bcm43xx_main.c
··· 939 return 0; 940 } 941 942 - static void bcm43xx_geo_init(struct bcm43xx_private *bcm) 943 { 944 - struct ieee80211_geo geo; 945 struct ieee80211_channel *chan; 946 int have_a = 0, have_bg = 0; 947 int i; ··· 949 struct bcm43xx_phyinfo *phy; 950 const char *iso_country; 951 952 - memset(&geo, 0, sizeof(geo)); 953 for (i = 0; i < bcm->nr_80211_available; i++) { 954 phy = &(bcm->core_80211_ext[i].phy); 955 switch (phy->type) { ··· 970 iso_country = bcm43xx_locale_iso(bcm->sprom.locale); 971 972 if (have_a) { 973 - for (i = 0, channel = 0; channel < 201; channel++) { 974 - chan = &geo.a[i++]; 975 chan->freq = bcm43xx_channel_to_freq_a(channel); 976 chan->channel = channel; 977 } 978 - geo.a_channels = i; 979 } 980 if (have_bg) { 981 - for (i = 0, channel = 1; channel < 15; channel++) { 982 - chan = &geo.bg[i++]; 983 chan->freq = bcm43xx_channel_to_freq_bg(channel); 984 chan->channel = channel; 985 } 986 - geo.bg_channels = i; 987 } 988 - memcpy(geo.name, iso_country, 2); 989 if (0 /*TODO: Outdoor use only */) 990 - geo.name[2] = 'O'; 991 else if (0 /*TODO: Indoor use only */) 992 - geo.name[2] = 'I'; 993 else 994 - geo.name[2] = ' '; 995 - geo.name[3] = '\0'; 996 997 - ieee80211_set_geo(bcm->ieee, &geo); 998 } 999 1000 /* DummyTransmission function, as documented on ··· 3487 goto err_80211_unwind; 3488 bcm43xx_wireless_core_disable(bcm); 3489 } 3490 bcm43xx_pctl_set_crystal(bcm, 0); 3491 3492 /* Set the MAC address in the networking subsystem */ 3493 - if (bcm43xx_current_phy(bcm)->type == BCM43xx_PHYTYPE_A) 3494 memcpy(bcm->net_dev->dev_addr, bcm->sprom.et1macaddr, 6); 3495 else 3496 memcpy(bcm->net_dev->dev_addr, bcm->sprom.il0macaddr, 6); 3497 - 3498 - bcm43xx_geo_init(bcm); 3499 3500 snprintf(bcm->nick, IW_ESSID_MAX_SIZE, 3501 "Broadcom %04X", bcm->chip_id);
··· 939 return 0; 940 } 941 942 + static int bcm43xx_geo_init(struct bcm43xx_private *bcm) 943 { 944 + struct ieee80211_geo *geo; 945 struct ieee80211_channel *chan; 946 int have_a = 0, have_bg = 0; 947 int i; ··· 949 struct bcm43xx_phyinfo *phy; 950 const char *iso_country; 951 952 + geo = kzalloc(sizeof(*geo), GFP_KERNEL); 953 + if (!geo) 954 + return -ENOMEM; 955 + 956 for (i = 0; i < bcm->nr_80211_available; i++) { 957 phy = &(bcm->core_80211_ext[i].phy); 958 switch (phy->type) { ··· 967 iso_country = bcm43xx_locale_iso(bcm->sprom.locale); 968 969 if (have_a) { 970 + for (i = 0, channel = IEEE80211_52GHZ_MIN_CHANNEL; 971 + channel <= IEEE80211_52GHZ_MAX_CHANNEL; channel++) { 972 + chan = &geo->a[i++]; 973 chan->freq = bcm43xx_channel_to_freq_a(channel); 974 chan->channel = channel; 975 } 976 + geo->a_channels = i; 977 } 978 if (have_bg) { 979 + for (i = 0, channel = IEEE80211_24GHZ_MIN_CHANNEL; 980 + channel <= IEEE80211_24GHZ_MAX_CHANNEL; channel++) { 981 + chan = &geo->bg[i++]; 982 chan->freq = bcm43xx_channel_to_freq_bg(channel); 983 chan->channel = channel; 984 } 985 + geo->bg_channels = i; 986 } 987 + memcpy(geo->name, iso_country, 2); 988 if (0 /*TODO: Outdoor use only */) 989 + geo->name[2] = 'O'; 990 else if (0 /*TODO: Indoor use only */) 991 + geo->name[2] = 'I'; 992 else 993 + geo->name[2] = ' '; 994 + geo->name[3] = '\0'; 995 996 + ieee80211_set_geo(bcm->ieee, geo); 997 + kfree(geo); 998 + 999 + return 0; 1000 } 1001 1002 /* DummyTransmission function, as documented on ··· 3479 goto err_80211_unwind; 3480 bcm43xx_wireless_core_disable(bcm); 3481 } 3482 + err = bcm43xx_geo_init(bcm); 3483 + if (err) 3484 + goto err_80211_unwind; 3485 bcm43xx_pctl_set_crystal(bcm, 0); 3486 3487 /* Set the MAC address in the networking subsystem */ 3488 + if (is_valid_ether_addr(bcm->sprom.et1macaddr)) 3489 memcpy(bcm->net_dev->dev_addr, bcm->sprom.et1macaddr, 6); 3490 else 3491 memcpy(bcm->net_dev->dev_addr, bcm->sprom.il0macaddr, 6); 3492 3493 snprintf(bcm->nick, IW_ESSID_MAX_SIZE, 3494 "Broadcom %04X", bcm->chip_id);
+4 -2
drivers/net/wireless/bcm43xx/bcm43xx_main.h
··· 118 static inline 119 int bcm43xx_is_valid_channel_a(u8 channel) 120 { 121 - return (channel <= 200); 122 } 123 static inline 124 int bcm43xx_is_valid_channel_bg(u8 channel) 125 { 126 - return (channel >= 1 && channel <= 14); 127 } 128 static inline 129 int bcm43xx_is_valid_channel(struct bcm43xx_private *bcm,
··· 118 static inline 119 int bcm43xx_is_valid_channel_a(u8 channel) 120 { 121 + return (channel >= IEEE80211_52GHZ_MIN_CHANNEL 122 + && channel <= IEEE80211_52GHZ_MAX_CHANNEL); 123 } 124 static inline 125 int bcm43xx_is_valid_channel_bg(u8 channel) 126 { 127 + return (channel >= IEEE80211_24GHZ_MIN_CHANNEL 128 + && channel <= IEEE80211_24GHZ_MAX_CHANNEL); 129 } 130 static inline 131 int bcm43xx_is_valid_channel(struct bcm43xx_private *bcm,
+1 -1
drivers/net/wireless/bcm43xx/bcm43xx_phy.c
··· 1287 if (radio->revision == 8) 1288 bcm43xx_phy_write(bcm, 0x0805, 0x3230); 1289 bcm43xx_phy_init_pctl(bcm); 1290 - if (bcm->chip_id == 0x4306 && bcm->chip_package != 2) { 1291 bcm43xx_phy_write(bcm, 0x0429, 1292 bcm43xx_phy_read(bcm, 0x0429) & 0xBFFF); 1293 bcm43xx_phy_write(bcm, 0x04C3,
··· 1287 if (radio->revision == 8) 1288 bcm43xx_phy_write(bcm, 0x0805, 0x3230); 1289 bcm43xx_phy_init_pctl(bcm); 1290 + if (bcm->chip_id == 0x4306 && bcm->chip_package == 2) { 1291 bcm43xx_phy_write(bcm, 0x0429, 1292 bcm43xx_phy_read(bcm, 0x0429) & 0xBFFF); 1293 bcm43xx_phy_write(bcm, 0x04C3,
+5 -2
drivers/net/wireless/bcm43xx/bcm43xx_wx.c
··· 182 mode = BCM43xx_INITIAL_IWMODE; 183 184 bcm43xx_lock_mmio(bcm, flags); 185 - if (bcm->ieee->iw_mode != mode) 186 - bcm43xx_set_iwmode(bcm, mode); 187 bcm43xx_unlock_mmio(bcm, flags); 188 189 return 0;
··· 182 mode = BCM43xx_INITIAL_IWMODE; 183 184 bcm43xx_lock_mmio(bcm, flags); 185 + if (bcm->initialized) { 186 + if (bcm->ieee->iw_mode != mode) 187 + bcm43xx_set_iwmode(bcm, mode); 188 + } else 189 + bcm->ieee->iw_mode = mode; 190 bcm43xx_unlock_mmio(bcm, flags); 191 192 return 0;
+8 -10
include/linux/netdevice.h
··· 831 __netif_rx_schedule(dev); 832 } 833 834 - 835 - static inline void __netif_rx_reschedule(struct net_device *dev, int undo) 836 - { 837 - dev->quota += undo; 838 - list_add_tail(&dev->poll_list, &__get_cpu_var(softnet_data).poll_list); 839 - __raise_softirq_irqoff(NET_RX_SOFTIRQ); 840 - } 841 - 842 - /* Try to reschedule poll. Called by dev->poll() after netif_rx_complete(). */ 843 static inline int netif_rx_reschedule(struct net_device *dev, int undo) 844 { 845 if (netif_rx_schedule_prep(dev)) { 846 unsigned long flags; 847 local_irq_save(flags); 848 - __netif_rx_reschedule(dev, undo); 849 local_irq_restore(flags); 850 return 1; 851 }
··· 831 __netif_rx_schedule(dev); 832 } 833 834 + /* Try to reschedule poll. Called by dev->poll() after netif_rx_complete(). 835 + * Do not inline this? 836 + */ 837 static inline int netif_rx_reschedule(struct net_device *dev, int undo) 838 { 839 if (netif_rx_schedule_prep(dev)) { 840 unsigned long flags; 841 + 842 + dev->quota += undo; 843 + 844 local_irq_save(flags); 845 + list_add_tail(&dev->poll_list, &__get_cpu_var(softnet_data).poll_list); 846 + __raise_softirq_irqoff(NET_RX_SOFTIRQ); 847 local_irq_restore(flags); 848 return 1; 849 }
+4 -2
include/net/ieee80211.h
··· 955 956 #define IEEE80211_24GHZ_MIN_CHANNEL 1 957 #define IEEE80211_24GHZ_MAX_CHANNEL 14 958 - #define IEEE80211_24GHZ_CHANNELS 14 959 960 #define IEEE80211_52GHZ_MIN_CHANNEL 34 961 #define IEEE80211_52GHZ_MAX_CHANNEL 165 962 - #define IEEE80211_52GHZ_CHANNELS 131 963 964 enum { 965 IEEE80211_CH_PASSIVE_ONLY = (1 << 0),
··· 955 956 #define IEEE80211_24GHZ_MIN_CHANNEL 1 957 #define IEEE80211_24GHZ_MAX_CHANNEL 14 958 + #define IEEE80211_24GHZ_CHANNELS (IEEE80211_24GHZ_MAX_CHANNEL - \ 959 + IEEE80211_24GHZ_MIN_CHANNEL + 1) 960 961 #define IEEE80211_52GHZ_MIN_CHANNEL 34 962 #define IEEE80211_52GHZ_MAX_CHANNEL 165 963 + #define IEEE80211_52GHZ_CHANNELS (IEEE80211_52GHZ_MAX_CHANNEL - \ 964 + IEEE80211_52GHZ_MIN_CHANNEL + 1) 965 966 enum { 967 IEEE80211_CH_PASSIVE_ONLY = (1 << 0),
+2 -1
include/net/ieee80211softmac.h
··· 204 205 /* couple of flags */ 206 u8 scanning:1, /* protects scanning from being done multiple times at once */ 207 - associated:1; 208 209 struct ieee80211softmac_scaninfo *scaninfo; 210 struct ieee80211softmac_assoc_info associnfo;
··· 204 205 /* couple of flags */ 206 u8 scanning:1, /* protects scanning from being done multiple times at once */ 207 + associated:1, 208 + running:1; 209 210 struct ieee80211softmac_scaninfo *scaninfo; 211 struct ieee80211softmac_assoc_info associnfo;
+15 -2
net/ieee80211/softmac/ieee80211softmac_assoc.c
··· 51 spin_lock_irqsave(&mac->lock, flags); 52 mac->associnfo.associating = 1; 53 mac->associated = 0; /* just to make sure */ 54 - spin_unlock_irqrestore(&mac->lock, flags); 55 56 /* Set a timer for timeout */ 57 /* FIXME: make timeout configurable */ 58 - schedule_delayed_work(&mac->associnfo.timeout, 5 * HZ); 59 } 60 61 void ··· 320 u16 status = le16_to_cpup(&resp->status); 321 struct ieee80211softmac_network *network = NULL; 322 unsigned long flags; 323 324 spin_lock_irqsave(&mac->lock, flags); 325 ··· 381 { 382 struct ieee80211softmac_device *mac = ieee80211_priv(dev); 383 unsigned long flags; 384 if (memcmp(disassoc->header.addr2, mac->associnfo.bssid, ETH_ALEN)) 385 return 0; 386 if (memcmp(disassoc->header.addr1, mac->dev->dev_addr, ETH_ALEN)) 387 return 0; 388 dprintk(KERN_INFO PFX "got disassoc frame\n"); 389 netif_carrier_off(dev); 390 spin_lock_irqsave(&mac->lock, flags); ··· 409 { 410 struct ieee80211softmac_device *mac = ieee80211_priv(dev); 411 struct ieee80211softmac_network *network; 412 413 network = ieee80211softmac_get_network_by_bssid(mac, resp->header.addr3); 414 if (!network) {
··· 51 spin_lock_irqsave(&mac->lock, flags); 52 mac->associnfo.associating = 1; 53 mac->associated = 0; /* just to make sure */ 54 55 /* Set a timer for timeout */ 56 /* FIXME: make timeout configurable */ 57 + if (likely(mac->running)) 58 + schedule_delayed_work(&mac->associnfo.timeout, 5 * HZ); 59 + spin_unlock_irqrestore(&mac->lock, flags); 60 } 61 62 void ··· 319 u16 status = le16_to_cpup(&resp->status); 320 struct ieee80211softmac_network *network = NULL; 321 unsigned long flags; 322 + 323 + if (unlikely(!mac->running)) 324 + return -ENODEV; 325 326 spin_lock_irqsave(&mac->lock, flags); 327 ··· 377 { 378 struct ieee80211softmac_device *mac = ieee80211_priv(dev); 379 unsigned long flags; 380 + 381 + if (unlikely(!mac->running)) 382 + return -ENODEV; 383 + 384 if (memcmp(disassoc->header.addr2, mac->associnfo.bssid, ETH_ALEN)) 385 return 0; 386 + 387 if (memcmp(disassoc->header.addr1, mac->dev->dev_addr, ETH_ALEN)) 388 return 0; 389 + 390 dprintk(KERN_INFO PFX "got disassoc frame\n"); 391 netif_carrier_off(dev); 392 spin_lock_irqsave(&mac->lock, flags); ··· 399 { 400 struct ieee80211softmac_device *mac = ieee80211_priv(dev); 401 struct ieee80211softmac_network *network; 402 + 403 + if (unlikely(!mac->running)) 404 + return -ENODEV; 405 406 network = ieee80211softmac_get_network_by_bssid(mac, resp->header.addr3); 407 if (!network) {
+14 -2
net/ieee80211/softmac/ieee80211softmac_auth.c
··· 86 87 /* Lock and set flags */ 88 spin_lock_irqsave(&mac->lock, flags); 89 net->authenticated = 0; 90 net->authenticating = 1; 91 /* add a timeout call so we eventually give up waiting for an auth reply */ ··· 129 unsigned long flags; 130 u8 * data; 131 132 /* Find correct auth queue item */ 133 spin_lock_irqsave(&mac->lock, flags); 134 list_for_each(list_ptr, &mac->auth_queue) { ··· 306 307 /* can't transmit data right now... */ 308 netif_carrier_off(mac->dev); 309 - /* let's try to re-associate */ 310 - schedule_work(&mac->associnfo.work); 311 spin_unlock_irqrestore(&mac->lock, flags); 312 } 313 ··· 344 struct ieee80211softmac_network *net = NULL; 345 struct ieee80211softmac_device *mac = ieee80211_priv(dev); 346 347 if (!deauth) { 348 dprintk("deauth without deauth packet. eek!\n"); 349 return 0; ··· 369 } 370 371 ieee80211softmac_deauth_from_net(mac, net); 372 return 0; 373 }
··· 86 87 /* Lock and set flags */ 88 spin_lock_irqsave(&mac->lock, flags); 89 + if (unlikely(!mac->running)) { 90 + /* Prevent reschedule on workqueue flush */ 91 + spin_unlock_irqrestore(&mac->lock, flags); 92 + return; 93 + } 94 net->authenticated = 0; 95 net->authenticating = 1; 96 /* add a timeout call so we eventually give up waiting for an auth reply */ ··· 124 unsigned long flags; 125 u8 * data; 126 127 + if (unlikely(!mac->running)) 128 + return -ENODEV; 129 + 130 /* Find correct auth queue item */ 131 spin_lock_irqsave(&mac->lock, flags); 132 list_for_each(list_ptr, &mac->auth_queue) { ··· 298 299 /* can't transmit data right now... */ 300 netif_carrier_off(mac->dev); 301 spin_unlock_irqrestore(&mac->lock, flags); 302 } 303 ··· 338 struct ieee80211softmac_network *net = NULL; 339 struct ieee80211softmac_device *mac = ieee80211_priv(dev); 340 341 + if (unlikely(!mac->running)) 342 + return -ENODEV; 343 + 344 if (!deauth) { 345 dprintk("deauth without deauth packet. eek!\n"); 346 return 0; ··· 360 } 361 362 ieee80211softmac_deauth_from_net(mac, net); 363 + 364 + /* let's try to re-associate */ 365 + schedule_work(&mac->associnfo.work); 366 return 0; 367 }
+4
net/ieee80211/softmac/ieee80211softmac_module.c
··· 89 ieee80211softmac_wait_for_scan(sm); 90 91 spin_lock_irqsave(&sm->lock, flags); 92 /* Free all pending assoc work items */ 93 cancel_delayed_work(&sm->associnfo.work); 94 ··· 206 assert(0); 207 if (mac->txrates_change) 208 mac->txrates_change(dev, change, &oldrates); 209 } 210 EXPORT_SYMBOL_GPL(ieee80211softmac_start); 211
··· 89 ieee80211softmac_wait_for_scan(sm); 90 91 spin_lock_irqsave(&sm->lock, flags); 92 + sm->running = 0; 93 + 94 /* Free all pending assoc work items */ 95 cancel_delayed_work(&sm->associnfo.work); 96 ··· 204 assert(0); 205 if (mac->txrates_change) 206 mac->txrates_change(dev, change, &oldrates); 207 + 208 + mac->running = 1; 209 } 210 EXPORT_SYMBOL_GPL(ieee80211softmac_start); 211
+8
net/ieee80211/softmac/ieee80211softmac_scan.c
··· 115 // TODO: is this if correct, or should we do this only if scanning from assoc request? 116 if (sm->associnfo.req_essid.len) 117 ieee80211softmac_send_mgt_frame(sm, &sm->associnfo.req_essid, IEEE80211_STYPE_PROBE_REQ, 0); 118 schedule_delayed_work(&si->softmac_scan, IEEE80211SOFTMAC_PROBE_DELAY); 119 return; 120 } else { 121 dprintk(PFX "Not probing Channel %d (not allowed here)\n", si->channels[current_channel_idx].channel);
··· 115 // TODO: is this if correct, or should we do this only if scanning from assoc request? 116 if (sm->associnfo.req_essid.len) 117 ieee80211softmac_send_mgt_frame(sm, &sm->associnfo.req_essid, IEEE80211_STYPE_PROBE_REQ, 0); 118 + 119 + spin_lock_irqsave(&sm->lock, flags); 120 + if (unlikely(!sm->running)) { 121 + /* Prevent reschedule on workqueue flush */ 122 + spin_unlock_irqrestore(&sm->lock, flags); 123 + break; 124 + } 125 schedule_delayed_work(&si->softmac_scan, IEEE80211SOFTMAC_PROBE_DELAY); 126 + spin_unlock_irqrestore(&sm->lock, flags); 127 return; 128 } else { 129 dprintk(PFX "Not probing Channel %d (not allowed here)\n", si->channels[current_channel_idx].channel);