aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-02-04 16:20:01 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-02-04 16:20:01 -0500
commit44f2c5c841da1b1e0864d768197ab1497b5c2cc1 (patch)
treea9e62ee30dedd31c5aeb9c1a97cb8efec5dc3398
parent78d2978874e4e10e97dfd4fd79db45bdc0748550 (diff)
parent1e6d93e45b231b3ae87c01902ede2315aacfe976 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (68 commits) net: can: janz-ican3: world-writable sysfs termination file net: can: at91_can: world-writable sysfs files MAINTAINERS: update email ids of the be2net driver maintainers. bridge: Don't put partly initialized fdb into hash r8169: prevent RxFIFO induced loops in the irq handler. r8169: RxFIFO overflow oddities with 8168 chipsets. r8169: use RxFIFO overflow workaround for 8168c chipset. include/net/genetlink.h: Allow genlmsg_cancel to accept a NULL argument net: Provide compat support for SIOCGETMIFCNT_IN6 and SIOCGETSGCNT_IN6. net: Support compat SIOCGETVIFCNT ioctl in ipv4. net: Fix bug in compat SIOCGETSGCNT handling. niu: Fix races between up/down and get_stats. tcp_ecn is an integer not a boolean atl1c: Add missing PCI device ID s390: Fix possibly wrong size in strncmp (smsgiucv) s390: Fix wrong size in memcmp (netiucv) qeth: allow OSA CHPARM change in suspend state qeth: allow HiperSockets framesize change in suspend qeth: add more strict MTU checking qeth: show new mac-address if its setting fails ...
-rw-r--r--Documentation/networking/ip-sysctl.txt2
-rw-r--r--MAINTAINERS15
-rw-r--r--drivers/isdn/icn/icn.c3
-rw-r--r--drivers/net/atl1c/atl1c_main.c1
-rw-r--r--drivers/net/benet/be_main.c4
-rw-r--r--drivers/net/bnx2x/bnx2x.h4
-rw-r--r--drivers/net/bnx2x/bnx2x_link.c65
-rw-r--r--drivers/net/bnx2x/bnx2x_main.c27
-rw-r--r--drivers/net/can/Kconfig2
-rw-r--r--drivers/net/can/at91_can.c2
-rw-r--r--drivers/net/can/janz-ican3.c2
-rw-r--r--drivers/net/can/softing/Kconfig2
-rw-r--r--drivers/net/depca.c6
-rw-r--r--drivers/net/dl2k.c4
-rw-r--r--drivers/net/enc28j60.c2
-rw-r--r--drivers/net/niu.c61
-rw-r--r--drivers/net/pcmcia/axnet_cs.c6
-rw-r--r--drivers/net/r8169.c41
-rw-r--r--drivers/net/vxge/vxge-config.c2
-rw-r--r--drivers/net/wireless/ath/ath5k/dma.c4
-rw-r--r--drivers/net/wireless/ath/ath5k/pcu.c4
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9002_hw.c3
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_init.c3
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_main.c21
-rw-r--r--drivers/net/wireless/ath/ath9k/init.c7
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c19
-rw-r--r--drivers/net/wireless/rtlwifi/efuse.c40
-rw-r--r--drivers/net/wireless/wl12xx/spi.c3
-rw-r--r--drivers/net/xen-netfront.c96
-rw-r--r--drivers/s390/net/netiucv.c2
-rw-r--r--drivers/s390/net/qeth_core_main.c149
-rw-r--r--drivers/s390/net/qeth_l2_main.c4
-rw-r--r--drivers/s390/net/smsgiucv.c2
-rw-r--r--drivers/vhost/net.c9
-rw-r--r--drivers/vhost/vhost.h6
-rw-r--r--include/linux/Kbuild1
-rw-r--r--include/linux/caif/Kbuild2
-rw-r--r--include/linux/mroute.h1
-rw-r--r--include/linux/mroute6.h1
-rw-r--r--include/net/genetlink.h3
-rw-r--r--include/net/netfilter/nf_conntrack_ecache.h3
-rw-r--r--include/net/sock.h2
-rw-r--r--net/batman-adv/vis.c14
-rw-r--r--net/bridge/br_fdb.c4
-rw-r--r--net/core/dev.c5
-rw-r--r--net/core/rtnetlink.c6
-rw-r--r--net/core/skbuff.c1
-rw-r--r--net/econet/af_econet.c4
-rw-r--r--net/ipv4/af_inet.c16
-rw-r--r--net/ipv4/ipmr.c76
-rw-r--r--net/ipv4/netfilter/arpt_mangle.c6
-rw-r--r--net/ipv4/raw.c19
-rw-r--r--net/ipv4/route.c6
-rw-r--r--net/ipv6/ip6mr.c75
-rw-r--r--net/ipv6/raw.c19
-rw-r--r--net/ipv6/route.c10
-rw-r--r--net/ipv6/sysctl_net_ipv6.c9
-rw-r--r--net/netfilter/nf_conntrack_ecache.c3
-rw-r--r--net/netfilter/nf_conntrack_netlink.c1
-rw-r--r--net/netfilter/xt_iprange.c16
60 files changed, 637 insertions, 289 deletions
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt
index d99940dcfc44..ac3b4a726a1a 100644
--- a/Documentation/networking/ip-sysctl.txt
+++ b/Documentation/networking/ip-sysctl.txt
@@ -187,7 +187,7 @@ tcp_cookie_size - INTEGER
187tcp_dsack - BOOLEAN 187tcp_dsack - BOOLEAN
188 Allows TCP to send "duplicate" SACKs. 188 Allows TCP to send "duplicate" SACKs.
189 189
190tcp_ecn - BOOLEAN 190tcp_ecn - INTEGER
191 Enable Explicit Congestion Notification (ECN) in TCP. ECN is only 191 Enable Explicit Congestion Notification (ECN) in TCP. ECN is only
192 used when both ends of the TCP flow support it. It is useful to 192 used when both ends of the TCP flow support it. It is useful to
193 avoid losses due to congestion (when the bottleneck router supports 193 avoid losses due to congestion (when the bottleneck router supports
diff --git a/MAINTAINERS b/MAINTAINERS
index 9511bff301c9..531c5cf150ba 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5551,12 +5551,11 @@ S: Supported
5551F: drivers/scsi/be2iscsi/ 5551F: drivers/scsi/be2iscsi/
5552 5552
5553SERVER ENGINES 10Gbps NIC - BladeEngine 2 DRIVER 5553SERVER ENGINES 10Gbps NIC - BladeEngine 2 DRIVER
5554M: Sathya Perla <sathyap@serverengines.com> 5554M: Sathya Perla <sathya.perla@emulex.com>
5555M: Subbu Seetharaman <subbus@serverengines.com> 5555M: Subbu Seetharaman <subbu.seetharaman@emulex.com>
5556M: Sarveshwar Bandi <sarveshwarb@serverengines.com> 5556M: Ajit Khaparde <ajit.khaparde@emulex.com>
5557M: Ajit Khaparde <ajitk@serverengines.com>
5558L: netdev@vger.kernel.org 5557L: netdev@vger.kernel.org
5559W: http://www.serverengines.com 5558W: http://www.emulex.com
5560S: Supported 5559S: Supported
5561F: drivers/net/benet/ 5560F: drivers/net/benet/
5562 5561
@@ -6787,12 +6786,12 @@ S: Maintained
6787F: drivers/net/wireless/wl1251/* 6786F: drivers/net/wireless/wl1251/*
6788 6787
6789WL1271 WIRELESS DRIVER 6788WL1271 WIRELESS DRIVER
6790M: Luciano Coelho <luciano.coelho@nokia.com> 6789M: Luciano Coelho <coelho@ti.com>
6791L: linux-wireless@vger.kernel.org 6790L: linux-wireless@vger.kernel.org
6792W: http://wireless.kernel.org 6791W: http://wireless.kernel.org/en/users/Drivers/wl12xx
6793T: git git://git.kernel.org/pub/scm/linux/kernel/git/luca/wl12xx.git 6792T: git git://git.kernel.org/pub/scm/linux/kernel/git/luca/wl12xx.git
6794S: Maintained 6793S: Maintained
6795F: drivers/net/wireless/wl12xx/wl1271* 6794F: drivers/net/wireless/wl12xx/
6796F: include/linux/wl12xx.h 6795F: include/linux/wl12xx.h
6797 6796
6798WL3501 WIRELESS PCMCIA CARD DRIVER 6797WL3501 WIRELESS PCMCIA CARD DRIVER
diff --git a/drivers/isdn/icn/icn.c b/drivers/isdn/icn/icn.c
index f2b5bab5e6a1..1f355bb85e54 100644
--- a/drivers/isdn/icn/icn.c
+++ b/drivers/isdn/icn/icn.c
@@ -1627,7 +1627,7 @@ __setup("icn=", icn_setup);
1627static int __init icn_init(void) 1627static int __init icn_init(void)
1628{ 1628{
1629 char *p; 1629 char *p;
1630 char rev[20]; 1630 char rev[21];
1631 1631
1632 memset(&dev, 0, sizeof(icn_dev)); 1632 memset(&dev, 0, sizeof(icn_dev));
1633 dev.memaddr = (membase & 0x0ffc000); 1633 dev.memaddr = (membase & 0x0ffc000);
@@ -1638,6 +1638,7 @@ static int __init icn_init(void)
1638 1638
1639 if ((p = strchr(revision, ':'))) { 1639 if ((p = strchr(revision, ':'))) {
1640 strncpy(rev, p + 1, 20); 1640 strncpy(rev, p + 1, 20);
1641 rev[20] = '\0';
1641 p = strchr(rev, '$'); 1642 p = strchr(rev, '$');
1642 if (p) 1643 if (p)
1643 *p = 0; 1644 *p = 0;
diff --git a/drivers/net/atl1c/atl1c_main.c b/drivers/net/atl1c/atl1c_main.c
index a699bbf20eb5..3824382faecc 100644
--- a/drivers/net/atl1c/atl1c_main.c
+++ b/drivers/net/atl1c/atl1c_main.c
@@ -48,6 +48,7 @@ static DEFINE_PCI_DEVICE_TABLE(atl1c_pci_tbl) = {
48 {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATHEROS_L2C_B)}, 48 {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATHEROS_L2C_B)},
49 {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATHEROS_L2C_B2)}, 49 {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATHEROS_L2C_B2)},
50 {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATHEROS_L1D)}, 50 {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATHEROS_L1D)},
51 {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATHEROS_L1D_2_0)},
51 /* required last entry */ 52 /* required last entry */
52 { 0 } 53 { 0 }
53}; 54};
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index de40d3b7152f..28a32a6c8bf1 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -312,11 +312,9 @@ void be_link_status_update(struct be_adapter *adapter, bool link_up)
312 if (adapter->link_up != link_up) { 312 if (adapter->link_up != link_up) {
313 adapter->link_speed = -1; 313 adapter->link_speed = -1;
314 if (link_up) { 314 if (link_up) {
315 netif_start_queue(netdev);
316 netif_carrier_on(netdev); 315 netif_carrier_on(netdev);
317 printk(KERN_INFO "%s: Link up\n", netdev->name); 316 printk(KERN_INFO "%s: Link up\n", netdev->name);
318 } else { 317 } else {
319 netif_stop_queue(netdev);
320 netif_carrier_off(netdev); 318 netif_carrier_off(netdev);
321 printk(KERN_INFO "%s: Link down\n", netdev->name); 319 printk(KERN_INFO "%s: Link down\n", netdev->name);
322 } 320 }
@@ -2628,8 +2626,6 @@ static void be_netdev_init(struct net_device *netdev)
2628 2626
2629 netif_napi_add(netdev, &adapter->tx_eq.napi, be_poll_tx_mcc, 2627 netif_napi_add(netdev, &adapter->tx_eq.napi, be_poll_tx_mcc,
2630 BE_NAPI_WEIGHT); 2628 BE_NAPI_WEIGHT);
2631
2632 netif_stop_queue(netdev);
2633} 2629}
2634 2630
2635static void be_unmap_pci_bars(struct be_adapter *adapter) 2631static void be_unmap_pci_bars(struct be_adapter *adapter)
diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h
index 8e4183717d91..653c62475cb6 100644
--- a/drivers/net/bnx2x/bnx2x.h
+++ b/drivers/net/bnx2x/bnx2x.h
@@ -22,8 +22,8 @@
22 * (you will need to reboot afterwards) */ 22 * (you will need to reboot afterwards) */
23/* #define BNX2X_STOP_ON_ERROR */ 23/* #define BNX2X_STOP_ON_ERROR */
24 24
25#define DRV_MODULE_VERSION "1.62.00-4" 25#define DRV_MODULE_VERSION "1.62.00-5"
26#define DRV_MODULE_RELDATE "2011/01/18" 26#define DRV_MODULE_RELDATE "2011/01/30"
27#define BNX2X_BC_VER 0x040200 27#define BNX2X_BC_VER 0x040200
28 28
29#define BNX2X_MULTI_QUEUE 29#define BNX2X_MULTI_QUEUE
diff --git a/drivers/net/bnx2x/bnx2x_link.c b/drivers/net/bnx2x/bnx2x_link.c
index 7160ec51093e..dd1210fddfff 100644
--- a/drivers/net/bnx2x/bnx2x_link.c
+++ b/drivers/net/bnx2x/bnx2x_link.c
@@ -3948,48 +3948,6 @@ static u8 bnx2x_8073_8727_external_rom_boot(struct bnx2x *bp,
3948 return rc; 3948 return rc;
3949} 3949}
3950 3950
3951static void bnx2x_8073_set_xaui_low_power_mode(struct bnx2x *bp,
3952 struct bnx2x_phy *phy)
3953{
3954 u16 val;
3955 bnx2x_cl45_read(bp, phy,
3956 MDIO_PMA_DEVAD, MDIO_PMA_REG_8073_CHIP_REV, &val);
3957
3958 if (val == 0) {
3959 /* Mustn't set low power mode in 8073 A0 */
3960 return;
3961 }
3962
3963 /* Disable PLL sequencer (use read-modify-write to clear bit 13) */
3964 bnx2x_cl45_read(bp, phy,
3965 MDIO_XS_DEVAD, MDIO_XS_PLL_SEQUENCER, &val);
3966 val &= ~(1<<13);
3967 bnx2x_cl45_write(bp, phy,
3968 MDIO_XS_DEVAD, MDIO_XS_PLL_SEQUENCER, val);
3969
3970 /* PLL controls */
3971 bnx2x_cl45_write(bp, phy, MDIO_XS_DEVAD, 0x805E, 0x1077);
3972 bnx2x_cl45_write(bp, phy, MDIO_XS_DEVAD, 0x805D, 0x0000);
3973 bnx2x_cl45_write(bp, phy, MDIO_XS_DEVAD, 0x805C, 0x030B);
3974 bnx2x_cl45_write(bp, phy, MDIO_XS_DEVAD, 0x805B, 0x1240);
3975 bnx2x_cl45_write(bp, phy, MDIO_XS_DEVAD, 0x805A, 0x2490);
3976
3977 /* Tx Controls */
3978 bnx2x_cl45_write(bp, phy, MDIO_XS_DEVAD, 0x80A7, 0x0C74);
3979 bnx2x_cl45_write(bp, phy, MDIO_XS_DEVAD, 0x80A6, 0x9041);
3980 bnx2x_cl45_write(bp, phy, MDIO_XS_DEVAD, 0x80A5, 0x4640);
3981
3982 /* Rx Controls */
3983 bnx2x_cl45_write(bp, phy, MDIO_XS_DEVAD, 0x80FE, 0x01C4);
3984 bnx2x_cl45_write(bp, phy, MDIO_XS_DEVAD, 0x80FD, 0x9249);
3985 bnx2x_cl45_write(bp, phy, MDIO_XS_DEVAD, 0x80FC, 0x2015);
3986
3987 /* Enable PLL sequencer (use read-modify-write to set bit 13) */
3988 bnx2x_cl45_read(bp, phy, MDIO_XS_DEVAD, MDIO_XS_PLL_SEQUENCER, &val);
3989 val |= (1<<13);
3990 bnx2x_cl45_write(bp, phy, MDIO_XS_DEVAD, MDIO_XS_PLL_SEQUENCER, val);
3991}
3992
3993/******************************************************************/ 3951/******************************************************************/
3994/* BCM8073 PHY SECTION */ 3952/* BCM8073 PHY SECTION */
3995/******************************************************************/ 3953/******************************************************************/
@@ -4148,8 +4106,6 @@ static u8 bnx2x_8073_config_init(struct bnx2x_phy *phy,
4148 4106
4149 bnx2x_8073_set_pause_cl37(params, phy, vars); 4107 bnx2x_8073_set_pause_cl37(params, phy, vars);
4150 4108
4151 bnx2x_8073_set_xaui_low_power_mode(bp, phy);
4152
4153 bnx2x_cl45_read(bp, phy, 4109 bnx2x_cl45_read(bp, phy,
4154 MDIO_PMA_DEVAD, MDIO_PMA_REG_M8051_MSGOUT_REG, &tmp1); 4110 MDIO_PMA_DEVAD, MDIO_PMA_REG_M8051_MSGOUT_REG, &tmp1);
4155 4111
@@ -6519,6 +6475,18 @@ static void bnx2x_848xx_set_link_led(struct bnx2x_phy *phy,
6519 MDIO_PMA_DEVAD, 6475 MDIO_PMA_DEVAD,
6520 MDIO_PMA_REG_8481_LED1_MASK, 6476 MDIO_PMA_REG_8481_LED1_MASK,
6521 0x80); 6477 0x80);
6478
6479 /* Tell LED3 to blink on source */
6480 bnx2x_cl45_read(bp, phy,
6481 MDIO_PMA_DEVAD,
6482 MDIO_PMA_REG_8481_LINK_SIGNAL,
6483 &val);
6484 val &= ~(7<<6);
6485 val |= (1<<6); /* A83B[8:6]= 1 */
6486 bnx2x_cl45_write(bp, phy,
6487 MDIO_PMA_DEVAD,
6488 MDIO_PMA_REG_8481_LINK_SIGNAL,
6489 val);
6522 } 6490 }
6523 break; 6491 break;
6524 } 6492 }
@@ -7720,10 +7688,13 @@ static u8 bnx2x_8073_common_init_phy(struct bnx2x *bp,
7720 struct bnx2x_phy phy[PORT_MAX]; 7688 struct bnx2x_phy phy[PORT_MAX];
7721 struct bnx2x_phy *phy_blk[PORT_MAX]; 7689 struct bnx2x_phy *phy_blk[PORT_MAX];
7722 u16 val; 7690 u16 val;
7723 s8 port; 7691 s8 port = 0;
7724 s8 port_of_path = 0; 7692 s8 port_of_path = 0;
7725 7693 u32 swap_val, swap_override;
7726 bnx2x_ext_phy_hw_reset(bp, 0); 7694 swap_val = REG_RD(bp, NIG_REG_PORT_SWAP);
7695 swap_override = REG_RD(bp, NIG_REG_STRAP_OVERRIDE);
7696 port ^= (swap_val && swap_override);
7697 bnx2x_ext_phy_hw_reset(bp, port);
7727 /* PART1 - Reset both phys */ 7698 /* PART1 - Reset both phys */
7728 for (port = PORT_MAX - 1; port >= PORT_0; port--) { 7699 for (port = PORT_MAX - 1; port >= PORT_0; port--) {
7729 u32 shmem_base, shmem2_base; 7700 u32 shmem_base, shmem2_base;
diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c
index 8cdcf5b39d1e..f40740e68ea5 100644
--- a/drivers/net/bnx2x/bnx2x_main.c
+++ b/drivers/net/bnx2x/bnx2x_main.c
@@ -2301,15 +2301,10 @@ static void bnx2x_rxq_set_mac_filters(struct bnx2x *bp, u16 cl_id, u32 filters)
2301 /* accept matched ucast */ 2301 /* accept matched ucast */
2302 drop_all_ucast = 0; 2302 drop_all_ucast = 0;
2303 } 2303 }
2304 if (filters & BNX2X_ACCEPT_MULTICAST) { 2304 if (filters & BNX2X_ACCEPT_MULTICAST)
2305 /* accept matched mcast */ 2305 /* accept matched mcast */
2306 drop_all_mcast = 0; 2306 drop_all_mcast = 0;
2307 if (IS_MF_SI(bp)) 2307
2308 /* since mcast addresses won't arrive with ovlan,
2309 * fw needs to accept all of them in
2310 * switch-independent mode */
2311 accp_all_mcast = 1;
2312 }
2313 if (filters & BNX2X_ACCEPT_ALL_UNICAST) { 2308 if (filters & BNX2X_ACCEPT_ALL_UNICAST) {
2314 /* accept all mcast */ 2309 /* accept all mcast */
2315 drop_all_ucast = 0; 2310 drop_all_ucast = 0;
@@ -5296,10 +5291,6 @@ static int bnx2x_init_hw_common(struct bnx2x *bp, u32 load_code)
5296 } 5291 }
5297 } 5292 }
5298 5293
5299 bp->port.need_hw_lock = bnx2x_hw_lock_required(bp,
5300 bp->common.shmem_base,
5301 bp->common.shmem2_base);
5302
5303 bnx2x_setup_fan_failure_detection(bp); 5294 bnx2x_setup_fan_failure_detection(bp);
5304 5295
5305 /* clear PXP2 attentions */ 5296 /* clear PXP2 attentions */
@@ -5503,9 +5494,6 @@ static int bnx2x_init_hw_port(struct bnx2x *bp)
5503 5494
5504 bnx2x_init_block(bp, MCP_BLOCK, init_stage); 5495 bnx2x_init_block(bp, MCP_BLOCK, init_stage);
5505 bnx2x_init_block(bp, DMAE_BLOCK, init_stage); 5496 bnx2x_init_block(bp, DMAE_BLOCK, init_stage);
5506 bp->port.need_hw_lock = bnx2x_hw_lock_required(bp,
5507 bp->common.shmem_base,
5508 bp->common.shmem2_base);
5509 if (bnx2x_fan_failure_det_req(bp, bp->common.shmem_base, 5497 if (bnx2x_fan_failure_det_req(bp, bp->common.shmem_base,
5510 bp->common.shmem2_base, port)) { 5498 bp->common.shmem2_base, port)) {
5511 u32 reg_addr = (port ? MISC_REG_AEU_ENABLE1_FUNC_1_OUT_0 : 5499 u32 reg_addr = (port ? MISC_REG_AEU_ENABLE1_FUNC_1_OUT_0 :
@@ -8379,6 +8367,17 @@ static void __devinit bnx2x_get_port_hwinfo(struct bnx2x *bp)
8379 (ext_phy_type != PORT_HW_CFG_XGXS_EXT_PHY_TYPE_NOT_CONN)) 8367 (ext_phy_type != PORT_HW_CFG_XGXS_EXT_PHY_TYPE_NOT_CONN))
8380 bp->mdio.prtad = 8368 bp->mdio.prtad =
8381 XGXS_EXT_PHY_ADDR(ext_phy_config); 8369 XGXS_EXT_PHY_ADDR(ext_phy_config);
8370
8371 /*
8372 * Check if hw lock is required to access MDC/MDIO bus to the PHY(s)
8373 * In MF mode, it is set to cover self test cases
8374 */
8375 if (IS_MF(bp))
8376 bp->port.need_hw_lock = 1;
8377 else
8378 bp->port.need_hw_lock = bnx2x_hw_lock_required(bp,
8379 bp->common.shmem_base,
8380 bp->common.shmem2_base);
8382} 8381}
8383 8382
8384static void __devinit bnx2x_get_mac_hwinfo(struct bnx2x *bp) 8383static void __devinit bnx2x_get_mac_hwinfo(struct bnx2x *bp)
diff --git a/drivers/net/can/Kconfig b/drivers/net/can/Kconfig
index 986195eaa57c..5dec456fd4a4 100644
--- a/drivers/net/can/Kconfig
+++ b/drivers/net/can/Kconfig
@@ -23,7 +23,7 @@ config CAN_SLCAN
23 23
24 As only the sending and receiving of CAN frames is implemented, this 24 As only the sending and receiving of CAN frames is implemented, this
25 driver should work with the (serial/USB) CAN hardware from: 25 driver should work with the (serial/USB) CAN hardware from:
26 www.canusb.com / www.can232.com / www.mictronic.com / www.canhack.de 26 www.canusb.com / www.can232.com / www.mictronics.de / www.canhack.de
27 27
28 Userspace tools to attach the SLCAN line discipline (slcan_attach, 28 Userspace tools to attach the SLCAN line discipline (slcan_attach,
29 slcand) can be found in the can-utils at the SocketCAN SVN, see 29 slcand) can be found in the can-utils at the SocketCAN SVN, see
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c
index 2532b9631538..57d2ffbbb433 100644
--- a/drivers/net/can/at91_can.c
+++ b/drivers/net/can/at91_can.c
@@ -1109,7 +1109,7 @@ static ssize_t at91_sysfs_set_mb0_id(struct device *dev,
1109 return ret; 1109 return ret;
1110} 1110}
1111 1111
1112static DEVICE_ATTR(mb0_id, S_IWUGO | S_IRUGO, 1112static DEVICE_ATTR(mb0_id, S_IWUSR | S_IRUGO,
1113 at91_sysfs_show_mb0_id, at91_sysfs_set_mb0_id); 1113 at91_sysfs_show_mb0_id, at91_sysfs_set_mb0_id);
1114 1114
1115static struct attribute *at91_sysfs_attrs[] = { 1115static struct attribute *at91_sysfs_attrs[] = {
diff --git a/drivers/net/can/janz-ican3.c b/drivers/net/can/janz-ican3.c
index b9a6d7a5a739..366f5cc050ae 100644
--- a/drivers/net/can/janz-ican3.c
+++ b/drivers/net/can/janz-ican3.c
@@ -1618,7 +1618,7 @@ static ssize_t ican3_sysfs_set_term(struct device *dev,
1618 return count; 1618 return count;
1619} 1619}
1620 1620
1621static DEVICE_ATTR(termination, S_IWUGO | S_IRUGO, ican3_sysfs_show_term, 1621static DEVICE_ATTR(termination, S_IWUSR | S_IRUGO, ican3_sysfs_show_term,
1622 ican3_sysfs_set_term); 1622 ican3_sysfs_set_term);
1623 1623
1624static struct attribute *ican3_sysfs_attrs[] = { 1624static struct attribute *ican3_sysfs_attrs[] = {
diff --git a/drivers/net/can/softing/Kconfig b/drivers/net/can/softing/Kconfig
index 92bd6bdde5e3..8ba81b3ddd90 100644
--- a/drivers/net/can/softing/Kconfig
+++ b/drivers/net/can/softing/Kconfig
@@ -1,6 +1,6 @@
1config CAN_SOFTING 1config CAN_SOFTING
2 tristate "Softing Gmbh CAN generic support" 2 tristate "Softing Gmbh CAN generic support"
3 depends on CAN_DEV 3 depends on CAN_DEV && HAS_IOMEM
4 ---help--- 4 ---help---
5 Support for CAN cards from Softing Gmbh & some cards 5 Support for CAN cards from Softing Gmbh & some cards
6 from Vector Gmbh. 6 from Vector Gmbh.
diff --git a/drivers/net/depca.c b/drivers/net/depca.c
index 1b48b68ad4fd..8b0084d17c8c 100644
--- a/drivers/net/depca.c
+++ b/drivers/net/depca.c
@@ -1094,7 +1094,7 @@ static int depca_rx(struct net_device *dev)
1094 } 1094 }
1095 } 1095 }
1096 /* Change buffer ownership for this last frame, back to the adapter */ 1096 /* Change buffer ownership for this last frame, back to the adapter */
1097 for (; lp->rx_old != entry; lp->rx_old = (++lp->rx_old) & lp->rxRingMask) { 1097 for (; lp->rx_old != entry; lp->rx_old = (lp->rx_old + 1) & lp->rxRingMask) {
1098 writel(readl(&lp->rx_ring[lp->rx_old].base) | R_OWN, &lp->rx_ring[lp->rx_old].base); 1098 writel(readl(&lp->rx_ring[lp->rx_old].base) | R_OWN, &lp->rx_ring[lp->rx_old].base);
1099 } 1099 }
1100 writel(readl(&lp->rx_ring[entry].base) | R_OWN, &lp->rx_ring[entry].base); 1100 writel(readl(&lp->rx_ring[entry].base) | R_OWN, &lp->rx_ring[entry].base);
@@ -1103,7 +1103,7 @@ static int depca_rx(struct net_device *dev)
1103 /* 1103 /*
1104 ** Update entry information 1104 ** Update entry information
1105 */ 1105 */
1106 lp->rx_new = (++lp->rx_new) & lp->rxRingMask; 1106 lp->rx_new = (lp->rx_new + 1) & lp->rxRingMask;
1107 } 1107 }
1108 1108
1109 return 0; 1109 return 0;
@@ -1148,7 +1148,7 @@ static int depca_tx(struct net_device *dev)
1148 } 1148 }
1149 1149
1150 /* Update all the pointers */ 1150 /* Update all the pointers */
1151 lp->tx_old = (++lp->tx_old) & lp->txRingMask; 1151 lp->tx_old = (lp->tx_old + 1) & lp->txRingMask;
1152 } 1152 }
1153 1153
1154 return 0; 1154 return 0;
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c
index e1a8216ff692..c05db6046050 100644
--- a/drivers/net/dl2k.c
+++ b/drivers/net/dl2k.c
@@ -1753,8 +1753,6 @@ rio_close (struct net_device *dev)
1753 1753
1754 /* Free all the skbuffs in the queue. */ 1754 /* Free all the skbuffs in the queue. */
1755 for (i = 0; i < RX_RING_SIZE; i++) { 1755 for (i = 0; i < RX_RING_SIZE; i++) {
1756 np->rx_ring[i].status = 0;
1757 np->rx_ring[i].fraginfo = 0;
1758 skb = np->rx_skbuff[i]; 1756 skb = np->rx_skbuff[i];
1759 if (skb) { 1757 if (skb) {
1760 pci_unmap_single(np->pdev, 1758 pci_unmap_single(np->pdev,
@@ -1763,6 +1761,8 @@ rio_close (struct net_device *dev)
1763 dev_kfree_skb (skb); 1761 dev_kfree_skb (skb);
1764 np->rx_skbuff[i] = NULL; 1762 np->rx_skbuff[i] = NULL;
1765 } 1763 }
1764 np->rx_ring[i].status = 0;
1765 np->rx_ring[i].fraginfo = 0;
1766 } 1766 }
1767 for (i = 0; i < TX_RING_SIZE; i++) { 1767 for (i = 0; i < TX_RING_SIZE; i++) {
1768 skb = np->tx_skbuff[i]; 1768 skb = np->tx_skbuff[i];
diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c
index 112c5aa9af7f..907b05a1c659 100644
--- a/drivers/net/enc28j60.c
+++ b/drivers/net/enc28j60.c
@@ -812,7 +812,7 @@ static void enc28j60_read_tsv(struct enc28j60_net *priv, u8 tsv[TSV_SIZE])
812 if (netif_msg_hw(priv)) 812 if (netif_msg_hw(priv))
813 printk(KERN_DEBUG DRV_NAME ": reading TSV at addr:0x%04x\n", 813 printk(KERN_DEBUG DRV_NAME ": reading TSV at addr:0x%04x\n",
814 endptr + 1); 814 endptr + 1);
815 enc28j60_mem_read(priv, endptr + 1, sizeof(tsv), tsv); 815 enc28j60_mem_read(priv, endptr + 1, TSV_SIZE, tsv);
816} 816}
817 817
818static void enc28j60_dump_tsv(struct enc28j60_net *priv, const char *msg, 818static void enc28j60_dump_tsv(struct enc28j60_net *priv, const char *msg,
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index 2541321bad82..9fb59d3f9c92 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -4489,6 +4489,9 @@ static int niu_alloc_channels(struct niu *np)
4489{ 4489{
4490 struct niu_parent *parent = np->parent; 4490 struct niu_parent *parent = np->parent;
4491 int first_rx_channel, first_tx_channel; 4491 int first_rx_channel, first_tx_channel;
4492 int num_rx_rings, num_tx_rings;
4493 struct rx_ring_info *rx_rings;
4494 struct tx_ring_info *tx_rings;
4492 int i, port, err; 4495 int i, port, err;
4493 4496
4494 port = np->port; 4497 port = np->port;
@@ -4498,18 +4501,21 @@ static int niu_alloc_channels(struct niu *np)
4498 first_tx_channel += parent->txchan_per_port[i]; 4501 first_tx_channel += parent->txchan_per_port[i];
4499 } 4502 }
4500 4503
4501 np->num_rx_rings = parent->rxchan_per_port[port]; 4504 num_rx_rings = parent->rxchan_per_port[port];
4502 np->num_tx_rings = parent->txchan_per_port[port]; 4505 num_tx_rings = parent->txchan_per_port[port];
4503 4506
4504 netif_set_real_num_rx_queues(np->dev, np->num_rx_rings); 4507 rx_rings = kcalloc(num_rx_rings, sizeof(struct rx_ring_info),
4505 netif_set_real_num_tx_queues(np->dev, np->num_tx_rings); 4508 GFP_KERNEL);
4506
4507 np->rx_rings = kcalloc(np->num_rx_rings, sizeof(struct rx_ring_info),
4508 GFP_KERNEL);
4509 err = -ENOMEM; 4509 err = -ENOMEM;
4510 if (!np->rx_rings) 4510 if (!rx_rings)
4511 goto out_err; 4511 goto out_err;
4512 4512
4513 np->num_rx_rings = num_rx_rings;
4514 smp_wmb();
4515 np->rx_rings = rx_rings;
4516
4517 netif_set_real_num_rx_queues(np->dev, num_rx_rings);
4518
4513 for (i = 0; i < np->num_rx_rings; i++) { 4519 for (i = 0; i < np->num_rx_rings; i++) {
4514 struct rx_ring_info *rp = &np->rx_rings[i]; 4520 struct rx_ring_info *rp = &np->rx_rings[i];
4515 4521
@@ -4538,12 +4544,18 @@ static int niu_alloc_channels(struct niu *np)
4538 return err; 4544 return err;
4539 } 4545 }
4540 4546
4541 np->tx_rings = kcalloc(np->num_tx_rings, sizeof(struct tx_ring_info), 4547 tx_rings = kcalloc(num_tx_rings, sizeof(struct tx_ring_info),
4542 GFP_KERNEL); 4548 GFP_KERNEL);
4543 err = -ENOMEM; 4549 err = -ENOMEM;
4544 if (!np->tx_rings) 4550 if (!tx_rings)
4545 goto out_err; 4551 goto out_err;
4546 4552
4553 np->num_tx_rings = num_tx_rings;
4554 smp_wmb();
4555 np->tx_rings = tx_rings;
4556
4557 netif_set_real_num_tx_queues(np->dev, num_tx_rings);
4558
4547 for (i = 0; i < np->num_tx_rings; i++) { 4559 for (i = 0; i < np->num_tx_rings; i++) {
4548 struct tx_ring_info *rp = &np->tx_rings[i]; 4560 struct tx_ring_info *rp = &np->tx_rings[i];
4549 4561
@@ -6246,11 +6258,17 @@ static void niu_sync_mac_stats(struct niu *np)
6246static void niu_get_rx_stats(struct niu *np) 6258static void niu_get_rx_stats(struct niu *np)
6247{ 6259{
6248 unsigned long pkts, dropped, errors, bytes; 6260 unsigned long pkts, dropped, errors, bytes;
6261 struct rx_ring_info *rx_rings;
6249 int i; 6262 int i;
6250 6263
6251 pkts = dropped = errors = bytes = 0; 6264 pkts = dropped = errors = bytes = 0;
6265
6266 rx_rings = ACCESS_ONCE(np->rx_rings);
6267 if (!rx_rings)
6268 goto no_rings;
6269
6252 for (i = 0; i < np->num_rx_rings; i++) { 6270 for (i = 0; i < np->num_rx_rings; i++) {
6253 struct rx_ring_info *rp = &np->rx_rings[i]; 6271 struct rx_ring_info *rp = &rx_rings[i];
6254 6272
6255 niu_sync_rx_discard_stats(np, rp, 0); 6273 niu_sync_rx_discard_stats(np, rp, 0);
6256 6274
@@ -6259,6 +6277,8 @@ static void niu_get_rx_stats(struct niu *np)
6259 dropped += rp->rx_dropped; 6277 dropped += rp->rx_dropped;
6260 errors += rp->rx_errors; 6278 errors += rp->rx_errors;
6261 } 6279 }
6280
6281no_rings:
6262 np->dev->stats.rx_packets = pkts; 6282 np->dev->stats.rx_packets = pkts;
6263 np->dev->stats.rx_bytes = bytes; 6283 np->dev->stats.rx_bytes = bytes;
6264 np->dev->stats.rx_dropped = dropped; 6284 np->dev->stats.rx_dropped = dropped;
@@ -6268,16 +6288,24 @@ static void niu_get_rx_stats(struct niu *np)
6268static void niu_get_tx_stats(struct niu *np) 6288static void niu_get_tx_stats(struct niu *np)
6269{ 6289{
6270 unsigned long pkts, errors, bytes; 6290 unsigned long pkts, errors, bytes;
6291 struct tx_ring_info *tx_rings;
6271 int i; 6292 int i;
6272 6293
6273 pkts = errors = bytes = 0; 6294 pkts = errors = bytes = 0;
6295
6296 tx_rings = ACCESS_ONCE(np->tx_rings);
6297 if (!tx_rings)
6298 goto no_rings;
6299
6274 for (i = 0; i < np->num_tx_rings; i++) { 6300 for (i = 0; i < np->num_tx_rings; i++) {
6275 struct tx_ring_info *rp = &np->tx_rings[i]; 6301 struct tx_ring_info *rp = &tx_rings[i];
6276 6302
6277 pkts += rp->tx_packets; 6303 pkts += rp->tx_packets;
6278 bytes += rp->tx_bytes; 6304 bytes += rp->tx_bytes;
6279 errors += rp->tx_errors; 6305 errors += rp->tx_errors;
6280 } 6306 }
6307
6308no_rings:
6281 np->dev->stats.tx_packets = pkts; 6309 np->dev->stats.tx_packets = pkts;
6282 np->dev->stats.tx_bytes = bytes; 6310 np->dev->stats.tx_bytes = bytes;
6283 np->dev->stats.tx_errors = errors; 6311 np->dev->stats.tx_errors = errors;
@@ -6287,9 +6315,10 @@ static struct net_device_stats *niu_get_stats(struct net_device *dev)
6287{ 6315{
6288 struct niu *np = netdev_priv(dev); 6316 struct niu *np = netdev_priv(dev);
6289 6317
6290 niu_get_rx_stats(np); 6318 if (netif_running(dev)) {
6291 niu_get_tx_stats(np); 6319 niu_get_rx_stats(np);
6292 6320 niu_get_tx_stats(np);
6321 }
6293 return &dev->stats; 6322 return &dev->stats;
6294} 6323}
6295 6324
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index 1f42f6ac8551..d3cb77205863 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -1488,12 +1488,10 @@ static void ei_rx_overrun(struct net_device *dev)
1488 1488
1489 /* 1489 /*
1490 * Wait a full Tx time (1.2ms) + some guard time, NS says 1.6ms total. 1490 * Wait a full Tx time (1.2ms) + some guard time, NS says 1.6ms total.
1491 * Early datasheets said to poll the reset bit, but now they say that 1491 * We wait at least 2ms.
1492 * it "is not a reliable indicator and subsequently should be ignored."
1493 * We wait at least 10ms.
1494 */ 1492 */
1495 1493
1496 mdelay(10); 1494 mdelay(2);
1497 1495
1498 /* 1496 /*
1499 * Reset RBCR[01] back to zero as per magic incantation. 1497 * Reset RBCR[01] back to zero as per magic incantation.
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index bde7d61f1930..59ccf0c5c610 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -973,7 +973,8 @@ static void __rtl8169_check_link_status(struct net_device *dev,
973 if (pm) 973 if (pm)
974 pm_request_resume(&tp->pci_dev->dev); 974 pm_request_resume(&tp->pci_dev->dev);
975 netif_carrier_on(dev); 975 netif_carrier_on(dev);
976 netif_info(tp, ifup, dev, "link up\n"); 976 if (net_ratelimit())
977 netif_info(tp, ifup, dev, "link up\n");
977 } else { 978 } else {
978 netif_carrier_off(dev); 979 netif_carrier_off(dev);
979 netif_info(tp, ifdown, dev, "link down\n"); 980 netif_info(tp, ifdown, dev, "link down\n");
@@ -3757,7 +3758,8 @@ static void rtl_hw_start_8168(struct net_device *dev)
3757 RTL_W16(IntrMitigate, 0x5151); 3758 RTL_W16(IntrMitigate, 0x5151);
3758 3759
3759 /* Work around for RxFIFO overflow. */ 3760 /* Work around for RxFIFO overflow. */
3760 if (tp->mac_version == RTL_GIGA_MAC_VER_11) { 3761 if (tp->mac_version == RTL_GIGA_MAC_VER_11 ||
3762 tp->mac_version == RTL_GIGA_MAC_VER_22) {
3761 tp->intr_event |= RxFIFOOver | PCSTimeout; 3763 tp->intr_event |= RxFIFOOver | PCSTimeout;
3762 tp->intr_event &= ~RxOverflow; 3764 tp->intr_event &= ~RxOverflow;
3763 } 3765 }
@@ -4639,12 +4641,33 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance)
4639 break; 4641 break;
4640 } 4642 }
4641 4643
4642 /* Work around for rx fifo overflow */ 4644 if (unlikely(status & RxFIFOOver)) {
4643 if (unlikely(status & RxFIFOOver) && 4645 switch (tp->mac_version) {
4644 (tp->mac_version == RTL_GIGA_MAC_VER_11)) { 4646 /* Work around for rx fifo overflow */
4645 netif_stop_queue(dev); 4647 case RTL_GIGA_MAC_VER_11:
4646 rtl8169_tx_timeout(dev); 4648 case RTL_GIGA_MAC_VER_22:
4647 break; 4649 case RTL_GIGA_MAC_VER_26:
4650 netif_stop_queue(dev);
4651 rtl8169_tx_timeout(dev);
4652 goto done;
4653 /* Testers needed. */
4654 case RTL_GIGA_MAC_VER_17:
4655 case RTL_GIGA_MAC_VER_19:
4656 case RTL_GIGA_MAC_VER_20:
4657 case RTL_GIGA_MAC_VER_21:
4658 case RTL_GIGA_MAC_VER_23:
4659 case RTL_GIGA_MAC_VER_24:
4660 case RTL_GIGA_MAC_VER_27:
4661 case RTL_GIGA_MAC_VER_28:
4662 /* Experimental science. Pktgen proof. */
4663 case RTL_GIGA_MAC_VER_12:
4664 case RTL_GIGA_MAC_VER_25:
4665 if (status == RxFIFOOver)
4666 goto done;
4667 break;
4668 default:
4669 break;
4670 }
4648 } 4671 }
4649 4672
4650 if (unlikely(status & SYSErr)) { 4673 if (unlikely(status & SYSErr)) {
@@ -4680,7 +4703,7 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance)
4680 (status & RxFIFOOver) ? (status | RxOverflow) : status); 4703 (status & RxFIFOOver) ? (status | RxOverflow) : status);
4681 status = RTL_R16(IntrStatus); 4704 status = RTL_R16(IntrStatus);
4682 } 4705 }
4683 4706done:
4684 return IRQ_RETVAL(handled); 4707 return IRQ_RETVAL(handled);
4685} 4708}
4686 4709
diff --git a/drivers/net/vxge/vxge-config.c b/drivers/net/vxge/vxge-config.c
index 01c05f53e2f9..228d4f7a58af 100644
--- a/drivers/net/vxge/vxge-config.c
+++ b/drivers/net/vxge/vxge-config.c
@@ -3690,7 +3690,7 @@ __vxge_hw_vpath_rts_table_get(struct __vxge_hw_vpath_handle *vp,
3690 if (status != VXGE_HW_OK) 3690 if (status != VXGE_HW_OK)
3691 goto exit; 3691 goto exit;
3692 3692
3693 if ((rts_table != VXGE_HW_RTS_ACCESS_STEER_CTRL_DATA_STRUCT_SEL_DA) || 3693 if ((rts_table != VXGE_HW_RTS_ACCESS_STEER_CTRL_DATA_STRUCT_SEL_DA) &&
3694 (rts_table != 3694 (rts_table !=
3695 VXGE_HW_RTS_ACS_STEER_CTRL_DATA_STRUCT_SEL_RTH_MULTI_IT)) 3695 VXGE_HW_RTS_ACS_STEER_CTRL_DATA_STRUCT_SEL_RTH_MULTI_IT))
3696 *data1 = 0; 3696 *data1 = 0;
diff --git a/drivers/net/wireless/ath/ath5k/dma.c b/drivers/net/wireless/ath/ath5k/dma.c
index 0064be7ce5c9..21091c26a9a5 100644
--- a/drivers/net/wireless/ath/ath5k/dma.c
+++ b/drivers/net/wireless/ath/ath5k/dma.c
@@ -838,9 +838,9 @@ int ath5k_hw_dma_stop(struct ath5k_hw *ah)
838 for (i = 0; i < qmax; i++) { 838 for (i = 0; i < qmax; i++) {
839 err = ath5k_hw_stop_tx_dma(ah, i); 839 err = ath5k_hw_stop_tx_dma(ah, i);
840 /* -EINVAL -> queue inactive */ 840 /* -EINVAL -> queue inactive */
841 if (err != -EINVAL) 841 if (err && err != -EINVAL)
842 return err; 842 return err;
843 } 843 }
844 844
845 return err; 845 return 0;
846} 846}
diff --git a/drivers/net/wireless/ath/ath5k/pcu.c b/drivers/net/wireless/ath/ath5k/pcu.c
index e5f2b96a4c63..a702817daf72 100644
--- a/drivers/net/wireless/ath/ath5k/pcu.c
+++ b/drivers/net/wireless/ath/ath5k/pcu.c
@@ -86,7 +86,7 @@ int ath5k_hw_get_frame_duration(struct ath5k_hw *ah,
86 if (!ah->ah_bwmode) { 86 if (!ah->ah_bwmode) {
87 dur = ieee80211_generic_frame_duration(sc->hw, 87 dur = ieee80211_generic_frame_duration(sc->hw,
88 NULL, len, rate); 88 NULL, len, rate);
89 return dur; 89 return le16_to_cpu(dur);
90 } 90 }
91 91
92 bitrate = rate->bitrate; 92 bitrate = rate->bitrate;
@@ -265,8 +265,6 @@ static inline void ath5k_hw_write_rate_duration(struct ath5k_hw *ah)
265 * what rate we should choose to TX ACKs. */ 265 * what rate we should choose to TX ACKs. */
266 tx_time = ath5k_hw_get_frame_duration(ah, 10, rate); 266 tx_time = ath5k_hw_get_frame_duration(ah, 10, rate);
267 267
268 tx_time = le16_to_cpu(tx_time);
269
270 ath5k_hw_reg_write(ah, tx_time, reg); 268 ath5k_hw_reg_write(ah, tx_time, reg);
271 269
272 if (!(rate->flags & IEEE80211_RATE_SHORT_PREAMBLE)) 270 if (!(rate->flags & IEEE80211_RATE_SHORT_PREAMBLE))
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_hw.c b/drivers/net/wireless/ath/ath9k/ar9002_hw.c
index f8a7771faee2..f44c84ab5dce 100644
--- a/drivers/net/wireless/ath/ath9k/ar9002_hw.c
+++ b/drivers/net/wireless/ath/ath9k/ar9002_hw.c
@@ -426,9 +426,8 @@ static void ar9002_hw_configpcipowersave(struct ath_hw *ah,
426 } 426 }
427 427
428 /* WAR for ASPM system hang */ 428 /* WAR for ASPM system hang */
429 if (AR_SREV_9280(ah) || AR_SREV_9285(ah) || AR_SREV_9287(ah)) { 429 if (AR_SREV_9285(ah) || AR_SREV_9287(ah))
430 val |= (AR_WA_BIT6 | AR_WA_BIT7); 430 val |= (AR_WA_BIT6 | AR_WA_BIT7);
431 }
432 431
433 if (AR_SREV_9285E_20(ah)) 432 if (AR_SREV_9285E_20(ah))
434 val |= AR_WA_BIT23; 433 val |= AR_WA_BIT23;
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
index 38433f9bfe59..0352f0994caa 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
@@ -142,9 +142,6 @@ static void ath9k_deinit_priv(struct ath9k_htc_priv *priv)
142{ 142{
143 ath9k_htc_exit_debug(priv->ah); 143 ath9k_htc_exit_debug(priv->ah);
144 ath9k_hw_deinit(priv->ah); 144 ath9k_hw_deinit(priv->ah);
145 tasklet_kill(&priv->swba_tasklet);
146 tasklet_kill(&priv->rx_tasklet);
147 tasklet_kill(&priv->tx_tasklet);
148 kfree(priv->ah); 145 kfree(priv->ah);
149 priv->ah = NULL; 146 priv->ah = NULL;
150} 147}
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index f4d576bc3ccd..6bb59958f71e 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1025,12 +1025,6 @@ static void ath9k_htc_stop(struct ieee80211_hw *hw)
1025 int ret = 0; 1025 int ret = 0;
1026 u8 cmd_rsp; 1026 u8 cmd_rsp;
1027 1027
1028 /* Cancel all the running timers/work .. */
1029 cancel_work_sync(&priv->fatal_work);
1030 cancel_work_sync(&priv->ps_work);
1031 cancel_delayed_work_sync(&priv->ath9k_led_blink_work);
1032 ath9k_led_stop_brightness(priv);
1033
1034 mutex_lock(&priv->mutex); 1028 mutex_lock(&priv->mutex);
1035 1029
1036 if (priv->op_flags & OP_INVALID) { 1030 if (priv->op_flags & OP_INVALID) {
@@ -1044,8 +1038,23 @@ static void ath9k_htc_stop(struct ieee80211_hw *hw)
1044 WMI_CMD(WMI_DISABLE_INTR_CMDID); 1038 WMI_CMD(WMI_DISABLE_INTR_CMDID);
1045 WMI_CMD(WMI_DRAIN_TXQ_ALL_CMDID); 1039 WMI_CMD(WMI_DRAIN_TXQ_ALL_CMDID);
1046 WMI_CMD(WMI_STOP_RECV_CMDID); 1040 WMI_CMD(WMI_STOP_RECV_CMDID);
1041
1042 tasklet_kill(&priv->swba_tasklet);
1043 tasklet_kill(&priv->rx_tasklet);
1044 tasklet_kill(&priv->tx_tasklet);
1045
1047 skb_queue_purge(&priv->tx_queue); 1046 skb_queue_purge(&priv->tx_queue);
1048 1047
1048 mutex_unlock(&priv->mutex);
1049
1050 /* Cancel all the running timers/work .. */
1051 cancel_work_sync(&priv->fatal_work);
1052 cancel_work_sync(&priv->ps_work);
1053 cancel_delayed_work_sync(&priv->ath9k_led_blink_work);
1054 ath9k_led_stop_brightness(priv);
1055
1056 mutex_lock(&priv->mutex);
1057
1049 /* Remove monitor interface here */ 1058 /* Remove monitor interface here */
1050 if (ah->opmode == NL80211_IFTYPE_MONITOR) { 1059 if (ah->opmode == NL80211_IFTYPE_MONITOR) {
1051 if (ath9k_htc_remove_monitor_interface(priv)) 1060 if (ath9k_htc_remove_monitor_interface(priv))
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index 767d8b86f1e1..087a6a95edd5 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -598,8 +598,6 @@ err_btcoex:
598err_queues: 598err_queues:
599 ath9k_hw_deinit(ah); 599 ath9k_hw_deinit(ah);
600err_hw: 600err_hw:
601 tasklet_kill(&sc->intr_tq);
602 tasklet_kill(&sc->bcon_tasklet);
603 601
604 kfree(ah); 602 kfree(ah);
605 sc->sc_ah = NULL; 603 sc->sc_ah = NULL;
@@ -807,9 +805,6 @@ static void ath9k_deinit_softc(struct ath_softc *sc)
807 805
808 ath9k_hw_deinit(sc->sc_ah); 806 ath9k_hw_deinit(sc->sc_ah);
809 807
810 tasklet_kill(&sc->intr_tq);
811 tasklet_kill(&sc->bcon_tasklet);
812
813 kfree(sc->sc_ah); 808 kfree(sc->sc_ah);
814 sc->sc_ah = NULL; 809 sc->sc_ah = NULL;
815} 810}
@@ -824,6 +819,8 @@ void ath9k_deinit_device(struct ath_softc *sc)
824 wiphy_rfkill_stop_polling(sc->hw->wiphy); 819 wiphy_rfkill_stop_polling(sc->hw->wiphy);
825 ath_deinit_leds(sc); 820 ath_deinit_leds(sc);
826 821
822 ath9k_ps_restore(sc);
823
827 for (i = 0; i < sc->num_sec_wiphy; i++) { 824 for (i = 0; i < sc->num_sec_wiphy; i++) {
828 struct ath_wiphy *aphy = sc->sec_wiphy[i]; 825 struct ath_wiphy *aphy = sc->sec_wiphy[i];
829 if (aphy == NULL) 826 if (aphy == NULL)
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index c79c97be6cd4..9040c2ff1909 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -325,6 +325,8 @@ static bool ath_paprd_send_frame(struct ath_softc *sc, struct sk_buff *skb, int
325{ 325{
326 struct ieee80211_hw *hw = sc->hw; 326 struct ieee80211_hw *hw = sc->hw;
327 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); 327 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
328 struct ath_hw *ah = sc->sc_ah;
329 struct ath_common *common = ath9k_hw_common(ah);
328 struct ath_tx_control txctl; 330 struct ath_tx_control txctl;
329 int time_left; 331 int time_left;
330 332
@@ -342,8 +344,12 @@ static bool ath_paprd_send_frame(struct ath_softc *sc, struct sk_buff *skb, int
342 init_completion(&sc->paprd_complete); 344 init_completion(&sc->paprd_complete);
343 sc->paprd_pending = true; 345 sc->paprd_pending = true;
344 txctl.paprd = BIT(chain); 346 txctl.paprd = BIT(chain);
345 if (ath_tx_start(hw, skb, &txctl) != 0) 347
348 if (ath_tx_start(hw, skb, &txctl) != 0) {
349 ath_dbg(common, ATH_DBG_XMIT, "PAPRD TX failed\n");
350 dev_kfree_skb_any(skb);
346 return false; 351 return false;
352 }
347 353
348 time_left = wait_for_completion_timeout(&sc->paprd_complete, 354 time_left = wait_for_completion_timeout(&sc->paprd_complete,
349 msecs_to_jiffies(ATH_PAPRD_TIMEOUT)); 355 msecs_to_jiffies(ATH_PAPRD_TIMEOUT));
@@ -953,8 +959,6 @@ void ath_radio_disable(struct ath_softc *sc, struct ieee80211_hw *hw)
953 959
954 spin_unlock_bh(&sc->sc_pcu_lock); 960 spin_unlock_bh(&sc->sc_pcu_lock);
955 ath9k_ps_restore(sc); 961 ath9k_ps_restore(sc);
956
957 ath9k_setpower(sc, ATH9K_PM_FULL_SLEEP);
958} 962}
959 963
960int ath_reset(struct ath_softc *sc, bool retry_tx) 964int ath_reset(struct ath_softc *sc, bool retry_tx)
@@ -1309,6 +1313,9 @@ static void ath9k_stop(struct ieee80211_hw *hw)
1309 1313
1310 spin_lock_bh(&sc->sc_pcu_lock); 1314 spin_lock_bh(&sc->sc_pcu_lock);
1311 1315
1316 /* prevent tasklets to enable interrupts once we disable them */
1317 ah->imask &= ~ATH9K_INT_GLOBAL;
1318
1312 /* make sure h/w will not generate any interrupt 1319 /* make sure h/w will not generate any interrupt
1313 * before setting the invalid flag. */ 1320 * before setting the invalid flag. */
1314 ath9k_hw_disable_interrupts(ah); 1321 ath9k_hw_disable_interrupts(ah);
@@ -1326,6 +1333,12 @@ static void ath9k_stop(struct ieee80211_hw *hw)
1326 1333
1327 spin_unlock_bh(&sc->sc_pcu_lock); 1334 spin_unlock_bh(&sc->sc_pcu_lock);
1328 1335
1336 /* we can now sync irq and kill any running tasklets, since we already
1337 * disabled interrupts and not holding a spin lock */
1338 synchronize_irq(sc->irq);
1339 tasklet_kill(&sc->intr_tq);
1340 tasklet_kill(&sc->bcon_tasklet);
1341
1329 ath9k_ps_restore(sc); 1342 ath9k_ps_restore(sc);
1330 1343
1331 sc->ps_idle = true; 1344 sc->ps_idle = true;
diff --git a/drivers/net/wireless/rtlwifi/efuse.c b/drivers/net/wireless/rtlwifi/efuse.c
index b8433f3a9bc2..62876cd5c41a 100644
--- a/drivers/net/wireless/rtlwifi/efuse.c
+++ b/drivers/net/wireless/rtlwifi/efuse.c
@@ -726,9 +726,9 @@ static int efuse_pg_packet_read(struct ieee80211_hw *hw, u8 offset, u8 *data)
726} 726}
727 727
728static void efuse_write_data_case1(struct ieee80211_hw *hw, u16 *efuse_addr, 728static void efuse_write_data_case1(struct ieee80211_hw *hw, u16 *efuse_addr,
729 u8 efuse_data, u8 offset, int *bcontinual, 729 u8 efuse_data, u8 offset, int *bcontinual,
730 u8 *write_state, struct pgpkt_struct target_pkt, 730 u8 *write_state, struct pgpkt_struct *target_pkt,
731 int *repeat_times, int *bresult, u8 word_en) 731 int *repeat_times, int *bresult, u8 word_en)
732{ 732{
733 struct rtl_priv *rtlpriv = rtl_priv(hw); 733 struct rtl_priv *rtlpriv = rtl_priv(hw);
734 struct pgpkt_struct tmp_pkt; 734 struct pgpkt_struct tmp_pkt;
@@ -744,8 +744,8 @@ static void efuse_write_data_case1(struct ieee80211_hw *hw, u16 *efuse_addr,
744 tmp_pkt.word_en = tmp_header & 0x0F; 744 tmp_pkt.word_en = tmp_header & 0x0F;
745 tmp_word_cnts = efuse_calculate_word_cnts(tmp_pkt.word_en); 745 tmp_word_cnts = efuse_calculate_word_cnts(tmp_pkt.word_en);
746 746
747 if (tmp_pkt.offset != target_pkt.offset) { 747 if (tmp_pkt.offset != target_pkt->offset) {
748 efuse_addr = efuse_addr + (tmp_word_cnts * 2) + 1; 748 *efuse_addr = *efuse_addr + (tmp_word_cnts * 2) + 1;
749 *write_state = PG_STATE_HEADER; 749 *write_state = PG_STATE_HEADER;
750 } else { 750 } else {
751 for (tmpindex = 0; tmpindex < (tmp_word_cnts * 2); tmpindex++) { 751 for (tmpindex = 0; tmpindex < (tmp_word_cnts * 2); tmpindex++) {
@@ -756,23 +756,23 @@ static void efuse_write_data_case1(struct ieee80211_hw *hw, u16 *efuse_addr,
756 } 756 }
757 757
758 if (bdataempty == false) { 758 if (bdataempty == false) {
759 efuse_addr = efuse_addr + (tmp_word_cnts * 2) + 1; 759 *efuse_addr = *efuse_addr + (tmp_word_cnts * 2) + 1;
760 *write_state = PG_STATE_HEADER; 760 *write_state = PG_STATE_HEADER;
761 } else { 761 } else {
762 match_word_en = 0x0F; 762 match_word_en = 0x0F;
763 if (!((target_pkt.word_en & BIT(0)) | 763 if (!((target_pkt->word_en & BIT(0)) |
764 (tmp_pkt.word_en & BIT(0)))) 764 (tmp_pkt.word_en & BIT(0))))
765 match_word_en &= (~BIT(0)); 765 match_word_en &= (~BIT(0));
766 766
767 if (!((target_pkt.word_en & BIT(1)) | 767 if (!((target_pkt->word_en & BIT(1)) |
768 (tmp_pkt.word_en & BIT(1)))) 768 (tmp_pkt.word_en & BIT(1))))
769 match_word_en &= (~BIT(1)); 769 match_word_en &= (~BIT(1));
770 770
771 if (!((target_pkt.word_en & BIT(2)) | 771 if (!((target_pkt->word_en & BIT(2)) |
772 (tmp_pkt.word_en & BIT(2)))) 772 (tmp_pkt.word_en & BIT(2))))
773 match_word_en &= (~BIT(2)); 773 match_word_en &= (~BIT(2));
774 774
775 if (!((target_pkt.word_en & BIT(3)) | 775 if (!((target_pkt->word_en & BIT(3)) |
776 (tmp_pkt.word_en & BIT(3)))) 776 (tmp_pkt.word_en & BIT(3))))
777 match_word_en &= (~BIT(3)); 777 match_word_en &= (~BIT(3));
778 778
@@ -780,7 +780,7 @@ static void efuse_write_data_case1(struct ieee80211_hw *hw, u16 *efuse_addr,
780 badworden = efuse_word_enable_data_write( 780 badworden = efuse_word_enable_data_write(
781 hw, *efuse_addr + 1, 781 hw, *efuse_addr + 1,
782 tmp_pkt.word_en, 782 tmp_pkt.word_en,
783 target_pkt.data); 783 target_pkt->data);
784 784
785 if (0x0F != (badworden & 0x0F)) { 785 if (0x0F != (badworden & 0x0F)) {
786 u8 reorg_offset = offset; 786 u8 reorg_offset = offset;
@@ -791,26 +791,26 @@ static void efuse_write_data_case1(struct ieee80211_hw *hw, u16 *efuse_addr,
791 } 791 }
792 792
793 tmp_word_en = 0x0F; 793 tmp_word_en = 0x0F;
794 if ((target_pkt.word_en & BIT(0)) ^ 794 if ((target_pkt->word_en & BIT(0)) ^
795 (match_word_en & BIT(0))) 795 (match_word_en & BIT(0)))
796 tmp_word_en &= (~BIT(0)); 796 tmp_word_en &= (~BIT(0));
797 797
798 if ((target_pkt.word_en & BIT(1)) ^ 798 if ((target_pkt->word_en & BIT(1)) ^
799 (match_word_en & BIT(1))) 799 (match_word_en & BIT(1)))
800 tmp_word_en &= (~BIT(1)); 800 tmp_word_en &= (~BIT(1));
801 801
802 if ((target_pkt.word_en & BIT(2)) ^ 802 if ((target_pkt->word_en & BIT(2)) ^
803 (match_word_en & BIT(2))) 803 (match_word_en & BIT(2)))
804 tmp_word_en &= (~BIT(2)); 804 tmp_word_en &= (~BIT(2));
805 805
806 if ((target_pkt.word_en & BIT(3)) ^ 806 if ((target_pkt->word_en & BIT(3)) ^
807 (match_word_en & BIT(3))) 807 (match_word_en & BIT(3)))
808 tmp_word_en &= (~BIT(3)); 808 tmp_word_en &= (~BIT(3));
809 809
810 if ((tmp_word_en & 0x0F) != 0x0F) { 810 if ((tmp_word_en & 0x0F) != 0x0F) {
811 *efuse_addr = efuse_get_current_size(hw); 811 *efuse_addr = efuse_get_current_size(hw);
812 target_pkt.offset = offset; 812 target_pkt->offset = offset;
813 target_pkt.word_en = tmp_word_en; 813 target_pkt->word_en = tmp_word_en;
814 } else 814 } else
815 *bcontinual = false; 815 *bcontinual = false;
816 *write_state = PG_STATE_HEADER; 816 *write_state = PG_STATE_HEADER;
@@ -821,8 +821,8 @@ static void efuse_write_data_case1(struct ieee80211_hw *hw, u16 *efuse_addr,
821 } 821 }
822 } else { 822 } else {
823 *efuse_addr += (2 * tmp_word_cnts) + 1; 823 *efuse_addr += (2 * tmp_word_cnts) + 1;
824 target_pkt.offset = offset; 824 target_pkt->offset = offset;
825 target_pkt.word_en = word_en; 825 target_pkt->word_en = word_en;
826 *write_state = PG_STATE_HEADER; 826 *write_state = PG_STATE_HEADER;
827 } 827 }
828 } 828 }
@@ -938,7 +938,7 @@ static int efuse_pg_packet_write(struct ieee80211_hw *hw,
938 efuse_write_data_case1(hw, &efuse_addr, 938 efuse_write_data_case1(hw, &efuse_addr,
939 efuse_data, offset, 939 efuse_data, offset,
940 &bcontinual, 940 &bcontinual,
941 &write_state, target_pkt, 941 &write_state, &target_pkt,
942 &repeat_times, &bresult, 942 &repeat_times, &bresult,
943 word_en); 943 word_en);
944 else 944 else
diff --git a/drivers/net/wireless/wl12xx/spi.c b/drivers/net/wireless/wl12xx/spi.c
index 46714910f98c..7145ea543783 100644
--- a/drivers/net/wireless/wl12xx/spi.c
+++ b/drivers/net/wireless/wl12xx/spi.c
@@ -110,9 +110,8 @@ static void wl1271_spi_reset(struct wl1271 *wl)
110 spi_message_add_tail(&t, &m); 110 spi_message_add_tail(&t, &m);
111 111
112 spi_sync(wl_to_spi(wl), &m); 112 spi_sync(wl_to_spi(wl), &m);
113 kfree(cmd);
114
115 wl1271_dump(DEBUG_SPI, "spi reset -> ", cmd, WSPI_INIT_CMD_LEN); 113 wl1271_dump(DEBUG_SPI, "spi reset -> ", cmd, WSPI_INIT_CMD_LEN);
114 kfree(cmd);
116} 115}
117 116
118static void wl1271_spi_init(struct wl1271 *wl) 117static void wl1271_spi_init(struct wl1271 *wl)
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 546de5749824..da1f12120346 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -120,6 +120,9 @@ struct netfront_info {
120 unsigned long rx_pfn_array[NET_RX_RING_SIZE]; 120 unsigned long rx_pfn_array[NET_RX_RING_SIZE];
121 struct multicall_entry rx_mcl[NET_RX_RING_SIZE+1]; 121 struct multicall_entry rx_mcl[NET_RX_RING_SIZE+1];
122 struct mmu_update rx_mmu[NET_RX_RING_SIZE]; 122 struct mmu_update rx_mmu[NET_RX_RING_SIZE];
123
124 /* Statistics */
125 int rx_gso_checksum_fixup;
123}; 126};
124 127
125struct netfront_rx_info { 128struct netfront_rx_info {
@@ -770,11 +773,29 @@ static RING_IDX xennet_fill_frags(struct netfront_info *np,
770 return cons; 773 return cons;
771} 774}
772 775
773static int skb_checksum_setup(struct sk_buff *skb) 776static int checksum_setup(struct net_device *dev, struct sk_buff *skb)
774{ 777{
775 struct iphdr *iph; 778 struct iphdr *iph;
776 unsigned char *th; 779 unsigned char *th;
777 int err = -EPROTO; 780 int err = -EPROTO;
781 int recalculate_partial_csum = 0;
782
783 /*
784 * A GSO SKB must be CHECKSUM_PARTIAL. However some buggy
785 * peers can fail to set NETRXF_csum_blank when sending a GSO
786 * frame. In this case force the SKB to CHECKSUM_PARTIAL and
787 * recalculate the partial checksum.
788 */
789 if (skb->ip_summed != CHECKSUM_PARTIAL && skb_is_gso(skb)) {
790 struct netfront_info *np = netdev_priv(dev);
791 np->rx_gso_checksum_fixup++;
792 skb->ip_summed = CHECKSUM_PARTIAL;
793 recalculate_partial_csum = 1;
794 }
795
796 /* A non-CHECKSUM_PARTIAL SKB does not require setup. */
797 if (skb->ip_summed != CHECKSUM_PARTIAL)
798 return 0;
778 799
779 if (skb->protocol != htons(ETH_P_IP)) 800 if (skb->protocol != htons(ETH_P_IP))
780 goto out; 801 goto out;
@@ -788,9 +809,23 @@ static int skb_checksum_setup(struct sk_buff *skb)
788 switch (iph->protocol) { 809 switch (iph->protocol) {
789 case IPPROTO_TCP: 810 case IPPROTO_TCP:
790 skb->csum_offset = offsetof(struct tcphdr, check); 811 skb->csum_offset = offsetof(struct tcphdr, check);
812
813 if (recalculate_partial_csum) {
814 struct tcphdr *tcph = (struct tcphdr *)th;
815 tcph->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr,
816 skb->len - iph->ihl*4,
817 IPPROTO_TCP, 0);
818 }
791 break; 819 break;
792 case IPPROTO_UDP: 820 case IPPROTO_UDP:
793 skb->csum_offset = offsetof(struct udphdr, check); 821 skb->csum_offset = offsetof(struct udphdr, check);
822
823 if (recalculate_partial_csum) {
824 struct udphdr *udph = (struct udphdr *)th;
825 udph->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr,
826 skb->len - iph->ihl*4,
827 IPPROTO_UDP, 0);
828 }
794 break; 829 break;
795 default: 830 default:
796 if (net_ratelimit()) 831 if (net_ratelimit())
@@ -829,13 +864,11 @@ static int handle_incoming_queue(struct net_device *dev,
829 /* Ethernet work: Delayed to here as it peeks the header. */ 864 /* Ethernet work: Delayed to here as it peeks the header. */
830 skb->protocol = eth_type_trans(skb, dev); 865 skb->protocol = eth_type_trans(skb, dev);
831 866
832 if (skb->ip_summed == CHECKSUM_PARTIAL) { 867 if (checksum_setup(dev, skb)) {
833 if (skb_checksum_setup(skb)) { 868 kfree_skb(skb);
834 kfree_skb(skb); 869 packets_dropped++;
835 packets_dropped++; 870 dev->stats.rx_errors++;
836 dev->stats.rx_errors++; 871 continue;
837 continue;
838 }
839 } 872 }
840 873
841 dev->stats.rx_packets++; 874 dev->stats.rx_packets++;
@@ -1632,12 +1665,59 @@ static void netback_changed(struct xenbus_device *dev,
1632 } 1665 }
1633} 1666}
1634 1667
1668static const struct xennet_stat {
1669 char name[ETH_GSTRING_LEN];
1670 u16 offset;
1671} xennet_stats[] = {
1672 {
1673 "rx_gso_checksum_fixup",
1674 offsetof(struct netfront_info, rx_gso_checksum_fixup)
1675 },
1676};
1677
1678static int xennet_get_sset_count(struct net_device *dev, int string_set)
1679{
1680 switch (string_set) {
1681 case ETH_SS_STATS:
1682 return ARRAY_SIZE(xennet_stats);
1683 default:
1684 return -EINVAL;
1685 }
1686}
1687
1688static void xennet_get_ethtool_stats(struct net_device *dev,
1689 struct ethtool_stats *stats, u64 * data)
1690{
1691 void *np = netdev_priv(dev);
1692 int i;
1693
1694 for (i = 0; i < ARRAY_SIZE(xennet_stats); i++)
1695 data[i] = *(int *)(np + xennet_stats[i].offset);
1696}
1697
1698static void xennet_get_strings(struct net_device *dev, u32 stringset, u8 * data)
1699{
1700 int i;
1701
1702 switch (stringset) {
1703 case ETH_SS_STATS:
1704 for (i = 0; i < ARRAY_SIZE(xennet_stats); i++)
1705 memcpy(data + i * ETH_GSTRING_LEN,
1706 xennet_stats[i].name, ETH_GSTRING_LEN);
1707 break;
1708 }
1709}
1710
1635static const struct ethtool_ops xennet_ethtool_ops = 1711static const struct ethtool_ops xennet_ethtool_ops =
1636{ 1712{
1637 .set_tx_csum = ethtool_op_set_tx_csum, 1713 .set_tx_csum = ethtool_op_set_tx_csum,
1638 .set_sg = xennet_set_sg, 1714 .set_sg = xennet_set_sg,
1639 .set_tso = xennet_set_tso, 1715 .set_tso = xennet_set_tso,
1640 .get_link = ethtool_op_get_link, 1716 .get_link = ethtool_op_get_link,
1717
1718 .get_sset_count = xennet_get_sset_count,
1719 .get_ethtool_stats = xennet_get_ethtool_stats,
1720 .get_strings = xennet_get_strings,
1641}; 1721};
1642 1722
1643#ifdef CONFIG_SYSFS 1723#ifdef CONFIG_SYSFS
diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c
index 65ebee0a3266..b6a6356d09b3 100644
--- a/drivers/s390/net/netiucv.c
+++ b/drivers/s390/net/netiucv.c
@@ -565,7 +565,7 @@ static int netiucv_callback_connreq(struct iucv_path *path,
565 struct iucv_event ev; 565 struct iucv_event ev;
566 int rc; 566 int rc;
567 567
568 if (memcmp(iucvMagic, ipuser, sizeof(ipuser))) 568 if (memcmp(iucvMagic, ipuser, 16))
569 /* ipuser must match iucvMagic. */ 569 /* ipuser must match iucvMagic. */
570 return -EINVAL; 570 return -EINVAL;
571 rc = -EINVAL; 571 rc = -EINVAL;
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 29f848bfc12f..019ae58ab913 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -988,16 +988,30 @@ static void qeth_get_channel_path_desc(struct qeth_card *card)
988 chp_dsc = (struct channelPath_dsc *)ccw_device_get_chp_desc(ccwdev, 0); 988 chp_dsc = (struct channelPath_dsc *)ccw_device_get_chp_desc(ccwdev, 0);
989 if (chp_dsc != NULL) { 989 if (chp_dsc != NULL) {
990 /* CHPP field bit 6 == 1 -> single queue */ 990 /* CHPP field bit 6 == 1 -> single queue */
991 if ((chp_dsc->chpp & 0x02) == 0x02) 991 if ((chp_dsc->chpp & 0x02) == 0x02) {
992 if ((atomic_read(&card->qdio.state) !=
993 QETH_QDIO_UNINITIALIZED) &&
994 (card->qdio.no_out_queues == 4))
995 /* change from 4 to 1 outbound queues */
996 qeth_free_qdio_buffers(card);
992 card->qdio.no_out_queues = 1; 997 card->qdio.no_out_queues = 1;
998 if (card->qdio.default_out_queue != 0)
999 dev_info(&card->gdev->dev,
1000 "Priority Queueing not supported\n");
1001 card->qdio.default_out_queue = 0;
1002 } else {
1003 if ((atomic_read(&card->qdio.state) !=
1004 QETH_QDIO_UNINITIALIZED) &&
1005 (card->qdio.no_out_queues == 1)) {
1006 /* change from 1 to 4 outbound queues */
1007 qeth_free_qdio_buffers(card);
1008 card->qdio.default_out_queue = 2;
1009 }
1010 card->qdio.no_out_queues = 4;
1011 }
993 card->info.func_level = 0x4100 + chp_dsc->desc; 1012 card->info.func_level = 0x4100 + chp_dsc->desc;
994 kfree(chp_dsc); 1013 kfree(chp_dsc);
995 } 1014 }
996 if (card->qdio.no_out_queues == 1) {
997 card->qdio.default_out_queue = 0;
998 dev_info(&card->gdev->dev,
999 "Priority Queueing not supported\n");
1000 }
1001 QETH_DBF_TEXT_(SETUP, 2, "nr:%x", card->qdio.no_out_queues); 1015 QETH_DBF_TEXT_(SETUP, 2, "nr:%x", card->qdio.no_out_queues);
1002 QETH_DBF_TEXT_(SETUP, 2, "lvl:%02x", card->info.func_level); 1016 QETH_DBF_TEXT_(SETUP, 2, "lvl:%02x", card->info.func_level);
1003 return; 1017 return;
@@ -1832,33 +1846,6 @@ static inline int qeth_get_initial_mtu_for_card(struct qeth_card *card)
1832 } 1846 }
1833} 1847}
1834 1848
1835static inline int qeth_get_max_mtu_for_card(int cardtype)
1836{
1837 switch (cardtype) {
1838
1839 case QETH_CARD_TYPE_UNKNOWN:
1840 case QETH_CARD_TYPE_OSD:
1841 case QETH_CARD_TYPE_OSN:
1842 case QETH_CARD_TYPE_OSM:
1843 case QETH_CARD_TYPE_OSX:
1844 return 61440;
1845 case QETH_CARD_TYPE_IQD:
1846 return 57344;
1847 default:
1848 return 1500;
1849 }
1850}
1851
1852static inline int qeth_get_mtu_out_of_mpc(int cardtype)
1853{
1854 switch (cardtype) {
1855 case QETH_CARD_TYPE_IQD:
1856 return 1;
1857 default:
1858 return 0;
1859 }
1860}
1861
1862static inline int qeth_get_mtu_outof_framesize(int framesize) 1849static inline int qeth_get_mtu_outof_framesize(int framesize)
1863{ 1850{
1864 switch (framesize) { 1851 switch (framesize) {
@@ -1881,10 +1868,9 @@ static inline int qeth_mtu_is_valid(struct qeth_card *card, int mtu)
1881 case QETH_CARD_TYPE_OSD: 1868 case QETH_CARD_TYPE_OSD:
1882 case QETH_CARD_TYPE_OSM: 1869 case QETH_CARD_TYPE_OSM:
1883 case QETH_CARD_TYPE_OSX: 1870 case QETH_CARD_TYPE_OSX:
1884 return ((mtu >= 576) && (mtu <= 61440));
1885 case QETH_CARD_TYPE_IQD: 1871 case QETH_CARD_TYPE_IQD:
1886 return ((mtu >= 576) && 1872 return ((mtu >= 576) &&
1887 (mtu <= card->info.max_mtu + 4096 - 32)); 1873 (mtu <= card->info.max_mtu));
1888 case QETH_CARD_TYPE_OSN: 1874 case QETH_CARD_TYPE_OSN:
1889 case QETH_CARD_TYPE_UNKNOWN: 1875 case QETH_CARD_TYPE_UNKNOWN:
1890 default: 1876 default:
@@ -1907,7 +1893,7 @@ static int qeth_ulp_enable_cb(struct qeth_card *card, struct qeth_reply *reply,
1907 memcpy(&card->token.ulp_filter_r, 1893 memcpy(&card->token.ulp_filter_r,
1908 QETH_ULP_ENABLE_RESP_FILTER_TOKEN(iob->data), 1894 QETH_ULP_ENABLE_RESP_FILTER_TOKEN(iob->data),
1909 QETH_MPC_TOKEN_LENGTH); 1895 QETH_MPC_TOKEN_LENGTH);
1910 if (qeth_get_mtu_out_of_mpc(card->info.type)) { 1896 if (card->info.type == QETH_CARD_TYPE_IQD) {
1911 memcpy(&framesize, QETH_ULP_ENABLE_RESP_MAX_MTU(iob->data), 2); 1897 memcpy(&framesize, QETH_ULP_ENABLE_RESP_MAX_MTU(iob->data), 2);
1912 mtu = qeth_get_mtu_outof_framesize(framesize); 1898 mtu = qeth_get_mtu_outof_framesize(framesize);
1913 if (!mtu) { 1899 if (!mtu) {
@@ -1915,12 +1901,21 @@ static int qeth_ulp_enable_cb(struct qeth_card *card, struct qeth_reply *reply,
1915 QETH_DBF_TEXT_(SETUP, 2, " rc%d", iob->rc); 1901 QETH_DBF_TEXT_(SETUP, 2, " rc%d", iob->rc);
1916 return 0; 1902 return 0;
1917 } 1903 }
1918 card->info.max_mtu = mtu; 1904 if (card->info.initial_mtu && (card->info.initial_mtu != mtu)) {
1905 /* frame size has changed */
1906 if (card->dev &&
1907 ((card->dev->mtu == card->info.initial_mtu) ||
1908 (card->dev->mtu > mtu)))
1909 card->dev->mtu = mtu;
1910 qeth_free_qdio_buffers(card);
1911 }
1919 card->info.initial_mtu = mtu; 1912 card->info.initial_mtu = mtu;
1913 card->info.max_mtu = mtu;
1920 card->qdio.in_buf_size = mtu + 2 * PAGE_SIZE; 1914 card->qdio.in_buf_size = mtu + 2 * PAGE_SIZE;
1921 } else { 1915 } else {
1922 card->info.initial_mtu = qeth_get_initial_mtu_for_card(card); 1916 card->info.initial_mtu = qeth_get_initial_mtu_for_card(card);
1923 card->info.max_mtu = qeth_get_max_mtu_for_card(card->info.type); 1917 card->info.max_mtu = *(__u16 *)QETH_ULP_ENABLE_RESP_MAX_MTU(
1918 iob->data);
1924 card->qdio.in_buf_size = QETH_IN_BUF_SIZE_DEFAULT; 1919 card->qdio.in_buf_size = QETH_IN_BUF_SIZE_DEFAULT;
1925 } 1920 }
1926 1921
@@ -3775,6 +3770,47 @@ static inline int qeth_get_qdio_q_format(struct qeth_card *card)
3775 } 3770 }
3776} 3771}
3777 3772
3773static void qeth_determine_capabilities(struct qeth_card *card)
3774{
3775 int rc;
3776 int length;
3777 char *prcd;
3778 struct ccw_device *ddev;
3779 int ddev_offline = 0;
3780
3781 QETH_DBF_TEXT(SETUP, 2, "detcapab");
3782 ddev = CARD_DDEV(card);
3783 if (!ddev->online) {
3784 ddev_offline = 1;
3785 rc = ccw_device_set_online(ddev);
3786 if (rc) {
3787 QETH_DBF_TEXT_(SETUP, 2, "3err%d", rc);
3788 goto out;
3789 }
3790 }
3791
3792 rc = qeth_read_conf_data(card, (void **) &prcd, &length);
3793 if (rc) {
3794 QETH_DBF_MESSAGE(2, "%s qeth_read_conf_data returned %i\n",
3795 dev_name(&card->gdev->dev), rc);
3796 QETH_DBF_TEXT_(SETUP, 2, "5err%d", rc);
3797 goto out_offline;
3798 }
3799 qeth_configure_unitaddr(card, prcd);
3800 qeth_configure_blkt_default(card, prcd);
3801 kfree(prcd);
3802
3803 rc = qdio_get_ssqd_desc(ddev, &card->ssqd);
3804 if (rc)
3805 QETH_DBF_TEXT_(SETUP, 2, "6err%d", rc);
3806
3807out_offline:
3808 if (ddev_offline == 1)
3809 ccw_device_set_offline(ddev);
3810out:
3811 return;
3812}
3813
3778static int qeth_qdio_establish(struct qeth_card *card) 3814static int qeth_qdio_establish(struct qeth_card *card)
3779{ 3815{
3780 struct qdio_initialize init_data; 3816 struct qdio_initialize init_data;
@@ -3905,6 +3941,7 @@ int qeth_core_hardsetup_card(struct qeth_card *card)
3905 3941
3906 QETH_DBF_TEXT(SETUP, 2, "hrdsetup"); 3942 QETH_DBF_TEXT(SETUP, 2, "hrdsetup");
3907 atomic_set(&card->force_alloc_skb, 0); 3943 atomic_set(&card->force_alloc_skb, 0);
3944 qeth_get_channel_path_desc(card);
3908retry: 3945retry:
3909 if (retries) 3946 if (retries)
3910 QETH_DBF_MESSAGE(2, "%s Retrying to do IDX activates.\n", 3947 QETH_DBF_MESSAGE(2, "%s Retrying to do IDX activates.\n",
@@ -3933,6 +3970,7 @@ retriable:
3933 else 3970 else
3934 goto retry; 3971 goto retry;
3935 } 3972 }
3973 qeth_determine_capabilities(card);
3936 qeth_init_tokens(card); 3974 qeth_init_tokens(card);
3937 qeth_init_func_level(card); 3975 qeth_init_func_level(card);
3938 rc = qeth_idx_activate_channel(&card->read, qeth_idx_read_cb); 3976 rc = qeth_idx_activate_channel(&card->read, qeth_idx_read_cb);
@@ -4202,41 +4240,6 @@ void qeth_core_free_discipline(struct qeth_card *card)
4202 card->discipline.ccwgdriver = NULL; 4240 card->discipline.ccwgdriver = NULL;
4203} 4241}
4204 4242
4205static void qeth_determine_capabilities(struct qeth_card *card)
4206{
4207 int rc;
4208 int length;
4209 char *prcd;
4210
4211 QETH_DBF_TEXT(SETUP, 2, "detcapab");
4212 rc = ccw_device_set_online(CARD_DDEV(card));
4213 if (rc) {
4214 QETH_DBF_TEXT_(SETUP, 2, "3err%d", rc);
4215 goto out;
4216 }
4217
4218
4219 rc = qeth_read_conf_data(card, (void **) &prcd, &length);
4220 if (rc) {
4221 QETH_DBF_MESSAGE(2, "%s qeth_read_conf_data returned %i\n",
4222 dev_name(&card->gdev->dev), rc);
4223 QETH_DBF_TEXT_(SETUP, 2, "5err%d", rc);
4224 goto out_offline;
4225 }
4226 qeth_configure_unitaddr(card, prcd);
4227 qeth_configure_blkt_default(card, prcd);
4228 kfree(prcd);
4229
4230 rc = qdio_get_ssqd_desc(CARD_DDEV(card), &card->ssqd);
4231 if (rc)
4232 QETH_DBF_TEXT_(SETUP, 2, "6err%d", rc);
4233
4234out_offline:
4235 ccw_device_set_offline(CARD_DDEV(card));
4236out:
4237 return;
4238}
4239
4240static int qeth_core_probe_device(struct ccwgroup_device *gdev) 4243static int qeth_core_probe_device(struct ccwgroup_device *gdev)
4241{ 4244{
4242 struct qeth_card *card; 4245 struct qeth_card *card;
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index 2ac8f6aff5a4..ada0fe782373 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -573,13 +573,13 @@ static int qeth_l2_send_setmac_cb(struct qeth_card *card,
573 case IPA_RC_L2_DUP_LAYER3_MAC: 573 case IPA_RC_L2_DUP_LAYER3_MAC:
574 dev_warn(&card->gdev->dev, 574 dev_warn(&card->gdev->dev,
575 "MAC address %pM already exists\n", 575 "MAC address %pM already exists\n",
576 card->dev->dev_addr); 576 cmd->data.setdelmac.mac);
577 break; 577 break;
578 case IPA_RC_L2_MAC_NOT_AUTH_BY_HYP: 578 case IPA_RC_L2_MAC_NOT_AUTH_BY_HYP:
579 case IPA_RC_L2_MAC_NOT_AUTH_BY_ADP: 579 case IPA_RC_L2_MAC_NOT_AUTH_BY_ADP:
580 dev_warn(&card->gdev->dev, 580 dev_warn(&card->gdev->dev,
581 "MAC address %pM is not authorized\n", 581 "MAC address %pM is not authorized\n",
582 card->dev->dev_addr); 582 cmd->data.setdelmac.mac);
583 break; 583 break;
584 default: 584 default:
585 break; 585 break;
diff --git a/drivers/s390/net/smsgiucv.c b/drivers/s390/net/smsgiucv.c
index 65e1cf104943..207b7d742443 100644
--- a/drivers/s390/net/smsgiucv.c
+++ b/drivers/s390/net/smsgiucv.c
@@ -60,7 +60,7 @@ static struct iucv_handler smsg_handler = {
60static int smsg_path_pending(struct iucv_path *path, u8 ipvmid[8], 60static int smsg_path_pending(struct iucv_path *path, u8 ipvmid[8],
61 u8 ipuser[16]) 61 u8 ipuser[16])
62{ 62{
63 if (strncmp(ipvmid, "*MSG ", sizeof(ipvmid)) != 0) 63 if (strncmp(ipvmid, "*MSG ", 8) != 0)
64 return -EINVAL; 64 return -EINVAL;
65 /* Path pending from *MSG. */ 65 /* Path pending from *MSG. */
66 return iucv_path_accept(path, &smsg_handler, "SMSGIUCV ", NULL); 66 return iucv_path_accept(path, &smsg_handler, "SMSGIUCV ", NULL);
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 9b3ca103135f..f616cefc95ba 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -128,8 +128,7 @@ static void handle_tx(struct vhost_net *net)
128 size_t hdr_size; 128 size_t hdr_size;
129 struct socket *sock; 129 struct socket *sock;
130 130
131 /* TODO: check that we are running from vhost_worker? 131 /* TODO: check that we are running from vhost_worker? */
132 * Not sure it's worth it, it's straight-forward enough. */
133 sock = rcu_dereference_check(vq->private_data, 1); 132 sock = rcu_dereference_check(vq->private_data, 1);
134 if (!sock) 133 if (!sock)
135 return; 134 return;
@@ -306,7 +305,8 @@ static void handle_rx_big(struct vhost_net *net)
306 size_t len, total_len = 0; 305 size_t len, total_len = 0;
307 int err; 306 int err;
308 size_t hdr_size; 307 size_t hdr_size;
309 struct socket *sock = rcu_dereference(vq->private_data); 308 /* TODO: check that we are running from vhost_worker? */
309 struct socket *sock = rcu_dereference_check(vq->private_data, 1);
310 if (!sock || skb_queue_empty(&sock->sk->sk_receive_queue)) 310 if (!sock || skb_queue_empty(&sock->sk->sk_receive_queue))
311 return; 311 return;
312 312
@@ -415,7 +415,8 @@ static void handle_rx_mergeable(struct vhost_net *net)
415 int err, headcount; 415 int err, headcount;
416 size_t vhost_hlen, sock_hlen; 416 size_t vhost_hlen, sock_hlen;
417 size_t vhost_len, sock_len; 417 size_t vhost_len, sock_len;
418 struct socket *sock = rcu_dereference(vq->private_data); 418 /* TODO: check that we are running from vhost_worker? */
419 struct socket *sock = rcu_dereference_check(vq->private_data, 1);
419 if (!sock || skb_queue_empty(&sock->sk->sk_receive_queue)) 420 if (!sock || skb_queue_empty(&sock->sk->sk_receive_queue))
420 return; 421 return;
421 422
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
index 2af44b7b1f3f..b3363ae38518 100644
--- a/drivers/vhost/vhost.h
+++ b/drivers/vhost/vhost.h
@@ -173,9 +173,9 @@ static inline int vhost_has_feature(struct vhost_dev *dev, int bit)
173{ 173{
174 unsigned acked_features; 174 unsigned acked_features;
175 175
176 acked_features = 176 /* TODO: check that we are running from vhost_worker or dev mutex is
177 rcu_dereference_index_check(dev->acked_features, 177 * held? */
178 lockdep_is_held(&dev->mutex)); 178 acked_features = rcu_dereference_index_check(dev->acked_features, 1);
179 return acked_features & (1 << bit); 179 return acked_features & (1 << bit);
180} 180}
181 181
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 2296d8b1931f..b0ada6f37dd6 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -1,5 +1,6 @@
1header-y += byteorder/ 1header-y += byteorder/
2header-y += can/ 2header-y += can/
3header-y += caif/
3header-y += dvb/ 4header-y += dvb/
4header-y += hdlc/ 5header-y += hdlc/
5header-y += isdn/ 6header-y += isdn/
diff --git a/include/linux/caif/Kbuild b/include/linux/caif/Kbuild
new file mode 100644
index 000000000000..a9cf250689dc
--- /dev/null
+++ b/include/linux/caif/Kbuild
@@ -0,0 +1,2 @@
1header-y += caif_socket.h
2header-y += if_caif.h
diff --git a/include/linux/mroute.h b/include/linux/mroute.h
index 0fa7a3a874c8..b21d567692b2 100644
--- a/include/linux/mroute.h
+++ b/include/linux/mroute.h
@@ -150,6 +150,7 @@ static inline int ip_mroute_opt(int opt)
150extern int ip_mroute_setsockopt(struct sock *, int, char __user *, unsigned int); 150extern int ip_mroute_setsockopt(struct sock *, int, char __user *, unsigned int);
151extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *); 151extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
152extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg); 152extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg);
153extern int ipmr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg);
153extern int ip_mr_init(void); 154extern int ip_mr_init(void);
154#else 155#else
155static inline 156static inline
diff --git a/include/linux/mroute6.h b/include/linux/mroute6.h
index 6091ab77f388..9d2deb200f54 100644
--- a/include/linux/mroute6.h
+++ b/include/linux/mroute6.h
@@ -136,6 +136,7 @@ extern int ip6_mroute_setsockopt(struct sock *, int, char __user *, unsigned int
136extern int ip6_mroute_getsockopt(struct sock *, int, char __user *, int __user *); 136extern int ip6_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
137extern int ip6_mr_input(struct sk_buff *skb); 137extern int ip6_mr_input(struct sk_buff *skb);
138extern int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg); 138extern int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg);
139extern int ip6mr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg);
139extern int ip6_mr_init(void); 140extern int ip6_mr_init(void);
140extern void ip6_mr_cleanup(void); 141extern void ip6_mr_cleanup(void);
141#else 142#else
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 8a64b811a39a..b4c7c1cbcf40 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -195,7 +195,8 @@ static inline int genlmsg_end(struct sk_buff *skb, void *hdr)
195 */ 195 */
196static inline void genlmsg_cancel(struct sk_buff *skb, void *hdr) 196static inline void genlmsg_cancel(struct sk_buff *skb, void *hdr)
197{ 197{
198 nlmsg_cancel(skb, hdr - GENL_HDRLEN - NLMSG_HDRLEN); 198 if (hdr)
199 nlmsg_cancel(skb, hdr - GENL_HDRLEN - NLMSG_HDRLEN);
199} 200}
200 201
201/** 202/**
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h
index 96ba5f7dcab6..349cefedc9f3 100644
--- a/include/net/netfilter/nf_conntrack_ecache.h
+++ b/include/net/netfilter/nf_conntrack_ecache.h
@@ -77,9 +77,6 @@ nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct)
77 if (e == NULL) 77 if (e == NULL)
78 return; 78 return;
79 79
80 if (!(e->ctmask & (1 << event)))
81 return;
82
83 set_bit(event, &e->cache); 80 set_bit(event, &e->cache);
84} 81}
85 82
diff --git a/include/net/sock.h b/include/net/sock.h
index d884d268c704..bc1cf7d88ccb 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -753,6 +753,8 @@ struct proto {
753 int level, 753 int level,
754 int optname, char __user *optval, 754 int optname, char __user *optval,
755 int __user *option); 755 int __user *option);
756 int (*compat_ioctl)(struct sock *sk,
757 unsigned int cmd, unsigned long arg);
756#endif 758#endif
757 int (*sendmsg)(struct kiocb *iocb, struct sock *sk, 759 int (*sendmsg)(struct kiocb *iocb, struct sock *sk,
758 struct msghdr *msg, size_t len); 760 struct msghdr *msg, size_t len);
diff --git a/net/batman-adv/vis.c b/net/batman-adv/vis.c
index cd4c4231fa48..de1022cacaf7 100644
--- a/net/batman-adv/vis.c
+++ b/net/batman-adv/vis.c
@@ -64,6 +64,7 @@ static void free_info(struct kref *ref)
64 64
65 spin_unlock_bh(&bat_priv->vis_list_lock); 65 spin_unlock_bh(&bat_priv->vis_list_lock);
66 kfree_skb(info->skb_packet); 66 kfree_skb(info->skb_packet);
67 kfree(info);
67} 68}
68 69
69/* Compare two vis packets, used by the hashing algorithm */ 70/* Compare two vis packets, used by the hashing algorithm */
@@ -268,10 +269,10 @@ int vis_seq_print_text(struct seq_file *seq, void *offset)
268 buff_pos += sprintf(buff + buff_pos, "%pM,", 269 buff_pos += sprintf(buff + buff_pos, "%pM,",
269 entry->addr); 270 entry->addr);
270 271
271 for (i = 0; i < packet->entries; i++) 272 for (j = 0; j < packet->entries; j++)
272 buff_pos += vis_data_read_entry( 273 buff_pos += vis_data_read_entry(
273 buff + buff_pos, 274 buff + buff_pos,
274 &entries[i], 275 &entries[j],
275 entry->addr, 276 entry->addr,
276 entry->primary); 277 entry->primary);
277 278
@@ -444,7 +445,7 @@ static struct vis_info *add_packet(struct bat_priv *bat_priv,
444 info); 445 info);
445 if (hash_added < 0) { 446 if (hash_added < 0) {
446 /* did not work (for some reason) */ 447 /* did not work (for some reason) */
447 kref_put(&old_info->refcount, free_info); 448 kref_put(&info->refcount, free_info);
448 info = NULL; 449 info = NULL;
449 } 450 }
450 451
@@ -815,7 +816,7 @@ static void send_vis_packets(struct work_struct *work)
815 container_of(work, struct delayed_work, work); 816 container_of(work, struct delayed_work, work);
816 struct bat_priv *bat_priv = 817 struct bat_priv *bat_priv =
817 container_of(delayed_work, struct bat_priv, vis_work); 818 container_of(delayed_work, struct bat_priv, vis_work);
818 struct vis_info *info, *temp; 819 struct vis_info *info;
819 820
820 spin_lock_bh(&bat_priv->vis_hash_lock); 821 spin_lock_bh(&bat_priv->vis_hash_lock);
821 purge_vis_packets(bat_priv); 822 purge_vis_packets(bat_priv);
@@ -825,8 +826,9 @@ static void send_vis_packets(struct work_struct *work)
825 send_list_add(bat_priv, bat_priv->my_vis_info); 826 send_list_add(bat_priv, bat_priv->my_vis_info);
826 } 827 }
827 828
828 list_for_each_entry_safe(info, temp, &bat_priv->vis_send_list, 829 while (!list_empty(&bat_priv->vis_send_list)) {
829 send_list) { 830 info = list_first_entry(&bat_priv->vis_send_list,
831 typeof(*info), send_list);
830 832
831 kref_get(&info->refcount); 833 kref_get(&info->refcount);
832 spin_unlock_bh(&bat_priv->vis_hash_lock); 834 spin_unlock_bh(&bat_priv->vis_hash_lock);
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index 2872393b2939..88485cc74dc3 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -328,12 +328,12 @@ static struct net_bridge_fdb_entry *fdb_create(struct hlist_head *head,
328 fdb = kmem_cache_alloc(br_fdb_cache, GFP_ATOMIC); 328 fdb = kmem_cache_alloc(br_fdb_cache, GFP_ATOMIC);
329 if (fdb) { 329 if (fdb) {
330 memcpy(fdb->addr.addr, addr, ETH_ALEN); 330 memcpy(fdb->addr.addr, addr, ETH_ALEN);
331 hlist_add_head_rcu(&fdb->hlist, head);
332
333 fdb->dst = source; 331 fdb->dst = source;
334 fdb->is_local = is_local; 332 fdb->is_local = is_local;
335 fdb->is_static = is_local; 333 fdb->is_static = is_local;
336 fdb->ageing_timer = jiffies; 334 fdb->ageing_timer = jiffies;
335
336 hlist_add_head_rcu(&fdb->hlist, head);
337 } 337 }
338 return fdb; 338 return fdb;
339} 339}
diff --git a/net/core/dev.c b/net/core/dev.c
index 24ea2d71e7ea..b6d0bf875a8e 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2563,7 +2563,8 @@ static int get_rps_cpu(struct net_device *dev, struct sk_buff *skb,
2563 2563
2564 map = rcu_dereference(rxqueue->rps_map); 2564 map = rcu_dereference(rxqueue->rps_map);
2565 if (map) { 2565 if (map) {
2566 if (map->len == 1) { 2566 if (map->len == 1 &&
2567 !rcu_dereference_raw(rxqueue->rps_flow_table)) {
2567 tcpu = map->cpus[0]; 2568 tcpu = map->cpus[0];
2568 if (cpu_online(tcpu)) 2569 if (cpu_online(tcpu))
2569 cpu = tcpu; 2570 cpu = tcpu;
@@ -3424,6 +3425,8 @@ static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb)
3424 __skb_pull(skb, skb_headlen(skb)); 3425 __skb_pull(skb, skb_headlen(skb));
3425 skb_reserve(skb, NET_IP_ALIGN - skb_headroom(skb)); 3426 skb_reserve(skb, NET_IP_ALIGN - skb_headroom(skb));
3426 skb->vlan_tci = 0; 3427 skb->vlan_tci = 0;
3428 skb->dev = napi->dev;
3429 skb->skb_iif = 0;
3427 3430
3428 napi->skb = skb; 3431 napi->skb = skb;
3429} 3432}
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 750db57f3bb3..2d65c6bb24c1 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1121,8 +1121,7 @@ static int validate_linkmsg(struct net_device *dev, struct nlattr *tb[])
1121 return -EOPNOTSUPP; 1121 return -EOPNOTSUPP;
1122 1122
1123 if (af_ops->validate_link_af) { 1123 if (af_ops->validate_link_af) {
1124 err = af_ops->validate_link_af(dev, 1124 err = af_ops->validate_link_af(dev, af);
1125 tb[IFLA_AF_SPEC]);
1126 if (err < 0) 1125 if (err < 0)
1127 return err; 1126 return err;
1128 } 1127 }
@@ -1672,6 +1671,9 @@ replay:
1672 snprintf(ifname, IFNAMSIZ, "%s%%d", ops->kind); 1671 snprintf(ifname, IFNAMSIZ, "%s%%d", ops->kind);
1673 1672
1674 dest_net = rtnl_link_get_net(net, tb); 1673 dest_net = rtnl_link_get_net(net, tb);
1674 if (IS_ERR(dest_net))
1675 return PTR_ERR(dest_net);
1676
1675 dev = rtnl_create_link(net, dest_net, ifname, ops, tb); 1677 dev = rtnl_create_link(net, dest_net, ifname, ops, tb);
1676 1678
1677 if (IS_ERR(dev)) 1679 if (IS_ERR(dev))
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 7cd1bc86d591..d883dcc78b6b 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -210,6 +210,7 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask,
210 shinfo = skb_shinfo(skb); 210 shinfo = skb_shinfo(skb);
211 memset(shinfo, 0, offsetof(struct skb_shared_info, dataref)); 211 memset(shinfo, 0, offsetof(struct skb_shared_info, dataref));
212 atomic_set(&shinfo->dataref, 1); 212 atomic_set(&shinfo->dataref, 1);
213 kmemcheck_annotate_variable(shinfo->destructor_arg);
213 214
214 if (fclone) { 215 if (fclone) {
215 struct sk_buff *child = skb + 1; 216 struct sk_buff *child = skb + 1;
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c
index 15dcc1a586b4..0c2826337919 100644
--- a/net/econet/af_econet.c
+++ b/net/econet/af_econet.c
@@ -265,13 +265,13 @@ static void ec_tx_done(struct sk_buff *skb, int result)
265static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, 265static int econet_sendmsg(struct kiocb *iocb, struct socket *sock,
266 struct msghdr *msg, size_t len) 266 struct msghdr *msg, size_t len)
267{ 267{
268 struct sock *sk = sock->sk;
269 struct sockaddr_ec *saddr=(struct sockaddr_ec *)msg->msg_name; 268 struct sockaddr_ec *saddr=(struct sockaddr_ec *)msg->msg_name;
270 struct net_device *dev; 269 struct net_device *dev;
271 struct ec_addr addr; 270 struct ec_addr addr;
272 int err; 271 int err;
273 unsigned char port, cb; 272 unsigned char port, cb;
274#if defined(CONFIG_ECONET_AUNUDP) || defined(CONFIG_ECONET_NATIVE) 273#if defined(CONFIG_ECONET_AUNUDP) || defined(CONFIG_ECONET_NATIVE)
274 struct sock *sk = sock->sk;
275 struct sk_buff *skb; 275 struct sk_buff *skb;
276 struct ec_cb *eb; 276 struct ec_cb *eb;
277#endif 277#endif
@@ -488,10 +488,10 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock,
488 488
489error_free_buf: 489error_free_buf:
490 vfree(userbuf); 490 vfree(userbuf);
491error:
491#else 492#else
492 err = -EPROTOTYPE; 493 err = -EPROTOTYPE;
493#endif 494#endif
494 error:
495 mutex_unlock(&econet_mutex); 495 mutex_unlock(&econet_mutex);
496 496
497 return err; 497 return err;
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index f2b61107df6c..45b89d7bda5a 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -880,6 +880,19 @@ int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
880} 880}
881EXPORT_SYMBOL(inet_ioctl); 881EXPORT_SYMBOL(inet_ioctl);
882 882
883#ifdef CONFIG_COMPAT
884int inet_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
885{
886 struct sock *sk = sock->sk;
887 int err = -ENOIOCTLCMD;
888
889 if (sk->sk_prot->compat_ioctl)
890 err = sk->sk_prot->compat_ioctl(sk, cmd, arg);
891
892 return err;
893}
894#endif
895
883const struct proto_ops inet_stream_ops = { 896const struct proto_ops inet_stream_ops = {
884 .family = PF_INET, 897 .family = PF_INET,
885 .owner = THIS_MODULE, 898 .owner = THIS_MODULE,
@@ -903,6 +916,7 @@ const struct proto_ops inet_stream_ops = {
903#ifdef CONFIG_COMPAT 916#ifdef CONFIG_COMPAT
904 .compat_setsockopt = compat_sock_common_setsockopt, 917 .compat_setsockopt = compat_sock_common_setsockopt,
905 .compat_getsockopt = compat_sock_common_getsockopt, 918 .compat_getsockopt = compat_sock_common_getsockopt,
919 .compat_ioctl = inet_compat_ioctl,
906#endif 920#endif
907}; 921};
908EXPORT_SYMBOL(inet_stream_ops); 922EXPORT_SYMBOL(inet_stream_ops);
@@ -929,6 +943,7 @@ const struct proto_ops inet_dgram_ops = {
929#ifdef CONFIG_COMPAT 943#ifdef CONFIG_COMPAT
930 .compat_setsockopt = compat_sock_common_setsockopt, 944 .compat_setsockopt = compat_sock_common_setsockopt,
931 .compat_getsockopt = compat_sock_common_getsockopt, 945 .compat_getsockopt = compat_sock_common_getsockopt,
946 .compat_ioctl = inet_compat_ioctl,
932#endif 947#endif
933}; 948};
934EXPORT_SYMBOL(inet_dgram_ops); 949EXPORT_SYMBOL(inet_dgram_ops);
@@ -959,6 +974,7 @@ static const struct proto_ops inet_sockraw_ops = {
959#ifdef CONFIG_COMPAT 974#ifdef CONFIG_COMPAT
960 .compat_setsockopt = compat_sock_common_setsockopt, 975 .compat_setsockopt = compat_sock_common_setsockopt,
961 .compat_getsockopt = compat_sock_common_getsockopt, 976 .compat_getsockopt = compat_sock_common_getsockopt,
977 .compat_ioctl = inet_compat_ioctl,
962#endif 978#endif
963}; 979};
964 980
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 3f3a9afd73e0..8b65a12654e7 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -60,6 +60,7 @@
60#include <linux/notifier.h> 60#include <linux/notifier.h>
61#include <linux/if_arp.h> 61#include <linux/if_arp.h>
62#include <linux/netfilter_ipv4.h> 62#include <linux/netfilter_ipv4.h>
63#include <linux/compat.h>
63#include <net/ipip.h> 64#include <net/ipip.h>
64#include <net/checksum.h> 65#include <net/checksum.h>
65#include <net/netlink.h> 66#include <net/netlink.h>
@@ -1434,6 +1435,81 @@ int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg)
1434 } 1435 }
1435} 1436}
1436 1437
1438#ifdef CONFIG_COMPAT
1439struct compat_sioc_sg_req {
1440 struct in_addr src;
1441 struct in_addr grp;
1442 compat_ulong_t pktcnt;
1443 compat_ulong_t bytecnt;
1444 compat_ulong_t wrong_if;
1445};
1446
1447struct compat_sioc_vif_req {
1448 vifi_t vifi; /* Which iface */
1449 compat_ulong_t icount;
1450 compat_ulong_t ocount;
1451 compat_ulong_t ibytes;
1452 compat_ulong_t obytes;
1453};
1454
1455int ipmr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg)
1456{
1457 struct compat_sioc_sg_req sr;
1458 struct compat_sioc_vif_req vr;
1459 struct vif_device *vif;
1460 struct mfc_cache *c;
1461 struct net *net = sock_net(sk);
1462 struct mr_table *mrt;
1463
1464 mrt = ipmr_get_table(net, raw_sk(sk)->ipmr_table ? : RT_TABLE_DEFAULT);
1465 if (mrt == NULL)
1466 return -ENOENT;
1467
1468 switch (cmd) {
1469 case SIOCGETVIFCNT:
1470 if (copy_from_user(&vr, arg, sizeof(vr)))
1471 return -EFAULT;
1472 if (vr.vifi >= mrt->maxvif)
1473 return -EINVAL;
1474 read_lock(&mrt_lock);
1475 vif = &mrt->vif_table[vr.vifi];
1476 if (VIF_EXISTS(mrt, vr.vifi)) {
1477 vr.icount = vif->pkt_in;
1478 vr.ocount = vif->pkt_out;
1479 vr.ibytes = vif->bytes_in;
1480 vr.obytes = vif->bytes_out;
1481 read_unlock(&mrt_lock);
1482
1483 if (copy_to_user(arg, &vr, sizeof(vr)))
1484 return -EFAULT;
1485 return 0;
1486 }
1487 read_unlock(&mrt_lock);
1488 return -EADDRNOTAVAIL;
1489 case SIOCGETSGCNT:
1490 if (copy_from_user(&sr, arg, sizeof(sr)))
1491 return -EFAULT;
1492
1493 rcu_read_lock();
1494 c = ipmr_cache_find(mrt, sr.src.s_addr, sr.grp.s_addr);
1495 if (c) {
1496 sr.pktcnt = c->mfc_un.res.pkt;
1497 sr.bytecnt = c->mfc_un.res.bytes;
1498 sr.wrong_if = c->mfc_un.res.wrong_if;
1499 rcu_read_unlock();
1500
1501 if (copy_to_user(arg, &sr, sizeof(sr)))
1502 return -EFAULT;
1503 return 0;
1504 }
1505 rcu_read_unlock();
1506 return -EADDRNOTAVAIL;
1507 default:
1508 return -ENOIOCTLCMD;
1509 }
1510}
1511#endif
1512
1437 1513
1438static int ipmr_device_event(struct notifier_block *this, unsigned long event, void *ptr) 1514static int ipmr_device_event(struct notifier_block *this, unsigned long event, void *ptr)
1439{ 1515{
diff --git a/net/ipv4/netfilter/arpt_mangle.c b/net/ipv4/netfilter/arpt_mangle.c
index b8ddcc480ed9..a5e52a9f0a12 100644
--- a/net/ipv4/netfilter/arpt_mangle.c
+++ b/net/ipv4/netfilter/arpt_mangle.c
@@ -60,12 +60,12 @@ static int checkentry(const struct xt_tgchk_param *par)
60 60
61 if (mangle->flags & ~ARPT_MANGLE_MASK || 61 if (mangle->flags & ~ARPT_MANGLE_MASK ||
62 !(mangle->flags & ARPT_MANGLE_MASK)) 62 !(mangle->flags & ARPT_MANGLE_MASK))
63 return false; 63 return -EINVAL;
64 64
65 if (mangle->target != NF_DROP && mangle->target != NF_ACCEPT && 65 if (mangle->target != NF_DROP && mangle->target != NF_ACCEPT &&
66 mangle->target != XT_CONTINUE) 66 mangle->target != XT_CONTINUE)
67 return false; 67 return -EINVAL;
68 return true; 68 return 0;
69} 69}
70 70
71static struct xt_target arpt_mangle_reg __read_mostly = { 71static struct xt_target arpt_mangle_reg __read_mostly = {
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index a3d5ab786e81..6390ba299b3d 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -76,6 +76,7 @@
76#include <linux/seq_file.h> 76#include <linux/seq_file.h>
77#include <linux/netfilter.h> 77#include <linux/netfilter.h>
78#include <linux/netfilter_ipv4.h> 78#include <linux/netfilter_ipv4.h>
79#include <linux/compat.h>
79 80
80static struct raw_hashinfo raw_v4_hashinfo = { 81static struct raw_hashinfo raw_v4_hashinfo = {
81 .lock = __RW_LOCK_UNLOCKED(raw_v4_hashinfo.lock), 82 .lock = __RW_LOCK_UNLOCKED(raw_v4_hashinfo.lock),
@@ -838,6 +839,23 @@ static int raw_ioctl(struct sock *sk, int cmd, unsigned long arg)
838 } 839 }
839} 840}
840 841
842#ifdef CONFIG_COMPAT
843static int compat_raw_ioctl(struct sock *sk, unsigned int cmd, unsigned long arg)
844{
845 switch (cmd) {
846 case SIOCOUTQ:
847 case SIOCINQ:
848 return -ENOIOCTLCMD;
849 default:
850#ifdef CONFIG_IP_MROUTE
851 return ipmr_compat_ioctl(sk, cmd, compat_ptr(arg));
852#else
853 return -ENOIOCTLCMD;
854#endif
855 }
856}
857#endif
858
841struct proto raw_prot = { 859struct proto raw_prot = {
842 .name = "RAW", 860 .name = "RAW",
843 .owner = THIS_MODULE, 861 .owner = THIS_MODULE,
@@ -860,6 +878,7 @@ struct proto raw_prot = {
860#ifdef CONFIG_COMPAT 878#ifdef CONFIG_COMPAT
861 .compat_setsockopt = compat_raw_setsockopt, 879 .compat_setsockopt = compat_raw_setsockopt,
862 .compat_getsockopt = compat_raw_getsockopt, 880 .compat_getsockopt = compat_raw_getsockopt,
881 .compat_ioctl = compat_raw_ioctl,
863#endif 882#endif
864}; 883};
865 884
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 351dc4e85242..788a3e74834e 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2707,6 +2707,11 @@ static struct dst_entry *ipv4_blackhole_dst_check(struct dst_entry *dst, u32 coo
2707 return NULL; 2707 return NULL;
2708} 2708}
2709 2709
2710static unsigned int ipv4_blackhole_default_mtu(const struct dst_entry *dst)
2711{
2712 return 0;
2713}
2714
2710static void ipv4_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu) 2715static void ipv4_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu)
2711{ 2716{
2712} 2717}
@@ -2716,6 +2721,7 @@ static struct dst_ops ipv4_dst_blackhole_ops = {
2716 .protocol = cpu_to_be16(ETH_P_IP), 2721 .protocol = cpu_to_be16(ETH_P_IP),
2717 .destroy = ipv4_dst_destroy, 2722 .destroy = ipv4_dst_destroy,
2718 .check = ipv4_blackhole_dst_check, 2723 .check = ipv4_blackhole_dst_check,
2724 .default_mtu = ipv4_blackhole_default_mtu,
2719 .update_pmtu = ipv4_rt_blackhole_update_pmtu, 2725 .update_pmtu = ipv4_rt_blackhole_update_pmtu,
2720}; 2726};
2721 2727
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 9fab274019c0..0e1d53bcf1e0 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -34,6 +34,7 @@
34#include <linux/seq_file.h> 34#include <linux/seq_file.h>
35#include <linux/init.h> 35#include <linux/init.h>
36#include <linux/slab.h> 36#include <linux/slab.h>
37#include <linux/compat.h>
37#include <net/protocol.h> 38#include <net/protocol.h>
38#include <linux/skbuff.h> 39#include <linux/skbuff.h>
39#include <net/sock.h> 40#include <net/sock.h>
@@ -1804,6 +1805,80 @@ int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg)
1804 } 1805 }
1805} 1806}
1806 1807
1808#ifdef CONFIG_COMPAT
1809struct compat_sioc_sg_req6 {
1810 struct sockaddr_in6 src;
1811 struct sockaddr_in6 grp;
1812 compat_ulong_t pktcnt;
1813 compat_ulong_t bytecnt;
1814 compat_ulong_t wrong_if;
1815};
1816
1817struct compat_sioc_mif_req6 {
1818 mifi_t mifi;
1819 compat_ulong_t icount;
1820 compat_ulong_t ocount;
1821 compat_ulong_t ibytes;
1822 compat_ulong_t obytes;
1823};
1824
1825int ip6mr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg)
1826{
1827 struct compat_sioc_sg_req6 sr;
1828 struct compat_sioc_mif_req6 vr;
1829 struct mif_device *vif;
1830 struct mfc6_cache *c;
1831 struct net *net = sock_net(sk);
1832 struct mr6_table *mrt;
1833
1834 mrt = ip6mr_get_table(net, raw6_sk(sk)->ip6mr_table ? : RT6_TABLE_DFLT);
1835 if (mrt == NULL)
1836 return -ENOENT;
1837
1838 switch (cmd) {
1839 case SIOCGETMIFCNT_IN6:
1840 if (copy_from_user(&vr, arg, sizeof(vr)))
1841 return -EFAULT;
1842 if (vr.mifi >= mrt->maxvif)
1843 return -EINVAL;
1844 read_lock(&mrt_lock);
1845 vif = &mrt->vif6_table[vr.mifi];
1846 if (MIF_EXISTS(mrt, vr.mifi)) {
1847 vr.icount = vif->pkt_in;
1848 vr.ocount = vif->pkt_out;
1849 vr.ibytes = vif->bytes_in;
1850 vr.obytes = vif->bytes_out;
1851 read_unlock(&mrt_lock);
1852
1853 if (copy_to_user(arg, &vr, sizeof(vr)))
1854 return -EFAULT;
1855 return 0;
1856 }
1857 read_unlock(&mrt_lock);
1858 return -EADDRNOTAVAIL;
1859 case SIOCGETSGCNT_IN6:
1860 if (copy_from_user(&sr, arg, sizeof(sr)))
1861 return -EFAULT;
1862
1863 read_lock(&mrt_lock);
1864 c = ip6mr_cache_find(mrt, &sr.src.sin6_addr, &sr.grp.sin6_addr);
1865 if (c) {
1866 sr.pktcnt = c->mfc_un.res.pkt;
1867 sr.bytecnt = c->mfc_un.res.bytes;
1868 sr.wrong_if = c->mfc_un.res.wrong_if;
1869 read_unlock(&mrt_lock);
1870
1871 if (copy_to_user(arg, &sr, sizeof(sr)))
1872 return -EFAULT;
1873 return 0;
1874 }
1875 read_unlock(&mrt_lock);
1876 return -EADDRNOTAVAIL;
1877 default:
1878 return -ENOIOCTLCMD;
1879 }
1880}
1881#endif
1807 1882
1808static inline int ip6mr_forward2_finish(struct sk_buff *skb) 1883static inline int ip6mr_forward2_finish(struct sk_buff *skb)
1809{ 1884{
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 86c39526ba5e..c5b0915d106b 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -31,6 +31,7 @@
31#include <linux/netfilter.h> 31#include <linux/netfilter.h>
32#include <linux/netfilter_ipv6.h> 32#include <linux/netfilter_ipv6.h>
33#include <linux/skbuff.h> 33#include <linux/skbuff.h>
34#include <linux/compat.h>
34#include <asm/uaccess.h> 35#include <asm/uaccess.h>
35#include <asm/ioctls.h> 36#include <asm/ioctls.h>
36 37
@@ -1157,6 +1158,23 @@ static int rawv6_ioctl(struct sock *sk, int cmd, unsigned long arg)
1157 } 1158 }
1158} 1159}
1159 1160
1161#ifdef CONFIG_COMPAT
1162static int compat_rawv6_ioctl(struct sock *sk, unsigned int cmd, unsigned long arg)
1163{
1164 switch (cmd) {
1165 case SIOCOUTQ:
1166 case SIOCINQ:
1167 return -ENOIOCTLCMD;
1168 default:
1169#ifdef CONFIG_IPV6_MROUTE
1170 return ip6mr_compat_ioctl(sk, cmd, compat_ptr(arg));
1171#else
1172 return -ENOIOCTLCMD;
1173#endif
1174 }
1175}
1176#endif
1177
1160static void rawv6_close(struct sock *sk, long timeout) 1178static void rawv6_close(struct sock *sk, long timeout)
1161{ 1179{
1162 if (inet_sk(sk)->inet_num == IPPROTO_RAW) 1180 if (inet_sk(sk)->inet_num == IPPROTO_RAW)
@@ -1215,6 +1233,7 @@ struct proto rawv6_prot = {
1215#ifdef CONFIG_COMPAT 1233#ifdef CONFIG_COMPAT
1216 .compat_setsockopt = compat_rawv6_setsockopt, 1234 .compat_setsockopt = compat_rawv6_setsockopt,
1217 .compat_getsockopt = compat_rawv6_getsockopt, 1235 .compat_getsockopt = compat_rawv6_getsockopt,
1236 .compat_ioctl = compat_rawv6_ioctl,
1218#endif 1237#endif
1219}; 1238};
1220 1239
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 1534508f6c68..1c29f95695de 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -113,6 +113,11 @@ static struct dst_ops ip6_dst_ops_template = {
113 .local_out = __ip6_local_out, 113 .local_out = __ip6_local_out,
114}; 114};
115 115
116static unsigned int ip6_blackhole_default_mtu(const struct dst_entry *dst)
117{
118 return 0;
119}
120
116static void ip6_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu) 121static void ip6_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu)
117{ 122{
118} 123}
@@ -122,6 +127,7 @@ static struct dst_ops ip6_dst_blackhole_ops = {
122 .protocol = cpu_to_be16(ETH_P_IPV6), 127 .protocol = cpu_to_be16(ETH_P_IPV6),
123 .destroy = ip6_dst_destroy, 128 .destroy = ip6_dst_destroy,
124 .check = ip6_dst_check, 129 .check = ip6_dst_check,
130 .default_mtu = ip6_blackhole_default_mtu,
125 .update_pmtu = ip6_rt_blackhole_update_pmtu, 131 .update_pmtu = ip6_rt_blackhole_update_pmtu,
126}; 132};
127 133
@@ -194,7 +200,6 @@ static void ip6_dst_destroy(struct dst_entry *dst)
194 in6_dev_put(idev); 200 in6_dev_put(idev);
195 } 201 }
196 if (peer) { 202 if (peer) {
197 BUG_ON(!(rt->rt6i_flags & RTF_CACHE));
198 rt->rt6i_peer = NULL; 203 rt->rt6i_peer = NULL;
199 inet_putpeer(peer); 204 inet_putpeer(peer);
200 } 205 }
@@ -204,9 +209,6 @@ void rt6_bind_peer(struct rt6_info *rt, int create)
204{ 209{
205 struct inet_peer *peer; 210 struct inet_peer *peer;
206 211
207 if (WARN_ON(!(rt->rt6i_flags & RTF_CACHE)))
208 return;
209
210 peer = inet_getpeer_v6(&rt->rt6i_dst.addr, create); 212 peer = inet_getpeer_v6(&rt->rt6i_dst.addr, create);
211 if (peer && cmpxchg(&rt->rt6i_peer, NULL, peer) != NULL) 213 if (peer && cmpxchg(&rt->rt6i_peer, NULL, peer) != NULL)
212 inet_putpeer(peer); 214 inet_putpeer(peer);
diff --git a/net/ipv6/sysctl_net_ipv6.c b/net/ipv6/sysctl_net_ipv6.c
index fa1d8f4e0051..7cb65ef79f9c 100644
--- a/net/ipv6/sysctl_net_ipv6.c
+++ b/net/ipv6/sysctl_net_ipv6.c
@@ -15,6 +15,8 @@
15#include <net/addrconf.h> 15#include <net/addrconf.h>
16#include <net/inet_frag.h> 16#include <net/inet_frag.h>
17 17
18static struct ctl_table empty[1];
19
18static ctl_table ipv6_table_template[] = { 20static ctl_table ipv6_table_template[] = {
19 { 21 {
20 .procname = "route", 22 .procname = "route",
@@ -35,6 +37,12 @@ static ctl_table ipv6_table_template[] = {
35 .mode = 0644, 37 .mode = 0644,
36 .proc_handler = proc_dointvec 38 .proc_handler = proc_dointvec
37 }, 39 },
40 {
41 .procname = "neigh",
42 .maxlen = 0,
43 .mode = 0555,
44 .child = empty,
45 },
38 { } 46 { }
39}; 47};
40 48
@@ -152,7 +160,6 @@ static struct ctl_table_header *ip6_base;
152 160
153int ipv6_static_sysctl_register(void) 161int ipv6_static_sysctl_register(void)
154{ 162{
155 static struct ctl_table empty[1];
156 ip6_base = register_sysctl_paths(net_ipv6_ctl_path, empty); 163 ip6_base = register_sysctl_paths(net_ipv6_ctl_path, empty);
157 if (ip6_base == NULL) 164 if (ip6_base == NULL)
158 return -ENOMEM; 165 return -ENOMEM;
diff --git a/net/netfilter/nf_conntrack_ecache.c b/net/netfilter/nf_conntrack_ecache.c
index 5702de35e2bb..63a1b915a7e4 100644
--- a/net/netfilter/nf_conntrack_ecache.c
+++ b/net/netfilter/nf_conntrack_ecache.c
@@ -63,6 +63,9 @@ void nf_ct_deliver_cached_events(struct nf_conn *ct)
63 * this does not harm and it happens very rarely. */ 63 * this does not harm and it happens very rarely. */
64 unsigned long missed = e->missed; 64 unsigned long missed = e->missed;
65 65
66 if (!((events | missed) & e->ctmask))
67 goto out_unlock;
68
66 ret = notify->fcn(events | missed, &item); 69 ret = notify->fcn(events | missed, &item);
67 if (unlikely(ret < 0 || missed)) { 70 if (unlikely(ret < 0 || missed)) {
68 spin_lock_bh(&ct->lock); 71 spin_lock_bh(&ct->lock);
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index 93297aaceb2b..eead9db6f899 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -667,6 +667,7 @@ restart:
667 if (ctnetlink_fill_info(skb, NETLINK_CB(cb->skb).pid, 667 if (ctnetlink_fill_info(skb, NETLINK_CB(cb->skb).pid,
668 cb->nlh->nlmsg_seq, 668 cb->nlh->nlmsg_seq,
669 IPCTNL_MSG_CT_NEW, ct) < 0) { 669 IPCTNL_MSG_CT_NEW, ct) < 0) {
670 nf_conntrack_get(&ct->ct_general);
670 cb->args[1] = (unsigned long)ct; 671 cb->args[1] = (unsigned long)ct;
671 goto out; 672 goto out;
672 } 673 }
diff --git a/net/netfilter/xt_iprange.c b/net/netfilter/xt_iprange.c
index 88f7c3511c72..73c33a42f87f 100644
--- a/net/netfilter/xt_iprange.c
+++ b/net/netfilter/xt_iprange.c
@@ -53,15 +53,13 @@ iprange_mt4(const struct sk_buff *skb, struct xt_action_param *par)
53} 53}
54 54
55static inline int 55static inline int
56iprange_ipv6_sub(const struct in6_addr *a, const struct in6_addr *b) 56iprange_ipv6_lt(const struct in6_addr *a, const struct in6_addr *b)
57{ 57{
58 unsigned int i; 58 unsigned int i;
59 int r;
60 59
61 for (i = 0; i < 4; ++i) { 60 for (i = 0; i < 4; ++i) {
62 r = ntohl(a->s6_addr32[i]) - ntohl(b->s6_addr32[i]); 61 if (a->s6_addr32[i] != b->s6_addr32[i])
63 if (r != 0) 62 return ntohl(a->s6_addr32[i]) < ntohl(b->s6_addr32[i]);
64 return r;
65 } 63 }
66 64
67 return 0; 65 return 0;
@@ -75,15 +73,15 @@ iprange_mt6(const struct sk_buff *skb, struct xt_action_param *par)
75 bool m; 73 bool m;
76 74
77 if (info->flags & IPRANGE_SRC) { 75 if (info->flags & IPRANGE_SRC) {
78 m = iprange_ipv6_sub(&iph->saddr, &info->src_min.in6) < 0; 76 m = iprange_ipv6_lt(&iph->saddr, &info->src_min.in6);
79 m |= iprange_ipv6_sub(&iph->saddr, &info->src_max.in6) > 0; 77 m |= iprange_ipv6_lt(&info->src_max.in6, &iph->saddr);
80 m ^= !!(info->flags & IPRANGE_SRC_INV); 78 m ^= !!(info->flags & IPRANGE_SRC_INV);
81 if (m) 79 if (m)
82 return false; 80 return false;
83 } 81 }
84 if (info->flags & IPRANGE_DST) { 82 if (info->flags & IPRANGE_DST) {
85 m = iprange_ipv6_sub(&iph->daddr, &info->dst_min.in6) < 0; 83 m = iprange_ipv6_lt(&iph->daddr, &info->dst_min.in6);
86 m |= iprange_ipv6_sub(&iph->daddr, &info->dst_max.in6) > 0; 84 m |= iprange_ipv6_lt(&info->dst_max.in6, &iph->daddr);
87 m ^= !!(info->flags & IPRANGE_DST_INV); 85 m ^= !!(info->flags & IPRANGE_DST_INV);
88 if (m) 86 if (m)
89 return false; 87 return false;