aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/isdn/i4l/isdn_net.c2
-rw-r--r--drivers/net/bnx2.c4
-rw-r--r--drivers/net/davinci_emac.c1
-rw-r--r--drivers/net/e100.c11
-rw-r--r--drivers/net/e1000/e1000_main.c4
-rw-r--r--drivers/net/forcedeth.c46
-rw-r--r--drivers/net/hamradio/bpqether.c2
-rw-r--r--drivers/net/hp100.c35
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c6
-rw-r--r--drivers/net/mv643xx_eth.c2
-rw-r--r--drivers/net/netxen/netxen_nic.h11
-rw-r--r--drivers/net/netxen/netxen_nic_hdr.h1
-rw-r--r--drivers/net/netxen/netxen_nic_hw.c6
-rw-r--r--drivers/net/netxen/netxen_nic_init.c11
-rw-r--r--drivers/net/netxen/netxen_nic_main.c32
-rw-r--r--drivers/net/niu.c4
-rw-r--r--drivers/net/phy/phy_device.c2
-rw-r--r--drivers/net/r8169.c19
-rw-r--r--drivers/net/sis190.c2
-rw-r--r--drivers/net/sky2.c161
-rw-r--r--drivers/net/sky2.h1
-rw-r--r--drivers/net/sonic.c2
-rw-r--r--drivers/net/ucc_geth.c113
-rw-r--r--drivers/net/ucc_geth.h2
-rw-r--r--drivers/net/via-velocity.c4
-rw-r--r--drivers/net/virtio_net.c10
-rw-r--r--drivers/net/vxge/vxge-config.c12
-rw-r--r--drivers/net/vxge/vxge-main.c13
-rw-r--r--drivers/net/vxge/vxge-version.h4
-rw-r--r--drivers/net/wan/lapbether.c16
-rw-r--r--drivers/net/wireless/ath/ath5k/pcu.c5
-rw-r--r--drivers/net/wireless/ath/ath9k/Kconfig1
-rw-r--r--drivers/net/wireless/ath/ath9k/ath9k.h10
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c29
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.h3
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c130
-rw-r--r--drivers/net/wireless/ath/ath9k/recv.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c141
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c4
-rw-r--r--drivers/net/wireless/libertas/if_spi.c11
-rw-r--r--drivers/platform/x86/dell-laptop.c2
-rw-r--r--drivers/platform/x86/sony-laptop.c5
-rw-r--r--drivers/s390/net/qeth_l2_main.c2
44 files changed, 458 insertions, 426 deletions
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c
index 34d54e7281fd..de4aad076ebc 100644
--- a/drivers/isdn/i4l/isdn_net.c
+++ b/drivers/isdn/i4l/isdn_net.c
@@ -1300,7 +1300,7 @@ isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev)
1300 netif_stop_queue(ndev); 1300 netif_stop_queue(ndev);
1301 } 1301 }
1302 } 1302 }
1303 return 1; 1303 return NETDEV_TX_BUSY;
1304} 1304}
1305 1305
1306/* 1306/*
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 7e3738112c4e..38f1c3375d7f 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -3552,14 +3552,14 @@ bnx2_set_rx_mode(struct net_device *dev)
3552 sort_mode |= BNX2_RPM_SORT_USER0_MC_HSH_EN; 3552 sort_mode |= BNX2_RPM_SORT_USER0_MC_HSH_EN;
3553 } 3553 }
3554 3554
3555 if (dev->uc_count > BNX2_MAX_UNICAST_ADDRESSES) { 3555 if (dev->uc.count > BNX2_MAX_UNICAST_ADDRESSES) {
3556 rx_mode |= BNX2_EMAC_RX_MODE_PROMISCUOUS; 3556 rx_mode |= BNX2_EMAC_RX_MODE_PROMISCUOUS;
3557 sort_mode |= BNX2_RPM_SORT_USER0_PROM_EN | 3557 sort_mode |= BNX2_RPM_SORT_USER0_PROM_EN |
3558 BNX2_RPM_SORT_USER0_PROM_VLAN; 3558 BNX2_RPM_SORT_USER0_PROM_VLAN;
3559 } else if (!(dev->flags & IFF_PROMISC)) { 3559 } else if (!(dev->flags & IFF_PROMISC)) {
3560 /* Add all entries into to the match filter list */ 3560 /* Add all entries into to the match filter list */
3561 i = 0; 3561 i = 0;
3562 list_for_each_entry(ha, &dev->uc_list, list) { 3562 list_for_each_entry(ha, &dev->uc.list, list) {
3563 bnx2_set_mac_addr(bp, ha->addr, 3563 bnx2_set_mac_addr(bp, ha->addr,
3564 i + BNX2_START_UNICAST_ADDRESS_INDEX); 3564 i + BNX2_START_UNICAST_ADDRESS_INDEX);
3565 sort_mode |= (1 << 3565 sort_mode |= (1 <<
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 0e9b9f9632c1..2df8fb0af701 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -2767,7 +2767,6 @@ static int __devexit davinci_emac_remove(struct platform_device *pdev)
2767 2767
2768 dev_notice(&ndev->dev, "DaVinci EMAC: davinci_emac_remove()\n"); 2768 dev_notice(&ndev->dev, "DaVinci EMAC: davinci_emac_remove()\n");
2769 2769
2770 clk_disable(emac_clk);
2771 platform_set_drvdata(pdev, NULL); 2770 platform_set_drvdata(pdev, NULL);
2772 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 2771 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
2773 mdiobus_unregister(priv->mii_bus); 2772 mdiobus_unregister(priv->mii_bus);
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index f7929e89eb03..efa680f4b8dd 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -2895,12 +2895,13 @@ static void __e100_shutdown(struct pci_dev *pdev, bool *enable_wake)
2895 2895
2896static int __e100_power_off(struct pci_dev *pdev, bool wake) 2896static int __e100_power_off(struct pci_dev *pdev, bool wake)
2897{ 2897{
2898 if (wake) { 2898 if (wake)
2899 return pci_prepare_to_sleep(pdev); 2899 return pci_prepare_to_sleep(pdev);
2900 } else { 2900
2901 pci_wake_from_d3(pdev, false); 2901 pci_wake_from_d3(pdev, false);
2902 return pci_set_power_state(pdev, PCI_D3hot); 2902 pci_set_power_state(pdev, PCI_D3hot);
2903 } 2903
2904 return 0;
2904} 2905}
2905 2906
2906#ifdef CONFIG_PM 2907#ifdef CONFIG_PM
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 8d36743c8140..5e3356f8eb5a 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -2370,7 +2370,7 @@ static void e1000_set_rx_mode(struct net_device *netdev)
2370 rctl |= E1000_RCTL_VFE; 2370 rctl |= E1000_RCTL_VFE;
2371 } 2371 }
2372 2372
2373 if (netdev->uc_count > rar_entries - 1) { 2373 if (netdev->uc.count > rar_entries - 1) {
2374 rctl |= E1000_RCTL_UPE; 2374 rctl |= E1000_RCTL_UPE;
2375 } else if (!(netdev->flags & IFF_PROMISC)) { 2375 } else if (!(netdev->flags & IFF_PROMISC)) {
2376 rctl &= ~E1000_RCTL_UPE; 2376 rctl &= ~E1000_RCTL_UPE;
@@ -2394,7 +2394,7 @@ static void e1000_set_rx_mode(struct net_device *netdev)
2394 */ 2394 */
2395 i = 1; 2395 i = 1;
2396 if (use_uc) 2396 if (use_uc)
2397 list_for_each_entry(ha, &netdev->uc_list, list) { 2397 list_for_each_entry(ha, &netdev->uc.list, list) {
2398 if (i == rar_entries) 2398 if (i == rar_entries)
2399 break; 2399 break;
2400 e1000_rar_set(hw, ha->addr, i++); 2400 e1000_rar_set(hw, ha->addr, i++);
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index b60a3041b64c..1094d292630f 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -719,7 +719,8 @@ static const struct register_test nv_registers_test[] = {
719struct nv_skb_map { 719struct nv_skb_map {
720 struct sk_buff *skb; 720 struct sk_buff *skb;
721 dma_addr_t dma; 721 dma_addr_t dma;
722 unsigned int dma_len; 722 unsigned int dma_len:31;
723 unsigned int dma_single:1;
723 struct ring_desc_ex *first_tx_desc; 724 struct ring_desc_ex *first_tx_desc;
724 struct nv_skb_map *next_tx_ctx; 725 struct nv_skb_map *next_tx_ctx;
725}; 726};
@@ -1912,6 +1913,7 @@ static void nv_init_tx(struct net_device *dev)
1912 np->tx_skb[i].skb = NULL; 1913 np->tx_skb[i].skb = NULL;
1913 np->tx_skb[i].dma = 0; 1914 np->tx_skb[i].dma = 0;
1914 np->tx_skb[i].dma_len = 0; 1915 np->tx_skb[i].dma_len = 0;
1916 np->tx_skb[i].dma_single = 0;
1915 np->tx_skb[i].first_tx_desc = NULL; 1917 np->tx_skb[i].first_tx_desc = NULL;
1916 np->tx_skb[i].next_tx_ctx = NULL; 1918 np->tx_skb[i].next_tx_ctx = NULL;
1917 } 1919 }
@@ -1930,23 +1932,30 @@ static int nv_init_ring(struct net_device *dev)
1930 return nv_alloc_rx_optimized(dev); 1932 return nv_alloc_rx_optimized(dev);
1931} 1933}
1932 1934
1933static int nv_release_txskb(struct net_device *dev, struct nv_skb_map* tx_skb) 1935static void nv_unmap_txskb(struct fe_priv *np, struct nv_skb_map *tx_skb)
1934{ 1936{
1935 struct fe_priv *np = netdev_priv(dev);
1936
1937 if (tx_skb->dma) { 1937 if (tx_skb->dma) {
1938 pci_unmap_page(np->pci_dev, tx_skb->dma, 1938 if (tx_skb->dma_single)
1939 tx_skb->dma_len, 1939 pci_unmap_single(np->pci_dev, tx_skb->dma,
1940 PCI_DMA_TODEVICE); 1940 tx_skb->dma_len,
1941 PCI_DMA_TODEVICE);
1942 else
1943 pci_unmap_page(np->pci_dev, tx_skb->dma,
1944 tx_skb->dma_len,
1945 PCI_DMA_TODEVICE);
1941 tx_skb->dma = 0; 1946 tx_skb->dma = 0;
1942 } 1947 }
1948}
1949
1950static int nv_release_txskb(struct fe_priv *np, struct nv_skb_map *tx_skb)
1951{
1952 nv_unmap_txskb(np, tx_skb);
1943 if (tx_skb->skb) { 1953 if (tx_skb->skb) {
1944 dev_kfree_skb_any(tx_skb->skb); 1954 dev_kfree_skb_any(tx_skb->skb);
1945 tx_skb->skb = NULL; 1955 tx_skb->skb = NULL;
1946 return 1; 1956 return 1;
1947 } else {
1948 return 0;
1949 } 1957 }
1958 return 0;
1950} 1959}
1951 1960
1952static void nv_drain_tx(struct net_device *dev) 1961static void nv_drain_tx(struct net_device *dev)
@@ -1964,10 +1973,11 @@ static void nv_drain_tx(struct net_device *dev)
1964 np->tx_ring.ex[i].bufhigh = 0; 1973 np->tx_ring.ex[i].bufhigh = 0;
1965 np->tx_ring.ex[i].buflow = 0; 1974 np->tx_ring.ex[i].buflow = 0;
1966 } 1975 }
1967 if (nv_release_txskb(dev, &np->tx_skb[i])) 1976 if (nv_release_txskb(np, &np->tx_skb[i]))
1968 dev->stats.tx_dropped++; 1977 dev->stats.tx_dropped++;
1969 np->tx_skb[i].dma = 0; 1978 np->tx_skb[i].dma = 0;
1970 np->tx_skb[i].dma_len = 0; 1979 np->tx_skb[i].dma_len = 0;
1980 np->tx_skb[i].dma_single = 0;
1971 np->tx_skb[i].first_tx_desc = NULL; 1981 np->tx_skb[i].first_tx_desc = NULL;
1972 np->tx_skb[i].next_tx_ctx = NULL; 1982 np->tx_skb[i].next_tx_ctx = NULL;
1973 } 1983 }
@@ -2171,6 +2181,7 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
2171 np->put_tx_ctx->dma = pci_map_single(np->pci_dev, skb->data + offset, bcnt, 2181 np->put_tx_ctx->dma = pci_map_single(np->pci_dev, skb->data + offset, bcnt,
2172 PCI_DMA_TODEVICE); 2182 PCI_DMA_TODEVICE);
2173 np->put_tx_ctx->dma_len = bcnt; 2183 np->put_tx_ctx->dma_len = bcnt;
2184 np->put_tx_ctx->dma_single = 1;
2174 put_tx->buf = cpu_to_le32(np->put_tx_ctx->dma); 2185 put_tx->buf = cpu_to_le32(np->put_tx_ctx->dma);
2175 put_tx->flaglen = cpu_to_le32((bcnt-1) | tx_flags); 2186 put_tx->flaglen = cpu_to_le32((bcnt-1) | tx_flags);
2176 2187
@@ -2196,6 +2207,7 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
2196 np->put_tx_ctx->dma = pci_map_page(np->pci_dev, frag->page, frag->page_offset+offset, bcnt, 2207 np->put_tx_ctx->dma = pci_map_page(np->pci_dev, frag->page, frag->page_offset+offset, bcnt,
2197 PCI_DMA_TODEVICE); 2208 PCI_DMA_TODEVICE);
2198 np->put_tx_ctx->dma_len = bcnt; 2209 np->put_tx_ctx->dma_len = bcnt;
2210 np->put_tx_ctx->dma_single = 0;
2199 put_tx->buf = cpu_to_le32(np->put_tx_ctx->dma); 2211 put_tx->buf = cpu_to_le32(np->put_tx_ctx->dma);
2200 put_tx->flaglen = cpu_to_le32((bcnt-1) | tx_flags); 2212 put_tx->flaglen = cpu_to_le32((bcnt-1) | tx_flags);
2201 2213
@@ -2291,6 +2303,7 @@ static int nv_start_xmit_optimized(struct sk_buff *skb, struct net_device *dev)
2291 np->put_tx_ctx->dma = pci_map_single(np->pci_dev, skb->data + offset, bcnt, 2303 np->put_tx_ctx->dma = pci_map_single(np->pci_dev, skb->data + offset, bcnt,
2292 PCI_DMA_TODEVICE); 2304 PCI_DMA_TODEVICE);
2293 np->put_tx_ctx->dma_len = bcnt; 2305 np->put_tx_ctx->dma_len = bcnt;
2306 np->put_tx_ctx->dma_single = 1;
2294 put_tx->bufhigh = cpu_to_le32(dma_high(np->put_tx_ctx->dma)); 2307 put_tx->bufhigh = cpu_to_le32(dma_high(np->put_tx_ctx->dma));
2295 put_tx->buflow = cpu_to_le32(dma_low(np->put_tx_ctx->dma)); 2308 put_tx->buflow = cpu_to_le32(dma_low(np->put_tx_ctx->dma));
2296 put_tx->flaglen = cpu_to_le32((bcnt-1) | tx_flags); 2309 put_tx->flaglen = cpu_to_le32((bcnt-1) | tx_flags);
@@ -2317,6 +2330,7 @@ static int nv_start_xmit_optimized(struct sk_buff *skb, struct net_device *dev)
2317 np->put_tx_ctx->dma = pci_map_page(np->pci_dev, frag->page, frag->page_offset+offset, bcnt, 2330 np->put_tx_ctx->dma = pci_map_page(np->pci_dev, frag->page, frag->page_offset+offset, bcnt,
2318 PCI_DMA_TODEVICE); 2331 PCI_DMA_TODEVICE);
2319 np->put_tx_ctx->dma_len = bcnt; 2332 np->put_tx_ctx->dma_len = bcnt;
2333 np->put_tx_ctx->dma_single = 0;
2320 put_tx->bufhigh = cpu_to_le32(dma_high(np->put_tx_ctx->dma)); 2334 put_tx->bufhigh = cpu_to_le32(dma_high(np->put_tx_ctx->dma));
2321 put_tx->buflow = cpu_to_le32(dma_low(np->put_tx_ctx->dma)); 2335 put_tx->buflow = cpu_to_le32(dma_low(np->put_tx_ctx->dma));
2322 put_tx->flaglen = cpu_to_le32((bcnt-1) | tx_flags); 2336 put_tx->flaglen = cpu_to_le32((bcnt-1) | tx_flags);
@@ -2434,10 +2448,7 @@ static int nv_tx_done(struct net_device *dev, int limit)
2434 dprintk(KERN_DEBUG "%s: nv_tx_done: flags 0x%x.\n", 2448 dprintk(KERN_DEBUG "%s: nv_tx_done: flags 0x%x.\n",
2435 dev->name, flags); 2449 dev->name, flags);
2436 2450
2437 pci_unmap_page(np->pci_dev, np->get_tx_ctx->dma, 2451 nv_unmap_txskb(np, np->get_tx_ctx);
2438 np->get_tx_ctx->dma_len,
2439 PCI_DMA_TODEVICE);
2440 np->get_tx_ctx->dma = 0;
2441 2452
2442 if (np->desc_ver == DESC_VER_1) { 2453 if (np->desc_ver == DESC_VER_1) {
2443 if (flags & NV_TX_LASTPACKET) { 2454 if (flags & NV_TX_LASTPACKET) {
@@ -2502,10 +2513,7 @@ static int nv_tx_done_optimized(struct net_device *dev, int limit)
2502 dprintk(KERN_DEBUG "%s: nv_tx_done_optimized: flags 0x%x.\n", 2513 dprintk(KERN_DEBUG "%s: nv_tx_done_optimized: flags 0x%x.\n",
2503 dev->name, flags); 2514 dev->name, flags);
2504 2515
2505 pci_unmap_page(np->pci_dev, np->get_tx_ctx->dma, 2516 nv_unmap_txskb(np, np->get_tx_ctx);
2506 np->get_tx_ctx->dma_len,
2507 PCI_DMA_TODEVICE);
2508 np->get_tx_ctx->dma = 0;
2509 2517
2510 if (flags & NV_TX2_LASTPACKET) { 2518 if (flags & NV_TX2_LASTPACKET) {
2511 if (!(flags & NV_TX2_ERROR)) 2519 if (!(flags & NV_TX2_ERROR))
@@ -5091,7 +5099,7 @@ static int nv_loopback_test(struct net_device *dev)
5091 dprintk(KERN_DEBUG "%s: loopback - did not receive test packet\n", dev->name); 5099 dprintk(KERN_DEBUG "%s: loopback - did not receive test packet\n", dev->name);
5092 } 5100 }
5093 5101
5094 pci_unmap_page(np->pci_dev, test_dma_addr, 5102 pci_unmap_single(np->pci_dev, test_dma_addr,
5095 (skb_end_pointer(tx_skb) - tx_skb->data), 5103 (skb_end_pointer(tx_skb) - tx_skb->data),
5096 PCI_DMA_TODEVICE); 5104 PCI_DMA_TODEVICE);
5097 dev_kfree_skb_any(tx_skb); 5105 dev_kfree_skb_any(tx_skb);
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c
index 5105548ad50c..abcd19a8bff9 100644
--- a/drivers/net/hamradio/bpqether.c
+++ b/drivers/net/hamradio/bpqether.c
@@ -260,7 +260,7 @@ static int bpq_xmit(struct sk_buff *skb, struct net_device *dev)
260 */ 260 */
261 if (!netif_running(dev)) { 261 if (!netif_running(dev)) {
262 kfree_skb(skb); 262 kfree_skb(skb);
263 return -ENODEV; 263 return NETDEV_TX_OK;
264 } 264 }
265 265
266 skb_pull(skb, 1); 266 skb_pull(skb, 1);
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c
index 8feda9fe8297..1d3429a415e6 100644
--- a/drivers/net/hp100.c
+++ b/drivers/net/hp100.c
@@ -1495,13 +1495,8 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev)
1495 hp100_outw(0x4210, TRACE); 1495 hp100_outw(0x4210, TRACE);
1496 printk("hp100: %s: start_xmit_bm\n", dev->name); 1496 printk("hp100: %s: start_xmit_bm\n", dev->name);
1497#endif 1497#endif
1498
1499 if (skb == NULL) {
1500 return 0;
1501 }
1502
1503 if (skb->len <= 0) 1498 if (skb->len <= 0)
1504 return 0; 1499 goto drop;
1505 1500
1506 if (lp->chip == HP100_CHIPID_SHASTA && skb_padto(skb, ETH_ZLEN)) 1501 if (lp->chip == HP100_CHIPID_SHASTA && skb_padto(skb, ETH_ZLEN))
1507 return 0; 1502 return 0;
@@ -1514,10 +1509,10 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev)
1514#endif 1509#endif
1515 /* not waited long enough since last tx? */ 1510 /* not waited long enough since last tx? */
1516 if (time_before(jiffies, dev->trans_start + HZ)) 1511 if (time_before(jiffies, dev->trans_start + HZ))
1517 return -EAGAIN; 1512 goto drop;
1518 1513
1519 if (hp100_check_lan(dev)) 1514 if (hp100_check_lan(dev))
1520 return -EIO; 1515 goto drop;
1521 1516
1522 if (lp->lan_type == HP100_LAN_100 && lp->hub_status < 0) { 1517 if (lp->lan_type == HP100_LAN_100 && lp->hub_status < 0) {
1523 /* we have a 100Mb/s adapter but it isn't connected to hub */ 1518 /* we have a 100Mb/s adapter but it isn't connected to hub */
@@ -1551,7 +1546,7 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev)
1551 } 1546 }
1552 1547
1553 dev->trans_start = jiffies; 1548 dev->trans_start = jiffies;
1554 return -EAGAIN; 1549 goto drop;
1555 } 1550 }
1556 1551
1557 /* 1552 /*
@@ -1591,6 +1586,10 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev)
1591 dev->trans_start = jiffies; 1586 dev->trans_start = jiffies;
1592 1587
1593 return 0; 1588 return 0;
1589
1590drop:
1591 dev_kfree_skb(skb);
1592 return NETDEV_TX_OK;
1594} 1593}
1595 1594
1596 1595
@@ -1648,16 +1647,11 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev)
1648 hp100_outw(0x4212, TRACE); 1647 hp100_outw(0x4212, TRACE);
1649 printk("hp100: %s: start_xmit\n", dev->name); 1648 printk("hp100: %s: start_xmit\n", dev->name);
1650#endif 1649#endif
1651
1652 if (skb == NULL) {
1653 return 0;
1654 }
1655
1656 if (skb->len <= 0) 1650 if (skb->len <= 0)
1657 return 0; 1651 goto drop;
1658 1652
1659 if (hp100_check_lan(dev)) 1653 if (hp100_check_lan(dev))
1660 return -EIO; 1654 goto drop;
1661 1655
1662 /* If there is not enough free memory on the card... */ 1656 /* If there is not enough free memory on the card... */
1663 i = hp100_inl(TX_MEM_FREE) & 0x7fffffff; 1657 i = hp100_inl(TX_MEM_FREE) & 0x7fffffff;
@@ -1671,7 +1665,7 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev)
1671 printk("hp100: %s: trans_start timing problem\n", 1665 printk("hp100: %s: trans_start timing problem\n",
1672 dev->name); 1666 dev->name);
1673#endif 1667#endif
1674 return -EAGAIN; 1668 goto drop;
1675 } 1669 }
1676 if (lp->lan_type == HP100_LAN_100 && lp->hub_status < 0) { 1670 if (lp->lan_type == HP100_LAN_100 && lp->hub_status < 0) {
1677 /* we have a 100Mb/s adapter but it isn't connected to hub */ 1671 /* we have a 100Mb/s adapter but it isn't connected to hub */
@@ -1705,7 +1699,7 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev)
1705 } 1699 }
1706 } 1700 }
1707 dev->trans_start = jiffies; 1701 dev->trans_start = jiffies;
1708 return -EAGAIN; 1702 goto drop;
1709 } 1703 }
1710 1704
1711 for (i = 0; i < 6000 && (hp100_inb(OPTION_MSW) & HP100_TX_CMD); i++) { 1705 for (i = 0; i < 6000 && (hp100_inb(OPTION_MSW) & HP100_TX_CMD); i++) {
@@ -1759,6 +1753,11 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev)
1759#endif 1753#endif
1760 1754
1761 return 0; 1755 return 0;
1756
1757drop:
1758 dev_kfree_skb(skb);
1759 return NETDEV_TX_OK;
1760
1762} 1761}
1763 1762
1764 1763
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index a551a96ce676..e756e220db32 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -2321,7 +2321,7 @@ static void ixgbe_set_rx_mode(struct net_device *netdev)
2321 IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, vlnctrl); 2321 IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, vlnctrl);
2322 2322
2323 /* reprogram secondary unicast list */ 2323 /* reprogram secondary unicast list */
2324 hw->mac.ops.update_uc_addr_list(hw, &netdev->uc_list); 2324 hw->mac.ops.update_uc_addr_list(hw, &netdev->uc.list);
2325 2325
2326 /* reprogram multicast list */ 2326 /* reprogram multicast list */
2327 addr_count = netdev->mc_count; 2327 addr_count = netdev->mc_count;
@@ -5261,7 +5261,7 @@ static int ixgbe_ioctl(struct net_device *netdev, struct ifreq *req, int cmd)
5261 5261
5262/** 5262/**
5263 * ixgbe_add_sanmac_netdev - Add the SAN MAC address to the corresponding 5263 * ixgbe_add_sanmac_netdev - Add the SAN MAC address to the corresponding
5264 * netdev->dev_addr_list 5264 * netdev->dev_addrs
5265 * @netdev: network interface device structure 5265 * @netdev: network interface device structure
5266 * 5266 *
5267 * Returns non-zero on failure 5267 * Returns non-zero on failure
@@ -5282,7 +5282,7 @@ static int ixgbe_add_sanmac_netdev(struct net_device *dev)
5282 5282
5283/** 5283/**
5284 * ixgbe_del_sanmac_netdev - Removes the SAN MAC address to the corresponding 5284 * ixgbe_del_sanmac_netdev - Removes the SAN MAC address to the corresponding
5285 * netdev->dev_addr_list 5285 * netdev->dev_addrs
5286 * @netdev: network interface device structure 5286 * @netdev: network interface device structure
5287 * 5287 *
5288 * Returns non-zero on failure 5288 * Returns non-zero on failure
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index b4e18a58cb1b..745ae8b4a2e8 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -1729,7 +1729,7 @@ static u32 uc_addr_filter_mask(struct net_device *dev)
1729 return 0; 1729 return 0;
1730 1730
1731 nibbles = 1 << (dev->dev_addr[5] & 0x0f); 1731 nibbles = 1 << (dev->dev_addr[5] & 0x0f);
1732 list_for_each_entry(ha, &dev->uc_list, list) { 1732 list_for_each_entry(ha, &dev->uc.list, list) {
1733 if (memcmp(dev->dev_addr, ha->addr, 5)) 1733 if (memcmp(dev->dev_addr, ha->addr, 5))
1734 return 0; 1734 return 0;
1735 if ((dev->dev_addr[5] ^ ha->addr[5]) & 0xf0) 1735 if ((dev->dev_addr[5] ^ ha->addr[5]) & 0xf0)
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index ab11c2b3f0fe..970cedeb5f37 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -169,6 +169,7 @@
169#define MAX_NUM_CARDS 4 169#define MAX_NUM_CARDS 4
170 170
171#define MAX_BUFFERS_PER_CMD 32 171#define MAX_BUFFERS_PER_CMD 32
172#define TX_STOP_THRESH ((MAX_SKB_FRAGS >> 2) + 4)
172 173
173/* 174/*
174 * Following are the states of the Phantom. Phantom will set them and 175 * Following are the states of the Phantom. Phantom will set them and
@@ -1436,7 +1437,7 @@ int netxen_nic_set_mac(struct net_device *netdev, void *p);
1436struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev); 1437struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev);
1437 1438
1438void netxen_nic_update_cmd_producer(struct netxen_adapter *adapter, 1439void netxen_nic_update_cmd_producer(struct netxen_adapter *adapter,
1439 struct nx_host_tx_ring *tx_ring, uint32_t crb_producer); 1440 struct nx_host_tx_ring *tx_ring);
1440 1441
1441/* 1442/*
1442 * NetXen Board information 1443 * NetXen Board information
@@ -1538,6 +1539,14 @@ dma_watchdog_wakeup(struct netxen_adapter *adapter)
1538} 1539}
1539 1540
1540 1541
1542static inline u32 netxen_tx_avail(struct nx_host_tx_ring *tx_ring)
1543{
1544 smp_mb();
1545 return find_diff_among(tx_ring->producer,
1546 tx_ring->sw_consumer, tx_ring->num_desc);
1547
1548}
1549
1541int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, __le64 *mac); 1550int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, __le64 *mac);
1542int netxen_p3_get_mac_addr(struct netxen_adapter *adapter, __le64 *mac); 1551int netxen_p3_get_mac_addr(struct netxen_adapter *adapter, __le64 *mac);
1543extern void netxen_change_ringparam(struct netxen_adapter *adapter); 1552extern void netxen_change_ringparam(struct netxen_adapter *adapter);
diff --git a/drivers/net/netxen/netxen_nic_hdr.h b/drivers/net/netxen/netxen_nic_hdr.h
index 7f0ddbfa7b28..3cc047844af3 100644
--- a/drivers/net/netxen/netxen_nic_hdr.h
+++ b/drivers/net/netxen/netxen_nic_hdr.h
@@ -355,6 +355,7 @@ enum {
355#define NETXEN_HW_CRB_HUB_AGT_ADR_LPC \ 355#define NETXEN_HW_CRB_HUB_AGT_ADR_LPC \
356 ((NETXEN_HW_H6_CH_HUB_ADR << 7) | NETXEN_HW_LPC_CRB_AGT_ADR) 356 ((NETXEN_HW_H6_CH_HUB_ADR << 7) | NETXEN_HW_LPC_CRB_AGT_ADR)
357 357
358#define NETXEN_SRE_MISC (NETXEN_CRB_SRE + 0x0002c)
358#define NETXEN_SRE_INT_STATUS (NETXEN_CRB_SRE + 0x00034) 359#define NETXEN_SRE_INT_STATUS (NETXEN_CRB_SRE + 0x00034)
359#define NETXEN_SRE_PBI_ACTIVE_STATUS (NETXEN_CRB_SRE + 0x01014) 360#define NETXEN_SRE_PBI_ACTIVE_STATUS (NETXEN_CRB_SRE + 0x01014)
360#define NETXEN_SRE_L1RE_CTL (NETXEN_CRB_SRE + 0x03000) 361#define NETXEN_SRE_L1RE_CTL (NETXEN_CRB_SRE + 0x03000)
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index 42ffb825ebf1..ce3b89d2cbb6 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -488,7 +488,7 @@ netxen_send_cmd_descs(struct netxen_adapter *adapter,
488 488
489 tx_ring->producer = producer; 489 tx_ring->producer = producer;
490 490
491 netxen_nic_update_cmd_producer(adapter, tx_ring, producer); 491 netxen_nic_update_cmd_producer(adapter, tx_ring);
492 492
493 netif_tx_unlock_bh(adapter->netdev); 493 netif_tx_unlock_bh(adapter->netdev);
494 494
@@ -2041,8 +2041,8 @@ void netxen_nic_get_firmware_info(struct netxen_adapter *adapter)
2041 fw_major, fw_minor, fw_build); 2041 fw_major, fw_minor, fw_build);
2042 2042
2043 if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) { 2043 if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) {
2044 i = NXRD32(adapter, NETXEN_MIU_MN_CONTROL); 2044 i = NXRD32(adapter, NETXEN_SRE_MISC);
2045 adapter->ahw.cut_through = (i & 0x4) ? 1 : 0; 2045 adapter->ahw.cut_through = (i & 0x8000) ? 1 : 0;
2046 dev_info(&pdev->dev, "firmware running in %s mode\n", 2046 dev_info(&pdev->dev, "firmware running in %s mode\n",
2047 adapter->ahw.cut_through ? "cut-through" : "legacy"); 2047 adapter->ahw.cut_through ? "cut-through" : "legacy");
2048 } 2048 }
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index 6f77ad58e3b3..bdb143d2b5c7 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -1292,7 +1292,6 @@ int netxen_process_cmd_ring(struct netxen_adapter *adapter)
1292 return 1; 1292 return 1;
1293 1293
1294 sw_consumer = tx_ring->sw_consumer; 1294 sw_consumer = tx_ring->sw_consumer;
1295 barrier(); /* hw_consumer can change underneath */
1296 hw_consumer = le32_to_cpu(*(tx_ring->hw_consumer)); 1295 hw_consumer = le32_to_cpu(*(tx_ring->hw_consumer));
1297 1296
1298 while (sw_consumer != hw_consumer) { 1297 while (sw_consumer != hw_consumer) {
@@ -1319,14 +1318,15 @@ int netxen_process_cmd_ring(struct netxen_adapter *adapter)
1319 break; 1318 break;
1320 } 1319 }
1321 1320
1322 tx_ring->sw_consumer = sw_consumer;
1323
1324 if (count && netif_running(netdev)) { 1321 if (count && netif_running(netdev)) {
1322 tx_ring->sw_consumer = sw_consumer;
1323
1325 smp_mb(); 1324 smp_mb();
1325
1326 if (netif_queue_stopped(netdev) && netif_carrier_ok(netdev)) { 1326 if (netif_queue_stopped(netdev) && netif_carrier_ok(netdev)) {
1327 netif_tx_lock(netdev); 1327 netif_tx_lock(netdev);
1328 netif_wake_queue(netdev); 1328 if (netxen_tx_avail(tx_ring) > TX_STOP_THRESH)
1329 smp_mb(); 1329 netif_wake_queue(netdev);
1330 netif_tx_unlock(netdev); 1330 netif_tx_unlock(netdev);
1331 } 1331 }
1332 } 1332 }
@@ -1343,7 +1343,6 @@ int netxen_process_cmd_ring(struct netxen_adapter *adapter)
1343 * There is still a possible race condition and the host could miss an 1343 * There is still a possible race condition and the host could miss an
1344 * interrupt. The card has to take care of this. 1344 * interrupt. The card has to take care of this.
1345 */ 1345 */
1346 barrier(); /* hw_consumer can change underneath */
1347 hw_consumer = le32_to_cpu(*(tx_ring->hw_consumer)); 1346 hw_consumer = le32_to_cpu(*(tx_ring->hw_consumer));
1348 done = (sw_consumer == hw_consumer); 1347 done = (sw_consumer == hw_consumer);
1349 spin_unlock(&adapter->tx_clean_lock); 1348 spin_unlock(&adapter->tx_clean_lock);
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 98737ef72936..71daa3d5f114 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -107,9 +107,14 @@ static uint32_t crb_cmd_producer[4] = {
107 107
108void 108void
109netxen_nic_update_cmd_producer(struct netxen_adapter *adapter, 109netxen_nic_update_cmd_producer(struct netxen_adapter *adapter,
110 struct nx_host_tx_ring *tx_ring, u32 producer) 110 struct nx_host_tx_ring *tx_ring)
111{ 111{
112 NXWR32(adapter, tx_ring->crb_cmd_producer, producer); 112 NXWR32(adapter, tx_ring->crb_cmd_producer, tx_ring->producer);
113
114 if (netxen_tx_avail(tx_ring) <= TX_STOP_THRESH) {
115 netif_stop_queue(adapter->netdev);
116 smp_mb();
117 }
113} 118}
114 119
115static uint32_t crb_cmd_consumer[4] = { 120static uint32_t crb_cmd_consumer[4] = {
@@ -119,9 +124,9 @@ static uint32_t crb_cmd_consumer[4] = {
119 124
120static inline void 125static inline void
121netxen_nic_update_cmd_consumer(struct netxen_adapter *adapter, 126netxen_nic_update_cmd_consumer(struct netxen_adapter *adapter,
122 struct nx_host_tx_ring *tx_ring, u32 consumer) 127 struct nx_host_tx_ring *tx_ring)
123{ 128{
124 NXWR32(adapter, tx_ring->crb_cmd_consumer, consumer); 129 NXWR32(adapter, tx_ring->crb_cmd_consumer, tx_ring->sw_consumer);
125} 130}
126 131
127static uint32_t msi_tgt_status[8] = { 132static uint32_t msi_tgt_status[8] = {
@@ -900,8 +905,11 @@ netxen_nic_attach(struct netxen_adapter *adapter)
900 tx_ring->crb_cmd_producer = crb_cmd_producer[adapter->portnum]; 905 tx_ring->crb_cmd_producer = crb_cmd_producer[adapter->portnum];
901 tx_ring->crb_cmd_consumer = crb_cmd_consumer[adapter->portnum]; 906 tx_ring->crb_cmd_consumer = crb_cmd_consumer[adapter->portnum];
902 907
903 netxen_nic_update_cmd_producer(adapter, tx_ring, 0); 908 tx_ring->producer = 0;
904 netxen_nic_update_cmd_consumer(adapter, tx_ring, 0); 909 tx_ring->sw_consumer = 0;
910
911 netxen_nic_update_cmd_producer(adapter, tx_ring);
912 netxen_nic_update_cmd_consumer(adapter, tx_ring);
905 } 913 }
906 914
907 for (ring = 0; ring < adapter->max_rds_rings; ring++) { 915 for (ring = 0; ring < adapter->max_rds_rings; ring++) {
@@ -1362,7 +1370,7 @@ netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1362 dma_addr_t temp_dma; 1370 dma_addr_t temp_dma;
1363 int i, k; 1371 int i, k;
1364 1372
1365 u32 producer, consumer; 1373 u32 producer;
1366 int frag_count, no_of_desc; 1374 int frag_count, no_of_desc;
1367 u32 num_txd = tx_ring->num_desc; 1375 u32 num_txd = tx_ring->num_desc;
1368 bool is_tso = false; 1376 bool is_tso = false;
@@ -1372,15 +1380,13 @@ netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1372 /* 4 fragments per cmd des */ 1380 /* 4 fragments per cmd des */
1373 no_of_desc = (frag_count + 3) >> 2; 1381 no_of_desc = (frag_count + 3) >> 2;
1374 1382
1375 producer = tx_ring->producer; 1383 if (unlikely(no_of_desc + 2) > netxen_tx_avail(tx_ring)) {
1376 smp_mb();
1377 consumer = tx_ring->sw_consumer;
1378 if ((no_of_desc+2) >= find_diff_among(producer, consumer, num_txd)) {
1379 netif_stop_queue(netdev); 1384 netif_stop_queue(netdev);
1380 smp_mb();
1381 return NETDEV_TX_BUSY; 1385 return NETDEV_TX_BUSY;
1382 } 1386 }
1383 1387
1388 producer = tx_ring->producer;
1389
1384 hwdesc = &tx_ring->desc_head[producer]; 1390 hwdesc = &tx_ring->desc_head[producer];
1385 netxen_clear_cmddesc((u64 *)hwdesc); 1391 netxen_clear_cmddesc((u64 *)hwdesc);
1386 pbuf = &tx_ring->cmd_buf_arr[producer]; 1392 pbuf = &tx_ring->cmd_buf_arr[producer];
@@ -1493,7 +1499,7 @@ netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1493 tx_ring->producer = producer; 1499 tx_ring->producer = producer;
1494 adapter->stats.txbytes += skb->len; 1500 adapter->stats.txbytes += skb->len;
1495 1501
1496 netxen_nic_update_cmd_producer(adapter, tx_ring, producer); 1502 netxen_nic_update_cmd_producer(adapter, tx_ring);
1497 1503
1498 adapter->stats.xmitcalled++; 1504 adapter->stats.xmitcalled++;
1499 1505
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index fa61a12c5e15..d2146d4a10f3 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -6376,7 +6376,7 @@ static void niu_set_rx_mode(struct net_device *dev)
6376 if ((dev->flags & IFF_ALLMULTI) || (dev->mc_count > 0)) 6376 if ((dev->flags & IFF_ALLMULTI) || (dev->mc_count > 0))
6377 np->flags |= NIU_FLAGS_MCAST; 6377 np->flags |= NIU_FLAGS_MCAST;
6378 6378
6379 alt_cnt = dev->uc_count; 6379 alt_cnt = dev->uc.count;
6380 if (alt_cnt > niu_num_alt_addr(np)) { 6380 if (alt_cnt > niu_num_alt_addr(np)) {
6381 alt_cnt = 0; 6381 alt_cnt = 0;
6382 np->flags |= NIU_FLAGS_PROMISC; 6382 np->flags |= NIU_FLAGS_PROMISC;
@@ -6385,7 +6385,7 @@ static void niu_set_rx_mode(struct net_device *dev)
6385 if (alt_cnt) { 6385 if (alt_cnt) {
6386 int index = 0; 6386 int index = 0;
6387 6387
6388 list_for_each_entry(ha, &dev->uc_list, list) { 6388 list_for_each_entry(ha, &dev->uc.list, list) {
6389 err = niu_set_alt_mac(np, index, ha->addr); 6389 err = niu_set_alt_mac(np, index, ha->addr);
6390 if (err) 6390 if (err)
6391 printk(KERN_WARNING PFX "%s: Error %d " 6391 printk(KERN_WARNING PFX "%s: Error %d "
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index a2ece89622d6..eba937c46376 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -244,7 +244,7 @@ EXPORT_SYMBOL(get_phy_device);
244 244
245/** 245/**
246 * phy_device_register - Register the phy device on the MDIO bus 246 * phy_device_register - Register the phy device on the MDIO bus
247 * @phy_device: phy_device structure to be added to the MDIO bus 247 * @phydev: phy_device structure to be added to the MDIO bus
248 */ 248 */
249int phy_device_register(struct phy_device *phydev) 249int phy_device_register(struct phy_device *phydev)
250{ 250{
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 35196faa084e..4e22462684c9 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -3811,22 +3811,11 @@ static struct net_device_stats *rtl8169_get_stats(struct net_device *dev)
3811 3811
3812static void rtl8169_net_suspend(struct net_device *dev) 3812static void rtl8169_net_suspend(struct net_device *dev)
3813{ 3813{
3814 struct rtl8169_private *tp = netdev_priv(dev);
3815 void __iomem *ioaddr = tp->mmio_addr;
3816
3817 if (!netif_running(dev)) 3814 if (!netif_running(dev))
3818 return; 3815 return;
3819 3816
3820 netif_device_detach(dev); 3817 netif_device_detach(dev);
3821 netif_stop_queue(dev); 3818 netif_stop_queue(dev);
3822
3823 spin_lock_irq(&tp->lock);
3824
3825 rtl8169_asic_down(ioaddr);
3826
3827 rtl8169_rx_missed(dev, ioaddr);
3828
3829 spin_unlock_irq(&tp->lock);
3830} 3819}
3831 3820
3832#ifdef CONFIG_PM 3821#ifdef CONFIG_PM
@@ -3876,9 +3865,17 @@ static struct dev_pm_ops rtl8169_pm_ops = {
3876static void rtl_shutdown(struct pci_dev *pdev) 3865static void rtl_shutdown(struct pci_dev *pdev)
3877{ 3866{
3878 struct net_device *dev = pci_get_drvdata(pdev); 3867 struct net_device *dev = pci_get_drvdata(pdev);
3868 struct rtl8169_private *tp = netdev_priv(dev);
3869 void __iomem *ioaddr = tp->mmio_addr;
3879 3870
3880 rtl8169_net_suspend(dev); 3871 rtl8169_net_suspend(dev);
3881 3872
3873 spin_lock_irq(&tp->lock);
3874
3875 rtl8169_asic_down(ioaddr);
3876
3877 spin_unlock_irq(&tp->lock);
3878
3882 if (system_state == SYSTEM_POWER_OFF) { 3879 if (system_state == SYSTEM_POWER_OFF) {
3883 pci_wake_from_d3(pdev, true); 3880 pci_wake_from_d3(pdev, true);
3884 pci_set_power_state(pdev, PCI_D3hot); 3881 pci_set_power_state(pdev, PCI_D3hot);
diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c
index e2247669a495..1f040e8a000b 100644
--- a/drivers/net/sis190.c
+++ b/drivers/net/sis190.c
@@ -1281,7 +1281,7 @@ static u16 sis190_default_phy(struct net_device *dev)
1281 else if (phy_lan) 1281 else if (phy_lan)
1282 phy_default = phy_lan; 1282 phy_default = phy_lan;
1283 else 1283 else
1284 phy_default = list_entry(&tp->first_phy, 1284 phy_default = list_first_entry(&tp->first_phy,
1285 struct sis190_phy, list); 1285 struct sis190_phy, list);
1286 } 1286 }
1287 1287
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 6b5946fe8ae2..7681d28c53d7 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -50,7 +50,7 @@
50#include "sky2.h" 50#include "sky2.h"
51 51
52#define DRV_NAME "sky2" 52#define DRV_NAME "sky2"
53#define DRV_VERSION "1.22" 53#define DRV_VERSION "1.23"
54#define PFX DRV_NAME " " 54#define PFX DRV_NAME " "
55 55
56/* 56/*
@@ -65,9 +65,9 @@
65#define RX_DEF_PENDING RX_MAX_PENDING 65#define RX_DEF_PENDING RX_MAX_PENDING
66 66
67#define TX_RING_SIZE 512 67#define TX_RING_SIZE 512
68#define TX_DEF_PENDING (TX_RING_SIZE - 1) 68#define TX_DEF_PENDING 128
69#define TX_MIN_PENDING 64
70#define MAX_SKB_TX_LE (4 + (sizeof(dma_addr_t)/sizeof(u32))*MAX_SKB_FRAGS) 69#define MAX_SKB_TX_LE (4 + (sizeof(dma_addr_t)/sizeof(u32))*MAX_SKB_FRAGS)
70#define TX_MIN_PENDING (MAX_SKB_TX_LE+1)
71 71
72#define STATUS_RING_SIZE 2048 /* 2 ports * (TX + 2*RX) */ 72#define STATUS_RING_SIZE 2048 /* 2 ports * (TX + 2*RX) */
73#define STATUS_LE_BYTES (STATUS_RING_SIZE*sizeof(struct sky2_status_le)) 73#define STATUS_LE_BYTES (STATUS_RING_SIZE*sizeof(struct sky2_status_le))
@@ -1151,7 +1151,14 @@ stopped:
1151 1151
1152 /* reset the Rx prefetch unit */ 1152 /* reset the Rx prefetch unit */
1153 sky2_write32(hw, Y2_QADDR(rxq, PREF_UNIT_CTRL), PREF_UNIT_RST_SET); 1153 sky2_write32(hw, Y2_QADDR(rxq, PREF_UNIT_CTRL), PREF_UNIT_RST_SET);
1154 mmiowb(); 1154
1155 /* Reset the RAM Buffer receive queue */
1156 sky2_write8(hw, RB_ADDR(rxq, RB_CTRL), RB_RST_SET);
1157
1158 /* Reset Rx MAC FIFO */
1159 sky2_write8(hw, SK_REG(sky2->port, RX_GMF_CTRL_T), GMF_RST_SET);
1160
1161 sky2_read8(hw, B0_CTST);
1155} 1162}
1156 1163
1157/* Clean out receive buffer area, assumes receiver hardware stopped */ 1164/* Clean out receive buffer area, assumes receiver hardware stopped */
@@ -1169,6 +1176,7 @@ static void sky2_rx_clean(struct sky2_port *sky2)
1169 re->skb = NULL; 1176 re->skb = NULL;
1170 } 1177 }
1171 } 1178 }
1179 skb_queue_purge(&sky2->rx_recycle);
1172} 1180}
1173 1181
1174/* Basic MII support */ 1182/* Basic MII support */
@@ -1245,6 +1253,12 @@ static void sky2_vlan_rx_register(struct net_device *dev, struct vlan_group *grp
1245} 1253}
1246#endif 1254#endif
1247 1255
1256/* Amount of required worst case padding in rx buffer */
1257static inline unsigned sky2_rx_pad(const struct sky2_hw *hw)
1258{
1259 return (hw->flags & SKY2_HW_RAM_BUFFER) ? 8 : 2;
1260}
1261
1248/* 1262/*
1249 * Allocate an skb for receiving. If the MTU is large enough 1263 * Allocate an skb for receiving. If the MTU is large enough
1250 * make the skb non-linear with a fragment list of pages. 1264 * make the skb non-linear with a fragment list of pages.
@@ -1254,6 +1268,13 @@ static struct sk_buff *sky2_rx_alloc(struct sky2_port *sky2)
1254 struct sk_buff *skb; 1268 struct sk_buff *skb;
1255 int i; 1269 int i;
1256 1270
1271 skb = __skb_dequeue(&sky2->rx_recycle);
1272 if (!skb)
1273 skb = netdev_alloc_skb(sky2->netdev, sky2->rx_data_size
1274 + sky2_rx_pad(sky2->hw));
1275 if (!skb)
1276 goto nomem;
1277
1257 if (sky2->hw->flags & SKY2_HW_RAM_BUFFER) { 1278 if (sky2->hw->flags & SKY2_HW_RAM_BUFFER) {
1258 unsigned char *start; 1279 unsigned char *start;
1259 /* 1280 /*
@@ -1262,18 +1283,10 @@ static struct sk_buff *sky2_rx_alloc(struct sky2_port *sky2)
1262 * The buffer returned from netdev_alloc_skb is 1283 * The buffer returned from netdev_alloc_skb is
1263 * aligned except if slab debugging is enabled. 1284 * aligned except if slab debugging is enabled.
1264 */ 1285 */
1265 skb = netdev_alloc_skb(sky2->netdev, sky2->rx_data_size + 8);
1266 if (!skb)
1267 goto nomem;
1268 start = PTR_ALIGN(skb->data, 8); 1286 start = PTR_ALIGN(skb->data, 8);
1269 skb_reserve(skb, start - skb->data); 1287 skb_reserve(skb, start - skb->data);
1270 } else { 1288 } else
1271 skb = netdev_alloc_skb(sky2->netdev,
1272 sky2->rx_data_size + NET_IP_ALIGN);
1273 if (!skb)
1274 goto nomem;
1275 skb_reserve(skb, NET_IP_ALIGN); 1289 skb_reserve(skb, NET_IP_ALIGN);
1276 }
1277 1290
1278 for (i = 0; i < sky2->rx_nfrags; i++) { 1291 for (i = 0; i < sky2->rx_nfrags; i++) {
1279 struct page *page = alloc_page(GFP_ATOMIC); 1292 struct page *page = alloc_page(GFP_ATOMIC);
@@ -1350,6 +1363,8 @@ static int sky2_rx_start(struct sky2_port *sky2)
1350 1363
1351 sky2->rx_data_size = size; 1364 sky2->rx_data_size = size;
1352 1365
1366 skb_queue_head_init(&sky2->rx_recycle);
1367
1353 /* Fill Rx ring */ 1368 /* Fill Rx ring */
1354 for (i = 0; i < sky2->rx_pending; i++) { 1369 for (i = 0; i < sky2->rx_pending; i++) {
1355 re = sky2->rx_ring + i; 1370 re = sky2->rx_ring + i;
@@ -1488,6 +1503,7 @@ static int sky2_up(struct net_device *dev)
1488 imask = sky2_read32(hw, B0_IMSK); 1503 imask = sky2_read32(hw, B0_IMSK);
1489 imask |= portirq_msk[port]; 1504 imask |= portirq_msk[port];
1490 sky2_write32(hw, B0_IMSK, imask); 1505 sky2_write32(hw, B0_IMSK, imask);
1506 sky2_read32(hw, B0_IMSK);
1491 1507
1492 sky2_set_multicast(dev); 1508 sky2_set_multicast(dev);
1493 1509
@@ -1756,14 +1772,22 @@ static void sky2_tx_complete(struct sky2_port *sky2, u16 done)
1756 } 1772 }
1757 1773
1758 if (le->ctrl & EOP) { 1774 if (le->ctrl & EOP) {
1775 struct sk_buff *skb = re->skb;
1776
1759 if (unlikely(netif_msg_tx_done(sky2))) 1777 if (unlikely(netif_msg_tx_done(sky2)))
1760 printk(KERN_DEBUG "%s: tx done %u\n", 1778 printk(KERN_DEBUG "%s: tx done %u\n",
1761 dev->name, idx); 1779 dev->name, idx);
1762 1780
1763 dev->stats.tx_packets++; 1781 dev->stats.tx_packets++;
1764 dev->stats.tx_bytes += re->skb->len; 1782 dev->stats.tx_bytes += skb->len;
1783
1784 if (skb_queue_len(&sky2->rx_recycle) < sky2->rx_pending
1785 && skb_recycle_check(skb, sky2->rx_data_size
1786 + sky2_rx_pad(sky2->hw)))
1787 __skb_queue_head(&sky2->rx_recycle, skb);
1788 else
1789 dev_kfree_skb_any(skb);
1765 1790
1766 dev_kfree_skb_any(re->skb);
1767 sky2->tx_next = RING_NEXT(idx, TX_RING_SIZE); 1791 sky2->tx_next = RING_NEXT(idx, TX_RING_SIZE);
1768 } 1792 }
1769 } 1793 }
@@ -1805,10 +1829,10 @@ static int sky2_down(struct net_device *dev)
1805 imask = sky2_read32(hw, B0_IMSK); 1829 imask = sky2_read32(hw, B0_IMSK);
1806 imask &= ~portirq_msk[port]; 1830 imask &= ~portirq_msk[port];
1807 sky2_write32(hw, B0_IMSK, imask); 1831 sky2_write32(hw, B0_IMSK, imask);
1832 sky2_read32(hw, B0_IMSK);
1808 1833
1809 synchronize_irq(hw->pdev->irq); 1834 /* Force flow control off */
1810 1835 sky2_write8(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_OFF);
1811 sky2_gmac_reset(hw, port);
1812 1836
1813 /* Stop transmitter */ 1837 /* Stop transmitter */
1814 sky2_write32(hw, Q_ADDR(txqaddr[port], Q_CSR), BMU_STOP); 1838 sky2_write32(hw, Q_ADDR(txqaddr[port], Q_CSR), BMU_STOP);
@@ -1821,9 +1845,6 @@ static int sky2_down(struct net_device *dev)
1821 ctrl &= ~(GM_GPCR_TX_ENA | GM_GPCR_RX_ENA); 1845 ctrl &= ~(GM_GPCR_TX_ENA | GM_GPCR_RX_ENA);
1822 gma_write16(hw, port, GM_GP_CTRL, ctrl); 1846 gma_write16(hw, port, GM_GP_CTRL, ctrl);
1823 1847
1824 /* Make sure no packets are pending */
1825 napi_synchronize(&hw->napi);
1826
1827 sky2_write8(hw, SK_REG(port, GPHY_CTRL), GPC_RST_SET); 1848 sky2_write8(hw, SK_REG(port, GPHY_CTRL), GPC_RST_SET);
1828 1849
1829 /* Workaround shared GMAC reset */ 1850 /* Workaround shared GMAC reset */
@@ -1854,6 +1875,15 @@ static int sky2_down(struct net_device *dev)
1854 sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET); 1875 sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET);
1855 sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_SET); 1876 sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_SET);
1856 1877
1878 /* Force any delayed status interrrupt and NAPI */
1879 sky2_write32(hw, STAT_LEV_TIMER_CNT, 0);
1880 sky2_write32(hw, STAT_TX_TIMER_CNT, 0);
1881 sky2_write32(hw, STAT_ISR_TIMER_CNT, 0);
1882 sky2_read8(hw, STAT_ISR_TIMER_CTRL);
1883
1884 synchronize_irq(hw->pdev->irq);
1885 napi_synchronize(&hw->napi);
1886
1857 sky2_phy_power_down(hw, port); 1887 sky2_phy_power_down(hw, port);
1858 1888
1859 /* turn off LED's */ 1889 /* turn off LED's */
@@ -2343,11 +2373,45 @@ static inline void sky2_tx_done(struct net_device *dev, u16 last)
2343 } 2373 }
2344} 2374}
2345 2375
2376static inline void sky2_skb_rx(const struct sky2_port *sky2,
2377 u32 status, struct sk_buff *skb)
2378{
2379#ifdef SKY2_VLAN_TAG_USED
2380 u16 vlan_tag = be16_to_cpu(sky2->rx_tag);
2381 if (sky2->vlgrp && (status & GMR_FS_VLAN)) {
2382 if (skb->ip_summed == CHECKSUM_NONE)
2383 vlan_hwaccel_receive_skb(skb, sky2->vlgrp, vlan_tag);
2384 else
2385 vlan_gro_receive(&sky2->hw->napi, sky2->vlgrp,
2386 vlan_tag, skb);
2387 return;
2388 }
2389#endif
2390 if (skb->ip_summed == CHECKSUM_NONE)
2391 netif_receive_skb(skb);
2392 else
2393 napi_gro_receive(&sky2->hw->napi, skb);
2394}
2395
2396static inline void sky2_rx_done(struct sky2_hw *hw, unsigned port,
2397 unsigned packets, unsigned bytes)
2398{
2399 if (packets) {
2400 struct net_device *dev = hw->dev[port];
2401
2402 dev->stats.rx_packets += packets;
2403 dev->stats.rx_bytes += bytes;
2404 dev->last_rx = jiffies;
2405 sky2_rx_update(netdev_priv(dev), rxqaddr[port]);
2406 }
2407}
2408
2346/* Process status response ring */ 2409/* Process status response ring */
2347static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx) 2410static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx)
2348{ 2411{
2349 int work_done = 0; 2412 int work_done = 0;
2350 unsigned rx[2] = { 0, 0 }; 2413 unsigned int total_bytes[2] = { 0 };
2414 unsigned int total_packets[2] = { 0 };
2351 2415
2352 rmb(); 2416 rmb();
2353 do { 2417 do {
@@ -2374,7 +2438,8 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx)
2374 le->opcode = 0; 2438 le->opcode = 0;
2375 switch (opcode & ~HW_OWNER) { 2439 switch (opcode & ~HW_OWNER) {
2376 case OP_RXSTAT: 2440 case OP_RXSTAT:
2377 ++rx[port]; 2441 total_packets[port]++;
2442 total_bytes[port] += length;
2378 skb = sky2_receive(dev, length, status); 2443 skb = sky2_receive(dev, length, status);
2379 if (unlikely(!skb)) { 2444 if (unlikely(!skb)) {
2380 dev->stats.rx_dropped++; 2445 dev->stats.rx_dropped++;
@@ -2392,18 +2457,8 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx)
2392 } 2457 }
2393 2458
2394 skb->protocol = eth_type_trans(skb, dev); 2459 skb->protocol = eth_type_trans(skb, dev);
2395 dev->stats.rx_packets++;
2396 dev->stats.rx_bytes += skb->len;
2397 dev->last_rx = jiffies;
2398 2460
2399#ifdef SKY2_VLAN_TAG_USED 2461 sky2_skb_rx(sky2, status, skb);
2400 if (sky2->vlgrp && (status & GMR_FS_VLAN)) {
2401 vlan_hwaccel_receive_skb(skb,
2402 sky2->vlgrp,
2403 be16_to_cpu(sky2->rx_tag));
2404 } else
2405#endif
2406 netif_receive_skb(skb);
2407 2462
2408 /* Stop after net poll weight */ 2463 /* Stop after net poll weight */
2409 if (++work_done >= to_do) 2464 if (++work_done >= to_do)
@@ -2473,11 +2528,8 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx)
2473 sky2_write32(hw, STAT_CTRL, SC_STAT_CLR_IRQ); 2528 sky2_write32(hw, STAT_CTRL, SC_STAT_CLR_IRQ);
2474 2529
2475exit_loop: 2530exit_loop:
2476 if (rx[0]) 2531 sky2_rx_done(hw, 0, total_packets[0], total_bytes[0]);
2477 sky2_rx_update(netdev_priv(hw->dev[0]), Q_R1); 2532 sky2_rx_done(hw, 1, total_packets[1], total_bytes[1]);
2478
2479 if (rx[1])
2480 sky2_rx_update(netdev_priv(hw->dev[1]), Q_R2);
2481 2533
2482 return work_done; 2534 return work_done;
2483} 2535}
@@ -4364,6 +4416,22 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
4364 goto err_out; 4416 goto err_out;
4365 } 4417 }
4366 4418
4419 /* Get configuration information
4420 * Note: only regular PCI config access once to test for HW issues
4421 * other PCI access through shared memory for speed and to
4422 * avoid MMCONFIG problems.
4423 */
4424 err = pci_read_config_dword(pdev, PCI_DEV_REG2, &reg);
4425 if (err) {
4426 dev_err(&pdev->dev, "PCI read config failed\n");
4427 goto err_out;
4428 }
4429
4430 if (~reg == 0) {
4431 dev_err(&pdev->dev, "PCI configuration read error\n");
4432 goto err_out;
4433 }
4434
4367 err = pci_request_regions(pdev, DRV_NAME); 4435 err = pci_request_regions(pdev, DRV_NAME);
4368 if (err) { 4436 if (err) {
4369 dev_err(&pdev->dev, "cannot obtain PCI resources\n"); 4437 dev_err(&pdev->dev, "cannot obtain PCI resources\n");
@@ -4389,21 +4457,6 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
4389 } 4457 }
4390 } 4458 }
4391 4459
4392 /* Get configuration information
4393 * Note: only regular PCI config access once to test for HW issues
4394 * other PCI access through shared memory for speed and to
4395 * avoid MMCONFIG problems.
4396 */
4397 err = pci_read_config_dword(pdev, PCI_DEV_REG2, &reg);
4398 if (err) {
4399 dev_err(&pdev->dev, "PCI read config failed\n");
4400 goto err_out_free_regions;
4401 }
4402
4403 /* size of available VPD, only impact sysfs */
4404 err = pci_vpd_truncate(pdev, 1ul << (((reg & PCI_VPD_ROM_SZ) >> 14) + 8));
4405 if (err)
4406 dev_warn(&pdev->dev, "Can't set VPD size\n");
4407 4460
4408#ifdef __BIG_ENDIAN 4461#ifdef __BIG_ENDIAN
4409 /* The sk98lin vendor driver uses hardware byte swapping but 4462 /* The sk98lin vendor driver uses hardware byte swapping but
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h
index 92fb24b27d45..b5549c9e5107 100644
--- a/drivers/net/sky2.h
+++ b/drivers/net/sky2.h
@@ -2028,6 +2028,7 @@ struct sky2_port {
2028 u16 rx_pending; 2028 u16 rx_pending;
2029 u16 rx_data_size; 2029 u16 rx_data_size;
2030 u16 rx_nfrags; 2030 u16 rx_nfrags;
2031 struct sk_buff_head rx_recycle;
2031 2032
2032#ifdef SKY2_VLAN_TAG_USED 2033#ifdef SKY2_VLAN_TAG_USED
2033 u16 rx_tag; 2034 u16 rx_tag;
diff --git a/drivers/net/sonic.c b/drivers/net/sonic.c
index e4255d829380..753a1fba4609 100644
--- a/drivers/net/sonic.c
+++ b/drivers/net/sonic.c
@@ -223,7 +223,7 @@ static int sonic_send_packet(struct sk_buff *skb, struct net_device *dev)
223 if (!laddr) { 223 if (!laddr) {
224 printk(KERN_ERR "%s: failed to map tx DMA buffer.\n", dev->name); 224 printk(KERN_ERR "%s: failed to map tx DMA buffer.\n", dev->name);
225 dev_kfree_skb(skb); 225 dev_kfree_skb(skb);
226 return NETDEV_TX_BUSY 226 return NETDEV_TX_BUSY;
227 } 227 }
228 228
229 sonic_tda_put(dev, entry, SONIC_TD_STATUS, 0); /* clear status */ 229 sonic_tda_put(dev, entry, SONIC_TD_STATUS, 0); /* clear status */
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index e2f2e91cfdd2..40c6eba775ce 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -65,8 +65,6 @@
65 65
66static DEFINE_SPINLOCK(ugeth_lock); 66static DEFINE_SPINLOCK(ugeth_lock);
67 67
68static void uec_configure_serdes(struct net_device *dev);
69
70static struct { 68static struct {
71 u32 msg_enable; 69 u32 msg_enable;
72} debug = { -1 }; 70} debug = { -1 };
@@ -1536,6 +1534,49 @@ static void adjust_link(struct net_device *dev)
1536 spin_unlock_irqrestore(&ugeth->lock, flags); 1534 spin_unlock_irqrestore(&ugeth->lock, flags);
1537} 1535}
1538 1536
1537/* Initialize TBI PHY interface for communicating with the
1538 * SERDES lynx PHY on the chip. We communicate with this PHY
1539 * through the MDIO bus on each controller, treating it as a
1540 * "normal" PHY at the address found in the UTBIPA register. We assume
1541 * that the UTBIPA register is valid. Either the MDIO bus code will set
1542 * it to a value that doesn't conflict with other PHYs on the bus, or the
1543 * value doesn't matter, as there are no other PHYs on the bus.
1544 */
1545static void uec_configure_serdes(struct net_device *dev)
1546{
1547 struct ucc_geth_private *ugeth = netdev_priv(dev);
1548 struct ucc_geth_info *ug_info = ugeth->ug_info;
1549 struct phy_device *tbiphy;
1550
1551 if (!ug_info->tbi_node) {
1552 dev_warn(&dev->dev, "SGMII mode requires that the device "
1553 "tree specify a tbi-handle\n");
1554 return;
1555 }
1556
1557 tbiphy = of_phy_find_device(ug_info->tbi_node);
1558 if (!tbiphy) {
1559 dev_err(&dev->dev, "error: Could not get TBI device\n");
1560 return;
1561 }
1562
1563 /*
1564 * If the link is already up, we must already be ok, and don't need to
1565 * configure and reset the TBI<->SerDes link. Maybe U-Boot configured
1566 * everything for us? Resetting it takes the link down and requires
1567 * several seconds for it to come back.
1568 */
1569 if (phy_read(tbiphy, ENET_TBI_MII_SR) & TBISR_LSTATUS)
1570 return;
1571
1572 /* Single clk mode, mii mode off(for serdes communication) */
1573 phy_write(tbiphy, ENET_TBI_MII_ANA, TBIANA_SETTINGS);
1574
1575 phy_write(tbiphy, ENET_TBI_MII_TBICON, TBICON_CLK_SELECT);
1576
1577 phy_write(tbiphy, ENET_TBI_MII_CR, TBICR_SETTINGS);
1578}
1579
1539/* Configure the PHY for dev. 1580/* Configure the PHY for dev.
1540 * returns 0 if success. -1 if failure 1581 * returns 0 if success. -1 if failure
1541 */ 1582 */
@@ -1577,41 +1618,7 @@ static int init_phy(struct net_device *dev)
1577 return 0; 1618 return 0;
1578} 1619}
1579 1620
1580/* Initialize TBI PHY interface for communicating with the
1581 * SERDES lynx PHY on the chip. We communicate with this PHY
1582 * through the MDIO bus on each controller, treating it as a
1583 * "normal" PHY at the address found in the UTBIPA register. We assume
1584 * that the UTBIPA register is valid. Either the MDIO bus code will set
1585 * it to a value that doesn't conflict with other PHYs on the bus, or the
1586 * value doesn't matter, as there are no other PHYs on the bus.
1587 */
1588static void uec_configure_serdes(struct net_device *dev)
1589{
1590 struct ucc_geth_private *ugeth = netdev_priv(dev);
1591
1592 if (!ugeth->tbiphy) {
1593 printk(KERN_WARNING "SGMII mode requires that the device "
1594 "tree specify a tbi-handle\n");
1595 return;
1596 }
1597 1621
1598 /*
1599 * If the link is already up, we must already be ok, and don't need to
1600 * configure and reset the TBI<->SerDes link. Maybe U-Boot configured
1601 * everything for us? Resetting it takes the link down and requires
1602 * several seconds for it to come back.
1603 */
1604 if (phy_read(ugeth->tbiphy, ENET_TBI_MII_SR) & TBISR_LSTATUS)
1605 return;
1606
1607 /* Single clk mode, mii mode off(for serdes communication) */
1608 phy_write(ugeth->tbiphy, ENET_TBI_MII_ANA, TBIANA_SETTINGS);
1609
1610 phy_write(ugeth->tbiphy, ENET_TBI_MII_TBICON, TBICON_CLK_SELECT);
1611
1612 phy_write(ugeth->tbiphy, ENET_TBI_MII_CR, TBICR_SETTINGS);
1613
1614}
1615 1622
1616static int ugeth_graceful_stop_tx(struct ucc_geth_private *ugeth) 1623static int ugeth_graceful_stop_tx(struct ucc_geth_private *ugeth)
1617{ 1624{
@@ -3711,6 +3718,9 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3711 } 3718 }
3712 ug_info->phy_node = phy; 3719 ug_info->phy_node = phy;
3713 3720
3721 /* Find the TBI PHY node. If it's not there, we don't support SGMII */
3722 ug_info->tbi_node = of_parse_phandle(np, "tbi-handle", 0);
3723
3714 /* get the phy interface type, or default to MII */ 3724 /* get the phy interface type, or default to MII */
3715 prop = of_get_property(np, "phy-connection-type", NULL); 3725 prop = of_get_property(np, "phy-connection-type", NULL);
3716 if (!prop) { 3726 if (!prop) {
@@ -3818,37 +3828,6 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3818 ugeth->ndev = dev; 3828 ugeth->ndev = dev;
3819 ugeth->node = np; 3829 ugeth->node = np;
3820 3830
3821 /* Find the TBI PHY. If it's not there, we don't support SGMII */
3822 ph = of_get_property(np, "tbi-handle", NULL);
3823 if (ph) {
3824 struct device_node *tbi = of_find_node_by_phandle(*ph);
3825 struct of_device *ofdev;
3826 struct mii_bus *bus;
3827 const unsigned int *id;
3828
3829 if (!tbi)
3830 return 0;
3831
3832 mdio = of_get_parent(tbi);
3833 if (!mdio)
3834 return 0;
3835
3836 ofdev = of_find_device_by_node(mdio);
3837
3838 of_node_put(mdio);
3839
3840 id = of_get_property(tbi, "reg", NULL);
3841 if (!id)
3842 return 0;
3843 of_node_put(tbi);
3844
3845 bus = dev_get_drvdata(&ofdev->dev);
3846 if (!bus)
3847 return 0;
3848
3849 ugeth->tbiphy = bus->phy_map[*id];
3850 }
3851
3852 return 0; 3831 return 0;
3853} 3832}
3854 3833
diff --git a/drivers/net/ucc_geth.h b/drivers/net/ucc_geth.h
index 5beba4c14532..195ab267ead7 100644
--- a/drivers/net/ucc_geth.h
+++ b/drivers/net/ucc_geth.h
@@ -1125,6 +1125,7 @@ struct ucc_geth_info {
1125 u16 pausePeriod; 1125 u16 pausePeriod;
1126 u16 extensionField; 1126 u16 extensionField;
1127 struct device_node *phy_node; 1127 struct device_node *phy_node;
1128 struct device_node *tbi_node;
1128 u8 weightfactor[NUM_TX_QUEUES]; 1129 u8 weightfactor[NUM_TX_QUEUES];
1129 u8 interruptcoalescingmaxvalue[NUM_RX_QUEUES]; 1130 u8 interruptcoalescingmaxvalue[NUM_RX_QUEUES];
1130 u8 l2qt[UCC_GETH_VLAN_PRIORITY_MAX]; 1131 u8 l2qt[UCC_GETH_VLAN_PRIORITY_MAX];
@@ -1213,7 +1214,6 @@ struct ucc_geth_private {
1213 1214
1214 struct ugeth_mii_info *mii_info; 1215 struct ugeth_mii_info *mii_info;
1215 struct phy_device *phydev; 1216 struct phy_device *phydev;
1216 struct phy_device *tbiphy;
1217 phy_interface_t phy_interface; 1217 phy_interface_t phy_interface;
1218 int max_speed; 1218 int max_speed;
1219 uint32_t msg_enable; 1219 uint32_t msg_enable;
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index e2a7725e567e..b02f7adff5dc 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -989,8 +989,10 @@ static int __devinit velocity_found1(struct pci_dev *pdev, const struct pci_devi
989 if (ret < 0) 989 if (ret < 0)
990 goto err_iounmap; 990 goto err_iounmap;
991 991
992 if (velocity_get_link(dev)) 992 if (!velocity_get_link(dev)) {
993 netif_carrier_off(dev); 993 netif_carrier_off(dev);
994 vptr->mii_status |= VELOCITY_LINK_FAIL;
995 }
994 996
995 velocity_print_info(vptr); 997 velocity_print_info(vptr);
996 pci_set_drvdata(pdev, dev); 998 pci_set_drvdata(pdev, dev);
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 52198f6797a4..2a6e81d5b579 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -709,7 +709,7 @@ static void virtnet_set_rx_mode(struct net_device *dev)
709 allmulti ? "en" : "dis"); 709 allmulti ? "en" : "dis");
710 710
711 /* MAC filter - use one buffer for both lists */ 711 /* MAC filter - use one buffer for both lists */
712 mac_data = buf = kzalloc(((dev->uc_count + dev->mc_count) * ETH_ALEN) + 712 mac_data = buf = kzalloc(((dev->uc.count + dev->mc_count) * ETH_ALEN) +
713 (2 * sizeof(mac_data->entries)), GFP_ATOMIC); 713 (2 * sizeof(mac_data->entries)), GFP_ATOMIC);
714 if (!buf) { 714 if (!buf) {
715 dev_warn(&dev->dev, "No memory for MAC address buffer\n"); 715 dev_warn(&dev->dev, "No memory for MAC address buffer\n");
@@ -719,16 +719,16 @@ static void virtnet_set_rx_mode(struct net_device *dev)
719 sg_init_table(sg, 2); 719 sg_init_table(sg, 2);
720 720
721 /* Store the unicast list and count in the front of the buffer */ 721 /* Store the unicast list and count in the front of the buffer */
722 mac_data->entries = dev->uc_count; 722 mac_data->entries = dev->uc.count;
723 i = 0; 723 i = 0;
724 list_for_each_entry(ha, &dev->uc_list, list) 724 list_for_each_entry(ha, &dev->uc.list, list)
725 memcpy(&mac_data->macs[i++][0], ha->addr, ETH_ALEN); 725 memcpy(&mac_data->macs[i++][0], ha->addr, ETH_ALEN);
726 726
727 sg_set_buf(&sg[0], mac_data, 727 sg_set_buf(&sg[0], mac_data,
728 sizeof(mac_data->entries) + (dev->uc_count * ETH_ALEN)); 728 sizeof(mac_data->entries) + (dev->uc.count * ETH_ALEN));
729 729
730 /* multicast list and count fill the end */ 730 /* multicast list and count fill the end */
731 mac_data = (void *)&mac_data->macs[dev->uc_count][0]; 731 mac_data = (void *)&mac_data->macs[dev->uc.count][0];
732 732
733 mac_data->entries = dev->mc_count; 733 mac_data->entries = dev->mc_count;
734 addr = dev->mc_list; 734 addr = dev->mc_list;
diff --git a/drivers/net/vxge/vxge-config.c b/drivers/net/vxge/vxge-config.c
index 26cde573af43..58d2551c78ed 100644
--- a/drivers/net/vxge/vxge-config.c
+++ b/drivers/net/vxge/vxge-config.c
@@ -454,7 +454,7 @@ __vxge_hw_verify_pci_e_info(struct __vxge_hw_device *hldev)
454 return VXGE_HW_OK; 454 return VXGE_HW_OK;
455} 455}
456 456
457static enum vxge_hw_status 457enum vxge_hw_status
458__vxge_hw_device_is_privilaged(struct __vxge_hw_device *hldev) 458__vxge_hw_device_is_privilaged(struct __vxge_hw_device *hldev)
459{ 459{
460 if ((hldev->host_type == VXGE_HW_NO_MR_NO_SR_NORMAL_FUNCTION || 460 if ((hldev->host_type == VXGE_HW_NO_MR_NO_SR_NORMAL_FUNCTION ||
@@ -676,10 +676,12 @@ enum vxge_hw_status __vxge_hw_device_initialize(struct __vxge_hw_device *hldev)
676{ 676{
677 enum vxge_hw_status status = VXGE_HW_OK; 677 enum vxge_hw_status status = VXGE_HW_OK;
678 678
679 /* Validate the pci-e link width and speed */ 679 if (VXGE_HW_OK == __vxge_hw_device_is_privilaged(hldev)) {
680 status = __vxge_hw_verify_pci_e_info(hldev); 680 /* Validate the pci-e link width and speed */
681 if (status != VXGE_HW_OK) 681 status = __vxge_hw_verify_pci_e_info(hldev);
682 goto exit; 682 if (status != VXGE_HW_OK)
683 goto exit;
684 }
683 685
684 vxge_hw_wrr_rebalance(hldev); 686 vxge_hw_wrr_rebalance(hldev);
685exit: 687exit:
diff --git a/drivers/net/vxge/vxge-main.c b/drivers/net/vxge/vxge-main.c
index 6c838b3e063a..6034497536a4 100644
--- a/drivers/net/vxge/vxge-main.c
+++ b/drivers/net/vxge/vxge-main.c
@@ -4203,6 +4203,16 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
4203 max_vpath_supported++; 4203 max_vpath_supported++;
4204 } 4204 }
4205 4205
4206 /* Enable SRIOV mode, if firmware has SRIOV support and if it is a PF */
4207 if ((VXGE_HW_FUNCTION_MODE_SRIOV ==
4208 ll_config.device_hw_info.function_mode) &&
4209 (max_config_dev > 1) && (pdev->is_physfn)) {
4210 ret = pci_enable_sriov(pdev, max_config_dev - 1);
4211 if (ret)
4212 vxge_debug_ll_config(VXGE_ERR,
4213 "Failed to enable SRIOV: %d \n", ret);
4214 }
4215
4206 /* 4216 /*
4207 * Configure vpaths and get driver configured number of vpaths 4217 * Configure vpaths and get driver configured number of vpaths
4208 * which is less than or equal to the maximum vpaths per function. 4218 * which is less than or equal to the maximum vpaths per function.
@@ -4366,6 +4376,7 @@ _exit6:
4366 4376
4367 vxge_device_unregister(hldev); 4377 vxge_device_unregister(hldev);
4368_exit5: 4378_exit5:
4379 pci_disable_sriov(pdev);
4369 vxge_hw_device_terminate(hldev); 4380 vxge_hw_device_terminate(hldev);
4370_exit4: 4381_exit4:
4371 iounmap(attr.bar1); 4382 iounmap(attr.bar1);
@@ -4429,6 +4440,8 @@ vxge_remove(struct pci_dev *pdev)
4429 iounmap(vdev->bar0); 4440 iounmap(vdev->bar0);
4430 iounmap(vdev->bar1); 4441 iounmap(vdev->bar1);
4431 4442
4443 pci_disable_sriov(pdev);
4444
4432 /* we are safe to free it now */ 4445 /* we are safe to free it now */
4433 free_netdev(dev); 4446 free_netdev(dev);
4434 4447
diff --git a/drivers/net/vxge/vxge-version.h b/drivers/net/vxge/vxge-version.h
index 7da02c545ed5..82786ffb7dd9 100644
--- a/drivers/net/vxge/vxge-version.h
+++ b/drivers/net/vxge/vxge-version.h
@@ -17,7 +17,7 @@
17 17
18#define VXGE_VERSION_MAJOR "2" 18#define VXGE_VERSION_MAJOR "2"
19#define VXGE_VERSION_MINOR "0" 19#define VXGE_VERSION_MINOR "0"
20#define VXGE_VERSION_FIX "1" 20#define VXGE_VERSION_FIX "4"
21#define VXGE_VERSION_BUILD "17129" 21#define VXGE_VERSION_BUILD "17795"
22#define VXGE_VERSION_FOR "k" 22#define VXGE_VERSION_FOR "k"
23#endif 23#endif
diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c
index 2dd78d20eb05..aff4f6bdf3d5 100644
--- a/drivers/net/wan/lapbether.c
+++ b/drivers/net/wan/lapbether.c
@@ -149,46 +149,40 @@ static int lapbeth_data_indication(struct net_device *dev, struct sk_buff *skb)
149 */ 149 */
150static int lapbeth_xmit(struct sk_buff *skb, struct net_device *dev) 150static int lapbeth_xmit(struct sk_buff *skb, struct net_device *dev)
151{ 151{
152 int err = -ENODEV; 152 int err;
153 153
154 /* 154 /*
155 * Just to be *really* sure not to send anything if the interface 155 * Just to be *really* sure not to send anything if the interface
156 * is down, the ethernet device may have gone. 156 * is down, the ethernet device may have gone.
157 */ 157 */
158 if (!netif_running(dev)) { 158 if (!netif_running(dev))
159 goto drop; 159 goto drop;
160 }
161 160
162 switch (skb->data[0]) { 161 switch (skb->data[0]) {
163 case 0x00: 162 case 0x00:
164 err = 0;
165 break; 163 break;
166 case 0x01: 164 case 0x01:
167 if ((err = lapb_connect_request(dev)) != LAPB_OK) 165 if ((err = lapb_connect_request(dev)) != LAPB_OK)
168 printk(KERN_ERR "lapbeth: lapb_connect_request " 166 printk(KERN_ERR "lapbeth: lapb_connect_request "
169 "error: %d\n", err); 167 "error: %d\n", err);
170 goto drop_ok; 168 goto drop;
171 case 0x02: 169 case 0x02:
172 if ((err = lapb_disconnect_request(dev)) != LAPB_OK) 170 if ((err = lapb_disconnect_request(dev)) != LAPB_OK)
173 printk(KERN_ERR "lapbeth: lapb_disconnect_request " 171 printk(KERN_ERR "lapbeth: lapb_disconnect_request "
174 "err: %d\n", err); 172 "err: %d\n", err);
175 /* Fall thru */ 173 /* Fall thru */
176 default: 174 default:
177 goto drop_ok; 175 goto drop;
178 } 176 }
179 177
180 skb_pull(skb, 1); 178 skb_pull(skb, 1);
181 179
182 if ((err = lapb_data_request(dev, skb)) != LAPB_OK) { 180 if ((err = lapb_data_request(dev, skb)) != LAPB_OK) {
183 printk(KERN_ERR "lapbeth: lapb_data_request error - %d\n", err); 181 printk(KERN_ERR "lapbeth: lapb_data_request error - %d\n", err);
184 err = -ENOMEM;
185 goto drop; 182 goto drop;
186 } 183 }
187 err = 0;
188out: 184out:
189 return err; 185 return NETDEV_TX_OK;
190drop_ok:
191 err = 0;
192drop: 186drop:
193 kfree_skb(skb); 187 kfree_skb(skb);
194 goto out; 188 goto out;
diff --git a/drivers/net/wireless/ath/ath5k/pcu.c b/drivers/net/wireless/ath/ath5k/pcu.c
index ec35503f6a40..2942f13c9c4a 100644
--- a/drivers/net/wireless/ath/ath5k/pcu.c
+++ b/drivers/net/wireless/ath/ath5k/pcu.c
@@ -733,8 +733,9 @@ void ath5k_hw_init_beacon(struct ath5k_hw *ah, u32 next_beacon, u32 interval)
733 /* 733 /*
734 * Set the beacon register and enable all timers. 734 * Set the beacon register and enable all timers.
735 */ 735 */
736 /* When in AP mode zero timer0 to start TSF */ 736 /* When in AP or Mesh Point mode zero timer0 to start TSF */
737 if (ah->ah_op_mode == NL80211_IFTYPE_AP) 737 if (ah->ah_op_mode == NL80211_IFTYPE_AP ||
738 ah->ah_op_mode == NL80211_IFTYPE_MESH_POINT)
738 ath5k_hw_reg_write(ah, 0, AR5K_TIMER0); 739 ath5k_hw_reg_write(ah, 0, AR5K_TIMER0);
739 740
740 ath5k_hw_reg_write(ah, next_beacon, AR5K_TIMER0); 741 ath5k_hw_reg_write(ah, next_beacon, AR5K_TIMER0);
diff --git a/drivers/net/wireless/ath/ath9k/Kconfig b/drivers/net/wireless/ath/ath9k/Kconfig
index 0ed1ac312aa6..2d79610bce12 100644
--- a/drivers/net/wireless/ath/ath9k/Kconfig
+++ b/drivers/net/wireless/ath/ath9k/Kconfig
@@ -1,7 +1,6 @@
1config ATH9K 1config ATH9K
2 tristate "Atheros 802.11n wireless cards support" 2 tristate "Atheros 802.11n wireless cards support"
3 depends on PCI && MAC80211 && WLAN_80211 3 depends on PCI && MAC80211 && WLAN_80211
4 depends on RFKILL || RFKILL=n
5 select ATH_COMMON 4 select ATH_COMMON
6 select MAC80211_LEDS 5 select MAC80211_LEDS
7 select LEDS_CLASS 6 select LEDS_CLASS
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 515880aa2116..5efc9345ca0d 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -21,7 +21,6 @@
21#include <linux/device.h> 21#include <linux/device.h>
22#include <net/mac80211.h> 22#include <net/mac80211.h>
23#include <linux/leds.h> 23#include <linux/leds.h>
24#include <linux/rfkill.h>
25 24
26#include "hw.h" 25#include "hw.h"
27#include "rc.h" 26#include "rc.h"
@@ -460,12 +459,6 @@ struct ath_led {
460 bool registered; 459 bool registered;
461}; 460};
462 461
463struct ath_rfkill {
464 struct rfkill *rfkill;
465 struct rfkill_ops ops;
466 char rfkill_name[32];
467};
468
469/********************/ 462/********************/
470/* Main driver core */ 463/* Main driver core */
471/********************/ 464/********************/
@@ -505,7 +498,6 @@ struct ath_rfkill {
505#define SC_OP_PROTECT_ENABLE BIT(6) 498#define SC_OP_PROTECT_ENABLE BIT(6)
506#define SC_OP_RXFLUSH BIT(7) 499#define SC_OP_RXFLUSH BIT(7)
507#define SC_OP_LED_ASSOCIATED BIT(8) 500#define SC_OP_LED_ASSOCIATED BIT(8)
508#define SC_OP_RFKILL_REGISTERED BIT(9)
509#define SC_OP_WAIT_FOR_BEACON BIT(12) 501#define SC_OP_WAIT_FOR_BEACON BIT(12)
510#define SC_OP_LED_ON BIT(13) 502#define SC_OP_LED_ON BIT(13)
511#define SC_OP_SCANNING BIT(14) 503#define SC_OP_SCANNING BIT(14)
@@ -591,7 +583,6 @@ struct ath_softc {
591 583
592 int beacon_interval; 584 int beacon_interval;
593 585
594 struct ath_rfkill rf_kill;
595 struct ath_ani ani; 586 struct ath_ani ani;
596 struct ath9k_node_stats nodestats; 587 struct ath9k_node_stats nodestats;
597#ifdef CONFIG_ATH9K_DEBUG 588#ifdef CONFIG_ATH9K_DEBUG
@@ -677,6 +668,7 @@ static inline void ath9k_ps_restore(struct ath_softc *sc)
677 if (atomic_dec_and_test(&sc->ps_usecount)) 668 if (atomic_dec_and_test(&sc->ps_usecount))
678 if ((sc->hw->conf.flags & IEEE80211_CONF_PS) && 669 if ((sc->hw->conf.flags & IEEE80211_CONF_PS) &&
679 !(sc->sc_flags & (SC_OP_WAIT_FOR_BEACON | 670 !(sc->sc_flags & (SC_OP_WAIT_FOR_BEACON |
671 SC_OP_WAIT_FOR_CAB |
680 SC_OP_WAIT_FOR_PSPOLL_DATA | 672 SC_OP_WAIT_FOR_PSPOLL_DATA |
681 SC_OP_WAIT_FOR_TX_ACK))) 673 SC_OP_WAIT_FOR_TX_ACK)))
682 ath9k_hw_setpower(sc->sc_ah, 674 ath9k_hw_setpower(sc->sc_ah,
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 1579c9407ed5..34935a8ee59d 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -2186,6 +2186,18 @@ static void ath9k_hw_spur_mitigate(struct ath_hw *ah, struct ath9k_channel *chan
2186 REG_WRITE(ah, AR_PHY_MASK2_P_61_45, tmp_mask); 2186 REG_WRITE(ah, AR_PHY_MASK2_P_61_45, tmp_mask);
2187} 2187}
2188 2188
2189static void ath9k_enable_rfkill(struct ath_hw *ah)
2190{
2191 REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL,
2192 AR_GPIO_INPUT_EN_VAL_RFSILENT_BB);
2193
2194 REG_CLR_BIT(ah, AR_GPIO_INPUT_MUX2,
2195 AR_GPIO_INPUT_MUX2_RFSILENT);
2196
2197 ath9k_hw_cfg_gpio_input(ah, ah->rfkill_gpio);
2198 REG_SET_BIT(ah, AR_PHY_TEST, RFSILENT_BB);
2199}
2200
2189int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, 2201int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
2190 bool bChannelChange) 2202 bool bChannelChange)
2191{ 2203{
@@ -2313,10 +2325,9 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
2313 ath9k_hw_init_interrupt_masks(ah, ah->opmode); 2325 ath9k_hw_init_interrupt_masks(ah, ah->opmode);
2314 ath9k_hw_init_qos(ah); 2326 ath9k_hw_init_qos(ah);
2315 2327
2316#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
2317 if (ah->caps.hw_caps & ATH9K_HW_CAP_RFSILENT) 2328 if (ah->caps.hw_caps & ATH9K_HW_CAP_RFSILENT)
2318 ath9k_enable_rfkill(ah); 2329 ath9k_enable_rfkill(ah);
2319#endif 2330
2320 ath9k_hw_init_user_settings(ah); 2331 ath9k_hw_init_user_settings(ah);
2321 2332
2322 REG_WRITE(ah, AR_STA_ID1, 2333 REG_WRITE(ah, AR_STA_ID1,
@@ -3613,20 +3624,6 @@ void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val)
3613 AR_GPIO_BIT(gpio)); 3624 AR_GPIO_BIT(gpio));
3614} 3625}
3615 3626
3616#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
3617void ath9k_enable_rfkill(struct ath_hw *ah)
3618{
3619 REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL,
3620 AR_GPIO_INPUT_EN_VAL_RFSILENT_BB);
3621
3622 REG_CLR_BIT(ah, AR_GPIO_INPUT_MUX2,
3623 AR_GPIO_INPUT_MUX2_RFSILENT);
3624
3625 ath9k_hw_cfg_gpio_input(ah, ah->rfkill_gpio);
3626 REG_SET_BIT(ah, AR_PHY_TEST, RFSILENT_BB);
3627}
3628#endif
3629
3630u32 ath9k_hw_getdefantenna(struct ath_hw *ah) 3627u32 ath9k_hw_getdefantenna(struct ath_hw *ah)
3631{ 3628{
3632 return REG_READ(ah, AR_DEF_ANTENNA) & 0x7; 3629 return REG_READ(ah, AR_DEF_ANTENNA) & 0x7;
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index dd8508ef6e05..9d0b31ad4603 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -565,9 +565,6 @@ u32 ath9k_hw_gpio_get(struct ath_hw *ah, u32 gpio);
565void ath9k_hw_cfg_output(struct ath_hw *ah, u32 gpio, 565void ath9k_hw_cfg_output(struct ath_hw *ah, u32 gpio,
566 u32 ah_signal_type); 566 u32 ah_signal_type);
567void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val); 567void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val);
568#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
569void ath9k_enable_rfkill(struct ath_hw *ah);
570#endif
571u32 ath9k_hw_getdefantenna(struct ath_hw *ah); 568u32 ath9k_hw_getdefantenna(struct ath_hw *ah);
572void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna); 569void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna);
573bool ath9k_hw_setantennaswitch(struct ath_hw *ah, 570bool ath9k_hw_setantennaswitch(struct ath_hw *ah,
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index f7baa406918b..9f49a3251d4d 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -231,6 +231,19 @@ static void ath_setup_rates(struct ath_softc *sc, enum ieee80211_band band)
231 } 231 }
232} 232}
233 233
234static struct ath9k_channel *ath_get_curchannel(struct ath_softc *sc,
235 struct ieee80211_hw *hw)
236{
237 struct ieee80211_channel *curchan = hw->conf.channel;
238 struct ath9k_channel *channel;
239 u8 chan_idx;
240
241 chan_idx = curchan->hw_value;
242 channel = &sc->sc_ah->channels[chan_idx];
243 ath9k_update_ichannel(sc, hw, channel);
244 return channel;
245}
246
234/* 247/*
235 * Set/change channels. If the channel is really being changed, it's done 248 * Set/change channels. If the channel is really being changed, it's done
236 * by reseting the chip. To accomplish this we must first cleanup any pending 249 * by reseting the chip. To accomplish this we must first cleanup any pending
@@ -283,7 +296,7 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw,
283 "reset status %d\n", 296 "reset status %d\n",
284 channel->center_freq, r); 297 channel->center_freq, r);
285 spin_unlock_bh(&sc->sc_resetlock); 298 spin_unlock_bh(&sc->sc_resetlock);
286 return r; 299 goto ps_restore;
287 } 300 }
288 spin_unlock_bh(&sc->sc_resetlock); 301 spin_unlock_bh(&sc->sc_resetlock);
289 302
@@ -292,14 +305,17 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw,
292 if (ath_startrecv(sc) != 0) { 305 if (ath_startrecv(sc) != 0) {
293 DPRINTF(sc, ATH_DBG_FATAL, 306 DPRINTF(sc, ATH_DBG_FATAL,
294 "Unable to restart recv logic\n"); 307 "Unable to restart recv logic\n");
295 return -EIO; 308 r = -EIO;
309 goto ps_restore;
296 } 310 }
297 311
298 ath_cache_conf_rate(sc, &hw->conf); 312 ath_cache_conf_rate(sc, &hw->conf);
299 ath_update_txpow(sc); 313 ath_update_txpow(sc);
300 ath9k_hw_set_interrupts(ah, sc->imask); 314 ath9k_hw_set_interrupts(ah, sc->imask);
315
316 ps_restore:
301 ath9k_ps_restore(sc); 317 ath9k_ps_restore(sc);
302 return 0; 318 return r;
303} 319}
304 320
305/* 321/*
@@ -1110,6 +1126,9 @@ void ath_radio_enable(struct ath_softc *sc)
1110 ath9k_ps_wakeup(sc); 1126 ath9k_ps_wakeup(sc);
1111 ath9k_hw_configpcipowersave(ah, 0); 1127 ath9k_hw_configpcipowersave(ah, 0);
1112 1128
1129 if (!ah->curchan)
1130 ah->curchan = ath_get_curchannel(sc, sc->hw);
1131
1113 spin_lock_bh(&sc->sc_resetlock); 1132 spin_lock_bh(&sc->sc_resetlock);
1114 r = ath9k_hw_reset(ah, ah->curchan, false); 1133 r = ath9k_hw_reset(ah, ah->curchan, false);
1115 if (r) { 1134 if (r) {
@@ -1162,6 +1181,9 @@ void ath_radio_disable(struct ath_softc *sc)
1162 ath_stoprecv(sc); /* turn off frame recv */ 1181 ath_stoprecv(sc); /* turn off frame recv */
1163 ath_flushrecv(sc); /* flush recv queue */ 1182 ath_flushrecv(sc); /* flush recv queue */
1164 1183
1184 if (!ah->curchan)
1185 ah->curchan = ath_get_curchannel(sc, sc->hw);
1186
1165 spin_lock_bh(&sc->sc_resetlock); 1187 spin_lock_bh(&sc->sc_resetlock);
1166 r = ath9k_hw_reset(ah, ah->curchan, false); 1188 r = ath9k_hw_reset(ah, ah->curchan, false);
1167 if (r) { 1189 if (r) {
@@ -1178,8 +1200,6 @@ void ath_radio_disable(struct ath_softc *sc)
1178 ath9k_ps_restore(sc); 1200 ath9k_ps_restore(sc);
1179} 1201}
1180 1202
1181#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
1182
1183/*******************/ 1203/*******************/
1184/* Rfkill */ 1204/* Rfkill */
1185/*******************/ 1205/*******************/
@@ -1192,81 +1212,27 @@ static bool ath_is_rfkill_set(struct ath_softc *sc)
1192 ah->rfkill_polarity; 1212 ah->rfkill_polarity;
1193} 1213}
1194 1214
1195/* s/w rfkill handlers */ 1215static void ath9k_rfkill_poll_state(struct ieee80211_hw *hw)
1196static int ath_rfkill_set_block(void *data, bool blocked)
1197{ 1216{
1198 struct ath_softc *sc = data; 1217 struct ath_wiphy *aphy = hw->priv;
1199 1218 struct ath_softc *sc = aphy->sc;
1200 if (blocked)
1201 ath_radio_disable(sc);
1202 else
1203 ath_radio_enable(sc);
1204
1205 return 0;
1206}
1207
1208static void ath_rfkill_poll_state(struct rfkill *rfkill, void *data)
1209{
1210 struct ath_softc *sc = data;
1211 bool blocked = !!ath_is_rfkill_set(sc); 1219 bool blocked = !!ath_is_rfkill_set(sc);
1212 1220
1213 if (rfkill_set_hw_state(rfkill, blocked)) 1221 wiphy_rfkill_set_hw_state(hw->wiphy, blocked);
1222
1223 if (blocked)
1214 ath_radio_disable(sc); 1224 ath_radio_disable(sc);
1215 else 1225 else
1216 ath_radio_enable(sc); 1226 ath_radio_enable(sc);
1217} 1227}
1218 1228
1219/* Init s/w rfkill */ 1229static void ath_start_rfkill_poll(struct ath_softc *sc)
1220static int ath_init_sw_rfkill(struct ath_softc *sc)
1221{
1222 sc->rf_kill.ops.set_block = ath_rfkill_set_block;
1223 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_RFSILENT)
1224 sc->rf_kill.ops.poll = ath_rfkill_poll_state;
1225
1226 snprintf(sc->rf_kill.rfkill_name, sizeof(sc->rf_kill.rfkill_name),
1227 "ath9k-%s::rfkill", wiphy_name(sc->hw->wiphy));
1228
1229 sc->rf_kill.rfkill = rfkill_alloc(sc->rf_kill.rfkill_name,
1230 wiphy_dev(sc->hw->wiphy),
1231 RFKILL_TYPE_WLAN,
1232 &sc->rf_kill.ops, sc);
1233 if (!sc->rf_kill.rfkill) {
1234 DPRINTF(sc, ATH_DBG_FATAL, "Failed to allocate rfkill\n");
1235 return -ENOMEM;
1236 }
1237
1238 return 0;
1239}
1240
1241/* Deinitialize rfkill */
1242static void ath_deinit_rfkill(struct ath_softc *sc)
1243{
1244 if (sc->sc_flags & SC_OP_RFKILL_REGISTERED) {
1245 rfkill_unregister(sc->rf_kill.rfkill);
1246 rfkill_destroy(sc->rf_kill.rfkill);
1247 sc->sc_flags &= ~SC_OP_RFKILL_REGISTERED;
1248 }
1249}
1250
1251static int ath_start_rfkill_poll(struct ath_softc *sc)
1252{ 1230{
1253 if (!(sc->sc_flags & SC_OP_RFKILL_REGISTERED)) { 1231 struct ath_hw *ah = sc->sc_ah;
1254 if (rfkill_register(sc->rf_kill.rfkill)) {
1255 DPRINTF(sc, ATH_DBG_FATAL,
1256 "Unable to register rfkill\n");
1257 rfkill_destroy(sc->rf_kill.rfkill);
1258
1259 /* Deinitialize the device */
1260 ath_cleanup(sc);
1261 return -EIO;
1262 } else {
1263 sc->sc_flags |= SC_OP_RFKILL_REGISTERED;
1264 }
1265 }
1266 1232
1267 return 0; 1233 if (ah->caps.hw_caps & ATH9K_HW_CAP_RFSILENT)
1234 wiphy_rfkill_start_polling(sc->hw->wiphy);
1268} 1235}
1269#endif /* CONFIG_RFKILL */
1270 1236
1271void ath_cleanup(struct ath_softc *sc) 1237void ath_cleanup(struct ath_softc *sc)
1272{ 1238{
@@ -1286,9 +1252,6 @@ void ath_detach(struct ath_softc *sc)
1286 1252
1287 DPRINTF(sc, ATH_DBG_CONFIG, "Detach ATH hw\n"); 1253 DPRINTF(sc, ATH_DBG_CONFIG, "Detach ATH hw\n");
1288 1254
1289#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
1290 ath_deinit_rfkill(sc);
1291#endif
1292 ath_deinit_leds(sc); 1255 ath_deinit_leds(sc);
1293 cancel_work_sync(&sc->chan_work); 1256 cancel_work_sync(&sc->chan_work);
1294 cancel_delayed_work_sync(&sc->wiphy_work); 1257 cancel_delayed_work_sync(&sc->wiphy_work);
@@ -1626,13 +1589,6 @@ int ath_attach(u16 devid, struct ath_softc *sc)
1626 if (error != 0) 1589 if (error != 0)
1627 goto error_attach; 1590 goto error_attach;
1628 1591
1629#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
1630 /* Initialize s/w rfkill */
1631 error = ath_init_sw_rfkill(sc);
1632 if (error)
1633 goto error_attach;
1634#endif
1635
1636 INIT_WORK(&sc->chan_work, ath9k_wiphy_chan_work); 1592 INIT_WORK(&sc->chan_work, ath9k_wiphy_chan_work);
1637 INIT_DELAYED_WORK(&sc->wiphy_work, ath9k_wiphy_work); 1593 INIT_DELAYED_WORK(&sc->wiphy_work, ath9k_wiphy_work);
1638 sc->wiphy_scheduler_int = msecs_to_jiffies(500); 1594 sc->wiphy_scheduler_int = msecs_to_jiffies(500);
@@ -1648,6 +1604,7 @@ int ath_attach(u16 devid, struct ath_softc *sc)
1648 /* Initialize LED control */ 1604 /* Initialize LED control */
1649 ath_init_leds(sc); 1605 ath_init_leds(sc);
1650 1606
1607 ath_start_rfkill_poll(sc);
1651 1608
1652 return 0; 1609 return 0;
1653 1610
@@ -1920,7 +1877,7 @@ static int ath9k_start(struct ieee80211_hw *hw)
1920 struct ath_softc *sc = aphy->sc; 1877 struct ath_softc *sc = aphy->sc;
1921 struct ieee80211_channel *curchan = hw->conf.channel; 1878 struct ieee80211_channel *curchan = hw->conf.channel;
1922 struct ath9k_channel *init_channel; 1879 struct ath9k_channel *init_channel;
1923 int r, pos; 1880 int r;
1924 1881
1925 DPRINTF(sc, ATH_DBG_CONFIG, "Starting driver with " 1882 DPRINTF(sc, ATH_DBG_CONFIG, "Starting driver with "
1926 "initial channel: %d MHz\n", curchan->center_freq); 1883 "initial channel: %d MHz\n", curchan->center_freq);
@@ -1950,11 +1907,9 @@ static int ath9k_start(struct ieee80211_hw *hw)
1950 1907
1951 /* setup initial channel */ 1908 /* setup initial channel */
1952 1909
1953 pos = curchan->hw_value; 1910 sc->chan_idx = curchan->hw_value;
1954 1911
1955 sc->chan_idx = pos; 1912 init_channel = ath_get_curchannel(sc, hw);
1956 init_channel = &sc->sc_ah->channels[pos];
1957 ath9k_update_ichannel(sc, hw, init_channel);
1958 1913
1959 /* Reset SERDES registers */ 1914 /* Reset SERDES registers */
1960 ath9k_hw_configpcipowersave(sc->sc_ah, 0); 1915 ath9k_hw_configpcipowersave(sc->sc_ah, 0);
@@ -2018,10 +1973,6 @@ static int ath9k_start(struct ieee80211_hw *hw)
2018 1973
2019 ieee80211_wake_queues(hw); 1974 ieee80211_wake_queues(hw);
2020 1975
2021#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
2022 r = ath_start_rfkill_poll(sc);
2023#endif
2024
2025mutex_unlock: 1976mutex_unlock:
2026 mutex_unlock(&sc->mutex); 1977 mutex_unlock(&sc->mutex);
2027 1978
@@ -2159,7 +2110,7 @@ static void ath9k_stop(struct ieee80211_hw *hw)
2159 } else 2110 } else
2160 sc->rx.rxlink = NULL; 2111 sc->rx.rxlink = NULL;
2161 2112
2162 rfkill_pause_polling(sc->rf_kill.rfkill); 2113 wiphy_rfkill_stop_polling(sc->hw->wiphy);
2163 2114
2164 /* disable HAL and put h/w to sleep */ 2115 /* disable HAL and put h/w to sleep */
2165 ath9k_hw_disable(sc->sc_ah); 2116 ath9k_hw_disable(sc->sc_ah);
@@ -2765,6 +2716,7 @@ struct ieee80211_ops ath9k_ops = {
2765 .ampdu_action = ath9k_ampdu_action, 2716 .ampdu_action = ath9k_ampdu_action,
2766 .sw_scan_start = ath9k_sw_scan_start, 2717 .sw_scan_start = ath9k_sw_scan_start,
2767 .sw_scan_complete = ath9k_sw_scan_complete, 2718 .sw_scan_complete = ath9k_sw_scan_complete,
2719 .rfkill_poll = ath9k_rfkill_poll_state,
2768}; 2720};
2769 2721
2770static struct { 2722static struct {
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index 5014a19b0f75..f99f3a76df3f 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -817,6 +817,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
817 } 817 }
818 818
819 if (unlikely(sc->sc_flags & (SC_OP_WAIT_FOR_BEACON | 819 if (unlikely(sc->sc_flags & (SC_OP_WAIT_FOR_BEACON |
820 SC_OP_WAIT_FOR_CAB |
820 SC_OP_WAIT_FOR_PSPOLL_DATA))) 821 SC_OP_WAIT_FOR_PSPOLL_DATA)))
821 ath_rx_ps(sc, skb); 822 ath_rx_ps(sc, skb);
822 823
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index a5637c4aa85d..6d1519e1f011 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -2152,7 +2152,6 @@ static int iwl_mac_start(struct ieee80211_hw *hw)
2152 /* we should be verifying the device is ready to be opened */ 2152 /* we should be verifying the device is ready to be opened */
2153 mutex_lock(&priv->mutex); 2153 mutex_lock(&priv->mutex);
2154 2154
2155 memset(&priv->staging_rxon, 0, sizeof(struct iwl_rxon_cmd));
2156 /* fetch ucode file from disk, alloc and copy to bus-master buffers ... 2155 /* fetch ucode file from disk, alloc and copy to bus-master buffers ...
2157 * ucode filename and max sizes are card-specific. */ 2156 * ucode filename and max sizes are card-specific. */
2158 2157
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index f9d16ca5b3d9..6ab07165ea28 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -629,13 +629,9 @@ u8 iwl_is_fat_tx_allowed(struct iwl_priv *priv,
629 if (!sta_ht_inf->ht_supported) 629 if (!sta_ht_inf->ht_supported)
630 return 0; 630 return 0;
631 } 631 }
632 632 return iwl_is_channel_extension(priv, priv->band,
633 if (iwl_ht_conf->ht_protection & IEEE80211_HT_OP_MODE_PROTECTION_20MHZ) 633 le16_to_cpu(priv->staging_rxon.channel),
634 return 1; 634 iwl_ht_conf->extension_chan_offset);
635 else
636 return iwl_is_channel_extension(priv, priv->band,
637 le16_to_cpu(priv->staging_rxon.channel),
638 iwl_ht_conf->extension_chan_offset);
639} 635}
640EXPORT_SYMBOL(iwl_is_fat_tx_allowed); 636EXPORT_SYMBOL(iwl_is_fat_tx_allowed);
641 637
@@ -826,9 +822,18 @@ void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info)
826 RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK); 822 RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK);
827 if (iwl_is_fat_tx_allowed(priv, NULL)) { 823 if (iwl_is_fat_tx_allowed(priv, NULL)) {
828 /* pure 40 fat */ 824 /* pure 40 fat */
829 if (rxon->flags & RXON_FLG_FAT_PROT_MSK) 825 if (ht_info->ht_protection == IEEE80211_HT_OP_MODE_PROTECTION_20MHZ) {
830 rxon->flags |= RXON_FLG_CHANNEL_MODE_PURE_40; 826 rxon->flags |= RXON_FLG_CHANNEL_MODE_PURE_40;
831 else { 827 /* Note: control channel is opposite of extension channel */
828 switch (ht_info->extension_chan_offset) {
829 case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
830 rxon->flags &= ~RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK;
831 break;
832 case IEEE80211_HT_PARAM_CHA_SEC_BELOW:
833 rxon->flags |= RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK;
834 break;
835 }
836 } else {
832 /* Note: control channel is opposite of extension channel */ 837 /* Note: control channel is opposite of extension channel */
833 switch (ht_info->extension_chan_offset) { 838 switch (ht_info->extension_chan_offset) {
834 case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: 839 case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
@@ -2390,39 +2395,46 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw,
2390 priv->ibss_beacon = ieee80211_beacon_get(hw, vif); 2395 priv->ibss_beacon = ieee80211_beacon_get(hw, vif);
2391 } 2396 }
2392 2397
2393 if ((changes & BSS_CHANGED_BSSID) && !iwl_is_rfkill(priv)) { 2398 if (changes & BSS_CHANGED_BEACON_INT) {
2394 /* If there is currently a HW scan going on in the background 2399 priv->beacon_int = bss_conf->beacon_int;
2395 * then we need to cancel it else the RXON below will fail. */ 2400 /* TODO: in AP mode, do something to make this take effect */
2401 }
2402
2403 if (changes & BSS_CHANGED_BSSID) {
2404 IWL_DEBUG_MAC80211(priv, "BSSID %pM\n", bss_conf->bssid);
2405
2406 /*
2407 * If there is currently a HW scan going on in the
2408 * background then we need to cancel it else the RXON
2409 * below/in post_associate will fail.
2410 */
2396 if (iwl_scan_cancel_timeout(priv, 100)) { 2411 if (iwl_scan_cancel_timeout(priv, 100)) {
2397 IWL_WARN(priv, "Aborted scan still in progress " 2412 IWL_WARN(priv, "Aborted scan still in progress after 100ms\n");
2398 "after 100ms\n");
2399 IWL_DEBUG_MAC80211(priv, "leaving - scan abort failed.\n"); 2413 IWL_DEBUG_MAC80211(priv, "leaving - scan abort failed.\n");
2400 mutex_unlock(&priv->mutex); 2414 mutex_unlock(&priv->mutex);
2401 return; 2415 return;
2402 } 2416 }
2403 memcpy(priv->staging_rxon.bssid_addr, 2417
2404 bss_conf->bssid, ETH_ALEN); 2418 /* mac80211 only sets assoc when in STATION mode */
2405 2419 if (priv->iw_mode == NL80211_IFTYPE_ADHOC ||
2406 /* TODO: Audit driver for usage of these members and see 2420 bss_conf->assoc) {
2407 * if mac80211 deprecates them (priv->bssid looks like it 2421 memcpy(priv->staging_rxon.bssid_addr,
2408 * shouldn't be there, but I haven't scanned the IBSS code 2422 bss_conf->bssid, ETH_ALEN);
2409 * to verify) - jpk */ 2423
2410 memcpy(priv->bssid, bss_conf->bssid, ETH_ALEN); 2424 /* currently needed in a few places */
2411 2425 memcpy(priv->bssid, bss_conf->bssid, ETH_ALEN);
2412 if (priv->iw_mode == NL80211_IFTYPE_AP) 2426 } else {
2413 iwlcore_config_ap(priv); 2427 priv->staging_rxon.filter_flags &=
2414 else { 2428 ~RXON_FILTER_ASSOC_MSK;
2415 int rc = iwlcore_commit_rxon(priv);
2416 if ((priv->iw_mode == NL80211_IFTYPE_STATION) && rc)
2417 iwl_rxon_add_station(
2418 priv, priv->active_rxon.bssid_addr, 1);
2419 } 2429 }
2420 } else if (!iwl_is_rfkill(priv)) { 2430
2421 iwl_scan_cancel_timeout(priv, 100);
2422 priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
2423 iwlcore_commit_rxon(priv);
2424 } 2431 }
2425 2432
2433 /*
2434 * This needs to be after setting the BSSID in case
2435 * mac80211 decides to do both changes at once because
2436 * it will invoke post_associate.
2437 */
2426 if (priv->iw_mode == NL80211_IFTYPE_ADHOC && 2438 if (priv->iw_mode == NL80211_IFTYPE_ADHOC &&
2427 changes & BSS_CHANGED_BEACON) { 2439 changes & BSS_CHANGED_BEACON) {
2428 struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); 2440 struct sk_buff *beacon = ieee80211_beacon_get(hw, vif);
@@ -2431,8 +2443,6 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw,
2431 iwl_mac_beacon_update(hw, beacon); 2443 iwl_mac_beacon_update(hw, beacon);
2432 } 2444 }
2433 2445
2434 mutex_unlock(&priv->mutex);
2435
2436 if (changes & BSS_CHANGED_ERP_PREAMBLE) { 2446 if (changes & BSS_CHANGED_ERP_PREAMBLE) {
2437 IWL_DEBUG_MAC80211(priv, "ERP_PREAMBLE %d\n", 2447 IWL_DEBUG_MAC80211(priv, "ERP_PREAMBLE %d\n",
2438 bss_conf->use_short_preamble); 2448 bss_conf->use_short_preamble);
@@ -2450,6 +2460,23 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw,
2450 priv->staging_rxon.flags &= ~RXON_FLG_TGG_PROTECT_MSK; 2460 priv->staging_rxon.flags &= ~RXON_FLG_TGG_PROTECT_MSK;
2451 } 2461 }
2452 2462
2463 if (changes & BSS_CHANGED_BASIC_RATES) {
2464 /* XXX use this information
2465 *
2466 * To do that, remove code from iwl_set_rate() and put something
2467 * like this here:
2468 *
2469 if (A-band)
2470 priv->staging_rxon.ofdm_basic_rates =
2471 bss_conf->basic_rates;
2472 else
2473 priv->staging_rxon.ofdm_basic_rates =
2474 bss_conf->basic_rates >> 4;
2475 priv->staging_rxon.cck_basic_rates =
2476 bss_conf->basic_rates & 0xF;
2477 */
2478 }
2479
2453 if (changes & BSS_CHANGED_HT) { 2480 if (changes & BSS_CHANGED_HT) {
2454 iwl_ht_conf(priv, bss_conf); 2481 iwl_ht_conf(priv, bss_conf);
2455 2482
@@ -2459,10 +2486,6 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw,
2459 2486
2460 if (changes & BSS_CHANGED_ASSOC) { 2487 if (changes & BSS_CHANGED_ASSOC) {
2461 IWL_DEBUG_MAC80211(priv, "ASSOC %d\n", bss_conf->assoc); 2488 IWL_DEBUG_MAC80211(priv, "ASSOC %d\n", bss_conf->assoc);
2462 /* This should never happen as this function should
2463 * never be called from interrupt context. */
2464 if (WARN_ON_ONCE(in_interrupt()))
2465 return;
2466 if (bss_conf->assoc) { 2489 if (bss_conf->assoc) {
2467 priv->assoc_id = bss_conf->aid; 2490 priv->assoc_id = bss_conf->aid;
2468 priv->beacon_int = bss_conf->beacon_int; 2491 priv->beacon_int = bss_conf->beacon_int;
@@ -2470,27 +2493,35 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw,
2470 priv->timestamp = bss_conf->timestamp; 2493 priv->timestamp = bss_conf->timestamp;
2471 priv->assoc_capability = bss_conf->assoc_capability; 2494 priv->assoc_capability = bss_conf->assoc_capability;
2472 2495
2473 /* we have just associated, don't start scan too early 2496 /*
2474 * leave time for EAPOL exchange to complete 2497 * We have just associated, don't start scan too early
2498 * leave time for EAPOL exchange to complete.
2499 *
2500 * XXX: do this in mac80211
2475 */ 2501 */
2476 priv->next_scan_jiffies = jiffies + 2502 priv->next_scan_jiffies = jiffies +
2477 IWL_DELAY_NEXT_SCAN_AFTER_ASSOC; 2503 IWL_DELAY_NEXT_SCAN_AFTER_ASSOC;
2478 mutex_lock(&priv->mutex); 2504 if (!iwl_is_rfkill(priv))
2479 priv->cfg->ops->lib->post_associate(priv); 2505 priv->cfg->ops->lib->post_associate(priv);
2480 mutex_unlock(&priv->mutex); 2506 } else
2481 } else {
2482 priv->assoc_id = 0; 2507 priv->assoc_id = 0;
2483 IWL_DEBUG_MAC80211(priv, "DISASSOC %d\n", bss_conf->assoc); 2508
2509 }
2510
2511 if (changes && iwl_is_associated(priv) && priv->assoc_id) {
2512 IWL_DEBUG_MAC80211(priv, "Changes (%#x) while associated\n",
2513 changes);
2514 ret = iwl_send_rxon_assoc(priv);
2515 if (!ret) {
2516 /* Sync active_rxon with latest change. */
2517 memcpy((void *)&priv->active_rxon,
2518 &priv->staging_rxon,
2519 sizeof(struct iwl_rxon_cmd));
2484 } 2520 }
2485 } else if (changes && iwl_is_associated(priv) && priv->assoc_id) {
2486 IWL_DEBUG_MAC80211(priv, "Associated Changes %d\n", changes);
2487 ret = iwl_send_rxon_assoc(priv);
2488 if (!ret)
2489 /* Sync active_rxon with latest change. */
2490 memcpy((void *)&priv->active_rxon,
2491 &priv->staging_rxon,
2492 sizeof(struct iwl_rxon_cmd));
2493 } 2521 }
2522
2523 mutex_unlock(&priv->mutex);
2524
2494 IWL_DEBUG_MAC80211(priv, "leave\n"); 2525 IWL_DEBUG_MAC80211(priv, "leave\n");
2495} 2526}
2496EXPORT_SYMBOL(iwl_bss_info_changed); 2527EXPORT_SYMBOL(iwl_bss_info_changed);
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 83d31606dd00..cb9bd4c8f25e 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -2498,8 +2498,7 @@ static void iwl3945_alive_start(struct iwl_priv *priv)
2498 struct iwl3945_rxon_cmd *active_rxon = 2498 struct iwl3945_rxon_cmd *active_rxon =
2499 (struct iwl3945_rxon_cmd *)(&priv->active_rxon); 2499 (struct iwl3945_rxon_cmd *)(&priv->active_rxon);
2500 2500
2501 memcpy(&priv->staging_rxon, &priv->active_rxon, 2501 priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK;
2502 sizeof(priv->staging_rxon));
2503 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 2502 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
2504 } else { 2503 } else {
2505 /* Initialize our rx_config data */ 2504 /* Initialize our rx_config data */
@@ -3147,7 +3146,6 @@ static int iwl3945_mac_start(struct ieee80211_hw *hw)
3147 /* we should be verifying the device is ready to be opened */ 3146 /* we should be verifying the device is ready to be opened */
3148 mutex_lock(&priv->mutex); 3147 mutex_lock(&priv->mutex);
3149 3148
3150 memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon));
3151 /* fetch ucode file from disk, alloc and copy to bus-master buffers ... 3149 /* fetch ucode file from disk, alloc and copy to bus-master buffers ...
3152 * ucode filename and max sizes are card-specific. */ 3150 * ucode filename and max sizes are card-specific. */
3153 3151
diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c
index 06a46d7b3d6c..6564282ce476 100644
--- a/drivers/net/wireless/libertas/if_spi.c
+++ b/drivers/net/wireless/libertas/if_spi.c
@@ -812,7 +812,6 @@ out:
812static void if_spi_e2h(struct if_spi_card *card) 812static void if_spi_e2h(struct if_spi_card *card)
813{ 813{
814 int err = 0; 814 int err = 0;
815 unsigned long flags;
816 u32 cause; 815 u32 cause;
817 struct lbs_private *priv = card->priv; 816 struct lbs_private *priv = card->priv;
818 817
@@ -827,10 +826,7 @@ static void if_spi_e2h(struct if_spi_card *card)
827 /* generate a card interrupt */ 826 /* generate a card interrupt */
828 spu_write_u16(card, IF_SPI_CARD_INT_CAUSE_REG, IF_SPI_CIC_HOST_EVENT); 827 spu_write_u16(card, IF_SPI_CARD_INT_CAUSE_REG, IF_SPI_CIC_HOST_EVENT);
829 828
830 spin_lock_irqsave(&priv->driver_lock, flags);
831 lbs_queue_event(priv, cause & 0xff); 829 lbs_queue_event(priv, cause & 0xff);
832 spin_unlock_irqrestore(&priv->driver_lock, flags);
833
834out: 830out:
835 if (err) 831 if (err)
836 lbs_pr_err("%s: error %d\n", __func__, err); 832 lbs_pr_err("%s: error %d\n", __func__, err);
@@ -875,7 +871,12 @@ static int lbs_spi_thread(void *data)
875 err = if_spi_c2h_data(card); 871 err = if_spi_c2h_data(card);
876 if (err) 872 if (err)
877 goto err; 873 goto err;
878 if (hiStatus & IF_SPI_HIST_CMD_DOWNLOAD_RDY) { 874
875 /* workaround: in PS mode, the card does not set the Command
876 * Download Ready bit, but it sets TX Download Ready. */
877 if (hiStatus & IF_SPI_HIST_CMD_DOWNLOAD_RDY ||
878 (card->priv->psstate != PS_STATE_FULL_POWER &&
879 (hiStatus & IF_SPI_HIST_TX_DOWNLOAD_RDY))) {
879 /* This means two things. First of all, 880 /* This means two things. First of all,
880 * if there was a previous command sent, the card has 881 * if there was a previous command sent, the card has
881 * successfully received it. 882 * successfully received it.
diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
index 2faf0e14f05a..74909c4aaeea 100644
--- a/drivers/platform/x86/dell-laptop.c
+++ b/drivers/platform/x86/dell-laptop.c
@@ -177,7 +177,7 @@ dell_send_request(struct calling_interface_buffer *buffer, int class,
177static int dell_rfkill_set(void *data, bool blocked) 177static int dell_rfkill_set(void *data, bool blocked)
178{ 178{
179 struct calling_interface_buffer buffer; 179 struct calling_interface_buffer buffer;
180 int disable = blocked ? 0 : 1; 180 int disable = blocked ? 1 : 0;
181 unsigned long radio = (unsigned long)data; 181 unsigned long radio = (unsigned long)data;
182 182
183 memset(&buffer, 0, sizeof(struct calling_interface_buffer)); 183 memset(&buffer, 0, sizeof(struct calling_interface_buffer));
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index e48d9a4506ff..dafaa4a92df5 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -1133,8 +1133,9 @@ static void sony_nc_rfkill_update()
1133 continue; 1133 continue;
1134 1134
1135 if (hwblock) { 1135 if (hwblock) {
1136 if (rfkill_set_hw_state(sony_rfkill_devices[i], true)) 1136 if (rfkill_set_hw_state(sony_rfkill_devices[i], true)) {
1137 sony_nc_rfkill_set((void *)i, true); 1137 /* we already know we're blocked */
1138 }
1138 continue; 1139 continue;
1139 } 1140 }
1140 1141
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index 81d7f268418a..691cecd03b83 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -655,7 +655,7 @@ static void qeth_l2_set_multicast_list(struct net_device *dev)
655 for (dm = dev->mc_list; dm; dm = dm->next) 655 for (dm = dev->mc_list; dm; dm = dm->next)
656 qeth_l2_add_mc(card, dm->da_addr, 0); 656 qeth_l2_add_mc(card, dm->da_addr, 0);
657 657
658 list_for_each_entry(ha, &dev->uc_list, list) 658 list_for_each_entry(ha, &dev->uc.list, list)
659 qeth_l2_add_mc(card, ha->addr, 1); 659 qeth_l2_add_mc(card, ha->addr, 1);
660 660
661 spin_unlock_bh(&card->mclock); 661 spin_unlock_bh(&card->mclock);