aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/Kconfig2
-rw-r--r--drivers/net/ethernet/broadcom/bgmac.c18
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c58
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c4
-rw-r--r--drivers/net/ethernet/freescale/fec.c58
-rw-r--r--drivers/net/ethernet/freescale/gianfar.c26
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_netdev.c4
-rw-r--r--drivers/net/ethernet/pasemi/pasemi_mac.c9
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic.h6
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c7
-rw-r--r--drivers/net/usb/smsc95xx.c36
-rw-r--r--drivers/net/vmxnet3/vmxnet3_drv.c4
-rw-r--r--drivers/net/vmxnet3/vmxnet3_ethtool.c6
-rw-r--r--drivers/net/vxlan.c3
-rw-r--r--drivers/net/wireless/b43/main.c3
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c4
-rw-r--r--drivers/net/wireless/mwifiex/pcie.c21
-rw-r--r--drivers/net/wireless/mwifiex/sdio.c9
-rw-r--r--include/linux/if_vlan.h6
-rw-r--r--include/net/icmp.h1
-rw-r--r--include/net/inet6_hashtables.h8
-rw-r--r--include/net/inet_frag.h8
-rw-r--r--include/net/inet_sock.h1
-rw-r--r--include/net/ipip.h17
-rw-r--r--include/net/ipv6.h12
-rw-r--r--net/core/dev.c4
-rw-r--r--net/core/sock.c2
-rw-r--r--net/core/sock_diag.c27
-rw-r--r--net/ipv4/af_inet.c17
-rw-r--r--net/ipv4/icmp.c23
-rw-r--r--net/ipv4/ip_gre.c25
-rw-r--r--net/ipv4/ping.c4
-rw-r--r--net/ipv4/tcp_output.c18
33 files changed, 218 insertions, 233 deletions
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 56c2d75a63d4..87f1d39ca551 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -150,7 +150,7 @@ config MACVTAP
150 150
151config VXLAN 151config VXLAN
152 tristate "Virtual eXtensible Local Area Network (VXLAN)" 152 tristate "Virtual eXtensible Local Area Network (VXLAN)"
153 depends on EXPERIMENTAL && INET 153 depends on INET
154 ---help--- 154 ---help---
155 This allows one to create vxlan virtual interfaces that provide 155 This allows one to create vxlan virtual interfaces that provide
156 Layer 2 Networks over Layer 3 Networks. VXLAN is often used 156 Layer 2 Networks over Layer 3 Networks. VXLAN is often used
diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c
index 3fd32880e526..bf985c04524e 100644
--- a/drivers/net/ethernet/broadcom/bgmac.c
+++ b/drivers/net/ethernet/broadcom/bgmac.c
@@ -436,6 +436,8 @@ static int bgmac_dma_alloc(struct bgmac *bgmac)
436 } 436 }
437 437
438 for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) { 438 for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) {
439 int j;
440
439 ring = &bgmac->rx_ring[i]; 441 ring = &bgmac->rx_ring[i];
440 ring->num_slots = BGMAC_RX_RING_SLOTS; 442 ring->num_slots = BGMAC_RX_RING_SLOTS;
441 ring->mmio_base = ring_base[i]; 443 ring->mmio_base = ring_base[i];
@@ -458,8 +460,8 @@ static int bgmac_dma_alloc(struct bgmac *bgmac)
458 bgmac_warn(bgmac, "DMA address using 0xC0000000 bit(s), it may need translation trick\n"); 460 bgmac_warn(bgmac, "DMA address using 0xC0000000 bit(s), it may need translation trick\n");
459 461
460 /* Alloc RX slots */ 462 /* Alloc RX slots */
461 for (i = 0; i < ring->num_slots; i++) { 463 for (j = 0; j < ring->num_slots; j++) {
462 err = bgmac_dma_rx_skb_for_slot(bgmac, &ring->slots[i]); 464 err = bgmac_dma_rx_skb_for_slot(bgmac, &ring->slots[j]);
463 if (err) { 465 if (err) {
464 bgmac_err(bgmac, "Can't allocate skb for slot in RX ring\n"); 466 bgmac_err(bgmac, "Can't allocate skb for slot in RX ring\n");
465 goto err_dma_free; 467 goto err_dma_free;
@@ -496,6 +498,8 @@ static void bgmac_dma_init(struct bgmac *bgmac)
496 } 498 }
497 499
498 for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) { 500 for (i = 0; i < BGMAC_MAX_RX_RINGS; i++) {
501 int j;
502
499 ring = &bgmac->rx_ring[i]; 503 ring = &bgmac->rx_ring[i];
500 504
501 /* We don't implement unaligned addressing, so enable first */ 505 /* We don't implement unaligned addressing, so enable first */
@@ -505,11 +509,11 @@ static void bgmac_dma_init(struct bgmac *bgmac)
505 bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_RX_RINGHI, 509 bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_RX_RINGHI,
506 upper_32_bits(ring->dma_base)); 510 upper_32_bits(ring->dma_base));
507 511
508 for (i = 0, dma_desc = ring->cpu_base; i < ring->num_slots; 512 for (j = 0, dma_desc = ring->cpu_base; j < ring->num_slots;
509 i++, dma_desc++) { 513 j++, dma_desc++) {
510 ctl0 = ctl1 = 0; 514 ctl0 = ctl1 = 0;
511 515
512 if (i == ring->num_slots - 1) 516 if (j == ring->num_slots - 1)
513 ctl0 |= BGMAC_DESC_CTL0_EOT; 517 ctl0 |= BGMAC_DESC_CTL0_EOT;
514 ctl1 |= BGMAC_RX_BUF_SIZE & BGMAC_DESC_CTL1_LEN; 518 ctl1 |= BGMAC_RX_BUF_SIZE & BGMAC_DESC_CTL1_LEN;
515 /* Is there any BGMAC device that requires extension? */ 519 /* Is there any BGMAC device that requires extension? */
@@ -517,8 +521,8 @@ static void bgmac_dma_init(struct bgmac *bgmac)
517 * B43_DMA64_DCTL1_ADDREXT_MASK; 521 * B43_DMA64_DCTL1_ADDREXT_MASK;
518 */ 522 */
519 523
520 dma_desc->addr_low = cpu_to_le32(lower_32_bits(ring->slots[i].dma_addr)); 524 dma_desc->addr_low = cpu_to_le32(lower_32_bits(ring->slots[j].dma_addr));
521 dma_desc->addr_high = cpu_to_le32(upper_32_bits(ring->slots[i].dma_addr)); 525 dma_desc->addr_high = cpu_to_le32(upper_32_bits(ring->slots[j].dma_addr));
522 dma_desc->ctl0 = cpu_to_le32(ctl0); 526 dma_desc->ctl0 = cpu_to_le32(ctl0);
523 dma_desc->ctl1 = cpu_to_le32(ctl1); 527 dma_desc->ctl1 = cpu_to_le32(ctl1);
524 } 528 }
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
index c6da77fa9d07..1663e0b6b5a0 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
@@ -13013,64 +13013,6 @@ static int bnx2x_84833_common_init_phy(struct bnx2x *bp,
13013 return 0; 13013 return 0;
13014} 13014}
13015 13015
13016static int bnx2x_84833_pre_init_phy(struct bnx2x *bp,
13017 struct bnx2x_phy *phy,
13018 u8 port)
13019{
13020 u16 val, cnt;
13021 /* Wait for FW completing its initialization. */
13022 for (cnt = 0; cnt < 1500; cnt++) {
13023 bnx2x_cl45_read(bp, phy,
13024 MDIO_PMA_DEVAD,
13025 MDIO_PMA_REG_CTRL, &val);
13026 if (!(val & (1<<15)))
13027 break;
13028 usleep_range(1000, 2000);
13029 }
13030 if (cnt >= 1500) {
13031 DP(NETIF_MSG_LINK, "84833 reset timeout\n");
13032 return -EINVAL;
13033 }
13034
13035 /* Put the port in super isolate mode. */
13036 bnx2x_cl45_read(bp, phy,
13037 MDIO_CTL_DEVAD,
13038 MDIO_84833_TOP_CFG_XGPHY_STRAP1, &val);
13039 val |= MDIO_84833_SUPER_ISOLATE;
13040 bnx2x_cl45_write(bp, phy,
13041 MDIO_CTL_DEVAD,
13042 MDIO_84833_TOP_CFG_XGPHY_STRAP1, val);
13043
13044 /* Save spirom version */
13045 bnx2x_save_848xx_spirom_version(phy, bp, port);
13046 return 0;
13047}
13048
13049int bnx2x_pre_init_phy(struct bnx2x *bp,
13050 u32 shmem_base,
13051 u32 shmem2_base,
13052 u32 chip_id,
13053 u8 port)
13054{
13055 int rc = 0;
13056 struct bnx2x_phy phy;
13057 if (bnx2x_populate_phy(bp, EXT_PHY1, shmem_base, shmem2_base,
13058 port, &phy) != 0) {
13059 DP(NETIF_MSG_LINK, "populate_phy failed\n");
13060 return -EINVAL;
13061 }
13062 bnx2x_set_mdio_clk(bp, chip_id, phy.mdio_ctrl);
13063 switch (phy.type) {
13064 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833:
13065 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84834:
13066 rc = bnx2x_84833_pre_init_phy(bp, &phy, port);
13067 break;
13068 default:
13069 break;
13070 }
13071 return rc;
13072}
13073
13074static int bnx2x_ext_phy_common_init(struct bnx2x *bp, u32 shmem_base_path[], 13016static int bnx2x_ext_phy_common_init(struct bnx2x *bp, u32 shmem_base_path[],
13075 u32 shmem2_base_path[], u8 phy_index, 13017 u32 shmem2_base_path[], u8 phy_index,
13076 u32 ext_phy_type, u32 chip_id) 13018 u32 ext_phy_type, u32 chip_id)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c
index 36246129864c..531eebf40d60 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c
@@ -98,7 +98,7 @@ static inline int bnx2x_pfvf_status_codes(int rc)
98 } 98 }
99} 99}
100 100
101int bnx2x_send_msg2pf(struct bnx2x *bp, u8 *done, dma_addr_t msg_mapping) 101static int bnx2x_send_msg2pf(struct bnx2x *bp, u8 *done, dma_addr_t msg_mapping)
102{ 102{
103 struct cstorm_vf_zone_data __iomem *zone_data = 103 struct cstorm_vf_zone_data __iomem *zone_data =
104 REG_ADDR(bp, PXP_VF_ADDR_CSDM_GLOBAL_START); 104 REG_ADDR(bp, PXP_VF_ADDR_CSDM_GLOBAL_START);
@@ -141,7 +141,7 @@ int bnx2x_send_msg2pf(struct bnx2x *bp, u8 *done, dma_addr_t msg_mapping)
141 return 0; 141 return 0;
142} 142}
143 143
144int bnx2x_get_vf_id(struct bnx2x *bp, u32 *vf_id) 144static int bnx2x_get_vf_id(struct bnx2x *bp, u32 *vf_id)
145{ 145{
146 u32 me_reg; 146 u32 me_reg;
147 int tout = 10, interval = 100; /* Wait for 1 sec */ 147 int tout = 10, interval = 100; /* Wait for 1 sec */
diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
index 29d82cf1528e..fccc3bf2141d 100644
--- a/drivers/net/ethernet/freescale/fec.c
+++ b/drivers/net/ethernet/freescale/fec.c
@@ -1782,24 +1782,6 @@ fec_probe(struct platform_device *pdev)
1782 fep->phy_interface = ret; 1782 fep->phy_interface = ret;
1783 } 1783 }
1784 1784
1785 for (i = 0; i < FEC_IRQ_NUM; i++) {
1786 irq = platform_get_irq(pdev, i);
1787 if (irq < 0) {
1788 if (i)
1789 break;
1790 ret = irq;
1791 goto failed_irq;
1792 }
1793 ret = request_irq(irq, fec_enet_interrupt, IRQF_DISABLED, pdev->name, ndev);
1794 if (ret) {
1795 while (--i >= 0) {
1796 irq = platform_get_irq(pdev, i);
1797 free_irq(irq, ndev);
1798 }
1799 goto failed_irq;
1800 }
1801 }
1802
1803 pinctrl = devm_pinctrl_get_select_default(&pdev->dev); 1785 pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
1804 if (IS_ERR(pinctrl)) { 1786 if (IS_ERR(pinctrl)) {
1805 ret = PTR_ERR(pinctrl); 1787 ret = PTR_ERR(pinctrl);
@@ -1850,6 +1832,24 @@ fec_probe(struct platform_device *pdev)
1850 if (ret) 1832 if (ret)
1851 goto failed_init; 1833 goto failed_init;
1852 1834
1835 for (i = 0; i < FEC_IRQ_NUM; i++) {
1836 irq = platform_get_irq(pdev, i);
1837 if (irq < 0) {
1838 if (i)
1839 break;
1840 ret = irq;
1841 goto failed_irq;
1842 }
1843 ret = request_irq(irq, fec_enet_interrupt, IRQF_DISABLED, pdev->name, ndev);
1844 if (ret) {
1845 while (--i >= 0) {
1846 irq = platform_get_irq(pdev, i);
1847 free_irq(irq, ndev);
1848 }
1849 goto failed_irq;
1850 }
1851 }
1852
1853 ret = fec_enet_mii_init(pdev); 1853 ret = fec_enet_mii_init(pdev);
1854 if (ret) 1854 if (ret)
1855 goto failed_mii_init; 1855 goto failed_mii_init;
@@ -1867,6 +1867,12 @@ failed_register:
1867 fec_enet_mii_remove(fep); 1867 fec_enet_mii_remove(fep);
1868failed_mii_init: 1868failed_mii_init:
1869failed_init: 1869failed_init:
1870 for (i = 0; i < FEC_IRQ_NUM; i++) {
1871 irq = platform_get_irq(pdev, i);
1872 if (irq > 0)
1873 free_irq(irq, ndev);
1874 }
1875failed_irq:
1870failed_regulator: 1876failed_regulator:
1871 clk_disable_unprepare(fep->clk_ahb); 1877 clk_disable_unprepare(fep->clk_ahb);
1872 clk_disable_unprepare(fep->clk_ipg); 1878 clk_disable_unprepare(fep->clk_ipg);
@@ -1874,12 +1880,6 @@ failed_regulator:
1874 clk_disable_unprepare(fep->clk_ptp); 1880 clk_disable_unprepare(fep->clk_ptp);
1875failed_pin: 1881failed_pin:
1876failed_clk: 1882failed_clk:
1877 for (i = 0; i < FEC_IRQ_NUM; i++) {
1878 irq = platform_get_irq(pdev, i);
1879 if (irq > 0)
1880 free_irq(irq, ndev);
1881 }
1882failed_irq:
1883 iounmap(fep->hwp); 1883 iounmap(fep->hwp);
1884failed_ioremap: 1884failed_ioremap:
1885 free_netdev(ndev); 1885 free_netdev(ndev);
@@ -1899,17 +1899,17 @@ fec_drv_remove(struct platform_device *pdev)
1899 1899
1900 unregister_netdev(ndev); 1900 unregister_netdev(ndev);
1901 fec_enet_mii_remove(fep); 1901 fec_enet_mii_remove(fep);
1902 for (i = 0; i < FEC_IRQ_NUM; i++) {
1903 int irq = platform_get_irq(pdev, i);
1904 if (irq > 0)
1905 free_irq(irq, ndev);
1906 }
1907 del_timer_sync(&fep->time_keep); 1902 del_timer_sync(&fep->time_keep);
1908 clk_disable_unprepare(fep->clk_ptp); 1903 clk_disable_unprepare(fep->clk_ptp);
1909 if (fep->ptp_clock) 1904 if (fep->ptp_clock)
1910 ptp_clock_unregister(fep->ptp_clock); 1905 ptp_clock_unregister(fep->ptp_clock);
1911 clk_disable_unprepare(fep->clk_ahb); 1906 clk_disable_unprepare(fep->clk_ahb);
1912 clk_disable_unprepare(fep->clk_ipg); 1907 clk_disable_unprepare(fep->clk_ipg);
1908 for (i = 0; i < FEC_IRQ_NUM; i++) {
1909 int irq = platform_get_irq(pdev, i);
1910 if (irq > 0)
1911 free_irq(irq, ndev);
1912 }
1913 iounmap(fep->hwp); 1913 iounmap(fep->hwp);
1914 free_netdev(ndev); 1914 free_netdev(ndev);
1915 1915
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index 4b5e8a692481..d2c5441d1bf0 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -2906,21 +2906,23 @@ static void gfar_netpoll(struct net_device *dev)
2906 /* If the device has multiple interrupts, run tx/rx */ 2906 /* If the device has multiple interrupts, run tx/rx */
2907 if (priv->device_flags & FSL_GIANFAR_DEV_HAS_MULTI_INTR) { 2907 if (priv->device_flags & FSL_GIANFAR_DEV_HAS_MULTI_INTR) {
2908 for (i = 0; i < priv->num_grps; i++) { 2908 for (i = 0; i < priv->num_grps; i++) {
2909 disable_irq(priv->gfargrp[i].interruptTransmit); 2909 struct gfar_priv_grp *grp = &priv->gfargrp[i];
2910 disable_irq(priv->gfargrp[i].interruptReceive); 2910
2911 disable_irq(priv->gfargrp[i].interruptError); 2911 disable_irq(gfar_irq(grp, TX)->irq);
2912 gfar_interrupt(priv->gfargrp[i].interruptTransmit, 2912 disable_irq(gfar_irq(grp, RX)->irq);
2913 &priv->gfargrp[i]); 2913 disable_irq(gfar_irq(grp, ER)->irq);
2914 enable_irq(priv->gfargrp[i].interruptError); 2914 gfar_interrupt(gfar_irq(grp, TX)->irq, grp);
2915 enable_irq(priv->gfargrp[i].interruptReceive); 2915 enable_irq(gfar_irq(grp, ER)->irq);
2916 enable_irq(priv->gfargrp[i].interruptTransmit); 2916 enable_irq(gfar_irq(grp, RX)->irq);
2917 enable_irq(gfar_irq(grp, TX)->irq);
2917 } 2918 }
2918 } else { 2919 } else {
2919 for (i = 0; i < priv->num_grps; i++) { 2920 for (i = 0; i < priv->num_grps; i++) {
2920 disable_irq(priv->gfargrp[i].interruptTransmit); 2921 struct gfar_priv_grp *grp = &priv->gfargrp[i];
2921 gfar_interrupt(priv->gfargrp[i].interruptTransmit, 2922
2922 &priv->gfargrp[i]); 2923 disable_irq(gfar_irq(grp, TX)->irq);
2923 enable_irq(priv->gfargrp[i].interruptTransmit); 2924 gfar_interrupt(gfar_irq(grp, TX)->irq, grp);
2925 enable_irq(gfar_irq(grp, TX)->irq);
2924 } 2926 }
2925 } 2927 }
2926} 2928}
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index 5088dc5c3d1a..5385474bb526 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -1829,7 +1829,7 @@ int mlx4_en_alloc_resources(struct mlx4_en_priv *priv)
1829 } 1829 }
1830 1830
1831#ifdef CONFIG_RFS_ACCEL 1831#ifdef CONFIG_RFS_ACCEL
1832 priv->dev->rx_cpu_rmap = alloc_irq_cpu_rmap(priv->rx_ring_num); 1832 priv->dev->rx_cpu_rmap = alloc_irq_cpu_rmap(priv->mdev->dev->caps.comp_pool);
1833 if (!priv->dev->rx_cpu_rmap) 1833 if (!priv->dev->rx_cpu_rmap)
1834 goto err; 1834 goto err;
1835#endif 1835#endif
@@ -2067,7 +2067,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
2067 err = -ENOMEM; 2067 err = -ENOMEM;
2068 goto out; 2068 goto out;
2069 } 2069 }
2070 priv->tx_cq = kzalloc(sizeof(struct mlx4_en_cq) * MAX_RX_RINGS, 2070 priv->tx_cq = kzalloc(sizeof(struct mlx4_en_cq) * MAX_TX_RINGS,
2071 GFP_KERNEL); 2071 GFP_KERNEL);
2072 if (!priv->tx_cq) { 2072 if (!priv->tx_cq) {
2073 err = -ENOMEM; 2073 err = -ENOMEM;
diff --git a/drivers/net/ethernet/pasemi/pasemi_mac.c b/drivers/net/ethernet/pasemi/pasemi_mac.c
index 0be5844d6372..b1cfbb75ff1e 100644
--- a/drivers/net/ethernet/pasemi/pasemi_mac.c
+++ b/drivers/net/ethernet/pasemi/pasemi_mac.c
@@ -579,8 +579,9 @@ static void pasemi_mac_free_tx_resources(struct pasemi_mac *mac)
579 (TX_RING_SIZE-1)].dma; 579 (TX_RING_SIZE-1)].dma;
580 freed = pasemi_mac_unmap_tx_skb(mac, nfrags, 580 freed = pasemi_mac_unmap_tx_skb(mac, nfrags,
581 info->skb, dmas); 581 info->skb, dmas);
582 } else 582 } else {
583 freed = 2; 583 freed = 2;
584 }
584 } 585 }
585 586
586 kfree(txring->ring_info); 587 kfree(txring->ring_info);
@@ -808,8 +809,9 @@ static int pasemi_mac_clean_rx(struct pasemi_mac_rxring *rx,
808 skb->ip_summed = CHECKSUM_UNNECESSARY; 809 skb->ip_summed = CHECKSUM_UNNECESSARY;
809 skb->csum = (macrx & XCT_MACRX_CSUM_M) >> 810 skb->csum = (macrx & XCT_MACRX_CSUM_M) >>
810 XCT_MACRX_CSUM_S; 811 XCT_MACRX_CSUM_S;
811 } else 812 } else {
812 skb_checksum_none_assert(skb); 813 skb_checksum_none_assert(skb);
814 }
813 815
814 packets++; 816 packets++;
815 tot_bytes += len; 817 tot_bytes += len;
@@ -1829,10 +1831,11 @@ pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1829 dev_err(&mac->pdev->dev, "register_netdev failed with error %d\n", 1831 dev_err(&mac->pdev->dev, "register_netdev failed with error %d\n",
1830 err); 1832 err);
1831 goto out; 1833 goto out;
1832 } else if netif_msg_probe(mac) 1834 } else if (netif_msg_probe(mac)) {
1833 printk(KERN_INFO "%s: PA Semi %s: intf %d, hw addr %pM\n", 1835 printk(KERN_INFO "%s: PA Semi %s: intf %d, hw addr %pM\n",
1834 dev->name, mac->type == MAC_TYPE_GMAC ? "GMAC" : "XAUI", 1836 dev->name, mac->type == MAC_TYPE_GMAC ? "GMAC" : "XAUI",
1835 mac->dma_if, dev->dev_addr); 1837 mac->dma_if, dev->dev_addr);
1838 }
1836 1839
1837 return err; 1840 return err;
1838 1841
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
index 11c3db6daffd..ba3c72fce1f2 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
@@ -38,8 +38,8 @@
38 38
39#define _QLCNIC_LINUX_MAJOR 5 39#define _QLCNIC_LINUX_MAJOR 5
40#define _QLCNIC_LINUX_MINOR 1 40#define _QLCNIC_LINUX_MINOR 1
41#define _QLCNIC_LINUX_SUBVERSION 34 41#define _QLCNIC_LINUX_SUBVERSION 35
42#define QLCNIC_LINUX_VERSIONID "5.1.34" 42#define QLCNIC_LINUX_VERSIONID "5.1.35"
43#define QLCNIC_DRV_IDC_VER 0x01 43#define QLCNIC_DRV_IDC_VER 0x01
44#define QLCNIC_DRIVER_VERSION ((_QLCNIC_LINUX_MAJOR << 16) |\ 44#define QLCNIC_DRIVER_VERSION ((_QLCNIC_LINUX_MAJOR << 16) |\
45 (_QLCNIC_LINUX_MINOR << 8) | (_QLCNIC_LINUX_SUBVERSION)) 45 (_QLCNIC_LINUX_MINOR << 8) | (_QLCNIC_LINUX_SUBVERSION))
@@ -1755,7 +1755,7 @@ static inline int qlcnic_set_lb_mode(struct qlcnic_adapter *adapter, u8 mode)
1755 1755
1756static inline int qlcnic_clear_lb_mode(struct qlcnic_adapter *adapter, u8 mode) 1756static inline int qlcnic_clear_lb_mode(struct qlcnic_adapter *adapter, u8 mode)
1757{ 1757{
1758 return adapter->ahw->hw_ops->config_loopback(adapter, mode); 1758 return adapter->ahw->hw_ops->clear_loopback(adapter, mode);
1759} 1759}
1760 1760
1761static inline int qlcnic_nic_set_promisc(struct qlcnic_adapter *adapter, 1761static inline int qlcnic_nic_set_promisc(struct qlcnic_adapter *adapter,
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
index c53832b02b3e..5c033f268ca5 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
@@ -589,13 +589,6 @@ static int qlcnic_83xx_idc_reattach_driver(struct qlcnic_adapter *adapter)
589 qlcnic_83xx_register_nic_idc_func(adapter, 1); 589 qlcnic_83xx_register_nic_idc_func(adapter, 1);
590 590
591 qlcnic_83xx_enable_mbx_intrpt(adapter); 591 qlcnic_83xx_enable_mbx_intrpt(adapter);
592 if ((adapter->flags & QLCNIC_MSIX_ENABLED)) {
593 if (qlcnic_83xx_config_intrpt(adapter, 1)) {
594 netdev_err(adapter->netdev,
595 "Failed to enable mbx intr\n");
596 return -EIO;
597 }
598 }
599 592
600 if (qlcnic_83xx_configure_opmode(adapter)) { 593 if (qlcnic_83xx_configure_opmode(adapter)) {
601 qlcnic_83xx_idc_enter_failed_state(adapter, 1); 594 qlcnic_83xx_idc_enter_failed_state(adapter, 1);
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index ff4fa37dfd1d..e6d2dea1373c 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -53,7 +53,7 @@
53 53
54#define FEATURE_8_WAKEUP_FILTERS (0x01) 54#define FEATURE_8_WAKEUP_FILTERS (0x01)
55#define FEATURE_PHY_NLP_CROSSOVER (0x02) 55#define FEATURE_PHY_NLP_CROSSOVER (0x02)
56#define FEATURE_AUTOSUSPEND (0x04) 56#define FEATURE_REMOTE_WAKEUP (0x04)
57 57
58#define SUSPEND_SUSPEND0 (0x01) 58#define SUSPEND_SUSPEND0 (0x01)
59#define SUSPEND_SUSPEND1 (0x02) 59#define SUSPEND_SUSPEND1 (0x02)
@@ -1146,7 +1146,7 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf)
1146 (val == ID_REV_CHIP_ID_89530_) || (val == ID_REV_CHIP_ID_9730_)) 1146 (val == ID_REV_CHIP_ID_89530_) || (val == ID_REV_CHIP_ID_9730_))
1147 pdata->features = (FEATURE_8_WAKEUP_FILTERS | 1147 pdata->features = (FEATURE_8_WAKEUP_FILTERS |
1148 FEATURE_PHY_NLP_CROSSOVER | 1148 FEATURE_PHY_NLP_CROSSOVER |
1149 FEATURE_AUTOSUSPEND); 1149 FEATURE_REMOTE_WAKEUP);
1150 else if (val == ID_REV_CHIP_ID_9512_) 1150 else if (val == ID_REV_CHIP_ID_9512_)
1151 pdata->features = FEATURE_8_WAKEUP_FILTERS; 1151 pdata->features = FEATURE_8_WAKEUP_FILTERS;
1152 1152
@@ -1247,10 +1247,12 @@ static int smsc95xx_enter_suspend0(struct usbnet *dev)
1247 1247
1248 /* read back PM_CTRL */ 1248 /* read back PM_CTRL */
1249 ret = smsc95xx_read_reg_nopm(dev, PM_CTRL, &val); 1249 ret = smsc95xx_read_reg_nopm(dev, PM_CTRL, &val);
1250 if (ret < 0)
1251 return ret;
1250 1252
1251 pdata->suspend_flags |= SUSPEND_SUSPEND0; 1253 pdata->suspend_flags |= SUSPEND_SUSPEND0;
1252 1254
1253 return ret; 1255 return 0;
1254} 1256}
1255 1257
1256static int smsc95xx_enter_suspend1(struct usbnet *dev) 1258static int smsc95xx_enter_suspend1(struct usbnet *dev)
@@ -1293,10 +1295,12 @@ static int smsc95xx_enter_suspend1(struct usbnet *dev)
1293 val |= (PM_CTL_WUPS_ED_ | PM_CTL_ED_EN_); 1295 val |= (PM_CTL_WUPS_ED_ | PM_CTL_ED_EN_);
1294 1296
1295 ret = smsc95xx_write_reg_nopm(dev, PM_CTRL, val); 1297 ret = smsc95xx_write_reg_nopm(dev, PM_CTRL, val);
1298 if (ret < 0)
1299 return ret;
1296 1300
1297 pdata->suspend_flags |= SUSPEND_SUSPEND1; 1301 pdata->suspend_flags |= SUSPEND_SUSPEND1;
1298 1302
1299 return ret; 1303 return 0;
1300} 1304}
1301 1305
1302static int smsc95xx_enter_suspend2(struct usbnet *dev) 1306static int smsc95xx_enter_suspend2(struct usbnet *dev)
@@ -1313,10 +1317,12 @@ static int smsc95xx_enter_suspend2(struct usbnet *dev)
1313 val |= PM_CTL_SUS_MODE_2; 1317 val |= PM_CTL_SUS_MODE_2;
1314 1318
1315 ret = smsc95xx_write_reg_nopm(dev, PM_CTRL, val); 1319 ret = smsc95xx_write_reg_nopm(dev, PM_CTRL, val);
1320 if (ret < 0)
1321 return ret;
1316 1322
1317 pdata->suspend_flags |= SUSPEND_SUSPEND2; 1323 pdata->suspend_flags |= SUSPEND_SUSPEND2;
1318 1324
1319 return ret; 1325 return 0;
1320} 1326}
1321 1327
1322static int smsc95xx_enter_suspend3(struct usbnet *dev) 1328static int smsc95xx_enter_suspend3(struct usbnet *dev)
@@ -1372,7 +1378,7 @@ static int smsc95xx_autosuspend(struct usbnet *dev, u32 link_up)
1372 if (!link_up) { 1378 if (!link_up) {
1373 /* link is down so enter EDPD mode, but only if device can 1379 /* link is down so enter EDPD mode, but only if device can
1374 * reliably resume from it. This check should be redundant 1380 * reliably resume from it. This check should be redundant
1375 * as current FEATURE_AUTOSUSPEND parts also support 1381 * as current FEATURE_REMOTE_WAKEUP parts also support
1376 * FEATURE_PHY_NLP_CROSSOVER but it's included for clarity */ 1382 * FEATURE_PHY_NLP_CROSSOVER but it's included for clarity */
1377 if (!(pdata->features & FEATURE_PHY_NLP_CROSSOVER)) { 1383 if (!(pdata->features & FEATURE_PHY_NLP_CROSSOVER)) {
1378 netdev_warn(dev->net, "EDPD not supported\n"); 1384 netdev_warn(dev->net, "EDPD not supported\n");
@@ -1412,15 +1418,6 @@ static int smsc95xx_suspend(struct usb_interface *intf, pm_message_t message)
1412 u32 val, link_up; 1418 u32 val, link_up;
1413 int ret; 1419 int ret;
1414 1420
1415 /* TODO: don't indicate this feature to usb framework if
1416 * our current hardware doesn't have the capability
1417 */
1418 if ((message.event == PM_EVENT_AUTO_SUSPEND) &&
1419 (!(pdata->features & FEATURE_AUTOSUSPEND))) {
1420 netdev_warn(dev->net, "autosuspend not supported\n");
1421 return -EBUSY;
1422 }
1423
1424 ret = usbnet_suspend(intf, message); 1421 ret = usbnet_suspend(intf, message);
1425 if (ret < 0) { 1422 if (ret < 0) {
1426 netdev_warn(dev->net, "usbnet_suspend error\n"); 1423 netdev_warn(dev->net, "usbnet_suspend error\n");
@@ -1435,7 +1432,8 @@ static int smsc95xx_suspend(struct usb_interface *intf, pm_message_t message)
1435 /* determine if link is up using only _nopm functions */ 1432 /* determine if link is up using only _nopm functions */
1436 link_up = smsc95xx_link_ok_nopm(dev); 1433 link_up = smsc95xx_link_ok_nopm(dev);
1437 1434
1438 if (message.event == PM_EVENT_AUTO_SUSPEND) { 1435 if (message.event == PM_EVENT_AUTO_SUSPEND &&
1436 (pdata->features & FEATURE_REMOTE_WAKEUP)) {
1439 ret = smsc95xx_autosuspend(dev, link_up); 1437 ret = smsc95xx_autosuspend(dev, link_up);
1440 goto done; 1438 goto done;
1441 } 1439 }
@@ -1872,11 +1870,11 @@ static int smsc95xx_manage_power(struct usbnet *dev, int on)
1872 1870
1873 dev->intf->needs_remote_wakeup = on; 1871 dev->intf->needs_remote_wakeup = on;
1874 1872
1875 if (pdata->features & FEATURE_AUTOSUSPEND) 1873 if (pdata->features & FEATURE_REMOTE_WAKEUP)
1876 return 0; 1874 return 0;
1877 1875
1878 /* this chip revision doesn't support autosuspend */ 1876 /* this chip revision isn't capable of remote wakeup */
1879 netdev_info(dev->net, "hardware doesn't support USB autosuspend\n"); 1877 netdev_info(dev->net, "hardware isn't capable of remote wakeup\n");
1880 1878
1881 if (on) 1879 if (on)
1882 usb_autopm_get_interface_no_resume(dev->intf); 1880 usb_autopm_get_interface_no_resume(dev->intf);
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index ffb97b2a15a0..4aad350e4dae 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -1385,8 +1385,8 @@ vmxnet3_rq_cleanup_all(struct vmxnet3_adapter *adapter)
1385} 1385}
1386 1386
1387 1387
1388void vmxnet3_rq_destroy(struct vmxnet3_rx_queue *rq, 1388static void vmxnet3_rq_destroy(struct vmxnet3_rx_queue *rq,
1389 struct vmxnet3_adapter *adapter) 1389 struct vmxnet3_adapter *adapter)
1390{ 1390{
1391 int i; 1391 int i;
1392 int j; 1392 int j;
diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c
index 9bc542be2937..a0feb17a0238 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethtool.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c
@@ -448,10 +448,8 @@ vmxnet3_get_ringparam(struct net_device *netdev,
448 param->rx_mini_max_pending = 0; 448 param->rx_mini_max_pending = 0;
449 param->rx_jumbo_max_pending = 0; 449 param->rx_jumbo_max_pending = 0;
450 450
451 param->rx_pending = adapter->rx_queue[0].rx_ring[0].size * 451 param->rx_pending = adapter->rx_queue[0].rx_ring[0].size;
452 adapter->num_rx_queues; 452 param->tx_pending = adapter->tx_queue[0].tx_ring.size;
453 param->tx_pending = adapter->tx_queue[0].tx_ring.size *
454 adapter->num_tx_queues;
455 param->rx_mini_pending = 0; 453 param->rx_mini_pending = 0;
456 param->rx_jumbo_pending = 0; 454 param->rx_jumbo_pending = 0;
457} 455}
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 9d70421cf3a0..f736823f8437 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -33,6 +33,7 @@
33#include <net/arp.h> 33#include <net/arp.h>
34#include <net/ndisc.h> 34#include <net/ndisc.h>
35#include <net/ip.h> 35#include <net/ip.h>
36#include <net/ipip.h>
36#include <net/icmp.h> 37#include <net/icmp.h>
37#include <net/udp.h> 38#include <net/udp.h>
38#include <net/rtnetlink.h> 39#include <net/rtnetlink.h>
@@ -962,13 +963,13 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
962 iph->daddr = dst; 963 iph->daddr = dst;
963 iph->saddr = fl4.saddr; 964 iph->saddr = fl4.saddr;
964 iph->ttl = ttl ? : ip4_dst_hoplimit(&rt->dst); 965 iph->ttl = ttl ? : ip4_dst_hoplimit(&rt->dst);
966 tunnel_ip_select_ident(skb, old_iph, &rt->dst);
965 967
966 vxlan_set_owner(dev, skb); 968 vxlan_set_owner(dev, skb);
967 969
968 /* See iptunnel_xmit() */ 970 /* See iptunnel_xmit() */
969 if (skb->ip_summed != CHECKSUM_PARTIAL) 971 if (skb->ip_summed != CHECKSUM_PARTIAL)
970 skb->ip_summed = CHECKSUM_NONE; 972 skb->ip_summed = CHECKSUM_NONE;
971 ip_select_ident(iph, &rt->dst, NULL);
972 973
973 err = ip_local_out(skb); 974 err = ip_local_out(skb);
974 if (likely(net_xmit_eval(err) == 0)) { 975 if (likely(net_xmit_eval(err) == 0)) {
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 806e34c19281..05682736e466 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -4214,7 +4214,6 @@ redo:
4214 mutex_unlock(&wl->mutex); 4214 mutex_unlock(&wl->mutex);
4215 cancel_delayed_work_sync(&dev->periodic_work); 4215 cancel_delayed_work_sync(&dev->periodic_work);
4216 cancel_work_sync(&wl->tx_work); 4216 cancel_work_sync(&wl->tx_work);
4217 cancel_work_sync(&wl->firmware_load);
4218 mutex_lock(&wl->mutex); 4217 mutex_lock(&wl->mutex);
4219 dev = wl->current_dev; 4218 dev = wl->current_dev;
4220 if (!dev || b43_status(dev) < B43_STAT_STARTED) { 4219 if (!dev || b43_status(dev) < B43_STAT_STARTED) {
@@ -5434,6 +5433,7 @@ static void b43_bcma_remove(struct bcma_device *core)
5434 /* We must cancel any work here before unregistering from ieee80211, 5433 /* We must cancel any work here before unregistering from ieee80211,
5435 * as the ieee80211 unreg will destroy the workqueue. */ 5434 * as the ieee80211 unreg will destroy the workqueue. */
5436 cancel_work_sync(&wldev->restart_work); 5435 cancel_work_sync(&wldev->restart_work);
5436 cancel_work_sync(&wl->firmware_load);
5437 5437
5438 B43_WARN_ON(!wl); 5438 B43_WARN_ON(!wl);
5439 if (!wldev->fw.ucode.data) 5439 if (!wldev->fw.ucode.data)
@@ -5510,6 +5510,7 @@ static void b43_ssb_remove(struct ssb_device *sdev)
5510 /* We must cancel any work here before unregistering from ieee80211, 5510 /* We must cancel any work here before unregistering from ieee80211,
5511 * as the ieee80211 unreg will destroy the workqueue. */ 5511 * as the ieee80211 unreg will destroy the workqueue. */
5512 cancel_work_sync(&wldev->restart_work); 5512 cancel_work_sync(&wldev->restart_work);
5513 cancel_work_sync(&wl->firmware_load);
5513 5514
5514 B43_WARN_ON(!wl); 5515 B43_WARN_ON(!wl);
5515 if (!wldev->fw.ucode.data) 5516 if (!wldev->fw.ucode.data)
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
index cecc3eff72e9..2af9c0f0798d 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
@@ -4615,8 +4615,10 @@ static s32 brcmf_notify_vif_event(struct brcmf_if *ifp,
4615 switch (ifevent->action) { 4615 switch (ifevent->action) {
4616 case BRCMF_E_IF_ADD: 4616 case BRCMF_E_IF_ADD:
4617 /* waiting process may have timed out */ 4617 /* waiting process may have timed out */
4618 if (!cfg->vif_event.vif) 4618 if (!cfg->vif_event.vif) {
4619 mutex_unlock(&event->vif_event_lock);
4619 return -EBADF; 4620 return -EBADF;
4621 }
4620 4622
4621 ifp->vif = vif; 4623 ifp->vif = vif;
4622 vif->ifp = ifp; 4624 vif->ifp = ifp;
diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c
index 4b54bcf382f3..35c79722c361 100644
--- a/drivers/net/wireless/mwifiex/pcie.c
+++ b/drivers/net/wireless/mwifiex/pcie.c
@@ -171,7 +171,7 @@ static int mwifiex_pcie_suspend(struct pci_dev *pdev, pm_message_t state)
171{ 171{
172 struct mwifiex_adapter *adapter; 172 struct mwifiex_adapter *adapter;
173 struct pcie_service_card *card; 173 struct pcie_service_card *card;
174 int hs_actived, i; 174 int hs_actived;
175 175
176 if (pdev) { 176 if (pdev) {
177 card = (struct pcie_service_card *) pci_get_drvdata(pdev); 177 card = (struct pcie_service_card *) pci_get_drvdata(pdev);
@@ -191,9 +191,6 @@ static int mwifiex_pcie_suspend(struct pci_dev *pdev, pm_message_t state)
191 /* Indicate device suspended */ 191 /* Indicate device suspended */
192 adapter->is_suspended = true; 192 adapter->is_suspended = true;
193 193
194 for (i = 0; i < adapter->priv_num; i++)
195 netif_carrier_off(adapter->priv[i]->netdev);
196
197 return 0; 194 return 0;
198} 195}
199 196
@@ -209,7 +206,6 @@ static int mwifiex_pcie_resume(struct pci_dev *pdev)
209{ 206{
210 struct mwifiex_adapter *adapter; 207 struct mwifiex_adapter *adapter;
211 struct pcie_service_card *card; 208 struct pcie_service_card *card;
212 int i;
213 209
214 if (pdev) { 210 if (pdev) {
215 card = (struct pcie_service_card *) pci_get_drvdata(pdev); 211 card = (struct pcie_service_card *) pci_get_drvdata(pdev);
@@ -231,10 +227,6 @@ static int mwifiex_pcie_resume(struct pci_dev *pdev)
231 227
232 adapter->is_suspended = false; 228 adapter->is_suspended = false;
233 229
234 for (i = 0; i < adapter->priv_num; i++)
235 if (adapter->priv[i]->media_connected)
236 netif_carrier_on(adapter->priv[i]->netdev);
237
238 mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA), 230 mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA),
239 MWIFIEX_ASYNC_CMD); 231 MWIFIEX_ASYNC_CMD);
240 232
@@ -916,17 +908,8 @@ static int mwifiex_pcie_delete_sleep_cookie_buf(struct mwifiex_adapter *adapter)
916static int mwifiex_clean_pcie_ring_buf(struct mwifiex_adapter *adapter) 908static int mwifiex_clean_pcie_ring_buf(struct mwifiex_adapter *adapter)
917{ 909{
918 struct pcie_service_card *card = adapter->card; 910 struct pcie_service_card *card = adapter->card;
919 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg;
920 u32 rdptr;
921
922 /* Read the TX ring read pointer set by firmware */
923 if (mwifiex_read_reg(adapter, reg->tx_rdptr, &rdptr)) {
924 dev_err(adapter->dev,
925 "Flush TXBD: failed to read reg->tx_rdptr\n");
926 return -1;
927 }
928 911
929 if (!mwifiex_pcie_txbd_empty(card, rdptr)) { 912 if (!mwifiex_pcie_txbd_empty(card, card->txbd_rdptr)) {
930 card->txbd_flush = 1; 913 card->txbd_flush = 1;
931 /* write pointer already set at last send 914 /* write pointer already set at last send
932 * send dnld-rdy intr again, wait for completion. 915 * send dnld-rdy intr again, wait for completion.
diff --git a/drivers/net/wireless/mwifiex/sdio.c b/drivers/net/wireless/mwifiex/sdio.c
index e63f646a260e..363ba31b58bf 100644
--- a/drivers/net/wireless/mwifiex/sdio.c
+++ b/drivers/net/wireless/mwifiex/sdio.c
@@ -161,7 +161,6 @@ static int mwifiex_sdio_suspend(struct device *dev)
161 struct sdio_mmc_card *card; 161 struct sdio_mmc_card *card;
162 struct mwifiex_adapter *adapter; 162 struct mwifiex_adapter *adapter;
163 mmc_pm_flag_t pm_flag = 0; 163 mmc_pm_flag_t pm_flag = 0;
164 int i;
165 int ret = 0; 164 int ret = 0;
166 165
167 if (func) { 166 if (func) {
@@ -198,9 +197,6 @@ static int mwifiex_sdio_suspend(struct device *dev)
198 /* Indicate device suspended */ 197 /* Indicate device suspended */
199 adapter->is_suspended = true; 198 adapter->is_suspended = true;
200 199
201 for (i = 0; i < adapter->priv_num; i++)
202 netif_carrier_off(adapter->priv[i]->netdev);
203
204 return ret; 200 return ret;
205} 201}
206 202
@@ -220,7 +216,6 @@ static int mwifiex_sdio_resume(struct device *dev)
220 struct sdio_mmc_card *card; 216 struct sdio_mmc_card *card;
221 struct mwifiex_adapter *adapter; 217 struct mwifiex_adapter *adapter;
222 mmc_pm_flag_t pm_flag = 0; 218 mmc_pm_flag_t pm_flag = 0;
223 int i;
224 219
225 if (func) { 220 if (func) {
226 pm_flag = sdio_get_host_pm_caps(func); 221 pm_flag = sdio_get_host_pm_caps(func);
@@ -243,10 +238,6 @@ static int mwifiex_sdio_resume(struct device *dev)
243 238
244 adapter->is_suspended = false; 239 adapter->is_suspended = false;
245 240
246 for (i = 0; i < adapter->priv_num; i++)
247 if (adapter->priv[i]->media_connected)
248 netif_carrier_on(adapter->priv[i]->netdev);
249
250 /* Disable Host Sleep */ 241 /* Disable Host Sleep */
251 mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA), 242 mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA),
252 MWIFIEX_ASYNC_CMD); 243 MWIFIEX_ASYNC_CMD);
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index d06cc5c8f58c..218a3b686d90 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -331,7 +331,7 @@ static inline void vlan_set_encap_proto(struct sk_buff *skb,
331 struct vlan_hdr *vhdr) 331 struct vlan_hdr *vhdr)
332{ 332{
333 __be16 proto; 333 __be16 proto;
334 unsigned char *rawp; 334 unsigned short *rawp;
335 335
336 /* 336 /*
337 * Was a VLAN packet, grab the encapsulated protocol, which the layer 337 * Was a VLAN packet, grab the encapsulated protocol, which the layer
@@ -344,8 +344,8 @@ static inline void vlan_set_encap_proto(struct sk_buff *skb,
344 return; 344 return;
345 } 345 }
346 346
347 rawp = skb->data; 347 rawp = (unsigned short *)(vhdr + 1);
348 if (*(unsigned short *) rawp == 0xFFFF) 348 if (*rawp == 0xFFFF)
349 /* 349 /*
350 * This is a magic hack to spot IPX packets. Older Novell 350 * This is a magic hack to spot IPX packets. Older Novell
351 * breaks the protocol design and runs IPX over 802.3 without 351 * breaks the protocol design and runs IPX over 802.3 without
diff --git a/include/net/icmp.h b/include/net/icmp.h
index 9ac2524d1402..081439fd070e 100644
--- a/include/net/icmp.h
+++ b/include/net/icmp.h
@@ -41,6 +41,7 @@ struct net;
41 41
42extern void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info); 42extern void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info);
43extern int icmp_rcv(struct sk_buff *skb); 43extern int icmp_rcv(struct sk_buff *skb);
44extern void icmp_err(struct sk_buff *, u32 info);
44extern int icmp_init(void); 45extern int icmp_init(void);
45extern void icmp_out_count(struct net *net, unsigned char type); 46extern void icmp_out_count(struct net *net, unsigned char type);
46 47
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index 7ca75cbbf75e..fd4ee016ba5c 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -28,16 +28,16 @@
28 28
29struct inet_hashinfo; 29struct inet_hashinfo;
30 30
31/* I have no idea if this is a good hash for v6 or not. -DaveM */
32static inline unsigned int inet6_ehashfn(struct net *net, 31static inline unsigned int inet6_ehashfn(struct net *net,
33 const struct in6_addr *laddr, const u16 lport, 32 const struct in6_addr *laddr, const u16 lport,
34 const struct in6_addr *faddr, const __be16 fport) 33 const struct in6_addr *faddr, const __be16 fport)
35{ 34{
36 u32 ports = (lport ^ (__force u16)fport); 35 u32 ports = (((u32)lport) << 16) | (__force u32)fport;
37 36
38 return jhash_3words((__force u32)laddr->s6_addr32[3], 37 return jhash_3words((__force u32)laddr->s6_addr32[3],
39 (__force u32)faddr->s6_addr32[3], 38 ipv6_addr_jhash(faddr),
40 ports, inet_ehash_secret + net_hash_mix(net)); 39 ports,
40 inet_ehash_secret + net_hash_mix(net));
41} 41}
42 42
43static inline int inet6_sk_ehashfn(const struct sock *sk) 43static inline int inet6_sk_ehashfn(const struct sock *sk)
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index 3f237db0a426..76c3fe5ecc2e 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -114,7 +114,13 @@ static inline void init_frag_mem_limit(struct netns_frags *nf)
114 114
115static inline int sum_frag_mem_limit(struct netns_frags *nf) 115static inline int sum_frag_mem_limit(struct netns_frags *nf)
116{ 116{
117 return percpu_counter_sum_positive(&nf->mem); 117 int res;
118
119 local_bh_disable();
120 res = percpu_counter_sum_positive(&nf->mem);
121 local_bh_enable();
122
123 return res;
118} 124}
119 125
120static inline void inet_frag_lru_move(struct inet_frag_queue *q) 126static inline void inet_frag_lru_move(struct inet_frag_queue *q)
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index a4196cbc84ec..7235ae73a1e8 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -203,6 +203,7 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to,
203extern int inet_sk_rebuild_header(struct sock *sk); 203extern int inet_sk_rebuild_header(struct sock *sk);
204 204
205extern u32 inet_ehash_secret; 205extern u32 inet_ehash_secret;
206extern u32 ipv6_hash_secret;
206extern void build_ehash_secret(void); 207extern void build_ehash_secret(void);
207 208
208static inline unsigned int inet_ehashfn(struct net *net, 209static inline unsigned int inet_ehashfn(struct net *net,
diff --git a/include/net/ipip.h b/include/net/ipip.h
index 21947cf4fa46..fd19625ff99d 100644
--- a/include/net/ipip.h
+++ b/include/net/ipip.h
@@ -71,4 +71,21 @@ static inline void iptunnel_xmit(struct sk_buff *skb, struct net_device *dev)
71 } 71 }
72} 72}
73 73
74static inline void tunnel_ip_select_ident(struct sk_buff *skb,
75 const struct iphdr *old_iph,
76 struct dst_entry *dst)
77{
78 struct iphdr *iph = ip_hdr(skb);
79
80 if (iph->frag_off & htons(IP_DF))
81 iph->id = 0;
82 else {
83 /* Use inner packet iph-id if possible. */
84 if (skb->protocol == htons(ETH_P_IP) && old_iph->id)
85 iph->id = old_iph->id;
86 else
87 __ip_select_ident(iph, dst,
88 (skb_shinfo(skb)->gso_segs ?: 1) - 1);
89 }
90}
74#endif 91#endif
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 851d5412a299..64d12e77719a 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -15,6 +15,7 @@
15 15
16#include <linux/ipv6.h> 16#include <linux/ipv6.h>
17#include <linux/hardirq.h> 17#include <linux/hardirq.h>
18#include <linux/jhash.h>
18#include <net/if_inet6.h> 19#include <net/if_inet6.h>
19#include <net/ndisc.h> 20#include <net/ndisc.h>
20#include <net/flow.h> 21#include <net/flow.h>
@@ -514,6 +515,17 @@ static inline u32 ipv6_addr_hash(const struct in6_addr *a)
514#endif 515#endif
515} 516}
516 517
518/* more secured version of ipv6_addr_hash() */
519static inline u32 ipv6_addr_jhash(const struct in6_addr *a)
520{
521 u32 v = (__force u32)a->s6_addr32[0] ^ (__force u32)a->s6_addr32[1];
522
523 return jhash_3words(v,
524 (__force u32)a->s6_addr32[2],
525 (__force u32)a->s6_addr32[3],
526 ipv6_hash_secret);
527}
528
517static inline bool ipv6_addr_loopback(const struct in6_addr *a) 529static inline bool ipv6_addr_loopback(const struct in6_addr *a)
518{ 530{
519#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64 531#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
diff --git a/net/core/dev.c b/net/core/dev.c
index 17bc535115d3..18d8b5acc343 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1882,8 +1882,10 @@ int netif_set_xps_queue(struct net_device *dev, struct cpumask *mask, u16 index)
1882 1882
1883 if (!new_dev_maps) 1883 if (!new_dev_maps)
1884 new_dev_maps = kzalloc(maps_sz, GFP_KERNEL); 1884 new_dev_maps = kzalloc(maps_sz, GFP_KERNEL);
1885 if (!new_dev_maps) 1885 if (!new_dev_maps) {
1886 mutex_unlock(&xps_map_mutex);
1886 return -ENOMEM; 1887 return -ENOMEM;
1888 }
1887 1889
1888 map = dev_maps ? xmap_dereference(dev_maps->cpu_map[cpu]) : 1890 map = dev_maps ? xmap_dereference(dev_maps->cpu_map[cpu]) :
1889 NULL; 1891 NULL;
diff --git a/net/core/sock.c b/net/core/sock.c
index fe96c5d34299..b261a7977746 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -186,8 +186,10 @@ void mem_cgroup_sockets_destroy(struct mem_cgroup *memcg)
186static struct lock_class_key af_family_keys[AF_MAX]; 186static struct lock_class_key af_family_keys[AF_MAX];
187static struct lock_class_key af_family_slock_keys[AF_MAX]; 187static struct lock_class_key af_family_slock_keys[AF_MAX];
188 188
189#if defined(CONFIG_MEMCG_KMEM)
189struct static_key memcg_socket_limit_enabled; 190struct static_key memcg_socket_limit_enabled;
190EXPORT_SYMBOL(memcg_socket_limit_enabled); 191EXPORT_SYMBOL(memcg_socket_limit_enabled);
192#endif
191 193
192/* 194/*
193 * Make lock validator output more readable. (we pre-construct these 195 * Make lock validator output more readable. (we pre-construct these
diff --git a/net/core/sock_diag.c b/net/core/sock_diag.c
index 602cd637182e..a29e90cf36b7 100644
--- a/net/core/sock_diag.c
+++ b/net/core/sock_diag.c
@@ -97,21 +97,6 @@ void sock_diag_unregister(const struct sock_diag_handler *hnld)
97} 97}
98EXPORT_SYMBOL_GPL(sock_diag_unregister); 98EXPORT_SYMBOL_GPL(sock_diag_unregister);
99 99
100static const inline struct sock_diag_handler *sock_diag_lock_handler(int family)
101{
102 if (sock_diag_handlers[family] == NULL)
103 request_module("net-pf-%d-proto-%d-type-%d", PF_NETLINK,
104 NETLINK_SOCK_DIAG, family);
105
106 mutex_lock(&sock_diag_table_mutex);
107 return sock_diag_handlers[family];
108}
109
110static inline void sock_diag_unlock_handler(const struct sock_diag_handler *h)
111{
112 mutex_unlock(&sock_diag_table_mutex);
113}
114
115static int __sock_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) 100static int __sock_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
116{ 101{
117 int err; 102 int err;
@@ -121,12 +106,20 @@ static int __sock_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
121 if (nlmsg_len(nlh) < sizeof(*req)) 106 if (nlmsg_len(nlh) < sizeof(*req))
122 return -EINVAL; 107 return -EINVAL;
123 108
124 hndl = sock_diag_lock_handler(req->sdiag_family); 109 if (req->sdiag_family >= AF_MAX)
110 return -EINVAL;
111
112 if (sock_diag_handlers[req->sdiag_family] == NULL)
113 request_module("net-pf-%d-proto-%d-type-%d", PF_NETLINK,
114 NETLINK_SOCK_DIAG, req->sdiag_family);
115
116 mutex_lock(&sock_diag_table_mutex);
117 hndl = sock_diag_handlers[req->sdiag_family];
125 if (hndl == NULL) 118 if (hndl == NULL)
126 err = -ENOENT; 119 err = -ENOENT;
127 else 120 else
128 err = hndl->dump(skb, nlh); 121 err = hndl->dump(skb, nlh);
129 sock_diag_unlock_handler(hndl); 122 mutex_unlock(&sock_diag_table_mutex);
130 123
131 return err; 124 return err;
132} 125}
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index e225a4e5b572..68f6a94f7661 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -248,8 +248,12 @@ EXPORT_SYMBOL(inet_listen);
248u32 inet_ehash_secret __read_mostly; 248u32 inet_ehash_secret __read_mostly;
249EXPORT_SYMBOL(inet_ehash_secret); 249EXPORT_SYMBOL(inet_ehash_secret);
250 250
251u32 ipv6_hash_secret __read_mostly;
252EXPORT_SYMBOL(ipv6_hash_secret);
253
251/* 254/*
252 * inet_ehash_secret must be set exactly once 255 * inet_ehash_secret must be set exactly once, and to a non nul value
256 * ipv6_hash_secret must be set exactly once.
253 */ 257 */
254void build_ehash_secret(void) 258void build_ehash_secret(void)
255{ 259{
@@ -259,7 +263,8 @@ void build_ehash_secret(void)
259 get_random_bytes(&rnd, sizeof(rnd)); 263 get_random_bytes(&rnd, sizeof(rnd));
260 } while (rnd == 0); 264 } while (rnd == 0);
261 265
262 cmpxchg(&inet_ehash_secret, 0, rnd); 266 if (cmpxchg(&inet_ehash_secret, 0, rnd) == 0)
267 get_random_bytes(&ipv6_hash_secret, sizeof(ipv6_hash_secret));
263} 268}
264EXPORT_SYMBOL(build_ehash_secret); 269EXPORT_SYMBOL(build_ehash_secret);
265 270
@@ -1327,8 +1332,10 @@ static struct sk_buff *inet_gso_segment(struct sk_buff *skb,
1327 if (skb->next != NULL) 1332 if (skb->next != NULL)
1328 iph->frag_off |= htons(IP_MF); 1333 iph->frag_off |= htons(IP_MF);
1329 offset += (skb->len - skb->mac_len - iph->ihl * 4); 1334 offset += (skb->len - skb->mac_len - iph->ihl * 4);
1330 } else 1335 } else {
1331 iph->id = htons(id++); 1336 if (!(iph->frag_off & htons(IP_DF)))
1337 iph->id = htons(id++);
1338 }
1332 iph->tot_len = htons(skb->len - skb->mac_len); 1339 iph->tot_len = htons(skb->len - skb->mac_len);
1333 iph->check = 0; 1340 iph->check = 0;
1334 iph->check = ip_fast_csum(skb_network_header(skb), iph->ihl); 1341 iph->check = ip_fast_csum(skb_network_header(skb), iph->ihl);
@@ -1572,7 +1579,7 @@ static const struct net_offload udp_offload = {
1572 1579
1573static const struct net_protocol icmp_protocol = { 1580static const struct net_protocol icmp_protocol = {
1574 .handler = icmp_rcv, 1581 .handler = icmp_rcv,
1575 .err_handler = ping_err, 1582 .err_handler = icmp_err,
1576 .no_policy = 1, 1583 .no_policy = 1,
1577 .netns_ok = 1, 1584 .netns_ok = 1,
1578}; 1585};
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 17ff9fd7cdda..3ac5dff79627 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -934,6 +934,29 @@ error:
934 goto drop; 934 goto drop;
935} 935}
936 936
937void icmp_err(struct sk_buff *skb, u32 info)
938{
939 struct iphdr *iph = (struct iphdr *)skb->data;
940 struct icmphdr *icmph = (struct icmphdr *)(skb->data+(iph->ihl<<2));
941 int type = icmp_hdr(skb)->type;
942 int code = icmp_hdr(skb)->code;
943 struct net *net = dev_net(skb->dev);
944
945 /*
946 * Use ping_err to handle all icmp errors except those
947 * triggered by ICMP_ECHOREPLY which sent from kernel.
948 */
949 if (icmph->type != ICMP_ECHOREPLY) {
950 ping_err(skb, info);
951 return;
952 }
953
954 if (type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED)
955 ipv4_update_pmtu(skb, net, info, 0, 0, IPPROTO_ICMP, 0);
956 else if (type == ICMP_REDIRECT)
957 ipv4_redirect(skb, net, 0, 0, IPPROTO_ICMP, 0);
958}
959
937/* 960/*
938 * This table is the definition of how we handle ICMP. 961 * This table is the definition of how we handle ICMP.
939 */ 962 */
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 5ef4da780ac1..d0ef0e674ec5 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -735,7 +735,7 @@ drop:
735 return 0; 735 return 0;
736} 736}
737 737
738static struct sk_buff *handle_offloads(struct sk_buff *skb) 738static struct sk_buff *handle_offloads(struct ip_tunnel *tunnel, struct sk_buff *skb)
739{ 739{
740 int err; 740 int err;
741 741
@@ -745,8 +745,12 @@ static struct sk_buff *handle_offloads(struct sk_buff *skb)
745 goto error; 745 goto error;
746 skb_shinfo(skb)->gso_type |= SKB_GSO_GRE; 746 skb_shinfo(skb)->gso_type |= SKB_GSO_GRE;
747 return skb; 747 return skb;
748 } 748 } else if (skb->ip_summed == CHECKSUM_PARTIAL &&
749 if (skb->ip_summed != CHECKSUM_PARTIAL) 749 tunnel->parms.o_flags&GRE_CSUM) {
750 err = skb_checksum_help(skb);
751 if (unlikely(err))
752 goto error;
753 } else if (skb->ip_summed != CHECKSUM_PARTIAL)
750 skb->ip_summed = CHECKSUM_NONE; 754 skb->ip_summed = CHECKSUM_NONE;
751 755
752 return skb; 756 return skb;
@@ -776,7 +780,7 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
776 int err; 780 int err;
777 int pkt_len; 781 int pkt_len;
778 782
779 skb = handle_offloads(skb); 783 skb = handle_offloads(tunnel, skb);
780 if (IS_ERR(skb)) { 784 if (IS_ERR(skb)) {
781 dev->stats.tx_dropped++; 785 dev->stats.tx_dropped++;
782 return NETDEV_TX_OK; 786 return NETDEV_TX_OK;
@@ -970,7 +974,8 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
970 iph->daddr = fl4.daddr; 974 iph->daddr = fl4.daddr;
971 iph->saddr = fl4.saddr; 975 iph->saddr = fl4.saddr;
972 iph->ttl = ttl; 976 iph->ttl = ttl;
973 iph->id = 0; 977
978 tunnel_ip_select_ident(skb, old_iph, &rt->dst);
974 979
975 if (ttl == 0) { 980 if (ttl == 0) {
976 if (skb->protocol == htons(ETH_P_IP)) 981 if (skb->protocol == htons(ETH_P_IP))
@@ -1101,14 +1106,8 @@ static int ipgre_tunnel_bind_dev(struct net_device *dev)
1101 tunnel->hlen = addend; 1106 tunnel->hlen = addend;
1102 /* TCP offload with GRE SEQ is not supported. */ 1107 /* TCP offload with GRE SEQ is not supported. */
1103 if (!(tunnel->parms.o_flags & GRE_SEQ)) { 1108 if (!(tunnel->parms.o_flags & GRE_SEQ)) {
1104 /* device supports enc gso offload*/ 1109 dev->features |= NETIF_F_GSO_SOFTWARE;
1105 if (tdev->hw_enc_features & NETIF_F_GRE_GSO) { 1110 dev->hw_features |= NETIF_F_GSO_SOFTWARE;
1106 dev->features |= NETIF_F_TSO;
1107 dev->hw_features |= NETIF_F_TSO;
1108 } else {
1109 dev->features |= NETIF_F_GSO_SOFTWARE;
1110 dev->hw_features |= NETIF_F_GSO_SOFTWARE;
1111 }
1112 } 1111 }
1113 1112
1114 return mtu; 1113 return mtu;
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
index 55c4ee1bba06..2e91006d6076 100644
--- a/net/ipv4/ping.c
+++ b/net/ipv4/ping.c
@@ -322,8 +322,8 @@ void ping_err(struct sk_buff *skb, u32 info)
322 struct iphdr *iph = (struct iphdr *)skb->data; 322 struct iphdr *iph = (struct iphdr *)skb->data;
323 struct icmphdr *icmph = (struct icmphdr *)(skb->data+(iph->ihl<<2)); 323 struct icmphdr *icmph = (struct icmphdr *)(skb->data+(iph->ihl<<2));
324 struct inet_sock *inet_sock; 324 struct inet_sock *inet_sock;
325 int type = icmph->type; 325 int type = icmp_hdr(skb)->type;
326 int code = icmph->code; 326 int code = icmp_hdr(skb)->code;
327 struct net *net = dev_net(skb->dev); 327 struct net *net = dev_net(skb->dev);
328 struct sock *sk; 328 struct sock *sk;
329 int harderr; 329 int harderr;
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index fd0cea114b5d..e2b4461074da 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1351,8 +1351,8 @@ int tcp_trim_head(struct sock *sk, struct sk_buff *skb, u32 len)
1351 return 0; 1351 return 0;
1352} 1352}
1353 1353
1354/* Calculate MSS. Not accounting for SACKs here. */ 1354/* Calculate MSS not accounting any TCP options. */
1355int tcp_mtu_to_mss(struct sock *sk, int pmtu) 1355static inline int __tcp_mtu_to_mss(struct sock *sk, int pmtu)
1356{ 1356{
1357 const struct tcp_sock *tp = tcp_sk(sk); 1357 const struct tcp_sock *tp = tcp_sk(sk);
1358 const struct inet_connection_sock *icsk = inet_csk(sk); 1358 const struct inet_connection_sock *icsk = inet_csk(sk);
@@ -1381,13 +1381,17 @@ int tcp_mtu_to_mss(struct sock *sk, int pmtu)
1381 /* Then reserve room for full set of TCP options and 8 bytes of data */ 1381 /* Then reserve room for full set of TCP options and 8 bytes of data */
1382 if (mss_now < 48) 1382 if (mss_now < 48)
1383 mss_now = 48; 1383 mss_now = 48;
1384
1385 /* Now subtract TCP options size, not including SACKs */
1386 mss_now -= tp->tcp_header_len - sizeof(struct tcphdr);
1387
1388 return mss_now; 1384 return mss_now;
1389} 1385}
1390 1386
1387/* Calculate MSS. Not accounting for SACKs here. */
1388int tcp_mtu_to_mss(struct sock *sk, int pmtu)
1389{
1390 /* Subtract TCP options size, not including SACKs */
1391 return __tcp_mtu_to_mss(sk, pmtu) -
1392 (tcp_sk(sk)->tcp_header_len - sizeof(struct tcphdr));
1393}
1394
1391/* Inverse of above */ 1395/* Inverse of above */
1392int tcp_mss_to_mtu(struct sock *sk, int mss) 1396int tcp_mss_to_mtu(struct sock *sk, int mss)
1393{ 1397{
@@ -2930,7 +2934,7 @@ static int tcp_send_syn_data(struct sock *sk, struct sk_buff *syn)
2930 */ 2934 */
2931 if (tp->rx_opt.user_mss && tp->rx_opt.user_mss < tp->rx_opt.mss_clamp) 2935 if (tp->rx_opt.user_mss && tp->rx_opt.user_mss < tp->rx_opt.mss_clamp)
2932 tp->rx_opt.mss_clamp = tp->rx_opt.user_mss; 2936 tp->rx_opt.mss_clamp = tp->rx_opt.user_mss;
2933 space = tcp_mtu_to_mss(sk, inet_csk(sk)->icsk_pmtu_cookie) - 2937 space = __tcp_mtu_to_mss(sk, inet_csk(sk)->icsk_pmtu_cookie) -
2934 MAX_TCP_OPTION_SPACE; 2938 MAX_TCP_OPTION_SPACE;
2935 2939
2936 syn_data = skb_copy_expand(syn, skb_headroom(syn), space, 2940 syn_data = skb_copy_expand(syn, skb_headroom(syn), space,