diff options
53 files changed, 527 insertions, 317 deletions
diff --git a/Documentation/networking/mpls-sysctl.txt b/Documentation/networking/mpls-sysctl.txt index 639ddf0ece9b..9ed15f86c17c 100644 --- a/Documentation/networking/mpls-sysctl.txt +++ b/Documentation/networking/mpls-sysctl.txt | |||
| @@ -18,3 +18,12 @@ platform_labels - INTEGER | |||
| 18 | 18 | ||
| 19 | Possible values: 0 - 1048575 | 19 | Possible values: 0 - 1048575 |
| 20 | Default: 0 | 20 | Default: 0 |
| 21 | |||
| 22 | conf/<interface>/input - BOOL | ||
| 23 | Control whether packets can be input on this interface. | ||
| 24 | |||
| 25 | If disabled, packets will be discarded without further | ||
| 26 | processing. | ||
| 27 | |||
| 28 | 0 - disabled (default) | ||
| 29 | not 0 - enabled | ||
diff --git a/Documentation/networking/scaling.txt b/Documentation/networking/scaling.txt index cbfac0949635..59f4db2a0c85 100644 --- a/Documentation/networking/scaling.txt +++ b/Documentation/networking/scaling.txt | |||
| @@ -282,7 +282,7 @@ following is true: | |||
| 282 | 282 | ||
| 283 | - The current CPU's queue head counter >= the recorded tail counter | 283 | - The current CPU's queue head counter >= the recorded tail counter |
| 284 | value in rps_dev_flow[i] | 284 | value in rps_dev_flow[i] |
| 285 | - The current CPU is unset (equal to RPS_NO_CPU) | 285 | - The current CPU is unset (>= nr_cpu_ids) |
| 286 | - The current CPU is offline | 286 | - The current CPU is offline |
| 287 | 287 | ||
| 288 | After this check, the packet is sent to the (possibly updated) current | 288 | After this check, the packet is sent to the (possibly updated) current |
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 | ||
| 8 | static void *bond_info_seq_start(struct seq_file *seq, loff_t *pos) | 9 | static 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 | ||
| 113 | config CAN_GRCAN | 113 | config 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 | ||
| 180 | config AMD_XGBE | 180 | config 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 | |||
| 25 | config ARC_EMAC | 25 | config 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 | |||
| 35 | config EMAC_ROCKCHIP | 34 | config 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: | |||
| 3381 | out2: | 3381 | out2: |
| 3382 | unregister_reboot_notifier(&ehea_reboot_nb); | 3382 | unregister_reboot_notifier(&ehea_reboot_nb); |
| 3383 | out: | 3383 | out: |
| 3384 | atomic_dec(&ehea_memory_hooks_registered); | ||
| 3384 | return ret; | 3385 | return ret; |
| 3385 | } | 3386 | } |
| 3386 | 3387 | ||
| 3387 | static void ehea_unregister_memory_hooks(void) | 3388 | static 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); |
| 1552 | err_free_mdio: | 1553 | err_free_mdio: |
| 1553 | mdiobus_free(pep->smi_bus); | 1554 | mdiobus_free(pep->smi_bus); |
| 1554 | err_base: | ||
| 1555 | iounmap(pep->base); | ||
| 1556 | err_netdev: | 1555 | err_netdev: |
| 1557 | free_netdev(dev); | 1556 | free_netdev(dev); |
| 1558 | err_clk: | 1557 | err_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 | ||
| 1121 | static int mlx4_en_get_rxfh(struct net_device *dev, u32 *ring_index, u8 *key, | 1122 | static 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 | ||
| 4177 | abort_with_mtrr: | 4164 | abort_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 | ||
| 102 | static void mdio_set(struct mdiobb_ctrl *ctrl, int what) | 104 | static 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 | ||
| 113 | static void mdc_set(struct mdiobb_ctrl *ctrl, int what) | 117 | static 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 | ||
| 121 | static struct mdiobb_ops mdio_gpio_ops = { | 125 | static 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 | |||
| 22 | struct mdio_mux_gpio_state { | 20 | struct 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 | ||
| 28 | static int mdio_mux_gpio_switch_fn(int current_child, int desired_child, | 25 | static 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, | |||
| 46 | static int mdio_mux_gpio_probe(struct platform_device *pdev) | 43 | static 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 | } | ||
| 84 | err: | ||
| 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 | ||
| 92 | static int mdio_mux_gpio_remove(struct platform_device *pdev) | 68 | static 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 | |||
| 647 | sanity_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 | } |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index bcbde799ec69..dbad4d728b4b 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
| @@ -60,6 +60,7 @@ struct phy_device; | |||
| 60 | struct wireless_dev; | 60 | struct wireless_dev; |
| 61 | /* 802.15.4 specific */ | 61 | /* 802.15.4 specific */ |
| 62 | struct wpan_dev; | 62 | struct wpan_dev; |
| 63 | struct mpls_dev; | ||
| 63 | 64 | ||
| 64 | void netdev_set_default_ethtool_ops(struct net_device *dev, | 65 | void netdev_set_default_ethtool_ops(struct net_device *dev, |
| 65 | const struct ethtool_ops *ops); | 66 | const struct ethtool_ops *ops); |
| @@ -1627,6 +1628,9 @@ struct net_device { | |||
| 1627 | void *ax25_ptr; | 1628 | void *ax25_ptr; |
| 1628 | struct wireless_dev *ieee80211_ptr; | 1629 | struct wireless_dev *ieee80211_ptr; |
| 1629 | struct wpan_dev *ieee802154_ptr; | 1630 | struct wpan_dev *ieee802154_ptr; |
| 1631 | #if IS_ENABLED(CONFIG_MPLS_ROUTING) | ||
| 1632 | struct mpls_dev __rcu *mpls_ptr; | ||
| 1633 | #endif | ||
| 1630 | 1634 | ||
| 1631 | /* | 1635 | /* |
| 1632 | * Cache lines mostly used on receive path (including eth_type_trans()) | 1636 | * Cache lines mostly used on receive path (including eth_type_trans()) |
| @@ -2021,10 +2025,10 @@ struct pcpu_sw_netstats { | |||
| 2021 | ({ \ | 2025 | ({ \ |
| 2022 | typeof(type) __percpu *pcpu_stats = alloc_percpu(type); \ | 2026 | typeof(type) __percpu *pcpu_stats = alloc_percpu(type); \ |
| 2023 | if (pcpu_stats) { \ | 2027 | if (pcpu_stats) { \ |
| 2024 | int i; \ | 2028 | int __cpu; \ |
| 2025 | for_each_possible_cpu(i) { \ | 2029 | for_each_possible_cpu(__cpu) { \ |
| 2026 | typeof(type) *stat; \ | 2030 | typeof(type) *stat; \ |
| 2027 | stat = per_cpu_ptr(pcpu_stats, i); \ | 2031 | stat = per_cpu_ptr(pcpu_stats, __cpu); \ |
| 2028 | u64_stats_init(&stat->syncp); \ | 2032 | u64_stats_init(&stat->syncp); \ |
| 2029 | } \ | 2033 | } \ |
| 2030 | } \ | 2034 | } \ |
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h index e23d242d1230..dbcbcc59aa92 100644 --- a/include/linux/rhashtable.h +++ b/include/linux/rhashtable.h | |||
| @@ -282,7 +282,8 @@ static inline bool rht_shrink_below_30(const struct rhashtable *ht, | |||
| 282 | static inline bool rht_grow_above_100(const struct rhashtable *ht, | 282 | static inline bool rht_grow_above_100(const struct rhashtable *ht, |
| 283 | const struct bucket_table *tbl) | 283 | const struct bucket_table *tbl) |
| 284 | { | 284 | { |
| 285 | return atomic_read(&ht->nelems) > tbl->size; | 285 | return atomic_read(&ht->nelems) > tbl->size && |
| 286 | (!ht->p.max_size || tbl->size < ht->p.max_size); | ||
| 286 | } | 287 | } |
| 287 | 288 | ||
| 288 | /* The bucket lock is selected based on the hash and protects mutations | 289 | /* The bucket lock is selected based on the hash and protects mutations |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 06793b598f44..66e374d62f64 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
| @@ -773,6 +773,7 @@ bool skb_try_coalesce(struct sk_buff *to, struct sk_buff *from, | |||
| 773 | 773 | ||
| 774 | struct sk_buff *__alloc_skb(unsigned int size, gfp_t priority, int flags, | 774 | struct sk_buff *__alloc_skb(unsigned int size, gfp_t priority, int flags, |
| 775 | int node); | 775 | int node); |
| 776 | struct sk_buff *__build_skb(void *data, unsigned int frag_size); | ||
| 776 | struct sk_buff *build_skb(void *data, unsigned int frag_size); | 777 | struct sk_buff *build_skb(void *data, unsigned int frag_size); |
| 777 | static inline struct sk_buff *alloc_skb(unsigned int size, | 778 | static inline struct sk_buff *alloc_skb(unsigned int size, |
| 778 | gfp_t priority) | 779 | gfp_t priority) |
diff --git a/include/net/bonding.h b/include/net/bonding.h index fda6feeb6c1f..78ed135e9dea 100644 --- a/include/net/bonding.h +++ b/include/net/bonding.h | |||
| @@ -30,13 +30,6 @@ | |||
| 30 | #include <net/bond_alb.h> | 30 | #include <net/bond_alb.h> |
| 31 | #include <net/bond_options.h> | 31 | #include <net/bond_options.h> |
| 32 | 32 | ||
| 33 | #define DRV_VERSION "3.7.1" | ||
| 34 | #define DRV_RELDATE "April 27, 2011" | ||
| 35 | #define DRV_NAME "bonding" | ||
| 36 | #define DRV_DESCRIPTION "Ethernet Channel Bonding Driver" | ||
| 37 | |||
| 38 | #define bond_version DRV_DESCRIPTION ": v" DRV_VERSION " (" DRV_RELDATE ")\n" | ||
| 39 | |||
| 40 | #define BOND_MAX_ARP_TARGETS 16 | 33 | #define BOND_MAX_ARP_TARGETS 16 |
| 41 | 34 | ||
| 42 | #define BOND_DEFAULT_MIIMON 100 | 35 | #define BOND_DEFAULT_MIIMON 100 |
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h index 7b5887cd1172..48a815823587 100644 --- a/include/net/inet_connection_sock.h +++ b/include/net/inet_connection_sock.h | |||
| @@ -279,12 +279,6 @@ static inline void inet_csk_reqsk_queue_add(struct sock *sk, | |||
| 279 | void inet_csk_reqsk_queue_hash_add(struct sock *sk, struct request_sock *req, | 279 | void inet_csk_reqsk_queue_hash_add(struct sock *sk, struct request_sock *req, |
| 280 | unsigned long timeout); | 280 | unsigned long timeout); |
| 281 | 281 | ||
| 282 | static inline void inet_csk_reqsk_queue_removed(struct sock *sk, | ||
| 283 | struct request_sock *req) | ||
| 284 | { | ||
| 285 | reqsk_queue_removed(&inet_csk(sk)->icsk_accept_queue, req); | ||
| 286 | } | ||
| 287 | |||
| 288 | static inline void inet_csk_reqsk_queue_added(struct sock *sk, | 282 | static inline void inet_csk_reqsk_queue_added(struct sock *sk, |
| 289 | const unsigned long timeout) | 283 | const unsigned long timeout) |
| 290 | { | 284 | { |
| @@ -306,19 +300,7 @@ static inline int inet_csk_reqsk_queue_is_full(const struct sock *sk) | |||
| 306 | return reqsk_queue_is_full(&inet_csk(sk)->icsk_accept_queue); | 300 | return reqsk_queue_is_full(&inet_csk(sk)->icsk_accept_queue); |
| 307 | } | 301 | } |
| 308 | 302 | ||
| 309 | static inline void inet_csk_reqsk_queue_unlink(struct sock *sk, | 303 | void inet_csk_reqsk_queue_drop(struct sock *sk, struct request_sock *req); |
| 310 | struct request_sock *req) | ||
| 311 | { | ||
| 312 | reqsk_queue_unlink(&inet_csk(sk)->icsk_accept_queue, req); | ||
| 313 | } | ||
| 314 | |||
| 315 | static inline void inet_csk_reqsk_queue_drop(struct sock *sk, | ||
| 316 | struct request_sock *req) | ||
| 317 | { | ||
| 318 | inet_csk_reqsk_queue_unlink(sk, req); | ||
| 319 | inet_csk_reqsk_queue_removed(sk, req); | ||
| 320 | reqsk_put(req); | ||
| 321 | } | ||
| 322 | 304 | ||
| 323 | void inet_csk_destroy_sock(struct sock *sk); | 305 | void inet_csk_destroy_sock(struct sock *sk); |
| 324 | void inet_csk_prepare_forced_close(struct sock *sk); | 306 | void inet_csk_prepare_forced_close(struct sock *sk); |
diff --git a/include/net/request_sock.h b/include/net/request_sock.h index fe41f3ceb008..9f4265ce8892 100644 --- a/include/net/request_sock.h +++ b/include/net/request_sock.h | |||
| @@ -212,24 +212,6 @@ static inline int reqsk_queue_empty(struct request_sock_queue *queue) | |||
| 212 | return queue->rskq_accept_head == NULL; | 212 | return queue->rskq_accept_head == NULL; |
| 213 | } | 213 | } |
| 214 | 214 | ||
| 215 | static inline void reqsk_queue_unlink(struct request_sock_queue *queue, | ||
| 216 | struct request_sock *req) | ||
| 217 | { | ||
| 218 | struct listen_sock *lopt = queue->listen_opt; | ||
| 219 | struct request_sock **prev; | ||
| 220 | |||
| 221 | spin_lock(&queue->syn_wait_lock); | ||
| 222 | |||
| 223 | prev = &lopt->syn_table[req->rsk_hash]; | ||
| 224 | while (*prev != req) | ||
| 225 | prev = &(*prev)->dl_next; | ||
| 226 | *prev = req->dl_next; | ||
| 227 | |||
| 228 | spin_unlock(&queue->syn_wait_lock); | ||
| 229 | if (del_timer(&req->rsk_timer)) | ||
| 230 | reqsk_put(req); | ||
| 231 | } | ||
| 232 | |||
| 233 | static inline void reqsk_queue_add(struct request_sock_queue *queue, | 215 | static inline void reqsk_queue_add(struct request_sock_queue *queue, |
| 234 | struct request_sock *req, | 216 | struct request_sock *req, |
| 235 | struct sock *parent, | 217 | struct sock *parent, |
diff --git a/lib/rhashtable.c b/lib/rhashtable.c index 4898442b837f..b28df4019ade 100644 --- a/lib/rhashtable.c +++ b/lib/rhashtable.c | |||
| @@ -405,13 +405,18 @@ int rhashtable_insert_rehash(struct rhashtable *ht) | |||
| 405 | 405 | ||
| 406 | if (rht_grow_above_75(ht, tbl)) | 406 | if (rht_grow_above_75(ht, tbl)) |
| 407 | size *= 2; | 407 | size *= 2; |
| 408 | /* More than two rehashes (not resizes) detected. */ | 408 | /* Do not schedule more than one rehash */ |
| 409 | else if (WARN_ON(old_tbl != tbl && old_tbl->size == size)) | 409 | else if (old_tbl != tbl) |
| 410 | return -EBUSY; | 410 | return -EBUSY; |
| 411 | 411 | ||
| 412 | new_tbl = bucket_table_alloc(ht, size, GFP_ATOMIC); | 412 | new_tbl = bucket_table_alloc(ht, size, GFP_ATOMIC); |
| 413 | if (new_tbl == NULL) | 413 | if (new_tbl == NULL) { |
| 414 | /* Schedule async resize/rehash to try allocation | ||
| 415 | * non-atomic context. | ||
| 416 | */ | ||
| 417 | schedule_work(&ht->run_work); | ||
| 414 | return -ENOMEM; | 418 | return -ENOMEM; |
| 419 | } | ||
| 415 | 420 | ||
| 416 | err = rhashtable_rehash_attach(ht, tbl, new_tbl); | 421 | err = rhashtable_rehash_attach(ht, tbl, new_tbl); |
| 417 | if (err) { | 422 | if (err) { |
diff --git a/net/core/dev.c b/net/core/dev.c index 1796cef55ab5..c7ba0388f1be 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
| @@ -3079,7 +3079,7 @@ static struct rps_dev_flow * | |||
| 3079 | set_rps_cpu(struct net_device *dev, struct sk_buff *skb, | 3079 | set_rps_cpu(struct net_device *dev, struct sk_buff *skb, |
| 3080 | struct rps_dev_flow *rflow, u16 next_cpu) | 3080 | struct rps_dev_flow *rflow, u16 next_cpu) |
| 3081 | { | 3081 | { |
| 3082 | if (next_cpu != RPS_NO_CPU) { | 3082 | if (next_cpu < nr_cpu_ids) { |
| 3083 | #ifdef CONFIG_RFS_ACCEL | 3083 | #ifdef CONFIG_RFS_ACCEL |
| 3084 | struct netdev_rx_queue *rxqueue; | 3084 | struct netdev_rx_queue *rxqueue; |
| 3085 | struct rps_dev_flow_table *flow_table; | 3085 | struct rps_dev_flow_table *flow_table; |
| @@ -3184,7 +3184,7 @@ static int get_rps_cpu(struct net_device *dev, struct sk_buff *skb, | |||
| 3184 | * If the desired CPU (where last recvmsg was done) is | 3184 | * If the desired CPU (where last recvmsg was done) is |
| 3185 | * different from current CPU (one in the rx-queue flow | 3185 | * different from current CPU (one in the rx-queue flow |
| 3186 | * table entry), switch if one of the following holds: | 3186 | * table entry), switch if one of the following holds: |
| 3187 | * - Current CPU is unset (equal to RPS_NO_CPU). | 3187 | * - Current CPU is unset (>= nr_cpu_ids). |
| 3188 | * - Current CPU is offline. | 3188 | * - Current CPU is offline. |
| 3189 | * - The current CPU's queue tail has advanced beyond the | 3189 | * - The current CPU's queue tail has advanced beyond the |
| 3190 | * last packet that was enqueued using this table entry. | 3190 | * last packet that was enqueued using this table entry. |
| @@ -3192,14 +3192,14 @@ static int get_rps_cpu(struct net_device *dev, struct sk_buff *skb, | |||
| 3192 | * have been dequeued, thus preserving in order delivery. | 3192 | * have been dequeued, thus preserving in order delivery. |
| 3193 | */ | 3193 | */ |
| 3194 | if (unlikely(tcpu != next_cpu) && | 3194 | if (unlikely(tcpu != next_cpu) && |
| 3195 | (tcpu == RPS_NO_CPU || !cpu_online(tcpu) || | 3195 | (tcpu >= nr_cpu_ids || !cpu_online(tcpu) || |
| 3196 | ((int)(per_cpu(softnet_data, tcpu).input_queue_head - | 3196 | ((int)(per_cpu(softnet_data, tcpu).input_queue_head - |
| 3197 | rflow->last_qtail)) >= 0)) { | 3197 | rflow->last_qtail)) >= 0)) { |
| 3198 | tcpu = next_cpu; | 3198 | tcpu = next_cpu; |
| 3199 | rflow = set_rps_cpu(dev, skb, rflow, next_cpu); | 3199 | rflow = set_rps_cpu(dev, skb, rflow, next_cpu); |
| 3200 | } | 3200 | } |
| 3201 | 3201 | ||
| 3202 | if (tcpu != RPS_NO_CPU && cpu_online(tcpu)) { | 3202 | if (tcpu < nr_cpu_ids && cpu_online(tcpu)) { |
| 3203 | *rflowp = rflow; | 3203 | *rflowp = rflow; |
| 3204 | cpu = tcpu; | 3204 | cpu = tcpu; |
| 3205 | goto done; | 3205 | goto done; |
| @@ -3240,14 +3240,14 @@ bool rps_may_expire_flow(struct net_device *dev, u16 rxq_index, | |||
| 3240 | struct rps_dev_flow_table *flow_table; | 3240 | struct rps_dev_flow_table *flow_table; |
| 3241 | struct rps_dev_flow *rflow; | 3241 | struct rps_dev_flow *rflow; |
| 3242 | bool expire = true; | 3242 | bool expire = true; |
| 3243 | int cpu; | 3243 | unsigned int cpu; |
| 3244 | 3244 | ||
| 3245 | rcu_read_lock(); | 3245 | rcu_read_lock(); |
| 3246 | flow_table = rcu_dereference(rxqueue->rps_flow_table); | 3246 | flow_table = rcu_dereference(rxqueue->rps_flow_table); |
| 3247 | if (flow_table && flow_id <= flow_table->mask) { | 3247 | if (flow_table && flow_id <= flow_table->mask) { |
| 3248 | rflow = &flow_table->flows[flow_id]; | 3248 | rflow = &flow_table->flows[flow_id]; |
| 3249 | cpu = ACCESS_ONCE(rflow->cpu); | 3249 | cpu = ACCESS_ONCE(rflow->cpu); |
| 3250 | if (rflow->filter == filter_id && cpu != RPS_NO_CPU && | 3250 | if (rflow->filter == filter_id && cpu < nr_cpu_ids && |
| 3251 | ((int)(per_cpu(softnet_data, cpu).input_queue_head - | 3251 | ((int)(per_cpu(softnet_data, cpu).input_queue_head - |
| 3252 | rflow->last_qtail) < | 3252 | rflow->last_qtail) < |
| 3253 | (int)(10 * flow_table->mask))) | 3253 | (int)(10 * flow_table->mask))) |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index d1967dab9cc6..3cfff2a3d651 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
| @@ -280,13 +280,14 @@ nodata: | |||
| 280 | EXPORT_SYMBOL(__alloc_skb); | 280 | EXPORT_SYMBOL(__alloc_skb); |
| 281 | 281 | ||
| 282 | /** | 282 | /** |
| 283 | * build_skb - build a network buffer | 283 | * __build_skb - build a network buffer |
| 284 | * @data: data buffer provided by caller | 284 | * @data: data buffer provided by caller |
| 285 | * @frag_size: size of fragment, or 0 if head was kmalloced | 285 | * @frag_size: size of data, or 0 if head was kmalloced |
| 286 | * | 286 | * |
| 287 | * Allocate a new &sk_buff. Caller provides space holding head and | 287 | * Allocate a new &sk_buff. Caller provides space holding head and |
| 288 | * skb_shared_info. @data must have been allocated by kmalloc() only if | 288 | * skb_shared_info. @data must have been allocated by kmalloc() only if |
| 289 | * @frag_size is 0, otherwise data should come from the page allocator. | 289 | * @frag_size is 0, otherwise data should come from the page allocator |
| 290 | * or vmalloc() | ||
| 290 | * The return is the new skb buffer. | 291 | * The return is the new skb buffer. |
| 291 | * On a failure the return is %NULL, and @data is not freed. | 292 | * On a failure the return is %NULL, and @data is not freed. |
| 292 | * Notes : | 293 | * Notes : |
| @@ -297,7 +298,7 @@ EXPORT_SYMBOL(__alloc_skb); | |||
| 297 | * before giving packet to stack. | 298 | * before giving packet to stack. |
| 298 | * RX rings only contains data buffers, not full skbs. | 299 | * RX rings only contains data buffers, not full skbs. |
| 299 | */ | 300 | */ |
| 300 | struct sk_buff *build_skb(void *data, unsigned int frag_size) | 301 | struct sk_buff *__build_skb(void *data, unsigned int frag_size) |
| 301 | { | 302 | { |
| 302 | struct skb_shared_info *shinfo; | 303 | struct skb_shared_info *shinfo; |
| 303 | struct sk_buff *skb; | 304 | struct sk_buff *skb; |
| @@ -311,7 +312,6 @@ struct sk_buff *build_skb(void *data, unsigned int frag_size) | |||
| 311 | 312 | ||
| 312 | memset(skb, 0, offsetof(struct sk_buff, tail)); | 313 | memset(skb, 0, offsetof(struct sk_buff, tail)); |
| 313 | skb->truesize = SKB_TRUESIZE(size); | 314 | skb->truesize = SKB_TRUESIZE(size); |
| 314 | skb->head_frag = frag_size != 0; | ||
| 315 | atomic_set(&skb->users, 1); | 315 | atomic_set(&skb->users, 1); |
| 316 | skb->head = data; | 316 | skb->head = data; |
| 317 | skb->data = data; | 317 | skb->data = data; |
| @@ -328,6 +328,23 @@ struct sk_buff *build_skb(void *data, unsigned int frag_size) | |||
| 328 | 328 | ||
| 329 | return skb; | 329 | return skb; |
| 330 | } | 330 | } |
| 331 | |||
| 332 | /* build_skb() is wrapper over __build_skb(), that specifically | ||
| 333 | * takes care of skb->head and skb->pfmemalloc | ||
| 334 | * This means that if @frag_size is not zero, then @data must be backed | ||
| 335 | * by a page fragment, not kmalloc() or vmalloc() | ||
| 336 | */ | ||
| 337 | struct sk_buff *build_skb(void *data, unsigned int frag_size) | ||
| 338 | { | ||
| 339 | struct sk_buff *skb = __build_skb(data, frag_size); | ||
| 340 | |||
| 341 | if (skb && frag_size) { | ||
| 342 | skb->head_frag = 1; | ||
| 343 | if (virt_to_head_page(data)->pfmemalloc) | ||
| 344 | skb->pfmemalloc = 1; | ||
| 345 | } | ||
| 346 | return skb; | ||
| 347 | } | ||
| 331 | EXPORT_SYMBOL(build_skb); | 348 | EXPORT_SYMBOL(build_skb); |
| 332 | 349 | ||
| 333 | struct netdev_alloc_cache { | 350 | struct netdev_alloc_cache { |
| @@ -348,7 +365,8 @@ static struct page *__page_frag_refill(struct netdev_alloc_cache *nc, | |||
| 348 | gfp_t gfp = gfp_mask; | 365 | gfp_t gfp = gfp_mask; |
| 349 | 366 | ||
| 350 | if (order) { | 367 | if (order) { |
| 351 | gfp_mask |= __GFP_COMP | __GFP_NOWARN | __GFP_NORETRY; | 368 | gfp_mask |= __GFP_COMP | __GFP_NOWARN | __GFP_NORETRY | |
| 369 | __GFP_NOMEMALLOC; | ||
| 352 | page = alloc_pages_node(NUMA_NO_NODE, gfp_mask, order); | 370 | page = alloc_pages_node(NUMA_NO_NODE, gfp_mask, order); |
| 353 | nc->frag.size = PAGE_SIZE << (page ? order : 0); | 371 | nc->frag.size = PAGE_SIZE << (page ? order : 0); |
| 354 | } | 372 | } |
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index 2b4f21d34df6..ccf4c5629b3c 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
| @@ -453,7 +453,8 @@ static struct sock *dccp_v4_hnd_req(struct sock *sk, struct sk_buff *skb) | |||
| 453 | iph->saddr, iph->daddr); | 453 | iph->saddr, iph->daddr); |
| 454 | if (req) { | 454 | if (req) { |
| 455 | nsk = dccp_check_req(sk, skb, req); | 455 | nsk = dccp_check_req(sk, skb, req); |
| 456 | reqsk_put(req); | 456 | if (!nsk) |
| 457 | reqsk_put(req); | ||
| 457 | return nsk; | 458 | return nsk; |
| 458 | } | 459 | } |
| 459 | nsk = inet_lookup_established(sock_net(sk), &dccp_hashinfo, | 460 | nsk = inet_lookup_established(sock_net(sk), &dccp_hashinfo, |
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index 9d0551092c6c..5165571f397a 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c | |||
| @@ -301,7 +301,8 @@ static struct sock *dccp_v6_hnd_req(struct sock *sk,struct sk_buff *skb) | |||
| 301 | &iph->daddr, inet6_iif(skb)); | 301 | &iph->daddr, inet6_iif(skb)); |
| 302 | if (req) { | 302 | if (req) { |
| 303 | nsk = dccp_check_req(sk, skb, req); | 303 | nsk = dccp_check_req(sk, skb, req); |
| 304 | reqsk_put(req); | 304 | if (!nsk) |
| 305 | reqsk_put(req); | ||
| 305 | return nsk; | 306 | return nsk; |
| 306 | } | 307 | } |
| 307 | nsk = __inet6_lookup_established(sock_net(sk), &dccp_hashinfo, | 308 | nsk = __inet6_lookup_established(sock_net(sk), &dccp_hashinfo, |
diff --git a/net/dccp/minisocks.c b/net/dccp/minisocks.c index 5f566663e47f..30addee2dd03 100644 --- a/net/dccp/minisocks.c +++ b/net/dccp/minisocks.c | |||
| @@ -186,8 +186,7 @@ struct sock *dccp_check_req(struct sock *sk, struct sk_buff *skb, | |||
| 186 | if (child == NULL) | 186 | if (child == NULL) |
| 187 | goto listen_overflow; | 187 | goto listen_overflow; |
| 188 | 188 | ||
| 189 | inet_csk_reqsk_queue_unlink(sk, req); | 189 | inet_csk_reqsk_queue_drop(sk, req); |
| 190 | inet_csk_reqsk_queue_removed(sk, req); | ||
| 191 | inet_csk_reqsk_queue_add(sk, req, child); | 190 | inet_csk_reqsk_queue_add(sk, req, child); |
| 192 | out: | 191 | out: |
| 193 | return child; | 192 | return child; |
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index 5c3dd6267ed3..8976ca423a07 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
| @@ -564,6 +564,40 @@ int inet_rtx_syn_ack(struct sock *parent, struct request_sock *req) | |||
| 564 | } | 564 | } |
| 565 | EXPORT_SYMBOL(inet_rtx_syn_ack); | 565 | EXPORT_SYMBOL(inet_rtx_syn_ack); |
| 566 | 566 | ||
| 567 | /* return true if req was found in the syn_table[] */ | ||
| 568 | static bool reqsk_queue_unlink(struct request_sock_queue *queue, | ||
| 569 | struct request_sock *req) | ||
| 570 | { | ||
| 571 | struct listen_sock *lopt = queue->listen_opt; | ||
| 572 | struct request_sock **prev; | ||
| 573 | bool found = false; | ||
| 574 | |||
| 575 | spin_lock(&queue->syn_wait_lock); | ||
| 576 | |||
| 577 | for (prev = &lopt->syn_table[req->rsk_hash]; *prev != NULL; | ||
| 578 | prev = &(*prev)->dl_next) { | ||
| 579 | if (*prev == req) { | ||
| 580 | *prev = req->dl_next; | ||
| 581 | found = true; | ||
| 582 | break; | ||
| 583 | } | ||
| 584 | } | ||
| 585 | |||
| 586 | spin_unlock(&queue->syn_wait_lock); | ||
| 587 | if (del_timer(&req->rsk_timer)) | ||
| 588 | reqsk_put(req); | ||
| 589 | return found; | ||
| 590 | } | ||
| 591 | |||
| 592 | void inet_csk_reqsk_queue_drop(struct sock *sk, struct request_sock *req) | ||
| 593 | { | ||
| 594 | if (reqsk_queue_unlink(&inet_csk(sk)->icsk_accept_queue, req)) { | ||
| 595 | reqsk_queue_removed(&inet_csk(sk)->icsk_accept_queue, req); | ||
| 596 | reqsk_put(req); | ||
| 597 | } | ||
| 598 | } | ||
| 599 | EXPORT_SYMBOL(inet_csk_reqsk_queue_drop); | ||
| 600 | |||
| 567 | static void reqsk_timer_handler(unsigned long data) | 601 | static void reqsk_timer_handler(unsigned long data) |
| 568 | { | 602 | { |
| 569 | struct request_sock *req = (struct request_sock *)data; | 603 | struct request_sock *req = (struct request_sock *)data; |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 3571f2be4470..fc1c658ec6c1 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
| @@ -1348,7 +1348,8 @@ static struct sock *tcp_v4_hnd_req(struct sock *sk, struct sk_buff *skb) | |||
| 1348 | req = inet_csk_search_req(sk, th->source, iph->saddr, iph->daddr); | 1348 | req = inet_csk_search_req(sk, th->source, iph->saddr, iph->daddr); |
| 1349 | if (req) { | 1349 | if (req) { |
| 1350 | nsk = tcp_check_req(sk, skb, req, false); | 1350 | nsk = tcp_check_req(sk, skb, req, false); |
| 1351 | reqsk_put(req); | 1351 | if (!nsk) |
| 1352 | reqsk_put(req); | ||
| 1352 | return nsk; | 1353 | return nsk; |
| 1353 | } | 1354 | } |
| 1354 | 1355 | ||
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c index 63d6311b5365..e5d7649136fc 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c | |||
| @@ -755,10 +755,11 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb, | |||
| 755 | if (!child) | 755 | if (!child) |
| 756 | goto listen_overflow; | 756 | goto listen_overflow; |
| 757 | 757 | ||
| 758 | inet_csk_reqsk_queue_unlink(sk, req); | 758 | inet_csk_reqsk_queue_drop(sk, req); |
| 759 | inet_csk_reqsk_queue_removed(sk, req); | ||
| 760 | |||
| 761 | inet_csk_reqsk_queue_add(sk, req, child); | 759 | inet_csk_reqsk_queue_add(sk, req, child); |
| 760 | /* Warning: caller must not call reqsk_put(req); | ||
| 761 | * child stole last reference on it. | ||
| 762 | */ | ||
| 762 | return child; | 763 | return child; |
| 763 | 764 | ||
| 764 | listen_overflow: | 765 | listen_overflow: |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 8c8d7e06b72f..a369e8a70b2c 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
| @@ -2812,39 +2812,65 @@ begin_fwd: | |||
| 2812 | } | 2812 | } |
| 2813 | } | 2813 | } |
| 2814 | 2814 | ||
| 2815 | /* Send a fin. The caller locks the socket for us. This cannot be | 2815 | /* We allow to exceed memory limits for FIN packets to expedite |
| 2816 | * allowed to fail queueing a FIN frame under any circumstances. | 2816 | * connection tear down and (memory) recovery. |
| 2817 | * Otherwise tcp_send_fin() could be tempted to either delay FIN | ||
| 2818 | * or even be forced to close flow without any FIN. | ||
| 2819 | */ | ||
| 2820 | static void sk_forced_wmem_schedule(struct sock *sk, int size) | ||
| 2821 | { | ||
| 2822 | int amt, status; | ||
| 2823 | |||
| 2824 | if (size <= sk->sk_forward_alloc) | ||
| 2825 | return; | ||
| 2826 | amt = sk_mem_pages(size); | ||
| 2827 | sk->sk_forward_alloc += amt * SK_MEM_QUANTUM; | ||
| 2828 | sk_memory_allocated_add(sk, amt, &status); | ||
| 2829 | } | ||
| 2830 | |||
| 2831 | /* Send a FIN. The caller locks the socket for us. | ||
| 2832 | * We should try to send a FIN packet really hard, but eventually give up. | ||
| 2817 | */ | 2833 | */ |
| 2818 | void tcp_send_fin(struct sock *sk) | 2834 | void tcp_send_fin(struct sock *sk) |
| 2819 | { | 2835 | { |
| 2836 | struct sk_buff *skb, *tskb = tcp_write_queue_tail(sk); | ||
| 2820 | struct tcp_sock *tp = tcp_sk(sk); | 2837 | struct tcp_sock *tp = tcp_sk(sk); |
| 2821 | struct sk_buff *skb = tcp_write_queue_tail(sk); | ||
| 2822 | int mss_now; | ||
| 2823 | 2838 | ||
| 2824 | /* Optimization, tack on the FIN if we have a queue of | 2839 | /* Optimization, tack on the FIN if we have one skb in write queue and |
| 2825 | * unsent frames. But be careful about outgoing SACKS | 2840 | * this skb was not yet sent, or we are under memory pressure. |
| 2826 | * and IP options. | 2841 | * Note: in the latter case, FIN packet will be sent after a timeout, |
| 2842 | * as TCP stack thinks it has already been transmitted. | ||
| 2827 | */ | 2843 | */ |
| 2828 | mss_now = tcp_current_mss(sk); | 2844 | if (tskb && (tcp_send_head(sk) || sk_under_memory_pressure(sk))) { |
| 2829 | 2845 | coalesce: | |
| 2830 | if (tcp_send_head(sk)) { | 2846 | TCP_SKB_CB(tskb)->tcp_flags |= TCPHDR_FIN; |
| 2831 | TCP_SKB_CB(skb)->tcp_flags |= TCPHDR_FIN; | 2847 | TCP_SKB_CB(tskb)->end_seq++; |
| 2832 | TCP_SKB_CB(skb)->end_seq++; | ||
| 2833 | tp->write_seq++; | 2848 | tp->write_seq++; |
| 2849 | if (!tcp_send_head(sk)) { | ||
| 2850 | /* This means tskb was already sent. | ||
| 2851 | * Pretend we included the FIN on previous transmit. | ||
| 2852 | * We need to set tp->snd_nxt to the value it would have | ||
| 2853 | * if FIN had been sent. This is because retransmit path | ||
| 2854 | * does not change tp->snd_nxt. | ||
| 2855 | */ | ||
| 2856 | tp->snd_nxt++; | ||
| 2857 | return; | ||
| 2858 | } | ||
| 2834 | } else { | 2859 | } else { |
| 2835 | /* Socket is locked, keep trying until memory is available. */ | 2860 | skb = alloc_skb_fclone(MAX_TCP_HEADER, sk->sk_allocation); |
| 2836 | for (;;) { | 2861 | if (unlikely(!skb)) { |
| 2837 | skb = sk_stream_alloc_skb(sk, 0, sk->sk_allocation); | 2862 | if (tskb) |
| 2838 | if (skb) | 2863 | goto coalesce; |
| 2839 | break; | 2864 | return; |
| 2840 | yield(); | ||
| 2841 | } | 2865 | } |
| 2866 | skb_reserve(skb, MAX_TCP_HEADER); | ||
| 2867 | sk_forced_wmem_schedule(sk, skb->truesize); | ||
| 2842 | /* FIN eats a sequence byte, write_seq advanced by tcp_queue_skb(). */ | 2868 | /* FIN eats a sequence byte, write_seq advanced by tcp_queue_skb(). */ |
| 2843 | tcp_init_nondata_skb(skb, tp->write_seq, | 2869 | tcp_init_nondata_skb(skb, tp->write_seq, |
| 2844 | TCPHDR_ACK | TCPHDR_FIN); | 2870 | TCPHDR_ACK | TCPHDR_FIN); |
| 2845 | tcp_queue_skb(sk, skb); | 2871 | tcp_queue_skb(sk, skb); |
| 2846 | } | 2872 | } |
| 2847 | __tcp_push_pending_frames(sk, mss_now, TCP_NAGLE_OFF); | 2873 | __tcp_push_pending_frames(sk, tcp_current_mss(sk), TCP_NAGLE_OFF); |
| 2848 | } | 2874 | } |
| 2849 | 2875 | ||
| 2850 | /* We get here when a process closes a file descriptor (either due to | 2876 | /* We get here when a process closes a file descriptor (either due to |
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index b5e6cc1d4a73..a38d3ac0f18f 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c | |||
| @@ -1246,7 +1246,6 @@ static void ip6gre_tunnel_setup(struct net_device *dev) | |||
| 1246 | static int ip6gre_tunnel_init(struct net_device *dev) | 1246 | static int ip6gre_tunnel_init(struct net_device *dev) |
| 1247 | { | 1247 | { |
| 1248 | struct ip6_tnl *tunnel; | 1248 | struct ip6_tnl *tunnel; |
| 1249 | int i; | ||
| 1250 | 1249 | ||
| 1251 | tunnel = netdev_priv(dev); | 1250 | tunnel = netdev_priv(dev); |
| 1252 | 1251 | ||
| @@ -1260,16 +1259,10 @@ static int ip6gre_tunnel_init(struct net_device *dev) | |||
| 1260 | if (ipv6_addr_any(&tunnel->parms.raddr)) | 1259 | if (ipv6_addr_any(&tunnel->parms.raddr)) |
| 1261 | dev->header_ops = &ip6gre_header_ops; | 1260 | dev->header_ops = &ip6gre_header_ops; |
| 1262 | 1261 | ||
| 1263 | dev->tstats = alloc_percpu(struct pcpu_sw_netstats); | 1262 | dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); |
| 1264 | if (!dev->tstats) | 1263 | if (!dev->tstats) |
| 1265 | return -ENOMEM; | 1264 | return -ENOMEM; |
| 1266 | 1265 | ||
| 1267 | for_each_possible_cpu(i) { | ||
| 1268 | struct pcpu_sw_netstats *ip6gre_tunnel_stats; | ||
| 1269 | ip6gre_tunnel_stats = per_cpu_ptr(dev->tstats, i); | ||
| 1270 | u64_stats_init(&ip6gre_tunnel_stats->syncp); | ||
| 1271 | } | ||
| 1272 | |||
| 1273 | return 0; | 1266 | return 0; |
| 1274 | } | 1267 | } |
| 1275 | 1268 | ||
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index ad51df85aa00..b6575d665568 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
| @@ -946,7 +946,8 @@ static struct sock *tcp_v6_hnd_req(struct sock *sk, struct sk_buff *skb) | |||
| 946 | &ipv6_hdr(skb)->daddr, tcp_v6_iif(skb)); | 946 | &ipv6_hdr(skb)->daddr, tcp_v6_iif(skb)); |
| 947 | if (req) { | 947 | if (req) { |
| 948 | nsk = tcp_check_req(sk, skb, req, false); | 948 | nsk = tcp_check_req(sk, skb, req, false); |
| 949 | reqsk_put(req); | 949 | if (!nsk) |
| 950 | reqsk_put(req); | ||
| 950 | return nsk; | 951 | return nsk; |
| 951 | } | 952 | } |
| 952 | nsk = __inet6_lookup_established(sock_net(sk), &tcp_hashinfo, | 953 | nsk = __inet6_lookup_established(sock_net(sk), &tcp_hashinfo, |
diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c index db8a2ea6d4de..954810c76a86 100644 --- a/net/mpls/af_mpls.c +++ b/net/mpls/af_mpls.c | |||
| @@ -53,6 +53,11 @@ static struct mpls_route *mpls_route_input_rcu(struct net *net, unsigned index) | |||
| 53 | return rt; | 53 | return rt; |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | static inline struct mpls_dev *mpls_dev_get(const struct net_device *dev) | ||
| 57 | { | ||
| 58 | return rcu_dereference_rtnl(dev->mpls_ptr); | ||
| 59 | } | ||
| 60 | |||
| 56 | static bool mpls_output_possible(const struct net_device *dev) | 61 | static bool mpls_output_possible(const struct net_device *dev) |
| 57 | { | 62 | { |
| 58 | return dev && (dev->flags & IFF_UP) && netif_carrier_ok(dev); | 63 | return dev && (dev->flags & IFF_UP) && netif_carrier_ok(dev); |
| @@ -136,6 +141,7 @@ static int mpls_forward(struct sk_buff *skb, struct net_device *dev, | |||
| 136 | struct mpls_route *rt; | 141 | struct mpls_route *rt; |
| 137 | struct mpls_entry_decoded dec; | 142 | struct mpls_entry_decoded dec; |
| 138 | struct net_device *out_dev; | 143 | struct net_device *out_dev; |
| 144 | struct mpls_dev *mdev; | ||
| 139 | unsigned int hh_len; | 145 | unsigned int hh_len; |
| 140 | unsigned int new_header_size; | 146 | unsigned int new_header_size; |
| 141 | unsigned int mtu; | 147 | unsigned int mtu; |
| @@ -143,6 +149,10 @@ static int mpls_forward(struct sk_buff *skb, struct net_device *dev, | |||
| 143 | 149 | ||
| 144 | /* Careful this entire function runs inside of an rcu critical section */ | 150 | /* Careful this entire function runs inside of an rcu critical section */ |
| 145 | 151 | ||
| 152 | mdev = mpls_dev_get(dev); | ||
| 153 | if (!mdev || !mdev->input_enabled) | ||
| 154 | goto drop; | ||
| 155 | |||
| 146 | if (skb->pkt_type != PACKET_HOST) | 156 | if (skb->pkt_type != PACKET_HOST) |
| 147 | goto drop; | 157 | goto drop; |
| 148 | 158 | ||
| @@ -352,9 +362,9 @@ static int mpls_route_add(struct mpls_route_config *cfg) | |||
| 352 | if (!dev) | 362 | if (!dev) |
| 353 | goto errout; | 363 | goto errout; |
| 354 | 364 | ||
| 355 | /* For now just support ethernet devices */ | 365 | /* Ensure this is a supported device */ |
| 356 | err = -EINVAL; | 366 | err = -EINVAL; |
| 357 | if ((dev->type != ARPHRD_ETHER) && (dev->type != ARPHRD_LOOPBACK)) | 367 | if (!mpls_dev_get(dev)) |
| 358 | goto errout; | 368 | goto errout; |
| 359 | 369 | ||
| 360 | err = -EINVAL; | 370 | err = -EINVAL; |
| @@ -428,10 +438,89 @@ errout: | |||
| 428 | return err; | 438 | return err; |
| 429 | } | 439 | } |
| 430 | 440 | ||
| 441 | #define MPLS_PERDEV_SYSCTL_OFFSET(field) \ | ||
| 442 | (&((struct mpls_dev *)0)->field) | ||
| 443 | |||
| 444 | static const struct ctl_table mpls_dev_table[] = { | ||
| 445 | { | ||
| 446 | .procname = "input", | ||
| 447 | .maxlen = sizeof(int), | ||
| 448 | .mode = 0644, | ||
| 449 | .proc_handler = proc_dointvec, | ||
| 450 | .data = MPLS_PERDEV_SYSCTL_OFFSET(input_enabled), | ||
| 451 | }, | ||
| 452 | { } | ||
| 453 | }; | ||
| 454 | |||
| 455 | static int mpls_dev_sysctl_register(struct net_device *dev, | ||
| 456 | struct mpls_dev *mdev) | ||
| 457 | { | ||
| 458 | char path[sizeof("net/mpls/conf/") + IFNAMSIZ]; | ||
| 459 | struct ctl_table *table; | ||
| 460 | int i; | ||
| 461 | |||
| 462 | table = kmemdup(&mpls_dev_table, sizeof(mpls_dev_table), GFP_KERNEL); | ||
| 463 | if (!table) | ||
| 464 | goto out; | ||
| 465 | |||
| 466 | /* Table data contains only offsets relative to the base of | ||
| 467 | * the mdev at this point, so make them absolute. | ||
| 468 | */ | ||
| 469 | for (i = 0; i < ARRAY_SIZE(mpls_dev_table); i++) | ||
| 470 | table[i].data = (char *)mdev + (uintptr_t)table[i].data; | ||
| 471 | |||
| 472 | snprintf(path, sizeof(path), "net/mpls/conf/%s", dev->name); | ||
| 473 | |||
| 474 | mdev->sysctl = register_net_sysctl(dev_net(dev), path, table); | ||
| 475 | if (!mdev->sysctl) | ||
| 476 | goto free; | ||
| 477 | |||
| 478 | return 0; | ||
| 479 | |||
| 480 | free: | ||
| 481 | kfree(table); | ||
| 482 | out: | ||
| 483 | return -ENOBUFS; | ||
| 484 | } | ||
| 485 | |||
| 486 | static void mpls_dev_sysctl_unregister(struct mpls_dev *mdev) | ||
| 487 | { | ||
| 488 | struct ctl_table *table; | ||
| 489 | |||
| 490 | table = mdev->sysctl->ctl_table_arg; | ||
| 491 | unregister_net_sysctl_table(mdev->sysctl); | ||
| 492 | kfree(table); | ||
| 493 | } | ||
| 494 | |||
| 495 | static struct mpls_dev *mpls_add_dev(struct net_device *dev) | ||
| 496 | { | ||
| 497 | struct mpls_dev *mdev; | ||
| 498 | int err = -ENOMEM; | ||
| 499 | |||
| 500 | ASSERT_RTNL(); | ||
| 501 | |||
| 502 | mdev = kzalloc(sizeof(*mdev), GFP_KERNEL); | ||
| 503 | if (!mdev) | ||
| 504 | return ERR_PTR(err); | ||
| 505 | |||
| 506 | err = mpls_dev_sysctl_register(dev, mdev); | ||
| 507 | if (err) | ||
| 508 | goto free; | ||
| 509 | |||
| 510 | rcu_assign_pointer(dev->mpls_ptr, mdev); | ||
| 511 | |||
| 512 | return mdev; | ||
| 513 | |||
| 514 | free: | ||
| 515 | kfree(mdev); | ||
| 516 | return ERR_PTR(err); | ||
| 517 | } | ||
| 518 | |||
| 431 | static void mpls_ifdown(struct net_device *dev) | 519 | static void mpls_ifdown(struct net_device *dev) |
| 432 | { | 520 | { |
| 433 | struct mpls_route __rcu **platform_label; | 521 | struct mpls_route __rcu **platform_label; |
| 434 | struct net *net = dev_net(dev); | 522 | struct net *net = dev_net(dev); |
| 523 | struct mpls_dev *mdev; | ||
| 435 | unsigned index; | 524 | unsigned index; |
| 436 | 525 | ||
| 437 | platform_label = rtnl_dereference(net->mpls.platform_label); | 526 | platform_label = rtnl_dereference(net->mpls.platform_label); |
| @@ -443,14 +532,35 @@ static void mpls_ifdown(struct net_device *dev) | |||
| 443 | continue; | 532 | continue; |
| 444 | rt->rt_dev = NULL; | 533 | rt->rt_dev = NULL; |
| 445 | } | 534 | } |
| 535 | |||
| 536 | mdev = mpls_dev_get(dev); | ||
| 537 | if (!mdev) | ||
| 538 | return; | ||
| 539 | |||
| 540 | mpls_dev_sysctl_unregister(mdev); | ||
| 541 | |||
| 542 | RCU_INIT_POINTER(dev->mpls_ptr, NULL); | ||
| 543 | |||
| 544 | kfree(mdev); | ||
| 446 | } | 545 | } |
| 447 | 546 | ||
| 448 | static int mpls_dev_notify(struct notifier_block *this, unsigned long event, | 547 | static int mpls_dev_notify(struct notifier_block *this, unsigned long event, |
| 449 | void *ptr) | 548 | void *ptr) |
| 450 | { | 549 | { |
| 451 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); | 550 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
| 551 | struct mpls_dev *mdev; | ||
| 452 | 552 | ||
| 453 | switch(event) { | 553 | switch(event) { |
| 554 | case NETDEV_REGISTER: | ||
| 555 | /* For now just support ethernet devices */ | ||
| 556 | if ((dev->type == ARPHRD_ETHER) || | ||
| 557 | (dev->type == ARPHRD_LOOPBACK)) { | ||
| 558 | mdev = mpls_add_dev(dev); | ||
| 559 | if (IS_ERR(mdev)) | ||
| 560 | return notifier_from_errno(PTR_ERR(mdev)); | ||
| 561 | } | ||
| 562 | break; | ||
| 563 | |||
| 454 | case NETDEV_UNREGISTER: | 564 | case NETDEV_UNREGISTER: |
| 455 | mpls_ifdown(dev); | 565 | mpls_ifdown(dev); |
| 456 | break; | 566 | break; |
| @@ -536,6 +646,15 @@ int nla_get_labels(const struct nlattr *nla, | |||
| 536 | if ((dec.bos != bos) || dec.ttl || dec.tc) | 646 | if ((dec.bos != bos) || dec.ttl || dec.tc) |
| 537 | return -EINVAL; | 647 | return -EINVAL; |
| 538 | 648 | ||
| 649 | switch (dec.label) { | ||
| 650 | case LABEL_IMPLICIT_NULL: | ||
| 651 | /* RFC3032: This is a label that an LSR may | ||
| 652 | * assign and distribute, but which never | ||
| 653 | * actually appears in the encapsulation. | ||
| 654 | */ | ||
| 655 | return -EINVAL; | ||
| 656 | } | ||
| 657 | |||
| 539 | label[i] = dec.label; | 658 | label[i] = dec.label; |
| 540 | } | 659 | } |
| 541 | *labels = nla_labels; | 660 | *labels = nla_labels; |
| @@ -912,7 +1031,7 @@ static int mpls_platform_labels(struct ctl_table *table, int write, | |||
| 912 | return ret; | 1031 | return ret; |
| 913 | } | 1032 | } |
| 914 | 1033 | ||
| 915 | static struct ctl_table mpls_table[] = { | 1034 | static const struct ctl_table mpls_table[] = { |
| 916 | { | 1035 | { |
| 917 | .procname = "platform_labels", | 1036 | .procname = "platform_labels", |
| 918 | .data = NULL, | 1037 | .data = NULL, |
diff --git a/net/mpls/internal.h b/net/mpls/internal.h index fb6de92052c4..693877d69606 100644 --- a/net/mpls/internal.h +++ b/net/mpls/internal.h | |||
| @@ -22,6 +22,12 @@ struct mpls_entry_decoded { | |||
| 22 | u8 bos; | 22 | u8 bos; |
| 23 | }; | 23 | }; |
| 24 | 24 | ||
| 25 | struct mpls_dev { | ||
| 26 | int input_enabled; | ||
| 27 | |||
| 28 | struct ctl_table_header *sysctl; | ||
| 29 | }; | ||
| 30 | |||
| 25 | struct sk_buff; | 31 | struct sk_buff; |
| 26 | 32 | ||
| 27 | static inline struct mpls_shim_hdr *mpls_hdr(const struct sk_buff *skb) | 33 | static inline struct mpls_shim_hdr *mpls_hdr(const struct sk_buff *skb) |
diff --git a/net/netfilter/nft_reject.c b/net/netfilter/nft_reject.c index 57d3e1af5630..0522fc9bfb0a 100644 --- a/net/netfilter/nft_reject.c +++ b/net/netfilter/nft_reject.c | |||
| @@ -63,6 +63,8 @@ int nft_reject_dump(struct sk_buff *skb, const struct nft_expr *expr) | |||
| 63 | if (nla_put_u8(skb, NFTA_REJECT_ICMP_CODE, priv->icmp_code)) | 63 | if (nla_put_u8(skb, NFTA_REJECT_ICMP_CODE, priv->icmp_code)) |
| 64 | goto nla_put_failure; | 64 | goto nla_put_failure; |
| 65 | break; | 65 | break; |
| 66 | default: | ||
| 67 | break; | ||
| 66 | } | 68 | } |
| 67 | 69 | ||
| 68 | return 0; | 70 | return 0; |
diff --git a/net/netfilter/nft_reject_inet.c b/net/netfilter/nft_reject_inet.c index 62cabee42fbe..635dbba93d01 100644 --- a/net/netfilter/nft_reject_inet.c +++ b/net/netfilter/nft_reject_inet.c | |||
| @@ -108,6 +108,8 @@ static int nft_reject_inet_dump(struct sk_buff *skb, | |||
| 108 | if (nla_put_u8(skb, NFTA_REJECT_ICMP_CODE, priv->icmp_code)) | 108 | if (nla_put_u8(skb, NFTA_REJECT_ICMP_CODE, priv->icmp_code)) |
| 109 | goto nla_put_failure; | 109 | goto nla_put_failure; |
| 110 | break; | 110 | break; |
| 111 | default: | ||
| 112 | break; | ||
| 111 | } | 113 | } |
| 112 | 114 | ||
| 113 | return 0; | 115 | return 0; |
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 19909d0786a2..ec4adbdcb9b4 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
| @@ -1629,13 +1629,11 @@ static struct sk_buff *netlink_alloc_large_skb(unsigned int size, | |||
| 1629 | if (data == NULL) | 1629 | if (data == NULL) |
| 1630 | return NULL; | 1630 | return NULL; |
| 1631 | 1631 | ||
| 1632 | skb = build_skb(data, size); | 1632 | skb = __build_skb(data, size); |
| 1633 | if (skb == NULL) | 1633 | if (skb == NULL) |
| 1634 | vfree(data); | 1634 | vfree(data); |
| 1635 | else { | 1635 | else |
| 1636 | skb->head_frag = 0; | ||
| 1637 | skb->destructor = netlink_skb_destructor; | 1636 | skb->destructor = netlink_skb_destructor; |
| 1638 | } | ||
| 1639 | 1637 | ||
| 1640 | return skb; | 1638 | return skb; |
| 1641 | } | 1639 | } |
diff --git a/net/tipc/link.c b/net/tipc/link.c index a6b30df6ec02..57be6e6aff99 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c | |||
| @@ -2143,7 +2143,6 @@ int tipc_nl_link_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
| 2143 | err = __tipc_nl_add_node_links(net, &msg, node, | 2143 | err = __tipc_nl_add_node_links(net, &msg, node, |
| 2144 | &prev_link); | 2144 | &prev_link); |
| 2145 | tipc_node_unlock(node); | 2145 | tipc_node_unlock(node); |
| 2146 | tipc_node_put(node); | ||
| 2147 | if (err) | 2146 | if (err) |
| 2148 | goto out; | 2147 | goto out; |
| 2149 | 2148 | ||
diff --git a/net/tipc/server.c b/net/tipc/server.c index ab6183cdb121..77ff03ed1e18 100644 --- a/net/tipc/server.c +++ b/net/tipc/server.c | |||
| @@ -102,7 +102,7 @@ static void tipc_conn_kref_release(struct kref *kref) | |||
| 102 | } | 102 | } |
| 103 | saddr->scope = -TIPC_NODE_SCOPE; | 103 | saddr->scope = -TIPC_NODE_SCOPE; |
| 104 | kernel_bind(sock, (struct sockaddr *)saddr, sizeof(*saddr)); | 104 | kernel_bind(sock, (struct sockaddr *)saddr, sizeof(*saddr)); |
| 105 | sk_release_kernel(sk); | 105 | sock_release(sock); |
| 106 | con->sock = NULL; | 106 | con->sock = NULL; |
| 107 | } | 107 | } |
| 108 | 108 | ||
| @@ -321,12 +321,9 @@ static struct socket *tipc_create_listen_sock(struct tipc_conn *con) | |||
| 321 | struct socket *sock = NULL; | 321 | struct socket *sock = NULL; |
| 322 | int ret; | 322 | int ret; |
| 323 | 323 | ||
| 324 | ret = sock_create_kern(AF_TIPC, SOCK_SEQPACKET, 0, &sock); | 324 | ret = __sock_create(s->net, AF_TIPC, SOCK_SEQPACKET, 0, &sock, 1); |
| 325 | if (ret < 0) | 325 | if (ret < 0) |
| 326 | return NULL; | 326 | return NULL; |
| 327 | |||
| 328 | sk_change_net(sock->sk, s->net); | ||
| 329 | |||
| 330 | ret = kernel_setsockopt(sock, SOL_TIPC, TIPC_IMPORTANCE, | 327 | ret = kernel_setsockopt(sock, SOL_TIPC, TIPC_IMPORTANCE, |
| 331 | (char *)&s->imp, sizeof(s->imp)); | 328 | (char *)&s->imp, sizeof(s->imp)); |
| 332 | if (ret < 0) | 329 | if (ret < 0) |
| @@ -376,7 +373,7 @@ static struct socket *tipc_create_listen_sock(struct tipc_conn *con) | |||
| 376 | 373 | ||
| 377 | create_err: | 374 | create_err: |
| 378 | kernel_sock_shutdown(sock, SHUT_RDWR); | 375 | kernel_sock_shutdown(sock, SHUT_RDWR); |
| 379 | sk_release_kernel(sock->sk); | 376 | sock_release(sock); |
| 380 | return NULL; | 377 | return NULL; |
| 381 | } | 378 | } |
| 382 | 379 | ||
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index ee90d74d7516..9074b5cede38 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c | |||
| @@ -1764,13 +1764,14 @@ static int tipc_sk_enqueue(struct sk_buff_head *inputq, struct sock *sk, | |||
| 1764 | int tipc_sk_rcv(struct net *net, struct sk_buff_head *inputq) | 1764 | int tipc_sk_rcv(struct net *net, struct sk_buff_head *inputq) |
| 1765 | { | 1765 | { |
| 1766 | u32 dnode, dport = 0; | 1766 | u32 dnode, dport = 0; |
| 1767 | int err = -TIPC_ERR_NO_PORT; | 1767 | int err; |
| 1768 | struct sk_buff *skb; | 1768 | struct sk_buff *skb; |
| 1769 | struct tipc_sock *tsk; | 1769 | struct tipc_sock *tsk; |
| 1770 | struct tipc_net *tn; | 1770 | struct tipc_net *tn; |
| 1771 | struct sock *sk; | 1771 | struct sock *sk; |
| 1772 | 1772 | ||
| 1773 | while (skb_queue_len(inputq)) { | 1773 | while (skb_queue_len(inputq)) { |
| 1774 | err = -TIPC_ERR_NO_PORT; | ||
| 1774 | skb = NULL; | 1775 | skb = NULL; |
| 1775 | dport = tipc_skb_peek_port(inputq, dport); | 1776 | dport = tipc_skb_peek_port(inputq, dport); |
| 1776 | tsk = tipc_sk_lookup(net, dport); | 1777 | tsk = tipc_sk_lookup(net, dport); |
diff --git a/net/unix/garbage.c b/net/unix/garbage.c index 99f7012b23b9..a73a226f2d33 100644 --- a/net/unix/garbage.c +++ b/net/unix/garbage.c | |||
| @@ -95,39 +95,36 @@ static DECLARE_WAIT_QUEUE_HEAD(unix_gc_wait); | |||
| 95 | 95 | ||
| 96 | unsigned int unix_tot_inflight; | 96 | unsigned int unix_tot_inflight; |
| 97 | 97 | ||
| 98 | |||
| 99 | struct sock *unix_get_socket(struct file *filp) | 98 | struct sock *unix_get_socket(struct file *filp) |
| 100 | { | 99 | { |
| 101 | struct sock *u_sock = NULL; | 100 | struct sock *u_sock = NULL; |
| 102 | struct inode *inode = file_inode(filp); | 101 | struct inode *inode = file_inode(filp); |
| 103 | 102 | ||
| 104 | /* | 103 | /* Socket ? */ |
| 105 | * Socket ? | ||
| 106 | */ | ||
| 107 | if (S_ISSOCK(inode->i_mode) && !(filp->f_mode & FMODE_PATH)) { | 104 | if (S_ISSOCK(inode->i_mode) && !(filp->f_mode & FMODE_PATH)) { |
| 108 | struct socket *sock = SOCKET_I(inode); | 105 | struct socket *sock = SOCKET_I(inode); |
| 109 | struct sock *s = sock->sk; | 106 | struct sock *s = sock->sk; |
| 110 | 107 | ||
| 111 | /* | 108 | /* PF_UNIX ? */ |
| 112 | * PF_UNIX ? | ||
| 113 | */ | ||
| 114 | if (s && sock->ops && sock->ops->family == PF_UNIX) | 109 | if (s && sock->ops && sock->ops->family == PF_UNIX) |
| 115 | u_sock = s; | 110 | u_sock = s; |
| 116 | } | 111 | } |
| 117 | return u_sock; | 112 | return u_sock; |
| 118 | } | 113 | } |
| 119 | 114 | ||
| 120 | /* | 115 | /* Keep the number of times in flight count for the file |
| 121 | * Keep the number of times in flight count for the file | 116 | * descriptor if it is for an AF_UNIX socket. |
| 122 | * descriptor if it is for an AF_UNIX socket. | ||
| 123 | */ | 117 | */ |
| 124 | 118 | ||
| 125 | void unix_inflight(struct file *fp) | 119 | void unix_inflight(struct file *fp) |
| 126 | { | 120 | { |
| 127 | struct sock *s = unix_get_socket(fp); | 121 | struct sock *s = unix_get_socket(fp); |
| 122 | |||
| 128 | if (s) { | 123 | if (s) { |
| 129 | struct unix_sock *u = unix_sk(s); | 124 | struct unix_sock *u = unix_sk(s); |
| 125 | |||
| 130 | spin_lock(&unix_gc_lock); | 126 | spin_lock(&unix_gc_lock); |
| 127 | |||
| 131 | if (atomic_long_inc_return(&u->inflight) == 1) { | 128 | if (atomic_long_inc_return(&u->inflight) == 1) { |
| 132 | BUG_ON(!list_empty(&u->link)); | 129 | BUG_ON(!list_empty(&u->link)); |
| 133 | list_add_tail(&u->link, &gc_inflight_list); | 130 | list_add_tail(&u->link, &gc_inflight_list); |
| @@ -142,10 +139,13 @@ void unix_inflight(struct file *fp) | |||
| 142 | void unix_notinflight(struct file *fp) | 139 | void unix_notinflight(struct file *fp) |
| 143 | { | 140 | { |
| 144 | struct sock *s = unix_get_socket(fp); | 141 | struct sock *s = unix_get_socket(fp); |
| 142 | |||
| 145 | if (s) { | 143 | if (s) { |
| 146 | struct unix_sock *u = unix_sk(s); | 144 | struct unix_sock *u = unix_sk(s); |
| 145 | |||
| 147 | spin_lock(&unix_gc_lock); | 146 | spin_lock(&unix_gc_lock); |
| 148 | BUG_ON(list_empty(&u->link)); | 147 | BUG_ON(list_empty(&u->link)); |
| 148 | |||
| 149 | if (atomic_long_dec_and_test(&u->inflight)) | 149 | if (atomic_long_dec_and_test(&u->inflight)) |
| 150 | list_del_init(&u->link); | 150 | list_del_init(&u->link); |
| 151 | unix_tot_inflight--; | 151 | unix_tot_inflight--; |
| @@ -161,32 +161,27 @@ static void scan_inflight(struct sock *x, void (*func)(struct unix_sock *), | |||
| 161 | 161 | ||
| 162 | spin_lock(&x->sk_receive_queue.lock); | 162 | spin_lock(&x->sk_receive_queue.lock); |
| 163 | skb_queue_walk_safe(&x->sk_receive_queue, skb, next) { | 163 | skb_queue_walk_safe(&x->sk_receive_queue, skb, next) { |
| 164 | /* | 164 | /* Do we have file descriptors ? */ |
| 165 | * Do we have file descriptors ? | ||
| 166 | */ | ||
| 167 | if (UNIXCB(skb).fp) { | 165 | if (UNIXCB(skb).fp) { |
| 168 | bool hit = false; | 166 | bool hit = false; |
| 169 | /* | 167 | /* Process the descriptors of this socket */ |
| 170 | * Process the descriptors of this socket | ||
| 171 | */ | ||
| 172 | int nfd = UNIXCB(skb).fp->count; | 168 | int nfd = UNIXCB(skb).fp->count; |
| 173 | struct file **fp = UNIXCB(skb).fp->fp; | 169 | struct file **fp = UNIXCB(skb).fp->fp; |
| 170 | |||
| 174 | while (nfd--) { | 171 | while (nfd--) { |
| 175 | /* | 172 | /* Get the socket the fd matches if it indeed does so */ |
| 176 | * Get the socket the fd matches | ||
| 177 | * if it indeed does so | ||
| 178 | */ | ||
| 179 | struct sock *sk = unix_get_socket(*fp++); | 173 | struct sock *sk = unix_get_socket(*fp++); |
| 174 | |||
| 180 | if (sk) { | 175 | if (sk) { |
| 181 | struct unix_sock *u = unix_sk(sk); | 176 | struct unix_sock *u = unix_sk(sk); |
| 182 | 177 | ||
| 183 | /* | 178 | /* Ignore non-candidates, they could |
| 184 | * Ignore non-candidates, they could | ||
| 185 | * have been added to the queues after | 179 | * have been added to the queues after |
| 186 | * starting the garbage collection | 180 | * starting the garbage collection |
| 187 | */ | 181 | */ |
| 188 | if (test_bit(UNIX_GC_CANDIDATE, &u->gc_flags)) { | 182 | if (test_bit(UNIX_GC_CANDIDATE, &u->gc_flags)) { |
| 189 | hit = true; | 183 | hit = true; |
| 184 | |||
| 190 | func(u); | 185 | func(u); |
| 191 | } | 186 | } |
| 192 | } | 187 | } |
| @@ -203,24 +198,22 @@ static void scan_inflight(struct sock *x, void (*func)(struct unix_sock *), | |||
| 203 | static void scan_children(struct sock *x, void (*func)(struct unix_sock *), | 198 | static void scan_children(struct sock *x, void (*func)(struct unix_sock *), |
| 204 | struct sk_buff_head *hitlist) | 199 | struct sk_buff_head *hitlist) |
| 205 | { | 200 | { |
| 206 | if (x->sk_state != TCP_LISTEN) | 201 | if (x->sk_state != TCP_LISTEN) { |
| 207 | scan_inflight(x, func, hitlist); | 202 | scan_inflight(x, func, hitlist); |
| 208 | else { | 203 | } else { |
| 209 | struct sk_buff *skb; | 204 | struct sk_buff *skb; |
| 210 | struct sk_buff *next; | 205 | struct sk_buff *next; |
| 211 | struct unix_sock *u; | 206 | struct unix_sock *u; |
| 212 | LIST_HEAD(embryos); | 207 | LIST_HEAD(embryos); |
| 213 | 208 | ||
| 214 | /* | 209 | /* For a listening socket collect the queued embryos |
| 215 | * For a listening socket collect the queued embryos | ||
| 216 | * and perform a scan on them as well. | 210 | * and perform a scan on them as well. |
| 217 | */ | 211 | */ |
| 218 | spin_lock(&x->sk_receive_queue.lock); | 212 | spin_lock(&x->sk_receive_queue.lock); |
| 219 | skb_queue_walk_safe(&x->sk_receive_queue, skb, next) { | 213 | skb_queue_walk_safe(&x->sk_receive_queue, skb, next) { |
| 220 | u = unix_sk(skb->sk); | 214 | u = unix_sk(skb->sk); |
| 221 | 215 | ||
| 222 | /* | 216 | /* An embryo cannot be in-flight, so it's safe |
| 223 | * An embryo cannot be in-flight, so it's safe | ||
| 224 | * to use the list link. | 217 | * to use the list link. |
| 225 | */ | 218 | */ |
| 226 | BUG_ON(!list_empty(&u->link)); | 219 | BUG_ON(!list_empty(&u->link)); |
| @@ -249,8 +242,7 @@ static void inc_inflight(struct unix_sock *usk) | |||
| 249 | static void inc_inflight_move_tail(struct unix_sock *u) | 242 | static void inc_inflight_move_tail(struct unix_sock *u) |
| 250 | { | 243 | { |
| 251 | atomic_long_inc(&u->inflight); | 244 | atomic_long_inc(&u->inflight); |
| 252 | /* | 245 | /* If this still might be part of a cycle, move it to the end |
| 253 | * If this still might be part of a cycle, move it to the end | ||
| 254 | * of the list, so that it's checked even if it was already | 246 | * of the list, so that it's checked even if it was already |
| 255 | * passed over | 247 | * passed over |
| 256 | */ | 248 | */ |
| @@ -263,8 +255,7 @@ static bool gc_in_progress; | |||
| 263 | 255 | ||
| 264 | void wait_for_unix_gc(void) | 256 | void wait_for_unix_gc(void) |
| 265 | { | 257 | { |
| 266 | /* | 258 | /* If number of inflight sockets is insane, |
| 267 | * If number of inflight sockets is insane, | ||
| 268 | * force a garbage collect right now. | 259 | * force a garbage collect right now. |
| 269 | */ | 260 | */ |
| 270 | if (unix_tot_inflight > UNIX_INFLIGHT_TRIGGER_GC && !gc_in_progress) | 261 | if (unix_tot_inflight > UNIX_INFLIGHT_TRIGGER_GC && !gc_in_progress) |
| @@ -288,8 +279,7 @@ void unix_gc(void) | |||
| 288 | goto out; | 279 | goto out; |
| 289 | 280 | ||
| 290 | gc_in_progress = true; | 281 | gc_in_progress = true; |
| 291 | /* | 282 | /* First, select candidates for garbage collection. Only |
| 292 | * First, select candidates for garbage collection. Only | ||
| 293 | * in-flight sockets are considered, and from those only ones | 283 | * in-flight sockets are considered, and from those only ones |
| 294 | * which don't have any external reference. | 284 | * which don't have any external reference. |
| 295 | * | 285 | * |
| @@ -320,15 +310,13 @@ void unix_gc(void) | |||
| 320 | } | 310 | } |
| 321 | } | 311 | } |
| 322 | 312 | ||
| 323 | /* | 313 | /* Now remove all internal in-flight reference to children of |
| 324 | * Now remove all internal in-flight reference to children of | ||
| 325 | * the candidates. | 314 | * the candidates. |
| 326 | */ | 315 | */ |
| 327 | list_for_each_entry(u, &gc_candidates, link) | 316 | list_for_each_entry(u, &gc_candidates, link) |
| 328 | scan_children(&u->sk, dec_inflight, NULL); | 317 | scan_children(&u->sk, dec_inflight, NULL); |
| 329 | 318 | ||
| 330 | /* | 319 | /* Restore the references for children of all candidates, |
| 331 | * Restore the references for children of all candidates, | ||
| 332 | * which have remaining references. Do this recursively, so | 320 | * which have remaining references. Do this recursively, so |
| 333 | * only those remain, which form cyclic references. | 321 | * only those remain, which form cyclic references. |
| 334 | * | 322 | * |
| @@ -350,8 +338,7 @@ void unix_gc(void) | |||
| 350 | } | 338 | } |
| 351 | list_del(&cursor); | 339 | list_del(&cursor); |
| 352 | 340 | ||
| 353 | /* | 341 | /* not_cycle_list contains those sockets which do not make up a |
| 354 | * not_cycle_list contains those sockets which do not make up a | ||
| 355 | * cycle. Restore these to the inflight list. | 342 | * cycle. Restore these to the inflight list. |
| 356 | */ | 343 | */ |
| 357 | while (!list_empty(¬_cycle_list)) { | 344 | while (!list_empty(¬_cycle_list)) { |
| @@ -360,8 +347,7 @@ void unix_gc(void) | |||
| 360 | list_move_tail(&u->link, &gc_inflight_list); | 347 | list_move_tail(&u->link, &gc_inflight_list); |
| 361 | } | 348 | } |
| 362 | 349 | ||
| 363 | /* | 350 | /* Now gc_candidates contains only garbage. Restore original |
| 364 | * Now gc_candidates contains only garbage. Restore original | ||
| 365 | * inflight counters for these as well, and remove the skbuffs | 351 | * inflight counters for these as well, and remove the skbuffs |
| 366 | * which are creating the cycle(s). | 352 | * which are creating the cycle(s). |
| 367 | */ | 353 | */ |
