aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/arm/am79c961a.c20
-rw-r--r--drivers/net/bnx2x.h11
-rw-r--r--drivers/net/bnx2x_link.c64
-rw-r--r--drivers/net/bnx2x_main.c302
-rw-r--r--drivers/net/bnx2x_reg.h2
-rw-r--r--drivers/net/cxgb3/sge.c1
-rw-r--r--drivers/net/e1000e/82571.c6
-rw-r--r--drivers/net/e1000e/hw.h1
-rw-r--r--drivers/net/gianfar.c6
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c62
-rw-r--r--drivers/net/ixgbe/ixgbe_type.h3
-rw-r--r--drivers/net/korina.c15
-rw-r--r--drivers/net/macb.c8
-rw-r--r--drivers/net/mlx4/profile.c6
-rw-r--r--drivers/net/mv643xx_eth.c17
-rw-r--r--drivers/net/myri10ge/myri10ge.c15
-rw-r--r--drivers/net/netxen/netxen_nic.h12
-rw-r--r--drivers/net/netxen/netxen_nic_ethtool.c5
-rw-r--r--drivers/net/netxen/netxen_nic_main.c31
-rw-r--r--drivers/net/phy/mdio_bus.c8
-rw-r--r--drivers/net/phy/smsc.c12
-rw-r--r--drivers/net/tg3.c81
-rw-r--r--drivers/net/tg3.h1
-rw-r--r--drivers/net/usb/mcs7830.c20
-rw-r--r--drivers/net/via-velocity.c2
-rw-r--r--drivers/net/virtio_net.c3
-rw-r--r--drivers/net/wimax/i2400m/control.c2
-rw-r--r--drivers/net/wimax/i2400m/usb-rx.c9
-rw-r--r--drivers/net/wireless/ath9k/rc.c2
-rw-r--r--drivers/net/wireless/ath9k/regd_common.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-rs.c14
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rs.c14
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-hcmd.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c4
-rw-r--r--drivers/net/wireless/libertas/hostcmd.h91
-rw-r--r--drivers/net/wireless/orinoco/orinoco.c32
-rw-r--r--drivers/net/wireless/p54/p54common.c30
-rw-r--r--drivers/net/wireless/p54/p54usb.c41
-rw-r--r--drivers/net/wireless/rndis_wlan.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.c3
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00rfkill.c2
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187_dev.c1
-rw-r--r--drivers/net/wireless/zd1211rw/zd_usb.c1
44 files changed, 582 insertions, 386 deletions
diff --git a/drivers/net/arm/am79c961a.c b/drivers/net/arm/am79c961a.c
index 0c628a9e5339..c2d012fcc29b 100644
--- a/drivers/net/arm/am79c961a.c
+++ b/drivers/net/arm/am79c961a.c
@@ -208,9 +208,9 @@ am79c961_init_for_open(struct net_device *dev)
208 /* 208 /*
209 * Stop the chip. 209 * Stop the chip.
210 */ 210 */
211 spin_lock_irqsave(priv->chip_lock, flags); 211 spin_lock_irqsave(&priv->chip_lock, flags);
212 write_rreg (dev->base_addr, CSR0, CSR0_BABL|CSR0_CERR|CSR0_MISS|CSR0_MERR|CSR0_TINT|CSR0_RINT|CSR0_STOP); 212 write_rreg (dev->base_addr, CSR0, CSR0_BABL|CSR0_CERR|CSR0_MISS|CSR0_MERR|CSR0_TINT|CSR0_RINT|CSR0_STOP);
213 spin_unlock_irqrestore(priv->chip_lock, flags); 213 spin_unlock_irqrestore(&priv->chip_lock, flags);
214 214
215 write_ireg (dev->base_addr, 5, 0x00a0); /* Receive address LED */ 215 write_ireg (dev->base_addr, 5, 0x00a0); /* Receive address LED */
216 write_ireg (dev->base_addr, 6, 0x0081); /* Collision LED */ 216 write_ireg (dev->base_addr, 6, 0x0081); /* Collision LED */
@@ -332,10 +332,10 @@ am79c961_close(struct net_device *dev)
332 netif_stop_queue(dev); 332 netif_stop_queue(dev);
333 netif_carrier_off(dev); 333 netif_carrier_off(dev);
334 334
335 spin_lock_irqsave(priv->chip_lock, flags); 335 spin_lock_irqsave(&priv->chip_lock, flags);
336 write_rreg (dev->base_addr, CSR0, CSR0_STOP); 336 write_rreg (dev->base_addr, CSR0, CSR0_STOP);
337 write_rreg (dev->base_addr, CSR3, CSR3_MASKALL); 337 write_rreg (dev->base_addr, CSR3, CSR3_MASKALL);
338 spin_unlock_irqrestore(priv->chip_lock, flags); 338 spin_unlock_irqrestore(&priv->chip_lock, flags);
339 339
340 free_irq (dev->irq, dev); 340 free_irq (dev->irq, dev);
341 341
@@ -391,7 +391,7 @@ static void am79c961_setmulticastlist (struct net_device *dev)
391 am79c961_mc_hash(dmi, multi_hash); 391 am79c961_mc_hash(dmi, multi_hash);
392 } 392 }
393 393
394 spin_lock_irqsave(priv->chip_lock, flags); 394 spin_lock_irqsave(&priv->chip_lock, flags);
395 395
396 stopped = read_rreg(dev->base_addr, CSR0) & CSR0_STOP; 396 stopped = read_rreg(dev->base_addr, CSR0) & CSR0_STOP;
397 397
@@ -405,9 +405,9 @@ static void am79c961_setmulticastlist (struct net_device *dev)
405 * Spin waiting for chip to report suspend mode 405 * Spin waiting for chip to report suspend mode
406 */ 406 */
407 while ((read_rreg(dev->base_addr, CTRL1) & CTRL1_SPND) == 0) { 407 while ((read_rreg(dev->base_addr, CTRL1) & CTRL1_SPND) == 0) {
408 spin_unlock_irqrestore(priv->chip_lock, flags); 408 spin_unlock_irqrestore(&priv->chip_lock, flags);
409 nop(); 409 nop();
410 spin_lock_irqsave(priv->chip_lock, flags); 410 spin_lock_irqsave(&priv->chip_lock, flags);
411 } 411 }
412 } 412 }
413 413
@@ -429,7 +429,7 @@ static void am79c961_setmulticastlist (struct net_device *dev)
429 write_rreg(dev->base_addr, CTRL1, 0); 429 write_rreg(dev->base_addr, CTRL1, 0);
430 } 430 }
431 431
432 spin_unlock_irqrestore(priv->chip_lock, flags); 432 spin_unlock_irqrestore(&priv->chip_lock, flags);
433} 433}
434 434
435static void am79c961_timeout(struct net_device *dev) 435static void am79c961_timeout(struct net_device *dev)
@@ -467,10 +467,10 @@ am79c961_sendpacket(struct sk_buff *skb, struct net_device *dev)
467 am_writeword (dev, hdraddr + 2, TMD_OWN|TMD_STP|TMD_ENP); 467 am_writeword (dev, hdraddr + 2, TMD_OWN|TMD_STP|TMD_ENP);
468 priv->txhead = head; 468 priv->txhead = head;
469 469
470 spin_lock_irqsave(priv->chip_lock, flags); 470 spin_lock_irqsave(&priv->chip_lock, flags);
471 write_rreg (dev->base_addr, CSR0, CSR0_TDMD|CSR0_IENA); 471 write_rreg (dev->base_addr, CSR0, CSR0_TDMD|CSR0_IENA);
472 dev->trans_start = jiffies; 472 dev->trans_start = jiffies;
473 spin_unlock_irqrestore(priv->chip_lock, flags); 473 spin_unlock_irqrestore(&priv->chip_lock, flags);
474 474
475 /* 475 /*
476 * If the next packet is owned by the ethernet device, 476 * If the next packet is owned by the ethernet device,
diff --git a/drivers/net/bnx2x.h b/drivers/net/bnx2x.h
index 6fcccef4cf3d..15a5cf0f676b 100644
--- a/drivers/net/bnx2x.h
+++ b/drivers/net/bnx2x.h
@@ -1,6 +1,6 @@
1/* bnx2x.h: Broadcom Everest network driver. 1/* bnx2x.h: Broadcom Everest network driver.
2 * 2 *
3 * Copyright (c) 2007-2008 Broadcom Corporation 3 * Copyright (c) 2007-2009 Broadcom Corporation
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
@@ -271,14 +271,7 @@ struct bnx2x_fastpath {
271 271
272#define bnx2x_fp(bp, nr, var) (bp->fp[nr].var) 272#define bnx2x_fp(bp, nr, var) (bp->fp[nr].var)
273 273
274#define BNX2X_HAS_TX_WORK(fp) \ 274#define BNX2X_HAS_WORK(fp) (bnx2x_has_rx_work(fp) || bnx2x_has_tx_work(fp))
275 ((fp->tx_pkt_prod != le16_to_cpu(*fp->tx_cons_sb)) || \
276 (fp->tx_pkt_prod != fp->tx_pkt_cons))
277
278#define BNX2X_HAS_RX_WORK(fp) \
279 (fp->rx_comp_cons != rx_cons_sb)
280
281#define BNX2X_HAS_WORK(fp) (BNX2X_HAS_RX_WORK(fp) || BNX2X_HAS_TX_WORK(fp))
282 275
283 276
284/* MC hsi */ 277/* MC hsi */
diff --git a/drivers/net/bnx2x_link.c b/drivers/net/bnx2x_link.c
index fefa6ab13064..aea26b4dc453 100644
--- a/drivers/net/bnx2x_link.c
+++ b/drivers/net/bnx2x_link.c
@@ -1,4 +1,4 @@
1/* Copyright 2008 Broadcom Corporation 1/* Copyright 2008-2009 Broadcom Corporation
2 * 2 *
3 * Unless you and Broadcom execute a separate written software license 3 * Unless you and Broadcom execute a separate written software license
4 * agreement governing use of this software, this software is licensed to you 4 * agreement governing use of this software, this software is licensed to you
@@ -317,6 +317,9 @@ static u8 bnx2x_emac_enable(struct link_params *params,
317 val &= ~0x810; 317 val &= ~0x810;
318 EMAC_WR(bp, EMAC_REG_EMAC_MODE, val); 318 EMAC_WR(bp, EMAC_REG_EMAC_MODE, val);
319 319
320 /* enable emac */
321 REG_WR(bp, NIG_REG_NIG_EMAC0_EN + port*4, 1);
322
320 /* enable emac for jumbo packets */ 323 /* enable emac for jumbo packets */
321 EMAC_WR(bp, EMAC_REG_EMAC_RX_MTU_SIZE, 324 EMAC_WR(bp, EMAC_REG_EMAC_RX_MTU_SIZE,
322 (EMAC_RX_MTU_SIZE_JUMBO_ENA | 325 (EMAC_RX_MTU_SIZE_JUMBO_ENA |
@@ -1609,7 +1612,7 @@ static u8 bnx2x_link_settings_status(struct link_params *params,
1609 u32 gp_status) 1612 u32 gp_status)
1610{ 1613{
1611 struct bnx2x *bp = params->bp; 1614 struct bnx2x *bp = params->bp;
1612 1615 u16 new_line_speed;
1613 u8 rc = 0; 1616 u8 rc = 0;
1614 vars->link_status = 0; 1617 vars->link_status = 0;
1615 1618
@@ -1629,7 +1632,7 @@ static u8 bnx2x_link_settings_status(struct link_params *params,
1629 1632
1630 switch (gp_status & GP_STATUS_SPEED_MASK) { 1633 switch (gp_status & GP_STATUS_SPEED_MASK) {
1631 case GP_STATUS_10M: 1634 case GP_STATUS_10M:
1632 vars->line_speed = SPEED_10; 1635 new_line_speed = SPEED_10;
1633 if (vars->duplex == DUPLEX_FULL) 1636 if (vars->duplex == DUPLEX_FULL)
1634 vars->link_status |= LINK_10TFD; 1637 vars->link_status |= LINK_10TFD;
1635 else 1638 else
@@ -1637,7 +1640,7 @@ static u8 bnx2x_link_settings_status(struct link_params *params,
1637 break; 1640 break;
1638 1641
1639 case GP_STATUS_100M: 1642 case GP_STATUS_100M:
1640 vars->line_speed = SPEED_100; 1643 new_line_speed = SPEED_100;
1641 if (vars->duplex == DUPLEX_FULL) 1644 if (vars->duplex == DUPLEX_FULL)
1642 vars->link_status |= LINK_100TXFD; 1645 vars->link_status |= LINK_100TXFD;
1643 else 1646 else
@@ -1646,7 +1649,7 @@ static u8 bnx2x_link_settings_status(struct link_params *params,
1646 1649
1647 case GP_STATUS_1G: 1650 case GP_STATUS_1G:
1648 case GP_STATUS_1G_KX: 1651 case GP_STATUS_1G_KX:
1649 vars->line_speed = SPEED_1000; 1652 new_line_speed = SPEED_1000;
1650 if (vars->duplex == DUPLEX_FULL) 1653 if (vars->duplex == DUPLEX_FULL)
1651 vars->link_status |= LINK_1000TFD; 1654 vars->link_status |= LINK_1000TFD;
1652 else 1655 else
@@ -1654,7 +1657,7 @@ static u8 bnx2x_link_settings_status(struct link_params *params,
1654 break; 1657 break;
1655 1658
1656 case GP_STATUS_2_5G: 1659 case GP_STATUS_2_5G:
1657 vars->line_speed = SPEED_2500; 1660 new_line_speed = SPEED_2500;
1658 if (vars->duplex == DUPLEX_FULL) 1661 if (vars->duplex == DUPLEX_FULL)
1659 vars->link_status |= LINK_2500TFD; 1662 vars->link_status |= LINK_2500TFD;
1660 else 1663 else
@@ -1671,32 +1674,32 @@ static u8 bnx2x_link_settings_status(struct link_params *params,
1671 case GP_STATUS_10G_KX4: 1674 case GP_STATUS_10G_KX4:
1672 case GP_STATUS_10G_HIG: 1675 case GP_STATUS_10G_HIG:
1673 case GP_STATUS_10G_CX4: 1676 case GP_STATUS_10G_CX4:
1674 vars->line_speed = SPEED_10000; 1677 new_line_speed = SPEED_10000;
1675 vars->link_status |= LINK_10GTFD; 1678 vars->link_status |= LINK_10GTFD;
1676 break; 1679 break;
1677 1680
1678 case GP_STATUS_12G_HIG: 1681 case GP_STATUS_12G_HIG:
1679 vars->line_speed = SPEED_12000; 1682 new_line_speed = SPEED_12000;
1680 vars->link_status |= LINK_12GTFD; 1683 vars->link_status |= LINK_12GTFD;
1681 break; 1684 break;
1682 1685
1683 case GP_STATUS_12_5G: 1686 case GP_STATUS_12_5G:
1684 vars->line_speed = SPEED_12500; 1687 new_line_speed = SPEED_12500;
1685 vars->link_status |= LINK_12_5GTFD; 1688 vars->link_status |= LINK_12_5GTFD;
1686 break; 1689 break;
1687 1690
1688 case GP_STATUS_13G: 1691 case GP_STATUS_13G:
1689 vars->line_speed = SPEED_13000; 1692 new_line_speed = SPEED_13000;
1690 vars->link_status |= LINK_13GTFD; 1693 vars->link_status |= LINK_13GTFD;
1691 break; 1694 break;
1692 1695
1693 case GP_STATUS_15G: 1696 case GP_STATUS_15G:
1694 vars->line_speed = SPEED_15000; 1697 new_line_speed = SPEED_15000;
1695 vars->link_status |= LINK_15GTFD; 1698 vars->link_status |= LINK_15GTFD;
1696 break; 1699 break;
1697 1700
1698 case GP_STATUS_16G: 1701 case GP_STATUS_16G:
1699 vars->line_speed = SPEED_16000; 1702 new_line_speed = SPEED_16000;
1700 vars->link_status |= LINK_16GTFD; 1703 vars->link_status |= LINK_16GTFD;
1701 break; 1704 break;
1702 1705
@@ -1708,6 +1711,15 @@ static u8 bnx2x_link_settings_status(struct link_params *params,
1708 break; 1711 break;
1709 } 1712 }
1710 1713
1714 /* Upon link speed change set the NIG into drain mode.
1715 Comes to deals with possible FIFO glitch due to clk change
1716 when speed is decreased without link down indicator */
1717 if (new_line_speed != vars->line_speed) {
1718 REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE
1719 + params->port*4, 0);
1720 msleep(1);
1721 }
1722 vars->line_speed = new_line_speed;
1711 vars->link_status |= LINK_STATUS_SERDES_LINK; 1723 vars->link_status |= LINK_STATUS_SERDES_LINK;
1712 1724
1713 if ((params->req_line_speed == SPEED_AUTO_NEG) && 1725 if ((params->req_line_speed == SPEED_AUTO_NEG) &&
@@ -3571,7 +3583,7 @@ static void bnx2x_set_xgxs_loopback(struct link_params *params,
3571 (MDIO_REG_BANK_CL73_IEEEB0 + 3583 (MDIO_REG_BANK_CL73_IEEEB0 +
3572 (MDIO_CL73_IEEEB0_CL73_AN_CONTROL & 0xf)), 3584 (MDIO_CL73_IEEEB0_CL73_AN_CONTROL & 0xf)),
3573 0x6041); 3585 0x6041);
3574 3586 msleep(200);
3575 /* set aer mmd back */ 3587 /* set aer mmd back */
3576 bnx2x_set_aer_mmd(params, vars); 3588 bnx2x_set_aer_mmd(params, vars);
3577 3589
@@ -3870,9 +3882,15 @@ static u8 bnx2x_link_initialize(struct link_params *params,
3870 } 3882 }
3871 3883
3872 if (vars->phy_flags & PHY_XGXS_FLAG) { 3884 if (vars->phy_flags & PHY_XGXS_FLAG) {
3873 if (params->req_line_speed && 3885 if ((params->req_line_speed &&
3874 ((params->req_line_speed == SPEED_100) || 3886 ((params->req_line_speed == SPEED_100) ||
3875 (params->req_line_speed == SPEED_10))) { 3887 (params->req_line_speed == SPEED_10))) ||
3888 (!params->req_line_speed &&
3889 (params->speed_cap_mask >=
3890 PORT_HW_CFG_SPEED_CAPABILITY_D0_10M_FULL) &&
3891 (params->speed_cap_mask <
3892 PORT_HW_CFG_SPEED_CAPABILITY_D0_1G)
3893 )) {
3876 vars->phy_flags |= PHY_SGMII_FLAG; 3894 vars->phy_flags |= PHY_SGMII_FLAG;
3877 } else { 3895 } else {
3878 vars->phy_flags &= ~PHY_SGMII_FLAG; 3896 vars->phy_flags &= ~PHY_SGMII_FLAG;
@@ -4194,6 +4212,11 @@ static u8 bnx2x_update_link_down(struct link_params *params,
4194 /* activate nig drain */ 4212 /* activate nig drain */
4195 REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + port*4, 1); 4213 REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + port*4, 1);
4196 4214
4215 /* disable emac */
4216 REG_WR(bp, NIG_REG_NIG_EMAC0_EN + port*4, 0);
4217
4218 msleep(10);
4219
4197 /* reset BigMac */ 4220 /* reset BigMac */
4198 bnx2x_bmac_rx_disable(bp, params->port); 4221 bnx2x_bmac_rx_disable(bp, params->port);
4199 REG_WR(bp, GRCBASE_MISC + 4222 REG_WR(bp, GRCBASE_MISC +
@@ -4238,6 +4261,7 @@ static u8 bnx2x_update_link_up(struct link_params *params,
4238 4261
4239 /* update shared memory */ 4262 /* update shared memory */
4240 bnx2x_update_mng(params, vars->link_status); 4263 bnx2x_update_mng(params, vars->link_status);
4264 msleep(20);
4241 return rc; 4265 return rc;
4242} 4266}
4243/* This function should called upon link interrupt */ 4267/* This function should called upon link interrupt */
@@ -4276,6 +4300,9 @@ u8 bnx2x_link_update(struct link_params *params, struct link_vars *vars)
4276 REG_RD(bp, NIG_REG_XGXS0_STATUS_LINK10G + port*0x68), 4300 REG_RD(bp, NIG_REG_XGXS0_STATUS_LINK10G + port*0x68),
4277 REG_RD(bp, NIG_REG_XGXS0_STATUS_LINK_STATUS + port*0x68)); 4301 REG_RD(bp, NIG_REG_XGXS0_STATUS_LINK_STATUS + port*0x68));
4278 4302
4303 /* disable emac */
4304 REG_WR(bp, NIG_REG_NIG_EMAC0_EN + port*4, 0);
4305
4279 ext_phy_type = XGXS_EXT_PHY_TYPE(params->ext_phy_config); 4306 ext_phy_type = XGXS_EXT_PHY_TYPE(params->ext_phy_config);
4280 4307
4281 /* Check external link change only for non-direct */ 4308 /* Check external link change only for non-direct */
@@ -4377,10 +4404,11 @@ static u8 bnx2x_8073_common_init_phy(struct bnx2x *bp, u32 shmem_base)
4377 ext_phy_addr[port], 4404 ext_phy_addr[port],
4378 MDIO_PMA_DEVAD, 4405 MDIO_PMA_DEVAD,
4379 MDIO_PMA_REG_ROM_VER1, &fw_ver1); 4406 MDIO_PMA_REG_ROM_VER1, &fw_ver1);
4380 if (fw_ver1 == 0) { 4407 if (fw_ver1 == 0 || fw_ver1 == 0x4321) {
4381 DP(NETIF_MSG_LINK, 4408 DP(NETIF_MSG_LINK,
4382 "bnx2x_8073_common_init_phy port %x " 4409 "bnx2x_8073_common_init_phy port %x:"
4383 "fw Download failed\n", port); 4410 "Download failed. fw version = 0x%x\n",
4411 port, fw_ver1);
4384 return -EINVAL; 4412 return -EINVAL;
4385 } 4413 }
4386 4414
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c
index 7c533797c064..d3e7775a9ccf 100644
--- a/drivers/net/bnx2x_main.c
+++ b/drivers/net/bnx2x_main.c
@@ -1,6 +1,6 @@
1/* bnx2x_main.c: Broadcom Everest network driver. 1/* bnx2x_main.c: Broadcom Everest network driver.
2 * 2 *
3 * Copyright (c) 2007-2008 Broadcom Corporation 3 * Copyright (c) 2007-2009 Broadcom Corporation
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
@@ -57,8 +57,8 @@
57#include "bnx2x.h" 57#include "bnx2x.h"
58#include "bnx2x_init.h" 58#include "bnx2x_init.h"
59 59
60#define DRV_MODULE_VERSION "1.45.23" 60#define DRV_MODULE_VERSION "1.45.26"
61#define DRV_MODULE_RELDATE "2008/11/03" 61#define DRV_MODULE_RELDATE "2009/01/26"
62#define BNX2X_BC_VER 0x040200 62#define BNX2X_BC_VER 0x040200
63 63
64/* Time in jiffies before concluding the transmitter is hung */ 64/* Time in jiffies before concluding the transmitter is hung */
@@ -69,7 +69,7 @@ static char version[] __devinitdata =
69 DRV_MODULE_NAME " " DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; 69 DRV_MODULE_NAME " " DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
70 70
71MODULE_AUTHOR("Eliezer Tamir"); 71MODULE_AUTHOR("Eliezer Tamir");
72MODULE_DESCRIPTION("Broadcom NetXtreme II BCM57710 Driver"); 72MODULE_DESCRIPTION("Broadcom NetXtreme II BCM57710/57711/57711E Driver");
73MODULE_LICENSE("GPL"); 73MODULE_LICENSE("GPL");
74MODULE_VERSION(DRV_MODULE_VERSION); 74MODULE_VERSION(DRV_MODULE_VERSION);
75 75
@@ -733,6 +733,24 @@ static u16 bnx2x_ack_int(struct bnx2x *bp)
733 * fast path service functions 733 * fast path service functions
734 */ 734 */
735 735
736static inline int bnx2x_has_tx_work(struct bnx2x_fastpath *fp)
737{
738 u16 tx_cons_sb;
739
740 /* Tell compiler that status block fields can change */
741 barrier();
742 tx_cons_sb = le16_to_cpu(*fp->tx_cons_sb);
743 return (fp->tx_pkt_cons != tx_cons_sb);
744}
745
746static inline int bnx2x_has_tx_work_unload(struct bnx2x_fastpath *fp)
747{
748 /* Tell compiler that consumer and producer can change */
749 barrier();
750 return (fp->tx_pkt_prod != fp->tx_pkt_cons);
751
752}
753
736/* free skb in the packet ring at pos idx 754/* free skb in the packet ring at pos idx
737 * return idx of last bd freed 755 * return idx of last bd freed
738 */ 756 */
@@ -5137,12 +5155,21 @@ static void enable_blocks_attention(struct bnx2x *bp)
5137} 5155}
5138 5156
5139 5157
5158static void bnx2x_reset_common(struct bnx2x *bp)
5159{
5160 /* reset_common */
5161 REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_CLEAR,
5162 0xd3ffff7f);
5163 REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_CLEAR, 0x1403);
5164}
5165
5140static int bnx2x_init_common(struct bnx2x *bp) 5166static int bnx2x_init_common(struct bnx2x *bp)
5141{ 5167{
5142 u32 val, i; 5168 u32 val, i;
5143 5169
5144 DP(BNX2X_MSG_MCP, "starting common init func %d\n", BP_FUNC(bp)); 5170 DP(BNX2X_MSG_MCP, "starting common init func %d\n", BP_FUNC(bp));
5145 5171
5172 bnx2x_reset_common(bp);
5146 REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_SET, 0xffffffff); 5173 REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_SET, 0xffffffff);
5147 REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_SET, 0xfffc); 5174 REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_SET, 0xfffc);
5148 5175
@@ -6123,8 +6150,8 @@ static void bnx2x_netif_start(struct bnx2x *bp)
6123static void bnx2x_netif_stop(struct bnx2x *bp, int disable_hw) 6150static void bnx2x_netif_stop(struct bnx2x *bp, int disable_hw)
6124{ 6151{
6125 bnx2x_int_disable_sync(bp, disable_hw); 6152 bnx2x_int_disable_sync(bp, disable_hw);
6153 bnx2x_napi_disable(bp);
6126 if (netif_running(bp->dev)) { 6154 if (netif_running(bp->dev)) {
6127 bnx2x_napi_disable(bp);
6128 netif_tx_disable(bp->dev); 6155 netif_tx_disable(bp->dev);
6129 bp->dev->trans_start = jiffies; /* prevent tx timeout */ 6156 bp->dev->trans_start = jiffies; /* prevent tx timeout */
6130 } 6157 }
@@ -6144,7 +6171,7 @@ static void bnx2x_set_mac_addr_e1(struct bnx2x *bp, int set)
6144 * multicast 64-127:port0 128-191:port1 6171 * multicast 64-127:port0 128-191:port1
6145 */ 6172 */
6146 config->hdr.length_6b = 2; 6173 config->hdr.length_6b = 2;
6147 config->hdr.offset = port ? 31 : 0; 6174 config->hdr.offset = port ? 32 : 0;
6148 config->hdr.client_id = BP_CL_ID(bp); 6175 config->hdr.client_id = BP_CL_ID(bp);
6149 config->hdr.reserved1 = 0; 6176 config->hdr.reserved1 = 0;
6150 6177
@@ -6308,7 +6335,7 @@ static void bnx2x_set_rx_mode(struct net_device *dev);
6308static int bnx2x_nic_load(struct bnx2x *bp, int load_mode) 6335static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
6309{ 6336{
6310 u32 load_code; 6337 u32 load_code;
6311 int i, rc; 6338 int i, rc = 0;
6312#ifdef BNX2X_STOP_ON_ERROR 6339#ifdef BNX2X_STOP_ON_ERROR
6313 if (unlikely(bp->panic)) 6340 if (unlikely(bp->panic))
6314 return -EPERM; 6341 return -EPERM;
@@ -6316,48 +6343,6 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
6316 6343
6317 bp->state = BNX2X_STATE_OPENING_WAIT4_LOAD; 6344 bp->state = BNX2X_STATE_OPENING_WAIT4_LOAD;
6318 6345
6319 /* Send LOAD_REQUEST command to MCP
6320 Returns the type of LOAD command:
6321 if it is the first port to be initialized
6322 common blocks should be initialized, otherwise - not
6323 */
6324 if (!BP_NOMCP(bp)) {
6325 load_code = bnx2x_fw_command(bp, DRV_MSG_CODE_LOAD_REQ);
6326 if (!load_code) {
6327 BNX2X_ERR("MCP response failure, aborting\n");
6328 return -EBUSY;
6329 }
6330 if (load_code == FW_MSG_CODE_DRV_LOAD_REFUSED)
6331 return -EBUSY; /* other port in diagnostic mode */
6332
6333 } else {
6334 int port = BP_PORT(bp);
6335
6336 DP(NETIF_MSG_IFUP, "NO MCP load counts before us %d, %d, %d\n",
6337 load_count[0], load_count[1], load_count[2]);
6338 load_count[0]++;
6339 load_count[1 + port]++;
6340 DP(NETIF_MSG_IFUP, "NO MCP new load counts %d, %d, %d\n",
6341 load_count[0], load_count[1], load_count[2]);
6342 if (load_count[0] == 1)
6343 load_code = FW_MSG_CODE_DRV_LOAD_COMMON;
6344 else if (load_count[1 + port] == 1)
6345 load_code = FW_MSG_CODE_DRV_LOAD_PORT;
6346 else
6347 load_code = FW_MSG_CODE_DRV_LOAD_FUNCTION;
6348 }
6349
6350 if ((load_code == FW_MSG_CODE_DRV_LOAD_COMMON) ||
6351 (load_code == FW_MSG_CODE_DRV_LOAD_PORT))
6352 bp->port.pmf = 1;
6353 else
6354 bp->port.pmf = 0;
6355 DP(NETIF_MSG_LINK, "pmf %d\n", bp->port.pmf);
6356
6357 /* if we can't use MSI-X we only need one fp,
6358 * so try to enable MSI-X with the requested number of fp's
6359 * and fallback to inta with one fp
6360 */
6361 if (use_inta) { 6346 if (use_inta) {
6362 bp->num_queues = 1; 6347 bp->num_queues = 1;
6363 6348
@@ -6372,7 +6357,15 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
6372 else 6357 else
6373 bp->num_queues = 1; 6358 bp->num_queues = 1;
6374 6359
6375 if (bnx2x_enable_msix(bp)) { 6360 DP(NETIF_MSG_IFUP,
6361 "set number of queues to %d\n", bp->num_queues);
6362
6363 /* if we can't use MSI-X we only need one fp,
6364 * so try to enable MSI-X with the requested number of fp's
6365 * and fallback to MSI or legacy INTx with one fp
6366 */
6367 rc = bnx2x_enable_msix(bp);
6368 if (rc) {
6376 /* failed to enable MSI-X */ 6369 /* failed to enable MSI-X */
6377 bp->num_queues = 1; 6370 bp->num_queues = 1;
6378 if (use_multi) 6371 if (use_multi)
@@ -6380,8 +6373,6 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
6380 " to enable MSI-X\n"); 6373 " to enable MSI-X\n");
6381 } 6374 }
6382 } 6375 }
6383 DP(NETIF_MSG_IFUP,
6384 "set number of queues to %d\n", bp->num_queues);
6385 6376
6386 if (bnx2x_alloc_mem(bp)) 6377 if (bnx2x_alloc_mem(bp))
6387 return -ENOMEM; 6378 return -ENOMEM;
@@ -6390,30 +6381,85 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
6390 bnx2x_fp(bp, i, disable_tpa) = 6381 bnx2x_fp(bp, i, disable_tpa) =
6391 ((bp->flags & TPA_ENABLE_FLAG) == 0); 6382 ((bp->flags & TPA_ENABLE_FLAG) == 0);
6392 6383
6384 for_each_queue(bp, i)
6385 netif_napi_add(bp->dev, &bnx2x_fp(bp, i, napi),
6386 bnx2x_poll, 128);
6387
6388#ifdef BNX2X_STOP_ON_ERROR
6389 for_each_queue(bp, i) {
6390 struct bnx2x_fastpath *fp = &bp->fp[i];
6391
6392 fp->poll_no_work = 0;
6393 fp->poll_calls = 0;
6394 fp->poll_max_calls = 0;
6395 fp->poll_complete = 0;
6396 fp->poll_exit = 0;
6397 }
6398#endif
6399 bnx2x_napi_enable(bp);
6400
6393 if (bp->flags & USING_MSIX_FLAG) { 6401 if (bp->flags & USING_MSIX_FLAG) {
6394 rc = bnx2x_req_msix_irqs(bp); 6402 rc = bnx2x_req_msix_irqs(bp);
6395 if (rc) { 6403 if (rc) {
6396 pci_disable_msix(bp->pdev); 6404 pci_disable_msix(bp->pdev);
6397 goto load_error; 6405 goto load_error1;
6398 } 6406 }
6407 printk(KERN_INFO PFX "%s: using MSI-X\n", bp->dev->name);
6399 } else { 6408 } else {
6400 bnx2x_ack_int(bp); 6409 bnx2x_ack_int(bp);
6401 rc = bnx2x_req_irq(bp); 6410 rc = bnx2x_req_irq(bp);
6402 if (rc) { 6411 if (rc) {
6403 BNX2X_ERR("IRQ request failed, aborting\n"); 6412 BNX2X_ERR("IRQ request failed rc %d, aborting\n", rc);
6404 goto load_error; 6413 goto load_error1;
6405 } 6414 }
6406 } 6415 }
6407 6416
6408 for_each_queue(bp, i) 6417 /* Send LOAD_REQUEST command to MCP
6409 netif_napi_add(bp->dev, &bnx2x_fp(bp, i, napi), 6418 Returns the type of LOAD command:
6410 bnx2x_poll, 128); 6419 if it is the first port to be initialized
6420 common blocks should be initialized, otherwise - not
6421 */
6422 if (!BP_NOMCP(bp)) {
6423 load_code = bnx2x_fw_command(bp, DRV_MSG_CODE_LOAD_REQ);
6424 if (!load_code) {
6425 BNX2X_ERR("MCP response failure, aborting\n");
6426 rc = -EBUSY;
6427 goto load_error2;
6428 }
6429 if (load_code == FW_MSG_CODE_DRV_LOAD_REFUSED) {
6430 rc = -EBUSY; /* other port in diagnostic mode */
6431 goto load_error2;
6432 }
6433
6434 } else {
6435 int port = BP_PORT(bp);
6436
6437 DP(NETIF_MSG_IFUP, "NO MCP load counts before us %d, %d, %d\n",
6438 load_count[0], load_count[1], load_count[2]);
6439 load_count[0]++;
6440 load_count[1 + port]++;
6441 DP(NETIF_MSG_IFUP, "NO MCP new load counts %d, %d, %d\n",
6442 load_count[0], load_count[1], load_count[2]);
6443 if (load_count[0] == 1)
6444 load_code = FW_MSG_CODE_DRV_LOAD_COMMON;
6445 else if (load_count[1 + port] == 1)
6446 load_code = FW_MSG_CODE_DRV_LOAD_PORT;
6447 else
6448 load_code = FW_MSG_CODE_DRV_LOAD_FUNCTION;
6449 }
6450
6451 if ((load_code == FW_MSG_CODE_DRV_LOAD_COMMON) ||
6452 (load_code == FW_MSG_CODE_DRV_LOAD_PORT))
6453 bp->port.pmf = 1;
6454 else
6455 bp->port.pmf = 0;
6456 DP(NETIF_MSG_LINK, "pmf %d\n", bp->port.pmf);
6411 6457
6412 /* Initialize HW */ 6458 /* Initialize HW */
6413 rc = bnx2x_init_hw(bp, load_code); 6459 rc = bnx2x_init_hw(bp, load_code);
6414 if (rc) { 6460 if (rc) {
6415 BNX2X_ERR("HW init failed, aborting\n"); 6461 BNX2X_ERR("HW init failed, aborting\n");
6416 goto load_int_disable; 6462 goto load_error2;
6417 } 6463 }
6418 6464
6419 /* Setup NIC internals and enable interrupts */ 6465 /* Setup NIC internals and enable interrupts */
@@ -6425,7 +6471,7 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
6425 if (!load_code) { 6471 if (!load_code) {
6426 BNX2X_ERR("MCP response failure, aborting\n"); 6472 BNX2X_ERR("MCP response failure, aborting\n");
6427 rc = -EBUSY; 6473 rc = -EBUSY;
6428 goto load_rings_free; 6474 goto load_error3;
6429 } 6475 }
6430 } 6476 }
6431 6477
@@ -6434,7 +6480,7 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
6434 rc = bnx2x_setup_leading(bp); 6480 rc = bnx2x_setup_leading(bp);
6435 if (rc) { 6481 if (rc) {
6436 BNX2X_ERR("Setup leading failed!\n"); 6482 BNX2X_ERR("Setup leading failed!\n");
6437 goto load_netif_stop; 6483 goto load_error3;
6438 } 6484 }
6439 6485
6440 if (CHIP_IS_E1H(bp)) 6486 if (CHIP_IS_E1H(bp))
@@ -6447,7 +6493,7 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
6447 for_each_nondefault_queue(bp, i) { 6493 for_each_nondefault_queue(bp, i) {
6448 rc = bnx2x_setup_multi(bp, i); 6494 rc = bnx2x_setup_multi(bp, i);
6449 if (rc) 6495 if (rc)
6450 goto load_netif_stop; 6496 goto load_error3;
6451 } 6497 }
6452 6498
6453 if (CHIP_IS_E1(bp)) 6499 if (CHIP_IS_E1(bp))
@@ -6463,18 +6509,18 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
6463 case LOAD_NORMAL: 6509 case LOAD_NORMAL:
6464 /* Tx queue should be only reenabled */ 6510 /* Tx queue should be only reenabled */
6465 netif_wake_queue(bp->dev); 6511 netif_wake_queue(bp->dev);
6512 /* Initialize the receive filter. */
6466 bnx2x_set_rx_mode(bp->dev); 6513 bnx2x_set_rx_mode(bp->dev);
6467 break; 6514 break;
6468 6515
6469 case LOAD_OPEN: 6516 case LOAD_OPEN:
6470 netif_start_queue(bp->dev); 6517 netif_start_queue(bp->dev);
6518 /* Initialize the receive filter. */
6471 bnx2x_set_rx_mode(bp->dev); 6519 bnx2x_set_rx_mode(bp->dev);
6472 if (bp->flags & USING_MSIX_FLAG)
6473 printk(KERN_INFO PFX "%s: using MSI-X\n",
6474 bp->dev->name);
6475 break; 6520 break;
6476 6521
6477 case LOAD_DIAG: 6522 case LOAD_DIAG:
6523 /* Initialize the receive filter. */
6478 bnx2x_set_rx_mode(bp->dev); 6524 bnx2x_set_rx_mode(bp->dev);
6479 bp->state = BNX2X_STATE_DIAG; 6525 bp->state = BNX2X_STATE_DIAG;
6480 break; 6526 break;
@@ -6492,20 +6538,25 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
6492 6538
6493 return 0; 6539 return 0;
6494 6540
6495load_netif_stop: 6541load_error3:
6496 bnx2x_napi_disable(bp); 6542 bnx2x_int_disable_sync(bp, 1);
6497load_rings_free: 6543 if (!BP_NOMCP(bp)) {
6544 bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_REQ_WOL_MCP);
6545 bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_DONE);
6546 }
6547 bp->port.pmf = 0;
6498 /* Free SKBs, SGEs, TPA pool and driver internals */ 6548 /* Free SKBs, SGEs, TPA pool and driver internals */
6499 bnx2x_free_skbs(bp); 6549 bnx2x_free_skbs(bp);
6500 for_each_queue(bp, i) 6550 for_each_queue(bp, i)
6501 bnx2x_free_rx_sge_range(bp, bp->fp + i, NUM_RX_SGE); 6551 bnx2x_free_rx_sge_range(bp, bp->fp + i, NUM_RX_SGE);
6502load_int_disable: 6552load_error2:
6503 bnx2x_int_disable_sync(bp, 1);
6504 /* Release IRQs */ 6553 /* Release IRQs */
6505 bnx2x_free_irq(bp); 6554 bnx2x_free_irq(bp);
6506load_error: 6555load_error1:
6556 bnx2x_napi_disable(bp);
6557 for_each_queue(bp, i)
6558 netif_napi_del(&bnx2x_fp(bp, i, napi));
6507 bnx2x_free_mem(bp); 6559 bnx2x_free_mem(bp);
6508 bp->port.pmf = 0;
6509 6560
6510 /* TBD we really need to reset the chip 6561 /* TBD we really need to reset the chip
6511 if we want to recover from this */ 6562 if we want to recover from this */
@@ -6578,6 +6629,7 @@ static int bnx2x_stop_leading(struct bnx2x *bp)
6578 } 6629 }
6579 cnt--; 6630 cnt--;
6580 msleep(1); 6631 msleep(1);
6632 rmb(); /* Refresh the dsb_sp_prod */
6581 } 6633 }
6582 bp->state = BNX2X_STATE_CLOSING_WAIT4_UNLOAD; 6634 bp->state = BNX2X_STATE_CLOSING_WAIT4_UNLOAD;
6583 bp->fp[0].state = BNX2X_FP_STATE_CLOSED; 6635 bp->fp[0].state = BNX2X_FP_STATE_CLOSED;
@@ -6629,14 +6681,6 @@ static void bnx2x_reset_port(struct bnx2x *bp)
6629 /* TODO: Close Doorbell port? */ 6681 /* TODO: Close Doorbell port? */
6630} 6682}
6631 6683
6632static void bnx2x_reset_common(struct bnx2x *bp)
6633{
6634 /* reset_common */
6635 REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_CLEAR,
6636 0xd3ffff7f);
6637 REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_CLEAR, 0x1403);
6638}
6639
6640static void bnx2x_reset_chip(struct bnx2x *bp, u32 reset_code) 6684static void bnx2x_reset_chip(struct bnx2x *bp, u32 reset_code)
6641{ 6685{
6642 DP(BNX2X_MSG_MCP, "function %d reset_code %x\n", 6686 DP(BNX2X_MSG_MCP, "function %d reset_code %x\n",
@@ -6677,20 +6721,22 @@ static int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode)
6677 bnx2x_set_storm_rx_mode(bp); 6721 bnx2x_set_storm_rx_mode(bp);
6678 6722
6679 bnx2x_netif_stop(bp, 1); 6723 bnx2x_netif_stop(bp, 1);
6680 if (!netif_running(bp->dev)) 6724
6681 bnx2x_napi_disable(bp);
6682 del_timer_sync(&bp->timer); 6725 del_timer_sync(&bp->timer);
6683 SHMEM_WR(bp, func_mb[BP_FUNC(bp)].drv_pulse_mb, 6726 SHMEM_WR(bp, func_mb[BP_FUNC(bp)].drv_pulse_mb,
6684 (DRV_PULSE_ALWAYS_ALIVE | bp->fw_drv_pulse_wr_seq)); 6727 (DRV_PULSE_ALWAYS_ALIVE | bp->fw_drv_pulse_wr_seq));
6685 bnx2x_stats_handle(bp, STATS_EVENT_STOP); 6728 bnx2x_stats_handle(bp, STATS_EVENT_STOP);
6686 6729
6730 /* Release IRQs */
6731 bnx2x_free_irq(bp);
6732
6687 /* Wait until tx fast path tasks complete */ 6733 /* Wait until tx fast path tasks complete */
6688 for_each_queue(bp, i) { 6734 for_each_queue(bp, i) {
6689 struct bnx2x_fastpath *fp = &bp->fp[i]; 6735 struct bnx2x_fastpath *fp = &bp->fp[i];
6690 6736
6691 cnt = 1000; 6737 cnt = 1000;
6692 smp_rmb(); 6738 smp_rmb();
6693 while (BNX2X_HAS_TX_WORK(fp)) { 6739 while (bnx2x_has_tx_work_unload(fp)) {
6694 6740
6695 bnx2x_tx_int(fp, 1000); 6741 bnx2x_tx_int(fp, 1000);
6696 if (!cnt) { 6742 if (!cnt) {
@@ -6711,9 +6757,6 @@ static int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode)
6711 /* Give HW time to discard old tx messages */ 6757 /* Give HW time to discard old tx messages */
6712 msleep(1); 6758 msleep(1);
6713 6759
6714 /* Release IRQs */
6715 bnx2x_free_irq(bp);
6716
6717 if (CHIP_IS_E1(bp)) { 6760 if (CHIP_IS_E1(bp)) {
6718 struct mac_configuration_cmd *config = 6761 struct mac_configuration_cmd *config =
6719 bnx2x_sp(bp, mcast_config); 6762 bnx2x_sp(bp, mcast_config);
@@ -6822,6 +6865,8 @@ unload_error:
6822 bnx2x_free_skbs(bp); 6865 bnx2x_free_skbs(bp);
6823 for_each_queue(bp, i) 6866 for_each_queue(bp, i)
6824 bnx2x_free_rx_sge_range(bp, bp->fp + i, NUM_RX_SGE); 6867 bnx2x_free_rx_sge_range(bp, bp->fp + i, NUM_RX_SGE);
6868 for_each_queue(bp, i)
6869 netif_napi_del(&bnx2x_fp(bp, i, napi));
6825 bnx2x_free_mem(bp); 6870 bnx2x_free_mem(bp);
6826 6871
6827 bp->state = BNX2X_STATE_CLOSED; 6872 bp->state = BNX2X_STATE_CLOSED;
@@ -6874,10 +6919,6 @@ static void __devinit bnx2x_undi_unload(struct bnx2x *bp)
6874 */ 6919 */
6875 bnx2x_acquire_hw_lock(bp, HW_LOCK_RESOURCE_UNDI); 6920 bnx2x_acquire_hw_lock(bp, HW_LOCK_RESOURCE_UNDI);
6876 val = REG_RD(bp, DORQ_REG_NORM_CID_OFST); 6921 val = REG_RD(bp, DORQ_REG_NORM_CID_OFST);
6877 if (val == 0x7)
6878 REG_WR(bp, DORQ_REG_NORM_CID_OFST, 0);
6879 bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_UNDI);
6880
6881 if (val == 0x7) { 6922 if (val == 0x7) {
6882 u32 reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS; 6923 u32 reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS;
6883 /* save our func */ 6924 /* save our func */
@@ -6885,6 +6926,9 @@ static void __devinit bnx2x_undi_unload(struct bnx2x *bp)
6885 u32 swap_en; 6926 u32 swap_en;
6886 u32 swap_val; 6927 u32 swap_val;
6887 6928
6929 /* clear the UNDI indication */
6930 REG_WR(bp, DORQ_REG_NORM_CID_OFST, 0);
6931
6888 BNX2X_DEV_INFO("UNDI is active! reset device\n"); 6932 BNX2X_DEV_INFO("UNDI is active! reset device\n");
6889 6933
6890 /* try unload UNDI on port 0 */ 6934 /* try unload UNDI on port 0 */
@@ -6910,6 +6954,9 @@ static void __devinit bnx2x_undi_unload(struct bnx2x *bp)
6910 bnx2x_fw_command(bp, reset_code); 6954 bnx2x_fw_command(bp, reset_code);
6911 } 6955 }
6912 6956
6957 /* now it's safe to release the lock */
6958 bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_UNDI);
6959
6913 REG_WR(bp, (BP_PORT(bp) ? HC_REG_CONFIG_1 : 6960 REG_WR(bp, (BP_PORT(bp) ? HC_REG_CONFIG_1 :
6914 HC_REG_CONFIG_0), 0x1000); 6961 HC_REG_CONFIG_0), 0x1000);
6915 6962
@@ -6954,7 +7001,9 @@ static void __devinit bnx2x_undi_unload(struct bnx2x *bp)
6954 bp->fw_seq = 7001 bp->fw_seq =
6955 (SHMEM_RD(bp, func_mb[bp->func].drv_mb_header) & 7002 (SHMEM_RD(bp, func_mb[bp->func].drv_mb_header) &
6956 DRV_MSG_SEQ_NUMBER_MASK); 7003 DRV_MSG_SEQ_NUMBER_MASK);
6957 } 7004
7005 } else
7006 bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_UNDI);
6958 } 7007 }
6959} 7008}
6960 7009
@@ -6971,7 +7020,7 @@ static void __devinit bnx2x_get_common_hwinfo(struct bnx2x *bp)
6971 id |= ((val & 0xf) << 12); 7020 id |= ((val & 0xf) << 12);
6972 val = REG_RD(bp, MISC_REG_CHIP_METAL); 7021 val = REG_RD(bp, MISC_REG_CHIP_METAL);
6973 id |= ((val & 0xff) << 4); 7022 id |= ((val & 0xff) << 4);
6974 REG_RD(bp, MISC_REG_BOND_ID); 7023 val = REG_RD(bp, MISC_REG_BOND_ID);
6975 id |= (val & 0xf); 7024 id |= (val & 0xf);
6976 bp->common.chip_id = id; 7025 bp->common.chip_id = id;
6977 bp->link_params.chip_id = bp->common.chip_id; 7026 bp->link_params.chip_id = bp->common.chip_id;
@@ -8103,6 +8152,9 @@ static int bnx2x_get_eeprom(struct net_device *dev,
8103 struct bnx2x *bp = netdev_priv(dev); 8152 struct bnx2x *bp = netdev_priv(dev);
8104 int rc; 8153 int rc;
8105 8154
8155 if (!netif_running(dev))
8156 return -EAGAIN;
8157
8106 DP(BNX2X_MSG_NVM, "ethtool_eeprom: cmd %d\n" 8158 DP(BNX2X_MSG_NVM, "ethtool_eeprom: cmd %d\n"
8107 DP_LEVEL " magic 0x%x offset 0x%x (%d) len 0x%x (%d)\n", 8159 DP_LEVEL " magic 0x%x offset 0x%x (%d) len 0x%x (%d)\n",
8108 eeprom->cmd, eeprom->magic, eeprom->offset, eeprom->offset, 8160 eeprom->cmd, eeprom->magic, eeprom->offset, eeprom->offset,
@@ -8705,18 +8757,17 @@ static int bnx2x_run_loopback(struct bnx2x *bp, int loopback_mode, u8 link_up)
8705 8757
8706 if (loopback_mode == BNX2X_MAC_LOOPBACK) { 8758 if (loopback_mode == BNX2X_MAC_LOOPBACK) {
8707 bp->link_params.loopback_mode = LOOPBACK_BMAC; 8759 bp->link_params.loopback_mode = LOOPBACK_BMAC;
8708 bnx2x_acquire_phy_lock(bp);
8709 bnx2x_phy_init(&bp->link_params, &bp->link_vars); 8760 bnx2x_phy_init(&bp->link_params, &bp->link_vars);
8710 bnx2x_release_phy_lock(bp);
8711 8761
8712 } else if (loopback_mode == BNX2X_PHY_LOOPBACK) { 8762 } else if (loopback_mode == BNX2X_PHY_LOOPBACK) {
8763 u16 cnt = 1000;
8713 bp->link_params.loopback_mode = LOOPBACK_XGXS_10; 8764 bp->link_params.loopback_mode = LOOPBACK_XGXS_10;
8714 bnx2x_acquire_phy_lock(bp);
8715 bnx2x_phy_init(&bp->link_params, &bp->link_vars); 8765 bnx2x_phy_init(&bp->link_params, &bp->link_vars);
8716 bnx2x_release_phy_lock(bp);
8717 /* wait until link state is restored */ 8766 /* wait until link state is restored */
8718 bnx2x_wait_for_link(bp, link_up); 8767 if (link_up)
8719 8768 while (cnt-- && bnx2x_test_link(&bp->link_params,
8769 &bp->link_vars))
8770 msleep(10);
8720 } else 8771 } else
8721 return -EINVAL; 8772 return -EINVAL;
8722 8773
@@ -8822,6 +8873,7 @@ static int bnx2x_test_loopback(struct bnx2x *bp, u8 link_up)
8822 return BNX2X_LOOPBACK_FAILED; 8873 return BNX2X_LOOPBACK_FAILED;
8823 8874
8824 bnx2x_netif_stop(bp, 1); 8875 bnx2x_netif_stop(bp, 1);
8876 bnx2x_acquire_phy_lock(bp);
8825 8877
8826 if (bnx2x_run_loopback(bp, BNX2X_MAC_LOOPBACK, link_up)) { 8878 if (bnx2x_run_loopback(bp, BNX2X_MAC_LOOPBACK, link_up)) {
8827 DP(NETIF_MSG_PROBE, "MAC loopback failed\n"); 8879 DP(NETIF_MSG_PROBE, "MAC loopback failed\n");
@@ -8833,6 +8885,7 @@ static int bnx2x_test_loopback(struct bnx2x *bp, u8 link_up)
8833 rc |= BNX2X_PHY_LOOPBACK_FAILED; 8885 rc |= BNX2X_PHY_LOOPBACK_FAILED;
8834 } 8886 }
8835 8887
8888 bnx2x_release_phy_lock(bp);
8836 bnx2x_netif_start(bp); 8889 bnx2x_netif_start(bp);
8837 8890
8838 return rc; 8891 return rc;
@@ -8906,7 +8959,10 @@ static int bnx2x_test_intr(struct bnx2x *bp)
8906 return -ENODEV; 8959 return -ENODEV;
8907 8960
8908 config->hdr.length_6b = 0; 8961 config->hdr.length_6b = 0;
8909 config->hdr.offset = 0; 8962 if (CHIP_IS_E1(bp))
8963 config->hdr.offset = (BP_PORT(bp) ? 32 : 0);
8964 else
8965 config->hdr.offset = BP_FUNC(bp);
8910 config->hdr.client_id = BP_CL_ID(bp); 8966 config->hdr.client_id = BP_CL_ID(bp);
8911 config->hdr.reserved1 = 0; 8967 config->hdr.reserved1 = 0;
8912 8968
@@ -9271,6 +9327,18 @@ static int bnx2x_set_power_state(struct bnx2x *bp, pci_power_t state)
9271 return 0; 9327 return 0;
9272} 9328}
9273 9329
9330static inline int bnx2x_has_rx_work(struct bnx2x_fastpath *fp)
9331{
9332 u16 rx_cons_sb;
9333
9334 /* Tell compiler that status block fields can change */
9335 barrier();
9336 rx_cons_sb = le16_to_cpu(*fp->rx_cons_sb);
9337 if ((rx_cons_sb & MAX_RCQ_DESC_CNT) == MAX_RCQ_DESC_CNT)
9338 rx_cons_sb++;
9339 return (fp->rx_comp_cons != rx_cons_sb);
9340}
9341
9274/* 9342/*
9275 * net_device service functions 9343 * net_device service functions
9276 */ 9344 */
@@ -9281,7 +9349,6 @@ static int bnx2x_poll(struct napi_struct *napi, int budget)
9281 napi); 9349 napi);
9282 struct bnx2x *bp = fp->bp; 9350 struct bnx2x *bp = fp->bp;
9283 int work_done = 0; 9351 int work_done = 0;
9284 u16 rx_cons_sb;
9285 9352
9286#ifdef BNX2X_STOP_ON_ERROR 9353#ifdef BNX2X_STOP_ON_ERROR
9287 if (unlikely(bp->panic)) 9354 if (unlikely(bp->panic))
@@ -9294,19 +9361,12 @@ static int bnx2x_poll(struct napi_struct *napi, int budget)
9294 9361
9295 bnx2x_update_fpsb_idx(fp); 9362 bnx2x_update_fpsb_idx(fp);
9296 9363
9297 if (BNX2X_HAS_TX_WORK(fp)) 9364 if (bnx2x_has_tx_work(fp))
9298 bnx2x_tx_int(fp, budget); 9365 bnx2x_tx_int(fp, budget);
9299 9366
9300 rx_cons_sb = le16_to_cpu(*fp->rx_cons_sb); 9367 if (bnx2x_has_rx_work(fp))
9301 if ((rx_cons_sb & MAX_RCQ_DESC_CNT) == MAX_RCQ_DESC_CNT)
9302 rx_cons_sb++;
9303 if (BNX2X_HAS_RX_WORK(fp))
9304 work_done = bnx2x_rx_int(fp, budget); 9368 work_done = bnx2x_rx_int(fp, budget);
9305
9306 rmb(); /* BNX2X_HAS_WORK() reads the status block */ 9369 rmb(); /* BNX2X_HAS_WORK() reads the status block */
9307 rx_cons_sb = le16_to_cpu(*fp->rx_cons_sb);
9308 if ((rx_cons_sb & MAX_RCQ_DESC_CNT) == MAX_RCQ_DESC_CNT)
9309 rx_cons_sb++;
9310 9370
9311 /* must not complete if we consumed full budget */ 9371 /* must not complete if we consumed full budget */
9312 if ((work_done < budget) && !BNX2X_HAS_WORK(fp)) { 9372 if ((work_done < budget) && !BNX2X_HAS_WORK(fp)) {
@@ -9417,6 +9477,7 @@ static inline u32 bnx2x_xmit_type(struct bnx2x *bp, struct sk_buff *skb)
9417 return rc; 9477 return rc;
9418} 9478}
9419 9479
9480#if (MAX_SKB_FRAGS >= MAX_FETCH_BD - 3)
9420/* check if packet requires linearization (packet is too fragmented) */ 9481/* check if packet requires linearization (packet is too fragmented) */
9421static int bnx2x_pkt_req_lin(struct bnx2x *bp, struct sk_buff *skb, 9482static int bnx2x_pkt_req_lin(struct bnx2x *bp, struct sk_buff *skb,
9422 u32 xmit_type) 9483 u32 xmit_type)
@@ -9494,6 +9555,7 @@ exit_lbl:
9494 9555
9495 return to_copy; 9556 return to_copy;
9496} 9557}
9558#endif
9497 9559
9498/* called with netif_tx_lock 9560/* called with netif_tx_lock
9499 * bnx2x_tx_int() runs without netif_tx_lock unless it needs to call 9561 * bnx2x_tx_int() runs without netif_tx_lock unless it needs to call
@@ -9534,6 +9596,7 @@ static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
9534 skb->ip_summed, skb->protocol, ipv6_hdr(skb)->nexthdr, 9596 skb->ip_summed, skb->protocol, ipv6_hdr(skb)->nexthdr,
9535 ip_hdr(skb)->protocol, skb_shinfo(skb)->gso_type, xmit_type); 9597 ip_hdr(skb)->protocol, skb_shinfo(skb)->gso_type, xmit_type);
9536 9598
9599#if (MAX_SKB_FRAGS >= MAX_FETCH_BD - 3)
9537 /* First, check if we need to linearize the skb 9600 /* First, check if we need to linearize the skb
9538 (due to FW restrictions) */ 9601 (due to FW restrictions) */
9539 if (bnx2x_pkt_req_lin(bp, skb, xmit_type)) { 9602 if (bnx2x_pkt_req_lin(bp, skb, xmit_type)) {
@@ -9546,6 +9609,7 @@ static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
9546 return NETDEV_TX_OK; 9609 return NETDEV_TX_OK;
9547 } 9610 }
9548 } 9611 }
9612#endif
9549 9613
9550 /* 9614 /*
9551 Please read carefully. First we use one BD which we mark as start, 9615 Please read carefully. First we use one BD which we mark as start,
@@ -9776,6 +9840,8 @@ static int bnx2x_open(struct net_device *dev)
9776{ 9840{
9777 struct bnx2x *bp = netdev_priv(dev); 9841 struct bnx2x *bp = netdev_priv(dev);
9778 9842
9843 netif_carrier_off(dev);
9844
9779 bnx2x_set_power_state(bp, PCI_D0); 9845 bnx2x_set_power_state(bp, PCI_D0);
9780 9846
9781 return bnx2x_nic_load(bp, LOAD_OPEN); 9847 return bnx2x_nic_load(bp, LOAD_OPEN);
@@ -9859,7 +9925,7 @@ static void bnx2x_set_rx_mode(struct net_device *dev)
9859 for (; i < old; i++) { 9925 for (; i < old; i++) {
9860 if (CAM_IS_INVALID(config-> 9926 if (CAM_IS_INVALID(config->
9861 config_table[i])) { 9927 config_table[i])) {
9862 i--; /* already invalidated */ 9928 /* already invalidated */
9863 break; 9929 break;
9864 } 9930 }
9865 /* invalidate */ 9931 /* invalidate */
@@ -10269,22 +10335,18 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev,
10269 return rc; 10335 return rc;
10270 } 10336 }
10271 10337
10272 rc = register_netdev(dev);
10273 if (rc) {
10274 dev_err(&pdev->dev, "Cannot register net device\n");
10275 goto init_one_exit;
10276 }
10277
10278 pci_set_drvdata(pdev, dev); 10338 pci_set_drvdata(pdev, dev);
10279 10339
10280 rc = bnx2x_init_bp(bp); 10340 rc = bnx2x_init_bp(bp);
10341 if (rc)
10342 goto init_one_exit;
10343
10344 rc = register_netdev(dev);
10281 if (rc) { 10345 if (rc) {
10282 unregister_netdev(dev); 10346 dev_err(&pdev->dev, "Cannot register net device\n");
10283 goto init_one_exit; 10347 goto init_one_exit;
10284 } 10348 }
10285 10349
10286 netif_carrier_off(dev);
10287
10288 bp->common.name = board_info[ent->driver_data].name; 10350 bp->common.name = board_info[ent->driver_data].name;
10289 printk(KERN_INFO "%s: %s (%c%d) PCI-E x%d %s found at mem %lx," 10351 printk(KERN_INFO "%s: %s (%c%d) PCI-E x%d %s found at mem %lx,"
10290 " IRQ %d, ", dev->name, bp->common.name, 10352 " IRQ %d, ", dev->name, bp->common.name,
@@ -10432,6 +10494,8 @@ static int bnx2x_eeh_nic_unload(struct bnx2x *bp)
10432 bnx2x_free_skbs(bp); 10494 bnx2x_free_skbs(bp);
10433 for_each_queue(bp, i) 10495 for_each_queue(bp, i)
10434 bnx2x_free_rx_sge_range(bp, bp->fp + i, NUM_RX_SGE); 10496 bnx2x_free_rx_sge_range(bp, bp->fp + i, NUM_RX_SGE);
10497 for_each_queue(bp, i)
10498 netif_napi_del(&bnx2x_fp(bp, i, napi));
10435 bnx2x_free_mem(bp); 10499 bnx2x_free_mem(bp);
10436 10500
10437 bp->state = BNX2X_STATE_CLOSED; 10501 bp->state = BNX2X_STATE_CLOSED;
diff --git a/drivers/net/bnx2x_reg.h b/drivers/net/bnx2x_reg.h
index a67b0c358ae4..d084e5fc4b51 100644
--- a/drivers/net/bnx2x_reg.h
+++ b/drivers/net/bnx2x_reg.h
@@ -1,6 +1,6 @@
1/* bnx2x_reg.h: Broadcom Everest network driver. 1/* bnx2x_reg.h: Broadcom Everest network driver.
2 * 2 *
3 * Copyright (c) 2007-2008 Broadcom Corporation 3 * Copyright (c) 2007-2009 Broadcom Corporation
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index 14f9fb3e8795..379a1324db4e 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -2104,6 +2104,7 @@ static void init_lro_mgr(struct sge_qset *qs, struct net_lro_mgr *lro_mgr)
2104{ 2104{
2105 lro_mgr->dev = qs->netdev; 2105 lro_mgr->dev = qs->netdev;
2106 lro_mgr->features = LRO_F_NAPI; 2106 lro_mgr->features = LRO_F_NAPI;
2107 lro_mgr->frag_align_pad = NET_IP_ALIGN;
2107 lro_mgr->ip_summed = CHECKSUM_UNNECESSARY; 2108 lro_mgr->ip_summed = CHECKSUM_UNNECESSARY;
2108 lro_mgr->ip_summed_aggr = CHECKSUM_UNNECESSARY; 2109 lro_mgr->ip_summed_aggr = CHECKSUM_UNNECESSARY;
2109 lro_mgr->max_desc = T3_MAX_LRO_SES; 2110 lro_mgr->max_desc = T3_MAX_LRO_SES;
diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c
index cf43ee743b3c..0890162953e9 100644
--- a/drivers/net/e1000e/82571.c
+++ b/drivers/net/e1000e/82571.c
@@ -981,11 +981,15 @@ static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw)
981 ew32(PBA_ECC, reg); 981 ew32(PBA_ECC, reg);
982 } 982 }
983 983
984 /* PCI-Ex Control Register */ 984 /* PCI-Ex Control Registers */
985 if (hw->mac.type == e1000_82574) { 985 if (hw->mac.type == e1000_82574) {
986 reg = er32(GCR); 986 reg = er32(GCR);
987 reg |= (1 << 22); 987 reg |= (1 << 22);
988 ew32(GCR, reg); 988 ew32(GCR, reg);
989
990 reg = er32(GCR2);
991 reg |= 1;
992 ew32(GCR2, reg);
989 } 993 }
990 994
991 return; 995 return;
diff --git a/drivers/net/e1000e/hw.h b/drivers/net/e1000e/hw.h
index f25e961c6b3b..2d4ce0492df0 100644
--- a/drivers/net/e1000e/hw.h
+++ b/drivers/net/e1000e/hw.h
@@ -206,6 +206,7 @@ enum e1e_registers {
206 E1000_MANC2H = 0x05860, /* Management Control To Host - RW */ 206 E1000_MANC2H = 0x05860, /* Management Control To Host - RW */
207 E1000_SW_FW_SYNC = 0x05B5C, /* Software-Firmware Synchronization - RW */ 207 E1000_SW_FW_SYNC = 0x05B5C, /* Software-Firmware Synchronization - RW */
208 E1000_GCR = 0x05B00, /* PCI-Ex Control */ 208 E1000_GCR = 0x05B00, /* PCI-Ex Control */
209 E1000_GCR2 = 0x05B64, /* PCI-Ex Control #2 */
209 E1000_FACTPS = 0x05B30, /* Function Active and Power State to MNG */ 210 E1000_FACTPS = 0x05B30, /* Function Active and Power State to MNG */
210 E1000_SWSM = 0x05B50, /* SW Semaphore */ 211 E1000_SWSM = 0x05B50, /* SW Semaphore */
211 E1000_FWSM = 0x05B54, /* FW Semaphore */ 212 E1000_FWSM = 0x05B54, /* FW Semaphore */
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index ea530673236e..3f7eab42aef1 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -1423,15 +1423,11 @@ static void gfar_vlan_rx_register(struct net_device *dev,
1423{ 1423{
1424 struct gfar_private *priv = netdev_priv(dev); 1424 struct gfar_private *priv = netdev_priv(dev);
1425 unsigned long flags; 1425 unsigned long flags;
1426 struct vlan_group *old_grp;
1427 u32 tempval; 1426 u32 tempval;
1428 1427
1429 spin_lock_irqsave(&priv->rxlock, flags); 1428 spin_lock_irqsave(&priv->rxlock, flags);
1430 1429
1431 old_grp = priv->vlgrp; 1430 priv->vlgrp = grp;
1432
1433 if (old_grp == grp)
1434 return;
1435 1431
1436 if (grp) { 1432 if (grp) {
1437 /* Enable VLAN tag insertion */ 1433 /* Enable VLAN tag insertion */
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index acef3c65cd2c..d2f4d5f508b7 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -318,6 +318,9 @@ static void ixgbe_update_rx_dca(struct ixgbe_adapter *adapter,
318 rxctrl |= dca3_get_tag(&adapter->pdev->dev, cpu); 318 rxctrl |= dca3_get_tag(&adapter->pdev->dev, cpu);
319 rxctrl |= IXGBE_DCA_RXCTRL_DESC_DCA_EN; 319 rxctrl |= IXGBE_DCA_RXCTRL_DESC_DCA_EN;
320 rxctrl |= IXGBE_DCA_RXCTRL_HEAD_DCA_EN; 320 rxctrl |= IXGBE_DCA_RXCTRL_HEAD_DCA_EN;
321 rxctrl &= ~(IXGBE_DCA_RXCTRL_DESC_RRO_EN);
322 rxctrl &= ~(IXGBE_DCA_RXCTRL_DESC_WRO_EN |
323 IXGBE_DCA_RXCTRL_DESC_HSRO_EN);
321 IXGBE_WRITE_REG(&adapter->hw, IXGBE_DCA_RXCTRL(q), rxctrl); 324 IXGBE_WRITE_REG(&adapter->hw, IXGBE_DCA_RXCTRL(q), rxctrl);
322 rx_ring->cpu = cpu; 325 rx_ring->cpu = cpu;
323 } 326 }
@@ -1741,6 +1744,32 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
1741 IXGBE_WRITE_REG(hw, IXGBE_RXCSUM, rxcsum); 1744 IXGBE_WRITE_REG(hw, IXGBE_RXCSUM, rxcsum);
1742} 1745}
1743 1746
1747static void ixgbe_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
1748{
1749 struct ixgbe_adapter *adapter = netdev_priv(netdev);
1750 struct ixgbe_hw *hw = &adapter->hw;
1751
1752 /* add VID to filter table */
1753 hw->mac.ops.set_vfta(&adapter->hw, vid, 0, true);
1754}
1755
1756static void ixgbe_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
1757{
1758 struct ixgbe_adapter *adapter = netdev_priv(netdev);
1759 struct ixgbe_hw *hw = &adapter->hw;
1760
1761 if (!test_bit(__IXGBE_DOWN, &adapter->state))
1762 ixgbe_irq_disable(adapter);
1763
1764 vlan_group_set_device(adapter->vlgrp, vid, NULL);
1765
1766 if (!test_bit(__IXGBE_DOWN, &adapter->state))
1767 ixgbe_irq_enable(adapter);
1768
1769 /* remove VID from filter table */
1770 hw->mac.ops.set_vfta(&adapter->hw, vid, 0, false);
1771}
1772
1744static void ixgbe_vlan_rx_register(struct net_device *netdev, 1773static void ixgbe_vlan_rx_register(struct net_device *netdev,
1745 struct vlan_group *grp) 1774 struct vlan_group *grp)
1746{ 1775{
@@ -1760,6 +1789,7 @@ static void ixgbe_vlan_rx_register(struct net_device *netdev,
1760 ctrl |= IXGBE_VLNCTRL_VME; 1789 ctrl |= IXGBE_VLNCTRL_VME;
1761 ctrl &= ~IXGBE_VLNCTRL_CFIEN; 1790 ctrl &= ~IXGBE_VLNCTRL_CFIEN;
1762 IXGBE_WRITE_REG(&adapter->hw, IXGBE_VLNCTRL, ctrl); 1791 IXGBE_WRITE_REG(&adapter->hw, IXGBE_VLNCTRL, ctrl);
1792 ixgbe_vlan_rx_add_vid(netdev, 0);
1763 1793
1764 if (grp) { 1794 if (grp) {
1765 /* enable VLAN tag insert/strip */ 1795 /* enable VLAN tag insert/strip */
@@ -1773,32 +1803,6 @@ static void ixgbe_vlan_rx_register(struct net_device *netdev,
1773 ixgbe_irq_enable(adapter); 1803 ixgbe_irq_enable(adapter);
1774} 1804}
1775 1805
1776static void ixgbe_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
1777{
1778 struct ixgbe_adapter *adapter = netdev_priv(netdev);
1779 struct ixgbe_hw *hw = &adapter->hw;
1780
1781 /* add VID to filter table */
1782 hw->mac.ops.set_vfta(&adapter->hw, vid, 0, true);
1783}
1784
1785static void ixgbe_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
1786{
1787 struct ixgbe_adapter *adapter = netdev_priv(netdev);
1788 struct ixgbe_hw *hw = &adapter->hw;
1789
1790 if (!test_bit(__IXGBE_DOWN, &adapter->state))
1791 ixgbe_irq_disable(adapter);
1792
1793 vlan_group_set_device(adapter->vlgrp, vid, NULL);
1794
1795 if (!test_bit(__IXGBE_DOWN, &adapter->state))
1796 ixgbe_irq_enable(adapter);
1797
1798 /* remove VID from filter table */
1799 hw->mac.ops.set_vfta(&adapter->hw, vid, 0, false);
1800}
1801
1802static void ixgbe_restore_vlan(struct ixgbe_adapter *adapter) 1806static void ixgbe_restore_vlan(struct ixgbe_adapter *adapter)
1803{ 1807{
1804 ixgbe_vlan_rx_register(adapter->netdev, adapter->vlgrp); 1808 ixgbe_vlan_rx_register(adapter->netdev, adapter->vlgrp);
@@ -2074,6 +2078,9 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter)
2074 2078
2075 ixgbe_irq_enable(adapter); 2079 ixgbe_irq_enable(adapter);
2076 2080
2081 /* enable transmits */
2082 netif_tx_start_all_queues(netdev);
2083
2077 /* bring the link up in the watchdog, this could race with our first 2084 /* bring the link up in the watchdog, this could race with our first
2078 * link up interrupt but shouldn't be a problem */ 2085 * link up interrupt but shouldn't be a problem */
2079 adapter->flags |= IXGBE_FLAG_NEED_LINK_UPDATE; 2086 adapter->flags |= IXGBE_FLAG_NEED_LINK_UPDATE;
@@ -3475,7 +3482,6 @@ static void ixgbe_watchdog_task(struct work_struct *work)
3475 (FLOW_TX ? "TX" : "None")))); 3482 (FLOW_TX ? "TX" : "None"))));
3476 3483
3477 netif_carrier_on(netdev); 3484 netif_carrier_on(netdev);
3478 netif_tx_wake_all_queues(netdev);
3479 } else { 3485 } else {
3480 /* Force detection of hung controller */ 3486 /* Force detection of hung controller */
3481 adapter->detect_tx_hung = true; 3487 adapter->detect_tx_hung = true;
@@ -3487,7 +3493,6 @@ static void ixgbe_watchdog_task(struct work_struct *work)
3487 printk(KERN_INFO "ixgbe: %s NIC Link is Down\n", 3493 printk(KERN_INFO "ixgbe: %s NIC Link is Down\n",
3488 netdev->name); 3494 netdev->name);
3489 netif_carrier_off(netdev); 3495 netif_carrier_off(netdev);
3490 netif_tx_stop_all_queues(netdev);
3491 } 3496 }
3492 } 3497 }
3493 3498
@@ -4218,7 +4223,6 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
4218 } 4223 }
4219 4224
4220 netif_carrier_off(netdev); 4225 netif_carrier_off(netdev);
4221 netif_tx_stop_all_queues(netdev);
4222 4226
4223 strcpy(netdev->name, "eth%d"); 4227 strcpy(netdev->name, "eth%d");
4224 err = register_netdev(netdev); 4228 err = register_netdev(netdev);
diff --git a/drivers/net/ixgbe/ixgbe_type.h b/drivers/net/ixgbe/ixgbe_type.h
index 83a11ff9ffd1..f011c57c9205 100644
--- a/drivers/net/ixgbe/ixgbe_type.h
+++ b/drivers/net/ixgbe/ixgbe_type.h
@@ -404,6 +404,9 @@
404#define IXGBE_DCA_RXCTRL_DESC_DCA_EN (1 << 5) /* DCA Rx Desc enable */ 404#define IXGBE_DCA_RXCTRL_DESC_DCA_EN (1 << 5) /* DCA Rx Desc enable */
405#define IXGBE_DCA_RXCTRL_HEAD_DCA_EN (1 << 6) /* DCA Rx Desc header enable */ 405#define IXGBE_DCA_RXCTRL_HEAD_DCA_EN (1 << 6) /* DCA Rx Desc header enable */
406#define IXGBE_DCA_RXCTRL_DATA_DCA_EN (1 << 7) /* DCA Rx Desc payload enable */ 406#define IXGBE_DCA_RXCTRL_DATA_DCA_EN (1 << 7) /* DCA Rx Desc payload enable */
407#define IXGBE_DCA_RXCTRL_DESC_RRO_EN (1 << 9) /* DCA Rx rd Desc Relax Order */
408#define IXGBE_DCA_RXCTRL_DESC_WRO_EN (1 << 13) /* DCA Rx wr Desc Relax Order */
409#define IXGBE_DCA_RXCTRL_DESC_HSRO_EN (1 << 15) /* DCA Rx Split Header RO */
407 410
408#define IXGBE_DCA_TXCTRL_CPUID_MASK 0x0000001F /* Tx CPUID Mask */ 411#define IXGBE_DCA_TXCTRL_CPUID_MASK 0x0000001F /* Tx CPUID Mask */
409#define IXGBE_DCA_TXCTRL_DESC_DCA_EN (1 << 5) /* DCA Tx Desc enable */ 412#define IXGBE_DCA_TXCTRL_DESC_DCA_EN (1 << 5) /* DCA Tx Desc enable */
diff --git a/drivers/net/korina.c b/drivers/net/korina.c
index 1d6e48e13366..75010cac76ac 100644
--- a/drivers/net/korina.c
+++ b/drivers/net/korina.c
@@ -416,6 +416,9 @@ static int korina_rx(struct net_device *dev, int limit)
416 if (devcs & ETH_RX_MP) 416 if (devcs & ETH_RX_MP)
417 dev->stats.multicast++; 417 dev->stats.multicast++;
418 418
419 /* 16 bit align */
420 skb_reserve(skb_new, 2);
421
419 lp->rx_skb[lp->rx_next_done] = skb_new; 422 lp->rx_skb[lp->rx_next_done] = skb_new;
420 } 423 }
421 424
@@ -740,6 +743,7 @@ static struct ethtool_ops netdev_ethtool_ops = {
740static void korina_alloc_ring(struct net_device *dev) 743static void korina_alloc_ring(struct net_device *dev)
741{ 744{
742 struct korina_private *lp = netdev_priv(dev); 745 struct korina_private *lp = netdev_priv(dev);
746 struct sk_buff *skb;
743 int i; 747 int i;
744 748
745 /* Initialize the transmit descriptors */ 749 /* Initialize the transmit descriptors */
@@ -755,8 +759,6 @@ static void korina_alloc_ring(struct net_device *dev)
755 759
756 /* Initialize the receive descriptors */ 760 /* Initialize the receive descriptors */
757 for (i = 0; i < KORINA_NUM_RDS; i++) { 761 for (i = 0; i < KORINA_NUM_RDS; i++) {
758 struct sk_buff *skb = lp->rx_skb[i];
759
760 skb = dev_alloc_skb(KORINA_RBSIZE + 2); 762 skb = dev_alloc_skb(KORINA_RBSIZE + 2);
761 if (!skb) 763 if (!skb)
762 break; 764 break;
@@ -769,11 +771,12 @@ static void korina_alloc_ring(struct net_device *dev)
769 lp->rd_ring[i].link = CPHYSADDR(&lp->rd_ring[i+1]); 771 lp->rd_ring[i].link = CPHYSADDR(&lp->rd_ring[i+1]);
770 } 772 }
771 773
772 /* loop back */ 774 /* loop back receive descriptors, so the last
773 lp->rd_ring[i].link = CPHYSADDR(&lp->rd_ring[0]); 775 * descriptor points to the first one */
774 lp->rx_next_done = 0; 776 lp->rd_ring[i - 1].link = CPHYSADDR(&lp->rd_ring[0]);
777 lp->rd_ring[i - 1].control |= DMA_DESC_COD;
775 778
776 lp->rd_ring[i].control |= DMA_DESC_COD; 779 lp->rx_next_done = 0;
777 lp->rx_chain_head = 0; 780 lp->rx_chain_head = 0;
778 lp->rx_chain_tail = 0; 781 lp->rx_chain_tail = 0;
779 lp->rx_chain_status = desc_empty; 782 lp->rx_chain_status = desc_empty;
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index a04da4ecaa88..f6c4936e2fa8 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -321,6 +321,10 @@ static void macb_tx(struct macb *bp)
321 printk(KERN_ERR "%s: TX underrun, resetting buffers\n", 321 printk(KERN_ERR "%s: TX underrun, resetting buffers\n",
322 bp->dev->name); 322 bp->dev->name);
323 323
324 /* Transfer ongoing, disable transmitter, to avoid confusion */
325 if (status & MACB_BIT(TGO))
326 macb_writel(bp, NCR, macb_readl(bp, NCR) & ~MACB_BIT(TE));
327
324 head = bp->tx_head; 328 head = bp->tx_head;
325 329
326 /*Mark all the buffer as used to avoid sending a lost buffer*/ 330 /*Mark all the buffer as used to avoid sending a lost buffer*/
@@ -343,6 +347,10 @@ static void macb_tx(struct macb *bp)
343 } 347 }
344 348
345 bp->tx_head = bp->tx_tail = 0; 349 bp->tx_head = bp->tx_tail = 0;
350
351 /* Enable the transmitter again */
352 if (status & MACB_BIT(TGO))
353 macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(TE));
346 } 354 }
347 355
348 if (!(status & MACB_BIT(COMP))) 356 if (!(status & MACB_BIT(COMP)))
diff --git a/drivers/net/mlx4/profile.c b/drivers/net/mlx4/profile.c
index 919fb9eb1b62..cebdf3243ca1 100644
--- a/drivers/net/mlx4/profile.c
+++ b/drivers/net/mlx4/profile.c
@@ -107,9 +107,9 @@ u64 mlx4_make_profile(struct mlx4_dev *dev,
107 profile[MLX4_RES_AUXC].num = request->num_qp; 107 profile[MLX4_RES_AUXC].num = request->num_qp;
108 profile[MLX4_RES_SRQ].num = request->num_srq; 108 profile[MLX4_RES_SRQ].num = request->num_srq;
109 profile[MLX4_RES_CQ].num = request->num_cq; 109 profile[MLX4_RES_CQ].num = request->num_cq;
110 profile[MLX4_RES_EQ].num = min(dev_cap->max_eqs, 110 profile[MLX4_RES_EQ].num = min_t(unsigned, dev_cap->max_eqs,
111 dev_cap->reserved_eqs + 111 dev_cap->reserved_eqs +
112 num_possible_cpus() + 1); 112 num_possible_cpus() + 1);
113 profile[MLX4_RES_DMPT].num = request->num_mpt; 113 profile[MLX4_RES_DMPT].num = request->num_mpt;
114 profile[MLX4_RES_CMPT].num = MLX4_NUM_CMPTS; 114 profile[MLX4_RES_CMPT].num = MLX4_NUM_CMPTS;
115 profile[MLX4_RES_MTT].num = request->num_mtt; 115 profile[MLX4_RES_MTT].num = request->num_mtt;
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 7253a499d9c8..5f31bbb614af 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -136,21 +136,23 @@ static char mv643xx_eth_driver_version[] = "1.4";
136/* 136/*
137 * SDMA configuration register. 137 * SDMA configuration register.
138 */ 138 */
139#define RX_BURST_SIZE_4_64BIT (2 << 1)
139#define RX_BURST_SIZE_16_64BIT (4 << 1) 140#define RX_BURST_SIZE_16_64BIT (4 << 1)
140#define BLM_RX_NO_SWAP (1 << 4) 141#define BLM_RX_NO_SWAP (1 << 4)
141#define BLM_TX_NO_SWAP (1 << 5) 142#define BLM_TX_NO_SWAP (1 << 5)
143#define TX_BURST_SIZE_4_64BIT (2 << 22)
142#define TX_BURST_SIZE_16_64BIT (4 << 22) 144#define TX_BURST_SIZE_16_64BIT (4 << 22)
143 145
144#if defined(__BIG_ENDIAN) 146#if defined(__BIG_ENDIAN)
145#define PORT_SDMA_CONFIG_DEFAULT_VALUE \ 147#define PORT_SDMA_CONFIG_DEFAULT_VALUE \
146 (RX_BURST_SIZE_16_64BIT | \ 148 (RX_BURST_SIZE_4_64BIT | \
147 TX_BURST_SIZE_16_64BIT) 149 TX_BURST_SIZE_4_64BIT)
148#elif defined(__LITTLE_ENDIAN) 150#elif defined(__LITTLE_ENDIAN)
149#define PORT_SDMA_CONFIG_DEFAULT_VALUE \ 151#define PORT_SDMA_CONFIG_DEFAULT_VALUE \
150 (RX_BURST_SIZE_16_64BIT | \ 152 (RX_BURST_SIZE_4_64BIT | \
151 BLM_RX_NO_SWAP | \ 153 BLM_RX_NO_SWAP | \
152 BLM_TX_NO_SWAP | \ 154 BLM_TX_NO_SWAP | \
153 TX_BURST_SIZE_16_64BIT) 155 TX_BURST_SIZE_4_64BIT)
154#else 156#else
155#error One of __BIG_ENDIAN or __LITTLE_ENDIAN must be defined 157#error One of __BIG_ENDIAN or __LITTLE_ENDIAN must be defined
156#endif 158#endif
@@ -1594,7 +1596,7 @@ oom:
1594 entry = addr_crc(a); 1596 entry = addr_crc(a);
1595 } 1597 }
1596 1598
1597 table[entry >> 2] |= 1 << (entry & 3); 1599 table[entry >> 2] |= 1 << (8 * (entry & 3));
1598 } 1600 }
1599 1601
1600 for (i = 0; i < 0x100; i += 4) { 1602 for (i = 0; i < 0x100; i += 4) {
@@ -2210,6 +2212,7 @@ static int mv643xx_eth_stop(struct net_device *dev)
2210 struct mv643xx_eth_private *mp = netdev_priv(dev); 2212 struct mv643xx_eth_private *mp = netdev_priv(dev);
2211 int i; 2213 int i;
2212 2214
2215 wrlp(mp, INT_MASK_EXT, 0x00000000);
2213 wrlp(mp, INT_MASK, 0x00000000); 2216 wrlp(mp, INT_MASK, 0x00000000);
2214 rdlp(mp, INT_MASK); 2217 rdlp(mp, INT_MASK);
2215 2218
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index 6bb71b687f7b..e9c1296b267e 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -1,7 +1,7 @@
1/************************************************************************* 1/*************************************************************************
2 * myri10ge.c: Myricom Myri-10G Ethernet driver. 2 * myri10ge.c: Myricom Myri-10G Ethernet driver.
3 * 3 *
4 * Copyright (C) 2005 - 2007 Myricom, Inc. 4 * Copyright (C) 2005 - 2009 Myricom, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
@@ -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.4.4-1.398" 78#define MYRI10GE_VERSION_STR "1.4.4-1.401"
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");
@@ -3786,7 +3786,7 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3786 if (status != 0) { 3786 if (status != 0) {
3787 dev_err(&pdev->dev, "Error %d writing PCI_EXP_DEVCTL\n", 3787 dev_err(&pdev->dev, "Error %d writing PCI_EXP_DEVCTL\n",
3788 status); 3788 status);
3789 goto abort_with_netdev; 3789 goto abort_with_enabled;
3790 } 3790 }
3791 3791
3792 pci_set_master(pdev); 3792 pci_set_master(pdev);
@@ -3801,13 +3801,13 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3801 } 3801 }
3802 if (status != 0) { 3802 if (status != 0) {
3803 dev_err(&pdev->dev, "Error %d setting DMA mask\n", status); 3803 dev_err(&pdev->dev, "Error %d setting DMA mask\n", status);
3804 goto abort_with_netdev; 3804 goto abort_with_enabled;
3805 } 3805 }
3806 (void)pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK); 3806 (void)pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK);
3807 mgp->cmd = dma_alloc_coherent(&pdev->dev, sizeof(*mgp->cmd), 3807 mgp->cmd = dma_alloc_coherent(&pdev->dev, sizeof(*mgp->cmd),
3808 &mgp->cmd_bus, GFP_KERNEL); 3808 &mgp->cmd_bus, GFP_KERNEL);
3809 if (mgp->cmd == NULL) 3809 if (mgp->cmd == NULL)
3810 goto abort_with_netdev; 3810 goto abort_with_enabled;
3811 3811
3812 mgp->board_span = pci_resource_len(pdev, 0); 3812 mgp->board_span = pci_resource_len(pdev, 0);
3813 mgp->iomem_base = pci_resource_start(pdev, 0); 3813 mgp->iomem_base = pci_resource_start(pdev, 0);
@@ -3943,8 +3943,10 @@ abort_with_mtrr:
3943 dma_free_coherent(&pdev->dev, sizeof(*mgp->cmd), 3943 dma_free_coherent(&pdev->dev, sizeof(*mgp->cmd),
3944 mgp->cmd, mgp->cmd_bus); 3944 mgp->cmd, mgp->cmd_bus);
3945 3945
3946abort_with_netdev: 3946abort_with_enabled:
3947 pci_disable_device(pdev);
3947 3948
3949abort_with_netdev:
3948 free_netdev(netdev); 3950 free_netdev(netdev);
3949 return status; 3951 return status;
3950} 3952}
@@ -3990,6 +3992,7 @@ static void myri10ge_remove(struct pci_dev *pdev)
3990 mgp->cmd, mgp->cmd_bus); 3992 mgp->cmd, mgp->cmd_bus);
3991 3993
3992 free_netdev(netdev); 3994 free_netdev(netdev);
3995 pci_disable_device(pdev);
3993 pci_set_drvdata(pdev, NULL); 3996 pci_set_drvdata(pdev, NULL);
3994} 3997}
3995 3998
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index c11c568fd7db..a75a31005fd3 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -146,7 +146,7 @@
146 146
147#define MAX_RX_BUFFER_LENGTH 1760 147#define MAX_RX_BUFFER_LENGTH 1760
148#define MAX_RX_JUMBO_BUFFER_LENGTH 8062 148#define MAX_RX_JUMBO_BUFFER_LENGTH 8062
149#define MAX_RX_LRO_BUFFER_LENGTH ((48*1024)-512) 149#define MAX_RX_LRO_BUFFER_LENGTH (8062)
150#define RX_DMA_MAP_LEN (MAX_RX_BUFFER_LENGTH - 2) 150#define RX_DMA_MAP_LEN (MAX_RX_BUFFER_LENGTH - 2)
151#define RX_JUMBO_DMA_MAP_LEN \ 151#define RX_JUMBO_DMA_MAP_LEN \
152 (MAX_RX_JUMBO_BUFFER_LENGTH - 2) 152 (MAX_RX_JUMBO_BUFFER_LENGTH - 2)
@@ -207,11 +207,11 @@
207 207
208#define MAX_CMD_DESCRIPTORS 4096 208#define MAX_CMD_DESCRIPTORS 4096
209#define MAX_RCV_DESCRIPTORS 16384 209#define MAX_RCV_DESCRIPTORS 16384
210#define MAX_CMD_DESCRIPTORS_HOST (MAX_CMD_DESCRIPTORS / 4) 210#define MAX_CMD_DESCRIPTORS_HOST 1024
211#define MAX_RCV_DESCRIPTORS_1G (MAX_RCV_DESCRIPTORS / 4) 211#define MAX_RCV_DESCRIPTORS_1G 2048
212#define MAX_RCV_DESCRIPTORS_10G 8192 212#define MAX_RCV_DESCRIPTORS_10G 4096
213#define MAX_JUMBO_RCV_DESCRIPTORS 1024 213#define MAX_JUMBO_RCV_DESCRIPTORS 512
214#define MAX_LRO_RCV_DESCRIPTORS 64 214#define MAX_LRO_RCV_DESCRIPTORS 8
215#define MAX_RCVSTATUS_DESCRIPTORS MAX_RCV_DESCRIPTORS 215#define MAX_RCVSTATUS_DESCRIPTORS MAX_RCV_DESCRIPTORS
216#define MAX_JUMBO_RCV_DESC MAX_JUMBO_RCV_DESCRIPTORS 216#define MAX_JUMBO_RCV_DESC MAX_JUMBO_RCV_DESCRIPTORS
217#define MAX_RCV_DESC MAX_RCV_DESCRIPTORS 217#define MAX_RCV_DESC MAX_RCV_DESCRIPTORS
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c
index c0bd40fcf708..0894a7be0225 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -561,7 +561,10 @@ netxen_nic_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ring)
561 } 561 }
562 ring->tx_pending = adapter->max_tx_desc_count; 562 ring->tx_pending = adapter->max_tx_desc_count;
563 563
564 ring->rx_max_pending = MAX_RCV_DESCRIPTORS; 564 if (adapter->ahw.board_type == NETXEN_NIC_GBE)
565 ring->rx_max_pending = MAX_RCV_DESCRIPTORS_1G;
566 else
567 ring->rx_max_pending = MAX_RCV_DESCRIPTORS_10G;
565 ring->tx_max_pending = MAX_CMD_DESCRIPTORS_HOST; 568 ring->tx_max_pending = MAX_CMD_DESCRIPTORS_HOST;
566 ring->rx_jumbo_max_pending = MAX_JUMBO_RCV_DESCRIPTORS; 569 ring->rx_jumbo_max_pending = MAX_JUMBO_RCV_DESCRIPTORS;
567 ring->rx_mini_max_pending = 0; 570 ring->rx_mini_max_pending = 0;
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index d854f07ef4d3..645d384fe87e 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -735,17 +735,18 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
735 735
736 SET_ETHTOOL_OPS(netdev, &netxen_nic_ethtool_ops); 736 SET_ETHTOOL_OPS(netdev, &netxen_nic_ethtool_ops);
737 737
738 /* ScatterGather support */ 738 netdev->features |= (NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO);
739 netdev->features = NETIF_F_SG; 739 netdev->vlan_features |= (NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO);
740 netdev->features |= NETIF_F_IP_CSUM; 740
741 netdev->features |= NETIF_F_TSO;
742 if (NX_IS_REVISION_P3(revision_id)) { 741 if (NX_IS_REVISION_P3(revision_id)) {
743 netdev->features |= NETIF_F_IPV6_CSUM; 742 netdev->features |= (NETIF_F_IPV6_CSUM | NETIF_F_TSO6);
744 netdev->features |= NETIF_F_TSO6; 743 netdev->vlan_features |= (NETIF_F_IPV6_CSUM | NETIF_F_TSO6);
745 } 744 }
746 745
747 if (adapter->pci_using_dac) 746 if (adapter->pci_using_dac) {
748 netdev->features |= NETIF_F_HIGHDMA; 747 netdev->features |= NETIF_F_HIGHDMA;
748 netdev->vlan_features |= NETIF_F_HIGHDMA;
749 }
749 750
750 /* 751 /*
751 * Set the CRB window to invalid. If any register in window 0 is 752 * Set the CRB window to invalid. If any register in window 0 is
@@ -1166,6 +1167,14 @@ static bool netxen_tso_check(struct net_device *netdev,
1166{ 1167{
1167 bool tso = false; 1168 bool tso = false;
1168 u8 opcode = TX_ETHER_PKT; 1169 u8 opcode = TX_ETHER_PKT;
1170 __be16 protocol = skb->protocol;
1171 u16 flags = 0;
1172
1173 if (protocol == __constant_htons(ETH_P_8021Q)) {
1174 struct vlan_ethhdr *vh = (struct vlan_ethhdr *)skb->data;
1175 protocol = vh->h_vlan_encapsulated_proto;
1176 flags = FLAGS_VLAN_TAGGED;
1177 }
1169 1178
1170 if ((netdev->features & (NETIF_F_TSO | NETIF_F_TSO6)) && 1179 if ((netdev->features & (NETIF_F_TSO | NETIF_F_TSO6)) &&
1171 skb_shinfo(skb)->gso_size > 0) { 1180 skb_shinfo(skb)->gso_size > 0) {
@@ -1174,21 +1183,21 @@ static bool netxen_tso_check(struct net_device *netdev,
1174 desc->total_hdr_length = 1183 desc->total_hdr_length =
1175 skb_transport_offset(skb) + tcp_hdrlen(skb); 1184 skb_transport_offset(skb) + tcp_hdrlen(skb);
1176 1185
1177 opcode = (skb->protocol == htons(ETH_P_IPV6)) ? 1186 opcode = (protocol == __constant_htons(ETH_P_IPV6)) ?
1178 TX_TCP_LSO6 : TX_TCP_LSO; 1187 TX_TCP_LSO6 : TX_TCP_LSO;
1179 tso = true; 1188 tso = true;
1180 1189
1181 } else if (skb->ip_summed == CHECKSUM_PARTIAL) { 1190 } else if (skb->ip_summed == CHECKSUM_PARTIAL) {
1182 u8 l4proto; 1191 u8 l4proto;
1183 1192
1184 if (skb->protocol == htons(ETH_P_IP)) { 1193 if (protocol == __constant_htons(ETH_P_IP)) {
1185 l4proto = ip_hdr(skb)->protocol; 1194 l4proto = ip_hdr(skb)->protocol;
1186 1195
1187 if (l4proto == IPPROTO_TCP) 1196 if (l4proto == IPPROTO_TCP)
1188 opcode = TX_TCP_PKT; 1197 opcode = TX_TCP_PKT;
1189 else if(l4proto == IPPROTO_UDP) 1198 else if(l4proto == IPPROTO_UDP)
1190 opcode = TX_UDP_PKT; 1199 opcode = TX_UDP_PKT;
1191 } else if (skb->protocol == htons(ETH_P_IPV6)) { 1200 } else if (protocol == __constant_htons(ETH_P_IPV6)) {
1192 l4proto = ipv6_hdr(skb)->nexthdr; 1201 l4proto = ipv6_hdr(skb)->nexthdr;
1193 1202
1194 if (l4proto == IPPROTO_TCP) 1203 if (l4proto == IPPROTO_TCP)
@@ -1199,7 +1208,7 @@ static bool netxen_tso_check(struct net_device *netdev,
1199 } 1208 }
1200 desc->tcp_hdr_offset = skb_transport_offset(skb); 1209 desc->tcp_hdr_offset = skb_transport_offset(skb);
1201 desc->ip_hdr_offset = skb_network_offset(skb); 1210 desc->ip_hdr_offset = skb_network_offset(skb);
1202 netxen_set_tx_flags_opcode(desc, 0, opcode); 1211 netxen_set_tx_flags_opcode(desc, flags, opcode);
1203 return tso; 1212 return tso;
1204} 1213}
1205 1214
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index 11adf6ed4628..811a637695ca 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -296,9 +296,8 @@ static int mdio_bus_suspend(struct device * dev, pm_message_t state)
296 struct phy_driver *phydrv = to_phy_driver(drv); 296 struct phy_driver *phydrv = to_phy_driver(drv);
297 struct phy_device *phydev = to_phy_device(dev); 297 struct phy_device *phydev = to_phy_device(dev);
298 298
299 if ((!device_may_wakeup(phydev->dev.parent)) && 299 if (drv && phydrv->suspend && !device_may_wakeup(phydev->dev.parent))
300 (phydrv && phydrv->suspend)) 300 ret = phydrv->suspend(phydev);
301 ret = phydrv->suspend(phydev);
302 301
303 return ret; 302 return ret;
304} 303}
@@ -310,8 +309,7 @@ static int mdio_bus_resume(struct device * dev)
310 struct phy_driver *phydrv = to_phy_driver(drv); 309 struct phy_driver *phydrv = to_phy_driver(drv);
311 struct phy_device *phydev = to_phy_device(dev); 310 struct phy_device *phydev = to_phy_device(dev);
312 311
313 if ((!device_may_wakeup(phydev->dev.parent)) && 312 if (drv && phydrv->resume && !device_may_wakeup(phydev->dev.parent))
314 (phydrv && phydrv->resume))
315 ret = phydrv->resume(phydev); 313 ret = phydrv->resume(phydev);
316 314
317 return ret; 315 return ret;
diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c
index c05d38d46350..1387187543e4 100644
--- a/drivers/net/phy/smsc.c
+++ b/drivers/net/phy/smsc.c
@@ -81,6 +81,9 @@ static struct phy_driver lan83c185_driver = {
81 .ack_interrupt = smsc_phy_ack_interrupt, 81 .ack_interrupt = smsc_phy_ack_interrupt,
82 .config_intr = smsc_phy_config_intr, 82 .config_intr = smsc_phy_config_intr,
83 83
84 .suspend = genphy_suspend,
85 .resume = genphy_resume,
86
84 .driver = { .owner = THIS_MODULE, } 87 .driver = { .owner = THIS_MODULE, }
85}; 88};
86 89
@@ -102,6 +105,9 @@ static struct phy_driver lan8187_driver = {
102 .ack_interrupt = smsc_phy_ack_interrupt, 105 .ack_interrupt = smsc_phy_ack_interrupt,
103 .config_intr = smsc_phy_config_intr, 106 .config_intr = smsc_phy_config_intr,
104 107
108 .suspend = genphy_suspend,
109 .resume = genphy_resume,
110
105 .driver = { .owner = THIS_MODULE, } 111 .driver = { .owner = THIS_MODULE, }
106}; 112};
107 113
@@ -123,6 +129,9 @@ static struct phy_driver lan8700_driver = {
123 .ack_interrupt = smsc_phy_ack_interrupt, 129 .ack_interrupt = smsc_phy_ack_interrupt,
124 .config_intr = smsc_phy_config_intr, 130 .config_intr = smsc_phy_config_intr,
125 131
132 .suspend = genphy_suspend,
133 .resume = genphy_resume,
134
126 .driver = { .owner = THIS_MODULE, } 135 .driver = { .owner = THIS_MODULE, }
127}; 136};
128 137
@@ -144,6 +153,9 @@ static struct phy_driver lan911x_int_driver = {
144 .ack_interrupt = smsc_phy_ack_interrupt, 153 .ack_interrupt = smsc_phy_ack_interrupt,
145 .config_intr = smsc_phy_config_intr, 154 .config_intr = smsc_phy_config_intr,
146 155
156 .suspend = genphy_suspend,
157 .resume = genphy_resume,
158
147 .driver = { .owner = THIS_MODULE, } 159 .driver = { .owner = THIS_MODULE, }
148}; 160};
149 161
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 5e2dbaee125b..8b3f84685387 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -7535,11 +7535,58 @@ static int tg3_test_msi(struct tg3 *tp)
7535 return err; 7535 return err;
7536} 7536}
7537 7537
7538static int tg3_request_firmware(struct tg3 *tp)
7539{
7540 const __be32 *fw_data;
7541
7542 if (request_firmware(&tp->fw, tp->fw_needed, &tp->pdev->dev)) {
7543 printk(KERN_ERR "%s: Failed to load firmware \"%s\"\n",
7544 tp->dev->name, tp->fw_needed);
7545 return -ENOENT;
7546 }
7547
7548 fw_data = (void *)tp->fw->data;
7549
7550 /* Firmware blob starts with version numbers, followed by
7551 * start address and _full_ length including BSS sections
7552 * (which must be longer than the actual data, of course
7553 */
7554
7555 tp->fw_len = be32_to_cpu(fw_data[2]); /* includes bss */
7556 if (tp->fw_len < (tp->fw->size - 12)) {
7557 printk(KERN_ERR "%s: bogus length %d in \"%s\"\n",
7558 tp->dev->name, tp->fw_len, tp->fw_needed);
7559 release_firmware(tp->fw);
7560 tp->fw = NULL;
7561 return -EINVAL;
7562 }
7563
7564 /* We no longer need firmware; we have it. */
7565 tp->fw_needed = NULL;
7566 return 0;
7567}
7568
7538static int tg3_open(struct net_device *dev) 7569static int tg3_open(struct net_device *dev)
7539{ 7570{
7540 struct tg3 *tp = netdev_priv(dev); 7571 struct tg3 *tp = netdev_priv(dev);
7541 int err; 7572 int err;
7542 7573
7574 if (tp->fw_needed) {
7575 err = tg3_request_firmware(tp);
7576 if (tp->pci_chip_rev_id == CHIPREV_ID_5701_A0) {
7577 if (err)
7578 return err;
7579 } else if (err) {
7580 printk(KERN_WARNING "%s: TSO capability disabled.\n",
7581 tp->dev->name);
7582 tp->tg3_flags2 &= ~TG3_FLG2_TSO_CAPABLE;
7583 } else if (!(tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE)) {
7584 printk(KERN_NOTICE "%s: TSO capability restored.\n",
7585 tp->dev->name);
7586 tp->tg3_flags2 |= TG3_FLG2_TSO_CAPABLE;
7587 }
7588 }
7589
7543 netif_carrier_off(tp->dev); 7590 netif_carrier_off(tp->dev);
7544 7591
7545 err = tg3_set_power_state(tp, PCI_D0); 7592 err = tg3_set_power_state(tp, PCI_D0);
@@ -12934,7 +12981,6 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
12934 struct net_device *dev; 12981 struct net_device *dev;
12935 struct tg3 *tp; 12982 struct tg3 *tp;
12936 int err, pm_cap; 12983 int err, pm_cap;
12937 const char *fw_name = NULL;
12938 char str[40]; 12984 char str[40];
12939 u64 dma_mask, persist_dma_mask; 12985 u64 dma_mask, persist_dma_mask;
12940 12986
@@ -13091,7 +13137,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
13091 tg3_init_bufmgr_config(tp); 13137 tg3_init_bufmgr_config(tp);
13092 13138
13093 if (tp->pci_chip_rev_id == CHIPREV_ID_5701_A0) 13139 if (tp->pci_chip_rev_id == CHIPREV_ID_5701_A0)
13094 fw_name = FIRMWARE_TG3; 13140 tp->fw_needed = FIRMWARE_TG3;
13095 13141
13096 if (tp->tg3_flags2 & TG3_FLG2_HW_TSO) { 13142 if (tp->tg3_flags2 & TG3_FLG2_HW_TSO) {
13097 tp->tg3_flags2 |= TG3_FLG2_TSO_CAPABLE; 13143 tp->tg3_flags2 |= TG3_FLG2_TSO_CAPABLE;
@@ -13104,37 +13150,10 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
13104 tp->tg3_flags2 &= ~TG3_FLG2_TSO_CAPABLE; 13150 tp->tg3_flags2 &= ~TG3_FLG2_TSO_CAPABLE;
13105 } else { 13151 } else {
13106 tp->tg3_flags2 |= TG3_FLG2_TSO_CAPABLE | TG3_FLG2_TSO_BUG; 13152 tp->tg3_flags2 |= TG3_FLG2_TSO_CAPABLE | TG3_FLG2_TSO_BUG;
13107 }
13108 if (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE) {
13109 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) 13153 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)
13110 fw_name = FIRMWARE_TG3TSO5; 13154 tp->fw_needed = FIRMWARE_TG3TSO5;
13111 else 13155 else
13112 fw_name = FIRMWARE_TG3TSO; 13156 tp->fw_needed = FIRMWARE_TG3TSO;
13113 }
13114
13115 if (fw_name) {
13116 const __be32 *fw_data;
13117
13118 err = request_firmware(&tp->fw, fw_name, &tp->pdev->dev);
13119 if (err) {
13120 printk(KERN_ERR "tg3: Failed to load firmware \"%s\"\n",
13121 fw_name);
13122 goto err_out_iounmap;
13123 }
13124
13125 fw_data = (void *)tp->fw->data;
13126
13127 /* Firmware blob starts with version numbers, followed by
13128 start address and _full_ length including BSS sections
13129 (which must be longer than the actual data, of course */
13130
13131 tp->fw_len = be32_to_cpu(fw_data[2]); /* includes bss */
13132 if (tp->fw_len < (tp->fw->size - 12)) {
13133 printk(KERN_ERR "tg3: bogus length %d in \"%s\"\n",
13134 tp->fw_len, fw_name);
13135 err = -EINVAL;
13136 goto err_out_fw;
13137 }
13138 } 13157 }
13139 13158
13140 /* TSO is on by default on chips that support hardware TSO. 13159 /* TSO is on by default on chips that support hardware TSO.
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index ae5da603c6af..508def3e077f 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -2764,6 +2764,7 @@ struct tg3 {
2764 struct ethtool_coalesce coal; 2764 struct ethtool_coalesce coal;
2765 2765
2766 /* firmware info */ 2766 /* firmware info */
2767 const char *fw_needed;
2767 const struct firmware *fw; 2768 const struct firmware *fw;
2768 u32 fw_len; /* includes BSS */ 2769 u32 fw_len; /* includes BSS */
2769}; 2770};
diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c
index 5385d66b306e..ced8f36ebd01 100644
--- a/drivers/net/usb/mcs7830.c
+++ b/drivers/net/usb/mcs7830.c
@@ -94,10 +94,18 @@ static int mcs7830_get_reg(struct usbnet *dev, u16 index, u16 size, void *data)
94{ 94{
95 struct usb_device *xdev = dev->udev; 95 struct usb_device *xdev = dev->udev;
96 int ret; 96 int ret;
97 void *buffer;
98
99 buffer = kmalloc(size, GFP_NOIO);
100 if (buffer == NULL)
101 return -ENOMEM;
97 102
98 ret = usb_control_msg(xdev, usb_rcvctrlpipe(xdev, 0), MCS7830_RD_BREQ, 103 ret = usb_control_msg(xdev, usb_rcvctrlpipe(xdev, 0), MCS7830_RD_BREQ,
99 MCS7830_RD_BMREQ, 0x0000, index, data, 104 MCS7830_RD_BMREQ, 0x0000, index, buffer,
100 size, MCS7830_CTRL_TIMEOUT); 105 size, MCS7830_CTRL_TIMEOUT);
106 memcpy(data, buffer, size);
107 kfree(buffer);
108
101 return ret; 109 return ret;
102} 110}
103 111
@@ -105,10 +113,18 @@ static int mcs7830_set_reg(struct usbnet *dev, u16 index, u16 size, void *data)
105{ 113{
106 struct usb_device *xdev = dev->udev; 114 struct usb_device *xdev = dev->udev;
107 int ret; 115 int ret;
116 void *buffer;
117
118 buffer = kmalloc(size, GFP_NOIO);
119 if (buffer == NULL)
120 return -ENOMEM;
121
122 memcpy(buffer, data, size);
108 123
109 ret = usb_control_msg(xdev, usb_sndctrlpipe(xdev, 0), MCS7830_WR_BREQ, 124 ret = usb_control_msg(xdev, usb_sndctrlpipe(xdev, 0), MCS7830_WR_BREQ,
110 MCS7830_WR_BMREQ, 0x0000, index, data, 125 MCS7830_WR_BMREQ, 0x0000, index, buffer,
111 size, MCS7830_CTRL_TIMEOUT); 126 size, MCS7830_CTRL_TIMEOUT);
127 kfree(buffer);
112 return ret; 128 return ret;
113} 129}
114 130
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index a75f91dc3153..c5691fdb7079 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -1302,7 +1302,7 @@ static void velocity_free_rd_ring(struct velocity_info *vptr)
1302static int velocity_init_td_ring(struct velocity_info *vptr) 1302static int velocity_init_td_ring(struct velocity_info *vptr)
1303{ 1303{
1304 dma_addr_t curr; 1304 dma_addr_t curr;
1305 unsigned int j; 1305 int j;
1306 1306
1307 /* Init the TD ring entries */ 1307 /* Init the TD ring entries */
1308 for (j = 0; j < vptr->tx.numq; j++) { 1308 for (j = 0; j < vptr->tx.numq; j++) {
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 43f6523c40be..63ef2a8905fb 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -24,6 +24,7 @@
24#include <linux/virtio.h> 24#include <linux/virtio.h>
25#include <linux/virtio_net.h> 25#include <linux/virtio_net.h>
26#include <linux/scatterlist.h> 26#include <linux/scatterlist.h>
27#include <linux/if_vlan.h>
27 28
28static int napi_weight = 128; 29static int napi_weight = 128;
29module_param(napi_weight, int, 0444); 30module_param(napi_weight, int, 0444);
@@ -33,7 +34,7 @@ module_param(csum, bool, 0444);
33module_param(gso, bool, 0444); 34module_param(gso, bool, 0444);
34 35
35/* FIXME: MTU in config. */ 36/* FIXME: MTU in config. */
36#define MAX_PACKET_LEN (ETH_HLEN+ETH_DATA_LEN) 37#define MAX_PACKET_LEN (ETH_HLEN + VLAN_HLEN + ETH_DATA_LEN)
37#define GOOD_COPY_LEN 128 38#define GOOD_COPY_LEN 128
38 39
39struct virtnet_info 40struct virtnet_info
diff --git a/drivers/net/wimax/i2400m/control.c b/drivers/net/wimax/i2400m/control.c
index d3d37fed6893..15d9f51b292c 100644
--- a/drivers/net/wimax/i2400m/control.c
+++ b/drivers/net/wimax/i2400m/control.c
@@ -609,7 +609,7 @@ void i2400m_msg_to_dev_cancel_wait(struct i2400m *i2400m, int code)
609 spin_lock_irqsave(&i2400m->rx_lock, flags); 609 spin_lock_irqsave(&i2400m->rx_lock, flags);
610 ack_skb = i2400m->ack_skb; 610 ack_skb = i2400m->ack_skb;
611 if (ack_skb && !IS_ERR(ack_skb)) 611 if (ack_skb && !IS_ERR(ack_skb))
612 kfree(ack_skb); 612 kfree_skb(ack_skb);
613 i2400m->ack_skb = ERR_PTR(code); 613 i2400m->ack_skb = ERR_PTR(code);
614 spin_unlock_irqrestore(&i2400m->rx_lock, flags); 614 spin_unlock_irqrestore(&i2400m->rx_lock, flags);
615} 615}
diff --git a/drivers/net/wimax/i2400m/usb-rx.c b/drivers/net/wimax/i2400m/usb-rx.c
index 074cc1f89853..a314799967cf 100644
--- a/drivers/net/wimax/i2400m/usb-rx.c
+++ b/drivers/net/wimax/i2400m/usb-rx.c
@@ -184,6 +184,8 @@ void i2400mu_rx_size_maybe_shrink(struct i2400mu *i2400mu)
184 * NOTE: this function might realloc the skb (if it is too small), 184 * NOTE: this function might realloc the skb (if it is too small),
185 * so always update with the one returned. 185 * so always update with the one returned.
186 * ERR_PTR() is < 0 on error. 186 * ERR_PTR() is < 0 on error.
187 * Will return NULL if it cannot reallocate -- this can be
188 * considered a transient retryable error.
187 */ 189 */
188static 190static
189struct sk_buff *i2400mu_rx(struct i2400mu *i2400mu, struct sk_buff *rx_skb) 191struct sk_buff *i2400mu_rx(struct i2400mu *i2400mu, struct sk_buff *rx_skb)
@@ -243,8 +245,8 @@ retry:
243 if (printk_ratelimit()) 245 if (printk_ratelimit())
244 dev_err(dev, "RX: Can't reallocate skb to %d; " 246 dev_err(dev, "RX: Can't reallocate skb to %d; "
245 "RX dropped\n", rx_size); 247 "RX dropped\n", rx_size);
246 kfree(rx_skb); 248 kfree_skb(rx_skb);
247 result = 0; 249 rx_skb = NULL;
248 goto out; /* drop it...*/ 250 goto out; /* drop it...*/
249 } 251 }
250 kfree_skb(rx_skb); 252 kfree_skb(rx_skb);
@@ -344,7 +346,8 @@ int i2400mu_rxd(void *_i2400mu)
344 if (IS_ERR(rx_skb)) 346 if (IS_ERR(rx_skb))
345 goto out; 347 goto out;
346 atomic_dec(&i2400mu->rx_pending_count); 348 atomic_dec(&i2400mu->rx_pending_count);
347 if (rx_skb->len == 0) { /* some ignorable condition */ 349 if (rx_skb == NULL || rx_skb->len == 0) {
350 /* some "ignorable" condition */
348 kfree_skb(rx_skb); 351 kfree_skb(rx_skb);
349 continue; 352 continue;
350 } 353 }
diff --git a/drivers/net/wireless/ath9k/rc.c b/drivers/net/wireless/ath9k/rc.c
index 04ab457a8faa..1b71b934bb5e 100644
--- a/drivers/net/wireless/ath9k/rc.c
+++ b/drivers/net/wireless/ath9k/rc.c
@@ -490,7 +490,7 @@ static inline int ath_rc_get_nextvalid_txrate(struct ath_rate_table *rate_table,
490 490
491static int ath_rc_valid_phyrate(u32 phy, u32 capflag, int ignore_cw) 491static int ath_rc_valid_phyrate(u32 phy, u32 capflag, int ignore_cw)
492{ 492{
493 if (WLAN_RC_PHY_HT(phy) & !(capflag & WLAN_RC_HT_FLAG)) 493 if (WLAN_RC_PHY_HT(phy) && !(capflag & WLAN_RC_HT_FLAG))
494 return 0; 494 return 0;
495 if (WLAN_RC_PHY_DS(phy) && !(capflag & WLAN_RC_DS_FLAG)) 495 if (WLAN_RC_PHY_DS(phy) && !(capflag & WLAN_RC_DS_FLAG))
496 return 0; 496 return 0;
diff --git a/drivers/net/wireless/ath9k/regd_common.h b/drivers/net/wireless/ath9k/regd_common.h
index 9112c030b1e8..6df1b3b77c25 100644
--- a/drivers/net/wireless/ath9k/regd_common.h
+++ b/drivers/net/wireless/ath9k/regd_common.h
@@ -228,7 +228,7 @@ enum {
228}; 228};
229 229
230#define REG_DOMAIN_2GHZ_MASK (REQ_MASK & \ 230#define REG_DOMAIN_2GHZ_MASK (REQ_MASK & \
231 (!(ADHOC_NO_11A | DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB))) 231 (~(ADHOC_NO_11A | DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB)))
232#define REG_DOMAIN_5GHZ_MASK REQ_MASK 232#define REG_DOMAIN_5GHZ_MASK REQ_MASK
233 233
234static struct reg_dmn_pair_mapping regDomainPairs[] = { 234static struct reg_dmn_pair_mapping regDomainPairs[] = {
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
index 9b60a0c5de5f..21c841847d88 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
@@ -638,12 +638,16 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
638 s8 scale_action = 0; 638 s8 scale_action = 0;
639 unsigned long flags; 639 unsigned long flags;
640 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 640 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
641 u16 fc, rate_mask; 641 u16 fc;
642 u16 rate_mask = 0;
642 struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_r; 643 struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_r;
643 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 644 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
644 645
645 IWL_DEBUG_RATE("enter\n"); 646 IWL_DEBUG_RATE("enter\n");
646 647
648 if (sta)
649 rate_mask = sta->supp_rates[sband->band];
650
647 /* Send management frames and broadcast/multicast data using lowest 651 /* Send management frames and broadcast/multicast data using lowest
648 * rate. */ 652 * rate. */
649 fc = le16_to_cpu(hdr->frame_control); 653 fc = le16_to_cpu(hdr->frame_control);
@@ -651,11 +655,15 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
651 is_multicast_ether_addr(hdr->addr1) || 655 is_multicast_ether_addr(hdr->addr1) ||
652 !sta || !priv_sta) { 656 !sta || !priv_sta) {
653 IWL_DEBUG_RATE("leave: No STA priv data to update!\n"); 657 IWL_DEBUG_RATE("leave: No STA priv data to update!\n");
654 info->control.rates[0].idx = rate_lowest_index(sband, sta); 658 if (!rate_mask)
659 info->control.rates[0].idx =
660 rate_lowest_index(sband, NULL);
661 else
662 info->control.rates[0].idx =
663 rate_lowest_index(sband, sta);
655 return; 664 return;
656 } 665 }
657 666
658 rate_mask = sta->supp_rates[sband->band];
659 index = min(rs_sta->last_txrate_idx & 0xffff, IWL_RATE_COUNT - 1); 667 index = min(rs_sta->last_txrate_idx & 0xffff, IWL_RATE_COUNT - 1);
660 668
661 if (sband->band == IEEE80211_BAND_5GHZ) 669 if (sband->band == IEEE80211_BAND_5GHZ)
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index f3f17929ca0b..27f50471aed8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -944,7 +944,8 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband,
944 } 944 }
945 945
946 /* See if there's a better rate or modulation mode to try. */ 946 /* See if there's a better rate or modulation mode to try. */
947 rs_rate_scale_perform(priv, hdr, sta, lq_sta); 947 if (sta && sta->supp_rates[sband->band])
948 rs_rate_scale_perform(priv, hdr, sta, lq_sta);
948out: 949out:
949 return; 950 return;
950} 951}
@@ -2101,14 +2102,23 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta,
2101 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 2102 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
2102 struct iwl_lq_sta *lq_sta = priv_sta; 2103 struct iwl_lq_sta *lq_sta = priv_sta;
2103 int rate_idx; 2104 int rate_idx;
2105 u64 mask_bit = 0;
2104 2106
2105 IWL_DEBUG_RATE_LIMIT("rate scale calculate new rate for skb\n"); 2107 IWL_DEBUG_RATE_LIMIT("rate scale calculate new rate for skb\n");
2106 2108
2109 if (sta)
2110 mask_bit = sta->supp_rates[sband->band];
2111
2107 /* Send management frames and broadcast/multicast data using lowest 2112 /* Send management frames and broadcast/multicast data using lowest
2108 * rate. */ 2113 * rate. */
2109 if (!ieee80211_is_data(hdr->frame_control) || 2114 if (!ieee80211_is_data(hdr->frame_control) ||
2110 is_multicast_ether_addr(hdr->addr1) || !sta || !lq_sta) { 2115 is_multicast_ether_addr(hdr->addr1) || !sta || !lq_sta) {
2111 info->control.rates[0].idx = rate_lowest_index(sband, sta); 2116 if (!mask_bit)
2117 info->control.rates[0].idx =
2118 rate_lowest_index(sband, NULL);
2119 else
2120 info->control.rates[0].idx =
2121 rate_lowest_index(sband, sta);
2112 return; 2122 return;
2113 } 2123 }
2114 2124
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 5da6b35cd26d..0dc8eed16404 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -2482,7 +2482,7 @@ static int iwl_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
2482 dev_kfree_skb_any(skb); 2482 dev_kfree_skb_any(skb);
2483 2483
2484 IWL_DEBUG_MACDUMP("leave\n"); 2484 IWL_DEBUG_MACDUMP("leave\n");
2485 return 0; 2485 return NETDEV_TX_OK;
2486} 2486}
2487 2487
2488static int iwl_mac_add_interface(struct ieee80211_hw *hw, 2488static int iwl_mac_add_interface(struct ieee80211_hw *hw,
diff --git a/drivers/net/wireless/iwlwifi/iwl-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-hcmd.c
index 8c71ad4f88c5..4b35b30e493e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-hcmd.c
+++ b/drivers/net/wireless/iwlwifi/iwl-hcmd.c
@@ -224,7 +224,7 @@ int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
224 IWL_ERROR("Error: Response NULL in '%s'\n", 224 IWL_ERROR("Error: Response NULL in '%s'\n",
225 get_cmd_string(cmd->id)); 225 get_cmd_string(cmd->id));
226 ret = -EIO; 226 ret = -EIO;
227 goto out; 227 goto cancel;
228 } 228 }
229 229
230 ret = 0; 230 ret = 0;
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index d64580805d6e..95d01984c80e 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -745,7 +745,7 @@ static int iwl3945_send_cmd_sync(struct iwl3945_priv *priv, struct iwl3945_host_
745 IWL_ERROR("Error: Response NULL in '%s'\n", 745 IWL_ERROR("Error: Response NULL in '%s'\n",
746 get_cmd_string(cmd->id)); 746 get_cmd_string(cmd->id));
747 ret = -EIO; 747 ret = -EIO;
748 goto out; 748 goto cancel;
749 } 749 }
750 750
751 ret = 0; 751 ret = 0;
@@ -6538,7 +6538,7 @@ static int iwl3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
6538 dev_kfree_skb_any(skb); 6538 dev_kfree_skb_any(skb);
6539 6539
6540 IWL_DEBUG_MAC80211("leave\n"); 6540 IWL_DEBUG_MAC80211("leave\n");
6541 return 0; 6541 return NETDEV_TX_OK;
6542} 6542}
6543 6543
6544static int iwl3945_mac_add_interface(struct ieee80211_hw *hw, 6544static int iwl3945_mac_add_interface(struct ieee80211_hw *hw,
diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h
index e173b1b46c23..f6a79a653b7b 100644
--- a/drivers/net/wireless/libertas/hostcmd.h
+++ b/drivers/net/wireless/libertas/hostcmd.h
@@ -32,7 +32,7 @@ struct txpd {
32 u8 pktdelay_2ms; 32 u8 pktdelay_2ms;
33 /* reserved */ 33 /* reserved */
34 u8 reserved1; 34 u8 reserved1;
35}; 35} __attribute__ ((packed));
36 36
37/* RxPD Descriptor */ 37/* RxPD Descriptor */
38struct rxpd { 38struct rxpd {
@@ -63,7 +63,7 @@ struct rxpd {
63 /* Pkt Priority */ 63 /* Pkt Priority */
64 u8 priority; 64 u8 priority;
65 u8 reserved[3]; 65 u8 reserved[3];
66}; 66} __attribute__ ((packed));
67 67
68struct cmd_header { 68struct cmd_header {
69 __le16 command; 69 __le16 command;
@@ -97,7 +97,7 @@ struct enc_key {
97struct lbs_offset_value { 97struct lbs_offset_value {
98 u32 offset; 98 u32 offset;
99 u32 value; 99 u32 value;
100}; 100} __attribute__ ((packed));
101 101
102/* Define general data structure */ 102/* Define general data structure */
103/* cmd_DS_GEN */ 103/* cmd_DS_GEN */
@@ -107,7 +107,7 @@ struct cmd_ds_gen {
107 __le16 seqnum; 107 __le16 seqnum;
108 __le16 result; 108 __le16 result;
109 void *cmdresp[0]; 109 void *cmdresp[0];
110}; 110} __attribute__ ((packed));
111 111
112#define S_DS_GEN sizeof(struct cmd_ds_gen) 112#define S_DS_GEN sizeof(struct cmd_ds_gen)
113 113
@@ -163,7 +163,7 @@ struct cmd_ds_802_11_subscribe_event {
163 * bump this up a bit. 163 * bump this up a bit.
164 */ 164 */
165 uint8_t tlv[128]; 165 uint8_t tlv[128];
166}; 166} __attribute__ ((packed));
167 167
168/* 168/*
169 * This scan handle Country Information IE(802.11d compliant) 169 * This scan handle Country Information IE(802.11d compliant)
@@ -180,7 +180,7 @@ struct cmd_ds_802_11_scan {
180 mrvlietypes_chanlistparamset_t ChanListParamSet; 180 mrvlietypes_chanlistparamset_t ChanListParamSet;
181 mrvlietypes_ratesparamset_t OpRateSet; 181 mrvlietypes_ratesparamset_t OpRateSet;
182#endif 182#endif
183}; 183} __attribute__ ((packed));
184 184
185struct cmd_ds_802_11_scan_rsp { 185struct cmd_ds_802_11_scan_rsp {
186 struct cmd_header hdr; 186 struct cmd_header hdr;
@@ -188,7 +188,7 @@ struct cmd_ds_802_11_scan_rsp {
188 __le16 bssdescriptsize; 188 __le16 bssdescriptsize;
189 uint8_t nr_sets; 189 uint8_t nr_sets;
190 uint8_t bssdesc_and_tlvbuffer[0]; 190 uint8_t bssdesc_and_tlvbuffer[0];
191}; 191} __attribute__ ((packed));
192 192
193struct cmd_ds_802_11_get_log { 193struct cmd_ds_802_11_get_log {
194 struct cmd_header hdr; 194 struct cmd_header hdr;
@@ -206,33 +206,33 @@ struct cmd_ds_802_11_get_log {
206 __le32 fcserror; 206 __le32 fcserror;
207 __le32 txframe; 207 __le32 txframe;
208 __le32 wepundecryptable; 208 __le32 wepundecryptable;
209}; 209} __attribute__ ((packed));
210 210
211struct cmd_ds_mac_control { 211struct cmd_ds_mac_control {
212 struct cmd_header hdr; 212 struct cmd_header hdr;
213 __le16 action; 213 __le16 action;
214 u16 reserved; 214 u16 reserved;
215}; 215} __attribute__ ((packed));
216 216
217struct cmd_ds_mac_multicast_adr { 217struct cmd_ds_mac_multicast_adr {
218 struct cmd_header hdr; 218 struct cmd_header hdr;
219 __le16 action; 219 __le16 action;
220 __le16 nr_of_adrs; 220 __le16 nr_of_adrs;
221 u8 maclist[ETH_ALEN * MRVDRV_MAX_MULTICAST_LIST_SIZE]; 221 u8 maclist[ETH_ALEN * MRVDRV_MAX_MULTICAST_LIST_SIZE];
222}; 222} __attribute__ ((packed));
223 223
224struct cmd_ds_802_11_authenticate { 224struct cmd_ds_802_11_authenticate {
225 u8 macaddr[ETH_ALEN]; 225 u8 macaddr[ETH_ALEN];
226 u8 authtype; 226 u8 authtype;
227 u8 reserved[10]; 227 u8 reserved[10];
228}; 228} __attribute__ ((packed));
229 229
230struct cmd_ds_802_11_deauthenticate { 230struct cmd_ds_802_11_deauthenticate {
231 struct cmd_header hdr; 231 struct cmd_header hdr;
232 232
233 u8 macaddr[ETH_ALEN]; 233 u8 macaddr[ETH_ALEN];
234 __le16 reasoncode; 234 __le16 reasoncode;
235}; 235} __attribute__ ((packed));
236 236
237struct cmd_ds_802_11_associate { 237struct cmd_ds_802_11_associate {
238 u8 peerstaaddr[6]; 238 u8 peerstaaddr[6];
@@ -251,7 +251,7 @@ struct cmd_ds_802_11_associate {
251 251
252struct cmd_ds_802_11_associate_rsp { 252struct cmd_ds_802_11_associate_rsp {
253 struct ieeetypes_assocrsp assocRsp; 253 struct ieeetypes_assocrsp assocRsp;
254}; 254} __attribute__ ((packed));
255 255
256struct cmd_ds_802_11_set_wep { 256struct cmd_ds_802_11_set_wep {
257 struct cmd_header hdr; 257 struct cmd_header hdr;
@@ -265,7 +265,7 @@ struct cmd_ds_802_11_set_wep {
265 /* 40, 128bit or TXWEP */ 265 /* 40, 128bit or TXWEP */
266 uint8_t keytype[4]; 266 uint8_t keytype[4];
267 uint8_t keymaterial[4][16]; 267 uint8_t keymaterial[4][16];
268}; 268} __attribute__ ((packed));
269 269
270struct cmd_ds_802_3_get_stat { 270struct cmd_ds_802_3_get_stat {
271 __le32 xmitok; 271 __le32 xmitok;
@@ -274,7 +274,7 @@ struct cmd_ds_802_3_get_stat {
274 __le32 rcverror; 274 __le32 rcverror;
275 __le32 rcvnobuffer; 275 __le32 rcvnobuffer;
276 __le32 rcvcrcerror; 276 __le32 rcvcrcerror;
277}; 277} __attribute__ ((packed));
278 278
279struct cmd_ds_802_11_get_stat { 279struct cmd_ds_802_11_get_stat {
280 __le32 txfragmentcnt; 280 __le32 txfragmentcnt;
@@ -294,7 +294,7 @@ struct cmd_ds_802_11_get_stat {
294 __le32 txbeacon; 294 __le32 txbeacon;
295 __le32 rxbeacon; 295 __le32 rxbeacon;
296 __le32 wepundecryptable; 296 __le32 wepundecryptable;
297}; 297} __attribute__ ((packed));
298 298
299struct cmd_ds_802_11_snmp_mib { 299struct cmd_ds_802_11_snmp_mib {
300 struct cmd_header hdr; 300 struct cmd_header hdr;
@@ -303,58 +303,58 @@ struct cmd_ds_802_11_snmp_mib {
303 __le16 oid; 303 __le16 oid;
304 __le16 bufsize; 304 __le16 bufsize;
305 u8 value[128]; 305 u8 value[128];
306}; 306} __attribute__ ((packed));
307 307
308struct cmd_ds_mac_reg_map { 308struct cmd_ds_mac_reg_map {
309 __le16 buffersize; 309 __le16 buffersize;
310 u8 regmap[128]; 310 u8 regmap[128];
311 __le16 reserved; 311 __le16 reserved;
312}; 312} __attribute__ ((packed));
313 313
314struct cmd_ds_bbp_reg_map { 314struct cmd_ds_bbp_reg_map {
315 __le16 buffersize; 315 __le16 buffersize;
316 u8 regmap[128]; 316 u8 regmap[128];
317 __le16 reserved; 317 __le16 reserved;
318}; 318} __attribute__ ((packed));
319 319
320struct cmd_ds_rf_reg_map { 320struct cmd_ds_rf_reg_map {
321 __le16 buffersize; 321 __le16 buffersize;
322 u8 regmap[64]; 322 u8 regmap[64];
323 __le16 reserved; 323 __le16 reserved;
324}; 324} __attribute__ ((packed));
325 325
326struct cmd_ds_mac_reg_access { 326struct cmd_ds_mac_reg_access {
327 __le16 action; 327 __le16 action;
328 __le16 offset; 328 __le16 offset;
329 __le32 value; 329 __le32 value;
330}; 330} __attribute__ ((packed));
331 331
332struct cmd_ds_bbp_reg_access { 332struct cmd_ds_bbp_reg_access {
333 __le16 action; 333 __le16 action;
334 __le16 offset; 334 __le16 offset;
335 u8 value; 335 u8 value;
336 u8 reserved[3]; 336 u8 reserved[3];
337}; 337} __attribute__ ((packed));
338 338
339struct cmd_ds_rf_reg_access { 339struct cmd_ds_rf_reg_access {
340 __le16 action; 340 __le16 action;
341 __le16 offset; 341 __le16 offset;
342 u8 value; 342 u8 value;
343 u8 reserved[3]; 343 u8 reserved[3];
344}; 344} __attribute__ ((packed));
345 345
346struct cmd_ds_802_11_radio_control { 346struct cmd_ds_802_11_radio_control {
347 struct cmd_header hdr; 347 struct cmd_header hdr;
348 348
349 __le16 action; 349 __le16 action;
350 __le16 control; 350 __le16 control;
351}; 351} __attribute__ ((packed));
352 352
353struct cmd_ds_802_11_beacon_control { 353struct cmd_ds_802_11_beacon_control {
354 __le16 action; 354 __le16 action;
355 __le16 beacon_enable; 355 __le16 beacon_enable;
356 __le16 beacon_period; 356 __le16 beacon_period;
357}; 357} __attribute__ ((packed));
358 358
359struct cmd_ds_802_11_sleep_params { 359struct cmd_ds_802_11_sleep_params {
360 struct cmd_header hdr; 360 struct cmd_header hdr;
@@ -379,7 +379,7 @@ struct cmd_ds_802_11_sleep_params {
379 379
380 /* reserved field, should be set to zero */ 380 /* reserved field, should be set to zero */
381 __le16 reserved; 381 __le16 reserved;
382}; 382} __attribute__ ((packed));
383 383
384struct cmd_ds_802_11_inactivity_timeout { 384struct cmd_ds_802_11_inactivity_timeout {
385 struct cmd_header hdr; 385 struct cmd_header hdr;
@@ -389,7 +389,7 @@ struct cmd_ds_802_11_inactivity_timeout {
389 389
390 /* Inactivity timeout in msec */ 390 /* Inactivity timeout in msec */
391 __le16 timeout; 391 __le16 timeout;
392}; 392} __attribute__ ((packed));
393 393
394struct cmd_ds_802_11_rf_channel { 394struct cmd_ds_802_11_rf_channel {
395 struct cmd_header hdr; 395 struct cmd_header hdr;
@@ -399,7 +399,7 @@ struct cmd_ds_802_11_rf_channel {
399 __le16 rftype; /* unused */ 399 __le16 rftype; /* unused */
400 __le16 reserved; /* unused */ 400 __le16 reserved; /* unused */
401 u8 channellist[32]; /* unused */ 401 u8 channellist[32]; /* unused */
402}; 402} __attribute__ ((packed));
403 403
404struct cmd_ds_802_11_rssi { 404struct cmd_ds_802_11_rssi {
405 /* weighting factor */ 405 /* weighting factor */
@@ -408,21 +408,21 @@ struct cmd_ds_802_11_rssi {
408 __le16 reserved_0; 408 __le16 reserved_0;
409 __le16 reserved_1; 409 __le16 reserved_1;
410 __le16 reserved_2; 410 __le16 reserved_2;
411}; 411} __attribute__ ((packed));
412 412
413struct cmd_ds_802_11_rssi_rsp { 413struct cmd_ds_802_11_rssi_rsp {
414 __le16 SNR; 414 __le16 SNR;
415 __le16 noisefloor; 415 __le16 noisefloor;
416 __le16 avgSNR; 416 __le16 avgSNR;
417 __le16 avgnoisefloor; 417 __le16 avgnoisefloor;
418}; 418} __attribute__ ((packed));
419 419
420struct cmd_ds_802_11_mac_address { 420struct cmd_ds_802_11_mac_address {
421 struct cmd_header hdr; 421 struct cmd_header hdr;
422 422
423 __le16 action; 423 __le16 action;
424 u8 macadd[ETH_ALEN]; 424 u8 macadd[ETH_ALEN];
425}; 425} __attribute__ ((packed));
426 426
427struct cmd_ds_802_11_rf_tx_power { 427struct cmd_ds_802_11_rf_tx_power {
428 struct cmd_header hdr; 428 struct cmd_header hdr;
@@ -431,7 +431,7 @@ struct cmd_ds_802_11_rf_tx_power {
431 __le16 curlevel; 431 __le16 curlevel;
432 s8 maxlevel; 432 s8 maxlevel;
433 s8 minlevel; 433 s8 minlevel;
434}; 434} __attribute__ ((packed));
435 435
436struct cmd_ds_802_11_rf_antenna { 436struct cmd_ds_802_11_rf_antenna {
437 __le16 action; 437 __le16 action;
@@ -439,33 +439,33 @@ struct cmd_ds_802_11_rf_antenna {
439 /* Number of antennas or 0xffff(diversity) */ 439 /* Number of antennas or 0xffff(diversity) */
440 __le16 antennamode; 440 __le16 antennamode;
441 441
442}; 442} __attribute__ ((packed));
443 443
444struct cmd_ds_802_11_monitor_mode { 444struct cmd_ds_802_11_monitor_mode {
445 __le16 action; 445 __le16 action;
446 __le16 mode; 446 __le16 mode;
447}; 447} __attribute__ ((packed));
448 448
449struct cmd_ds_set_boot2_ver { 449struct cmd_ds_set_boot2_ver {
450 struct cmd_header hdr; 450 struct cmd_header hdr;
451 451
452 __le16 action; 452 __le16 action;
453 __le16 version; 453 __le16 version;
454}; 454} __attribute__ ((packed));
455 455
456struct cmd_ds_802_11_fw_wake_method { 456struct cmd_ds_802_11_fw_wake_method {
457 struct cmd_header hdr; 457 struct cmd_header hdr;
458 458
459 __le16 action; 459 __le16 action;
460 __le16 method; 460 __le16 method;
461}; 461} __attribute__ ((packed));
462 462
463struct cmd_ds_802_11_sleep_period { 463struct cmd_ds_802_11_sleep_period {
464 struct cmd_header hdr; 464 struct cmd_header hdr;
465 465
466 __le16 action; 466 __le16 action;
467 __le16 period; 467 __le16 period;
468}; 468} __attribute__ ((packed));
469 469
470struct cmd_ds_802_11_ps_mode { 470struct cmd_ds_802_11_ps_mode {
471 __le16 action; 471 __le16 action;
@@ -473,7 +473,7 @@ struct cmd_ds_802_11_ps_mode {
473 __le16 multipledtim; 473 __le16 multipledtim;
474 __le16 reserved; 474 __le16 reserved;
475 __le16 locallisteninterval; 475 __le16 locallisteninterval;
476}; 476} __attribute__ ((packed));
477 477
478struct cmd_confirm_sleep { 478struct cmd_confirm_sleep {
479 struct cmd_header hdr; 479 struct cmd_header hdr;
@@ -483,7 +483,7 @@ struct cmd_confirm_sleep {
483 __le16 multipledtim; 483 __le16 multipledtim;
484 __le16 reserved; 484 __le16 reserved;
485 __le16 locallisteninterval; 485 __le16 locallisteninterval;
486}; 486} __attribute__ ((packed));
487 487
488struct cmd_ds_802_11_data_rate { 488struct cmd_ds_802_11_data_rate {
489 struct cmd_header hdr; 489 struct cmd_header hdr;
@@ -491,14 +491,14 @@ struct cmd_ds_802_11_data_rate {
491 __le16 action; 491 __le16 action;
492 __le16 reserved; 492 __le16 reserved;
493 u8 rates[MAX_RATES]; 493 u8 rates[MAX_RATES];
494}; 494} __attribute__ ((packed));
495 495
496struct cmd_ds_802_11_rate_adapt_rateset { 496struct cmd_ds_802_11_rate_adapt_rateset {
497 struct cmd_header hdr; 497 struct cmd_header hdr;
498 __le16 action; 498 __le16 action;
499 __le16 enablehwauto; 499 __le16 enablehwauto;
500 __le16 bitmap; 500 __le16 bitmap;
501}; 501} __attribute__ ((packed));
502 502
503struct cmd_ds_802_11_ad_hoc_start { 503struct cmd_ds_802_11_ad_hoc_start {
504 struct cmd_header hdr; 504 struct cmd_header hdr;
@@ -520,7 +520,7 @@ struct cmd_ds_802_11_ad_hoc_result {
520 520
521 u8 pad[3]; 521 u8 pad[3];
522 u8 bssid[ETH_ALEN]; 522 u8 bssid[ETH_ALEN];
523}; 523} __attribute__ ((packed));
524 524
525struct adhoc_bssdesc { 525struct adhoc_bssdesc {
526 u8 bssid[ETH_ALEN]; 526 u8 bssid[ETH_ALEN];
@@ -578,7 +578,7 @@ struct MrvlIEtype_keyParamSet {
578 578
579 /* key material of size keylen */ 579 /* key material of size keylen */
580 u8 key[32]; 580 u8 key[32];
581}; 581} __attribute__ ((packed));
582 582
583#define MAX_WOL_RULES 16 583#define MAX_WOL_RULES 16
584 584
@@ -590,7 +590,7 @@ struct host_wol_rule {
590 __le16 reserve; 590 __le16 reserve;
591 __be32 sig_mask; 591 __be32 sig_mask;
592 __be32 signature; 592 __be32 signature;
593}; 593} __attribute__ ((packed));
594 594
595struct wol_config { 595struct wol_config {
596 uint8_t action; 596 uint8_t action;
@@ -598,8 +598,7 @@ struct wol_config {
598 uint8_t no_rules_in_cmd; 598 uint8_t no_rules_in_cmd;
599 uint8_t result; 599 uint8_t result;
600 struct host_wol_rule rule[MAX_WOL_RULES]; 600 struct host_wol_rule rule[MAX_WOL_RULES];
601}; 601} __attribute__ ((packed));
602
603 602
604struct cmd_ds_host_sleep { 603struct cmd_ds_host_sleep {
605 struct cmd_header hdr; 604 struct cmd_header hdr;
diff --git a/drivers/net/wireless/orinoco/orinoco.c b/drivers/net/wireless/orinoco/orinoco.c
index c3bb85e0251e..45a04faa7818 100644
--- a/drivers/net/wireless/orinoco/orinoco.c
+++ b/drivers/net/wireless/orinoco/orinoco.c
@@ -1673,7 +1673,7 @@ static void print_linkstatus(struct net_device *dev, u16 status)
1673 s = "UNKNOWN"; 1673 s = "UNKNOWN";
1674 } 1674 }
1675 1675
1676 printk(KERN_INFO "%s: New link status: %s (%04x)\n", 1676 printk(KERN_DEBUG "%s: New link status: %s (%04x)\n",
1677 dev->name, s, status); 1677 dev->name, s, status);
1678} 1678}
1679 1679
@@ -5068,33 +5068,30 @@ static int orinoco_ioctl_set_genie(struct net_device *dev,
5068 struct orinoco_private *priv = netdev_priv(dev); 5068 struct orinoco_private *priv = netdev_priv(dev);
5069 u8 *buf; 5069 u8 *buf;
5070 unsigned long flags; 5070 unsigned long flags;
5071 int err = 0;
5072 5071
5073 /* cut off at IEEE80211_MAX_DATA_LEN */ 5072 /* cut off at IEEE80211_MAX_DATA_LEN */
5074 if ((wrqu->data.length > IEEE80211_MAX_DATA_LEN) || 5073 if ((wrqu->data.length > IEEE80211_MAX_DATA_LEN) ||
5075 (wrqu->data.length && (extra == NULL))) 5074 (wrqu->data.length && (extra == NULL)))
5076 return -EINVAL; 5075 return -EINVAL;
5077 5076
5078 if (orinoco_lock(priv, &flags) != 0)
5079 return -EBUSY;
5080
5081 if (wrqu->data.length) { 5077 if (wrqu->data.length) {
5082 buf = kmalloc(wrqu->data.length, GFP_KERNEL); 5078 buf = kmalloc(wrqu->data.length, GFP_KERNEL);
5083 if (buf == NULL) { 5079 if (buf == NULL)
5084 err = -ENOMEM; 5080 return -ENOMEM;
5085 goto out;
5086 }
5087 5081
5088 memcpy(buf, extra, wrqu->data.length); 5082 memcpy(buf, extra, wrqu->data.length);
5089 kfree(priv->wpa_ie); 5083 } else
5090 priv->wpa_ie = buf; 5084 buf = NULL;
5091 priv->wpa_ie_len = wrqu->data.length; 5085
5092 } else { 5086 if (orinoco_lock(priv, &flags) != 0) {
5093 kfree(priv->wpa_ie); 5087 kfree(buf);
5094 priv->wpa_ie = NULL; 5088 return -EBUSY;
5095 priv->wpa_ie_len = 0;
5096 } 5089 }
5097 5090
5091 kfree(priv->wpa_ie);
5092 priv->wpa_ie = buf;
5093 priv->wpa_ie_len = wrqu->data.length;
5094
5098 if (priv->wpa_ie) { 5095 if (priv->wpa_ie) {
5099 /* Looks like wl_lkm wants to check the auth alg, and 5096 /* Looks like wl_lkm wants to check the auth alg, and
5100 * somehow pass it to the firmware. 5097 * somehow pass it to the firmware.
@@ -5103,9 +5100,8 @@ static int orinoco_ioctl_set_genie(struct net_device *dev,
5103 */ 5100 */
5104 } 5101 }
5105 5102
5106out:
5107 orinoco_unlock(priv, &flags); 5103 orinoco_unlock(priv, &flags);
5108 return err; 5104 return 0;
5109} 5105}
5110 5106
5111static int orinoco_ioctl_get_genie(struct net_device *dev, 5107static int orinoco_ioctl_get_genie(struct net_device *dev,
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c
index c6a370fa9bcb..34561e6e816b 100644
--- a/drivers/net/wireless/p54/p54common.c
+++ b/drivers/net/wireless/p54/p54common.c
@@ -451,8 +451,8 @@ static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
451 } 451 }
452 if (err) 452 if (err)
453 goto err; 453 goto err;
454 454 }
455 } 455 break;
456 case PDR_PRISM_ZIF_TX_IQ_CALIBRATION: 456 case PDR_PRISM_ZIF_TX_IQ_CALIBRATION:
457 priv->iq_autocal = kmalloc(data_len, GFP_KERNEL); 457 priv->iq_autocal = kmalloc(data_len, GFP_KERNEL);
458 if (!priv->iq_autocal) { 458 if (!priv->iq_autocal) {
@@ -745,7 +745,7 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb)
745 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(entry); 745 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(entry);
746 struct p54_hdr *entry_hdr; 746 struct p54_hdr *entry_hdr;
747 struct p54_tx_data *entry_data; 747 struct p54_tx_data *entry_data;
748 int pad = 0; 748 unsigned int pad = 0, frame_len;
749 749
750 range = (void *)info->rate_driver_data; 750 range = (void *)info->rate_driver_data;
751 if (range->start_addr != addr) { 751 if (range->start_addr != addr) {
@@ -768,6 +768,7 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb)
768 __skb_unlink(entry, &priv->tx_queue); 768 __skb_unlink(entry, &priv->tx_queue);
769 spin_unlock_irqrestore(&priv->tx_queue.lock, flags); 769 spin_unlock_irqrestore(&priv->tx_queue.lock, flags);
770 770
771 frame_len = entry->len;
771 entry_hdr = (struct p54_hdr *) entry->data; 772 entry_hdr = (struct p54_hdr *) entry->data;
772 entry_data = (struct p54_tx_data *) entry_hdr->data; 773 entry_data = (struct p54_tx_data *) entry_hdr->data;
773 priv->tx_stats[entry_data->hw_queue].len--; 774 priv->tx_stats[entry_data->hw_queue].len--;
@@ -814,15 +815,28 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb)
814 info->status.ack_signal = p54_rssi_to_dbm(dev, 815 info->status.ack_signal = p54_rssi_to_dbm(dev,
815 (int)payload->ack_rssi); 816 (int)payload->ack_rssi);
816 817
817 if (entry_data->key_type == P54_CRYPTO_TKIPMICHAEL) { 818 /* Undo all changes to the frame. */
819 switch (entry_data->key_type) {
820 case P54_CRYPTO_TKIPMICHAEL: {
818 u8 *iv = (u8 *)(entry_data->align + pad + 821 u8 *iv = (u8 *)(entry_data->align + pad +
819 entry_data->crypt_offset); 822 entry_data->crypt_offset);
820 823
821 /* Restore the original TKIP IV. */ 824 /* Restore the original TKIP IV. */
822 iv[2] = iv[0]; 825 iv[2] = iv[0];
823 iv[0] = iv[1]; 826 iv[0] = iv[1];
824 iv[1] = (iv[0] | 0x20) & 0x7f; /* WEPSeed - 8.3.2.2 */ 827 iv[1] = (iv[0] | 0x20) & 0x7f; /* WEPSeed - 8.3.2.2 */
828
829 frame_len -= 12; /* remove TKIP_MMIC + TKIP_ICV */
830 break;
831 }
832 case P54_CRYPTO_AESCCMP:
833 frame_len -= 8; /* remove CCMP_MIC */
834 break;
835 case P54_CRYPTO_WEP:
836 frame_len -= 4; /* remove WEP_ICV */
837 break;
825 } 838 }
839 skb_trim(entry, frame_len);
826 skb_pull(entry, sizeof(*hdr) + pad + sizeof(*entry_data)); 840 skb_pull(entry, sizeof(*hdr) + pad + sizeof(*entry_data));
827 ieee80211_tx_status_irqsafe(dev, entry); 841 ieee80211_tx_status_irqsafe(dev, entry);
828 goto out; 842 goto out;
@@ -1147,7 +1161,7 @@ static int p54_set_tim(struct ieee80211_hw *dev, struct ieee80211_sta *sta,
1147 1161
1148 skb = p54_alloc_skb(dev, P54_HDR_FLAG_CONTROL_OPSET, 1162 skb = p54_alloc_skb(dev, P54_HDR_FLAG_CONTROL_OPSET,
1149 sizeof(struct p54_hdr) + sizeof(*tim), 1163 sizeof(struct p54_hdr) + sizeof(*tim),
1150 P54_CONTROL_TYPE_TIM, GFP_KERNEL); 1164 P54_CONTROL_TYPE_TIM, GFP_ATOMIC);
1151 if (!skb) 1165 if (!skb)
1152 return -ENOMEM; 1166 return -ENOMEM;
1153 1167
@@ -1610,7 +1624,7 @@ static int p54_scan(struct ieee80211_hw *dev, u16 mode, u16 dwell)
1610 1624
1611 err: 1625 err:
1612 printk(KERN_ERR "%s: frequency change failed\n", wiphy_name(dev->wiphy)); 1626 printk(KERN_ERR "%s: frequency change failed\n", wiphy_name(dev->wiphy));
1613 kfree_skb(skb); 1627 p54_free_skb(dev, skb);
1614 return -EINVAL; 1628 return -EINVAL;
1615} 1629}
1616 1630
@@ -2077,7 +2091,7 @@ static int p54_set_key(struct ieee80211_hw *dev, enum set_key_cmd cmd,
2077 algo = P54_CRYPTO_AESCCMP; 2091 algo = P54_CRYPTO_AESCCMP;
2078 break; 2092 break;
2079 default: 2093 default:
2080 return -EINVAL; 2094 return -EOPNOTSUPP;
2081 } 2095 }
2082 } 2096 }
2083 2097
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c
index 6a6a72f6f82c..5de2ebfb28c7 100644
--- a/drivers/net/wireless/p54/p54usb.c
+++ b/drivers/net/wireless/p54/p54usb.c
@@ -144,11 +144,8 @@ static void p54u_tx_cb(struct urb *urb)
144 struct sk_buff *skb = urb->context; 144 struct sk_buff *skb = urb->context;
145 struct ieee80211_hw *dev = (struct ieee80211_hw *) 145 struct ieee80211_hw *dev = (struct ieee80211_hw *)
146 usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0)); 146 usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0));
147 struct p54u_priv *priv = dev->priv;
148 147
149 skb_pull(skb, priv->common.tx_hdr_len); 148 p54_free_skb(dev, skb);
150 if (FREE_AFTER_TX(skb))
151 p54_free_skb(dev, skb);
152} 149}
153 150
154static void p54u_tx_dummy_cb(struct urb *urb) { } 151static void p54u_tx_dummy_cb(struct urb *urb) { }
@@ -230,7 +227,10 @@ static void p54u_tx_3887(struct ieee80211_hw *dev, struct sk_buff *skb)
230 p54u_tx_dummy_cb, dev); 227 p54u_tx_dummy_cb, dev);
231 usb_fill_bulk_urb(data_urb, priv->udev, 228 usb_fill_bulk_urb(data_urb, priv->udev,
232 usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA), 229 usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA),
233 skb->data, skb->len, p54u_tx_cb, skb); 230 skb->data, skb->len, FREE_AFTER_TX(skb) ?
231 p54u_tx_cb : p54u_tx_dummy_cb, skb);
232 addr_urb->transfer_flags |= URB_ZERO_PACKET;
233 data_urb->transfer_flags |= URB_ZERO_PACKET;
234 234
235 usb_anchor_urb(addr_urb, &priv->submitted); 235 usb_anchor_urb(addr_urb, &priv->submitted);
236 err = usb_submit_urb(addr_urb, GFP_ATOMIC); 236 err = usb_submit_urb(addr_urb, GFP_ATOMIC);
@@ -239,7 +239,7 @@ static void p54u_tx_3887(struct ieee80211_hw *dev, struct sk_buff *skb)
239 goto out; 239 goto out;
240 } 240 }
241 241
242 usb_anchor_urb(addr_urb, &priv->submitted); 242 usb_anchor_urb(data_urb, &priv->submitted);
243 err = usb_submit_urb(data_urb, GFP_ATOMIC); 243 err = usb_submit_urb(data_urb, GFP_ATOMIC);
244 if (err) 244 if (err)
245 usb_unanchor_urb(data_urb); 245 usb_unanchor_urb(data_urb);
@@ -269,28 +269,24 @@ static void p54u_tx_lm87(struct ieee80211_hw *dev, struct sk_buff *skb)
269{ 269{
270 struct p54u_priv *priv = dev->priv; 270 struct p54u_priv *priv = dev->priv;
271 struct urb *data_urb; 271 struct urb *data_urb;
272 struct lm87_tx_hdr *hdr; 272 struct lm87_tx_hdr *hdr = (void *)skb->data - sizeof(*hdr);
273 __le32 checksum;
274 __le32 addr = ((struct p54_hdr *)skb->data)->req_id;
275 273
276 data_urb = usb_alloc_urb(0, GFP_ATOMIC); 274 data_urb = usb_alloc_urb(0, GFP_ATOMIC);
277 if (!data_urb) 275 if (!data_urb)
278 return; 276 return;
279 277
280 checksum = p54u_lm87_chksum((__le32 *)skb->data, skb->len); 278 hdr->chksum = p54u_lm87_chksum((__le32 *)skb->data, skb->len);
281 hdr = (struct lm87_tx_hdr *)skb_push(skb, sizeof(*hdr)); 279 hdr->device_addr = ((struct p54_hdr *)skb->data)->req_id;
282 hdr->chksum = checksum;
283 hdr->device_addr = addr;
284 280
285 usb_fill_bulk_urb(data_urb, priv->udev, 281 usb_fill_bulk_urb(data_urb, priv->udev,
286 usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA), 282 usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA),
287 skb->data, skb->len, p54u_tx_cb, skb); 283 hdr, skb->len + sizeof(*hdr), FREE_AFTER_TX(skb) ?
284 p54u_tx_cb : p54u_tx_dummy_cb, skb);
288 data_urb->transfer_flags |= URB_ZERO_PACKET; 285 data_urb->transfer_flags |= URB_ZERO_PACKET;
289 286
290 usb_anchor_urb(data_urb, &priv->submitted); 287 usb_anchor_urb(data_urb, &priv->submitted);
291 if (usb_submit_urb(data_urb, GFP_ATOMIC)) { 288 if (usb_submit_urb(data_urb, GFP_ATOMIC)) {
292 usb_unanchor_urb(data_urb); 289 usb_unanchor_urb(data_urb);
293 skb_pull(skb, sizeof(*hdr));
294 p54_free_skb(dev, skb); 290 p54_free_skb(dev, skb);
295 } 291 }
296 usb_free_urb(data_urb); 292 usb_free_urb(data_urb);
@@ -300,11 +296,9 @@ static void p54u_tx_net2280(struct ieee80211_hw *dev, struct sk_buff *skb)
300{ 296{
301 struct p54u_priv *priv = dev->priv; 297 struct p54u_priv *priv = dev->priv;
302 struct urb *int_urb, *data_urb; 298 struct urb *int_urb, *data_urb;
303 struct net2280_tx_hdr *hdr; 299 struct net2280_tx_hdr *hdr = (void *)skb->data - sizeof(*hdr);
304 struct net2280_reg_write *reg; 300 struct net2280_reg_write *reg;
305 int err = 0; 301 int err = 0;
306 __le32 addr = ((struct p54_hdr *) skb->data)->req_id;
307 __le16 len = cpu_to_le16(skb->len);
308 302
309 reg = kmalloc(sizeof(*reg), GFP_ATOMIC); 303 reg = kmalloc(sizeof(*reg), GFP_ATOMIC);
310 if (!reg) 304 if (!reg)
@@ -327,10 +321,9 @@ static void p54u_tx_net2280(struct ieee80211_hw *dev, struct sk_buff *skb)
327 reg->addr = cpu_to_le32(P54U_DEV_BASE); 321 reg->addr = cpu_to_le32(P54U_DEV_BASE);
328 reg->val = cpu_to_le32(ISL38XX_DEV_INT_DATA); 322 reg->val = cpu_to_le32(ISL38XX_DEV_INT_DATA);
329 323
330 hdr = (void *)skb_push(skb, sizeof(*hdr));
331 memset(hdr, 0, sizeof(*hdr)); 324 memset(hdr, 0, sizeof(*hdr));
332 hdr->len = len; 325 hdr->len = cpu_to_le16(skb->len);
333 hdr->device_addr = addr; 326 hdr->device_addr = ((struct p54_hdr *) skb->data)->req_id;
334 327
335 usb_fill_bulk_urb(int_urb, priv->udev, 328 usb_fill_bulk_urb(int_urb, priv->udev,
336 usb_sndbulkpipe(priv->udev, P54U_PIPE_DEV), reg, sizeof(*reg), 329 usb_sndbulkpipe(priv->udev, P54U_PIPE_DEV), reg, sizeof(*reg),
@@ -341,11 +334,13 @@ static void p54u_tx_net2280(struct ieee80211_hw *dev, struct sk_buff *skb)
341 * free what's inside the transfer_buffer after the callback routine 334 * free what's inside the transfer_buffer after the callback routine
342 * has completed. 335 * has completed.
343 */ 336 */
344 int_urb->transfer_flags |= URB_FREE_BUFFER; 337 int_urb->transfer_flags |= URB_FREE_BUFFER | URB_ZERO_PACKET;
345 338
346 usb_fill_bulk_urb(data_urb, priv->udev, 339 usb_fill_bulk_urb(data_urb, priv->udev,
347 usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA), 340 usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA),
348 skb->data, skb->len, p54u_tx_cb, skb); 341 hdr, skb->len + sizeof(*hdr), FREE_AFTER_TX(skb) ?
342 p54u_tx_cb : p54u_tx_dummy_cb, skb);
343 data_urb->transfer_flags |= URB_ZERO_PACKET;
349 344
350 usb_anchor_urb(int_urb, &priv->submitted); 345 usb_anchor_urb(int_urb, &priv->submitted);
351 err = usb_submit_urb(int_urb, GFP_ATOMIC); 346 err = usb_submit_urb(int_urb, GFP_ATOMIC);
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index 607ce9f61b54..ed93ac41297f 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -1649,9 +1649,7 @@ static char *rndis_translate_scan(struct net_device *dev,
1649 char *end_buf, 1649 char *end_buf,
1650 struct ndis_80211_bssid_ex *bssid) 1650 struct ndis_80211_bssid_ex *bssid)
1651{ 1651{
1652#ifdef DEBUG
1653 struct usbnet *usbdev = netdev_priv(dev); 1652 struct usbnet *usbdev = netdev_priv(dev);
1654#endif
1655 u8 *ie; 1653 u8 *ie;
1656 char *current_val; 1654 char *current_val;
1657 int bssid_len, ie_len, i; 1655 int bssid_len, ie_len, i;
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
index 746a8f36b931..0709decec9c2 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -154,6 +154,7 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
154 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; 154 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
155 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb); 155 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb);
156 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)entry->skb->data; 156 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)entry->skb->data;
157 struct ieee80211_tx_rate *txrate = &tx_info->control.rates[0];
157 struct ieee80211_rate *rate = 158 struct ieee80211_rate *rate =
158 ieee80211_get_tx_rate(rt2x00dev->hw, tx_info); 159 ieee80211_get_tx_rate(rt2x00dev->hw, tx_info);
159 const struct rt2x00_rate *hwrate; 160 const struct rt2x00_rate *hwrate;
@@ -313,7 +314,7 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
313 * When preamble is enabled we should set the 314 * When preamble is enabled we should set the
314 * preamble bit for the signal. 315 * preamble bit for the signal.
315 */ 316 */
316 if (rate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) 317 if (txrate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)
317 txdesc->signal |= 0x08; 318 txdesc->signal |= 0x08;
318 } 319 }
319} 320}
diff --git a/drivers/net/wireless/rt2x00/rt2x00rfkill.c b/drivers/net/wireless/rt2x00/rt2x00rfkill.c
index c3f53a92180a..3298cae1e12d 100644
--- a/drivers/net/wireless/rt2x00/rt2x00rfkill.c
+++ b/drivers/net/wireless/rt2x00/rt2x00rfkill.c
@@ -162,7 +162,7 @@ void rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev)
162 162
163void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev) 163void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev)
164{ 164{
165 if (!test_bit(RFKILL_STATE_ALLOCATED, &rt2x00dev->flags)) 165 if (!test_bit(RFKILL_STATE_ALLOCATED, &rt2x00dev->rfkill_state))
166 return; 166 return;
167 167
168 cancel_delayed_work_sync(&rt2x00dev->rfkill_work); 168 cancel_delayed_work_sync(&rt2x00dev->rfkill_work);
diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c
index 6ad6bac37706..22bc07ef2f37 100644
--- a/drivers/net/wireless/rtl818x/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8187_dev.c
@@ -273,6 +273,7 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
273 273
274 usb_fill_bulk_urb(urb, priv->udev, usb_sndbulkpipe(priv->udev, ep), 274 usb_fill_bulk_urb(urb, priv->udev, usb_sndbulkpipe(priv->udev, ep),
275 buf, skb->len, rtl8187_tx_cb, skb); 275 buf, skb->len, rtl8187_tx_cb, skb);
276 urb->transfer_flags |= URB_ZERO_PACKET;
276 usb_anchor_urb(urb, &priv->anchored); 277 usb_anchor_urb(urb, &priv->anchored);
277 rc = usb_submit_urb(urb, GFP_ATOMIC); 278 rc = usb_submit_urb(urb, GFP_ATOMIC);
278 if (rc < 0) { 279 if (rc < 0) {
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c
index b5db57d2fcf5..17527f765b39 100644
--- a/drivers/net/wireless/zd1211rw/zd_usb.c
+++ b/drivers/net/wireless/zd1211rw/zd_usb.c
@@ -84,6 +84,7 @@ static struct usb_device_id usb_ids[] = {
84 { USB_DEVICE(0x0586, 0x340a), .driver_info = DEVICE_ZD1211B }, 84 { USB_DEVICE(0x0586, 0x340a), .driver_info = DEVICE_ZD1211B },
85 { USB_DEVICE(0x0471, 0x1237), .driver_info = DEVICE_ZD1211B }, 85 { USB_DEVICE(0x0471, 0x1237), .driver_info = DEVICE_ZD1211B },
86 { USB_DEVICE(0x07fa, 0x1196), .driver_info = DEVICE_ZD1211B }, 86 { USB_DEVICE(0x07fa, 0x1196), .driver_info = DEVICE_ZD1211B },
87 { USB_DEVICE(0x0df6, 0x0036), .driver_info = DEVICE_ZD1211B },
87 /* "Driverless" devices that need ejecting */ 88 /* "Driverless" devices that need ejecting */
88 { USB_DEVICE(0x0ace, 0x2011), .driver_info = DEVICE_INSTALLER }, 89 { USB_DEVICE(0x0ace, 0x2011), .driver_info = DEVICE_INSTALLER },
89 { USB_DEVICE(0x0ace, 0x20ff), .driver_info = DEVICE_INSTALLER }, 90 { USB_DEVICE(0x0ace, 0x20ff), .driver_info = DEVICE_INSTALLER },