aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-05-27 16:41:13 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-05-27 16:41:13 -0400
commit8f98bcdf8f9638ee012ff09c6c8732e0fda6018a (patch)
tree1701863428e97735dc9cafa4740dba179e7820d7
parent7ffb9e116fb0abe12b29c81d56bb8a9f498ee1a9 (diff)
parent9302d7bb0c5cd46be5706859301f18c137b2439f (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Don't use MMIO on certain iwlwifi devices otherwise we get a firmware crash. 2) Don't corrupt the GRO lists of mac80211 contexts by doing sends via timer interrupt, from Johannes Berg. 3) SKB tailroom is miscalculated in AP_VLAN crypto code, from Michal Kazior. 4) Fix fw_status memory leak in iwlwifi, from Haim Dreyfuss. 5) Fix use after free in iwl_mvm_d0i3_enable_tx(), from Eliad Peller. 6) JIT'ing of large BPF programs is broken on x86, from Alexei Starovoitov. 7) EMAC driver ethtool register dump size is miscalculated, from Ivan Mikhaylov. 8) Fix PHY initial link mode when autonegotiation is disabled in amd-xgbe, from Tom Lendacky. 9) Fix NULL deref on SOCK_DEAD socket in AF_UNIX and CAIF protocols, from Mark Salyzyn. 10) credit_bytes not initialized properly in xen-netback, from Ross Lagerwall. 11) Fallback from MSI-X to INTx interrupts not handled properly in mlx4 driver, fix from Benjamin Poirier. 12) Perform ->attach() after binding dev->qdisc in packet scheduler, otherwise we can crash. From Cong WANG. 13) Don't clobber data in sctp_v4_map_v6(). From Jason Gunthorpe. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (30 commits) sctp: Fix mangled IPv4 addresses on a IPv6 listening socket net_sched: invoke ->attach() after setting dev->qdisc xen-netfront: properly destroy queues when removing device mlx4_core: Fix fallback from MSI-X to INTx xen/netback: Properly initialize credit_bytes net: netxen: correct sysfs bin attribute return code tools: bpf_jit_disasm: fix segfault on disabled debugging log output unix/caif: sk_socket can disappear when state is unlocked amd-xgbe-phy: Fix initial mode when autoneg is disabled net: dp83640: fix improper double spin locking. net: dp83640: reinforce locking rules. net: dp83640: fix broken calibration routine. net: stmmac: create one debugfs dir per net-device net/ibm/emac: fix size of emac dump memory areas x86: bpf_jit: fix compilation of large bpf programs net: phy: bcm7xxx: Fix 7425 PHY ID and flags iwlwifi: mvm: avoid use-after-free on iwl_mvm_d0i3_enable_tx() iwlwifi: mvm: clean net-detect info if device was reset during suspend iwlwifi: mvm: take the UCODE_DOWN reference when resuming iwlwifi: mvm: BT Coex - duplicate the command if sent ASYNC ...
-rw-r--r--arch/x86/net/bpf_jit_comp.c7
-rw-r--r--drivers/net/ethernet/ibm/emac/core.c16
-rw-r--r--drivers/net/ethernet/ibm/emac/core.h7
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/cmd.c9
-rw-r--r--drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c6
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac.h6
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c76
-rw-r--r--drivers/net/phy/amd-xgbe-phy.c45
-rw-r--r--drivers/net/phy/bcm7xxx.c2
-rw-r--r--drivers/net/phy/dp83640.c23
-rw-r--r--drivers/net/wireless/iwlwifi/Kconfig1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-7000.c16
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c5
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-eeprom-parse.h3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-nvm-parse.c30
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/coex_legacy.c2
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/d3.c22
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mac80211.c3
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/ops.c6
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/rs.c3
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/trans.c8
-rw-r--r--drivers/net/xen-netback/xenbus.c1
-rw-r--r--drivers/net/xen-netfront.c15
-rw-r--r--drivers/ssb/driver_pcicore.c7
-rw-r--r--include/linux/brcmphy.h2
-rw-r--r--include/net/sctp/sctp.h7
-rw-r--r--net/caif/caif_socket.c8
-rw-r--r--net/mac80211/cfg.c59
-rw-r--r--net/mac80211/ieee80211_i.h9
-rw-r--r--net/mac80211/iface.c6
-rw-r--r--net/mac80211/key.c82
-rw-r--r--net/mac80211/key.h1
-rw-r--r--net/mac80211/rx.c5
-rw-r--r--net/mac80211/util.c3
-rw-r--r--net/sched/sch_api.c10
-rw-r--r--net/unix/af_unix.c8
-rw-r--r--tools/net/bpf_jit_disasm.c2
37 files changed, 351 insertions, 170 deletions
diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c
index 99f76103c6b7..ddeff4844a10 100644
--- a/arch/x86/net/bpf_jit_comp.c
+++ b/arch/x86/net/bpf_jit_comp.c
@@ -966,7 +966,12 @@ void bpf_int_jit_compile(struct bpf_prog *prog)
966 } 966 }
967 ctx.cleanup_addr = proglen; 967 ctx.cleanup_addr = proglen;
968 968
969 for (pass = 0; pass < 10; pass++) { 969 /* JITed image shrinks with every pass and the loop iterates
970 * until the image stops shrinking. Very large bpf programs
971 * may converge on the last pass. In such case do one more
972 * pass to emit the final image
973 */
974 for (pass = 0; pass < 10 || image; pass++) {
970 proglen = do_jit(prog, addrs, image, oldproglen, &ctx); 975 proglen = do_jit(prog, addrs, image, oldproglen, &ctx);
971 if (proglen <= 0) { 976 if (proglen <= 0) {
972 image = NULL; 977 image = NULL;
diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c
index de7919322190..b9df0cbd0a38 100644
--- a/drivers/net/ethernet/ibm/emac/core.c
+++ b/drivers/net/ethernet/ibm/emac/core.c
@@ -2084,12 +2084,8 @@ static void emac_ethtool_get_pauseparam(struct net_device *ndev,
2084 2084
2085static int emac_get_regs_len(struct emac_instance *dev) 2085static int emac_get_regs_len(struct emac_instance *dev)
2086{ 2086{
2087 if (emac_has_feature(dev, EMAC_FTR_EMAC4))
2088 return sizeof(struct emac_ethtool_regs_subhdr) +
2089 EMAC4_ETHTOOL_REGS_SIZE(dev);
2090 else
2091 return sizeof(struct emac_ethtool_regs_subhdr) + 2087 return sizeof(struct emac_ethtool_regs_subhdr) +
2092 EMAC_ETHTOOL_REGS_SIZE(dev); 2088 sizeof(struct emac_regs);
2093} 2089}
2094 2090
2095static int emac_ethtool_get_regs_len(struct net_device *ndev) 2091static int emac_ethtool_get_regs_len(struct net_device *ndev)
@@ -2114,15 +2110,15 @@ static void *emac_dump_regs(struct emac_instance *dev, void *buf)
2114 struct emac_ethtool_regs_subhdr *hdr = buf; 2110 struct emac_ethtool_regs_subhdr *hdr = buf;
2115 2111
2116 hdr->index = dev->cell_index; 2112 hdr->index = dev->cell_index;
2117 if (emac_has_feature(dev, EMAC_FTR_EMAC4)) { 2113 if (emac_has_feature(dev, EMAC_FTR_EMAC4SYNC)) {
2114 hdr->version = EMAC4SYNC_ETHTOOL_REGS_VER;
2115 } else if (emac_has_feature(dev, EMAC_FTR_EMAC4)) {
2118 hdr->version = EMAC4_ETHTOOL_REGS_VER; 2116 hdr->version = EMAC4_ETHTOOL_REGS_VER;
2119 memcpy_fromio(hdr + 1, dev->emacp, EMAC4_ETHTOOL_REGS_SIZE(dev));
2120 return (void *)(hdr + 1) + EMAC4_ETHTOOL_REGS_SIZE(dev);
2121 } else { 2117 } else {
2122 hdr->version = EMAC_ETHTOOL_REGS_VER; 2118 hdr->version = EMAC_ETHTOOL_REGS_VER;
2123 memcpy_fromio(hdr + 1, dev->emacp, EMAC_ETHTOOL_REGS_SIZE(dev));
2124 return (void *)(hdr + 1) + EMAC_ETHTOOL_REGS_SIZE(dev);
2125 } 2119 }
2120 memcpy_fromio(hdr + 1, dev->emacp, sizeof(struct emac_regs));
2121 return (void *)(hdr + 1) + sizeof(struct emac_regs);
2126} 2122}
2127 2123
2128static void emac_ethtool_get_regs(struct net_device *ndev, 2124static void emac_ethtool_get_regs(struct net_device *ndev,
diff --git a/drivers/net/ethernet/ibm/emac/core.h b/drivers/net/ethernet/ibm/emac/core.h
index 67f342a9f65e..28df37420da9 100644
--- a/drivers/net/ethernet/ibm/emac/core.h
+++ b/drivers/net/ethernet/ibm/emac/core.h
@@ -461,10 +461,7 @@ struct emac_ethtool_regs_subhdr {
461}; 461};
462 462
463#define EMAC_ETHTOOL_REGS_VER 0 463#define EMAC_ETHTOOL_REGS_VER 0
464#define EMAC_ETHTOOL_REGS_SIZE(dev) ((dev)->rsrc_regs.end - \ 464#define EMAC4_ETHTOOL_REGS_VER 1
465 (dev)->rsrc_regs.start + 1) 465#define EMAC4SYNC_ETHTOOL_REGS_VER 2
466#define EMAC4_ETHTOOL_REGS_VER 1
467#define EMAC4_ETHTOOL_REGS_SIZE(dev) ((dev)->rsrc_regs.end - \
468 (dev)->rsrc_regs.start + 1)
469 466
470#endif /* __IBM_NEWEMAC_CORE_H */ 467#endif /* __IBM_NEWEMAC_CORE_H */
diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c
index 4f7dc044601e..529ef0594b90 100644
--- a/drivers/net/ethernet/mellanox/mlx4/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c
@@ -714,8 +714,13 @@ static int mlx4_cmd_wait(struct mlx4_dev *dev, u64 in_param, u64 *out_param,
714 msecs_to_jiffies(timeout))) { 714 msecs_to_jiffies(timeout))) {
715 mlx4_warn(dev, "command 0x%x timed out (go bit not cleared)\n", 715 mlx4_warn(dev, "command 0x%x timed out (go bit not cleared)\n",
716 op); 716 op);
717 err = -EIO; 717 if (op == MLX4_CMD_NOP) {
718 goto out_reset; 718 err = -EBUSY;
719 goto out;
720 } else {
721 err = -EIO;
722 goto out_reset;
723 }
719 } 724 }
720 725
721 err = context->result; 726 err = context->result;
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
index e0c31e3947d1..6409a06bbdf6 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
@@ -3025,9 +3025,9 @@ netxen_sysfs_read_dimm(struct file *filp, struct kobject *kobj,
3025 u8 dw, rows, cols, banks, ranks; 3025 u8 dw, rows, cols, banks, ranks;
3026 u32 val; 3026 u32 val;
3027 3027
3028 if (size != sizeof(struct netxen_dimm_cfg)) { 3028 if (size < attr->size) {
3029 netdev_err(netdev, "Invalid size\n"); 3029 netdev_err(netdev, "Invalid size\n");
3030 return -1; 3030 return -EINVAL;
3031 } 3031 }
3032 3032
3033 memset(&dimm, 0, sizeof(struct netxen_dimm_cfg)); 3033 memset(&dimm, 0, sizeof(struct netxen_dimm_cfg));
@@ -3137,7 +3137,7 @@ out:
3137 3137
3138static struct bin_attribute bin_attr_dimm = { 3138static struct bin_attribute bin_attr_dimm = {
3139 .attr = { .name = "dimm", .mode = (S_IRUGO | S_IWUSR) }, 3139 .attr = { .name = "dimm", .mode = (S_IRUGO | S_IWUSR) },
3140 .size = 0, 3140 .size = sizeof(struct netxen_dimm_cfg),
3141 .read = netxen_sysfs_read_dimm, 3141 .read = netxen_sysfs_read_dimm,
3142}; 3142};
3143 3143
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index 2ac9552d1fa3..73bab983edd9 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -117,6 +117,12 @@ struct stmmac_priv {
117 int use_riwt; 117 int use_riwt;
118 int irq_wake; 118 int irq_wake;
119 spinlock_t ptp_lock; 119 spinlock_t ptp_lock;
120
121#ifdef CONFIG_DEBUG_FS
122 struct dentry *dbgfs_dir;
123 struct dentry *dbgfs_rings_status;
124 struct dentry *dbgfs_dma_cap;
125#endif
120}; 126};
121 127
122int stmmac_mdio_unregister(struct net_device *ndev); 128int stmmac_mdio_unregister(struct net_device *ndev);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 05c146f718a3..2c5ce2baca87 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -118,7 +118,7 @@ static irqreturn_t stmmac_interrupt(int irq, void *dev_id);
118 118
119#ifdef CONFIG_DEBUG_FS 119#ifdef CONFIG_DEBUG_FS
120static int stmmac_init_fs(struct net_device *dev); 120static int stmmac_init_fs(struct net_device *dev);
121static void stmmac_exit_fs(void); 121static void stmmac_exit_fs(struct net_device *dev);
122#endif 122#endif
123 123
124#define STMMAC_COAL_TIMER(x) (jiffies + usecs_to_jiffies(x)) 124#define STMMAC_COAL_TIMER(x) (jiffies + usecs_to_jiffies(x))
@@ -1916,7 +1916,7 @@ static int stmmac_release(struct net_device *dev)
1916 netif_carrier_off(dev); 1916 netif_carrier_off(dev);
1917 1917
1918#ifdef CONFIG_DEBUG_FS 1918#ifdef CONFIG_DEBUG_FS
1919 stmmac_exit_fs(); 1919 stmmac_exit_fs(dev);
1920#endif 1920#endif
1921 1921
1922 stmmac_release_ptp(priv); 1922 stmmac_release_ptp(priv);
@@ -2508,8 +2508,6 @@ static int stmmac_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
2508 2508
2509#ifdef CONFIG_DEBUG_FS 2509#ifdef CONFIG_DEBUG_FS
2510static struct dentry *stmmac_fs_dir; 2510static struct dentry *stmmac_fs_dir;
2511static struct dentry *stmmac_rings_status;
2512static struct dentry *stmmac_dma_cap;
2513 2511
2514static void sysfs_display_ring(void *head, int size, int extend_desc, 2512static void sysfs_display_ring(void *head, int size, int extend_desc,
2515 struct seq_file *seq) 2513 struct seq_file *seq)
@@ -2648,36 +2646,39 @@ static const struct file_operations stmmac_dma_cap_fops = {
2648 2646
2649static int stmmac_init_fs(struct net_device *dev) 2647static int stmmac_init_fs(struct net_device *dev)
2650{ 2648{
2651 /* Create debugfs entries */ 2649 struct stmmac_priv *priv = netdev_priv(dev);
2652 stmmac_fs_dir = debugfs_create_dir(STMMAC_RESOURCE_NAME, NULL); 2650
2651 /* Create per netdev entries */
2652 priv->dbgfs_dir = debugfs_create_dir(dev->name, stmmac_fs_dir);
2653 2653
2654 if (!stmmac_fs_dir || IS_ERR(stmmac_fs_dir)) { 2654 if (!priv->dbgfs_dir || IS_ERR(priv->dbgfs_dir)) {
2655 pr_err("ERROR %s, debugfs create directory failed\n", 2655 pr_err("ERROR %s/%s, debugfs create directory failed\n",
2656 STMMAC_RESOURCE_NAME); 2656 STMMAC_RESOURCE_NAME, dev->name);
2657 2657
2658 return -ENOMEM; 2658 return -ENOMEM;
2659 } 2659 }
2660 2660
2661 /* Entry to report DMA RX/TX rings */ 2661 /* Entry to report DMA RX/TX rings */
2662 stmmac_rings_status = debugfs_create_file("descriptors_status", 2662 priv->dbgfs_rings_status =
2663 S_IRUGO, stmmac_fs_dir, dev, 2663 debugfs_create_file("descriptors_status", S_IRUGO,
2664 &stmmac_rings_status_fops); 2664 priv->dbgfs_dir, dev,
2665 &stmmac_rings_status_fops);
2665 2666
2666 if (!stmmac_rings_status || IS_ERR(stmmac_rings_status)) { 2667 if (!priv->dbgfs_rings_status || IS_ERR(priv->dbgfs_rings_status)) {
2667 pr_info("ERROR creating stmmac ring debugfs file\n"); 2668 pr_info("ERROR creating stmmac ring debugfs file\n");
2668 debugfs_remove(stmmac_fs_dir); 2669 debugfs_remove_recursive(priv->dbgfs_dir);
2669 2670
2670 return -ENOMEM; 2671 return -ENOMEM;
2671 } 2672 }
2672 2673
2673 /* Entry to report the DMA HW features */ 2674 /* Entry to report the DMA HW features */
2674 stmmac_dma_cap = debugfs_create_file("dma_cap", S_IRUGO, stmmac_fs_dir, 2675 priv->dbgfs_dma_cap = debugfs_create_file("dma_cap", S_IRUGO,
2675 dev, &stmmac_dma_cap_fops); 2676 priv->dbgfs_dir,
2677 dev, &stmmac_dma_cap_fops);
2676 2678
2677 if (!stmmac_dma_cap || IS_ERR(stmmac_dma_cap)) { 2679 if (!priv->dbgfs_dma_cap || IS_ERR(priv->dbgfs_dma_cap)) {
2678 pr_info("ERROR creating stmmac MMC debugfs file\n"); 2680 pr_info("ERROR creating stmmac MMC debugfs file\n");
2679 debugfs_remove(stmmac_rings_status); 2681 debugfs_remove_recursive(priv->dbgfs_dir);
2680 debugfs_remove(stmmac_fs_dir);
2681 2682
2682 return -ENOMEM; 2683 return -ENOMEM;
2683 } 2684 }
@@ -2685,11 +2686,11 @@ static int stmmac_init_fs(struct net_device *dev)
2685 return 0; 2686 return 0;
2686} 2687}
2687 2688
2688static void stmmac_exit_fs(void) 2689static void stmmac_exit_fs(struct net_device *dev)
2689{ 2690{
2690 debugfs_remove(stmmac_rings_status); 2691 struct stmmac_priv *priv = netdev_priv(dev);
2691 debugfs_remove(stmmac_dma_cap); 2692
2692 debugfs_remove(stmmac_fs_dir); 2693 debugfs_remove_recursive(priv->dbgfs_dir);
2693} 2694}
2694#endif /* CONFIG_DEBUG_FS */ 2695#endif /* CONFIG_DEBUG_FS */
2695 2696
@@ -3149,6 +3150,35 @@ err:
3149__setup("stmmaceth=", stmmac_cmdline_opt); 3150__setup("stmmaceth=", stmmac_cmdline_opt);
3150#endif /* MODULE */ 3151#endif /* MODULE */
3151 3152
3153static int __init stmmac_init(void)
3154{
3155#ifdef CONFIG_DEBUG_FS
3156 /* Create debugfs main directory if it doesn't exist yet */
3157 if (!stmmac_fs_dir) {
3158 stmmac_fs_dir = debugfs_create_dir(STMMAC_RESOURCE_NAME, NULL);
3159
3160 if (!stmmac_fs_dir || IS_ERR(stmmac_fs_dir)) {
3161 pr_err("ERROR %s, debugfs create directory failed\n",
3162 STMMAC_RESOURCE_NAME);
3163
3164 return -ENOMEM;
3165 }
3166 }
3167#endif
3168
3169 return 0;
3170}
3171
3172static void __exit stmmac_exit(void)
3173{
3174#ifdef CONFIG_DEBUG_FS
3175 debugfs_remove_recursive(stmmac_fs_dir);
3176#endif
3177}
3178
3179module_init(stmmac_init)
3180module_exit(stmmac_exit)
3181
3152MODULE_DESCRIPTION("STMMAC 10/100/1000 Ethernet device driver"); 3182MODULE_DESCRIPTION("STMMAC 10/100/1000 Ethernet device driver");
3153MODULE_AUTHOR("Giuseppe Cavallaro <peppe.cavallaro@st.com>"); 3183MODULE_AUTHOR("Giuseppe Cavallaro <peppe.cavallaro@st.com>");
3154MODULE_LICENSE("GPL"); 3184MODULE_LICENSE("GPL");
diff --git a/drivers/net/phy/amd-xgbe-phy.c b/drivers/net/phy/amd-xgbe-phy.c
index fb276f64cd64..34a75cba3b73 100644
--- a/drivers/net/phy/amd-xgbe-phy.c
+++ b/drivers/net/phy/amd-xgbe-phy.c
@@ -755,6 +755,45 @@ static int amd_xgbe_phy_set_mode(struct phy_device *phydev,
755 return ret; 755 return ret;
756} 756}
757 757
758static bool amd_xgbe_phy_use_xgmii_mode(struct phy_device *phydev)
759{
760 if (phydev->autoneg == AUTONEG_ENABLE) {
761 if (phydev->advertising & ADVERTISED_10000baseKR_Full)
762 return true;
763 } else {
764 if (phydev->speed == SPEED_10000)
765 return true;
766 }
767
768 return false;
769}
770
771static bool amd_xgbe_phy_use_gmii_2500_mode(struct phy_device *phydev)
772{
773 if (phydev->autoneg == AUTONEG_ENABLE) {
774 if (phydev->advertising & ADVERTISED_2500baseX_Full)
775 return true;
776 } else {
777 if (phydev->speed == SPEED_2500)
778 return true;
779 }
780
781 return false;
782}
783
784static bool amd_xgbe_phy_use_gmii_mode(struct phy_device *phydev)
785{
786 if (phydev->autoneg == AUTONEG_ENABLE) {
787 if (phydev->advertising & ADVERTISED_1000baseKX_Full)
788 return true;
789 } else {
790 if (phydev->speed == SPEED_1000)
791 return true;
792 }
793
794 return false;
795}
796
758static int amd_xgbe_phy_set_an(struct phy_device *phydev, bool enable, 797static int amd_xgbe_phy_set_an(struct phy_device *phydev, bool enable,
759 bool restart) 798 bool restart)
760{ 799{
@@ -1235,11 +1274,11 @@ static int amd_xgbe_phy_config_init(struct phy_device *phydev)
1235 /* Set initial mode - call the mode setting routines 1274 /* Set initial mode - call the mode setting routines
1236 * directly to insure we are properly configured 1275 * directly to insure we are properly configured
1237 */ 1276 */
1238 if (phydev->advertising & SUPPORTED_10000baseKR_Full) 1277 if (amd_xgbe_phy_use_xgmii_mode(phydev))
1239 ret = amd_xgbe_phy_xgmii_mode(phydev); 1278 ret = amd_xgbe_phy_xgmii_mode(phydev);
1240 else if (phydev->advertising & SUPPORTED_1000baseKX_Full) 1279 else if (amd_xgbe_phy_use_gmii_mode(phydev))
1241 ret = amd_xgbe_phy_gmii_mode(phydev); 1280 ret = amd_xgbe_phy_gmii_mode(phydev);
1242 else if (phydev->advertising & SUPPORTED_2500baseX_Full) 1281 else if (amd_xgbe_phy_use_gmii_2500_mode(phydev))
1243 ret = amd_xgbe_phy_gmii_2500_mode(phydev); 1282 ret = amd_xgbe_phy_gmii_2500_mode(phydev);
1244 else 1283 else
1245 ret = -EINVAL; 1284 ret = -EINVAL;
diff --git a/drivers/net/phy/bcm7xxx.c b/drivers/net/phy/bcm7xxx.c
index 64c74c6a4828..b5dc59de094e 100644
--- a/drivers/net/phy/bcm7xxx.c
+++ b/drivers/net/phy/bcm7xxx.c
@@ -404,7 +404,7 @@ static struct phy_driver bcm7xxx_driver[] = {
404 .name = "Broadcom BCM7425", 404 .name = "Broadcom BCM7425",
405 .features = PHY_GBIT_FEATURES | 405 .features = PHY_GBIT_FEATURES |
406 SUPPORTED_Pause | SUPPORTED_Asym_Pause, 406 SUPPORTED_Pause | SUPPORTED_Asym_Pause,
407 .flags = 0, 407 .flags = PHY_IS_INTERNAL,
408 .config_init = bcm7xxx_config_init, 408 .config_init = bcm7xxx_config_init,
409 .config_aneg = genphy_config_aneg, 409 .config_aneg = genphy_config_aneg,
410 .read_status = genphy_read_status, 410 .read_status = genphy_read_status,
diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c
index 496e02f961d3..00cb41e71312 100644
--- a/drivers/net/phy/dp83640.c
+++ b/drivers/net/phy/dp83640.c
@@ -47,7 +47,7 @@
47#define PSF_TX 0x1000 47#define PSF_TX 0x1000
48#define EXT_EVENT 1 48#define EXT_EVENT 1
49#define CAL_EVENT 7 49#define CAL_EVENT 7
50#define CAL_TRIGGER 7 50#define CAL_TRIGGER 1
51#define DP83640_N_PINS 12 51#define DP83640_N_PINS 12
52 52
53#define MII_DP83640_MICR 0x11 53#define MII_DP83640_MICR 0x11
@@ -496,7 +496,9 @@ static int ptp_dp83640_enable(struct ptp_clock_info *ptp,
496 else 496 else
497 evnt |= EVNT_RISE; 497 evnt |= EVNT_RISE;
498 } 498 }
499 mutex_lock(&clock->extreg_lock);
499 ext_write(0, phydev, PAGE5, PTP_EVNT, evnt); 500 ext_write(0, phydev, PAGE5, PTP_EVNT, evnt);
501 mutex_unlock(&clock->extreg_lock);
500 return 0; 502 return 0;
501 503
502 case PTP_CLK_REQ_PEROUT: 504 case PTP_CLK_REQ_PEROUT:
@@ -532,6 +534,8 @@ static u8 status_frame_src[6] = { 0x08, 0x00, 0x17, 0x0B, 0x6B, 0x0F };
532 534
533static void enable_status_frames(struct phy_device *phydev, bool on) 535static void enable_status_frames(struct phy_device *phydev, bool on)
534{ 536{
537 struct dp83640_private *dp83640 = phydev->priv;
538 struct dp83640_clock *clock = dp83640->clock;
535 u16 cfg0 = 0, ver; 539 u16 cfg0 = 0, ver;
536 540
537 if (on) 541 if (on)
@@ -539,9 +543,13 @@ static void enable_status_frames(struct phy_device *phydev, bool on)
539 543
540 ver = (PSF_PTPVER & VERSIONPTP_MASK) << VERSIONPTP_SHIFT; 544 ver = (PSF_PTPVER & VERSIONPTP_MASK) << VERSIONPTP_SHIFT;
541 545
546 mutex_lock(&clock->extreg_lock);
547
542 ext_write(0, phydev, PAGE5, PSF_CFG0, cfg0); 548 ext_write(0, phydev, PAGE5, PSF_CFG0, cfg0);
543 ext_write(0, phydev, PAGE6, PSF_CFG1, ver); 549 ext_write(0, phydev, PAGE6, PSF_CFG1, ver);
544 550
551 mutex_unlock(&clock->extreg_lock);
552
545 if (!phydev->attached_dev) { 553 if (!phydev->attached_dev) {
546 pr_warn("expected to find an attached netdevice\n"); 554 pr_warn("expected to find an attached netdevice\n");
547 return; 555 return;
@@ -838,7 +846,7 @@ static void decode_rxts(struct dp83640_private *dp83640,
838 list_del_init(&rxts->list); 846 list_del_init(&rxts->list);
839 phy2rxts(phy_rxts, rxts); 847 phy2rxts(phy_rxts, rxts);
840 848
841 spin_lock_irqsave(&dp83640->rx_queue.lock, flags); 849 spin_lock(&dp83640->rx_queue.lock);
842 skb_queue_walk(&dp83640->rx_queue, skb) { 850 skb_queue_walk(&dp83640->rx_queue, skb) {
843 struct dp83640_skb_info *skb_info; 851 struct dp83640_skb_info *skb_info;
844 852
@@ -853,7 +861,7 @@ static void decode_rxts(struct dp83640_private *dp83640,
853 break; 861 break;
854 } 862 }
855 } 863 }
856 spin_unlock_irqrestore(&dp83640->rx_queue.lock, flags); 864 spin_unlock(&dp83640->rx_queue.lock);
857 865
858 if (!shhwtstamps) 866 if (!shhwtstamps)
859 list_add_tail(&rxts->list, &dp83640->rxts); 867 list_add_tail(&rxts->list, &dp83640->rxts);
@@ -1173,11 +1181,18 @@ static int dp83640_config_init(struct phy_device *phydev)
1173 1181
1174 if (clock->chosen && !list_empty(&clock->phylist)) 1182 if (clock->chosen && !list_empty(&clock->phylist))
1175 recalibrate(clock); 1183 recalibrate(clock);
1176 else 1184 else {
1185 mutex_lock(&clock->extreg_lock);
1177 enable_broadcast(phydev, clock->page, 1); 1186 enable_broadcast(phydev, clock->page, 1);
1187 mutex_unlock(&clock->extreg_lock);
1188 }
1178 1189
1179 enable_status_frames(phydev, true); 1190 enable_status_frames(phydev, true);
1191
1192 mutex_lock(&clock->extreg_lock);
1180 ext_write(0, phydev, PAGE4, PTP_CTL, PTP_ENABLE); 1193 ext_write(0, phydev, PAGE4, PTP_CTL, PTP_ENABLE);
1194 mutex_unlock(&clock->extreg_lock);
1195
1181 return 0; 1196 return 0;
1182} 1197}
1183 1198
diff --git a/drivers/net/wireless/iwlwifi/Kconfig b/drivers/net/wireless/iwlwifi/Kconfig
index ab019b45551b..f89f446e5c8a 100644
--- a/drivers/net/wireless/iwlwifi/Kconfig
+++ b/drivers/net/wireless/iwlwifi/Kconfig
@@ -21,6 +21,7 @@ config IWLWIFI
21 Intel 7260 Wi-Fi Adapter 21 Intel 7260 Wi-Fi Adapter
22 Intel 3160 Wi-Fi Adapter 22 Intel 3160 Wi-Fi Adapter
23 Intel 7265 Wi-Fi Adapter 23 Intel 7265 Wi-Fi Adapter
24 Intel 3165 Wi-Fi Adapter
24 25
25 26
26 This driver uses the kernel's mac80211 subsystem. 27 This driver uses the kernel's mac80211 subsystem.
diff --git a/drivers/net/wireless/iwlwifi/iwl-7000.c b/drivers/net/wireless/iwlwifi/iwl-7000.c
index 36e786f0387b..74ad278116be 100644
--- a/drivers/net/wireless/iwlwifi/iwl-7000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-7000.c
@@ -70,15 +70,14 @@
70 70
71/* Highest firmware API version supported */ 71/* Highest firmware API version supported */
72#define IWL7260_UCODE_API_MAX 13 72#define IWL7260_UCODE_API_MAX 13
73#define IWL3160_UCODE_API_MAX 13
74 73
75/* Oldest version we won't warn about */ 74/* Oldest version we won't warn about */
76#define IWL7260_UCODE_API_OK 12 75#define IWL7260_UCODE_API_OK 12
77#define IWL3160_UCODE_API_OK 12 76#define IWL3165_UCODE_API_OK 13
78 77
79/* Lowest firmware API version supported */ 78/* Lowest firmware API version supported */
80#define IWL7260_UCODE_API_MIN 10 79#define IWL7260_UCODE_API_MIN 10
81#define IWL3160_UCODE_API_MIN 10 80#define IWL3165_UCODE_API_MIN 13
82 81
83/* NVM versions */ 82/* NVM versions */
84#define IWL7260_NVM_VERSION 0x0a1d 83#define IWL7260_NVM_VERSION 0x0a1d
@@ -104,9 +103,6 @@
104#define IWL3160_FW_PRE "iwlwifi-3160-" 103#define IWL3160_FW_PRE "iwlwifi-3160-"
105#define IWL3160_MODULE_FIRMWARE(api) IWL3160_FW_PRE __stringify(api) ".ucode" 104#define IWL3160_MODULE_FIRMWARE(api) IWL3160_FW_PRE __stringify(api) ".ucode"
106 105
107#define IWL3165_FW_PRE "iwlwifi-3165-"
108#define IWL3165_MODULE_FIRMWARE(api) IWL3165_FW_PRE __stringify(api) ".ucode"
109
110#define IWL7265_FW_PRE "iwlwifi-7265-" 106#define IWL7265_FW_PRE "iwlwifi-7265-"
111#define IWL7265_MODULE_FIRMWARE(api) IWL7265_FW_PRE __stringify(api) ".ucode" 107#define IWL7265_MODULE_FIRMWARE(api) IWL7265_FW_PRE __stringify(api) ".ucode"
112 108
@@ -248,8 +244,13 @@ static const struct iwl_ht_params iwl7265_ht_params = {
248 244
249const struct iwl_cfg iwl3165_2ac_cfg = { 245const struct iwl_cfg iwl3165_2ac_cfg = {
250 .name = "Intel(R) Dual Band Wireless AC 3165", 246 .name = "Intel(R) Dual Band Wireless AC 3165",
251 .fw_name_pre = IWL3165_FW_PRE, 247 .fw_name_pre = IWL7265D_FW_PRE,
252 IWL_DEVICE_7000, 248 IWL_DEVICE_7000,
249 /* sparse doens't like the re-assignment but it is safe */
250#ifndef __CHECKER__
251 .ucode_api_ok = IWL3165_UCODE_API_OK,
252 .ucode_api_min = IWL3165_UCODE_API_MIN,
253#endif
253 .ht_params = &iwl7000_ht_params, 254 .ht_params = &iwl7000_ht_params,
254 .nvm_ver = IWL3165_NVM_VERSION, 255 .nvm_ver = IWL3165_NVM_VERSION,
255 .nvm_calib_ver = IWL3165_TX_POWER_VERSION, 256 .nvm_calib_ver = IWL3165_TX_POWER_VERSION,
@@ -325,6 +326,5 @@ const struct iwl_cfg iwl7265d_n_cfg = {
325 326
326MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); 327MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_OK));
327MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL3160_UCODE_API_OK)); 328MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL3160_UCODE_API_OK));
328MODULE_FIRMWARE(IWL3165_MODULE_FIRMWARE(IWL3160_UCODE_API_OK));
329MODULE_FIRMWARE(IWL7265_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); 329MODULE_FIRMWARE(IWL7265_MODULE_FIRMWARE(IWL7260_UCODE_API_OK));
330MODULE_FIRMWARE(IWL7265D_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); 330MODULE_FIRMWARE(IWL7265D_MODULE_FIRMWARE(IWL7260_UCODE_API_OK));
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c b/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c
index 41ff85de7334..21302b6f2bfd 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c
@@ -6,6 +6,7 @@
6 * GPL LICENSE SUMMARY 6 * GPL LICENSE SUMMARY
7 * 7 *
8 * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved. 8 * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2015 Intel Mobile Communications GmbH
9 * 10 *
10 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as 12 * it under the terms of version 2 of the GNU General Public License as
@@ -31,6 +32,7 @@
31 * BSD LICENSE 32 * BSD LICENSE
32 * 33 *
33 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. 34 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
35 * Copyright(c) 2015 Intel Mobile Communications GmbH
34 * All rights reserved. 36 * All rights reserved.
35 * 37 *
36 * Redistribution and use in source and binary forms, with or without 38 * Redistribution and use in source and binary forms, with or without
@@ -748,6 +750,9 @@ void iwl_init_ht_hw_capab(const struct iwl_cfg *cfg,
748 return; 750 return;
749 } 751 }
750 752
753 if (data->sku_cap_mimo_disabled)
754 rx_chains = 1;
755
751 ht_info->ht_supported = true; 756 ht_info->ht_supported = true;
752 ht_info->cap = IEEE80211_HT_CAP_DSSSCCK40; 757 ht_info->cap = IEEE80211_HT_CAP_DSSSCCK40;
753 758
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.h b/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.h
index 5234a0bf11e4..750c8c9ee70d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.h
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.h
@@ -6,6 +6,7 @@
6 * GPL LICENSE SUMMARY 6 * GPL LICENSE SUMMARY
7 * 7 *
8 * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved. 8 * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2015 Intel Mobile Communications GmbH
9 * 10 *
10 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as 12 * it under the terms of version 2 of the GNU General Public License as
@@ -31,6 +32,7 @@
31 * BSD LICENSE 32 * BSD LICENSE
32 * 33 *
33 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. 34 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
35 * Copyright(c) 2015 Intel Mobile Communications GmbH
34 * All rights reserved. 36 * All rights reserved.
35 * 37 *
36 * Redistribution and use in source and binary forms, with or without 38 * Redistribution and use in source and binary forms, with or without
@@ -84,6 +86,7 @@ struct iwl_nvm_data {
84 bool sku_cap_11ac_enable; 86 bool sku_cap_11ac_enable;
85 bool sku_cap_amt_enable; 87 bool sku_cap_amt_enable;
86 bool sku_cap_ipan_enable; 88 bool sku_cap_ipan_enable;
89 bool sku_cap_mimo_disabled;
87 90
88 u16 radio_cfg_type; 91 u16 radio_cfg_type;
89 u8 radio_cfg_step; 92 u8 radio_cfg_step;
diff --git a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c
index 83903a5025c2..75e96db6626b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c
+++ b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c
@@ -6,7 +6,7 @@
6 * GPL LICENSE SUMMARY 6 * GPL LICENSE SUMMARY
7 * 7 *
8 * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved. 8 * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH 9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of version 2 of the GNU General Public License as 12 * it under the terms of version 2 of the GNU General Public License as
@@ -32,7 +32,7 @@
32 * BSD LICENSE 32 * BSD LICENSE
33 * 33 *
34 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. 34 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
35 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH 35 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
36 * All rights reserved. 36 * All rights reserved.
37 * 37 *
38 * Redistribution and use in source and binary forms, with or without 38 * Redistribution and use in source and binary forms, with or without
@@ -116,10 +116,11 @@ enum family_8000_nvm_offsets {
116 116
117/* SKU Capabilities (actual values from NVM definition) */ 117/* SKU Capabilities (actual values from NVM definition) */
118enum nvm_sku_bits { 118enum nvm_sku_bits {
119 NVM_SKU_CAP_BAND_24GHZ = BIT(0), 119 NVM_SKU_CAP_BAND_24GHZ = BIT(0),
120 NVM_SKU_CAP_BAND_52GHZ = BIT(1), 120 NVM_SKU_CAP_BAND_52GHZ = BIT(1),
121 NVM_SKU_CAP_11N_ENABLE = BIT(2), 121 NVM_SKU_CAP_11N_ENABLE = BIT(2),
122 NVM_SKU_CAP_11AC_ENABLE = BIT(3), 122 NVM_SKU_CAP_11AC_ENABLE = BIT(3),
123 NVM_SKU_CAP_MIMO_DISABLE = BIT(5),
123}; 124};
124 125
125/* 126/*
@@ -368,6 +369,11 @@ static void iwl_init_vht_hw_capab(const struct iwl_cfg *cfg,
368 if (cfg->ht_params->ldpc) 369 if (cfg->ht_params->ldpc)
369 vht_cap->cap |= IEEE80211_VHT_CAP_RXLDPC; 370 vht_cap->cap |= IEEE80211_VHT_CAP_RXLDPC;
370 371
372 if (data->sku_cap_mimo_disabled) {
373 num_rx_ants = 1;
374 num_tx_ants = 1;
375 }
376
371 if (num_tx_ants > 1) 377 if (num_tx_ants > 1)
372 vht_cap->cap |= IEEE80211_VHT_CAP_TXSTBC; 378 vht_cap->cap |= IEEE80211_VHT_CAP_TXSTBC;
373 else 379 else
@@ -527,6 +533,10 @@ static void iwl_set_hw_address_family_8000(struct device *dev,
527 const u8 *hw_addr; 533 const u8 *hw_addr;
528 534
529 if (mac_override) { 535 if (mac_override) {
536 static const u8 reserved_mac[] = {
537 0x02, 0xcc, 0xaa, 0xff, 0xee, 0x00
538 };
539
530 hw_addr = (const u8 *)(mac_override + 540 hw_addr = (const u8 *)(mac_override +
531 MAC_ADDRESS_OVERRIDE_FAMILY_8000); 541 MAC_ADDRESS_OVERRIDE_FAMILY_8000);
532 542
@@ -538,7 +548,12 @@ static void iwl_set_hw_address_family_8000(struct device *dev,
538 data->hw_addr[4] = hw_addr[5]; 548 data->hw_addr[4] = hw_addr[5];
539 data->hw_addr[5] = hw_addr[4]; 549 data->hw_addr[5] = hw_addr[4];
540 550
541 if (is_valid_ether_addr(data->hw_addr)) 551 /*
552 * Force the use of the OTP MAC address in case of reserved MAC
553 * address in the NVM, or if address is given but invalid.
554 */
555 if (is_valid_ether_addr(data->hw_addr) &&
556 memcmp(reserved_mac, hw_addr, ETH_ALEN) != 0)
542 return; 557 return;
543 558
544 IWL_ERR_DEV(dev, 559 IWL_ERR_DEV(dev,
@@ -610,6 +625,7 @@ iwl_parse_nvm_data(struct device *dev, const struct iwl_cfg *cfg,
610 data->sku_cap_11n_enable = false; 625 data->sku_cap_11n_enable = false;
611 data->sku_cap_11ac_enable = data->sku_cap_11n_enable && 626 data->sku_cap_11ac_enable = data->sku_cap_11n_enable &&
612 (sku & NVM_SKU_CAP_11AC_ENABLE); 627 (sku & NVM_SKU_CAP_11AC_ENABLE);
628 data->sku_cap_mimo_disabled = sku & NVM_SKU_CAP_MIMO_DISABLE;
613 629
614 data->n_hw_addrs = iwl_get_n_hw_addrs(cfg, nvm_sw); 630 data->n_hw_addrs = iwl_get_n_hw_addrs(cfg, nvm_sw);
615 631
diff --git a/drivers/net/wireless/iwlwifi/mvm/coex_legacy.c b/drivers/net/wireless/iwlwifi/mvm/coex_legacy.c
index d954591e0be5..6ac6de2af977 100644
--- a/drivers/net/wireless/iwlwifi/mvm/coex_legacy.c
+++ b/drivers/net/wireless/iwlwifi/mvm/coex_legacy.c
@@ -776,7 +776,7 @@ static int iwl_mvm_bt_coex_reduced_txp(struct iwl_mvm *mvm, u8 sta_id,
776 struct iwl_host_cmd cmd = { 776 struct iwl_host_cmd cmd = {
777 .id = BT_CONFIG, 777 .id = BT_CONFIG,
778 .len = { sizeof(*bt_cmd), }, 778 .len = { sizeof(*bt_cmd), },
779 .dataflags = { IWL_HCMD_DFL_NOCOPY, }, 779 .dataflags = { IWL_HCMD_DFL_DUP, },
780 .flags = CMD_ASYNC, 780 .flags = CMD_ASYNC,
781 }; 781 };
782 struct iwl_mvm_sta *mvmsta; 782 struct iwl_mvm_sta *mvmsta;
diff --git a/drivers/net/wireless/iwlwifi/mvm/d3.c b/drivers/net/wireless/iwlwifi/mvm/d3.c
index 1b1b2bf26819..4310cf102d78 100644
--- a/drivers/net/wireless/iwlwifi/mvm/d3.c
+++ b/drivers/net/wireless/iwlwifi/mvm/d3.c
@@ -1750,8 +1750,10 @@ static void iwl_mvm_query_netdetect_reasons(struct iwl_mvm *mvm,
1750 int i, j, n_matches, ret; 1750 int i, j, n_matches, ret;
1751 1751
1752 fw_status = iwl_mvm_get_wakeup_status(mvm, vif); 1752 fw_status = iwl_mvm_get_wakeup_status(mvm, vif);
1753 if (!IS_ERR_OR_NULL(fw_status)) 1753 if (!IS_ERR_OR_NULL(fw_status)) {
1754 reasons = le32_to_cpu(fw_status->wakeup_reasons); 1754 reasons = le32_to_cpu(fw_status->wakeup_reasons);
1755 kfree(fw_status);
1756 }
1755 1757
1756 if (reasons & IWL_WOWLAN_WAKEUP_BY_RFKILL_DEASSERTED) 1758 if (reasons & IWL_WOWLAN_WAKEUP_BY_RFKILL_DEASSERTED)
1757 wakeup.rfkill_release = true; 1759 wakeup.rfkill_release = true;
@@ -1868,15 +1870,15 @@ static int __iwl_mvm_resume(struct iwl_mvm *mvm, bool test)
1868 /* get the BSS vif pointer again */ 1870 /* get the BSS vif pointer again */
1869 vif = iwl_mvm_get_bss_vif(mvm); 1871 vif = iwl_mvm_get_bss_vif(mvm);
1870 if (IS_ERR_OR_NULL(vif)) 1872 if (IS_ERR_OR_NULL(vif))
1871 goto out_unlock; 1873 goto err;
1872 1874
1873 ret = iwl_trans_d3_resume(mvm->trans, &d3_status, test); 1875 ret = iwl_trans_d3_resume(mvm->trans, &d3_status, test);
1874 if (ret) 1876 if (ret)
1875 goto out_unlock; 1877 goto err;
1876 1878
1877 if (d3_status != IWL_D3_STATUS_ALIVE) { 1879 if (d3_status != IWL_D3_STATUS_ALIVE) {
1878 IWL_INFO(mvm, "Device was reset during suspend\n"); 1880 IWL_INFO(mvm, "Device was reset during suspend\n");
1879 goto out_unlock; 1881 goto err;
1880 } 1882 }
1881 1883
1882 /* query SRAM first in case we want event logging */ 1884 /* query SRAM first in case we want event logging */
@@ -1902,7 +1904,8 @@ static int __iwl_mvm_resume(struct iwl_mvm *mvm, bool test)
1902 goto out_iterate; 1904 goto out_iterate;
1903 } 1905 }
1904 1906
1905 out_unlock: 1907err:
1908 iwl_mvm_free_nd(mvm);
1906 mutex_unlock(&mvm->mutex); 1909 mutex_unlock(&mvm->mutex);
1907 1910
1908out_iterate: 1911out_iterate:
@@ -1915,6 +1918,14 @@ out:
1915 /* return 1 to reconfigure the device */ 1918 /* return 1 to reconfigure the device */
1916 set_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status); 1919 set_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status);
1917 set_bit(IWL_MVM_STATUS_D3_RECONFIG, &mvm->status); 1920 set_bit(IWL_MVM_STATUS_D3_RECONFIG, &mvm->status);
1921
1922 /* We always return 1, which causes mac80211 to do a reconfig
1923 * with IEEE80211_RECONFIG_TYPE_RESTART. This type of
1924 * reconfig calls iwl_mvm_restart_complete(), where we unref
1925 * the IWL_MVM_REF_UCODE_DOWN, so we need to take the
1926 * reference here.
1927 */
1928 iwl_mvm_ref(mvm, IWL_MVM_REF_UCODE_DOWN);
1918 return 1; 1929 return 1;
1919} 1930}
1920 1931
@@ -2021,7 +2032,6 @@ static int iwl_mvm_d3_test_release(struct inode *inode, struct file *file)
2021 __iwl_mvm_resume(mvm, true); 2032 __iwl_mvm_resume(mvm, true);
2022 rtnl_unlock(); 2033 rtnl_unlock();
2023 iwl_abort_notification_waits(&mvm->notif_wait); 2034 iwl_abort_notification_waits(&mvm->notif_wait);
2024 iwl_mvm_ref(mvm, IWL_MVM_REF_UCODE_DOWN);
2025 ieee80211_restart_hw(mvm->hw); 2035 ieee80211_restart_hw(mvm->hw);
2026 2036
2027 /* wait for restart and disconnect all interfaces */ 2037 /* wait for restart and disconnect all interfaces */
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
index 40265b9c66ae..dda9f7b5f342 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
@@ -3995,9 +3995,6 @@ static void iwl_mvm_mac_event_callback(struct ieee80211_hw *hw,
3995 if (!iwl_fw_dbg_trigger_enabled(mvm->fw, FW_DBG_TRIGGER_MLME)) 3995 if (!iwl_fw_dbg_trigger_enabled(mvm->fw, FW_DBG_TRIGGER_MLME))
3996 return; 3996 return;
3997 3997
3998 if (event->u.mlme.status == MLME_SUCCESS)
3999 return;
4000
4001 trig = iwl_fw_dbg_get_trigger(mvm->fw, FW_DBG_TRIGGER_MLME); 3998 trig = iwl_fw_dbg_get_trigger(mvm->fw, FW_DBG_TRIGGER_MLME);
4002 trig_mlme = (void *)trig->data; 3999 trig_mlme = (void *)trig->data;
4003 if (!iwl_fw_dbg_trigger_check_stop(mvm, vif, trig)) 4000 if (!iwl_fw_dbg_trigger_check_stop(mvm, vif, trig))
diff --git a/drivers/net/wireless/iwlwifi/mvm/ops.c b/drivers/net/wireless/iwlwifi/mvm/ops.c
index 1c66297d82c0..2ea01238754e 100644
--- a/drivers/net/wireless/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/iwlwifi/mvm/ops.c
@@ -1263,11 +1263,13 @@ static void iwl_mvm_d0i3_exit_work(struct work_struct *wk)
1263 ieee80211_iterate_active_interfaces( 1263 ieee80211_iterate_active_interfaces(
1264 mvm->hw, IEEE80211_IFACE_ITER_NORMAL, 1264 mvm->hw, IEEE80211_IFACE_ITER_NORMAL,
1265 iwl_mvm_d0i3_disconnect_iter, mvm); 1265 iwl_mvm_d0i3_disconnect_iter, mvm);
1266
1267 iwl_free_resp(&get_status_cmd);
1268out: 1266out:
1269 iwl_mvm_d0i3_enable_tx(mvm, qos_seq); 1267 iwl_mvm_d0i3_enable_tx(mvm, qos_seq);
1270 1268
1269 /* qos_seq might point inside resp_pkt, so free it only now */
1270 if (get_status_cmd.resp_pkt)
1271 iwl_free_resp(&get_status_cmd);
1272
1271 /* the FW might have updated the regdomain */ 1273 /* the FW might have updated the regdomain */
1272 iwl_mvm_update_changed_regdom(mvm); 1274 iwl_mvm_update_changed_regdom(mvm);
1273 1275
diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.c b/drivers/net/wireless/iwlwifi/mvm/rs.c
index f9928f2c125f..33cd68ae7bf9 100644
--- a/drivers/net/wireless/iwlwifi/mvm/rs.c
+++ b/drivers/net/wireless/iwlwifi/mvm/rs.c
@@ -180,6 +180,9 @@ static bool rs_mimo_allow(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
180 if (iwl_mvm_vif_low_latency(mvmvif) && mvmsta->vif->p2p) 180 if (iwl_mvm_vif_low_latency(mvmvif) && mvmsta->vif->p2p)
181 return false; 181 return false;
182 182
183 if (mvm->nvm_data->sku_cap_mimo_disabled)
184 return false;
185
183 return true; 186 return true;
184} 187}
185 188
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c
index 47bbf573fdc8..d6f6515fe663 100644
--- a/drivers/net/wireless/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
@@ -1049,9 +1049,11 @@ static void iwl_trans_pcie_stop_device(struct iwl_trans *trans, bool low_power)
1049 iwl_pcie_rx_stop(trans); 1049 iwl_pcie_rx_stop(trans);
1050 1050
1051 /* Power-down device's busmaster DMA clocks */ 1051 /* Power-down device's busmaster DMA clocks */
1052 iwl_write_prph(trans, APMG_CLK_DIS_REG, 1052 if (trans->cfg->device_family != IWL_DEVICE_FAMILY_8000) {
1053 APMG_CLK_VAL_DMA_CLK_RQT); 1053 iwl_write_prph(trans, APMG_CLK_DIS_REG,
1054 udelay(5); 1054 APMG_CLK_VAL_DMA_CLK_RQT);
1055 udelay(5);
1056 }
1055 } 1057 }
1056 1058
1057 /* Make sure (redundant) we've released our request to stay awake */ 1059 /* Make sure (redundant) we've released our request to stay awake */
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
index 3d8dbf5f2d39..fee02414529e 100644
--- a/drivers/net/xen-netback/xenbus.c
+++ b/drivers/net/xen-netback/xenbus.c
@@ -793,6 +793,7 @@ static void connect(struct backend_info *be)
793 goto err; 793 goto err;
794 } 794 }
795 795
796 queue->credit_bytes = credit_bytes;
796 queue->remaining_credit = credit_bytes; 797 queue->remaining_credit = credit_bytes;
797 queue->credit_usec = credit_usec; 798 queue->credit_usec = credit_usec;
798 799
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 3f45afd4382e..e031c943286e 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1698,6 +1698,7 @@ static void xennet_destroy_queues(struct netfront_info *info)
1698 1698
1699 if (netif_running(info->netdev)) 1699 if (netif_running(info->netdev))
1700 napi_disable(&queue->napi); 1700 napi_disable(&queue->napi);
1701 del_timer_sync(&queue->rx_refill_timer);
1701 netif_napi_del(&queue->napi); 1702 netif_napi_del(&queue->napi);
1702 } 1703 }
1703 1704
@@ -2102,9 +2103,6 @@ static const struct attribute_group xennet_dev_group = {
2102static int xennet_remove(struct xenbus_device *dev) 2103static int xennet_remove(struct xenbus_device *dev)
2103{ 2104{
2104 struct netfront_info *info = dev_get_drvdata(&dev->dev); 2105 struct netfront_info *info = dev_get_drvdata(&dev->dev);
2105 unsigned int num_queues = info->netdev->real_num_tx_queues;
2106 struct netfront_queue *queue = NULL;
2107 unsigned int i = 0;
2108 2106
2109 dev_dbg(&dev->dev, "%s\n", dev->nodename); 2107 dev_dbg(&dev->dev, "%s\n", dev->nodename);
2110 2108
@@ -2112,16 +2110,7 @@ static int xennet_remove(struct xenbus_device *dev)
2112 2110
2113 unregister_netdev(info->netdev); 2111 unregister_netdev(info->netdev);
2114 2112
2115 for (i = 0; i < num_queues; ++i) { 2113 xennet_destroy_queues(info);
2116 queue = &info->queues[i];
2117 del_timer_sync(&queue->rx_refill_timer);
2118 }
2119
2120 if (num_queues) {
2121 kfree(info->queues);
2122 info->queues = NULL;
2123 }
2124
2125 xennet_free_netdev(info->netdev); 2114 xennet_free_netdev(info->netdev);
2126 2115
2127 return 0; 2116 return 0;
diff --git a/drivers/ssb/driver_pcicore.c b/drivers/ssb/driver_pcicore.c
index 15a7ee3859dd..5fe1c22e289b 100644
--- a/drivers/ssb/driver_pcicore.c
+++ b/drivers/ssb/driver_pcicore.c
@@ -359,12 +359,13 @@ static void ssb_pcicore_init_hostmode(struct ssb_pcicore *pc)
359 359
360 /* 360 /*
361 * Accessing PCI config without a proper delay after devices reset (not 361 * Accessing PCI config without a proper delay after devices reset (not
362 * GPIO reset) was causing reboots on WRT300N v1.0. 362 * GPIO reset) was causing reboots on WRT300N v1.0 (BCM4704).
363 * Tested delay 850 us lowered reboot chance to 50-80%, 1000 us fixed it 363 * Tested delay 850 us lowered reboot chance to 50-80%, 1000 us fixed it
364 * completely. Flushing all writes was also tested but with no luck. 364 * completely. Flushing all writes was also tested but with no luck.
365 * The same problem was reported for WRT350N v1 (BCM4705), so we just
366 * sleep here unconditionally.
365 */ 367 */
366 if (pc->dev->bus->chip_id == 0x4704) 368 usleep_range(1000, 2000);
367 usleep_range(1000, 2000);
368 369
369 /* Enable PCI bridge BAR0 prefetch and burst */ 370 /* Enable PCI bridge BAR0 prefetch and burst */
370 val = PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY; 371 val = PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY;
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
index ae2982c0f7a6..656da2a12ffe 100644
--- a/include/linux/brcmphy.h
+++ b/include/linux/brcmphy.h
@@ -17,7 +17,7 @@
17#define PHY_ID_BCM7250 0xae025280 17#define PHY_ID_BCM7250 0xae025280
18#define PHY_ID_BCM7364 0xae025260 18#define PHY_ID_BCM7364 0xae025260
19#define PHY_ID_BCM7366 0x600d8490 19#define PHY_ID_BCM7366 0x600d8490
20#define PHY_ID_BCM7425 0x03625e60 20#define PHY_ID_BCM7425 0x600d86b0
21#define PHY_ID_BCM7429 0x600d8730 21#define PHY_ID_BCM7429 0x600d8730
22#define PHY_ID_BCM7439 0x600d8480 22#define PHY_ID_BCM7439 0x600d8480
23#define PHY_ID_BCM7439_2 0xae025080 23#define PHY_ID_BCM7439_2 0xae025080
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index c56a438c3a1e..ce13cf20f625 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -574,11 +574,14 @@ static inline void sctp_v6_map_v4(union sctp_addr *addr)
574/* Map v4 address to v4-mapped v6 address */ 574/* Map v4 address to v4-mapped v6 address */
575static inline void sctp_v4_map_v6(union sctp_addr *addr) 575static inline void sctp_v4_map_v6(union sctp_addr *addr)
576{ 576{
577 __be16 port;
578
579 port = addr->v4.sin_port;
580 addr->v6.sin6_addr.s6_addr32[3] = addr->v4.sin_addr.s_addr;
581 addr->v6.sin6_port = port;
577 addr->v6.sin6_family = AF_INET6; 582 addr->v6.sin6_family = AF_INET6;
578 addr->v6.sin6_flowinfo = 0; 583 addr->v6.sin6_flowinfo = 0;
579 addr->v6.sin6_scope_id = 0; 584 addr->v6.sin6_scope_id = 0;
580 addr->v6.sin6_port = addr->v4.sin_port;
581 addr->v6.sin6_addr.s6_addr32[3] = addr->v4.sin_addr.s_addr;
582 addr->v6.sin6_addr.s6_addr32[0] = 0; 585 addr->v6.sin6_addr.s6_addr32[0] = 0;
583 addr->v6.sin6_addr.s6_addr32[1] = 0; 586 addr->v6.sin6_addr.s6_addr32[1] = 0;
584 addr->v6.sin6_addr.s6_addr32[2] = htonl(0x0000ffff); 587 addr->v6.sin6_addr.s6_addr32[2] = htonl(0x0000ffff);
diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c
index 4ec0c803aef1..112ad784838a 100644
--- a/net/caif/caif_socket.c
+++ b/net/caif/caif_socket.c
@@ -330,6 +330,10 @@ static long caif_stream_data_wait(struct sock *sk, long timeo)
330 release_sock(sk); 330 release_sock(sk);
331 timeo = schedule_timeout(timeo); 331 timeo = schedule_timeout(timeo);
332 lock_sock(sk); 332 lock_sock(sk);
333
334 if (sock_flag(sk, SOCK_DEAD))
335 break;
336
333 clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags); 337 clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);
334 } 338 }
335 339
@@ -373,6 +377,10 @@ static int caif_stream_recvmsg(struct socket *sock, struct msghdr *msg,
373 struct sk_buff *skb; 377 struct sk_buff *skb;
374 378
375 lock_sock(sk); 379 lock_sock(sk);
380 if (sock_flag(sk, SOCK_DEAD)) {
381 err = -ECONNRESET;
382 goto unlock;
383 }
376 skb = skb_dequeue(&sk->sk_receive_queue); 384 skb = skb_dequeue(&sk->sk_receive_queue);
377 caif_check_flow_release(sk); 385 caif_check_flow_release(sk);
378 386
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 265e42721a66..ff347a0eebd4 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2495,51 +2495,22 @@ static bool ieee80211_coalesce_started_roc(struct ieee80211_local *local,
2495 struct ieee80211_roc_work *new_roc, 2495 struct ieee80211_roc_work *new_roc,
2496 struct ieee80211_roc_work *cur_roc) 2496 struct ieee80211_roc_work *cur_roc)
2497{ 2497{
2498 unsigned long j = jiffies; 2498 unsigned long now = jiffies;
2499 unsigned long cur_roc_end = cur_roc->hw_start_time + 2499 unsigned long remaining = cur_roc->hw_start_time +
2500 msecs_to_jiffies(cur_roc->duration); 2500 msecs_to_jiffies(cur_roc->duration) -
2501 struct ieee80211_roc_work *next_roc; 2501 now;
2502 int new_dur;
2503 2502
2504 if (WARN_ON(!cur_roc->started || !cur_roc->hw_begun)) 2503 if (WARN_ON(!cur_roc->started || !cur_roc->hw_begun))
2505 return false; 2504 return false;
2506 2505
2507 if (time_after(j + IEEE80211_ROC_MIN_LEFT, cur_roc_end)) 2506 /* if it doesn't fit entirely, schedule a new one */
2507 if (new_roc->duration > jiffies_to_msecs(remaining))
2508 return false; 2508 return false;
2509 2509
2510 ieee80211_handle_roc_started(new_roc); 2510 ieee80211_handle_roc_started(new_roc);
2511 2511
2512 new_dur = new_roc->duration - jiffies_to_msecs(cur_roc_end - j); 2512 /* add to dependents so we send the expired event properly */
2513 2513 list_add_tail(&new_roc->list, &cur_roc->dependents);
2514 /* cur_roc is long enough - add new_roc to the dependents list. */
2515 if (new_dur <= 0) {
2516 list_add_tail(&new_roc->list, &cur_roc->dependents);
2517 return true;
2518 }
2519
2520 new_roc->duration = new_dur;
2521
2522 /*
2523 * if cur_roc was already coalesced before, we might
2524 * want to extend the next roc instead of adding
2525 * a new one.
2526 */
2527 next_roc = list_entry(cur_roc->list.next,
2528 struct ieee80211_roc_work, list);
2529 if (&next_roc->list != &local->roc_list &&
2530 next_roc->chan == new_roc->chan &&
2531 next_roc->sdata == new_roc->sdata &&
2532 !WARN_ON(next_roc->started)) {
2533 list_add_tail(&new_roc->list, &next_roc->dependents);
2534 next_roc->duration = max(next_roc->duration,
2535 new_roc->duration);
2536 next_roc->type = max(next_roc->type, new_roc->type);
2537 return true;
2538 }
2539
2540 /* add right after cur_roc */
2541 list_add(&new_roc->list, &cur_roc->list);
2542
2543 return true; 2514 return true;
2544} 2515}
2545 2516
@@ -2652,17 +2623,9 @@ static int ieee80211_start_roc_work(struct ieee80211_local *local,
2652 * In the offloaded ROC case, if it hasn't begun, add 2623 * In the offloaded ROC case, if it hasn't begun, add
2653 * this new one to the dependent list to be handled 2624 * this new one to the dependent list to be handled
2654 * when the master one begins. If it has begun, 2625 * when the master one begins. If it has begun,
2655 * check that there's still a minimum time left and 2626 * check if it fits entirely within the existing one,
2656 * if so, start this one, transmitting the frame, but 2627 * in which case it will just be dependent as well.
2657 * add it to the list directly after this one with 2628 * Otherwise, schedule it by itself.
2658 * a reduced time so we'll ask the driver to execute
2659 * it right after finishing the previous one, in the
2660 * hope that it'll also be executed right afterwards,
2661 * effectively extending the old one.
2662 * If there's no minimum time left, just add it to the
2663 * normal list.
2664 * TODO: the ROC type is ignored here, assuming that it
2665 * is better to immediately use the current ROC.
2666 */ 2629 */
2667 if (!tmp->hw_begun) { 2630 if (!tmp->hw_begun) {
2668 list_add_tail(&roc->list, &tmp->dependents); 2631 list_add_tail(&roc->list, &tmp->dependents);
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index ab46ab4a7249..c0a9187bc3a9 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -205,6 +205,8 @@ enum ieee80211_packet_rx_flags {
205 * @IEEE80211_RX_CMNTR: received on cooked monitor already 205 * @IEEE80211_RX_CMNTR: received on cooked monitor already
206 * @IEEE80211_RX_BEACON_REPORTED: This frame was already reported 206 * @IEEE80211_RX_BEACON_REPORTED: This frame was already reported
207 * to cfg80211_report_obss_beacon(). 207 * to cfg80211_report_obss_beacon().
208 * @IEEE80211_RX_REORDER_TIMER: this frame is released by the
209 * reorder buffer timeout timer, not the normal RX path
208 * 210 *
209 * These flags are used across handling multiple interfaces 211 * These flags are used across handling multiple interfaces
210 * for a single frame. 212 * for a single frame.
@@ -212,6 +214,7 @@ enum ieee80211_packet_rx_flags {
212enum ieee80211_rx_flags { 214enum ieee80211_rx_flags {
213 IEEE80211_RX_CMNTR = BIT(0), 215 IEEE80211_RX_CMNTR = BIT(0),
214 IEEE80211_RX_BEACON_REPORTED = BIT(1), 216 IEEE80211_RX_BEACON_REPORTED = BIT(1),
217 IEEE80211_RX_REORDER_TIMER = BIT(2),
215}; 218};
216 219
217struct ieee80211_rx_data { 220struct ieee80211_rx_data {
@@ -325,12 +328,6 @@ struct mesh_preq_queue {
325 u8 flags; 328 u8 flags;
326}; 329};
327 330
328#if HZ/100 == 0
329#define IEEE80211_ROC_MIN_LEFT 1
330#else
331#define IEEE80211_ROC_MIN_LEFT (HZ/100)
332#endif
333
334struct ieee80211_roc_work { 331struct ieee80211_roc_work {
335 struct list_head list; 332 struct list_head list;
336 struct list_head dependents; 333 struct list_head dependents;
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index bab5c63c0bad..84cef600c573 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -522,6 +522,12 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
522 memcpy(sdata->vif.hw_queue, master->vif.hw_queue, 522 memcpy(sdata->vif.hw_queue, master->vif.hw_queue,
523 sizeof(sdata->vif.hw_queue)); 523 sizeof(sdata->vif.hw_queue));
524 sdata->vif.bss_conf.chandef = master->vif.bss_conf.chandef; 524 sdata->vif.bss_conf.chandef = master->vif.bss_conf.chandef;
525
526 mutex_lock(&local->key_mtx);
527 sdata->crypto_tx_tailroom_needed_cnt +=
528 master->crypto_tx_tailroom_needed_cnt;
529 mutex_unlock(&local->key_mtx);
530
525 break; 531 break;
526 } 532 }
527 case NL80211_IFTYPE_AP: 533 case NL80211_IFTYPE_AP:
diff --git a/net/mac80211/key.c b/net/mac80211/key.c
index 2291cd730091..a907f2d5c12d 100644
--- a/net/mac80211/key.c
+++ b/net/mac80211/key.c
@@ -58,6 +58,22 @@ static void assert_key_lock(struct ieee80211_local *local)
58 lockdep_assert_held(&local->key_mtx); 58 lockdep_assert_held(&local->key_mtx);
59} 59}
60 60
61static void
62update_vlan_tailroom_need_count(struct ieee80211_sub_if_data *sdata, int delta)
63{
64 struct ieee80211_sub_if_data *vlan;
65
66 if (sdata->vif.type != NL80211_IFTYPE_AP)
67 return;
68
69 mutex_lock(&sdata->local->mtx);
70
71 list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list)
72 vlan->crypto_tx_tailroom_needed_cnt += delta;
73
74 mutex_unlock(&sdata->local->mtx);
75}
76
61static void increment_tailroom_need_count(struct ieee80211_sub_if_data *sdata) 77static void increment_tailroom_need_count(struct ieee80211_sub_if_data *sdata)
62{ 78{
63 /* 79 /*
@@ -79,6 +95,8 @@ static void increment_tailroom_need_count(struct ieee80211_sub_if_data *sdata)
79 * http://mid.gmane.org/1308590980.4322.19.camel@jlt3.sipsolutions.net 95 * http://mid.gmane.org/1308590980.4322.19.camel@jlt3.sipsolutions.net
80 */ 96 */
81 97
98 update_vlan_tailroom_need_count(sdata, 1);
99
82 if (!sdata->crypto_tx_tailroom_needed_cnt++) { 100 if (!sdata->crypto_tx_tailroom_needed_cnt++) {
83 /* 101 /*
84 * Flush all XMIT packets currently using HW encryption or no 102 * Flush all XMIT packets currently using HW encryption or no
@@ -88,6 +106,15 @@ static void increment_tailroom_need_count(struct ieee80211_sub_if_data *sdata)
88 } 106 }
89} 107}
90 108
109static void decrease_tailroom_need_count(struct ieee80211_sub_if_data *sdata,
110 int delta)
111{
112 WARN_ON_ONCE(sdata->crypto_tx_tailroom_needed_cnt < delta);
113
114 update_vlan_tailroom_need_count(sdata, -delta);
115 sdata->crypto_tx_tailroom_needed_cnt -= delta;
116}
117
91static int ieee80211_key_enable_hw_accel(struct ieee80211_key *key) 118static int ieee80211_key_enable_hw_accel(struct ieee80211_key *key)
92{ 119{
93 struct ieee80211_sub_if_data *sdata; 120 struct ieee80211_sub_if_data *sdata;
@@ -144,7 +171,7 @@ static int ieee80211_key_enable_hw_accel(struct ieee80211_key *key)
144 171
145 if (!((key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) || 172 if (!((key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) ||
146 (key->conf.flags & IEEE80211_KEY_FLAG_RESERVE_TAILROOM))) 173 (key->conf.flags & IEEE80211_KEY_FLAG_RESERVE_TAILROOM)))
147 sdata->crypto_tx_tailroom_needed_cnt--; 174 decrease_tailroom_need_count(sdata, 1);
148 175
149 WARN_ON((key->conf.flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE) && 176 WARN_ON((key->conf.flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE) &&
150 (key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)); 177 (key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV));
@@ -541,7 +568,7 @@ static void __ieee80211_key_destroy(struct ieee80211_key *key,
541 schedule_delayed_work(&sdata->dec_tailroom_needed_wk, 568 schedule_delayed_work(&sdata->dec_tailroom_needed_wk,
542 HZ/2); 569 HZ/2);
543 } else { 570 } else {
544 sdata->crypto_tx_tailroom_needed_cnt--; 571 decrease_tailroom_need_count(sdata, 1);
545 } 572 }
546 } 573 }
547 574
@@ -631,6 +658,7 @@ void ieee80211_key_free(struct ieee80211_key *key, bool delay_tailroom)
631void ieee80211_enable_keys(struct ieee80211_sub_if_data *sdata) 658void ieee80211_enable_keys(struct ieee80211_sub_if_data *sdata)
632{ 659{
633 struct ieee80211_key *key; 660 struct ieee80211_key *key;
661 struct ieee80211_sub_if_data *vlan;
634 662
635 ASSERT_RTNL(); 663 ASSERT_RTNL();
636 664
@@ -639,7 +667,14 @@ void ieee80211_enable_keys(struct ieee80211_sub_if_data *sdata)
639 667
640 mutex_lock(&sdata->local->key_mtx); 668 mutex_lock(&sdata->local->key_mtx);
641 669
642 sdata->crypto_tx_tailroom_needed_cnt = 0; 670 WARN_ON_ONCE(sdata->crypto_tx_tailroom_needed_cnt ||
671 sdata->crypto_tx_tailroom_pending_dec);
672
673 if (sdata->vif.type == NL80211_IFTYPE_AP) {
674 list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list)
675 WARN_ON_ONCE(vlan->crypto_tx_tailroom_needed_cnt ||
676 vlan->crypto_tx_tailroom_pending_dec);
677 }
643 678
644 list_for_each_entry(key, &sdata->key_list, list) { 679 list_for_each_entry(key, &sdata->key_list, list) {
645 increment_tailroom_need_count(sdata); 680 increment_tailroom_need_count(sdata);
@@ -649,6 +684,22 @@ void ieee80211_enable_keys(struct ieee80211_sub_if_data *sdata)
649 mutex_unlock(&sdata->local->key_mtx); 684 mutex_unlock(&sdata->local->key_mtx);
650} 685}
651 686
687void ieee80211_reset_crypto_tx_tailroom(struct ieee80211_sub_if_data *sdata)
688{
689 struct ieee80211_sub_if_data *vlan;
690
691 mutex_lock(&sdata->local->key_mtx);
692
693 sdata->crypto_tx_tailroom_needed_cnt = 0;
694
695 if (sdata->vif.type == NL80211_IFTYPE_AP) {
696 list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list)
697 vlan->crypto_tx_tailroom_needed_cnt = 0;
698 }
699
700 mutex_unlock(&sdata->local->key_mtx);
701}
702
652void ieee80211_iter_keys(struct ieee80211_hw *hw, 703void ieee80211_iter_keys(struct ieee80211_hw *hw,
653 struct ieee80211_vif *vif, 704 struct ieee80211_vif *vif,
654 void (*iter)(struct ieee80211_hw *hw, 705 void (*iter)(struct ieee80211_hw *hw,
@@ -688,8 +739,8 @@ static void ieee80211_free_keys_iface(struct ieee80211_sub_if_data *sdata,
688{ 739{
689 struct ieee80211_key *key, *tmp; 740 struct ieee80211_key *key, *tmp;
690 741
691 sdata->crypto_tx_tailroom_needed_cnt -= 742 decrease_tailroom_need_count(sdata,
692 sdata->crypto_tx_tailroom_pending_dec; 743 sdata->crypto_tx_tailroom_pending_dec);
693 sdata->crypto_tx_tailroom_pending_dec = 0; 744 sdata->crypto_tx_tailroom_pending_dec = 0;
694 745
695 ieee80211_debugfs_key_remove_mgmt_default(sdata); 746 ieee80211_debugfs_key_remove_mgmt_default(sdata);
@@ -709,6 +760,7 @@ void ieee80211_free_keys(struct ieee80211_sub_if_data *sdata,
709{ 760{
710 struct ieee80211_local *local = sdata->local; 761 struct ieee80211_local *local = sdata->local;
711 struct ieee80211_sub_if_data *vlan; 762 struct ieee80211_sub_if_data *vlan;
763 struct ieee80211_sub_if_data *master;
712 struct ieee80211_key *key, *tmp; 764 struct ieee80211_key *key, *tmp;
713 LIST_HEAD(keys); 765 LIST_HEAD(keys);
714 766
@@ -728,8 +780,20 @@ void ieee80211_free_keys(struct ieee80211_sub_if_data *sdata,
728 list_for_each_entry_safe(key, tmp, &keys, list) 780 list_for_each_entry_safe(key, tmp, &keys, list)
729 __ieee80211_key_destroy(key, false); 781 __ieee80211_key_destroy(key, false);
730 782
731 WARN_ON_ONCE(sdata->crypto_tx_tailroom_needed_cnt || 783 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
732 sdata->crypto_tx_tailroom_pending_dec); 784 if (sdata->bss) {
785 master = container_of(sdata->bss,
786 struct ieee80211_sub_if_data,
787 u.ap);
788
789 WARN_ON_ONCE(sdata->crypto_tx_tailroom_needed_cnt !=
790 master->crypto_tx_tailroom_needed_cnt);
791 }
792 } else {
793 WARN_ON_ONCE(sdata->crypto_tx_tailroom_needed_cnt ||
794 sdata->crypto_tx_tailroom_pending_dec);
795 }
796
733 if (sdata->vif.type == NL80211_IFTYPE_AP) { 797 if (sdata->vif.type == NL80211_IFTYPE_AP) {
734 list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list) 798 list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list)
735 WARN_ON_ONCE(vlan->crypto_tx_tailroom_needed_cnt || 799 WARN_ON_ONCE(vlan->crypto_tx_tailroom_needed_cnt ||
@@ -793,8 +857,8 @@ void ieee80211_delayed_tailroom_dec(struct work_struct *wk)
793 */ 857 */
794 858
795 mutex_lock(&sdata->local->key_mtx); 859 mutex_lock(&sdata->local->key_mtx);
796 sdata->crypto_tx_tailroom_needed_cnt -= 860 decrease_tailroom_need_count(sdata,
797 sdata->crypto_tx_tailroom_pending_dec; 861 sdata->crypto_tx_tailroom_pending_dec);
798 sdata->crypto_tx_tailroom_pending_dec = 0; 862 sdata->crypto_tx_tailroom_pending_dec = 0;
799 mutex_unlock(&sdata->local->key_mtx); 863 mutex_unlock(&sdata->local->key_mtx);
800} 864}
diff --git a/net/mac80211/key.h b/net/mac80211/key.h
index c5a31835be0e..96557dd1e77d 100644
--- a/net/mac80211/key.h
+++ b/net/mac80211/key.h
@@ -161,6 +161,7 @@ void ieee80211_free_keys(struct ieee80211_sub_if_data *sdata,
161void ieee80211_free_sta_keys(struct ieee80211_local *local, 161void ieee80211_free_sta_keys(struct ieee80211_local *local,
162 struct sta_info *sta); 162 struct sta_info *sta);
163void ieee80211_enable_keys(struct ieee80211_sub_if_data *sdata); 163void ieee80211_enable_keys(struct ieee80211_sub_if_data *sdata);
164void ieee80211_reset_crypto_tx_tailroom(struct ieee80211_sub_if_data *sdata);
164 165
165#define key_mtx_dereference(local, ref) \ 166#define key_mtx_dereference(local, ref) \
166 rcu_dereference_protected(ref, lockdep_is_held(&((local)->key_mtx))) 167 rcu_dereference_protected(ref, lockdep_is_held(&((local)->key_mtx)))
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 260eed45b6d2..5793f75c5ffd 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -2121,7 +2121,8 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx)
2121 /* deliver to local stack */ 2121 /* deliver to local stack */
2122 skb->protocol = eth_type_trans(skb, dev); 2122 skb->protocol = eth_type_trans(skb, dev);
2123 memset(skb->cb, 0, sizeof(skb->cb)); 2123 memset(skb->cb, 0, sizeof(skb->cb));
2124 if (rx->local->napi) 2124 if (!(rx->flags & IEEE80211_RX_REORDER_TIMER) &&
2125 rx->local->napi)
2125 napi_gro_receive(rx->local->napi, skb); 2126 napi_gro_receive(rx->local->napi, skb);
2126 else 2127 else
2127 netif_receive_skb(skb); 2128 netif_receive_skb(skb);
@@ -3231,7 +3232,7 @@ void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid)
3231 /* This is OK -- must be QoS data frame */ 3232 /* This is OK -- must be QoS data frame */
3232 .security_idx = tid, 3233 .security_idx = tid,
3233 .seqno_idx = tid, 3234 .seqno_idx = tid,
3234 .flags = 0, 3235 .flags = IEEE80211_RX_REORDER_TIMER,
3235 }; 3236 };
3236 struct tid_ampdu_rx *tid_agg_rx; 3237 struct tid_ampdu_rx *tid_agg_rx;
3237 3238
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 79412f16b61d..b864ebc6ab8f 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -2023,6 +2023,9 @@ int ieee80211_reconfig(struct ieee80211_local *local)
2023 2023
2024 /* add back keys */ 2024 /* add back keys */
2025 list_for_each_entry(sdata, &local->interfaces, list) 2025 list_for_each_entry(sdata, &local->interfaces, list)
2026 ieee80211_reset_crypto_tx_tailroom(sdata);
2027
2028 list_for_each_entry(sdata, &local->interfaces, list)
2026 if (ieee80211_sdata_running(sdata)) 2029 if (ieee80211_sdata_running(sdata))
2027 ieee80211_enable_keys(sdata); 2030 ieee80211_enable_keys(sdata);
2028 2031
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index ad9eed70bc8f..1e1c89e51a11 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -815,10 +815,8 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent,
815 if (dev->flags & IFF_UP) 815 if (dev->flags & IFF_UP)
816 dev_deactivate(dev); 816 dev_deactivate(dev);
817 817
818 if (new && new->ops->attach) { 818 if (new && new->ops->attach)
819 new->ops->attach(new); 819 goto skip;
820 num_q = 0;
821 }
822 820
823 for (i = 0; i < num_q; i++) { 821 for (i = 0; i < num_q; i++) {
824 struct netdev_queue *dev_queue = dev_ingress_queue(dev); 822 struct netdev_queue *dev_queue = dev_ingress_queue(dev);
@@ -834,12 +832,16 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent,
834 qdisc_destroy(old); 832 qdisc_destroy(old);
835 } 833 }
836 834
835skip:
837 if (!ingress) { 836 if (!ingress) {
838 notify_and_destroy(net, skb, n, classid, 837 notify_and_destroy(net, skb, n, classid,
839 dev->qdisc, new); 838 dev->qdisc, new);
840 if (new && !new->ops->attach) 839 if (new && !new->ops->attach)
841 atomic_inc(&new->refcnt); 840 atomic_inc(&new->refcnt);
842 dev->qdisc = new ? : &noop_qdisc; 841 dev->qdisc = new ? : &noop_qdisc;
842
843 if (new && new->ops->attach)
844 new->ops->attach(new);
843 } else { 845 } else {
844 notify_and_destroy(net, skb, n, classid, old, new); 846 notify_and_destroy(net, skb, n, classid, old, new);
845 } 847 }
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 5266ea7b922b..06430598cf51 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -1880,6 +1880,10 @@ static long unix_stream_data_wait(struct sock *sk, long timeo,
1880 unix_state_unlock(sk); 1880 unix_state_unlock(sk);
1881 timeo = freezable_schedule_timeout(timeo); 1881 timeo = freezable_schedule_timeout(timeo);
1882 unix_state_lock(sk); 1882 unix_state_lock(sk);
1883
1884 if (sock_flag(sk, SOCK_DEAD))
1885 break;
1886
1883 clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags); 1887 clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);
1884 } 1888 }
1885 1889
@@ -1939,6 +1943,10 @@ static int unix_stream_recvmsg(struct socket *sock, struct msghdr *msg,
1939 struct sk_buff *skb, *last; 1943 struct sk_buff *skb, *last;
1940 1944
1941 unix_state_lock(sk); 1945 unix_state_lock(sk);
1946 if (sock_flag(sk, SOCK_DEAD)) {
1947 err = -ECONNRESET;
1948 goto unlock;
1949 }
1942 last = skb = skb_peek(&sk->sk_receive_queue); 1950 last = skb = skb_peek(&sk->sk_receive_queue);
1943again: 1951again:
1944 if (skb == NULL) { 1952 if (skb == NULL) {
diff --git a/tools/net/bpf_jit_disasm.c b/tools/net/bpf_jit_disasm.c
index c5baf9c591b7..618c2bcd4eab 100644
--- a/tools/net/bpf_jit_disasm.c
+++ b/tools/net/bpf_jit_disasm.c
@@ -123,6 +123,8 @@ static int get_last_jit_image(char *haystack, size_t hlen,
123 assert(ret == 0); 123 assert(ret == 0);
124 124
125 ptr = haystack; 125 ptr = haystack;
126 memset(pmatch, 0, sizeof(pmatch));
127
126 while (1) { 128 while (1) {
127 ret = regexec(&regex, ptr, 1, pmatch, 0); 129 ret = regexec(&regex, ptr, 1, pmatch, 0);
128 if (ret == 0) { 130 if (ret == 0) {