aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2014-03-14 22:31:55 -0400
committerDavid S. Miller <davem@davemloft.net>2014-03-14 22:31:55 -0400
commit85dcce7a73f1cc59f7a96fe52713b1630f4ca272 (patch)
tree6c645923eb2f0152073b90685ce80e46cfb7afed /drivers/net
parent4c4e4113db249c828fffb286bc95ffb255e081f5 (diff)
parenta4ecdf82f8ea49f7d3a072121dcbd0bf3a7cb93a (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts: drivers/net/usb/r8152.c drivers/net/xen-netback/netback.c Both the r8152 and netback conflicts were simple overlapping changes. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/bonding/bond_alb.c2
-rw-r--r--drivers/net/bonding/bond_options.c1
-rw-r--r--drivers/net/ethernet/broadcom/bnx2.c37
-rw-r--r--drivers/net/ethernet/broadcom/bnx2.h5
-rw-r--r--drivers/net/ethernet/brocade/bna/bfa_ioc.c2
-rw-r--r--drivers/net/ethernet/cadence/macb.c16
-rw-r--r--drivers/net/ethernet/freescale/fec_main.c14
-rw-r--r--drivers/net/ethernet/ibm/ibmveth.c25
-rw-r--r--drivers/net/ethernet/ibm/ibmveth.h1
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_netdev.c10
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/fw.c11
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/main.c14
-rw-r--r--drivers/net/ethernet/realtek/r8169.c2
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/chain_mode.c2
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/common.h20
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/ring_mode.c9
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c91
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c2
-rw-r--r--drivers/net/hyperv/netvsc_drv.c4
-rw-r--r--drivers/net/hyperv/rndis_filter.c21
-rw-r--r--drivers/net/ieee802154/at86rf230.c11
-rw-r--r--drivers/net/phy/phy.c11
-rw-r--r--drivers/net/usb/Makefile2
-rw-r--r--drivers/net/usb/ax88179_178a.c8
-rw-r--r--drivers/net/usb/cdc_ether.c7
-rw-r--r--drivers/net/usb/r8152.c12
-rw-r--r--drivers/net/usb/r815x.c248
-rw-r--r--drivers/net/vmxnet3/vmxnet3_drv.c19
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/bt-coex.c7
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/drv.c5
-rw-r--r--drivers/net/wireless/mwifiex/11ac.c3
-rw-r--r--drivers/net/wireless/mwifiex/11n.c3
-rw-r--r--drivers/net/wireless/mwifiex/scan.c8
-rw-r--r--drivers/net/xen-netback/interface.c3
-rw-r--r--drivers/net/xen-netback/netback.c39
35 files changed, 266 insertions, 409 deletions
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index 060b6117aeac..9f69e818b000 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -722,7 +722,7 @@ static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bon
722 client_info->ntt = 0; 722 client_info->ntt = 0;
723 } 723 }
724 724
725 if (!vlan_get_tag(skb, &client_info->vlan_id)) 725 if (vlan_get_tag(skb, &client_info->vlan_id))
726 client_info->vlan_id = 0; 726 client_info->vlan_id = 0;
727 727
728 if (!client_info->assigned) { 728 if (!client_info->assigned) {
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
index 22800bde9752..6e6b09359ec3 100644
--- a/drivers/net/bonding/bond_options.c
+++ b/drivers/net/bonding/bond_options.c
@@ -176,6 +176,7 @@ static const struct bond_opt_value bond_resend_igmp_tbl[] = {
176static const struct bond_opt_value bond_lp_interval_tbl[] = { 176static const struct bond_opt_value bond_lp_interval_tbl[] = {
177 { "minval", 1, BOND_VALFLAG_MIN | BOND_VALFLAG_DEFAULT}, 177 { "minval", 1, BOND_VALFLAG_MIN | BOND_VALFLAG_DEFAULT},
178 { "maxval", INT_MAX, BOND_VALFLAG_MAX}, 178 { "maxval", INT_MAX, BOND_VALFLAG_MAX},
179 { NULL, -1, 0},
179}; 180};
180 181
181static const struct bond_option bond_opts[] = { 182static const struct bond_option bond_opts[] = {
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c
index 2e42de239798..a8efb18e42fa 100644
--- a/drivers/net/ethernet/broadcom/bnx2.c
+++ b/drivers/net/ethernet/broadcom/bnx2.c
@@ -2507,6 +2507,7 @@ bnx2_fw_sync(struct bnx2 *bp, u32 msg_data, int ack, int silent)
2507 2507
2508 bp->fw_wr_seq++; 2508 bp->fw_wr_seq++;
2509 msg_data |= bp->fw_wr_seq; 2509 msg_data |= bp->fw_wr_seq;
2510 bp->fw_last_msg = msg_data;
2510 2511
2511 bnx2_shmem_wr(bp, BNX2_DRV_MB, msg_data); 2512 bnx2_shmem_wr(bp, BNX2_DRV_MB, msg_data);
2512 2513
@@ -4003,8 +4004,23 @@ bnx2_setup_wol(struct bnx2 *bp)
4003 wol_msg = BNX2_DRV_MSG_CODE_SUSPEND_NO_WOL; 4004 wol_msg = BNX2_DRV_MSG_CODE_SUSPEND_NO_WOL;
4004 } 4005 }
4005 4006
4006 if (!(bp->flags & BNX2_FLAG_NO_WOL)) 4007 if (!(bp->flags & BNX2_FLAG_NO_WOL)) {
4007 bnx2_fw_sync(bp, BNX2_DRV_MSG_DATA_WAIT3 | wol_msg, 1, 0); 4008 u32 val;
4009
4010 wol_msg |= BNX2_DRV_MSG_DATA_WAIT3;
4011 if (bp->fw_last_msg || BNX2_CHIP(bp) != BNX2_CHIP_5709) {
4012 bnx2_fw_sync(bp, wol_msg, 1, 0);
4013 return;
4014 }
4015 /* Tell firmware not to power down the PHY yet, otherwise
4016 * the chip will take a long time to respond to MMIO reads.
4017 */
4018 val = bnx2_shmem_rd(bp, BNX2_PORT_FEATURE);
4019 bnx2_shmem_wr(bp, BNX2_PORT_FEATURE,
4020 val | BNX2_PORT_FEATURE_ASF_ENABLED);
4021 bnx2_fw_sync(bp, wol_msg, 1, 0);
4022 bnx2_shmem_wr(bp, BNX2_PORT_FEATURE, val);
4023 }
4008 4024
4009} 4025}
4010 4026
@@ -4036,9 +4052,22 @@ bnx2_set_power_state(struct bnx2 *bp, pci_power_t state)
4036 4052
4037 if (bp->wol) 4053 if (bp->wol)
4038 pci_set_power_state(bp->pdev, PCI_D3hot); 4054 pci_set_power_state(bp->pdev, PCI_D3hot);
4039 } else { 4055 break;
4040 pci_set_power_state(bp->pdev, PCI_D3hot); 4056
4057 }
4058 if (!bp->fw_last_msg && BNX2_CHIP(bp) == BNX2_CHIP_5709) {
4059 u32 val;
4060
4061 /* Tell firmware not to power down the PHY yet,
4062 * otherwise the other port may not respond to
4063 * MMIO reads.
4064 */
4065 val = bnx2_shmem_rd(bp, BNX2_BC_STATE_CONDITION);
4066 val &= ~BNX2_CONDITION_PM_STATE_MASK;
4067 val |= BNX2_CONDITION_PM_STATE_UNPREP;
4068 bnx2_shmem_wr(bp, BNX2_BC_STATE_CONDITION, val);
4041 } 4069 }
4070 pci_set_power_state(bp->pdev, PCI_D3hot);
4042 4071
4043 /* No more memory access after this point until 4072 /* No more memory access after this point until
4044 * device is brought back to D0. 4073 * device is brought back to D0.
diff --git a/drivers/net/ethernet/broadcom/bnx2.h b/drivers/net/ethernet/broadcom/bnx2.h
index f1cf2c44e7ed..e341bc366fa5 100644
--- a/drivers/net/ethernet/broadcom/bnx2.h
+++ b/drivers/net/ethernet/broadcom/bnx2.h
@@ -6900,6 +6900,7 @@ struct bnx2 {
6900 6900
6901 u16 fw_wr_seq; 6901 u16 fw_wr_seq;
6902 u16 fw_drv_pulse_wr_seq; 6902 u16 fw_drv_pulse_wr_seq;
6903 u32 fw_last_msg;
6903 6904
6904 int rx_max_ring; 6905 int rx_max_ring;
6905 int rx_ring_size; 6906 int rx_ring_size;
@@ -7406,6 +7407,10 @@ struct bnx2_rv2p_fw_file {
7406#define BNX2_CONDITION_MFW_RUN_NCSI 0x00006000 7407#define BNX2_CONDITION_MFW_RUN_NCSI 0x00006000
7407#define BNX2_CONDITION_MFW_RUN_NONE 0x0000e000 7408#define BNX2_CONDITION_MFW_RUN_NONE 0x0000e000
7408#define BNX2_CONDITION_MFW_RUN_MASK 0x0000e000 7409#define BNX2_CONDITION_MFW_RUN_MASK 0x0000e000
7410#define BNX2_CONDITION_PM_STATE_MASK 0x00030000
7411#define BNX2_CONDITION_PM_STATE_FULL 0x00030000
7412#define BNX2_CONDITION_PM_STATE_PREP 0x00020000
7413#define BNX2_CONDITION_PM_STATE_UNPREP 0x00010000
7409 7414
7410#define BNX2_BC_STATE_DEBUG_CMD 0x1dc 7415#define BNX2_BC_STATE_DEBUG_CMD 0x1dc
7411#define BNX2_BC_STATE_BC_DBG_CMD_SIGNATURE 0x42440000 7416#define BNX2_BC_STATE_BC_DBG_CMD_SIGNATURE 0x42440000
diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.c b/drivers/net/ethernet/brocade/bna/bfa_ioc.c
index 1803c3959044..354ae9792bad 100644
--- a/drivers/net/ethernet/brocade/bna/bfa_ioc.c
+++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.c
@@ -1704,7 +1704,7 @@ bfa_flash_sem_get(void __iomem *bar)
1704 while (!bfa_raw_sem_get(bar)) { 1704 while (!bfa_raw_sem_get(bar)) {
1705 if (--n <= 0) 1705 if (--n <= 0)
1706 return BFA_STATUS_BADFLASH; 1706 return BFA_STATUS_BADFLASH;
1707 udelay(10000); 1707 mdelay(10);
1708 } 1708 }
1709 return BFA_STATUS_OK; 1709 return BFA_STATUS_OK;
1710} 1710}
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index 3190d38e16fb..d0c38e01e99f 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -632,11 +632,16 @@ static void gem_rx_refill(struct macb *bp)
632 "Unable to allocate sk_buff\n"); 632 "Unable to allocate sk_buff\n");
633 break; 633 break;
634 } 634 }
635 bp->rx_skbuff[entry] = skb;
636 635
637 /* now fill corresponding descriptor entry */ 636 /* now fill corresponding descriptor entry */
638 paddr = dma_map_single(&bp->pdev->dev, skb->data, 637 paddr = dma_map_single(&bp->pdev->dev, skb->data,
639 bp->rx_buffer_size, DMA_FROM_DEVICE); 638 bp->rx_buffer_size, DMA_FROM_DEVICE);
639 if (dma_mapping_error(&bp->pdev->dev, paddr)) {
640 dev_kfree_skb(skb);
641 break;
642 }
643
644 bp->rx_skbuff[entry] = skb;
640 645
641 if (entry == RX_RING_SIZE - 1) 646 if (entry == RX_RING_SIZE - 1)
642 paddr |= MACB_BIT(RX_WRAP); 647 paddr |= MACB_BIT(RX_WRAP);
@@ -725,7 +730,7 @@ static int gem_rx(struct macb *bp, int budget)
725 skb_put(skb, len); 730 skb_put(skb, len);
726 addr = MACB_BF(RX_WADDR, MACB_BFEXT(RX_WADDR, addr)); 731 addr = MACB_BF(RX_WADDR, MACB_BFEXT(RX_WADDR, addr));
727 dma_unmap_single(&bp->pdev->dev, addr, 732 dma_unmap_single(&bp->pdev->dev, addr,
728 len, DMA_FROM_DEVICE); 733 bp->rx_buffer_size, DMA_FROM_DEVICE);
729 734
730 skb->protocol = eth_type_trans(skb, bp->dev); 735 skb->protocol = eth_type_trans(skb, bp->dev);
731 skb_checksum_none_assert(skb); 736 skb_checksum_none_assert(skb);
@@ -1036,11 +1041,15 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev)
1036 } 1041 }
1037 1042
1038 entry = macb_tx_ring_wrap(bp->tx_head); 1043 entry = macb_tx_ring_wrap(bp->tx_head);
1039 bp->tx_head++;
1040 netdev_vdbg(bp->dev, "Allocated ring entry %u\n", entry); 1044 netdev_vdbg(bp->dev, "Allocated ring entry %u\n", entry);
1041 mapping = dma_map_single(&bp->pdev->dev, skb->data, 1045 mapping = dma_map_single(&bp->pdev->dev, skb->data,
1042 len, DMA_TO_DEVICE); 1046 len, DMA_TO_DEVICE);
1047 if (dma_mapping_error(&bp->pdev->dev, mapping)) {
1048 kfree_skb(skb);
1049 goto unlock;
1050 }
1043 1051
1052 bp->tx_head++;
1044 tx_skb = &bp->tx_skb[entry]; 1053 tx_skb = &bp->tx_skb[entry];
1045 tx_skb->skb = skb; 1054 tx_skb->skb = skb;
1046 tx_skb->mapping = mapping; 1055 tx_skb->mapping = mapping;
@@ -1066,6 +1075,7 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev)
1066 if (CIRC_SPACE(bp->tx_head, bp->tx_tail, TX_RING_SIZE) < 1) 1075 if (CIRC_SPACE(bp->tx_head, bp->tx_tail, TX_RING_SIZE) < 1)
1067 netif_stop_queue(dev); 1076 netif_stop_queue(dev);
1068 1077
1078unlock:
1069 spin_unlock_irqrestore(&bp->lock, flags); 1079 spin_unlock_irqrestore(&bp->lock, flags);
1070 1080
1071 return NETDEV_TX_OK; 1081 return NETDEV_TX_OK;
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 479a7cba45c0..03a351300013 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -528,13 +528,6 @@ fec_restart(struct net_device *ndev, int duplex)
528 /* Clear any outstanding interrupt. */ 528 /* Clear any outstanding interrupt. */
529 writel(0xffc00000, fep->hwp + FEC_IEVENT); 529 writel(0xffc00000, fep->hwp + FEC_IEVENT);
530 530
531 /* Setup multicast filter. */
532 set_multicast_list(ndev);
533#ifndef CONFIG_M5272
534 writel(0, fep->hwp + FEC_HASH_TABLE_HIGH);
535 writel(0, fep->hwp + FEC_HASH_TABLE_LOW);
536#endif
537
538 /* Set maximum receive buffer size. */ 531 /* Set maximum receive buffer size. */
539 writel(PKT_MAXBLR_SIZE, fep->hwp + FEC_R_BUFF_SIZE); 532 writel(PKT_MAXBLR_SIZE, fep->hwp + FEC_R_BUFF_SIZE);
540 533
@@ -655,6 +648,13 @@ fec_restart(struct net_device *ndev, int duplex)
655 648
656 writel(rcntl, fep->hwp + FEC_R_CNTRL); 649 writel(rcntl, fep->hwp + FEC_R_CNTRL);
657 650
651 /* Setup multicast filter. */
652 set_multicast_list(ndev);
653#ifndef CONFIG_M5272
654 writel(0, fep->hwp + FEC_HASH_TABLE_HIGH);
655 writel(0, fep->hwp + FEC_HASH_TABLE_LOW);
656#endif
657
658 if (id_entry->driver_data & FEC_QUIRK_ENET_MAC) { 658 if (id_entry->driver_data & FEC_QUIRK_ENET_MAC) {
659 /* enable ENET endian swap */ 659 /* enable ENET endian swap */
660 ecntl |= (1 << 8); 660 ecntl |= (1 << 8);
diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
index 4be971590461..1fc8334fc181 100644
--- a/drivers/net/ethernet/ibm/ibmveth.c
+++ b/drivers/net/ethernet/ibm/ibmveth.c
@@ -522,10 +522,21 @@ retry:
522 return rc; 522 return rc;
523} 523}
524 524
525static u64 ibmveth_encode_mac_addr(u8 *mac)
526{
527 int i;
528 u64 encoded = 0;
529
530 for (i = 0; i < ETH_ALEN; i++)
531 encoded = (encoded << 8) | mac[i];
532
533 return encoded;
534}
535
525static int ibmveth_open(struct net_device *netdev) 536static int ibmveth_open(struct net_device *netdev)
526{ 537{
527 struct ibmveth_adapter *adapter = netdev_priv(netdev); 538 struct ibmveth_adapter *adapter = netdev_priv(netdev);
528 u64 mac_address = 0; 539 u64 mac_address;
529 int rxq_entries = 1; 540 int rxq_entries = 1;
530 unsigned long lpar_rc; 541 unsigned long lpar_rc;
531 int rc; 542 int rc;
@@ -579,8 +590,7 @@ static int ibmveth_open(struct net_device *netdev)
579 adapter->rx_queue.num_slots = rxq_entries; 590 adapter->rx_queue.num_slots = rxq_entries;
580 adapter->rx_queue.toggle = 1; 591 adapter->rx_queue.toggle = 1;
581 592
582 memcpy(&mac_address, netdev->dev_addr, netdev->addr_len); 593 mac_address = ibmveth_encode_mac_addr(netdev->dev_addr);
583 mac_address = mac_address >> 16;
584 594
585 rxq_desc.fields.flags_len = IBMVETH_BUF_VALID | 595 rxq_desc.fields.flags_len = IBMVETH_BUF_VALID |
586 adapter->rx_queue.queue_len; 596 adapter->rx_queue.queue_len;
@@ -1183,8 +1193,8 @@ static void ibmveth_set_multicast_list(struct net_device *netdev)
1183 /* add the addresses to the filter table */ 1193 /* add the addresses to the filter table */
1184 netdev_for_each_mc_addr(ha, netdev) { 1194 netdev_for_each_mc_addr(ha, netdev) {
1185 /* add the multicast address to the filter table */ 1195 /* add the multicast address to the filter table */
1186 unsigned long mcast_addr = 0; 1196 u64 mcast_addr;
1187 memcpy(((char *)&mcast_addr)+2, ha->addr, ETH_ALEN); 1197 mcast_addr = ibmveth_encode_mac_addr(ha->addr);
1188 lpar_rc = h_multicast_ctrl(adapter->vdev->unit_address, 1198 lpar_rc = h_multicast_ctrl(adapter->vdev->unit_address,
1189 IbmVethMcastAddFilter, 1199 IbmVethMcastAddFilter,
1190 mcast_addr); 1200 mcast_addr);
@@ -1372,9 +1382,6 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id)
1372 1382
1373 netif_napi_add(netdev, &adapter->napi, ibmveth_poll, 16); 1383 netif_napi_add(netdev, &adapter->napi, ibmveth_poll, 16);
1374 1384
1375 adapter->mac_addr = 0;
1376 memcpy(&adapter->mac_addr, mac_addr_p, ETH_ALEN);
1377
1378 netdev->irq = dev->irq; 1385 netdev->irq = dev->irq;
1379 netdev->netdev_ops = &ibmveth_netdev_ops; 1386 netdev->netdev_ops = &ibmveth_netdev_ops;
1380 netdev->ethtool_ops = &netdev_ethtool_ops; 1387 netdev->ethtool_ops = &netdev_ethtool_ops;
@@ -1383,7 +1390,7 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id)
1383 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; 1390 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
1384 netdev->features |= netdev->hw_features; 1391 netdev->features |= netdev->hw_features;
1385 1392
1386 memcpy(netdev->dev_addr, &adapter->mac_addr, netdev->addr_len); 1393 memcpy(netdev->dev_addr, mac_addr_p, ETH_ALEN);
1387 1394
1388 for (i = 0; i < IBMVETH_NUM_BUFF_POOLS; i++) { 1395 for (i = 0; i < IBMVETH_NUM_BUFF_POOLS; i++) {
1389 struct kobject *kobj = &adapter->rx_buff_pool[i].kobj; 1396 struct kobject *kobj = &adapter->rx_buff_pool[i].kobj;
diff --git a/drivers/net/ethernet/ibm/ibmveth.h b/drivers/net/ethernet/ibm/ibmveth.h
index 451ba7949e15..1f37499d4398 100644
--- a/drivers/net/ethernet/ibm/ibmveth.h
+++ b/drivers/net/ethernet/ibm/ibmveth.h
@@ -138,7 +138,6 @@ struct ibmveth_adapter {
138 struct napi_struct napi; 138 struct napi_struct napi;
139 struct net_device_stats stats; 139 struct net_device_stats stats;
140 unsigned int mcastFilterSize; 140 unsigned int mcastFilterSize;
141 unsigned long mac_addr;
142 void * buffer_list_addr; 141 void * buffer_list_addr;
143 void * filter_list_addr; 142 void * filter_list_addr;
144 dma_addr_t buffer_list_dma; 143 dma_addr_t buffer_list_dma;
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index 3db594614fd3..fa5ee719e04b 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -742,6 +742,14 @@ static int mlx4_en_replace_mac(struct mlx4_en_priv *priv, int qpn,
742 err = mlx4_en_uc_steer_add(priv, new_mac, 742 err = mlx4_en_uc_steer_add(priv, new_mac,
743 &qpn, 743 &qpn,
744 &entry->reg_id); 744 &entry->reg_id);
745 if (err)
746 return err;
747 if (priv->tunnel_reg_id) {
748 mlx4_flow_detach(priv->mdev->dev, priv->tunnel_reg_id);
749 priv->tunnel_reg_id = 0;
750 }
751 err = mlx4_en_tunnel_steer_add(priv, new_mac, qpn,
752 &priv->tunnel_reg_id);
745 return err; 753 return err;
746 } 754 }
747 } 755 }
@@ -1780,6 +1788,8 @@ void mlx4_en_stop_port(struct net_device *dev, int detach)
1780 mc_list[5] = priv->port; 1788 mc_list[5] = priv->port;
1781 mlx4_multicast_detach(mdev->dev, &priv->rss_map.indir_qp, 1789 mlx4_multicast_detach(mdev->dev, &priv->rss_map.indir_qp,
1782 mc_list, MLX4_PROT_ETH, mclist->reg_id); 1790 mc_list, MLX4_PROT_ETH, mclist->reg_id);
1791 if (mclist->tunnel_reg_id)
1792 mlx4_flow_detach(mdev->dev, mclist->tunnel_reg_id);
1783 } 1793 }
1784 mlx4_en_clear_list(dev); 1794 mlx4_en_clear_list(dev);
1785 list_for_each_entry_safe(mclist, tmp, &priv->curr_list, list) { 1795 list_for_each_entry_safe(mclist, tmp, &priv->curr_list, list) {
diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c
index 6e1ee2170a39..d0d8dd832557 100644
--- a/drivers/net/ethernet/mellanox/mlx4/fw.c
+++ b/drivers/net/ethernet/mellanox/mlx4/fw.c
@@ -129,13 +129,14 @@ static void dump_dev_cap_flags2(struct mlx4_dev *dev, u64 flags)
129 [0] = "RSS support", 129 [0] = "RSS support",
130 [1] = "RSS Toeplitz Hash Function support", 130 [1] = "RSS Toeplitz Hash Function support",
131 [2] = "RSS XOR Hash Function support", 131 [2] = "RSS XOR Hash Function support",
132 [3] = "Device manage flow steering support", 132 [3] = "Device managed flow steering support",
133 [4] = "Automatic MAC reassignment support", 133 [4] = "Automatic MAC reassignment support",
134 [5] = "Time stamping support", 134 [5] = "Time stamping support",
135 [6] = "VST (control vlan insertion/stripping) support", 135 [6] = "VST (control vlan insertion/stripping) support",
136 [7] = "FSM (MAC anti-spoofing) support", 136 [7] = "FSM (MAC anti-spoofing) support",
137 [8] = "Dynamic QP updates support", 137 [8] = "Dynamic QP updates support",
138 [9] = "TCP/IP offloads/flow-steering for VXLAN support" 138 [9] = "Device managed flow steering IPoIB support",
139 [10] = "TCP/IP offloads/flow-steering for VXLAN support"
139 }; 140 };
140 int i; 141 int i;
141 142
@@ -859,7 +860,7 @@ int mlx4_QUERY_DEV_CAP_wrapper(struct mlx4_dev *dev, int slave,
859 MLX4_PUT(outbox->buf, field, QUERY_DEV_CAP_CQ_TS_SUPPORT_OFFSET); 860 MLX4_PUT(outbox->buf, field, QUERY_DEV_CAP_CQ_TS_SUPPORT_OFFSET);
860 861
861 /* For guests, disable vxlan tunneling */ 862 /* For guests, disable vxlan tunneling */
862 MLX4_GET(field, outbox, QUERY_DEV_CAP_VXLAN); 863 MLX4_GET(field, outbox->buf, QUERY_DEV_CAP_VXLAN);
863 field &= 0xf7; 864 field &= 0xf7;
864 MLX4_PUT(outbox->buf, field, QUERY_DEV_CAP_VXLAN); 865 MLX4_PUT(outbox->buf, field, QUERY_DEV_CAP_VXLAN);
865 866
@@ -869,7 +870,7 @@ int mlx4_QUERY_DEV_CAP_wrapper(struct mlx4_dev *dev, int slave,
869 MLX4_PUT(outbox->buf, field, QUERY_DEV_CAP_BF_OFFSET); 870 MLX4_PUT(outbox->buf, field, QUERY_DEV_CAP_BF_OFFSET);
870 871
871 /* For guests, disable mw type 2 */ 872 /* For guests, disable mw type 2 */
872 MLX4_GET(bmme_flags, outbox, QUERY_DEV_CAP_BMME_FLAGS_OFFSET); 873 MLX4_GET(bmme_flags, outbox->buf, QUERY_DEV_CAP_BMME_FLAGS_OFFSET);
873 bmme_flags &= ~MLX4_BMME_FLAG_TYPE_2_WIN; 874 bmme_flags &= ~MLX4_BMME_FLAG_TYPE_2_WIN;
874 MLX4_PUT(outbox->buf, bmme_flags, QUERY_DEV_CAP_BMME_FLAGS_OFFSET); 875 MLX4_PUT(outbox->buf, bmme_flags, QUERY_DEV_CAP_BMME_FLAGS_OFFSET);
875 876
@@ -883,7 +884,7 @@ int mlx4_QUERY_DEV_CAP_wrapper(struct mlx4_dev *dev, int slave,
883 } 884 }
884 885
885 /* turn off ipoib managed steering for guests */ 886 /* turn off ipoib managed steering for guests */
886 MLX4_GET(field, outbox, QUERY_DEV_CAP_FLOW_STEERING_IPOIB_OFFSET); 887 MLX4_GET(field, outbox->buf, QUERY_DEV_CAP_FLOW_STEERING_IPOIB_OFFSET);
887 field &= ~0x80; 888 field &= ~0x80;
888 MLX4_PUT(outbox->buf, field, QUERY_DEV_CAP_FLOW_STEERING_IPOIB_OFFSET); 889 MLX4_PUT(outbox->buf, field, QUERY_DEV_CAP_FLOW_STEERING_IPOIB_OFFSET);
889 890
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 4c441aa83016..abd0b1d277aa 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -149,6 +149,8 @@ struct mlx4_port_config {
149 struct pci_dev *pdev; 149 struct pci_dev *pdev;
150}; 150};
151 151
152static atomic_t pf_loading = ATOMIC_INIT(0);
153
152int mlx4_check_port_params(struct mlx4_dev *dev, 154int mlx4_check_port_params(struct mlx4_dev *dev,
153 enum mlx4_port_type *port_type) 155 enum mlx4_port_type *port_type)
154{ 156{
@@ -748,7 +750,7 @@ static void mlx4_request_modules(struct mlx4_dev *dev)
748 has_eth_port = true; 750 has_eth_port = true;
749 } 751 }
750 752
751 if (has_ib_port) 753 if (has_ib_port || (dev->caps.flags & MLX4_DEV_CAP_FLAG_IBOE))
752 request_module_nowait(IB_DRV_NAME); 754 request_module_nowait(IB_DRV_NAME);
753 if (has_eth_port) 755 if (has_eth_port)
754 request_module_nowait(EN_DRV_NAME); 756 request_module_nowait(EN_DRV_NAME);
@@ -1406,6 +1408,11 @@ static int mlx4_init_slave(struct mlx4_dev *dev)
1406 u32 slave_read; 1408 u32 slave_read;
1407 u32 cmd_channel_ver; 1409 u32 cmd_channel_ver;
1408 1410
1411 if (atomic_read(&pf_loading)) {
1412 mlx4_warn(dev, "PF is not ready. Deferring probe\n");
1413 return -EPROBE_DEFER;
1414 }
1415
1409 mutex_lock(&priv->cmd.slave_cmd_mutex); 1416 mutex_lock(&priv->cmd.slave_cmd_mutex);
1410 priv->cmd.max_cmds = 1; 1417 priv->cmd.max_cmds = 1;
1411 mlx4_warn(dev, "Sending reset\n"); 1418 mlx4_warn(dev, "Sending reset\n");
@@ -2311,7 +2318,11 @@ static int __mlx4_init_one(struct pci_dev *pdev, int pci_dev_data)
2311 2318
2312 if (num_vfs) { 2319 if (num_vfs) {
2313 mlx4_warn(dev, "Enabling SR-IOV with %d VFs\n", num_vfs); 2320 mlx4_warn(dev, "Enabling SR-IOV with %d VFs\n", num_vfs);
2321
2322 atomic_inc(&pf_loading);
2314 err = pci_enable_sriov(pdev, num_vfs); 2323 err = pci_enable_sriov(pdev, num_vfs);
2324 atomic_dec(&pf_loading);
2325
2315 if (err) { 2326 if (err) {
2316 mlx4_err(dev, "Failed to enable SR-IOV, continuing without SR-IOV (err = %d).\n", 2327 mlx4_err(dev, "Failed to enable SR-IOV, continuing without SR-IOV (err = %d).\n",
2317 err); 2328 err);
@@ -2676,6 +2687,7 @@ static struct pci_driver mlx4_driver = {
2676 .name = DRV_NAME, 2687 .name = DRV_NAME,
2677 .id_table = mlx4_pci_table, 2688 .id_table = mlx4_pci_table,
2678 .probe = mlx4_init_one, 2689 .probe = mlx4_init_one,
2690 .shutdown = mlx4_remove_one,
2679 .remove = mlx4_remove_one, 2691 .remove = mlx4_remove_one,
2680 .err_handler = &mlx4_err_handler, 2692 .err_handler = &mlx4_err_handler,
2681}; 2693};
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index cf947337e0d6..90c14d16f261 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -209,7 +209,7 @@ static const struct {
209 [RTL_GIGA_MAC_VER_16] = 209 [RTL_GIGA_MAC_VER_16] =
210 _R("RTL8101e", RTL_TD_0, NULL, JUMBO_1K, true), 210 _R("RTL8101e", RTL_TD_0, NULL, JUMBO_1K, true),
211 [RTL_GIGA_MAC_VER_17] = 211 [RTL_GIGA_MAC_VER_17] =
212 _R("RTL8168b/8111b", RTL_TD_1, NULL, JUMBO_4K, false), 212 _R("RTL8168b/8111b", RTL_TD_0, NULL, JUMBO_4K, false),
213 [RTL_GIGA_MAC_VER_18] = 213 [RTL_GIGA_MAC_VER_18] =
214 _R("RTL8168cp/8111cp", RTL_TD_1, NULL, JUMBO_6K, false), 214 _R("RTL8168cp/8111cp", RTL_TD_1, NULL, JUMBO_6K, false),
215 [RTL_GIGA_MAC_VER_19] = 215 [RTL_GIGA_MAC_VER_19] =
diff --git a/drivers/net/ethernet/stmicro/stmmac/chain_mode.c b/drivers/net/ethernet/stmicro/stmmac/chain_mode.c
index 72d282bf33a5..c553f6b5a913 100644
--- a/drivers/net/ethernet/stmicro/stmmac/chain_mode.c
+++ b/drivers/net/ethernet/stmicro/stmmac/chain_mode.c
@@ -151,7 +151,7 @@ static void stmmac_clean_desc3(void *priv_ptr, struct dma_desc *p)
151 sizeof(struct dma_desc))); 151 sizeof(struct dma_desc)));
152} 152}
153 153
154const struct stmmac_chain_mode_ops chain_mode_ops = { 154const struct stmmac_mode_ops chain_mode_ops = {
155 .init = stmmac_init_dma_chain, 155 .init = stmmac_init_dma_chain,
156 .is_jumbo_frm = stmmac_is_jumbo_frm, 156 .is_jumbo_frm = stmmac_is_jumbo_frm,
157 .jumbo_frm = stmmac_jumbo_frm, 157 .jumbo_frm = stmmac_jumbo_frm,
diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index 7834a3993946..74610f3aca9e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -419,20 +419,13 @@ struct mii_regs {
419 unsigned int data; /* MII Data */ 419 unsigned int data; /* MII Data */
420}; 420};
421 421
422struct stmmac_ring_mode_ops { 422struct stmmac_mode_ops {
423 unsigned int (*is_jumbo_frm) (int len, int ehn_desc);
424 unsigned int (*jumbo_frm) (void *priv, struct sk_buff *skb, int csum);
425 void (*refill_desc3) (void *priv, struct dma_desc *p);
426 void (*init_desc3) (struct dma_desc *p);
427 void (*clean_desc3) (void *priv, struct dma_desc *p);
428 int (*set_16kib_bfsize) (int mtu);
429};
430
431struct stmmac_chain_mode_ops {
432 void (*init) (void *des, dma_addr_t phy_addr, unsigned int size, 423 void (*init) (void *des, dma_addr_t phy_addr, unsigned int size,
433 unsigned int extend_desc); 424 unsigned int extend_desc);
434 unsigned int (*is_jumbo_frm) (int len, int ehn_desc); 425 unsigned int (*is_jumbo_frm) (int len, int ehn_desc);
435 unsigned int (*jumbo_frm) (void *priv, struct sk_buff *skb, int csum); 426 unsigned int (*jumbo_frm) (void *priv, struct sk_buff *skb, int csum);
427 int (*set_16kib_bfsize)(int mtu);
428 void (*init_desc3)(struct dma_desc *p);
436 void (*refill_desc3) (void *priv, struct dma_desc *p); 429 void (*refill_desc3) (void *priv, struct dma_desc *p);
437 void (*clean_desc3) (void *priv, struct dma_desc *p); 430 void (*clean_desc3) (void *priv, struct dma_desc *p);
438}; 431};
@@ -441,8 +434,7 @@ struct mac_device_info {
441 const struct stmmac_ops *mac; 434 const struct stmmac_ops *mac;
442 const struct stmmac_desc_ops *desc; 435 const struct stmmac_desc_ops *desc;
443 const struct stmmac_dma_ops *dma; 436 const struct stmmac_dma_ops *dma;
444 const struct stmmac_ring_mode_ops *ring; 437 const struct stmmac_mode_ops *mode;
445 const struct stmmac_chain_mode_ops *chain;
446 const struct stmmac_hwtimestamp *ptp; 438 const struct stmmac_hwtimestamp *ptp;
447 struct mii_regs mii; /* MII register Addresses */ 439 struct mii_regs mii; /* MII register Addresses */
448 struct mac_link link; 440 struct mac_link link;
@@ -460,7 +452,7 @@ void stmmac_get_mac_addr(void __iomem *ioaddr, unsigned char *addr,
460void stmmac_set_mac(void __iomem *ioaddr, bool enable); 452void stmmac_set_mac(void __iomem *ioaddr, bool enable);
461 453
462void dwmac_dma_flush_tx_fifo(void __iomem *ioaddr); 454void dwmac_dma_flush_tx_fifo(void __iomem *ioaddr);
463extern const struct stmmac_ring_mode_ops ring_mode_ops; 455extern const struct stmmac_mode_ops ring_mode_ops;
464extern const struct stmmac_chain_mode_ops chain_mode_ops; 456extern const struct stmmac_mode_ops chain_mode_ops;
465 457
466#endif /* __COMMON_H__ */ 458#endif /* __COMMON_H__ */
diff --git a/drivers/net/ethernet/stmicro/stmmac/ring_mode.c b/drivers/net/ethernet/stmicro/stmmac/ring_mode.c
index a96c7c2f5f3f..650a4be6bce5 100644
--- a/drivers/net/ethernet/stmicro/stmmac/ring_mode.c
+++ b/drivers/net/ethernet/stmicro/stmmac/ring_mode.c
@@ -100,10 +100,9 @@ static void stmmac_refill_desc3(void *priv_ptr, struct dma_desc *p)
100{ 100{
101 struct stmmac_priv *priv = (struct stmmac_priv *)priv_ptr; 101 struct stmmac_priv *priv = (struct stmmac_priv *)priv_ptr;
102 102
103 if (unlikely(priv->plat->has_gmac)) 103 /* Fill DES3 in case of RING mode */
104 /* Fill DES3 in case of RING mode */ 104 if (priv->dma_buf_sz >= BUF_SIZE_8KiB)
105 if (priv->dma_buf_sz >= BUF_SIZE_8KiB) 105 p->des3 = p->des2 + BUF_SIZE_8KiB;
106 p->des3 = p->des2 + BUF_SIZE_8KiB;
107} 106}
108 107
109/* In ring mode we need to fill the desc3 because it is used as buffer */ 108/* In ring mode we need to fill the desc3 because it is used as buffer */
@@ -126,7 +125,7 @@ static int stmmac_set_16kib_bfsize(int mtu)
126 return ret; 125 return ret;
127} 126}
128 127
129const struct stmmac_ring_mode_ops ring_mode_ops = { 128const struct stmmac_mode_ops ring_mode_ops = {
130 .is_jumbo_frm = stmmac_is_jumbo_frm, 129 .is_jumbo_frm = stmmac_is_jumbo_frm,
131 .jumbo_frm = stmmac_jumbo_frm, 130 .jumbo_frm = stmmac_jumbo_frm,
132 .refill_desc3 = stmmac_refill_desc3, 131 .refill_desc3 = stmmac_refill_desc3,
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 078ad0ec8593..8543e1cfd55e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -92,8 +92,8 @@ static int tc = TC_DEFAULT;
92module_param(tc, int, S_IRUGO | S_IWUSR); 92module_param(tc, int, S_IRUGO | S_IWUSR);
93MODULE_PARM_DESC(tc, "DMA threshold control value"); 93MODULE_PARM_DESC(tc, "DMA threshold control value");
94 94
95#define DMA_BUFFER_SIZE BUF_SIZE_4KiB 95#define DEFAULT_BUFSIZE 1536
96static int buf_sz = DMA_BUFFER_SIZE; 96static int buf_sz = DEFAULT_BUFSIZE;
97module_param(buf_sz, int, S_IRUGO | S_IWUSR); 97module_param(buf_sz, int, S_IRUGO | S_IWUSR);
98MODULE_PARM_DESC(buf_sz, "DMA buffer size"); 98MODULE_PARM_DESC(buf_sz, "DMA buffer size");
99 99
@@ -136,8 +136,8 @@ static void stmmac_verify_args(void)
136 dma_rxsize = DMA_RX_SIZE; 136 dma_rxsize = DMA_RX_SIZE;
137 if (unlikely(dma_txsize < 0)) 137 if (unlikely(dma_txsize < 0))
138 dma_txsize = DMA_TX_SIZE; 138 dma_txsize = DMA_TX_SIZE;
139 if (unlikely((buf_sz < DMA_BUFFER_SIZE) || (buf_sz > BUF_SIZE_16KiB))) 139 if (unlikely((buf_sz < DEFAULT_BUFSIZE) || (buf_sz > BUF_SIZE_16KiB)))
140 buf_sz = DMA_BUFFER_SIZE; 140 buf_sz = DEFAULT_BUFSIZE;
141 if (unlikely(flow_ctrl > 1)) 141 if (unlikely(flow_ctrl > 1))
142 flow_ctrl = FLOW_AUTO; 142 flow_ctrl = FLOW_AUTO;
143 else if (likely(flow_ctrl < 0)) 143 else if (likely(flow_ctrl < 0))
@@ -286,10 +286,25 @@ bool stmmac_eee_init(struct stmmac_priv *priv)
286 286
287 /* MAC core supports the EEE feature. */ 287 /* MAC core supports the EEE feature. */
288 if (priv->dma_cap.eee) { 288 if (priv->dma_cap.eee) {
289 int tx_lpi_timer = priv->tx_lpi_timer;
290
289 /* Check if the PHY supports EEE */ 291 /* Check if the PHY supports EEE */
290 if (phy_init_eee(priv->phydev, 1)) 292 if (phy_init_eee(priv->phydev, 1)) {
293 /* To manage at run-time if the EEE cannot be supported
294 * anymore (for example because the lp caps have been
295 * changed).
296 * In that case the driver disable own timers.
297 */
298 if (priv->eee_active) {
299 pr_debug("stmmac: disable EEE\n");
300 del_timer_sync(&priv->eee_ctrl_timer);
301 priv->hw->mac->set_eee_timer(priv->ioaddr, 0,
302 tx_lpi_timer);
303 }
304 priv->eee_active = 0;
291 goto out; 305 goto out;
292 306 }
307 /* Activate the EEE and start timers */
293 if (!priv->eee_active) { 308 if (!priv->eee_active) {
294 priv->eee_active = 1; 309 priv->eee_active = 1;
295 init_timer(&priv->eee_ctrl_timer); 310 init_timer(&priv->eee_ctrl_timer);
@@ -300,13 +315,13 @@ bool stmmac_eee_init(struct stmmac_priv *priv)
300 315
301 priv->hw->mac->set_eee_timer(priv->ioaddr, 316 priv->hw->mac->set_eee_timer(priv->ioaddr,
302 STMMAC_DEFAULT_LIT_LS, 317 STMMAC_DEFAULT_LIT_LS,
303 priv->tx_lpi_timer); 318 tx_lpi_timer);
304 } else 319 } else
305 /* Set HW EEE according to the speed */ 320 /* Set HW EEE according to the speed */
306 priv->hw->mac->set_eee_pls(priv->ioaddr, 321 priv->hw->mac->set_eee_pls(priv->ioaddr,
307 priv->phydev->link); 322 priv->phydev->link);
308 323
309 pr_info("stmmac: Energy-Efficient Ethernet initialized\n"); 324 pr_debug("stmmac: Energy-Efficient Ethernet initialized\n");
310 325
311 ret = true; 326 ret = true;
312 } 327 }
@@ -886,10 +901,10 @@ static int stmmac_set_bfsize(int mtu, int bufsize)
886 ret = BUF_SIZE_8KiB; 901 ret = BUF_SIZE_8KiB;
887 else if (mtu >= BUF_SIZE_2KiB) 902 else if (mtu >= BUF_SIZE_2KiB)
888 ret = BUF_SIZE_4KiB; 903 ret = BUF_SIZE_4KiB;
889 else if (mtu >= DMA_BUFFER_SIZE) 904 else if (mtu > DEFAULT_BUFSIZE)
890 ret = BUF_SIZE_2KiB; 905 ret = BUF_SIZE_2KiB;
891 else 906 else
892 ret = DMA_BUFFER_SIZE; 907 ret = DEFAULT_BUFSIZE;
893 908
894 return ret; 909 return ret;
895} 910}
@@ -951,9 +966,9 @@ static int stmmac_init_rx_buffers(struct stmmac_priv *priv, struct dma_desc *p,
951 966
952 p->des2 = priv->rx_skbuff_dma[i]; 967 p->des2 = priv->rx_skbuff_dma[i];
953 968
954 if ((priv->mode == STMMAC_RING_MODE) && 969 if ((priv->hw->mode->init_desc3) &&
955 (priv->dma_buf_sz == BUF_SIZE_16KiB)) 970 (priv->dma_buf_sz == BUF_SIZE_16KiB))
956 priv->hw->ring->init_desc3(p); 971 priv->hw->mode->init_desc3(p);
957 972
958 return 0; 973 return 0;
959} 974}
@@ -984,11 +999,8 @@ static int init_dma_desc_rings(struct net_device *dev)
984 unsigned int bfsize = 0; 999 unsigned int bfsize = 0;
985 int ret = -ENOMEM; 1000 int ret = -ENOMEM;
986 1001
987 /* Set the max buffer size according to the DESC mode 1002 if (priv->hw->mode->set_16kib_bfsize)
988 * and the MTU. Note that RING mode allows 16KiB bsize. 1003 bfsize = priv->hw->mode->set_16kib_bfsize(dev->mtu);
989 */
990 if (priv->mode == STMMAC_RING_MODE)
991 bfsize = priv->hw->ring->set_16kib_bfsize(dev->mtu);
992 1004
993 if (bfsize < BUF_SIZE_16KiB) 1005 if (bfsize < BUF_SIZE_16KiB)
994 bfsize = stmmac_set_bfsize(dev->mtu, priv->dma_buf_sz); 1006 bfsize = stmmac_set_bfsize(dev->mtu, priv->dma_buf_sz);
@@ -1029,15 +1041,15 @@ static int init_dma_desc_rings(struct net_device *dev)
1029 /* Setup the chained descriptor addresses */ 1041 /* Setup the chained descriptor addresses */
1030 if (priv->mode == STMMAC_CHAIN_MODE) { 1042 if (priv->mode == STMMAC_CHAIN_MODE) {
1031 if (priv->extend_desc) { 1043 if (priv->extend_desc) {
1032 priv->hw->chain->init(priv->dma_erx, priv->dma_rx_phy, 1044 priv->hw->mode->init(priv->dma_erx, priv->dma_rx_phy,
1033 rxsize, 1); 1045 rxsize, 1);
1034 priv->hw->chain->init(priv->dma_etx, priv->dma_tx_phy, 1046 priv->hw->mode->init(priv->dma_etx, priv->dma_tx_phy,
1035 txsize, 1); 1047 txsize, 1);
1036 } else { 1048 } else {
1037 priv->hw->chain->init(priv->dma_rx, priv->dma_rx_phy, 1049 priv->hw->mode->init(priv->dma_rx, priv->dma_rx_phy,
1038 rxsize, 0); 1050 rxsize, 0);
1039 priv->hw->chain->init(priv->dma_tx, priv->dma_tx_phy, 1051 priv->hw->mode->init(priv->dma_tx, priv->dma_tx_phy,
1040 txsize, 0); 1052 txsize, 0);
1041 } 1053 }
1042 } 1054 }
1043 1055
@@ -1288,7 +1300,7 @@ static void stmmac_tx_clean(struct stmmac_priv *priv)
1288 DMA_TO_DEVICE); 1300 DMA_TO_DEVICE);
1289 priv->tx_skbuff_dma[entry] = 0; 1301 priv->tx_skbuff_dma[entry] = 0;
1290 } 1302 }
1291 priv->hw->ring->clean_desc3(priv, p); 1303 priv->hw->mode->clean_desc3(priv, p);
1292 1304
1293 if (likely(skb != NULL)) { 1305 if (likely(skb != NULL)) {
1294 dev_kfree_skb(skb); 1306 dev_kfree_skb(skb);
@@ -1844,6 +1856,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
1844 int nfrags = skb_shinfo(skb)->nr_frags; 1856 int nfrags = skb_shinfo(skb)->nr_frags;
1845 struct dma_desc *desc, *first; 1857 struct dma_desc *desc, *first;
1846 unsigned int nopaged_len = skb_headlen(skb); 1858 unsigned int nopaged_len = skb_headlen(skb);
1859 unsigned int enh_desc = priv->plat->enh_desc;
1847 1860
1848 if (unlikely(stmmac_tx_avail(priv) < nfrags + 1)) { 1861 if (unlikely(stmmac_tx_avail(priv) < nfrags + 1)) {
1849 if (!netif_queue_stopped(dev)) { 1862 if (!netif_queue_stopped(dev)) {
@@ -1871,27 +1884,19 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
1871 first = desc; 1884 first = desc;
1872 1885
1873 /* To program the descriptors according to the size of the frame */ 1886 /* To program the descriptors according to the size of the frame */
1874 if (priv->mode == STMMAC_RING_MODE) { 1887 if (enh_desc)
1875 is_jumbo = priv->hw->ring->is_jumbo_frm(skb->len, 1888 is_jumbo = priv->hw->mode->is_jumbo_frm(skb->len, enh_desc);
1876 priv->plat->enh_desc); 1889
1877 if (unlikely(is_jumbo))
1878 entry = priv->hw->ring->jumbo_frm(priv, skb,
1879 csum_insertion);
1880 } else {
1881 is_jumbo = priv->hw->chain->is_jumbo_frm(skb->len,
1882 priv->plat->enh_desc);
1883 if (unlikely(is_jumbo))
1884 entry = priv->hw->chain->jumbo_frm(priv, skb,
1885 csum_insertion);
1886 }
1887 if (likely(!is_jumbo)) { 1890 if (likely(!is_jumbo)) {
1888 desc->des2 = dma_map_single(priv->device, skb->data, 1891 desc->des2 = dma_map_single(priv->device, skb->data,
1889 nopaged_len, DMA_TO_DEVICE); 1892 nopaged_len, DMA_TO_DEVICE);
1890 priv->tx_skbuff_dma[entry] = desc->des2; 1893 priv->tx_skbuff_dma[entry] = desc->des2;
1891 priv->hw->desc->prepare_tx_desc(desc, 1, nopaged_len, 1894 priv->hw->desc->prepare_tx_desc(desc, 1, nopaged_len,
1892 csum_insertion, priv->mode); 1895 csum_insertion, priv->mode);
1893 } else 1896 } else {
1894 desc = first; 1897 desc = first;
1898 entry = priv->hw->mode->jumbo_frm(priv, skb, csum_insertion);
1899 }
1895 1900
1896 for (i = 0; i < nfrags; i++) { 1901 for (i = 0; i < nfrags; i++) {
1897 const skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; 1902 const skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
@@ -2029,7 +2034,7 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv)
2029 2034
2030 p->des2 = priv->rx_skbuff_dma[entry]; 2035 p->des2 = priv->rx_skbuff_dma[entry];
2031 2036
2032 priv->hw->ring->refill_desc3(priv, p); 2037 priv->hw->mode->refill_desc3(priv, p);
2033 2038
2034 if (netif_msg_rx_status(priv)) 2039 if (netif_msg_rx_status(priv))
2035 pr_debug("\trefill entry #%d\n", entry); 2040 pr_debug("\trefill entry #%d\n", entry);
@@ -2633,11 +2638,11 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
2633 2638
2634 /* To use the chained or ring mode */ 2639 /* To use the chained or ring mode */
2635 if (chain_mode) { 2640 if (chain_mode) {
2636 priv->hw->chain = &chain_mode_ops; 2641 priv->hw->mode = &chain_mode_ops;
2637 pr_info(" Chain mode enabled\n"); 2642 pr_info(" Chain mode enabled\n");
2638 priv->mode = STMMAC_CHAIN_MODE; 2643 priv->mode = STMMAC_CHAIN_MODE;
2639 } else { 2644 } else {
2640 priv->hw->ring = &ring_mode_ops; 2645 priv->hw->mode = &ring_mode_ops;
2641 pr_info(" Ring mode enabled\n"); 2646 pr_info(" Ring mode enabled\n");
2642 priv->mode = STMMAC_RING_MODE; 2647 priv->mode = STMMAC_RING_MODE;
2643 } 2648 }
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index c61bc72b8e90..8fb32a80f1c1 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -36,7 +36,7 @@ static const struct of_device_id stmmac_dt_ids[] = {
36#ifdef CONFIG_DWMAC_STI 36#ifdef CONFIG_DWMAC_STI
37 { .compatible = "st,stih415-dwmac", .data = &sti_gmac_data}, 37 { .compatible = "st,stih415-dwmac", .data = &sti_gmac_data},
38 { .compatible = "st,stih416-dwmac", .data = &sti_gmac_data}, 38 { .compatible = "st,stih416-dwmac", .data = &sti_gmac_data},
39 { .compatible = "st,stih127-dwmac", .data = &sti_gmac_data}, 39 { .compatible = "st,stid127-dwmac", .data = &sti_gmac_data},
40#endif 40#endif
41 /* SoC specific glue layers should come before generic bindings */ 41 /* SoC specific glue layers should come before generic bindings */
42 { .compatible = "st,spear600-gmac"}, 42 { .compatible = "st,spear600-gmac"},
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 3d069901e6d9..4e4cf9e0c8d7 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -674,6 +674,8 @@ static int netvsc_probe(struct hv_device *dev,
674 if (!net) 674 if (!net)
675 return -ENOMEM; 675 return -ENOMEM;
676 676
677 netif_carrier_off(net);
678
677 net_device_ctx = netdev_priv(net); 679 net_device_ctx = netdev_priv(net);
678 net_device_ctx->device_ctx = dev; 680 net_device_ctx->device_ctx = dev;
679 hv_set_drvdata(dev, net); 681 hv_set_drvdata(dev, net);
@@ -706,6 +708,8 @@ static int netvsc_probe(struct hv_device *dev,
706 pr_err("Unable to register netdev.\n"); 708 pr_err("Unable to register netdev.\n");
707 rndis_filter_device_remove(dev); 709 rndis_filter_device_remove(dev);
708 free_netdev(net); 710 free_netdev(net);
711 } else {
712 schedule_delayed_work(&net_device_ctx->dwork, 0);
709 } 713 }
710 714
711 return ret; 715 return ret;
diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c
index 54553df74cd2..4a37e3db9e32 100644
--- a/drivers/net/hyperv/rndis_filter.c
+++ b/drivers/net/hyperv/rndis_filter.c
@@ -240,6 +240,22 @@ static int rndis_filter_send_request(struct rndis_device *dev,
240 return ret; 240 return ret;
241} 241}
242 242
243static void rndis_set_link_state(struct rndis_device *rdev,
244 struct rndis_request *request)
245{
246 u32 link_status;
247 struct rndis_query_complete *query_complete;
248
249 query_complete = &request->response_msg.msg.query_complete;
250
251 if (query_complete->status == RNDIS_STATUS_SUCCESS &&
252 query_complete->info_buflen == sizeof(u32)) {
253 memcpy(&link_status, (void *)((unsigned long)query_complete +
254 query_complete->info_buf_offset), sizeof(u32));
255 rdev->link_state = link_status != 0;
256 }
257}
258
243static void rndis_filter_receive_response(struct rndis_device *dev, 259static void rndis_filter_receive_response(struct rndis_device *dev,
244 struct rndis_message *resp) 260 struct rndis_message *resp)
245{ 261{
@@ -269,6 +285,10 @@ static void rndis_filter_receive_response(struct rndis_device *dev,
269 sizeof(struct rndis_message) + RNDIS_EXT_LEN) { 285 sizeof(struct rndis_message) + RNDIS_EXT_LEN) {
270 memcpy(&request->response_msg, resp, 286 memcpy(&request->response_msg, resp,
271 resp->msg_len); 287 resp->msg_len);
288 if (request->request_msg.ndis_msg_type ==
289 RNDIS_MSG_QUERY && request->request_msg.msg.
290 query_req.oid == RNDIS_OID_GEN_MEDIA_CONNECT_STATUS)
291 rndis_set_link_state(dev, request);
272 } else { 292 } else {
273 netdev_err(ndev, 293 netdev_err(ndev,
274 "rndis response buffer overflow " 294 "rndis response buffer overflow "
@@ -674,7 +694,6 @@ static int rndis_filter_query_device_link_status(struct rndis_device *dev)
674 ret = rndis_filter_query_device(dev, 694 ret = rndis_filter_query_device(dev,
675 RNDIS_OID_GEN_MEDIA_CONNECT_STATUS, 695 RNDIS_OID_GEN_MEDIA_CONNECT_STATUS,
676 &link_status, &size); 696 &link_status, &size);
677 dev->link_state = (link_status != 0) ? true : false;
678 697
679 return ret; 698 return ret;
680} 699}
diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c
index 934a12c03552..ae38a98d072e 100644
--- a/drivers/net/ieee802154/at86rf230.c
+++ b/drivers/net/ieee802154/at86rf230.c
@@ -655,12 +655,12 @@ at86rf230_xmit(struct ieee802154_dev *dev, struct sk_buff *skb)
655 int rc; 655 int rc;
656 unsigned long flags; 656 unsigned long flags;
657 657
658 spin_lock(&lp->lock); 658 spin_lock_irqsave(&lp->lock, flags);
659 if (lp->irq_busy) { 659 if (lp->irq_busy) {
660 spin_unlock(&lp->lock); 660 spin_unlock_irqrestore(&lp->lock, flags);
661 return -EBUSY; 661 return -EBUSY;
662 } 662 }
663 spin_unlock(&lp->lock); 663 spin_unlock_irqrestore(&lp->lock, flags);
664 664
665 might_sleep(); 665 might_sleep();
666 666
@@ -944,10 +944,11 @@ static void at86rf230_irqwork_level(struct work_struct *work)
944static irqreturn_t at86rf230_isr(int irq, void *data) 944static irqreturn_t at86rf230_isr(int irq, void *data)
945{ 945{
946 struct at86rf230_local *lp = data; 946 struct at86rf230_local *lp = data;
947 unsigned long flags;
947 948
948 spin_lock(&lp->lock); 949 spin_lock_irqsave(&lp->lock, flags);
949 lp->irq_busy = 1; 950 lp->irq_busy = 1;
950 spin_unlock(&lp->lock); 951 spin_unlock_irqrestore(&lp->lock, flags);
951 952
952 schedule_work(&lp->irqwork); 953 schedule_work(&lp->irqwork);
953 954
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 643b5d665f41..1d788f19135b 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -186,9 +186,9 @@ static const struct phy_setting settings[] = {
186 * of that setting. Returns the index of the last setting if 186 * of that setting. Returns the index of the last setting if
187 * none of the others match. 187 * none of the others match.
188 */ 188 */
189static inline int phy_find_setting(int speed, int duplex) 189static inline unsigned int phy_find_setting(int speed, int duplex)
190{ 190{
191 int idx = 0; 191 unsigned int idx = 0;
192 192
193 while (idx < ARRAY_SIZE(settings) && 193 while (idx < ARRAY_SIZE(settings) &&
194 (settings[idx].speed != speed || settings[idx].duplex != duplex)) 194 (settings[idx].speed != speed || settings[idx].duplex != duplex))
@@ -207,7 +207,7 @@ static inline int phy_find_setting(int speed, int duplex)
207 * the mask in features. Returns the index of the last setting 207 * the mask in features. Returns the index of the last setting
208 * if nothing else matches. 208 * if nothing else matches.
209 */ 209 */
210static inline int phy_find_valid(int idx, u32 features) 210static inline unsigned int phy_find_valid(unsigned int idx, u32 features)
211{ 211{
212 while (idx < MAX_NUM_SETTINGS && !(settings[idx].setting & features)) 212 while (idx < MAX_NUM_SETTINGS && !(settings[idx].setting & features))
213 idx++; 213 idx++;
@@ -226,7 +226,7 @@ static inline int phy_find_valid(int idx, u32 features)
226static void phy_sanitize_settings(struct phy_device *phydev) 226static void phy_sanitize_settings(struct phy_device *phydev)
227{ 227{
228 u32 features = phydev->supported; 228 u32 features = phydev->supported;
229 int idx; 229 unsigned int idx;
230 230
231 /* Sanitize settings based on PHY capabilities */ 231 /* Sanitize settings based on PHY capabilities */
232 if ((features & SUPPORTED_Autoneg) == 0) 232 if ((features & SUPPORTED_Autoneg) == 0)
@@ -979,7 +979,8 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable)
979 (phydev->interface == PHY_INTERFACE_MODE_RGMII))) { 979 (phydev->interface == PHY_INTERFACE_MODE_RGMII))) {
980 int eee_lp, eee_cap, eee_adv; 980 int eee_lp, eee_cap, eee_adv;
981 u32 lp, cap, adv; 981 u32 lp, cap, adv;
982 int idx, status; 982 int status;
983 unsigned int idx;
983 984
984 /* Read phy status to properly get the right settings */ 985 /* Read phy status to properly get the right settings */
985 status = phy_read_status(phydev); 986 status = phy_read_status(phydev);
diff --git a/drivers/net/usb/Makefile b/drivers/net/usb/Makefile
index 433f0a00c683..e2797f1e1b31 100644
--- a/drivers/net/usb/Makefile
+++ b/drivers/net/usb/Makefile
@@ -11,7 +11,7 @@ obj-$(CONFIG_USB_HSO) += hso.o
11obj-$(CONFIG_USB_NET_AX8817X) += asix.o 11obj-$(CONFIG_USB_NET_AX8817X) += asix.o
12asix-y := asix_devices.o asix_common.o ax88172a.o 12asix-y := asix_devices.o asix_common.o ax88172a.o
13obj-$(CONFIG_USB_NET_AX88179_178A) += ax88179_178a.o 13obj-$(CONFIG_USB_NET_AX88179_178A) += ax88179_178a.o
14obj-$(CONFIG_USB_NET_CDCETHER) += cdc_ether.o r815x.o 14obj-$(CONFIG_USB_NET_CDCETHER) += cdc_ether.o
15obj-$(CONFIG_USB_NET_CDC_EEM) += cdc_eem.o 15obj-$(CONFIG_USB_NET_CDC_EEM) += cdc_eem.o
16obj-$(CONFIG_USB_NET_DM9601) += dm9601.o 16obj-$(CONFIG_USB_NET_DM9601) += dm9601.o
17obj-$(CONFIG_USB_NET_SR9700) += sr9700.o 17obj-$(CONFIG_USB_NET_SR9700) += sr9700.o
diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
index d2e6fdb25e28..054e59ca6946 100644
--- a/drivers/net/usb/ax88179_178a.c
+++ b/drivers/net/usb/ax88179_178a.c
@@ -1029,20 +1029,12 @@ static int ax88179_bind(struct usbnet *dev, struct usb_interface *intf)
1029 dev->mii.phy_id = 0x03; 1029 dev->mii.phy_id = 0x03;
1030 dev->mii.supports_gmii = 1; 1030 dev->mii.supports_gmii = 1;
1031 1031
1032 if (usb_device_no_sg_constraint(dev->udev))
1033 dev->can_dma_sg = 1;
1034
1035 dev->net->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | 1032 dev->net->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
1036 NETIF_F_RXCSUM; 1033 NETIF_F_RXCSUM;
1037 1034
1038 dev->net->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | 1035 dev->net->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
1039 NETIF_F_RXCSUM; 1036 NETIF_F_RXCSUM;
1040 1037
1041 if (dev->can_dma_sg) {
1042 dev->net->features |= NETIF_F_SG | NETIF_F_TSO;
1043 dev->net->hw_features |= NETIF_F_SG | NETIF_F_TSO;
1044 }
1045
1046 /* Enable checksum offload */ 1038 /* Enable checksum offload */
1047 *tmp = AX_RXCOE_IP | AX_RXCOE_TCP | AX_RXCOE_UDP | 1039 *tmp = AX_RXCOE_IP | AX_RXCOE_TCP | AX_RXCOE_UDP |
1048 AX_RXCOE_TCPV6 | AX_RXCOE_UDPV6; 1040 AX_RXCOE_TCPV6 | AX_RXCOE_UDPV6;
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 42e176912c8e..bd363b27e854 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -652,6 +652,13 @@ static const struct usb_device_id products[] = {
652 .driver_info = 0, 652 .driver_info = 0,
653}, 653},
654 654
655/* Samsung USB Ethernet Adapters */
656{
657 USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, 0xa101, USB_CLASS_COMM,
658 USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
659 .driver_info = 0,
660},
661
655/* WHITELIST!!! 662/* WHITELIST!!!
656 * 663 *
657 * CDC Ether uses two interfaces, not necessarily consecutive. 664 * CDC Ether uses two interfaces, not necessarily consecutive.
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index aa1d5b2e9c30..18e12a3f7fc3 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -3367,6 +3367,12 @@ static int rtl8152_probe(struct usb_interface *intf,
3367 struct net_device *netdev; 3367 struct net_device *netdev;
3368 int ret; 3368 int ret;
3369 3369
3370 if (udev->actconfig->desc.bConfigurationValue != 1) {
3371 usb_driver_set_configuration(udev, 1);
3372 return -ENODEV;
3373 }
3374
3375 usb_reset_device(udev);
3370 netdev = alloc_etherdev(sizeof(struct r8152)); 3376 netdev = alloc_etherdev(sizeof(struct r8152));
3371 if (!netdev) { 3377 if (!netdev) {
3372 dev_err(&intf->dev, "Out of memory\n"); 3378 dev_err(&intf->dev, "Out of memory\n");
@@ -3456,9 +3462,9 @@ static void rtl8152_disconnect(struct usb_interface *intf)
3456 3462
3457/* table of devices that work with this driver */ 3463/* table of devices that work with this driver */
3458static struct usb_device_id rtl8152_table[] = { 3464static struct usb_device_id rtl8152_table[] = {
3459 {REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, PRODUCT_ID_RTL8152)}, 3465 {USB_DEVICE(VENDOR_ID_REALTEK, PRODUCT_ID_RTL8152)},
3460 {REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, PRODUCT_ID_RTL8153)}, 3466 {USB_DEVICE(VENDOR_ID_REALTEK, PRODUCT_ID_RTL8153)},
3461 {REALTEK_USB_DEVICE(VENDOR_ID_SAMSUNG, PRODUCT_ID_SAMSUNG)}, 3467 {USB_DEVICE(VENDOR_ID_SAMSUNG, PRODUCT_ID_SAMSUNG)},
3462 {} 3468 {}
3463}; 3469};
3464 3470
diff --git a/drivers/net/usb/r815x.c b/drivers/net/usb/r815x.c
deleted file mode 100644
index f0a8791b7636..000000000000
--- a/drivers/net/usb/r815x.c
+++ /dev/null
@@ -1,248 +0,0 @@
1#include <linux/module.h>
2#include <linux/netdevice.h>
3#include <linux/mii.h>
4#include <linux/usb.h>
5#include <linux/usb/cdc.h>
6#include <linux/usb/usbnet.h>
7
8#define RTL815x_REQT_READ 0xc0
9#define RTL815x_REQT_WRITE 0x40
10#define RTL815x_REQ_GET_REGS 0x05
11#define RTL815x_REQ_SET_REGS 0x05
12
13#define MCU_TYPE_PLA 0x0100
14#define OCP_BASE 0xe86c
15#define BASE_MII 0xa400
16
17#define BYTE_EN_DWORD 0xff
18#define BYTE_EN_WORD 0x33
19#define BYTE_EN_BYTE 0x11
20
21#define R815x_PHY_ID 32
22#define REALTEK_VENDOR_ID 0x0bda
23
24
25static int pla_read_word(struct usb_device *udev, u16 index)
26{
27 int ret;
28 u8 shift = index & 2;
29 __le32 *tmp;
30
31 tmp = kmalloc(sizeof(*tmp), GFP_KERNEL);
32 if (!tmp)
33 return -ENOMEM;
34
35 index &= ~3;
36
37 ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
38 RTL815x_REQ_GET_REGS, RTL815x_REQT_READ,
39 index, MCU_TYPE_PLA, tmp, sizeof(*tmp), 500);
40 if (ret < 0)
41 goto out2;
42
43 ret = __le32_to_cpu(*tmp);
44 ret >>= (shift * 8);
45 ret &= 0xffff;
46
47out2:
48 kfree(tmp);
49 return ret;
50}
51
52static int pla_write_word(struct usb_device *udev, u16 index, u32 data)
53{
54 __le32 *tmp;
55 u32 mask = 0xffff;
56 u16 byen = BYTE_EN_WORD;
57 u8 shift = index & 2;
58 int ret;
59
60 tmp = kmalloc(sizeof(*tmp), GFP_KERNEL);
61 if (!tmp)
62 return -ENOMEM;
63
64 data &= mask;
65
66 if (shift) {
67 byen <<= shift;
68 mask <<= (shift * 8);
69 data <<= (shift * 8);
70 index &= ~3;
71 }
72
73 ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
74 RTL815x_REQ_GET_REGS, RTL815x_REQT_READ,
75 index, MCU_TYPE_PLA, tmp, sizeof(*tmp), 500);
76 if (ret < 0)
77 goto out3;
78
79 data |= __le32_to_cpu(*tmp) & ~mask;
80 *tmp = __cpu_to_le32(data);
81
82 ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
83 RTL815x_REQ_SET_REGS, RTL815x_REQT_WRITE,
84 index, MCU_TYPE_PLA | byen, tmp, sizeof(*tmp),
85 500);
86
87out3:
88 kfree(tmp);
89 return ret;
90}
91
92static int ocp_reg_read(struct usbnet *dev, u16 addr)
93{
94 u16 ocp_base, ocp_index;
95 int ret;
96
97 ocp_base = addr & 0xf000;
98 ret = pla_write_word(dev->udev, OCP_BASE, ocp_base);
99 if (ret < 0)
100 goto out;
101
102 ocp_index = (addr & 0x0fff) | 0xb000;
103 ret = pla_read_word(dev->udev, ocp_index);
104
105out:
106 return ret;
107}
108
109static int ocp_reg_write(struct usbnet *dev, u16 addr, u16 data)
110{
111 u16 ocp_base, ocp_index;
112 int ret;
113
114 ocp_base = addr & 0xf000;
115 ret = pla_write_word(dev->udev, OCP_BASE, ocp_base);
116 if (ret < 0)
117 goto out1;
118
119 ocp_index = (addr & 0x0fff) | 0xb000;
120 ret = pla_write_word(dev->udev, ocp_index, data);
121
122out1:
123 return ret;
124}
125
126static int r815x_mdio_read(struct net_device *netdev, int phy_id, int reg)
127{
128 struct usbnet *dev = netdev_priv(netdev);
129 int ret;
130
131 if (phy_id != R815x_PHY_ID)
132 return -EINVAL;
133
134 if (usb_autopm_get_interface(dev->intf) < 0)
135 return -ENODEV;
136
137 ret = ocp_reg_read(dev, BASE_MII + reg * 2);
138
139 usb_autopm_put_interface(dev->intf);
140 return ret;
141}
142
143static
144void r815x_mdio_write(struct net_device *netdev, int phy_id, int reg, int val)
145{
146 struct usbnet *dev = netdev_priv(netdev);
147
148 if (phy_id != R815x_PHY_ID)
149 return;
150
151 if (usb_autopm_get_interface(dev->intf) < 0)
152 return;
153
154 ocp_reg_write(dev, BASE_MII + reg * 2, val);
155
156 usb_autopm_put_interface(dev->intf);
157}
158
159static int r8153_bind(struct usbnet *dev, struct usb_interface *intf)
160{
161 int status;
162
163 status = usbnet_cdc_bind(dev, intf);
164 if (status < 0)
165 return status;
166
167 dev->mii.dev = dev->net;
168 dev->mii.mdio_read = r815x_mdio_read;
169 dev->mii.mdio_write = r815x_mdio_write;
170 dev->mii.phy_id_mask = 0x3f;
171 dev->mii.reg_num_mask = 0x1f;
172 dev->mii.phy_id = R815x_PHY_ID;
173 dev->mii.supports_gmii = 1;
174
175 return status;
176}
177
178static int r8152_bind(struct usbnet *dev, struct usb_interface *intf)
179{
180 int status;
181
182 status = usbnet_cdc_bind(dev, intf);
183 if (status < 0)
184 return status;
185
186 dev->mii.dev = dev->net;
187 dev->mii.mdio_read = r815x_mdio_read;
188 dev->mii.mdio_write = r815x_mdio_write;
189 dev->mii.phy_id_mask = 0x3f;
190 dev->mii.reg_num_mask = 0x1f;
191 dev->mii.phy_id = R815x_PHY_ID;
192 dev->mii.supports_gmii = 0;
193
194 return status;
195}
196
197static const struct driver_info r8152_info = {
198 .description = "RTL8152 ECM Device",
199 .flags = FLAG_ETHER | FLAG_POINTTOPOINT,
200 .bind = r8152_bind,
201 .unbind = usbnet_cdc_unbind,
202 .status = usbnet_cdc_status,
203 .manage_power = usbnet_manage_power,
204};
205
206static const struct driver_info r8153_info = {
207 .description = "RTL8153 ECM Device",
208 .flags = FLAG_ETHER | FLAG_POINTTOPOINT,
209 .bind = r8153_bind,
210 .unbind = usbnet_cdc_unbind,
211 .status = usbnet_cdc_status,
212 .manage_power = usbnet_manage_power,
213};
214
215static const struct usb_device_id products[] = {
216{
217 USB_DEVICE_AND_INTERFACE_INFO(REALTEK_VENDOR_ID, 0x8152, USB_CLASS_COMM,
218 USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
219 .driver_info = (unsigned long) &r8152_info,
220},
221
222{
223 USB_DEVICE_AND_INTERFACE_INFO(REALTEK_VENDOR_ID, 0x8153, USB_CLASS_COMM,
224 USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
225 .driver_info = (unsigned long) &r8153_info,
226},
227
228 { }, /* END */
229};
230MODULE_DEVICE_TABLE(usb, products);
231
232static struct usb_driver r815x_driver = {
233 .name = "r815x",
234 .id_table = products,
235 .probe = usbnet_probe,
236 .disconnect = usbnet_disconnect,
237 .suspend = usbnet_suspend,
238 .resume = usbnet_resume,
239 .reset_resume = usbnet_resume,
240 .supports_autosuspend = 1,
241 .disable_hub_initiated_lpm = 1,
242};
243
244module_usb_driver(r815x_driver);
245
246MODULE_AUTHOR("Hayes Wang");
247MODULE_DESCRIPTION("Realtek USB ECM device");
248MODULE_LICENSE("GPL");
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index 9275c8c423b1..28965adfeebd 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -1762,11 +1762,20 @@ vmxnet3_netpoll(struct net_device *netdev)
1762{ 1762{
1763 struct vmxnet3_adapter *adapter = netdev_priv(netdev); 1763 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
1764 1764
1765 if (adapter->intr.mask_mode == VMXNET3_IMM_ACTIVE) 1765 switch (adapter->intr.type) {
1766 vmxnet3_disable_all_intrs(adapter); 1766#ifdef CONFIG_PCI_MSI
1767 1767 case VMXNET3_IT_MSIX: {
1768 vmxnet3_do_poll(adapter, adapter->rx_queue[0].rx_ring[0].size); 1768 int i;
1769 vmxnet3_enable_all_intrs(adapter); 1769 for (i = 0; i < adapter->num_rx_queues; i++)
1770 vmxnet3_msix_rx(0, &adapter->rx_queue[i]);
1771 break;
1772 }
1773#endif
1774 case VMXNET3_IT_MSI:
1775 default:
1776 vmxnet3_intr(0, adapter->netdev);
1777 break;
1778 }
1770 1779
1771} 1780}
1772#endif /* CONFIG_NET_POLL_CONTROLLER */ 1781#endif /* CONFIG_NET_POLL_CONTROLLER */
diff --git a/drivers/net/wireless/iwlwifi/mvm/bt-coex.c b/drivers/net/wireless/iwlwifi/mvm/bt-coex.c
index 38a54a3fde34..2aa3ee93c68e 100644
--- a/drivers/net/wireless/iwlwifi/mvm/bt-coex.c
+++ b/drivers/net/wireless/iwlwifi/mvm/bt-coex.c
@@ -906,8 +906,11 @@ void iwl_mvm_bt_rssi_event(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
906 906
907 lockdep_assert_held(&mvm->mutex); 907 lockdep_assert_held(&mvm->mutex);
908 908
909 /* Rssi update while not associated ?! */ 909 /*
910 if (WARN_ON_ONCE(mvmvif->ap_sta_id == IWL_MVM_STATION_COUNT)) 910 * Rssi update while not associated - can happen since the statistics
911 * are handled asynchronously
912 */
913 if (mvmvif->ap_sta_id == IWL_MVM_STATION_COUNT)
911 return; 914 return;
912 915
913 /* No BT - reports should be disabled */ 916 /* No BT - reports should be disabled */
diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c
index 0f52e961a5a5..1f97631a82e4 100644
--- a/drivers/net/wireless/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/iwlwifi/pcie/drv.c
@@ -360,13 +360,12 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = {
360/* 7265 Series */ 360/* 7265 Series */
361 {IWL_PCI_DEVICE(0x095A, 0x5010, iwl7265_2ac_cfg)}, 361 {IWL_PCI_DEVICE(0x095A, 0x5010, iwl7265_2ac_cfg)},
362 {IWL_PCI_DEVICE(0x095A, 0x5110, iwl7265_2ac_cfg)}, 362 {IWL_PCI_DEVICE(0x095A, 0x5110, iwl7265_2ac_cfg)},
363 {IWL_PCI_DEVICE(0x095A, 0x5112, iwl7265_2ac_cfg)},
364 {IWL_PCI_DEVICE(0x095A, 0x5100, iwl7265_2ac_cfg)}, 363 {IWL_PCI_DEVICE(0x095A, 0x5100, iwl7265_2ac_cfg)},
365 {IWL_PCI_DEVICE(0x095A, 0x510A, iwl7265_2ac_cfg)},
366 {IWL_PCI_DEVICE(0x095B, 0x5310, iwl7265_2ac_cfg)}, 364 {IWL_PCI_DEVICE(0x095B, 0x5310, iwl7265_2ac_cfg)},
367 {IWL_PCI_DEVICE(0x095B, 0x5302, iwl7265_2ac_cfg)}, 365 {IWL_PCI_DEVICE(0x095B, 0x5302, iwl7265_n_cfg)},
368 {IWL_PCI_DEVICE(0x095B, 0x5210, iwl7265_2ac_cfg)}, 366 {IWL_PCI_DEVICE(0x095B, 0x5210, iwl7265_2ac_cfg)},
369 {IWL_PCI_DEVICE(0x095A, 0x5012, iwl7265_2ac_cfg)}, 367 {IWL_PCI_DEVICE(0x095A, 0x5012, iwl7265_2ac_cfg)},
368 {IWL_PCI_DEVICE(0x095A, 0x5412, iwl7265_2ac_cfg)},
370 {IWL_PCI_DEVICE(0x095A, 0x5410, iwl7265_2ac_cfg)}, 369 {IWL_PCI_DEVICE(0x095A, 0x5410, iwl7265_2ac_cfg)},
371 {IWL_PCI_DEVICE(0x095A, 0x5400, iwl7265_2ac_cfg)}, 370 {IWL_PCI_DEVICE(0x095A, 0x5400, iwl7265_2ac_cfg)},
372 {IWL_PCI_DEVICE(0x095A, 0x1010, iwl7265_2ac_cfg)}, 371 {IWL_PCI_DEVICE(0x095A, 0x1010, iwl7265_2ac_cfg)},
diff --git a/drivers/net/wireless/mwifiex/11ac.c b/drivers/net/wireless/mwifiex/11ac.c
index bb43251c18f2..c92f27aa71ed 100644
--- a/drivers/net/wireless/mwifiex/11ac.c
+++ b/drivers/net/wireless/mwifiex/11ac.c
@@ -192,8 +192,7 @@ int mwifiex_cmd_append_11ac_tlv(struct mwifiex_private *priv,
192 vht_cap->header.len = 192 vht_cap->header.len =
193 cpu_to_le16(sizeof(struct ieee80211_vht_cap)); 193 cpu_to_le16(sizeof(struct ieee80211_vht_cap));
194 memcpy((u8 *)vht_cap + sizeof(struct mwifiex_ie_types_header), 194 memcpy((u8 *)vht_cap + sizeof(struct mwifiex_ie_types_header),
195 (u8 *)bss_desc->bcn_vht_cap + 195 (u8 *)bss_desc->bcn_vht_cap,
196 sizeof(struct ieee_types_header),
197 le16_to_cpu(vht_cap->header.len)); 196 le16_to_cpu(vht_cap->header.len));
198 197
199 mwifiex_fill_vht_cap_tlv(priv, &vht_cap->vht_cap, 198 mwifiex_fill_vht_cap_tlv(priv, &vht_cap->vht_cap,
diff --git a/drivers/net/wireless/mwifiex/11n.c b/drivers/net/wireless/mwifiex/11n.c
index 79ead928a64e..d9c65b60cd72 100644
--- a/drivers/net/wireless/mwifiex/11n.c
+++ b/drivers/net/wireless/mwifiex/11n.c
@@ -317,8 +317,7 @@ mwifiex_cmd_append_11n_tlv(struct mwifiex_private *priv,
317 ht_cap->header.len = 317 ht_cap->header.len =
318 cpu_to_le16(sizeof(struct ieee80211_ht_cap)); 318 cpu_to_le16(sizeof(struct ieee80211_ht_cap));
319 memcpy((u8 *) ht_cap + sizeof(struct mwifiex_ie_types_header), 319 memcpy((u8 *) ht_cap + sizeof(struct mwifiex_ie_types_header),
320 (u8 *) bss_desc->bcn_ht_cap + 320 (u8 *)bss_desc->bcn_ht_cap,
321 sizeof(struct ieee_types_header),
322 le16_to_cpu(ht_cap->header.len)); 321 le16_to_cpu(ht_cap->header.len));
323 322
324 mwifiex_fill_cap_info(priv, radio_type, &ht_cap->ht_cap); 323 mwifiex_fill_cap_info(priv, radio_type, &ht_cap->ht_cap);
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
index 0e8ca7bab3e7..f13924447a2c 100644
--- a/drivers/net/wireless/mwifiex/scan.c
+++ b/drivers/net/wireless/mwifiex/scan.c
@@ -2311,12 +2311,12 @@ mwifiex_save_curr_bcn(struct mwifiex_private *priv)
2311 curr_bss->ht_info_offset); 2311 curr_bss->ht_info_offset);
2312 2312
2313 if (curr_bss->bcn_vht_cap) 2313 if (curr_bss->bcn_vht_cap)
2314 curr_bss->bcn_ht_cap = (void *)(curr_bss->beacon_buf + 2314 curr_bss->bcn_vht_cap = (void *)(curr_bss->beacon_buf +
2315 curr_bss->vht_cap_offset); 2315 curr_bss->vht_cap_offset);
2316 2316
2317 if (curr_bss->bcn_vht_oper) 2317 if (curr_bss->bcn_vht_oper)
2318 curr_bss->bcn_ht_oper = (void *)(curr_bss->beacon_buf + 2318 curr_bss->bcn_vht_oper = (void *)(curr_bss->beacon_buf +
2319 curr_bss->vht_info_offset); 2319 curr_bss->vht_info_offset);
2320 2320
2321 if (curr_bss->bcn_bss_co_2040) 2321 if (curr_bss->bcn_bss_co_2040)
2322 curr_bss->bcn_bss_co_2040 = 2322 curr_bss->bcn_bss_co_2040 =
diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
index 83a71ac5b93a..a6a8c1579eb9 100644
--- a/drivers/net/xen-netback/interface.c
+++ b/drivers/net/xen-netback/interface.c
@@ -148,8 +148,7 @@ static int xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev)
148 /* If the skb is GSO then we'll also need an extra slot for the 148 /* If the skb is GSO then we'll also need an extra slot for the
149 * metadata. 149 * metadata.
150 */ 150 */
151 if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4 || 151 if (skb_is_gso(skb))
152 skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6)
153 min_slots_needed++; 152 min_slots_needed++;
154 153
155 /* If the skb can't possibly fit in the remaining slots 154 /* If the skb can't possibly fit in the remaining slots
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
index bc943205a691..5a8c4a43c522 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -243,7 +243,7 @@ static void xenvif_gop_frag_copy(struct xenvif *vif, struct sk_buff *skb,
243 struct gnttab_copy *copy_gop; 243 struct gnttab_copy *copy_gop;
244 struct xenvif_rx_meta *meta; 244 struct xenvif_rx_meta *meta;
245 unsigned long bytes; 245 unsigned long bytes;
246 int gso_type; 246 int gso_type = XEN_NETIF_GSO_TYPE_NONE;
247 247
248 /* Data must not cross a page boundary. */ 248 /* Data must not cross a page boundary. */
249 BUG_ON(size + offset > PAGE_SIZE<<compound_order(page)); 249 BUG_ON(size + offset > PAGE_SIZE<<compound_order(page));
@@ -309,12 +309,12 @@ static void xenvif_gop_frag_copy(struct xenvif *vif, struct sk_buff *skb,
309 } 309 }
310 310
311 /* Leave a gap for the GSO descriptor. */ 311 /* Leave a gap for the GSO descriptor. */
312 if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4) 312 if (skb_is_gso(skb)) {
313 gso_type = XEN_NETIF_GSO_TYPE_TCPV4; 313 if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4)
314 else if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6) 314 gso_type = XEN_NETIF_GSO_TYPE_TCPV4;
315 gso_type = XEN_NETIF_GSO_TYPE_TCPV6; 315 else if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6)
316 else 316 gso_type = XEN_NETIF_GSO_TYPE_TCPV6;
317 gso_type = XEN_NETIF_GSO_TYPE_NONE; 317 }
318 318
319 if (*head && ((1 << gso_type) & vif->gso_mask)) 319 if (*head && ((1 << gso_type) & vif->gso_mask))
320 vif->rx.req_cons++; 320 vif->rx.req_cons++;
@@ -348,22 +348,18 @@ static int xenvif_gop_skb(struct sk_buff *skb,
348 int head = 1; 348 int head = 1;
349 int old_meta_prod; 349 int old_meta_prod;
350 int gso_type; 350 int gso_type;
351 int gso_size;
352 struct ubuf_info *ubuf = skb_shinfo(skb)->destructor_arg; 351 struct ubuf_info *ubuf = skb_shinfo(skb)->destructor_arg;
353 grant_ref_t foreign_grefs[MAX_SKB_FRAGS]; 352 grant_ref_t foreign_grefs[MAX_SKB_FRAGS];
354 struct xenvif *foreign_vif = NULL; 353 struct xenvif *foreign_vif = NULL;
355 354
356 old_meta_prod = npo->meta_prod; 355 old_meta_prod = npo->meta_prod;
357 356
358 if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4) { 357 gso_type = XEN_NETIF_GSO_TYPE_NONE;
359 gso_type = XEN_NETIF_GSO_TYPE_TCPV4; 358 if (skb_is_gso(skb)) {
360 gso_size = skb_shinfo(skb)->gso_size; 359 if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4)
361 } else if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6) { 360 gso_type = XEN_NETIF_GSO_TYPE_TCPV4;
362 gso_type = XEN_NETIF_GSO_TYPE_TCPV6; 361 else if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6)
363 gso_size = skb_shinfo(skb)->gso_size; 362 gso_type = XEN_NETIF_GSO_TYPE_TCPV6;
364 } else {
365 gso_type = XEN_NETIF_GSO_TYPE_NONE;
366 gso_size = 0;
367 } 363 }
368 364
369 /* Set up a GSO prefix descriptor, if necessary */ 365 /* Set up a GSO prefix descriptor, if necessary */
@@ -371,7 +367,7 @@ static int xenvif_gop_skb(struct sk_buff *skb,
371 req = RING_GET_REQUEST(&vif->rx, vif->rx.req_cons++); 367 req = RING_GET_REQUEST(&vif->rx, vif->rx.req_cons++);
372 meta = npo->meta + npo->meta_prod++; 368 meta = npo->meta + npo->meta_prod++;
373 meta->gso_type = gso_type; 369 meta->gso_type = gso_type;
374 meta->gso_size = gso_size; 370 meta->gso_size = skb_shinfo(skb)->gso_size;
375 meta->size = 0; 371 meta->size = 0;
376 meta->id = req->id; 372 meta->id = req->id;
377 } 373 }
@@ -381,7 +377,7 @@ static int xenvif_gop_skb(struct sk_buff *skb,
381 377
382 if ((1 << gso_type) & vif->gso_mask) { 378 if ((1 << gso_type) & vif->gso_mask) {
383 meta->gso_type = gso_type; 379 meta->gso_type = gso_type;
384 meta->gso_size = gso_size; 380 meta->gso_size = skb_shinfo(skb)->gso_size;
385 } else { 381 } else {
386 meta->gso_type = XEN_NETIF_GSO_TYPE_NONE; 382 meta->gso_type = XEN_NETIF_GSO_TYPE_NONE;
387 meta->gso_size = 0; 383 meta->gso_size = 0;
@@ -531,8 +527,9 @@ static void xenvif_rx_action(struct xenvif *vif)
531 size = skb_frag_size(&skb_shinfo(skb)->frags[i]); 527 size = skb_frag_size(&skb_shinfo(skb)->frags[i]);
532 max_slots_needed += DIV_ROUND_UP(size, PAGE_SIZE); 528 max_slots_needed += DIV_ROUND_UP(size, PAGE_SIZE);
533 } 529 }
534 if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4 || 530 if (skb_is_gso(skb) &&
535 skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6) 531 (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4 ||
532 skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6))
536 max_slots_needed++; 533 max_slots_needed++;
537 534
538 /* If the skb may not fit then bail out now */ 535 /* If the skb may not fit then bail out now */