aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-04-08 15:41:23 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-08 15:41:23 -0400
commitce7613db2d8d4d5af2587ab5d7090055c4562201 (patch)
treebc1037a83581e27e9a3f9d52b8e073a0a803a964
parent0afccc4ccecf8436b8e59369b384f6d0a56c90d1 (diff)
parent52c35befb69b005c3fc5afdaae3a5717ad013411 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull more networking updates from David Miller: 1) If a VXLAN interface is created with no groups, we can crash on reception of packets. Fix from Mike Rapoport. 2) Missing includes in CPTS driver, from Alexei Starovoitov. 3) Fix string validations in isdnloop driver, from YOSHIFUJI Hideaki and Dan Carpenter. 4) Missing irq.h include in bnxw2x, enic, and qlcnic drivers. From Josh Boyer. 5) AF_PACKET transmit doesn't statistically count TX drops, from Daniel Borkmann. 6) Byte-Queue-Limit enabled drivers aren't handled properly in AF_PACKET transmit path, also from Daniel Borkmann. Same problem exists in pktgen, and Daniel fixed it there too. 7) Fix resource leaks in driver probe error paths of new sxgbe driver, from Francois Romieu. 8) Truesize of SKBs can gradually get more and more corrupted in NAPI packet recycling path, fix from Eric Dumazet. 9) Fix uniprocessor netfilter build, from Florian Westphal. In the longer term we should perhaps try to find a way for ARRAY_SIZE() to work even with zero sized array elements. 10) Fix crash in netfilter conntrack extensions due to mis-estimation of required extension space. From Andrey Vagin. 11) Since we commit table rule updates before trying to copy the counters back to userspace (it's the last action we perform), we really can't signal the user copy with an error as we are beyond the point from which we can unwind everything. This causes all kinds of use after free crashes and other mysterious behavior. From Thomas Graf. 12) Restore previous behvaior of div/mod by zero in BPF filter processing. From Daniel Borkmann. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (38 commits) net: sctp: wake up all assocs if sndbuf policy is per socket isdnloop: several buffer overflows netdev: remove potentially harmful checks pktgen: fix xmit test for BQL enabled devices net/at91_ether: avoid NULL pointer dereference tipc: Let tipc_release() return 0 at86rf230: fix MAX_CSMA_RETRIES parameter mac802154: fix duplicate #include headers sxgbe: fix duplicate #include headers net: filter: be more defensive on div/mod by X==0 netfilter: Can't fail and free after table replacement xen-netback: Trivial format string fix net: bcmgenet: Remove unnecessary version.h inclusion net: smc911x: Remove unused local variable bonding: Inactive slaves should keep inactive flag's value netfilter: nf_tables: fix wrong format in request_module() netfilter: nf_tables: set names cannot be larger than 15 bytes netfilter: nf_conntrack: reserve two bytes for nf_ct_ext->len netfilter: Add {ipt,ip6t}_osf aliases for xt_osf netfilter: x_tables: allow to use cgroup match for LOCAL_IN nf hooks ...
-rw-r--r--drivers/isdn/isdnloop/isdnloop.c23
-rw-r--r--drivers/net/bonding/bond_main.c2
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h1
-rw-r--r--drivers/net/ethernet/broadcom/genet/bcmgenet.c1
-rw-r--r--drivers/net/ethernet/cadence/at91_ether.c3
-rw-r--r--drivers/net/ethernet/cisco/enic/enic.h1
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic.h1
-rw-r--r--drivers/net/ethernet/samsung/Kconfig24
-rw-r--r--drivers/net/ethernet/samsung/sxgbe/Kconfig9
-rw-r--r--drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c1
-rw-r--r--drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c27
-rw-r--r--drivers/net/ethernet/smsc/smc911x.c1
-rw-r--r--drivers/net/ethernet/ti/cpts.c2
-rw-r--r--drivers/net/ieee802154/at86rf230.c2
-rw-r--r--drivers/net/phy/spi_ks8995.c52
-rw-r--r--drivers/net/vxlan.c6
-rw-r--r--drivers/net/xen-netback/common.h1
-rw-r--r--drivers/net/xen-netback/netback.c146
-rw-r--r--include/linux/netdev_features.h2
-rw-r--r--include/linux/netdevice.h24
-rw-r--r--include/net/netfilter/nf_conntrack_extend.h4
-rw-r--r--net/bridge/netfilter/ebtables.c5
-rw-r--r--net/core/dev.c14
-rw-r--r--net/core/ethtool.c1
-rw-r--r--net/core/filter.c32
-rw-r--r--net/core/pktgen.c2
-rw-r--r--net/ipv4/netfilter/arp_tables.c6
-rw-r--r--net/ipv4/netfilter/ip_tables.c6
-rw-r--r--net/ipv6/netfilter/ip6_tables.c6
-rw-r--r--net/mac802154/mib.c1
-rw-r--r--net/netfilter/nf_tables_api.c7
-rw-r--r--net/netfilter/xt_cgroup.c3
-rw-r--r--net/netfilter/xt_connlimit.c25
-rw-r--r--net/netfilter/xt_osf.c2
-rw-r--r--net/packet/af_packet.c3
-rw-r--r--net/sctp/socket.c36
-rw-r--r--net/tipc/net.c3
-rw-r--r--net/tipc/socket.c3
38 files changed, 320 insertions, 168 deletions
diff --git a/drivers/isdn/isdnloop/isdnloop.c b/drivers/isdn/isdnloop/isdnloop.c
index 02125e6a9109..5a4da94aefb0 100644
--- a/drivers/isdn/isdnloop/isdnloop.c
+++ b/drivers/isdn/isdnloop/isdnloop.c
@@ -518,9 +518,9 @@ static isdnloop_stat isdnloop_cmd_table[] =
518static void 518static void
519isdnloop_fake_err(isdnloop_card *card) 519isdnloop_fake_err(isdnloop_card *card)
520{ 520{
521 char buf[60]; 521 char buf[64];
522 522
523 sprintf(buf, "E%s", card->omsg); 523 snprintf(buf, sizeof(buf), "E%s", card->omsg);
524 isdnloop_fake(card, buf, -1); 524 isdnloop_fake(card, buf, -1);
525 isdnloop_fake(card, "NAK", -1); 525 isdnloop_fake(card, "NAK", -1);
526} 526}
@@ -903,6 +903,8 @@ isdnloop_parse_cmd(isdnloop_card *card)
903 case 7: 903 case 7:
904 /* 0x;EAZ */ 904 /* 0x;EAZ */
905 p += 3; 905 p += 3;
906 if (strlen(p) >= sizeof(card->eazlist[0]))
907 break;
906 strcpy(card->eazlist[ch - 1], p); 908 strcpy(card->eazlist[ch - 1], p);
907 break; 909 break;
908 case 8: 910 case 8:
@@ -1070,6 +1072,12 @@ isdnloop_start(isdnloop_card *card, isdnloop_sdef *sdefp)
1070 return -EBUSY; 1072 return -EBUSY;
1071 if (copy_from_user((char *) &sdef, (char *) sdefp, sizeof(sdef))) 1073 if (copy_from_user((char *) &sdef, (char *) sdefp, sizeof(sdef)))
1072 return -EFAULT; 1074 return -EFAULT;
1075
1076 for (i = 0; i < 3; i++) {
1077 if (!memchr(sdef.num[i], 0, sizeof(sdef.num[i])))
1078 return -EINVAL;
1079 }
1080
1073 spin_lock_irqsave(&card->isdnloop_lock, flags); 1081 spin_lock_irqsave(&card->isdnloop_lock, flags);
1074 switch (sdef.ptype) { 1082 switch (sdef.ptype) {
1075 case ISDN_PTYPE_EURO: 1083 case ISDN_PTYPE_EURO:
@@ -1127,7 +1135,7 @@ isdnloop_command(isdn_ctrl *c, isdnloop_card *card)
1127{ 1135{
1128 ulong a; 1136 ulong a;
1129 int i; 1137 int i;
1130 char cbuf[60]; 1138 char cbuf[80];
1131 isdn_ctrl cmd; 1139 isdn_ctrl cmd;
1132 isdnloop_cdef cdef; 1140 isdnloop_cdef cdef;
1133 1141
@@ -1192,7 +1200,6 @@ isdnloop_command(isdn_ctrl *c, isdnloop_card *card)
1192 break; 1200 break;
1193 if ((c->arg & 255) < ISDNLOOP_BCH) { 1201 if ((c->arg & 255) < ISDNLOOP_BCH) {
1194 char *p; 1202 char *p;
1195 char dial[50];
1196 char dcode[4]; 1203 char dcode[4];
1197 1204
1198 a = c->arg; 1205 a = c->arg;
@@ -1204,10 +1211,10 @@ isdnloop_command(isdn_ctrl *c, isdnloop_card *card)
1204 } else 1211 } else
1205 /* Normal Dial */ 1212 /* Normal Dial */
1206 strcpy(dcode, "CAL"); 1213 strcpy(dcode, "CAL");
1207 strcpy(dial, p); 1214 snprintf(cbuf, sizeof(cbuf),
1208 sprintf(cbuf, "%02d;D%s_R%s,%02d,%02d,%s\n", (int) (a + 1), 1215 "%02d;D%s_R%s,%02d,%02d,%s\n", (int) (a + 1),
1209 dcode, dial, c->parm.setup.si1, 1216 dcode, p, c->parm.setup.si1,
1210 c->parm.setup.si2, c->parm.setup.eazmsn); 1217 c->parm.setup.si2, c->parm.setup.eazmsn);
1211 i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); 1218 i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card);
1212 } 1219 }
1213 break; 1220 break;
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 95a6ca7d9e51..d9f85464b362 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3077,7 +3077,7 @@ static int bond_open(struct net_device *bond_dev)
3077 if (bond_has_slaves(bond)) { 3077 if (bond_has_slaves(bond)) {
3078 read_lock(&bond->curr_slave_lock); 3078 read_lock(&bond->curr_slave_lock);
3079 bond_for_each_slave(bond, slave, iter) { 3079 bond_for_each_slave(bond, slave, iter) {
3080 if ((bond->params.mode == BOND_MODE_ACTIVEBACKUP) 3080 if (USES_PRIMARY(bond->params.mode)
3081 && (slave != bond->curr_active_slave)) { 3081 && (slave != bond->curr_active_slave)) {
3082 bond_set_slave_inactive_flags(slave, 3082 bond_set_slave_inactive_flags(slave,
3083 BOND_SLAVE_NOTIFY_NOW); 3083 BOND_SLAVE_NOTIFY_NOW);
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
index 05f4f5f52635..3448cc033ca5 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
@@ -21,6 +21,7 @@
21#include <linux/pci.h> 21#include <linux/pci.h>
22#include <linux/netdevice.h> 22#include <linux/netdevice.h>
23#include <linux/etherdevice.h> 23#include <linux/etherdevice.h>
24#include <linux/irq.h>
24 25
25#include "bnx2x.h" 26#include "bnx2x.h"
26#include "bnx2x_sriov.h" 27#include "bnx2x_sriov.h"
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index adf8acbddf56..0966bd04375f 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -34,7 +34,6 @@
34#include <linux/dma-mapping.h> 34#include <linux/dma-mapping.h>
35#include <linux/pm.h> 35#include <linux/pm.h>
36#include <linux/clk.h> 36#include <linux/clk.h>
37#include <linux/version.h>
38#include <linux/of.h> 37#include <linux/of.h>
39#include <linux/of_address.h> 38#include <linux/of_address.h>
40#include <linux/of_irq.h> 39#include <linux/of_irq.h>
diff --git a/drivers/net/ethernet/cadence/at91_ether.c b/drivers/net/ethernet/cadence/at91_ether.c
index ce75de9bae9e..4a79edaf3885 100644
--- a/drivers/net/ethernet/cadence/at91_ether.c
+++ b/drivers/net/ethernet/cadence/at91_ether.c
@@ -342,6 +342,9 @@ static int __init at91ether_probe(struct platform_device *pdev)
342 } 342 }
343 clk_enable(lp->pclk); 343 clk_enable(lp->pclk);
344 344
345 lp->hclk = ERR_PTR(-ENOENT);
346 lp->tx_clk = ERR_PTR(-ENOENT);
347
345 /* Install the interrupt handler */ 348 /* Install the interrupt handler */
346 dev->irq = platform_get_irq(pdev, 0); 349 dev->irq = platform_get_irq(pdev, 0);
347 res = devm_request_irq(&pdev->dev, dev->irq, at91ether_interrupt, 0, dev->name, dev); 350 res = devm_request_irq(&pdev->dev, dev->irq, at91ether_interrupt, 0, dev->name, dev);
diff --git a/drivers/net/ethernet/cisco/enic/enic.h b/drivers/net/ethernet/cisco/enic/enic.h
index e9f7c656ddda..e35c8e0202ad 100644
--- a/drivers/net/ethernet/cisco/enic/enic.h
+++ b/drivers/net/ethernet/cisco/enic/enic.h
@@ -29,6 +29,7 @@
29#include "vnic_stats.h" 29#include "vnic_stats.h"
30#include "vnic_nic.h" 30#include "vnic_nic.h"
31#include "vnic_rss.h" 31#include "vnic_rss.h"
32#include <linux/irq.h>
32 33
33#define DRV_NAME "enic" 34#define DRV_NAME "enic"
34#define DRV_DESCRIPTION "Cisco VIC Ethernet NIC Driver" 35#define DRV_DESCRIPTION "Cisco VIC Ethernet NIC Driver"
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
index f31bb5e9d8a9..7b52a88923ef 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
@@ -23,6 +23,7 @@
23#include <linux/ethtool.h> 23#include <linux/ethtool.h>
24#include <linux/mii.h> 24#include <linux/mii.h>
25#include <linux/timer.h> 25#include <linux/timer.h>
26#include <linux/irq.h>
26 27
27#include <linux/vmalloc.h> 28#include <linux/vmalloc.h>
28 29
diff --git a/drivers/net/ethernet/samsung/Kconfig b/drivers/net/ethernet/samsung/Kconfig
index 7902341f2623..2360d8150777 100644
--- a/drivers/net/ethernet/samsung/Kconfig
+++ b/drivers/net/ethernet/samsung/Kconfig
@@ -3,14 +3,30 @@
3# 3#
4 4
5config NET_VENDOR_SAMSUNG 5config NET_VENDOR_SAMSUNG
6 bool "Samsung Ethernet device" 6 bool "Samsung Ethernet devices"
7 default y 7 default y
8 ---help--- 8 ---help---
9 This is the driver for the SXGBE 10G Ethernet IP block found on Samsung 9 If you have a network (Ethernet) chipset belonging to this class,
10 platforms. 10 say Y.
11
12 Note that the answer to this question does not directly affect
13 the kernel: saying N will just case the configurator to skip all
14 the questions about Samsung chipsets. If you say Y, you will be asked
15 for your specific chipset/driver in the following questions.
11 16
12if NET_VENDOR_SAMSUNG 17if NET_VENDOR_SAMSUNG
13 18
14source "drivers/net/ethernet/samsung/sxgbe/Kconfig" 19config SXGBE_ETH
20 tristate "Samsung 10G/2.5G/1G SXGBE Ethernet driver"
21 depends on HAS_IOMEM && HAS_DMA
22 select PHYLIB
23 select CRC32
24 select PTP_1588_CLOCK
25 ---help---
26 This is the driver for the SXGBE 10G Ethernet IP block found on
27 Samsung platforms.
28
29 To compile this driver as a module, choose M here: the module
30 will be called samsung-sxgbe.
15 31
16endif # NET_VENDOR_SAMSUNG 32endif # NET_VENDOR_SAMSUNG
diff --git a/drivers/net/ethernet/samsung/sxgbe/Kconfig b/drivers/net/ethernet/samsung/sxgbe/Kconfig
deleted file mode 100644
index d79288c51d0a..000000000000
--- a/drivers/net/ethernet/samsung/sxgbe/Kconfig
+++ /dev/null
@@ -1,9 +0,0 @@
1config SXGBE_ETH
2 tristate "Samsung 10G/2.5G/1G SXGBE Ethernet driver"
3 depends on HAS_IOMEM && HAS_DMA
4 select PHYLIB
5 select CRC32
6 select PTP_1588_CLOCK
7 ---help---
8 This is the driver for the SXGBE 10G Ethernet IP block found on Samsung
9 platforms.
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c
index 28f89c41d0cd..4d989ff6c978 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c
@@ -9,7 +9,6 @@
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 */ 11 */
12#include <linux/io.h>
13#include <linux/delay.h> 12#include <linux/delay.h>
14#include <linux/export.h> 13#include <linux/export.h>
15#include <linux/io.h> 14#include <linux/io.h>
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
index a72688e8dc6c..27e8c824b204 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
@@ -2113,11 +2113,11 @@ struct sxgbe_priv_data *sxgbe_drv_probe(struct device *device,
2113 /* allocate memory resources for Descriptor rings */ 2113 /* allocate memory resources for Descriptor rings */
2114 ret = txring_mem_alloc(priv); 2114 ret = txring_mem_alloc(priv);
2115 if (ret) 2115 if (ret)
2116 goto error_free_netdev; 2116 goto error_free_hw;
2117 2117
2118 ret = rxring_mem_alloc(priv); 2118 ret = rxring_mem_alloc(priv);
2119 if (ret) 2119 if (ret)
2120 goto error_free_netdev; 2120 goto error_free_hw;
2121 2121
2122 ndev->netdev_ops = &sxgbe_netdev_ops; 2122 ndev->netdev_ops = &sxgbe_netdev_ops;
2123 2123
@@ -2163,7 +2163,7 @@ struct sxgbe_priv_data *sxgbe_drv_probe(struct device *device,
2163 if (IS_ERR(priv->sxgbe_clk)) { 2163 if (IS_ERR(priv->sxgbe_clk)) {
2164 netdev_warn(ndev, "%s: warning: cannot get CSR clock\n", 2164 netdev_warn(ndev, "%s: warning: cannot get CSR clock\n",
2165 __func__); 2165 __func__);
2166 goto error_clk_get; 2166 goto error_napi_del;
2167 } 2167 }
2168 2168
2169 /* If a specific clk_csr value is passed from the platform 2169 /* If a specific clk_csr value is passed from the platform
@@ -2182,24 +2182,27 @@ struct sxgbe_priv_data *sxgbe_drv_probe(struct device *device,
2182 if (ret < 0) { 2182 if (ret < 0) {
2183 netdev_dbg(ndev, "%s: MDIO bus (id: %d) registration failed\n", 2183 netdev_dbg(ndev, "%s: MDIO bus (id: %d) registration failed\n",
2184 __func__, priv->plat->bus_id); 2184 __func__, priv->plat->bus_id);
2185 goto error_mdio_register; 2185 goto error_clk_put;
2186 } 2186 }
2187 2187
2188 ret = register_netdev(ndev); 2188 ret = register_netdev(ndev);
2189 if (ret) { 2189 if (ret) {
2190 pr_err("%s: ERROR %i registering the device\n", __func__, ret); 2190 pr_err("%s: ERROR %i registering the device\n", __func__, ret);
2191 goto error_netdev_register; 2191 goto error_mdio_unregister;
2192 } 2192 }
2193 2193
2194 sxgbe_check_ether_addr(priv); 2194 sxgbe_check_ether_addr(priv);
2195 2195
2196 return priv; 2196 return priv;
2197 2197
2198error_mdio_register: 2198error_mdio_unregister:
2199 sxgbe_mdio_unregister(ndev);
2200error_clk_put:
2199 clk_put(priv->sxgbe_clk); 2201 clk_put(priv->sxgbe_clk);
2200error_clk_get: 2202error_napi_del:
2201error_netdev_register:
2202 netif_napi_del(&priv->napi); 2203 netif_napi_del(&priv->napi);
2204error_free_hw:
2205 kfree(priv->hw);
2203error_free_netdev: 2206error_free_netdev:
2204 free_netdev(ndev); 2207 free_netdev(ndev);
2205 2208
@@ -2224,11 +2227,15 @@ int sxgbe_drv_remove(struct net_device *ndev)
2224 priv->hw->mac->enable_tx(priv->ioaddr, false); 2227 priv->hw->mac->enable_tx(priv->ioaddr, false);
2225 priv->hw->mac->enable_rx(priv->ioaddr, false); 2228 priv->hw->mac->enable_rx(priv->ioaddr, false);
2226 2229
2227 netif_napi_del(&priv->napi); 2230 unregister_netdev(ndev);
2228 2231
2229 sxgbe_mdio_unregister(ndev); 2232 sxgbe_mdio_unregister(ndev);
2230 2233
2231 unregister_netdev(ndev); 2234 clk_put(priv->sxgbe_clk);
2235
2236 netif_napi_del(&priv->napi);
2237
2238 kfree(priv->hw);
2232 2239
2233 free_netdev(ndev); 2240 free_netdev(ndev);
2234 2241
diff --git a/drivers/net/ethernet/smsc/smc911x.c b/drivers/net/ethernet/smsc/smc911x.c
index 66b05e62f70a..1c44e67c3067 100644
--- a/drivers/net/ethernet/smsc/smc911x.c
+++ b/drivers/net/ethernet/smsc/smc911x.c
@@ -1211,7 +1211,6 @@ static void
1211smc911x_rx_dma_irq(int dma, void *data) 1211smc911x_rx_dma_irq(int dma, void *data)
1212{ 1212{
1213 struct net_device *dev = (struct net_device *)data; 1213 struct net_device *dev = (struct net_device *)data;
1214 unsigned long ioaddr = dev->base_addr;
1215 struct smc911x_local *lp = netdev_priv(dev); 1214 struct smc911x_local *lp = netdev_priv(dev);
1216 struct sk_buff *skb = lp->current_rx_skb; 1215 struct sk_buff *skb = lp->current_rx_skb;
1217 unsigned long flags; 1216 unsigned long flags;
diff --git a/drivers/net/ethernet/ti/cpts.c b/drivers/net/ethernet/ti/cpts.c
index a3bbf59eaafd..243513980b51 100644
--- a/drivers/net/ethernet/ti/cpts.c
+++ b/drivers/net/ethernet/ti/cpts.c
@@ -26,6 +26,8 @@
26#include <linux/time.h> 26#include <linux/time.h>
27#include <linux/uaccess.h> 27#include <linux/uaccess.h>
28#include <linux/workqueue.h> 28#include <linux/workqueue.h>
29#include <linux/if_ether.h>
30#include <linux/if_vlan.h>
29 31
30#include "cpts.h" 32#include "cpts.h"
31 33
diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c
index 89417ac41083..430bb0db9bc4 100644
--- a/drivers/net/ieee802154/at86rf230.c
+++ b/drivers/net/ieee802154/at86rf230.c
@@ -852,7 +852,7 @@ at86rf212_set_csma_params(struct ieee802154_dev *dev, u8 min_be, u8 max_be,
852 if (rc) 852 if (rc)
853 return rc; 853 return rc;
854 854
855 return at86rf230_write_subreg(lp, SR_MAX_CSMA_RETRIES, max_be); 855 return at86rf230_write_subreg(lp, SR_MAX_CSMA_RETRIES, retries);
856} 856}
857 857
858static int 858static int
diff --git a/drivers/net/phy/spi_ks8995.c b/drivers/net/phy/spi_ks8995.c
index 4cf5fb922e59..22b047f1fcdc 100644
--- a/drivers/net/phy/spi_ks8995.c
+++ b/drivers/net/phy/spi_ks8995.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * SPI driver for Micrel/Kendin KS8995M ethernet switch 2 * SPI driver for Micrel/Kendin KS8995M and KSZ8864RMN ethernet switches
3 * 3 *
4 * Copyright (C) 2008 Gabor Juhos <juhosg at openwrt.org> 4 * Copyright (C) 2008 Gabor Juhos <juhosg at openwrt.org>
5 * 5 *
@@ -70,7 +70,10 @@
70#define KS8995_REG_IAD1 0x76 /* Indirect Access Data 1 */ 70#define KS8995_REG_IAD1 0x76 /* Indirect Access Data 1 */
71#define KS8995_REG_IAD0 0x77 /* Indirect Access Data 0 */ 71#define KS8995_REG_IAD0 0x77 /* Indirect Access Data 0 */
72 72
73#define KSZ8864_REG_ID1 0xfe /* Chip ID in bit 7 */
74
73#define KS8995_REGS_SIZE 0x80 75#define KS8995_REGS_SIZE 0x80
76#define KSZ8864_REGS_SIZE 0x100
74 77
75#define ID1_CHIPID_M 0xf 78#define ID1_CHIPID_M 0xf
76#define ID1_CHIPID_S 4 79#define ID1_CHIPID_S 4
@@ -94,6 +97,7 @@ struct ks8995_switch {
94 struct spi_device *spi; 97 struct spi_device *spi;
95 struct mutex lock; 98 struct mutex lock;
96 struct ks8995_pdata *pdata; 99 struct ks8995_pdata *pdata;
100 struct bin_attribute regs_attr;
97}; 101};
98 102
99static inline u8 get_chip_id(u8 val) 103static inline u8 get_chip_id(u8 val)
@@ -216,11 +220,11 @@ static ssize_t ks8995_registers_read(struct file *filp, struct kobject *kobj,
216 dev = container_of(kobj, struct device, kobj); 220 dev = container_of(kobj, struct device, kobj);
217 ks8995 = dev_get_drvdata(dev); 221 ks8995 = dev_get_drvdata(dev);
218 222
219 if (unlikely(off > KS8995_REGS_SIZE)) 223 if (unlikely(off > ks8995->regs_attr.size))
220 return 0; 224 return 0;
221 225
222 if ((off + count) > KS8995_REGS_SIZE) 226 if ((off + count) > ks8995->regs_attr.size)
223 count = KS8995_REGS_SIZE - off; 227 count = ks8995->regs_attr.size - off;
224 228
225 if (unlikely(!count)) 229 if (unlikely(!count))
226 return count; 230 return count;
@@ -238,11 +242,11 @@ static ssize_t ks8995_registers_write(struct file *filp, struct kobject *kobj,
238 dev = container_of(kobj, struct device, kobj); 242 dev = container_of(kobj, struct device, kobj);
239 ks8995 = dev_get_drvdata(dev); 243 ks8995 = dev_get_drvdata(dev);
240 244
241 if (unlikely(off >= KS8995_REGS_SIZE)) 245 if (unlikely(off >= ks8995->regs_attr.size))
242 return -EFBIG; 246 return -EFBIG;
243 247
244 if ((off + count) > KS8995_REGS_SIZE) 248 if ((off + count) > ks8995->regs_attr.size)
245 count = KS8995_REGS_SIZE - off; 249 count = ks8995->regs_attr.size - off;
246 250
247 if (unlikely(!count)) 251 if (unlikely(!count))
248 return count; 252 return count;
@@ -251,7 +255,7 @@ static ssize_t ks8995_registers_write(struct file *filp, struct kobject *kobj,
251} 255}
252 256
253 257
254static struct bin_attribute ks8995_registers_attr = { 258static const struct bin_attribute ks8995_registers_attr = {
255 .attr = { 259 .attr = {
256 .name = "registers", 260 .name = "registers",
257 .mode = S_IRUSR | S_IWUSR, 261 .mode = S_IRUSR | S_IWUSR,
@@ -306,20 +310,44 @@ static int ks8995_probe(struct spi_device *spi)
306 goto err_drvdata; 310 goto err_drvdata;
307 } 311 }
308 312
313 memcpy(&ks->regs_attr, &ks8995_registers_attr, sizeof(ks->regs_attr));
314 if (get_chip_id(ids[1]) != CHIPID_M) {
315 u8 val;
316
317 /* Check if this is a KSZ8864RMN */
318 err = ks8995_read(ks, &val, KSZ8864_REG_ID1, sizeof(val));
319 if (err < 0) {
320 dev_err(&spi->dev,
321 "unable to read chip id register, err=%d\n",
322 err);
323 goto err_drvdata;
324 }
325 if ((val & 0x80) == 0) {
326 dev_err(&spi->dev, "unknown chip:%02x,0\n", ids[1]);
327 goto err_drvdata;
328 }
329 ks->regs_attr.size = KSZ8864_REGS_SIZE;
330 }
331
309 err = ks8995_reset(ks); 332 err = ks8995_reset(ks);
310 if (err) 333 if (err)
311 goto err_drvdata; 334 goto err_drvdata;
312 335
313 err = sysfs_create_bin_file(&spi->dev.kobj, &ks8995_registers_attr); 336 err = sysfs_create_bin_file(&spi->dev.kobj, &ks->regs_attr);
314 if (err) { 337 if (err) {
315 dev_err(&spi->dev, "unable to create sysfs file, err=%d\n", 338 dev_err(&spi->dev, "unable to create sysfs file, err=%d\n",
316 err); 339 err);
317 goto err_drvdata; 340 goto err_drvdata;
318 } 341 }
319 342
320 dev_info(&spi->dev, "KS89%02X device found, Chip ID:%01x, " 343 if (get_chip_id(ids[1]) == CHIPID_M) {
321 "Revision:%01x\n", ids[0], 344 dev_info(&spi->dev,
322 get_chip_id(ids[1]), get_chip_rev(ids[1])); 345 "KS8995 device found, Chip ID:%x, Revision:%x\n",
346 get_chip_id(ids[1]), get_chip_rev(ids[1]));
347 } else {
348 dev_info(&spi->dev, "KSZ8864 device found, Revision:%x\n",
349 get_chip_rev(ids[1]));
350 }
323 351
324 return 0; 352 return 0;
325 353
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 0d862a5077ab..c55e316373a1 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -871,6 +871,9 @@ static int vxlan_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
871 if (err) 871 if (err)
872 return err; 872 return err;
873 873
874 if (vxlan->default_dst.remote_ip.sa.sa_family != ip.sa.sa_family)
875 return -EAFNOSUPPORT;
876
874 spin_lock_bh(&vxlan->hash_lock); 877 spin_lock_bh(&vxlan->hash_lock);
875 err = vxlan_fdb_create(vxlan, addr, &ip, ndm->ndm_state, flags, 878 err = vxlan_fdb_create(vxlan, addr, &ip, ndm->ndm_state, flags,
876 port, vni, ifindex, ndm->ndm_flags); 879 port, vni, ifindex, ndm->ndm_flags);
@@ -2601,9 +2604,10 @@ static int vxlan_newlink(struct net *net, struct net_device *dev,
2601 vni = nla_get_u32(data[IFLA_VXLAN_ID]); 2604 vni = nla_get_u32(data[IFLA_VXLAN_ID]);
2602 dst->remote_vni = vni; 2605 dst->remote_vni = vni;
2603 2606
2607 /* Unless IPv6 is explicitly requested, assume IPv4 */
2608 dst->remote_ip.sa.sa_family = AF_INET;
2604 if (data[IFLA_VXLAN_GROUP]) { 2609 if (data[IFLA_VXLAN_GROUP]) {
2605 dst->remote_ip.sin.sin_addr.s_addr = nla_get_be32(data[IFLA_VXLAN_GROUP]); 2610 dst->remote_ip.sin.sin_addr.s_addr = nla_get_be32(data[IFLA_VXLAN_GROUP]);
2606 dst->remote_ip.sa.sa_family = AF_INET;
2607 } else if (data[IFLA_VXLAN_GROUP6]) { 2611 } else if (data[IFLA_VXLAN_GROUP6]) {
2608 if (!IS_ENABLED(CONFIG_IPV6)) 2612 if (!IS_ENABLED(CONFIG_IPV6))
2609 return -EPFNOSUPPORT; 2613 return -EPFNOSUPPORT;
diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h
index 89d1d0556b6e..630a3fcf65bc 100644
--- a/drivers/net/xen-netback/common.h
+++ b/drivers/net/xen-netback/common.h
@@ -124,6 +124,7 @@ struct xenvif {
124 struct pending_tx_info pending_tx_info[MAX_PENDING_REQS]; 124 struct pending_tx_info pending_tx_info[MAX_PENDING_REQS];
125 grant_handle_t grant_tx_handle[MAX_PENDING_REQS]; 125 grant_handle_t grant_tx_handle[MAX_PENDING_REQS];
126 126
127 struct gnttab_copy tx_copy_ops[MAX_PENDING_REQS];
127 struct gnttab_map_grant_ref tx_map_ops[MAX_PENDING_REQS]; 128 struct gnttab_map_grant_ref tx_map_ops[MAX_PENDING_REQS];
128 struct gnttab_unmap_grant_ref tx_unmap_ops[MAX_PENDING_REQS]; 129 struct gnttab_unmap_grant_ref tx_unmap_ops[MAX_PENDING_REQS];
129 /* passed to gnttab_[un]map_refs with pages under (un)mapping */ 130 /* passed to gnttab_[un]map_refs with pages under (un)mapping */
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
index 3f021e054ba1..76665405c5aa 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -820,13 +820,13 @@ struct xenvif_tx_cb {
820 820
821#define XENVIF_TX_CB(skb) ((struct xenvif_tx_cb *)(skb)->cb) 821#define XENVIF_TX_CB(skb) ((struct xenvif_tx_cb *)(skb)->cb)
822 822
823static inline void xenvif_tx_create_gop(struct xenvif *vif, 823static inline void xenvif_tx_create_map_op(struct xenvif *vif,
824 u16 pending_idx, 824 u16 pending_idx,
825 struct xen_netif_tx_request *txp, 825 struct xen_netif_tx_request *txp,
826 struct gnttab_map_grant_ref *gop) 826 struct gnttab_map_grant_ref *mop)
827{ 827{
828 vif->pages_to_map[gop-vif->tx_map_ops] = vif->mmap_pages[pending_idx]; 828 vif->pages_to_map[mop-vif->tx_map_ops] = vif->mmap_pages[pending_idx];
829 gnttab_set_map_op(gop, idx_to_kaddr(vif, pending_idx), 829 gnttab_set_map_op(mop, idx_to_kaddr(vif, pending_idx),
830 GNTMAP_host_map | GNTMAP_readonly, 830 GNTMAP_host_map | GNTMAP_readonly,
831 txp->gref, vif->domid); 831 txp->gref, vif->domid);
832 832
@@ -880,7 +880,7 @@ static struct gnttab_map_grant_ref *xenvif_get_requests(struct xenvif *vif,
880 shinfo->nr_frags++, txp++, gop++) { 880 shinfo->nr_frags++, txp++, gop++) {
881 index = pending_index(vif->pending_cons++); 881 index = pending_index(vif->pending_cons++);
882 pending_idx = vif->pending_ring[index]; 882 pending_idx = vif->pending_ring[index];
883 xenvif_tx_create_gop(vif, pending_idx, txp, gop); 883 xenvif_tx_create_map_op(vif, pending_idx, txp, gop);
884 frag_set_pending_idx(&frags[shinfo->nr_frags], pending_idx); 884 frag_set_pending_idx(&frags[shinfo->nr_frags], pending_idx);
885 } 885 }
886 886
@@ -900,7 +900,7 @@ static struct gnttab_map_grant_ref *xenvif_get_requests(struct xenvif *vif,
900 shinfo->nr_frags++, txp++, gop++) { 900 shinfo->nr_frags++, txp++, gop++) {
901 index = pending_index(vif->pending_cons++); 901 index = pending_index(vif->pending_cons++);
902 pending_idx = vif->pending_ring[index]; 902 pending_idx = vif->pending_ring[index];
903 xenvif_tx_create_gop(vif, pending_idx, txp, gop); 903 xenvif_tx_create_map_op(vif, pending_idx, txp, gop);
904 frag_set_pending_idx(&frags[shinfo->nr_frags], 904 frag_set_pending_idx(&frags[shinfo->nr_frags],
905 pending_idx); 905 pending_idx);
906 } 906 }
@@ -940,38 +940,42 @@ static inline void xenvif_grant_handle_reset(struct xenvif *vif,
940 940
941static int xenvif_tx_check_gop(struct xenvif *vif, 941static int xenvif_tx_check_gop(struct xenvif *vif,
942 struct sk_buff *skb, 942 struct sk_buff *skb,
943 struct gnttab_map_grant_ref **gopp) 943 struct gnttab_map_grant_ref **gopp_map,
944 struct gnttab_copy **gopp_copy)
944{ 945{
945 struct gnttab_map_grant_ref *gop = *gopp; 946 struct gnttab_map_grant_ref *gop_map = *gopp_map;
946 u16 pending_idx = XENVIF_TX_CB(skb)->pending_idx; 947 u16 pending_idx = XENVIF_TX_CB(skb)->pending_idx;
947 struct skb_shared_info *shinfo = skb_shinfo(skb); 948 struct skb_shared_info *shinfo = skb_shinfo(skb);
948 struct pending_tx_info *tx_info;
949 int nr_frags = shinfo->nr_frags; 949 int nr_frags = shinfo->nr_frags;
950 int i, err, start; 950 int i, err;
951 struct sk_buff *first_skb = NULL; 951 struct sk_buff *first_skb = NULL;
952 952
953 /* Check status of header. */ 953 /* Check status of header. */
954 err = gop->status; 954 err = (*gopp_copy)->status;
955 if (unlikely(err)) 955 (*gopp_copy)++;
956 if (unlikely(err)) {
957 if (net_ratelimit())
958 netdev_dbg(vif->dev,
959 "Grant copy of header failed! status: %d pending_idx: %u ref: %u\n",
960 (*gopp_copy)->status,
961 pending_idx,
962 (*gopp_copy)->source.u.ref);
956 xenvif_idx_release(vif, pending_idx, XEN_NETIF_RSP_ERROR); 963 xenvif_idx_release(vif, pending_idx, XEN_NETIF_RSP_ERROR);
957 else 964 }
958 xenvif_grant_handle_set(vif, pending_idx , gop->handle);
959
960 /* Skip first skb fragment if it is on same page as header fragment. */
961 start = (frag_get_pending_idx(&shinfo->frags[0]) == pending_idx);
962 965
963check_frags: 966check_frags:
964 for (i = start; i < nr_frags; i++) { 967 for (i = 0; i < nr_frags; i++, gop_map++) {
965 int j, newerr; 968 int j, newerr;
966 969
967 pending_idx = frag_get_pending_idx(&shinfo->frags[i]); 970 pending_idx = frag_get_pending_idx(&shinfo->frags[i]);
968 tx_info = &vif->pending_tx_info[pending_idx];
969 971
970 /* Check error status: if okay then remember grant handle. */ 972 /* Check error status: if okay then remember grant handle. */
971 newerr = (++gop)->status; 973 newerr = gop_map->status;
972 974
973 if (likely(!newerr)) { 975 if (likely(!newerr)) {
974 xenvif_grant_handle_set(vif, pending_idx , gop->handle); 976 xenvif_grant_handle_set(vif,
977 pending_idx,
978 gop_map->handle);
975 /* Had a previous error? Invalidate this fragment. */ 979 /* Had a previous error? Invalidate this fragment. */
976 if (unlikely(err)) 980 if (unlikely(err))
977 xenvif_idx_unmap(vif, pending_idx); 981 xenvif_idx_unmap(vif, pending_idx);
@@ -979,18 +983,20 @@ check_frags:
979 } 983 }
980 984
981 /* Error on this fragment: respond to client with an error. */ 985 /* Error on this fragment: respond to client with an error. */
986 if (net_ratelimit())
987 netdev_dbg(vif->dev,
988 "Grant map of %d. frag failed! status: %d pending_idx: %u ref: %u\n",
989 i,
990 gop_map->status,
991 pending_idx,
992 gop_map->ref);
982 xenvif_idx_release(vif, pending_idx, XEN_NETIF_RSP_ERROR); 993 xenvif_idx_release(vif, pending_idx, XEN_NETIF_RSP_ERROR);
983 994
984 /* Not the first error? Preceding frags already invalidated. */ 995 /* Not the first error? Preceding frags already invalidated. */
985 if (err) 996 if (err)
986 continue; 997 continue;
987 /* First error: invalidate header and preceding fragments. */ 998 /* First error: invalidate preceding fragments. */
988 if (!first_skb) 999 for (j = 0; j < i; j++) {
989 pending_idx = XENVIF_TX_CB(skb)->pending_idx;
990 else
991 pending_idx = XENVIF_TX_CB(skb)->pending_idx;
992 xenvif_idx_unmap(vif, pending_idx);
993 for (j = start; j < i; j++) {
994 pending_idx = frag_get_pending_idx(&shinfo->frags[j]); 1000 pending_idx = frag_get_pending_idx(&shinfo->frags[j]);
995 xenvif_idx_unmap(vif, pending_idx); 1001 xenvif_idx_unmap(vif, pending_idx);
996 } 1002 }
@@ -1004,7 +1010,6 @@ check_frags:
1004 skb = shinfo->frag_list; 1010 skb = shinfo->frag_list;
1005 shinfo = skb_shinfo(skb); 1011 shinfo = skb_shinfo(skb);
1006 nr_frags = shinfo->nr_frags; 1012 nr_frags = shinfo->nr_frags;
1007 start = 0;
1008 1013
1009 goto check_frags; 1014 goto check_frags;
1010 } 1015 }
@@ -1015,15 +1020,13 @@ check_frags:
1015 if (first_skb && err) { 1020 if (first_skb && err) {
1016 int j; 1021 int j;
1017 shinfo = skb_shinfo(first_skb); 1022 shinfo = skb_shinfo(first_skb);
1018 pending_idx = XENVIF_TX_CB(skb)->pending_idx; 1023 for (j = 0; j < shinfo->nr_frags; j++) {
1019 start = (frag_get_pending_idx(&shinfo->frags[0]) == pending_idx);
1020 for (j = start; j < shinfo->nr_frags; j++) {
1021 pending_idx = frag_get_pending_idx(&shinfo->frags[j]); 1024 pending_idx = frag_get_pending_idx(&shinfo->frags[j]);
1022 xenvif_idx_unmap(vif, pending_idx); 1025 xenvif_idx_unmap(vif, pending_idx);
1023 } 1026 }
1024 } 1027 }
1025 1028
1026 *gopp = gop + 1; 1029 *gopp_map = gop_map;
1027 return err; 1030 return err;
1028} 1031}
1029 1032
@@ -1034,9 +1037,6 @@ static void xenvif_fill_frags(struct xenvif *vif, struct sk_buff *skb)
1034 int i; 1037 int i;
1035 u16 prev_pending_idx = INVALID_PENDING_IDX; 1038 u16 prev_pending_idx = INVALID_PENDING_IDX;
1036 1039
1037 if (skb_shinfo(skb)->destructor_arg)
1038 prev_pending_idx = XENVIF_TX_CB(skb)->pending_idx;
1039
1040 for (i = 0; i < nr_frags; i++) { 1040 for (i = 0; i < nr_frags; i++) {
1041 skb_frag_t *frag = shinfo->frags + i; 1041 skb_frag_t *frag = shinfo->frags + i;
1042 struct xen_netif_tx_request *txp; 1042 struct xen_netif_tx_request *txp;
@@ -1046,10 +1046,10 @@ static void xenvif_fill_frags(struct xenvif *vif, struct sk_buff *skb)
1046 pending_idx = frag_get_pending_idx(frag); 1046 pending_idx = frag_get_pending_idx(frag);
1047 1047
1048 /* If this is not the first frag, chain it to the previous*/ 1048 /* If this is not the first frag, chain it to the previous*/
1049 if (unlikely(prev_pending_idx == INVALID_PENDING_IDX)) 1049 if (prev_pending_idx == INVALID_PENDING_IDX)
1050 skb_shinfo(skb)->destructor_arg = 1050 skb_shinfo(skb)->destructor_arg =
1051 &callback_param(vif, pending_idx); 1051 &callback_param(vif, pending_idx);
1052 else if (likely(pending_idx != prev_pending_idx)) 1052 else
1053 callback_param(vif, prev_pending_idx).ctx = 1053 callback_param(vif, prev_pending_idx).ctx =
1054 &callback_param(vif, pending_idx); 1054 &callback_param(vif, pending_idx);
1055 1055
@@ -1189,7 +1189,10 @@ static bool tx_credit_exceeded(struct xenvif *vif, unsigned size)
1189 return false; 1189 return false;
1190} 1190}
1191 1191
1192static unsigned xenvif_tx_build_gops(struct xenvif *vif, int budget) 1192static void xenvif_tx_build_gops(struct xenvif *vif,
1193 int budget,
1194 unsigned *copy_ops,
1195 unsigned *map_ops)
1193{ 1196{
1194 struct gnttab_map_grant_ref *gop = vif->tx_map_ops, *request_gop; 1197 struct gnttab_map_grant_ref *gop = vif->tx_map_ops, *request_gop;
1195 struct sk_buff *skb; 1198 struct sk_buff *skb;
@@ -1292,22 +1295,36 @@ static unsigned xenvif_tx_build_gops(struct xenvif *vif, int budget)
1292 } 1295 }
1293 } 1296 }
1294 1297
1295 xenvif_tx_create_gop(vif, pending_idx, &txreq, gop);
1296
1297 gop++;
1298
1299 XENVIF_TX_CB(skb)->pending_idx = pending_idx; 1298 XENVIF_TX_CB(skb)->pending_idx = pending_idx;
1300 1299
1301 __skb_put(skb, data_len); 1300 __skb_put(skb, data_len);
1301 vif->tx_copy_ops[*copy_ops].source.u.ref = txreq.gref;
1302 vif->tx_copy_ops[*copy_ops].source.domid = vif->domid;
1303 vif->tx_copy_ops[*copy_ops].source.offset = txreq.offset;
1304
1305 vif->tx_copy_ops[*copy_ops].dest.u.gmfn =
1306 virt_to_mfn(skb->data);
1307 vif->tx_copy_ops[*copy_ops].dest.domid = DOMID_SELF;
1308 vif->tx_copy_ops[*copy_ops].dest.offset =
1309 offset_in_page(skb->data);
1310
1311 vif->tx_copy_ops[*copy_ops].len = data_len;
1312 vif->tx_copy_ops[*copy_ops].flags = GNTCOPY_source_gref;
1313
1314 (*copy_ops)++;
1302 1315
1303 skb_shinfo(skb)->nr_frags = ret; 1316 skb_shinfo(skb)->nr_frags = ret;
1304 if (data_len < txreq.size) { 1317 if (data_len < txreq.size) {
1305 skb_shinfo(skb)->nr_frags++; 1318 skb_shinfo(skb)->nr_frags++;
1306 frag_set_pending_idx(&skb_shinfo(skb)->frags[0], 1319 frag_set_pending_idx(&skb_shinfo(skb)->frags[0],
1307 pending_idx); 1320 pending_idx);
1321 xenvif_tx_create_map_op(vif, pending_idx, &txreq, gop);
1322 gop++;
1308 } else { 1323 } else {
1309 frag_set_pending_idx(&skb_shinfo(skb)->frags[0], 1324 frag_set_pending_idx(&skb_shinfo(skb)->frags[0],
1310 INVALID_PENDING_IDX); 1325 INVALID_PENDING_IDX);
1326 memcpy(&vif->pending_tx_info[pending_idx].req, &txreq,
1327 sizeof(txreq));
1311 } 1328 }
1312 1329
1313 vif->pending_cons++; 1330 vif->pending_cons++;
@@ -1324,11 +1341,13 @@ static unsigned xenvif_tx_build_gops(struct xenvif *vif, int budget)
1324 1341
1325 vif->tx.req_cons = idx; 1342 vif->tx.req_cons = idx;
1326 1343
1327 if ((gop-vif->tx_map_ops) >= ARRAY_SIZE(vif->tx_map_ops)) 1344 if (((gop-vif->tx_map_ops) >= ARRAY_SIZE(vif->tx_map_ops)) ||
1345 (*copy_ops >= ARRAY_SIZE(vif->tx_copy_ops)))
1328 break; 1346 break;
1329 } 1347 }
1330 1348
1331 return gop - vif->tx_map_ops; 1349 (*map_ops) = gop - vif->tx_map_ops;
1350 return;
1332} 1351}
1333 1352
1334/* Consolidate skb with a frag_list into a brand new one with local pages on 1353/* Consolidate skb with a frag_list into a brand new one with local pages on
@@ -1399,7 +1418,8 @@ static int xenvif_handle_frag_list(struct xenvif *vif, struct sk_buff *skb)
1399 1418
1400static int xenvif_tx_submit(struct xenvif *vif) 1419static int xenvif_tx_submit(struct xenvif *vif)
1401{ 1420{
1402 struct gnttab_map_grant_ref *gop = vif->tx_map_ops; 1421 struct gnttab_map_grant_ref *gop_map = vif->tx_map_ops;
1422 struct gnttab_copy *gop_copy = vif->tx_copy_ops;
1403 struct sk_buff *skb; 1423 struct sk_buff *skb;
1404 int work_done = 0; 1424 int work_done = 0;
1405 1425
@@ -1412,27 +1432,22 @@ static int xenvif_tx_submit(struct xenvif *vif)
1412 txp = &vif->pending_tx_info[pending_idx].req; 1432 txp = &vif->pending_tx_info[pending_idx].req;
1413 1433
1414 /* Check the remap error code. */ 1434 /* Check the remap error code. */
1415 if (unlikely(xenvif_tx_check_gop(vif, skb, &gop))) { 1435 if (unlikely(xenvif_tx_check_gop(vif, skb, &gop_map, &gop_copy))) {
1416 netdev_dbg(vif->dev, "netback grant failed.\n");
1417 skb_shinfo(skb)->nr_frags = 0; 1436 skb_shinfo(skb)->nr_frags = 0;
1418 kfree_skb(skb); 1437 kfree_skb(skb);
1419 continue; 1438 continue;
1420 } 1439 }
1421 1440
1422 data_len = skb->len; 1441 data_len = skb->len;
1423 memcpy(skb->data,
1424 (void *)(idx_to_kaddr(vif, pending_idx)|txp->offset),
1425 data_len);
1426 callback_param(vif, pending_idx).ctx = NULL; 1442 callback_param(vif, pending_idx).ctx = NULL;
1427 if (data_len < txp->size) { 1443 if (data_len < txp->size) {
1428 /* Append the packet payload as a fragment. */ 1444 /* Append the packet payload as a fragment. */
1429 txp->offset += data_len; 1445 txp->offset += data_len;
1430 txp->size -= data_len; 1446 txp->size -= data_len;
1431 skb_shinfo(skb)->destructor_arg =
1432 &callback_param(vif, pending_idx);
1433 } else { 1447 } else {
1434 /* Schedule a response immediately. */ 1448 /* Schedule a response immediately. */
1435 xenvif_idx_unmap(vif, pending_idx); 1449 xenvif_idx_release(vif, pending_idx,
1450 XEN_NETIF_RSP_OKAY);
1436 } 1451 }
1437 1452
1438 if (txp->flags & XEN_NETTXF_csum_blank) 1453 if (txp->flags & XEN_NETTXF_csum_blank)
@@ -1611,22 +1626,25 @@ static inline void xenvif_tx_dealloc_action(struct xenvif *vif)
1611/* Called after netfront has transmitted */ 1626/* Called after netfront has transmitted */
1612int xenvif_tx_action(struct xenvif *vif, int budget) 1627int xenvif_tx_action(struct xenvif *vif, int budget)
1613{ 1628{
1614 unsigned nr_gops; 1629 unsigned nr_mops, nr_cops = 0;
1615 int work_done, ret; 1630 int work_done, ret;
1616 1631
1617 if (unlikely(!tx_work_todo(vif))) 1632 if (unlikely(!tx_work_todo(vif)))
1618 return 0; 1633 return 0;
1619 1634
1620 nr_gops = xenvif_tx_build_gops(vif, budget); 1635 xenvif_tx_build_gops(vif, budget, &nr_cops, &nr_mops);
1621 1636
1622 if (nr_gops == 0) 1637 if (nr_cops == 0)
1623 return 0; 1638 return 0;
1624 1639
1625 ret = gnttab_map_refs(vif->tx_map_ops, 1640 gnttab_batch_copy(vif->tx_copy_ops, nr_cops);
1626 NULL, 1641 if (nr_mops != 0) {
1627 vif->pages_to_map, 1642 ret = gnttab_map_refs(vif->tx_map_ops,
1628 nr_gops); 1643 NULL,
1629 BUG_ON(ret); 1644 vif->pages_to_map,
1645 nr_mops);
1646 BUG_ON(ret);
1647 }
1630 1648
1631 work_done = xenvif_tx_submit(vif); 1649 work_done = xenvif_tx_submit(vif);
1632 1650
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index 5a09a48f2658..c26d0ec2ef3a 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -63,6 +63,7 @@ enum {
63 NETIF_F_HW_VLAN_STAG_RX_BIT, /* Receive VLAN STAG HW acceleration */ 63 NETIF_F_HW_VLAN_STAG_RX_BIT, /* Receive VLAN STAG HW acceleration */
64 NETIF_F_HW_VLAN_STAG_FILTER_BIT,/* Receive filtering on VLAN STAGs */ 64 NETIF_F_HW_VLAN_STAG_FILTER_BIT,/* Receive filtering on VLAN STAGs */
65 NETIF_F_HW_L2FW_DOFFLOAD_BIT, /* Allow L2 Forwarding in Hardware */ 65 NETIF_F_HW_L2FW_DOFFLOAD_BIT, /* Allow L2 Forwarding in Hardware */
66 NETIF_F_BUSY_POLL_BIT, /* Busy poll */
66 67
67 /* 68 /*
68 * Add your fresh new feature above and remember to update 69 * Add your fresh new feature above and remember to update
@@ -118,6 +119,7 @@ enum {
118#define NETIF_F_HW_VLAN_STAG_RX __NETIF_F(HW_VLAN_STAG_RX) 119#define NETIF_F_HW_VLAN_STAG_RX __NETIF_F(HW_VLAN_STAG_RX)
119#define NETIF_F_HW_VLAN_STAG_TX __NETIF_F(HW_VLAN_STAG_TX) 120#define NETIF_F_HW_VLAN_STAG_TX __NETIF_F(HW_VLAN_STAG_TX)
120#define NETIF_F_HW_L2FW_DOFFLOAD __NETIF_F(HW_L2FW_DOFFLOAD) 121#define NETIF_F_HW_L2FW_DOFFLOAD __NETIF_F(HW_L2FW_DOFFLOAD)
122#define NETIF_F_BUSY_POLL __NETIF_F(BUSY_POLL)
121 123
122/* Features valid for ethtool to change */ 124/* Features valid for ethtool to change */
123/* = all defined minus driver/device-class-related */ 125/* = all defined minus driver/device-class-related */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 775cc956ff78..7ed3a3aa6604 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -519,11 +519,18 @@ enum netdev_queue_state_t {
519 __QUEUE_STATE_DRV_XOFF, 519 __QUEUE_STATE_DRV_XOFF,
520 __QUEUE_STATE_STACK_XOFF, 520 __QUEUE_STATE_STACK_XOFF,
521 __QUEUE_STATE_FROZEN, 521 __QUEUE_STATE_FROZEN,
522#define QUEUE_STATE_ANY_XOFF ((1 << __QUEUE_STATE_DRV_XOFF) | \
523 (1 << __QUEUE_STATE_STACK_XOFF))
524#define QUEUE_STATE_ANY_XOFF_OR_FROZEN (QUEUE_STATE_ANY_XOFF | \
525 (1 << __QUEUE_STATE_FROZEN))
526}; 522};
523
524#define QUEUE_STATE_DRV_XOFF (1 << __QUEUE_STATE_DRV_XOFF)
525#define QUEUE_STATE_STACK_XOFF (1 << __QUEUE_STATE_STACK_XOFF)
526#define QUEUE_STATE_FROZEN (1 << __QUEUE_STATE_FROZEN)
527
528#define QUEUE_STATE_ANY_XOFF (QUEUE_STATE_DRV_XOFF | QUEUE_STATE_STACK_XOFF)
529#define QUEUE_STATE_ANY_XOFF_OR_FROZEN (QUEUE_STATE_ANY_XOFF | \
530 QUEUE_STATE_FROZEN)
531#define QUEUE_STATE_DRV_XOFF_OR_FROZEN (QUEUE_STATE_DRV_XOFF | \
532 QUEUE_STATE_FROZEN)
533
527/* 534/*
528 * __QUEUE_STATE_DRV_XOFF is used by drivers to stop the transmit queue. The 535 * __QUEUE_STATE_DRV_XOFF is used by drivers to stop the transmit queue. The
529 * netif_tx_* functions below are used to manipulate this flag. The 536 * netif_tx_* functions below are used to manipulate this flag. The
@@ -2252,11 +2259,18 @@ static inline bool netif_xmit_stopped(const struct netdev_queue *dev_queue)
2252 return dev_queue->state & QUEUE_STATE_ANY_XOFF; 2259 return dev_queue->state & QUEUE_STATE_ANY_XOFF;
2253} 2260}
2254 2261
2255static inline bool netif_xmit_frozen_or_stopped(const struct netdev_queue *dev_queue) 2262static inline bool
2263netif_xmit_frozen_or_stopped(const struct netdev_queue *dev_queue)
2256{ 2264{
2257 return dev_queue->state & QUEUE_STATE_ANY_XOFF_OR_FROZEN; 2265 return dev_queue->state & QUEUE_STATE_ANY_XOFF_OR_FROZEN;
2258} 2266}
2259 2267
2268static inline bool
2269netif_xmit_frozen_or_drv_stopped(const struct netdev_queue *dev_queue)
2270{
2271 return dev_queue->state & QUEUE_STATE_DRV_XOFF_OR_FROZEN;
2272}
2273
2260static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue, 2274static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue,
2261 unsigned int bytes) 2275 unsigned int bytes)
2262{ 2276{
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h
index 956b175523ff..55d15049ab2f 100644
--- a/include/net/netfilter/nf_conntrack_extend.h
+++ b/include/net/netfilter/nf_conntrack_extend.h
@@ -47,8 +47,8 @@ enum nf_ct_ext_id {
47/* Extensions: optional stuff which isn't permanently in struct. */ 47/* Extensions: optional stuff which isn't permanently in struct. */
48struct nf_ct_ext { 48struct nf_ct_ext {
49 struct rcu_head rcu; 49 struct rcu_head rcu;
50 u8 offset[NF_CT_EXT_NUM]; 50 u16 offset[NF_CT_EXT_NUM];
51 u8 len; 51 u16 len;
52 char data[0]; 52 char data[0];
53}; 53};
54 54
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
index 0e474b13463b..1059ed3bc255 100644
--- a/net/bridge/netfilter/ebtables.c
+++ b/net/bridge/netfilter/ebtables.c
@@ -1044,10 +1044,9 @@ static int do_replace_finish(struct net *net, struct ebt_replace *repl,
1044 if (repl->num_counters && 1044 if (repl->num_counters &&
1045 copy_to_user(repl->counters, counterstmp, 1045 copy_to_user(repl->counters, counterstmp,
1046 repl->num_counters * sizeof(struct ebt_counter))) { 1046 repl->num_counters * sizeof(struct ebt_counter))) {
1047 ret = -EFAULT; 1047 /* Silent error, can't fail, new table is already in place */
1048 net_warn_ratelimited("ebtables: counters copy to user failed while replacing table\n");
1048 } 1049 }
1049 else
1050 ret = 0;
1051 1050
1052 /* decrease module count and free resources */ 1051 /* decrease module count and free resources */
1053 EBT_ENTRY_ITERATE(table->entries, table->entries_size, 1052 EBT_ENTRY_ITERATE(table->entries, table->entries_size,
diff --git a/net/core/dev.c b/net/core/dev.c
index 757063420ce0..14dac0654f28 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4043,6 +4043,7 @@ static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb)
4043 skb->vlan_tci = 0; 4043 skb->vlan_tci = 0;
4044 skb->dev = napi->dev; 4044 skb->dev = napi->dev;
4045 skb->skb_iif = 0; 4045 skb->skb_iif = 0;
4046 skb->truesize = SKB_TRUESIZE(skb_end_offset(skb));
4046 4047
4047 napi->skb = skb; 4048 napi->skb = skb;
4048} 4049}
@@ -4588,8 +4589,7 @@ void *netdev_lower_get_next_private(struct net_device *dev,
4588 if (&lower->list == &dev->adj_list.lower) 4589 if (&lower->list == &dev->adj_list.lower)
4589 return NULL; 4590 return NULL;
4590 4591
4591 if (iter) 4592 *iter = lower->list.next;
4592 *iter = lower->list.next;
4593 4593
4594 return lower->private; 4594 return lower->private;
4595} 4595}
@@ -4617,8 +4617,7 @@ void *netdev_lower_get_next_private_rcu(struct net_device *dev,
4617 if (&lower->list == &dev->adj_list.lower) 4617 if (&lower->list == &dev->adj_list.lower)
4618 return NULL; 4618 return NULL;
4619 4619
4620 if (iter) 4620 *iter = &lower->list;
4621 *iter = &lower->list;
4622 4621
4623 return lower->private; 4622 return lower->private;
4624} 4623}
@@ -5696,6 +5695,13 @@ static netdev_features_t netdev_fix_features(struct net_device *dev,
5696 } 5695 }
5697 } 5696 }
5698 5697
5698#ifdef CONFIG_NET_RX_BUSY_POLL
5699 if (dev->netdev_ops->ndo_busy_poll)
5700 features |= NETIF_F_BUSY_POLL;
5701 else
5702#endif
5703 features &= ~NETIF_F_BUSY_POLL;
5704
5699 return features; 5705 return features;
5700} 5706}
5701 5707
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 30071dec287a..640ba0e5831c 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -97,6 +97,7 @@ static const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN]
97 [NETIF_F_RXFCS_BIT] = "rx-fcs", 97 [NETIF_F_RXFCS_BIT] = "rx-fcs",
98 [NETIF_F_RXALL_BIT] = "rx-all", 98 [NETIF_F_RXALL_BIT] = "rx-all",
99 [NETIF_F_HW_L2FW_DOFFLOAD_BIT] = "l2-fwd-offload", 99 [NETIF_F_HW_L2FW_DOFFLOAD_BIT] = "l2-fwd-offload",
100 [NETIF_F_BUSY_POLL_BIT] = "busy-poll",
100}; 101};
101 102
102static int ethtool_get_features(struct net_device *dev, void __user *useraddr) 103static int ethtool_get_features(struct net_device *dev, void __user *useraddr)
diff --git a/net/core/filter.c b/net/core/filter.c
index 765556ba32ef..e08b3822c72a 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -295,43 +295,43 @@ select_insn:
295 (*(s64 *) &A) >>= K; 295 (*(s64 *) &A) >>= K;
296 CONT; 296 CONT;
297 BPF_ALU64_BPF_MOD_BPF_X: 297 BPF_ALU64_BPF_MOD_BPF_X:
298 if (unlikely(X == 0))
299 return 0;
298 tmp = A; 300 tmp = A;
299 if (X) 301 A = do_div(tmp, X);
300 A = do_div(tmp, X);
301 CONT; 302 CONT;
302 BPF_ALU_BPF_MOD_BPF_X: 303 BPF_ALU_BPF_MOD_BPF_X:
304 if (unlikely(X == 0))
305 return 0;
303 tmp = (u32) A; 306 tmp = (u32) A;
304 if (X) 307 A = do_div(tmp, (u32) X);
305 A = do_div(tmp, (u32) X);
306 CONT; 308 CONT;
307 BPF_ALU64_BPF_MOD_BPF_K: 309 BPF_ALU64_BPF_MOD_BPF_K:
308 tmp = A; 310 tmp = A;
309 if (K) 311 A = do_div(tmp, K);
310 A = do_div(tmp, K);
311 CONT; 312 CONT;
312 BPF_ALU_BPF_MOD_BPF_K: 313 BPF_ALU_BPF_MOD_BPF_K:
313 tmp = (u32) A; 314 tmp = (u32) A;
314 if (K) 315 A = do_div(tmp, (u32) K);
315 A = do_div(tmp, (u32) K);
316 CONT; 316 CONT;
317 BPF_ALU64_BPF_DIV_BPF_X: 317 BPF_ALU64_BPF_DIV_BPF_X:
318 if (X) 318 if (unlikely(X == 0))
319 do_div(A, X); 319 return 0;
320 do_div(A, X);
320 CONT; 321 CONT;
321 BPF_ALU_BPF_DIV_BPF_X: 322 BPF_ALU_BPF_DIV_BPF_X:
323 if (unlikely(X == 0))
324 return 0;
322 tmp = (u32) A; 325 tmp = (u32) A;
323 if (X) 326 do_div(tmp, (u32) X);
324 do_div(tmp, (u32) X);
325 A = (u32) tmp; 327 A = (u32) tmp;
326 CONT; 328 CONT;
327 BPF_ALU64_BPF_DIV_BPF_K: 329 BPF_ALU64_BPF_DIV_BPF_K:
328 if (K) 330 do_div(A, K);
329 do_div(A, K);
330 CONT; 331 CONT;
331 BPF_ALU_BPF_DIV_BPF_K: 332 BPF_ALU_BPF_DIV_BPF_K:
332 tmp = (u32) A; 333 tmp = (u32) A;
333 if (K) 334 do_div(tmp, (u32) K);
334 do_div(tmp, (u32) K);
335 A = (u32) tmp; 335 A = (u32) tmp;
336 CONT; 336 CONT;
337 BPF_ALU_BPF_END_BPF_TO_BE: 337 BPF_ALU_BPF_END_BPF_TO_BE:
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index d0dac57291af..d068ec25db1e 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -3340,7 +3340,7 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev)
3340 3340
3341 __netif_tx_lock_bh(txq); 3341 __netif_tx_lock_bh(txq);
3342 3342
3343 if (unlikely(netif_xmit_frozen_or_stopped(txq))) { 3343 if (unlikely(netif_xmit_frozen_or_drv_stopped(txq))) {
3344 ret = NETDEV_TX_BUSY; 3344 ret = NETDEV_TX_BUSY;
3345 pkt_dev->last_ok = 0; 3345 pkt_dev->last_ok = 0;
3346 goto unlock; 3346 goto unlock;
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
index 59da7cde0724..f95b6f93814b 100644
--- a/net/ipv4/netfilter/arp_tables.c
+++ b/net/ipv4/netfilter/arp_tables.c
@@ -1044,8 +1044,10 @@ static int __do_replace(struct net *net, const char *name,
1044 1044
1045 xt_free_table_info(oldinfo); 1045 xt_free_table_info(oldinfo);
1046 if (copy_to_user(counters_ptr, counters, 1046 if (copy_to_user(counters_ptr, counters,
1047 sizeof(struct xt_counters) * num_counters) != 0) 1047 sizeof(struct xt_counters) * num_counters) != 0) {
1048 ret = -EFAULT; 1048 /* Silent error, can't fail, new table is already in place */
1049 net_warn_ratelimited("arptables: counters copy to user failed while replacing table\n");
1050 }
1049 vfree(counters); 1051 vfree(counters);
1050 xt_table_unlock(t); 1052 xt_table_unlock(t);
1051 return ret; 1053 return ret;
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
index 718dfbd30cbe..99e810f84671 100644
--- a/net/ipv4/netfilter/ip_tables.c
+++ b/net/ipv4/netfilter/ip_tables.c
@@ -1231,8 +1231,10 @@ __do_replace(struct net *net, const char *name, unsigned int valid_hooks,
1231 1231
1232 xt_free_table_info(oldinfo); 1232 xt_free_table_info(oldinfo);
1233 if (copy_to_user(counters_ptr, counters, 1233 if (copy_to_user(counters_ptr, counters,
1234 sizeof(struct xt_counters) * num_counters) != 0) 1234 sizeof(struct xt_counters) * num_counters) != 0) {
1235 ret = -EFAULT; 1235 /* Silent error, can't fail, new table is already in place */
1236 net_warn_ratelimited("iptables: counters copy to user failed while replacing table\n");
1237 }
1236 vfree(counters); 1238 vfree(counters);
1237 xt_table_unlock(t); 1239 xt_table_unlock(t);
1238 return ret; 1240 return ret;
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
index 710238f58aa9..e080fbbbc0e5 100644
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -1241,8 +1241,10 @@ __do_replace(struct net *net, const char *name, unsigned int valid_hooks,
1241 1241
1242 xt_free_table_info(oldinfo); 1242 xt_free_table_info(oldinfo);
1243 if (copy_to_user(counters_ptr, counters, 1243 if (copy_to_user(counters_ptr, counters,
1244 sizeof(struct xt_counters) * num_counters) != 0) 1244 sizeof(struct xt_counters) * num_counters) != 0) {
1245 ret = -EFAULT; 1245 /* Silent error, can't fail, new table is already in place */
1246 net_warn_ratelimited("ip6tables: counters copy to user failed while replacing table\n");
1247 }
1246 vfree(counters); 1248 vfree(counters);
1247 xt_table_unlock(t); 1249 xt_table_unlock(t);
1248 return ret; 1250 return ret;
diff --git a/net/mac802154/mib.c b/net/mac802154/mib.c
index 153bd1ddbfbb..f0991f2344d4 100644
--- a/net/mac802154/mib.c
+++ b/net/mac802154/mib.c
@@ -26,7 +26,6 @@
26#include <net/mac802154.h> 26#include <net/mac802154.h>
27#include <net/ieee802154_netdev.h> 27#include <net/ieee802154_netdev.h>
28#include <net/wpan-phy.h> 28#include <net/wpan-phy.h>
29#include <net/ieee802154_netdev.h>
30 29
31#include "mac802154.h" 30#include "mac802154.h"
32 31
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 33045a562297..3fd159db9f06 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -152,8 +152,8 @@ nf_tables_chain_type_lookup(const struct nft_af_info *afi,
152#ifdef CONFIG_MODULES 152#ifdef CONFIG_MODULES
153 if (autoload) { 153 if (autoload) {
154 nfnl_unlock(NFNL_SUBSYS_NFTABLES); 154 nfnl_unlock(NFNL_SUBSYS_NFTABLES);
155 request_module("nft-chain-%u-%*.s", afi->family, 155 request_module("nft-chain-%u-%.*s", afi->family,
156 nla_len(nla)-1, (const char *)nla_data(nla)); 156 nla_len(nla), (const char *)nla_data(nla));
157 nfnl_lock(NFNL_SUBSYS_NFTABLES); 157 nfnl_lock(NFNL_SUBSYS_NFTABLES);
158 type = __nf_tables_chain_type_lookup(afi->family, nla); 158 type = __nf_tables_chain_type_lookup(afi->family, nla);
159 if (type != NULL) 159 if (type != NULL)
@@ -1946,7 +1946,8 @@ static const struct nft_set_ops *nft_select_set_ops(const struct nlattr * const
1946 1946
1947static const struct nla_policy nft_set_policy[NFTA_SET_MAX + 1] = { 1947static const struct nla_policy nft_set_policy[NFTA_SET_MAX + 1] = {
1948 [NFTA_SET_TABLE] = { .type = NLA_STRING }, 1948 [NFTA_SET_TABLE] = { .type = NLA_STRING },
1949 [NFTA_SET_NAME] = { .type = NLA_STRING }, 1949 [NFTA_SET_NAME] = { .type = NLA_STRING,
1950 .len = IFNAMSIZ - 1 },
1950 [NFTA_SET_FLAGS] = { .type = NLA_U32 }, 1951 [NFTA_SET_FLAGS] = { .type = NLA_U32 },
1951 [NFTA_SET_KEY_TYPE] = { .type = NLA_U32 }, 1952 [NFTA_SET_KEY_TYPE] = { .type = NLA_U32 },
1952 [NFTA_SET_KEY_LEN] = { .type = NLA_U32 }, 1953 [NFTA_SET_KEY_LEN] = { .type = NLA_U32 },
diff --git a/net/netfilter/xt_cgroup.c b/net/netfilter/xt_cgroup.c
index 9a8e77e7f8d4..f4e833005320 100644
--- a/net/netfilter/xt_cgroup.c
+++ b/net/netfilter/xt_cgroup.c
@@ -54,7 +54,8 @@ static struct xt_match cgroup_mt_reg __read_mostly = {
54 .matchsize = sizeof(struct xt_cgroup_info), 54 .matchsize = sizeof(struct xt_cgroup_info),
55 .me = THIS_MODULE, 55 .me = THIS_MODULE,
56 .hooks = (1 << NF_INET_LOCAL_OUT) | 56 .hooks = (1 << NF_INET_LOCAL_OUT) |
57 (1 << NF_INET_POST_ROUTING), 57 (1 << NF_INET_POST_ROUTING) |
58 (1 << NF_INET_LOCAL_IN),
58}; 59};
59 60
60static int __init cgroup_mt_init(void) 61static int __init cgroup_mt_init(void)
diff --git a/net/netfilter/xt_connlimit.c b/net/netfilter/xt_connlimit.c
index 458464e7bd7a..fbc66bb250d5 100644
--- a/net/netfilter/xt_connlimit.c
+++ b/net/netfilter/xt_connlimit.c
@@ -32,8 +32,14 @@
32#include <net/netfilter/nf_conntrack_tuple.h> 32#include <net/netfilter/nf_conntrack_tuple.h>
33#include <net/netfilter/nf_conntrack_zones.h> 33#include <net/netfilter/nf_conntrack_zones.h>
34 34
35#define CONNLIMIT_SLOTS 32 35#define CONNLIMIT_SLOTS 256U
36#define CONNLIMIT_LOCK_SLOTS 32 36
37#ifdef CONFIG_LOCKDEP
38#define CONNLIMIT_LOCK_SLOTS 8U
39#else
40#define CONNLIMIT_LOCK_SLOTS 256U
41#endif
42
37#define CONNLIMIT_GC_MAX_NODES 8 43#define CONNLIMIT_GC_MAX_NODES 8
38 44
39/* we will save the tuples of all connections we care about */ 45/* we will save the tuples of all connections we care about */
@@ -49,10 +55,11 @@ struct xt_connlimit_rb {
49 union nf_inet_addr addr; /* search key */ 55 union nf_inet_addr addr; /* search key */
50}; 56};
51 57
58static spinlock_t xt_connlimit_locks[CONNLIMIT_LOCK_SLOTS] __cacheline_aligned_in_smp;
59
52struct xt_connlimit_data { 60struct xt_connlimit_data {
53 struct rb_root climit_root4[CONNLIMIT_SLOTS]; 61 struct rb_root climit_root4[CONNLIMIT_SLOTS];
54 struct rb_root climit_root6[CONNLIMIT_SLOTS]; 62 struct rb_root climit_root6[CONNLIMIT_SLOTS];
55 spinlock_t locks[CONNLIMIT_LOCK_SLOTS];
56}; 63};
57 64
58static u_int32_t connlimit_rnd __read_mostly; 65static u_int32_t connlimit_rnd __read_mostly;
@@ -297,11 +304,11 @@ static int count_them(struct net *net,
297 root = &data->climit_root4[hash]; 304 root = &data->climit_root4[hash];
298 } 305 }
299 306
300 spin_lock_bh(&data->locks[hash % CONNLIMIT_LOCK_SLOTS]); 307 spin_lock_bh(&xt_connlimit_locks[hash % CONNLIMIT_LOCK_SLOTS]);
301 308
302 count = count_tree(net, root, tuple, addr, mask, family); 309 count = count_tree(net, root, tuple, addr, mask, family);
303 310
304 spin_unlock_bh(&data->locks[hash % CONNLIMIT_LOCK_SLOTS]); 311 spin_unlock_bh(&xt_connlimit_locks[hash % CONNLIMIT_LOCK_SLOTS]);
305 312
306 return count; 313 return count;
307} 314}
@@ -377,9 +384,6 @@ static int connlimit_mt_check(const struct xt_mtchk_param *par)
377 return -ENOMEM; 384 return -ENOMEM;
378 } 385 }
379 386
380 for (i = 0; i < ARRAY_SIZE(info->data->locks); ++i)
381 spin_lock_init(&info->data->locks[i]);
382
383 for (i = 0; i < ARRAY_SIZE(info->data->climit_root4); ++i) 387 for (i = 0; i < ARRAY_SIZE(info->data->climit_root4); ++i)
384 info->data->climit_root4[i] = RB_ROOT; 388 info->data->climit_root4[i] = RB_ROOT;
385 for (i = 0; i < ARRAY_SIZE(info->data->climit_root6); ++i) 389 for (i = 0; i < ARRAY_SIZE(info->data->climit_root6); ++i)
@@ -435,11 +439,14 @@ static struct xt_match connlimit_mt_reg __read_mostly = {
435 439
436static int __init connlimit_mt_init(void) 440static int __init connlimit_mt_init(void)
437{ 441{
438 int ret; 442 int ret, i;
439 443
440 BUILD_BUG_ON(CONNLIMIT_LOCK_SLOTS > CONNLIMIT_SLOTS); 444 BUILD_BUG_ON(CONNLIMIT_LOCK_SLOTS > CONNLIMIT_SLOTS);
441 BUILD_BUG_ON((CONNLIMIT_SLOTS % CONNLIMIT_LOCK_SLOTS) != 0); 445 BUILD_BUG_ON((CONNLIMIT_SLOTS % CONNLIMIT_LOCK_SLOTS) != 0);
442 446
447 for (i = 0; i < CONNLIMIT_LOCK_SLOTS; ++i)
448 spin_lock_init(&xt_connlimit_locks[i]);
449
443 connlimit_conn_cachep = kmem_cache_create("xt_connlimit_conn", 450 connlimit_conn_cachep = kmem_cache_create("xt_connlimit_conn",
444 sizeof(struct xt_connlimit_conn), 451 sizeof(struct xt_connlimit_conn),
445 0, 0, NULL); 452 0, 0, NULL);
diff --git a/net/netfilter/xt_osf.c b/net/netfilter/xt_osf.c
index 7174611bd672..c529161cdbf8 100644
--- a/net/netfilter/xt_osf.c
+++ b/net/netfilter/xt_osf.c
@@ -422,4 +422,6 @@ module_exit(xt_osf_fini);
422MODULE_LICENSE("GPL"); 422MODULE_LICENSE("GPL");
423MODULE_AUTHOR("Evgeniy Polyakov <zbr@ioremap.net>"); 423MODULE_AUTHOR("Evgeniy Polyakov <zbr@ioremap.net>");
424MODULE_DESCRIPTION("Passive OS fingerprint matching."); 424MODULE_DESCRIPTION("Passive OS fingerprint matching.");
425MODULE_ALIAS("ipt_osf");
426MODULE_ALIAS("ip6t_osf");
425MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_OSF); 427MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_OSF);
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 01039d2b1695..72e0c71fb01d 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -261,7 +261,7 @@ static int packet_direct_xmit(struct sk_buff *skb)
261 local_bh_disable(); 261 local_bh_disable();
262 262
263 HARD_TX_LOCK(dev, txq, smp_processor_id()); 263 HARD_TX_LOCK(dev, txq, smp_processor_id());
264 if (!netif_xmit_frozen_or_stopped(txq)) { 264 if (!netif_xmit_frozen_or_drv_stopped(txq)) {
265 ret = ops->ndo_start_xmit(skb, dev); 265 ret = ops->ndo_start_xmit(skb, dev);
266 if (ret == NETDEV_TX_OK) 266 if (ret == NETDEV_TX_OK)
267 txq_trans_update(txq); 267 txq_trans_update(txq);
@@ -275,6 +275,7 @@ static int packet_direct_xmit(struct sk_buff *skb)
275 275
276 return ret; 276 return ret;
277drop: 277drop:
278 atomic_long_inc(&dev->tx_dropped);
278 kfree_skb(skb); 279 kfree_skb(skb);
279 return NET_XMIT_DROP; 280 return NET_XMIT_DROP;
280} 281}
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 981aaf8b6ace..5f83a6a2fa67 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -6593,6 +6593,40 @@ static void __sctp_write_space(struct sctp_association *asoc)
6593 } 6593 }
6594} 6594}
6595 6595
6596static void sctp_wake_up_waiters(struct sock *sk,
6597 struct sctp_association *asoc)
6598{
6599 struct sctp_association *tmp = asoc;
6600
6601 /* We do accounting for the sndbuf space per association,
6602 * so we only need to wake our own association.
6603 */
6604 if (asoc->ep->sndbuf_policy)
6605 return __sctp_write_space(asoc);
6606
6607 /* Accounting for the sndbuf space is per socket, so we
6608 * need to wake up others, try to be fair and in case of
6609 * other associations, let them have a go first instead
6610 * of just doing a sctp_write_space() call.
6611 *
6612 * Note that we reach sctp_wake_up_waiters() only when
6613 * associations free up queued chunks, thus we are under
6614 * lock and the list of associations on a socket is
6615 * guaranteed not to change.
6616 */
6617 for (tmp = list_next_entry(tmp, asocs); 1;
6618 tmp = list_next_entry(tmp, asocs)) {
6619 /* Manually skip the head element. */
6620 if (&tmp->asocs == &((sctp_sk(sk))->ep->asocs))
6621 continue;
6622 /* Wake up association. */
6623 __sctp_write_space(tmp);
6624 /* We've reached the end. */
6625 if (tmp == asoc)
6626 break;
6627 }
6628}
6629
6596/* Do accounting for the sndbuf space. 6630/* Do accounting for the sndbuf space.
6597 * Decrement the used sndbuf space of the corresponding association by the 6631 * Decrement the used sndbuf space of the corresponding association by the
6598 * data size which was just transmitted(freed). 6632 * data size which was just transmitted(freed).
@@ -6620,7 +6654,7 @@ static void sctp_wfree(struct sk_buff *skb)
6620 sk_mem_uncharge(sk, skb->truesize); 6654 sk_mem_uncharge(sk, skb->truesize);
6621 6655
6622 sock_wfree(skb); 6656 sock_wfree(skb);
6623 __sctp_write_space(asoc); 6657 sctp_wake_up_waiters(sk, asoc);
6624 6658
6625 sctp_association_put(asoc); 6659 sctp_association_put(asoc);
6626} 6660}
diff --git a/net/tipc/net.c b/net/tipc/net.c
index 0374a817631e..4c564eb69e1a 100644
--- a/net/tipc/net.c
+++ b/net/tipc/net.c
@@ -182,6 +182,8 @@ void tipc_net_start(u32 addr)
182 tipc_bclink_init(); 182 tipc_bclink_init();
183 write_unlock_bh(&tipc_net_lock); 183 write_unlock_bh(&tipc_net_lock);
184 184
185 tipc_nametbl_publish(TIPC_CFG_SRV, tipc_own_addr, tipc_own_addr,
186 TIPC_ZONE_SCOPE, 0, tipc_own_addr);
185 pr_info("Started in network mode\n"); 187 pr_info("Started in network mode\n");
186 pr_info("Own node address %s, network identity %u\n", 188 pr_info("Own node address %s, network identity %u\n",
187 tipc_addr_string_fill(addr_string, tipc_own_addr), tipc_net_id); 189 tipc_addr_string_fill(addr_string, tipc_own_addr), tipc_net_id);
@@ -192,6 +194,7 @@ void tipc_net_stop(void)
192 if (!tipc_own_addr) 194 if (!tipc_own_addr)
193 return; 195 return;
194 196
197 tipc_nametbl_withdraw(TIPC_CFG_SRV, tipc_own_addr, 0, tipc_own_addr);
195 write_lock_bh(&tipc_net_lock); 198 write_lock_bh(&tipc_net_lock);
196 tipc_bearer_stop(); 199 tipc_bearer_stop();
197 tipc_bclink_stop(); 200 tipc_bclink_stop();
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 29b7f26a12cf..adc12e227303 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -301,7 +301,6 @@ static int tipc_release(struct socket *sock)
301 struct tipc_sock *tsk; 301 struct tipc_sock *tsk;
302 struct tipc_port *port; 302 struct tipc_port *port;
303 struct sk_buff *buf; 303 struct sk_buff *buf;
304 int res;
305 304
306 /* 305 /*
307 * Exit if socket isn't fully initialized (occurs when a failed accept() 306 * Exit if socket isn't fully initialized (occurs when a failed accept()
@@ -349,7 +348,7 @@ static int tipc_release(struct socket *sock)
349 sock_put(sk); 348 sock_put(sk);
350 sock->sk = NULL; 349 sock->sk = NULL;
351 350
352 return res; 351 return 0;
353} 352}
354 353
355/** 354/**