aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/bonding/bond_alb.c2
-rw-r--r--drivers/net/bonding/bond_alb.h9
-rw-r--r--drivers/net/bonding/bond_main.c1
-rw-r--r--drivers/net/bonding/bond_sysfs.c39
-rw-r--r--drivers/net/bonding/bonding.h1
-rw-r--r--drivers/net/ethernet/adi/bfin_mac.c4
-rw-r--r--drivers/net/ethernet/amd/sun3lance.c2
-rw-r--r--drivers/net/ethernet/atheros/alx/main.c9
-rw-r--r--drivers/net/ethernet/broadcom/bgmac.c44
-rw-r--r--drivers/net/ethernet/broadcom/bgmac.h4
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x.h37
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c8
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c4
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c14
-rw-r--r--drivers/net/ethernet/broadcom/cnic.c6
-rw-r--r--drivers/net/ethernet/broadcom/tg3.c6
-rw-r--r--drivers/net/ethernet/broadcom/tg3.h1
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c4
-rw-r--r--drivers/net/ethernet/dec/tulip/de4x5.c2
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c2
-rw-r--r--drivers/net/ethernet/freescale/fec_main.c2
-rw-r--r--drivers/net/ethernet/hp/hp100.c2
-rw-r--r--drivers/net/ethernet/ibm/ehea/ehea_main.c21
-rw-r--r--drivers/net/ethernet/intel/e1000e/ethtool.c8
-rw-r--r--drivers/net/ethernet/intel/e1000e/ich8lan.c13
-rw-r--r--drivers/net/ethernet/intel/e1000e/ich8lan.h2
-rw-r--r--drivers/net/ethernet/intel/e1000e/netdev.c2
-rw-r--r--drivers/net/ethernet/intel/igb/e1000_82575.c4
-rw-r--r--drivers/net/ethernet/intel/igb/e1000_mac.c10
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c25
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c19
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_type.h1
-rw-r--r--drivers/net/ethernet/lantiq_etop.c6
-rw-r--r--drivers/net/ethernet/marvell/pxa168_eth.c3
-rw-r--r--drivers/net/ethernet/marvell/skge.c5
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_ethtool.c16
-rw-r--r--drivers/net/ethernet/micrel/ks8851_mll.c2
-rw-r--r--drivers/net/ethernet/natsemi/jazzsonic.c3
-rw-r--r--drivers/net/ethernet/natsemi/xtsonic.c3
-rw-r--r--drivers/net/ethernet/pasemi/pasemi_mac.c4
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c1
-rw-r--r--drivers/net/ethernet/realtek/r8169.c1
-rw-r--r--drivers/net/ethernet/sfc/Kconfig2
-rw-r--r--drivers/net/ethernet/sfc/ef10.c58
-rw-r--r--drivers/net/ethernet/sfc/mcdi_port.c2
-rw-r--r--drivers/net/ethernet/sfc/nic.h3
-rw-r--r--drivers/net/ethernet/smsc/smc91x.h2
-rw-r--r--drivers/net/ethernet/smsc/smsc9420.c3
-rw-r--r--drivers/net/ethernet/toshiba/ps3_gelic_net.c2
-rw-r--r--drivers/net/irda/mcs7780.c40
-rw-r--r--drivers/net/loopback.c1
-rw-r--r--drivers/net/netconsole.c5
-rw-r--r--drivers/net/phy/cicada.c4
-rw-r--r--drivers/net/ppp/pptp.c2
-rw-r--r--drivers/net/tun.c11
-rw-r--r--drivers/net/usb/cdc_ether.c115
-rw-r--r--drivers/net/vxlan.c40
-rw-r--r--drivers/net/wireless/brcm80211/Kconfig4
-rw-r--r--drivers/net/wireless/cw1200/cw1200_spi.c28
-rw-r--r--drivers/net/wireless/cw1200/fwio.c2
-rw-r--r--drivers/net/wireless/cw1200/hwbus.h1
-rw-r--r--drivers/net/wireless/cw1200/hwio.c15
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.c11
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187/dev.c15
-rw-r--r--drivers/net/xen-netback/common.h1
-rw-r--r--drivers/net/xen-netback/interface.c28
-rw-r--r--drivers/net/xen-netback/netback.c94
-rw-r--r--drivers/net/xen-netback/xenbus.c17
68 files changed, 554 insertions, 304 deletions
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index 91f179d5135c..f428ef574372 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -1472,7 +1472,7 @@ void bond_alb_monitor(struct work_struct *work)
1472 bond_info->lp_counter++; 1472 bond_info->lp_counter++;
1473 1473
1474 /* send learning packets */ 1474 /* send learning packets */
1475 if (bond_info->lp_counter >= BOND_ALB_LP_TICKS) { 1475 if (bond_info->lp_counter >= BOND_ALB_LP_TICKS(bond)) {
1476 /* change of curr_active_slave involves swapping of mac addresses. 1476 /* change of curr_active_slave involves swapping of mac addresses.
1477 * in order to avoid this swapping from happening while 1477 * in order to avoid this swapping from happening while
1478 * sending the learning packets, the curr_slave_lock must be held for 1478 * sending the learning packets, the curr_slave_lock must be held for
diff --git a/drivers/net/bonding/bond_alb.h b/drivers/net/bonding/bond_alb.h
index 28d8e4c7dc06..c5eff5dafdfe 100644
--- a/drivers/net/bonding/bond_alb.h
+++ b/drivers/net/bonding/bond_alb.h
@@ -36,14 +36,15 @@ struct slave;
36 * Used for division - never set 36 * Used for division - never set
37 * to zero !!! 37 * to zero !!!
38 */ 38 */
39#define BOND_ALB_LP_INTERVAL 1 /* In seconds, periodic send of 39#define BOND_ALB_DEFAULT_LP_INTERVAL 1
40 * learning packets to the switch 40#define BOND_ALB_LP_INTERVAL(bond) (bond->params.lp_interval) /* In seconds, periodic send of
41 */ 41 * learning packets to the switch
42 */
42 43
43#define BOND_TLB_REBALANCE_TICKS (BOND_TLB_REBALANCE_INTERVAL \ 44#define BOND_TLB_REBALANCE_TICKS (BOND_TLB_REBALANCE_INTERVAL \
44 * ALB_TIMER_TICKS_PER_SEC) 45 * ALB_TIMER_TICKS_PER_SEC)
45 46
46#define BOND_ALB_LP_TICKS (BOND_ALB_LP_INTERVAL \ 47#define BOND_ALB_LP_TICKS(bond) (BOND_ALB_LP_INTERVAL(bond) \
47 * ALB_TIMER_TICKS_PER_SEC) 48 * ALB_TIMER_TICKS_PER_SEC)
48 49
49#define TLB_HASH_TABLE_SIZE 256 /* The size of the clients hash table. 50#define TLB_HASH_TABLE_SIZE 256 /* The size of the clients hash table.
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 72df399c4ab3..55bbb8b8200c 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -4416,6 +4416,7 @@ static int bond_check_params(struct bond_params *params)
4416 params->all_slaves_active = all_slaves_active; 4416 params->all_slaves_active = all_slaves_active;
4417 params->resend_igmp = resend_igmp; 4417 params->resend_igmp = resend_igmp;
4418 params->min_links = min_links; 4418 params->min_links = min_links;
4419 params->lp_interval = BOND_ALB_DEFAULT_LP_INTERVAL;
4419 4420
4420 if (primary) { 4421 if (primary) {
4421 strncpy(params->primary, primary, IFNAMSIZ); 4422 strncpy(params->primary, primary, IFNAMSIZ);
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index eeab40b01b7a..c29b836749b6 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -1699,6 +1699,44 @@ out:
1699static DEVICE_ATTR(resend_igmp, S_IRUGO | S_IWUSR, 1699static DEVICE_ATTR(resend_igmp, S_IRUGO | S_IWUSR,
1700 bonding_show_resend_igmp, bonding_store_resend_igmp); 1700 bonding_show_resend_igmp, bonding_store_resend_igmp);
1701 1701
1702
1703static ssize_t bonding_show_lp_interval(struct device *d,
1704 struct device_attribute *attr,
1705 char *buf)
1706{
1707 struct bonding *bond = to_bond(d);
1708 return sprintf(buf, "%d\n", bond->params.lp_interval);
1709}
1710
1711static ssize_t bonding_store_lp_interval(struct device *d,
1712 struct device_attribute *attr,
1713 const char *buf, size_t count)
1714{
1715 struct bonding *bond = to_bond(d);
1716 int new_value, ret = count;
1717
1718 if (sscanf(buf, "%d", &new_value) != 1) {
1719 pr_err("%s: no lp interval value specified.\n",
1720 bond->dev->name);
1721 ret = -EINVAL;
1722 goto out;
1723 }
1724
1725 if (new_value <= 0) {
1726 pr_err ("%s: lp_interval must be between 1 and %d\n",
1727 bond->dev->name, INT_MAX);
1728 ret = -EINVAL;
1729 goto out;
1730 }
1731
1732 bond->params.lp_interval = new_value;
1733out:
1734 return ret;
1735}
1736
1737static DEVICE_ATTR(lp_interval, S_IRUGO | S_IWUSR,
1738 bonding_show_lp_interval, bonding_store_lp_interval);
1739
1702static struct attribute *per_bond_attrs[] = { 1740static struct attribute *per_bond_attrs[] = {
1703 &dev_attr_slaves.attr, 1741 &dev_attr_slaves.attr,
1704 &dev_attr_mode.attr, 1742 &dev_attr_mode.attr,
@@ -1729,6 +1767,7 @@ static struct attribute *per_bond_attrs[] = {
1729 &dev_attr_all_slaves_active.attr, 1767 &dev_attr_all_slaves_active.attr,
1730 &dev_attr_resend_igmp.attr, 1768 &dev_attr_resend_igmp.attr,
1731 &dev_attr_min_links.attr, 1769 &dev_attr_min_links.attr,
1770 &dev_attr_lp_interval.attr,
1732 NULL, 1771 NULL,
1733}; 1772};
1734 1773
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 7ad8bd5cc947..03cf3fd14490 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -176,6 +176,7 @@ struct bond_params {
176 int tx_queues; 176 int tx_queues;
177 int all_slaves_active; 177 int all_slaves_active;
178 int resend_igmp; 178 int resend_igmp;
179 int lp_interval;
179}; 180};
180 181
181struct bond_parm_tbl { 182struct bond_parm_tbl {
diff --git a/drivers/net/ethernet/adi/bfin_mac.c b/drivers/net/ethernet/adi/bfin_mac.c
index e66684a438f5..75fb1d20d6fd 100644
--- a/drivers/net/ethernet/adi/bfin_mac.c
+++ b/drivers/net/ethernet/adi/bfin_mac.c
@@ -530,7 +530,7 @@ static int bfin_mac_ethtool_setwol(struct net_device *dev,
530 if (lp->wol && !lp->irq_wake_requested) { 530 if (lp->wol && !lp->irq_wake_requested) {
531 /* register wake irq handler */ 531 /* register wake irq handler */
532 rc = request_irq(IRQ_MAC_WAKEDET, bfin_mac_wake_interrupt, 532 rc = request_irq(IRQ_MAC_WAKEDET, bfin_mac_wake_interrupt,
533 IRQF_DISABLED, "EMAC_WAKE", dev); 533 0, "EMAC_WAKE", dev);
534 if (rc) 534 if (rc)
535 return rc; 535 return rc;
536 lp->irq_wake_requested = true; 536 lp->irq_wake_requested = true;
@@ -1686,7 +1686,7 @@ static int bfin_mac_probe(struct platform_device *pdev)
1686 /* now, enable interrupts */ 1686 /* now, enable interrupts */
1687 /* register irq handler */ 1687 /* register irq handler */
1688 rc = request_irq(IRQ_MAC_RX, bfin_mac_interrupt, 1688 rc = request_irq(IRQ_MAC_RX, bfin_mac_interrupt,
1689 IRQF_DISABLED, "EMAC_RX", ndev); 1689 0, "EMAC_RX", ndev);
1690 if (rc) { 1690 if (rc) {
1691 dev_err(&pdev->dev, "Cannot request Blackfin MAC RX IRQ!\n"); 1691 dev_err(&pdev->dev, "Cannot request Blackfin MAC RX IRQ!\n");
1692 rc = -EBUSY; 1692 rc = -EBUSY;
diff --git a/drivers/net/ethernet/amd/sun3lance.c b/drivers/net/ethernet/amd/sun3lance.c
index d6b20296b8e4..3d8c6b2cdea4 100644
--- a/drivers/net/ethernet/amd/sun3lance.c
+++ b/drivers/net/ethernet/amd/sun3lance.c
@@ -358,7 +358,7 @@ static int __init lance_probe( struct net_device *dev)
358 358
359 REGA(CSR0) = CSR0_STOP; 359 REGA(CSR0) = CSR0_STOP;
360 360
361 if (request_irq(LANCE_IRQ, lance_interrupt, IRQF_DISABLED, "SUN3 Lance", dev) < 0) { 361 if (request_irq(LANCE_IRQ, lance_interrupt, 0, "SUN3 Lance", dev) < 0) {
362#ifdef CONFIG_SUN3 362#ifdef CONFIG_SUN3
363 iounmap((void __iomem *)ioaddr); 363 iounmap((void __iomem *)ioaddr);
364#endif 364#endif
diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c
index 027398ebbba6..fc95b235e210 100644
--- a/drivers/net/ethernet/atheros/alx/main.c
+++ b/drivers/net/ethernet/atheros/alx/main.c
@@ -1188,7 +1188,7 @@ static int alx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1188 struct alx_priv *alx; 1188 struct alx_priv *alx;
1189 struct alx_hw *hw; 1189 struct alx_hw *hw;
1190 bool phy_configured; 1190 bool phy_configured;
1191 int bars, pm_cap, err; 1191 int bars, err;
1192 1192
1193 err = pci_enable_device_mem(pdev); 1193 err = pci_enable_device_mem(pdev);
1194 if (err) 1194 if (err)
@@ -1225,18 +1225,13 @@ static int alx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1225 pci_enable_pcie_error_reporting(pdev); 1225 pci_enable_pcie_error_reporting(pdev);
1226 pci_set_master(pdev); 1226 pci_set_master(pdev);
1227 1227
1228 pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM); 1228 if (!pdev->pm_cap) {
1229 if (pm_cap == 0) {
1230 dev_err(&pdev->dev, 1229 dev_err(&pdev->dev,
1231 "Can't find power management capability, aborting\n"); 1230 "Can't find power management capability, aborting\n");
1232 err = -EIO; 1231 err = -EIO;
1233 goto out_pci_release; 1232 goto out_pci_release;
1234 } 1233 }
1235 1234
1236 err = pci_set_power_state(pdev, PCI_D0);
1237 if (err)
1238 goto out_pci_release;
1239
1240 netdev = alloc_etherdev(sizeof(*alx)); 1235 netdev = alloc_etherdev(sizeof(*alx));
1241 if (!netdev) { 1236 if (!netdev) {
1242 err = -ENOMEM; 1237 err = -ENOMEM;
diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c
index eec0af45b859..249468f95365 100644
--- a/drivers/net/ethernet/broadcom/bgmac.c
+++ b/drivers/net/ethernet/broadcom/bgmac.c
@@ -157,6 +157,7 @@ static netdev_tx_t bgmac_dma_tx_add(struct bgmac *bgmac,
157 if (++ring->end >= BGMAC_TX_RING_SLOTS) 157 if (++ring->end >= BGMAC_TX_RING_SLOTS)
158 ring->end = 0; 158 ring->end = 0;
159 bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_TX_INDEX, 159 bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_TX_INDEX,
160 ring->index_base +
160 ring->end * sizeof(struct bgmac_dma_desc)); 161 ring->end * sizeof(struct bgmac_dma_desc));
161 162
162 /* Always keep one slot free to allow detecting bugged calls. */ 163 /* Always keep one slot free to allow detecting bugged calls. */
@@ -181,6 +182,8 @@ static void bgmac_dma_tx_free(struct bgmac *bgmac, struct bgmac_dma_ring *ring)
181 /* The last slot that hardware didn't consume yet */ 182 /* The last slot that hardware didn't consume yet */
182 empty_slot = bgmac_read(bgmac, ring->mmio_base + BGMAC_DMA_TX_STATUS); 183 empty_slot = bgmac_read(bgmac, ring->mmio_base + BGMAC_DMA_TX_STATUS);
183 empty_slot &= BGMAC_DMA_TX_STATDPTR; 184 empty_slot &= BGMAC_DMA_TX_STATDPTR;
185 empty_slot -= ring->index_base;
186 empty_slot &= BGMAC_DMA_TX_STATDPTR;
184 empty_slot /= sizeof(struct bgmac_dma_desc); 187 empty_slot /= sizeof(struct bgmac_dma_desc);
185 188
186 while (ring->start != empty_slot) { 189 while (ring->start != empty_slot) {
@@ -274,6 +277,8 @@ static int bgmac_dma_rx_read(struct bgmac *bgmac, struct bgmac_dma_ring *ring,
274 277
275 end_slot = bgmac_read(bgmac, ring->mmio_base + BGMAC_DMA_RX_STATUS); 278 end_slot = bgmac_read(bgmac, ring->mmio_base + BGMAC_DMA_RX_STATUS);
276 end_slot &= BGMAC_DMA_RX_STATDPTR; 279 end_slot &= BGMAC_DMA_RX_STATDPTR;
280 end_slot -= ring->index_base;
281 end_slot &= BGMAC_DMA_RX_STATDPTR;
277 end_slot /= sizeof(struct bgmac_dma_desc); 282 end_slot /= sizeof(struct bgmac_dma_desc);
278 283
279 ring->end = end_slot; 284 ring->end = end_slot;
@@ -418,9 +423,6 @@ static int bgmac_dma_alloc(struct bgmac *bgmac)
418 ring = &bgmac->tx_ring[i]; 423 ring = &bgmac->tx_ring[i];
419 ring->num_slots = BGMAC_TX_RING_SLOTS; 424 ring->num_slots = BGMAC_TX_RING_SLOTS;
420 ring->mmio_base = ring_base[i]; 425 ring->mmio_base = ring_base[i];
421 if (bgmac_dma_unaligned(bgmac, ring, BGMAC_DMA_RING_TX))
422 bgmac_warn(bgmac, "TX on ring 0x%X supports unaligned addressing but this feature is not implemented\n",
423 ring->mmio_base);
424 426
425 /* Alloc ring of descriptors */ 427 /* Alloc ring of descriptors */
426 size = ring->num_slots * sizeof(struct bgmac_dma_desc); 428 size = ring->num_slots * sizeof(struct bgmac_dma_desc);
@@ -435,6 +437,13 @@ static int bgmac_dma_alloc(struct bgmac *bgmac)
435 if (ring->dma_base & 0xC0000000) 437 if (ring->dma_base & 0xC0000000)
436 bgmac_warn(bgmac, "DMA address using 0xC0000000 bit(s), it may need translation trick\n"); 438 bgmac_warn(bgmac, "DMA address using 0xC0000000 bit(s), it may need translation trick\n");
437 439
440 ring->unaligned = bgmac_dma_unaligned(bgmac, ring,
441 BGMAC_DMA_RING_TX);
442 if (ring->unaligned)
443 ring->index_base = lower_32_bits(ring->dma_base);
444 else
445 ring->index_base = 0;
446
438 /* No need to alloc TX slots yet */ 447 /* No need to alloc TX slots yet */
439 } 448 }
440 449
@@ -444,9 +453,6 @@ static int bgmac_dma_alloc(struct bgmac *bgmac)
444 ring = &bgmac->rx_ring[i]; 453 ring = &bgmac->rx_ring[i];
445 ring->num_slots = BGMAC_RX_RING_SLOTS; 454 ring->num_slots = BGMAC_RX_RING_SLOTS;
446 ring->mmio_base = ring_base[i]; 455 ring->mmio_base = ring_base[i];
447 if (bgmac_dma_unaligned(bgmac, ring, BGMAC_DMA_RING_RX))
448 bgmac_warn(bgmac, "RX on ring 0x%X supports unaligned addressing but this feature is not implemented\n",
449 ring->mmio_base);
450 456
451 /* Alloc ring of descriptors */ 457 /* Alloc ring of descriptors */
452 size = ring->num_slots * sizeof(struct bgmac_dma_desc); 458 size = ring->num_slots * sizeof(struct bgmac_dma_desc);
@@ -462,6 +468,13 @@ static int bgmac_dma_alloc(struct bgmac *bgmac)
462 if (ring->dma_base & 0xC0000000) 468 if (ring->dma_base & 0xC0000000)
463 bgmac_warn(bgmac, "DMA address using 0xC0000000 bit(s), it may need translation trick\n"); 469 bgmac_warn(bgmac, "DMA address using 0xC0000000 bit(s), it may need translation trick\n");
464 470
471 ring->unaligned = bgmac_dma_unaligned(bgmac, ring,
472 BGMAC_DMA_RING_RX);
473 if (ring->unaligned)
474 ring->index_base = lower_32_bits(ring->dma_base);
475 else
476 ring->index_base = 0;
477
465 /* Alloc RX slots */ 478 /* Alloc RX slots */
466 for (j = 0; j < ring->num_slots; j++) { 479 for (j = 0; j < ring->num_slots; j++) {
467 err = bgmac_dma_rx_skb_for_slot(bgmac, &ring->slots[j]); 480 err = bgmac_dma_rx_skb_for_slot(bgmac, &ring->slots[j]);
@@ -489,12 +502,14 @@ static void bgmac_dma_init(struct bgmac *bgmac)
489 for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) { 502 for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) {
490 ring = &bgmac->tx_ring[i]; 503 ring = &bgmac->tx_ring[i];
491 504
492 /* We don't implement unaligned addressing, so enable first */ 505 if (!ring->unaligned)
493 bgmac_dma_tx_enable(bgmac, ring); 506 bgmac_dma_tx_enable(bgmac, ring);
494 bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_TX_RINGLO, 507 bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_TX_RINGLO,
495 lower_32_bits(ring->dma_base)); 508 lower_32_bits(ring->dma_base));
496 bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_TX_RINGHI, 509 bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_TX_RINGHI,
497 upper_32_bits(ring->dma_base)); 510 upper_32_bits(ring->dma_base));
511 if (ring->unaligned)
512 bgmac_dma_tx_enable(bgmac, ring);
498 513
499 ring->start = 0; 514 ring->start = 0;
500 ring->end = 0; /* Points the slot that should *not* be read */ 515 ring->end = 0; /* Points the slot that should *not* be read */
@@ -505,12 +520,14 @@ static void bgmac_dma_init(struct bgmac *bgmac)
505 520
506 ring = &bgmac->rx_ring[i]; 521 ring = &bgmac->rx_ring[i];
507 522
508 /* We don't implement unaligned addressing, so enable first */ 523 if (!ring->unaligned)
509 bgmac_dma_rx_enable(bgmac, ring); 524 bgmac_dma_rx_enable(bgmac, ring);
510 bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_RX_RINGLO, 525 bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_RX_RINGLO,
511 lower_32_bits(ring->dma_base)); 526 lower_32_bits(ring->dma_base));
512 bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_RX_RINGHI, 527 bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_RX_RINGHI,
513 upper_32_bits(ring->dma_base)); 528 upper_32_bits(ring->dma_base));
529 if (ring->unaligned)
530 bgmac_dma_rx_enable(bgmac, ring);
514 531
515 for (j = 0, dma_desc = ring->cpu_base; j < ring->num_slots; 532 for (j = 0, dma_desc = ring->cpu_base; j < ring->num_slots;
516 j++, dma_desc++) { 533 j++, dma_desc++) {
@@ -531,6 +548,7 @@ static void bgmac_dma_init(struct bgmac *bgmac)
531 } 548 }
532 549
533 bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_RX_INDEX, 550 bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_RX_INDEX,
551 ring->index_base +
534 ring->num_slots * sizeof(struct bgmac_dma_desc)); 552 ring->num_slots * sizeof(struct bgmac_dma_desc));
535 553
536 ring->start = 0; 554 ring->start = 0;
@@ -908,10 +926,10 @@ static void bgmac_chip_reset(struct bgmac *bgmac)
908 struct bcma_drv_cc *cc = &bgmac->core->bus->drv_cc; 926 struct bcma_drv_cc *cc = &bgmac->core->bus->drv_cc;
909 u8 et_swtype = 0; 927 u8 et_swtype = 0;
910 u8 sw_type = BGMAC_CHIPCTL_1_SW_TYPE_EPHY | 928 u8 sw_type = BGMAC_CHIPCTL_1_SW_TYPE_EPHY |
911 BGMAC_CHIPCTL_1_IF_TYPE_RMII; 929 BGMAC_CHIPCTL_1_IF_TYPE_MII;
912 char buf[2]; 930 char buf[4];
913 931
914 if (bcm47xx_nvram_getenv("et_swtype", buf, 1) > 0) { 932 if (bcm47xx_nvram_getenv("et_swtype", buf, sizeof(buf)) > 0) {
915 if (kstrtou8(buf, 0, &et_swtype)) 933 if (kstrtou8(buf, 0, &et_swtype))
916 bgmac_err(bgmac, "Failed to parse et_swtype (%s)\n", 934 bgmac_err(bgmac, "Failed to parse et_swtype (%s)\n",
917 buf); 935 buf);
diff --git a/drivers/net/ethernet/broadcom/bgmac.h b/drivers/net/ethernet/broadcom/bgmac.h
index 98d4b5fcc070..66c8afbdc8c7 100644
--- a/drivers/net/ethernet/broadcom/bgmac.h
+++ b/drivers/net/ethernet/broadcom/bgmac.h
@@ -333,7 +333,7 @@
333 333
334#define BGMAC_CHIPCTL_1_IF_TYPE_MASK 0x00000030 334#define BGMAC_CHIPCTL_1_IF_TYPE_MASK 0x00000030
335#define BGMAC_CHIPCTL_1_IF_TYPE_RMII 0x00000000 335#define BGMAC_CHIPCTL_1_IF_TYPE_RMII 0x00000000
336#define BGMAC_CHIPCTL_1_IF_TYPE_MI 0x00000010 336#define BGMAC_CHIPCTL_1_IF_TYPE_MII 0x00000010
337#define BGMAC_CHIPCTL_1_IF_TYPE_RGMII 0x00000020 337#define BGMAC_CHIPCTL_1_IF_TYPE_RGMII 0x00000020
338#define BGMAC_CHIPCTL_1_SW_TYPE_MASK 0x000000C0 338#define BGMAC_CHIPCTL_1_SW_TYPE_MASK 0x000000C0
339#define BGMAC_CHIPCTL_1_SW_TYPE_EPHY 0x00000000 339#define BGMAC_CHIPCTL_1_SW_TYPE_EPHY 0x00000000
@@ -384,6 +384,8 @@ struct bgmac_dma_ring {
384 u16 mmio_base; 384 u16 mmio_base;
385 struct bgmac_dma_desc *cpu_base; 385 struct bgmac_dma_desc *cpu_base;
386 dma_addr_t dma_base; 386 dma_addr_t dma_base;
387 u32 index_base; /* Used for unaligned rings only, otherwise 0 */
388 bool unaligned;
387 389
388 struct bgmac_slot_info slots[BGMAC_RX_RING_SLOTS]; 390 struct bgmac_slot_info slots[BGMAC_RX_RING_SLOTS];
389}; 391};
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
index 0c338026ce01..97b3d32a98bd 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
@@ -246,8 +246,37 @@ enum {
246 BNX2X_MAX_CNIC_ETH_CL_ID_IDX, 246 BNX2X_MAX_CNIC_ETH_CL_ID_IDX,
247}; 247};
248 248
249#define BNX2X_CNIC_START_ETH_CID(bp) (BNX2X_NUM_NON_CNIC_QUEUES(bp) *\ 249/* use a value high enough to be above all the PFs, which has least significant
250 * nibble as 8, so when cnic needs to come up with a CID for UIO to use to
251 * calculate doorbell address according to old doorbell configuration scheme
252 * (db_msg_sz 1 << 7 * cid + 0x40 DPM offset) it can come up with a valid number
253 * We must avoid coming up with cid 8 for iscsi since according to this method
254 * the designated UIO cid will come out 0 and it has a special handling for that
255 * case which doesn't suit us. Therefore will will cieling to closes cid which
256 * has least signigifcant nibble 8 and if it is 8 we will move forward to 0x18.
257 */
258
259#define BNX2X_1st_NON_L2_ETH_CID(bp) (BNX2X_NUM_NON_CNIC_QUEUES(bp) * \
250 (bp)->max_cos) 260 (bp)->max_cos)
261/* amount of cids traversed by UIO's DPM addition to doorbell */
262#define UIO_DPM 8
263/* roundup to DPM offset */
264#define UIO_ROUNDUP(bp) (roundup(BNX2X_1st_NON_L2_ETH_CID(bp), \
265 UIO_DPM))
266/* offset to nearest value which has lsb nibble matching DPM */
267#define UIO_CID_OFFSET(bp) ((UIO_ROUNDUP(bp) + UIO_DPM) % \
268 (UIO_DPM * 2))
269/* add offset to rounded-up cid to get a value which could be used with UIO */
270#define UIO_DPM_ALIGN(bp) (UIO_ROUNDUP(bp) + UIO_CID_OFFSET(bp))
271/* but wait - avoid UIO special case for cid 0 */
272#define UIO_DPM_CID0_OFFSET(bp) ((UIO_DPM * 2) * \
273 (UIO_DPM_ALIGN(bp) == UIO_DPM))
274/* Properly DPM aligned CID dajusted to cid 0 secal case */
275#define BNX2X_CNIC_START_ETH_CID(bp) (UIO_DPM_ALIGN(bp) + \
276 (UIO_DPM_CID0_OFFSET(bp)))
277/* how many cids were wasted - need this value for cid allocation */
278#define UIO_CID_PAD(bp) (BNX2X_CNIC_START_ETH_CID(bp) - \
279 BNX2X_1st_NON_L2_ETH_CID(bp))
251 /* iSCSI L2 */ 280 /* iSCSI L2 */
252#define BNX2X_ISCSI_ETH_CID(bp) (BNX2X_CNIC_START_ETH_CID(bp)) 281#define BNX2X_ISCSI_ETH_CID(bp) (BNX2X_CNIC_START_ETH_CID(bp))
253 /* FCoE L2 */ 282 /* FCoE L2 */
@@ -1542,7 +1571,6 @@ struct bnx2x {
1542 */ 1571 */
1543 bool fcoe_init; 1572 bool fcoe_init;
1544 1573
1545 int pm_cap;
1546 int mrrs; 1574 int mrrs;
1547 1575
1548 struct delayed_work sp_task; 1576 struct delayed_work sp_task;
@@ -1681,10 +1709,11 @@ struct bnx2x {
1681 * Maximum CID count that might be required by the bnx2x: 1709 * Maximum CID count that might be required by the bnx2x:
1682 * Max RSS * Max_Tx_Multi_Cos + FCoE + iSCSI 1710 * Max RSS * Max_Tx_Multi_Cos + FCoE + iSCSI
1683 */ 1711 */
1712
1684#define BNX2X_L2_CID_COUNT(bp) (BNX2X_NUM_ETH_QUEUES(bp) * BNX2X_MULTI_TX_COS \ 1713#define BNX2X_L2_CID_COUNT(bp) (BNX2X_NUM_ETH_QUEUES(bp) * BNX2X_MULTI_TX_COS \
1685 + 2 * CNIC_SUPPORT(bp)) 1714 + CNIC_SUPPORT(bp) * (2 + UIO_CID_PAD(bp)))
1686#define BNX2X_L2_MAX_CID(bp) (BNX2X_MAX_RSS_COUNT(bp) * BNX2X_MULTI_TX_COS \ 1715#define BNX2X_L2_MAX_CID(bp) (BNX2X_MAX_RSS_COUNT(bp) * BNX2X_MULTI_TX_COS \
1687 + 2 * CNIC_SUPPORT(bp)) 1716 + CNIC_SUPPORT(bp) * (2 + UIO_CID_PAD(bp)))
1688#define L2_ILT_LINES(bp) (DIV_ROUND_UP(BNX2X_L2_CID_COUNT(bp),\ 1717#define L2_ILT_LINES(bp) (DIV_ROUND_UP(BNX2X_L2_CID_COUNT(bp),\
1689 ILT_PAGE_CIDS)) 1718 ILT_PAGE_CIDS))
1690 1719
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index 90045c920d09..61726af1de6e 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -3008,16 +3008,16 @@ int bnx2x_set_power_state(struct bnx2x *bp, pci_power_t state)
3008 u16 pmcsr; 3008 u16 pmcsr;
3009 3009
3010 /* If there is no power capability, silently succeed */ 3010 /* If there is no power capability, silently succeed */
3011 if (!bp->pm_cap) { 3011 if (!bp->pdev->pm_cap) {
3012 BNX2X_DEV_INFO("No power capability. Breaking.\n"); 3012 BNX2X_DEV_INFO("No power capability. Breaking.\n");
3013 return 0; 3013 return 0;
3014 } 3014 }
3015 3015
3016 pci_read_config_word(bp->pdev, bp->pm_cap + PCI_PM_CTRL, &pmcsr); 3016 pci_read_config_word(bp->pdev, bp->pdev->pm_cap + PCI_PM_CTRL, &pmcsr);
3017 3017
3018 switch (state) { 3018 switch (state) {
3019 case PCI_D0: 3019 case PCI_D0:
3020 pci_write_config_word(bp->pdev, bp->pm_cap + PCI_PM_CTRL, 3020 pci_write_config_word(bp->pdev, bp->pdev->pm_cap + PCI_PM_CTRL,
3021 ((pmcsr & ~PCI_PM_CTRL_STATE_MASK) | 3021 ((pmcsr & ~PCI_PM_CTRL_STATE_MASK) |
3022 PCI_PM_CTRL_PME_STATUS)); 3022 PCI_PM_CTRL_PME_STATUS));
3023 3023
@@ -3041,7 +3041,7 @@ int bnx2x_set_power_state(struct bnx2x *bp, pci_power_t state)
3041 if (bp->wol) 3041 if (bp->wol)
3042 pmcsr |= PCI_PM_CTRL_PME_ENABLE; 3042 pmcsr |= PCI_PM_CTRL_PME_ENABLE;
3043 3043
3044 pci_write_config_word(bp->pdev, bp->pm_cap + PCI_PM_CTRL, 3044 pci_write_config_word(bp->pdev, bp->pdev->pm_cap + PCI_PM_CTRL,
3045 pmcsr); 3045 pmcsr);
3046 3046
3047 /* No more memory access after this point until 3047 /* No more memory access after this point until
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
index 2612e3c715d4..324de5f05332 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
@@ -1387,9 +1387,9 @@ static bool bnx2x_is_nvm_accessible(struct bnx2x *bp)
1387 u16 pm = 0; 1387 u16 pm = 0;
1388 struct net_device *dev = pci_get_drvdata(bp->pdev); 1388 struct net_device *dev = pci_get_drvdata(bp->pdev);
1389 1389
1390 if (bp->pm_cap) 1390 if (bp->pdev->pm_cap)
1391 rc = pci_read_config_word(bp->pdev, 1391 rc = pci_read_config_word(bp->pdev,
1392 bp->pm_cap + PCI_PM_CTRL, &pm); 1392 bp->pdev->pm_cap + PCI_PM_CTRL, &pm);
1393 1393
1394 if ((rc && !netif_running(dev)) || 1394 if ((rc && !netif_running(dev)) ||
1395 (!rc && ((pm & PCI_PM_CTRL_STATE_MASK) != (__force u16)PCI_D0))) 1395 (!rc && ((pm & PCI_PM_CTRL_STATE_MASK) != (__force u16)PCI_D0)))
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 2f8dbbbd7a86..a6704b555042 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -8652,6 +8652,7 @@ u32 bnx2x_send_unload_req(struct bnx2x *bp, int unload_mode)
8652 else if (bp->wol) { 8652 else if (bp->wol) {
8653 u32 emac_base = port ? GRCBASE_EMAC1 : GRCBASE_EMAC0; 8653 u32 emac_base = port ? GRCBASE_EMAC1 : GRCBASE_EMAC0;
8654 u8 *mac_addr = bp->dev->dev_addr; 8654 u8 *mac_addr = bp->dev->dev_addr;
8655 struct pci_dev *pdev = bp->pdev;
8655 u32 val; 8656 u32 val;
8656 u16 pmc; 8657 u16 pmc;
8657 8658
@@ -8668,9 +8669,9 @@ u32 bnx2x_send_unload_req(struct bnx2x *bp, int unload_mode)
8668 EMAC_WR(bp, EMAC_REG_EMAC_MAC_MATCH + entry + 4, val); 8669 EMAC_WR(bp, EMAC_REG_EMAC_MAC_MATCH + entry + 4, val);
8669 8670
8670 /* Enable the PME and clear the status */ 8671 /* Enable the PME and clear the status */
8671 pci_read_config_word(bp->pdev, bp->pm_cap + PCI_PM_CTRL, &pmc); 8672 pci_read_config_word(pdev, pdev->pm_cap + PCI_PM_CTRL, &pmc);
8672 pmc |= PCI_PM_CTRL_PME_ENABLE | PCI_PM_CTRL_PME_STATUS; 8673 pmc |= PCI_PM_CTRL_PME_ENABLE | PCI_PM_CTRL_PME_STATUS;
8673 pci_write_config_word(bp->pdev, bp->pm_cap + PCI_PM_CTRL, pmc); 8674 pci_write_config_word(pdev, pdev->pm_cap + PCI_PM_CTRL, pmc);
8674 8675
8675 reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_EN; 8676 reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_EN;
8676 8677
@@ -10399,7 +10400,7 @@ static void bnx2x_get_common_hwinfo(struct bnx2x *bp)
10399 break; 10400 break;
10400 } 10401 }
10401 10402
10402 pci_read_config_word(bp->pdev, bp->pm_cap + PCI_PM_PMC, &pmc); 10403 pci_read_config_word(bp->pdev, bp->pdev->pm_cap + PCI_PM_PMC, &pmc);
10403 bp->flags |= (pmc & PCI_PM_CAP_PME_D3cold) ? 0 : NO_WOL_FLAG; 10404 bp->flags |= (pmc & PCI_PM_CAP_PME_D3cold) ? 0 : NO_WOL_FLAG;
10404 10405
10405 BNX2X_DEV_INFO("%sWoL capable\n", 10406 BNX2X_DEV_INFO("%sWoL capable\n",
@@ -12141,8 +12142,7 @@ static int bnx2x_init_dev(struct bnx2x *bp, struct pci_dev *pdev,
12141 } 12142 }
12142 12143
12143 if (IS_PF(bp)) { 12144 if (IS_PF(bp)) {
12144 bp->pm_cap = pdev->pm_cap; 12145 if (!pdev->pm_cap) {
12145 if (bp->pm_cap == 0) {
12146 dev_err(&bp->pdev->dev, 12146 dev_err(&bp->pdev->dev,
12147 "Cannot find power management capability, aborting\n"); 12147 "Cannot find power management capability, aborting\n");
12148 rc = -EIO; 12148 rc = -EIO;
@@ -13632,6 +13632,10 @@ void bnx2x_setup_cnic_info(struct bnx2x *bp)
13632 cp->fcoe_init_cid = BNX2X_FCOE_ETH_CID(bp); 13632 cp->fcoe_init_cid = BNX2X_FCOE_ETH_CID(bp);
13633 cp->iscsi_l2_cid = BNX2X_ISCSI_ETH_CID(bp); 13633 cp->iscsi_l2_cid = BNX2X_ISCSI_ETH_CID(bp);
13634 13634
13635 DP(NETIF_MSG_IFUP, "BNX2X_1st_NON_L2_ETH_CID(bp) %x, cp->starting_cid %x, cp->fcoe_init_cid %x, cp->iscsi_l2_cid %x\n",
13636 BNX2X_1st_NON_L2_ETH_CID(bp), cp->starting_cid, cp->fcoe_init_cid,
13637 cp->iscsi_l2_cid);
13638
13635 if (NO_ISCSI_OOO(bp)) 13639 if (NO_ISCSI_OOO(bp))
13636 cp->drv_state |= CNIC_DRV_STATE_NO_ISCSI_OOO; 13640 cp->drv_state |= CNIC_DRV_STATE_NO_ISCSI_OOO;
13637} 13641}
diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c
index 8142480d9770..99394bd49a13 100644
--- a/drivers/net/ethernet/broadcom/cnic.c
+++ b/drivers/net/ethernet/broadcom/cnic.c
@@ -3135,6 +3135,7 @@ static void cnic_service_bnx2x_bh(unsigned long data)
3135{ 3135{
3136 struct cnic_dev *dev = (struct cnic_dev *) data; 3136 struct cnic_dev *dev = (struct cnic_dev *) data;
3137 struct cnic_local *cp = dev->cnic_priv; 3137 struct cnic_local *cp = dev->cnic_priv;
3138 struct bnx2x *bp = netdev_priv(dev->netdev);
3138 u32 status_idx, new_status_idx; 3139 u32 status_idx, new_status_idx;
3139 3140
3140 if (unlikely(!test_bit(CNIC_F_CNIC_UP, &dev->flags))) 3141 if (unlikely(!test_bit(CNIC_F_CNIC_UP, &dev->flags)))
@@ -3146,7 +3147,7 @@ static void cnic_service_bnx2x_bh(unsigned long data)
3146 CNIC_WR16(dev, cp->kcq1.io_addr, 3147 CNIC_WR16(dev, cp->kcq1.io_addr,
3147 cp->kcq1.sw_prod_idx + MAX_KCQ_IDX); 3148 cp->kcq1.sw_prod_idx + MAX_KCQ_IDX);
3148 3149
3149 if (cp->ethdev->drv_state & CNIC_DRV_STATE_NO_FCOE) { 3150 if (!CNIC_SUPPORTS_FCOE(bp)) {
3150 cp->arm_int(dev, status_idx); 3151 cp->arm_int(dev, status_idx);
3151 break; 3152 break;
3152 } 3153 }
@@ -5217,7 +5218,8 @@ static void cnic_init_rings(struct cnic_dev *dev)
5217 "iSCSI CLIENT_SETUP did not complete\n"); 5218 "iSCSI CLIENT_SETUP did not complete\n");
5218 cnic_spq_completion(dev, DRV_CTL_RET_L2_SPQ_CREDIT_CMD, 1); 5219 cnic_spq_completion(dev, DRV_CTL_RET_L2_SPQ_CREDIT_CMD, 1);
5219 cnic_ring_ctl(dev, cid, cli, 1); 5220 cnic_ring_ctl(dev, cid, cli, 1);
5220 *cid_ptr = cid; 5221 *cid_ptr = cid >> 4;
5222 *(cid_ptr + 1) = cid * bp->db_size;
5221 } 5223 }
5222} 5224}
5223 5225
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 5701f3d1a169..12d961c4ebca 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -3034,6 +3034,7 @@ static bool tg3_phy_led_bug(struct tg3 *tp)
3034{ 3034{
3035 switch (tg3_asic_rev(tp)) { 3035 switch (tg3_asic_rev(tp)) {
3036 case ASIC_REV_5719: 3036 case ASIC_REV_5719:
3037 case ASIC_REV_5720:
3037 if ((tp->phy_flags & TG3_PHYFLG_MII_SERDES) && 3038 if ((tp->phy_flags & TG3_PHYFLG_MII_SERDES) &&
3038 !tp->pci_fn) 3039 !tp->pci_fn)
3039 return true; 3040 return true;
@@ -16192,12 +16193,12 @@ static int tg3_get_invariants(struct tg3 *tp, const struct pci_device_id *ent)
16192 * So explicitly force the chip into D0 here. 16193 * So explicitly force the chip into D0 here.
16193 */ 16194 */
16194 pci_read_config_dword(tp->pdev, 16195 pci_read_config_dword(tp->pdev,
16195 tp->pm_cap + PCI_PM_CTRL, 16196 tp->pdev->pm_cap + PCI_PM_CTRL,
16196 &pm_reg); 16197 &pm_reg);
16197 pm_reg &= ~PCI_PM_CTRL_STATE_MASK; 16198 pm_reg &= ~PCI_PM_CTRL_STATE_MASK;
16198 pm_reg |= PCI_PM_CTRL_PME_ENABLE | 0 /* D0 */; 16199 pm_reg |= PCI_PM_CTRL_PME_ENABLE | 0 /* D0 */;
16199 pci_write_config_dword(tp->pdev, 16200 pci_write_config_dword(tp->pdev,
16200 tp->pm_cap + PCI_PM_CTRL, 16201 tp->pdev->pm_cap + PCI_PM_CTRL,
16201 pm_reg); 16202 pm_reg);
16202 16203
16203 /* Also, force SERR#/PERR# in PCI command. */ 16204 /* Also, force SERR#/PERR# in PCI command. */
@@ -17346,7 +17347,6 @@ static int tg3_init_one(struct pci_dev *pdev,
17346 tp = netdev_priv(dev); 17347 tp = netdev_priv(dev);
17347 tp->pdev = pdev; 17348 tp->pdev = pdev;
17348 tp->dev = dev; 17349 tp->dev = dev;
17349 tp->pm_cap = pdev->pm_cap;
17350 tp->rx_mode = TG3_DEF_RX_MODE; 17350 tp->rx_mode = TG3_DEF_RX_MODE;
17351 tp->tx_mode = TG3_DEF_TX_MODE; 17351 tp->tx_mode = TG3_DEF_TX_MODE;
17352 tp->irq_sync = 1; 17352 tp->irq_sync = 1;
diff --git a/drivers/net/ethernet/broadcom/tg3.h b/drivers/net/ethernet/broadcom/tg3.h
index ddb8be1298ea..70257808aa37 100644
--- a/drivers/net/ethernet/broadcom/tg3.h
+++ b/drivers/net/ethernet/broadcom/tg3.h
@@ -3234,7 +3234,6 @@ struct tg3 {
3234 u8 pci_lat_timer; 3234 u8 pci_lat_timer;
3235 3235
3236 int pci_fn; 3236 int pci_fn;
3237 int pm_cap;
3238 int msi_cap; 3237 int msi_cap;
3239 int pcix_cap; 3238 int pcix_cap;
3240 int pcie_readrq; 3239 int pcie_readrq;
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index 0d0665ca6f19..c73cabdbd4c0 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -6149,8 +6149,10 @@ static int __init cxgb4_init_module(void)
6149 pr_warn("could not create debugfs entry, continuing\n"); 6149 pr_warn("could not create debugfs entry, continuing\n");
6150 6150
6151 ret = pci_register_driver(&cxgb4_driver); 6151 ret = pci_register_driver(&cxgb4_driver);
6152 if (ret < 0) 6152 if (ret < 0) {
6153 debugfs_remove(cxgb4_debugfs_root); 6153 debugfs_remove(cxgb4_debugfs_root);
6154 destroy_workqueue(workq);
6155 }
6154 6156
6155 register_inet6addr_notifier(&cxgb4_inet6addr_notifier); 6157 register_inet6addr_notifier(&cxgb4_inet6addr_notifier);
6156 6158
diff --git a/drivers/net/ethernet/dec/tulip/de4x5.c b/drivers/net/ethernet/dec/tulip/de4x5.c
index 2db6c573cec7..263b92c00cbf 100644
--- a/drivers/net/ethernet/dec/tulip/de4x5.c
+++ b/drivers/net/ethernet/dec/tulip/de4x5.c
@@ -1321,7 +1321,7 @@ de4x5_open(struct net_device *dev)
1321 if (request_irq(dev->irq, de4x5_interrupt, IRQF_SHARED, 1321 if (request_irq(dev->irq, de4x5_interrupt, IRQF_SHARED,
1322 lp->adapter_name, dev)) { 1322 lp->adapter_name, dev)) {
1323 printk("de4x5_open(): Requested IRQ%d is busy - attemping FAST/SHARE...", dev->irq); 1323 printk("de4x5_open(): Requested IRQ%d is busy - attemping FAST/SHARE...", dev->irq);
1324 if (request_irq(dev->irq, de4x5_interrupt, IRQF_DISABLED | IRQF_SHARED, 1324 if (request_irq(dev->irq, de4x5_interrupt, IRQF_SHARED,
1325 lp->adapter_name, dev)) { 1325 lp->adapter_name, dev)) {
1326 printk("\n Cannot get IRQ- reconfigure your hardware.\n"); 1326 printk("\n Cannot get IRQ- reconfigure your hardware.\n");
1327 disable_ast(dev); 1327 disable_ast(dev);
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 3224d28cdad4..100b528b9bd0 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -2802,7 +2802,7 @@ static int be_vfs_if_create(struct be_adapter *adapter)
2802 struct be_resources res = {0}; 2802 struct be_resources res = {0};
2803 struct be_vf_cfg *vf_cfg; 2803 struct be_vf_cfg *vf_cfg;
2804 u32 cap_flags, en_flags, vf; 2804 u32 cap_flags, en_flags, vf;
2805 int status; 2805 int status = 0;
2806 2806
2807 cap_flags = BE_IF_FLAGS_UNTAGGED | BE_IF_FLAGS_BROADCAST | 2807 cap_flags = BE_IF_FLAGS_UNTAGGED | BE_IF_FLAGS_BROADCAST |
2808 BE_IF_FLAGS_MULTICAST; 2808 BE_IF_FLAGS_MULTICAST;
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index f9aacf5d8523..b2793b91cc55 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -2199,7 +2199,7 @@ fec_probe(struct platform_device *pdev)
2199 goto failed_irq; 2199 goto failed_irq;
2200 } 2200 }
2201 ret = devm_request_irq(&pdev->dev, irq, fec_enet_interrupt, 2201 ret = devm_request_irq(&pdev->dev, irq, fec_enet_interrupt,
2202 IRQF_DISABLED, pdev->name, ndev); 2202 0, pdev->name, ndev);
2203 if (ret) 2203 if (ret)
2204 goto failed_irq; 2204 goto failed_irq;
2205 } 2205 }
diff --git a/drivers/net/ethernet/hp/hp100.c b/drivers/net/ethernet/hp/hp100.c
index e3c7c697fc45..91227d03274e 100644
--- a/drivers/net/ethernet/hp/hp100.c
+++ b/drivers/net/ethernet/hp/hp100.c
@@ -1097,7 +1097,7 @@ static int hp100_open(struct net_device *dev)
1097 /* New: if bus is PCI or EISA, interrupts might be shared interrupts */ 1097 /* New: if bus is PCI or EISA, interrupts might be shared interrupts */
1098 if (request_irq(dev->irq, hp100_interrupt, 1098 if (request_irq(dev->irq, hp100_interrupt,
1099 lp->bus == HP100_BUS_PCI || lp->bus == 1099 lp->bus == HP100_BUS_PCI || lp->bus ==
1100 HP100_BUS_EISA ? IRQF_SHARED : IRQF_DISABLED, 1100 HP100_BUS_EISA ? IRQF_SHARED : 0,
1101 "hp100", dev)) { 1101 "hp100", dev)) {
1102 printk("hp100: %s: unable to get IRQ %d\n", dev->name, dev->irq); 1102 printk("hp100: %s: unable to get IRQ %d\n", dev->name, dev->irq);
1103 return -EAGAIN; 1103 return -EAGAIN;
diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c
index 35853b43d66e..2d1c6bdd3618 100644
--- a/drivers/net/ethernet/ibm/ehea/ehea_main.c
+++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c
@@ -102,6 +102,19 @@ static int ehea_probe_adapter(struct platform_device *dev);
102 102
103static int ehea_remove(struct platform_device *dev); 103static int ehea_remove(struct platform_device *dev);
104 104
105static struct of_device_id ehea_module_device_table[] = {
106 {
107 .name = "lhea",
108 .compatible = "IBM,lhea",
109 },
110 {
111 .type = "network",
112 .compatible = "IBM,lhea-ethernet",
113 },
114 {},
115};
116MODULE_DEVICE_TABLE(of, ehea_module_device_table);
117
105static struct of_device_id ehea_device_table[] = { 118static struct of_device_id ehea_device_table[] = {
106 { 119 {
107 .name = "lhea", 120 .name = "lhea",
@@ -109,7 +122,6 @@ static struct of_device_id ehea_device_table[] = {
109 }, 122 },
110 {}, 123 {},
111}; 124};
112MODULE_DEVICE_TABLE(of, ehea_device_table);
113 125
114static struct platform_driver ehea_driver = { 126static struct platform_driver ehea_driver = {
115 .driver = { 127 .driver = {
@@ -1285,7 +1297,7 @@ static int ehea_reg_interrupts(struct net_device *dev)
1285 1297
1286 ret = ibmebus_request_irq(port->qp_eq->attr.ist1, 1298 ret = ibmebus_request_irq(port->qp_eq->attr.ist1,
1287 ehea_qp_aff_irq_handler, 1299 ehea_qp_aff_irq_handler,
1288 IRQF_DISABLED, port->int_aff_name, port); 1300 0, port->int_aff_name, port);
1289 if (ret) { 1301 if (ret) {
1290 netdev_err(dev, "failed registering irq for qp_aff_irq_handler:ist=%X\n", 1302 netdev_err(dev, "failed registering irq for qp_aff_irq_handler:ist=%X\n",
1291 port->qp_eq->attr.ist1); 1303 port->qp_eq->attr.ist1);
@@ -1303,8 +1315,7 @@ static int ehea_reg_interrupts(struct net_device *dev)
1303 "%s-queue%d", dev->name, i); 1315 "%s-queue%d", dev->name, i);
1304 ret = ibmebus_request_irq(pr->eq->attr.ist1, 1316 ret = ibmebus_request_irq(pr->eq->attr.ist1,
1305 ehea_recv_irq_handler, 1317 ehea_recv_irq_handler,
1306 IRQF_DISABLED, pr->int_send_name, 1318 0, pr->int_send_name, pr);
1307 pr);
1308 if (ret) { 1319 if (ret) {
1309 netdev_err(dev, "failed registering irq for ehea_queue port_res_nr:%d, ist=%X\n", 1320 netdev_err(dev, "failed registering irq for ehea_queue port_res_nr:%d, ist=%X\n",
1310 i, pr->eq->attr.ist1); 1321 i, pr->eq->attr.ist1);
@@ -3320,7 +3331,7 @@ static int ehea_probe_adapter(struct platform_device *dev)
3320 } 3331 }
3321 3332
3322 ret = ibmebus_request_irq(adapter->neq->attr.ist1, 3333 ret = ibmebus_request_irq(adapter->neq->attr.ist1,
3323 ehea_interrupt_neq, IRQF_DISABLED, 3334 ehea_interrupt_neq, 0,
3324 "ehea_neq", adapter); 3335 "ehea_neq", adapter);
3325 if (ret) { 3336 if (ret) {
3326 dev_err(&dev->dev, "requesting NEQ IRQ failed\n"); 3337 dev_err(&dev->dev, "requesting NEQ IRQ failed\n");
diff --git a/drivers/net/ethernet/intel/e1000e/ethtool.c b/drivers/net/ethernet/intel/e1000e/ethtool.c
index a8633b8f0ac5..d14c8f53384c 100644
--- a/drivers/net/ethernet/intel/e1000e/ethtool.c
+++ b/drivers/net/ethernet/intel/e1000e/ethtool.c
@@ -922,6 +922,14 @@ static int e1000_reg_test(struct e1000_adapter *adapter, u64 *data)
922 else 922 else
923 mask &= ~(1 << 30); 923 mask &= ~(1 << 30);
924 } 924 }
925 if (mac->type == e1000_pch2lan) {
926 /* SHRAH[0,1,2] different than previous */
927 if (i == 7)
928 mask &= 0xFFF4FFFF;
929 /* SHRAH[3] different than SHRAH[0,1,2] */
930 if (i == 10)
931 mask |= (1 << 30);
932 }
925 933
926 REG_PATTERN_TEST_ARRAY(E1000_RA, ((i << 1) + 1), mask, 934 REG_PATTERN_TEST_ARRAY(E1000_RA, ((i << 1) + 1), mask,
927 0xFFFFFFFF); 935 0xFFFFFFFF);
diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c
index af08188d7e62..42f0f6717511 100644
--- a/drivers/net/ethernet/intel/e1000e/ich8lan.c
+++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c
@@ -1371,7 +1371,10 @@ static void e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index)
1371 return; 1371 return;
1372 } 1372 }
1373 1373
1374 if (index < hw->mac.rar_entry_count) { 1374 /* RAR[1-6] are owned by manageability. Skip those and program the
1375 * next address into the SHRA register array.
1376 */
1377 if (index < (u32)(hw->mac.rar_entry_count - 6)) {
1375 s32 ret_val; 1378 s32 ret_val;
1376 1379
1377 ret_val = e1000_acquire_swflag_ich8lan(hw); 1380 ret_val = e1000_acquire_swflag_ich8lan(hw);
@@ -1962,8 +1965,8 @@ void e1000_copy_rx_addrs_to_phy_ich8lan(struct e1000_hw *hw)
1962 if (ret_val) 1965 if (ret_val)
1963 goto release; 1966 goto release;
1964 1967
1965 /* Copy both RAL/H (rar_entry_count) and SHRAL/H (+4) to PHY */ 1968 /* Copy both RAL/H (rar_entry_count) and SHRAL/H to PHY */
1966 for (i = 0; i < (hw->mac.rar_entry_count + 4); i++) { 1969 for (i = 0; i < (hw->mac.rar_entry_count); i++) {
1967 mac_reg = er32(RAL(i)); 1970 mac_reg = er32(RAL(i));
1968 hw->phy.ops.write_reg_page(hw, BM_RAR_L(i), 1971 hw->phy.ops.write_reg_page(hw, BM_RAR_L(i),
1969 (u16)(mac_reg & 0xFFFF)); 1972 (u16)(mac_reg & 0xFFFF));
@@ -2007,10 +2010,10 @@ s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable)
2007 return ret_val; 2010 return ret_val;
2008 2011
2009 if (enable) { 2012 if (enable) {
2010 /* Write Rx addresses (rar_entry_count for RAL/H, +4 for 2013 /* Write Rx addresses (rar_entry_count for RAL/H, and
2011 * SHRAL/H) and initial CRC values to the MAC 2014 * SHRAL/H) and initial CRC values to the MAC
2012 */ 2015 */
2013 for (i = 0; i < (hw->mac.rar_entry_count + 4); i++) { 2016 for (i = 0; i < hw->mac.rar_entry_count; i++) {
2014 u8 mac_addr[ETH_ALEN] = { 0 }; 2017 u8 mac_addr[ETH_ALEN] = { 0 };
2015 u32 addr_high, addr_low; 2018 u32 addr_high, addr_low;
2016 2019
diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.h b/drivers/net/ethernet/intel/e1000e/ich8lan.h
index 59865695b282..217090df33e7 100644
--- a/drivers/net/ethernet/intel/e1000e/ich8lan.h
+++ b/drivers/net/ethernet/intel/e1000e/ich8lan.h
@@ -98,7 +98,7 @@
98#define PCIE_ICH8_SNOOP_ALL PCIE_NO_SNOOP_ALL 98#define PCIE_ICH8_SNOOP_ALL PCIE_NO_SNOOP_ALL
99 99
100#define E1000_ICH_RAR_ENTRIES 7 100#define E1000_ICH_RAR_ENTRIES 7
101#define E1000_PCH2_RAR_ENTRIES 5 /* RAR[0], SHRA[0-3] */ 101#define E1000_PCH2_RAR_ENTRIES 11 /* RAR[0-6], SHRA[0-3] */
102#define E1000_PCH_LPT_RAR_ENTRIES 12 /* RAR[0], SHRA[0-10] */ 102#define E1000_PCH_LPT_RAR_ENTRIES 12 /* RAR[0], SHRA[0-10] */
103 103
104#define PHY_PAGE_SHIFT 5 104#define PHY_PAGE_SHIFT 5
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index e87e9b01f404..4ef786775acb 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -4868,7 +4868,7 @@ static void e1000_watchdog_task(struct work_struct *work)
4868 */ 4868 */
4869 if ((hw->phy.type == e1000_phy_igp_3 || 4869 if ((hw->phy.type == e1000_phy_igp_3 ||
4870 hw->phy.type == e1000_phy_bm) && 4870 hw->phy.type == e1000_phy_bm) &&
4871 (hw->mac.autoneg == true) && 4871 hw->mac.autoneg &&
4872 (adapter->link_speed == SPEED_10 || 4872 (adapter->link_speed == SPEED_10 ||
4873 adapter->link_speed == SPEED_100) && 4873 adapter->link_speed == SPEED_100) &&
4874 (adapter->link_duplex == HALF_DUPLEX)) { 4874 (adapter->link_duplex == HALF_DUPLEX)) {
diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c
index 79b58353d849..47c2d10df826 100644
--- a/drivers/net/ethernet/intel/igb/e1000_82575.c
+++ b/drivers/net/ethernet/intel/igb/e1000_82575.c
@@ -719,6 +719,10 @@ static s32 igb_get_phy_id_82575(struct e1000_hw *hw)
719 u32 ctrl_ext; 719 u32 ctrl_ext;
720 u32 mdic; 720 u32 mdic;
721 721
722 /* Extra read required for some PHY's on i354 */
723 if (hw->mac.type == e1000_i354)
724 igb_get_phy_id(hw);
725
722 /* For SGMII PHYs, we try the list of possible addresses until 726 /* For SGMII PHYs, we try the list of possible addresses until
723 * we find one that works. For non-SGMII PHYs 727 * we find one that works. For non-SGMII PHYs
724 * (e.g. integrated copper PHYs), an address of 1 should 728 * (e.g. integrated copper PHYs), an address of 1 should
diff --git a/drivers/net/ethernet/intel/igb/e1000_mac.c b/drivers/net/ethernet/intel/igb/e1000_mac.c
index f0dfd41dd4bd..298f0ed50670 100644
--- a/drivers/net/ethernet/intel/igb/e1000_mac.c
+++ b/drivers/net/ethernet/intel/igb/e1000_mac.c
@@ -712,6 +712,7 @@ static s32 igb_set_fc_watermarks(struct e1000_hw *hw)
712static s32 igb_set_default_fc(struct e1000_hw *hw) 712static s32 igb_set_default_fc(struct e1000_hw *hw)
713{ 713{
714 s32 ret_val = 0; 714 s32 ret_val = 0;
715 u16 lan_offset;
715 u16 nvm_data; 716 u16 nvm_data;
716 717
717 /* Read and store word 0x0F of the EEPROM. This word contains bits 718 /* Read and store word 0x0F of the EEPROM. This word contains bits
@@ -722,7 +723,14 @@ static s32 igb_set_default_fc(struct e1000_hw *hw)
722 * control setting, then the variable hw->fc will 723 * control setting, then the variable hw->fc will
723 * be initialized based on a value in the EEPROM. 724 * be initialized based on a value in the EEPROM.
724 */ 725 */
725 ret_val = hw->nvm.ops.read(hw, NVM_INIT_CONTROL2_REG, 1, &nvm_data); 726 if (hw->mac.type == e1000_i350) {
727 lan_offset = NVM_82580_LAN_FUNC_OFFSET(hw->bus.func);
728 ret_val = hw->nvm.ops.read(hw, NVM_INIT_CONTROL2_REG
729 + lan_offset, 1, &nvm_data);
730 } else {
731 ret_val = hw->nvm.ops.read(hw, NVM_INIT_CONTROL2_REG,
732 1, &nvm_data);
733 }
726 734
727 if (ret_val) { 735 if (ret_val) {
728 hw_dbg("NVM Read Error\n"); 736 hw_dbg("NVM Read Error\n");
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
index 0e1b973659b0..e8649abf97c0 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
@@ -160,6 +160,13 @@ static int ixgbe_get_settings(struct net_device *netdev,
160 bool autoneg = false; 160 bool autoneg = false;
161 bool link_up; 161 bool link_up;
162 162
163 /* SFP type is needed for get_link_capabilities */
164 if (hw->phy.media_type & (ixgbe_media_type_fiber |
165 ixgbe_media_type_fiber_qsfp)) {
166 if (hw->phy.sfp_type == ixgbe_sfp_type_not_present)
167 hw->phy.ops.identify_sfp(hw);
168 }
169
163 hw->mac.ops.get_link_capabilities(hw, &supported_link, &autoneg); 170 hw->mac.ops.get_link_capabilities(hw, &supported_link, &autoneg);
164 171
165 /* set the supported link speeds */ 172 /* set the supported link speeds */
@@ -186,6 +193,11 @@ static int ixgbe_get_settings(struct net_device *netdev,
186 ecmd->advertising |= ADVERTISED_1000baseT_Full; 193 ecmd->advertising |= ADVERTISED_1000baseT_Full;
187 if (supported_link & IXGBE_LINK_SPEED_100_FULL) 194 if (supported_link & IXGBE_LINK_SPEED_100_FULL)
188 ecmd->advertising |= ADVERTISED_100baseT_Full; 195 ecmd->advertising |= ADVERTISED_100baseT_Full;
196
197 if (hw->phy.multispeed_fiber && !autoneg) {
198 if (supported_link & IXGBE_LINK_SPEED_10GB_FULL)
199 ecmd->advertising = ADVERTISED_10000baseT_Full;
200 }
189 } 201 }
190 202
191 if (autoneg) { 203 if (autoneg) {
@@ -314,6 +326,14 @@ static int ixgbe_set_settings(struct net_device *netdev,
314 if (ecmd->advertising & ~ecmd->supported) 326 if (ecmd->advertising & ~ecmd->supported)
315 return -EINVAL; 327 return -EINVAL;
316 328
329 /* only allow one speed at a time if no autoneg */
330 if (!ecmd->autoneg && hw->phy.multispeed_fiber) {
331 if (ecmd->advertising ==
332 (ADVERTISED_10000baseT_Full |
333 ADVERTISED_1000baseT_Full))
334 return -EINVAL;
335 }
336
317 old = hw->phy.autoneg_advertised; 337 old = hw->phy.autoneg_advertised;
318 advertised = 0; 338 advertised = 0;
319 if (ecmd->advertising & ADVERTISED_10000baseT_Full) 339 if (ecmd->advertising & ADVERTISED_10000baseT_Full)
@@ -1805,6 +1825,10 @@ static int ixgbe_run_loopback_test(struct ixgbe_adapter *adapter)
1805 unsigned int size = 1024; 1825 unsigned int size = 1024;
1806 netdev_tx_t tx_ret_val; 1826 netdev_tx_t tx_ret_val;
1807 struct sk_buff *skb; 1827 struct sk_buff *skb;
1828 u32 flags_orig = adapter->flags;
1829
1830 /* DCB can modify the frames on Tx */
1831 adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED;
1808 1832
1809 /* allocate test skb */ 1833 /* allocate test skb */
1810 skb = alloc_skb(size, GFP_KERNEL); 1834 skb = alloc_skb(size, GFP_KERNEL);
@@ -1857,6 +1881,7 @@ static int ixgbe_run_loopback_test(struct ixgbe_adapter *adapter)
1857 1881
1858 /* free the original skb */ 1882 /* free the original skb */
1859 kfree_skb(skb); 1883 kfree_skb(skb);
1884 adapter->flags = flags_orig;
1860 1885
1861 return ret_val; 1886 return ret_val;
1862} 1887}
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 7aba452833e5..0ade0cd5ef53 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -3571,7 +3571,7 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
3571{ 3571{
3572 struct ixgbe_hw *hw = &adapter->hw; 3572 struct ixgbe_hw *hw = &adapter->hw;
3573 int i; 3573 int i;
3574 u32 rxctrl; 3574 u32 rxctrl, rfctl;
3575 3575
3576 /* disable receives while setting up the descriptors */ 3576 /* disable receives while setting up the descriptors */
3577 rxctrl = IXGBE_READ_REG(hw, IXGBE_RXCTRL); 3577 rxctrl = IXGBE_READ_REG(hw, IXGBE_RXCTRL);
@@ -3580,6 +3580,13 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
3580 ixgbe_setup_psrtype(adapter); 3580 ixgbe_setup_psrtype(adapter);
3581 ixgbe_setup_rdrxctl(adapter); 3581 ixgbe_setup_rdrxctl(adapter);
3582 3582
3583 /* RSC Setup */
3584 rfctl = IXGBE_READ_REG(hw, IXGBE_RFCTL);
3585 rfctl &= ~IXGBE_RFCTL_RSC_DIS;
3586 if (!(adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED))
3587 rfctl |= IXGBE_RFCTL_RSC_DIS;
3588 IXGBE_WRITE_REG(hw, IXGBE_RFCTL, rfctl);
3589
3583 /* Program registers for the distribution of queues */ 3590 /* Program registers for the distribution of queues */
3584 ixgbe_setup_mrqc(adapter); 3591 ixgbe_setup_mrqc(adapter);
3585 3592
@@ -5993,8 +6000,16 @@ static void ixgbe_sfp_link_config_subtask(struct ixgbe_adapter *adapter)
5993 adapter->flags &= ~IXGBE_FLAG_NEED_LINK_CONFIG; 6000 adapter->flags &= ~IXGBE_FLAG_NEED_LINK_CONFIG;
5994 6001
5995 speed = hw->phy.autoneg_advertised; 6002 speed = hw->phy.autoneg_advertised;
5996 if ((!speed) && (hw->mac.ops.get_link_capabilities)) 6003 if ((!speed) && (hw->mac.ops.get_link_capabilities)) {
5997 hw->mac.ops.get_link_capabilities(hw, &speed, &autoneg); 6004 hw->mac.ops.get_link_capabilities(hw, &speed, &autoneg);
6005
6006 /* setup the highest link when no autoneg */
6007 if (!autoneg) {
6008 if (speed & IXGBE_LINK_SPEED_10GB_FULL)
6009 speed = IXGBE_LINK_SPEED_10GB_FULL;
6010 }
6011 }
6012
5998 if (hw->mac.ops.setup_link) 6013 if (hw->mac.ops.setup_link)
5999 hw->mac.ops.setup_link(hw, speed, true); 6014 hw->mac.ops.setup_link(hw, speed, true);
6000 6015
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
index 6442cf8f9dce..10775cb9b6d8 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
@@ -1861,6 +1861,7 @@ enum {
1861#define IXGBE_RFCTL_ISCSI_DIS 0x00000001 1861#define IXGBE_RFCTL_ISCSI_DIS 0x00000001
1862#define IXGBE_RFCTL_ISCSI_DWC_MASK 0x0000003E 1862#define IXGBE_RFCTL_ISCSI_DWC_MASK 0x0000003E
1863#define IXGBE_RFCTL_ISCSI_DWC_SHIFT 1 1863#define IXGBE_RFCTL_ISCSI_DWC_SHIFT 1
1864#define IXGBE_RFCTL_RSC_DIS 0x00000020
1864#define IXGBE_RFCTL_NFSW_DIS 0x00000040 1865#define IXGBE_RFCTL_NFSW_DIS 0x00000040
1865#define IXGBE_RFCTL_NFSR_DIS 0x00000080 1866#define IXGBE_RFCTL_NFSR_DIS 0x00000080
1866#define IXGBE_RFCTL_NFS_VER_MASK 0x00000300 1867#define IXGBE_RFCTL_NFS_VER_MASK 0x00000300
diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c
index bfdb06860397..6a6c1f76d8e0 100644
--- a/drivers/net/ethernet/lantiq_etop.c
+++ b/drivers/net/ethernet/lantiq_etop.c
@@ -282,8 +282,7 @@ ltq_etop_hw_init(struct net_device *dev)
282 282
283 if (IS_TX(i)) { 283 if (IS_TX(i)) {
284 ltq_dma_alloc_tx(&ch->dma); 284 ltq_dma_alloc_tx(&ch->dma);
285 request_irq(irq, ltq_etop_dma_irq, IRQF_DISABLED, 285 request_irq(irq, ltq_etop_dma_irq, 0, "etop_tx", priv);
286 "etop_tx", priv);
287 } else if (IS_RX(i)) { 286 } else if (IS_RX(i)) {
288 ltq_dma_alloc_rx(&ch->dma); 287 ltq_dma_alloc_rx(&ch->dma);
289 for (ch->dma.desc = 0; ch->dma.desc < LTQ_DESC_NUM; 288 for (ch->dma.desc = 0; ch->dma.desc < LTQ_DESC_NUM;
@@ -291,8 +290,7 @@ ltq_etop_hw_init(struct net_device *dev)
291 if (ltq_etop_alloc_skb(ch)) 290 if (ltq_etop_alloc_skb(ch))
292 return -ENOMEM; 291 return -ENOMEM;
293 ch->dma.desc = 0; 292 ch->dma.desc = 0;
294 request_irq(irq, ltq_etop_dma_irq, IRQF_DISABLED, 293 request_irq(irq, ltq_etop_dma_irq, 0, "etop_rx", priv);
295 "etop_rx", priv);
296 } 294 }
297 ch->dma.irq = irq; 295 ch->dma.irq = irq;
298 } 296 }
diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
index 4ae0c7426010..fff62460185c 100644
--- a/drivers/net/ethernet/marvell/pxa168_eth.c
+++ b/drivers/net/ethernet/marvell/pxa168_eth.c
@@ -1123,8 +1123,7 @@ static int pxa168_eth_open(struct net_device *dev)
1123 struct pxa168_eth_private *pep = netdev_priv(dev); 1123 struct pxa168_eth_private *pep = netdev_priv(dev);
1124 int err; 1124 int err;
1125 1125
1126 err = request_irq(dev->irq, pxa168_eth_int_handler, 1126 err = request_irq(dev->irq, pxa168_eth_int_handler, 0, dev->name, dev);
1127 IRQF_DISABLED, dev->name, dev);
1128 if (err) { 1127 if (err) {
1129 dev_err(&dev->dev, "can't assign irq\n"); 1128 dev_err(&dev->dev, "can't assign irq\n");
1130 return -EAGAIN; 1129 return -EAGAIN;
diff --git a/drivers/net/ethernet/marvell/skge.c b/drivers/net/ethernet/marvell/skge.c
index ef94a591f9e5..1a9c4f6269ea 100644
--- a/drivers/net/ethernet/marvell/skge.c
+++ b/drivers/net/ethernet/marvell/skge.c
@@ -3092,6 +3092,9 @@ static struct sk_buff *skge_rx_get(struct net_device *dev,
3092 if (!nskb) 3092 if (!nskb)
3093 goto resubmit; 3093 goto resubmit;
3094 3094
3095 skb = e->skb;
3096 prefetch(skb->data);
3097
3095 if (skge_rx_setup(skge, e, nskb, skge->rx_buf_size) < 0) { 3098 if (skge_rx_setup(skge, e, nskb, skge->rx_buf_size) < 0) {
3096 dev_kfree_skb(nskb); 3099 dev_kfree_skb(nskb);
3097 goto resubmit; 3100 goto resubmit;
@@ -3101,8 +3104,6 @@ static struct sk_buff *skge_rx_get(struct net_device *dev,
3101 dma_unmap_addr(e, mapaddr), 3104 dma_unmap_addr(e, mapaddr),
3102 dma_unmap_len(e, maplen), 3105 dma_unmap_len(e, maplen),
3103 PCI_DMA_FROMDEVICE); 3106 PCI_DMA_FROMDEVICE);
3104 skb = e->skb;
3105 prefetch(skb->data);
3106 } 3107 }
3107 3108
3108 skb_put(skb, len); 3109 skb_put(skb, len);
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
index a28cd801a236..0c750985f47e 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
@@ -53,9 +53,11 @@ static int mlx4_en_moderation_update(struct mlx4_en_priv *priv)
53 for (i = 0; i < priv->tx_ring_num; i++) { 53 for (i = 0; i < priv->tx_ring_num; i++) {
54 priv->tx_cq[i].moder_cnt = priv->tx_frames; 54 priv->tx_cq[i].moder_cnt = priv->tx_frames;
55 priv->tx_cq[i].moder_time = priv->tx_usecs; 55 priv->tx_cq[i].moder_time = priv->tx_usecs;
56 err = mlx4_en_set_cq_moder(priv, &priv->tx_cq[i]); 56 if (priv->port_up) {
57 if (err) 57 err = mlx4_en_set_cq_moder(priv, &priv->tx_cq[i]);
58 return err; 58 if (err)
59 return err;
60 }
59 } 61 }
60 62
61 if (priv->adaptive_rx_coal) 63 if (priv->adaptive_rx_coal)
@@ -65,9 +67,11 @@ static int mlx4_en_moderation_update(struct mlx4_en_priv *priv)
65 priv->rx_cq[i].moder_cnt = priv->rx_frames; 67 priv->rx_cq[i].moder_cnt = priv->rx_frames;
66 priv->rx_cq[i].moder_time = priv->rx_usecs; 68 priv->rx_cq[i].moder_time = priv->rx_usecs;
67 priv->last_moder_time[i] = MLX4_EN_AUTO_CONF; 69 priv->last_moder_time[i] = MLX4_EN_AUTO_CONF;
68 err = mlx4_en_set_cq_moder(priv, &priv->rx_cq[i]); 70 if (priv->port_up) {
69 if (err) 71 err = mlx4_en_set_cq_moder(priv, &priv->rx_cq[i]);
70 return err; 72 if (err)
73 return err;
74 }
71 } 75 }
72 76
73 return err; 77 return err;
diff --git a/drivers/net/ethernet/micrel/ks8851_mll.c b/drivers/net/ethernet/micrel/ks8851_mll.c
index 0fba1532d326..075f4e21d33d 100644
--- a/drivers/net/ethernet/micrel/ks8851_mll.c
+++ b/drivers/net/ethernet/micrel/ks8851_mll.c
@@ -915,7 +915,7 @@ static int ks_net_open(struct net_device *netdev)
915 struct ks_net *ks = netdev_priv(netdev); 915 struct ks_net *ks = netdev_priv(netdev);
916 int err; 916 int err;
917 917
918#define KS_INT_FLAGS (IRQF_DISABLED|IRQF_TRIGGER_LOW) 918#define KS_INT_FLAGS IRQF_TRIGGER_LOW
919 /* lock the card, even if we may not actually do anything 919 /* lock the card, even if we may not actually do anything
920 * else at the moment. 920 * else at the moment.
921 */ 921 */
diff --git a/drivers/net/ethernet/natsemi/jazzsonic.c b/drivers/net/ethernet/natsemi/jazzsonic.c
index c20766c2f65b..79257f71c5d9 100644
--- a/drivers/net/ethernet/natsemi/jazzsonic.c
+++ b/drivers/net/ethernet/natsemi/jazzsonic.c
@@ -83,8 +83,7 @@ static int jazzsonic_open(struct net_device* dev)
83{ 83{
84 int retval; 84 int retval;
85 85
86 retval = request_irq(dev->irq, sonic_interrupt, IRQF_DISABLED, 86 retval = request_irq(dev->irq, sonic_interrupt, 0, "sonic", dev);
87 "sonic", dev);
88 if (retval) { 87 if (retval) {
89 printk(KERN_ERR "%s: unable to get IRQ %d.\n", 88 printk(KERN_ERR "%s: unable to get IRQ %d.\n",
90 dev->name, dev->irq); 89 dev->name, dev->irq);
diff --git a/drivers/net/ethernet/natsemi/xtsonic.c b/drivers/net/ethernet/natsemi/xtsonic.c
index c2e0256fe3df..4da172ac5599 100644
--- a/drivers/net/ethernet/natsemi/xtsonic.c
+++ b/drivers/net/ethernet/natsemi/xtsonic.c
@@ -95,8 +95,7 @@ static int xtsonic_open(struct net_device *dev)
95{ 95{
96 int retval; 96 int retval;
97 97
98 retval = request_irq(dev->irq, sonic_interrupt, IRQF_DISABLED, 98 retval = request_irq(dev->irq, sonic_interrupt, 0, "sonic", dev);
99 "sonic", dev);
100 if (retval) { 99 if (retval) {
101 printk(KERN_ERR "%s: unable to get IRQ %d.\n", 100 printk(KERN_ERR "%s: unable to get IRQ %d.\n",
102 dev->name, dev->irq); 101 dev->name, dev->irq);
diff --git a/drivers/net/ethernet/pasemi/pasemi_mac.c b/drivers/net/ethernet/pasemi/pasemi_mac.c
index c498181a9aa8..5b65356e7568 100644
--- a/drivers/net/ethernet/pasemi/pasemi_mac.c
+++ b/drivers/net/ethernet/pasemi/pasemi_mac.c
@@ -1219,7 +1219,7 @@ static int pasemi_mac_open(struct net_device *dev)
1219 snprintf(mac->tx_irq_name, sizeof(mac->tx_irq_name), "%s tx", 1219 snprintf(mac->tx_irq_name, sizeof(mac->tx_irq_name), "%s tx",
1220 dev->name); 1220 dev->name);
1221 1221
1222 ret = request_irq(mac->tx->chan.irq, pasemi_mac_tx_intr, IRQF_DISABLED, 1222 ret = request_irq(mac->tx->chan.irq, pasemi_mac_tx_intr, 0,
1223 mac->tx_irq_name, mac->tx); 1223 mac->tx_irq_name, mac->tx);
1224 if (ret) { 1224 if (ret) {
1225 dev_err(&mac->pdev->dev, "request_irq of irq %d failed: %d\n", 1225 dev_err(&mac->pdev->dev, "request_irq of irq %d failed: %d\n",
@@ -1230,7 +1230,7 @@ static int pasemi_mac_open(struct net_device *dev)
1230 snprintf(mac->rx_irq_name, sizeof(mac->rx_irq_name), "%s rx", 1230 snprintf(mac->rx_irq_name, sizeof(mac->rx_irq_name), "%s rx",
1231 dev->name); 1231 dev->name);
1232 1232
1233 ret = request_irq(mac->rx->chan.irq, pasemi_mac_rx_intr, IRQF_DISABLED, 1233 ret = request_irq(mac->rx->chan.irq, pasemi_mac_rx_intr, 0,
1234 mac->rx_irq_name, mac->rx); 1234 mac->rx_irq_name, mac->rx);
1235 if (ret) { 1235 if (ret) {
1236 dev_err(&mac->pdev->dev, "request_irq of irq %d failed: %d\n", 1236 dev_err(&mac->pdev->dev, "request_irq of irq %d failed: %d\n",
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
index 652cc13c5023..392b9bd12b4f 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
@@ -1561,6 +1561,7 @@ static int qlcnic_sriov_vf_reinit_driver(struct qlcnic_adapter *adapter)
1561{ 1561{
1562 int err; 1562 int err;
1563 1563
1564 adapter->need_fw_reset = 0;
1564 qlcnic_83xx_reinit_mbx_work(adapter->ahw->mailbox); 1565 qlcnic_83xx_reinit_mbx_work(adapter->ahw->mailbox);
1565 qlcnic_83xx_enable_mbx_interrupt(adapter); 1566 qlcnic_83xx_enable_mbx_interrupt(adapter);
1566 1567
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 6f87f2cde647..3397cee89777 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -4231,6 +4231,7 @@ static void rtl_init_rxcfg(struct rtl8169_private *tp)
4231 case RTL_GIGA_MAC_VER_23: 4231 case RTL_GIGA_MAC_VER_23:
4232 case RTL_GIGA_MAC_VER_24: 4232 case RTL_GIGA_MAC_VER_24:
4233 case RTL_GIGA_MAC_VER_34: 4233 case RTL_GIGA_MAC_VER_34:
4234 case RTL_GIGA_MAC_VER_35:
4234 RTL_W32(RxConfig, RX128_INT_EN | RX_MULTI_EN | RX_DMA_BURST); 4235 RTL_W32(RxConfig, RX128_INT_EN | RX_MULTI_EN | RX_DMA_BURST);
4235 break; 4236 break;
4236 case RTL_GIGA_MAC_VER_40: 4237 case RTL_GIGA_MAC_VER_40:
diff --git a/drivers/net/ethernet/sfc/Kconfig b/drivers/net/ethernet/sfc/Kconfig
index 8b7152565c5e..088921294448 100644
--- a/drivers/net/ethernet/sfc/Kconfig
+++ b/drivers/net/ethernet/sfc/Kconfig
@@ -7,7 +7,7 @@ config SFC
7 select I2C_ALGOBIT 7 select I2C_ALGOBIT
8 select PTP_1588_CLOCK 8 select PTP_1588_CLOCK
9 ---help--- 9 ---help---
10 This driver supports 10-gigabit Ethernet cards based on 10 This driver supports 10/40-gigabit Ethernet cards based on
11 the Solarflare SFC4000, SFC9000-family and SFC9100-family 11 the Solarflare SFC4000, SFC9000-family and SFC9100-family
12 controllers. 12 controllers.
13 13
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
index 5f42313b4965..9f18ae984f9e 100644
--- a/drivers/net/ethernet/sfc/ef10.c
+++ b/drivers/net/ethernet/sfc/ef10.c
@@ -94,7 +94,7 @@ static unsigned int efx_ef10_mem_map_size(struct efx_nic *efx)
94 return resource_size(&efx->pci_dev->resource[EFX_MEM_BAR]); 94 return resource_size(&efx->pci_dev->resource[EFX_MEM_BAR]);
95} 95}
96 96
97static int efx_ef10_init_capabilities(struct efx_nic *efx) 97static int efx_ef10_init_datapath_caps(struct efx_nic *efx)
98{ 98{
99 MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_CAPABILITIES_OUT_LEN); 99 MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_CAPABILITIES_OUT_LEN);
100 struct efx_ef10_nic_data *nic_data = efx->nic_data; 100 struct efx_ef10_nic_data *nic_data = efx->nic_data;
@@ -107,16 +107,27 @@ static int efx_ef10_init_capabilities(struct efx_nic *efx)
107 outbuf, sizeof(outbuf), &outlen); 107 outbuf, sizeof(outbuf), &outlen);
108 if (rc) 108 if (rc)
109 return rc; 109 return rc;
110 if (outlen < sizeof(outbuf)) {
111 netif_err(efx, drv, efx->net_dev,
112 "unable to read datapath firmware capabilities\n");
113 return -EIO;
114 }
110 115
111 if (outlen >= sizeof(outbuf)) { 116 nic_data->datapath_caps =
112 nic_data->datapath_caps = 117 MCDI_DWORD(outbuf, GET_CAPABILITIES_OUT_FLAGS1);
113 MCDI_DWORD(outbuf, GET_CAPABILITIES_OUT_FLAGS1); 118
114 if (!(nic_data->datapath_caps & 119 if (!(nic_data->datapath_caps &
115 (1 << MC_CMD_GET_CAPABILITIES_OUT_TX_TSO_LBN))) { 120 (1 << MC_CMD_GET_CAPABILITIES_OUT_TX_TSO_LBN))) {
116 netif_err(efx, drv, efx->net_dev, 121 netif_err(efx, drv, efx->net_dev,
117 "Capabilities don't indicate TSO support.\n"); 122 "current firmware does not support TSO\n");
118 return -ENODEV; 123 return -ENODEV;
119 } 124 }
125
126 if (!(nic_data->datapath_caps &
127 (1 << MC_CMD_GET_CAPABILITIES_OUT_RX_PREFIX_LEN_14_LBN))) {
128 netif_err(efx, probe, efx->net_dev,
129 "current firmware does not support an RX prefix\n");
130 return -ENODEV;
120 } 131 }
121 132
122 return 0; 133 return 0;
@@ -217,21 +228,13 @@ static int efx_ef10_probe(struct efx_nic *efx)
217 if (rc) 228 if (rc)
218 goto fail3; 229 goto fail3;
219 230
220 rc = efx_ef10_init_capabilities(efx); 231 rc = efx_ef10_init_datapath_caps(efx);
221 if (rc < 0) 232 if (rc < 0)
222 goto fail3; 233 goto fail3;
223 234
224 efx->rx_packet_len_offset = 235 efx->rx_packet_len_offset =
225 ES_DZ_RX_PREFIX_PKTLEN_OFST - ES_DZ_RX_PREFIX_SIZE; 236 ES_DZ_RX_PREFIX_PKTLEN_OFST - ES_DZ_RX_PREFIX_SIZE;
226 237
227 if (!(nic_data->datapath_caps &
228 (1 << MC_CMD_GET_CAPABILITIES_OUT_RX_PREFIX_LEN_14_LBN))) {
229 netif_err(efx, probe, efx->net_dev,
230 "current firmware does not support an RX prefix\n");
231 rc = -ENODEV;
232 goto fail3;
233 }
234
235 rc = efx_mcdi_port_get_number(efx); 238 rc = efx_mcdi_port_get_number(efx);
236 if (rc < 0) 239 if (rc < 0)
237 goto fail3; 240 goto fail3;
@@ -260,8 +263,6 @@ static int efx_ef10_probe(struct efx_nic *efx)
260 if (rc) 263 if (rc)
261 goto fail3; 264 goto fail3;
262 265
263 efx_ptp_probe(efx);
264
265 return 0; 266 return 0;
266 267
267fail3: 268fail3:
@@ -342,6 +343,13 @@ static int efx_ef10_init_nic(struct efx_nic *efx)
342 struct efx_ef10_nic_data *nic_data = efx->nic_data; 343 struct efx_ef10_nic_data *nic_data = efx->nic_data;
343 int rc; 344 int rc;
344 345
346 if (nic_data->must_check_datapath_caps) {
347 rc = efx_ef10_init_datapath_caps(efx);
348 if (rc)
349 return rc;
350 nic_data->must_check_datapath_caps = false;
351 }
352
345 if (nic_data->must_realloc_vis) { 353 if (nic_data->must_realloc_vis) {
346 /* We cannot let the number of VIs change now */ 354 /* We cannot let the number of VIs change now */
347 rc = efx_ef10_alloc_vis(efx, nic_data->n_allocated_vis, 355 rc = efx_ef10_alloc_vis(efx, nic_data->n_allocated_vis,
@@ -710,6 +718,14 @@ static int efx_ef10_mcdi_poll_reboot(struct efx_nic *efx)
710 nic_data->must_restore_filters = true; 718 nic_data->must_restore_filters = true;
711 nic_data->rx_rss_context = EFX_EF10_RSS_CONTEXT_INVALID; 719 nic_data->rx_rss_context = EFX_EF10_RSS_CONTEXT_INVALID;
712 720
721 /* The datapath firmware might have been changed */
722 nic_data->must_check_datapath_caps = true;
723
724 /* MAC statistics have been cleared on the NIC; clear the local
725 * statistic that we update with efx_update_diff_stat().
726 */
727 nic_data->stats[EF10_STAT_rx_bad_bytes] = 0;
728
713 return -EIO; 729 return -EIO;
714} 730}
715 731
diff --git a/drivers/net/ethernet/sfc/mcdi_port.c b/drivers/net/ethernet/sfc/mcdi_port.c
index 8d33da6697fb..7b6be61d549f 100644
--- a/drivers/net/ethernet/sfc/mcdi_port.c
+++ b/drivers/net/ethernet/sfc/mcdi_port.c
@@ -556,6 +556,7 @@ static int efx_mcdi_phy_set_settings(struct efx_nic *efx, struct ethtool_cmd *ec
556 case 100: caps = 1 << MC_CMD_PHY_CAP_100FDX_LBN; break; 556 case 100: caps = 1 << MC_CMD_PHY_CAP_100FDX_LBN; break;
557 case 1000: caps = 1 << MC_CMD_PHY_CAP_1000FDX_LBN; break; 557 case 1000: caps = 1 << MC_CMD_PHY_CAP_1000FDX_LBN; break;
558 case 10000: caps = 1 << MC_CMD_PHY_CAP_10000FDX_LBN; break; 558 case 10000: caps = 1 << MC_CMD_PHY_CAP_10000FDX_LBN; break;
559 case 40000: caps = 1 << MC_CMD_PHY_CAP_40000FDX_LBN; break;
559 default: return -EINVAL; 560 default: return -EINVAL;
560 } 561 }
561 } else { 562 } else {
@@ -841,6 +842,7 @@ static unsigned int efx_mcdi_event_link_speed[] = {
841 [MCDI_EVENT_LINKCHANGE_SPEED_100M] = 100, 842 [MCDI_EVENT_LINKCHANGE_SPEED_100M] = 100,
842 [MCDI_EVENT_LINKCHANGE_SPEED_1G] = 1000, 843 [MCDI_EVENT_LINKCHANGE_SPEED_1G] = 1000,
843 [MCDI_EVENT_LINKCHANGE_SPEED_10G] = 10000, 844 [MCDI_EVENT_LINKCHANGE_SPEED_10G] = 10000,
845 [MCDI_EVENT_LINKCHANGE_SPEED_40G] = 40000,
844}; 846};
845 847
846void efx_mcdi_process_link_change(struct efx_nic *efx, efx_qword_t *ev) 848void efx_mcdi_process_link_change(struct efx_nic *efx, efx_qword_t *ev)
diff --git a/drivers/net/ethernet/sfc/nic.h b/drivers/net/ethernet/sfc/nic.h
index 4b1e188f7a2f..fda29d39032f 100644
--- a/drivers/net/ethernet/sfc/nic.h
+++ b/drivers/net/ethernet/sfc/nic.h
@@ -400,6 +400,8 @@ enum {
400 * @rx_rss_context: Firmware handle for our RSS context 400 * @rx_rss_context: Firmware handle for our RSS context
401 * @stats: Hardware statistics 401 * @stats: Hardware statistics
402 * @workaround_35388: Flag: firmware supports workaround for bug 35388 402 * @workaround_35388: Flag: firmware supports workaround for bug 35388
403 * @must_check_datapath_caps: Flag: @datapath_caps needs to be revalidated
404 * after MC reboot
403 * @datapath_caps: Capabilities of datapath firmware (FLAGS1 field of 405 * @datapath_caps: Capabilities of datapath firmware (FLAGS1 field of
404 * %MC_CMD_GET_CAPABILITIES response) 406 * %MC_CMD_GET_CAPABILITIES response)
405 */ 407 */
@@ -413,6 +415,7 @@ struct efx_ef10_nic_data {
413 u32 rx_rss_context; 415 u32 rx_rss_context;
414 u64 stats[EF10_STAT_COUNT]; 416 u64 stats[EF10_STAT_COUNT];
415 bool workaround_35388; 417 bool workaround_35388;
418 bool must_check_datapath_caps;
416 u32 datapath_caps; 419 u32 datapath_caps;
417}; 420};
418 421
diff --git a/drivers/net/ethernet/smsc/smc91x.h b/drivers/net/ethernet/smsc/smc91x.h
index 370e13dde115..5730fe2445a6 100644
--- a/drivers/net/ethernet/smsc/smc91x.h
+++ b/drivers/net/ethernet/smsc/smc91x.h
@@ -271,7 +271,7 @@ static inline void mcf_outsw(void *a, unsigned char *p, int l)
271#define SMC_insw(a, r, p, l) mcf_insw(a + r, p, l) 271#define SMC_insw(a, r, p, l) mcf_insw(a + r, p, l)
272#define SMC_outsw(a, r, p, l) mcf_outsw(a + r, p, l) 272#define SMC_outsw(a, r, p, l) mcf_outsw(a + r, p, l)
273 273
274#define SMC_IRQ_FLAGS (IRQF_DISABLED) 274#define SMC_IRQ_FLAGS 0
275 275
276#else 276#else
277 277
diff --git a/drivers/net/ethernet/smsc/smsc9420.c b/drivers/net/ethernet/smsc/smsc9420.c
index ffa5c4ad1210..5f9e79f7f2df 100644
--- a/drivers/net/ethernet/smsc/smsc9420.c
+++ b/drivers/net/ethernet/smsc/smsc9420.c
@@ -1356,8 +1356,7 @@ static int smsc9420_open(struct net_device *dev)
1356 smsc9420_reg_write(pd, INT_STAT, 0xFFFFFFFF); 1356 smsc9420_reg_write(pd, INT_STAT, 0xFFFFFFFF);
1357 smsc9420_pci_flush_write(pd); 1357 smsc9420_pci_flush_write(pd);
1358 1358
1359 result = request_irq(irq, smsc9420_isr, IRQF_SHARED | IRQF_DISABLED, 1359 result = request_irq(irq, smsc9420_isr, IRQF_SHARED, DRV_NAME, pd);
1360 DRV_NAME, pd);
1361 if (result) { 1360 if (result) {
1362 smsc_warn(IFUP, "Unable to use IRQ = %d", irq); 1361 smsc_warn(IFUP, "Unable to use IRQ = %d", irq);
1363 result = -ENODEV; 1362 result = -ENODEV;
diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_net.c b/drivers/net/ethernet/toshiba/ps3_gelic_net.c
index 9c805e0c0cae..f7f2ef49c0c1 100644
--- a/drivers/net/ethernet/toshiba/ps3_gelic_net.c
+++ b/drivers/net/ethernet/toshiba/ps3_gelic_net.c
@@ -1726,7 +1726,7 @@ static int ps3_gelic_driver_probe(struct ps3_system_bus_device *dev)
1726 goto fail_alloc_irq; 1726 goto fail_alloc_irq;
1727 } 1727 }
1728 result = request_irq(card->irq, gelic_card_interrupt, 1728 result = request_irq(card->irq, gelic_card_interrupt,
1729 IRQF_DISABLED, netdev->name, card); 1729 0, netdev->name, card);
1730 1730
1731 if (result) { 1731 if (result) {
1732 dev_info(ctodev(card), "%s:request_irq failed (%d)\n", 1732 dev_info(ctodev(card), "%s:request_irq failed (%d)\n",
diff --git a/drivers/net/irda/mcs7780.c b/drivers/net/irda/mcs7780.c
index f07c340990da..3f138ca88670 100644
--- a/drivers/net/irda/mcs7780.c
+++ b/drivers/net/irda/mcs7780.c
@@ -191,8 +191,8 @@ static inline int mcs_setup_transceiver_vishay(struct mcs_cb *mcs)
191 goto error; 191 goto error;
192 192
193 ret = 0; 193 ret = 0;
194 error: 194error:
195 return ret; 195 return ret;
196} 196}
197 197
198/* Setup a communication between mcs7780 and agilent chip. */ 198/* Setup a communication between mcs7780 and agilent chip. */
@@ -501,8 +501,11 @@ static inline int mcs_setup_urbs(struct mcs_cb *mcs)
501 return 0; 501 return 0;
502 502
503 mcs->rx_urb = usb_alloc_urb(0, GFP_KERNEL); 503 mcs->rx_urb = usb_alloc_urb(0, GFP_KERNEL);
504 if (!mcs->rx_urb) 504 if (!mcs->rx_urb) {
505 usb_free_urb(mcs->tx_urb);
506 mcs->tx_urb = NULL;
505 return 0; 507 return 0;
508 }
506 509
507 return 1; 510 return 1;
508} 511}
@@ -643,9 +646,9 @@ static int mcs_speed_change(struct mcs_cb *mcs)
643 ret = mcs_set_reg(mcs, MCS_MODE_REG, rval); 646 ret = mcs_set_reg(mcs, MCS_MODE_REG, rval);
644 647
645 mcs->speed = mcs->new_speed; 648 mcs->speed = mcs->new_speed;
646 error: 649error:
647 mcs->new_speed = 0; 650 mcs->new_speed = 0;
648 return ret; 651 return ret;
649} 652}
650 653
651/* Ioctl calls not supported at this time. Can be an area of future work. */ 654/* Ioctl calls not supported at this time. Can be an area of future work. */
@@ -738,17 +741,20 @@ static int mcs_net_open(struct net_device *netdev)
738 741
739 ret = mcs_receive_start(mcs); 742 ret = mcs_receive_start(mcs);
740 if (ret) 743 if (ret)
741 goto error3; 744 goto error4;
742 745
743 netif_start_queue(netdev); 746 netif_start_queue(netdev);
744 return 0; 747 return 0;
745 748
746 error3: 749error4:
747 irlap_close(mcs->irlap); 750 usb_free_urb(mcs->rx_urb);
748 error2: 751 usb_free_urb(mcs->tx_urb);
749 kfree_skb(mcs->rx_buff.skb); 752error3:
750 error1: 753 irlap_close(mcs->irlap);
751 return ret; 754error2:
755 kfree_skb(mcs->rx_buff.skb);
756error1:
757 return ret;
752} 758}
753 759
754/* Receive callback function. */ 760/* Receive callback function. */
@@ -946,11 +952,11 @@ static int mcs_probe(struct usb_interface *intf,
946 usb_set_intfdata(intf, mcs); 952 usb_set_intfdata(intf, mcs);
947 return 0; 953 return 0;
948 954
949 error2: 955error2:
950 free_netdev(ndev); 956 free_netdev(ndev);
951 957
952 error1: 958error1:
953 return ret; 959 return ret;
954} 960}
955 961
956/* The current device is removed, the USB layer tells us to shut down. */ 962/* The current device is removed, the USB layer tells us to shut down. */
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index fcbf680c3e62..a17d85a331f1 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -146,6 +146,7 @@ static int loopback_dev_init(struct net_device *dev)
146 146
147static void loopback_dev_free(struct net_device *dev) 147static void loopback_dev_free(struct net_device *dev)
148{ 148{
149 dev_net(dev)->loopback_dev = NULL;
149 free_percpu(dev->lstats); 150 free_percpu(dev->lstats);
150 free_netdev(dev); 151 free_netdev(dev);
151} 152}
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index dcb21347c670..adeee615dd19 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -684,15 +684,12 @@ restart:
684 case NETDEV_RELEASE: 684 case NETDEV_RELEASE:
685 case NETDEV_JOIN: 685 case NETDEV_JOIN:
686 case NETDEV_UNREGISTER: 686 case NETDEV_UNREGISTER:
687 /* 687 /* rtnl_lock already held
688 * rtnl_lock already held
689 * we might sleep in __netpoll_cleanup() 688 * we might sleep in __netpoll_cleanup()
690 */ 689 */
691 spin_unlock_irqrestore(&target_list_lock, flags); 690 spin_unlock_irqrestore(&target_list_lock, flags);
692 691
693 mutex_lock(&nt->mutex);
694 __netpoll_cleanup(&nt->np); 692 __netpoll_cleanup(&nt->np);
695 mutex_unlock(&nt->mutex);
696 693
697 spin_lock_irqsave(&target_list_lock, flags); 694 spin_lock_irqsave(&target_list_lock, flags);
698 dev_put(nt->np.dev); 695 dev_put(nt->np.dev);
diff --git a/drivers/net/phy/cicada.c b/drivers/net/phy/cicada.c
index db472ffb6e89..313a0377f68f 100644
--- a/drivers/net/phy/cicada.c
+++ b/drivers/net/phy/cicada.c
@@ -30,9 +30,9 @@
30#include <linux/ethtool.h> 30#include <linux/ethtool.h>
31#include <linux/phy.h> 31#include <linux/phy.h>
32 32
33#include <asm/io.h> 33#include <linux/io.h>
34#include <asm/irq.h> 34#include <asm/irq.h>
35#include <asm/uaccess.h> 35#include <linux/uaccess.h>
36 36
37/* Cicada Extended Control Register 1 */ 37/* Cicada Extended Control Register 1 */
38#define MII_CIS8201_EXT_CON1 0x17 38#define MII_CIS8201_EXT_CON1 0x17
diff --git a/drivers/net/ppp/pptp.c b/drivers/net/ppp/pptp.c
index 6fa5ae00039f..01805319e1e0 100644
--- a/drivers/net/ppp/pptp.c
+++ b/drivers/net/ppp/pptp.c
@@ -281,7 +281,7 @@ static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
281 nf_reset(skb); 281 nf_reset(skb);
282 282
283 skb->ip_summed = CHECKSUM_NONE; 283 skb->ip_summed = CHECKSUM_NONE;
284 ip_select_ident(iph, &rt->dst, NULL); 284 ip_select_ident(skb, &rt->dst, NULL);
285 ip_send_check(iph); 285 ip_send_check(iph);
286 286
287 ip_local_out(skb); 287 ip_local_out(skb);
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index a639de8401f8..807815fc9968 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1641,11 +1641,11 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
1641 INIT_LIST_HEAD(&tun->disabled); 1641 INIT_LIST_HEAD(&tun->disabled);
1642 err = tun_attach(tun, file, false); 1642 err = tun_attach(tun, file, false);
1643 if (err < 0) 1643 if (err < 0)
1644 goto err_free_dev; 1644 goto err_free_flow;
1645 1645
1646 err = register_netdevice(tun->dev); 1646 err = register_netdevice(tun->dev);
1647 if (err < 0) 1647 if (err < 0)
1648 goto err_free_dev; 1648 goto err_detach;
1649 1649
1650 if (device_create_file(&tun->dev->dev, &dev_attr_tun_flags) || 1650 if (device_create_file(&tun->dev->dev, &dev_attr_tun_flags) ||
1651 device_create_file(&tun->dev->dev, &dev_attr_owner) || 1651 device_create_file(&tun->dev->dev, &dev_attr_owner) ||
@@ -1689,7 +1689,12 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
1689 strcpy(ifr->ifr_name, tun->dev->name); 1689 strcpy(ifr->ifr_name, tun->dev->name);
1690 return 0; 1690 return 0;
1691 1691
1692 err_free_dev: 1692err_detach:
1693 tun_detach_all(dev);
1694err_free_flow:
1695 tun_flow_uninit(tun);
1696 security_tun_dev_free_security(tun->security);
1697err_free_dev:
1693 free_netdev(dev); 1698 free_netdev(dev);
1694 return err; 1699 return err;
1695} 1700}
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 03ad4dc293aa..2023f3ea891e 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -33,7 +33,7 @@
33#include <linux/usb/usbnet.h> 33#include <linux/usb/usbnet.h>
34 34
35 35
36#if defined(CONFIG_USB_NET_RNDIS_HOST) || defined(CONFIG_USB_NET_RNDIS_HOST_MODULE) 36#if IS_ENABLED(CONFIG_USB_NET_RNDIS_HOST)
37 37
38static int is_rndis(struct usb_interface_descriptor *desc) 38static int is_rndis(struct usb_interface_descriptor *desc)
39{ 39{
@@ -69,8 +69,7 @@ static const u8 mbm_guid[16] = {
69 0xa6, 0x07, 0xc0, 0xff, 0xcb, 0x7e, 0x39, 0x2a, 69 0xa6, 0x07, 0xc0, 0xff, 0xcb, 0x7e, 0x39, 0x2a,
70}; 70};
71 71
72/* 72/* probes control interface, claims data interface, collects the bulk
73 * probes control interface, claims data interface, collects the bulk
74 * endpoints, activates data interface (if needed), maybe sets MTU. 73 * endpoints, activates data interface (if needed), maybe sets MTU.
75 * all pure cdc, except for certain firmware workarounds, and knowing 74 * all pure cdc, except for certain firmware workarounds, and knowing
76 * that rndis uses one different rule. 75 * that rndis uses one different rule.
@@ -88,7 +87,7 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
88 struct usb_cdc_mdlm_desc *desc = NULL; 87 struct usb_cdc_mdlm_desc *desc = NULL;
89 struct usb_cdc_mdlm_detail_desc *detail = NULL; 88 struct usb_cdc_mdlm_detail_desc *detail = NULL;
90 89
91 if (sizeof dev->data < sizeof *info) 90 if (sizeof(dev->data) < sizeof(*info))
92 return -EDOM; 91 return -EDOM;
93 92
94 /* expect strict spec conformance for the descriptors, but 93 /* expect strict spec conformance for the descriptors, but
@@ -126,10 +125,10 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
126 is_activesync(&intf->cur_altsetting->desc) || 125 is_activesync(&intf->cur_altsetting->desc) ||
127 is_wireless_rndis(&intf->cur_altsetting->desc)); 126 is_wireless_rndis(&intf->cur_altsetting->desc));
128 127
129 memset(info, 0, sizeof *info); 128 memset(info, 0, sizeof(*info));
130 info->control = intf; 129 info->control = intf;
131 while (len > 3) { 130 while (len > 3) {
132 if (buf [1] != USB_DT_CS_INTERFACE) 131 if (buf[1] != USB_DT_CS_INTERFACE)
133 goto next_desc; 132 goto next_desc;
134 133
135 /* use bDescriptorSubType to identify the CDC descriptors. 134 /* use bDescriptorSubType to identify the CDC descriptors.
@@ -139,14 +138,14 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
139 * in favor of a complicated OID-based RPC scheme doing what 138 * in favor of a complicated OID-based RPC scheme doing what
140 * CDC Ethernet achieves with a simple descriptor. 139 * CDC Ethernet achieves with a simple descriptor.
141 */ 140 */
142 switch (buf [2]) { 141 switch (buf[2]) {
143 case USB_CDC_HEADER_TYPE: 142 case USB_CDC_HEADER_TYPE:
144 if (info->header) { 143 if (info->header) {
145 dev_dbg(&intf->dev, "extra CDC header\n"); 144 dev_dbg(&intf->dev, "extra CDC header\n");
146 goto bad_desc; 145 goto bad_desc;
147 } 146 }
148 info->header = (void *) buf; 147 info->header = (void *) buf;
149 if (info->header->bLength != sizeof *info->header) { 148 if (info->header->bLength != sizeof(*info->header)) {
150 dev_dbg(&intf->dev, "CDC header len %u\n", 149 dev_dbg(&intf->dev, "CDC header len %u\n",
151 info->header->bLength); 150 info->header->bLength);
152 goto bad_desc; 151 goto bad_desc;
@@ -175,7 +174,7 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
175 goto bad_desc; 174 goto bad_desc;
176 } 175 }
177 info->u = (void *) buf; 176 info->u = (void *) buf;
178 if (info->u->bLength != sizeof *info->u) { 177 if (info->u->bLength != sizeof(*info->u)) {
179 dev_dbg(&intf->dev, "CDC union len %u\n", 178 dev_dbg(&intf->dev, "CDC union len %u\n",
180 info->u->bLength); 179 info->u->bLength);
181 goto bad_desc; 180 goto bad_desc;
@@ -233,7 +232,7 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
233 goto bad_desc; 232 goto bad_desc;
234 } 233 }
235 info->ether = (void *) buf; 234 info->ether = (void *) buf;
236 if (info->ether->bLength != sizeof *info->ether) { 235 if (info->ether->bLength != sizeof(*info->ether)) {
237 dev_dbg(&intf->dev, "CDC ether len %u\n", 236 dev_dbg(&intf->dev, "CDC ether len %u\n",
238 info->ether->bLength); 237 info->ether->bLength);
239 goto bad_desc; 238 goto bad_desc;
@@ -274,8 +273,8 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
274 break; 273 break;
275 } 274 }
276next_desc: 275next_desc:
277 len -= buf [0]; /* bLength */ 276 len -= buf[0]; /* bLength */
278 buf += buf [0]; 277 buf += buf[0];
279 } 278 }
280 279
281 /* Microsoft ActiveSync based and some regular RNDIS devices lack the 280 /* Microsoft ActiveSync based and some regular RNDIS devices lack the
@@ -379,9 +378,7 @@ void usbnet_cdc_unbind(struct usbnet *dev, struct usb_interface *intf)
379} 378}
380EXPORT_SYMBOL_GPL(usbnet_cdc_unbind); 379EXPORT_SYMBOL_GPL(usbnet_cdc_unbind);
381 380
382/*------------------------------------------------------------------------- 381/* Communications Device Class, Ethernet Control model
383 *
384 * Communications Device Class, Ethernet Control model
385 * 382 *
386 * Takes two interfaces. The DATA interface is inactive till an altsetting 383 * Takes two interfaces. The DATA interface is inactive till an altsetting
387 * is selected. Configuration data includes class descriptors. There's 384 * is selected. Configuration data includes class descriptors. There's
@@ -389,8 +386,7 @@ EXPORT_SYMBOL_GPL(usbnet_cdc_unbind);
389 * 386 *
390 * This should interop with whatever the 2.4 "CDCEther.c" driver 387 * This should interop with whatever the 2.4 "CDCEther.c" driver
391 * (by Brad Hards) talked with, with more functionality. 388 * (by Brad Hards) talked with, with more functionality.
392 * 389 */
393 *-------------------------------------------------------------------------*/
394 390
395static void dumpspeed(struct usbnet *dev, __le32 *speeds) 391static void dumpspeed(struct usbnet *dev, __le32 *speeds)
396{ 392{
@@ -404,7 +400,7 @@ void usbnet_cdc_status(struct usbnet *dev, struct urb *urb)
404{ 400{
405 struct usb_cdc_notification *event; 401 struct usb_cdc_notification *event;
406 402
407 if (urb->actual_length < sizeof *event) 403 if (urb->actual_length < sizeof(*event))
408 return; 404 return;
409 405
410 /* SPEED_CHANGE can get split into two 8-byte packets */ 406 /* SPEED_CHANGE can get split into two 8-byte packets */
@@ -423,7 +419,7 @@ void usbnet_cdc_status(struct usbnet *dev, struct urb *urb)
423 case USB_CDC_NOTIFY_SPEED_CHANGE: /* tx/rx rates */ 419 case USB_CDC_NOTIFY_SPEED_CHANGE: /* tx/rx rates */
424 netif_dbg(dev, timer, dev->net, "CDC: speed change (len %d)\n", 420 netif_dbg(dev, timer, dev->net, "CDC: speed change (len %d)\n",
425 urb->actual_length); 421 urb->actual_length);
426 if (urb->actual_length != (sizeof *event + 8)) 422 if (urb->actual_length != (sizeof(*event) + 8))
427 set_bit(EVENT_STS_SPLIT, &dev->flags); 423 set_bit(EVENT_STS_SPLIT, &dev->flags);
428 else 424 else
429 dumpspeed(dev, (__le32 *) &event[1]); 425 dumpspeed(dev, (__le32 *) &event[1]);
@@ -469,7 +465,6 @@ EXPORT_SYMBOL_GPL(usbnet_cdc_bind);
469static const struct driver_info cdc_info = { 465static const struct driver_info cdc_info = {
470 .description = "CDC Ethernet Device", 466 .description = "CDC Ethernet Device",
471 .flags = FLAG_ETHER | FLAG_POINTTOPOINT, 467 .flags = FLAG_ETHER | FLAG_POINTTOPOINT,
472 // .check_connect = cdc_check_connect,
473 .bind = usbnet_cdc_bind, 468 .bind = usbnet_cdc_bind,
474 .unbind = usbnet_cdc_unbind, 469 .unbind = usbnet_cdc_unbind,
475 .status = usbnet_cdc_status, 470 .status = usbnet_cdc_status,
@@ -493,9 +488,8 @@ static const struct driver_info wwan_info = {
493#define DELL_VENDOR_ID 0x413C 488#define DELL_VENDOR_ID 0x413C
494#define REALTEK_VENDOR_ID 0x0bda 489#define REALTEK_VENDOR_ID 0x0bda
495 490
496static const struct usb_device_id products [] = { 491static const struct usb_device_id products[] = {
497/* 492/* BLACKLIST !!
498 * BLACKLIST !!
499 * 493 *
500 * First blacklist any products that are egregiously nonconformant 494 * First blacklist any products that are egregiously nonconformant
501 * with the CDC Ethernet specs. Minor braindamage we cope with; when 495 * with the CDC Ethernet specs. Minor braindamage we cope with; when
@@ -542,7 +536,7 @@ static const struct usb_device_id products [] = {
542 .driver_info = 0, 536 .driver_info = 0,
543}, { 537}, {
544 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO 538 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
545 | USB_DEVICE_ID_MATCH_DEVICE, 539 | USB_DEVICE_ID_MATCH_DEVICE,
546 .idVendor = 0x04DD, 540 .idVendor = 0x04DD,
547 .idProduct = 0x8007, /* C-700 */ 541 .idProduct = 0x8007, /* C-700 */
548 ZAURUS_MASTER_INTERFACE, 542 ZAURUS_MASTER_INTERFACE,
@@ -659,8 +653,7 @@ static const struct usb_device_id products [] = {
659 .driver_info = 0, 653 .driver_info = 0,
660}, 654},
661 655
662/* 656/* WHITELIST!!!
663 * WHITELIST!!!
664 * 657 *
665 * CDC Ether uses two interfaces, not necessarily consecutive. 658 * CDC Ether uses two interfaces, not necessarily consecutive.
666 * We match the main interface, ignoring the optional device 659 * We match the main interface, ignoring the optional device
@@ -672,60 +665,40 @@ static const struct usb_device_id products [] = {
672 */ 665 */
673{ 666{
674 /* ZTE (Vodafone) K3805-Z */ 667 /* ZTE (Vodafone) K3805-Z */
675 .match_flags = USB_DEVICE_ID_MATCH_VENDOR 668 USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1003, USB_CLASS_COMM,
676 | USB_DEVICE_ID_MATCH_PRODUCT 669 USB_CDC_SUBCLASS_ETHERNET,
677 | USB_DEVICE_ID_MATCH_INT_INFO, 670 USB_CDC_PROTO_NONE),
678 .idVendor = ZTE_VENDOR_ID,
679 .idProduct = 0x1003,
680 .bInterfaceClass = USB_CLASS_COMM,
681 .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET,
682 .bInterfaceProtocol = USB_CDC_PROTO_NONE,
683 .driver_info = (unsigned long)&wwan_info, 671 .driver_info = (unsigned long)&wwan_info,
684}, { 672}, {
685 /* ZTE (Vodafone) K3806-Z */ 673 /* ZTE (Vodafone) K3806-Z */
686 .match_flags = USB_DEVICE_ID_MATCH_VENDOR 674 USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1015, USB_CLASS_COMM,
687 | USB_DEVICE_ID_MATCH_PRODUCT 675 USB_CDC_SUBCLASS_ETHERNET,
688 | USB_DEVICE_ID_MATCH_INT_INFO, 676 USB_CDC_PROTO_NONE),
689 .idVendor = ZTE_VENDOR_ID,
690 .idProduct = 0x1015,
691 .bInterfaceClass = USB_CLASS_COMM,
692 .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET,
693 .bInterfaceProtocol = USB_CDC_PROTO_NONE,
694 .driver_info = (unsigned long)&wwan_info, 677 .driver_info = (unsigned long)&wwan_info,
695}, { 678}, {
696 /* ZTE (Vodafone) K4510-Z */ 679 /* ZTE (Vodafone) K4510-Z */
697 .match_flags = USB_DEVICE_ID_MATCH_VENDOR 680 USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1173, USB_CLASS_COMM,
698 | USB_DEVICE_ID_MATCH_PRODUCT 681 USB_CDC_SUBCLASS_ETHERNET,
699 | USB_DEVICE_ID_MATCH_INT_INFO, 682 USB_CDC_PROTO_NONE),
700 .idVendor = ZTE_VENDOR_ID,
701 .idProduct = 0x1173,
702 .bInterfaceClass = USB_CLASS_COMM,
703 .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET,
704 .bInterfaceProtocol = USB_CDC_PROTO_NONE,
705 .driver_info = (unsigned long)&wwan_info, 683 .driver_info = (unsigned long)&wwan_info,
706}, { 684}, {
707 /* ZTE (Vodafone) K3770-Z */ 685 /* ZTE (Vodafone) K3770-Z */
708 .match_flags = USB_DEVICE_ID_MATCH_VENDOR 686 USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1177, USB_CLASS_COMM,
709 | USB_DEVICE_ID_MATCH_PRODUCT 687 USB_CDC_SUBCLASS_ETHERNET,
710 | USB_DEVICE_ID_MATCH_INT_INFO, 688 USB_CDC_PROTO_NONE),
711 .idVendor = ZTE_VENDOR_ID,
712 .idProduct = 0x1177,
713 .bInterfaceClass = USB_CLASS_COMM,
714 .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET,
715 .bInterfaceProtocol = USB_CDC_PROTO_NONE,
716 .driver_info = (unsigned long)&wwan_info, 689 .driver_info = (unsigned long)&wwan_info,
717}, { 690}, {
718 /* ZTE (Vodafone) K3772-Z */ 691 /* ZTE (Vodafone) K3772-Z */
719 .match_flags = USB_DEVICE_ID_MATCH_VENDOR 692 USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1181, USB_CLASS_COMM,
720 | USB_DEVICE_ID_MATCH_PRODUCT 693 USB_CDC_SUBCLASS_ETHERNET,
721 | USB_DEVICE_ID_MATCH_INT_INFO, 694 USB_CDC_PROTO_NONE),
722 .idVendor = ZTE_VENDOR_ID,
723 .idProduct = 0x1181,
724 .bInterfaceClass = USB_CLASS_COMM,
725 .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET,
726 .bInterfaceProtocol = USB_CDC_PROTO_NONE,
727 .driver_info = (unsigned long)&wwan_info, 695 .driver_info = (unsigned long)&wwan_info,
728}, { 696}, {
697 /* Telit modules */
698 USB_VENDOR_AND_INTERFACE_INFO(0x1bc7, USB_CLASS_COMM,
699 USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
700 .driver_info = (kernel_ulong_t) &wwan_info,
701}, {
729 USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ETHERNET, 702 USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ETHERNET,
730 USB_CDC_PROTO_NONE), 703 USB_CDC_PROTO_NONE),
731 .driver_info = (unsigned long) &cdc_info, 704 .driver_info = (unsigned long) &cdc_info,
@@ -736,15 +709,11 @@ static const struct usb_device_id products [] = {
736 709
737}, { 710}, {
738 /* Various Huawei modems with a network port like the UMG1831 */ 711 /* Various Huawei modems with a network port like the UMG1831 */
739 .match_flags = USB_DEVICE_ID_MATCH_VENDOR 712 USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_COMM,
740 | USB_DEVICE_ID_MATCH_INT_INFO, 713 USB_CDC_SUBCLASS_ETHERNET, 255),
741 .idVendor = HUAWEI_VENDOR_ID,
742 .bInterfaceClass = USB_CLASS_COMM,
743 .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET,
744 .bInterfaceProtocol = 255,
745 .driver_info = (unsigned long)&wwan_info, 714 .driver_info = (unsigned long)&wwan_info,
746}, 715},
747 { }, // END 716 { }, /* END */
748}; 717};
749MODULE_DEVICE_TABLE(usb, products); 718MODULE_DEVICE_TABLE(usb, products);
750 719
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index bf64b4191dcc..d1292fe746bc 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -564,7 +564,7 @@ static void vxlan_notify_add_rx_port(struct sock *sk)
564 struct net_device *dev; 564 struct net_device *dev;
565 struct net *net = sock_net(sk); 565 struct net *net = sock_net(sk);
566 sa_family_t sa_family = sk->sk_family; 566 sa_family_t sa_family = sk->sk_family;
567 u16 port = htons(inet_sk(sk)->inet_sport); 567 __be16 port = inet_sk(sk)->inet_sport;
568 568
569 rcu_read_lock(); 569 rcu_read_lock();
570 for_each_netdev_rcu(net, dev) { 570 for_each_netdev_rcu(net, dev) {
@@ -581,7 +581,7 @@ static void vxlan_notify_del_rx_port(struct sock *sk)
581 struct net_device *dev; 581 struct net_device *dev;
582 struct net *net = sock_net(sk); 582 struct net *net = sock_net(sk);
583 sa_family_t sa_family = sk->sk_family; 583 sa_family_t sa_family = sk->sk_family;
584 u16 port = htons(inet_sk(sk)->inet_sport); 584 __be16 port = inet_sk(sk)->inet_sport;
585 585
586 rcu_read_lock(); 586 rcu_read_lock();
587 for_each_netdev_rcu(net, dev) { 587 for_each_netdev_rcu(net, dev) {
@@ -2021,7 +2021,8 @@ static struct device_type vxlan_type = {
2021}; 2021};
2022 2022
2023/* Calls the ndo_add_vxlan_port of the caller in order to 2023/* Calls the ndo_add_vxlan_port of the caller in order to
2024 * supply the listening VXLAN udp ports. 2024 * supply the listening VXLAN udp ports. Callers are expected
2025 * to implement the ndo_add_vxlan_port.
2025 */ 2026 */
2026void vxlan_get_rx_port(struct net_device *dev) 2027void vxlan_get_rx_port(struct net_device *dev)
2027{ 2028{
@@ -2029,16 +2030,13 @@ void vxlan_get_rx_port(struct net_device *dev)
2029 struct net *net = dev_net(dev); 2030 struct net *net = dev_net(dev);
2030 struct vxlan_net *vn = net_generic(net, vxlan_net_id); 2031 struct vxlan_net *vn = net_generic(net, vxlan_net_id);
2031 sa_family_t sa_family; 2032 sa_family_t sa_family;
2032 u16 port; 2033 __be16 port;
2033 int i; 2034 unsigned int i;
2034
2035 if (!dev || !dev->netdev_ops || !dev->netdev_ops->ndo_add_vxlan_port)
2036 return;
2037 2035
2038 spin_lock(&vn->sock_lock); 2036 spin_lock(&vn->sock_lock);
2039 for (i = 0; i < PORT_HASH_SIZE; ++i) { 2037 for (i = 0; i < PORT_HASH_SIZE; ++i) {
2040 hlist_for_each_entry_rcu(vs, vs_head(net, i), hlist) { 2038 hlist_for_each_entry_rcu(vs, &vn->sock_list[i], hlist) {
2041 port = htons(inet_sk(vs->sock->sk)->inet_sport); 2039 port = inet_sk(vs->sock->sk)->inet_sport;
2042 sa_family = vs->sock->sk->sk_family; 2040 sa_family = vs->sock->sk->sk_family;
2043 dev->netdev_ops->ndo_add_vxlan_port(dev, sa_family, 2041 dev->netdev_ops->ndo_add_vxlan_port(dev, sa_family,
2044 port); 2042 port);
@@ -2492,15 +2490,19 @@ static int vxlan_newlink(struct net *net, struct net_device *dev,
2492 2490
2493 SET_ETHTOOL_OPS(dev, &vxlan_ethtool_ops); 2491 SET_ETHTOOL_OPS(dev, &vxlan_ethtool_ops);
2494 2492
2495 /* create an fdb entry for default destination */ 2493 /* create an fdb entry for a valid default destination */
2496 err = vxlan_fdb_create(vxlan, all_zeros_mac, 2494 if (!vxlan_addr_any(&vxlan->default_dst.remote_ip)) {
2497 &vxlan->default_dst.remote_ip, 2495 err = vxlan_fdb_create(vxlan, all_zeros_mac,
2498 NUD_REACHABLE|NUD_PERMANENT, 2496 &vxlan->default_dst.remote_ip,
2499 NLM_F_EXCL|NLM_F_CREATE, 2497 NUD_REACHABLE|NUD_PERMANENT,
2500 vxlan->dst_port, vxlan->default_dst.remote_vni, 2498 NLM_F_EXCL|NLM_F_CREATE,
2501 vxlan->default_dst.remote_ifindex, NTF_SELF); 2499 vxlan->dst_port,
2502 if (err) 2500 vxlan->default_dst.remote_vni,
2503 return err; 2501 vxlan->default_dst.remote_ifindex,
2502 NTF_SELF);
2503 if (err)
2504 return err;
2505 }
2504 2506
2505 err = register_netdevice(dev); 2507 err = register_netdevice(dev);
2506 if (err) { 2508 if (err) {
diff --git a/drivers/net/wireless/brcm80211/Kconfig b/drivers/net/wireless/brcm80211/Kconfig
index fc8a0fa6d3b2..b00a7e92225f 100644
--- a/drivers/net/wireless/brcm80211/Kconfig
+++ b/drivers/net/wireless/brcm80211/Kconfig
@@ -28,7 +28,7 @@ config BRCMFMAC
28 28
29config BRCMFMAC_SDIO 29config BRCMFMAC_SDIO
30 bool "SDIO bus interface support for FullMAC driver" 30 bool "SDIO bus interface support for FullMAC driver"
31 depends on MMC 31 depends on (MMC = y || MMC = BRCMFMAC)
32 depends on BRCMFMAC 32 depends on BRCMFMAC
33 select FW_LOADER 33 select FW_LOADER
34 default y 34 default y
@@ -39,7 +39,7 @@ config BRCMFMAC_SDIO
39 39
40config BRCMFMAC_USB 40config BRCMFMAC_USB
41 bool "USB bus interface support for FullMAC driver" 41 bool "USB bus interface support for FullMAC driver"
42 depends on USB 42 depends on (USB = y || USB = BRCMFMAC)
43 depends on BRCMFMAC 43 depends on BRCMFMAC
44 select FW_LOADER 44 select FW_LOADER
45 ---help--- 45 ---help---
diff --git a/drivers/net/wireless/cw1200/cw1200_spi.c b/drivers/net/wireless/cw1200/cw1200_spi.c
index d06376014bcd..f5e6b489ed32 100644
--- a/drivers/net/wireless/cw1200/cw1200_spi.c
+++ b/drivers/net/wireless/cw1200/cw1200_spi.c
@@ -40,7 +40,9 @@ struct hwbus_priv {
40 struct cw1200_common *core; 40 struct cw1200_common *core;
41 const struct cw1200_platform_data_spi *pdata; 41 const struct cw1200_platform_data_spi *pdata;
42 spinlock_t lock; /* Serialize all bus operations */ 42 spinlock_t lock; /* Serialize all bus operations */
43 wait_queue_head_t wq;
43 int claimed; 44 int claimed;
45 int irq_disabled;
44}; 46};
45 47
46#define SDIO_TO_SPI_ADDR(addr) ((addr & 0x1f)>>2) 48#define SDIO_TO_SPI_ADDR(addr) ((addr & 0x1f)>>2)
@@ -197,8 +199,11 @@ static void cw1200_spi_lock(struct hwbus_priv *self)
197{ 199{
198 unsigned long flags; 200 unsigned long flags;
199 201
202 DECLARE_WAITQUEUE(wait, current);
203
200 might_sleep(); 204 might_sleep();
201 205
206 add_wait_queue(&self->wq, &wait);
202 spin_lock_irqsave(&self->lock, flags); 207 spin_lock_irqsave(&self->lock, flags);
203 while (1) { 208 while (1) {
204 set_current_state(TASK_UNINTERRUPTIBLE); 209 set_current_state(TASK_UNINTERRUPTIBLE);
@@ -211,6 +216,7 @@ static void cw1200_spi_lock(struct hwbus_priv *self)
211 set_current_state(TASK_RUNNING); 216 set_current_state(TASK_RUNNING);
212 self->claimed = 1; 217 self->claimed = 1;
213 spin_unlock_irqrestore(&self->lock, flags); 218 spin_unlock_irqrestore(&self->lock, flags);
219 remove_wait_queue(&self->wq, &wait);
214 220
215 return; 221 return;
216} 222}
@@ -222,6 +228,8 @@ static void cw1200_spi_unlock(struct hwbus_priv *self)
222 spin_lock_irqsave(&self->lock, flags); 228 spin_lock_irqsave(&self->lock, flags);
223 self->claimed = 0; 229 self->claimed = 0;
224 spin_unlock_irqrestore(&self->lock, flags); 230 spin_unlock_irqrestore(&self->lock, flags);
231 wake_up(&self->wq);
232
225 return; 233 return;
226} 234}
227 235
@@ -230,6 +238,8 @@ static irqreturn_t cw1200_spi_irq_handler(int irq, void *dev_id)
230 struct hwbus_priv *self = dev_id; 238 struct hwbus_priv *self = dev_id;
231 239
232 if (self->core) { 240 if (self->core) {
241 disable_irq_nosync(self->func->irq);
242 self->irq_disabled = 1;
233 cw1200_irq_handler(self->core); 243 cw1200_irq_handler(self->core);
234 return IRQ_HANDLED; 244 return IRQ_HANDLED;
235 } else { 245 } else {
@@ -263,13 +273,22 @@ exit:
263 273
264static int cw1200_spi_irq_unsubscribe(struct hwbus_priv *self) 274static int cw1200_spi_irq_unsubscribe(struct hwbus_priv *self)
265{ 275{
266 int ret = 0;
267
268 pr_debug("SW IRQ unsubscribe\n"); 276 pr_debug("SW IRQ unsubscribe\n");
269 disable_irq_wake(self->func->irq); 277 disable_irq_wake(self->func->irq);
270 free_irq(self->func->irq, self); 278 free_irq(self->func->irq, self);
271 279
272 return ret; 280 return 0;
281}
282
283static int cw1200_spi_irq_enable(struct hwbus_priv *self, int enable)
284{
285 /* Disables are handled by the interrupt handler */
286 if (enable && self->irq_disabled) {
287 enable_irq(self->func->irq);
288 self->irq_disabled = 0;
289 }
290
291 return 0;
273} 292}
274 293
275static int cw1200_spi_off(const struct cw1200_platform_data_spi *pdata) 294static int cw1200_spi_off(const struct cw1200_platform_data_spi *pdata)
@@ -349,6 +368,7 @@ static struct hwbus_ops cw1200_spi_hwbus_ops = {
349 .unlock = cw1200_spi_unlock, 368 .unlock = cw1200_spi_unlock,
350 .align_size = cw1200_spi_align_size, 369 .align_size = cw1200_spi_align_size,
351 .power_mgmt = cw1200_spi_pm, 370 .power_mgmt = cw1200_spi_pm,
371 .irq_enable = cw1200_spi_irq_enable,
352}; 372};
353 373
354/* Probe Function to be called by SPI stack when device is discovered */ 374/* Probe Function to be called by SPI stack when device is discovered */
@@ -400,6 +420,8 @@ static int cw1200_spi_probe(struct spi_device *func)
400 420
401 spi_set_drvdata(func, self); 421 spi_set_drvdata(func, self);
402 422
423 init_waitqueue_head(&self->wq);
424
403 status = cw1200_spi_irq_subscribe(self); 425 status = cw1200_spi_irq_subscribe(self);
404 426
405 status = cw1200_core_probe(&cw1200_spi_hwbus_ops, 427 status = cw1200_core_probe(&cw1200_spi_hwbus_ops,
diff --git a/drivers/net/wireless/cw1200/fwio.c b/drivers/net/wireless/cw1200/fwio.c
index acdff0f7f952..0b2061bbc68b 100644
--- a/drivers/net/wireless/cw1200/fwio.c
+++ b/drivers/net/wireless/cw1200/fwio.c
@@ -485,7 +485,7 @@ int cw1200_load_firmware(struct cw1200_common *priv)
485 485
486 /* Enable interrupt signalling */ 486 /* Enable interrupt signalling */
487 priv->hwbus_ops->lock(priv->hwbus_priv); 487 priv->hwbus_ops->lock(priv->hwbus_priv);
488 ret = __cw1200_irq_enable(priv, 1); 488 ret = __cw1200_irq_enable(priv, 2);
489 priv->hwbus_ops->unlock(priv->hwbus_priv); 489 priv->hwbus_ops->unlock(priv->hwbus_priv);
490 if (ret < 0) 490 if (ret < 0)
491 goto unsubscribe; 491 goto unsubscribe;
diff --git a/drivers/net/wireless/cw1200/hwbus.h b/drivers/net/wireless/cw1200/hwbus.h
index 8b2fc831c3de..51dfb3a90735 100644
--- a/drivers/net/wireless/cw1200/hwbus.h
+++ b/drivers/net/wireless/cw1200/hwbus.h
@@ -28,6 +28,7 @@ struct hwbus_ops {
28 void (*unlock)(struct hwbus_priv *self); 28 void (*unlock)(struct hwbus_priv *self);
29 size_t (*align_size)(struct hwbus_priv *self, size_t size); 29 size_t (*align_size)(struct hwbus_priv *self, size_t size);
30 int (*power_mgmt)(struct hwbus_priv *self, bool suspend); 30 int (*power_mgmt)(struct hwbus_priv *self, bool suspend);
31 int (*irq_enable)(struct hwbus_priv *self, int enable);
31}; 32};
32 33
33#endif /* CW1200_HWBUS_H */ 34#endif /* CW1200_HWBUS_H */
diff --git a/drivers/net/wireless/cw1200/hwio.c b/drivers/net/wireless/cw1200/hwio.c
index ff230b7aeedd..41bd7615ccaa 100644
--- a/drivers/net/wireless/cw1200/hwio.c
+++ b/drivers/net/wireless/cw1200/hwio.c
@@ -273,6 +273,21 @@ int __cw1200_irq_enable(struct cw1200_common *priv, int enable)
273 u16 val16; 273 u16 val16;
274 int ret; 274 int ret;
275 275
276 /* We need to do this hack because the SPI layer can sleep on I/O
277 and the general path involves I/O to the device in interrupt
278 context.
279
280 However, the initial enable call needs to go to the hardware.
281
282 We don't worry about shutdown because we do a full reset which
283 clears the interrupt enabled bits.
284 */
285 if (priv->hwbus_ops->irq_enable) {
286 ret = priv->hwbus_ops->irq_enable(priv->hwbus_priv, enable);
287 if (ret || enable < 2)
288 return ret;
289 }
290
276 if (HIF_8601_SILICON == priv->hw_type) { 291 if (HIF_8601_SILICON == priv->hw_type) {
277 ret = __cw1200_reg_read_32(priv, ST90TDS_CONFIG_REG_ID, &val32); 292 ret = __cw1200_reg_read_32(priv, ST90TDS_CONFIG_REG_ID, &val32);
278 if (ret < 0) { 293 if (ret < 0) {
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 95e6e61c3de0..88ce656f96cd 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -6659,19 +6659,20 @@ int rt2800_enable_radio(struct rt2x00_dev *rt2x00dev)
6659 rt2800_init_registers(rt2x00dev))) 6659 rt2800_init_registers(rt2x00dev)))
6660 return -EIO; 6660 return -EIO;
6661 6661
6662 if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev)))
6663 return -EIO;
6664
6662 /* 6665 /*
6663 * Send signal to firmware during boot time. 6666 * Send signal to firmware during boot time.
6664 */ 6667 */
6665 rt2800_register_write(rt2x00dev, H2M_BBP_AGENT, 0); 6668 rt2800_register_write(rt2x00dev, H2M_BBP_AGENT, 0);
6666 rt2800_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0); 6669 rt2800_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0);
6667 if (rt2x00_is_usb(rt2x00dev)) { 6670 if (rt2x00_is_usb(rt2x00dev))
6668 rt2800_register_write(rt2x00dev, H2M_INT_SRC, 0); 6671 rt2800_register_write(rt2x00dev, H2M_INT_SRC, 0);
6669 rt2800_mcu_request(rt2x00dev, MCU_BOOT_SIGNAL, 0, 0, 0); 6672 rt2800_mcu_request(rt2x00dev, MCU_BOOT_SIGNAL, 0, 0, 0);
6670 }
6671 msleep(1); 6673 msleep(1);
6672 6674
6673 if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev) || 6675 if (unlikely(rt2800_wait_bbp_ready(rt2x00dev)))
6674 rt2800_wait_bbp_ready(rt2x00dev)))
6675 return -EIO; 6676 return -EIO;
6676 6677
6677 rt2800_init_bbp(rt2x00dev); 6678 rt2800_init_bbp(rt2x00dev);
diff --git a/drivers/net/wireless/rtl818x/rtl8187/dev.c b/drivers/net/wireless/rtl818x/rtl8187/dev.c
index 841fb9dfc9da..9a6edb0c014e 100644
--- a/drivers/net/wireless/rtl818x/rtl8187/dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8187/dev.c
@@ -438,17 +438,16 @@ static int rtl8187_init_urbs(struct ieee80211_hw *dev)
438 skb_queue_tail(&priv->rx_queue, skb); 438 skb_queue_tail(&priv->rx_queue, skb);
439 usb_anchor_urb(entry, &priv->anchored); 439 usb_anchor_urb(entry, &priv->anchored);
440 ret = usb_submit_urb(entry, GFP_KERNEL); 440 ret = usb_submit_urb(entry, GFP_KERNEL);
441 usb_put_urb(entry);
441 if (ret) { 442 if (ret) {
442 skb_unlink(skb, &priv->rx_queue); 443 skb_unlink(skb, &priv->rx_queue);
443 usb_unanchor_urb(entry); 444 usb_unanchor_urb(entry);
444 goto err; 445 goto err;
445 } 446 }
446 usb_free_urb(entry);
447 } 447 }
448 return ret; 448 return ret;
449 449
450err: 450err:
451 usb_free_urb(entry);
452 kfree_skb(skb); 451 kfree_skb(skb);
453 usb_kill_anchored_urbs(&priv->anchored); 452 usb_kill_anchored_urbs(&priv->anchored);
454 return ret; 453 return ret;
@@ -956,8 +955,12 @@ static int rtl8187_start(struct ieee80211_hw *dev)
956 (RETRY_COUNT << 8 /* short retry limit */) | 955 (RETRY_COUNT << 8 /* short retry limit */) |
957 (RETRY_COUNT << 0 /* long retry limit */) | 956 (RETRY_COUNT << 0 /* long retry limit */) |
958 (7 << 21 /* MAX TX DMA */)); 957 (7 << 21 /* MAX TX DMA */));
959 rtl8187_init_urbs(dev); 958 ret = rtl8187_init_urbs(dev);
960 rtl8187b_init_status_urb(dev); 959 if (ret)
960 goto rtl8187_start_exit;
961 ret = rtl8187b_init_status_urb(dev);
962 if (ret)
963 usb_kill_anchored_urbs(&priv->anchored);
961 goto rtl8187_start_exit; 964 goto rtl8187_start_exit;
962 } 965 }
963 966
@@ -966,7 +969,9 @@ static int rtl8187_start(struct ieee80211_hw *dev)
966 rtl818x_iowrite32(priv, &priv->map->MAR[0], ~0); 969 rtl818x_iowrite32(priv, &priv->map->MAR[0], ~0);
967 rtl818x_iowrite32(priv, &priv->map->MAR[1], ~0); 970 rtl818x_iowrite32(priv, &priv->map->MAR[1], ~0);
968 971
969 rtl8187_init_urbs(dev); 972 ret = rtl8187_init_urbs(dev);
973 if (ret)
974 goto rtl8187_start_exit;
970 975
971 reg = RTL818X_RX_CONF_ONLYERLPKT | 976 reg = RTL818X_RX_CONF_ONLYERLPKT |
972 RTL818X_RX_CONF_RX_AUTORESETPHY | 977 RTL818X_RX_CONF_RX_AUTORESETPHY |
diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h
index a1977430ddfb..5715318d6bab 100644
--- a/drivers/net/xen-netback/common.h
+++ b/drivers/net/xen-netback/common.h
@@ -184,6 +184,7 @@ int xenvif_connect(struct xenvif *vif, unsigned long tx_ring_ref,
184 unsigned long rx_ring_ref, unsigned int tx_evtchn, 184 unsigned long rx_ring_ref, unsigned int tx_evtchn,
185 unsigned int rx_evtchn); 185 unsigned int rx_evtchn);
186void xenvif_disconnect(struct xenvif *vif); 186void xenvif_disconnect(struct xenvif *vif);
187void xenvif_free(struct xenvif *vif);
187 188
188int xenvif_xenbus_init(void); 189int xenvif_xenbus_init(void);
189void xenvif_xenbus_fini(void); 190void xenvif_xenbus_fini(void);
diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
index 625c6f49cfba..01bb854c7f62 100644
--- a/drivers/net/xen-netback/interface.c
+++ b/drivers/net/xen-netback/interface.c
@@ -353,6 +353,9 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid,
353 } 353 }
354 354
355 netdev_dbg(dev, "Successfully created xenvif\n"); 355 netdev_dbg(dev, "Successfully created xenvif\n");
356
357 __module_get(THIS_MODULE);
358
356 return vif; 359 return vif;
357} 360}
358 361
@@ -366,8 +369,6 @@ int xenvif_connect(struct xenvif *vif, unsigned long tx_ring_ref,
366 if (vif->tx_irq) 369 if (vif->tx_irq)
367 return 0; 370 return 0;
368 371
369 __module_get(THIS_MODULE);
370
371 err = xenvif_map_frontend_rings(vif, tx_ring_ref, rx_ring_ref); 372 err = xenvif_map_frontend_rings(vif, tx_ring_ref, rx_ring_ref);
372 if (err < 0) 373 if (err < 0)
373 goto err; 374 goto err;
@@ -406,7 +407,7 @@ int xenvif_connect(struct xenvif *vif, unsigned long tx_ring_ref,
406 407
407 init_waitqueue_head(&vif->wq); 408 init_waitqueue_head(&vif->wq);
408 vif->task = kthread_create(xenvif_kthread, 409 vif->task = kthread_create(xenvif_kthread,
409 (void *)vif, vif->dev->name); 410 (void *)vif, "%s", vif->dev->name);
410 if (IS_ERR(vif->task)) { 411 if (IS_ERR(vif->task)) {
411 pr_warn("Could not allocate kthread for %s\n", vif->dev->name); 412 pr_warn("Could not allocate kthread for %s\n", vif->dev->name);
412 err = PTR_ERR(vif->task); 413 err = PTR_ERR(vif->task);
@@ -452,12 +453,6 @@ void xenvif_carrier_off(struct xenvif *vif)
452 453
453void xenvif_disconnect(struct xenvif *vif) 454void xenvif_disconnect(struct xenvif *vif)
454{ 455{
455 /* Disconnect funtion might get called by generic framework
456 * even before vif connects, so we need to check if we really
457 * need to do a module_put.
458 */
459 int need_module_put = 0;
460
461 if (netif_carrier_ok(vif->dev)) 456 if (netif_carrier_ok(vif->dev))
462 xenvif_carrier_off(vif); 457 xenvif_carrier_off(vif);
463 458
@@ -468,23 +463,22 @@ void xenvif_disconnect(struct xenvif *vif)
468 unbind_from_irqhandler(vif->tx_irq, vif); 463 unbind_from_irqhandler(vif->tx_irq, vif);
469 unbind_from_irqhandler(vif->rx_irq, vif); 464 unbind_from_irqhandler(vif->rx_irq, vif);
470 } 465 }
471 /* vif->irq is valid, we had a module_get in 466 vif->tx_irq = 0;
472 * xenvif_connect.
473 */
474 need_module_put = 1;
475 } 467 }
476 468
477 if (vif->task) 469 if (vif->task)
478 kthread_stop(vif->task); 470 kthread_stop(vif->task);
479 471
472 xenvif_unmap_frontend_rings(vif);
473}
474
475void xenvif_free(struct xenvif *vif)
476{
480 netif_napi_del(&vif->napi); 477 netif_napi_del(&vif->napi);
481 478
482 unregister_netdev(vif->dev); 479 unregister_netdev(vif->dev);
483 480
484 xenvif_unmap_frontend_rings(vif);
485
486 free_netdev(vif->dev); 481 free_netdev(vif->dev);
487 482
488 if (need_module_put) 483 module_put(THIS_MODULE);
489 module_put(THIS_MODULE);
490} 484}
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
index 956130c70036..f3e591c611de 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -212,6 +212,49 @@ static bool start_new_rx_buffer(int offset, unsigned long size, int head)
212 return false; 212 return false;
213} 213}
214 214
215struct xenvif_count_slot_state {
216 unsigned long copy_off;
217 bool head;
218};
219
220unsigned int xenvif_count_frag_slots(struct xenvif *vif,
221 unsigned long offset, unsigned long size,
222 struct xenvif_count_slot_state *state)
223{
224 unsigned count = 0;
225
226 offset &= ~PAGE_MASK;
227
228 while (size > 0) {
229 unsigned long bytes;
230
231 bytes = PAGE_SIZE - offset;
232
233 if (bytes > size)
234 bytes = size;
235
236 if (start_new_rx_buffer(state->copy_off, bytes, state->head)) {
237 count++;
238 state->copy_off = 0;
239 }
240
241 if (state->copy_off + bytes > MAX_BUFFER_OFFSET)
242 bytes = MAX_BUFFER_OFFSET - state->copy_off;
243
244 state->copy_off += bytes;
245
246 offset += bytes;
247 size -= bytes;
248
249 if (offset == PAGE_SIZE)
250 offset = 0;
251
252 state->head = false;
253 }
254
255 return count;
256}
257
215/* 258/*
216 * Figure out how many ring slots we're going to need to send @skb to 259 * Figure out how many ring slots we're going to need to send @skb to
217 * the guest. This function is essentially a dry run of 260 * the guest. This function is essentially a dry run of
@@ -219,48 +262,39 @@ static bool start_new_rx_buffer(int offset, unsigned long size, int head)
219 */ 262 */
220unsigned int xenvif_count_skb_slots(struct xenvif *vif, struct sk_buff *skb) 263unsigned int xenvif_count_skb_slots(struct xenvif *vif, struct sk_buff *skb)
221{ 264{
265 struct xenvif_count_slot_state state;
222 unsigned int count; 266 unsigned int count;
223 int i, copy_off; 267 unsigned char *data;
268 unsigned i;
224 269
225 count = DIV_ROUND_UP(skb_headlen(skb), PAGE_SIZE); 270 state.head = true;
271 state.copy_off = 0;
226 272
227 copy_off = skb_headlen(skb) % PAGE_SIZE; 273 /* Slot for the first (partial) page of data. */
274 count = 1;
228 275
276 /* Need a slot for the GSO prefix for GSO extra data? */
229 if (skb_shinfo(skb)->gso_size) 277 if (skb_shinfo(skb)->gso_size)
230 count++; 278 count++;
231 279
232 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { 280 data = skb->data;
233 unsigned long size = skb_frag_size(&skb_shinfo(skb)->frags[i]); 281 while (data < skb_tail_pointer(skb)) {
234 unsigned long offset = skb_shinfo(skb)->frags[i].page_offset; 282 unsigned long offset = offset_in_page(data);
235 unsigned long bytes; 283 unsigned long size = PAGE_SIZE - offset;
236
237 offset &= ~PAGE_MASK;
238
239 while (size > 0) {
240 BUG_ON(offset >= PAGE_SIZE);
241 BUG_ON(copy_off > MAX_BUFFER_OFFSET);
242
243 bytes = PAGE_SIZE - offset;
244
245 if (bytes > size)
246 bytes = size;
247 284
248 if (start_new_rx_buffer(copy_off, bytes, 0)) { 285 if (data + size > skb_tail_pointer(skb))
249 count++; 286 size = skb_tail_pointer(skb) - data;
250 copy_off = 0;
251 }
252 287
253 if (copy_off + bytes > MAX_BUFFER_OFFSET) 288 count += xenvif_count_frag_slots(vif, offset, size, &state);
254 bytes = MAX_BUFFER_OFFSET - copy_off;
255 289
256 copy_off += bytes; 290 data += size;
291 }
257 292
258 offset += bytes; 293 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
259 size -= bytes; 294 unsigned long size = skb_frag_size(&skb_shinfo(skb)->frags[i]);
295 unsigned long offset = skb_shinfo(skb)->frags[i].page_offset;
260 296
261 if (offset == PAGE_SIZE) 297 count += xenvif_count_frag_slots(vif, offset, size, &state);
262 offset = 0;
263 }
264 } 298 }
265 return count; 299 return count;
266} 300}
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
index 1fe48fe364ed..a53782ef1540 100644
--- a/drivers/net/xen-netback/xenbus.c
+++ b/drivers/net/xen-netback/xenbus.c
@@ -42,7 +42,7 @@ static int netback_remove(struct xenbus_device *dev)
42 if (be->vif) { 42 if (be->vif) {
43 kobject_uevent(&dev->dev.kobj, KOBJ_OFFLINE); 43 kobject_uevent(&dev->dev.kobj, KOBJ_OFFLINE);
44 xenbus_rm(XBT_NIL, dev->nodename, "hotplug-status"); 44 xenbus_rm(XBT_NIL, dev->nodename, "hotplug-status");
45 xenvif_disconnect(be->vif); 45 xenvif_free(be->vif);
46 be->vif = NULL; 46 be->vif = NULL;
47 } 47 }
48 kfree(be); 48 kfree(be);
@@ -213,9 +213,18 @@ static void disconnect_backend(struct xenbus_device *dev)
213{ 213{
214 struct backend_info *be = dev_get_drvdata(&dev->dev); 214 struct backend_info *be = dev_get_drvdata(&dev->dev);
215 215
216 if (be->vif)
217 xenvif_disconnect(be->vif);
218}
219
220static void destroy_backend(struct xenbus_device *dev)
221{
222 struct backend_info *be = dev_get_drvdata(&dev->dev);
223
216 if (be->vif) { 224 if (be->vif) {
225 kobject_uevent(&dev->dev.kobj, KOBJ_OFFLINE);
217 xenbus_rm(XBT_NIL, dev->nodename, "hotplug-status"); 226 xenbus_rm(XBT_NIL, dev->nodename, "hotplug-status");
218 xenvif_disconnect(be->vif); 227 xenvif_free(be->vif);
219 be->vif = NULL; 228 be->vif = NULL;
220 } 229 }
221} 230}
@@ -246,14 +255,11 @@ static void frontend_changed(struct xenbus_device *dev,
246 case XenbusStateConnected: 255 case XenbusStateConnected:
247 if (dev->state == XenbusStateConnected) 256 if (dev->state == XenbusStateConnected)
248 break; 257 break;
249 backend_create_xenvif(be);
250 if (be->vif) 258 if (be->vif)
251 connect(be); 259 connect(be);
252 break; 260 break;
253 261
254 case XenbusStateClosing: 262 case XenbusStateClosing:
255 if (be->vif)
256 kobject_uevent(&dev->dev.kobj, KOBJ_OFFLINE);
257 disconnect_backend(dev); 263 disconnect_backend(dev);
258 xenbus_switch_state(dev, XenbusStateClosing); 264 xenbus_switch_state(dev, XenbusStateClosing);
259 break; 265 break;
@@ -262,6 +268,7 @@ static void frontend_changed(struct xenbus_device *dev,
262 xenbus_switch_state(dev, XenbusStateClosed); 268 xenbus_switch_state(dev, XenbusStateClosed);
263 if (xenbus_dev_is_online(dev)) 269 if (xenbus_dev_is_online(dev))
264 break; 270 break;
271 destroy_backend(dev);
265 /* fall through if not online */ 272 /* fall through if not online */
266 case XenbusStateUnknown: 273 case XenbusStateUnknown:
267 device_unregister(&dev->dev); 274 device_unregister(&dev->dev);