aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2014-09-23 12:09:27 -0400
committerDavid S. Miller <davem@davemloft.net>2014-09-23 12:09:27 -0400
commit1f6d80358dc9bbbeb56cb43384fa11fd645d9289 (patch)
tree152bfa5165292a8e4f06d536b6d222a68480e573 /drivers/net
parenta2aeb02a8e6a9fef397c344245a54eeae67341f6 (diff)
parent98f75b8291a89ba6bf73e322ee467ce0bfeb91c1 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts: arch/mips/net/bpf_jit.c drivers/net/can/flexcan.c Both the flexcan and MIPS bpf_jit conflicts were cases of simple overlapping changes. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/bonding/bond_main.c19
-rw-r--r--drivers/net/can/at91_can.c8
-rw-r--r--drivers/net/can/c_can/c_can_platform.c4
-rw-r--r--drivers/net/can/flexcan.c54
-rw-r--r--drivers/net/can/sja1000/peak_pci.c6
-rw-r--r--drivers/net/ethernet/3com/3c59x.c50
-rw-r--r--drivers/net/ethernet/arc/emac_main.c53
-rw-r--r--drivers/net/ethernet/broadcom/b44.c2
-rw-r--r--drivers/net/ethernet/broadcom/bcmsysport.c31
-rw-r--r--drivers/net/ethernet/broadcom/genet/bcmgenet.c143
-rw-r--r--drivers/net/ethernet/broadcom/tg3.c20
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c49
-rw-r--r--drivers/net/ethernet/davicom/dm9000.c2
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/cmd.c21
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_ethtool.c3
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/qp.c12
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/resource_tracker.c38
-rw-r--r--drivers/net/ethernet/octeon/octeon_mgmt.c4
-rw-r--r--drivers/net/ethernet/oki-semi/pch_gbe/Kconfig1
-rw-r--r--drivers/net/ethernet/realtek/r8169.c67
-rw-r--r--drivers/net/ethernet/sfc/farch.c3
-rw-r--r--drivers/net/ethernet/sun/sunvnet.c7
-rw-r--r--drivers/net/ethernet/ti/cpsw.c52
-rw-r--r--drivers/net/macvlan.c4
-rw-r--r--drivers/net/phy/micrel.c3
-rw-r--r--drivers/net/usb/r8152.c62
-rw-r--r--drivers/net/wireless/ath/ath9k/common-beacon.c5
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_txrx.c2
-rw-r--r--drivers/net/wireless/brcm80211/Kconfig10
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/Makefile10
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/bcdc.h7
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/fweh.c12
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/fweh.h2
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h11
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c9
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/power.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-7000.c16
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-config.h3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-nvm-parse.c4
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/coex.c9
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c3
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/fw-api.h4
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c10
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mac80211.c25
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/power.c5
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/rx.c6
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/sf.c2
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/tx.c8
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/drv.c7
49 files changed, 609 insertions, 281 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 382a389b9bba..53904758d693 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -175,7 +175,7 @@ MODULE_PARM_DESC(fail_over_mac, "For active-backup, do not set all slaves to "
175 "the same MAC; 0 for none (default), " 175 "the same MAC; 0 for none (default), "
176 "1 for active, 2 for follow"); 176 "1 for active, 2 for follow");
177module_param(all_slaves_active, int, 0); 177module_param(all_slaves_active, int, 0);
178MODULE_PARM_DESC(all_slaves_active, "Keep all frames received on an interface" 178MODULE_PARM_DESC(all_slaves_active, "Keep all frames received on an interface "
179 "by setting active flag for all slaves; " 179 "by setting active flag for all slaves; "
180 "0 for never (default), 1 for always."); 180 "0 for never (default), 1 for always.");
181module_param(resend_igmp, int, 0); 181module_param(resend_igmp, int, 0);
@@ -3531,8 +3531,14 @@ static int bond_xmit_roundrobin(struct sk_buff *skb, struct net_device *bond_dev
3531 else 3531 else
3532 bond_xmit_slave_id(bond, skb, 0); 3532 bond_xmit_slave_id(bond, skb, 0);
3533 } else { 3533 } else {
3534 slave_id = bond_rr_gen_slave_id(bond); 3534 int slave_cnt = ACCESS_ONCE(bond->slave_cnt);
3535 bond_xmit_slave_id(bond, skb, slave_id % bond->slave_cnt); 3535
3536 if (likely(slave_cnt)) {
3537 slave_id = bond_rr_gen_slave_id(bond);
3538 bond_xmit_slave_id(bond, skb, slave_id % slave_cnt);
3539 } else {
3540 dev_kfree_skb_any(skb);
3541 }
3536 } 3542 }
3537 3543
3538 return NETDEV_TX_OK; 3544 return NETDEV_TX_OK;
@@ -3562,8 +3568,13 @@ static int bond_xmit_activebackup(struct sk_buff *skb, struct net_device *bond_d
3562static int bond_xmit_xor(struct sk_buff *skb, struct net_device *bond_dev) 3568static int bond_xmit_xor(struct sk_buff *skb, struct net_device *bond_dev)
3563{ 3569{
3564 struct bonding *bond = netdev_priv(bond_dev); 3570 struct bonding *bond = netdev_priv(bond_dev);
3571 int slave_cnt = ACCESS_ONCE(bond->slave_cnt);
3565 3572
3566 bond_xmit_slave_id(bond, skb, bond_xmit_hash(bond, skb) % bond->slave_cnt); 3573 if (likely(slave_cnt))
3574 bond_xmit_slave_id(bond, skb,
3575 bond_xmit_hash(bond, skb) % slave_cnt);
3576 else
3577 dev_kfree_skb_any(skb);
3567 3578
3568 return NETDEV_TX_OK; 3579 return NETDEV_TX_OK;
3569} 3580}
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c
index f07fa89b5fd5..05e1aa090add 100644
--- a/drivers/net/can/at91_can.c
+++ b/drivers/net/can/at91_can.c
@@ -1123,7 +1123,9 @@ static int at91_open(struct net_device *dev)
1123 struct at91_priv *priv = netdev_priv(dev); 1123 struct at91_priv *priv = netdev_priv(dev);
1124 int err; 1124 int err;
1125 1125
1126 clk_enable(priv->clk); 1126 err = clk_prepare_enable(priv->clk);
1127 if (err)
1128 return err;
1127 1129
1128 /* check or determine and set bittime */ 1130 /* check or determine and set bittime */
1129 err = open_candev(dev); 1131 err = open_candev(dev);
@@ -1149,7 +1151,7 @@ static int at91_open(struct net_device *dev)
1149 out_close: 1151 out_close:
1150 close_candev(dev); 1152 close_candev(dev);
1151 out: 1153 out:
1152 clk_disable(priv->clk); 1154 clk_disable_unprepare(priv->clk);
1153 1155
1154 return err; 1156 return err;
1155} 1157}
@@ -1166,7 +1168,7 @@ static int at91_close(struct net_device *dev)
1166 at91_chip_stop(dev, CAN_STATE_STOPPED); 1168 at91_chip_stop(dev, CAN_STATE_STOPPED);
1167 1169
1168 free_irq(dev->irq, dev); 1170 free_irq(dev->irq, dev);
1169 clk_disable(priv->clk); 1171 clk_disable_unprepare(priv->clk);
1170 1172
1171 close_candev(dev); 1173 close_candev(dev);
1172 1174
diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c
index 109cb44291f5..fb279d6ae484 100644
--- a/drivers/net/can/c_can/c_can_platform.c
+++ b/drivers/net/can/c_can/c_can_platform.c
@@ -97,14 +97,14 @@ static void c_can_hw_raminit_ti(const struct c_can_priv *priv, bool enable)
97 ctrl |= CAN_RAMINIT_DONE_MASK(priv->instance); 97 ctrl |= CAN_RAMINIT_DONE_MASK(priv->instance);
98 writel(ctrl, priv->raminit_ctrlreg); 98 writel(ctrl, priv->raminit_ctrlreg);
99 ctrl &= ~CAN_RAMINIT_DONE_MASK(priv->instance); 99 ctrl &= ~CAN_RAMINIT_DONE_MASK(priv->instance);
100 c_can_hw_raminit_wait_ti(priv, ctrl, mask); 100 c_can_hw_raminit_wait_ti(priv, mask, ctrl);
101 101
102 if (enable) { 102 if (enable) {
103 /* Set start bit and wait for the done bit. */ 103 /* Set start bit and wait for the done bit. */
104 ctrl |= CAN_RAMINIT_START_MASK(priv->instance); 104 ctrl |= CAN_RAMINIT_START_MASK(priv->instance);
105 writel(ctrl, priv->raminit_ctrlreg); 105 writel(ctrl, priv->raminit_ctrlreg);
106 ctrl |= CAN_RAMINIT_DONE_MASK(priv->instance); 106 ctrl |= CAN_RAMINIT_DONE_MASK(priv->instance);
107 c_can_hw_raminit_wait_ti(priv, ctrl, mask); 107 c_can_hw_raminit_wait_ti(priv, mask, ctrl);
108 } 108 }
109 spin_unlock(&raminit_lock); 109 spin_unlock(&raminit_lock);
110} 110}
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 2700865efcad..60f86bd0434a 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -62,7 +62,7 @@
62#define FLEXCAN_MCR_BCC BIT(16) 62#define FLEXCAN_MCR_BCC BIT(16)
63#define FLEXCAN_MCR_LPRIO_EN BIT(13) 63#define FLEXCAN_MCR_LPRIO_EN BIT(13)
64#define FLEXCAN_MCR_AEN BIT(12) 64#define FLEXCAN_MCR_AEN BIT(12)
65#define FLEXCAN_MCR_MAXMB(x) ((x) & 0x1f) 65#define FLEXCAN_MCR_MAXMB(x) ((x) & 0x7f)
66#define FLEXCAN_MCR_IDAM_A (0 << 8) 66#define FLEXCAN_MCR_IDAM_A (0 << 8)
67#define FLEXCAN_MCR_IDAM_B (1 << 8) 67#define FLEXCAN_MCR_IDAM_B (1 << 8)
68#define FLEXCAN_MCR_IDAM_C (2 << 8) 68#define FLEXCAN_MCR_IDAM_C (2 << 8)
@@ -146,7 +146,9 @@
146 FLEXCAN_ESR_BOFF_INT | FLEXCAN_ESR_ERR_INT) 146 FLEXCAN_ESR_BOFF_INT | FLEXCAN_ESR_ERR_INT)
147 147
148/* FLEXCAN interrupt flag register (IFLAG) bits */ 148/* FLEXCAN interrupt flag register (IFLAG) bits */
149#define FLEXCAN_TX_BUF_ID 8 149/* Errata ERR005829 step7: Reserve first valid MB */
150#define FLEXCAN_TX_BUF_RESERVED 8
151#define FLEXCAN_TX_BUF_ID 9
150#define FLEXCAN_IFLAG_BUF(x) BIT(x) 152#define FLEXCAN_IFLAG_BUF(x) BIT(x)
151#define FLEXCAN_IFLAG_RX_FIFO_OVERFLOW BIT(7) 153#define FLEXCAN_IFLAG_RX_FIFO_OVERFLOW BIT(7)
152#define FLEXCAN_IFLAG_RX_FIFO_WARN BIT(6) 154#define FLEXCAN_IFLAG_RX_FIFO_WARN BIT(6)
@@ -157,6 +159,17 @@
157 159
158/* FLEXCAN message buffers */ 160/* FLEXCAN message buffers */
159#define FLEXCAN_MB_CNT_CODE(x) (((x) & 0xf) << 24) 161#define FLEXCAN_MB_CNT_CODE(x) (((x) & 0xf) << 24)
162#define FLEXCAN_MB_CODE_RX_INACTIVE (0x0 << 24)
163#define FLEXCAN_MB_CODE_RX_EMPTY (0x4 << 24)
164#define FLEXCAN_MB_CODE_RX_FULL (0x2 << 24)
165#define FLEXCAN_MB_CODE_RX_OVERRRUN (0x6 << 24)
166#define FLEXCAN_MB_CODE_RX_RANSWER (0xa << 24)
167
168#define FLEXCAN_MB_CODE_TX_INACTIVE (0x8 << 24)
169#define FLEXCAN_MB_CODE_TX_ABORT (0x9 << 24)
170#define FLEXCAN_MB_CODE_TX_DATA (0xc << 24)
171#define FLEXCAN_MB_CODE_TX_TANSWER (0xe << 24)
172
160#define FLEXCAN_MB_CNT_SRR BIT(22) 173#define FLEXCAN_MB_CNT_SRR BIT(22)
161#define FLEXCAN_MB_CNT_IDE BIT(21) 174#define FLEXCAN_MB_CNT_IDE BIT(21)
162#define FLEXCAN_MB_CNT_RTR BIT(20) 175#define FLEXCAN_MB_CNT_RTR BIT(20)
@@ -333,7 +346,7 @@ static int flexcan_chip_enable(struct flexcan_priv *priv)
333 flexcan_write(reg, &regs->mcr); 346 flexcan_write(reg, &regs->mcr);
334 347
335 while (timeout-- && (flexcan_read(&regs->mcr) & FLEXCAN_MCR_LPM_ACK)) 348 while (timeout-- && (flexcan_read(&regs->mcr) & FLEXCAN_MCR_LPM_ACK))
336 usleep_range(10, 20); 349 udelay(10);
337 350
338 if (flexcan_read(&regs->mcr) & FLEXCAN_MCR_LPM_ACK) 351 if (flexcan_read(&regs->mcr) & FLEXCAN_MCR_LPM_ACK)
339 return -ETIMEDOUT; 352 return -ETIMEDOUT;
@@ -352,7 +365,7 @@ static int flexcan_chip_disable(struct flexcan_priv *priv)
352 flexcan_write(reg, &regs->mcr); 365 flexcan_write(reg, &regs->mcr);
353 366
354 while (timeout-- && !(flexcan_read(&regs->mcr) & FLEXCAN_MCR_LPM_ACK)) 367 while (timeout-- && !(flexcan_read(&regs->mcr) & FLEXCAN_MCR_LPM_ACK))
355 usleep_range(10, 20); 368 udelay(10);
356 369
357 if (!(flexcan_read(&regs->mcr) & FLEXCAN_MCR_LPM_ACK)) 370 if (!(flexcan_read(&regs->mcr) & FLEXCAN_MCR_LPM_ACK))
358 return -ETIMEDOUT; 371 return -ETIMEDOUT;
@@ -371,7 +384,7 @@ static int flexcan_chip_freeze(struct flexcan_priv *priv)
371 flexcan_write(reg, &regs->mcr); 384 flexcan_write(reg, &regs->mcr);
372 385
373 while (timeout-- && !(flexcan_read(&regs->mcr) & FLEXCAN_MCR_FRZ_ACK)) 386 while (timeout-- && !(flexcan_read(&regs->mcr) & FLEXCAN_MCR_FRZ_ACK))
374 usleep_range(100, 200); 387 udelay(100);
375 388
376 if (!(flexcan_read(&regs->mcr) & FLEXCAN_MCR_FRZ_ACK)) 389 if (!(flexcan_read(&regs->mcr) & FLEXCAN_MCR_FRZ_ACK))
377 return -ETIMEDOUT; 390 return -ETIMEDOUT;
@@ -390,7 +403,7 @@ static int flexcan_chip_unfreeze(struct flexcan_priv *priv)
390 flexcan_write(reg, &regs->mcr); 403 flexcan_write(reg, &regs->mcr);
391 404
392 while (timeout-- && (flexcan_read(&regs->mcr) & FLEXCAN_MCR_FRZ_ACK)) 405 while (timeout-- && (flexcan_read(&regs->mcr) & FLEXCAN_MCR_FRZ_ACK))
393 usleep_range(10, 20); 406 udelay(10);
394 407
395 if (flexcan_read(&regs->mcr) & FLEXCAN_MCR_FRZ_ACK) 408 if (flexcan_read(&regs->mcr) & FLEXCAN_MCR_FRZ_ACK)
396 return -ETIMEDOUT; 409 return -ETIMEDOUT;
@@ -405,7 +418,7 @@ static int flexcan_chip_softreset(struct flexcan_priv *priv)
405 418
406 flexcan_write(FLEXCAN_MCR_SOFTRST, &regs->mcr); 419 flexcan_write(FLEXCAN_MCR_SOFTRST, &regs->mcr);
407 while (timeout-- && (flexcan_read(&regs->mcr) & FLEXCAN_MCR_SOFTRST)) 420 while (timeout-- && (flexcan_read(&regs->mcr) & FLEXCAN_MCR_SOFTRST))
408 usleep_range(10, 20); 421 udelay(10);
409 422
410 if (flexcan_read(&regs->mcr) & FLEXCAN_MCR_SOFTRST) 423 if (flexcan_read(&regs->mcr) & FLEXCAN_MCR_SOFTRST)
411 return -ETIMEDOUT; 424 return -ETIMEDOUT;
@@ -487,6 +500,14 @@ static int flexcan_start_xmit(struct sk_buff *skb, struct net_device *dev)
487 flexcan_write(can_id, &regs->cantxfg[FLEXCAN_TX_BUF_ID].can_id); 500 flexcan_write(can_id, &regs->cantxfg[FLEXCAN_TX_BUF_ID].can_id);
488 flexcan_write(ctrl, &regs->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl); 501 flexcan_write(ctrl, &regs->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl);
489 502
503 /* Errata ERR005829 step8:
504 * Write twice INACTIVE(0x8) code to first MB.
505 */
506 flexcan_write(FLEXCAN_MB_CODE_TX_INACTIVE,
507 &regs->cantxfg[FLEXCAN_TX_BUF_RESERVED].can_ctrl);
508 flexcan_write(FLEXCAN_MB_CODE_TX_INACTIVE,
509 &regs->cantxfg[FLEXCAN_TX_BUF_RESERVED].can_ctrl);
510
490 return NETDEV_TX_OK; 511 return NETDEV_TX_OK;
491} 512}
492 513
@@ -803,6 +824,9 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)
803 stats->tx_bytes += can_get_echo_skb(dev, 0); 824 stats->tx_bytes += can_get_echo_skb(dev, 0);
804 stats->tx_packets++; 825 stats->tx_packets++;
805 can_led_event(dev, CAN_LED_EVENT_TX); 826 can_led_event(dev, CAN_LED_EVENT_TX);
827 /* after sending a RTR frame mailbox is in RX mode */
828 flexcan_write(FLEXCAN_MB_CODE_TX_INACTIVE,
829 &regs->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl);
806 flexcan_write((1 << FLEXCAN_TX_BUF_ID), &regs->iflag1); 830 flexcan_write((1 << FLEXCAN_TX_BUF_ID), &regs->iflag1);
807 netif_wake_queue(dev); 831 netif_wake_queue(dev);
808 } 832 }
@@ -858,8 +882,8 @@ static int flexcan_chip_start(struct net_device *dev)
858{ 882{
859 struct flexcan_priv *priv = netdev_priv(dev); 883 struct flexcan_priv *priv = netdev_priv(dev);
860 struct flexcan_regs __iomem *regs = priv->base; 884 struct flexcan_regs __iomem *regs = priv->base;
861 int err;
862 u32 reg_mcr, reg_ctrl, reg_crl2, reg_mecr; 885 u32 reg_mcr, reg_ctrl, reg_crl2, reg_mecr;
886 int err, i;
863 887
864 /* enable module */ 888 /* enable module */
865 err = flexcan_chip_enable(priv); 889 err = flexcan_chip_enable(priv);
@@ -926,8 +950,18 @@ static int flexcan_chip_start(struct net_device *dev)
926 netdev_dbg(dev, "%s: writing ctrl=0x%08x", __func__, reg_ctrl); 950 netdev_dbg(dev, "%s: writing ctrl=0x%08x", __func__, reg_ctrl);
927 flexcan_write(reg_ctrl, &regs->ctrl); 951 flexcan_write(reg_ctrl, &regs->ctrl);
928 952
929 /* Abort any pending TX, mark Mailbox as INACTIVE */ 953 /* clear and invalidate all mailboxes first */
930 flexcan_write(FLEXCAN_MB_CNT_CODE(0x4), 954 for (i = FLEXCAN_TX_BUF_ID; i < ARRAY_SIZE(regs->cantxfg); i++) {
955 flexcan_write(FLEXCAN_MB_CODE_RX_INACTIVE,
956 &regs->cantxfg[i].can_ctrl);
957 }
958
959 /* Errata ERR005829: mark first TX mailbox as INACTIVE */
960 flexcan_write(FLEXCAN_MB_CODE_TX_INACTIVE,
961 &regs->cantxfg[FLEXCAN_TX_BUF_RESERVED].can_ctrl);
962
963 /* mark TX mailbox as INACTIVE */
964 flexcan_write(FLEXCAN_MB_CODE_TX_INACTIVE,
931 &regs->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl); 965 &regs->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl);
932 966
933 /* acceptance mask/acceptance code (accept everything) */ 967 /* acceptance mask/acceptance code (accept everything) */
diff --git a/drivers/net/can/sja1000/peak_pci.c b/drivers/net/can/sja1000/peak_pci.c
index 7a85590fefb9..e5fac368068a 100644
--- a/drivers/net/can/sja1000/peak_pci.c
+++ b/drivers/net/can/sja1000/peak_pci.c
@@ -70,6 +70,8 @@ struct peak_pci_chan {
70#define PEAK_PC_104P_DEVICE_ID 0x0006 /* PCAN-PC/104+ cards */ 70#define PEAK_PC_104P_DEVICE_ID 0x0006 /* PCAN-PC/104+ cards */
71#define PEAK_PCI_104E_DEVICE_ID 0x0007 /* PCAN-PCI/104 Express cards */ 71#define PEAK_PCI_104E_DEVICE_ID 0x0007 /* PCAN-PCI/104 Express cards */
72#define PEAK_MPCIE_DEVICE_ID 0x0008 /* The miniPCIe slot cards */ 72#define PEAK_MPCIE_DEVICE_ID 0x0008 /* The miniPCIe slot cards */
73#define PEAK_PCIE_OEM_ID 0x0009 /* PCAN-PCI Express OEM */
74#define PEAK_PCIEC34_DEVICE_ID 0x000A /* PCAN-PCI Express 34 (one channel) */
73 75
74#define PEAK_PCI_CHAN_MAX 4 76#define PEAK_PCI_CHAN_MAX 4
75 77
@@ -87,6 +89,7 @@ static const struct pci_device_id peak_pci_tbl[] = {
87 {PEAK_PCI_VENDOR_ID, PEAK_CPCI_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, 89 {PEAK_PCI_VENDOR_ID, PEAK_CPCI_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,},
88#ifdef CONFIG_CAN_PEAK_PCIEC 90#ifdef CONFIG_CAN_PEAK_PCIEC
89 {PEAK_PCI_VENDOR_ID, PEAK_PCIEC_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, 91 {PEAK_PCI_VENDOR_ID, PEAK_PCIEC_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,},
92 {PEAK_PCI_VENDOR_ID, PEAK_PCIEC34_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,},
90#endif 93#endif
91 {0,} 94 {0,}
92}; 95};
@@ -653,7 +656,8 @@ static int peak_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
653 * This must be done *before* register_sja1000dev() but 656 * This must be done *before* register_sja1000dev() but
654 * *after* devices linkage 657 * *after* devices linkage
655 */ 658 */
656 if (pdev->device == PEAK_PCIEC_DEVICE_ID) { 659 if (pdev->device == PEAK_PCIEC_DEVICE_ID ||
660 pdev->device == PEAK_PCIEC34_DEVICE_ID) {
657 err = peak_pciec_probe(pdev, dev); 661 err = peak_pciec_probe(pdev, dev);
658 if (err) { 662 if (err) {
659 dev_err(&pdev->dev, 663 dev_err(&pdev->dev,
diff --git a/drivers/net/ethernet/3com/3c59x.c b/drivers/net/ethernet/3com/3c59x.c
index 2b92d712f212..86e621142d5b 100644
--- a/drivers/net/ethernet/3com/3c59x.c
+++ b/drivers/net/ethernet/3com/3c59x.c
@@ -2128,6 +2128,7 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev)
2128 int entry = vp->cur_tx % TX_RING_SIZE; 2128 int entry = vp->cur_tx % TX_RING_SIZE;
2129 struct boom_tx_desc *prev_entry = &vp->tx_ring[(vp->cur_tx-1) % TX_RING_SIZE]; 2129 struct boom_tx_desc *prev_entry = &vp->tx_ring[(vp->cur_tx-1) % TX_RING_SIZE];
2130 unsigned long flags; 2130 unsigned long flags;
2131 dma_addr_t dma_addr;
2131 2132
2132 if (vortex_debug > 6) { 2133 if (vortex_debug > 6) {
2133 pr_debug("boomerang_start_xmit()\n"); 2134 pr_debug("boomerang_start_xmit()\n");
@@ -2162,24 +2163,48 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev)
2162 vp->tx_ring[entry].status = cpu_to_le32(skb->len | TxIntrUploaded | AddTCPChksum | AddUDPChksum); 2163 vp->tx_ring[entry].status = cpu_to_le32(skb->len | TxIntrUploaded | AddTCPChksum | AddUDPChksum);
2163 2164
2164 if (!skb_shinfo(skb)->nr_frags) { 2165 if (!skb_shinfo(skb)->nr_frags) {
2165 vp->tx_ring[entry].frag[0].addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->data, 2166 dma_addr = pci_map_single(VORTEX_PCI(vp), skb->data, skb->len,
2166 skb->len, PCI_DMA_TODEVICE)); 2167 PCI_DMA_TODEVICE);
2168 if (dma_mapping_error(&VORTEX_PCI(vp)->dev, dma_addr))
2169 goto out_dma_err;
2170
2171 vp->tx_ring[entry].frag[0].addr = cpu_to_le32(dma_addr);
2167 vp->tx_ring[entry].frag[0].length = cpu_to_le32(skb->len | LAST_FRAG); 2172 vp->tx_ring[entry].frag[0].length = cpu_to_le32(skb->len | LAST_FRAG);
2168 } else { 2173 } else {
2169 int i; 2174 int i;
2170 2175
2171 vp->tx_ring[entry].frag[0].addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->data, 2176 dma_addr = pci_map_single(VORTEX_PCI(vp), skb->data,
2172 skb_headlen(skb), PCI_DMA_TODEVICE)); 2177 skb_headlen(skb), PCI_DMA_TODEVICE);
2178 if (dma_mapping_error(&VORTEX_PCI(vp)->dev, dma_addr))
2179 goto out_dma_err;
2180
2181 vp->tx_ring[entry].frag[0].addr = cpu_to_le32(dma_addr);
2173 vp->tx_ring[entry].frag[0].length = cpu_to_le32(skb_headlen(skb)); 2182 vp->tx_ring[entry].frag[0].length = cpu_to_le32(skb_headlen(skb));
2174 2183
2175 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { 2184 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
2176 skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; 2185 skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
2177 2186
2187 dma_addr = skb_frag_dma_map(&VORTEX_PCI(vp)->dev, frag,
2188 0,
2189 frag->size,
2190 DMA_TO_DEVICE);
2191 if (dma_mapping_error(&VORTEX_PCI(vp)->dev, dma_addr)) {
2192 for(i = i-1; i >= 0; i--)
2193 dma_unmap_page(&VORTEX_PCI(vp)->dev,
2194 le32_to_cpu(vp->tx_ring[entry].frag[i+1].addr),
2195 le32_to_cpu(vp->tx_ring[entry].frag[i+1].length),
2196 DMA_TO_DEVICE);
2197
2198 pci_unmap_single(VORTEX_PCI(vp),
2199 le32_to_cpu(vp->tx_ring[entry].frag[0].addr),
2200 le32_to_cpu(vp->tx_ring[entry].frag[0].length),
2201 PCI_DMA_TODEVICE);
2202
2203 goto out_dma_err;
2204 }
2205
2178 vp->tx_ring[entry].frag[i+1].addr = 2206 vp->tx_ring[entry].frag[i+1].addr =
2179 cpu_to_le32(skb_frag_dma_map( 2207 cpu_to_le32(dma_addr);
2180 &VORTEX_PCI(vp)->dev,
2181 frag,
2182 frag->page_offset, frag->size, DMA_TO_DEVICE));
2183 2208
2184 if (i == skb_shinfo(skb)->nr_frags-1) 2209 if (i == skb_shinfo(skb)->nr_frags-1)
2185 vp->tx_ring[entry].frag[i+1].length = cpu_to_le32(skb_frag_size(frag)|LAST_FRAG); 2210 vp->tx_ring[entry].frag[i+1].length = cpu_to_le32(skb_frag_size(frag)|LAST_FRAG);
@@ -2188,7 +2213,10 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev)
2188 } 2213 }
2189 } 2214 }
2190#else 2215#else
2191 vp->tx_ring[entry].addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->data, skb->len, PCI_DMA_TODEVICE)); 2216 dma_addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->data, skb->len, PCI_DMA_TODEVICE));
2217 if (dma_mapping_error(&VORTEX_PCI(vp)->dev, dma_addr))
2218 goto out_dma_err;
2219 vp->tx_ring[entry].addr = cpu_to_le32(dma_addr);
2192 vp->tx_ring[entry].length = cpu_to_le32(skb->len | LAST_FRAG); 2220 vp->tx_ring[entry].length = cpu_to_le32(skb->len | LAST_FRAG);
2193 vp->tx_ring[entry].status = cpu_to_le32(skb->len | TxIntrUploaded); 2221 vp->tx_ring[entry].status = cpu_to_le32(skb->len | TxIntrUploaded);
2194#endif 2222#endif
@@ -2216,7 +2244,11 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev)
2216 skb_tx_timestamp(skb); 2244 skb_tx_timestamp(skb);
2217 iowrite16(DownUnstall, ioaddr + EL3_CMD); 2245 iowrite16(DownUnstall, ioaddr + EL3_CMD);
2218 spin_unlock_irqrestore(&vp->lock, flags); 2246 spin_unlock_irqrestore(&vp->lock, flags);
2247out:
2219 return NETDEV_TX_OK; 2248 return NETDEV_TX_OK;
2249out_dma_err:
2250 dev_err(&VORTEX_PCI(vp)->dev, "Error mapping dma buffer\n");
2251 goto out;
2220} 2252}
2221 2253
2222/* The interrupt handler does all of the Rx thread work and cleans up 2254/* The interrupt handler does all of the Rx thread work and cleans up
diff --git a/drivers/net/ethernet/arc/emac_main.c b/drivers/net/ethernet/arc/emac_main.c
index dbea8472bfb4..abe1eabc0171 100644
--- a/drivers/net/ethernet/arc/emac_main.c
+++ b/drivers/net/ethernet/arc/emac_main.c
@@ -28,6 +28,17 @@
28 28
29 29
30/** 30/**
31 * arc_emac_tx_avail - Return the number of available slots in the tx ring.
32 * @priv: Pointer to ARC EMAC private data structure.
33 *
34 * returns: the number of slots available for transmission in tx the ring.
35 */
36static inline int arc_emac_tx_avail(struct arc_emac_priv *priv)
37{
38 return (priv->txbd_dirty + TX_BD_NUM - priv->txbd_curr - 1) % TX_BD_NUM;
39}
40
41/**
31 * arc_emac_adjust_link - Adjust the PHY link duplex. 42 * arc_emac_adjust_link - Adjust the PHY link duplex.
32 * @ndev: Pointer to the net_device structure. 43 * @ndev: Pointer to the net_device structure.
33 * 44 *
@@ -182,10 +193,15 @@ static void arc_emac_tx_clean(struct net_device *ndev)
182 txbd->info = 0; 193 txbd->info = 0;
183 194
184 *txbd_dirty = (*txbd_dirty + 1) % TX_BD_NUM; 195 *txbd_dirty = (*txbd_dirty + 1) % TX_BD_NUM;
185
186 if (netif_queue_stopped(ndev))
187 netif_wake_queue(ndev);
188 } 196 }
197
198 /* Ensure that txbd_dirty is visible to tx() before checking
199 * for queue stopped.
200 */
201 smp_mb();
202
203 if (netif_queue_stopped(ndev) && arc_emac_tx_avail(priv))
204 netif_wake_queue(ndev);
189} 205}
190 206
191/** 207/**
@@ -300,7 +316,7 @@ static int arc_emac_poll(struct napi_struct *napi, int budget)
300 work_done = arc_emac_rx(ndev, budget); 316 work_done = arc_emac_rx(ndev, budget);
301 if (work_done < budget) { 317 if (work_done < budget) {
302 napi_complete(napi); 318 napi_complete(napi);
303 arc_reg_or(priv, R_ENABLE, RXINT_MASK); 319 arc_reg_or(priv, R_ENABLE, RXINT_MASK | TXINT_MASK);
304 } 320 }
305 321
306 return work_done; 322 return work_done;
@@ -329,9 +345,9 @@ static irqreturn_t arc_emac_intr(int irq, void *dev_instance)
329 /* Reset all flags except "MDIO complete" */ 345 /* Reset all flags except "MDIO complete" */
330 arc_reg_set(priv, R_STATUS, status); 346 arc_reg_set(priv, R_STATUS, status);
331 347
332 if (status & RXINT_MASK) { 348 if (status & (RXINT_MASK | TXINT_MASK)) {
333 if (likely(napi_schedule_prep(&priv->napi))) { 349 if (likely(napi_schedule_prep(&priv->napi))) {
334 arc_reg_clr(priv, R_ENABLE, RXINT_MASK); 350 arc_reg_clr(priv, R_ENABLE, RXINT_MASK | TXINT_MASK);
335 __napi_schedule(&priv->napi); 351 __napi_schedule(&priv->napi);
336 } 352 }
337 } 353 }
@@ -442,7 +458,7 @@ static int arc_emac_open(struct net_device *ndev)
442 arc_reg_set(priv, R_TX_RING, (unsigned int)priv->txbd_dma); 458 arc_reg_set(priv, R_TX_RING, (unsigned int)priv->txbd_dma);
443 459
444 /* Enable interrupts */ 460 /* Enable interrupts */
445 arc_reg_set(priv, R_ENABLE, RXINT_MASK | ERR_MASK); 461 arc_reg_set(priv, R_ENABLE, RXINT_MASK | TXINT_MASK | ERR_MASK);
446 462
447 /* Set CONTROL */ 463 /* Set CONTROL */
448 arc_reg_set(priv, R_CTRL, 464 arc_reg_set(priv, R_CTRL,
@@ -513,7 +529,7 @@ static int arc_emac_stop(struct net_device *ndev)
513 netif_stop_queue(ndev); 529 netif_stop_queue(ndev);
514 530
515 /* Disable interrupts */ 531 /* Disable interrupts */
516 arc_reg_clr(priv, R_ENABLE, RXINT_MASK | ERR_MASK); 532 arc_reg_clr(priv, R_ENABLE, RXINT_MASK | TXINT_MASK | ERR_MASK);
517 533
518 /* Disable EMAC */ 534 /* Disable EMAC */
519 arc_reg_clr(priv, R_CTRL, EN_MASK); 535 arc_reg_clr(priv, R_CTRL, EN_MASK);
@@ -576,11 +592,9 @@ static int arc_emac_tx(struct sk_buff *skb, struct net_device *ndev)
576 592
577 len = max_t(unsigned int, ETH_ZLEN, skb->len); 593 len = max_t(unsigned int, ETH_ZLEN, skb->len);
578 594
579 /* EMAC still holds this buffer in its possession. 595 if (unlikely(!arc_emac_tx_avail(priv))) {
580 * CPU must not modify this buffer descriptor
581 */
582 if (unlikely((le32_to_cpu(*info) & OWN_MASK) == FOR_EMAC)) {
583 netif_stop_queue(ndev); 596 netif_stop_queue(ndev);
597 netdev_err(ndev, "BUG! Tx Ring full when queue awake!\n");
584 return NETDEV_TX_BUSY; 598 return NETDEV_TX_BUSY;
585 } 599 }
586 600
@@ -609,12 +623,19 @@ static int arc_emac_tx(struct sk_buff *skb, struct net_device *ndev)
609 /* Increment index to point to the next BD */ 623 /* Increment index to point to the next BD */
610 *txbd_curr = (*txbd_curr + 1) % TX_BD_NUM; 624 *txbd_curr = (*txbd_curr + 1) % TX_BD_NUM;
611 625
612 /* Get "info" of the next BD */ 626 /* Ensure that tx_clean() sees the new txbd_curr before
613 info = &priv->txbd[*txbd_curr].info; 627 * checking the queue status. This prevents an unneeded wake
628 * of the queue in tx_clean().
629 */
630 smp_mb();
614 631
615 /* Check if if Tx BD ring is full - next BD is still owned by EMAC */ 632 if (!arc_emac_tx_avail(priv)) {
616 if (unlikely((le32_to_cpu(*info) & OWN_MASK) == FOR_EMAC))
617 netif_stop_queue(ndev); 633 netif_stop_queue(ndev);
634 /* Refresh tx_dirty */
635 smp_mb();
636 if (arc_emac_tx_avail(priv))
637 netif_start_queue(ndev);
638 }
618 639
619 arc_reg_set(priv, R_STATUS, TXPL_MASK); 640 arc_reg_set(priv, R_STATUS, TXPL_MASK);
620 641
diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c
index 56fadbd4258a..416620fa8fac 100644
--- a/drivers/net/ethernet/broadcom/b44.c
+++ b/drivers/net/ethernet/broadcom/b44.c
@@ -1697,7 +1697,7 @@ static struct rtnl_link_stats64 *b44_get_stats64(struct net_device *dev,
1697 hwstat->tx_underruns + 1697 hwstat->tx_underruns +
1698 hwstat->tx_excessive_cols + 1698 hwstat->tx_excessive_cols +
1699 hwstat->tx_late_cols); 1699 hwstat->tx_late_cols);
1700 nstat->multicast = hwstat->tx_multicast_pkts; 1700 nstat->multicast = hwstat->rx_multicast_pkts;
1701 nstat->collisions = hwstat->tx_total_cols; 1701 nstat->collisions = hwstat->tx_total_cols;
1702 1702
1703 nstat->rx_length_errors = (hwstat->rx_oversize_pkts + 1703 nstat->rx_length_errors = (hwstat->rx_oversize_pkts +
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 662cf2222873..77f1ff7396ac 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -543,6 +543,25 @@ static unsigned int bcm_sysport_desc_rx(struct bcm_sysport_priv *priv,
543 while ((processed < to_process) && (processed < budget)) { 543 while ((processed < to_process) && (processed < budget)) {
544 cb = &priv->rx_cbs[priv->rx_read_ptr]; 544 cb = &priv->rx_cbs[priv->rx_read_ptr];
545 skb = cb->skb; 545 skb = cb->skb;
546
547 processed++;
548 priv->rx_read_ptr++;
549
550 if (priv->rx_read_ptr == priv->num_rx_bds)
551 priv->rx_read_ptr = 0;
552
553 /* We do not have a backing SKB, so we do not a corresponding
554 * DMA mapping for this incoming packet since
555 * bcm_sysport_rx_refill always either has both skb and mapping
556 * or none.
557 */
558 if (unlikely(!skb)) {
559 netif_err(priv, rx_err, ndev, "out of memory!\n");
560 ndev->stats.rx_dropped++;
561 ndev->stats.rx_errors++;
562 goto refill;
563 }
564
546 dma_unmap_single(kdev, dma_unmap_addr(cb, dma_addr), 565 dma_unmap_single(kdev, dma_unmap_addr(cb, dma_addr),
547 RX_BUF_LENGTH, DMA_FROM_DEVICE); 566 RX_BUF_LENGTH, DMA_FROM_DEVICE);
548 567
@@ -552,23 +571,11 @@ static unsigned int bcm_sysport_desc_rx(struct bcm_sysport_priv *priv,
552 status = (rsb->rx_status_len >> DESC_STATUS_SHIFT) & 571 status = (rsb->rx_status_len >> DESC_STATUS_SHIFT) &
553 DESC_STATUS_MASK; 572 DESC_STATUS_MASK;
554 573
555 processed++;
556 priv->rx_read_ptr++;
557 if (priv->rx_read_ptr == priv->num_rx_bds)
558 priv->rx_read_ptr = 0;
559
560 netif_dbg(priv, rx_status, ndev, 574 netif_dbg(priv, rx_status, ndev,
561 "p=%d, c=%d, rd_ptr=%d, len=%d, flag=0x%04x\n", 575 "p=%d, c=%d, rd_ptr=%d, len=%d, flag=0x%04x\n",
562 p_index, priv->rx_c_index, priv->rx_read_ptr, 576 p_index, priv->rx_c_index, priv->rx_read_ptr,
563 len, status); 577 len, status);
564 578
565 if (unlikely(!skb)) {
566 netif_err(priv, rx_err, ndev, "out of memory!\n");
567 ndev->stats.rx_dropped++;
568 ndev->stats.rx_errors++;
569 goto refill;
570 }
571
572 if (unlikely(!(status & DESC_EOP) || !(status & DESC_SOP))) { 579 if (unlikely(!(status & DESC_EOP) || !(status & DESC_SOP))) {
573 netif_err(priv, rx_status, ndev, "fragmented packet!\n"); 580 netif_err(priv, rx_status, ndev, "fragmented packet!\n");
574 ndev->stats.rx_dropped++; 581 ndev->stats.rx_dropped++;
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index a12c65604f9d..e8c601d26c64 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -875,6 +875,7 @@ static void __bcmgenet_tx_reclaim(struct net_device *dev,
875 int last_tx_cn, last_c_index, num_tx_bds; 875 int last_tx_cn, last_c_index, num_tx_bds;
876 struct enet_cb *tx_cb_ptr; 876 struct enet_cb *tx_cb_ptr;
877 struct netdev_queue *txq; 877 struct netdev_queue *txq;
878 unsigned int bds_compl;
878 unsigned int c_index; 879 unsigned int c_index;
879 880
880 /* Compute how many buffers are transmitted since last xmit call */ 881 /* Compute how many buffers are transmitted since last xmit call */
@@ -899,7 +900,9 @@ static void __bcmgenet_tx_reclaim(struct net_device *dev,
899 /* Reclaim transmitted buffers */ 900 /* Reclaim transmitted buffers */
900 while (last_tx_cn-- > 0) { 901 while (last_tx_cn-- > 0) {
901 tx_cb_ptr = ring->cbs + last_c_index; 902 tx_cb_ptr = ring->cbs + last_c_index;
903 bds_compl = 0;
902 if (tx_cb_ptr->skb) { 904 if (tx_cb_ptr->skb) {
905 bds_compl = skb_shinfo(tx_cb_ptr->skb)->nr_frags + 1;
903 dev->stats.tx_bytes += tx_cb_ptr->skb->len; 906 dev->stats.tx_bytes += tx_cb_ptr->skb->len;
904 dma_unmap_single(&dev->dev, 907 dma_unmap_single(&dev->dev,
905 dma_unmap_addr(tx_cb_ptr, dma_addr), 908 dma_unmap_addr(tx_cb_ptr, dma_addr),
@@ -916,7 +919,7 @@ static void __bcmgenet_tx_reclaim(struct net_device *dev,
916 dma_unmap_addr_set(tx_cb_ptr, dma_addr, 0); 919 dma_unmap_addr_set(tx_cb_ptr, dma_addr, 0);
917 } 920 }
918 dev->stats.tx_packets++; 921 dev->stats.tx_packets++;
919 ring->free_bds += 1; 922 ring->free_bds += bds_compl;
920 923
921 last_c_index++; 924 last_c_index++;
922 last_c_index &= (num_tx_bds - 1); 925 last_c_index &= (num_tx_bds - 1);
@@ -1274,12 +1277,29 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_priv *priv,
1274 1277
1275 while ((rxpktprocessed < rxpkttoprocess) && 1278 while ((rxpktprocessed < rxpkttoprocess) &&
1276 (rxpktprocessed < budget)) { 1279 (rxpktprocessed < budget)) {
1280 cb = &priv->rx_cbs[priv->rx_read_ptr];
1281 skb = cb->skb;
1282
1283 rxpktprocessed++;
1284
1285 priv->rx_read_ptr++;
1286 priv->rx_read_ptr &= (priv->num_rx_bds - 1);
1287
1288 /* We do not have a backing SKB, so we do not have a
1289 * corresponding DMA mapping for this incoming packet since
1290 * bcmgenet_rx_refill always either has both skb and mapping or
1291 * none.
1292 */
1293 if (unlikely(!skb)) {
1294 dev->stats.rx_dropped++;
1295 dev->stats.rx_errors++;
1296 goto refill;
1297 }
1298
1277 /* Unmap the packet contents such that we can use the 1299 /* Unmap the packet contents such that we can use the
1278 * RSV from the 64 bytes descriptor when enabled and save 1300 * RSV from the 64 bytes descriptor when enabled and save
1279 * a 32-bits register read 1301 * a 32-bits register read
1280 */ 1302 */
1281 cb = &priv->rx_cbs[priv->rx_read_ptr];
1282 skb = cb->skb;
1283 dma_unmap_single(&dev->dev, dma_unmap_addr(cb, dma_addr), 1303 dma_unmap_single(&dev->dev, dma_unmap_addr(cb, dma_addr),
1284 priv->rx_buf_len, DMA_FROM_DEVICE); 1304 priv->rx_buf_len, DMA_FROM_DEVICE);
1285 1305
@@ -1307,18 +1327,6 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_priv *priv,
1307 __func__, p_index, priv->rx_c_index, 1327 __func__, p_index, priv->rx_c_index,
1308 priv->rx_read_ptr, dma_length_status); 1328 priv->rx_read_ptr, dma_length_status);
1309 1329
1310 rxpktprocessed++;
1311
1312 priv->rx_read_ptr++;
1313 priv->rx_read_ptr &= (priv->num_rx_bds - 1);
1314
1315 /* out of memory, just drop packets at the hardware level */
1316 if (unlikely(!skb)) {
1317 dev->stats.rx_dropped++;
1318 dev->stats.rx_errors++;
1319 goto refill;
1320 }
1321
1322 if (unlikely(!(dma_flag & DMA_EOP) || !(dma_flag & DMA_SOP))) { 1330 if (unlikely(!(dma_flag & DMA_EOP) || !(dma_flag & DMA_SOP))) {
1323 netif_err(priv, rx_status, dev, 1331 netif_err(priv, rx_status, dev,
1324 "dropping fragmented packet!\n"); 1332 "dropping fragmented packet!\n");
@@ -1736,13 +1744,63 @@ static void bcmgenet_init_multiq(struct net_device *dev)
1736 bcmgenet_tdma_writel(priv, reg, DMA_CTRL); 1744 bcmgenet_tdma_writel(priv, reg, DMA_CTRL);
1737} 1745}
1738 1746
1747static int bcmgenet_dma_teardown(struct bcmgenet_priv *priv)
1748{
1749 int ret = 0;
1750 int timeout = 0;
1751 u32 reg;
1752
1753 /* Disable TDMA to stop add more frames in TX DMA */
1754 reg = bcmgenet_tdma_readl(priv, DMA_CTRL);
1755 reg &= ~DMA_EN;
1756 bcmgenet_tdma_writel(priv, reg, DMA_CTRL);
1757
1758 /* Check TDMA status register to confirm TDMA is disabled */
1759 while (timeout++ < DMA_TIMEOUT_VAL) {
1760 reg = bcmgenet_tdma_readl(priv, DMA_STATUS);
1761 if (reg & DMA_DISABLED)
1762 break;
1763
1764 udelay(1);
1765 }
1766
1767 if (timeout == DMA_TIMEOUT_VAL) {
1768 netdev_warn(priv->dev, "Timed out while disabling TX DMA\n");
1769 ret = -ETIMEDOUT;
1770 }
1771
1772 /* Wait 10ms for packet drain in both tx and rx dma */
1773 usleep_range(10000, 20000);
1774
1775 /* Disable RDMA */
1776 reg = bcmgenet_rdma_readl(priv, DMA_CTRL);
1777 reg &= ~DMA_EN;
1778 bcmgenet_rdma_writel(priv, reg, DMA_CTRL);
1779
1780 timeout = 0;
1781 /* Check RDMA status register to confirm RDMA is disabled */
1782 while (timeout++ < DMA_TIMEOUT_VAL) {
1783 reg = bcmgenet_rdma_readl(priv, DMA_STATUS);
1784 if (reg & DMA_DISABLED)
1785 break;
1786
1787 udelay(1);
1788 }
1789
1790 if (timeout == DMA_TIMEOUT_VAL) {
1791 netdev_warn(priv->dev, "Timed out while disabling RX DMA\n");
1792 ret = -ETIMEDOUT;
1793 }
1794
1795 return ret;
1796}
1797
1739static void bcmgenet_fini_dma(struct bcmgenet_priv *priv) 1798static void bcmgenet_fini_dma(struct bcmgenet_priv *priv)
1740{ 1799{
1741 int i; 1800 int i;
1742 1801
1743 /* disable DMA */ 1802 /* disable DMA */
1744 bcmgenet_rdma_writel(priv, 0, DMA_CTRL); 1803 bcmgenet_dma_teardown(priv);
1745 bcmgenet_tdma_writel(priv, 0, DMA_CTRL);
1746 1804
1747 for (i = 0; i < priv->num_tx_bds; i++) { 1805 for (i = 0; i < priv->num_tx_bds; i++) {
1748 if (priv->tx_cbs[i].skb != NULL) { 1806 if (priv->tx_cbs[i].skb != NULL) {
@@ -2101,57 +2159,6 @@ err_clk_disable:
2101 return ret; 2159 return ret;
2102} 2160}
2103 2161
2104static int bcmgenet_dma_teardown(struct bcmgenet_priv *priv)
2105{
2106 int ret = 0;
2107 int timeout = 0;
2108 u32 reg;
2109
2110 /* Disable TDMA to stop add more frames in TX DMA */
2111 reg = bcmgenet_tdma_readl(priv, DMA_CTRL);
2112 reg &= ~DMA_EN;
2113 bcmgenet_tdma_writel(priv, reg, DMA_CTRL);
2114
2115 /* Check TDMA status register to confirm TDMA is disabled */
2116 while (timeout++ < DMA_TIMEOUT_VAL) {
2117 reg = bcmgenet_tdma_readl(priv, DMA_STATUS);
2118 if (reg & DMA_DISABLED)
2119 break;
2120
2121 udelay(1);
2122 }
2123
2124 if (timeout == DMA_TIMEOUT_VAL) {
2125 netdev_warn(priv->dev, "Timed out while disabling TX DMA\n");
2126 ret = -ETIMEDOUT;
2127 }
2128
2129 /* Wait 10ms for packet drain in both tx and rx dma */
2130 usleep_range(10000, 20000);
2131
2132 /* Disable RDMA */
2133 reg = bcmgenet_rdma_readl(priv, DMA_CTRL);
2134 reg &= ~DMA_EN;
2135 bcmgenet_rdma_writel(priv, reg, DMA_CTRL);
2136
2137 timeout = 0;
2138 /* Check RDMA status register to confirm RDMA is disabled */
2139 while (timeout++ < DMA_TIMEOUT_VAL) {
2140 reg = bcmgenet_rdma_readl(priv, DMA_STATUS);
2141 if (reg & DMA_DISABLED)
2142 break;
2143
2144 udelay(1);
2145 }
2146
2147 if (timeout == DMA_TIMEOUT_VAL) {
2148 netdev_warn(priv->dev, "Timed out while disabling RX DMA\n");
2149 ret = -ETIMEDOUT;
2150 }
2151
2152 return ret;
2153}
2154
2155static void bcmgenet_netif_stop(struct net_device *dev) 2162static void bcmgenet_netif_stop(struct net_device *dev)
2156{ 2163{
2157 struct bcmgenet_priv *priv = netdev_priv(dev); 2164 struct bcmgenet_priv *priv = netdev_priv(dev);
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index cb77ae93d89a..e7d3a620d96a 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -7914,8 +7914,6 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
7914 7914
7915 entry = tnapi->tx_prod; 7915 entry = tnapi->tx_prod;
7916 base_flags = 0; 7916 base_flags = 0;
7917 if (skb->ip_summed == CHECKSUM_PARTIAL)
7918 base_flags |= TXD_FLAG_TCPUDP_CSUM;
7919 7917
7920 mss = skb_shinfo(skb)->gso_size; 7918 mss = skb_shinfo(skb)->gso_size;
7921 if (mss) { 7919 if (mss) {
@@ -7929,6 +7927,13 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
7929 7927
7930 hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb) - ETH_HLEN; 7928 hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb) - ETH_HLEN;
7931 7929
7930 /* HW/FW can not correctly segment packets that have been
7931 * vlan encapsulated.
7932 */
7933 if (skb->protocol == htons(ETH_P_8021Q) ||
7934 skb->protocol == htons(ETH_P_8021AD))
7935 return tg3_tso_bug(tp, tnapi, txq, skb);
7936
7932 if (!skb_is_gso_v6(skb)) { 7937 if (!skb_is_gso_v6(skb)) {
7933 if (unlikely((ETH_HLEN + hdr_len) > 80) && 7938 if (unlikely((ETH_HLEN + hdr_len) > 80) &&
7934 tg3_flag(tp, TSO_BUG)) 7939 tg3_flag(tp, TSO_BUG))
@@ -7979,6 +7984,17 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
7979 base_flags |= tsflags << 12; 7984 base_flags |= tsflags << 12;
7980 } 7985 }
7981 } 7986 }
7987 } else if (skb->ip_summed == CHECKSUM_PARTIAL) {
7988 /* HW/FW can not correctly checksum packets that have been
7989 * vlan encapsulated.
7990 */
7991 if (skb->protocol == htons(ETH_P_8021Q) ||
7992 skb->protocol == htons(ETH_P_8021AD)) {
7993 if (skb_checksum_help(skb))
7994 goto drop;
7995 } else {
7996 base_flags |= TXD_FLAG_TCPUDP_CSUM;
7997 }
7982 } 7998 }
7983 7999
7984 if (tg3_flag(tp, USE_JUMBO_BDFLAG) && 8000 if (tg3_flag(tp, USE_JUMBO_BDFLAG) &&
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index f56b95af3fcf..eeec49540233 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -6478,6 +6478,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
6478 struct port_info *pi; 6478 struct port_info *pi;
6479 bool highdma = false; 6479 bool highdma = false;
6480 struct adapter *adapter = NULL; 6480 struct adapter *adapter = NULL;
6481 void __iomem *regs;
6481 6482
6482 printk_once(KERN_INFO "%s - version %s\n", DRV_DESC, DRV_VERSION); 6483 printk_once(KERN_INFO "%s - version %s\n", DRV_DESC, DRV_VERSION);
6483 6484
@@ -6494,19 +6495,35 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
6494 goto out_release_regions; 6495 goto out_release_regions;
6495 } 6496 }
6496 6497
6498 regs = pci_ioremap_bar(pdev, 0);
6499 if (!regs) {
6500 dev_err(&pdev->dev, "cannot map device registers\n");
6501 err = -ENOMEM;
6502 goto out_disable_device;
6503 }
6504
6505 /* We control everything through one PF */
6506 func = SOURCEPF_GET(readl(regs + PL_WHOAMI));
6507 if (func != ent->driver_data) {
6508 iounmap(regs);
6509 pci_disable_device(pdev);
6510 pci_save_state(pdev); /* to restore SR-IOV later */
6511 goto sriov;
6512 }
6513
6497 if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { 6514 if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {
6498 highdma = true; 6515 highdma = true;
6499 err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); 6516 err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
6500 if (err) { 6517 if (err) {
6501 dev_err(&pdev->dev, "unable to obtain 64-bit DMA for " 6518 dev_err(&pdev->dev, "unable to obtain 64-bit DMA for "
6502 "coherent allocations\n"); 6519 "coherent allocations\n");
6503 goto out_disable_device; 6520 goto out_unmap_bar0;
6504 } 6521 }
6505 } else { 6522 } else {
6506 err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); 6523 err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
6507 if (err) { 6524 if (err) {
6508 dev_err(&pdev->dev, "no usable DMA configuration\n"); 6525 dev_err(&pdev->dev, "no usable DMA configuration\n");
6509 goto out_disable_device; 6526 goto out_unmap_bar0;
6510 } 6527 }
6511 } 6528 }
6512 6529
@@ -6518,7 +6535,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
6518 adapter = kzalloc(sizeof(*adapter), GFP_KERNEL); 6535 adapter = kzalloc(sizeof(*adapter), GFP_KERNEL);
6519 if (!adapter) { 6536 if (!adapter) {
6520 err = -ENOMEM; 6537 err = -ENOMEM;
6521 goto out_disable_device; 6538 goto out_unmap_bar0;
6522 } 6539 }
6523 6540
6524 adapter->workq = create_singlethread_workqueue("cxgb4"); 6541 adapter->workq = create_singlethread_workqueue("cxgb4");
@@ -6530,20 +6547,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
6530 /* PCI device has been enabled */ 6547 /* PCI device has been enabled */
6531 adapter->flags |= DEV_ENABLED; 6548 adapter->flags |= DEV_ENABLED;
6532 6549
6533 adapter->regs = pci_ioremap_bar(pdev, 0); 6550 adapter->regs = regs;
6534 if (!adapter->regs) {
6535 dev_err(&pdev->dev, "cannot map device registers\n");
6536 err = -ENOMEM;
6537 goto out_free_adapter;
6538 }
6539
6540 /* We control everything through one PF */
6541 func = SOURCEPF_GET(readl(adapter->regs + PL_WHOAMI));
6542 if (func != ent->driver_data) {
6543 pci_save_state(pdev); /* to restore SR-IOV later */
6544 goto sriov;
6545 }
6546
6547 adapter->pdev = pdev; 6551 adapter->pdev = pdev;
6548 adapter->pdev_dev = &pdev->dev; 6552 adapter->pdev_dev = &pdev->dev;
6549 adapter->mbox = func; 6553 adapter->mbox = func;
@@ -6560,7 +6564,8 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
6560 6564
6561 err = t4_prep_adapter(adapter); 6565 err = t4_prep_adapter(adapter);
6562 if (err) 6566 if (err)
6563 goto out_unmap_bar0; 6567 goto out_free_adapter;
6568
6564 6569
6565 if (!is_t4(adapter->params.chip)) { 6570 if (!is_t4(adapter->params.chip)) {
6566 s_qpp = QUEUESPERPAGEPF1 * adapter->fn; 6571 s_qpp = QUEUESPERPAGEPF1 * adapter->fn;
@@ -6577,14 +6582,14 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
6577 dev_err(&pdev->dev, 6582 dev_err(&pdev->dev,
6578 "Incorrect number of egress queues per page\n"); 6583 "Incorrect number of egress queues per page\n");
6579 err = -EINVAL; 6584 err = -EINVAL;
6580 goto out_unmap_bar0; 6585 goto out_free_adapter;
6581 } 6586 }
6582 adapter->bar2 = ioremap_wc(pci_resource_start(pdev, 2), 6587 adapter->bar2 = ioremap_wc(pci_resource_start(pdev, 2),
6583 pci_resource_len(pdev, 2)); 6588 pci_resource_len(pdev, 2));
6584 if (!adapter->bar2) { 6589 if (!adapter->bar2) {
6585 dev_err(&pdev->dev, "cannot map device bar2 region\n"); 6590 dev_err(&pdev->dev, "cannot map device bar2 region\n");
6586 err = -ENOMEM; 6591 err = -ENOMEM;
6587 goto out_unmap_bar0; 6592 goto out_free_adapter;
6588 } 6593 }
6589 } 6594 }
6590 6595
@@ -6722,13 +6727,13 @@ sriov:
6722 out_unmap_bar: 6727 out_unmap_bar:
6723 if (!is_t4(adapter->params.chip)) 6728 if (!is_t4(adapter->params.chip))
6724 iounmap(adapter->bar2); 6729 iounmap(adapter->bar2);
6725 out_unmap_bar0:
6726 iounmap(adapter->regs);
6727 out_free_adapter: 6730 out_free_adapter:
6728 if (adapter->workq) 6731 if (adapter->workq)
6729 destroy_workqueue(adapter->workq); 6732 destroy_workqueue(adapter->workq);
6730 6733
6731 kfree(adapter); 6734 kfree(adapter);
6735 out_unmap_bar0:
6736 iounmap(regs);
6732 out_disable_device: 6737 out_disable_device:
6733 pci_disable_pcie_error_reporting(pdev); 6738 pci_disable_pcie_error_reporting(pdev);
6734 pci_disable_device(pdev); 6739 pci_disable_device(pdev);
diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c
index 9b33057a9477..70089c29d307 100644
--- a/drivers/net/ethernet/davicom/dm9000.c
+++ b/drivers/net/ethernet/davicom/dm9000.c
@@ -1399,7 +1399,7 @@ static struct dm9000_plat_data *dm9000_parse_dt(struct device *dev)
1399 const void *mac_addr; 1399 const void *mac_addr;
1400 1400
1401 if (!IS_ENABLED(CONFIG_OF) || !np) 1401 if (!IS_ENABLED(CONFIG_OF) || !np)
1402 return NULL; 1402 return ERR_PTR(-ENXIO);
1403 1403
1404 pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); 1404 pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
1405 if (!pdata) 1405 if (!pdata)
diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c
index 65a4a0f88ea0..02a2e90d581a 100644
--- a/drivers/net/ethernet/mellanox/mlx4/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c
@@ -2389,6 +2389,22 @@ struct mlx4_slaves_pport mlx4_phys_to_slaves_pport_actv(
2389} 2389}
2390EXPORT_SYMBOL_GPL(mlx4_phys_to_slaves_pport_actv); 2390EXPORT_SYMBOL_GPL(mlx4_phys_to_slaves_pport_actv);
2391 2391
2392static int mlx4_slaves_closest_port(struct mlx4_dev *dev, int slave, int port)
2393{
2394 struct mlx4_active_ports actv_ports = mlx4_get_active_ports(dev, slave);
2395 int min_port = find_first_bit(actv_ports.ports, dev->caps.num_ports)
2396 + 1;
2397 int max_port = min_port +
2398 bitmap_weight(actv_ports.ports, dev->caps.num_ports);
2399
2400 if (port < min_port)
2401 port = min_port;
2402 else if (port >= max_port)
2403 port = max_port - 1;
2404
2405 return port;
2406}
2407
2392int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac) 2408int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac)
2393{ 2409{
2394 struct mlx4_priv *priv = mlx4_priv(dev); 2410 struct mlx4_priv *priv = mlx4_priv(dev);
@@ -2402,6 +2418,7 @@ int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac)
2402 if (slave < 0) 2418 if (slave < 0)
2403 return -EINVAL; 2419 return -EINVAL;
2404 2420
2421 port = mlx4_slaves_closest_port(dev, slave, port);
2405 s_info = &priv->mfunc.master.vf_admin[slave].vport[port]; 2422 s_info = &priv->mfunc.master.vf_admin[slave].vport[port];
2406 s_info->mac = mac; 2423 s_info->mac = mac;
2407 mlx4_info(dev, "default mac on vf %d port %d to %llX will take afect only after vf restart\n", 2424 mlx4_info(dev, "default mac on vf %d port %d to %llX will take afect only after vf restart\n",
@@ -2428,6 +2445,7 @@ int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos)
2428 if (slave < 0) 2445 if (slave < 0)
2429 return -EINVAL; 2446 return -EINVAL;
2430 2447
2448 port = mlx4_slaves_closest_port(dev, slave, port);
2431 vf_admin = &priv->mfunc.master.vf_admin[slave].vport[port]; 2449 vf_admin = &priv->mfunc.master.vf_admin[slave].vport[port];
2432 2450
2433 if ((0 == vlan) && (0 == qos)) 2451 if ((0 == vlan) && (0 == qos))
@@ -2455,6 +2473,7 @@ bool mlx4_get_slave_default_vlan(struct mlx4_dev *dev, int port, int slave,
2455 struct mlx4_priv *priv; 2473 struct mlx4_priv *priv;
2456 2474
2457 priv = mlx4_priv(dev); 2475 priv = mlx4_priv(dev);
2476 port = mlx4_slaves_closest_port(dev, slave, port);
2458 vp_oper = &priv->mfunc.master.vf_oper[slave].vport[port]; 2477 vp_oper = &priv->mfunc.master.vf_oper[slave].vport[port];
2459 2478
2460 if (MLX4_VGT != vp_oper->state.default_vlan) { 2479 if (MLX4_VGT != vp_oper->state.default_vlan) {
@@ -2482,6 +2501,7 @@ int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting)
2482 if (slave < 0) 2501 if (slave < 0)
2483 return -EINVAL; 2502 return -EINVAL;
2484 2503
2504 port = mlx4_slaves_closest_port(dev, slave, port);
2485 s_info = &priv->mfunc.master.vf_admin[slave].vport[port]; 2505 s_info = &priv->mfunc.master.vf_admin[slave].vport[port];
2486 s_info->spoofchk = setting; 2506 s_info->spoofchk = setting;
2487 2507
@@ -2535,6 +2555,7 @@ int mlx4_set_vf_link_state(struct mlx4_dev *dev, int port, int vf, int link_stat
2535 if (slave < 0) 2555 if (slave < 0)
2536 return -EINVAL; 2556 return -EINVAL;
2537 2557
2558 port = mlx4_slaves_closest_port(dev, slave, port);
2538 switch (link_state) { 2559 switch (link_state) {
2539 case IFLA_VF_LINK_STATE_AUTO: 2560 case IFLA_VF_LINK_STATE_AUTO:
2540 /* get current link state */ 2561 /* get current link state */
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
index e22f24f784fc..35ff2925110a 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
@@ -487,6 +487,9 @@ static int mlx4_en_set_pauseparam(struct net_device *dev,
487 struct mlx4_en_dev *mdev = priv->mdev; 487 struct mlx4_en_dev *mdev = priv->mdev;
488 int err; 488 int err;
489 489
490 if (pause->autoneg)
491 return -EINVAL;
492
490 priv->prof->tx_pause = pause->tx_pause != 0; 493 priv->prof->tx_pause = pause->tx_pause != 0;
491 priv->prof->rx_pause = pause->rx_pause != 0; 494 priv->prof->rx_pause = pause->rx_pause != 0;
492 err = mlx4_SET_PORT_general(mdev->dev, priv->port, 495 err = mlx4_SET_PORT_general(mdev->dev, priv->port,
diff --git a/drivers/net/ethernet/mellanox/mlx4/qp.c b/drivers/net/ethernet/mellanox/mlx4/qp.c
index 0dc31d85fc3b..2301365c79c7 100644
--- a/drivers/net/ethernet/mellanox/mlx4/qp.c
+++ b/drivers/net/ethernet/mellanox/mlx4/qp.c
@@ -390,13 +390,14 @@ err_icm:
390EXPORT_SYMBOL_GPL(mlx4_qp_alloc); 390EXPORT_SYMBOL_GPL(mlx4_qp_alloc);
391 391
392#define MLX4_UPDATE_QP_SUPPORTED_ATTRS MLX4_UPDATE_QP_SMAC 392#define MLX4_UPDATE_QP_SUPPORTED_ATTRS MLX4_UPDATE_QP_SMAC
393int mlx4_update_qp(struct mlx4_dev *dev, struct mlx4_qp *qp, 393int mlx4_update_qp(struct mlx4_dev *dev, u32 qpn,
394 enum mlx4_update_qp_attr attr, 394 enum mlx4_update_qp_attr attr,
395 struct mlx4_update_qp_params *params) 395 struct mlx4_update_qp_params *params)
396{ 396{
397 struct mlx4_cmd_mailbox *mailbox; 397 struct mlx4_cmd_mailbox *mailbox;
398 struct mlx4_update_qp_context *cmd; 398 struct mlx4_update_qp_context *cmd;
399 u64 pri_addr_path_mask = 0; 399 u64 pri_addr_path_mask = 0;
400 u64 qp_mask = 0;
400 int err = 0; 401 int err = 0;
401 402
402 mailbox = mlx4_alloc_cmd_mailbox(dev); 403 mailbox = mlx4_alloc_cmd_mailbox(dev);
@@ -413,9 +414,16 @@ int mlx4_update_qp(struct mlx4_dev *dev, struct mlx4_qp *qp,
413 cmd->qp_context.pri_path.grh_mylmc = params->smac_index; 414 cmd->qp_context.pri_path.grh_mylmc = params->smac_index;
414 } 415 }
415 416
417 if (attr & MLX4_UPDATE_QP_VSD) {
418 qp_mask |= 1ULL << MLX4_UPD_QP_MASK_VSD;
419 if (params->flags & MLX4_UPDATE_QP_PARAMS_FLAGS_VSD_ENABLE)
420 cmd->qp_context.param3 |= cpu_to_be32(MLX4_STRIP_VLAN);
421 }
422
416 cmd->primary_addr_path_mask = cpu_to_be64(pri_addr_path_mask); 423 cmd->primary_addr_path_mask = cpu_to_be64(pri_addr_path_mask);
424 cmd->qp_mask = cpu_to_be64(qp_mask);
417 425
418 err = mlx4_cmd(dev, mailbox->dma, qp->qpn & 0xffffff, 0, 426 err = mlx4_cmd(dev, mailbox->dma, qpn & 0xffffff, 0,
419 MLX4_CMD_UPDATE_QP, MLX4_CMD_TIME_CLASS_A, 427 MLX4_CMD_UPDATE_QP, MLX4_CMD_TIME_CLASS_A,
420 MLX4_CMD_NATIVE); 428 MLX4_CMD_NATIVE);
421 429
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
index 1089367fed22..5d2498dcf536 100644
--- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
+++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
@@ -702,11 +702,13 @@ static int update_vport_qp_param(struct mlx4_dev *dev,
702 struct mlx4_qp_context *qpc = inbox->buf + 8; 702 struct mlx4_qp_context *qpc = inbox->buf + 8;
703 struct mlx4_vport_oper_state *vp_oper; 703 struct mlx4_vport_oper_state *vp_oper;
704 struct mlx4_priv *priv; 704 struct mlx4_priv *priv;
705 u32 qp_type;
705 int port; 706 int port;
706 707
707 port = (qpc->pri_path.sched_queue & 0x40) ? 2 : 1; 708 port = (qpc->pri_path.sched_queue & 0x40) ? 2 : 1;
708 priv = mlx4_priv(dev); 709 priv = mlx4_priv(dev);
709 vp_oper = &priv->mfunc.master.vf_oper[slave].vport[port]; 710 vp_oper = &priv->mfunc.master.vf_oper[slave].vport[port];
711 qp_type = (be32_to_cpu(qpc->flags) >> 16) & 0xff;
710 712
711 if (MLX4_VGT != vp_oper->state.default_vlan) { 713 if (MLX4_VGT != vp_oper->state.default_vlan) {
712 /* the reserved QPs (special, proxy, tunnel) 714 /* the reserved QPs (special, proxy, tunnel)
@@ -715,8 +717,20 @@ static int update_vport_qp_param(struct mlx4_dev *dev,
715 if (mlx4_is_qp_reserved(dev, qpn)) 717 if (mlx4_is_qp_reserved(dev, qpn))
716 return 0; 718 return 0;
717 719
718 /* force strip vlan by clear vsd */ 720 /* force strip vlan by clear vsd, MLX QP refers to Raw Ethernet */
719 qpc->param3 &= ~cpu_to_be32(MLX4_STRIP_VLAN); 721 if (qp_type == MLX4_QP_ST_UD ||
722 (qp_type == MLX4_QP_ST_MLX && mlx4_is_eth(dev, port))) {
723 if (dev->caps.bmme_flags & MLX4_BMME_FLAG_VSD_INIT2RTR) {
724 *(__be32 *)inbox->buf =
725 cpu_to_be32(be32_to_cpu(*(__be32 *)inbox->buf) |
726 MLX4_QP_OPTPAR_VLAN_STRIPPING);
727 qpc->param3 &= ~cpu_to_be32(MLX4_STRIP_VLAN);
728 } else {
729 struct mlx4_update_qp_params params = {.flags = 0};
730
731 mlx4_update_qp(dev, qpn, MLX4_UPDATE_QP_VSD, &params);
732 }
733 }
720 734
721 if (vp_oper->state.link_state == IFLA_VF_LINK_STATE_DISABLE && 735 if (vp_oper->state.link_state == IFLA_VF_LINK_STATE_DISABLE &&
722 dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_UPDATE_QP) { 736 dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_UPDATE_QP) {
@@ -3998,13 +4012,17 @@ int mlx4_UPDATE_QP_wrapper(struct mlx4_dev *dev, int slave,
3998 } 4012 }
3999 4013
4000 port = (rqp->sched_queue >> 6 & 1) + 1; 4014 port = (rqp->sched_queue >> 6 & 1) + 1;
4001 smac_index = cmd->qp_context.pri_path.grh_mylmc; 4015
4002 err = mac_find_smac_ix_in_slave(dev, slave, port, 4016 if (pri_addr_path_mask & (1ULL << MLX4_UPD_QP_PATH_MASK_MAC_INDEX)) {
4003 smac_index, &mac); 4017 smac_index = cmd->qp_context.pri_path.grh_mylmc;
4004 if (err) { 4018 err = mac_find_smac_ix_in_slave(dev, slave, port,
4005 mlx4_err(dev, "Failed to update qpn 0x%x, MAC is invalid. smac_ix: %d\n", 4019 smac_index, &mac);
4006 qpn, smac_index); 4020
4007 goto err_mac; 4021 if (err) {
4022 mlx4_err(dev, "Failed to update qpn 0x%x, MAC is invalid. smac_ix: %d\n",
4023 qpn, smac_index);
4024 goto err_mac;
4025 }
4008 } 4026 }
4009 4027
4010 err = mlx4_cmd(dev, inbox->dma, 4028 err = mlx4_cmd(dev, inbox->dma,
@@ -4818,7 +4836,7 @@ void mlx4_vf_immed_vlan_work_handler(struct work_struct *_work)
4818 MLX4_VLAN_CTRL_ETH_RX_BLOCK_UNTAGGED; 4836 MLX4_VLAN_CTRL_ETH_RX_BLOCK_UNTAGGED;
4819 4837
4820 upd_context = mailbox->buf; 4838 upd_context = mailbox->buf;
4821 upd_context->qp_mask = cpu_to_be64(MLX4_UPD_QP_MASK_VSD); 4839 upd_context->qp_mask = cpu_to_be64(1ULL << MLX4_UPD_QP_MASK_VSD);
4822 4840
4823 spin_lock_irq(mlx4_tlock(dev)); 4841 spin_lock_irq(mlx4_tlock(dev));
4824 list_for_each_entry_safe(qp, tmp, qp_list, com.list) { 4842 list_for_each_entry_safe(qp, tmp, qp_list, com.list) {
diff --git a/drivers/net/ethernet/octeon/octeon_mgmt.c b/drivers/net/ethernet/octeon/octeon_mgmt.c
index 979c6980639f..a42293092ea4 100644
--- a/drivers/net/ethernet/octeon/octeon_mgmt.c
+++ b/drivers/net/ethernet/octeon/octeon_mgmt.c
@@ -290,9 +290,11 @@ static void octeon_mgmt_clean_tx_buffers(struct octeon_mgmt *p)
290 /* Read the hardware TX timestamp if one was recorded */ 290 /* Read the hardware TX timestamp if one was recorded */
291 if (unlikely(re.s.tstamp)) { 291 if (unlikely(re.s.tstamp)) {
292 struct skb_shared_hwtstamps ts; 292 struct skb_shared_hwtstamps ts;
293 u64 ns;
294
293 memset(&ts, 0, sizeof(ts)); 295 memset(&ts, 0, sizeof(ts));
294 /* Read the timestamp */ 296 /* Read the timestamp */
295 u64 ns = cvmx_read_csr(CVMX_MIXX_TSTAMP(p->port)); 297 ns = cvmx_read_csr(CVMX_MIXX_TSTAMP(p->port));
296 /* Remove the timestamp from the FIFO */ 298 /* Remove the timestamp from the FIFO */
297 cvmx_write_csr(CVMX_MIXX_TSCTL(p->port), 0); 299 cvmx_write_csr(CVMX_MIXX_TSCTL(p->port), 0);
298 /* Tell the kernel about the timestamp */ 300 /* Tell the kernel about the timestamp */
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig b/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig
index 44c8be1c6805..5f7a35212796 100644
--- a/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig
+++ b/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig
@@ -7,6 +7,7 @@ config PCH_GBE
7 depends on PCI && (X86_32 || COMPILE_TEST) 7 depends on PCI && (X86_32 || COMPILE_TEST)
8 select MII 8 select MII
9 select PTP_1588_CLOCK_PCH 9 select PTP_1588_CLOCK_PCH
10 select NET_PTP_CLASSIFY
10 ---help--- 11 ---help---
11 This is a gigabit ethernet driver for EG20T PCH. 12 This is a gigabit ethernet driver for EG20T PCH.
12 EG20T PCH is the platform controller hub that is used in Intel's 13 EG20T PCH is the platform controller hub that is used in Intel's
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 02dd92ac1764..1d81238fcb93 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -1847,33 +1847,31 @@ static void __rtl8169_set_features(struct net_device *dev,
1847 netdev_features_t features) 1847 netdev_features_t features)
1848{ 1848{
1849 struct rtl8169_private *tp = netdev_priv(dev); 1849 struct rtl8169_private *tp = netdev_priv(dev);
1850 netdev_features_t changed = features ^ dev->features;
1851 void __iomem *ioaddr = tp->mmio_addr; 1850 void __iomem *ioaddr = tp->mmio_addr;
1851 u32 rx_config;
1852 1852
1853 if (!(changed & (NETIF_F_RXALL | NETIF_F_RXCSUM | 1853 rx_config = RTL_R32(RxConfig);
1854 NETIF_F_HW_VLAN_CTAG_RX))) 1854 if (features & NETIF_F_RXALL)
1855 return; 1855 rx_config |= (AcceptErr | AcceptRunt);
1856 else
1857 rx_config &= ~(AcceptErr | AcceptRunt);
1856 1858
1857 if (changed & (NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_RX)) { 1859 RTL_W32(RxConfig, rx_config);
1858 if (features & NETIF_F_RXCSUM)
1859 tp->cp_cmd |= RxChkSum;
1860 else
1861 tp->cp_cmd &= ~RxChkSum;
1862 1860
1863 if (dev->features & NETIF_F_HW_VLAN_CTAG_RX) 1861 if (features & NETIF_F_RXCSUM)
1864 tp->cp_cmd |= RxVlan; 1862 tp->cp_cmd |= RxChkSum;
1865 else 1863 else
1866 tp->cp_cmd &= ~RxVlan; 1864 tp->cp_cmd &= ~RxChkSum;
1867 1865
1868 RTL_W16(CPlusCmd, tp->cp_cmd); 1866 if (features & NETIF_F_HW_VLAN_CTAG_RX)
1869 RTL_R16(CPlusCmd); 1867 tp->cp_cmd |= RxVlan;
1870 } 1868 else
1871 if (changed & NETIF_F_RXALL) { 1869 tp->cp_cmd &= ~RxVlan;
1872 int tmp = (RTL_R32(RxConfig) & ~(AcceptErr | AcceptRunt)); 1870
1873 if (features & NETIF_F_RXALL) 1871 tp->cp_cmd |= RTL_R16(CPlusCmd) & ~(RxVlan | RxChkSum);
1874 tmp |= (AcceptErr | AcceptRunt); 1872
1875 RTL_W32(RxConfig, tmp); 1873 RTL_W16(CPlusCmd, tp->cp_cmd);
1876 } 1874 RTL_R16(CPlusCmd);
1877} 1875}
1878 1876
1879static int rtl8169_set_features(struct net_device *dev, 1877static int rtl8169_set_features(struct net_device *dev,
@@ -1881,8 +1879,11 @@ static int rtl8169_set_features(struct net_device *dev,
1881{ 1879{
1882 struct rtl8169_private *tp = netdev_priv(dev); 1880 struct rtl8169_private *tp = netdev_priv(dev);
1883 1881
1882 features &= NETIF_F_RXALL | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_RX;
1883
1884 rtl_lock_work(tp); 1884 rtl_lock_work(tp);
1885 __rtl8169_set_features(dev, features); 1885 if (features ^ dev->features)
1886 __rtl8169_set_features(dev, features);
1886 rtl_unlock_work(tp); 1887 rtl_unlock_work(tp);
1887 1888
1888 return 0; 1889 return 0;
@@ -7531,8 +7532,7 @@ static void rtl_hw_initialize(struct rtl8169_private *tp)
7531 } 7532 }
7532} 7533}
7533 7534
7534static int 7535static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
7535rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
7536{ 7536{
7537 const struct rtl_cfg_info *cfg = rtl_cfg_infos + ent->driver_data; 7537 const struct rtl_cfg_info *cfg = rtl_cfg_infos + ent->driver_data;
7538 const unsigned int region = cfg->region; 7538 const unsigned int region = cfg->region;
@@ -7607,7 +7607,7 @@ rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
7607 goto err_out_mwi_2; 7607 goto err_out_mwi_2;
7608 } 7608 }
7609 7609
7610 tp->cp_cmd = RxChkSum; 7610 tp->cp_cmd = 0;
7611 7611
7612 if ((sizeof(dma_addr_t) > 4) && 7612 if ((sizeof(dma_addr_t) > 4) &&
7613 !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) && use_dac) { 7613 !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) && use_dac) {
@@ -7648,13 +7648,6 @@ rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
7648 7648
7649 pci_set_master(pdev); 7649 pci_set_master(pdev);
7650 7650
7651 /*
7652 * Pretend we are using VLANs; This bypasses a nasty bug where
7653 * Interrupts stop flowing on high load on 8110SCd controllers.
7654 */
7655 if (tp->mac_version == RTL_GIGA_MAC_VER_05)
7656 tp->cp_cmd |= RxVlan;
7657
7658 rtl_init_mdio_ops(tp); 7651 rtl_init_mdio_ops(tp);
7659 rtl_init_pll_power_ops(tp); 7652 rtl_init_pll_power_ops(tp);
7660 rtl_init_jumbo_ops(tp); 7653 rtl_init_jumbo_ops(tp);
@@ -7738,8 +7731,14 @@ rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
7738 dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | 7731 dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO |
7739 NETIF_F_HIGHDMA; 7732 NETIF_F_HIGHDMA;
7740 7733
7734 tp->cp_cmd |= RxChkSum | RxVlan;
7735
7736 /*
7737 * Pretend we are using VLANs; This bypasses a nasty bug where
7738 * Interrupts stop flowing on high load on 8110SCd controllers.
7739 */
7741 if (tp->mac_version == RTL_GIGA_MAC_VER_05) 7740 if (tp->mac_version == RTL_GIGA_MAC_VER_05)
7742 /* 8110SCd requires hardware Rx VLAN - disallow toggling */ 7741 /* Disallow toggling */
7743 dev->hw_features &= ~NETIF_F_HW_VLAN_CTAG_RX; 7742 dev->hw_features &= ~NETIF_F_HW_VLAN_CTAG_RX;
7744 7743
7745 if (tp->txd_version == RTL_TD_0) 7744 if (tp->txd_version == RTL_TD_0)
diff --git a/drivers/net/ethernet/sfc/farch.c b/drivers/net/ethernet/sfc/farch.c
index 0537381cd2f6..6859437b59fb 100644
--- a/drivers/net/ethernet/sfc/farch.c
+++ b/drivers/net/ethernet/sfc/farch.c
@@ -2933,6 +2933,9 @@ void efx_farch_filter_sync_rx_mode(struct efx_nic *efx)
2933 u32 crc; 2933 u32 crc;
2934 int bit; 2934 int bit;
2935 2935
2936 if (!efx_dev_registered(efx))
2937 return;
2938
2936 netif_addr_lock_bh(net_dev); 2939 netif_addr_lock_bh(net_dev);
2937 2940
2938 efx->unicast_filter = !(net_dev->flags & IFF_PROMISC); 2941 efx->unicast_filter = !(net_dev->flags & IFF_PROMISC);
diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c
index 763cdfc228be..edb860947da4 100644
--- a/drivers/net/ethernet/sun/sunvnet.c
+++ b/drivers/net/ethernet/sun/sunvnet.c
@@ -360,14 +360,17 @@ static int vnet_walk_rx_one(struct vnet_port *port,
360 if (IS_ERR(desc)) 360 if (IS_ERR(desc))
361 return PTR_ERR(desc); 361 return PTR_ERR(desc);
362 362
363 if (desc->hdr.state != VIO_DESC_READY)
364 return 1;
365
366 rmb();
367
363 viodbg(DATA, "vio_walk_rx_one desc[%02x:%02x:%08x:%08x:%llx:%llx]\n", 368 viodbg(DATA, "vio_walk_rx_one desc[%02x:%02x:%08x:%08x:%llx:%llx]\n",
364 desc->hdr.state, desc->hdr.ack, 369 desc->hdr.state, desc->hdr.ack,
365 desc->size, desc->ncookies, 370 desc->size, desc->ncookies,
366 desc->cookies[0].cookie_addr, 371 desc->cookies[0].cookie_addr,
367 desc->cookies[0].cookie_size); 372 desc->cookies[0].cookie_size);
368 373
369 if (desc->hdr.state != VIO_DESC_READY)
370 return 1;
371 err = vnet_rx_one(port, desc->size, desc->cookies, desc->ncookies); 374 err = vnet_rx_one(port, desc->size, desc->cookies, desc->ncookies);
372 if (err == -ECONNRESET) 375 if (err == -ECONNRESET)
373 return err; 376 return err;
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 5c3f1f3ad16f..45ba50e4eaec 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -701,6 +701,28 @@ static void cpsw_rx_handler(void *token, int len, int status)
701 cpsw_dual_emac_src_port_detect(status, priv, ndev, skb); 701 cpsw_dual_emac_src_port_detect(status, priv, ndev, skb);
702 702
703 if (unlikely(status < 0) || unlikely(!netif_running(ndev))) { 703 if (unlikely(status < 0) || unlikely(!netif_running(ndev))) {
704 bool ndev_status = false;
705 struct cpsw_slave *slave = priv->slaves;
706 int n;
707
708 if (priv->data.dual_emac) {
709 /* In dual emac mode check for all interfaces */
710 for (n = priv->data.slaves; n; n--, slave++)
711 if (netif_running(slave->ndev))
712 ndev_status = true;
713 }
714
715 if (ndev_status && (status >= 0)) {
716 /* The packet received is for the interface which
717 * is already down and the other interface is up
718 * and running, intead of freeing which results
719 * in reducing of the number of rx descriptor in
720 * DMA engine, requeue skb back to cpdma.
721 */
722 new_skb = skb;
723 goto requeue;
724 }
725
704 /* the interface is going down, skbs are purged */ 726 /* the interface is going down, skbs are purged */
705 dev_kfree_skb_any(skb); 727 dev_kfree_skb_any(skb);
706 return; 728 return;
@@ -719,6 +741,7 @@ static void cpsw_rx_handler(void *token, int len, int status)
719 new_skb = skb; 741 new_skb = skb;
720 } 742 }
721 743
744requeue:
722 ret = cpdma_chan_submit(priv->rxch, new_skb, new_skb->data, 745 ret = cpdma_chan_submit(priv->rxch, new_skb, new_skb->data,
723 skb_tailroom(new_skb), 0); 746 skb_tailroom(new_skb), 0);
724 if (WARN_ON(ret < 0)) 747 if (WARN_ON(ret < 0))
@@ -2354,10 +2377,19 @@ static int cpsw_suspend(struct device *dev)
2354 struct net_device *ndev = platform_get_drvdata(pdev); 2377 struct net_device *ndev = platform_get_drvdata(pdev);
2355 struct cpsw_priv *priv = netdev_priv(ndev); 2378 struct cpsw_priv *priv = netdev_priv(ndev);
2356 2379
2357 if (netif_running(ndev)) 2380 if (priv->data.dual_emac) {
2358 cpsw_ndo_stop(ndev); 2381 int i;
2359 2382
2360 for_each_slave(priv, soft_reset_slave); 2383 for (i = 0; i < priv->data.slaves; i++) {
2384 if (netif_running(priv->slaves[i].ndev))
2385 cpsw_ndo_stop(priv->slaves[i].ndev);
2386 soft_reset_slave(priv->slaves + i);
2387 }
2388 } else {
2389 if (netif_running(ndev))
2390 cpsw_ndo_stop(ndev);
2391 for_each_slave(priv, soft_reset_slave);
2392 }
2361 2393
2362 pm_runtime_put_sync(&pdev->dev); 2394 pm_runtime_put_sync(&pdev->dev);
2363 2395
@@ -2371,14 +2403,24 @@ static int cpsw_resume(struct device *dev)
2371{ 2403{
2372 struct platform_device *pdev = to_platform_device(dev); 2404 struct platform_device *pdev = to_platform_device(dev);
2373 struct net_device *ndev = platform_get_drvdata(pdev); 2405 struct net_device *ndev = platform_get_drvdata(pdev);
2406 struct cpsw_priv *priv = netdev_priv(ndev);
2374 2407
2375 pm_runtime_get_sync(&pdev->dev); 2408 pm_runtime_get_sync(&pdev->dev);
2376 2409
2377 /* Select default pin state */ 2410 /* Select default pin state */
2378 pinctrl_pm_select_default_state(&pdev->dev); 2411 pinctrl_pm_select_default_state(&pdev->dev);
2379 2412
2380 if (netif_running(ndev)) 2413 if (priv->data.dual_emac) {
2381 cpsw_ndo_open(ndev); 2414 int i;
2415
2416 for (i = 0; i < priv->data.slaves; i++) {
2417 if (netif_running(priv->slaves[i].ndev))
2418 cpsw_ndo_open(priv->slaves[i].ndev);
2419 }
2420 } else {
2421 if (netif_running(ndev))
2422 cpsw_ndo_open(ndev);
2423 }
2382 return 0; 2424 return 0;
2383} 2425}
2384 2426
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index a96955597755..726edabff26b 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -36,6 +36,7 @@
36#include <linux/netpoll.h> 36#include <linux/netpoll.h>
37 37
38#define MACVLAN_HASH_SIZE (1 << BITS_PER_BYTE) 38#define MACVLAN_HASH_SIZE (1 << BITS_PER_BYTE)
39#define MACVLAN_BC_QUEUE_LEN 1000
39 40
40struct macvlan_port { 41struct macvlan_port {
41 struct net_device *dev; 42 struct net_device *dev;
@@ -248,7 +249,7 @@ static void macvlan_broadcast_enqueue(struct macvlan_port *port,
248 goto err; 249 goto err;
249 250
250 spin_lock(&port->bc_queue.lock); 251 spin_lock(&port->bc_queue.lock);
251 if (skb_queue_len(&port->bc_queue) < skb->dev->tx_queue_len) { 252 if (skb_queue_len(&port->bc_queue) < MACVLAN_BC_QUEUE_LEN) {
252 __skb_queue_tail(&port->bc_queue, nskb); 253 __skb_queue_tail(&port->bc_queue, nskb);
253 err = 0; 254 err = 0;
254 } 255 }
@@ -806,6 +807,7 @@ static netdev_features_t macvlan_fix_features(struct net_device *dev,
806 features, 807 features,
807 mask); 808 mask);
808 features |= ALWAYS_ON_FEATURES; 809 features |= ALWAYS_ON_FEATURES;
810 features &= ~NETIF_F_NETNS_LOCAL;
809 811
810 return features; 812 return features;
811} 813}
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index fd0ea7c50ee6..011dbda2b2f1 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -592,8 +592,7 @@ static struct phy_driver ksphy_driver[] = {
592 .phy_id = PHY_ID_KSZ9031, 592 .phy_id = PHY_ID_KSZ9031,
593 .phy_id_mask = 0x00fffff0, 593 .phy_id_mask = 0x00fffff0,
594 .name = "Micrel KSZ9031 Gigabit PHY", 594 .name = "Micrel KSZ9031 Gigabit PHY",
595 .features = (PHY_GBIT_FEATURES | SUPPORTED_Pause 595 .features = (PHY_GBIT_FEATURES | SUPPORTED_Pause),
596 | SUPPORTED_Asym_Pause),
597 .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, 596 .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
598 .config_init = ksz9031_config_init, 597 .config_init = ksz9031_config_init,
599 .config_aneg = genphy_config_aneg, 598 .config_aneg = genphy_config_aneg,
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 94032199800d..3d5c39a1e46f 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -2050,7 +2050,7 @@ static int rtl8153_enable(struct r8152 *tp)
2050 return rtl_enable(tp); 2050 return rtl_enable(tp);
2051} 2051}
2052 2052
2053static void rtl8152_disable(struct r8152 *tp) 2053static void rtl_disable(struct r8152 *tp)
2054{ 2054{
2055 u32 ocp_data; 2055 u32 ocp_data;
2056 int i; 2056 int i;
@@ -2291,6 +2291,13 @@ static inline void r8152b_enable_aldps(struct r8152 *tp)
2291 LINKENA | DIS_SDSAVE); 2291 LINKENA | DIS_SDSAVE);
2292} 2292}
2293 2293
2294static void rtl8152_disable(struct r8152 *tp)
2295{
2296 r8152b_disable_aldps(tp);
2297 rtl_disable(tp);
2298 r8152b_enable_aldps(tp);
2299}
2300
2294static void r8152b_hw_phy_cfg(struct r8152 *tp) 2301static void r8152b_hw_phy_cfg(struct r8152 *tp)
2295{ 2302{
2296 u16 data; 2303 u16 data;
@@ -2301,11 +2308,8 @@ static void r8152b_hw_phy_cfg(struct r8152 *tp)
2301 r8152_mdio_write(tp, MII_BMCR, data); 2308 r8152_mdio_write(tp, MII_BMCR, data);
2302 } 2309 }
2303 2310
2304 r8152b_disable_aldps(tp);
2305
2306 rtl_clear_bp(tp); 2311 rtl_clear_bp(tp);
2307 2312
2308 r8152b_enable_aldps(tp);
2309 set_bit(PHY_RESET, &tp->flags); 2313 set_bit(PHY_RESET, &tp->flags);
2310} 2314}
2311 2315
@@ -2314,9 +2318,6 @@ static void r8152b_exit_oob(struct r8152 *tp)
2314 u32 ocp_data; 2318 u32 ocp_data;
2315 int i; 2319 int i;
2316 2320
2317 if (test_bit(RTL8152_UNPLUG, &tp->flags))
2318 return;
2319
2320 ocp_data = ocp_read_dword(tp, MCU_TYPE_PLA, PLA_RCR); 2321 ocp_data = ocp_read_dword(tp, MCU_TYPE_PLA, PLA_RCR);
2321 ocp_data &= ~RCR_ACPT_ALL; 2322 ocp_data &= ~RCR_ACPT_ALL;
2322 ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, ocp_data); 2323 ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, ocp_data);
@@ -2404,7 +2405,7 @@ static void r8152b_enter_oob(struct r8152 *tp)
2404 ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RXFIFO_CTRL1, RXFIFO_THR2_OOB); 2405 ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RXFIFO_CTRL1, RXFIFO_THR2_OOB);
2405 ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RXFIFO_CTRL2, RXFIFO_THR3_OOB); 2406 ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RXFIFO_CTRL2, RXFIFO_THR3_OOB);
2406 2407
2407 rtl8152_disable(tp); 2408 rtl_disable(tp);
2408 2409
2409 for (i = 0; i < 1000; i++) { 2410 for (i = 0; i < 1000; i++) {
2410 ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); 2411 ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL);
@@ -2540,9 +2541,6 @@ static void r8153_first_init(struct r8152 *tp)
2540 u32 ocp_data; 2541 u32 ocp_data;
2541 int i; 2542 int i;
2542 2543
2543 if (test_bit(RTL8152_UNPLUG, &tp->flags))
2544 return;
2545
2546 rxdy_gated_en(tp, true); 2544 rxdy_gated_en(tp, true);
2547 r8153_teredo_off(tp); 2545 r8153_teredo_off(tp);
2548 2546
@@ -2613,7 +2611,7 @@ static void r8153_enter_oob(struct r8152 *tp)
2613 ocp_data &= ~NOW_IS_OOB; 2611 ocp_data &= ~NOW_IS_OOB;
2614 ocp_write_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL, ocp_data); 2612 ocp_write_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL, ocp_data);
2615 2613
2616 rtl8152_disable(tp); 2614 rtl_disable(tp);
2617 2615
2618 for (i = 0; i < 1000; i++) { 2616 for (i = 0; i < 1000; i++) {
2619 ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); 2617 ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL);
@@ -2675,6 +2673,13 @@ static void r8153_enable_aldps(struct r8152 *tp)
2675 ocp_reg_write(tp, OCP_POWER_CFG, data); 2673 ocp_reg_write(tp, OCP_POWER_CFG, data);
2676} 2674}
2677 2675
2676static void rtl8153_disable(struct r8152 *tp)
2677{
2678 r8153_disable_aldps(tp);
2679 rtl_disable(tp);
2680 r8153_enable_aldps(tp);
2681}
2682
2678static int rtl8152_set_speed(struct r8152 *tp, u8 autoneg, u16 speed, u8 duplex) 2683static int rtl8152_set_speed(struct r8152 *tp, u8 autoneg, u16 speed, u8 duplex)
2679{ 2684{
2680 u16 bmcr, anar, gbcr; 2685 u16 bmcr, anar, gbcr;
@@ -2765,6 +2770,16 @@ out:
2765 return ret; 2770 return ret;
2766} 2771}
2767 2772
2773static void rtl8152_up(struct r8152 *tp)
2774{
2775 if (test_bit(RTL8152_UNPLUG, &tp->flags))
2776 return;
2777
2778 r8152b_disable_aldps(tp);
2779 r8152b_exit_oob(tp);
2780 r8152b_enable_aldps(tp);
2781}
2782
2768static void rtl8152_down(struct r8152 *tp) 2783static void rtl8152_down(struct r8152 *tp)
2769{ 2784{
2770 if (test_bit(RTL8152_UNPLUG, &tp->flags)) { 2785 if (test_bit(RTL8152_UNPLUG, &tp->flags)) {
@@ -2778,6 +2793,16 @@ static void rtl8152_down(struct r8152 *tp)
2778 r8152b_enable_aldps(tp); 2793 r8152b_enable_aldps(tp);
2779} 2794}
2780 2795
2796static void rtl8153_up(struct r8152 *tp)
2797{
2798 if (test_bit(RTL8152_UNPLUG, &tp->flags))
2799 return;
2800
2801 r8153_disable_aldps(tp);
2802 r8153_first_init(tp);
2803 r8153_enable_aldps(tp);
2804}
2805
2781static void rtl8153_down(struct r8152 *tp) 2806static void rtl8153_down(struct r8152 *tp)
2782{ 2807{
2783 if (test_bit(RTL8152_UNPLUG, &tp->flags)) { 2808 if (test_bit(RTL8152_UNPLUG, &tp->flags)) {
@@ -2996,6 +3021,8 @@ static void r8152b_init(struct r8152 *tp)
2996 if (test_bit(RTL8152_UNPLUG, &tp->flags)) 3021 if (test_bit(RTL8152_UNPLUG, &tp->flags))
2997 return; 3022 return;
2998 3023
3024 r8152b_disable_aldps(tp);
3025
2999 if (tp->version == RTL_VER_01) { 3026 if (tp->version == RTL_VER_01) {
3000 ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_LED_FEATURE); 3027 ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_LED_FEATURE);
3001 ocp_data &= ~LED_MODE_MASK; 3028 ocp_data &= ~LED_MODE_MASK;
@@ -3034,6 +3061,7 @@ static void r8153_init(struct r8152 *tp)
3034 if (test_bit(RTL8152_UNPLUG, &tp->flags)) 3061 if (test_bit(RTL8152_UNPLUG, &tp->flags))
3035 return; 3062 return;
3036 3063
3064 r8153_disable_aldps(tp);
3037 r8153_u1u2en(tp, false); 3065 r8153_u1u2en(tp, false);
3038 3066
3039 for (i = 0; i < 500; i++) { 3067 for (i = 0; i < 500; i++) {
@@ -3444,7 +3472,7 @@ static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id)
3444 ops->init = r8152b_init; 3472 ops->init = r8152b_init;
3445 ops->enable = rtl8152_enable; 3473 ops->enable = rtl8152_enable;
3446 ops->disable = rtl8152_disable; 3474 ops->disable = rtl8152_disable;
3447 ops->up = r8152b_exit_oob; 3475 ops->up = rtl8152_up;
3448 ops->down = rtl8152_down; 3476 ops->down = rtl8152_down;
3449 ops->unload = rtl8152_unload; 3477 ops->unload = rtl8152_unload;
3450 ret = 0; 3478 ret = 0;
@@ -3452,8 +3480,8 @@ static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id)
3452 case PRODUCT_ID_RTL8153: 3480 case PRODUCT_ID_RTL8153:
3453 ops->init = r8153_init; 3481 ops->init = r8153_init;
3454 ops->enable = rtl8153_enable; 3482 ops->enable = rtl8153_enable;
3455 ops->disable = rtl8152_disable; 3483 ops->disable = rtl8153_disable;
3456 ops->up = r8153_first_init; 3484 ops->up = rtl8153_up;
3457 ops->down = rtl8153_down; 3485 ops->down = rtl8153_down;
3458 ops->unload = rtl8153_unload; 3486 ops->unload = rtl8153_unload;
3459 ret = 0; 3487 ret = 0;
@@ -3468,8 +3496,8 @@ static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id)
3468 case PRODUCT_ID_SAMSUNG: 3496 case PRODUCT_ID_SAMSUNG:
3469 ops->init = r8153_init; 3497 ops->init = r8153_init;
3470 ops->enable = rtl8153_enable; 3498 ops->enable = rtl8153_enable;
3471 ops->disable = rtl8152_disable; 3499 ops->disable = rtl8153_disable;
3472 ops->up = r8153_first_init; 3500 ops->up = rtl8153_up;
3473 ops->down = rtl8153_down; 3501 ops->down = rtl8153_down;
3474 ops->unload = rtl8153_unload; 3502 ops->unload = rtl8153_unload;
3475 ret = 0; 3503 ret = 0;
diff --git a/drivers/net/wireless/ath/ath9k/common-beacon.c b/drivers/net/wireless/ath/ath9k/common-beacon.c
index 733be5178481..6ad44470d0f2 100644
--- a/drivers/net/wireless/ath/ath9k/common-beacon.c
+++ b/drivers/net/wireless/ath/ath9k/common-beacon.c
@@ -57,7 +57,7 @@ int ath9k_cmn_beacon_config_sta(struct ath_hw *ah,
57 struct ath9k_beacon_state *bs) 57 struct ath9k_beacon_state *bs)
58{ 58{
59 struct ath_common *common = ath9k_hw_common(ah); 59 struct ath_common *common = ath9k_hw_common(ah);
60 int dtim_intval, sleepduration; 60 int dtim_intval;
61 u64 tsf; 61 u64 tsf;
62 62
63 /* No need to configure beacon if we are not associated */ 63 /* No need to configure beacon if we are not associated */
@@ -75,7 +75,6 @@ int ath9k_cmn_beacon_config_sta(struct ath_hw *ah,
75 * last beacon we received (which may be none). 75 * last beacon we received (which may be none).
76 */ 76 */
77 dtim_intval = conf->intval * conf->dtim_period; 77 dtim_intval = conf->intval * conf->dtim_period;
78 sleepduration = ah->hw->conf.listen_interval * conf->intval;
79 78
80 /* 79 /*
81 * Pull nexttbtt forward to reflect the current 80 * Pull nexttbtt forward to reflect the current
@@ -113,7 +112,7 @@ int ath9k_cmn_beacon_config_sta(struct ath_hw *ah,
113 */ 112 */
114 113
115 bs->bs_sleepduration = TU_TO_USEC(roundup(IEEE80211_MS_TO_TU(100), 114 bs->bs_sleepduration = TU_TO_USEC(roundup(IEEE80211_MS_TO_TU(100),
116 sleepduration)); 115 conf->intval));
117 if (bs->bs_sleepduration > bs->bs_dtimperiod) 116 if (bs->bs_sleepduration > bs->bs_dtimperiod)
118 bs->bs_sleepduration = bs->bs_dtimperiod; 117 bs->bs_sleepduration = bs->bs_dtimperiod;
119 118
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
index bb86eb2ffc95..f0484b1b617e 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
@@ -978,7 +978,7 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv,
978 struct ath_hw *ah = common->ah; 978 struct ath_hw *ah = common->ah;
979 struct ath_htc_rx_status *rxstatus; 979 struct ath_htc_rx_status *rxstatus;
980 struct ath_rx_status rx_stats; 980 struct ath_rx_status rx_stats;
981 bool decrypt_error; 981 bool decrypt_error = false;
982 982
983 if (skb->len < HTC_RX_FRAME_HEADER_SIZE) { 983 if (skb->len < HTC_RX_FRAME_HEADER_SIZE) {
984 ath_err(common, "Corrupted RX frame, dropping (len: %d)\n", 984 ath_err(common, "Corrupted RX frame, dropping (len: %d)\n",
diff --git a/drivers/net/wireless/brcm80211/Kconfig b/drivers/net/wireless/brcm80211/Kconfig
index b8e2561ea645..fe3dc126b149 100644
--- a/drivers/net/wireless/brcm80211/Kconfig
+++ b/drivers/net/wireless/brcm80211/Kconfig
@@ -27,10 +27,17 @@ config BRCMFMAC
27 one of the bus interface support. If you choose to build a module, 27 one of the bus interface support. If you choose to build a module,
28 it'll be called brcmfmac.ko. 28 it'll be called brcmfmac.ko.
29 29
30config BRCMFMAC_PROTO_BCDC
31 bool
32
33config BRCMFMAC_PROTO_MSGBUF
34 bool
35
30config BRCMFMAC_SDIO 36config BRCMFMAC_SDIO
31 bool "SDIO bus interface support for FullMAC driver" 37 bool "SDIO bus interface support for FullMAC driver"
32 depends on (MMC = y || MMC = BRCMFMAC) 38 depends on (MMC = y || MMC = BRCMFMAC)
33 depends on BRCMFMAC 39 depends on BRCMFMAC
40 select BRCMFMAC_PROTO_BCDC
34 select FW_LOADER 41 select FW_LOADER
35 default y 42 default y
36 ---help--- 43 ---help---
@@ -42,6 +49,7 @@ config BRCMFMAC_USB
42 bool "USB bus interface support for FullMAC driver" 49 bool "USB bus interface support for FullMAC driver"
43 depends on (USB = y || USB = BRCMFMAC) 50 depends on (USB = y || USB = BRCMFMAC)
44 depends on BRCMFMAC 51 depends on BRCMFMAC
52 select BRCMFMAC_PROTO_BCDC
45 select FW_LOADER 53 select FW_LOADER
46 ---help--- 54 ---help---
47 This option enables the USB bus interface support for Broadcom 55 This option enables the USB bus interface support for Broadcom
@@ -52,6 +60,8 @@ config BRCMFMAC_PCIE
52 bool "PCIE bus interface support for FullMAC driver" 60 bool "PCIE bus interface support for FullMAC driver"
53 depends on BRCMFMAC 61 depends on BRCMFMAC
54 depends on PCI 62 depends on PCI
63 depends on HAS_DMA
64 select BRCMFMAC_PROTO_MSGBUF
55 select FW_LOADER 65 select FW_LOADER
56 ---help--- 66 ---help---
57 This option enables the PCIE bus interface support for Broadcom 67 This option enables the PCIE bus interface support for Broadcom
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/Makefile b/drivers/net/wireless/brcm80211/brcmfmac/Makefile
index c35adf4bc70b..90a977fe9a64 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/Makefile
+++ b/drivers/net/wireless/brcm80211/brcmfmac/Makefile
@@ -30,16 +30,18 @@ brcmfmac-objs += \
30 fwsignal.o \ 30 fwsignal.o \
31 p2p.o \ 31 p2p.o \
32 proto.o \ 32 proto.o \
33 bcdc.o \
34 commonring.o \
35 flowring.o \
36 msgbuf.o \
37 dhd_common.o \ 33 dhd_common.o \
38 dhd_linux.o \ 34 dhd_linux.o \
39 firmware.o \ 35 firmware.o \
40 feature.o \ 36 feature.o \
41 btcoex.o \ 37 btcoex.o \
42 vendor.o 38 vendor.o
39brcmfmac-$(CONFIG_BRCMFMAC_PROTO_BCDC) += \
40 bcdc.o
41brcmfmac-$(CONFIG_BRCMFMAC_PROTO_MSGBUF) += \
42 commonring.o \
43 flowring.o \
44 msgbuf.o
43brcmfmac-$(CONFIG_BRCMFMAC_SDIO) += \ 45brcmfmac-$(CONFIG_BRCMFMAC_SDIO) += \
44 dhd_sdio.o \ 46 dhd_sdio.o \
45 bcmsdh.o 47 bcmsdh.o
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.h b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.h
index 17e8c039ff32..6003179c0ceb 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.h
@@ -16,9 +16,12 @@
16#ifndef BRCMFMAC_BCDC_H 16#ifndef BRCMFMAC_BCDC_H
17#define BRCMFMAC_BCDC_H 17#define BRCMFMAC_BCDC_H
18 18
19 19#ifdef CONFIG_BRCMFMAC_PROTO_BCDC
20int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr); 20int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr);
21void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr); 21void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr);
22 22#else
23static inline int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr) { return 0; }
24static inline void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr) {}
25#endif
23 26
24#endif /* BRCMFMAC_BCDC_H */ 27#endif /* BRCMFMAC_BCDC_H */
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
index 4f1daabc551b..44fc85f68f7a 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
@@ -185,7 +185,13 @@ static void brcmf_fweh_handle_if_event(struct brcmf_pub *drvr,
185 ifevent->action, ifevent->ifidx, ifevent->bssidx, 185 ifevent->action, ifevent->ifidx, ifevent->bssidx,
186 ifevent->flags, ifevent->role); 186 ifevent->flags, ifevent->role);
187 187
188 if (ifevent->flags & BRCMF_E_IF_FLAG_NOIF) { 188 /* The P2P Device interface event must not be ignored
189 * contrary to what firmware tells us. The only way to
190 * distinguish the P2P Device is by looking at the ifidx
191 * and bssidx received.
192 */
193 if (!(ifevent->ifidx == 0 && ifevent->bssidx == 1) &&
194 (ifevent->flags & BRCMF_E_IF_FLAG_NOIF)) {
189 brcmf_dbg(EVENT, "event can be ignored\n"); 195 brcmf_dbg(EVENT, "event can be ignored\n");
190 return; 196 return;
191 } 197 }
@@ -210,12 +216,12 @@ static void brcmf_fweh_handle_if_event(struct brcmf_pub *drvr,
210 return; 216 return;
211 } 217 }
212 218
213 if (ifevent->action == BRCMF_E_IF_CHANGE) 219 if (ifp && ifevent->action == BRCMF_E_IF_CHANGE)
214 brcmf_fws_reset_interface(ifp); 220 brcmf_fws_reset_interface(ifp);
215 221
216 err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data); 222 err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data);
217 223
218 if (ifevent->action == BRCMF_E_IF_DEL) { 224 if (ifp && ifevent->action == BRCMF_E_IF_DEL) {
219 brcmf_fws_del_interface(ifp); 225 brcmf_fws_del_interface(ifp);
220 brcmf_del_if(drvr, ifevent->bssidx); 226 brcmf_del_if(drvr, ifevent->bssidx);
221 } 227 }
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fweh.h b/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
index dd20b1862d44..cbf033f59109 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
@@ -172,6 +172,8 @@ enum brcmf_fweh_event_code {
172#define BRCMF_E_IF_ROLE_STA 0 172#define BRCMF_E_IF_ROLE_STA 0
173#define BRCMF_E_IF_ROLE_AP 1 173#define BRCMF_E_IF_ROLE_AP 1
174#define BRCMF_E_IF_ROLE_WDS 2 174#define BRCMF_E_IF_ROLE_WDS 2
175#define BRCMF_E_IF_ROLE_P2P_GO 3
176#define BRCMF_E_IF_ROLE_P2P_CLIENT 4
175 177
176/** 178/**
177 * definitions for event packet validation. 179 * definitions for event packet validation.
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h
index f901ae52bf2b..77a51b8c1e12 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h
@@ -15,6 +15,7 @@
15#ifndef BRCMFMAC_MSGBUF_H 15#ifndef BRCMFMAC_MSGBUF_H
16#define BRCMFMAC_MSGBUF_H 16#define BRCMFMAC_MSGBUF_H
17 17
18#ifdef CONFIG_BRCMFMAC_PROTO_MSGBUF
18 19
19#define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_MAX_ITEM 20 20#define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_MAX_ITEM 20
20#define BRCMF_H2D_MSGRING_RXPOST_SUBMIT_MAX_ITEM 256 21#define BRCMF_H2D_MSGRING_RXPOST_SUBMIT_MAX_ITEM 256
@@ -32,9 +33,15 @@
32 33
33 34
34int brcmf_proto_msgbuf_rx_trigger(struct device *dev); 35int brcmf_proto_msgbuf_rx_trigger(struct device *dev);
36void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u8 flowid);
35int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr); 37int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr);
36void brcmf_proto_msgbuf_detach(struct brcmf_pub *drvr); 38void brcmf_proto_msgbuf_detach(struct brcmf_pub *drvr);
37void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u8 flowid); 39#else
38 40static inline int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr)
41{
42 return 0;
43}
44static inline void brcmf_proto_msgbuf_detach(struct brcmf_pub *drvr) {}
45#endif
39 46
40#endif /* BRCMFMAC_MSGBUF_H */ 47#endif /* BRCMFMAC_MSGBUF_H */
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
index 12a60ca1462a..54fc1a1cb4f7 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
@@ -497,8 +497,11 @@ brcmf_configure_arp_offload(struct brcmf_if *ifp, bool enable)
497static void 497static void
498brcmf_cfg80211_update_proto_addr_mode(struct wireless_dev *wdev) 498brcmf_cfg80211_update_proto_addr_mode(struct wireless_dev *wdev)
499{ 499{
500 struct net_device *ndev = wdev->netdev; 500 struct brcmf_cfg80211_vif *vif;
501 struct brcmf_if *ifp = netdev_priv(ndev); 501 struct brcmf_if *ifp;
502
503 vif = container_of(wdev, struct brcmf_cfg80211_vif, wdev);
504 ifp = vif->ifp;
502 505
503 if ((wdev->iftype == NL80211_IFTYPE_ADHOC) || 506 if ((wdev->iftype == NL80211_IFTYPE_ADHOC) ||
504 (wdev->iftype == NL80211_IFTYPE_AP) || 507 (wdev->iftype == NL80211_IFTYPE_AP) ||
@@ -5149,6 +5152,7 @@ static int brcmf_enable_bw40_2g(struct brcmf_cfg80211_info *cfg)
5149 5152
5150 ch.band = BRCMU_CHAN_BAND_2G; 5153 ch.band = BRCMU_CHAN_BAND_2G;
5151 ch.bw = BRCMU_CHAN_BW_40; 5154 ch.bw = BRCMU_CHAN_BW_40;
5155 ch.sb = BRCMU_CHAN_SB_NONE;
5152 ch.chnum = 0; 5156 ch.chnum = 0;
5153 cfg->d11inf.encchspec(&ch); 5157 cfg->d11inf.encchspec(&ch);
5154 5158
@@ -5182,6 +5186,7 @@ static int brcmf_enable_bw40_2g(struct brcmf_cfg80211_info *cfg)
5182 5186
5183 brcmf_update_bw40_channel_flag(&band->channels[j], &ch); 5187 brcmf_update_bw40_channel_flag(&band->channels[j], &ch);
5184 } 5188 }
5189 kfree(pbuf);
5185 } 5190 }
5186 return err; 5191 return err;
5187} 5192}
diff --git a/drivers/net/wireless/iwlwifi/dvm/power.c b/drivers/net/wireless/iwlwifi/dvm/power.c
index 760c45c34ef3..1513dbc79c14 100644
--- a/drivers/net/wireless/iwlwifi/dvm/power.c
+++ b/drivers/net/wireless/iwlwifi/dvm/power.c
@@ -40,7 +40,7 @@
40#include "commands.h" 40#include "commands.h"
41#include "power.h" 41#include "power.h"
42 42
43static bool force_cam; 43static bool force_cam = true;
44module_param(force_cam, bool, 0644); 44module_param(force_cam, bool, 0644);
45MODULE_PARM_DESC(force_cam, "force continuously aware mode (no power saving at all)"); 45MODULE_PARM_DESC(force_cam, "force continuously aware mode (no power saving at all)");
46 46
diff --git a/drivers/net/wireless/iwlwifi/iwl-7000.c b/drivers/net/wireless/iwlwifi/iwl-7000.c
index 7e26d0dbfcf7..8e99dffa88e8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-7000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-7000.c
@@ -85,6 +85,8 @@
85#define IWL7260_TX_POWER_VERSION 0xffff /* meaningless */ 85#define IWL7260_TX_POWER_VERSION 0xffff /* meaningless */
86#define IWL3160_NVM_VERSION 0x709 86#define IWL3160_NVM_VERSION 0x709
87#define IWL3160_TX_POWER_VERSION 0xffff /* meaningless */ 87#define IWL3160_TX_POWER_VERSION 0xffff /* meaningless */
88#define IWL3165_NVM_VERSION 0x709
89#define IWL3165_TX_POWER_VERSION 0xffff /* meaningless */
88#define IWL7265_NVM_VERSION 0x0a1d 90#define IWL7265_NVM_VERSION 0x0a1d
89#define IWL7265_TX_POWER_VERSION 0xffff /* meaningless */ 91#define IWL7265_TX_POWER_VERSION 0xffff /* meaningless */
90 92
@@ -94,6 +96,9 @@
94#define IWL3160_FW_PRE "iwlwifi-3160-" 96#define IWL3160_FW_PRE "iwlwifi-3160-"
95#define IWL3160_MODULE_FIRMWARE(api) IWL3160_FW_PRE __stringify(api) ".ucode" 97#define IWL3160_MODULE_FIRMWARE(api) IWL3160_FW_PRE __stringify(api) ".ucode"
96 98
99#define IWL3165_FW_PRE "iwlwifi-3165-"
100#define IWL3165_MODULE_FIRMWARE(api) IWL3165_FW_PRE __stringify(api) ".ucode"
101
97#define IWL7265_FW_PRE "iwlwifi-7265-" 102#define IWL7265_FW_PRE "iwlwifi-7265-"
98#define IWL7265_MODULE_FIRMWARE(api) IWL7265_FW_PRE __stringify(api) ".ucode" 103#define IWL7265_MODULE_FIRMWARE(api) IWL7265_FW_PRE __stringify(api) ".ucode"
99 104
@@ -215,6 +220,16 @@ static const struct iwl_pwr_tx_backoff iwl7265_pwr_tx_backoffs[] = {
215 {0}, 220 {0},
216}; 221};
217 222
223const struct iwl_cfg iwl3165_2ac_cfg = {
224 .name = "Intel(R) Dual Band Wireless AC 3165",
225 .fw_name_pre = IWL3165_FW_PRE,
226 IWL_DEVICE_7000,
227 .ht_params = &iwl7000_ht_params,
228 .nvm_ver = IWL3165_NVM_VERSION,
229 .nvm_calib_ver = IWL3165_TX_POWER_VERSION,
230 .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs,
231};
232
218const struct iwl_cfg iwl7265_2ac_cfg = { 233const struct iwl_cfg iwl7265_2ac_cfg = {
219 .name = "Intel(R) Dual Band Wireless AC 7265", 234 .name = "Intel(R) Dual Band Wireless AC 7265",
220 .fw_name_pre = IWL7265_FW_PRE, 235 .fw_name_pre = IWL7265_FW_PRE,
@@ -247,4 +262,5 @@ const struct iwl_cfg iwl7265_n_cfg = {
247 262
248MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); 263MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_OK));
249MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL3160_UCODE_API_OK)); 264MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL3160_UCODE_API_OK));
265MODULE_FIRMWARE(IWL3165_MODULE_FIRMWARE(IWL3160_UCODE_API_OK));
250MODULE_FIRMWARE(IWL7265_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); 266MODULE_FIRMWARE(IWL7265_MODULE_FIRMWARE(IWL7260_UCODE_API_OK));
diff --git a/drivers/net/wireless/iwlwifi/iwl-config.h b/drivers/net/wireless/iwlwifi/iwl-config.h
index 8da596db9abe..3d7cc37420ae 100644
--- a/drivers/net/wireless/iwlwifi/iwl-config.h
+++ b/drivers/net/wireless/iwlwifi/iwl-config.h
@@ -120,6 +120,8 @@ enum iwl_led_mode {
120#define IWL_LONG_WD_TIMEOUT 10000 120#define IWL_LONG_WD_TIMEOUT 10000
121#define IWL_MAX_WD_TIMEOUT 120000 121#define IWL_MAX_WD_TIMEOUT 120000
122 122
123#define IWL_DEFAULT_MAX_TX_POWER 22
124
123/* Antenna presence definitions */ 125/* Antenna presence definitions */
124#define ANT_NONE 0x0 126#define ANT_NONE 0x0
125#define ANT_A BIT(0) 127#define ANT_A BIT(0)
@@ -335,6 +337,7 @@ extern const struct iwl_cfg iwl7260_n_cfg;
335extern const struct iwl_cfg iwl3160_2ac_cfg; 337extern const struct iwl_cfg iwl3160_2ac_cfg;
336extern const struct iwl_cfg iwl3160_2n_cfg; 338extern const struct iwl_cfg iwl3160_2n_cfg;
337extern const struct iwl_cfg iwl3160_n_cfg; 339extern const struct iwl_cfg iwl3160_n_cfg;
340extern const struct iwl_cfg iwl3165_2ac_cfg;
338extern const struct iwl_cfg iwl7265_2ac_cfg; 341extern const struct iwl_cfg iwl7265_2ac_cfg;
339extern const struct iwl_cfg iwl7265_2n_cfg; 342extern const struct iwl_cfg iwl7265_2n_cfg;
340extern const struct iwl_cfg iwl7265_n_cfg; 343extern const struct iwl_cfg iwl7265_n_cfg;
diff --git a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c
index 8e7af798abd1..40718f814f8d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c
+++ b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c
@@ -148,8 +148,6 @@ static const u8 iwl_nvm_channels_family_8000[] = {
148#define LAST_2GHZ_HT_PLUS 9 148#define LAST_2GHZ_HT_PLUS 9
149#define LAST_5GHZ_HT 161 149#define LAST_5GHZ_HT 161
150 150
151#define DEFAULT_MAX_TX_POWER 16
152
153/* rate data (static) */ 151/* rate data (static) */
154static struct ieee80211_rate iwl_cfg80211_rates[] = { 152static struct ieee80211_rate iwl_cfg80211_rates[] = {
155 { .bitrate = 1 * 10, .hw_value = 0, .hw_value_short = 0, }, 153 { .bitrate = 1 * 10, .hw_value = 0, .hw_value_short = 0, },
@@ -297,7 +295,7 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg,
297 * Default value - highest tx power value. max_power 295 * Default value - highest tx power value. max_power
298 * is not used in mvm, and is used for backwards compatibility 296 * is not used in mvm, and is used for backwards compatibility
299 */ 297 */
300 channel->max_power = DEFAULT_MAX_TX_POWER; 298 channel->max_power = IWL_DEFAULT_MAX_TX_POWER;
301 is_5ghz = channel->band == IEEE80211_BAND_5GHZ; 299 is_5ghz = channel->band == IEEE80211_BAND_5GHZ;
302 IWL_DEBUG_EEPROM(dev, 300 IWL_DEBUG_EEPROM(dev,
303 "Ch. %d [%sGHz] %s%s%s%s%s%s%s(0x%02x %ddBm): Ad-Hoc %ssupported\n", 301 "Ch. %d [%sGHz] %s%s%s%s%s%s%s(0x%02x %ddBm): Ad-Hoc %ssupported\n",
diff --git a/drivers/net/wireless/iwlwifi/mvm/coex.c b/drivers/net/wireless/iwlwifi/mvm/coex.c
index 2262d6dc61ae..6e8f3e2aef74 100644
--- a/drivers/net/wireless/iwlwifi/mvm/coex.c
+++ b/drivers/net/wireless/iwlwifi/mvm/coex.c
@@ -587,8 +587,6 @@ int iwl_send_bt_init_conf(struct iwl_mvm *mvm)
587 lockdep_assert_held(&mvm->mutex); 587 lockdep_assert_held(&mvm->mutex);
588 588
589 if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS)) { 589 if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS)) {
590 u32 mode;
591
592 switch (mvm->bt_force_ant_mode) { 590 switch (mvm->bt_force_ant_mode) {
593 case BT_FORCE_ANT_BT: 591 case BT_FORCE_ANT_BT:
594 mode = BT_COEX_BT; 592 mode = BT_COEX_BT;
@@ -758,7 +756,8 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac,
758 struct iwl_bt_iterator_data *data = _data; 756 struct iwl_bt_iterator_data *data = _data;
759 struct iwl_mvm *mvm = data->mvm; 757 struct iwl_mvm *mvm = data->mvm;
760 struct ieee80211_chanctx_conf *chanctx_conf; 758 struct ieee80211_chanctx_conf *chanctx_conf;
761 enum ieee80211_smps_mode smps_mode; 759 /* default smps_mode is AUTOMATIC - only used for client modes */
760 enum ieee80211_smps_mode smps_mode = IEEE80211_SMPS_AUTOMATIC;
762 u32 bt_activity_grading; 761 u32 bt_activity_grading;
763 int ave_rssi; 762 int ave_rssi;
764 763
@@ -766,8 +765,6 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac,
766 765
767 switch (vif->type) { 766 switch (vif->type) {
768 case NL80211_IFTYPE_STATION: 767 case NL80211_IFTYPE_STATION:
769 /* default smps_mode for BSS / P2P client is AUTOMATIC */
770 smps_mode = IEEE80211_SMPS_AUTOMATIC;
771 break; 768 break;
772 case NL80211_IFTYPE_AP: 769 case NL80211_IFTYPE_AP:
773 if (!mvmvif->ap_ibss_active) 770 if (!mvmvif->ap_ibss_active)
@@ -799,7 +796,7 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac,
799 else if (bt_activity_grading >= BT_LOW_TRAFFIC) 796 else if (bt_activity_grading >= BT_LOW_TRAFFIC)
800 smps_mode = IEEE80211_SMPS_DYNAMIC; 797 smps_mode = IEEE80211_SMPS_DYNAMIC;
801 798
802 /* relax SMPS contraints for next association */ 799 /* relax SMPS constraints for next association */
803 if (!vif->bss_conf.assoc) 800 if (!vif->bss_conf.assoc)
804 smps_mode = IEEE80211_SMPS_AUTOMATIC; 801 smps_mode = IEEE80211_SMPS_AUTOMATIC;
805 802
diff --git a/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c b/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c
index d919b4ebc83c..9aa2311a776c 100644
--- a/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c
+++ b/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c
@@ -76,8 +76,7 @@ static void iwl_dbgfs_update_pm(struct iwl_mvm *mvm,
76 76
77 switch (param) { 77 switch (param) {
78 case MVM_DEBUGFS_PM_KEEP_ALIVE: { 78 case MVM_DEBUGFS_PM_KEEP_ALIVE: {
79 struct ieee80211_hw *hw = mvm->hw; 79 int dtimper = vif->bss_conf.dtim_period ?: 1;
80 int dtimper = hw->conf.ps_dtim_period ?: 1;
81 int dtimper_msec = dtimper * vif->bss_conf.beacon_int; 80 int dtimper_msec = dtimper * vif->bss_conf.beacon_int;
82 81
83 IWL_DEBUG_POWER(mvm, "debugfs: set keep_alive= %d sec\n", val); 82 IWL_DEBUG_POWER(mvm, "debugfs: set keep_alive= %d sec\n", val);
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api.h b/drivers/net/wireless/iwlwifi/mvm/fw-api.h
index 9c975f9ecfcb..541b844c6b5d 100644
--- a/drivers/net/wireless/iwlwifi/mvm/fw-api.h
+++ b/drivers/net/wireless/iwlwifi/mvm/fw-api.h
@@ -1603,14 +1603,14 @@ enum iwl_sf_scenario {
1603 1603
1604/** 1604/**
1605 * Smart Fifo configuration command. 1605 * Smart Fifo configuration command.
1606 * @state: smart fifo state, types listed in iwl_sf_sate. 1606 * @state: smart fifo state, types listed in enum %iwl_sf_sate.
1607 * @watermark: Minimum allowed availabe free space in RXF for transient state. 1607 * @watermark: Minimum allowed availabe free space in RXF for transient state.
1608 * @long_delay_timeouts: aging and idle timer values for each scenario 1608 * @long_delay_timeouts: aging and idle timer values for each scenario
1609 * in long delay state. 1609 * in long delay state.
1610 * @full_on_timeouts: timer values for each scenario in full on state. 1610 * @full_on_timeouts: timer values for each scenario in full on state.
1611 */ 1611 */
1612struct iwl_sf_cfg_cmd { 1612struct iwl_sf_cfg_cmd {
1613 enum iwl_sf_state state; 1613 __le32 state;
1614 __le32 watermark[SF_TRANSIENT_STATES_NUMBER]; 1614 __le32 watermark[SF_TRANSIENT_STATES_NUMBER];
1615 __le32 long_delay_timeouts[SF_NUM_SCENARIO][SF_NUM_TIMEOUT_TYPES]; 1615 __le32 long_delay_timeouts[SF_NUM_SCENARIO][SF_NUM_TIMEOUT_TYPES];
1616 __le32 full_on_timeouts[SF_NUM_SCENARIO][SF_NUM_TIMEOUT_TYPES]; 1616 __le32 full_on_timeouts[SF_NUM_SCENARIO][SF_NUM_TIMEOUT_TYPES];
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
index 9cbb192f680e..158aed501473 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
@@ -727,11 +727,6 @@ static int iwl_mvm_mac_ctxt_cmd_sta(struct iwl_mvm *mvm,
727 !force_assoc_off) { 727 !force_assoc_off) {
728 u32 dtim_offs; 728 u32 dtim_offs;
729 729
730 /* Allow beacons to pass through as long as we are not
731 * associated, or we do not have dtim period information.
732 */
733 cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_BEACON);
734
735 /* 730 /*
736 * The DTIM count counts down, so when it is N that means N 731 * The DTIM count counts down, so when it is N that means N
737 * more beacon intervals happen until the DTIM TBTT. Therefore 732 * more beacon intervals happen until the DTIM TBTT. Therefore
@@ -765,6 +760,11 @@ static int iwl_mvm_mac_ctxt_cmd_sta(struct iwl_mvm *mvm,
765 ctxt_sta->is_assoc = cpu_to_le32(1); 760 ctxt_sta->is_assoc = cpu_to_le32(1);
766 } else { 761 } else {
767 ctxt_sta->is_assoc = cpu_to_le32(0); 762 ctxt_sta->is_assoc = cpu_to_le32(0);
763
764 /* Allow beacons to pass through as long as we are not
765 * associated, or we do not have dtim period information.
766 */
767 cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_BEACON);
768 } 768 }
769 769
770 ctxt_sta->bi = cpu_to_le32(vif->bss_conf.beacon_int); 770 ctxt_sta->bi = cpu_to_le32(vif->bss_conf.beacon_int);
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
index 8d1d4b40b0a3..069bb8e81c36 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
@@ -398,12 +398,14 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
398 else 398 else
399 hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; 399 hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
400 400
401 /* TODO: enable that only for firmwares that don't crash */ 401 if (IWL_UCODE_API(mvm->fw->ucode_ver) >= 10) {
402 /* hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; */ 402 hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN;
403 hw->wiphy->max_sched_scan_ssids = PROBE_OPTION_MAX; 403 hw->wiphy->max_sched_scan_ssids = PROBE_OPTION_MAX;
404 hw->wiphy->max_match_sets = IWL_SCAN_MAX_PROFILES; 404 hw->wiphy->max_match_sets = IWL_SCAN_MAX_PROFILES;
405 /* we create the 802.11 header and zero length SSID IE. */ 405 /* we create the 802.11 header and zero length SSID IE. */
406 hw->wiphy->max_sched_scan_ie_len = SCAN_OFFLOAD_PROBE_REQ_SIZE - 24 - 2; 406 hw->wiphy->max_sched_scan_ie_len =
407 SCAN_OFFLOAD_PROBE_REQ_SIZE - 24 - 2;
408 }
407 409
408 hw->wiphy->features |= NL80211_FEATURE_P2P_GO_CTWIN | 410 hw->wiphy->features |= NL80211_FEATURE_P2P_GO_CTWIN |
409 NL80211_FEATURE_LOW_PRIORITY_SCAN | 411 NL80211_FEATURE_LOW_PRIORITY_SCAN |
@@ -1544,11 +1546,6 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm,
1544 */ 1546 */
1545 iwl_mvm_remove_time_event(mvm, mvmvif, 1547 iwl_mvm_remove_time_event(mvm, mvmvif,
1546 &mvmvif->time_event_data); 1548 &mvmvif->time_event_data);
1547 } else if (changes & (BSS_CHANGED_PS | BSS_CHANGED_P2P_PS |
1548 BSS_CHANGED_QOS)) {
1549 ret = iwl_mvm_power_update_mac(mvm);
1550 if (ret)
1551 IWL_ERR(mvm, "failed to update power mode\n");
1552 } 1549 }
1553 1550
1554 if (changes & BSS_CHANGED_BEACON_INFO) { 1551 if (changes & BSS_CHANGED_BEACON_INFO) {
@@ -1556,6 +1553,12 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm,
1556 WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif, 0)); 1553 WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif, 0));
1557 } 1554 }
1558 1555
1556 if (changes & (BSS_CHANGED_PS | BSS_CHANGED_P2P_PS | BSS_CHANGED_QOS)) {
1557 ret = iwl_mvm_power_update_mac(mvm);
1558 if (ret)
1559 IWL_ERR(mvm, "failed to update power mode\n");
1560 }
1561
1559 if (changes & BSS_CHANGED_TXPOWER) { 1562 if (changes & BSS_CHANGED_TXPOWER) {
1560 IWL_DEBUG_CALIB(mvm, "Changing TX Power to %d\n", 1563 IWL_DEBUG_CALIB(mvm, "Changing TX Power to %d\n",
1561 bss_conf->txpower); 1564 bss_conf->txpower);
diff --git a/drivers/net/wireless/iwlwifi/mvm/power.c b/drivers/net/wireless/iwlwifi/mvm/power.c
index e7a6626fe839..5a29c193b72a 100644
--- a/drivers/net/wireless/iwlwifi/mvm/power.c
+++ b/drivers/net/wireless/iwlwifi/mvm/power.c
@@ -290,7 +290,6 @@ static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm,
290 struct ieee80211_vif *vif, 290 struct ieee80211_vif *vif,
291 struct iwl_mac_power_cmd *cmd) 291 struct iwl_mac_power_cmd *cmd)
292{ 292{
293 struct ieee80211_hw *hw = mvm->hw;
294 struct ieee80211_chanctx_conf *chanctx_conf; 293 struct ieee80211_chanctx_conf *chanctx_conf;
295 struct ieee80211_channel *chan; 294 struct ieee80211_channel *chan;
296 int dtimper, dtimper_msec; 295 int dtimper, dtimper_msec;
@@ -301,7 +300,7 @@ static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm,
301 300
302 cmd->id_and_color = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, 301 cmd->id_and_color = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id,
303 mvmvif->color)); 302 mvmvif->color));
304 dtimper = hw->conf.ps_dtim_period ?: 1; 303 dtimper = vif->bss_conf.dtim_period;
305 304
306 /* 305 /*
307 * Regardless of power management state the driver must set 306 * Regardless of power management state the driver must set
@@ -963,7 +962,7 @@ int iwl_mvm_update_d0i3_power_mode(struct iwl_mvm *mvm,
963 iwl_mvm_power_build_cmd(mvm, vif, &cmd); 962 iwl_mvm_power_build_cmd(mvm, vif, &cmd);
964 if (enable) { 963 if (enable) {
965 /* configure skip over dtim up to 300 msec */ 964 /* configure skip over dtim up to 300 msec */
966 int dtimper = mvm->hw->conf.ps_dtim_period ?: 1; 965 int dtimper = vif->bss_conf.dtim_period ?: 1;
967 int dtimper_msec = dtimper * vif->bss_conf.beacon_int; 966 int dtimper_msec = dtimper * vif->bss_conf.beacon_int;
968 967
969 if (WARN_ON(!dtimper_msec)) 968 if (WARN_ON(!dtimper_msec))
diff --git a/drivers/net/wireless/iwlwifi/mvm/rx.c b/drivers/net/wireless/iwlwifi/mvm/rx.c
index 48144e3ad527..a6cb84ed653f 100644
--- a/drivers/net/wireless/iwlwifi/mvm/rx.c
+++ b/drivers/net/wireless/iwlwifi/mvm/rx.c
@@ -151,13 +151,13 @@ static void iwl_mvm_get_signal_strength(struct iwl_mvm *mvm,
151 le32_to_cpu(phy_info->non_cfg_phy[IWL_RX_INFO_ENERGY_ANT_ABC_IDX]); 151 le32_to_cpu(phy_info->non_cfg_phy[IWL_RX_INFO_ENERGY_ANT_ABC_IDX]);
152 energy_a = (val & IWL_RX_INFO_ENERGY_ANT_A_MSK) >> 152 energy_a = (val & IWL_RX_INFO_ENERGY_ANT_A_MSK) >>
153 IWL_RX_INFO_ENERGY_ANT_A_POS; 153 IWL_RX_INFO_ENERGY_ANT_A_POS;
154 energy_a = energy_a ? -energy_a : -256; 154 energy_a = energy_a ? -energy_a : S8_MIN;
155 energy_b = (val & IWL_RX_INFO_ENERGY_ANT_B_MSK) >> 155 energy_b = (val & IWL_RX_INFO_ENERGY_ANT_B_MSK) >>
156 IWL_RX_INFO_ENERGY_ANT_B_POS; 156 IWL_RX_INFO_ENERGY_ANT_B_POS;
157 energy_b = energy_b ? -energy_b : -256; 157 energy_b = energy_b ? -energy_b : S8_MIN;
158 energy_c = (val & IWL_RX_INFO_ENERGY_ANT_C_MSK) >> 158 energy_c = (val & IWL_RX_INFO_ENERGY_ANT_C_MSK) >>
159 IWL_RX_INFO_ENERGY_ANT_C_POS; 159 IWL_RX_INFO_ENERGY_ANT_C_POS;
160 energy_c = energy_c ? -energy_c : -256; 160 energy_c = energy_c ? -energy_c : S8_MIN;
161 max_energy = max(energy_a, energy_b); 161 max_energy = max(energy_a, energy_b);
162 max_energy = max(max_energy, energy_c); 162 max_energy = max(max_energy, energy_c);
163 163
diff --git a/drivers/net/wireless/iwlwifi/mvm/sf.c b/drivers/net/wireless/iwlwifi/mvm/sf.c
index d1922afe06f4..f88410c7cbfb 100644
--- a/drivers/net/wireless/iwlwifi/mvm/sf.c
+++ b/drivers/net/wireless/iwlwifi/mvm/sf.c
@@ -174,7 +174,7 @@ static int iwl_mvm_sf_config(struct iwl_mvm *mvm, u8 sta_id,
174 enum iwl_sf_state new_state) 174 enum iwl_sf_state new_state)
175{ 175{
176 struct iwl_sf_cfg_cmd sf_cmd = { 176 struct iwl_sf_cfg_cmd sf_cmd = {
177 .state = new_state, 177 .state = cpu_to_le32(new_state),
178 }; 178 };
179 struct ieee80211_sta *sta; 179 struct ieee80211_sta *sta;
180 int ret = 0; 180 int ret = 0;
diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c b/drivers/net/wireless/iwlwifi/mvm/tx.c
index 963edb8656ad..ed0919465e0e 100644
--- a/drivers/net/wireless/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/iwlwifi/mvm/tx.c
@@ -170,10 +170,14 @@ static void iwl_mvm_set_tx_cmd_rate(struct iwl_mvm *mvm,
170 170
171 /* 171 /*
172 * for data packets, rate info comes from the table inside the fw. This 172 * for data packets, rate info comes from the table inside the fw. This
173 * table is controlled by LINK_QUALITY commands 173 * table is controlled by LINK_QUALITY commands. Exclude ctrl port
174 * frames like EAPOLs which should be treated as mgmt frames. This
175 * avoids them being sent initially in high rates which increases the
176 * chances for completion of the 4-Way handshake.
174 */ 177 */
175 178
176 if (ieee80211_is_data(fc) && sta) { 179 if (ieee80211_is_data(fc) && sta &&
180 !(info->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO)) {
177 tx_cmd->initial_rate_index = 0; 181 tx_cmd->initial_rate_index = 0;
178 tx_cmd->tx_flags |= cpu_to_le32(TX_CMD_FLG_STA_RATE); 182 tx_cmd->tx_flags |= cpu_to_le32(TX_CMD_FLG_STA_RATE);
179 return; 183 return;
diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c
index dbbbf23082a2..b9d5049e52da 100644
--- a/drivers/net/wireless/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/iwlwifi/pcie/drv.c
@@ -354,11 +354,17 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
354 {IWL_PCI_DEVICE(0x08B3, 0x8060, iwl3160_2n_cfg)}, 354 {IWL_PCI_DEVICE(0x08B3, 0x8060, iwl3160_2n_cfg)},
355 {IWL_PCI_DEVICE(0x08B3, 0x8062, iwl3160_n_cfg)}, 355 {IWL_PCI_DEVICE(0x08B3, 0x8062, iwl3160_n_cfg)},
356 {IWL_PCI_DEVICE(0x08B4, 0x8270, iwl3160_2ac_cfg)}, 356 {IWL_PCI_DEVICE(0x08B4, 0x8270, iwl3160_2ac_cfg)},
357 {IWL_PCI_DEVICE(0x08B4, 0x8370, iwl3160_2ac_cfg)},
358 {IWL_PCI_DEVICE(0x08B4, 0x8272, iwl3160_2ac_cfg)},
357 {IWL_PCI_DEVICE(0x08B3, 0x8470, iwl3160_2ac_cfg)}, 359 {IWL_PCI_DEVICE(0x08B3, 0x8470, iwl3160_2ac_cfg)},
358 {IWL_PCI_DEVICE(0x08B3, 0x8570, iwl3160_2ac_cfg)}, 360 {IWL_PCI_DEVICE(0x08B3, 0x8570, iwl3160_2ac_cfg)},
359 {IWL_PCI_DEVICE(0x08B3, 0x1070, iwl3160_2ac_cfg)}, 361 {IWL_PCI_DEVICE(0x08B3, 0x1070, iwl3160_2ac_cfg)},
360 {IWL_PCI_DEVICE(0x08B3, 0x1170, iwl3160_2ac_cfg)}, 362 {IWL_PCI_DEVICE(0x08B3, 0x1170, iwl3160_2ac_cfg)},
361 363
364/* 3165 Series */
365 {IWL_PCI_DEVICE(0x3165, 0x4010, iwl3165_2ac_cfg)},
366 {IWL_PCI_DEVICE(0x3165, 0x4210, iwl3165_2ac_cfg)},
367
362/* 7265 Series */ 368/* 7265 Series */
363 {IWL_PCI_DEVICE(0x095A, 0x5010, iwl7265_2ac_cfg)}, 369 {IWL_PCI_DEVICE(0x095A, 0x5010, iwl7265_2ac_cfg)},
364 {IWL_PCI_DEVICE(0x095A, 0x5110, iwl7265_2ac_cfg)}, 370 {IWL_PCI_DEVICE(0x095A, 0x5110, iwl7265_2ac_cfg)},
@@ -380,6 +386,7 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
380 {IWL_PCI_DEVICE(0x095B, 0x5202, iwl7265_n_cfg)}, 386 {IWL_PCI_DEVICE(0x095B, 0x5202, iwl7265_n_cfg)},
381 {IWL_PCI_DEVICE(0x095A, 0x9010, iwl7265_2ac_cfg)}, 387 {IWL_PCI_DEVICE(0x095A, 0x9010, iwl7265_2ac_cfg)},
382 {IWL_PCI_DEVICE(0x095A, 0x9012, iwl7265_2ac_cfg)}, 388 {IWL_PCI_DEVICE(0x095A, 0x9012, iwl7265_2ac_cfg)},
389 {IWL_PCI_DEVICE(0x095A, 0x900A, iwl7265_2ac_cfg)},
383 {IWL_PCI_DEVICE(0x095A, 0x9110, iwl7265_2ac_cfg)}, 390 {IWL_PCI_DEVICE(0x095A, 0x9110, iwl7265_2ac_cfg)},
384 {IWL_PCI_DEVICE(0x095A, 0x9112, iwl7265_2ac_cfg)}, 391 {IWL_PCI_DEVICE(0x095A, 0x9112, iwl7265_2ac_cfg)},
385 {IWL_PCI_DEVICE(0x095A, 0x9210, iwl7265_2ac_cfg)}, 392 {IWL_PCI_DEVICE(0x095A, 0x9210, iwl7265_2ac_cfg)},