aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-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
17 files changed, 175 insertions, 105 deletions
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