From 4170474f0be65263a5ccc832852c8f53be55b194 Mon Sep 17 00:00:00 2001 From: Bruce Allan Date: Tue, 22 Jan 2013 08:44:04 +0000 Subject: [PATCH] --- yaml --- r: 352084 b: refs/heads/master c: f25701df2ef171894730534e5b557186d2bacf17 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/Documentation/networking/LICENSE.qlcnic | 2 +- trunk/Documentation/networking/ip-sysctl.txt | 11 + trunk/drivers/bcma/driver_chipcommon_nflash.c | 2 +- trunk/drivers/net/bonding/bond_sysfs.c | 1 - trunk/drivers/net/can/c_can/c_can.c | 6 +- trunk/drivers/net/ethernet/emulex/benet/be.h | 8 +- .../net/ethernet/emulex/benet/be_main.c | 2 +- .../drivers/net/ethernet/freescale/gianfar.c | 16 +- .../drivers/net/ethernet/intel/e1000e/82571.c | 15 -- .../drivers/net/ethernet/intel/e1000e/82571.h | 58 +++++ .../net/ethernet/intel/e1000e/defines.h | 2 - .../drivers/net/ethernet/intel/e1000e/e1000.h | 4 - trunk/drivers/net/ethernet/intel/e1000e/hw.h | 5 +- .../net/ethernet/intel/e1000e/netdev.c | 1 - .../net/ethernet/qlogic/qlcnic/qlcnic.h | 2 +- .../ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | 7 - .../ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h | 7 - .../ethernet/qlogic/qlcnic/qlcnic_83xx_init.c | 7 - .../ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c | 7 - .../net/ethernet/qlogic/qlcnic/qlcnic_ctx.c | 2 +- .../ethernet/qlogic/qlcnic/qlcnic_ethtool.c | 2 +- .../net/ethernet/qlogic/qlcnic/qlcnic_hdr.h | 2 +- .../net/ethernet/qlogic/qlcnic/qlcnic_hw.c | 2 +- .../net/ethernet/qlogic/qlcnic/qlcnic_hw.h | 7 - .../net/ethernet/qlogic/qlcnic/qlcnic_init.c | 2 +- .../net/ethernet/qlogic/qlcnic/qlcnic_io.c | 7 - .../net/ethernet/qlogic/qlcnic/qlcnic_main.c | 2 +- .../ethernet/qlogic/qlcnic/qlcnic_minidump.c | 6 - .../net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c | 7 - trunk/drivers/net/ethernet/via/via-rhine.c | 8 +- trunk/drivers/net/tun.c | 38 ++- trunk/drivers/net/usb/qmi_wwan.c | 1 - trunk/drivers/net/usb/usbnet.c | 35 +-- trunk/drivers/net/vmxnet3/vmxnet3_drv.c | 7 +- .../net/wireless/brcm80211/brcmsmac/main.c | 25 +- trunk/drivers/net/wireless/iwlwifi/dvm/tx.c | 27 ++- trunk/drivers/net/wireless/mwifiex/scan.c | 9 +- trunk/drivers/net/wireless/rtlwifi/usb.c | 4 +- trunk/drivers/vhost/net.c | 41 ++-- trunk/drivers/vhost/vhost.c | 18 +- trunk/drivers/vhost/vhost.h | 2 +- trunk/include/linux/tcp.h | 1 + trunk/include/linux/usb/usbnet.h | 2 - trunk/include/net/tcp.h | 1 + trunk/include/net/transp_v6.h | 22 +- trunk/kernel/sysctl_binary.c | 1 + trunk/net/core/pktgen.c | 9 +- trunk/net/core/skbuff.c | 2 +- trunk/net/ipv4/af_inet.c | 19 ++ trunk/net/ipv4/ip_input.c | 7 + trunk/net/ipv4/protocol.c | 6 - trunk/net/ipv4/sysctl_net_ipv4.c | 7 + trunk/net/ipv4/tcp.c | 1 + trunk/net/ipv4/tcp_cong.c | 42 +++- trunk/net/ipv4/tcp_input.c | 21 +- trunk/net/ipv4/tcp_ipv4.c | 6 +- trunk/net/ipv4/tcp_minisocks.c | 1 + trunk/net/ipv6/addrconf.c | 1 - trunk/net/ipv6/datagram.c | 16 +- trunk/net/ipv6/ip6_flowlabel.c | 4 +- trunk/net/ipv6/ipv6_sockglue.c | 6 +- trunk/net/ipv6/raw.c | 6 +- trunk/net/ipv6/tcp_ipv6.c | 6 +- trunk/net/ipv6/udp.c | 6 +- trunk/net/l2tp/l2tp_core.c | 217 +++++------------- trunk/net/l2tp/l2tp_core.h | 7 +- trunk/net/l2tp/l2tp_ip.c | 16 +- trunk/net/l2tp/l2tp_ip6.c | 10 +- trunk/net/l2tp/l2tp_netlink.c | 1 - trunk/net/packet/af_packet.c | 10 +- trunk/net/sched/sch_netem.c | 12 +- trunk/net/sunrpc/svcsock.c | 2 +- trunk/net/wireless/scan.c | 2 +- 74 files changed, 394 insertions(+), 495 deletions(-) create mode 100644 trunk/drivers/net/ethernet/intel/e1000e/82571.h diff --git a/[refs] b/[refs] index 0df7967f400d..a440fb55ab97 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: ca2eb5679f8ddffff60156af42595df44a315ef0 +refs/heads/master: f25701df2ef171894730534e5b557186d2bacf17 diff --git a/trunk/Documentation/networking/LICENSE.qlcnic b/trunk/Documentation/networking/LICENSE.qlcnic index 2ae3b64983ab..e7fb2c6023bc 100644 --- a/trunk/Documentation/networking/LICENSE.qlcnic +++ b/trunk/Documentation/networking/LICENSE.qlcnic @@ -1,4 +1,4 @@ -Copyright (c) 2009-2013 QLogic Corporation +Copyright (c) 2009-2011 QLogic Corporation QLogic Linux qlcnic NIC Driver You may modify and redistribute the device driver code under the diff --git a/trunk/Documentation/networking/ip-sysctl.txt b/trunk/Documentation/networking/ip-sysctl.txt index dc2dc87d2557..19ac1802bfd4 100644 --- a/trunk/Documentation/networking/ip-sysctl.txt +++ b/trunk/Documentation/networking/ip-sysctl.txt @@ -130,6 +130,17 @@ somaxconn - INTEGER Defaults to 128. See also tcp_max_syn_backlog for additional tuning for TCP sockets. +tcp_abc - INTEGER + Controls Appropriate Byte Count (ABC) defined in RFC3465. + ABC is a way of increasing congestion window (cwnd) more slowly + in response to partial acknowledgments. + Possible values are: + 0 increase cwnd once per acknowledgment (no ABC) + 1 increase cwnd once per acknowledgment of full sized segment + 2 allow increase cwnd by two if acknowledgment is + of two segments to compensate for delayed acknowledgments. + Default: 0 (off) + tcp_abort_on_overflow - BOOLEAN If listening service is too slow to accept new connections, reset them. Default state is FALSE. It means that if overflow diff --git a/trunk/drivers/bcma/driver_chipcommon_nflash.c b/trunk/drivers/bcma/driver_chipcommon_nflash.c index 1f0b83e18f68..dbda91e4dff5 100644 --- a/trunk/drivers/bcma/driver_chipcommon_nflash.c +++ b/trunk/drivers/bcma/driver_chipcommon_nflash.c @@ -21,7 +21,7 @@ int bcma_nflash_init(struct bcma_drv_cc *cc) struct bcma_bus *bus = cc->core->bus; if (bus->chipinfo.id != BCMA_CHIP_ID_BCM4706 && - cc->core->id.rev != 38) { + cc->core->id.rev != 0x38) { bcma_err(bus, "NAND flash on unsupported board!\n"); return -ENOTSUPP; } diff --git a/trunk/drivers/net/bonding/bond_sysfs.c b/trunk/drivers/net/bonding/bond_sysfs.c index 1c9e09fbdff8..1877ed7ca086 100644 --- a/trunk/drivers/net/bonding/bond_sysfs.c +++ b/trunk/drivers/net/bonding/bond_sysfs.c @@ -1053,7 +1053,6 @@ static ssize_t bonding_store_primary(struct device *d, pr_info("%s: Setting primary slave to None.\n", bond->dev->name); bond->primary_slave = NULL; - memset(bond->params.primary, 0, sizeof(bond->params.primary)); bond_select_active_slave(bond); goto out; } diff --git a/trunk/drivers/net/can/c_can/c_can.c b/trunk/drivers/net/can/c_can/c_can.c index a668cd491cb3..285f763e3cd1 100644 --- a/trunk/drivers/net/can/c_can/c_can.c +++ b/trunk/drivers/net/can/c_can/c_can.c @@ -491,12 +491,8 @@ static void c_can_setup_receive_object(struct net_device *dev, int iface, priv->write_reg(priv, C_CAN_IFACE(MASK1_REG, iface), IFX_WRITE_LOW_16BIT(mask)); - - /* According to C_CAN documentation, the reserved bit - * in IFx_MASK2 register is fixed 1 - */ priv->write_reg(priv, C_CAN_IFACE(MASK2_REG, iface), - IFX_WRITE_HIGH_16BIT(mask) | BIT(13)); + IFX_WRITE_HIGH_16BIT(mask)); priv->write_reg(priv, C_CAN_IFACE(ARB1_REG, iface), IFX_WRITE_LOW_16BIT(id)); diff --git a/trunk/drivers/net/ethernet/emulex/benet/be.h b/trunk/drivers/net/ethernet/emulex/benet/be.h index 28ceb8414185..4010cb71bddb 100644 --- a/trunk/drivers/net/ethernet/emulex/benet/be.h +++ b/trunk/drivers/net/ethernet/emulex/benet/be.h @@ -36,13 +36,13 @@ #define DRV_VER "4.6.62.0u" #define DRV_NAME "be2net" -#define BE_NAME "Emulex BladeEngine2" -#define BE3_NAME "Emulex BladeEngine3" -#define OC_NAME "Emulex OneConnect" +#define BE_NAME "ServerEngines BladeEngine2 10Gbps NIC" +#define BE3_NAME "ServerEngines BladeEngine3 10Gbps NIC" +#define OC_NAME "Emulex OneConnect 10Gbps NIC" #define OC_NAME_BE OC_NAME "(be3)" #define OC_NAME_LANCER OC_NAME "(Lancer)" #define OC_NAME_SH OC_NAME "(Skyhawk)" -#define DRV_DESC "Emulex OneConnect 10Gbps NIC Driver" +#define DRV_DESC "ServerEngines BladeEngine 10Gbps NIC Driver" #define BE_VENDOR_ID 0x19a2 #define EMULEX_VENDOR_ID 0x10df diff --git a/trunk/drivers/net/ethernet/emulex/benet/be_main.c b/trunk/drivers/net/ethernet/emulex/benet/be_main.c index 3860888ac711..7d534818d2fb 100644 --- a/trunk/drivers/net/ethernet/emulex/benet/be_main.c +++ b/trunk/drivers/net/ethernet/emulex/benet/be_main.c @@ -25,7 +25,7 @@ MODULE_VERSION(DRV_VER); MODULE_DEVICE_TABLE(pci, be_dev_ids); MODULE_DESCRIPTION(DRV_DESC " " DRV_VER); -MODULE_AUTHOR("Emulex Corporation"); +MODULE_AUTHOR("ServerEngines Corporation"); MODULE_LICENSE("GPL"); static unsigned int num_vfs; diff --git a/trunk/drivers/net/ethernet/freescale/gianfar.c b/trunk/drivers/net/ethernet/freescale/gianfar.c index 75734bfed10f..19c54a0acb56 100644 --- a/trunk/drivers/net/ethernet/freescale/gianfar.c +++ b/trunk/drivers/net/ethernet/freescale/gianfar.c @@ -580,11 +580,19 @@ static int gfar_parse_group(struct device_node *np, u32 *queue_mask; int i; - for (i = 0; i < GFAR_NUM_IRQS; i++) { - grp->irqinfo[i] = kzalloc(sizeof(struct gfar_irqinfo), - GFP_KERNEL); - if (!grp->irqinfo[i]) + if (priv->mode == MQ_MG_MODE) { + for (i = 0; i < GFAR_NUM_IRQS; i++) { + grp->irqinfo[i] = kzalloc(sizeof(struct gfar_irqinfo), + GFP_KERNEL); + if (!grp->irqinfo[i]) + return -ENOMEM; + } + } else { + grp->irqinfo[GFAR_TX] = kzalloc(sizeof(struct gfar_irqinfo), + GFP_KERNEL); + if (!grp->irqinfo[GFAR_TX]) return -ENOMEM; + grp->irqinfo[GFAR_RX] = grp->irqinfo[GFAR_ER] = NULL; } grp->regs = of_iomap(np, 0); diff --git a/trunk/drivers/net/ethernet/intel/e1000e/82571.c b/trunk/drivers/net/ethernet/intel/e1000e/82571.c index cf86090edd3b..1db7e3df43ea 100644 --- a/trunk/drivers/net/ethernet/intel/e1000e/82571.c +++ b/trunk/drivers/net/ethernet/intel/e1000e/82571.c @@ -44,21 +44,6 @@ #include "e1000.h" -#define ID_LED_RESERVED_F746 0xF746 -#define ID_LED_DEFAULT_82573 ((ID_LED_DEF1_DEF2 << 12) | \ - (ID_LED_OFF1_ON2 << 8) | \ - (ID_LED_DEF1_DEF2 << 4) | \ - (ID_LED_DEF1_DEF2)) - -#define E1000_GCR_L1_ACT_WITHOUT_L0S_RX 0x08000000 -#define AN_RETRY_COUNT 5 /* Autoneg Retry Count value */ -#define E1000_BASE1000T_STATUS 10 -#define E1000_IDLE_ERROR_COUNT_MASK 0xFF -#define E1000_RECEIVE_ERROR_COUNTER 21 -#define E1000_RECEIVE_ERROR_MAX 0xFFFF - -#define E1000_NVM_INIT_CTRL2_MNGM 0x6000 /* Manageability Operation Mode mask */ - static s32 e1000_get_phy_id_82571(struct e1000_hw *hw); static s32 e1000_setup_copper_link_82571(struct e1000_hw *hw); static s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw); diff --git a/trunk/drivers/net/ethernet/intel/e1000e/82571.h b/trunk/drivers/net/ethernet/intel/e1000e/82571.h new file mode 100644 index 000000000000..85cb1a3b7cd4 --- /dev/null +++ b/trunk/drivers/net/ethernet/intel/e1000e/82571.h @@ -0,0 +1,58 @@ +/******************************************************************************* + + Intel PRO/1000 Linux driver + Copyright(c) 1999 - 2013 Intel Corporation. + + This program is free software; you can redistribute it and/or modify it + under the terms and conditions of the GNU General Public License, + version 2, as published by the Free Software Foundation. + + This program is distributed in the hope it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + + The full GNU General Public License is included in this distribution in + the file called "COPYING". + + Contact Information: + Linux NICS + e1000-devel Mailing List + Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 + +*******************************************************************************/ + +#ifndef _E1000E_82571_H_ +#define _E1000E_82571_H_ + +#define ID_LED_RESERVED_F746 0xF746 +#define ID_LED_DEFAULT_82573 ((ID_LED_DEF1_DEF2 << 12) | \ + (ID_LED_OFF1_ON2 << 8) | \ + (ID_LED_DEF1_DEF2 << 4) | \ + (ID_LED_DEF1_DEF2)) + +#define E1000_GCR_L1_ACT_WITHOUT_L0S_RX 0x08000000 +#define AN_RETRY_COUNT 5 /* Autoneg Retry Count value */ + +/* Intr Throttling - RW */ +#define E1000_EITR_82574(_n) (0x000E8 + (0x4 * (_n))) + +#define E1000_EIAC_82574 0x000DC /* Ext. Interrupt Auto Clear - RW */ +#define E1000_EIAC_MASK_82574 0x01F00000 + +/* Manageability Operation Mode mask */ +#define E1000_NVM_INIT_CTRL2_MNGM 0x6000 + +#define E1000_BASE1000T_STATUS 10 +#define E1000_IDLE_ERROR_COUNT_MASK 0xFF +#define E1000_RECEIVE_ERROR_COUNTER 21 +#define E1000_RECEIVE_ERROR_MAX 0xFFFF +bool e1000_check_phy_82574(struct e1000_hw *hw); +bool e1000e_get_laa_state_82571(struct e1000_hw *hw); +void e1000e_set_laa_state_82571(struct e1000_hw *hw, bool state); + +#endif diff --git a/trunk/drivers/net/ethernet/intel/e1000e/defines.h b/trunk/drivers/net/ethernet/intel/e1000e/defines.h index 615b900c0152..b425544144ec 100644 --- a/trunk/drivers/net/ethernet/intel/e1000e/defines.h +++ b/trunk/drivers/net/ethernet/intel/e1000e/defines.h @@ -606,8 +606,6 @@ #define NVM_ALT_MAC_ADDR_PTR 0x0037 #define NVM_CHECKSUM_REG 0x003F -#define E1000_NVM_INIT_CTRL2_MNGM 0x6000 /* Manageability Operation Mode mask */ - #define E1000_NVM_CFG_DONE_PORT_0 0x40000 /* MNG config cycle done */ #define E1000_NVM_CFG_DONE_PORT_1 0x80000 /* ...for second port */ diff --git a/trunk/drivers/net/ethernet/intel/e1000e/e1000.h b/trunk/drivers/net/ethernet/intel/e1000e/e1000.h index 4b0bd9c225cc..12c5d4043505 100644 --- a/trunk/drivers/net/ethernet/intel/e1000e/e1000.h +++ b/trunk/drivers/net/ethernet/intel/e1000e/e1000.h @@ -579,9 +579,6 @@ extern s32 e1000_read_pba_string_generic(struct e1000_hw *hw, u8 *pba_num, extern bool e1000e_enable_mng_pass_thru(struct e1000_hw *hw); -extern bool e1000e_get_laa_state_82571(struct e1000_hw *hw); -extern void e1000e_set_laa_state_82571(struct e1000_hw *hw, bool state); - extern void e1000e_write_protect_nvm_ich8lan(struct e1000_hw *hw); extern void e1000e_set_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw, bool state); @@ -703,7 +700,6 @@ extern s32 e1000_get_phy_info_ife(struct e1000_hw *hw); extern s32 e1000_check_polarity_ife(struct e1000_hw *hw); extern s32 e1000_phy_force_speed_duplex_ife(struct e1000_hw *hw); extern s32 e1000_check_polarity_igp(struct e1000_hw *hw); -extern bool e1000_check_phy_82574(struct e1000_hw *hw); extern s32 e1000_read_emi_reg_locked(struct e1000_hw *hw, u16 addr, u16 *data); extern void e1000e_ptp_init(struct e1000_adapter *adapter); extern void e1000e_ptp_remove(struct e1000_adapter *adapter); diff --git a/trunk/drivers/net/ethernet/intel/e1000e/hw.h b/trunk/drivers/net/ethernet/intel/e1000e/hw.h index f32b19af9a72..6f94437d8c0e 100644 --- a/trunk/drivers/net/ethernet/intel/e1000e/hw.h +++ b/trunk/drivers/net/ethernet/intel/e1000e/hw.h @@ -54,12 +54,9 @@ enum e1e_registers { E1000_ICS = 0x000C8, /* Interrupt Cause Set - WO */ E1000_IMS = 0x000D0, /* Interrupt Mask Set - RW */ E1000_IMC = 0x000D8, /* Interrupt Mask Clear - WO */ - E1000_EIAC_82574 = 0x000DC, /* Ext. Interrupt Auto Clear - RW */ E1000_IAM = 0x000E0, /* Interrupt Acknowledge Auto Mask */ E1000_IVAR = 0x000E4, /* Interrupt Vector Allocation - RW */ E1000_FEXTNVM7 = 0x000E4, /* Future Extended NVM 7 - RW */ - E1000_EITR_82574_BASE = 0x000E8, /* Interrupt Throttling - RW */ -#define E1000_EITR_82574(_n) (E1000_EITR_82574_BASE + (_n << 2)) E1000_LPIC = 0x000FC, /* Low Power Idle Control - RW */ E1000_RCTL = 0x00100, /* Rx Control - RW */ E1000_FCTTV = 0x00170, /* Flow Control Transmit Timer Value - RW */ @@ -1005,4 +1002,6 @@ struct e1000_hw { } dev_spec; }; +#include "82571.h" + #endif diff --git a/trunk/drivers/net/ethernet/intel/e1000e/netdev.c b/trunk/drivers/net/ethernet/intel/e1000e/netdev.c index e0eb5dddf3ea..6fcf9e8008c0 100644 --- a/trunk/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/trunk/drivers/net/ethernet/intel/e1000e/netdev.c @@ -2024,7 +2024,6 @@ static void e1000_configure_msix(struct e1000_adapter *adapter) ctrl_ext |= E1000_CTRL_EXT_PBA_CLR; /* Auto-Mask Other interrupts upon ICR read */ -#define E1000_EIAC_MASK_82574 0x01F00000 ew32(IAM, ~E1000_EIAC_MASK_82574 | E1000_IMS_OTHER); ctrl_ext |= E1000_CTRL_EXT_EIAME; ew32(CTRL_EXT, ctrl_ext); diff --git a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h index 3a840e741982..457ca8ec9e73 100644 --- a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h +++ b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h @@ -1,6 +1,6 @@ /* * QLogic qlcnic NIC Driver - * Copyright (c) 2009-2013 QLogic Corporation + * Copyright (c) 2009-2010 QLogic Corporation * * See LICENSE.qlcnic for copyright and licensing details. */ diff --git a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c index cdcbbb0e40cb..65233c846537 100644 --- a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c +++ b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c @@ -1,10 +1,3 @@ -/* - * QLogic qlcnic NIC Driver - * Copyright (c) 2009-2013 QLogic Corporation - * - * See LICENSE.qlcnic for copyright and licensing details. - */ - #include "qlcnic.h" #include #include diff --git a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h index b62017bae368..2b44eb14d525 100644 --- a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h +++ b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h @@ -1,10 +1,3 @@ -/* - * QLogic qlcnic NIC Driver - * Copyright (c) 2009-2013 QLogic Corporation - * - * See LICENSE.qlcnic for copyright and licensing details. - */ - #ifndef __QLCNIC_83XX_HW_H #define __QLCNIC_83XX_HW_H diff --git a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c index f6470027d0fc..8163e5b338e4 100644 --- a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c +++ b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c @@ -1,10 +1,3 @@ -/* - * QLogic qlcnic NIC Driver - * Copyright (c) 2009-2013 QLogic Corporation - * - * See LICENSE.qlcnic for copyright and licensing details. - */ - #include "qlcnic.h" #include "qlcnic_hw.h" diff --git a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c index b0c3de9ede03..b3ef33a67229 100644 --- a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c +++ b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c @@ -1,10 +1,3 @@ -/* - * QLogic qlcnic NIC Driver - * Copyright (c) 2009-2013 QLogic Corporation - * - * See LICENSE.qlcnic for copyright and licensing details. - */ - #include "qlcnic.h" #include "qlcnic_hw.h" diff --git a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c index 4a3bd64b7fb0..7372964d3a76 100644 --- a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c +++ b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c @@ -1,6 +1,6 @@ /* * QLogic qlcnic NIC Driver - * Copyright (c) 2009-2013 QLogic Corporation + * Copyright (c) 2009-2010 QLogic Corporation * * See LICENSE.qlcnic for copyright and licensing details. */ diff --git a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c index 6320d551c63d..f65fd7b6f9ae 100644 --- a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c +++ b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c @@ -1,6 +1,6 @@ /* * QLogic qlcnic NIC Driver - * Copyright (c) 2009-2013 QLogic Corporation + * Copyright (c) 2009-2010 QLogic Corporation * * See LICENSE.qlcnic for copyright and licensing details. */ diff --git a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hdr.h b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hdr.h index 44197ca1456c..74f771122985 100644 --- a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hdr.h +++ b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hdr.h @@ -1,6 +1,6 @@ /* * QLogic qlcnic NIC Driver - * Copyright (c) 2009-2013 QLogic Corporation + * Copyright (c) 2009-2010 QLogic Corporation * * See LICENSE.qlcnic for copyright and licensing details. */ diff --git a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c index 51716ab8739a..4ee92b254fc0 100644 --- a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c +++ b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c @@ -1,6 +1,6 @@ /* * QLogic qlcnic NIC Driver - * Copyright (c) 2009-2013 QLogic Corporation + * Copyright (c) 2009-2010 QLogic Corporation * * See LICENSE.qlcnic for copyright and licensing details. */ diff --git a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h index ed52b9cfa15d..9673e2bcff06 100644 --- a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h +++ b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h @@ -1,10 +1,3 @@ -/* - * QLogic qlcnic NIC Driver - * Copyright (c) 2009-2013 QLogic Corporation - * - * See LICENSE.qlcnic for copyright and licensing details. - */ - #ifndef __QLCNIC_HW_H #define __QLCNIC_HW_H diff --git a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c index d28336fc65ab..10ad25d7aa0e 100644 --- a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c +++ b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c @@ -1,6 +1,6 @@ /* * QLogic qlcnic NIC Driver - * Copyright (c) 2009-2013 QLogic Corporation + * Copyright (c) 2009-2010 QLogic Corporation * * See LICENSE.qlcnic for copyright and licensing details. */ diff --git a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c index bb4311e9aea9..d00f62832742 100644 --- a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c +++ b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c @@ -1,10 +1,3 @@ -/* - * QLogic qlcnic NIC Driver - * Copyright (c) 2009-2013 QLogic Corporation - * - * See LICENSE.qlcnic for copyright and licensing details. - */ - #include #include #include diff --git a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index d0aef32d0390..fb0255a90ce4 100644 --- a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c @@ -1,6 +1,6 @@ /* * QLogic qlcnic NIC Driver - * Copyright (c) 2009-2013 QLogic Corporation + * Copyright (c) 2009-2010 QLogic Corporation * * See LICENSE.qlcnic for copyright and licensing details. */ diff --git a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c index abbd22c814a6..8dbc8e76bc74 100644 --- a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c +++ b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c @@ -1,9 +1,3 @@ -/* - * QLogic qlcnic NIC Driver - * Copyright (c) 2009-2013 QLogic Corporation - * - * See LICENSE.qlcnic for copyright and licensing details. - */ #include "qlcnic.h" #include "qlcnic_hdr.h" diff --git a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c index 987fb6f8adc3..504506349ac1 100644 --- a/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c +++ b/trunk/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c @@ -1,10 +1,3 @@ -/* - * QLogic qlcnic NIC Driver - * Copyright (c) 2009-2013 QLogic Corporation - * - * See LICENSE.qlcnic for copyright and licensing details. - */ - #include #include #include diff --git a/trunk/drivers/net/ethernet/via/via-rhine.c b/trunk/drivers/net/ethernet/via/via-rhine.c index 185c721c52d7..ec4a5e1c6fb2 100644 --- a/trunk/drivers/net/ethernet/via/via-rhine.c +++ b/trunk/drivers/net/ethernet/via/via-rhine.c @@ -1812,7 +1812,7 @@ static void rhine_tx(struct net_device *dev) rp->tx_skbuff[entry]->len, PCI_DMA_TODEVICE); } - dev_kfree_skb(rp->tx_skbuff[entry]); + dev_kfree_skb_irq(rp->tx_skbuff[entry]); rp->tx_skbuff[entry] = NULL; entry = (++rp->dirty_tx) % TX_RING_SIZE; } @@ -2024,7 +2024,11 @@ static void rhine_slow_event_task(struct work_struct *work) if (intr_status & IntrPCIErr) netif_warn(rp, hw, dev, "PCI error\n"); - iowrite16(RHINE_EVENT & 0xffff, rp->base + IntrEnable); + napi_disable(&rp->napi); + rhine_irq_disable(rp); + /* Slow and safe. Consider __napi_schedule as a replacement ? */ + napi_enable(&rp->napi); + napi_schedule(&rp->napi); out_unlock: mutex_unlock(&rp->task_lock); diff --git a/trunk/drivers/net/tun.c b/trunk/drivers/net/tun.c index b1038c0e2240..8d208dd92963 100644 --- a/trunk/drivers/net/tun.c +++ b/trunk/drivers/net/tun.c @@ -298,12 +298,11 @@ static void tun_flow_cleanup(unsigned long data) } static void tun_flow_update(struct tun_struct *tun, u32 rxhash, - struct tun_file *tfile) + u16 queue_index) { struct hlist_head *head; struct tun_flow_entry *e; unsigned long delay = tun->ageing_time; - u16 queue_index = tfile->queue_index; if (!rxhash) return; @@ -312,9 +311,7 @@ static void tun_flow_update(struct tun_struct *tun, u32 rxhash, rcu_read_lock(); - /* We may get a very small possibility of OOO during switching, not - * worth to optimize.*/ - if (tun->numqueues == 1 || tfile->detached) + if (tun->numqueues == 1) goto unlock; e = tun_flow_find(head, rxhash); @@ -414,21 +411,21 @@ static void __tun_detach(struct tun_file *tfile, bool clean) tun = rtnl_dereference(tfile->tun); - if (tun && !tfile->detached) { + if (tun) { u16 index = tfile->queue_index; BUG_ON(index >= tun->numqueues); dev = tun->dev; rcu_assign_pointer(tun->tfiles[index], tun->tfiles[tun->numqueues - 1]); + rcu_assign_pointer(tfile->tun, NULL); ntfile = rtnl_dereference(tun->tfiles[index]); ntfile->queue_index = index; --tun->numqueues; - if (clean) { - rcu_assign_pointer(tfile->tun, NULL); + if (clean) sock_put(&tfile->sk); - } else + else tun_disable_queue(tun, tfile); synchronize_net(); @@ -442,13 +439,10 @@ static void __tun_detach(struct tun_file *tfile, bool clean) } if (clean) { - if (tun && tun->numqueues == 0 && tun->numdisabled == 0) { - netif_carrier_off(tun->dev); - - if (!(tun->flags & TUN_PERSIST) && - tun->dev->reg_state == NETREG_REGISTERED) + if (tun && tun->numqueues == 0 && tun->numdisabled == 0 && + !(tun->flags & TUN_PERSIST)) + if (tun->dev->reg_state == NETREG_REGISTERED) unregister_netdevice(tun->dev); - } BUG_ON(!test_bit(SOCK_EXTERNALLY_ALLOCATED, &tfile->socket.flags)); @@ -476,10 +470,6 @@ static void tun_detach_all(struct net_device *dev) rcu_assign_pointer(tfile->tun, NULL); --tun->numqueues; } - list_for_each_entry(tfile, &tun->disabled, next) { - wake_up_all(&tfile->wq.wait); - rcu_assign_pointer(tfile->tun, NULL); - } BUG_ON(tun->numqueues != 0); synchronize_net(); @@ -510,7 +500,7 @@ static int tun_attach(struct tun_struct *tun, struct file *file) goto out; err = -EINVAL; - if (rtnl_dereference(tfile->tun) && !tfile->detached) + if (rtnl_dereference(tfile->tun)) goto out; err = -EBUSY; @@ -1213,7 +1203,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, tun->dev->stats.rx_packets++; tun->dev->stats.rx_bytes += len; - tun_flow_update(tun, rxhash, tfile); + tun_flow_update(tun, rxhash, tfile->queue_index); return total_len; } @@ -1672,9 +1662,9 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) device_create_file(&tun->dev->dev, &dev_attr_owner) || device_create_file(&tun->dev->dev, &dev_attr_group)) pr_err("Failed to create tun sysfs files\n"); - } - netif_carrier_on(tun->dev); + netif_carrier_on(tun->dev); + } tun_debug(KERN_INFO, tun, "tun_set_iff\n"); @@ -1827,7 +1817,7 @@ static int tun_set_queue(struct file *file, struct ifreq *ifr) ret = tun_attach(tun, file); } else if (ifr->ifr_flags & IFF_DETACH_QUEUE) { tun = rtnl_dereference(tfile->tun); - if (!tun || !(tun->flags & TUN_TAP_MQ) || tfile->detached) + if (!tun || !(tun->flags & TUN_TAP_MQ)) ret = -EINVAL; else __tun_detach(tfile, false); diff --git a/trunk/drivers/net/usb/qmi_wwan.c b/trunk/drivers/net/usb/qmi_wwan.c index 2ca7f8ea2dca..575a5839ee34 100644 --- a/trunk/drivers/net/usb/qmi_wwan.c +++ b/trunk/drivers/net/usb/qmi_wwan.c @@ -461,7 +461,6 @@ static const struct usb_device_id products[] = { {QMI_FIXED_INTF(0x1199, 0x901c, 8)}, /* Sierra Wireless EM7700 */ {QMI_FIXED_INTF(0x1bbb, 0x011e, 4)}, /* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */ {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ - {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */ /* 4. Gobi 1000 devices */ {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ diff --git a/trunk/drivers/net/usb/usbnet.c b/trunk/drivers/net/usb/usbnet.c index 51f3192f3931..30c1b330e983 100644 --- a/trunk/drivers/net/usb/usbnet.c +++ b/trunk/drivers/net/usb/usbnet.c @@ -380,12 +380,6 @@ static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags) unsigned long lockflags; size_t size = dev->rx_urb_size; - /* prevent rx skb allocation when error ratio is high */ - if (test_bit(EVENT_RX_KILL, &dev->flags)) { - usb_free_urb(urb); - return -ENOLINK; - } - skb = __netdev_alloc_skb_ip_align(dev->net, size, flags); if (!skb) { netif_dbg(dev, rx_err, dev->net, "no rx skb\n"); @@ -545,17 +539,6 @@ static void rx_complete (struct urb *urb) break; } - /* stop rx if packet error rate is high */ - if (++dev->pkt_cnt > 30) { - dev->pkt_cnt = 0; - dev->pkt_err = 0; - } else { - if (state == rx_cleanup) - dev->pkt_err++; - if (dev->pkt_err > 20) - set_bit(EVENT_RX_KILL, &dev->flags); - } - state = defer_bh(dev, skb, &dev->rxq, state); if (urb) { @@ -808,11 +791,6 @@ int usbnet_open (struct net_device *net) (dev->driver_info->flags & FLAG_FRAMING_AX) ? "ASIX" : "simple"); - /* reset rx error state */ - dev->pkt_cnt = 0; - dev->pkt_err = 0; - clear_bit(EVENT_RX_KILL, &dev->flags); - // delay posting reads until we're fully open tasklet_schedule (&dev->bh); if (info->manage_power) { @@ -1125,11 +1103,13 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb, if (info->tx_fixup) { skb = info->tx_fixup (dev, skb, GFP_ATOMIC); if (!skb) { - /* packet collected; minidriver waiting for more */ - if (info->flags & FLAG_MULTI_PACKET) + if (netif_msg_tx_err(dev)) { + netif_dbg(dev, tx_err, dev->net, "can't tx_fixup skb\n"); + goto drop; + } else { + /* cdc_ncm collected packet; waits for more */ goto not_drop; - netif_dbg(dev, tx_err, dev->net, "can't tx_fixup skb\n"); - goto drop; + } } } length = skb->len; @@ -1274,9 +1254,6 @@ static void usbnet_bh (unsigned long param) } } - /* restart RX again after disabling due to high error rate */ - clear_bit(EVENT_RX_KILL, &dev->flags); - // waiting for all pending urbs to complete? if (dev->wait) { if ((dev->txq.qlen + dev->rxq.qlen + dev->done.qlen) == 0) { diff --git a/trunk/drivers/net/vmxnet3/vmxnet3_drv.c b/trunk/drivers/net/vmxnet3/vmxnet3_drv.c index ffb97b2a15a0..b1c90f8ccd3d 100644 --- a/trunk/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/trunk/drivers/net/vmxnet3/vmxnet3_drv.c @@ -150,7 +150,8 @@ vmxnet3_check_link(struct vmxnet3_adapter *adapter, bool affectTxQueue) if (ret & 1) { /* Link is up. */ netdev_info(adapter->netdev, "NIC Link is Up %d Mbps\n", adapter->link_speed); - netif_carrier_on(adapter->netdev); + if (!netif_carrier_ok(adapter->netdev)) + netif_carrier_on(adapter->netdev); if (affectTxQueue) { for (i = 0; i < adapter->num_tx_queues; i++) @@ -159,7 +160,8 @@ vmxnet3_check_link(struct vmxnet3_adapter *adapter, bool affectTxQueue) } } else { netdev_info(adapter->netdev, "NIC Link is Down\n"); - netif_carrier_off(adapter->netdev); + if (netif_carrier_ok(adapter->netdev)) + netif_carrier_off(adapter->netdev); if (affectTxQueue) { for (i = 0; i < adapter->num_tx_queues; i++) @@ -3058,7 +3060,6 @@ vmxnet3_probe_device(struct pci_dev *pdev, netif_set_real_num_tx_queues(adapter->netdev, adapter->num_tx_queues); netif_set_real_num_rx_queues(adapter->netdev, adapter->num_rx_queues); - netif_carrier_off(netdev); err = register_netdev(netdev); if (err) { diff --git a/trunk/drivers/net/wireless/brcm80211/brcmsmac/main.c b/trunk/drivers/net/wireless/brcm80211/brcmsmac/main.c index 8d560b64516d..c26992a60e6c 100644 --- a/trunk/drivers/net/wireless/brcm80211/brcmsmac/main.c +++ b/trunk/drivers/net/wireless/brcm80211/brcmsmac/main.c @@ -1027,6 +1027,7 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs) static bool brcms_b_txstatus(struct brcms_hardware *wlc_hw, bool bound, bool *fatal) { + bool morepending = false; struct bcma_device *core; struct tx_status txstatus, *txs; u32 s1, s2; @@ -1040,20 +1041,23 @@ brcms_b_txstatus(struct brcms_hardware *wlc_hw, bool bound, bool *fatal) txs = &txstatus; core = wlc_hw->d11core; *fatal = false; + s1 = bcma_read32(core, D11REGOFFS(frmtxstatus)); + while (!(*fatal) + && (s1 & TXS_V)) { + /* !give others some time to run! */ + if (n >= max_tx_num) { + morepending = true; + break; + } - while (n < max_tx_num) { - s1 = bcma_read32(core, D11REGOFFS(frmtxstatus)); if (s1 == 0xffffffff) { brcms_err(core, "wl%d: %s: dead chip\n", wlc_hw->unit, __func__); *fatal = true; return false; } - /* only process when valid */ - if (!(s1 & TXS_V)) - break; - s2 = bcma_read32(core, D11REGOFFS(frmtxstatus2)); + txs->status = s1 & TXS_STATUS_MASK; txs->frameid = (s1 & TXS_FID_MASK) >> TXS_FID_SHIFT; txs->sequence = s2 & TXS_SEQ_MASK; @@ -1061,12 +1065,15 @@ brcms_b_txstatus(struct brcms_hardware *wlc_hw, bool bound, bool *fatal) txs->lasttxtime = 0; *fatal = brcms_c_dotxstatus(wlc_hw->wlc, txs); - if (*fatal == true) - return false; + + s1 = bcma_read32(core, D11REGOFFS(frmtxstatus)); n++; } - return n >= max_tx_num; + if (*fatal) + return false; + + return morepending; } static void brcms_c_tbtt(struct brcms_c_info *wlc) diff --git a/trunk/drivers/net/wireless/iwlwifi/dvm/tx.c b/trunk/drivers/net/wireless/iwlwifi/dvm/tx.c index 191b9d4bee47..6b01fc195940 100644 --- a/trunk/drivers/net/wireless/iwlwifi/dvm/tx.c +++ b/trunk/drivers/net/wireless/iwlwifi/dvm/tx.c @@ -1145,13 +1145,6 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb, next_reclaimed = ssn; } - if (tid != IWL_TID_NON_QOS) { - priv->tid_data[sta_id][tid].next_reclaimed = - next_reclaimed; - IWL_DEBUG_TX_REPLY(priv, "Next reclaimed packet:%d\n", - next_reclaimed); - } - iwl_trans_reclaim(priv->trans, txq_id, ssn, &skbs); iwlagn_check_ratid_empty(priv, sta_id, tid); @@ -1202,12 +1195,30 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb, if (!is_agg) iwlagn_non_agg_tx_status(priv, ctx, hdr->addr1); + /* + * W/A for FW bug - the seq_ctl isn't updated when the + * queues are flushed. Fetch it from the packet itself + */ + if (!is_agg && status == TX_STATUS_FAIL_FIFO_FLUSHED) { + next_reclaimed = le16_to_cpu(hdr->seq_ctrl); + next_reclaimed = + SEQ_TO_SN(next_reclaimed + 0x10); + } + is_offchannel_skb = (info->flags & IEEE80211_TX_CTL_TX_OFFCHAN); freed++; } - WARN_ON(!is_agg && freed != 1); + if (tid != IWL_TID_NON_QOS) { + priv->tid_data[sta_id][tid].next_reclaimed = + next_reclaimed; + IWL_DEBUG_TX_REPLY(priv, "Next reclaimed packet:%d\n", + next_reclaimed); + } + + if (!is_agg && freed != 1) + IWL_ERR(priv, "Q: %d, freed %d\n", txq_id, freed); /* * An offchannel frame can be send only on the AUX queue, where diff --git a/trunk/drivers/net/wireless/mwifiex/scan.c b/trunk/drivers/net/wireless/mwifiex/scan.c index d41f0e647280..f0de40166dc3 100644 --- a/trunk/drivers/net/wireless/mwifiex/scan.c +++ b/trunk/drivers/net/wireless/mwifiex/scan.c @@ -1557,7 +1557,7 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv, dev_err(adapter->dev, "SCAN_RESP: too many AP returned (%d)\n", scan_rsp->number_of_sets); ret = -1; - goto check_next_scan; + goto done; } bytes_left = le16_to_cpu(scan_rsp->bss_descript_size); @@ -1628,8 +1628,7 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv, if (!beacon_size || beacon_size > bytes_left) { bss_info += bytes_left; bytes_left = 0; - ret = -1; - goto check_next_scan; + return -1; } /* Initialize the current working beacon pointer for this BSS @@ -1685,7 +1684,7 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv, dev_err(priv->adapter->dev, "%s: bytes left < IE length\n", __func__); - goto check_next_scan; + goto done; } if (element_id == WLAN_EID_DS_PARAMS) { channel = *(current_ptr + sizeof(struct ieee_types_header)); @@ -1748,7 +1747,6 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv, } } -check_next_scan: spin_lock_irqsave(&adapter->scan_pending_q_lock, flags); if (list_empty(&adapter->scan_pending_q)) { spin_unlock_irqrestore(&adapter->scan_pending_q_lock, flags); @@ -1809,6 +1807,7 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv, } } +done: return ret; } diff --git a/trunk/drivers/net/wireless/rtlwifi/usb.c b/trunk/drivers/net/wireless/rtlwifi/usb.c index 1535efda3d52..f2ecdeb3a90d 100644 --- a/trunk/drivers/net/wireless/rtlwifi/usb.c +++ b/trunk/drivers/net/wireless/rtlwifi/usb.c @@ -542,8 +542,8 @@ static void _rtl_rx_pre_process(struct ieee80211_hw *hw, struct sk_buff *skb) WARN_ON(skb_queue_empty(&rx_queue)); while (!skb_queue_empty(&rx_queue)) { _skb = skb_dequeue(&rx_queue); - _rtl_usb_rx_process_agg(hw, _skb); - ieee80211_rx_irqsafe(hw, _skb); + _rtl_usb_rx_process_agg(hw, skb); + ieee80211_rx_irqsafe(hw, skb); } } diff --git a/trunk/drivers/vhost/net.c b/trunk/drivers/vhost/net.c index 959b1cd89e6a..ebd08b21b234 100644 --- a/trunk/drivers/vhost/net.c +++ b/trunk/drivers/vhost/net.c @@ -165,16 +165,12 @@ static void tx_poll_stop(struct vhost_net *net) } /* Caller must have TX VQ lock */ -static int tx_poll_start(struct vhost_net *net, struct socket *sock) +static void tx_poll_start(struct vhost_net *net, struct socket *sock) { - int ret; - if (unlikely(net->tx_poll_state != VHOST_NET_POLL_STOPPED)) - return 0; - ret = vhost_poll_start(net->poll + VHOST_NET_VQ_TX, sock->file); - if (!ret) - net->tx_poll_state = VHOST_NET_POLL_STARTED; - return ret; + return; + vhost_poll_start(net->poll + VHOST_NET_VQ_TX, sock->file); + net->tx_poll_state = VHOST_NET_POLL_STARTED; } /* In case of DMA done not in order in lower device driver for some reason. @@ -646,23 +642,20 @@ static void vhost_net_disable_vq(struct vhost_net *n, vhost_poll_stop(n->poll + VHOST_NET_VQ_RX); } -static int vhost_net_enable_vq(struct vhost_net *n, +static void vhost_net_enable_vq(struct vhost_net *n, struct vhost_virtqueue *vq) { struct socket *sock; - int ret; sock = rcu_dereference_protected(vq->private_data, lockdep_is_held(&vq->mutex)); if (!sock) - return 0; + return; if (vq == n->vqs + VHOST_NET_VQ_TX) { n->tx_poll_state = VHOST_NET_POLL_STOPPED; - ret = tx_poll_start(n, sock); + tx_poll_start(n, sock); } else - ret = vhost_poll_start(n->poll + VHOST_NET_VQ_RX, sock->file); - - return ret; + vhost_poll_start(n->poll + VHOST_NET_VQ_RX, sock->file); } static struct socket *vhost_net_stop_vq(struct vhost_net *n, @@ -834,18 +827,15 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd) r = PTR_ERR(ubufs); goto err_ubufs; } - + oldubufs = vq->ubufs; + vq->ubufs = ubufs; vhost_net_disable_vq(n, vq); rcu_assign_pointer(vq->private_data, sock); + vhost_net_enable_vq(n, vq); + r = vhost_init_used(vq); if (r) - goto err_used; - r = vhost_net_enable_vq(n, vq); - if (r) - goto err_used; - - oldubufs = vq->ubufs; - vq->ubufs = ubufs; + goto err_vq; n->tx_packets = 0; n->tx_zcopy_err = 0; @@ -869,11 +859,6 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd) mutex_unlock(&n->dev.mutex); return 0; -err_used: - rcu_assign_pointer(vq->private_data, oldsock); - vhost_net_enable_vq(n, vq); - if (ubufs) - vhost_ubuf_put_and_wait(ubufs); err_ubufs: fput(sock->file); err_vq: diff --git a/trunk/drivers/vhost/vhost.c b/trunk/drivers/vhost/vhost.c index 9759249e6d90..34389f75fe65 100644 --- a/trunk/drivers/vhost/vhost.c +++ b/trunk/drivers/vhost/vhost.c @@ -77,38 +77,26 @@ void vhost_poll_init(struct vhost_poll *poll, vhost_work_fn_t fn, init_poll_funcptr(&poll->table, vhost_poll_func); poll->mask = mask; poll->dev = dev; - poll->wqh = NULL; vhost_work_init(&poll->work, fn); } /* Start polling a file. We add ourselves to file's wait queue. The caller must * keep a reference to a file until after vhost_poll_stop is called. */ -int vhost_poll_start(struct vhost_poll *poll, struct file *file) +void vhost_poll_start(struct vhost_poll *poll, struct file *file) { unsigned long mask; - int ret = 0; mask = file->f_op->poll(file, &poll->table); if (mask) vhost_poll_wakeup(&poll->wait, 0, 0, (void *)mask); - if (mask & POLLERR) { - if (poll->wqh) - remove_wait_queue(poll->wqh, &poll->wait); - ret = -EINVAL; - } - - return ret; } /* Stop polling a file. After this function returns, it becomes safe to drop the * file reference. You must also flush afterwards. */ void vhost_poll_stop(struct vhost_poll *poll) { - if (poll->wqh) { - remove_wait_queue(poll->wqh, &poll->wait); - poll->wqh = NULL; - } + remove_wait_queue(poll->wqh, &poll->wait); } static bool vhost_work_seq_done(struct vhost_dev *dev, struct vhost_work *work, @@ -804,7 +792,7 @@ long vhost_vring_ioctl(struct vhost_dev *d, int ioctl, void __user *argp) fput(filep); if (pollstart && vq->handle_kick) - r = vhost_poll_start(&vq->poll, vq->kick); + vhost_poll_start(&vq->poll, vq->kick); mutex_unlock(&vq->mutex); diff --git a/trunk/drivers/vhost/vhost.h b/trunk/drivers/vhost/vhost.h index 17261e277c02..2639c58b23ab 100644 --- a/trunk/drivers/vhost/vhost.h +++ b/trunk/drivers/vhost/vhost.h @@ -42,7 +42,7 @@ void vhost_work_queue(struct vhost_dev *dev, struct vhost_work *work); void vhost_poll_init(struct vhost_poll *poll, vhost_work_fn_t fn, unsigned long mask, struct vhost_dev *dev); -int vhost_poll_start(struct vhost_poll *poll, struct file *file); +void vhost_poll_start(struct vhost_poll *poll, struct file *file); void vhost_poll_stop(struct vhost_poll *poll); void vhost_poll_flush(struct vhost_poll *poll); void vhost_poll_queue(struct vhost_poll *poll); diff --git a/trunk/include/linux/tcp.h b/trunk/include/linux/tcp.h index 6d0d46138ae8..4e1d2283e3cc 100644 --- a/trunk/include/linux/tcp.h +++ b/trunk/include/linux/tcp.h @@ -246,6 +246,7 @@ struct tcp_sock { u32 sacked_out; /* SACK'd packets */ u32 fackets_out; /* FACK'd packets */ u32 tso_deferred; + u32 bytes_acked; /* Appropriate Byte Counting - RFC3465 */ /* from STCP, retrans queue hinting */ struct sk_buff* lost_skb_hint; diff --git a/trunk/include/linux/usb/usbnet.h b/trunk/include/linux/usb/usbnet.h index 0de078d4cdb9..5de7a220e986 100644 --- a/trunk/include/linux/usb/usbnet.h +++ b/trunk/include/linux/usb/usbnet.h @@ -33,7 +33,6 @@ struct usbnet { wait_queue_head_t *wait; struct mutex phy_mutex; unsigned char suspend_count; - unsigned char pkt_cnt, pkt_err; /* i/o info: pipes etc */ unsigned in, out; @@ -71,7 +70,6 @@ struct usbnet { # define EVENT_DEV_OPEN 7 # define EVENT_DEVICE_REPORT_IDLE 8 # define EVENT_NO_RUNTIME_PM 9 -# define EVENT_RX_KILL 10 }; static inline struct usb_driver *driver_of(struct usb_interface *intf) diff --git a/trunk/include/net/tcp.h b/trunk/include/net/tcp.h index 23f2e98d4b65..614af8b7758e 100644 --- a/trunk/include/net/tcp.h +++ b/trunk/include/net/tcp.h @@ -279,6 +279,7 @@ extern int sysctl_tcp_dma_copybreak; extern int sysctl_tcp_nometrics_save; extern int sysctl_tcp_moderate_rcvbuf; extern int sysctl_tcp_tso_win_divisor; +extern int sysctl_tcp_abc; extern int sysctl_tcp_mtu_probing; extern int sysctl_tcp_base_mss; extern int sysctl_tcp_workaround_signed_windows; diff --git a/trunk/include/net/transp_v6.h b/trunk/include/net/transp_v6.h index 938b7fd11204..498433dd067d 100644 --- a/trunk/include/net/transp_v6.h +++ b/trunk/include/net/transp_v6.h @@ -34,17 +34,17 @@ extern int udpv6_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len); -extern int ip6_datagram_recv_ctl(struct sock *sk, - struct msghdr *msg, - struct sk_buff *skb); - -extern int ip6_datagram_send_ctl(struct net *net, - struct sock *sk, - struct msghdr *msg, - struct flowi6 *fl6, - struct ipv6_txoptions *opt, - int *hlimit, int *tclass, - int *dontfrag); +extern int datagram_recv_ctl(struct sock *sk, + struct msghdr *msg, + struct sk_buff *skb); + +extern int datagram_send_ctl(struct net *net, + struct sock *sk, + struct msghdr *msg, + struct flowi6 *fl6, + struct ipv6_txoptions *opt, + int *hlimit, int *tclass, + int *dontfrag); #define LOOPBACK4_IPV6 cpu_to_be32(0x7f000006) diff --git a/trunk/kernel/sysctl_binary.c b/trunk/kernel/sysctl_binary.c index b669ca1fa103..5a6384450501 100644 --- a/trunk/kernel/sysctl_binary.c +++ b/trunk/kernel/sysctl_binary.c @@ -387,6 +387,7 @@ static const struct bin_table bin_net_ipv4_table[] = { { CTL_INT, NET_TCP_MODERATE_RCVBUF, "tcp_moderate_rcvbuf" }, { CTL_INT, NET_TCP_TSO_WIN_DIVISOR, "tcp_tso_win_divisor" }, { CTL_STR, NET_TCP_CONG_CONTROL, "tcp_congestion_control" }, + { CTL_INT, NET_TCP_ABC, "tcp_abc" }, { CTL_INT, NET_TCP_MTU_PROBING, "tcp_mtu_probing" }, { CTL_INT, NET_TCP_BASE_MSS, "tcp_base_mss" }, { CTL_INT, NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS, "tcp_workaround_signed_windows" }, diff --git a/trunk/net/core/pktgen.c b/trunk/net/core/pktgen.c index 2201e699ad67..797769551b91 100644 --- a/trunk/net/core/pktgen.c +++ b/trunk/net/core/pktgen.c @@ -1790,13 +1790,10 @@ static ssize_t pktgen_thread_write(struct file *file, return -EFAULT; i += len; mutex_lock(&pktgen_thread_lock); - ret = pktgen_add_device(t, f); + pktgen_add_device(t, f); mutex_unlock(&pktgen_thread_lock); - if (!ret) { - ret = count; - sprintf(pg_result, "OK: add_device=%s", f); - } else - sprintf(pg_result, "ERROR: can not add device %s", f); + ret = count; + sprintf(pg_result, "OK: add_device=%s", f); goto out; } diff --git a/trunk/net/core/skbuff.c b/trunk/net/core/skbuff.c index 55f7ef6ada6d..bddc1dd2e7f2 100644 --- a/trunk/net/core/skbuff.c +++ b/trunk/net/core/skbuff.c @@ -686,7 +686,7 @@ static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old) new->network_header = old->network_header; new->mac_header = old->mac_header; new->inner_transport_header = old->inner_transport_header; - new->inner_network_header = old->inner_network_header; + new->inner_network_header = old->inner_transport_header; skb_dst_copy(new, old); new->rxhash = old->rxhash; new->ooo_okay = old->ooo_okay; diff --git a/trunk/net/ipv4/af_inet.c b/trunk/net/ipv4/af_inet.c index 1aec92bf8018..49ddca31c4da 100644 --- a/trunk/net/ipv4/af_inet.c +++ b/trunk/net/ipv4/af_inet.c @@ -263,6 +263,21 @@ void build_ehash_secret(void) } EXPORT_SYMBOL(build_ehash_secret); +static inline int inet_netns_ok(struct net *net, __u8 protocol) +{ + const struct net_protocol *ipprot; + + if (net_eq(net, &init_net)) + return 1; + + ipprot = rcu_dereference(inet_protos[protocol]); + if (ipprot == NULL) { + /* raw IP is OK */ + return 1; + } + return ipprot->netns_ok; +} + /* * Create an inet socket. */ @@ -335,6 +350,10 @@ static int inet_create(struct net *net, struct socket *sock, int protocol, !ns_capable(net->user_ns, CAP_NET_RAW)) goto out_rcu_unlock; + err = -EAFNOSUPPORT; + if (!inet_netns_ok(net, protocol)) + goto out_rcu_unlock; + sock->ops = answer->ops; answer_prot = answer->prot; answer_no_check = answer->no_check; diff --git a/trunk/net/ipv4/ip_input.c b/trunk/net/ipv4/ip_input.c index 87abd3e2bd32..f1395a6fb35f 100644 --- a/trunk/net/ipv4/ip_input.c +++ b/trunk/net/ipv4/ip_input.c @@ -208,6 +208,13 @@ static int ip_local_deliver_finish(struct sk_buff *skb) if (ipprot != NULL) { int ret; + if (!net_eq(net, &init_net) && !ipprot->netns_ok) { + net_info_ratelimited("%s: proto %d isn't netns-ready\n", + __func__, protocol); + kfree_skb(skb); + goto out; + } + if (!ipprot->no_policy) { if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) { kfree_skb(skb); diff --git a/trunk/net/ipv4/protocol.c b/trunk/net/ipv4/protocol.c index ce848461acbb..0f9d09f54bd9 100644 --- a/trunk/net/ipv4/protocol.c +++ b/trunk/net/ipv4/protocol.c @@ -37,12 +37,6 @@ const struct net_offload __rcu *inet_offloads[MAX_INET_PROTOS] __read_mostly; int inet_add_protocol(const struct net_protocol *prot, unsigned char protocol) { - if (!prot->netns_ok) { - pr_err("Protocol %u is not namespace aware, cannot register.\n", - protocol); - return -EINVAL; - } - return !cmpxchg((const struct net_protocol **)&inet_protos[protocol], NULL, prot) ? 0 : -1; } diff --git a/trunk/net/ipv4/sysctl_net_ipv4.c b/trunk/net/ipv4/sysctl_net_ipv4.c index 960fd29d9b8e..2622707602d1 100644 --- a/trunk/net/ipv4/sysctl_net_ipv4.c +++ b/trunk/net/ipv4/sysctl_net_ipv4.c @@ -632,6 +632,13 @@ static struct ctl_table ipv4_table[] = { .maxlen = TCP_CA_NAME_MAX, .proc_handler = proc_tcp_congestion_control, }, + { + .procname = "tcp_abc", + .data = &sysctl_tcp_abc, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec, + }, { .procname = "tcp_mtu_probing", .data = &sysctl_tcp_mtu_probing, diff --git a/trunk/net/ipv4/tcp.c b/trunk/net/ipv4/tcp.c index 2c7e5963c2ea..3ec1f69c5ceb 100644 --- a/trunk/net/ipv4/tcp.c +++ b/trunk/net/ipv4/tcp.c @@ -2289,6 +2289,7 @@ int tcp_disconnect(struct sock *sk, int flags) tp->packets_out = 0; tp->snd_ssthresh = TCP_INFINITE_SSTHRESH; tp->snd_cwnd_cnt = 0; + tp->bytes_acked = 0; tp->window_clamp = 0; tcp_set_ca_state(sk, TCP_CA_Open); tcp_clear_retrans(tp); diff --git a/trunk/net/ipv4/tcp_cong.c b/trunk/net/ipv4/tcp_cong.c index 019c2389a341..291f2ed7cc31 100644 --- a/trunk/net/ipv4/tcp_cong.c +++ b/trunk/net/ipv4/tcp_cong.c @@ -310,24 +310,35 @@ void tcp_slow_start(struct tcp_sock *tp) { int cnt; /* increase in packets */ unsigned int delta = 0; - u32 snd_cwnd = tp->snd_cwnd; - if (unlikely(!snd_cwnd)) { - pr_err_once("snd_cwnd is nul, please report this bug.\n"); - snd_cwnd = 1U; - } + /* RFC3465: ABC Slow start + * Increase only after a full MSS of bytes is acked + * + * TCP sender SHOULD increase cwnd by the number of + * previously unacknowledged bytes ACKed by each incoming + * acknowledgment, provided the increase is not more than L + */ + if (sysctl_tcp_abc && tp->bytes_acked < tp->mss_cache) + return; if (sysctl_tcp_max_ssthresh > 0 && tp->snd_cwnd > sysctl_tcp_max_ssthresh) cnt = sysctl_tcp_max_ssthresh >> 1; /* limited slow start */ else - cnt = snd_cwnd; /* exponential increase */ + cnt = tp->snd_cwnd; /* exponential increase */ + + /* RFC3465: ABC + * We MAY increase by 2 if discovered delayed ack + */ + if (sysctl_tcp_abc > 1 && tp->bytes_acked >= 2*tp->mss_cache) + cnt <<= 1; + tp->bytes_acked = 0; tp->snd_cwnd_cnt += cnt; - while (tp->snd_cwnd_cnt >= snd_cwnd) { - tp->snd_cwnd_cnt -= snd_cwnd; + while (tp->snd_cwnd_cnt >= tp->snd_cwnd) { + tp->snd_cwnd_cnt -= tp->snd_cwnd; delta++; } - tp->snd_cwnd = min(snd_cwnd + delta, tp->snd_cwnd_clamp); + tp->snd_cwnd = min(tp->snd_cwnd + delta, tp->snd_cwnd_clamp); } EXPORT_SYMBOL_GPL(tcp_slow_start); @@ -361,9 +372,20 @@ void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 in_flight) /* In "safe" area, increase. */ if (tp->snd_cwnd <= tp->snd_ssthresh) tcp_slow_start(tp); + /* In dangerous area, increase slowly. */ - else + else if (sysctl_tcp_abc) { + /* RFC3465: Appropriate Byte Count + * increase once for each full cwnd acked + */ + if (tp->bytes_acked >= tp->snd_cwnd*tp->mss_cache) { + tp->bytes_acked -= tp->snd_cwnd*tp->mss_cache; + if (tp->snd_cwnd < tp->snd_cwnd_clamp) + tp->snd_cwnd++; + } + } else { tcp_cong_avoid_ai(tp, tp->snd_cwnd); + } } EXPORT_SYMBOL_GPL(tcp_reno_cong_avoid); diff --git a/trunk/net/ipv4/tcp_input.c b/trunk/net/ipv4/tcp_input.c index f56bd1082f54..492c7cfe1453 100644 --- a/trunk/net/ipv4/tcp_input.c +++ b/trunk/net/ipv4/tcp_input.c @@ -98,6 +98,7 @@ int sysctl_tcp_frto_response __read_mostly; int sysctl_tcp_thin_dupack __read_mostly; int sysctl_tcp_moderate_rcvbuf __read_mostly = 1; +int sysctl_tcp_abc __read_mostly; int sysctl_tcp_early_retrans __read_mostly = 2; #define FLAG_DATA 0x01 /* Incoming frame contained data. */ @@ -2006,6 +2007,7 @@ static void tcp_enter_frto_loss(struct sock *sk, int allowed_segments, int flag) tp->snd_cwnd_cnt = 0; tp->snd_cwnd_stamp = tcp_time_stamp; tp->frto_counter = 0; + tp->bytes_acked = 0; tp->reordering = min_t(unsigned int, tp->reordering, sysctl_tcp_reordering); @@ -2054,6 +2056,7 @@ void tcp_enter_loss(struct sock *sk, int how) tp->snd_cwnd_cnt = 0; tp->snd_cwnd_stamp = tcp_time_stamp; + tp->bytes_acked = 0; tcp_clear_retrans_partial(tp); if (tcp_is_reno(tp)) @@ -2681,6 +2684,7 @@ static void tcp_init_cwnd_reduction(struct sock *sk, const bool set_ssthresh) struct tcp_sock *tp = tcp_sk(sk); tp->high_seq = tp->snd_nxt; + tp->bytes_acked = 0; tp->snd_cwnd_cnt = 0; tp->prior_cwnd = tp->snd_cwnd; tp->prr_delivered = 0; @@ -2731,6 +2735,7 @@ void tcp_enter_cwr(struct sock *sk, const int set_ssthresh) struct tcp_sock *tp = tcp_sk(sk); tp->prior_ssthresh = 0; + tp->bytes_acked = 0; if (inet_csk(sk)->icsk_ca_state < TCP_CA_CWR) { tp->undo_marker = 0; tcp_init_cwnd_reduction(sk, set_ssthresh); @@ -3412,6 +3417,7 @@ static void tcp_conservative_spur_to_response(struct tcp_sock *tp) { tp->snd_cwnd = min(tp->snd_cwnd, tp->snd_ssthresh); tp->snd_cwnd_cnt = 0; + tp->bytes_acked = 0; TCP_ECN_queue_cwr(tp); tcp_moderate_cwnd(tp); } @@ -3476,8 +3482,7 @@ static bool tcp_process_frto(struct sock *sk, int flag) ((tp->frto_counter >= 2) && (flag & FLAG_RETRANS_DATA_ACKED))) tp->undo_marker = 0; - if (!before(tp->snd_una, tp->frto_highmark) || - !tcp_packets_in_flight(tp)) { + if (!before(tp->snd_una, tp->frto_highmark)) { tcp_enter_frto_loss(sk, (tp->frto_counter == 1 ? 2 : 3), flag); return true; } @@ -3603,6 +3608,15 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag) if (after(ack, prior_snd_una)) flag |= FLAG_SND_UNA_ADVANCED; + if (sysctl_tcp_abc) { + if (icsk->icsk_ca_state < TCP_CA_CWR) + tp->bytes_acked += ack - prior_snd_una; + else if (icsk->icsk_ca_state == TCP_CA_Loss) + /* we assume just one segment left network */ + tp->bytes_acked += min(ack - prior_snd_una, + tp->mss_cache); + } + prior_fackets = tp->fackets_out; prior_in_flight = tcp_packets_in_flight(tp); @@ -5633,7 +5647,8 @@ static bool tcp_rcv_fastopen_synack(struct sock *sk, struct sk_buff *synack, * the remote receives only the retransmitted (regular) SYNs: either * the original SYN-data or the corresponding SYN-ACK is lost. */ - syn_drop = (cookie->len <= 0 && data && tp->total_retrans); + syn_drop = (cookie->len <= 0 && data && + inet_csk(sk)->icsk_retransmits); tcp_fastopen_cache_set(sk, mss, cookie, syn_drop); diff --git a/trunk/net/ipv4/tcp_ipv4.c b/trunk/net/ipv4/tcp_ipv4.c index 0eaf685bddc9..5a1cfc692df0 100644 --- a/trunk/net/ipv4/tcp_ipv4.c +++ b/trunk/net/ipv4/tcp_ipv4.c @@ -496,7 +496,6 @@ void tcp_v4_err(struct sk_buff *icmp_skb, u32 info) * errors returned from accept(). */ inet_csk_reqsk_queue_drop(sk, req, prev); - NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); goto out; case TCP_SYN_SENT: @@ -1502,10 +1501,8 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) * clogging syn queue with openreqs with exponentially increasing * timeout. */ - if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1) { - NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENOVERFLOWS); + if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1) goto drop; - } req = inet_reqsk_alloc(&tcp_request_sock_ops); if (!req) @@ -1670,7 +1667,6 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) drop_and_free: reqsk_free(req); drop: - NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); return 0; } EXPORT_SYMBOL(tcp_v4_conn_request); diff --git a/trunk/net/ipv4/tcp_minisocks.c b/trunk/net/ipv4/tcp_minisocks.c index f0409287b5f4..f35f2dfb6401 100644 --- a/trunk/net/ipv4/tcp_minisocks.c +++ b/trunk/net/ipv4/tcp_minisocks.c @@ -446,6 +446,7 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req, */ newtp->snd_cwnd = TCP_INIT_CWND; newtp->snd_cwnd_cnt = 0; + newtp->bytes_acked = 0; newtp->frto_counter = 0; newtp->frto_highmark = 0; diff --git a/trunk/net/ipv6/addrconf.c b/trunk/net/ipv6/addrconf.c index bd9f9360f769..7f7332b44699 100644 --- a/trunk/net/ipv6/addrconf.c +++ b/trunk/net/ipv6/addrconf.c @@ -1656,7 +1656,6 @@ static int addrconf_ifid_eui64(u8 *eui, struct net_device *dev) if (dev->addr_len != IEEE802154_ADDR_LEN) return -1; memcpy(eui, dev->dev_addr, 8); - eui[0] ^= 2; return 0; } diff --git a/trunk/net/ipv6/datagram.c b/trunk/net/ipv6/datagram.c index f5a54782a340..33be36398a78 100644 --- a/trunk/net/ipv6/datagram.c +++ b/trunk/net/ipv6/datagram.c @@ -380,7 +380,7 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len) if (skb->protocol == htons(ETH_P_IPV6)) { sin->sin6_addr = ipv6_hdr(skb)->saddr; if (np->rxopt.all) - ip6_datagram_recv_ctl(sk, msg, skb); + datagram_recv_ctl(sk, msg, skb); if (ipv6_addr_type(&sin->sin6_addr) & IPV6_ADDR_LINKLOCAL) sin->sin6_scope_id = IP6CB(skb)->iif; } else { @@ -468,8 +468,7 @@ int ipv6_recv_rxpmtu(struct sock *sk, struct msghdr *msg, int len) } -int ip6_datagram_recv_ctl(struct sock *sk, struct msghdr *msg, - struct sk_buff *skb) +int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, struct sk_buff *skb) { struct ipv6_pinfo *np = inet6_sk(sk); struct inet6_skb_parm *opt = IP6CB(skb); @@ -599,12 +598,11 @@ int ip6_datagram_recv_ctl(struct sock *sk, struct msghdr *msg, } return 0; } -EXPORT_SYMBOL_GPL(ip6_datagram_recv_ctl); -int ip6_datagram_send_ctl(struct net *net, struct sock *sk, - struct msghdr *msg, struct flowi6 *fl6, - struct ipv6_txoptions *opt, - int *hlimit, int *tclass, int *dontfrag) +int datagram_send_ctl(struct net *net, struct sock *sk, + struct msghdr *msg, struct flowi6 *fl6, + struct ipv6_txoptions *opt, + int *hlimit, int *tclass, int *dontfrag) { struct in6_pktinfo *src_info; struct cmsghdr *cmsg; @@ -874,4 +872,4 @@ int ip6_datagram_send_ctl(struct net *net, struct sock *sk, exit_f: return err; } -EXPORT_SYMBOL_GPL(ip6_datagram_send_ctl); +EXPORT_SYMBOL_GPL(datagram_send_ctl); diff --git a/trunk/net/ipv6/ip6_flowlabel.c b/trunk/net/ipv6/ip6_flowlabel.c index ea42bf40a997..22494afd981c 100644 --- a/trunk/net/ipv6/ip6_flowlabel.c +++ b/trunk/net/ipv6/ip6_flowlabel.c @@ -390,8 +390,8 @@ fl_create(struct net *net, struct sock *sk, struct in6_flowlabel_req *freq, msg.msg_control = (void*)(fl->opt+1); memset(&flowi6, 0, sizeof(flowi6)); - err = ip6_datagram_send_ctl(net, sk, &msg, &flowi6, fl->opt, - &junk, &junk, &junk); + err = datagram_send_ctl(net, sk, &msg, &flowi6, fl->opt, &junk, + &junk, &junk); if (err) goto done; err = -EINVAL; diff --git a/trunk/net/ipv6/ipv6_sockglue.c b/trunk/net/ipv6/ipv6_sockglue.c index d1e2e8ef29c5..ee94d31c9d4d 100644 --- a/trunk/net/ipv6/ipv6_sockglue.c +++ b/trunk/net/ipv6/ipv6_sockglue.c @@ -476,8 +476,8 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname, msg.msg_controllen = optlen; msg.msg_control = (void*)(opt+1); - retv = ip6_datagram_send_ctl(net, sk, &msg, &fl6, opt, &junk, - &junk, &junk); + retv = datagram_send_ctl(net, sk, &msg, &fl6, opt, &junk, &junk, + &junk); if (retv) goto done; update: @@ -1002,7 +1002,7 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname, release_sock(sk); if (skb) { - int err = ip6_datagram_recv_ctl(sk, &msg, skb); + int err = datagram_recv_ctl(sk, &msg, skb); kfree_skb(skb); if (err) return err; diff --git a/trunk/net/ipv6/raw.c b/trunk/net/ipv6/raw.c index 70fa81449997..6cd29b1e8b92 100644 --- a/trunk/net/ipv6/raw.c +++ b/trunk/net/ipv6/raw.c @@ -507,7 +507,7 @@ static int rawv6_recvmsg(struct kiocb *iocb, struct sock *sk, sock_recv_ts_and_drops(msg, sk, skb); if (np->rxopt.all) - ip6_datagram_recv_ctl(sk, msg, skb); + datagram_recv_ctl(sk, msg, skb); err = copied; if (flags & MSG_TRUNC) @@ -822,8 +822,8 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk, memset(opt, 0, sizeof(struct ipv6_txoptions)); opt->tot_len = sizeof(struct ipv6_txoptions); - err = ip6_datagram_send_ctl(sock_net(sk), sk, msg, &fl6, opt, - &hlimit, &tclass, &dontfrag); + err = datagram_send_ctl(sock_net(sk), sk, msg, &fl6, opt, + &hlimit, &tclass, &dontfrag); if (err < 0) { fl6_sock_release(flowlabel); return err; diff --git a/trunk/net/ipv6/tcp_ipv6.c b/trunk/net/ipv6/tcp_ipv6.c index bbb28ae7e5f3..06087e58738a 100644 --- a/trunk/net/ipv6/tcp_ipv6.c +++ b/trunk/net/ipv6/tcp_ipv6.c @@ -423,7 +423,6 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, } inet_csk_reqsk_queue_drop(sk, req, prev); - NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); goto out; case TCP_SYN_SENT: @@ -960,10 +959,8 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) goto drop; } - if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1) { - NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENOVERFLOWS); + if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1) goto drop; - } req = inet6_reqsk_alloc(&tcp6_request_sock_ops); if (req == NULL) @@ -1112,7 +1109,6 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) drop_and_free: reqsk_free(req); drop: - NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); return 0; /* don't send reset */ } diff --git a/trunk/net/ipv6/udp.c b/trunk/net/ipv6/udp.c index 599e1ba6d1ce..cb5bf497c09c 100644 --- a/trunk/net/ipv6/udp.c +++ b/trunk/net/ipv6/udp.c @@ -467,7 +467,7 @@ int udpv6_recvmsg(struct kiocb *iocb, struct sock *sk, ip_cmsg_recv(msg, skb); } else { if (np->rxopt.all) - ip6_datagram_recv_ctl(sk, msg, skb); + datagram_recv_ctl(sk, msg, skb); } err = copied; @@ -1143,8 +1143,8 @@ int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk, memset(opt, 0, sizeof(struct ipv6_txoptions)); opt->tot_len = sizeof(*opt); - err = ip6_datagram_send_ctl(sock_net(sk), sk, msg, &fl6, opt, - &hlimit, &tclass, &dontfrag); + err = datagram_send_ctl(sock_net(sk), sk, msg, &fl6, opt, + &hlimit, &tclass, &dontfrag); if (err < 0) { fl6_sock_release(flowlabel); return err; diff --git a/trunk/net/l2tp/l2tp_core.c b/trunk/net/l2tp/l2tp_core.c index b6ba65fa3c50..1a9f3723c13c 100644 --- a/trunk/net/l2tp/l2tp_core.c +++ b/trunk/net/l2tp/l2tp_core.c @@ -101,7 +101,6 @@ struct l2tp_skb_cb { static atomic_t l2tp_tunnel_count; static atomic_t l2tp_session_count; -static struct workqueue_struct *l2tp_wq; /* per-net private data for this module */ static unsigned int l2tp_net_id; @@ -123,6 +122,7 @@ static inline struct l2tp_net *l2tp_pernet(struct net *net) return net_generic(net, l2tp_net_id); } + /* Tunnel reference counts. Incremented per session that is added to * the tunnel. */ @@ -168,51 +168,6 @@ l2tp_session_id_hash_2(struct l2tp_net *pn, u32 session_id) } -/* Lookup the tunnel socket, possibly involving the fs code if the socket is - * owned by userspace. A struct sock returned from this function must be - * released using l2tp_tunnel_sock_put once you're done with it. - */ -struct sock *l2tp_tunnel_sock_lookup(struct l2tp_tunnel *tunnel) -{ - int err = 0; - struct socket *sock = NULL; - struct sock *sk = NULL; - - if (!tunnel) - goto out; - - if (tunnel->fd >= 0) { - /* Socket is owned by userspace, who might be in the process - * of closing it. Look the socket up using the fd to ensure - * consistency. - */ - sock = sockfd_lookup(tunnel->fd, &err); - if (sock) - sk = sock->sk; - } else { - /* Socket is owned by kernelspace */ - sk = tunnel->sock; - } - -out: - return sk; -} -EXPORT_SYMBOL_GPL(l2tp_tunnel_sock_lookup); - -/* Drop a reference to a tunnel socket obtained via. l2tp_tunnel_sock_put */ -void l2tp_tunnel_sock_put(struct sock *sk) -{ - struct l2tp_tunnel *tunnel = l2tp_sock_to_tunnel(sk); - if (tunnel) { - if (tunnel->fd >= 0) { - /* Socket is owned by userspace */ - sockfd_put(sk->sk_socket); - } - sock_put(sk); - } -} -EXPORT_SYMBOL_GPL(l2tp_tunnel_sock_put); - /* Lookup a session by id in the global session list */ static struct l2tp_session *l2tp_session_find_2(struct net *net, u32 session_id) @@ -1277,7 +1232,6 @@ EXPORT_SYMBOL_GPL(l2tp_xmit_skb); static void l2tp_tunnel_destruct(struct sock *sk) { struct l2tp_tunnel *tunnel; - struct l2tp_net *pn; tunnel = sk->sk_user_data; if (tunnel == NULL) @@ -1285,8 +1239,9 @@ static void l2tp_tunnel_destruct(struct sock *sk) l2tp_info(tunnel, L2TP_MSG_CONTROL, "%s: closing...\n", tunnel->name); + /* Close all sessions */ + l2tp_tunnel_closeall(tunnel); - /* Disable udp encapsulation */ switch (tunnel->encap) { case L2TP_ENCAPTYPE_UDP: /* No longer an encapsulation socket. See net/ipv4/udp.c */ @@ -1298,23 +1253,17 @@ static void l2tp_tunnel_destruct(struct sock *sk) } /* Remove hooks into tunnel socket */ + tunnel->sock = NULL; sk->sk_destruct = tunnel->old_sk_destruct; sk->sk_user_data = NULL; - tunnel->sock = NULL; - - /* Remove the tunnel struct from the tunnel list */ - pn = l2tp_pernet(tunnel->l2tp_net); - spin_lock_bh(&pn->l2tp_tunnel_list_lock); - list_del_rcu(&tunnel->list); - spin_unlock_bh(&pn->l2tp_tunnel_list_lock); - atomic_dec(&l2tp_tunnel_count); - - l2tp_tunnel_closeall(tunnel); - l2tp_tunnel_dec_refcount(tunnel); /* Call the original destructor */ if (sk->sk_destruct) (*sk->sk_destruct)(sk); + + /* We're finished with the socket */ + l2tp_tunnel_dec_refcount(tunnel); + end: return; } @@ -1388,77 +1337,48 @@ static void l2tp_tunnel_closeall(struct l2tp_tunnel *tunnel) */ static void l2tp_tunnel_free(struct l2tp_tunnel *tunnel) { + struct l2tp_net *pn = l2tp_pernet(tunnel->l2tp_net); + BUG_ON(atomic_read(&tunnel->ref_count) != 0); BUG_ON(tunnel->sock != NULL); - l2tp_info(tunnel, L2TP_MSG_CONTROL, "%s: free...\n", tunnel->name); - kfree_rcu(tunnel, rcu); -} - -/* Workqueue tunnel deletion function */ -static void l2tp_tunnel_del_work(struct work_struct *work) -{ - struct l2tp_tunnel *tunnel = NULL; - struct socket *sock = NULL; - struct sock *sk = NULL; - tunnel = container_of(work, struct l2tp_tunnel, del_work); - sk = l2tp_tunnel_sock_lookup(tunnel); - if (!sk) - return; - - sock = sk->sk_socket; - BUG_ON(!sock); + l2tp_info(tunnel, L2TP_MSG_CONTROL, "%s: free...\n", tunnel->name); - /* If the tunnel socket was created directly by the kernel, use the - * sk_* API to release the socket now. Otherwise go through the - * inet_* layer to shut the socket down, and let userspace close it. - * In either case the tunnel resources are freed in the socket - * destructor when the tunnel socket goes away. - */ - if (sock->file == NULL) { - kernel_sock_shutdown(sock, SHUT_RDWR); - sk_release_kernel(sk); - } else { - inet_shutdown(sock, 2); - } + /* Remove from tunnel list */ + spin_lock_bh(&pn->l2tp_tunnel_list_lock); + list_del_rcu(&tunnel->list); + kfree_rcu(tunnel, rcu); + spin_unlock_bh(&pn->l2tp_tunnel_list_lock); - l2tp_tunnel_sock_put(sk); + atomic_dec(&l2tp_tunnel_count); } /* Create a socket for the tunnel, if one isn't set up by * userspace. This is used for static tunnels where there is no * managing L2TP daemon. - * - * Since we don't want these sockets to keep a namespace alive by - * themselves, we drop the socket's namespace refcount after creation. - * These sockets are freed when the namespace exits using the pernet - * exit hook. */ -static int l2tp_tunnel_sock_create(struct net *net, - u32 tunnel_id, - u32 peer_tunnel_id, - struct l2tp_tunnel_cfg *cfg, - struct socket **sockp) +static int l2tp_tunnel_sock_create(u32 tunnel_id, u32 peer_tunnel_id, struct l2tp_tunnel_cfg *cfg, struct socket **sockp) { int err = -EINVAL; - struct socket *sock = NULL; - struct sockaddr_in udp_addr = {0}; - struct sockaddr_l2tpip ip_addr = {0}; + struct sockaddr_in udp_addr; #if IS_ENABLED(CONFIG_IPV6) - struct sockaddr_in6 udp6_addr = {0}; - struct sockaddr_l2tpip6 ip6_addr = {0}; + struct sockaddr_in6 udp6_addr; + struct sockaddr_l2tpip6 ip6_addr; #endif + struct sockaddr_l2tpip ip_addr; + struct socket *sock = NULL; switch (cfg->encap) { case L2TP_ENCAPTYPE_UDP: #if IS_ENABLED(CONFIG_IPV6) if (cfg->local_ip6 && cfg->peer_ip6) { - err = sock_create_kern(AF_INET6, SOCK_DGRAM, 0, &sock); + err = sock_create(AF_INET6, SOCK_DGRAM, 0, sockp); if (err < 0) goto out; - sk_change_net(sock->sk, net); + sock = *sockp; + memset(&udp6_addr, 0, sizeof(udp6_addr)); udp6_addr.sin6_family = AF_INET6; memcpy(&udp6_addr.sin6_addr, cfg->local_ip6, sizeof(udp6_addr.sin6_addr)); @@ -1480,12 +1400,13 @@ static int l2tp_tunnel_sock_create(struct net *net, } else #endif { - err = sock_create_kern(AF_INET, SOCK_DGRAM, 0, &sock); + err = sock_create(AF_INET, SOCK_DGRAM, 0, sockp); if (err < 0) goto out; - sk_change_net(sock->sk, net); + sock = *sockp; + memset(&udp_addr, 0, sizeof(udp_addr)); udp_addr.sin_family = AF_INET; udp_addr.sin_addr = cfg->local_ip; udp_addr.sin_port = htons(cfg->local_udp_port); @@ -1512,13 +1433,14 @@ static int l2tp_tunnel_sock_create(struct net *net, case L2TP_ENCAPTYPE_IP: #if IS_ENABLED(CONFIG_IPV6) if (cfg->local_ip6 && cfg->peer_ip6) { - err = sock_create_kern(AF_INET6, SOCK_DGRAM, - IPPROTO_L2TP, &sock); + err = sock_create(AF_INET6, SOCK_DGRAM, IPPROTO_L2TP, + sockp); if (err < 0) goto out; - sk_change_net(sock->sk, net); + sock = *sockp; + memset(&ip6_addr, 0, sizeof(ip6_addr)); ip6_addr.l2tp_family = AF_INET6; memcpy(&ip6_addr.l2tp_addr, cfg->local_ip6, sizeof(ip6_addr.l2tp_addr)); @@ -1540,13 +1462,14 @@ static int l2tp_tunnel_sock_create(struct net *net, } else #endif { - err = sock_create_kern(AF_INET, SOCK_DGRAM, - IPPROTO_L2TP, &sock); + err = sock_create(AF_INET, SOCK_DGRAM, IPPROTO_L2TP, + sockp); if (err < 0) goto out; - sk_change_net(sock->sk, net); + sock = *sockp; + memset(&ip_addr, 0, sizeof(ip_addr)); ip_addr.l2tp_family = AF_INET; ip_addr.l2tp_addr = cfg->local_ip; ip_addr.l2tp_conn_id = tunnel_id; @@ -1570,10 +1493,8 @@ static int l2tp_tunnel_sock_create(struct net *net, } out: - *sockp = sock; if ((err < 0) && sock) { - kernel_sock_shutdown(sock, SHUT_RDWR); - sk_release_kernel(sock->sk); + sock_release(sock); *sockp = NULL; } @@ -1596,23 +1517,15 @@ int l2tp_tunnel_create(struct net *net, int fd, int version, u32 tunnel_id, u32 * kernel socket. */ if (fd < 0) { - err = l2tp_tunnel_sock_create(net, tunnel_id, peer_tunnel_id, - cfg, &sock); + err = l2tp_tunnel_sock_create(tunnel_id, peer_tunnel_id, cfg, &sock); if (err < 0) goto err; } else { + err = -EBADF; sock = sockfd_lookup(fd, &err); if (!sock) { - pr_err("tunl %u: sockfd_lookup(fd=%d) returned %d\n", + pr_err("tunl %hu: sockfd_lookup(fd=%d) returned %d\n", tunnel_id, fd, err); - err = -EBADF; - goto err; - } - - /* Reject namespace mismatches */ - if (!net_eq(sock_net(sock->sk), net)) { - pr_err("tunl %u: netns mismatch\n", tunnel_id); - err = -EINVAL; goto err; } } @@ -1694,14 +1607,10 @@ int l2tp_tunnel_create(struct net *net, int fd, int version, u32 tunnel_id, u32 tunnel->old_sk_destruct = sk->sk_destruct; sk->sk_destruct = &l2tp_tunnel_destruct; tunnel->sock = sk; - tunnel->fd = fd; lockdep_set_class_and_name(&sk->sk_lock.slock, &l2tp_socket_class, "l2tp_sock"); sk->sk_allocation = GFP_ATOMIC; - /* Init delete workqueue struct */ - INIT_WORK(&tunnel->del_work, l2tp_tunnel_del_work); - /* Add tunnel to our list */ INIT_LIST_HEAD(&tunnel->list); atomic_inc(&l2tp_tunnel_count); @@ -1733,7 +1642,25 @@ EXPORT_SYMBOL_GPL(l2tp_tunnel_create); */ int l2tp_tunnel_delete(struct l2tp_tunnel *tunnel) { - return (false == queue_work(l2tp_wq, &tunnel->del_work)); + int err = 0; + struct socket *sock = tunnel->sock ? tunnel->sock->sk_socket : NULL; + + /* Force the tunnel socket to close. This will eventually + * cause the tunnel to be deleted via the normal socket close + * mechanisms when userspace closes the tunnel socket. + */ + if (sock != NULL) { + err = inet_shutdown(sock, 2); + + /* If the tunnel's socket was created by the kernel, + * close the socket here since the socket was not + * created by userspace. + */ + if (sock->file == NULL) + err = inet_release(sock); + } + + return err; } EXPORT_SYMBOL_GPL(l2tp_tunnel_delete); @@ -1917,21 +1844,8 @@ static __net_init int l2tp_init_net(struct net *net) return 0; } -static __net_exit void l2tp_exit_net(struct net *net) -{ - struct l2tp_net *pn = l2tp_pernet(net); - struct l2tp_tunnel *tunnel = NULL; - - rcu_read_lock_bh(); - list_for_each_entry_rcu(tunnel, &pn->l2tp_tunnel_list, list) { - (void)l2tp_tunnel_delete(tunnel); - } - rcu_read_unlock_bh(); -} - static struct pernet_operations l2tp_net_ops = { .init = l2tp_init_net, - .exit = l2tp_exit_net, .id = &l2tp_net_id, .size = sizeof(struct l2tp_net), }; @@ -1944,13 +1858,6 @@ static int __init l2tp_init(void) if (rc) goto out; - l2tp_wq = alloc_workqueue("l2tp", WQ_NON_REENTRANT | WQ_UNBOUND, 0); - if (!l2tp_wq) { - pr_err("alloc_workqueue failed\n"); - rc = -ENOMEM; - goto out; - } - pr_info("L2TP core driver, %s\n", L2TP_DRV_VERSION); out: @@ -1960,10 +1867,6 @@ static int __init l2tp_init(void) static void __exit l2tp_exit(void) { unregister_pernet_device(&l2tp_net_ops); - if (l2tp_wq) { - destroy_workqueue(l2tp_wq); - l2tp_wq = NULL; - } } module_init(l2tp_init); diff --git a/trunk/net/l2tp/l2tp_core.h b/trunk/net/l2tp/l2tp_core.h index 8eb8f1d47f3a..56d583e083a7 100644 --- a/trunk/net/l2tp/l2tp_core.h +++ b/trunk/net/l2tp/l2tp_core.h @@ -188,10 +188,7 @@ struct l2tp_tunnel { int (*recv_payload_hook)(struct sk_buff *skb); void (*old_sk_destruct)(struct sock *); struct sock *sock; /* Parent socket */ - int fd; /* Parent fd, if tunnel socket - * was created by userspace */ - - struct work_struct del_work; + int fd; uint8_t priv[0]; /* private data */ }; @@ -231,8 +228,6 @@ static inline struct l2tp_tunnel *l2tp_sock_to_tunnel(struct sock *sk) return tunnel; } -extern struct sock *l2tp_tunnel_sock_lookup(struct l2tp_tunnel *tunnel); -extern void l2tp_tunnel_sock_put(struct sock *sk); extern struct l2tp_session *l2tp_session_find(struct net *net, struct l2tp_tunnel *tunnel, u32 session_id); extern struct l2tp_session *l2tp_session_find_nth(struct l2tp_tunnel *tunnel, int nth); extern struct l2tp_session *l2tp_session_find_by_ifname(struct net *net, char *ifname); diff --git a/trunk/net/l2tp/l2tp_ip.c b/trunk/net/l2tp/l2tp_ip.c index f7ac8f42fee2..61d8b75d2686 100644 --- a/trunk/net/l2tp/l2tp_ip.c +++ b/trunk/net/l2tp/l2tp_ip.c @@ -115,7 +115,6 @@ static inline struct sock *l2tp_ip_bind_lookup(struct net *net, __be32 laddr, in */ static int l2tp_ip_recv(struct sk_buff *skb) { - struct net *net = dev_net(skb->dev); struct sock *sk; u32 session_id; u32 tunnel_id; @@ -143,7 +142,7 @@ static int l2tp_ip_recv(struct sk_buff *skb) } /* Ok, this is a data packet. Lookup the session. */ - session = l2tp_session_find(net, NULL, session_id); + session = l2tp_session_find(&init_net, NULL, session_id); if (session == NULL) goto discard; @@ -174,14 +173,14 @@ static int l2tp_ip_recv(struct sk_buff *skb) goto discard; tunnel_id = ntohl(*(__be32 *) &skb->data[4]); - tunnel = l2tp_tunnel_find(net, tunnel_id); + tunnel = l2tp_tunnel_find(&init_net, tunnel_id); if (tunnel != NULL) sk = tunnel->sock; else { struct iphdr *iph = (struct iphdr *) skb_network_header(skb); read_lock_bh(&l2tp_ip_lock); - sk = __l2tp_ip_bind_lookup(net, iph->daddr, 0, tunnel_id); + sk = __l2tp_ip_bind_lookup(&init_net, iph->daddr, 0, tunnel_id); read_unlock_bh(&l2tp_ip_lock); } @@ -240,7 +239,6 @@ static int l2tp_ip_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) { struct inet_sock *inet = inet_sk(sk); struct sockaddr_l2tpip *addr = (struct sockaddr_l2tpip *) uaddr; - struct net *net = sock_net(sk); int ret; int chk_addr_ret; @@ -253,8 +251,7 @@ static int l2tp_ip_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) ret = -EADDRINUSE; read_lock_bh(&l2tp_ip_lock); - if (__l2tp_ip_bind_lookup(net, addr->l2tp_addr.s_addr, - sk->sk_bound_dev_if, addr->l2tp_conn_id)) + if (__l2tp_ip_bind_lookup(&init_net, addr->l2tp_addr.s_addr, sk->sk_bound_dev_if, addr->l2tp_conn_id)) goto out_in_use; read_unlock_bh(&l2tp_ip_lock); @@ -263,7 +260,7 @@ static int l2tp_ip_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) if (sk->sk_state != TCP_CLOSE || addr_len < sizeof(struct sockaddr_l2tpip)) goto out; - chk_addr_ret = inet_addr_type(net, addr->l2tp_addr.s_addr); + chk_addr_ret = inet_addr_type(&init_net, addr->l2tp_addr.s_addr); ret = -EADDRNOTAVAIL; if (addr->l2tp_addr.s_addr && chk_addr_ret != RTN_LOCAL && chk_addr_ret != RTN_MULTICAST && chk_addr_ret != RTN_BROADCAST) @@ -372,7 +369,7 @@ static int l2tp_ip_backlog_recv(struct sock *sk, struct sk_buff *skb) return 0; drop: - IP_INC_STATS(sock_net(sk), IPSTATS_MIB_INDISCARDS); + IP_INC_STATS(&init_net, IPSTATS_MIB_INDISCARDS); kfree_skb(skb); return -1; } @@ -608,7 +605,6 @@ static struct inet_protosw l2tp_ip_protosw = { static struct net_protocol l2tp_ip_protocol __read_mostly = { .handler = l2tp_ip_recv, - .netns_ok = 1, }; static int __init l2tp_ip_init(void) diff --git a/trunk/net/l2tp/l2tp_ip6.c b/trunk/net/l2tp/l2tp_ip6.c index 8ee4a86ae996..927547171bc7 100644 --- a/trunk/net/l2tp/l2tp_ip6.c +++ b/trunk/net/l2tp/l2tp_ip6.c @@ -554,8 +554,8 @@ static int l2tp_ip6_sendmsg(struct kiocb *iocb, struct sock *sk, memset(opt, 0, sizeof(struct ipv6_txoptions)); opt->tot_len = sizeof(struct ipv6_txoptions); - err = ip6_datagram_send_ctl(sock_net(sk), sk, msg, &fl6, opt, - &hlimit, &tclass, &dontfrag); + err = datagram_send_ctl(sock_net(sk), sk, msg, &fl6, opt, + &hlimit, &tclass, &dontfrag); if (err < 0) { fl6_sock_release(flowlabel); return err; @@ -646,7 +646,7 @@ static int l2tp_ip6_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, size_t len, int noblock, int flags, int *addr_len) { - struct ipv6_pinfo *np = inet6_sk(sk); + struct inet_sock *inet = inet_sk(sk); struct sockaddr_l2tpip6 *lsa = (struct sockaddr_l2tpip6 *)msg->msg_name; size_t copied = 0; int err = -EOPNOTSUPP; @@ -688,8 +688,8 @@ static int l2tp_ip6_recvmsg(struct kiocb *iocb, struct sock *sk, lsa->l2tp_scope_id = IP6CB(skb)->iif; } - if (np->rxopt.all) - ip6_datagram_recv_ctl(sk, msg, skb); + if (inet->cmsg_flags) + ip_cmsg_recv(msg, skb); if (flags & MSG_TRUNC) copied = skb->len; diff --git a/trunk/net/l2tp/l2tp_netlink.c b/trunk/net/l2tp/l2tp_netlink.c index c1bab22db85e..bbba3a19e944 100644 --- a/trunk/net/l2tp/l2tp_netlink.c +++ b/trunk/net/l2tp/l2tp_netlink.c @@ -37,7 +37,6 @@ static struct genl_family l2tp_nl_family = { .version = L2TP_GENL_VERSION, .hdrsize = 0, .maxattr = L2TP_ATTR_MAX, - .netnsok = true, }; /* Accessed under genl lock */ diff --git a/trunk/net/packet/af_packet.c b/trunk/net/packet/af_packet.c index c111bd0e083a..e639645e8fec 100644 --- a/trunk/net/packet/af_packet.c +++ b/trunk/net/packet/af_packet.c @@ -2361,15 +2361,13 @@ static int packet_release(struct socket *sock) packet_flush_mclist(sk); - if (po->rx_ring.pg_vec) { - memset(&req_u, 0, sizeof(req_u)); + memset(&req_u, 0, sizeof(req_u)); + + if (po->rx_ring.pg_vec) packet_set_ring(sk, &req_u, 1, 0); - } - if (po->tx_ring.pg_vec) { - memset(&req_u, 0, sizeof(req_u)); + if (po->tx_ring.pg_vec) packet_set_ring(sk, &req_u, 1, 1); - } fanout_release(sk); diff --git a/trunk/net/sched/sch_netem.c b/trunk/net/sched/sch_netem.c index 3d2acc7a9c80..298c0ddfb57e 100644 --- a/trunk/net/sched/sch_netem.c +++ b/trunk/net/sched/sch_netem.c @@ -438,18 +438,18 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) if (q->rate) { struct sk_buff_head *list = &sch->q; + delay += packet_len_2_sched_time(skb->len, q); + if (!skb_queue_empty(list)) { /* - * Last packet in queue is reference point (now), - * calculate this time bonus and subtract + * Last packet in queue is reference point (now). + * First packet in queue is already in flight, + * calculate this time bonus and substract * from delay. */ - delay -= netem_skb_cb(skb_peek_tail(list))->time_to_send - now; - delay = max_t(psched_tdiff_t, 0, delay); + delay -= now - netem_skb_cb(skb_peek(list))->time_to_send; now = netem_skb_cb(skb_peek_tail(list))->time_to_send; } - - delay += packet_len_2_sched_time(skb->len, q); } cb->time_to_send = now + delay; diff --git a/trunk/net/sunrpc/svcsock.c b/trunk/net/sunrpc/svcsock.c index 0f679df7d072..0a148c9d2a5c 100644 --- a/trunk/net/sunrpc/svcsock.c +++ b/trunk/net/sunrpc/svcsock.c @@ -465,7 +465,7 @@ static int svc_udp_get_dest_address4(struct svc_rqst *rqstp, } /* - * See net/ipv6/datagram.c : ip6_datagram_recv_ctl + * See net/ipv6/datagram.c : datagram_recv_ctl */ static int svc_udp_get_dest_address6(struct svc_rqst *rqstp, struct cmsghdr *cmh) diff --git a/trunk/net/wireless/scan.c b/trunk/net/wireless/scan.c index 45f1618c8e23..01592d7d4789 100644 --- a/trunk/net/wireless/scan.c +++ b/trunk/net/wireless/scan.c @@ -1358,7 +1358,7 @@ ieee80211_bss(struct wiphy *wiphy, struct iw_request_info *info, &iwe, IW_EV_UINT_LEN); } - buf = kmalloc(31, GFP_ATOMIC); + buf = kmalloc(30, GFP_ATOMIC); if (buf) { memset(&iwe, 0, sizeof(iwe)); iwe.cmd = IWEVCUSTOM;