aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-09-10 08:05:45 -0400
committerIngo Molnar <mingo@elte.hu>2008-09-10 08:05:45 -0400
commit3ce9bcb583536c45a46c7302747029450e22279c (patch)
tree7a4167189ffc6dc909151d1a5d040f9f0656a9f4 /drivers/net
parent26fd10517e810dd59ea050b052de24a75ee6dc07 (diff)
parentf7d0b926ac8c8ec0c7a83ee69409bd2e6bb39f81 (diff)
Merge branch 'core/xen' into x86/xen
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/Kconfig6
-rw-r--r--drivers/net/atl1e/atl1e_main.c3
-rw-r--r--drivers/net/atlx/atl1.c1
-rw-r--r--drivers/net/bnx2x.h7
-rw-r--r--drivers/net/bnx2x_main.c250
-rw-r--r--drivers/net/e100.c4
-rw-r--r--drivers/net/e1000/e1000_param.c81
-rw-r--r--drivers/net/forcedeth.c12
-rw-r--r--drivers/net/fs_enet/fs_enet-main.c8
-rw-r--r--drivers/net/fs_enet/mac-scc.c8
-rw-r--r--drivers/net/gianfar.c22
-rw-r--r--drivers/net/gianfar.h1
-rw-r--r--drivers/net/ibm_newemac/core.c6
-rw-r--r--drivers/net/ibmveth.c5
-rw-r--r--drivers/net/igb/e1000_82575.c1
-rw-r--r--drivers/net/igb/e1000_hw.h1
-rw-r--r--drivers/net/igb/igb_ethtool.c17
-rw-r--r--drivers/net/igb/igb_main.c25
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c14
-rw-r--r--drivers/net/mv643xx_eth.c35
-rw-r--r--drivers/net/myri10ge/myri10ge.c2
-rw-r--r--drivers/net/netxen/netxen_nic_main.c10
-rw-r--r--drivers/net/pcmcia/axnet_cs.c1
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c2
-rw-r--r--drivers/net/r8169.c2
-rw-r--r--drivers/net/skfp/ess.c6
-rw-r--r--drivers/net/smc91x.c2
-rw-r--r--drivers/net/usb/hso.c3
-rw-r--r--drivers/net/usb/mcs7830.c47
-rw-r--r--drivers/net/usb/pegasus.c11
-rw-r--r--drivers/net/wan/sbni.c8
-rw-r--r--drivers/net/wd.c2
-rw-r--r--drivers/net/wireless/ath5k/base.c23
-rw-r--r--drivers/net/wireless/ath5k/base.h1
-rw-r--r--drivers/net/wireless/ath9k/hw.c8
-rw-r--r--drivers/net/wireless/ath9k/main.c18
-rw-r--r--drivers/net/wireless/ath9k/recv.c5
-rw-r--r--drivers/net/wireless/ath9k/xmit.c4
-rw-r--r--drivers/net/wireless/atmel.c51
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c14
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rs.c3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c35
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c77
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-fh.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-rx.c5
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-scan.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-tx.c29
-rw-r--r--drivers/net/wireless/libertas/if_cs.c13
-rw-r--r--drivers/net/wireless/orinoco.c10
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00reg.h5
52 files changed, 533 insertions, 379 deletions
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index a5c141cecd4e..4a11296a9514 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -822,14 +822,14 @@ config ULTRA32
822 will be called smc-ultra32. 822 will be called smc-ultra32.
823 823
824config BFIN_MAC 824config BFIN_MAC
825 tristate "Blackfin 527/536/537 on-chip mac support" 825 tristate "Blackfin on-chip MAC support"
826 depends on NET_ETHERNET && (BF527 || BF537 || BF536) 826 depends on NET_ETHERNET && (BF526 || BF527 || BF536 || BF537)
827 select CRC32 827 select CRC32
828 select MII 828 select MII
829 select PHYLIB 829 select PHYLIB
830 select BFIN_MAC_USE_L1 if DMA_UNCACHED_NONE 830 select BFIN_MAC_USE_L1 if DMA_UNCACHED_NONE
831 help 831 help
832 This is the driver for blackfin on-chip mac device. Say Y if you want it 832 This is the driver for Blackfin on-chip mac device. Say Y if you want it
833 compiled into the kernel. This driver is also available as a module 833 compiled into the kernel. This driver is also available as a module
834 ( = code which can be inserted in and removed from the running kernel 834 ( = code which can be inserted in and removed from the running kernel
835 whenever you want). The module will be called bfin_mac. 835 whenever you want). The module will be called bfin_mac.
diff --git a/drivers/net/atl1e/atl1e_main.c b/drivers/net/atl1e/atl1e_main.c
index 82d7be1655d3..7685b995ff9b 100644
--- a/drivers/net/atl1e/atl1e_main.c
+++ b/drivers/net/atl1e/atl1e_main.c
@@ -2232,10 +2232,11 @@ static int atl1e_resume(struct pci_dev *pdev)
2232 2232
2233 AT_WRITE_REG(&adapter->hw, REG_WOL_CTRL, 0); 2233 AT_WRITE_REG(&adapter->hw, REG_WOL_CTRL, 0);
2234 2234
2235 if (netif_running(netdev)) 2235 if (netif_running(netdev)) {
2236 err = atl1e_request_irq(adapter); 2236 err = atl1e_request_irq(adapter);
2237 if (err) 2237 if (err)
2238 return err; 2238 return err;
2239 }
2239 2240
2240 atl1e_reset_hw(&adapter->hw); 2241 atl1e_reset_hw(&adapter->hw);
2241 2242
diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index e6a7bb79d4df..e23ce77712f1 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -3022,7 +3022,6 @@ static int __devinit atl1_probe(struct pci_dev *pdev,
3022 netdev->features = NETIF_F_HW_CSUM; 3022 netdev->features = NETIF_F_HW_CSUM;
3023 netdev->features |= NETIF_F_SG; 3023 netdev->features |= NETIF_F_SG;
3024 netdev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX); 3024 netdev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX);
3025 netdev->features |= NETIF_F_TSO;
3026 netdev->features |= NETIF_F_LLTX; 3025 netdev->features |= NETIF_F_LLTX;
3027 3026
3028 /* 3027 /*
diff --git a/drivers/net/bnx2x.h b/drivers/net/bnx2x.h
index b468f904c7f8..fd705d1295a7 100644
--- a/drivers/net/bnx2x.h
+++ b/drivers/net/bnx2x.h
@@ -151,6 +151,8 @@ struct sw_rx_page {
151#define PAGES_PER_SGE_SHIFT 0 151#define PAGES_PER_SGE_SHIFT 0
152#define PAGES_PER_SGE (1 << PAGES_PER_SGE_SHIFT) 152#define PAGES_PER_SGE (1 << PAGES_PER_SGE_SHIFT)
153 153
154#define BCM_RX_ETH_PAYLOAD_ALIGN 64
155
154/* SGE ring related macros */ 156/* SGE ring related macros */
155#define NUM_RX_SGE_PAGES 2 157#define NUM_RX_SGE_PAGES 2
156#define RX_SGE_CNT (BCM_PAGE_SIZE / sizeof(struct eth_rx_sge)) 158#define RX_SGE_CNT (BCM_PAGE_SIZE / sizeof(struct eth_rx_sge))
@@ -271,7 +273,7 @@ struct bnx2x_fastpath {
271 (fp->tx_pkt_prod != fp->tx_pkt_cons)) 273 (fp->tx_pkt_prod != fp->tx_pkt_cons))
272 274
273#define BNX2X_HAS_RX_WORK(fp) \ 275#define BNX2X_HAS_RX_WORK(fp) \
274 (fp->rx_comp_cons != le16_to_cpu(*fp->rx_cons_sb)) 276 (fp->rx_comp_cons != rx_cons_sb)
275 277
276#define BNX2X_HAS_WORK(fp) (BNX2X_HAS_RX_WORK(fp) || BNX2X_HAS_TX_WORK(fp)) 278#define BNX2X_HAS_WORK(fp) (BNX2X_HAS_RX_WORK(fp) || BNX2X_HAS_TX_WORK(fp))
277 279
@@ -750,8 +752,7 @@ struct bnx2x {
750 752
751 u32 rx_csum; 753 u32 rx_csum;
752 u32 rx_offset; 754 u32 rx_offset;
753 u32 rx_buf_use_size; /* useable size */ 755 u32 rx_buf_size;
754 u32 rx_buf_size; /* with alignment */
755#define ETH_OVREHEAD (ETH_HLEN + 8) /* 8 for CRC + VLAN */ 756#define ETH_OVREHEAD (ETH_HLEN + 8) /* 8 for CRC + VLAN */
756#define ETH_MIN_PACKET_SIZE 60 757#define ETH_MIN_PACKET_SIZE 60
757#define ETH_MAX_PACKET_SIZE 1500 758#define ETH_MAX_PACKET_SIZE 1500
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c
index 971576b43687..a8eb3c4a47c8 100644
--- a/drivers/net/bnx2x_main.c
+++ b/drivers/net/bnx2x_main.c
@@ -59,8 +59,8 @@
59#include "bnx2x.h" 59#include "bnx2x.h"
60#include "bnx2x_init.h" 60#include "bnx2x_init.h"
61 61
62#define DRV_MODULE_VERSION "1.45.17" 62#define DRV_MODULE_VERSION "1.45.21"
63#define DRV_MODULE_RELDATE "2008/08/13" 63#define DRV_MODULE_RELDATE "2008/09/03"
64#define BNX2X_BC_VER 0x040200 64#define BNX2X_BC_VER 0x040200
65 65
66/* Time in jiffies before concluding the transmitter is hung */ 66/* Time in jiffies before concluding the transmitter is hung */
@@ -1027,7 +1027,7 @@ static inline int bnx2x_alloc_rx_skb(struct bnx2x *bp,
1027 if (unlikely(skb == NULL)) 1027 if (unlikely(skb == NULL))
1028 return -ENOMEM; 1028 return -ENOMEM;
1029 1029
1030 mapping = pci_map_single(bp->pdev, skb->data, bp->rx_buf_use_size, 1030 mapping = pci_map_single(bp->pdev, skb->data, bp->rx_buf_size,
1031 PCI_DMA_FROMDEVICE); 1031 PCI_DMA_FROMDEVICE);
1032 if (unlikely(dma_mapping_error(&bp->pdev->dev, mapping))) { 1032 if (unlikely(dma_mapping_error(&bp->pdev->dev, mapping))) {
1033 dev_kfree_skb(skb); 1033 dev_kfree_skb(skb);
@@ -1169,7 +1169,7 @@ static void bnx2x_tpa_start(struct bnx2x_fastpath *fp, u16 queue,
1169 /* move empty skb from pool to prod and map it */ 1169 /* move empty skb from pool to prod and map it */
1170 prod_rx_buf->skb = fp->tpa_pool[queue].skb; 1170 prod_rx_buf->skb = fp->tpa_pool[queue].skb;
1171 mapping = pci_map_single(bp->pdev, fp->tpa_pool[queue].skb->data, 1171 mapping = pci_map_single(bp->pdev, fp->tpa_pool[queue].skb->data,
1172 bp->rx_buf_use_size, PCI_DMA_FROMDEVICE); 1172 bp->rx_buf_size, PCI_DMA_FROMDEVICE);
1173 pci_unmap_addr_set(prod_rx_buf, mapping, mapping); 1173 pci_unmap_addr_set(prod_rx_buf, mapping, mapping);
1174 1174
1175 /* move partial skb from cons to pool (don't unmap yet) */ 1175 /* move partial skb from cons to pool (don't unmap yet) */
@@ -1276,7 +1276,7 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp,
1276 pool entry status to BNX2X_TPA_STOP even if new skb allocation 1276 pool entry status to BNX2X_TPA_STOP even if new skb allocation
1277 fails. */ 1277 fails. */
1278 pci_unmap_single(bp->pdev, pci_unmap_addr(rx_buf, mapping), 1278 pci_unmap_single(bp->pdev, pci_unmap_addr(rx_buf, mapping),
1279 bp->rx_buf_use_size, PCI_DMA_FROMDEVICE); 1279 bp->rx_buf_size, PCI_DMA_FROMDEVICE);
1280 1280
1281 if (likely(new_skb)) { 1281 if (likely(new_skb)) {
1282 /* fix ip xsum and give it to the stack */ 1282 /* fix ip xsum and give it to the stack */
@@ -1520,7 +1520,7 @@ static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget)
1520 } else if (bnx2x_alloc_rx_skb(bp, fp, bd_prod) == 0) { 1520 } else if (bnx2x_alloc_rx_skb(bp, fp, bd_prod) == 0) {
1521 pci_unmap_single(bp->pdev, 1521 pci_unmap_single(bp->pdev,
1522 pci_unmap_addr(rx_buf, mapping), 1522 pci_unmap_addr(rx_buf, mapping),
1523 bp->rx_buf_use_size, 1523 bp->rx_buf_size,
1524 PCI_DMA_FROMDEVICE); 1524 PCI_DMA_FROMDEVICE);
1525 skb_reserve(skb, pad); 1525 skb_reserve(skb, pad);
1526 skb_put(skb, len); 1526 skb_put(skb, len);
@@ -1717,8 +1717,8 @@ static int bnx2x_acquire_hw_lock(struct bnx2x *bp, u32 resource)
1717 return -EEXIST; 1717 return -EEXIST;
1718 } 1718 }
1719 1719
1720 /* Try for 1 second every 5ms */ 1720 /* Try for 5 second every 5ms */
1721 for (cnt = 0; cnt < 200; cnt++) { 1721 for (cnt = 0; cnt < 1000; cnt++) {
1722 /* Try to acquire the lock */ 1722 /* Try to acquire the lock */
1723 REG_WR(bp, hw_lock_control_reg + 4, resource_bit); 1723 REG_WR(bp, hw_lock_control_reg + 4, resource_bit);
1724 lock_status = REG_RD(bp, hw_lock_control_reg); 1724 lock_status = REG_RD(bp, hw_lock_control_reg);
@@ -2550,6 +2550,7 @@ static inline void bnx2x_attn_int_deasserted0(struct bnx2x *bp, u32 attn)
2550 BNX2X_ERR("SPIO5 hw attention\n"); 2550 BNX2X_ERR("SPIO5 hw attention\n");
2551 2551
2552 switch (bp->common.board & SHARED_HW_CFG_BOARD_TYPE_MASK) { 2552 switch (bp->common.board & SHARED_HW_CFG_BOARD_TYPE_MASK) {
2553 case SHARED_HW_CFG_BOARD_TYPE_BCM957710A1021G:
2553 case SHARED_HW_CFG_BOARD_TYPE_BCM957710A1022G: 2554 case SHARED_HW_CFG_BOARD_TYPE_BCM957710A1022G:
2554 /* Fan failure attention */ 2555 /* Fan failure attention */
2555 2556
@@ -4228,7 +4229,7 @@ static inline void bnx2x_free_tpa_pool(struct bnx2x *bp,
4228 if (fp->tpa_state[i] == BNX2X_TPA_START) 4229 if (fp->tpa_state[i] == BNX2X_TPA_START)
4229 pci_unmap_single(bp->pdev, 4230 pci_unmap_single(bp->pdev,
4230 pci_unmap_addr(rx_buf, mapping), 4231 pci_unmap_addr(rx_buf, mapping),
4231 bp->rx_buf_use_size, 4232 bp->rx_buf_size,
4232 PCI_DMA_FROMDEVICE); 4233 PCI_DMA_FROMDEVICE);
4233 4234
4234 dev_kfree_skb(skb); 4235 dev_kfree_skb(skb);
@@ -4244,15 +4245,14 @@ static void bnx2x_init_rx_rings(struct bnx2x *bp)
4244 u16 ring_prod, cqe_ring_prod; 4245 u16 ring_prod, cqe_ring_prod;
4245 int i, j; 4246 int i, j;
4246 4247
4247 bp->rx_buf_use_size = bp->dev->mtu; 4248 bp->rx_buf_size = bp->dev->mtu;
4248 bp->rx_buf_use_size += bp->rx_offset + ETH_OVREHEAD; 4249 bp->rx_buf_size += bp->rx_offset + ETH_OVREHEAD +
4249 bp->rx_buf_size = bp->rx_buf_use_size + 64; 4250 BCM_RX_ETH_PAYLOAD_ALIGN;
4250 4251
4251 if (bp->flags & TPA_ENABLE_FLAG) { 4252 if (bp->flags & TPA_ENABLE_FLAG) {
4252 DP(NETIF_MSG_IFUP, 4253 DP(NETIF_MSG_IFUP,
4253 "rx_buf_use_size %d rx_buf_size %d effective_mtu %d\n", 4254 "rx_buf_size %d effective_mtu %d\n",
4254 bp->rx_buf_use_size, bp->rx_buf_size, 4255 bp->rx_buf_size, bp->dev->mtu + ETH_OVREHEAD);
4255 bp->dev->mtu + ETH_OVREHEAD);
4256 4256
4257 for_each_queue(bp, j) { 4257 for_each_queue(bp, j) {
4258 struct bnx2x_fastpath *fp = &bp->fp[j]; 4258 struct bnx2x_fastpath *fp = &bp->fp[j];
@@ -4461,9 +4461,10 @@ static void bnx2x_init_context(struct bnx2x *bp)
4461 context->ustorm_st_context.common.status_block_id = sb_id; 4461 context->ustorm_st_context.common.status_block_id = sb_id;
4462 context->ustorm_st_context.common.flags = 4462 context->ustorm_st_context.common.flags =
4463 USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_MC_ALIGNMENT; 4463 USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_MC_ALIGNMENT;
4464 context->ustorm_st_context.common.mc_alignment_size = 64; 4464 context->ustorm_st_context.common.mc_alignment_size =
4465 BCM_RX_ETH_PAYLOAD_ALIGN;
4465 context->ustorm_st_context.common.bd_buff_size = 4466 context->ustorm_st_context.common.bd_buff_size =
4466 bp->rx_buf_use_size; 4467 bp->rx_buf_size;
4467 context->ustorm_st_context.common.bd_page_base_hi = 4468 context->ustorm_st_context.common.bd_page_base_hi =
4468 U64_HI(fp->rx_desc_mapping); 4469 U64_HI(fp->rx_desc_mapping);
4469 context->ustorm_st_context.common.bd_page_base_lo = 4470 context->ustorm_st_context.common.bd_page_base_lo =
@@ -4605,6 +4606,17 @@ static void bnx2x_init_internal_common(struct bnx2x *bp)
4605{ 4606{
4606 int i; 4607 int i;
4607 4608
4609 if (bp->flags & TPA_ENABLE_FLAG) {
4610 struct tstorm_eth_tpa_exist tpa = {0};
4611
4612 tpa.tpa_exist = 1;
4613
4614 REG_WR(bp, BAR_TSTRORM_INTMEM + TSTORM_TPA_EXIST_OFFSET,
4615 ((u32 *)&tpa)[0]);
4616 REG_WR(bp, BAR_TSTRORM_INTMEM + TSTORM_TPA_EXIST_OFFSET + 4,
4617 ((u32 *)&tpa)[1]);
4618 }
4619
4608 /* Zero this manually as its initialization is 4620 /* Zero this manually as its initialization is
4609 currently missing in the initTool */ 4621 currently missing in the initTool */
4610 for (i = 0; i < (USTORM_AGG_DATA_SIZE >> 2); i++) 4622 for (i = 0; i < (USTORM_AGG_DATA_SIZE >> 2); i++)
@@ -4705,7 +4717,7 @@ static void bnx2x_init_internal_func(struct bnx2x *bp)
4705 } 4717 }
4706 4718
4707 /* Init CQ ring mapping and aggregation size */ 4719 /* Init CQ ring mapping and aggregation size */
4708 max_agg_size = min((u32)(bp->rx_buf_use_size + 4720 max_agg_size = min((u32)(bp->rx_buf_size +
4709 8*BCM_PAGE_SIZE*PAGES_PER_SGE), 4721 8*BCM_PAGE_SIZE*PAGES_PER_SGE),
4710 (u32)0xffff); 4722 (u32)0xffff);
4711 for_each_queue(bp, i) { 4723 for_each_queue(bp, i) {
@@ -5337,6 +5349,7 @@ static int bnx2x_init_common(struct bnx2x *bp)
5337 } 5349 }
5338 5350
5339 switch (bp->common.board & SHARED_HW_CFG_BOARD_TYPE_MASK) { 5351 switch (bp->common.board & SHARED_HW_CFG_BOARD_TYPE_MASK) {
5352 case SHARED_HW_CFG_BOARD_TYPE_BCM957710A1021G:
5340 case SHARED_HW_CFG_BOARD_TYPE_BCM957710A1022G: 5353 case SHARED_HW_CFG_BOARD_TYPE_BCM957710A1022G:
5341 /* Fan failure is indicated by SPIO 5 */ 5354 /* Fan failure is indicated by SPIO 5 */
5342 bnx2x_set_spio(bp, MISC_REGISTERS_SPIO_5, 5355 bnx2x_set_spio(bp, MISC_REGISTERS_SPIO_5,
@@ -5363,17 +5376,6 @@ static int bnx2x_init_common(struct bnx2x *bp)
5363 5376
5364 enable_blocks_attention(bp); 5377 enable_blocks_attention(bp);
5365 5378
5366 if (bp->flags & TPA_ENABLE_FLAG) {
5367 struct tstorm_eth_tpa_exist tmp = {0};
5368
5369 tmp.tpa_exist = 1;
5370
5371 REG_WR(bp, BAR_TSTRORM_INTMEM + TSTORM_TPA_EXIST_OFFSET,
5372 ((u32 *)&tmp)[0]);
5373 REG_WR(bp, BAR_TSTRORM_INTMEM + TSTORM_TPA_EXIST_OFFSET + 4,
5374 ((u32 *)&tmp)[1]);
5375 }
5376
5377 if (!BP_NOMCP(bp)) { 5379 if (!BP_NOMCP(bp)) {
5378 bnx2x_acquire_phy_lock(bp); 5380 bnx2x_acquire_phy_lock(bp);
5379 bnx2x_common_init_phy(bp, bp->common.shmem_base); 5381 bnx2x_common_init_phy(bp, bp->common.shmem_base);
@@ -5531,6 +5533,7 @@ static int bnx2x_init_port(struct bnx2x *bp)
5531 /* Port DMAE comes here */ 5533 /* Port DMAE comes here */
5532 5534
5533 switch (bp->common.board & SHARED_HW_CFG_BOARD_TYPE_MASK) { 5535 switch (bp->common.board & SHARED_HW_CFG_BOARD_TYPE_MASK) {
5536 case SHARED_HW_CFG_BOARD_TYPE_BCM957710A1021G:
5534 case SHARED_HW_CFG_BOARD_TYPE_BCM957710A1022G: 5537 case SHARED_HW_CFG_BOARD_TYPE_BCM957710A1022G:
5535 /* add SPIO 5 to group 0 */ 5538 /* add SPIO 5 to group 0 */
5536 val = REG_RD(bp, MISC_REG_AEU_ENABLE1_FUNC_0_OUT_0); 5539 val = REG_RD(bp, MISC_REG_AEU_ENABLE1_FUNC_0_OUT_0);
@@ -5937,7 +5940,7 @@ static void bnx2x_free_rx_skbs(struct bnx2x *bp)
5937 5940
5938 pci_unmap_single(bp->pdev, 5941 pci_unmap_single(bp->pdev,
5939 pci_unmap_addr(rx_buf, mapping), 5942 pci_unmap_addr(rx_buf, mapping),
5940 bp->rx_buf_use_size, 5943 bp->rx_buf_size,
5941 PCI_DMA_FROMDEVICE); 5944 PCI_DMA_FROMDEVICE);
5942 5945
5943 rx_buf->skb = NULL; 5946 rx_buf->skb = NULL;
@@ -6055,6 +6058,44 @@ static int bnx2x_req_irq(struct bnx2x *bp)
6055 return rc; 6058 return rc;
6056} 6059}
6057 6060
6061static void bnx2x_napi_enable(struct bnx2x *bp)
6062{
6063 int i;
6064
6065 for_each_queue(bp, i)
6066 napi_enable(&bnx2x_fp(bp, i, napi));
6067}
6068
6069static void bnx2x_napi_disable(struct bnx2x *bp)
6070{
6071 int i;
6072
6073 for_each_queue(bp, i)
6074 napi_disable(&bnx2x_fp(bp, i, napi));
6075}
6076
6077static void bnx2x_netif_start(struct bnx2x *bp)
6078{
6079 if (atomic_dec_and_test(&bp->intr_sem)) {
6080 if (netif_running(bp->dev)) {
6081 if (bp->state == BNX2X_STATE_OPEN)
6082 netif_wake_queue(bp->dev);
6083 bnx2x_napi_enable(bp);
6084 bnx2x_int_enable(bp);
6085 }
6086 }
6087}
6088
6089static void bnx2x_netif_stop(struct bnx2x *bp)
6090{
6091 bnx2x_int_disable_sync(bp);
6092 if (netif_running(bp->dev)) {
6093 bnx2x_napi_disable(bp);
6094 netif_tx_disable(bp->dev);
6095 bp->dev->trans_start = jiffies; /* prevent tx timeout */
6096 }
6097}
6098
6058/* 6099/*
6059 * Init service functions 6100 * Init service functions
6060 */ 6101 */
@@ -6338,7 +6379,7 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
6338 rc = bnx2x_init_hw(bp, load_code); 6379 rc = bnx2x_init_hw(bp, load_code);
6339 if (rc) { 6380 if (rc) {
6340 BNX2X_ERR("HW init failed, aborting\n"); 6381 BNX2X_ERR("HW init failed, aborting\n");
6341 goto load_error; 6382 goto load_int_disable;
6342 } 6383 }
6343 6384
6344 /* Setup NIC internals and enable interrupts */ 6385 /* Setup NIC internals and enable interrupts */
@@ -6350,7 +6391,7 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
6350 if (!load_code) { 6391 if (!load_code) {
6351 BNX2X_ERR("MCP response failure, aborting\n"); 6392 BNX2X_ERR("MCP response failure, aborting\n");
6352 rc = -EBUSY; 6393 rc = -EBUSY;
6353 goto load_int_disable; 6394 goto load_rings_free;
6354 } 6395 }
6355 } 6396 }
6356 6397
@@ -6360,8 +6401,7 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
6360 6401
6361 /* Enable Rx interrupt handling before sending the ramrod 6402 /* Enable Rx interrupt handling before sending the ramrod
6362 as it's completed on Rx FP queue */ 6403 as it's completed on Rx FP queue */
6363 for_each_queue(bp, i) 6404 bnx2x_napi_enable(bp);
6364 napi_enable(&bnx2x_fp(bp, i, napi));
6365 6405
6366 /* Enable interrupt handling */ 6406 /* Enable interrupt handling */
6367 atomic_set(&bp->intr_sem, 0); 6407 atomic_set(&bp->intr_sem, 0);
@@ -6369,7 +6409,7 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
6369 rc = bnx2x_setup_leading(bp); 6409 rc = bnx2x_setup_leading(bp);
6370 if (rc) { 6410 if (rc) {
6371 BNX2X_ERR("Setup leading failed!\n"); 6411 BNX2X_ERR("Setup leading failed!\n");
6372 goto load_stop_netif; 6412 goto load_netif_stop;
6373 } 6413 }
6374 6414
6375 if (CHIP_IS_E1H(bp)) 6415 if (CHIP_IS_E1H(bp))
@@ -6382,7 +6422,7 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
6382 for_each_nondefault_queue(bp, i) { 6422 for_each_nondefault_queue(bp, i) {
6383 rc = bnx2x_setup_multi(bp, i); 6423 rc = bnx2x_setup_multi(bp, i);
6384 if (rc) 6424 if (rc)
6385 goto load_stop_netif; 6425 goto load_netif_stop;
6386 } 6426 }
6387 6427
6388 if (CHIP_IS_E1(bp)) 6428 if (CHIP_IS_E1(bp))
@@ -6427,20 +6467,17 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
6427 6467
6428 return 0; 6468 return 0;
6429 6469
6430load_stop_netif: 6470load_netif_stop:
6471 bnx2x_napi_disable(bp);
6472load_rings_free:
6473 /* Free SKBs, SGEs, TPA pool and driver internals */
6474 bnx2x_free_skbs(bp);
6431 for_each_queue(bp, i) 6475 for_each_queue(bp, i)
6432 napi_disable(&bnx2x_fp(bp, i, napi)); 6476 bnx2x_free_rx_sge_range(bp, bp->fp + i, NUM_RX_SGE);
6433
6434load_int_disable: 6477load_int_disable:
6435 bnx2x_int_disable_sync(bp); 6478 bnx2x_int_disable_sync(bp);
6436
6437 /* Release IRQs */ 6479 /* Release IRQs */
6438 bnx2x_free_irq(bp); 6480 bnx2x_free_irq(bp);
6439
6440 /* Free SKBs, SGEs, TPA pool and driver internals */
6441 bnx2x_free_skbs(bp);
6442 for_each_queue(bp, i)
6443 bnx2x_free_rx_sge_range(bp, bp->fp + i, NUM_RX_SGE);
6444load_error: 6481load_error:
6445 bnx2x_free_mem(bp); 6482 bnx2x_free_mem(bp);
6446 6483
@@ -6455,7 +6492,7 @@ static int bnx2x_stop_multi(struct bnx2x *bp, int index)
6455 6492
6456 /* halt the connection */ 6493 /* halt the connection */
6457 bp->fp[index].state = BNX2X_FP_STATE_HALTING; 6494 bp->fp[index].state = BNX2X_FP_STATE_HALTING;
6458 bnx2x_sp_post(bp, RAMROD_CMD_ID_ETH_HALT, index, 0, 0, 0); 6495 bnx2x_sp_post(bp, RAMROD_CMD_ID_ETH_HALT, index, 0, index, 0);
6459 6496
6460 /* Wait for completion */ 6497 /* Wait for completion */
6461 rc = bnx2x_wait_ramrod(bp, BNX2X_FP_STATE_HALTED, index, 6498 rc = bnx2x_wait_ramrod(bp, BNX2X_FP_STATE_HALTED, index,
@@ -6613,11 +6650,9 @@ static int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode)
6613 bp->rx_mode = BNX2X_RX_MODE_NONE; 6650 bp->rx_mode = BNX2X_RX_MODE_NONE;
6614 bnx2x_set_storm_rx_mode(bp); 6651 bnx2x_set_storm_rx_mode(bp);
6615 6652
6616 if (netif_running(bp->dev)) { 6653 bnx2x_netif_stop(bp);
6617 netif_tx_disable(bp->dev); 6654 if (!netif_running(bp->dev))
6618 bp->dev->trans_start = jiffies; /* prevent tx timeout */ 6655 bnx2x_napi_disable(bp);
6619 }
6620
6621 del_timer_sync(&bp->timer); 6656 del_timer_sync(&bp->timer);
6622 SHMEM_WR(bp, func_mb[BP_FUNC(bp)].drv_pulse_mb, 6657 SHMEM_WR(bp, func_mb[BP_FUNC(bp)].drv_pulse_mb,
6623 (DRV_PULSE_ALWAYS_ALIVE | bp->fw_drv_pulse_wr_seq)); 6658 (DRV_PULSE_ALWAYS_ALIVE | bp->fw_drv_pulse_wr_seq));
@@ -6631,9 +6666,7 @@ static int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode)
6631 smp_rmb(); 6666 smp_rmb();
6632 while (BNX2X_HAS_TX_WORK(fp)) { 6667 while (BNX2X_HAS_TX_WORK(fp)) {
6633 6668
6634 if (!netif_running(bp->dev)) 6669 bnx2x_tx_int(fp, 1000);
6635 bnx2x_tx_int(fp, 1000);
6636
6637 if (!cnt) { 6670 if (!cnt) {
6638 BNX2X_ERR("timeout waiting for queue[%d]\n", 6671 BNX2X_ERR("timeout waiting for queue[%d]\n",
6639 i); 6672 i);
@@ -6649,46 +6682,12 @@ static int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode)
6649 smp_rmb(); 6682 smp_rmb();
6650 } 6683 }
6651 } 6684 }
6652
6653 /* Give HW time to discard old tx messages */ 6685 /* Give HW time to discard old tx messages */
6654 msleep(1); 6686 msleep(1);
6655 6687
6656 for_each_queue(bp, i)
6657 napi_disable(&bnx2x_fp(bp, i, napi));
6658 /* Disable interrupts after Tx and Rx are disabled on stack level */
6659 bnx2x_int_disable_sync(bp);
6660
6661 /* Release IRQs */ 6688 /* Release IRQs */
6662 bnx2x_free_irq(bp); 6689 bnx2x_free_irq(bp);
6663 6690
6664 if (unload_mode == UNLOAD_NORMAL)
6665 reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS;
6666
6667 else if (bp->flags & NO_WOL_FLAG) {
6668 reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_MCP;
6669 if (CHIP_IS_E1H(bp))
6670 REG_WR(bp, MISC_REG_E1HMF_MODE, 0);
6671
6672 } else if (bp->wol) {
6673 u32 emac_base = port ? GRCBASE_EMAC1 : GRCBASE_EMAC0;
6674 u8 *mac_addr = bp->dev->dev_addr;
6675 u32 val;
6676 /* The mac address is written to entries 1-4 to
6677 preserve entry 0 which is used by the PMF */
6678 u8 entry = (BP_E1HVN(bp) + 1)*8;
6679
6680 val = (mac_addr[0] << 8) | mac_addr[1];
6681 EMAC_WR(bp, EMAC_REG_EMAC_MAC_MATCH + entry, val);
6682
6683 val = (mac_addr[2] << 24) | (mac_addr[3] << 16) |
6684 (mac_addr[4] << 8) | mac_addr[5];
6685 EMAC_WR(bp, EMAC_REG_EMAC_MAC_MATCH + entry + 4, val);
6686
6687 reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_EN;
6688
6689 } else
6690 reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS;
6691
6692 if (CHIP_IS_E1(bp)) { 6691 if (CHIP_IS_E1(bp)) {
6693 struct mac_configuration_cmd *config = 6692 struct mac_configuration_cmd *config =
6694 bnx2x_sp(bp, mcast_config); 6693 bnx2x_sp(bp, mcast_config);
@@ -6711,14 +6710,41 @@ static int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode)
6711 U64_LO(bnx2x_sp_mapping(bp, mcast_config)), 0); 6710 U64_LO(bnx2x_sp_mapping(bp, mcast_config)), 0);
6712 6711
6713 } else { /* E1H */ 6712 } else { /* E1H */
6713 REG_WR(bp, NIG_REG_LLH0_FUNC_EN + port*8, 0);
6714
6714 bnx2x_set_mac_addr_e1h(bp, 0); 6715 bnx2x_set_mac_addr_e1h(bp, 0);
6715 6716
6716 for (i = 0; i < MC_HASH_SIZE; i++) 6717 for (i = 0; i < MC_HASH_SIZE; i++)
6717 REG_WR(bp, MC_HASH_OFFSET(bp, i), 0); 6718 REG_WR(bp, MC_HASH_OFFSET(bp, i), 0);
6718 } 6719 }
6719 6720
6720 if (CHIP_IS_E1H(bp)) 6721 if (unload_mode == UNLOAD_NORMAL)
6721 REG_WR(bp, NIG_REG_LLH0_FUNC_EN + port*8, 0); 6722 reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS;
6723
6724 else if (bp->flags & NO_WOL_FLAG) {
6725 reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_MCP;
6726 if (CHIP_IS_E1H(bp))
6727 REG_WR(bp, MISC_REG_E1HMF_MODE, 0);
6728
6729 } else if (bp->wol) {
6730 u32 emac_base = port ? GRCBASE_EMAC1 : GRCBASE_EMAC0;
6731 u8 *mac_addr = bp->dev->dev_addr;
6732 u32 val;
6733 /* The mac address is written to entries 1-4 to
6734 preserve entry 0 which is used by the PMF */
6735 u8 entry = (BP_E1HVN(bp) + 1)*8;
6736
6737 val = (mac_addr[0] << 8) | mac_addr[1];
6738 EMAC_WR(bp, EMAC_REG_EMAC_MAC_MATCH + entry, val);
6739
6740 val = (mac_addr[2] << 24) | (mac_addr[3] << 16) |
6741 (mac_addr[4] << 8) | mac_addr[5];
6742 EMAC_WR(bp, EMAC_REG_EMAC_MAC_MATCH + entry + 4, val);
6743
6744 reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_EN;
6745
6746 } else
6747 reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS;
6722 6748
6723 /* Close multi and leading connections 6749 /* Close multi and leading connections
6724 Completions for ramrods are collected in a synchronous way */ 6750 Completions for ramrods are collected in a synchronous way */
@@ -6821,6 +6847,10 @@ static void __devinit bnx2x_undi_unload(struct bnx2x *bp)
6821 */ 6847 */
6822 bnx2x_acquire_hw_lock(bp, HW_LOCK_RESOURCE_UNDI); 6848 bnx2x_acquire_hw_lock(bp, HW_LOCK_RESOURCE_UNDI);
6823 val = REG_RD(bp, DORQ_REG_NORM_CID_OFST); 6849 val = REG_RD(bp, DORQ_REG_NORM_CID_OFST);
6850 if (val == 0x7)
6851 REG_WR(bp, DORQ_REG_NORM_CID_OFST, 0);
6852 bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_UNDI);
6853
6824 if (val == 0x7) { 6854 if (val == 0x7) {
6825 u32 reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS; 6855 u32 reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS;
6826 /* save our func */ 6856 /* save our func */
@@ -6898,7 +6928,6 @@ static void __devinit bnx2x_undi_unload(struct bnx2x *bp)
6898 (SHMEM_RD(bp, func_mb[bp->func].drv_mb_header) & 6928 (SHMEM_RD(bp, func_mb[bp->func].drv_mb_header) &
6899 DRV_MSG_SEQ_NUMBER_MASK); 6929 DRV_MSG_SEQ_NUMBER_MASK);
6900 } 6930 }
6901 bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_UNDI);
6902 } 6931 }
6903} 6932}
6904 6933
@@ -8617,34 +8646,6 @@ test_mem_exit:
8617 return rc; 8646 return rc;
8618} 8647}
8619 8648
8620static void bnx2x_netif_start(struct bnx2x *bp)
8621{
8622 int i;
8623
8624 if (atomic_dec_and_test(&bp->intr_sem)) {
8625 if (netif_running(bp->dev)) {
8626 bnx2x_int_enable(bp);
8627 for_each_queue(bp, i)
8628 napi_enable(&bnx2x_fp(bp, i, napi));
8629 if (bp->state == BNX2X_STATE_OPEN)
8630 netif_wake_queue(bp->dev);
8631 }
8632 }
8633}
8634
8635static void bnx2x_netif_stop(struct bnx2x *bp)
8636{
8637 int i;
8638
8639 if (netif_running(bp->dev)) {
8640 netif_tx_disable(bp->dev);
8641 bp->dev->trans_start = jiffies; /* prevent tx timeout */
8642 for_each_queue(bp, i)
8643 napi_disable(&bnx2x_fp(bp, i, napi));
8644 }
8645 bnx2x_int_disable_sync(bp);
8646}
8647
8648static void bnx2x_wait_for_link(struct bnx2x *bp, u8 link_up) 8649static void bnx2x_wait_for_link(struct bnx2x *bp, u8 link_up)
8649{ 8650{
8650 int cnt = 1000; 8651 int cnt = 1000;
@@ -9250,6 +9251,7 @@ static int bnx2x_poll(struct napi_struct *napi, int budget)
9250 napi); 9251 napi);
9251 struct bnx2x *bp = fp->bp; 9252 struct bnx2x *bp = fp->bp;
9252 int work_done = 0; 9253 int work_done = 0;
9254 u16 rx_cons_sb;
9253 9255
9254#ifdef BNX2X_STOP_ON_ERROR 9256#ifdef BNX2X_STOP_ON_ERROR
9255 if (unlikely(bp->panic)) 9257 if (unlikely(bp->panic))
@@ -9265,10 +9267,16 @@ static int bnx2x_poll(struct napi_struct *napi, int budget)
9265 if (BNX2X_HAS_TX_WORK(fp)) 9267 if (BNX2X_HAS_TX_WORK(fp))
9266 bnx2x_tx_int(fp, budget); 9268 bnx2x_tx_int(fp, budget);
9267 9269
9270 rx_cons_sb = le16_to_cpu(*fp->rx_cons_sb);
9271 if ((rx_cons_sb & MAX_RCQ_DESC_CNT) == MAX_RCQ_DESC_CNT)
9272 rx_cons_sb++;
9268 if (BNX2X_HAS_RX_WORK(fp)) 9273 if (BNX2X_HAS_RX_WORK(fp))
9269 work_done = bnx2x_rx_int(fp, budget); 9274 work_done = bnx2x_rx_int(fp, budget);
9270 9275
9271 rmb(); /* BNX2X_HAS_WORK() reads the status block */ 9276 rmb(); /* BNX2X_HAS_WORK() reads the status block */
9277 rx_cons_sb = le16_to_cpu(*fp->rx_cons_sb);
9278 if ((rx_cons_sb & MAX_RCQ_DESC_CNT) == MAX_RCQ_DESC_CNT)
9279 rx_cons_sb++;
9272 9280
9273 /* must not complete if we consumed full budget */ 9281 /* must not complete if we consumed full budget */
9274 if ((work_done < budget) && !BNX2X_HAS_WORK(fp)) { 9282 if ((work_done < budget) && !BNX2X_HAS_WORK(fp)) {
@@ -9484,8 +9492,7 @@ static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
9484 fp_index = (smp_processor_id() % bp->num_queues); 9492 fp_index = (smp_processor_id() % bp->num_queues);
9485 fp = &bp->fp[fp_index]; 9493 fp = &bp->fp[fp_index];
9486 9494
9487 if (unlikely(bnx2x_tx_avail(bp->fp) < 9495 if (unlikely(bnx2x_tx_avail(fp) < (skb_shinfo(skb)->nr_frags + 3))) {
9488 (skb_shinfo(skb)->nr_frags + 3))) {
9489 bp->eth_stats.driver_xoff++, 9496 bp->eth_stats.driver_xoff++,
9490 netif_stop_queue(dev); 9497 netif_stop_queue(dev);
9491 BNX2X_ERR("BUG! Tx ring full when queue awake!\n"); 9498 BNX2X_ERR("BUG! Tx ring full when queue awake!\n");
@@ -9548,7 +9555,6 @@ static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
9548 tx_bd->vlan = cpu_to_le16(pkt_prod); 9555 tx_bd->vlan = cpu_to_le16(pkt_prod);
9549 9556
9550 if (xmit_type) { 9557 if (xmit_type) {
9551
9552 /* turn on parsing and get a BD */ 9558 /* turn on parsing and get a BD */
9553 bd_prod = TX_BD(NEXT_TX_IDX(bd_prod)); 9559 bd_prod = TX_BD(NEXT_TX_IDX(bd_prod));
9554 pbd = (void *)&fp->tx_desc_ring[bd_prod]; 9560 pbd = (void *)&fp->tx_desc_ring[bd_prod];
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 19d32a227be1..453115acaad2 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -1838,7 +1838,7 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
1838 if ((le16_to_cpu(rfd->command) & cb_el) && 1838 if ((le16_to_cpu(rfd->command) & cb_el) &&
1839 (RU_RUNNING == nic->ru_running)) 1839 (RU_RUNNING == nic->ru_running))
1840 1840
1841 if (readb(&nic->csr->scb.status) & rus_no_res) 1841 if (ioread8(&nic->csr->scb.status) & rus_no_res)
1842 nic->ru_running = RU_SUSPENDED; 1842 nic->ru_running = RU_SUSPENDED;
1843 return -ENODATA; 1843 return -ENODATA;
1844 } 1844 }
@@ -1861,7 +1861,7 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
1861 if ((le16_to_cpu(rfd->command) & cb_el) && 1861 if ((le16_to_cpu(rfd->command) & cb_el) &&
1862 (RU_RUNNING == nic->ru_running)) { 1862 (RU_RUNNING == nic->ru_running)) {
1863 1863
1864 if (readb(&nic->csr->scb.status) & rus_no_res) 1864 if (ioread8(&nic->csr->scb.status) & rus_no_res)
1865 nic->ru_running = RU_SUSPENDED; 1865 nic->ru_running = RU_SUSPENDED;
1866 } 1866 }
1867 1867
diff --git a/drivers/net/e1000/e1000_param.c b/drivers/net/e1000/e1000_param.c
index b9f90a5d3d4d..213437d13154 100644
--- a/drivers/net/e1000/e1000_param.c
+++ b/drivers/net/e1000/e1000_param.c
@@ -208,7 +208,7 @@ struct e1000_option {
208 } r; 208 } r;
209 struct { /* list_option info */ 209 struct { /* list_option info */
210 int nr; 210 int nr;
211 struct e1000_opt_list { int i; char *str; } *p; 211 const struct e1000_opt_list { int i; char *str; } *p;
212 } l; 212 } l;
213 } arg; 213 } arg;
214}; 214};
@@ -242,7 +242,7 @@ static int __devinit e1000_validate_option(unsigned int *value,
242 break; 242 break;
243 case list_option: { 243 case list_option: {
244 int i; 244 int i;
245 struct e1000_opt_list *ent; 245 const struct e1000_opt_list *ent;
246 246
247 for (i = 0; i < opt->arg.l.nr; i++) { 247 for (i = 0; i < opt->arg.l.nr; i++) {
248 ent = &opt->arg.l.p[i]; 248 ent = &opt->arg.l.p[i];
@@ -279,7 +279,9 @@ static void e1000_check_copper_options(struct e1000_adapter *adapter);
279 279
280void __devinit e1000_check_options(struct e1000_adapter *adapter) 280void __devinit e1000_check_options(struct e1000_adapter *adapter)
281{ 281{
282 struct e1000_option opt;
282 int bd = adapter->bd_number; 283 int bd = adapter->bd_number;
284
283 if (bd >= E1000_MAX_NIC) { 285 if (bd >= E1000_MAX_NIC) {
284 DPRINTK(PROBE, NOTICE, 286 DPRINTK(PROBE, NOTICE,
285 "Warning: no configuration for board #%i\n", bd); 287 "Warning: no configuration for board #%i\n", bd);
@@ -287,19 +289,21 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter)
287 } 289 }
288 290
289 { /* Transmit Descriptor Count */ 291 { /* Transmit Descriptor Count */
290 struct e1000_option opt = { 292 struct e1000_tx_ring *tx_ring = adapter->tx_ring;
293 int i;
294 e1000_mac_type mac_type = adapter->hw.mac_type;
295
296 opt = (struct e1000_option) {
291 .type = range_option, 297 .type = range_option,
292 .name = "Transmit Descriptors", 298 .name = "Transmit Descriptors",
293 .err = "using default of " 299 .err = "using default of "
294 __MODULE_STRING(E1000_DEFAULT_TXD), 300 __MODULE_STRING(E1000_DEFAULT_TXD),
295 .def = E1000_DEFAULT_TXD, 301 .def = E1000_DEFAULT_TXD,
296 .arg = { .r = { .min = E1000_MIN_TXD }} 302 .arg = { .r = {
303 .min = E1000_MIN_TXD,
304 .max = mac_type < e1000_82544 ? E1000_MAX_TXD : E1000_MAX_82544_TXD
305 }}
297 }; 306 };
298 struct e1000_tx_ring *tx_ring = adapter->tx_ring;
299 int i;
300 e1000_mac_type mac_type = adapter->hw.mac_type;
301 opt.arg.r.max = mac_type < e1000_82544 ?
302 E1000_MAX_TXD : E1000_MAX_82544_TXD;
303 307
304 if (num_TxDescriptors > bd) { 308 if (num_TxDescriptors > bd) {
305 tx_ring->count = TxDescriptors[bd]; 309 tx_ring->count = TxDescriptors[bd];
@@ -313,19 +317,21 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter)
313 tx_ring[i].count = tx_ring->count; 317 tx_ring[i].count = tx_ring->count;
314 } 318 }
315 { /* Receive Descriptor Count */ 319 { /* Receive Descriptor Count */
316 struct e1000_option opt = { 320 struct e1000_rx_ring *rx_ring = adapter->rx_ring;
321 int i;
322 e1000_mac_type mac_type = adapter->hw.mac_type;
323
324 opt = (struct e1000_option) {
317 .type = range_option, 325 .type = range_option,
318 .name = "Receive Descriptors", 326 .name = "Receive Descriptors",
319 .err = "using default of " 327 .err = "using default of "
320 __MODULE_STRING(E1000_DEFAULT_RXD), 328 __MODULE_STRING(E1000_DEFAULT_RXD),
321 .def = E1000_DEFAULT_RXD, 329 .def = E1000_DEFAULT_RXD,
322 .arg = { .r = { .min = E1000_MIN_RXD }} 330 .arg = { .r = {
331 .min = E1000_MIN_RXD,
332 .max = mac_type < e1000_82544 ? E1000_MAX_RXD : E1000_MAX_82544_RXD
333 }}
323 }; 334 };
324 struct e1000_rx_ring *rx_ring = adapter->rx_ring;
325 int i;
326 e1000_mac_type mac_type = adapter->hw.mac_type;
327 opt.arg.r.max = mac_type < e1000_82544 ? E1000_MAX_RXD :
328 E1000_MAX_82544_RXD;
329 335
330 if (num_RxDescriptors > bd) { 336 if (num_RxDescriptors > bd) {
331 rx_ring->count = RxDescriptors[bd]; 337 rx_ring->count = RxDescriptors[bd];
@@ -339,7 +345,7 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter)
339 rx_ring[i].count = rx_ring->count; 345 rx_ring[i].count = rx_ring->count;
340 } 346 }
341 { /* Checksum Offload Enable/Disable */ 347 { /* Checksum Offload Enable/Disable */
342 struct e1000_option opt = { 348 opt = (struct e1000_option) {
343 .type = enable_option, 349 .type = enable_option,
344 .name = "Checksum Offload", 350 .name = "Checksum Offload",
345 .err = "defaulting to Enabled", 351 .err = "defaulting to Enabled",
@@ -363,7 +369,7 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter)
363 { E1000_FC_FULL, "Flow Control Enabled" }, 369 { E1000_FC_FULL, "Flow Control Enabled" },
364 { E1000_FC_DEFAULT, "Flow Control Hardware Default" }}; 370 { E1000_FC_DEFAULT, "Flow Control Hardware Default" }};
365 371
366 struct e1000_option opt = { 372 opt = (struct e1000_option) {
367 .type = list_option, 373 .type = list_option,
368 .name = "Flow Control", 374 .name = "Flow Control",
369 .err = "reading default settings from EEPROM", 375 .err = "reading default settings from EEPROM",
@@ -381,7 +387,7 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter)
381 } 387 }
382 } 388 }
383 { /* Transmit Interrupt Delay */ 389 { /* Transmit Interrupt Delay */
384 struct e1000_option opt = { 390 opt = (struct e1000_option) {
385 .type = range_option, 391 .type = range_option,
386 .name = "Transmit Interrupt Delay", 392 .name = "Transmit Interrupt Delay",
387 .err = "using default of " __MODULE_STRING(DEFAULT_TIDV), 393 .err = "using default of " __MODULE_STRING(DEFAULT_TIDV),
@@ -399,7 +405,7 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter)
399 } 405 }
400 } 406 }
401 { /* Transmit Absolute Interrupt Delay */ 407 { /* Transmit Absolute Interrupt Delay */
402 struct e1000_option opt = { 408 opt = (struct e1000_option) {
403 .type = range_option, 409 .type = range_option,
404 .name = "Transmit Absolute Interrupt Delay", 410 .name = "Transmit Absolute Interrupt Delay",
405 .err = "using default of " __MODULE_STRING(DEFAULT_TADV), 411 .err = "using default of " __MODULE_STRING(DEFAULT_TADV),
@@ -417,7 +423,7 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter)
417 } 423 }
418 } 424 }
419 { /* Receive Interrupt Delay */ 425 { /* Receive Interrupt Delay */
420 struct e1000_option opt = { 426 opt = (struct e1000_option) {
421 .type = range_option, 427 .type = range_option,
422 .name = "Receive Interrupt Delay", 428 .name = "Receive Interrupt Delay",
423 .err = "using default of " __MODULE_STRING(DEFAULT_RDTR), 429 .err = "using default of " __MODULE_STRING(DEFAULT_RDTR),
@@ -435,7 +441,7 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter)
435 } 441 }
436 } 442 }
437 { /* Receive Absolute Interrupt Delay */ 443 { /* Receive Absolute Interrupt Delay */
438 struct e1000_option opt = { 444 opt = (struct e1000_option) {
439 .type = range_option, 445 .type = range_option,
440 .name = "Receive Absolute Interrupt Delay", 446 .name = "Receive Absolute Interrupt Delay",
441 .err = "using default of " __MODULE_STRING(DEFAULT_RADV), 447 .err = "using default of " __MODULE_STRING(DEFAULT_RADV),
@@ -453,7 +459,7 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter)
453 } 459 }
454 } 460 }
455 { /* Interrupt Throttling Rate */ 461 { /* Interrupt Throttling Rate */
456 struct e1000_option opt = { 462 opt = (struct e1000_option) {
457 .type = range_option, 463 .type = range_option,
458 .name = "Interrupt Throttling Rate (ints/sec)", 464 .name = "Interrupt Throttling Rate (ints/sec)",
459 .err = "using default of " __MODULE_STRING(DEFAULT_ITR), 465 .err = "using default of " __MODULE_STRING(DEFAULT_ITR),
@@ -497,7 +503,7 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter)
497 } 503 }
498 } 504 }
499 { /* Smart Power Down */ 505 { /* Smart Power Down */
500 struct e1000_option opt = { 506 opt = (struct e1000_option) {
501 .type = enable_option, 507 .type = enable_option,
502 .name = "PHY Smart Power Down", 508 .name = "PHY Smart Power Down",
503 .err = "defaulting to Disabled", 509 .err = "defaulting to Disabled",
@@ -513,7 +519,7 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter)
513 } 519 }
514 } 520 }
515 { /* Kumeran Lock Loss Workaround */ 521 { /* Kumeran Lock Loss Workaround */
516 struct e1000_option opt = { 522 opt = (struct e1000_option) {
517 .type = enable_option, 523 .type = enable_option,
518 .name = "Kumeran Lock Loss Workaround", 524 .name = "Kumeran Lock Loss Workaround",
519 .err = "defaulting to Enabled", 525 .err = "defaulting to Enabled",
@@ -578,16 +584,18 @@ static void __devinit e1000_check_fiber_options(struct e1000_adapter *adapter)
578 584
579static void __devinit e1000_check_copper_options(struct e1000_adapter *adapter) 585static void __devinit e1000_check_copper_options(struct e1000_adapter *adapter)
580{ 586{
587 struct e1000_option opt;
581 unsigned int speed, dplx, an; 588 unsigned int speed, dplx, an;
582 int bd = adapter->bd_number; 589 int bd = adapter->bd_number;
583 590
584 { /* Speed */ 591 { /* Speed */
585 struct e1000_opt_list speed_list[] = {{ 0, "" }, 592 static const struct e1000_opt_list speed_list[] = {
586 { SPEED_10, "" }, 593 { 0, "" },
587 { SPEED_100, "" }, 594 { SPEED_10, "" },
588 { SPEED_1000, "" }}; 595 { SPEED_100, "" },
596 { SPEED_1000, "" }};
589 597
590 struct e1000_option opt = { 598 opt = (struct e1000_option) {
591 .type = list_option, 599 .type = list_option,
592 .name = "Speed", 600 .name = "Speed",
593 .err = "parameter ignored", 601 .err = "parameter ignored",
@@ -604,11 +612,12 @@ static void __devinit e1000_check_copper_options(struct e1000_adapter *adapter)
604 } 612 }
605 } 613 }
606 { /* Duplex */ 614 { /* Duplex */
607 struct e1000_opt_list dplx_list[] = {{ 0, "" }, 615 static const struct e1000_opt_list dplx_list[] = {
608 { HALF_DUPLEX, "" }, 616 { 0, "" },
609 { FULL_DUPLEX, "" }}; 617 { HALF_DUPLEX, "" },
618 { FULL_DUPLEX, "" }};
610 619
611 struct e1000_option opt = { 620 opt = (struct e1000_option) {
612 .type = list_option, 621 .type = list_option,
613 .name = "Duplex", 622 .name = "Duplex",
614 .err = "parameter ignored", 623 .err = "parameter ignored",
@@ -637,7 +646,7 @@ static void __devinit e1000_check_copper_options(struct e1000_adapter *adapter)
637 "parameter ignored\n"); 646 "parameter ignored\n");
638 adapter->hw.autoneg_advertised = AUTONEG_ADV_DEFAULT; 647 adapter->hw.autoneg_advertised = AUTONEG_ADV_DEFAULT;
639 } else { /* Autoneg */ 648 } else { /* Autoneg */
640 struct e1000_opt_list an_list[] = 649 static const struct e1000_opt_list an_list[] =
641 #define AA "AutoNeg advertising " 650 #define AA "AutoNeg advertising "
642 {{ 0x01, AA "10/HD" }, 651 {{ 0x01, AA "10/HD" },
643 { 0x02, AA "10/FD" }, 652 { 0x02, AA "10/FD" },
@@ -671,7 +680,7 @@ static void __devinit e1000_check_copper_options(struct e1000_adapter *adapter)
671 { 0x2e, AA "1000/FD, 100/FD, 100/HD, 10/FD" }, 680 { 0x2e, AA "1000/FD, 100/FD, 100/HD, 10/FD" },
672 { 0x2f, AA "1000/FD, 100/FD, 100/HD, 10/FD, 10/HD" }}; 681 { 0x2f, AA "1000/FD, 100/FD, 100/HD, 10/FD, 10/HD" }};
673 682
674 struct e1000_option opt = { 683 opt = (struct e1000_option) {
675 .type = list_option, 684 .type = list_option,
676 .name = "AutoNeg", 685 .name = "AutoNeg",
677 .err = "parameter ignored", 686 .err = "parameter ignored",
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 053971e5fc94..0b6ecef9a849 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -5522,7 +5522,7 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
5522 if (id->driver_data & DEV_HAS_CHECKSUM) { 5522 if (id->driver_data & DEV_HAS_CHECKSUM) {
5523 np->rx_csum = 1; 5523 np->rx_csum = 1;
5524 np->txrxctl_bits |= NVREG_TXRXCTL_RXCHECK; 5524 np->txrxctl_bits |= NVREG_TXRXCTL_RXCHECK;
5525 dev->features |= NETIF_F_HW_CSUM | NETIF_F_SG; 5525 dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
5526 dev->features |= NETIF_F_TSO; 5526 dev->features |= NETIF_F_TSO;
5527 } 5527 }
5528 5528
@@ -5835,7 +5835,7 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
5835 5835
5836 dev_printk(KERN_INFO, &pci_dev->dev, "%s%s%s%s%s%s%s%s%s%sdesc-v%u\n", 5836 dev_printk(KERN_INFO, &pci_dev->dev, "%s%s%s%s%s%s%s%s%s%sdesc-v%u\n",
5837 dev->features & NETIF_F_HIGHDMA ? "highdma " : "", 5837 dev->features & NETIF_F_HIGHDMA ? "highdma " : "",
5838 dev->features & (NETIF_F_HW_CSUM | NETIF_F_SG) ? 5838 dev->features & (NETIF_F_IP_CSUM | NETIF_F_SG) ?
5839 "csum " : "", 5839 "csum " : "",
5840 dev->features & (NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX) ? 5840 dev->features & (NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX) ?
5841 "vlan " : "", 5841 "vlan " : "",
@@ -5975,10 +5975,12 @@ static void nv_shutdown(struct pci_dev *pdev)
5975 if (netif_running(dev)) 5975 if (netif_running(dev))
5976 nv_close(dev); 5976 nv_close(dev);
5977 5977
5978 pci_enable_wake(pdev, PCI_D3hot, np->wolenabled);
5979 pci_enable_wake(pdev, PCI_D3cold, np->wolenabled);
5980 pci_disable_device(pdev); 5978 pci_disable_device(pdev);
5981 pci_set_power_state(pdev, PCI_D3hot); 5979 if (system_state == SYSTEM_POWER_OFF) {
5980 if (pci_enable_wake(pdev, PCI_D3cold, np->wolenabled))
5981 pci_enable_wake(pdev, PCI_D3hot, np->wolenabled);
5982 pci_set_power_state(pdev, PCI_D3hot);
5983 }
5982} 5984}
5983#else 5985#else
5984#define nv_suspend NULL 5986#define nv_suspend NULL
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
index 9a51ec8293cc..9d461825bf4c 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -792,6 +792,10 @@ static int fs_enet_open(struct net_device *dev)
792 int r; 792 int r;
793 int err; 793 int err;
794 794
795 /* to initialize the fep->cur_rx,... */
796 /* not doing this, will cause a crash in fs_enet_rx_napi */
797 fs_init_bds(fep->ndev);
798
795 if (fep->fpi->use_napi) 799 if (fep->fpi->use_napi)
796 napi_enable(&fep->napi); 800 napi_enable(&fep->napi);
797 801
@@ -1167,6 +1171,10 @@ static struct of_device_id fs_enet_match[] = {
1167 .compatible = "fsl,cpm1-scc-enet", 1171 .compatible = "fsl,cpm1-scc-enet",
1168 .data = (void *)&fs_scc_ops, 1172 .data = (void *)&fs_scc_ops,
1169 }, 1173 },
1174 {
1175 .compatible = "fsl,cpm2-scc-enet",
1176 .data = (void *)&fs_scc_ops,
1177 },
1170#endif 1178#endif
1171#ifdef CONFIG_FS_ENET_HAS_FCC 1179#ifdef CONFIG_FS_ENET_HAS_FCC
1172 { 1180 {
diff --git a/drivers/net/fs_enet/mac-scc.c b/drivers/net/fs_enet/mac-scc.c
index 029b3c7ef29c..22f50dd8b277 100644
--- a/drivers/net/fs_enet/mac-scc.c
+++ b/drivers/net/fs_enet/mac-scc.c
@@ -47,7 +47,6 @@
47#include "fs_enet.h" 47#include "fs_enet.h"
48 48
49/*************************************************/ 49/*************************************************/
50
51#if defined(CONFIG_CPM1) 50#if defined(CONFIG_CPM1)
52/* for a 8xx __raw_xxx's are sufficient */ 51/* for a 8xx __raw_xxx's are sufficient */
53#define __fs_out32(addr, x) __raw_writel(x, addr) 52#define __fs_out32(addr, x) __raw_writel(x, addr)
@@ -62,6 +61,8 @@
62#define __fs_out16(addr, x) out_be16(addr, x) 61#define __fs_out16(addr, x) out_be16(addr, x)
63#define __fs_in32(addr) in_be32(addr) 62#define __fs_in32(addr) in_be32(addr)
64#define __fs_in16(addr) in_be16(addr) 63#define __fs_in16(addr) in_be16(addr)
64#define __fs_out8(addr, x) out_8(addr, x)
65#define __fs_in8(addr) in_8(addr)
65#endif 66#endif
66 67
67/* write, read, set bits, clear bits */ 68/* write, read, set bits, clear bits */
@@ -262,8 +263,13 @@ static void restart(struct net_device *dev)
262 263
263 /* Initialize function code registers for big-endian. 264 /* Initialize function code registers for big-endian.
264 */ 265 */
266#ifndef CONFIG_NOT_COHERENT_CACHE
267 W8(ep, sen_genscc.scc_rfcr, SCC_EB | SCC_GBL);
268 W8(ep, sen_genscc.scc_tfcr, SCC_EB | SCC_GBL);
269#else
265 W8(ep, sen_genscc.scc_rfcr, SCC_EB); 270 W8(ep, sen_genscc.scc_rfcr, SCC_EB);
266 W8(ep, sen_genscc.scc_tfcr, SCC_EB); 271 W8(ep, sen_genscc.scc_tfcr, SCC_EB);
272#endif
267 273
268 /* Set maximum bytes per receive buffer. 274 /* Set maximum bytes per receive buffer.
269 * This appears to be an Ethernet frame size, not the buffer 275 * This appears to be an Ethernet frame size, not the buffer
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 999d69168277..4320a983a588 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -105,6 +105,7 @@ const char gfar_driver_version[] = "1.3";
105 105
106static int gfar_enet_open(struct net_device *dev); 106static int gfar_enet_open(struct net_device *dev);
107static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev); 107static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev);
108static void gfar_reset_task(struct work_struct *work);
108static void gfar_timeout(struct net_device *dev); 109static void gfar_timeout(struct net_device *dev);
109static int gfar_close(struct net_device *dev); 110static int gfar_close(struct net_device *dev);
110struct sk_buff *gfar_new_skb(struct net_device *dev); 111struct sk_buff *gfar_new_skb(struct net_device *dev);
@@ -209,6 +210,7 @@ static int gfar_probe(struct platform_device *pdev)
209 spin_lock_init(&priv->txlock); 210 spin_lock_init(&priv->txlock);
210 spin_lock_init(&priv->rxlock); 211 spin_lock_init(&priv->rxlock);
211 spin_lock_init(&priv->bflock); 212 spin_lock_init(&priv->bflock);
213 INIT_WORK(&priv->reset_task, gfar_reset_task);
212 214
213 platform_set_drvdata(pdev, dev); 215 platform_set_drvdata(pdev, dev);
214 216
@@ -1212,6 +1214,7 @@ static int gfar_close(struct net_device *dev)
1212 1214
1213 napi_disable(&priv->napi); 1215 napi_disable(&priv->napi);
1214 1216
1217 cancel_work_sync(&priv->reset_task);
1215 stop_gfar(dev); 1218 stop_gfar(dev);
1216 1219
1217 /* Disconnect from the PHY */ 1220 /* Disconnect from the PHY */
@@ -1326,13 +1329,16 @@ static int gfar_change_mtu(struct net_device *dev, int new_mtu)
1326 return 0; 1329 return 0;
1327} 1330}
1328 1331
1329/* gfar_timeout gets called when a packet has not been 1332/* gfar_reset_task gets scheduled when a packet has not been
1330 * transmitted after a set amount of time. 1333 * transmitted after a set amount of time.
1331 * For now, assume that clearing out all the structures, and 1334 * For now, assume that clearing out all the structures, and
1332 * starting over will fix the problem. */ 1335 * starting over will fix the problem.
1333static void gfar_timeout(struct net_device *dev) 1336 */
1337static void gfar_reset_task(struct work_struct *work)
1334{ 1338{
1335 dev->stats.tx_errors++; 1339 struct gfar_private *priv = container_of(work, struct gfar_private,
1340 reset_task);
1341 struct net_device *dev = priv->dev;
1336 1342
1337 if (dev->flags & IFF_UP) { 1343 if (dev->flags & IFF_UP) {
1338 stop_gfar(dev); 1344 stop_gfar(dev);
@@ -1342,6 +1348,14 @@ static void gfar_timeout(struct net_device *dev)
1342 netif_tx_schedule_all(dev); 1348 netif_tx_schedule_all(dev);
1343} 1349}
1344 1350
1351static void gfar_timeout(struct net_device *dev)
1352{
1353 struct gfar_private *priv = netdev_priv(dev);
1354
1355 dev->stats.tx_errors++;
1356 schedule_work(&priv->reset_task);
1357}
1358
1345/* Interrupt Handler for Transmit complete */ 1359/* Interrupt Handler for Transmit complete */
1346static int gfar_clean_tx_ring(struct net_device *dev) 1360static int gfar_clean_tx_ring(struct net_device *dev)
1347{ 1361{
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h
index d59df98bd636..f46e9b63af13 100644
--- a/drivers/net/gianfar.h
+++ b/drivers/net/gianfar.h
@@ -756,6 +756,7 @@ struct gfar_private {
756 756
757 uint32_t msg_enable; 757 uint32_t msg_enable;
758 758
759 struct work_struct reset_task;
759 /* Network Statistics */ 760 /* Network Statistics */
760 struct gfar_extra_stats extra_stats; 761 struct gfar_extra_stats extra_stats;
761}; 762};
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c
index 2e720f26ca83..ccd9d9058f6d 100644
--- a/drivers/net/ibm_newemac/core.c
+++ b/drivers/net/ibm_newemac/core.c
@@ -663,9 +663,6 @@ static int emac_configure(struct emac_instance *dev)
663 if (emac_phy_gpcs(dev->phy.mode)) 663 if (emac_phy_gpcs(dev->phy.mode))
664 emac_mii_reset_phy(&dev->phy); 664 emac_mii_reset_phy(&dev->phy);
665 665
666 /* Required for Pause packet support in EMAC */
667 dev_mc_add(ndev, default_mcast_addr, sizeof(default_mcast_addr), 1);
668
669 return 0; 666 return 0;
670} 667}
671 668
@@ -1150,6 +1147,9 @@ static int emac_open(struct net_device *ndev)
1150 } else 1147 } else
1151 netif_carrier_on(dev->ndev); 1148 netif_carrier_on(dev->ndev);
1152 1149
1150 /* Required for Pause packet support in EMAC */
1151 dev_mc_add(ndev, default_mcast_addr, sizeof(default_mcast_addr), 1);
1152
1153 emac_configure(dev); 1153 emac_configure(dev);
1154 mal_poll_add(dev->mal, &dev->commac); 1154 mal_poll_add(dev->mal, &dev->commac);
1155 mal_enable_tx_channel(dev->mal, dev->mal_tx_chan); 1155 mal_enable_tx_channel(dev->mal, dev->mal_tx_chan);
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c
index a03fe1fb61ca..c2d57f836088 100644
--- a/drivers/net/ibmveth.c
+++ b/drivers/net/ibmveth.c
@@ -904,8 +904,6 @@ static int ibmveth_start_xmit(struct sk_buff *skb, struct net_device *netdev)
904 unsigned long data_dma_addr; 904 unsigned long data_dma_addr;
905 905
906 desc.fields.flags_len = IBMVETH_BUF_VALID | skb->len; 906 desc.fields.flags_len = IBMVETH_BUF_VALID | skb->len;
907 data_dma_addr = dma_map_single(&adapter->vdev->dev, skb->data,
908 skb->len, DMA_TO_DEVICE);
909 907
910 if (skb->ip_summed == CHECKSUM_PARTIAL && 908 if (skb->ip_summed == CHECKSUM_PARTIAL &&
911 ip_hdr(skb)->protocol != IPPROTO_TCP && skb_checksum_help(skb)) { 909 ip_hdr(skb)->protocol != IPPROTO_TCP && skb_checksum_help(skb)) {
@@ -924,6 +922,8 @@ static int ibmveth_start_xmit(struct sk_buff *skb, struct net_device *netdev)
924 buf[1] = 0; 922 buf[1] = 0;
925 } 923 }
926 924
925 data_dma_addr = dma_map_single(&adapter->vdev->dev, skb->data,
926 skb->len, DMA_TO_DEVICE);
927 if (dma_mapping_error(&adapter->vdev->dev, data_dma_addr)) { 927 if (dma_mapping_error(&adapter->vdev->dev, data_dma_addr)) {
928 if (!firmware_has_feature(FW_FEATURE_CMO)) 928 if (!firmware_has_feature(FW_FEATURE_CMO))
929 ibmveth_error_printk("tx: unable to map xmit buffer\n"); 929 ibmveth_error_printk("tx: unable to map xmit buffer\n");
@@ -932,6 +932,7 @@ static int ibmveth_start_xmit(struct sk_buff *skb, struct net_device *netdev)
932 desc.fields.address = adapter->bounce_buffer_dma; 932 desc.fields.address = adapter->bounce_buffer_dma;
933 tx_map_failed++; 933 tx_map_failed++;
934 used_bounce = 1; 934 used_bounce = 1;
935 wmb();
935 } else 936 } else
936 desc.fields.address = data_dma_addr; 937 desc.fields.address = data_dma_addr;
937 938
diff --git a/drivers/net/igb/e1000_82575.c b/drivers/net/igb/e1000_82575.c
index bb823acc7443..f5e2e7235fcb 100644
--- a/drivers/net/igb/e1000_82575.c
+++ b/drivers/net/igb/e1000_82575.c
@@ -87,7 +87,6 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw)
87 case E1000_DEV_ID_82576: 87 case E1000_DEV_ID_82576:
88 case E1000_DEV_ID_82576_FIBER: 88 case E1000_DEV_ID_82576_FIBER:
89 case E1000_DEV_ID_82576_SERDES: 89 case E1000_DEV_ID_82576_SERDES:
90 case E1000_DEV_ID_82576_QUAD_COPPER:
91 mac->type = e1000_82576; 90 mac->type = e1000_82576;
92 break; 91 break;
93 default: 92 default:
diff --git a/drivers/net/igb/e1000_hw.h b/drivers/net/igb/e1000_hw.h
index a65ccc3095c3..99504a600a80 100644
--- a/drivers/net/igb/e1000_hw.h
+++ b/drivers/net/igb/e1000_hw.h
@@ -41,7 +41,6 @@ struct e1000_hw;
41#define E1000_DEV_ID_82576 0x10C9 41#define E1000_DEV_ID_82576 0x10C9
42#define E1000_DEV_ID_82576_FIBER 0x10E6 42#define E1000_DEV_ID_82576_FIBER 0x10E6
43#define E1000_DEV_ID_82576_SERDES 0x10E7 43#define E1000_DEV_ID_82576_SERDES 0x10E7
44#define E1000_DEV_ID_82576_QUAD_COPPER 0x10E8
45#define E1000_DEV_ID_82575EB_COPPER 0x10A7 44#define E1000_DEV_ID_82575EB_COPPER 0x10A7
46#define E1000_DEV_ID_82575EB_FIBER_SERDES 0x10A9 45#define E1000_DEV_ID_82575EB_FIBER_SERDES 0x10A9
47#define E1000_DEV_ID_82575GB_QUAD_COPPER 0x10D6 46#define E1000_DEV_ID_82575GB_QUAD_COPPER 0x10D6
diff --git a/drivers/net/igb/igb_ethtool.c b/drivers/net/igb/igb_ethtool.c
index 11aee1309951..58906c984be9 100644
--- a/drivers/net/igb/igb_ethtool.c
+++ b/drivers/net/igb/igb_ethtool.c
@@ -373,13 +373,17 @@ static void igb_get_regs(struct net_device *netdev,
373 regs_buff[12] = rd32(E1000_EECD); 373 regs_buff[12] = rd32(E1000_EECD);
374 374
375 /* Interrupt */ 375 /* Interrupt */
376 regs_buff[13] = rd32(E1000_EICR); 376 /* Reading EICS for EICR because they read the
377 * same but EICS does not clear on read */
378 regs_buff[13] = rd32(E1000_EICS);
377 regs_buff[14] = rd32(E1000_EICS); 379 regs_buff[14] = rd32(E1000_EICS);
378 regs_buff[15] = rd32(E1000_EIMS); 380 regs_buff[15] = rd32(E1000_EIMS);
379 regs_buff[16] = rd32(E1000_EIMC); 381 regs_buff[16] = rd32(E1000_EIMC);
380 regs_buff[17] = rd32(E1000_EIAC); 382 regs_buff[17] = rd32(E1000_EIAC);
381 regs_buff[18] = rd32(E1000_EIAM); 383 regs_buff[18] = rd32(E1000_EIAM);
382 regs_buff[19] = rd32(E1000_ICR); 384 /* Reading ICS for ICR because they read the
385 * same but ICS does not clear on read */
386 regs_buff[19] = rd32(E1000_ICS);
383 regs_buff[20] = rd32(E1000_ICS); 387 regs_buff[20] = rd32(E1000_ICS);
384 regs_buff[21] = rd32(E1000_IMS); 388 regs_buff[21] = rd32(E1000_IMS);
385 regs_buff[22] = rd32(E1000_IMC); 389 regs_buff[22] = rd32(E1000_IMC);
@@ -1746,15 +1750,6 @@ static int igb_wol_exclusion(struct igb_adapter *adapter,
1746 /* return success for non excluded adapter ports */ 1750 /* return success for non excluded adapter ports */
1747 retval = 0; 1751 retval = 0;
1748 break; 1752 break;
1749 case E1000_DEV_ID_82576_QUAD_COPPER:
1750 /* quad port adapters only support WoL on port A */
1751 if (!(adapter->flags & IGB_FLAG_QUAD_PORT_A)) {
1752 wol->supported = 0;
1753 break;
1754 }
1755 /* return success for non excluded adapter ports */
1756 retval = 0;
1757 break;
1758 default: 1753 default:
1759 /* dual port cards only support WoL on port A from now on 1754 /* dual port cards only support WoL on port A from now on
1760 * unless it was enabled in the eeprom for port B 1755 * unless it was enabled in the eeprom for port B
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index 8f66e15ec8d6..634c4c9d87be 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -61,7 +61,6 @@ static struct pci_device_id igb_pci_tbl[] = {
61 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576), board_82575 }, 61 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576), board_82575 },
62 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_FIBER), board_82575 }, 62 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_FIBER), board_82575 },
63 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_SERDES), board_82575 }, 63 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_SERDES), board_82575 },
64 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_QUAD_COPPER), board_82575 },
65 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82575EB_COPPER), board_82575 }, 64 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82575EB_COPPER), board_82575 },
66 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82575EB_FIBER_SERDES), board_82575 }, 65 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82575EB_FIBER_SERDES), board_82575 },
67 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82575GB_QUAD_COPPER), board_82575 }, 66 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82575GB_QUAD_COPPER), board_82575 },
@@ -521,7 +520,7 @@ static void igb_set_interrupt_capability(struct igb_adapter *adapter)
521 adapter->msix_entries, 520 adapter->msix_entries,
522 numvecs); 521 numvecs);
523 if (err == 0) 522 if (err == 0)
524 return; 523 goto out;
525 524
526 igb_reset_interrupt_capability(adapter); 525 igb_reset_interrupt_capability(adapter);
527 526
@@ -531,7 +530,7 @@ msi_only:
531 adapter->num_tx_queues = 1; 530 adapter->num_tx_queues = 1;
532 if (!pci_enable_msi(adapter->pdev)) 531 if (!pci_enable_msi(adapter->pdev))
533 adapter->flags |= IGB_FLAG_HAS_MSI; 532 adapter->flags |= IGB_FLAG_HAS_MSI;
534 533out:
535 /* Notify the stack of the (possibly) reduced Tx Queue count. */ 534 /* Notify the stack of the (possibly) reduced Tx Queue count. */
536 adapter->netdev->real_num_tx_queues = adapter->num_tx_queues; 535 adapter->netdev->real_num_tx_queues = adapter->num_tx_queues;
537 return; 536 return;
@@ -1217,16 +1216,6 @@ static int __devinit igb_probe(struct pci_dev *pdev,
1217 if (rd32(E1000_STATUS) & E1000_STATUS_FUNC_1) 1216 if (rd32(E1000_STATUS) & E1000_STATUS_FUNC_1)
1218 adapter->eeprom_wol = 0; 1217 adapter->eeprom_wol = 0;
1219 break; 1218 break;
1220 case E1000_DEV_ID_82576_QUAD_COPPER:
1221 /* if quad port adapter, disable WoL on all but port A */
1222 if (global_quad_port_a != 0)
1223 adapter->eeprom_wol = 0;
1224 else
1225 adapter->flags |= IGB_FLAG_QUAD_PORT_A;
1226 /* Reset for multiple quad port adapters */
1227 if (++global_quad_port_a == 4)
1228 global_quad_port_a = 0;
1229 break;
1230 } 1219 }
1231 1220
1232 /* initialize the wol settings based on the eeprom settings */ 1221 /* initialize the wol settings based on the eeprom settings */
@@ -2290,7 +2279,9 @@ static void igb_watchdog_task(struct work_struct *work)
2290 struct igb_ring *tx_ring = adapter->tx_ring; 2279 struct igb_ring *tx_ring = adapter->tx_ring;
2291 struct e1000_mac_info *mac = &adapter->hw.mac; 2280 struct e1000_mac_info *mac = &adapter->hw.mac;
2292 u32 link; 2281 u32 link;
2282 u32 eics = 0;
2293 s32 ret_val; 2283 s32 ret_val;
2284 int i;
2294 2285
2295 if ((netif_carrier_ok(netdev)) && 2286 if ((netif_carrier_ok(netdev)) &&
2296 (rd32(E1000_STATUS) & E1000_STATUS_LU)) 2287 (rd32(E1000_STATUS) & E1000_STATUS_LU))
@@ -2392,7 +2383,13 @@ link_up:
2392 } 2383 }
2393 2384
2394 /* Cause software interrupt to ensure rx ring is cleaned */ 2385 /* Cause software interrupt to ensure rx ring is cleaned */
2395 wr32(E1000_ICS, E1000_ICS_RXDMT0); 2386 if (adapter->msix_entries) {
2387 for (i = 0; i < adapter->num_rx_queues; i++)
2388 eics |= adapter->rx_ring[i].eims_value;
2389 wr32(E1000_EICS, eics);
2390 } else {
2391 wr32(E1000_ICS, E1000_ICS_RXDMT0);
2392 }
2396 2393
2397 /* Force detection of hung controller every watchdog period */ 2394 /* Force detection of hung controller every watchdog period */
2398 tx_ring->detect_tx_hung = true; 2395 tx_ring->detect_tx_hung = true;
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 34bca16d48a6..a417be7f8be5 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -1636,16 +1636,17 @@ static void ixgbe_set_multi(struct net_device *netdev)
1636 struct ixgbe_hw *hw = &adapter->hw; 1636 struct ixgbe_hw *hw = &adapter->hw;
1637 struct dev_mc_list *mc_ptr; 1637 struct dev_mc_list *mc_ptr;
1638 u8 *mta_list; 1638 u8 *mta_list;
1639 u32 fctrl; 1639 u32 fctrl, vlnctrl;
1640 int i; 1640 int i;
1641 1641
1642 /* Check for Promiscuous and All Multicast modes */ 1642 /* Check for Promiscuous and All Multicast modes */
1643 1643
1644 fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL); 1644 fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL);
1645 vlnctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL);
1645 1646
1646 if (netdev->flags & IFF_PROMISC) { 1647 if (netdev->flags & IFF_PROMISC) {
1647 fctrl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); 1648 fctrl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE);
1648 fctrl &= ~IXGBE_VLNCTRL_VFE; 1649 vlnctrl &= ~IXGBE_VLNCTRL_VFE;
1649 } else { 1650 } else {
1650 if (netdev->flags & IFF_ALLMULTI) { 1651 if (netdev->flags & IFF_ALLMULTI) {
1651 fctrl |= IXGBE_FCTRL_MPE; 1652 fctrl |= IXGBE_FCTRL_MPE;
@@ -1653,10 +1654,11 @@ static void ixgbe_set_multi(struct net_device *netdev)
1653 } else { 1654 } else {
1654 fctrl &= ~(IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); 1655 fctrl &= ~(IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE);
1655 } 1656 }
1656 fctrl |= IXGBE_VLNCTRL_VFE; 1657 vlnctrl |= IXGBE_VLNCTRL_VFE;
1657 } 1658 }
1658 1659
1659 IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl); 1660 IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl);
1661 IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, vlnctrl);
1660 1662
1661 if (netdev->mc_count) { 1663 if (netdev->mc_count) {
1662 mta_list = kcalloc(netdev->mc_count, ETH_ALEN, GFP_ATOMIC); 1664 mta_list = kcalloc(netdev->mc_count, ETH_ALEN, GFP_ATOMIC);
@@ -2302,6 +2304,12 @@ static int __devinit ixgbe_set_interrupt_capability(struct ixgbe_adapter
2302 int vector, v_budget; 2304 int vector, v_budget;
2303 2305
2304 /* 2306 /*
2307 * Set the default interrupt throttle rate.
2308 */
2309 adapter->rx_eitr = (1000000 / IXGBE_DEFAULT_ITR_RX_USECS);
2310 adapter->tx_eitr = (1000000 / IXGBE_DEFAULT_ITR_TX_USECS);
2311
2312 /*
2305 * It's easy to be greedy for MSI-X vectors, but it really 2313 * It's easy to be greedy for MSI-X vectors, but it really
2306 * doesn't do us much good if we have a lot more vectors 2314 * doesn't do us much good if we have a lot more vectors
2307 * than CPU's. So let's be conservative and only ask for 2315 * than CPU's. So let's be conservative and only ask for
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 46819af3b062..0a18b9e96da1 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -55,7 +55,7 @@
55#include <asm/system.h> 55#include <asm/system.h>
56 56
57static char mv643xx_eth_driver_name[] = "mv643xx_eth"; 57static char mv643xx_eth_driver_name[] = "mv643xx_eth";
58static char mv643xx_eth_driver_version[] = "1.2"; 58static char mv643xx_eth_driver_version[] = "1.3";
59 59
60#define MV643XX_ETH_CHECKSUM_OFFLOAD_TX 60#define MV643XX_ETH_CHECKSUM_OFFLOAD_TX
61#define MV643XX_ETH_NAPI 61#define MV643XX_ETH_NAPI
@@ -474,11 +474,19 @@ static void rxq_refill(struct rx_queue *rxq)
474 /* 474 /*
475 * Reserve 2+14 bytes for an ethernet header (the 475 * Reserve 2+14 bytes for an ethernet header (the
476 * hardware automatically prepends 2 bytes of dummy 476 * hardware automatically prepends 2 bytes of dummy
477 * data to each received packet), 4 bytes for a VLAN 477 * data to each received packet), 16 bytes for up to
478 * header, and 4 bytes for the trailing FCS -- 24 478 * four VLAN tags, and 4 bytes for the trailing FCS
479 * bytes total. 479 * -- 36 bytes total.
480 */ 480 */
481 skb_size = mp->dev->mtu + 24; 481 skb_size = mp->dev->mtu + 36;
482
483 /*
484 * Make sure that the skb size is a multiple of 8
485 * bytes, as the lower three bits of the receive
486 * descriptor's buffer size field are ignored by
487 * the hardware.
488 */
489 skb_size = (skb_size + 7) & ~7;
482 490
483 skb = dev_alloc_skb(skb_size + dma_get_cache_alignment() - 1); 491 skb = dev_alloc_skb(skb_size + dma_get_cache_alignment() - 1);
484 if (skb == NULL) 492 if (skb == NULL)
@@ -509,10 +517,8 @@ static void rxq_refill(struct rx_queue *rxq)
509 skb_reserve(skb, 2); 517 skb_reserve(skb, 2);
510 } 518 }
511 519
512 if (rxq->rx_desc_count != rxq->rx_ring_size) { 520 if (rxq->rx_desc_count != rxq->rx_ring_size)
513 rxq->rx_oom.expires = jiffies + (HZ / 10); 521 mod_timer(&rxq->rx_oom, jiffies + (HZ / 10));
514 add_timer(&rxq->rx_oom);
515 }
516 522
517 spin_unlock_irqrestore(&mp->lock, flags); 523 spin_unlock_irqrestore(&mp->lock, flags);
518} 524}
@@ -529,7 +535,7 @@ static int rxq_process(struct rx_queue *rxq, int budget)
529 int rx; 535 int rx;
530 536
531 rx = 0; 537 rx = 0;
532 while (rx < budget) { 538 while (rx < budget && rxq->rx_desc_count) {
533 struct rx_desc *rx_desc; 539 struct rx_desc *rx_desc;
534 unsigned int cmd_sts; 540 unsigned int cmd_sts;
535 struct sk_buff *skb; 541 struct sk_buff *skb;
@@ -554,7 +560,7 @@ static int rxq_process(struct rx_queue *rxq, int budget)
554 spin_unlock_irqrestore(&mp->lock, flags); 560 spin_unlock_irqrestore(&mp->lock, flags);
555 561
556 dma_unmap_single(NULL, rx_desc->buf_ptr + 2, 562 dma_unmap_single(NULL, rx_desc->buf_ptr + 2,
557 mp->dev->mtu + 24, DMA_FROM_DEVICE); 563 rx_desc->buf_size, DMA_FROM_DEVICE);
558 rxq->rx_desc_count--; 564 rxq->rx_desc_count--;
559 rx++; 565 rx++;
560 566
@@ -636,9 +642,9 @@ static int mv643xx_eth_poll(struct napi_struct *napi, int budget)
636 txq_reclaim(mp->txq + i, 0); 642 txq_reclaim(mp->txq + i, 0);
637 643
638 if (netif_carrier_ok(mp->dev)) { 644 if (netif_carrier_ok(mp->dev)) {
639 spin_lock(&mp->lock); 645 spin_lock_irq(&mp->lock);
640 __txq_maybe_wake(mp->txq + mp->txq_primary); 646 __txq_maybe_wake(mp->txq + mp->txq_primary);
641 spin_unlock(&mp->lock); 647 spin_unlock_irq(&mp->lock);
642 } 648 }
643 } 649 }
644#endif 650#endif
@@ -650,8 +656,6 @@ static int mv643xx_eth_poll(struct napi_struct *napi, int budget)
650 656
651 if (rx < budget) { 657 if (rx < budget) {
652 netif_rx_complete(mp->dev, napi); 658 netif_rx_complete(mp->dev, napi);
653 wrl(mp, INT_CAUSE(mp->port_num), 0);
654 wrl(mp, INT_CAUSE_EXT(mp->port_num), 0);
655 wrl(mp, INT_MASK(mp->port_num), INT_TX_END | INT_RX | INT_EXT); 659 wrl(mp, INT_MASK(mp->port_num), INT_TX_END | INT_RX | INT_EXT);
656 } 660 }
657 661
@@ -1796,6 +1800,7 @@ static irqreturn_t mv643xx_eth_irq(int irq, void *dev_id)
1796 */ 1800 */
1797#ifdef MV643XX_ETH_NAPI 1801#ifdef MV643XX_ETH_NAPI
1798 if (int_cause & INT_RX) { 1802 if (int_cause & INT_RX) {
1803 wrl(mp, INT_CAUSE(mp->port_num), ~(int_cause & INT_RX));
1799 wrl(mp, INT_MASK(mp->port_num), 0x00000000); 1804 wrl(mp, INT_MASK(mp->port_num), 0x00000000);
1800 rdl(mp, INT_MASK(mp->port_num)); 1805 rdl(mp, INT_MASK(mp->port_num));
1801 1806
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index 54cd89cb0838..d6524db321af 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -75,7 +75,7 @@
75#include "myri10ge_mcp.h" 75#include "myri10ge_mcp.h"
76#include "myri10ge_mcp_gen_header.h" 76#include "myri10ge_mcp_gen_header.h"
77 77
78#define MYRI10GE_VERSION_STR "1.3.99-1.347" 78#define MYRI10GE_VERSION_STR "1.4.3-1.358"
79 79
80MODULE_DESCRIPTION("Myricom 10G driver (10GbE)"); 80MODULE_DESCRIPTION("Myricom 10G driver (10GbE)");
81MODULE_AUTHOR("Maintainer: help@myri.com"); 81MODULE_AUTHOR("Maintainer: help@myri.com");
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 32bb47adbe39..008fd6618a5f 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -359,16 +359,6 @@ static void netxen_pcie_strap_init(struct netxen_adapter *adapter)
359 int i, pos; 359 int i, pos;
360 struct pci_dev *pdev; 360 struct pci_dev *pdev;
361 361
362 pdev = pci_get_device(0x1166, 0x0140, NULL);
363 if (pdev) {
364 pci_dev_put(pdev);
365 adapter->hw_read_wx(adapter,
366 NETXEN_PCIE_REG(PCIE_TGT_SPLIT_CHICKEN), &chicken, 4);
367 chicken |= 0x4000;
368 adapter->hw_write_wx(adapter,
369 NETXEN_PCIE_REG(PCIE_TGT_SPLIT_CHICKEN), &chicken, 4);
370 }
371
372 pdev = adapter->pdev; 362 pdev = adapter->pdev;
373 363
374 adapter->hw_read_wx(adapter, 364 adapter->hw_read_wx(adapter,
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index 3f682d49a4e6..52bf11b73c6e 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -784,6 +784,7 @@ static struct pcmcia_device_id axnet_ids[] = {
784 PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega FEther PCC-TXD", 0x5261440f, 0x436768c5), 784 PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega FEther PCC-TXD", 0x5261440f, 0x436768c5),
785 PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega FEtherII PCC-TXD", 0x5261440f, 0x730df72e), 785 PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega FEtherII PCC-TXD", 0x5261440f, 0x730df72e),
786 PCMCIA_DEVICE_PROD_ID12("Dynalink", "L100C16", 0x55632fd5, 0x66bc2a90), 786 PCMCIA_DEVICE_PROD_ID12("Dynalink", "L100C16", 0x55632fd5, 0x66bc2a90),
787 PCMCIA_DEVICE_PROD_ID12("IO DATA", "ETXPCM", 0x547e66dc, 0x233adac2),
787 PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 PC Card (PCMPC100 V3)", 0x0733cc81, 0x232019a8), 788 PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 PC Card (PCMPC100 V3)", 0x0733cc81, 0x232019a8),
788 PCMCIA_DEVICE_PROD_ID12("MELCO", "LPC3-TX", 0x481e0094, 0xf91af609), 789 PCMCIA_DEVICE_PROD_ID12("MELCO", "LPC3-TX", 0x481e0094, 0xf91af609),
789 PCMCIA_DEVICE_PROD_ID12("PCMCIA", "100BASE", 0x281f1c5d, 0x7c2add04), 790 PCMCIA_DEVICE_PROD_ID12("PCMCIA", "100BASE", 0x281f1c5d, 0x7c2add04),
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index 2d4c4ad89b8d..ebc1ae6bcbe5 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -1626,6 +1626,7 @@ static struct pcmcia_device_id pcnet_ids[] = {
1626 PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega EtherII PCC-TD", 0x5261440f, 0xc49bd73d), 1626 PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega EtherII PCC-TD", 0x5261440f, 0xc49bd73d),
1627 PCMCIA_DEVICE_PROD_ID12("Corega K.K.", "corega EtherII PCC-TD", 0xd4fdcbd8, 0xc49bd73d), 1627 PCMCIA_DEVICE_PROD_ID12("Corega K.K.", "corega EtherII PCC-TD", 0xd4fdcbd8, 0xc49bd73d),
1628 PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega Ether PCC-T", 0x5261440f, 0x6705fcaa), 1628 PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega Ether PCC-T", 0x5261440f, 0x6705fcaa),
1629 PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega Ether PCC-TD", 0x5261440f, 0x47d5ca83),
1629 PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega FastEther PCC-TX", 0x5261440f, 0x485e85d9), 1630 PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega FastEther PCC-TX", 0x5261440f, 0x485e85d9),
1630 PCMCIA_DEVICE_PROD_ID12("Corega,K.K.", "Ethernet LAN Card", 0x110d26d9, 0x9fd2f0a2), 1631 PCMCIA_DEVICE_PROD_ID12("Corega,K.K.", "Ethernet LAN Card", 0x110d26d9, 0x9fd2f0a2),
1631 PCMCIA_DEVICE_PROD_ID12("corega,K.K.", "Ethernet LAN Card", 0x9791a90e, 0x9fd2f0a2), 1632 PCMCIA_DEVICE_PROD_ID12("corega,K.K.", "Ethernet LAN Card", 0x9791a90e, 0x9fd2f0a2),
@@ -1737,7 +1738,6 @@ static struct pcmcia_device_id pcnet_ids[] = {
1737 PCMCIA_DEVICE_PROD_ID1("CyQ've 10 Base-T LAN CARD", 0x94faf360), 1738 PCMCIA_DEVICE_PROD_ID1("CyQ've 10 Base-T LAN CARD", 0x94faf360),
1738 PCMCIA_DEVICE_PROD_ID1("EP-210 PCMCIA LAN CARD.", 0x8850b4de), 1739 PCMCIA_DEVICE_PROD_ID1("EP-210 PCMCIA LAN CARD.", 0x8850b4de),
1739 PCMCIA_DEVICE_PROD_ID1("ETHER-C16", 0x06a8514f), 1740 PCMCIA_DEVICE_PROD_ID1("ETHER-C16", 0x06a8514f),
1740 PCMCIA_DEVICE_PROD_ID1("IC-CARD", 0x60cb09a6),
1741 PCMCIA_DEVICE_PROD_ID1("NE2000 Compatible", 0x75b8ad5a), 1741 PCMCIA_DEVICE_PROD_ID1("NE2000 Compatible", 0x75b8ad5a),
1742 PCMCIA_DEVICE_PROD_ID2("EN-6200P2", 0xa996d078), 1742 PCMCIA_DEVICE_PROD_ID2("EN-6200P2", 0xa996d078),
1743 /* too generic! */ 1743 /* too generic! */
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index a3e3895e5032..0f6f9747d255 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -2792,7 +2792,7 @@ static int rtl8169_rx_interrupt(struct net_device *dev,
2792 pkt_size, PCI_DMA_FROMDEVICE); 2792 pkt_size, PCI_DMA_FROMDEVICE);
2793 rtl8169_mark_to_asic(desc, tp->rx_buf_sz); 2793 rtl8169_mark_to_asic(desc, tp->rx_buf_sz);
2794 } else { 2794 } else {
2795 pci_unmap_single(pdev, addr, pkt_size, 2795 pci_unmap_single(pdev, addr, tp->rx_buf_sz,
2796 PCI_DMA_FROMDEVICE); 2796 PCI_DMA_FROMDEVICE);
2797 tp->Rx_skbuff[entry] = NULL; 2797 tp->Rx_skbuff[entry] = NULL;
2798 } 2798 }
diff --git a/drivers/net/skfp/ess.c b/drivers/net/skfp/ess.c
index 889f98724610..a85efcfd9d0e 100644
--- a/drivers/net/skfp/ess.c
+++ b/drivers/net/skfp/ess.c
@@ -510,7 +510,7 @@ static void ess_send_response(struct s_smc *smc, struct smt_header *sm,
510 chg->path.para.p_type = SMT_P320B ; 510 chg->path.para.p_type = SMT_P320B ;
511 chg->path.para.p_len = sizeof(struct smt_p_320b) - PARA_LEN ; 511 chg->path.para.p_len = sizeof(struct smt_p_320b) - PARA_LEN ;
512 chg->path.mib_index = SBAPATHINDEX ; 512 chg->path.mib_index = SBAPATHINDEX ;
513 chg->path.path_pad = (u_short)NULL ; 513 chg->path.path_pad = 0;
514 chg->path.path_index = PRIMARY_RING ; 514 chg->path.path_index = PRIMARY_RING ;
515 515
516 /* set P320F */ 516 /* set P320F */
@@ -606,7 +606,7 @@ static void ess_send_alc_req(struct s_smc *smc)
606 req->path.para.p_type = SMT_P320B ; 606 req->path.para.p_type = SMT_P320B ;
607 req->path.para.p_len = sizeof(struct smt_p_320b) - PARA_LEN ; 607 req->path.para.p_len = sizeof(struct smt_p_320b) - PARA_LEN ;
608 req->path.mib_index = SBAPATHINDEX ; 608 req->path.mib_index = SBAPATHINDEX ;
609 req->path.path_pad = (u_short)NULL ; 609 req->path.path_pad = 0;
610 req->path.path_index = PRIMARY_RING ; 610 req->path.path_index = PRIMARY_RING ;
611 611
612 /* set P0017 */ 612 /* set P0017 */
@@ -636,7 +636,7 @@ static void ess_send_alc_req(struct s_smc *smc)
636 /* set P19 */ 636 /* set P19 */
637 req->a_addr.para.p_type = SMT_P0019 ; 637 req->a_addr.para.p_type = SMT_P0019 ;
638 req->a_addr.para.p_len = sizeof(struct smt_p_0019) - PARA_LEN ; 638 req->a_addr.para.p_len = sizeof(struct smt_p_0019) - PARA_LEN ;
639 req->a_addr.sba_pad = (u_short)NULL ; 639 req->a_addr.sba_pad = 0;
640 req->a_addr.alloc_addr = null_addr ; 640 req->a_addr.alloc_addr = null_addr ;
641 641
642 /* set P1A */ 642 /* set P1A */
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
index 2040965d7724..24768c10cadb 100644
--- a/drivers/net/smc91x.c
+++ b/drivers/net/smc91x.c
@@ -2255,7 +2255,7 @@ static int smc_drv_remove(struct platform_device *pdev)
2255 2255
2256 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-regs"); 2256 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-regs");
2257 if (!res) 2257 if (!res)
2258 platform_get_resource(pdev, IORESOURCE_MEM, 0); 2258 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
2259 release_mem_region(res->start, SMC_IO_EXTENT); 2259 release_mem_region(res->start, SMC_IO_EXTENT);
2260 2260
2261 free_netdev(ndev); 2261 free_netdev(ndev);
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index 1b7cac77159e..6e42b5a8c22b 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -397,7 +397,7 @@ static const struct usb_device_id hso_ids[] = {
397 {default_port_device(0x0af0, 0xc031)}, /* Icon-Edge */ 397 {default_port_device(0x0af0, 0xc031)}, /* Icon-Edge */
398 {icon321_port_device(0x0af0, 0xd013)}, /* Module HSxPA */ 398 {icon321_port_device(0x0af0, 0xd013)}, /* Module HSxPA */
399 {icon321_port_device(0x0af0, 0xd031)}, /* Icon-321 */ 399 {icon321_port_device(0x0af0, 0xd031)}, /* Icon-321 */
400 {default_port_device(0x0af0, 0xd033)}, /* Icon-322 */ 400 {icon321_port_device(0x0af0, 0xd033)}, /* Icon-322 */
401 {USB_DEVICE(0x0af0, 0x7301)}, /* GE40x */ 401 {USB_DEVICE(0x0af0, 0x7301)}, /* GE40x */
402 {USB_DEVICE(0x0af0, 0x7361)}, /* GE40x */ 402 {USB_DEVICE(0x0af0, 0x7361)}, /* GE40x */
403 {USB_DEVICE(0x0af0, 0x7401)}, /* GI 0401 */ 403 {USB_DEVICE(0x0af0, 0x7401)}, /* GI 0401 */
@@ -2613,6 +2613,7 @@ static int hso_resume(struct usb_interface *iface)
2613 "Transmitting lingering data\n"); 2613 "Transmitting lingering data\n");
2614 hso_net_start_xmit(hso_net->skb_tx_buf, 2614 hso_net_start_xmit(hso_net->skb_tx_buf,
2615 hso_net->net); 2615 hso_net->net);
2616 hso_net->skb_tx_buf = NULL;
2616 } 2617 }
2617 result = hso_start_net_device(network_table[i]); 2618 result = hso_start_net_device(network_table[i]);
2618 if (result) 2619 if (result)
diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c
index c3d119f997f5..ca9d00c1194e 100644
--- a/drivers/net/usb/mcs7830.c
+++ b/drivers/net/usb/mcs7830.c
@@ -46,6 +46,10 @@
46 46
47#define MCS7830_VENDOR_ID 0x9710 47#define MCS7830_VENDOR_ID 0x9710
48#define MCS7830_PRODUCT_ID 0x7830 48#define MCS7830_PRODUCT_ID 0x7830
49#define MCS7730_PRODUCT_ID 0x7730
50
51#define SITECOM_VENDOR_ID 0x0DF6
52#define LN_030_PRODUCT_ID 0x0021
49 53
50#define MCS7830_MII_ADVERTISE (ADVERTISE_PAUSE_CAP | ADVERTISE_100FULL | \ 54#define MCS7830_MII_ADVERTISE (ADVERTISE_PAUSE_CAP | ADVERTISE_100FULL | \
51 ADVERTISE_100HALF | ADVERTISE_10FULL | \ 55 ADVERTISE_100HALF | ADVERTISE_10FULL | \
@@ -442,6 +446,29 @@ static struct ethtool_ops mcs7830_ethtool_ops = {
442 .nway_reset = usbnet_nway_reset, 446 .nway_reset = usbnet_nway_reset,
443}; 447};
444 448
449static int mcs7830_set_mac_address(struct net_device *netdev, void *p)
450{
451 int ret;
452 struct usbnet *dev = netdev_priv(netdev);
453 struct sockaddr *addr = p;
454
455 if (netif_running(netdev))
456 return -EBUSY;
457
458 if (!is_valid_ether_addr(addr->sa_data))
459 return -EINVAL;
460
461 memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
462
463 ret = mcs7830_set_reg(dev, HIF_REG_ETHERNET_ADDR, ETH_ALEN,
464 netdev->dev_addr);
465
466 if (ret < 0)
467 return ret;
468
469 return 0;
470}
471
445static int mcs7830_bind(struct usbnet *dev, struct usb_interface *udev) 472static int mcs7830_bind(struct usbnet *dev, struct usb_interface *udev)
446{ 473{
447 struct net_device *net = dev->net; 474 struct net_device *net = dev->net;
@@ -455,6 +482,7 @@ static int mcs7830_bind(struct usbnet *dev, struct usb_interface *udev)
455 net->ethtool_ops = &mcs7830_ethtool_ops; 482 net->ethtool_ops = &mcs7830_ethtool_ops;
456 net->set_multicast_list = mcs7830_set_multicast; 483 net->set_multicast_list = mcs7830_set_multicast;
457 mcs7830_set_multicast(net); 484 mcs7830_set_multicast(net);
485 net->set_mac_address = mcs7830_set_mac_address;
458 486
459 /* reserve space for the status byte on rx */ 487 /* reserve space for the status byte on rx */
460 dev->rx_urb_size = ETH_FRAME_LEN + 1; 488 dev->rx_urb_size = ETH_FRAME_LEN + 1;
@@ -491,7 +519,16 @@ static int mcs7830_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
491} 519}
492 520
493static const struct driver_info moschip_info = { 521static const struct driver_info moschip_info = {
494 .description = "MOSCHIP 7830 usb-NET adapter", 522 .description = "MOSCHIP 7830/7730 usb-NET adapter",
523 .bind = mcs7830_bind,
524 .rx_fixup = mcs7830_rx_fixup,
525 .flags = FLAG_ETHER,
526 .in = 1,
527 .out = 2,
528};
529
530static const struct driver_info sitecom_info = {
531 .description = "Sitecom LN-30 usb-NET adapter",
495 .bind = mcs7830_bind, 532 .bind = mcs7830_bind,
496 .rx_fixup = mcs7830_rx_fixup, 533 .rx_fixup = mcs7830_rx_fixup,
497 .flags = FLAG_ETHER, 534 .flags = FLAG_ETHER,
@@ -504,6 +541,14 @@ static const struct usb_device_id products[] = {
504 USB_DEVICE(MCS7830_VENDOR_ID, MCS7830_PRODUCT_ID), 541 USB_DEVICE(MCS7830_VENDOR_ID, MCS7830_PRODUCT_ID),
505 .driver_info = (unsigned long) &moschip_info, 542 .driver_info = (unsigned long) &moschip_info,
506 }, 543 },
544 {
545 USB_DEVICE(MCS7830_VENDOR_ID, MCS7730_PRODUCT_ID),
546 .driver_info = (unsigned long) &moschip_info,
547 },
548 {
549 USB_DEVICE(SITECOM_VENDOR_ID, LN_030_PRODUCT_ID),
550 .driver_info = (unsigned long) &sitecom_info,
551 },
507 {}, 552 {},
508}; 553};
509MODULE_DEVICE_TABLE(usb, products); 554MODULE_DEVICE_TABLE(usb, products);
diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
index a84ba487c713..8c19307e5040 100644
--- a/drivers/net/usb/pegasus.c
+++ b/drivers/net/usb/pegasus.c
@@ -117,7 +117,7 @@ static void ctrl_callback(struct urb *urb)
117 case -ENOENT: 117 case -ENOENT:
118 break; 118 break;
119 default: 119 default:
120 if (netif_msg_drv(pegasus)) 120 if (netif_msg_drv(pegasus) && printk_ratelimit())
121 dev_dbg(&pegasus->intf->dev, "%s, status %d\n", 121 dev_dbg(&pegasus->intf->dev, "%s, status %d\n",
122 __FUNCTION__, urb->status); 122 __FUNCTION__, urb->status);
123 } 123 }
@@ -166,7 +166,7 @@ static int get_registers(pegasus_t * pegasus, __u16 indx, __u16 size,
166 set_current_state(TASK_RUNNING); 166 set_current_state(TASK_RUNNING);
167 if (ret == -ENODEV) 167 if (ret == -ENODEV)
168 netif_device_detach(pegasus->net); 168 netif_device_detach(pegasus->net);
169 if (netif_msg_drv(pegasus)) 169 if (netif_msg_drv(pegasus) && printk_ratelimit())
170 dev_err(&pegasus->intf->dev, "%s, status %d\n", 170 dev_err(&pegasus->intf->dev, "%s, status %d\n",
171 __FUNCTION__, ret); 171 __FUNCTION__, ret);
172 goto out; 172 goto out;
@@ -275,7 +275,7 @@ static int set_register(pegasus_t * pegasus, __u16 indx, __u8 data)
275 if ((ret = usb_submit_urb(pegasus->ctrl_urb, GFP_ATOMIC))) { 275 if ((ret = usb_submit_urb(pegasus->ctrl_urb, GFP_ATOMIC))) {
276 if (ret == -ENODEV) 276 if (ret == -ENODEV)
277 netif_device_detach(pegasus->net); 277 netif_device_detach(pegasus->net);
278 if (netif_msg_drv(pegasus)) 278 if (netif_msg_drv(pegasus) && printk_ratelimit())
279 dev_err(&pegasus->intf->dev, "%s, status %d\n", 279 dev_err(&pegasus->intf->dev, "%s, status %d\n",
280 __FUNCTION__, ret); 280 __FUNCTION__, ret);
281 goto out; 281 goto out;
@@ -1209,8 +1209,7 @@ static void pegasus_set_multicast(struct net_device *net)
1209 pegasus->eth_regs[EthCtrl2] |= RX_PROMISCUOUS; 1209 pegasus->eth_regs[EthCtrl2] |= RX_PROMISCUOUS;
1210 if (netif_msg_link(pegasus)) 1210 if (netif_msg_link(pegasus))
1211 pr_info("%s: Promiscuous mode enabled.\n", net->name); 1211 pr_info("%s: Promiscuous mode enabled.\n", net->name);
1212 } else if (net->mc_count || 1212 } else if (net->mc_count || (net->flags & IFF_ALLMULTI)) {
1213 (net->flags & IFF_ALLMULTI)) {
1214 pegasus->eth_regs[EthCtrl0] |= RX_MULTICAST; 1213 pegasus->eth_regs[EthCtrl0] |= RX_MULTICAST;
1215 pegasus->eth_regs[EthCtrl2] &= ~RX_PROMISCUOUS; 1214 pegasus->eth_regs[EthCtrl2] &= ~RX_PROMISCUOUS;
1216 if (netif_msg_link(pegasus)) 1215 if (netif_msg_link(pegasus))
@@ -1220,6 +1219,8 @@ static void pegasus_set_multicast(struct net_device *net)
1220 pegasus->eth_regs[EthCtrl2] &= ~RX_PROMISCUOUS; 1219 pegasus->eth_regs[EthCtrl2] &= ~RX_PROMISCUOUS;
1221 } 1220 }
1222 1221
1222 pegasus->ctrl_urb->status = 0;
1223
1223 pegasus->flags |= ETH_REGS_CHANGE; 1224 pegasus->flags |= ETH_REGS_CHANGE;
1224 ctrl_callback(pegasus->ctrl_urb); 1225 ctrl_callback(pegasus->ctrl_urb);
1225} 1226}
diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c
index e59255a155a9..6596cd0742b9 100644
--- a/drivers/net/wan/sbni.c
+++ b/drivers/net/wan/sbni.c
@@ -1317,7 +1317,7 @@ sbni_ioctl( struct net_device *dev, struct ifreq *ifr, int cmd )
1317 break; 1317 break;
1318 1318
1319 case SIOCDEVRESINSTATS : 1319 case SIOCDEVRESINSTATS :
1320 if( current->euid != 0 ) /* root only */ 1320 if (!capable(CAP_NET_ADMIN))
1321 return -EPERM; 1321 return -EPERM;
1322 memset( &nl->in_stats, 0, sizeof(struct sbni_in_stats) ); 1322 memset( &nl->in_stats, 0, sizeof(struct sbni_in_stats) );
1323 break; 1323 break;
@@ -1334,7 +1334,7 @@ sbni_ioctl( struct net_device *dev, struct ifreq *ifr, int cmd )
1334 break; 1334 break;
1335 1335
1336 case SIOCDEVSHWSTATE : 1336 case SIOCDEVSHWSTATE :
1337 if( current->euid != 0 ) /* root only */ 1337 if (!capable(CAP_NET_ADMIN))
1338 return -EPERM; 1338 return -EPERM;
1339 1339
1340 spin_lock( &nl->lock ); 1340 spin_lock( &nl->lock );
@@ -1355,7 +1355,7 @@ sbni_ioctl( struct net_device *dev, struct ifreq *ifr, int cmd )
1355#ifdef CONFIG_SBNI_MULTILINE 1355#ifdef CONFIG_SBNI_MULTILINE
1356 1356
1357 case SIOCDEVENSLAVE : 1357 case SIOCDEVENSLAVE :
1358 if( current->euid != 0 ) /* root only */ 1358 if (!capable(CAP_NET_ADMIN))
1359 return -EPERM; 1359 return -EPERM;
1360 1360
1361 if (copy_from_user( slave_name, ifr->ifr_data, sizeof slave_name )) 1361 if (copy_from_user( slave_name, ifr->ifr_data, sizeof slave_name ))
@@ -1370,7 +1370,7 @@ sbni_ioctl( struct net_device *dev, struct ifreq *ifr, int cmd )
1370 return enslave( dev, slave_dev ); 1370 return enslave( dev, slave_dev );
1371 1371
1372 case SIOCDEVEMANSIPATE : 1372 case SIOCDEVEMANSIPATE :
1373 if( current->euid != 0 ) /* root only */ 1373 if (!capable(CAP_NET_ADMIN))
1374 return -EPERM; 1374 return -EPERM;
1375 1375
1376 return emancipate( dev ); 1376 return emancipate( dev );
diff --git a/drivers/net/wd.c b/drivers/net/wd.c
index 6f9aa1643743..fa14255282af 100644
--- a/drivers/net/wd.c
+++ b/drivers/net/wd.c
@@ -337,7 +337,7 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr)
337#ifdef CONFIG_NET_POLL_CONTROLLER 337#ifdef CONFIG_NET_POLL_CONTROLLER
338 dev->poll_controller = ei_poll; 338 dev->poll_controller = ei_poll;
339#endif 339#endif
340 NS8390p_init(dev, 0); 340 NS8390_init(dev, 0);
341 341
342#if 1 342#if 1
343 /* Enable interrupt generation on softconfig cards -- M.U */ 343 /* Enable interrupt generation on softconfig cards -- M.U */
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index b20a45aa8680..0676c6d84383 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -251,7 +251,7 @@ static inline void ath5k_txbuf_free(struct ath5k_softc *sc,
251 return; 251 return;
252 pci_unmap_single(sc->pdev, bf->skbaddr, bf->skb->len, 252 pci_unmap_single(sc->pdev, bf->skbaddr, bf->skb->len,
253 PCI_DMA_TODEVICE); 253 PCI_DMA_TODEVICE);
254 dev_kfree_skb(bf->skb); 254 dev_kfree_skb_any(bf->skb);
255 bf->skb = NULL; 255 bf->skb = NULL;
256} 256}
257 257
@@ -466,6 +466,7 @@ ath5k_pci_probe(struct pci_dev *pdev,
466 mutex_init(&sc->lock); 466 mutex_init(&sc->lock);
467 spin_lock_init(&sc->rxbuflock); 467 spin_lock_init(&sc->rxbuflock);
468 spin_lock_init(&sc->txbuflock); 468 spin_lock_init(&sc->txbuflock);
469 spin_lock_init(&sc->block);
469 470
470 /* Set private data */ 471 /* Set private data */
471 pci_set_drvdata(pdev, hw); 472 pci_set_drvdata(pdev, hw);
@@ -2179,8 +2180,11 @@ ath5k_beacon_config(struct ath5k_softc *sc)
2179 2180
2180 sc->imask |= AR5K_INT_SWBA; 2181 sc->imask |= AR5K_INT_SWBA;
2181 2182
2182 if (ath5k_hw_hasveol(ah)) 2183 if (ath5k_hw_hasveol(ah)) {
2184 spin_lock(&sc->block);
2183 ath5k_beacon_send(sc); 2185 ath5k_beacon_send(sc);
2186 spin_unlock(&sc->block);
2187 }
2184 } 2188 }
2185 /* TODO else AP */ 2189 /* TODO else AP */
2186 2190
@@ -2403,7 +2407,9 @@ ath5k_intr(int irq, void *dev_id)
2403 TSF_TO_TU(tsf), 2407 TSF_TO_TU(tsf),
2404 (unsigned long long) tsf); 2408 (unsigned long long) tsf);
2405 } else { 2409 } else {
2410 spin_lock(&sc->block);
2406 ath5k_beacon_send(sc); 2411 ath5k_beacon_send(sc);
2412 spin_unlock(&sc->block);
2407 } 2413 }
2408 } 2414 }
2409 if (status & AR5K_INT_RXEOL) { 2415 if (status & AR5K_INT_RXEOL) {
@@ -2745,6 +2751,11 @@ static int ath5k_add_interface(struct ieee80211_hw *hw,
2745 ret = -EOPNOTSUPP; 2751 ret = -EOPNOTSUPP;
2746 goto end; 2752 goto end;
2747 } 2753 }
2754
2755 /* Set to a reasonable value. Note that this will
2756 * be set to mac80211's value at ath5k_config(). */
2757 sc->bintval = 1000;
2758
2748 ret = 0; 2759 ret = 0;
2749end: 2760end:
2750 mutex_unlock(&sc->lock); 2761 mutex_unlock(&sc->lock);
@@ -2789,9 +2800,6 @@ ath5k_config_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2789 struct ath5k_hw *ah = sc->ah; 2800 struct ath5k_hw *ah = sc->ah;
2790 int ret; 2801 int ret;
2791 2802
2792 /* Set to a reasonable value. Note that this will
2793 * be set to mac80211's value at ath5k_config(). */
2794 sc->bintval = 1000;
2795 mutex_lock(&sc->lock); 2803 mutex_lock(&sc->lock);
2796 if (sc->vif != vif) { 2804 if (sc->vif != vif) {
2797 ret = -EIO; 2805 ret = -EIO;
@@ -3050,6 +3058,7 @@ static int
3050ath5k_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb) 3058ath5k_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)
3051{ 3059{
3052 struct ath5k_softc *sc = hw->priv; 3060 struct ath5k_softc *sc = hw->priv;
3061 unsigned long flags;
3053 int ret; 3062 int ret;
3054 3063
3055 ath5k_debug_dump_skb(sc, skb, "BC ", 1); 3064 ath5k_debug_dump_skb(sc, skb, "BC ", 1);
@@ -3059,12 +3068,14 @@ ath5k_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)
3059 goto end; 3068 goto end;
3060 } 3069 }
3061 3070
3071 spin_lock_irqsave(&sc->block, flags);
3062 ath5k_txbuf_free(sc, sc->bbuf); 3072 ath5k_txbuf_free(sc, sc->bbuf);
3063 sc->bbuf->skb = skb; 3073 sc->bbuf->skb = skb;
3064 ret = ath5k_beacon_setup(sc, sc->bbuf); 3074 ret = ath5k_beacon_setup(sc, sc->bbuf);
3065 if (ret) 3075 if (ret)
3066 sc->bbuf->skb = NULL; 3076 sc->bbuf->skb = NULL;
3067 else { 3077 spin_unlock_irqrestore(&sc->block, flags);
3078 if (!ret) {
3068 ath5k_beacon_config(sc); 3079 ath5k_beacon_config(sc);
3069 mmiowb(); 3080 mmiowb();
3070 } 3081 }
diff --git a/drivers/net/wireless/ath5k/base.h b/drivers/net/wireless/ath5k/base.h
index d7e03e6b8271..7ec2f377d5c7 100644
--- a/drivers/net/wireless/ath5k/base.h
+++ b/drivers/net/wireless/ath5k/base.h
@@ -172,6 +172,7 @@ struct ath5k_softc {
172 struct tasklet_struct txtq; /* tx intr tasklet */ 172 struct tasklet_struct txtq; /* tx intr tasklet */
173 struct ath5k_led tx_led; /* tx led */ 173 struct ath5k_led tx_led; /* tx led */
174 174
175 spinlock_t block; /* protects beacon */
175 struct ath5k_buf *bbuf; /* beacon buffer */ 176 struct ath5k_buf *bbuf; /* beacon buffer */
176 unsigned int bhalq, /* SW q for outgoing beacons */ 177 unsigned int bhalq, /* SW q for outgoing beacons */
177 bmisscount, /* missed beacon transmits */ 178 bmisscount, /* missed beacon transmits */
diff --git a/drivers/net/wireless/ath9k/hw.c b/drivers/net/wireless/ath9k/hw.c
index a17eb130f574..6dbfed0b4149 100644
--- a/drivers/net/wireless/ath9k/hw.c
+++ b/drivers/net/wireless/ath9k/hw.c
@@ -7285,15 +7285,15 @@ ath9k_hw_set_keycache_entry(struct ath_hal *ah, u16 entry,
7285 } 7285 }
7286 break; 7286 break;
7287 case ATH9K_CIPHER_WEP: 7287 case ATH9K_CIPHER_WEP:
7288 if (k->kv_len < 40 / NBBY) { 7288 if (k->kv_len < LEN_WEP40) {
7289 DPRINTF(ah->ah_sc, ATH_DBG_KEYCACHE, 7289 DPRINTF(ah->ah_sc, ATH_DBG_KEYCACHE,
7290 "%s: WEP key length %u too small\n", 7290 "%s: WEP key length %u too small\n",
7291 __func__, k->kv_len); 7291 __func__, k->kv_len);
7292 return false; 7292 return false;
7293 } 7293 }
7294 if (k->kv_len <= 40 / NBBY) 7294 if (k->kv_len <= LEN_WEP40)
7295 keyType = AR_KEYTABLE_TYPE_40; 7295 keyType = AR_KEYTABLE_TYPE_40;
7296 else if (k->kv_len <= 104 / NBBY) 7296 else if (k->kv_len <= LEN_WEP104)
7297 keyType = AR_KEYTABLE_TYPE_104; 7297 keyType = AR_KEYTABLE_TYPE_104;
7298 else 7298 else
7299 keyType = AR_KEYTABLE_TYPE_128; 7299 keyType = AR_KEYTABLE_TYPE_128;
@@ -7313,7 +7313,7 @@ ath9k_hw_set_keycache_entry(struct ath_hal *ah, u16 entry,
7313 key2 = get_unaligned_le32(k->kv_val + 6) ^ xorMask; 7313 key2 = get_unaligned_le32(k->kv_val + 6) ^ xorMask;
7314 key3 = (get_unaligned_le16(k->kv_val + 10) ^ xorMask) & 0xffff; 7314 key3 = (get_unaligned_le16(k->kv_val + 10) ^ xorMask) & 0xffff;
7315 key4 = get_unaligned_le32(k->kv_val + 12) ^ xorMask; 7315 key4 = get_unaligned_le32(k->kv_val + 12) ^ xorMask;
7316 if (k->kv_len <= 104 / NBBY) 7316 if (k->kv_len <= LEN_WEP104)
7317 key4 &= 0xff; 7317 key4 &= 0xff;
7318 7318
7319 if (keyType == AR_KEYTABLE_TYPE_TKIP && ATH9K_IS_MIC_ENABLED(ah)) { 7319 if (keyType == AR_KEYTABLE_TYPE_TKIP && ATH9K_IS_MIC_ENABLED(ah)) {
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index 2888778040e4..c5107f269f24 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -206,7 +206,8 @@ static int ath_key_config(struct ath_softc *sc,
206 if (!ret) 206 if (!ret)
207 return -EIO; 207 return -EIO;
208 208
209 sc->sc_keytype = hk.kv_type; 209 if (mac)
210 sc->sc_keytype = hk.kv_type;
210 return 0; 211 return 0;
211} 212}
212 213
@@ -756,7 +757,8 @@ static int ath9k_set_key(struct ieee80211_hw *hw,
756 key->hw_key_idx = key->keyidx; 757 key->hw_key_idx = key->keyidx;
757 /* push IV and Michael MIC generation to stack */ 758 /* push IV and Michael MIC generation to stack */
758 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; 759 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
759 key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; 760 if (key->alg == ALG_TKIP)
761 key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
760 } 762 }
761 break; 763 break;
762 case DISABLE_KEY: 764 case DISABLE_KEY:
@@ -1065,8 +1067,16 @@ void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb,
1065 tx_info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK; 1067 tx_info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK;
1066 tx_status->flags &= ~ATH_TX_BAR; 1068 tx_status->flags &= ~ATH_TX_BAR;
1067 } 1069 }
1068 if (tx_status->flags) 1070
1069 tx_info->status.excessive_retries = 1; 1071 if (tx_status->flags & (ATH_TX_ERROR | ATH_TX_XRETRY)) {
1072 if (!(tx_info->flags & IEEE80211_TX_CTL_NO_ACK)) {
1073 /* Frame was not ACKed, but an ACK was expected */
1074 tx_info->status.excessive_retries = 1;
1075 }
1076 } else {
1077 /* Frame was ACKed */
1078 tx_info->flags |= IEEE80211_TX_STAT_ACK;
1079 }
1070 1080
1071 tx_info->status.retry_count = tx_status->retries; 1081 tx_info->status.retry_count = tx_status->retries;
1072 1082
diff --git a/drivers/net/wireless/ath9k/recv.c b/drivers/net/wireless/ath9k/recv.c
index 2fe806175c01..20ddb7acdb94 100644
--- a/drivers/net/wireless/ath9k/recv.c
+++ b/drivers/net/wireless/ath9k/recv.c
@@ -360,8 +360,9 @@ static void ath_rx_flush_tid(struct ath_softc *sc,
360 struct ath_arx_tid *rxtid, int drop) 360 struct ath_arx_tid *rxtid, int drop)
361{ 361{
362 struct ath_rxbuf *rxbuf; 362 struct ath_rxbuf *rxbuf;
363 unsigned long flag;
363 364
364 spin_lock_bh(&rxtid->tidlock); 365 spin_lock_irqsave(&rxtid->tidlock, flag);
365 while (rxtid->baw_head != rxtid->baw_tail) { 366 while (rxtid->baw_head != rxtid->baw_tail) {
366 rxbuf = rxtid->rxbuf + rxtid->baw_head; 367 rxbuf = rxtid->rxbuf + rxtid->baw_head;
367 if (!rxbuf->rx_wbuf) { 368 if (!rxbuf->rx_wbuf) {
@@ -382,7 +383,7 @@ static void ath_rx_flush_tid(struct ath_softc *sc,
382 INCR(rxtid->baw_head, ATH_TID_MAX_BUFS); 383 INCR(rxtid->baw_head, ATH_TID_MAX_BUFS);
383 INCR(rxtid->seq_next, IEEE80211_SEQ_MAX); 384 INCR(rxtid->seq_next, IEEE80211_SEQ_MAX);
384 } 385 }
385 spin_unlock_bh(&rxtid->tidlock); 386 spin_unlock_irqrestore(&rxtid->tidlock, flag);
386} 387}
387 388
388static struct sk_buff *ath_rxbuf_alloc(struct ath_softc *sc, 389static struct sk_buff *ath_rxbuf_alloc(struct ath_softc *sc,
diff --git a/drivers/net/wireless/ath9k/xmit.c b/drivers/net/wireless/ath9k/xmit.c
index 157f830ee6b8..550129f717e2 100644
--- a/drivers/net/wireless/ath9k/xmit.c
+++ b/drivers/net/wireless/ath9k/xmit.c
@@ -357,9 +357,9 @@ static int ath_tx_prepare(struct ath_softc *sc,
357 txctl->flags = ATH9K_TXDESC_CLRDMASK; /* needed for crypto errors */ 357 txctl->flags = ATH9K_TXDESC_CLRDMASK; /* needed for crypto errors */
358 358
359 if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK) 359 if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK)
360 tx_info->flags |= ATH9K_TXDESC_NOACK; 360 txctl->flags |= ATH9K_TXDESC_NOACK;
361 if (tx_info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) 361 if (tx_info->flags & IEEE80211_TX_CTL_USE_RTS_CTS)
362 tx_info->flags |= ATH9K_TXDESC_RTSENA; 362 txctl->flags |= ATH9K_TXDESC_RTSENA;
363 363
364 /* 364 /*
365 * Setup for rate calculations. 365 * Setup for rate calculations.
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index bd35bb0a1480..bd65c485098c 100644
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -1304,7 +1304,7 @@ EXPORT_SYMBOL(atmel_open);
1304int atmel_open(struct net_device *dev) 1304int atmel_open(struct net_device *dev)
1305{ 1305{
1306 struct atmel_private *priv = netdev_priv(dev); 1306 struct atmel_private *priv = netdev_priv(dev);
1307 int i, channel; 1307 int i, channel, err;
1308 1308
1309 /* any scheduled timer is no longer needed and might screw things up.. */ 1309 /* any scheduled timer is no longer needed and might screw things up.. */
1310 del_timer_sync(&priv->management_timer); 1310 del_timer_sync(&priv->management_timer);
@@ -1328,8 +1328,9 @@ int atmel_open(struct net_device *dev)
1328 priv->site_survey_state = SITE_SURVEY_IDLE; 1328 priv->site_survey_state = SITE_SURVEY_IDLE;
1329 priv->station_is_associated = 0; 1329 priv->station_is_associated = 0;
1330 1330
1331 if (!reset_atmel_card(dev)) 1331 err = reset_atmel_card(dev);
1332 return -EAGAIN; 1332 if (err)
1333 return err;
1333 1334
1334 if (priv->config_reg_domain) { 1335 if (priv->config_reg_domain) {
1335 priv->reg_domain = priv->config_reg_domain; 1336 priv->reg_domain = priv->config_reg_domain;
@@ -3061,12 +3062,20 @@ static void authenticate(struct atmel_private *priv, u16 frame_len)
3061 } 3062 }
3062 3063
3063 if (status == WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG) { 3064 if (status == WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG) {
3064 /* Do opensystem first, then try sharedkey */ 3065 /* Flip back and forth between WEP auth modes until the max
3066 * authentication tries has been exceeded.
3067 */
3065 if (system == WLAN_AUTH_OPEN) { 3068 if (system == WLAN_AUTH_OPEN) {
3066 priv->CurrentAuthentTransactionSeqNum = 0x001; 3069 priv->CurrentAuthentTransactionSeqNum = 0x001;
3067 priv->exclude_unencrypted = 1; 3070 priv->exclude_unencrypted = 1;
3068 send_authentication_request(priv, WLAN_AUTH_SHARED_KEY, NULL, 0); 3071 send_authentication_request(priv, WLAN_AUTH_SHARED_KEY, NULL, 0);
3069 return; 3072 return;
3073 } else if ( system == WLAN_AUTH_SHARED_KEY
3074 && priv->wep_is_on) {
3075 priv->CurrentAuthentTransactionSeqNum = 0x001;
3076 priv->exclude_unencrypted = 0;
3077 send_authentication_request(priv, WLAN_AUTH_OPEN, NULL, 0);
3078 return;
3070 } else if (priv->connect_to_any_BSS) { 3079 } else if (priv->connect_to_any_BSS) {
3071 int bss_index; 3080 int bss_index;
3072 3081
@@ -3580,12 +3589,12 @@ static int atmel_wakeup_firmware(struct atmel_private *priv)
3580 3589
3581 if (i == 0) { 3590 if (i == 0) {
3582 printk(KERN_ALERT "%s: MAC failed to boot.\n", priv->dev->name); 3591 printk(KERN_ALERT "%s: MAC failed to boot.\n", priv->dev->name);
3583 return 0; 3592 return -EIO;
3584 } 3593 }
3585 3594
3586 if ((priv->host_info_base = atmel_read16(priv->dev, MR2)) == 0xffff) { 3595 if ((priv->host_info_base = atmel_read16(priv->dev, MR2)) == 0xffff) {
3587 printk(KERN_ALERT "%s: card missing.\n", priv->dev->name); 3596 printk(KERN_ALERT "%s: card missing.\n", priv->dev->name);
3588 return 0; 3597 return -ENODEV;
3589 } 3598 }
3590 3599
3591 /* now check for completion of MAC initialization through 3600 /* now check for completion of MAC initialization through
@@ -3609,19 +3618,19 @@ static int atmel_wakeup_firmware(struct atmel_private *priv)
3609 if (i == 0) { 3618 if (i == 0) {
3610 printk(KERN_ALERT "%s: MAC failed to initialise.\n", 3619 printk(KERN_ALERT "%s: MAC failed to initialise.\n",
3611 priv->dev->name); 3620 priv->dev->name);
3612 return 0; 3621 return -EIO;
3613 } 3622 }
3614 3623
3615 /* Check for MAC_INIT_OK only on the register that the MAC_INIT_OK was set */ 3624 /* Check for MAC_INIT_OK only on the register that the MAC_INIT_OK was set */
3616 if ((mr3 & MAC_INIT_COMPLETE) && 3625 if ((mr3 & MAC_INIT_COMPLETE) &&
3617 !(atmel_read16(priv->dev, MR3) & MAC_INIT_OK)) { 3626 !(atmel_read16(priv->dev, MR3) & MAC_INIT_OK)) {
3618 printk(KERN_ALERT "%s: MAC failed MR3 self-test.\n", priv->dev->name); 3627 printk(KERN_ALERT "%s: MAC failed MR3 self-test.\n", priv->dev->name);
3619 return 0; 3628 return -EIO;
3620 } 3629 }
3621 if ((mr1 & MAC_INIT_COMPLETE) && 3630 if ((mr1 & MAC_INIT_COMPLETE) &&
3622 !(atmel_read16(priv->dev, MR1) & MAC_INIT_OK)) { 3631 !(atmel_read16(priv->dev, MR1) & MAC_INIT_OK)) {
3623 printk(KERN_ALERT "%s: MAC failed MR1 self-test.\n", priv->dev->name); 3632 printk(KERN_ALERT "%s: MAC failed MR1 self-test.\n", priv->dev->name);
3624 return 0; 3633 return -EIO;
3625 } 3634 }
3626 3635
3627 atmel_copy_to_host(priv->dev, (unsigned char *)iface, 3636 atmel_copy_to_host(priv->dev, (unsigned char *)iface,
@@ -3642,7 +3651,7 @@ static int atmel_wakeup_firmware(struct atmel_private *priv)
3642 iface->func_ctrl = le16_to_cpu(iface->func_ctrl); 3651 iface->func_ctrl = le16_to_cpu(iface->func_ctrl);
3643 iface->mac_status = le16_to_cpu(iface->mac_status); 3652 iface->mac_status = le16_to_cpu(iface->mac_status);
3644 3653
3645 return 1; 3654 return 0;
3646} 3655}
3647 3656
3648/* determine type of memory and MAC address */ 3657/* determine type of memory and MAC address */
@@ -3693,7 +3702,7 @@ static int probe_atmel_card(struct net_device *dev)
3693 /* Standard firmware in flash, boot it up and ask 3702 /* Standard firmware in flash, boot it up and ask
3694 for the Mac Address */ 3703 for the Mac Address */
3695 priv->card_type = CARD_TYPE_SPI_FLASH; 3704 priv->card_type = CARD_TYPE_SPI_FLASH;
3696 if (atmel_wakeup_firmware(priv)) { 3705 if (atmel_wakeup_firmware(priv) == 0) {
3697 atmel_get_mib(priv, Mac_Address_Mib_Type, 0, dev->dev_addr, 6); 3706 atmel_get_mib(priv, Mac_Address_Mib_Type, 0, dev->dev_addr, 6);
3698 3707
3699 /* got address, now squash it again until the network 3708 /* got address, now squash it again until the network
@@ -3835,6 +3844,7 @@ static int reset_atmel_card(struct net_device *dev)
3835 struct atmel_private *priv = netdev_priv(dev); 3844 struct atmel_private *priv = netdev_priv(dev);
3836 u8 configuration; 3845 u8 configuration;
3837 int old_state = priv->station_state; 3846 int old_state = priv->station_state;
3847 int err = 0;
3838 3848
3839 /* data to add to the firmware names, in priority order 3849 /* data to add to the firmware names, in priority order
3840 this implemenents firmware versioning */ 3850 this implemenents firmware versioning */
@@ -3868,11 +3878,12 @@ static int reset_atmel_card(struct net_device *dev)
3868 dev->name); 3878 dev->name);
3869 strcpy(priv->firmware_id, "atmel_at76c502.bin"); 3879 strcpy(priv->firmware_id, "atmel_at76c502.bin");
3870 } 3880 }
3871 if (request_firmware(&fw_entry, priv->firmware_id, priv->sys_dev) != 0) { 3881 err = request_firmware(&fw_entry, priv->firmware_id, priv->sys_dev);
3882 if (err != 0) {
3872 printk(KERN_ALERT 3883 printk(KERN_ALERT
3873 "%s: firmware %s is missing, cannot continue.\n", 3884 "%s: firmware %s is missing, cannot continue.\n",
3874 dev->name, priv->firmware_id); 3885 dev->name, priv->firmware_id);
3875 return 0; 3886 return err;
3876 } 3887 }
3877 } else { 3888 } else {
3878 int fw_index = 0; 3889 int fw_index = 0;
@@ -3901,7 +3912,7 @@ static int reset_atmel_card(struct net_device *dev)
3901 "%s: firmware %s is missing, cannot start.\n", 3912 "%s: firmware %s is missing, cannot start.\n",
3902 dev->name, priv->firmware_id); 3913 dev->name, priv->firmware_id);
3903 priv->firmware_id[0] = '\0'; 3914 priv->firmware_id[0] = '\0';
3904 return 0; 3915 return -ENOENT;
3905 } 3916 }
3906 } 3917 }
3907 3918
@@ -3926,8 +3937,9 @@ static int reset_atmel_card(struct net_device *dev)
3926 release_firmware(fw_entry); 3937 release_firmware(fw_entry);
3927 } 3938 }
3928 3939
3929 if (!atmel_wakeup_firmware(priv)) 3940 err = atmel_wakeup_firmware(priv);
3930 return 0; 3941 if (err != 0)
3942 return err;
3931 3943
3932 /* Check the version and set the correct flag for wpa stuff, 3944 /* Check the version and set the correct flag for wpa stuff,
3933 old and new firmware is incompatible. 3945 old and new firmware is incompatible.
@@ -3968,10 +3980,9 @@ static int reset_atmel_card(struct net_device *dev)
3968 if (!priv->radio_on_broken) { 3980 if (!priv->radio_on_broken) {
3969 if (atmel_send_command_wait(priv, CMD_EnableRadio, NULL, 0) == 3981 if (atmel_send_command_wait(priv, CMD_EnableRadio, NULL, 0) ==
3970 CMD_STATUS_REJECTED_RADIO_OFF) { 3982 CMD_STATUS_REJECTED_RADIO_OFF) {
3971 printk(KERN_INFO 3983 printk(KERN_INFO "%s: cannot turn the radio on.\n",
3972 "%s: cannot turn the radio on. (Hey radio, you're beautiful!)\n",
3973 dev->name); 3984 dev->name);
3974 return 0; 3985 return -EIO;
3975 } 3986 }
3976 } 3987 }
3977 3988
@@ -4006,7 +4017,7 @@ static int reset_atmel_card(struct net_device *dev)
4006 wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); 4017 wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL);
4007 } 4018 }
4008 4019
4009 return 1; 4020 return 0;
4010} 4021}
4011 4022
4012static void atmel_send_command(struct atmel_private *priv, int command, 4023static void atmel_send_command(struct atmel_private *priv, int command,
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index e2581229d8b2..23fed3298962 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -474,8 +474,8 @@ static void iwl4965_apm_stop(struct iwl_priv *priv)
474 iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); 474 iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
475 475
476 udelay(10); 476 udelay(10);
477 477 /* clear "init complete" move adapter D0A* --> D0U state */
478 iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); 478 iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
479 spin_unlock_irqrestore(&priv->lock, flags); 479 spin_unlock_irqrestore(&priv->lock, flags);
480} 480}
481 481
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index cbc01a00eaf4..b08036a9d894 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -145,7 +145,8 @@ static void iwl5000_apm_stop(struct iwl_priv *priv)
145 145
146 udelay(10); 146 udelay(10);
147 147
148 iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); 148 /* clear "init complete" move adapter D0A* --> D0U state */
149 iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
149 150
150 spin_unlock_irqrestore(&priv->lock, flags); 151 spin_unlock_irqrestore(&priv->lock, flags);
151} 152}
@@ -577,14 +578,11 @@ static int iwl5000_load_section(struct iwl_priv *priv,
577 FH_TFDIB_CTRL0_REG(FH_SRVC_CHNL), 578 FH_TFDIB_CTRL0_REG(FH_SRVC_CHNL),
578 phy_addr & FH_MEM_TFDIB_DRAM_ADDR_LSB_MSK); 579 phy_addr & FH_MEM_TFDIB_DRAM_ADDR_LSB_MSK);
579 580
580 /* FIME: write the MSB of the phy_addr in CTRL1
581 * iwl_write_direct32(priv,
582 IWL_FH_TFDIB_CTRL1_REG(IWL_FH_SRVC_CHNL),
583 ((phy_addr & MSB_MSK)
584 << FH_MEM_TFDIB_REG1_ADDR_BITSHIFT) | byte_count);
585 */
586 iwl_write_direct32(priv, 581 iwl_write_direct32(priv,
587 FH_TFDIB_CTRL1_REG(FH_SRVC_CHNL), byte_cnt); 582 FH_TFDIB_CTRL1_REG(FH_SRVC_CHNL),
583 (iwl_get_dma_hi_address(phy_addr)
584 << FH_MEM_TFDIB_REG1_ADDR_BITSHIFT) | byte_cnt);
585
588 iwl_write_direct32(priv, 586 iwl_write_direct32(priv,
589 FH_TCSR_CHNL_TX_BUF_STS_REG(FH_SRVC_CHNL), 587 FH_TCSR_CHNL_TX_BUF_STS_REG(FH_SRVC_CHNL),
590 1 << FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_NUM | 588 1 << FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_NUM |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index 754fef5b592f..90a2b6dee7c0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -1153,7 +1153,8 @@ static int rs_switch_to_mimo2(struct iwl_priv *priv,
1153 !sta->ht_info.ht_supported) 1153 !sta->ht_info.ht_supported)
1154 return -1; 1154 return -1;
1155 1155
1156 if (priv->current_ht_config.tx_mimo_ps_mode == IWL_MIMO_PS_STATIC) 1156 if (((sta->ht_info.cap & IEEE80211_HT_CAP_MIMO_PS) >> 2)
1157 == IWL_MIMO_PS_STATIC)
1157 return -1; 1158 return -1;
1158 1159
1159 /* Need both Tx chains/antennas to support MIMO */ 1160 /* Need both Tx chains/antennas to support MIMO */
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 061ffba9c884..e01f048a02dd 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -181,14 +181,14 @@ static int iwl4965_check_rxon_cmd(struct iwl_rxon_cmd *rxon)
181} 181}
182 182
183/** 183/**
184 * iwl4965_full_rxon_required - check if full RXON (vs RXON_ASSOC) cmd is needed 184 * iwl_full_rxon_required - check if full RXON (vs RXON_ASSOC) cmd is needed
185 * @priv: staging_rxon is compared to active_rxon 185 * @priv: staging_rxon is compared to active_rxon
186 * 186 *
187 * If the RXON structure is changing enough to require a new tune, 187 * If the RXON structure is changing enough to require a new tune,
188 * or is clearing the RXON_FILTER_ASSOC_MSK, then return 1 to indicate that 188 * or is clearing the RXON_FILTER_ASSOC_MSK, then return 1 to indicate that
189 * a new tune (full RXON command, rather than RXON_ASSOC cmd) is required. 189 * a new tune (full RXON command, rather than RXON_ASSOC cmd) is required.
190 */ 190 */
191static int iwl4965_full_rxon_required(struct iwl_priv *priv) 191static int iwl_full_rxon_required(struct iwl_priv *priv)
192{ 192{
193 193
194 /* These items are only settable from the full RXON command */ 194 /* These items are only settable from the full RXON command */
@@ -207,7 +207,6 @@ static int iwl4965_full_rxon_required(struct iwl_priv *priv)
207 priv->active_rxon.ofdm_ht_single_stream_basic_rates) || 207 priv->active_rxon.ofdm_ht_single_stream_basic_rates) ||
208 (priv->staging_rxon.ofdm_ht_dual_stream_basic_rates != 208 (priv->staging_rxon.ofdm_ht_dual_stream_basic_rates !=
209 priv->active_rxon.ofdm_ht_dual_stream_basic_rates) || 209 priv->active_rxon.ofdm_ht_dual_stream_basic_rates) ||
210 (priv->staging_rxon.rx_chain != priv->active_rxon.rx_chain) ||
211 (priv->staging_rxon.assoc_id != priv->active_rxon.assoc_id)) 210 (priv->staging_rxon.assoc_id != priv->active_rxon.assoc_id))
212 return 1; 211 return 1;
213 212
@@ -263,7 +262,7 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv)
263 /* If we don't need to send a full RXON, we can use 262 /* If we don't need to send a full RXON, we can use
264 * iwl4965_rxon_assoc_cmd which is used to reconfigure filter 263 * iwl4965_rxon_assoc_cmd which is used to reconfigure filter
265 * and other flags for the current radio configuration. */ 264 * and other flags for the current radio configuration. */
266 if (!iwl4965_full_rxon_required(priv)) { 265 if (!iwl_full_rxon_required(priv)) {
267 ret = iwl_send_rxon_assoc(priv); 266 ret = iwl_send_rxon_assoc(priv);
268 if (ret) { 267 if (ret) {
269 IWL_ERROR("Error setting RXON_ASSOC (%d)\n", ret); 268 IWL_ERROR("Error setting RXON_ASSOC (%d)\n", ret);
@@ -587,8 +586,6 @@ static void iwl4965_ht_conf(struct iwl_priv *priv,
587 iwl_conf->supported_chan_width = 0; 586 iwl_conf->supported_chan_width = 0;
588 } 587 }
589 588
590 iwl_conf->tx_mimo_ps_mode =
591 (u8)((ht_conf->cap & IEEE80211_HT_CAP_MIMO_PS) >> 2);
592 memcpy(iwl_conf->supp_mcs_set, ht_conf->supp_mcs_set, 16); 589 memcpy(iwl_conf->supp_mcs_set, ht_conf->supp_mcs_set, 16);
593 590
594 iwl_conf->control_channel = ht_bss_conf->primary_channel; 591 iwl_conf->control_channel = ht_bss_conf->primary_channel;
@@ -2190,7 +2187,10 @@ static void __iwl4965_down(struct iwl_priv *priv)
2190 udelay(5); 2187 udelay(5);
2191 2188
2192 /* FIXME: apm_ops.suspend(priv) */ 2189 /* FIXME: apm_ops.suspend(priv) */
2193 priv->cfg->ops->lib->apm_ops.reset(priv); 2190 if (exit_pending || test_bit(STATUS_IN_SUSPEND, &priv->status))
2191 priv->cfg->ops->lib->apm_ops.stop(priv);
2192 else
2193 priv->cfg->ops->lib->apm_ops.reset(priv);
2194 priv->cfg->ops->lib->free_shared_mem(priv); 2194 priv->cfg->ops->lib->free_shared_mem(priv);
2195 2195
2196 exit: 2196 exit:
@@ -2602,6 +2602,7 @@ static int iwl4965_mac_start(struct ieee80211_hw *hw)
2602{ 2602{
2603 struct iwl_priv *priv = hw->priv; 2603 struct iwl_priv *priv = hw->priv;
2604 int ret; 2604 int ret;
2605 u16 pci_cmd;
2605 2606
2606 IWL_DEBUG_MAC80211("enter\n"); 2607 IWL_DEBUG_MAC80211("enter\n");
2607 2608
@@ -2612,6 +2613,13 @@ static int iwl4965_mac_start(struct ieee80211_hw *hw)
2612 pci_restore_state(priv->pci_dev); 2613 pci_restore_state(priv->pci_dev);
2613 pci_enable_msi(priv->pci_dev); 2614 pci_enable_msi(priv->pci_dev);
2614 2615
2616 /* enable interrupts if needed: hw bug w/a */
2617 pci_read_config_word(priv->pci_dev, PCI_COMMAND, &pci_cmd);
2618 if (pci_cmd & PCI_COMMAND_INTX_DISABLE) {
2619 pci_cmd &= ~PCI_COMMAND_INTX_DISABLE;
2620 pci_write_config_word(priv->pci_dev, PCI_COMMAND, pci_cmd);
2621 }
2622
2615 ret = request_irq(priv->pci_dev->irq, iwl4965_isr, IRQF_SHARED, 2623 ret = request_irq(priv->pci_dev->irq, iwl4965_isr, IRQF_SHARED,
2616 DRV_NAME, priv); 2624 DRV_NAME, priv);
2617 if (ret) { 2625 if (ret) {
@@ -3580,7 +3588,7 @@ static int iwl4965_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *sk
3580 3588
3581 priv->assoc_id = 0; 3589 priv->assoc_id = 0;
3582 timestamp = ((struct ieee80211_mgmt *)skb->data)->u.beacon.timestamp; 3590 timestamp = ((struct ieee80211_mgmt *)skb->data)->u.beacon.timestamp;
3583 priv->timestamp = le64_to_cpu(timestamp) + (priv->beacon_int * 1000); 3591 priv->timestamp = le64_to_cpu(timestamp);
3584 3592
3585 IWL_DEBUG_MAC80211("leave\n"); 3593 IWL_DEBUG_MAC80211("leave\n");
3586 spin_unlock_irqrestore(&priv->lock, flags); 3594 spin_unlock_irqrestore(&priv->lock, flags);
@@ -4364,15 +4372,18 @@ static void __devexit iwl4965_pci_remove(struct pci_dev *pdev)
4364 iwl_dbgfs_unregister(priv); 4372 iwl_dbgfs_unregister(priv);
4365 sysfs_remove_group(&pdev->dev.kobj, &iwl4965_attribute_group); 4373 sysfs_remove_group(&pdev->dev.kobj, &iwl4965_attribute_group);
4366 4374
4375 /* ieee80211_unregister_hw call wil cause iwl4965_mac_stop to
4376 * to be called and iwl4965_down since we are removing the device
4377 * we need to set STATUS_EXIT_PENDING bit.
4378 */
4379 set_bit(STATUS_EXIT_PENDING, &priv->status);
4367 if (priv->mac80211_registered) { 4380 if (priv->mac80211_registered) {
4368 ieee80211_unregister_hw(priv->hw); 4381 ieee80211_unregister_hw(priv->hw);
4369 priv->mac80211_registered = 0; 4382 priv->mac80211_registered = 0;
4383 } else {
4384 iwl4965_down(priv);
4370 } 4385 }
4371 4386
4372 set_bit(STATUS_EXIT_PENDING, &priv->status);
4373
4374 iwl4965_down(priv);
4375
4376 /* make sure we flush any pending irq or 4387 /* make sure we flush any pending irq or
4377 * tasklet for the driver 4388 * tasklet for the driver
4378 */ 4389 */
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index c72f72579bea..80f2f84defa8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -592,12 +592,11 @@ static void iwlcore_free_geos(struct iwl_priv *priv)
592 clear_bit(STATUS_GEO_CONFIGURED, &priv->status); 592 clear_bit(STATUS_GEO_CONFIGURED, &priv->status);
593} 593}
594 594
595static u8 is_single_rx_stream(struct iwl_priv *priv) 595static bool is_single_rx_stream(struct iwl_priv *priv)
596{ 596{
597 return !priv->current_ht_config.is_ht || 597 return !priv->current_ht_config.is_ht ||
598 ((priv->current_ht_config.supp_mcs_set[1] == 0) && 598 ((priv->current_ht_config.supp_mcs_set[1] == 0) &&
599 (priv->current_ht_config.supp_mcs_set[2] == 0)) || 599 (priv->current_ht_config.supp_mcs_set[2] == 0));
600 priv->ps_mode == IWL_MIMO_PS_STATIC;
601} 600}
602 601
603static u8 iwl_is_channel_extension(struct iwl_priv *priv, 602static u8 iwl_is_channel_extension(struct iwl_priv *priv,
@@ -704,33 +703,39 @@ EXPORT_SYMBOL(iwl_set_rxon_ht);
704 * MIMO (dual stream) requires at least 2, but works better with 3. 703 * MIMO (dual stream) requires at least 2, but works better with 3.
705 * This does not determine *which* chains to use, just how many. 704 * This does not determine *which* chains to use, just how many.
706 */ 705 */
707static int iwlcore_get_rx_chain_counter(struct iwl_priv *priv, 706static int iwl_get_active_rx_chain_count(struct iwl_priv *priv)
708 u8 *idle_state, u8 *rx_state)
709{ 707{
710 u8 is_single = is_single_rx_stream(priv); 708 bool is_single = is_single_rx_stream(priv);
711 u8 is_cam = test_bit(STATUS_POWER_PMI, &priv->status) ? 0 : 1; 709 bool is_cam = !test_bit(STATUS_POWER_PMI, &priv->status);
712 710
713 /* # of Rx chains to use when expecting MIMO. */ 711 /* # of Rx chains to use when expecting MIMO. */
714 if (is_single || (!is_cam && (priv->ps_mode == IWL_MIMO_PS_STATIC))) 712 if (is_single || (!is_cam && (priv->ps_mode == IWL_MIMO_PS_STATIC)))
715 *rx_state = 2; 713 return 2;
716 else 714 else
717 *rx_state = 3; 715 return 3;
716}
718 717
718static int iwl_get_idle_rx_chain_count(struct iwl_priv *priv, int active_cnt)
719{
720 int idle_cnt;
721 bool is_cam = !test_bit(STATUS_POWER_PMI, &priv->status);
719 /* # Rx chains when idling and maybe trying to save power */ 722 /* # Rx chains when idling and maybe trying to save power */
720 switch (priv->ps_mode) { 723 switch (priv->ps_mode) {
721 case IWL_MIMO_PS_STATIC: 724 case IWL_MIMO_PS_STATIC:
722 case IWL_MIMO_PS_DYNAMIC: 725 case IWL_MIMO_PS_DYNAMIC:
723 *idle_state = (is_cam) ? 2 : 1; 726 idle_cnt = (is_cam) ? 2 : 1;
724 break; 727 break;
725 case IWL_MIMO_PS_NONE: 728 case IWL_MIMO_PS_NONE:
726 *idle_state = (is_cam) ? *rx_state : 1; 729 idle_cnt = (is_cam) ? active_cnt : 1;
727 break; 730 break;
731 case IWL_MIMO_PS_INVALID:
728 default: 732 default:
729 *idle_state = 1; 733 IWL_ERROR("invalide mimo ps mode %d\n", priv->ps_mode);
734 WARN_ON(1);
735 idle_cnt = -1;
730 break; 736 break;
731 } 737 }
732 738 return idle_cnt;
733 return 0;
734} 739}
735 740
736/** 741/**
@@ -741,34 +746,44 @@ static int iwlcore_get_rx_chain_counter(struct iwl_priv *priv,
741 */ 746 */
742void iwl_set_rxon_chain(struct iwl_priv *priv) 747void iwl_set_rxon_chain(struct iwl_priv *priv)
743{ 748{
744 u8 is_single = is_single_rx_stream(priv); 749 bool is_single = is_single_rx_stream(priv);
745 u8 idle_state, rx_state; 750 bool is_cam = !test_bit(STATUS_POWER_PMI, &priv->status);
746 751 u8 idle_rx_cnt, active_rx_cnt;
747 priv->staging_rxon.rx_chain = 0; 752 u16 rx_chain;
748 rx_state = idle_state = 3;
749 753
750 /* Tell uCode which antennas are actually connected. 754 /* Tell uCode which antennas are actually connected.
751 * Before first association, we assume all antennas are connected. 755 * Before first association, we assume all antennas are connected.
752 * Just after first association, iwl_chain_noise_calibration() 756 * Just after first association, iwl_chain_noise_calibration()
753 * checks which antennas actually *are* connected. */ 757 * checks which antennas actually *are* connected. */
754 priv->staging_rxon.rx_chain |= 758 rx_chain = priv->hw_params.valid_rx_ant << RXON_RX_CHAIN_VALID_POS;
755 cpu_to_le16(priv->hw_params.valid_rx_ant <<
756 RXON_RX_CHAIN_VALID_POS);
757 759
758 /* How many receivers should we use? */ 760 /* How many receivers should we use? */
759 iwlcore_get_rx_chain_counter(priv, &idle_state, &rx_state); 761 active_rx_cnt = iwl_get_active_rx_chain_count(priv);
760 priv->staging_rxon.rx_chain |= 762 idle_rx_cnt = iwl_get_idle_rx_chain_count(priv, active_rx_cnt);
761 cpu_to_le16(rx_state << RXON_RX_CHAIN_MIMO_CNT_POS); 763
762 priv->staging_rxon.rx_chain |= 764 /* correct rx chain count accoridng hw settings */
763 cpu_to_le16(idle_state << RXON_RX_CHAIN_CNT_POS); 765 if (priv->hw_params.rx_chains_num < active_rx_cnt)
764 766 active_rx_cnt = priv->hw_params.rx_chains_num;
765 if (!is_single && (rx_state >= 2) && 767
766 !test_bit(STATUS_POWER_PMI, &priv->status)) 768 if (priv->hw_params.rx_chains_num < idle_rx_cnt)
769 idle_rx_cnt = priv->hw_params.rx_chains_num;
770
771 rx_chain |= active_rx_cnt << RXON_RX_CHAIN_MIMO_CNT_POS;
772 rx_chain |= idle_rx_cnt << RXON_RX_CHAIN_CNT_POS;
773
774 priv->staging_rxon.rx_chain = cpu_to_le16(rx_chain);
775
776 if (!is_single && (active_rx_cnt >= 2) && is_cam)
767 priv->staging_rxon.rx_chain |= RXON_RX_CHAIN_MIMO_FORCE_MSK; 777 priv->staging_rxon.rx_chain |= RXON_RX_CHAIN_MIMO_FORCE_MSK;
768 else 778 else
769 priv->staging_rxon.rx_chain &= ~RXON_RX_CHAIN_MIMO_FORCE_MSK; 779 priv->staging_rxon.rx_chain &= ~RXON_RX_CHAIN_MIMO_FORCE_MSK;
770 780
771 IWL_DEBUG_ASSOC("rx chain %X\n", priv->staging_rxon.rx_chain); 781 IWL_DEBUG_ASSOC("rx_chain=0x%Xi active=%d idle=%d\n",
782 priv->staging_rxon.rx_chain,
783 active_rx_cnt, idle_rx_cnt);
784
785 WARN_ON(active_rx_cnt == 0 || idle_rx_cnt == 0 ||
786 active_rx_cnt < idle_rx_cnt);
772} 787}
773EXPORT_SYMBOL(iwl_set_rxon_chain); 788EXPORT_SYMBOL(iwl_set_rxon_chain);
774 789
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index c19db438306c..cdfb343c7ec6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -412,7 +412,6 @@ struct iwl_ht_info {
412 /* self configuration data */ 412 /* self configuration data */
413 u8 is_ht; 413 u8 is_ht;
414 u8 supported_chan_width; 414 u8 supported_chan_width;
415 u16 tx_mimo_ps_mode;
416 u8 is_green_field; 415 u8 is_green_field;
417 u8 sgf; /* HT_SHORT_GI_* short guard interval */ 416 u8 sgf; /* HT_SHORT_GI_* short guard interval */
418 u8 max_amsdu_size; 417 u8 max_amsdu_size;
diff --git a/drivers/net/wireless/iwlwifi/iwl-fh.h b/drivers/net/wireless/iwlwifi/iwl-fh.h
index 944642450d3d..cd11c0ca2991 100644
--- a/drivers/net/wireless/iwlwifi/iwl-fh.h
+++ b/drivers/net/wireless/iwlwifi/iwl-fh.h
@@ -287,6 +287,7 @@
287 287
288#define FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE (0x01000000) 288#define FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE (0x01000000)
289 289
290#define FH_MEM_TFDIB_REG1_ADDR_BITSHIFT 28
290 291
291/** 292/**
292 * Transmit DMA Channel Control/Status Registers (TCSR) 293 * Transmit DMA Channel Control/Status Registers (TCSR)
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c
index f3f6ea49fdd2..e81bfc42a7cb 100644
--- a/drivers/net/wireless/iwlwifi/iwl-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-rx.c
@@ -1173,7 +1173,10 @@ void iwl_rx_reply_rx(struct iwl_priv *priv,
1173 1173
1174 rx_status.antenna = 0; 1174 rx_status.antenna = 0;
1175 rx_status.flag = 0; 1175 rx_status.flag = 0;
1176 rx_status.flag |= RX_FLAG_TSFT; 1176
1177 /* TSF isn't reliable. In order to allow smooth user experience,
1178 * this W/A doesn't propagate it to the mac80211 */
1179 /*rx_status.flag |= RX_FLAG_TSFT;*/
1177 1180
1178 if ((unlikely(rx_start->cfg_phy_cnt > 20))) { 1181 if ((unlikely(rx_start->cfg_phy_cnt > 20))) {
1179 IWL_DEBUG_DROP("dsp size out of range [0,20]: %d/n", 1182 IWL_DEBUG_DROP("dsp size out of range [0,20]: %d/n",
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
index 9bb6adb28b73..6c8ac3a87d54 100644
--- a/drivers/net/wireless/iwlwifi/iwl-scan.c
+++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
@@ -421,7 +421,7 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv,
421 else 421 else
422 scan_ch->type = SCAN_CHANNEL_TYPE_ACTIVE; 422 scan_ch->type = SCAN_CHANNEL_TYPE_ACTIVE;
423 423
424 if ((scan_ch->type & SCAN_CHANNEL_TYPE_ACTIVE) && n_probes) 424 if (n_probes)
425 scan_ch->type |= IWL_SCAN_PROBE_MASK(n_probes); 425 scan_ch->type |= IWL_SCAN_PROBE_MASK(n_probes);
426 426
427 scan_ch->active_dwell = cpu_to_le16(active_dwell); 427 scan_ch->active_dwell = cpu_to_le16(active_dwell);
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
index d82823b5c8ab..78b1a7a4ca40 100644
--- a/drivers/net/wireless/iwlwifi/iwl-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
@@ -402,12 +402,11 @@ static int iwl_hw_tx_queue_init(struct iwl_priv *priv,
402/** 402/**
403 * iwl_tx_queue_init - Allocate and initialize one tx/cmd queue 403 * iwl_tx_queue_init - Allocate and initialize one tx/cmd queue
404 */ 404 */
405static int iwl_tx_queue_init(struct iwl_priv *priv, 405static int iwl_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq,
406 struct iwl_tx_queue *txq,
407 int slots_num, u32 txq_id) 406 int slots_num, u32 txq_id)
408{ 407{
409 int i, len; 408 int i, len;
410 int rc = 0; 409 int ret;
411 410
412 /* 411 /*
413 * Alloc buffer array for commands (Tx or other types of commands). 412 * Alloc buffer array for commands (Tx or other types of commands).
@@ -426,19 +425,16 @@ static int iwl_tx_queue_init(struct iwl_priv *priv,
426 continue; 425 continue;
427 } 426 }
428 427
429 txq->cmd[i] = kmalloc(len, GFP_KERNEL | GFP_DMA); 428 txq->cmd[i] = kmalloc(len, GFP_KERNEL);
430 if (!txq->cmd[i]) 429 if (!txq->cmd[i])
431 return -ENOMEM; 430 goto err;
432 } 431 }
433 432
434 /* Alloc driver data array and TFD circular buffer */ 433 /* Alloc driver data array and TFD circular buffer */
435 rc = iwl_tx_queue_alloc(priv, txq, txq_id); 434 ret = iwl_tx_queue_alloc(priv, txq, txq_id);
436 if (rc) { 435 if (ret)
437 for (i = 0; i < slots_num; i++) 436 goto err;
438 kfree(txq->cmd[i]);
439 437
440 return -ENOMEM;
441 }
442 txq->need_update = 0; 438 txq->need_update = 0;
443 439
444 /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise 440 /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise
@@ -452,6 +448,17 @@ static int iwl_tx_queue_init(struct iwl_priv *priv,
452 iwl_hw_tx_queue_init(priv, txq); 448 iwl_hw_tx_queue_init(priv, txq);
453 449
454 return 0; 450 return 0;
451err:
452 for (i = 0; i < slots_num; i++) {
453 kfree(txq->cmd[i]);
454 txq->cmd[i] = NULL;
455 }
456
457 if (txq_id == IWL_CMD_QUEUE_NUM) {
458 kfree(txq->cmd[slots_num]);
459 txq->cmd[slots_num] = NULL;
460 }
461 return -ENOMEM;
455} 462}
456/** 463/**
457 * iwl_hw_txq_ctx_free - Free TXQ Context 464 * iwl_hw_txq_ctx_free - Free TXQ Context
diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c
index 04d7a251e3f0..8941919001bb 100644
--- a/drivers/net/wireless/libertas/if_cs.c
+++ b/drivers/net/wireless/libertas/if_cs.c
@@ -595,7 +595,7 @@ static int if_cs_prog_helper(struct if_cs_card *card)
595 if (ret < 0) { 595 if (ret < 0) {
596 lbs_pr_err("can't download helper at 0x%x, ret %d\n", 596 lbs_pr_err("can't download helper at 0x%x, ret %d\n",
597 sent, ret); 597 sent, ret);
598 goto done; 598 goto err_release;
599 } 599 }
600 600
601 if (count == 0) 601 if (count == 0)
@@ -604,9 +604,8 @@ static int if_cs_prog_helper(struct if_cs_card *card)
604 sent += count; 604 sent += count;
605 } 605 }
606 606
607err_release:
607 release_firmware(fw); 608 release_firmware(fw);
608 ret = 0;
609
610done: 609done:
611 lbs_deb_leave_args(LBS_DEB_CS, "ret %d", ret); 610 lbs_deb_leave_args(LBS_DEB_CS, "ret %d", ret);
612 return ret; 611 return ret;
@@ -676,14 +675,8 @@ static int if_cs_prog_real(struct if_cs_card *card)
676 } 675 }
677 676
678 ret = if_cs_poll_while_fw_download(card, IF_CS_SCRATCH, 0x5a); 677 ret = if_cs_poll_while_fw_download(card, IF_CS_SCRATCH, 0x5a);
679 if (ret < 0) { 678 if (ret < 0)
680 lbs_pr_err("firmware download failed\n"); 679 lbs_pr_err("firmware download failed\n");
681 goto err_release;
682 }
683
684 ret = 0;
685 goto done;
686
687 680
688err_release: 681err_release:
689 release_firmware(fw); 682 release_firmware(fw);
diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c
index 1ebcafe7ca5f..36c004e15602 100644
--- a/drivers/net/wireless/orinoco.c
+++ b/drivers/net/wireless/orinoco.c
@@ -1970,6 +1970,9 @@ __orinoco_set_multicast_list(struct net_device *dev)
1970 priv->promiscuous = promisc; 1970 priv->promiscuous = promisc;
1971 } 1971 }
1972 1972
1973 /* If we're not in promiscuous mode, then we need to set the
1974 * group address if either we want to multicast, or if we were
1975 * multicasting and want to stop */
1973 if (! promisc && (mc_count || priv->mc_count) ) { 1976 if (! promisc && (mc_count || priv->mc_count) ) {
1974 struct dev_mc_list *p = dev->mc_list; 1977 struct dev_mc_list *p = dev->mc_list;
1975 struct hermes_multicast mclist; 1978 struct hermes_multicast mclist;
@@ -1989,9 +1992,10 @@ __orinoco_set_multicast_list(struct net_device *dev)
1989 printk(KERN_WARNING "%s: Multicast list is " 1992 printk(KERN_WARNING "%s: Multicast list is "
1990 "longer than mc_count\n", dev->name); 1993 "longer than mc_count\n", dev->name);
1991 1994
1992 err = hermes_write_ltv(hw, USER_BAP, HERMES_RID_CNFGROUPADDRESSES, 1995 err = hermes_write_ltv(hw, USER_BAP,
1993 HERMES_BYTES_TO_RECLEN(priv->mc_count * ETH_ALEN), 1996 HERMES_RID_CNFGROUPADDRESSES,
1994 &mclist); 1997 HERMES_BYTES_TO_RECLEN(mc_count * ETH_ALEN),
1998 &mclist);
1995 if (err) 1999 if (err)
1996 printk(KERN_ERR "%s: Error %d setting multicast list.\n", 2000 printk(KERN_ERR "%s: Error %d setting multicast list.\n",
1997 dev->name, err); 2001 dev->name, err);
diff --git a/drivers/net/wireless/rt2x00/rt2x00reg.h b/drivers/net/wireless/rt2x00/rt2x00reg.h
index 7e88ce5651b9..2ea7866abd5d 100644
--- a/drivers/net/wireless/rt2x00/rt2x00reg.h
+++ b/drivers/net/wireless/rt2x00/rt2x00reg.h
@@ -136,7 +136,7 @@ struct rt2x00_field32 {
136 */ 136 */
137#define is_power_of_two(x) ( !((x) & ((x)-1)) ) 137#define is_power_of_two(x) ( !((x) & ((x)-1)) )
138#define low_bit_mask(x) ( ((x)-1) & ~(x) ) 138#define low_bit_mask(x) ( ((x)-1) & ~(x) )
139#define is_valid_mask(x) is_power_of_two(1 + (x) + low_bit_mask(x)) 139#define is_valid_mask(x) is_power_of_two(1LU + (x) + low_bit_mask(x))
140 140
141/* 141/*
142 * Macro's to find first set bit in a variable. 142 * Macro's to find first set bit in a variable.
@@ -173,8 +173,7 @@ struct rt2x00_field32 {
173 * does not exceed the given typelimit. 173 * does not exceed the given typelimit.
174 */ 174 */
175#define FIELD_CHECK(__mask, __type) \ 175#define FIELD_CHECK(__mask, __type) \
176 BUILD_BUG_ON(!__builtin_constant_p(__mask) || \ 176 BUILD_BUG_ON(!(__mask) || \
177 !(__mask) || \
178 !is_valid_mask(__mask) || \ 177 !is_valid_mask(__mask) || \
179 (__mask) != (__type)(__mask)) \ 178 (__mask) != (__type)(__mask)) \
180 179