aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-04-27 17:05:19 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-04-27 17:05:19 -0400
commit2decb2682f80759f631c8332f9a2a34a02150a03 (patch)
tree6c30015e4118ff6a56c67043f2ba842ed4a6e011 /drivers/net
parentb787f68c36d49bb1d9236f403813641efa74a031 (diff)
parent22a8f237c0551bae95ffcd2a7ff17d6f5fcce7e7 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) mlx4 doesn't check fully for supported valid RSS hash function, fix from Amir Vadai 2) Off by one in ibmveth_change_mtu(), from David Gibson 3) Prevent altera chip from reporting false error interrupts in some circumstances, from Chee Nouk Phoon 4) Get rid of that stupid endless loop trying to allocate a FIN packet in TCP, and in the process kill deadlocks. From Eric Dumazet 5) Fix get_rps_cpus() crash due to wrong invalid-cpu value, also from Eric Dumazet 6) Fix two bugs in async rhashtable resizing, from Thomas Graf 7) Fix topology server listener socket namespace bug in TIPC, from Ying Xue 8) Add some missing HAS_DMA kconfig dependencies, from Geert Uytterhoeven 9) bgmac driver intends to force re-polling but does so by returning the wrong value from it's ->poll() handler. Fix from Rafał Miłecki 10) When the creater of an rhashtable configures a max size for it, don't bark in the logs and drop insertions when that is exceeded. Fix from Johannes Berg 11) Recover from out of order packets in ppp mppe properly, from Sylvain Rochet * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (41 commits) bnx2x: really disable TPA if 'disable_tpa' option is set net:treewide: Fix typo in drivers/net net/mlx4_en: Prevent setting invalid RSS hash function mdio-mux-gpio: use new gpiod_get_array and gpiod_put_array functions netfilter; Add some missing default cases to switch statements in nft_reject. ppp: mppe: discard late packet in stateless mode ppp: mppe: sanity error path rework net/bonding: Make DRV macros private net: rfs: fix crash in get_rps_cpus() altera tse: add support for fixed-links. pxa168: fix double deallocation of managed resources net: fix crash in build_skb() net: eth: altera: Resolve false errors from MSGDMA to TSE ehea: Fix memory hook reference counting crashes net/tg3: Release IRQs on permanent error net: mdio-gpio: support access that may sleep inet: fix possible panic in reqsk_queue_unlink() rhashtable: don't attempt to grow when at max_size bgmac: fix requests for extra polling calls from NAPI tcp: avoid looping in tcp_send_fin() ...
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/bonding/bond_main.c2
-rw-r--r--drivers/net/bonding/bond_procfs.c1
-rw-r--r--drivers/net/bonding/bonding_priv.h25
-rw-r--r--drivers/net/can/Kconfig2
-rw-r--r--drivers/net/can/usb/kvaser_usb.c2
-rw-r--r--drivers/net/ethernet/8390/etherh.c2
-rw-r--r--drivers/net/ethernet/altera/altera_msgdmahw.h5
-rw-r--r--drivers/net/ethernet/altera/altera_tse_main.c37
-rw-r--r--drivers/net/ethernet/amd/Kconfig2
-rw-r--r--drivers/net/ethernet/arc/Kconfig5
-rw-r--r--drivers/net/ethernet/broadcom/bgmac.c2
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c49
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c17
-rw-r--r--drivers/net/ethernet/broadcom/tg3.c4
-rw-r--r--drivers/net/ethernet/cadence/macb.c4
-rw-r--r--drivers/net/ethernet/ibm/ehea/ehea_main.c6
-rw-r--r--drivers/net/ethernet/ibm/ibmveth.c4
-rw-r--r--drivers/net/ethernet/marvell/pxa168_eth.c16
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_ethtool.c29
-rw-r--r--drivers/net/ethernet/myricom/myri10ge/myri10ge.c38
-rw-r--r--drivers/net/phy/mdio-gpio.c14
-rw-r--r--drivers/net/phy/mdio-mux-gpio.c60
-rw-r--r--drivers/net/ppp/ppp_mppe.c36
-rw-r--r--drivers/net/vxlan.c6
24 files changed, 208 insertions, 160 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 78dde56ae6e6..3a10551d64cf 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -82,6 +82,8 @@
82#include <net/bond_3ad.h> 82#include <net/bond_3ad.h>
83#include <net/bond_alb.h> 83#include <net/bond_alb.h>
84 84
85#include "bonding_priv.h"
86
85/*---------------------------- Module parameters ----------------------------*/ 87/*---------------------------- Module parameters ----------------------------*/
86 88
87/* monitor all links that often (in milliseconds). <=0 disables monitoring */ 89/* monitor all links that often (in milliseconds). <=0 disables monitoring */
diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c
index 62694cfc05b6..b20b35acb47d 100644
--- a/drivers/net/bonding/bond_procfs.c
+++ b/drivers/net/bonding/bond_procfs.c
@@ -4,6 +4,7 @@
4#include <net/netns/generic.h> 4#include <net/netns/generic.h>
5#include <net/bonding.h> 5#include <net/bonding.h>
6 6
7#include "bonding_priv.h"
7 8
8static void *bond_info_seq_start(struct seq_file *seq, loff_t *pos) 9static void *bond_info_seq_start(struct seq_file *seq, loff_t *pos)
9 __acquires(RCU) 10 __acquires(RCU)
diff --git a/drivers/net/bonding/bonding_priv.h b/drivers/net/bonding/bonding_priv.h
new file mode 100644
index 000000000000..5a4d81a9437c
--- /dev/null
+++ b/drivers/net/bonding/bonding_priv.h
@@ -0,0 +1,25 @@
1/*
2 * Bond several ethernet interfaces into a Cisco, running 'Etherchannel'.
3 *
4 * Portions are (c) Copyright 1995 Simon "Guru Aleph-Null" Janes
5 * NCM: Network and Communications Management, Inc.
6 *
7 * BUT, I'm the one who modified it for ethernet, so:
8 * (c) Copyright 1999, Thomas Davis, tadavis@lbl.gov
9 *
10 * This software may be used and distributed according to the terms
11 * of the GNU Public License, incorporated herein by reference.
12 *
13 */
14
15#ifndef _BONDING_PRIV_H
16#define _BONDING_PRIV_H
17
18#define DRV_VERSION "3.7.1"
19#define DRV_RELDATE "April 27, 2011"
20#define DRV_NAME "bonding"
21#define DRV_DESCRIPTION "Ethernet Channel Bonding Driver"
22
23#define bond_version DRV_DESCRIPTION ": v" DRV_VERSION " (" DRV_RELDATE ")\n"
24
25#endif
diff --git a/drivers/net/can/Kconfig b/drivers/net/can/Kconfig
index 58808f651452..e8c96b8e86f4 100644
--- a/drivers/net/can/Kconfig
+++ b/drivers/net/can/Kconfig
@@ -112,7 +112,7 @@ config PCH_CAN
112 112
113config CAN_GRCAN 113config CAN_GRCAN
114 tristate "Aeroflex Gaisler GRCAN and GRHCAN CAN devices" 114 tristate "Aeroflex Gaisler GRCAN and GRHCAN CAN devices"
115 depends on OF 115 depends on OF && HAS_DMA
116 ---help--- 116 ---help---
117 Say Y here if you want to use Aeroflex Gaisler GRCAN or GRHCAN. 117 Say Y here if you want to use Aeroflex Gaisler GRCAN or GRHCAN.
118 Note that the driver supports little endian, even though little 118 Note that the driver supports little endian, even though little
diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c
index 4643914859b2..8b17a9065b0b 100644
--- a/drivers/net/can/usb/kvaser_usb.c
+++ b/drivers/net/can/usb/kvaser_usb.c
@@ -1102,7 +1102,7 @@ static void kvaser_usb_rx_can_err(const struct kvaser_usb_net_priv *priv,
1102 1102
1103 if (msg->u.rx_can_header.flag & (MSG_FLAG_ERROR_FRAME | 1103 if (msg->u.rx_can_header.flag & (MSG_FLAG_ERROR_FRAME |
1104 MSG_FLAG_NERR)) { 1104 MSG_FLAG_NERR)) {
1105 netdev_err(priv->netdev, "Unknow error (flags: 0x%02x)\n", 1105 netdev_err(priv->netdev, "Unknown error (flags: 0x%02x)\n",
1106 msg->u.rx_can_header.flag); 1106 msg->u.rx_can_header.flag);
1107 1107
1108 stats->rx_errors++; 1108 stats->rx_errors++;
diff --git a/drivers/net/ethernet/8390/etherh.c b/drivers/net/ethernet/8390/etherh.c
index b36ee9e0d220..d686b9cac29f 100644
--- a/drivers/net/ethernet/8390/etherh.c
+++ b/drivers/net/ethernet/8390/etherh.c
@@ -523,7 +523,7 @@ static int etherh_addr(char *addr, struct expansion_card *ec)
523 char *s; 523 char *s;
524 524
525 if (!ecard_readchunk(&cd, ec, 0xf5, 0)) { 525 if (!ecard_readchunk(&cd, ec, 0xf5, 0)) {
526 printk(KERN_ERR "%s: unable to read podule description string\n", 526 printk(KERN_ERR "%s: unable to read module description string\n",
527 dev_name(&ec->dev)); 527 dev_name(&ec->dev));
528 goto no_addr; 528 goto no_addr;
529 } 529 }
diff --git a/drivers/net/ethernet/altera/altera_msgdmahw.h b/drivers/net/ethernet/altera/altera_msgdmahw.h
index eba070f16782..89cd11d86642 100644
--- a/drivers/net/ethernet/altera/altera_msgdmahw.h
+++ b/drivers/net/ethernet/altera/altera_msgdmahw.h
@@ -58,15 +58,12 @@ struct msgdma_extended_desc {
58/* Tx buffer control flags 58/* Tx buffer control flags
59 */ 59 */
60#define MSGDMA_DESC_CTL_TX_FIRST (MSGDMA_DESC_CTL_GEN_SOP | \ 60#define MSGDMA_DESC_CTL_TX_FIRST (MSGDMA_DESC_CTL_GEN_SOP | \
61 MSGDMA_DESC_CTL_TR_ERR_IRQ | \
62 MSGDMA_DESC_CTL_GO) 61 MSGDMA_DESC_CTL_GO)
63 62
64#define MSGDMA_DESC_CTL_TX_MIDDLE (MSGDMA_DESC_CTL_TR_ERR_IRQ | \ 63#define MSGDMA_DESC_CTL_TX_MIDDLE (MSGDMA_DESC_CTL_GO)
65 MSGDMA_DESC_CTL_GO)
66 64
67#define MSGDMA_DESC_CTL_TX_LAST (MSGDMA_DESC_CTL_GEN_EOP | \ 65#define MSGDMA_DESC_CTL_TX_LAST (MSGDMA_DESC_CTL_GEN_EOP | \
68 MSGDMA_DESC_CTL_TR_COMP_IRQ | \ 66 MSGDMA_DESC_CTL_TR_COMP_IRQ | \
69 MSGDMA_DESC_CTL_TR_ERR_IRQ | \
70 MSGDMA_DESC_CTL_GO) 67 MSGDMA_DESC_CTL_GO)
71 68
72#define MSGDMA_DESC_CTL_TX_SINGLE (MSGDMA_DESC_CTL_GEN_SOP | \ 69#define MSGDMA_DESC_CTL_TX_SINGLE (MSGDMA_DESC_CTL_GEN_SOP | \
diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/ethernet/altera/altera_tse_main.c
index 90a76306ad0f..0533c051a3e5 100644
--- a/drivers/net/ethernet/altera/altera_tse_main.c
+++ b/drivers/net/ethernet/altera/altera_tse_main.c
@@ -777,6 +777,8 @@ static int init_phy(struct net_device *dev)
777 struct altera_tse_private *priv = netdev_priv(dev); 777 struct altera_tse_private *priv = netdev_priv(dev);
778 struct phy_device *phydev; 778 struct phy_device *phydev;
779 struct device_node *phynode; 779 struct device_node *phynode;
780 bool fixed_link = false;
781 int rc = 0;
780 782
781 /* Avoid init phy in case of no phy present */ 783 /* Avoid init phy in case of no phy present */
782 if (!priv->phy_iface) 784 if (!priv->phy_iface)
@@ -789,13 +791,32 @@ static int init_phy(struct net_device *dev)
789 phynode = of_parse_phandle(priv->device->of_node, "phy-handle", 0); 791 phynode = of_parse_phandle(priv->device->of_node, "phy-handle", 0);
790 792
791 if (!phynode) { 793 if (!phynode) {
792 netdev_dbg(dev, "no phy-handle found\n"); 794 /* check if a fixed-link is defined in device-tree */
793 if (!priv->mdio) { 795 if (of_phy_is_fixed_link(priv->device->of_node)) {
794 netdev_err(dev, 796 rc = of_phy_register_fixed_link(priv->device->of_node);
795 "No phy-handle nor local mdio specified\n"); 797 if (rc < 0) {
796 return -ENODEV; 798 netdev_err(dev, "cannot register fixed PHY\n");
799 return rc;
800 }
801
802 /* In the case of a fixed PHY, the DT node associated
803 * to the PHY is the Ethernet MAC DT node.
804 */
805 phynode = of_node_get(priv->device->of_node);
806 fixed_link = true;
807
808 netdev_dbg(dev, "fixed-link detected\n");
809 phydev = of_phy_connect(dev, phynode,
810 &altera_tse_adjust_link,
811 0, priv->phy_iface);
812 } else {
813 netdev_dbg(dev, "no phy-handle found\n");
814 if (!priv->mdio) {
815 netdev_err(dev, "No phy-handle nor local mdio specified\n");
816 return -ENODEV;
817 }
818 phydev = connect_local_phy(dev);
797 } 819 }
798 phydev = connect_local_phy(dev);
799 } else { 820 } else {
800 netdev_dbg(dev, "phy-handle found\n"); 821 netdev_dbg(dev, "phy-handle found\n");
801 phydev = of_phy_connect(dev, phynode, 822 phydev = of_phy_connect(dev, phynode,
@@ -819,10 +840,10 @@ static int init_phy(struct net_device *dev)
819 /* Broken HW is sometimes missing the pull-up resistor on the 840 /* Broken HW is sometimes missing the pull-up resistor on the
820 * MDIO line, which results in reads to non-existent devices returning 841 * MDIO line, which results in reads to non-existent devices returning
821 * 0 rather than 0xffff. Catch this here and treat 0 as a non-existent 842 * 0 rather than 0xffff. Catch this here and treat 0 as a non-existent
822 * device as well. 843 * device as well. If a fixed-link is used the phy_id is always 0.
823 * Note: phydev->phy_id is the result of reading the UID PHY registers. 844 * Note: phydev->phy_id is the result of reading the UID PHY registers.
824 */ 845 */
825 if (phydev->phy_id == 0) { 846 if ((phydev->phy_id == 0) && !fixed_link) {
826 netdev_err(dev, "Bad PHY UID 0x%08x\n", phydev->phy_id); 847 netdev_err(dev, "Bad PHY UID 0x%08x\n", phydev->phy_id);
827 phy_disconnect(phydev); 848 phy_disconnect(phydev);
828 return -ENODEV; 849 return -ENODEV;
diff --git a/drivers/net/ethernet/amd/Kconfig b/drivers/net/ethernet/amd/Kconfig
index c638c85f3954..089c269637b7 100644
--- a/drivers/net/ethernet/amd/Kconfig
+++ b/drivers/net/ethernet/amd/Kconfig
@@ -179,7 +179,7 @@ config SUNLANCE
179 179
180config AMD_XGBE 180config AMD_XGBE
181 tristate "AMD 10GbE Ethernet driver" 181 tristate "AMD 10GbE Ethernet driver"
182 depends on (OF_NET || ACPI) && HAS_IOMEM 182 depends on (OF_NET || ACPI) && HAS_IOMEM && HAS_DMA
183 select PHYLIB 183 select PHYLIB
184 select AMD_XGBE_PHY 184 select AMD_XGBE_PHY
185 select BITREVERSE 185 select BITREVERSE
diff --git a/drivers/net/ethernet/arc/Kconfig b/drivers/net/ethernet/arc/Kconfig
index 8e262e2b39b6..dea29ee24da4 100644
--- a/drivers/net/ethernet/arc/Kconfig
+++ b/drivers/net/ethernet/arc/Kconfig
@@ -25,8 +25,7 @@ config ARC_EMAC_CORE
25config ARC_EMAC 25config ARC_EMAC
26 tristate "ARC EMAC support" 26 tristate "ARC EMAC support"
27 select ARC_EMAC_CORE 27 select ARC_EMAC_CORE
28 depends on OF_IRQ 28 depends on OF_IRQ && OF_NET && HAS_DMA
29 depends on OF_NET
30 ---help--- 29 ---help---
31 On some legacy ARC (Synopsys) FPGA boards such as ARCAngel4/ML50x 30 On some legacy ARC (Synopsys) FPGA boards such as ARCAngel4/ML50x
32 non-standard on-chip ethernet device ARC EMAC 10/100 is used. 31 non-standard on-chip ethernet device ARC EMAC 10/100 is used.
@@ -35,7 +34,7 @@ config ARC_EMAC
35config EMAC_ROCKCHIP 34config EMAC_ROCKCHIP
36 tristate "Rockchip EMAC support" 35 tristate "Rockchip EMAC support"
37 select ARC_EMAC_CORE 36 select ARC_EMAC_CORE
38 depends on OF_IRQ && OF_NET && REGULATOR 37 depends on OF_IRQ && OF_NET && REGULATOR && HAS_DMA
39 ---help--- 38 ---help---
40 Support for Rockchip RK3066/RK3188 EMAC ethernet controllers. 39 Support for Rockchip RK3066/RK3188 EMAC ethernet controllers.
41 This selects Rockchip SoC glue layer support for the 40 This selects Rockchip SoC glue layer support for the
diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c
index de77d3a74abc..21e3c38c7c75 100644
--- a/drivers/net/ethernet/broadcom/bgmac.c
+++ b/drivers/net/ethernet/broadcom/bgmac.c
@@ -1260,7 +1260,7 @@ static int bgmac_poll(struct napi_struct *napi, int weight)
1260 1260
1261 /* Poll again if more events arrived in the meantime */ 1261 /* Poll again if more events arrived in the meantime */
1262 if (bgmac_read(bgmac, BGMAC_INT_STATUS) & (BGMAC_IS_TX0 | BGMAC_IS_RX)) 1262 if (bgmac_read(bgmac, BGMAC_INT_STATUS) & (BGMAC_IS_TX0 | BGMAC_IS_RX))
1263 return handled; 1263 return weight;
1264 1264
1265 if (handled < weight) { 1265 if (handled < weight) {
1266 napi_complete(napi); 1266 napi_complete(napi);
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index 2f63467bce46..3558a36b1c2d 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -2485,8 +2485,10 @@ static void bnx2x_bz_fp(struct bnx2x *bp, int index)
2485 else if (bp->flags & GRO_ENABLE_FLAG) 2485 else if (bp->flags & GRO_ENABLE_FLAG)
2486 fp->mode = TPA_MODE_GRO; 2486 fp->mode = TPA_MODE_GRO;
2487 2487
2488 /* We don't want TPA on an FCoE L2 ring */ 2488 /* We don't want TPA if it's disabled in bp
2489 if (IS_FCOE_FP(fp)) 2489 * or if this is an FCoE L2 ring.
2490 */
2491 if (bp->disable_tpa || IS_FCOE_FP(fp))
2490 fp->disable_tpa = 1; 2492 fp->disable_tpa = 1;
2491} 2493}
2492 2494
@@ -4809,6 +4811,23 @@ netdev_features_t bnx2x_fix_features(struct net_device *dev,
4809{ 4811{
4810 struct bnx2x *bp = netdev_priv(dev); 4812 struct bnx2x *bp = netdev_priv(dev);
4811 4813
4814 if (pci_num_vf(bp->pdev)) {
4815 netdev_features_t changed = dev->features ^ features;
4816
4817 /* Revert the requested changes in features if they
4818 * would require internal reload of PF in bnx2x_set_features().
4819 */
4820 if (!(features & NETIF_F_RXCSUM) && !bp->disable_tpa) {
4821 features &= ~NETIF_F_RXCSUM;
4822 features |= dev->features & NETIF_F_RXCSUM;
4823 }
4824
4825 if (changed & NETIF_F_LOOPBACK) {
4826 features &= ~NETIF_F_LOOPBACK;
4827 features |= dev->features & NETIF_F_LOOPBACK;
4828 }
4829 }
4830
4812 /* TPA requires Rx CSUM offloading */ 4831 /* TPA requires Rx CSUM offloading */
4813 if (!(features & NETIF_F_RXCSUM)) { 4832 if (!(features & NETIF_F_RXCSUM)) {
4814 features &= ~NETIF_F_LRO; 4833 features &= ~NETIF_F_LRO;
@@ -4839,15 +4858,18 @@ int bnx2x_set_features(struct net_device *dev, netdev_features_t features)
4839 else 4858 else
4840 flags &= ~GRO_ENABLE_FLAG; 4859 flags &= ~GRO_ENABLE_FLAG;
4841 4860
4842 if (features & NETIF_F_LOOPBACK) { 4861 /* VFs or non SRIOV PFs should be able to change loopback feature */
4843 if (bp->link_params.loopback_mode != LOOPBACK_BMAC) { 4862 if (!pci_num_vf(bp->pdev)) {
4844 bp->link_params.loopback_mode = LOOPBACK_BMAC; 4863 if (features & NETIF_F_LOOPBACK) {
4845 bnx2x_reload = true; 4864 if (bp->link_params.loopback_mode != LOOPBACK_BMAC) {
4846 } 4865 bp->link_params.loopback_mode = LOOPBACK_BMAC;
4847 } else { 4866 bnx2x_reload = true;
4848 if (bp->link_params.loopback_mode != LOOPBACK_NONE) { 4867 }
4849 bp->link_params.loopback_mode = LOOPBACK_NONE; 4868 } else {
4850 bnx2x_reload = true; 4869 if (bp->link_params.loopback_mode != LOOPBACK_NONE) {
4870 bp->link_params.loopback_mode = LOOPBACK_NONE;
4871 bnx2x_reload = true;
4872 }
4851 } 4873 }
4852 } 4874 }
4853 4875
@@ -4931,6 +4953,11 @@ int bnx2x_resume(struct pci_dev *pdev)
4931 } 4953 }
4932 bp = netdev_priv(dev); 4954 bp = netdev_priv(dev);
4933 4955
4956 if (pci_num_vf(bp->pdev)) {
4957 DP(BNX2X_MSG_IOV, "VFs are enabled, can not change MTU\n");
4958 return -EPERM;
4959 }
4960
4934 if (bp->recovery_state != BNX2X_RECOVERY_DONE) { 4961 if (bp->recovery_state != BNX2X_RECOVERY_DONE) {
4935 BNX2X_ERR("Handling parity error recovery. Try again later\n"); 4962 BNX2X_ERR("Handling parity error recovery. Try again later\n");
4936 return -EAGAIN; 4963 return -EAGAIN;
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
index e3d853cab7c9..48ed005ba73f 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
@@ -1843,6 +1843,12 @@ static int bnx2x_set_ringparam(struct net_device *dev,
1843 "set ring params command parameters: rx_pending = %d, tx_pending = %d\n", 1843 "set ring params command parameters: rx_pending = %d, tx_pending = %d\n",
1844 ering->rx_pending, ering->tx_pending); 1844 ering->rx_pending, ering->tx_pending);
1845 1845
1846 if (pci_num_vf(bp->pdev)) {
1847 DP(BNX2X_MSG_IOV,
1848 "VFs are enabled, can not change ring parameters\n");
1849 return -EPERM;
1850 }
1851
1846 if (bp->recovery_state != BNX2X_RECOVERY_DONE) { 1852 if (bp->recovery_state != BNX2X_RECOVERY_DONE) {
1847 DP(BNX2X_MSG_ETHTOOL, 1853 DP(BNX2X_MSG_ETHTOOL,
1848 "Handling parity error recovery. Try again later\n"); 1854 "Handling parity error recovery. Try again later\n");
@@ -2899,6 +2905,12 @@ static void bnx2x_self_test(struct net_device *dev,
2899 u8 is_serdes, link_up; 2905 u8 is_serdes, link_up;
2900 int rc, cnt = 0; 2906 int rc, cnt = 0;
2901 2907
2908 if (pci_num_vf(bp->pdev)) {
2909 DP(BNX2X_MSG_IOV,
2910 "VFs are enabled, can not perform self test\n");
2911 return;
2912 }
2913
2902 if (bp->recovery_state != BNX2X_RECOVERY_DONE) { 2914 if (bp->recovery_state != BNX2X_RECOVERY_DONE) {
2903 netdev_err(bp->dev, 2915 netdev_err(bp->dev,
2904 "Handling parity error recovery. Try again later\n"); 2916 "Handling parity error recovery. Try again later\n");
@@ -3468,6 +3480,11 @@ static int bnx2x_set_channels(struct net_device *dev,
3468 channels->rx_count, channels->tx_count, channels->other_count, 3480 channels->rx_count, channels->tx_count, channels->other_count,
3469 channels->combined_count); 3481 channels->combined_count);
3470 3482
3483 if (pci_num_vf(bp->pdev)) {
3484 DP(BNX2X_MSG_IOV, "VFs are enabled, can not set channels\n");
3485 return -EPERM;
3486 }
3487
3471 /* We don't support separate rx / tx channels. 3488 /* We don't support separate rx / tx channels.
3472 * We don't allow setting 'other' channels. 3489 * We don't allow setting 'other' channels.
3473 */ 3490 */
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 1270b189a9a2..069952fa5d64 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -18129,7 +18129,9 @@ static pci_ers_result_t tg3_io_error_detected(struct pci_dev *pdev,
18129 18129
18130 rtnl_lock(); 18130 rtnl_lock();
18131 18131
18132 tp->pcierr_recovery = true; 18132 /* We needn't recover from permanent error */
18133 if (state == pci_channel_io_frozen)
18134 tp->pcierr_recovery = true;
18133 18135
18134 /* We probably don't have netdev yet */ 18136 /* We probably don't have netdev yet */
18135 if (!netdev || !netif_running(netdev)) 18137 if (!netdev || !netif_running(netdev))
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index 9f5387249f24..665c29098e3c 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -1473,9 +1473,9 @@ static void macb_init_rings(struct macb *bp)
1473 for (i = 0; i < TX_RING_SIZE; i++) { 1473 for (i = 0; i < TX_RING_SIZE; i++) {
1474 bp->queues[0].tx_ring[i].addr = 0; 1474 bp->queues[0].tx_ring[i].addr = 0;
1475 bp->queues[0].tx_ring[i].ctrl = MACB_BIT(TX_USED); 1475 bp->queues[0].tx_ring[i].ctrl = MACB_BIT(TX_USED);
1476 bp->queues[0].tx_head = 0;
1477 bp->queues[0].tx_tail = 0;
1478 } 1476 }
1477 bp->queues[0].tx_head = 0;
1478 bp->queues[0].tx_tail = 0;
1479 bp->queues[0].tx_ring[TX_RING_SIZE - 1].ctrl |= MACB_BIT(TX_WRAP); 1479 bp->queues[0].tx_ring[TX_RING_SIZE - 1].ctrl |= MACB_BIT(TX_WRAP);
1480 1480
1481 bp->rx_tail = 0; 1481 bp->rx_tail = 0;
diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c
index 291c87036e17..2a0dc127df3f 100644
--- a/drivers/net/ethernet/ibm/ehea/ehea_main.c
+++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c
@@ -3347,7 +3347,7 @@ static int ehea_register_memory_hooks(void)
3347{ 3347{
3348 int ret = 0; 3348 int ret = 0;
3349 3349
3350 if (atomic_inc_and_test(&ehea_memory_hooks_registered)) 3350 if (atomic_inc_return(&ehea_memory_hooks_registered) > 1)
3351 return 0; 3351 return 0;
3352 3352
3353 ret = ehea_create_busmap(); 3353 ret = ehea_create_busmap();
@@ -3381,12 +3381,14 @@ out3:
3381out2: 3381out2:
3382 unregister_reboot_notifier(&ehea_reboot_nb); 3382 unregister_reboot_notifier(&ehea_reboot_nb);
3383out: 3383out:
3384 atomic_dec(&ehea_memory_hooks_registered);
3384 return ret; 3385 return ret;
3385} 3386}
3386 3387
3387static void ehea_unregister_memory_hooks(void) 3388static void ehea_unregister_memory_hooks(void)
3388{ 3389{
3389 if (atomic_read(&ehea_memory_hooks_registered)) 3390 /* Only remove the hooks if we've registered them */
3391 if (atomic_read(&ehea_memory_hooks_registered) == 0)
3390 return; 3392 return;
3391 3393
3392 unregister_reboot_notifier(&ehea_reboot_nb); 3394 unregister_reboot_notifier(&ehea_reboot_nb);
diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
index cd7675ac5bf9..18134766a114 100644
--- a/drivers/net/ethernet/ibm/ibmveth.c
+++ b/drivers/net/ethernet/ibm/ibmveth.c
@@ -1238,7 +1238,7 @@ static int ibmveth_change_mtu(struct net_device *dev, int new_mtu)
1238 return -EINVAL; 1238 return -EINVAL;
1239 1239
1240 for (i = 0; i < IBMVETH_NUM_BUFF_POOLS; i++) 1240 for (i = 0; i < IBMVETH_NUM_BUFF_POOLS; i++)
1241 if (new_mtu_oh < adapter->rx_buff_pool[i].buff_size) 1241 if (new_mtu_oh <= adapter->rx_buff_pool[i].buff_size)
1242 break; 1242 break;
1243 1243
1244 if (i == IBMVETH_NUM_BUFF_POOLS) 1244 if (i == IBMVETH_NUM_BUFF_POOLS)
@@ -1257,7 +1257,7 @@ static int ibmveth_change_mtu(struct net_device *dev, int new_mtu)
1257 for (i = 0; i < IBMVETH_NUM_BUFF_POOLS; i++) { 1257 for (i = 0; i < IBMVETH_NUM_BUFF_POOLS; i++) {
1258 adapter->rx_buff_pool[i].active = 1; 1258 adapter->rx_buff_pool[i].active = 1;
1259 1259
1260 if (new_mtu_oh < adapter->rx_buff_pool[i].buff_size) { 1260 if (new_mtu_oh <= adapter->rx_buff_pool[i].buff_size) {
1261 dev->mtu = new_mtu; 1261 dev->mtu = new_mtu;
1262 vio_cmo_set_dev_desired(viodev, 1262 vio_cmo_set_dev_desired(viodev,
1263 ibmveth_get_desired_dma 1263 ibmveth_get_desired_dma
diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
index af829c578400..7ace07dad6a3 100644
--- a/drivers/net/ethernet/marvell/pxa168_eth.c
+++ b/drivers/net/ethernet/marvell/pxa168_eth.c
@@ -1508,7 +1508,8 @@ static int pxa168_eth_probe(struct platform_device *pdev)
1508 np = of_parse_phandle(pdev->dev.of_node, "phy-handle", 0); 1508 np = of_parse_phandle(pdev->dev.of_node, "phy-handle", 0);
1509 if (!np) { 1509 if (!np) {
1510 dev_err(&pdev->dev, "missing phy-handle\n"); 1510 dev_err(&pdev->dev, "missing phy-handle\n");
1511 return -EINVAL; 1511 err = -EINVAL;
1512 goto err_netdev;
1512 } 1513 }
1513 of_property_read_u32(np, "reg", &pep->phy_addr); 1514 of_property_read_u32(np, "reg", &pep->phy_addr);
1514 pep->phy_intf = of_get_phy_mode(pdev->dev.of_node); 1515 pep->phy_intf = of_get_phy_mode(pdev->dev.of_node);
@@ -1526,7 +1527,7 @@ static int pxa168_eth_probe(struct platform_device *pdev)
1526 pep->smi_bus = mdiobus_alloc(); 1527 pep->smi_bus = mdiobus_alloc();
1527 if (pep->smi_bus == NULL) { 1528 if (pep->smi_bus == NULL) {
1528 err = -ENOMEM; 1529 err = -ENOMEM;
1529 goto err_base; 1530 goto err_netdev;
1530 } 1531 }
1531 pep->smi_bus->priv = pep; 1532 pep->smi_bus->priv = pep;
1532 pep->smi_bus->name = "pxa168_eth smi"; 1533 pep->smi_bus->name = "pxa168_eth smi";
@@ -1551,13 +1552,10 @@ err_mdiobus:
1551 mdiobus_unregister(pep->smi_bus); 1552 mdiobus_unregister(pep->smi_bus);
1552err_free_mdio: 1553err_free_mdio:
1553 mdiobus_free(pep->smi_bus); 1554 mdiobus_free(pep->smi_bus);
1554err_base:
1555 iounmap(pep->base);
1556err_netdev: 1555err_netdev:
1557 free_netdev(dev); 1556 free_netdev(dev);
1558err_clk: 1557err_clk:
1559 clk_disable(clk); 1558 clk_disable_unprepare(clk);
1560 clk_put(clk);
1561 return err; 1559 return err;
1562} 1560}
1563 1561
@@ -1574,13 +1572,9 @@ static int pxa168_eth_remove(struct platform_device *pdev)
1574 if (pep->phy) 1572 if (pep->phy)
1575 phy_disconnect(pep->phy); 1573 phy_disconnect(pep->phy);
1576 if (pep->clk) { 1574 if (pep->clk) {
1577 clk_disable(pep->clk); 1575 clk_disable_unprepare(pep->clk);
1578 clk_put(pep->clk);
1579 pep->clk = NULL;
1580 } 1576 }
1581 1577
1582 iounmap(pep->base);
1583 pep->base = NULL;
1584 mdiobus_unregister(pep->smi_bus); 1578 mdiobus_unregister(pep->smi_bus);
1585 mdiobus_free(pep->smi_bus); 1579 mdiobus_free(pep->smi_bus);
1586 unregister_netdev(dev); 1580 unregister_netdev(dev);
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
index 3f44e2bbb982..a2ddf3d75ff8 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
@@ -1102,20 +1102,21 @@ static int mlx4_en_check_rxfh_func(struct net_device *dev, u8 hfunc)
1102 struct mlx4_en_priv *priv = netdev_priv(dev); 1102 struct mlx4_en_priv *priv = netdev_priv(dev);
1103 1103
1104 /* check if requested function is supported by the device */ 1104 /* check if requested function is supported by the device */
1105 if ((hfunc == ETH_RSS_HASH_TOP && 1105 if (hfunc == ETH_RSS_HASH_TOP) {
1106 !(priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_RSS_TOP)) || 1106 if (!(priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_RSS_TOP))
1107 (hfunc == ETH_RSS_HASH_XOR && 1107 return -EINVAL;
1108 !(priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_RSS_XOR))) 1108 if (!(dev->features & NETIF_F_RXHASH))
1109 return -EINVAL; 1109 en_warn(priv, "Toeplitz hash function should be used in conjunction with RX hashing for optimal performance\n");
1110 return 0;
1111 } else if (hfunc == ETH_RSS_HASH_XOR) {
1112 if (!(priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_RSS_XOR))
1113 return -EINVAL;
1114 if (dev->features & NETIF_F_RXHASH)
1115 en_warn(priv, "Enabling both XOR Hash function and RX Hashing can limit RPS functionality\n");
1116 return 0;
1117 }
1110 1118
1111 priv->rss_hash_fn = hfunc; 1119 return -EINVAL;
1112 if (hfunc == ETH_RSS_HASH_TOP && !(dev->features & NETIF_F_RXHASH))
1113 en_warn(priv,
1114 "Toeplitz hash function should be used in conjunction with RX hashing for optimal performance\n");
1115 if (hfunc == ETH_RSS_HASH_XOR && (dev->features & NETIF_F_RXHASH))
1116 en_warn(priv,
1117 "Enabling both XOR Hash function and RX Hashing can limit RPS functionality\n");
1118 return 0;
1119} 1120}
1120 1121
1121static int mlx4_en_get_rxfh(struct net_device *dev, u32 *ring_index, u8 *key, 1122static int mlx4_en_get_rxfh(struct net_device *dev, u32 *ring_index, u8 *key,
@@ -1189,6 +1190,8 @@ static int mlx4_en_set_rxfh(struct net_device *dev, const u32 *ring_index,
1189 priv->prof->rss_rings = rss_rings; 1190 priv->prof->rss_rings = rss_rings;
1190 if (key) 1191 if (key)
1191 memcpy(priv->rss_key, key, MLX4_EN_RSS_KEY_SIZE); 1192 memcpy(priv->rss_key, key, MLX4_EN_RSS_KEY_SIZE);
1193 if (hfunc != ETH_RSS_HASH_NO_CHANGE)
1194 priv->rss_hash_fn = hfunc;
1192 1195
1193 if (port_up) { 1196 if (port_up) {
1194 err = mlx4_en_start_port(dev); 1197 err = mlx4_en_start_port(dev);
diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
index 1412f5af05ec..2bae50292dcd 100644
--- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
+++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
@@ -69,11 +69,7 @@
69#include <net/ip.h> 69#include <net/ip.h>
70#include <net/tcp.h> 70#include <net/tcp.h>
71#include <asm/byteorder.h> 71#include <asm/byteorder.h>
72#include <asm/io.h>
73#include <asm/processor.h> 72#include <asm/processor.h>
74#ifdef CONFIG_MTRR
75#include <asm/mtrr.h>
76#endif
77#include <net/busy_poll.h> 73#include <net/busy_poll.h>
78 74
79#include "myri10ge_mcp.h" 75#include "myri10ge_mcp.h"
@@ -242,8 +238,7 @@ struct myri10ge_priv {
242 unsigned int rdma_tags_available; 238 unsigned int rdma_tags_available;
243 int intr_coal_delay; 239 int intr_coal_delay;
244 __be32 __iomem *intr_coal_delay_ptr; 240 __be32 __iomem *intr_coal_delay_ptr;
245 int mtrr; 241 int wc_cookie;
246 int wc_enabled;
247 int down_cnt; 242 int down_cnt;
248 wait_queue_head_t down_wq; 243 wait_queue_head_t down_wq;
249 struct work_struct watchdog_work; 244 struct work_struct watchdog_work;
@@ -1905,7 +1900,7 @@ static const char myri10ge_gstrings_main_stats[][ETH_GSTRING_LEN] = {
1905 "tx_aborted_errors", "tx_carrier_errors", "tx_fifo_errors", 1900 "tx_aborted_errors", "tx_carrier_errors", "tx_fifo_errors",
1906 "tx_heartbeat_errors", "tx_window_errors", 1901 "tx_heartbeat_errors", "tx_window_errors",
1907 /* device-specific stats */ 1902 /* device-specific stats */
1908 "tx_boundary", "WC", "irq", "MSI", "MSIX", 1903 "tx_boundary", "irq", "MSI", "MSIX",
1909 "read_dma_bw_MBs", "write_dma_bw_MBs", "read_write_dma_bw_MBs", 1904 "read_dma_bw_MBs", "write_dma_bw_MBs", "read_write_dma_bw_MBs",
1910 "serial_number", "watchdog_resets", 1905 "serial_number", "watchdog_resets",
1911#ifdef CONFIG_MYRI10GE_DCA 1906#ifdef CONFIG_MYRI10GE_DCA
@@ -1984,7 +1979,6 @@ myri10ge_get_ethtool_stats(struct net_device *netdev,
1984 data[i] = ((u64 *)&link_stats)[i]; 1979 data[i] = ((u64 *)&link_stats)[i];
1985 1980
1986 data[i++] = (unsigned int)mgp->tx_boundary; 1981 data[i++] = (unsigned int)mgp->tx_boundary;
1987 data[i++] = (unsigned int)mgp->wc_enabled;
1988 data[i++] = (unsigned int)mgp->pdev->irq; 1982 data[i++] = (unsigned int)mgp->pdev->irq;
1989 data[i++] = (unsigned int)mgp->msi_enabled; 1983 data[i++] = (unsigned int)mgp->msi_enabled;
1990 data[i++] = (unsigned int)mgp->msix_enabled; 1984 data[i++] = (unsigned int)mgp->msix_enabled;
@@ -4040,14 +4034,7 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
4040 4034
4041 mgp->board_span = pci_resource_len(pdev, 0); 4035 mgp->board_span = pci_resource_len(pdev, 0);
4042 mgp->iomem_base = pci_resource_start(pdev, 0); 4036 mgp->iomem_base = pci_resource_start(pdev, 0);
4043 mgp->mtrr = -1; 4037 mgp->wc_cookie = arch_phys_wc_add(mgp->iomem_base, mgp->board_span);
4044 mgp->wc_enabled = 0;
4045#ifdef CONFIG_MTRR
4046 mgp->mtrr = mtrr_add(mgp->iomem_base, mgp->board_span,
4047 MTRR_TYPE_WRCOMB, 1);
4048 if (mgp->mtrr >= 0)
4049 mgp->wc_enabled = 1;
4050#endif
4051 mgp->sram = ioremap_wc(mgp->iomem_base, mgp->board_span); 4038 mgp->sram = ioremap_wc(mgp->iomem_base, mgp->board_span);
4052 if (mgp->sram == NULL) { 4039 if (mgp->sram == NULL) {
4053 dev_err(&pdev->dev, "ioremap failed for %ld bytes at 0x%lx\n", 4040 dev_err(&pdev->dev, "ioremap failed for %ld bytes at 0x%lx\n",
@@ -4146,14 +4133,14 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
4146 goto abort_with_state; 4133 goto abort_with_state;
4147 } 4134 }
4148 if (mgp->msix_enabled) 4135 if (mgp->msix_enabled)
4149 dev_info(dev, "%d MSI-X IRQs, tx bndry %d, fw %s, WC %s\n", 4136 dev_info(dev, "%d MSI-X IRQs, tx bndry %d, fw %s, MTRR %s, WC Enabled\n",
4150 mgp->num_slices, mgp->tx_boundary, mgp->fw_name, 4137 mgp->num_slices, mgp->tx_boundary, mgp->fw_name,
4151 (mgp->wc_enabled ? "Enabled" : "Disabled")); 4138 (mgp->wc_cookie > 0 ? "Enabled" : "Disabled"));
4152 else 4139 else
4153 dev_info(dev, "%s IRQ %d, tx bndry %d, fw %s, WC %s\n", 4140 dev_info(dev, "%s IRQ %d, tx bndry %d, fw %s, MTRR %s, WC Enabled\n",
4154 mgp->msi_enabled ? "MSI" : "xPIC", 4141 mgp->msi_enabled ? "MSI" : "xPIC",
4155 pdev->irq, mgp->tx_boundary, mgp->fw_name, 4142 pdev->irq, mgp->tx_boundary, mgp->fw_name,
4156 (mgp->wc_enabled ? "Enabled" : "Disabled")); 4143 (mgp->wc_cookie > 0 ? "Enabled" : "Disabled"));
4157 4144
4158 board_number++; 4145 board_number++;
4159 return 0; 4146 return 0;
@@ -4175,10 +4162,7 @@ abort_with_ioremap:
4175 iounmap(mgp->sram); 4162 iounmap(mgp->sram);
4176 4163
4177abort_with_mtrr: 4164abort_with_mtrr:
4178#ifdef CONFIG_MTRR 4165 arch_phys_wc_del(mgp->wc_cookie);
4179 if (mgp->mtrr >= 0)
4180 mtrr_del(mgp->mtrr, mgp->iomem_base, mgp->board_span);
4181#endif
4182 dma_free_coherent(&pdev->dev, sizeof(*mgp->cmd), 4166 dma_free_coherent(&pdev->dev, sizeof(*mgp->cmd),
4183 mgp->cmd, mgp->cmd_bus); 4167 mgp->cmd, mgp->cmd_bus);
4184 4168
@@ -4220,11 +4204,7 @@ static void myri10ge_remove(struct pci_dev *pdev)
4220 pci_restore_state(pdev); 4204 pci_restore_state(pdev);
4221 4205
4222 iounmap(mgp->sram); 4206 iounmap(mgp->sram);
4223 4207 arch_phys_wc_del(mgp->wc_cookie);
4224#ifdef CONFIG_MTRR
4225 if (mgp->mtrr >= 0)
4226 mtrr_del(mgp->mtrr, mgp->iomem_base, mgp->board_span);
4227#endif
4228 myri10ge_free_slices(mgp); 4208 myri10ge_free_slices(mgp);
4229 kfree(mgp->msix_vectors); 4209 kfree(mgp->msix_vectors);
4230 dma_free_coherent(&pdev->dev, sizeof(*mgp->cmd), 4210 dma_free_coherent(&pdev->dev, sizeof(*mgp->cmd),
diff --git a/drivers/net/phy/mdio-gpio.c b/drivers/net/phy/mdio-gpio.c
index 49ce7ece5af3..c9cb486c753d 100644
--- a/drivers/net/phy/mdio-gpio.c
+++ b/drivers/net/phy/mdio-gpio.c
@@ -80,7 +80,8 @@ static void mdio_dir(struct mdiobb_ctrl *ctrl, int dir)
80 * assume the pin serves as pull-up. If direction is 80 * assume the pin serves as pull-up. If direction is
81 * output, the default value is high. 81 * output, the default value is high.
82 */ 82 */
83 gpio_set_value(bitbang->mdo, 1 ^ bitbang->mdo_active_low); 83 gpio_set_value_cansleep(bitbang->mdo,
84 1 ^ bitbang->mdo_active_low);
84 return; 85 return;
85 } 86 }
86 87
@@ -96,7 +97,8 @@ static int mdio_get(struct mdiobb_ctrl *ctrl)
96 struct mdio_gpio_info *bitbang = 97 struct mdio_gpio_info *bitbang =
97 container_of(ctrl, struct mdio_gpio_info, ctrl); 98 container_of(ctrl, struct mdio_gpio_info, ctrl);
98 99
99 return gpio_get_value(bitbang->mdio) ^ bitbang->mdio_active_low; 100 return gpio_get_value_cansleep(bitbang->mdio) ^
101 bitbang->mdio_active_low;
100} 102}
101 103
102static void mdio_set(struct mdiobb_ctrl *ctrl, int what) 104static void mdio_set(struct mdiobb_ctrl *ctrl, int what)
@@ -105,9 +107,11 @@ static void mdio_set(struct mdiobb_ctrl *ctrl, int what)
105 container_of(ctrl, struct mdio_gpio_info, ctrl); 107 container_of(ctrl, struct mdio_gpio_info, ctrl);
106 108
107 if (bitbang->mdo) 109 if (bitbang->mdo)
108 gpio_set_value(bitbang->mdo, what ^ bitbang->mdo_active_low); 110 gpio_set_value_cansleep(bitbang->mdo,
111 what ^ bitbang->mdo_active_low);
109 else 112 else
110 gpio_set_value(bitbang->mdio, what ^ bitbang->mdio_active_low); 113 gpio_set_value_cansleep(bitbang->mdio,
114 what ^ bitbang->mdio_active_low);
111} 115}
112 116
113static void mdc_set(struct mdiobb_ctrl *ctrl, int what) 117static void mdc_set(struct mdiobb_ctrl *ctrl, int what)
@@ -115,7 +119,7 @@ static void mdc_set(struct mdiobb_ctrl *ctrl, int what)
115 struct mdio_gpio_info *bitbang = 119 struct mdio_gpio_info *bitbang =
116 container_of(ctrl, struct mdio_gpio_info, ctrl); 120 container_of(ctrl, struct mdio_gpio_info, ctrl);
117 121
118 gpio_set_value(bitbang->mdc, what ^ bitbang->mdc_active_low); 122 gpio_set_value_cansleep(bitbang->mdc, what ^ bitbang->mdc_active_low);
119} 123}
120 124
121static struct mdiobb_ops mdio_gpio_ops = { 125static struct mdiobb_ops mdio_gpio_ops = {
diff --git a/drivers/net/phy/mdio-mux-gpio.c b/drivers/net/phy/mdio-mux-gpio.c
index 1a87a585e74d..66edd99bc302 100644
--- a/drivers/net/phy/mdio-mux-gpio.c
+++ b/drivers/net/phy/mdio-mux-gpio.c
@@ -12,33 +12,30 @@
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/phy.h> 13#include <linux/phy.h>
14#include <linux/mdio-mux.h> 14#include <linux/mdio-mux.h>
15#include <linux/of_gpio.h> 15#include <linux/gpio/consumer.h>
16 16
17#define DRV_VERSION "1.1" 17#define DRV_VERSION "1.1"
18#define DRV_DESCRIPTION "GPIO controlled MDIO bus multiplexer driver" 18#define DRV_DESCRIPTION "GPIO controlled MDIO bus multiplexer driver"
19 19
20#define MDIO_MUX_GPIO_MAX_BITS 8
21
22struct mdio_mux_gpio_state { 20struct mdio_mux_gpio_state {
23 struct gpio_desc *gpio[MDIO_MUX_GPIO_MAX_BITS]; 21 struct gpio_descs *gpios;
24 unsigned int num_gpios;
25 void *mux_handle; 22 void *mux_handle;
26}; 23};
27 24
28static int mdio_mux_gpio_switch_fn(int current_child, int desired_child, 25static int mdio_mux_gpio_switch_fn(int current_child, int desired_child,
29 void *data) 26 void *data)
30{ 27{
31 int values[MDIO_MUX_GPIO_MAX_BITS];
32 unsigned int n;
33 struct mdio_mux_gpio_state *s = data; 28 struct mdio_mux_gpio_state *s = data;
29 int values[s->gpios->ndescs];
30 unsigned int n;
34 31
35 if (current_child == desired_child) 32 if (current_child == desired_child)
36 return 0; 33 return 0;
37 34
38 for (n = 0; n < s->num_gpios; n++) { 35 for (n = 0; n < s->gpios->ndescs; n++)
39 values[n] = (desired_child >> n) & 1; 36 values[n] = (desired_child >> n) & 1;
40 } 37
41 gpiod_set_array_cansleep(s->num_gpios, s->gpio, values); 38 gpiod_set_array_cansleep(s->gpios->ndescs, s->gpios->desc, values);
42 39
43 return 0; 40 return 0;
44} 41}
@@ -46,56 +43,33 @@ static int mdio_mux_gpio_switch_fn(int current_child, int desired_child,
46static int mdio_mux_gpio_probe(struct platform_device *pdev) 43static int mdio_mux_gpio_probe(struct platform_device *pdev)
47{ 44{
48 struct mdio_mux_gpio_state *s; 45 struct mdio_mux_gpio_state *s;
49 int num_gpios;
50 unsigned int n;
51 int r; 46 int r;
52 47
53 if (!pdev->dev.of_node)
54 return -ENODEV;
55
56 num_gpios = of_gpio_count(pdev->dev.of_node);
57 if (num_gpios <= 0 || num_gpios > MDIO_MUX_GPIO_MAX_BITS)
58 return -ENODEV;
59
60 s = devm_kzalloc(&pdev->dev, sizeof(*s), GFP_KERNEL); 48 s = devm_kzalloc(&pdev->dev, sizeof(*s), GFP_KERNEL);
61 if (!s) 49 if (!s)
62 return -ENOMEM; 50 return -ENOMEM;
63 51
64 s->num_gpios = num_gpios; 52 s->gpios = gpiod_get_array(&pdev->dev, NULL, GPIOD_OUT_LOW);
65 53 if (IS_ERR(s->gpios))
66 for (n = 0; n < num_gpios; ) { 54 return PTR_ERR(s->gpios);
67 struct gpio_desc *gpio = gpiod_get_index(&pdev->dev, NULL, n,
68 GPIOD_OUT_LOW);
69 if (IS_ERR(gpio)) {
70 r = PTR_ERR(gpio);
71 goto err;
72 }
73 s->gpio[n] = gpio;
74 n++;
75 }
76 55
77 r = mdio_mux_init(&pdev->dev, 56 r = mdio_mux_init(&pdev->dev,
78 mdio_mux_gpio_switch_fn, &s->mux_handle, s); 57 mdio_mux_gpio_switch_fn, &s->mux_handle, s);
79 58
80 if (r == 0) { 59 if (r != 0) {
81 pdev->dev.platform_data = s; 60 gpiod_put_array(s->gpios);
82 return 0; 61 return r;
83 }
84err:
85 while (n) {
86 n--;
87 gpiod_put(s->gpio[n]);
88 } 62 }
89 return r; 63
64 pdev->dev.platform_data = s;
65 return 0;
90} 66}
91 67
92static int mdio_mux_gpio_remove(struct platform_device *pdev) 68static int mdio_mux_gpio_remove(struct platform_device *pdev)
93{ 69{
94 unsigned int n;
95 struct mdio_mux_gpio_state *s = dev_get_platdata(&pdev->dev); 70 struct mdio_mux_gpio_state *s = dev_get_platdata(&pdev->dev);
96 mdio_mux_uninit(s->mux_handle); 71 mdio_mux_uninit(s->mux_handle);
97 for (n = 0; n < s->num_gpios; n++) 72 gpiod_put_array(s->gpios);
98 gpiod_put(s->gpio[n]);
99 return 0; 73 return 0;
100} 74}
101 75
diff --git a/drivers/net/ppp/ppp_mppe.c b/drivers/net/ppp/ppp_mppe.c
index 911b21602ff2..05005c660d4d 100644
--- a/drivers/net/ppp/ppp_mppe.c
+++ b/drivers/net/ppp/ppp_mppe.c
@@ -478,7 +478,6 @@ mppe_decompress(void *arg, unsigned char *ibuf, int isize, unsigned char *obuf,
478 struct blkcipher_desc desc = { .tfm = state->arc4 }; 478 struct blkcipher_desc desc = { .tfm = state->arc4 };
479 unsigned ccount; 479 unsigned ccount;
480 int flushed = MPPE_BITS(ibuf) & MPPE_BIT_FLUSHED; 480 int flushed = MPPE_BITS(ibuf) & MPPE_BIT_FLUSHED;
481 int sanity = 0;
482 struct scatterlist sg_in[1], sg_out[1]; 481 struct scatterlist sg_in[1], sg_out[1];
483 482
484 if (isize <= PPP_HDRLEN + MPPE_OVHD) { 483 if (isize <= PPP_HDRLEN + MPPE_OVHD) {
@@ -514,31 +513,19 @@ mppe_decompress(void *arg, unsigned char *ibuf, int isize, unsigned char *obuf,
514 "mppe_decompress[%d]: ENCRYPTED bit not set!\n", 513 "mppe_decompress[%d]: ENCRYPTED bit not set!\n",
515 state->unit); 514 state->unit);
516 state->sanity_errors += 100; 515 state->sanity_errors += 100;
517 sanity = 1; 516 goto sanity_error;
518 } 517 }
519 if (!state->stateful && !flushed) { 518 if (!state->stateful && !flushed) {
520 printk(KERN_DEBUG "mppe_decompress[%d]: FLUSHED bit not set in " 519 printk(KERN_DEBUG "mppe_decompress[%d]: FLUSHED bit not set in "
521 "stateless mode!\n", state->unit); 520 "stateless mode!\n", state->unit);
522 state->sanity_errors += 100; 521 state->sanity_errors += 100;
523 sanity = 1; 522 goto sanity_error;
524 } 523 }
525 if (state->stateful && ((ccount & 0xff) == 0xff) && !flushed) { 524 if (state->stateful && ((ccount & 0xff) == 0xff) && !flushed) {
526 printk(KERN_DEBUG "mppe_decompress[%d]: FLUSHED bit not set on " 525 printk(KERN_DEBUG "mppe_decompress[%d]: FLUSHED bit not set on "
527 "flag packet!\n", state->unit); 526 "flag packet!\n", state->unit);
528 state->sanity_errors += 100; 527 state->sanity_errors += 100;
529 sanity = 1; 528 goto sanity_error;
530 }
531
532 if (sanity) {
533 if (state->sanity_errors < SANITY_MAX)
534 return DECOMP_ERROR;
535 else
536 /*
537 * Take LCP down if the peer is sending too many bogons.
538 * We don't want to do this for a single or just a few
539 * instances since it could just be due to packet corruption.
540 */
541 return DECOMP_FATALERROR;
542 } 529 }
543 530
544 /* 531 /*
@@ -546,6 +533,13 @@ mppe_decompress(void *arg, unsigned char *ibuf, int isize, unsigned char *obuf,
546 */ 533 */
547 534
548 if (!state->stateful) { 535 if (!state->stateful) {
536 /* Discard late packet */
537 if ((ccount - state->ccount) % MPPE_CCOUNT_SPACE
538 > MPPE_CCOUNT_SPACE / 2) {
539 state->sanity_errors++;
540 goto sanity_error;
541 }
542
549 /* RFC 3078, sec 8.1. Rekey for every packet. */ 543 /* RFC 3078, sec 8.1. Rekey for every packet. */
550 while (state->ccount != ccount) { 544 while (state->ccount != ccount) {
551 mppe_rekey(state, 0); 545 mppe_rekey(state, 0);
@@ -649,6 +643,16 @@ mppe_decompress(void *arg, unsigned char *ibuf, int isize, unsigned char *obuf,
649 state->sanity_errors >>= 1; 643 state->sanity_errors >>= 1;
650 644
651 return osize; 645 return osize;
646
647sanity_error:
648 if (state->sanity_errors < SANITY_MAX)
649 return DECOMP_ERROR;
650 else
651 /* Take LCP down if the peer is sending too many bogons.
652 * We don't want to do this for a single or just a few
653 * instances since it could just be due to packet corruption.
654 */
655 return DECOMP_FATALERROR;
652} 656}
653 657
654/* 658/*
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 154116aafd0d..27a5f954f8e9 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -730,12 +730,8 @@ static int vxlan_fdb_create(struct vxlan_dev *vxlan,
730 /* Only change unicasts */ 730 /* Only change unicasts */
731 if (!(is_multicast_ether_addr(f->eth_addr) || 731 if (!(is_multicast_ether_addr(f->eth_addr) ||
732 is_zero_ether_addr(f->eth_addr))) { 732 is_zero_ether_addr(f->eth_addr))) {
733 int rc = vxlan_fdb_replace(f, ip, port, vni, 733 notify |= vxlan_fdb_replace(f, ip, port, vni,
734 ifindex); 734 ifindex);
735
736 if (rc < 0)
737 return rc;
738 notify |= rc;
739 } else 735 } else
740 return -EOPNOTSUPP; 736 return -EOPNOTSUPP;
741 } 737 }