aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/3com/3c574_cs.c2
-rw-r--r--drivers/net/ethernet/adi/Kconfig1
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c30
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c2
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c60
-rw-r--r--drivers/net/ethernet/broadcom/tg3.c62
-rw-r--r--drivers/net/ethernet/calxeda/xgmac.c4
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c17
-rw-r--r--drivers/net/ethernet/emulex/benet/be.h1
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c29
-rw-r--r--drivers/net/ethernet/intel/ixgbe/Makefile3
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_debugfs.c5
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c4
-rw-r--r--drivers/net/ethernet/marvell/mvmdio.c6
-rw-r--r--drivers/net/ethernet/marvell/mvneta.c19
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_tx.c13
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/main.c11
-rw-r--r--drivers/net/ethernet/nvidia/forcedeth.c35
-rw-r--r--drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c2
-rw-r--r--drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c2
-rw-r--r--drivers/net/ethernet/qlogic/qlge/qlge_main.c2
-rw-r--r--drivers/net/ethernet/realtek/r8169.c7
-rw-r--r--drivers/net/ethernet/ti/cpts.c3
-rw-r--r--drivers/net/ethernet/ti/cpts.h1
-rw-r--r--drivers/net/ethernet/xilinx/Kconfig2
-rw-r--r--drivers/net/ethernet/xilinx/xilinx_axienet_main.c2
-rw-r--r--drivers/net/hyperv/hyperv_net.h2
-rw-r--r--drivers/net/hyperv/netvsc_drv.c2
-rw-r--r--drivers/net/macvlan.c5
-rw-r--r--drivers/net/phy/marvell.c9
-rw-r--r--drivers/net/tun.c113
-rw-r--r--drivers/net/usb/cdc_mbim.c19
-rw-r--r--drivers/net/usb/cdc_ncm.c51
-rw-r--r--drivers/net/usb/dm9601.c22
-rw-r--r--drivers/net/usb/qmi_wwan.c3
-rw-r--r--drivers/net/usb/usbnet.c4
-rw-r--r--drivers/net/vxlan.c7
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8723ae/sw.c2
-rw-r--r--drivers/net/xen-netfront.c27
39 files changed, 385 insertions, 206 deletions
diff --git a/drivers/net/ethernet/3com/3c574_cs.c b/drivers/net/ethernet/3com/3c574_cs.c
index 66df93638085..ffd8de28a76a 100644
--- a/drivers/net/ethernet/3com/3c574_cs.c
+++ b/drivers/net/ethernet/3com/3c574_cs.c
@@ -432,7 +432,7 @@ static int tc574_config(struct pcmcia_device *link)
432 netdev_info(dev, "%s at io %#3lx, irq %d, hw_addr %pM\n", 432 netdev_info(dev, "%s at io %#3lx, irq %d, hw_addr %pM\n",
433 cardname, dev->base_addr, dev->irq, dev->dev_addr); 433 cardname, dev->base_addr, dev->irq, dev->dev_addr);
434 netdev_info(dev, " %dK FIFO split %s Rx:Tx, %sMII interface.\n", 434 netdev_info(dev, " %dK FIFO split %s Rx:Tx, %sMII interface.\n",
435 8 << config & Ram_size, 435 8 << (config & Ram_size),
436 ram_split[(config & Ram_split) >> Ram_split_shift], 436 ram_split[(config & Ram_split) >> Ram_split_shift],
437 config & Autoselect ? "autoselect " : ""); 437 config & Autoselect ? "autoselect " : "");
438 438
diff --git a/drivers/net/ethernet/adi/Kconfig b/drivers/net/ethernet/adi/Kconfig
index e49c0eff040b..a9481606bbcd 100644
--- a/drivers/net/ethernet/adi/Kconfig
+++ b/drivers/net/ethernet/adi/Kconfig
@@ -61,6 +61,7 @@ config BFIN_RX_DESC_NUM
61 61
62config BFIN_MAC_USE_HWSTAMP 62config BFIN_MAC_USE_HWSTAMP
63 bool "Use IEEE 1588 hwstamp" 63 bool "Use IEEE 1588 hwstamp"
64 depends on BFIN_MAC && BF518
64 select PTP_1588_CLOCK 65 select PTP_1588_CLOCK
65 default y 66 default y
66 ---help--- 67 ---help---
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index 01588b66a38c..f771ddfba646 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -80,12 +80,37 @@ static inline void bnx2x_move_fp(struct bnx2x *bp, int from, int to)
80 new_txdata_index = new_max_eth_txqs + FCOE_TXQ_IDX_OFFSET; 80 new_txdata_index = new_max_eth_txqs + FCOE_TXQ_IDX_OFFSET;
81 } 81 }
82 82
83 memcpy(&bp->bnx2x_txq[old_txdata_index], 83 memcpy(&bp->bnx2x_txq[new_txdata_index],
84 &bp->bnx2x_txq[new_txdata_index], 84 &bp->bnx2x_txq[old_txdata_index],
85 sizeof(struct bnx2x_fp_txdata)); 85 sizeof(struct bnx2x_fp_txdata));
86 to_fp->txdata_ptr[0] = &bp->bnx2x_txq[new_txdata_index]; 86 to_fp->txdata_ptr[0] = &bp->bnx2x_txq[new_txdata_index];
87} 87}
88 88
89/**
90 * bnx2x_shrink_eth_fp - guarantees fastpath structures stay intact
91 *
92 * @bp: driver handle
93 * @delta: number of eth queues which were not allocated
94 */
95static void bnx2x_shrink_eth_fp(struct bnx2x *bp, int delta)
96{
97 int i, cos, old_eth_num = BNX2X_NUM_ETH_QUEUES(bp);
98
99 /* Queue pointer cannot be re-set on an fp-basis, as moving pointer
100 * backward along the array could cause memory to be overriden
101 */
102 for (cos = 1; cos < bp->max_cos; cos++) {
103 for (i = 0; i < old_eth_num - delta; i++) {
104 struct bnx2x_fastpath *fp = &bp->fp[i];
105 int new_idx = cos * (old_eth_num - delta) + i;
106
107 memcpy(&bp->bnx2x_txq[new_idx], fp->txdata_ptr[cos],
108 sizeof(struct bnx2x_fp_txdata));
109 fp->txdata_ptr[cos] = &bp->bnx2x_txq[new_idx];
110 }
111 }
112}
113
89int load_count[2][3] = { {0} }; /* per-path: 0-common, 1-port0, 2-port1 */ 114int load_count[2][3] = { {0} }; /* per-path: 0-common, 1-port0, 2-port1 */
90 115
91/* free skb in the packet ring at pos idx 116/* free skb in the packet ring at pos idx
@@ -3863,6 +3888,7 @@ int bnx2x_alloc_fp_mem(struct bnx2x *bp)
3863 int delta = BNX2X_NUM_ETH_QUEUES(bp) - i; 3888 int delta = BNX2X_NUM_ETH_QUEUES(bp) - i;
3864 3889
3865 WARN_ON(delta < 0); 3890 WARN_ON(delta < 0);
3891 bnx2x_shrink_eth_fp(bp, delta);
3866 if (CNIC_SUPPORT(bp)) 3892 if (CNIC_SUPPORT(bp))
3867 /* move non eth FPs next to last eth FP 3893 /* move non eth FPs next to last eth FP
3868 * must be done in that order 3894 * must be done in that order
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
index 277f17e3c8f8..a427b49a886c 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
@@ -2777,10 +2777,10 @@ static int bnx2x_set_rss_flags(struct bnx2x *bp, struct ethtool_rxnfc *info)
2777 } else if ((info->flow_type == UDP_V6_FLOW) && 2777 } else if ((info->flow_type == UDP_V6_FLOW) &&
2778 (bp->rss_conf_obj.udp_rss_v6 != udp_rss_requested)) { 2778 (bp->rss_conf_obj.udp_rss_v6 != udp_rss_requested)) {
2779 bp->rss_conf_obj.udp_rss_v6 = udp_rss_requested; 2779 bp->rss_conf_obj.udp_rss_v6 = udp_rss_requested;
2780 return bnx2x_config_rss_pf(bp, &bp->rss_conf_obj, 0);
2781 DP(BNX2X_MSG_ETHTOOL, 2780 DP(BNX2X_MSG_ETHTOOL,
2782 "rss re-configured, UDP 4-tupple %s\n", 2781 "rss re-configured, UDP 4-tupple %s\n",
2783 udp_rss_requested ? "enabled" : "disabled"); 2782 udp_rss_requested ? "enabled" : "disabled");
2783 return bnx2x_config_rss_pf(bp, &bp->rss_conf_obj, 0);
2784 } else { 2784 } else {
2785 return 0; 2785 return 0;
2786 } 2786 }
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 940ef859dc60..5523da3afcdc 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -127,6 +127,17 @@ MODULE_PARM_DESC(debug, " Default debug msglevel");
127 127
128struct workqueue_struct *bnx2x_wq; 128struct workqueue_struct *bnx2x_wq;
129 129
130struct bnx2x_mac_vals {
131 u32 xmac_addr;
132 u32 xmac_val;
133 u32 emac_addr;
134 u32 emac_val;
135 u32 umac_addr;
136 u32 umac_val;
137 u32 bmac_addr;
138 u32 bmac_val[2];
139};
140
130enum bnx2x_board_type { 141enum bnx2x_board_type {
131 BCM57710 = 0, 142 BCM57710 = 0,
132 BCM57711, 143 BCM57711,
@@ -9420,12 +9431,19 @@ static inline void bnx2x_undi_int_disable(struct bnx2x *bp)
9420 bnx2x_undi_int_disable_e1h(bp); 9431 bnx2x_undi_int_disable_e1h(bp);
9421} 9432}
9422 9433
9423static void bnx2x_prev_unload_close_mac(struct bnx2x *bp) 9434static void bnx2x_prev_unload_close_mac(struct bnx2x *bp,
9435 struct bnx2x_mac_vals *vals)
9424{ 9436{
9425 u32 val, base_addr, offset, mask, reset_reg; 9437 u32 val, base_addr, offset, mask, reset_reg;
9426 bool mac_stopped = false; 9438 bool mac_stopped = false;
9427 u8 port = BP_PORT(bp); 9439 u8 port = BP_PORT(bp);
9428 9440
9441 /* reset addresses as they also mark which values were changed */
9442 vals->bmac_addr = 0;
9443 vals->umac_addr = 0;
9444 vals->xmac_addr = 0;
9445 vals->emac_addr = 0;
9446
9429 reset_reg = REG_RD(bp, MISC_REG_RESET_REG_2); 9447 reset_reg = REG_RD(bp, MISC_REG_RESET_REG_2);
9430 9448
9431 if (!CHIP_IS_E3(bp)) { 9449 if (!CHIP_IS_E3(bp)) {
@@ -9447,14 +9465,18 @@ static void bnx2x_prev_unload_close_mac(struct bnx2x *bp)
9447 */ 9465 */
9448 wb_data[0] = REG_RD(bp, base_addr + offset); 9466 wb_data[0] = REG_RD(bp, base_addr + offset);
9449 wb_data[1] = REG_RD(bp, base_addr + offset + 0x4); 9467 wb_data[1] = REG_RD(bp, base_addr + offset + 0x4);
9468 vals->bmac_addr = base_addr + offset;
9469 vals->bmac_val[0] = wb_data[0];
9470 vals->bmac_val[1] = wb_data[1];
9450 wb_data[0] &= ~BMAC_CONTROL_RX_ENABLE; 9471 wb_data[0] &= ~BMAC_CONTROL_RX_ENABLE;
9451 REG_WR(bp, base_addr + offset, wb_data[0]); 9472 REG_WR(bp, vals->bmac_addr, wb_data[0]);
9452 REG_WR(bp, base_addr + offset + 0x4, wb_data[1]); 9473 REG_WR(bp, vals->bmac_addr + 0x4, wb_data[1]);
9453 9474
9454 } 9475 }
9455 BNX2X_DEV_INFO("Disable emac Rx\n"); 9476 BNX2X_DEV_INFO("Disable emac Rx\n");
9456 REG_WR(bp, NIG_REG_NIG_EMAC0_EN + BP_PORT(bp)*4, 0); 9477 vals->emac_addr = NIG_REG_NIG_EMAC0_EN + BP_PORT(bp)*4;
9457 9478 vals->emac_val = REG_RD(bp, vals->emac_addr);
9479 REG_WR(bp, vals->emac_addr, 0);
9458 mac_stopped = true; 9480 mac_stopped = true;
9459 } else { 9481 } else {
9460 if (reset_reg & MISC_REGISTERS_RESET_REG_2_XMAC) { 9482 if (reset_reg & MISC_REGISTERS_RESET_REG_2_XMAC) {
@@ -9465,14 +9487,18 @@ static void bnx2x_prev_unload_close_mac(struct bnx2x *bp)
9465 val & ~(1 << 1)); 9487 val & ~(1 << 1));
9466 REG_WR(bp, base_addr + XMAC_REG_PFC_CTRL_HI, 9488 REG_WR(bp, base_addr + XMAC_REG_PFC_CTRL_HI,
9467 val | (1 << 1)); 9489 val | (1 << 1));
9468 REG_WR(bp, base_addr + XMAC_REG_CTRL, 0); 9490 vals->xmac_addr = base_addr + XMAC_REG_CTRL;
9491 vals->xmac_val = REG_RD(bp, vals->xmac_addr);
9492 REG_WR(bp, vals->xmac_addr, 0);
9469 mac_stopped = true; 9493 mac_stopped = true;
9470 } 9494 }
9471 mask = MISC_REGISTERS_RESET_REG_2_UMAC0 << port; 9495 mask = MISC_REGISTERS_RESET_REG_2_UMAC0 << port;
9472 if (mask & reset_reg) { 9496 if (mask & reset_reg) {
9473 BNX2X_DEV_INFO("Disable umac Rx\n"); 9497 BNX2X_DEV_INFO("Disable umac Rx\n");
9474 base_addr = BP_PORT(bp) ? GRCBASE_UMAC1 : GRCBASE_UMAC0; 9498 base_addr = BP_PORT(bp) ? GRCBASE_UMAC1 : GRCBASE_UMAC0;
9475 REG_WR(bp, base_addr + UMAC_REG_COMMAND_CONFIG, 0); 9499 vals->umac_addr = base_addr + UMAC_REG_COMMAND_CONFIG;
9500 vals->umac_val = REG_RD(bp, vals->umac_addr);
9501 REG_WR(bp, vals->umac_addr, 0);
9476 mac_stopped = true; 9502 mac_stopped = true;
9477 } 9503 }
9478 } 9504 }
@@ -9664,12 +9690,16 @@ static int bnx2x_prev_unload_common(struct bnx2x *bp)
9664{ 9690{
9665 u32 reset_reg, tmp_reg = 0, rc; 9691 u32 reset_reg, tmp_reg = 0, rc;
9666 bool prev_undi = false; 9692 bool prev_undi = false;
9693 struct bnx2x_mac_vals mac_vals;
9694
9667 /* It is possible a previous function received 'common' answer, 9695 /* It is possible a previous function received 'common' answer,
9668 * but hasn't loaded yet, therefore creating a scenario of 9696 * but hasn't loaded yet, therefore creating a scenario of
9669 * multiple functions receiving 'common' on the same path. 9697 * multiple functions receiving 'common' on the same path.
9670 */ 9698 */
9671 BNX2X_DEV_INFO("Common unload Flow\n"); 9699 BNX2X_DEV_INFO("Common unload Flow\n");
9672 9700
9701 memset(&mac_vals, 0, sizeof(mac_vals));
9702
9673 if (bnx2x_prev_is_path_marked(bp)) 9703 if (bnx2x_prev_is_path_marked(bp))
9674 return bnx2x_prev_mcp_done(bp); 9704 return bnx2x_prev_mcp_done(bp);
9675 9705
@@ -9680,7 +9710,10 @@ static int bnx2x_prev_unload_common(struct bnx2x *bp)
9680 u32 timer_count = 1000; 9710 u32 timer_count = 1000;
9681 9711
9682 /* Close the MAC Rx to prevent BRB from filling up */ 9712 /* Close the MAC Rx to prevent BRB from filling up */
9683 bnx2x_prev_unload_close_mac(bp); 9713 bnx2x_prev_unload_close_mac(bp, &mac_vals);
9714
9715 /* close LLH filters towards the BRB */
9716 bnx2x_set_rx_filter(&bp->link_params, 0);
9684 9717
9685 /* Check if the UNDI driver was previously loaded 9718 /* Check if the UNDI driver was previously loaded
9686 * UNDI driver initializes CID offset for normal bell to 0x7 9719 * UNDI driver initializes CID offset for normal bell to 0x7
@@ -9727,6 +9760,17 @@ static int bnx2x_prev_unload_common(struct bnx2x *bp)
9727 /* No packets are in the pipeline, path is ready for reset */ 9760 /* No packets are in the pipeline, path is ready for reset */
9728 bnx2x_reset_common(bp); 9761 bnx2x_reset_common(bp);
9729 9762
9763 if (mac_vals.xmac_addr)
9764 REG_WR(bp, mac_vals.xmac_addr, mac_vals.xmac_val);
9765 if (mac_vals.umac_addr)
9766 REG_WR(bp, mac_vals.umac_addr, mac_vals.umac_val);
9767 if (mac_vals.emac_addr)
9768 REG_WR(bp, mac_vals.emac_addr, mac_vals.emac_val);
9769 if (mac_vals.bmac_addr) {
9770 REG_WR(bp, mac_vals.bmac_addr, mac_vals.bmac_val[0]);
9771 REG_WR(bp, mac_vals.bmac_addr + 4, mac_vals.bmac_val[1]);
9772 }
9773
9730 rc = bnx2x_prev_mark_path(bp, prev_undi); 9774 rc = bnx2x_prev_mark_path(bp, prev_undi);
9731 if (rc) { 9775 if (rc) {
9732 bnx2x_prev_mcp_done(bp); 9776 bnx2x_prev_mcp_done(bp);
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 78ea90c40e19..bdb086934cd9 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -1283,14 +1283,26 @@ static int tg3_phy_auxctl_write(struct tg3 *tp, int reg, u32 set)
1283 return tg3_writephy(tp, MII_TG3_AUX_CTRL, set | reg); 1283 return tg3_writephy(tp, MII_TG3_AUX_CTRL, set | reg);
1284} 1284}
1285 1285
1286#define TG3_PHY_AUXCTL_SMDSP_ENABLE(tp) \ 1286static int tg3_phy_toggle_auxctl_smdsp(struct tg3 *tp, bool enable)
1287 tg3_phy_auxctl_write((tp), MII_TG3_AUXCTL_SHDWSEL_AUXCTL, \ 1287{
1288 MII_TG3_AUXCTL_ACTL_SMDSP_ENA | \ 1288 u32 val;
1289 MII_TG3_AUXCTL_ACTL_TX_6DB) 1289 int err;
1290 1290
1291#define TG3_PHY_AUXCTL_SMDSP_DISABLE(tp) \ 1291 err = tg3_phy_auxctl_read(tp, MII_TG3_AUXCTL_SHDWSEL_AUXCTL, &val);
1292 tg3_phy_auxctl_write((tp), MII_TG3_AUXCTL_SHDWSEL_AUXCTL, \ 1292
1293 MII_TG3_AUXCTL_ACTL_TX_6DB); 1293 if (err)
1294 return err;
1295 if (enable)
1296
1297 val |= MII_TG3_AUXCTL_ACTL_SMDSP_ENA;
1298 else
1299 val &= ~MII_TG3_AUXCTL_ACTL_SMDSP_ENA;
1300
1301 err = tg3_phy_auxctl_write((tp), MII_TG3_AUXCTL_SHDWSEL_AUXCTL,
1302 val | MII_TG3_AUXCTL_ACTL_TX_6DB);
1303
1304 return err;
1305}
1294 1306
1295static int tg3_bmcr_reset(struct tg3 *tp) 1307static int tg3_bmcr_reset(struct tg3 *tp)
1296{ 1308{
@@ -2223,7 +2235,7 @@ static void tg3_phy_apply_otp(struct tg3 *tp)
2223 2235
2224 otp = tp->phy_otp; 2236 otp = tp->phy_otp;
2225 2237
2226 if (TG3_PHY_AUXCTL_SMDSP_ENABLE(tp)) 2238 if (tg3_phy_toggle_auxctl_smdsp(tp, true))
2227 return; 2239 return;
2228 2240
2229 phy = ((otp & TG3_OTP_AGCTGT_MASK) >> TG3_OTP_AGCTGT_SHIFT); 2241 phy = ((otp & TG3_OTP_AGCTGT_MASK) >> TG3_OTP_AGCTGT_SHIFT);
@@ -2248,7 +2260,7 @@ static void tg3_phy_apply_otp(struct tg3 *tp)
2248 ((otp & TG3_OTP_RCOFF_MASK) >> TG3_OTP_RCOFF_SHIFT); 2260 ((otp & TG3_OTP_RCOFF_MASK) >> TG3_OTP_RCOFF_SHIFT);
2249 tg3_phydsp_write(tp, MII_TG3_DSP_EXP97, phy); 2261 tg3_phydsp_write(tp, MII_TG3_DSP_EXP97, phy);
2250 2262
2251 TG3_PHY_AUXCTL_SMDSP_DISABLE(tp); 2263 tg3_phy_toggle_auxctl_smdsp(tp, false);
2252} 2264}
2253 2265
2254static void tg3_phy_eee_adjust(struct tg3 *tp, u32 current_link_up) 2266static void tg3_phy_eee_adjust(struct tg3 *tp, u32 current_link_up)
@@ -2284,9 +2296,9 @@ static void tg3_phy_eee_adjust(struct tg3 *tp, u32 current_link_up)
2284 2296
2285 if (!tp->setlpicnt) { 2297 if (!tp->setlpicnt) {
2286 if (current_link_up == 1 && 2298 if (current_link_up == 1 &&
2287 !TG3_PHY_AUXCTL_SMDSP_ENABLE(tp)) { 2299 !tg3_phy_toggle_auxctl_smdsp(tp, true)) {
2288 tg3_phydsp_write(tp, MII_TG3_DSP_TAP26, 0x0000); 2300 tg3_phydsp_write(tp, MII_TG3_DSP_TAP26, 0x0000);
2289 TG3_PHY_AUXCTL_SMDSP_DISABLE(tp); 2301 tg3_phy_toggle_auxctl_smdsp(tp, false);
2290 } 2302 }
2291 2303
2292 val = tr32(TG3_CPMU_EEE_MODE); 2304 val = tr32(TG3_CPMU_EEE_MODE);
@@ -2302,11 +2314,11 @@ static void tg3_phy_eee_enable(struct tg3 *tp)
2302 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 || 2314 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 ||
2303 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 || 2315 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 ||
2304 tg3_flag(tp, 57765_CLASS)) && 2316 tg3_flag(tp, 57765_CLASS)) &&
2305 !TG3_PHY_AUXCTL_SMDSP_ENABLE(tp)) { 2317 !tg3_phy_toggle_auxctl_smdsp(tp, true)) {
2306 val = MII_TG3_DSP_TAP26_ALNOKO | 2318 val = MII_TG3_DSP_TAP26_ALNOKO |
2307 MII_TG3_DSP_TAP26_RMRXSTO; 2319 MII_TG3_DSP_TAP26_RMRXSTO;
2308 tg3_phydsp_write(tp, MII_TG3_DSP_TAP26, val); 2320 tg3_phydsp_write(tp, MII_TG3_DSP_TAP26, val);
2309 TG3_PHY_AUXCTL_SMDSP_DISABLE(tp); 2321 tg3_phy_toggle_auxctl_smdsp(tp, false);
2310 } 2322 }
2311 2323
2312 val = tr32(TG3_CPMU_EEE_MODE); 2324 val = tr32(TG3_CPMU_EEE_MODE);
@@ -2450,7 +2462,7 @@ static int tg3_phy_reset_5703_4_5(struct tg3 *tp)
2450 tg3_writephy(tp, MII_CTRL1000, 2462 tg3_writephy(tp, MII_CTRL1000,
2451 CTL1000_AS_MASTER | CTL1000_ENABLE_MASTER); 2463 CTL1000_AS_MASTER | CTL1000_ENABLE_MASTER);
2452 2464
2453 err = TG3_PHY_AUXCTL_SMDSP_ENABLE(tp); 2465 err = tg3_phy_toggle_auxctl_smdsp(tp, true);
2454 if (err) 2466 if (err)
2455 return err; 2467 return err;
2456 2468
@@ -2471,7 +2483,7 @@ static int tg3_phy_reset_5703_4_5(struct tg3 *tp)
2471 tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x8200); 2483 tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x8200);
2472 tg3_writephy(tp, MII_TG3_DSP_CONTROL, 0x0000); 2484 tg3_writephy(tp, MII_TG3_DSP_CONTROL, 0x0000);
2473 2485
2474 TG3_PHY_AUXCTL_SMDSP_DISABLE(tp); 2486 tg3_phy_toggle_auxctl_smdsp(tp, false);
2475 2487
2476 tg3_writephy(tp, MII_CTRL1000, phy9_orig); 2488 tg3_writephy(tp, MII_CTRL1000, phy9_orig);
2477 2489
@@ -2572,10 +2584,10 @@ static int tg3_phy_reset(struct tg3 *tp)
2572 2584
2573out: 2585out:
2574 if ((tp->phy_flags & TG3_PHYFLG_ADC_BUG) && 2586 if ((tp->phy_flags & TG3_PHYFLG_ADC_BUG) &&
2575 !TG3_PHY_AUXCTL_SMDSP_ENABLE(tp)) { 2587 !tg3_phy_toggle_auxctl_smdsp(tp, true)) {
2576 tg3_phydsp_write(tp, 0x201f, 0x2aaa); 2588 tg3_phydsp_write(tp, 0x201f, 0x2aaa);
2577 tg3_phydsp_write(tp, 0x000a, 0x0323); 2589 tg3_phydsp_write(tp, 0x000a, 0x0323);
2578 TG3_PHY_AUXCTL_SMDSP_DISABLE(tp); 2590 tg3_phy_toggle_auxctl_smdsp(tp, false);
2579 } 2591 }
2580 2592
2581 if (tp->phy_flags & TG3_PHYFLG_5704_A0_BUG) { 2593 if (tp->phy_flags & TG3_PHYFLG_5704_A0_BUG) {
@@ -2584,14 +2596,14 @@ out:
2584 } 2596 }
2585 2597
2586 if (tp->phy_flags & TG3_PHYFLG_BER_BUG) { 2598 if (tp->phy_flags & TG3_PHYFLG_BER_BUG) {
2587 if (!TG3_PHY_AUXCTL_SMDSP_ENABLE(tp)) { 2599 if (!tg3_phy_toggle_auxctl_smdsp(tp, true)) {
2588 tg3_phydsp_write(tp, 0x000a, 0x310b); 2600 tg3_phydsp_write(tp, 0x000a, 0x310b);
2589 tg3_phydsp_write(tp, 0x201f, 0x9506); 2601 tg3_phydsp_write(tp, 0x201f, 0x9506);
2590 tg3_phydsp_write(tp, 0x401f, 0x14e2); 2602 tg3_phydsp_write(tp, 0x401f, 0x14e2);
2591 TG3_PHY_AUXCTL_SMDSP_DISABLE(tp); 2603 tg3_phy_toggle_auxctl_smdsp(tp, false);
2592 } 2604 }
2593 } else if (tp->phy_flags & TG3_PHYFLG_JITTER_BUG) { 2605 } else if (tp->phy_flags & TG3_PHYFLG_JITTER_BUG) {
2594 if (!TG3_PHY_AUXCTL_SMDSP_ENABLE(tp)) { 2606 if (!tg3_phy_toggle_auxctl_smdsp(tp, true)) {
2595 tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x000a); 2607 tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x000a);
2596 if (tp->phy_flags & TG3_PHYFLG_ADJUST_TRIM) { 2608 if (tp->phy_flags & TG3_PHYFLG_ADJUST_TRIM) {
2597 tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x110b); 2609 tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x110b);
@@ -2600,7 +2612,7 @@ out:
2600 } else 2612 } else
2601 tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x010b); 2613 tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x010b);
2602 2614
2603 TG3_PHY_AUXCTL_SMDSP_DISABLE(tp); 2615 tg3_phy_toggle_auxctl_smdsp(tp, false);
2604 } 2616 }
2605 } 2617 }
2606 2618
@@ -4009,7 +4021,7 @@ static int tg3_phy_autoneg_cfg(struct tg3 *tp, u32 advertise, u32 flowctrl)
4009 tw32(TG3_CPMU_EEE_MODE, 4021 tw32(TG3_CPMU_EEE_MODE,
4010 tr32(TG3_CPMU_EEE_MODE) & ~TG3_CPMU_EEEMD_LPI_ENABLE); 4022 tr32(TG3_CPMU_EEE_MODE) & ~TG3_CPMU_EEEMD_LPI_ENABLE);
4011 4023
4012 err = TG3_PHY_AUXCTL_SMDSP_ENABLE(tp); 4024 err = tg3_phy_toggle_auxctl_smdsp(tp, true);
4013 if (!err) { 4025 if (!err) {
4014 u32 err2; 4026 u32 err2;
4015 4027
@@ -4042,7 +4054,7 @@ static int tg3_phy_autoneg_cfg(struct tg3 *tp, u32 advertise, u32 flowctrl)
4042 MII_TG3_DSP_CH34TP2_HIBW01); 4054 MII_TG3_DSP_CH34TP2_HIBW01);
4043 } 4055 }
4044 4056
4045 err2 = TG3_PHY_AUXCTL_SMDSP_DISABLE(tp); 4057 err2 = tg3_phy_toggle_auxctl_smdsp(tp, false);
4046 if (!err) 4058 if (!err)
4047 err = err2; 4059 err = err2;
4048 } 4060 }
@@ -6950,6 +6962,9 @@ static void tg3_poll_controller(struct net_device *dev)
6950 int i; 6962 int i;
6951 struct tg3 *tp = netdev_priv(dev); 6963 struct tg3 *tp = netdev_priv(dev);
6952 6964
6965 if (tg3_irq_sync(tp))
6966 return;
6967
6953 for (i = 0; i < tp->irq_cnt; i++) 6968 for (i = 0; i < tp->irq_cnt; i++)
6954 tg3_interrupt(tp->napi[i].irq_vec, &tp->napi[i]); 6969 tg3_interrupt(tp->napi[i].irq_vec, &tp->napi[i]);
6955} 6970}
@@ -16367,6 +16382,7 @@ static int tg3_init_one(struct pci_dev *pdev,
16367 tp->pm_cap = pm_cap; 16382 tp->pm_cap = pm_cap;
16368 tp->rx_mode = TG3_DEF_RX_MODE; 16383 tp->rx_mode = TG3_DEF_RX_MODE;
16369 tp->tx_mode = TG3_DEF_TX_MODE; 16384 tp->tx_mode = TG3_DEF_TX_MODE;
16385 tp->irq_sync = 1;
16370 16386
16371 if (tg3_debug > 0) 16387 if (tg3_debug > 0)
16372 tp->msg_enable = tg3_debug; 16388 tp->msg_enable = tg3_debug;
diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c
index b407043ce9b0..f7f02900f650 100644
--- a/drivers/net/ethernet/calxeda/xgmac.c
+++ b/drivers/net/ethernet/calxeda/xgmac.c
@@ -548,6 +548,10 @@ static int desc_get_rx_status(struct xgmac_priv *priv, struct xgmac_dma_desc *p)
548 return -1; 548 return -1;
549 } 549 }
550 550
551 /* All frames should fit into a single buffer */
552 if (!(status & RXDESC_FIRST_SEG) || !(status & RXDESC_LAST_SEG))
553 return -1;
554
551 /* Check if packet has checksum already */ 555 /* Check if packet has checksum already */
552 if ((status & RXDESC_FRAME_TYPE) && (status & RXDESC_EXT_STATUS) && 556 if ((status & RXDESC_FRAME_TYPE) && (status & RXDESC_EXT_STATUS) &&
553 !(ext_status & RXDESC_IP_PAYLOAD_MASK)) 557 !(ext_status & RXDESC_IP_PAYLOAD_MASK))
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index f0718e1a8369..c306df7d4568 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -1994,9 +1994,20 @@ static int set_coalesce(struct net_device *dev, struct ethtool_coalesce *c)
1994{ 1994{
1995 const struct port_info *pi = netdev_priv(dev); 1995 const struct port_info *pi = netdev_priv(dev);
1996 struct adapter *adap = pi->adapter; 1996 struct adapter *adap = pi->adapter;
1997 1997 struct sge_rspq *q;
1998 return set_rxq_intr_params(adap, &adap->sge.ethrxq[pi->first_qset].rspq, 1998 int i;
1999 c->rx_coalesce_usecs, c->rx_max_coalesced_frames); 1999 int r = 0;
2000
2001 for (i = pi->first_qset; i < pi->first_qset + pi->nqsets; i++) {
2002 q = &adap->sge.ethrxq[i].rspq;
2003 r = set_rxq_intr_params(adap, q, c->rx_coalesce_usecs,
2004 c->rx_max_coalesced_frames);
2005 if (r) {
2006 dev_err(&dev->dev, "failed to set coalesce %d\n", r);
2007 break;
2008 }
2009 }
2010 return r;
2000} 2011}
2001 2012
2002static int get_coalesce(struct net_device *dev, struct ethtool_coalesce *c) 2013static int get_coalesce(struct net_device *dev, struct ethtool_coalesce *c)
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h
index 3bc1912afba9..4eba17b83ba8 100644
--- a/drivers/net/ethernet/emulex/benet/be.h
+++ b/drivers/net/ethernet/emulex/benet/be.h
@@ -190,6 +190,7 @@ struct be_eq_obj {
190 190
191 u8 idx; /* array index */ 191 u8 idx; /* array index */
192 u16 tx_budget; 192 u16 tx_budget;
193 u16 spurious_intr;
193 struct napi_struct napi; 194 struct napi_struct napi;
194 struct be_adapter *adapter; 195 struct be_adapter *adapter;
195} ____cacheline_aligned_in_smp; 196} ____cacheline_aligned_in_smp;
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 9dca22be8125..5c995700e534 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -2026,19 +2026,30 @@ static irqreturn_t be_intx(int irq, void *dev)
2026 struct be_adapter *adapter = eqo->adapter; 2026 struct be_adapter *adapter = eqo->adapter;
2027 int num_evts = 0; 2027 int num_evts = 0;
2028 2028
2029 /* On Lancer, clear-intr bit of the EQ DB does not work. 2029 /* IRQ is not expected when NAPI is scheduled as the EQ
2030 * INTx is de-asserted only on notifying num evts. 2030 * will not be armed.
2031 * But, this can happen on Lancer INTx where it takes
2032 * a while to de-assert INTx or in BE2 where occasionaly
2033 * an interrupt may be raised even when EQ is unarmed.
2034 * If NAPI is already scheduled, then counting & notifying
2035 * events will orphan them.
2031 */ 2036 */
2032 if (lancer_chip(adapter)) 2037 if (napi_schedule_prep(&eqo->napi)) {
2033 num_evts = events_get(eqo); 2038 num_evts = events_get(eqo);
2039 __napi_schedule(&eqo->napi);
2040 if (num_evts)
2041 eqo->spurious_intr = 0;
2042 }
2043 be_eq_notify(adapter, eqo->q.id, false, true, num_evts);
2034 2044
2035 /* The EQ-notify may not de-assert INTx rightaway, causing 2045 /* Return IRQ_HANDLED only for the the first spurious intr
2036 * the ISR to be invoked again. So, return HANDLED even when 2046 * after a valid intr to stop the kernel from branding
2037 * num_evts is zero. 2047 * this irq as a bad one!
2038 */ 2048 */
2039 be_eq_notify(adapter, eqo->q.id, false, true, num_evts); 2049 if (num_evts || eqo->spurious_intr++ == 0)
2040 napi_schedule(&eqo->napi); 2050 return IRQ_HANDLED;
2041 return IRQ_HANDLED; 2051 else
2052 return IRQ_NONE;
2042} 2053}
2043 2054
2044static irqreturn_t be_msix(int irq, void *dev) 2055static irqreturn_t be_msix(int irq, void *dev)
diff --git a/drivers/net/ethernet/intel/ixgbe/Makefile b/drivers/net/ethernet/intel/ixgbe/Makefile
index f3a632bf8d96..687c83d1bdab 100644
--- a/drivers/net/ethernet/intel/ixgbe/Makefile
+++ b/drivers/net/ethernet/intel/ixgbe/Makefile
@@ -32,7 +32,7 @@
32 32
33obj-$(CONFIG_IXGBE) += ixgbe.o 33obj-$(CONFIG_IXGBE) += ixgbe.o
34 34
35ixgbe-objs := ixgbe_main.o ixgbe_common.o ixgbe_ethtool.o ixgbe_debugfs.o\ 35ixgbe-objs := ixgbe_main.o ixgbe_common.o ixgbe_ethtool.o \
36 ixgbe_82599.o ixgbe_82598.o ixgbe_phy.o ixgbe_sriov.o \ 36 ixgbe_82599.o ixgbe_82598.o ixgbe_phy.o ixgbe_sriov.o \
37 ixgbe_mbx.o ixgbe_x540.o ixgbe_lib.o ixgbe_ptp.o 37 ixgbe_mbx.o ixgbe_x540.o ixgbe_lib.o ixgbe_ptp.o
38 38
@@ -40,4 +40,5 @@ ixgbe-$(CONFIG_IXGBE_DCB) += ixgbe_dcb.o ixgbe_dcb_82598.o \
40 ixgbe_dcb_82599.o ixgbe_dcb_nl.o 40 ixgbe_dcb_82599.o ixgbe_dcb_nl.o
41 41
42ixgbe-$(CONFIG_IXGBE_HWMON) += ixgbe_sysfs.o 42ixgbe-$(CONFIG_IXGBE_HWMON) += ixgbe_sysfs.o
43ixgbe-$(CONFIG_DEBUG_FS) += ixgbe_debugfs.o
43ixgbe-$(CONFIG_FCOE:m=y) += ixgbe_fcoe.o 44ixgbe-$(CONFIG_FCOE:m=y) += ixgbe_fcoe.o
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_debugfs.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_debugfs.c
index 50aa546b8c7a..3504686d3af5 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_debugfs.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_debugfs.c
@@ -24,9 +24,6 @@
24 Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 24 Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
25 25
26*******************************************************************************/ 26*******************************************************************************/
27
28#ifdef CONFIG_DEBUG_FS
29
30#include <linux/debugfs.h> 27#include <linux/debugfs.h>
31#include <linux/module.h> 28#include <linux/module.h>
32 29
@@ -277,5 +274,3 @@ void ixgbe_dbg_exit(void)
277{ 274{
278 debugfs_remove_recursive(ixgbe_dbg_root); 275 debugfs_remove_recursive(ixgbe_dbg_root);
279} 276}
280
281#endif /* CONFIG_DEBUG_FS */
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
index 1a751c9d09c4..bb9256a1b0a9 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
@@ -660,11 +660,11 @@ int ixgbe_ptp_hwtstamp_ioctl(struct ixgbe_adapter *adapter,
660 break; 660 break;
661 case HWTSTAMP_FILTER_PTP_V1_L4_SYNC: 661 case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
662 tsync_rx_ctl |= IXGBE_TSYNCRXCTL_TYPE_L4_V1; 662 tsync_rx_ctl |= IXGBE_TSYNCRXCTL_TYPE_L4_V1;
663 tsync_rx_mtrl = IXGBE_RXMTRL_V1_SYNC_MSG; 663 tsync_rx_mtrl |= IXGBE_RXMTRL_V1_SYNC_MSG;
664 break; 664 break;
665 case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ: 665 case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
666 tsync_rx_ctl |= IXGBE_TSYNCRXCTL_TYPE_L4_V1; 666 tsync_rx_ctl |= IXGBE_TSYNCRXCTL_TYPE_L4_V1;
667 tsync_rx_mtrl = IXGBE_RXMTRL_V1_DELAY_REQ_MSG; 667 tsync_rx_mtrl |= IXGBE_RXMTRL_V1_DELAY_REQ_MSG;
668 break; 668 break;
669 case HWTSTAMP_FILTER_PTP_V2_EVENT: 669 case HWTSTAMP_FILTER_PTP_V2_EVENT:
670 case HWTSTAMP_FILTER_PTP_V2_L2_EVENT: 670 case HWTSTAMP_FILTER_PTP_V2_L2_EVENT:
diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
index 6d6002bab060..74f1c157a480 100644
--- a/drivers/net/ethernet/marvell/mvmdio.c
+++ b/drivers/net/ethernet/marvell/mvmdio.c
@@ -141,7 +141,7 @@ static int orion_mdio_reset(struct mii_bus *bus)
141 return 0; 141 return 0;
142} 142}
143 143
144static int __devinit orion_mdio_probe(struct platform_device *pdev) 144static int orion_mdio_probe(struct platform_device *pdev)
145{ 145{
146 struct device_node *np = pdev->dev.of_node; 146 struct device_node *np = pdev->dev.of_node;
147 struct mii_bus *bus; 147 struct mii_bus *bus;
@@ -197,7 +197,7 @@ static int __devinit orion_mdio_probe(struct platform_device *pdev)
197 return 0; 197 return 0;
198} 198}
199 199
200static int __devexit orion_mdio_remove(struct platform_device *pdev) 200static int orion_mdio_remove(struct platform_device *pdev)
201{ 201{
202 struct mii_bus *bus = platform_get_drvdata(pdev); 202 struct mii_bus *bus = platform_get_drvdata(pdev);
203 mdiobus_unregister(bus); 203 mdiobus_unregister(bus);
@@ -214,7 +214,7 @@ MODULE_DEVICE_TABLE(of, orion_mdio_match);
214 214
215static struct platform_driver orion_mdio_driver = { 215static struct platform_driver orion_mdio_driver = {
216 .probe = orion_mdio_probe, 216 .probe = orion_mdio_probe,
217 .remove = __devexit_p(orion_mdio_remove), 217 .remove = orion_mdio_remove,
218 .driver = { 218 .driver = {
219 .name = "orion-mdio", 219 .name = "orion-mdio",
220 .of_match_table = orion_mdio_match, 220 .of_match_table = orion_mdio_match,
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 3f8086b9f5e5..b6025c305e10 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -635,7 +635,7 @@ static void mvneta_rxq_bm_disable(struct mvneta_port *pp,
635 635
636 636
637/* Sets the RGMII Enable bit (RGMIIEn) in port MAC control register */ 637/* Sets the RGMII Enable bit (RGMIIEn) in port MAC control register */
638static void __devinit mvneta_gmac_rgmii_set(struct mvneta_port *pp, int enable) 638static void mvneta_gmac_rgmii_set(struct mvneta_port *pp, int enable)
639{ 639{
640 u32 val; 640 u32 val;
641 641
@@ -650,7 +650,7 @@ static void __devinit mvneta_gmac_rgmii_set(struct mvneta_port *pp, int enable)
650} 650}
651 651
652/* Config SGMII port */ 652/* Config SGMII port */
653static void __devinit mvneta_port_sgmii_config(struct mvneta_port *pp) 653static void mvneta_port_sgmii_config(struct mvneta_port *pp)
654{ 654{
655 u32 val; 655 u32 val;
656 656
@@ -2564,7 +2564,7 @@ const struct ethtool_ops mvneta_eth_tool_ops = {
2564}; 2564};
2565 2565
2566/* Initialize hw */ 2566/* Initialize hw */
2567static int __devinit mvneta_init(struct mvneta_port *pp, int phy_addr) 2567static int mvneta_init(struct mvneta_port *pp, int phy_addr)
2568{ 2568{
2569 int queue; 2569 int queue;
2570 2570
@@ -2613,9 +2613,8 @@ static void mvneta_deinit(struct mvneta_port *pp)
2613} 2613}
2614 2614
2615/* platform glue : initialize decoding windows */ 2615/* platform glue : initialize decoding windows */
2616static void __devinit 2616static void mvneta_conf_mbus_windows(struct mvneta_port *pp,
2617mvneta_conf_mbus_windows(struct mvneta_port *pp, 2617 const struct mbus_dram_target_info *dram)
2618 const struct mbus_dram_target_info *dram)
2619{ 2618{
2620 u32 win_enable; 2619 u32 win_enable;
2621 u32 win_protect; 2620 u32 win_protect;
@@ -2648,7 +2647,7 @@ mvneta_conf_mbus_windows(struct mvneta_port *pp,
2648} 2647}
2649 2648
2650/* Power up the port */ 2649/* Power up the port */
2651static void __devinit mvneta_port_power_up(struct mvneta_port *pp, int phy_mode) 2650static void mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)
2652{ 2651{
2653 u32 val; 2652 u32 val;
2654 2653
@@ -2671,7 +2670,7 @@ static void __devinit mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)
2671} 2670}
2672 2671
2673/* Device initialization routine */ 2672/* Device initialization routine */
2674static int __devinit mvneta_probe(struct platform_device *pdev) 2673static int mvneta_probe(struct platform_device *pdev)
2675{ 2674{
2676 const struct mbus_dram_target_info *dram_target_info; 2675 const struct mbus_dram_target_info *dram_target_info;
2677 struct device_node *dn = pdev->dev.of_node; 2676 struct device_node *dn = pdev->dev.of_node;
@@ -2803,7 +2802,7 @@ err_free_netdev:
2803} 2802}
2804 2803
2805/* Device removal routine */ 2804/* Device removal routine */
2806static int __devexit mvneta_remove(struct platform_device *pdev) 2805static int mvneta_remove(struct platform_device *pdev)
2807{ 2806{
2808 struct net_device *dev = platform_get_drvdata(pdev); 2807 struct net_device *dev = platform_get_drvdata(pdev);
2809 struct mvneta_port *pp = netdev_priv(dev); 2808 struct mvneta_port *pp = netdev_priv(dev);
@@ -2828,7 +2827,7 @@ MODULE_DEVICE_TABLE(of, mvneta_match);
2828 2827
2829static struct platform_driver mvneta_driver = { 2828static struct platform_driver mvneta_driver = {
2830 .probe = mvneta_probe, 2829 .probe = mvneta_probe,
2831 .remove = __devexit_p(mvneta_remove), 2830 .remove = mvneta_remove,
2832 .driver = { 2831 .driver = {
2833 .name = MVNETA_DRIVER_NAME, 2832 .name = MVNETA_DRIVER_NAME,
2834 .of_match_table = mvneta_match, 2833 .of_match_table = mvneta_match,
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
index 2b799f4f1c37..6771b69f40d5 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
@@ -630,10 +630,15 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
630 ring->tx_csum++; 630 ring->tx_csum++;
631 } 631 }
632 632
633 /* Copy dst mac address to wqe */ 633 if (mlx4_is_mfunc(mdev->dev) || priv->validate_loopback) {
634 ethh = (struct ethhdr *)skb->data; 634 /* Copy dst mac address to wqe. This allows loopback in eSwitch,
635 tx_desc->ctrl.srcrb_flags16[0] = get_unaligned((__be16 *)ethh->h_dest); 635 * so that VFs and PF can communicate with each other
636 tx_desc->ctrl.imm = get_unaligned((__be32 *)(ethh->h_dest + 2)); 636 */
637 ethh = (struct ethhdr *)skb->data;
638 tx_desc->ctrl.srcrb_flags16[0] = get_unaligned((__be16 *)ethh->h_dest);
639 tx_desc->ctrl.imm = get_unaligned((__be32 *)(ethh->h_dest + 2));
640 }
641
637 /* Handle LSO (TSO) packets */ 642 /* Handle LSO (TSO) packets */
638 if (lso_header_size) { 643 if (lso_header_size) {
639 /* Mark opcode as LSO */ 644 /* Mark opcode as LSO */
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index e1bafffbc3b1..a6542d75374c 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -1790,15 +1790,8 @@ static void mlx4_enable_msi_x(struct mlx4_dev *dev)
1790 int i; 1790 int i;
1791 1791
1792 if (msi_x) { 1792 if (msi_x) {
1793 /* In multifunction mode each function gets 2 msi-X vectors 1793 nreq = min_t(int, dev->caps.num_eqs - dev->caps.reserved_eqs,
1794 * one for data path completions anf the other for asynch events 1794 nreq);
1795 * or command completions */
1796 if (mlx4_is_mfunc(dev)) {
1797 nreq = 2;
1798 } else {
1799 nreq = min_t(int, dev->caps.num_eqs -
1800 dev->caps.reserved_eqs, nreq);
1801 }
1802 1795
1803 entries = kcalloc(nreq, sizeof *entries, GFP_KERNEL); 1796 entries = kcalloc(nreq, sizeof *entries, GFP_KERNEL);
1804 if (!entries) 1797 if (!entries)
diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c
index 653487dc7b52..87fa5919c455 100644
--- a/drivers/net/ethernet/nvidia/forcedeth.c
+++ b/drivers/net/ethernet/nvidia/forcedeth.c
@@ -1821,6 +1821,11 @@ static int nv_alloc_rx(struct net_device *dev)
1821 skb->data, 1821 skb->data,
1822 skb_tailroom(skb), 1822 skb_tailroom(skb),
1823 PCI_DMA_FROMDEVICE); 1823 PCI_DMA_FROMDEVICE);
1824 if (pci_dma_mapping_error(np->pci_dev,
1825 np->put_rx_ctx->dma)) {
1826 kfree_skb(skb);
1827 goto packet_dropped;
1828 }
1824 np->put_rx_ctx->dma_len = skb_tailroom(skb); 1829 np->put_rx_ctx->dma_len = skb_tailroom(skb);
1825 np->put_rx.orig->buf = cpu_to_le32(np->put_rx_ctx->dma); 1830 np->put_rx.orig->buf = cpu_to_le32(np->put_rx_ctx->dma);
1826 wmb(); 1831 wmb();
@@ -1830,6 +1835,7 @@ static int nv_alloc_rx(struct net_device *dev)
1830 if (unlikely(np->put_rx_ctx++ == np->last_rx_ctx)) 1835 if (unlikely(np->put_rx_ctx++ == np->last_rx_ctx))
1831 np->put_rx_ctx = np->first_rx_ctx; 1836 np->put_rx_ctx = np->first_rx_ctx;
1832 } else { 1837 } else {
1838packet_dropped:
1833 u64_stats_update_begin(&np->swstats_rx_syncp); 1839 u64_stats_update_begin(&np->swstats_rx_syncp);
1834 np->stat_rx_dropped++; 1840 np->stat_rx_dropped++;
1835 u64_stats_update_end(&np->swstats_rx_syncp); 1841 u64_stats_update_end(&np->swstats_rx_syncp);
@@ -1856,6 +1862,11 @@ static int nv_alloc_rx_optimized(struct net_device *dev)
1856 skb->data, 1862 skb->data,
1857 skb_tailroom(skb), 1863 skb_tailroom(skb),
1858 PCI_DMA_FROMDEVICE); 1864 PCI_DMA_FROMDEVICE);
1865 if (pci_dma_mapping_error(np->pci_dev,
1866 np->put_rx_ctx->dma)) {
1867 kfree_skb(skb);
1868 goto packet_dropped;
1869 }
1859 np->put_rx_ctx->dma_len = skb_tailroom(skb); 1870 np->put_rx_ctx->dma_len = skb_tailroom(skb);
1860 np->put_rx.ex->bufhigh = cpu_to_le32(dma_high(np->put_rx_ctx->dma)); 1871 np->put_rx.ex->bufhigh = cpu_to_le32(dma_high(np->put_rx_ctx->dma));
1861 np->put_rx.ex->buflow = cpu_to_le32(dma_low(np->put_rx_ctx->dma)); 1872 np->put_rx.ex->buflow = cpu_to_le32(dma_low(np->put_rx_ctx->dma));
@@ -1866,6 +1877,7 @@ static int nv_alloc_rx_optimized(struct net_device *dev)
1866 if (unlikely(np->put_rx_ctx++ == np->last_rx_ctx)) 1877 if (unlikely(np->put_rx_ctx++ == np->last_rx_ctx))
1867 np->put_rx_ctx = np->first_rx_ctx; 1878 np->put_rx_ctx = np->first_rx_ctx;
1868 } else { 1879 } else {
1880packet_dropped:
1869 u64_stats_update_begin(&np->swstats_rx_syncp); 1881 u64_stats_update_begin(&np->swstats_rx_syncp);
1870 np->stat_rx_dropped++; 1882 np->stat_rx_dropped++;
1871 u64_stats_update_end(&np->swstats_rx_syncp); 1883 u64_stats_update_end(&np->swstats_rx_syncp);
@@ -2217,6 +2229,15 @@ static netdev_tx_t nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
2217 bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size; 2229 bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size;
2218 np->put_tx_ctx->dma = pci_map_single(np->pci_dev, skb->data + offset, bcnt, 2230 np->put_tx_ctx->dma = pci_map_single(np->pci_dev, skb->data + offset, bcnt,
2219 PCI_DMA_TODEVICE); 2231 PCI_DMA_TODEVICE);
2232 if (pci_dma_mapping_error(np->pci_dev,
2233 np->put_tx_ctx->dma)) {
2234 /* on DMA mapping error - drop the packet */
2235 kfree_skb(skb);
2236 u64_stats_update_begin(&np->swstats_tx_syncp);
2237 np->stat_tx_dropped++;
2238 u64_stats_update_end(&np->swstats_tx_syncp);
2239 return NETDEV_TX_OK;
2240 }
2220 np->put_tx_ctx->dma_len = bcnt; 2241 np->put_tx_ctx->dma_len = bcnt;
2221 np->put_tx_ctx->dma_single = 1; 2242 np->put_tx_ctx->dma_single = 1;
2222 put_tx->buf = cpu_to_le32(np->put_tx_ctx->dma); 2243 put_tx->buf = cpu_to_le32(np->put_tx_ctx->dma);
@@ -2337,6 +2358,15 @@ static netdev_tx_t nv_start_xmit_optimized(struct sk_buff *skb,
2337 bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size; 2358 bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size;
2338 np->put_tx_ctx->dma = pci_map_single(np->pci_dev, skb->data + offset, bcnt, 2359 np->put_tx_ctx->dma = pci_map_single(np->pci_dev, skb->data + offset, bcnt,
2339 PCI_DMA_TODEVICE); 2360 PCI_DMA_TODEVICE);
2361 if (pci_dma_mapping_error(np->pci_dev,
2362 np->put_tx_ctx->dma)) {
2363 /* on DMA mapping error - drop the packet */
2364 kfree_skb(skb);
2365 u64_stats_update_begin(&np->swstats_tx_syncp);
2366 np->stat_tx_dropped++;
2367 u64_stats_update_end(&np->swstats_tx_syncp);
2368 return NETDEV_TX_OK;
2369 }
2340 np->put_tx_ctx->dma_len = bcnt; 2370 np->put_tx_ctx->dma_len = bcnt;
2341 np->put_tx_ctx->dma_single = 1; 2371 np->put_tx_ctx->dma_single = 1;
2342 put_tx->bufhigh = cpu_to_le32(dma_high(np->put_tx_ctx->dma)); 2372 put_tx->bufhigh = cpu_to_le32(dma_high(np->put_tx_ctx->dma));
@@ -5003,6 +5033,11 @@ static int nv_loopback_test(struct net_device *dev)
5003 test_dma_addr = pci_map_single(np->pci_dev, tx_skb->data, 5033 test_dma_addr = pci_map_single(np->pci_dev, tx_skb->data,
5004 skb_tailroom(tx_skb), 5034 skb_tailroom(tx_skb),
5005 PCI_DMA_FROMDEVICE); 5035 PCI_DMA_FROMDEVICE);
5036 if (pci_dma_mapping_error(np->pci_dev,
5037 test_dma_addr)) {
5038 dev_kfree_skb_any(tx_skb);
5039 goto out;
5040 }
5006 pkt_data = skb_put(tx_skb, pkt_len); 5041 pkt_data = skb_put(tx_skb, pkt_len);
5007 for (i = 0; i < pkt_len; i++) 5042 for (i = 0; i < pkt_len; i++)
5008 pkt_data[i] = (u8)(i & 0xff); 5043 pkt_data[i] = (u8)(i & 0xff);
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
index bc165f4d0f65..695667d471a1 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
@@ -144,7 +144,7 @@ void netxen_release_tx_buffers(struct netxen_adapter *adapter)
144 buffrag->length, PCI_DMA_TODEVICE); 144 buffrag->length, PCI_DMA_TODEVICE);
145 buffrag->dma = 0ULL; 145 buffrag->dma = 0ULL;
146 } 146 }
147 for (j = 0; j < cmd_buf->frag_count; j++) { 147 for (j = 1; j < cmd_buf->frag_count; j++) {
148 buffrag++; 148 buffrag++;
149 if (buffrag->dma) { 149 if (buffrag->dma) {
150 pci_unmap_page(adapter->pdev, buffrag->dma, 150 pci_unmap_page(adapter->pdev, buffrag->dma,
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
index 6098fd4adfeb..69e321a65077 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
@@ -1963,10 +1963,12 @@ unwind:
1963 while (--i >= 0) { 1963 while (--i >= 0) {
1964 nf = &pbuf->frag_array[i+1]; 1964 nf = &pbuf->frag_array[i+1];
1965 pci_unmap_page(pdev, nf->dma, nf->length, PCI_DMA_TODEVICE); 1965 pci_unmap_page(pdev, nf->dma, nf->length, PCI_DMA_TODEVICE);
1966 nf->dma = 0ULL;
1966 } 1967 }
1967 1968
1968 nf = &pbuf->frag_array[0]; 1969 nf = &pbuf->frag_array[0];
1969 pci_unmap_single(pdev, nf->dma, skb_headlen(skb), PCI_DMA_TODEVICE); 1970 pci_unmap_single(pdev, nf->dma, skb_headlen(skb), PCI_DMA_TODEVICE);
1971 nf->dma = 0ULL;
1970 1972
1971out_err: 1973out_err:
1972 return -ENOMEM; 1974 return -ENOMEM;
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
index f80cd975daed..3e73742024b0 100644
--- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c
+++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
@@ -4678,7 +4678,7 @@ static int qlge_probe(struct pci_dev *pdev,
4678 qdev = netdev_priv(ndev); 4678 qdev = netdev_priv(ndev);
4679 SET_NETDEV_DEV(ndev, &pdev->dev); 4679 SET_NETDEV_DEV(ndev, &pdev->dev);
4680 ndev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | 4680 ndev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM |
4681 NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN | 4681 NETIF_F_TSO | NETIF_F_TSO_ECN |
4682 NETIF_F_HW_VLAN_TX | NETIF_F_RXCSUM; 4682 NETIF_F_HW_VLAN_TX | NETIF_F_RXCSUM;
4683 ndev->features = ndev->hw_features | 4683 ndev->features = ndev->hw_features |
4684 NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER; 4684 NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER;
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index ed96f309bca8..c28bc318cec6 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -6111,13 +6111,6 @@ process_pkt:
6111 tp->rx_stats.bytes += pkt_size; 6111 tp->rx_stats.bytes += pkt_size;
6112 u64_stats_update_end(&tp->rx_stats.syncp); 6112 u64_stats_update_end(&tp->rx_stats.syncp);
6113 } 6113 }
6114
6115 /* Work around for AMD plateform. */
6116 if ((desc->opts2 & cpu_to_le32(0xfffe000)) &&
6117 (tp->mac_version == RTL_GIGA_MAC_VER_05)) {
6118 desc->opts2 = 0;
6119 cur_rx++;
6120 }
6121 } 6114 }
6122 6115
6123 count = cur_rx - tp->cur_rx; 6116 count = cur_rx - tp->cur_rx;
diff --git a/drivers/net/ethernet/ti/cpts.c b/drivers/net/ethernet/ti/cpts.c
index 5e62c1aeeffb..463597f919f1 100644
--- a/drivers/net/ethernet/ti/cpts.c
+++ b/drivers/net/ethernet/ti/cpts.c
@@ -247,8 +247,7 @@ static void cpts_clk_init(struct cpts *cpts)
247 cpts->refclk = NULL; 247 cpts->refclk = NULL;
248 return; 248 return;
249 } 249 }
250 clk_enable(cpts->refclk); 250 clk_prepare_enable(cpts->refclk);
251 cpts->freq = cpts->refclk->recalc(cpts->refclk);
252} 251}
253 252
254static void cpts_clk_release(struct cpts *cpts) 253static void cpts_clk_release(struct cpts *cpts)
diff --git a/drivers/net/ethernet/ti/cpts.h b/drivers/net/ethernet/ti/cpts.h
index e1bba3a496b2..fe993cdd7e23 100644
--- a/drivers/net/ethernet/ti/cpts.h
+++ b/drivers/net/ethernet/ti/cpts.h
@@ -120,7 +120,6 @@ struct cpts {
120 struct delayed_work overflow_work; 120 struct delayed_work overflow_work;
121 int phc_index; 121 int phc_index;
122 struct clk *refclk; 122 struct clk *refclk;
123 unsigned long freq;
124 struct list_head events; 123 struct list_head events;
125 struct list_head pool; 124 struct list_head pool;
126 struct cpts_event pool_data[CPTS_MAX_EVENTS]; 125 struct cpts_event pool_data[CPTS_MAX_EVENTS];
diff --git a/drivers/net/ethernet/xilinx/Kconfig b/drivers/net/ethernet/xilinx/Kconfig
index 5778a4ae1164..122d60c0481b 100644
--- a/drivers/net/ethernet/xilinx/Kconfig
+++ b/drivers/net/ethernet/xilinx/Kconfig
@@ -27,7 +27,7 @@ config XILINX_EMACLITE
27 27
28config XILINX_AXI_EMAC 28config XILINX_AXI_EMAC
29 tristate "Xilinx 10/100/1000 AXI Ethernet support" 29 tristate "Xilinx 10/100/1000 AXI Ethernet support"
30 depends on (PPC32 || MICROBLAZE) 30 depends on MICROBLAZE
31 select PHYLIB 31 select PHYLIB
32 ---help--- 32 ---help---
33 This driver supports the 10/100/1000 Ethernet from Xilinx for the 33 This driver supports the 10/100/1000 Ethernet from Xilinx for the
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index d9f69b82cc4f..6f47100e58d7 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -1590,7 +1590,7 @@ static int axienet_of_probe(struct platform_device *op)
1590 lp->rx_irq = irq_of_parse_and_map(np, 1); 1590 lp->rx_irq = irq_of_parse_and_map(np, 1);
1591 lp->tx_irq = irq_of_parse_and_map(np, 0); 1591 lp->tx_irq = irq_of_parse_and_map(np, 0);
1592 of_node_put(np); 1592 of_node_put(np);
1593 if ((lp->rx_irq == NO_IRQ) || (lp->tx_irq == NO_IRQ)) { 1593 if ((lp->rx_irq <= 0) || (lp->tx_irq <= 0)) {
1594 dev_err(&op->dev, "could not determine irqs\n"); 1594 dev_err(&op->dev, "could not determine irqs\n");
1595 ret = -ENOMEM; 1595 ret = -ENOMEM;
1596 goto err_iounmap_2; 1596 goto err_iounmap_2;
diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
index 5fd6f4674326..e6fe0d80d612 100644
--- a/drivers/net/hyperv/hyperv_net.h
+++ b/drivers/net/hyperv/hyperv_net.h
@@ -84,7 +84,7 @@ struct hv_netvsc_packet {
84}; 84};
85 85
86struct netvsc_device_info { 86struct netvsc_device_info {
87 unsigned char mac_adr[6]; 87 unsigned char mac_adr[ETH_ALEN];
88 bool link_state; /* 0 - link up, 1 - link down */ 88 bool link_state; /* 0 - link up, 1 - link down */
89 int ring_size; 89 int ring_size;
90}; 90};
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index f825a629a699..8264f0ef7692 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -349,7 +349,7 @@ static int netvsc_set_mac_addr(struct net_device *ndev, void *p)
349 struct net_device_context *ndevctx = netdev_priv(ndev); 349 struct net_device_context *ndevctx = netdev_priv(ndev);
350 struct hv_device *hdev = ndevctx->device_ctx; 350 struct hv_device *hdev = ndevctx->device_ctx;
351 struct sockaddr *addr = p; 351 struct sockaddr *addr = p;
352 char save_adr[14]; 352 char save_adr[ETH_ALEN];
353 unsigned char save_aatype; 353 unsigned char save_aatype;
354 int err; 354 int err;
355 355
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 68a43fe602e7..d3fb97d97cbc 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -822,7 +822,10 @@ static int macvlan_changelink(struct net_device *dev,
822 822
823static size_t macvlan_get_size(const struct net_device *dev) 823static size_t macvlan_get_size(const struct net_device *dev)
824{ 824{
825 return nla_total_size(4); 825 return (0
826 + nla_total_size(4) /* IFLA_MACVLAN_MODE */
827 + nla_total_size(2) /* IFLA_MACVLAN_FLAGS */
828 );
826} 829}
827 830
828static int macvlan_fill_info(struct sk_buff *skb, 831static int macvlan_fill_info(struct sk_buff *skb,
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 5d2a3f215887..22dec9c7ef05 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -353,15 +353,6 @@ static int m88e1111_config_init(struct phy_device *phydev)
353 int err; 353 int err;
354 int temp; 354 int temp;
355 355
356 /* Enable Fiber/Copper auto selection */
357 temp = phy_read(phydev, MII_M1111_PHY_EXT_SR);
358 temp &= ~MII_M1111_HWCFG_FIBER_COPPER_AUTO;
359 phy_write(phydev, MII_M1111_PHY_EXT_SR, temp);
360
361 temp = phy_read(phydev, MII_BMCR);
362 temp |= BMCR_RESET;
363 phy_write(phydev, MII_BMCR, temp);
364
365 if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) || 356 if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) ||
366 (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) || 357 (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) ||
367 (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) || 358 (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) ||
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 504f7f1cad94..cc09b67c23bc 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -109,11 +109,11 @@ struct tap_filter {
109 unsigned char addr[FLT_EXACT_COUNT][ETH_ALEN]; 109 unsigned char addr[FLT_EXACT_COUNT][ETH_ALEN];
110}; 110};
111 111
112/* 1024 is probably a high enough limit: modern hypervisors seem to support on 112/* DEFAULT_MAX_NUM_RSS_QUEUES were choosed to let the rx/tx queues allocated for
113 * the order of 100-200 CPUs so this leaves us some breathing space if we want 113 * the netdevice to be fit in one page. So we can make sure the success of
114 * to match a queue per guest CPU. 114 * memory allocation. TODO: increase the limit. */
115 */ 115#define MAX_TAP_QUEUES DEFAULT_MAX_NUM_RSS_QUEUES
116#define MAX_TAP_QUEUES 1024 116#define MAX_TAP_FLOWS 4096
117 117
118#define TUN_FLOW_EXPIRE (3 * HZ) 118#define TUN_FLOW_EXPIRE (3 * HZ)
119 119
@@ -180,12 +180,13 @@ struct tun_struct {
180 int debug; 180 int debug;
181#endif 181#endif
182 spinlock_t lock; 182 spinlock_t lock;
183 struct kmem_cache *flow_cache;
184 struct hlist_head flows[TUN_NUM_FLOW_ENTRIES]; 183 struct hlist_head flows[TUN_NUM_FLOW_ENTRIES];
185 struct timer_list flow_gc_timer; 184 struct timer_list flow_gc_timer;
186 unsigned long ageing_time; 185 unsigned long ageing_time;
187 unsigned int numdisabled; 186 unsigned int numdisabled;
188 struct list_head disabled; 187 struct list_head disabled;
188 void *security;
189 u32 flow_count;
189}; 190};
190 191
191static inline u32 tun_hashfn(u32 rxhash) 192static inline u32 tun_hashfn(u32 rxhash)
@@ -209,8 +210,8 @@ static struct tun_flow_entry *tun_flow_create(struct tun_struct *tun,
209 struct hlist_head *head, 210 struct hlist_head *head,
210 u32 rxhash, u16 queue_index) 211 u32 rxhash, u16 queue_index)
211{ 212{
212 struct tun_flow_entry *e = kmem_cache_alloc(tun->flow_cache, 213 struct tun_flow_entry *e = kmalloc(sizeof(*e), GFP_ATOMIC);
213 GFP_ATOMIC); 214
214 if (e) { 215 if (e) {
215 tun_debug(KERN_INFO, tun, "create flow: hash %u index %u\n", 216 tun_debug(KERN_INFO, tun, "create flow: hash %u index %u\n",
216 rxhash, queue_index); 217 rxhash, queue_index);
@@ -219,23 +220,18 @@ static struct tun_flow_entry *tun_flow_create(struct tun_struct *tun,
219 e->queue_index = queue_index; 220 e->queue_index = queue_index;
220 e->tun = tun; 221 e->tun = tun;
221 hlist_add_head_rcu(&e->hash_link, head); 222 hlist_add_head_rcu(&e->hash_link, head);
223 ++tun->flow_count;
222 } 224 }
223 return e; 225 return e;
224} 226}
225 227
226static void tun_flow_free(struct rcu_head *head)
227{
228 struct tun_flow_entry *e
229 = container_of(head, struct tun_flow_entry, rcu);
230 kmem_cache_free(e->tun->flow_cache, e);
231}
232
233static void tun_flow_delete(struct tun_struct *tun, struct tun_flow_entry *e) 228static void tun_flow_delete(struct tun_struct *tun, struct tun_flow_entry *e)
234{ 229{
235 tun_debug(KERN_INFO, tun, "delete flow: hash %u index %u\n", 230 tun_debug(KERN_INFO, tun, "delete flow: hash %u index %u\n",
236 e->rxhash, e->queue_index); 231 e->rxhash, e->queue_index);
237 hlist_del_rcu(&e->hash_link); 232 hlist_del_rcu(&e->hash_link);
238 call_rcu(&e->rcu, tun_flow_free); 233 kfree_rcu(e, rcu);
234 --tun->flow_count;
239} 235}
240 236
241static void tun_flow_flush(struct tun_struct *tun) 237static void tun_flow_flush(struct tun_struct *tun)
@@ -325,7 +321,8 @@ static void tun_flow_update(struct tun_struct *tun, u32 rxhash,
325 e->updated = jiffies; 321 e->updated = jiffies;
326 } else { 322 } else {
327 spin_lock_bh(&tun->lock); 323 spin_lock_bh(&tun->lock);
328 if (!tun_flow_find(head, rxhash)) 324 if (!tun_flow_find(head, rxhash) &&
325 tun->flow_count < MAX_TAP_FLOWS)
329 tun_flow_create(tun, head, rxhash, queue_index); 326 tun_flow_create(tun, head, rxhash, queue_index);
330 327
331 if (!timer_pending(&tun->flow_gc_timer)) 328 if (!timer_pending(&tun->flow_gc_timer))
@@ -412,8 +409,8 @@ static void __tun_detach(struct tun_file *tfile, bool clean)
412 struct tun_struct *tun; 409 struct tun_struct *tun;
413 struct net_device *dev; 410 struct net_device *dev;
414 411
415 tun = rcu_dereference_protected(tfile->tun, 412 tun = rtnl_dereference(tfile->tun);
416 lockdep_rtnl_is_held()); 413
417 if (tun) { 414 if (tun) {
418 u16 index = tfile->queue_index; 415 u16 index = tfile->queue_index;
419 BUG_ON(index >= tun->numqueues); 416 BUG_ON(index >= tun->numqueues);
@@ -422,8 +419,7 @@ static void __tun_detach(struct tun_file *tfile, bool clean)
422 rcu_assign_pointer(tun->tfiles[index], 419 rcu_assign_pointer(tun->tfiles[index],
423 tun->tfiles[tun->numqueues - 1]); 420 tun->tfiles[tun->numqueues - 1]);
424 rcu_assign_pointer(tfile->tun, NULL); 421 rcu_assign_pointer(tfile->tun, NULL);
425 ntfile = rcu_dereference_protected(tun->tfiles[index], 422 ntfile = rtnl_dereference(tun->tfiles[index]);
426 lockdep_rtnl_is_held());
427 ntfile->queue_index = index; 423 ntfile->queue_index = index;
428 424
429 --tun->numqueues; 425 --tun->numqueues;
@@ -437,8 +433,10 @@ static void __tun_detach(struct tun_file *tfile, bool clean)
437 /* Drop read queue */ 433 /* Drop read queue */
438 skb_queue_purge(&tfile->sk.sk_receive_queue); 434 skb_queue_purge(&tfile->sk.sk_receive_queue);
439 tun_set_real_num_queues(tun); 435 tun_set_real_num_queues(tun);
440 } else if (tfile->detached && clean) 436 } else if (tfile->detached && clean) {
441 tun = tun_enable_queue(tfile); 437 tun = tun_enable_queue(tfile);
438 sock_put(&tfile->sk);
439 }
442 440
443 if (clean) { 441 if (clean) {
444 if (tun && tun->numqueues == 0 && tun->numdisabled == 0 && 442 if (tun && tun->numqueues == 0 && tun->numdisabled == 0 &&
@@ -466,8 +464,7 @@ static void tun_detach_all(struct net_device *dev)
466 int i, n = tun->numqueues; 464 int i, n = tun->numqueues;
467 465
468 for (i = 0; i < n; i++) { 466 for (i = 0; i < n; i++) {
469 tfile = rcu_dereference_protected(tun->tfiles[i], 467 tfile = rtnl_dereference(tun->tfiles[i]);
470 lockdep_rtnl_is_held());
471 BUG_ON(!tfile); 468 BUG_ON(!tfile);
472 wake_up_all(&tfile->wq.wait); 469 wake_up_all(&tfile->wq.wait);
473 rcu_assign_pointer(tfile->tun, NULL); 470 rcu_assign_pointer(tfile->tun, NULL);
@@ -477,8 +474,7 @@ static void tun_detach_all(struct net_device *dev)
477 474
478 synchronize_net(); 475 synchronize_net();
479 for (i = 0; i < n; i++) { 476 for (i = 0; i < n; i++) {
480 tfile = rcu_dereference_protected(tun->tfiles[i], 477 tfile = rtnl_dereference(tun->tfiles[i]);
481 lockdep_rtnl_is_held());
482 /* Drop read queue */ 478 /* Drop read queue */
483 skb_queue_purge(&tfile->sk.sk_receive_queue); 479 skb_queue_purge(&tfile->sk.sk_receive_queue);
484 sock_put(&tfile->sk); 480 sock_put(&tfile->sk);
@@ -489,6 +485,9 @@ static void tun_detach_all(struct net_device *dev)
489 sock_put(&tfile->sk); 485 sock_put(&tfile->sk);
490 } 486 }
491 BUG_ON(tun->numdisabled != 0); 487 BUG_ON(tun->numdisabled != 0);
488
489 if (tun->flags & TUN_PERSIST)
490 module_put(THIS_MODULE);
492} 491}
493 492
494static int tun_attach(struct tun_struct *tun, struct file *file) 493static int tun_attach(struct tun_struct *tun, struct file *file)
@@ -496,8 +495,12 @@ static int tun_attach(struct tun_struct *tun, struct file *file)
496 struct tun_file *tfile = file->private_data; 495 struct tun_file *tfile = file->private_data;
497 int err; 496 int err;
498 497
498 err = security_tun_dev_attach(tfile->socket.sk, tun->security);
499 if (err < 0)
500 goto out;
501
499 err = -EINVAL; 502 err = -EINVAL;
500 if (rcu_dereference_protected(tfile->tun, lockdep_rtnl_is_held())) 503 if (rtnl_dereference(tfile->tun))
501 goto out; 504 goto out;
502 505
503 err = -EBUSY; 506 err = -EBUSY;
@@ -833,12 +836,6 @@ static int tun_flow_init(struct tun_struct *tun)
833{ 836{
834 int i; 837 int i;
835 838
836 tun->flow_cache = kmem_cache_create("tun_flow_cache",
837 sizeof(struct tun_flow_entry), 0, 0,
838 NULL);
839 if (!tun->flow_cache)
840 return -ENOMEM;
841
842 for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++) 839 for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++)
843 INIT_HLIST_HEAD(&tun->flows[i]); 840 INIT_HLIST_HEAD(&tun->flows[i]);
844 841
@@ -854,10 +851,6 @@ static void tun_flow_uninit(struct tun_struct *tun)
854{ 851{
855 del_timer_sync(&tun->flow_gc_timer); 852 del_timer_sync(&tun->flow_gc_timer);
856 tun_flow_flush(tun); 853 tun_flow_flush(tun);
857
858 /* Wait for completion of call_rcu()'s */
859 rcu_barrier();
860 kmem_cache_destroy(tun->flow_cache);
861} 854}
862 855
863/* Initialize net device. */ 856/* Initialize net device. */
@@ -1389,6 +1382,7 @@ static void tun_free_netdev(struct net_device *dev)
1389 1382
1390 BUG_ON(!(list_empty(&tun->disabled))); 1383 BUG_ON(!(list_empty(&tun->disabled)));
1391 tun_flow_uninit(tun); 1384 tun_flow_uninit(tun);
1385 security_tun_dev_free_security(tun->security);
1392 free_netdev(dev); 1386 free_netdev(dev);
1393} 1387}
1394 1388
@@ -1562,6 +1556,9 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
1562 struct net_device *dev; 1556 struct net_device *dev;
1563 int err; 1557 int err;
1564 1558
1559 if (tfile->detached)
1560 return -EINVAL;
1561
1565 dev = __dev_get_by_name(net, ifr->ifr_name); 1562 dev = __dev_get_by_name(net, ifr->ifr_name);
1566 if (dev) { 1563 if (dev) {
1567 if (ifr->ifr_flags & IFF_TUN_EXCL) 1564 if (ifr->ifr_flags & IFF_TUN_EXCL)
@@ -1575,7 +1572,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
1575 1572
1576 if (tun_not_capable(tun)) 1573 if (tun_not_capable(tun))
1577 return -EPERM; 1574 return -EPERM;
1578 err = security_tun_dev_attach(tfile->socket.sk); 1575 err = security_tun_dev_open(tun->security);
1579 if (err < 0) 1576 if (err < 0)
1580 return err; 1577 return err;
1581 1578
@@ -1590,6 +1587,8 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
1590 else { 1587 else {
1591 char *name; 1588 char *name;
1592 unsigned long flags = 0; 1589 unsigned long flags = 0;
1590 int queues = ifr->ifr_flags & IFF_MULTI_QUEUE ?
1591 MAX_TAP_QUEUES : 1;
1593 1592
1594 if (!ns_capable(net->user_ns, CAP_NET_ADMIN)) 1593 if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
1595 return -EPERM; 1594 return -EPERM;
@@ -1613,8 +1612,8 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
1613 name = ifr->ifr_name; 1612 name = ifr->ifr_name;
1614 1613
1615 dev = alloc_netdev_mqs(sizeof(struct tun_struct), name, 1614 dev = alloc_netdev_mqs(sizeof(struct tun_struct), name,
1616 tun_setup, 1615 tun_setup, queues, queues);
1617 MAX_TAP_QUEUES, MAX_TAP_QUEUES); 1616
1618 if (!dev) 1617 if (!dev)
1619 return -ENOMEM; 1618 return -ENOMEM;
1620 1619
@@ -1632,7 +1631,9 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
1632 1631
1633 spin_lock_init(&tun->lock); 1632 spin_lock_init(&tun->lock);
1634 1633
1635 security_tun_dev_post_create(&tfile->sk); 1634 err = security_tun_dev_alloc_security(&tun->security);
1635 if (err < 0)
1636 goto err_free_dev;
1636 1637
1637 tun_net_init(dev); 1638 tun_net_init(dev);
1638 1639
@@ -1756,8 +1757,7 @@ static void tun_detach_filter(struct tun_struct *tun, int n)
1756 struct tun_file *tfile; 1757 struct tun_file *tfile;
1757 1758
1758 for (i = 0; i < n; i++) { 1759 for (i = 0; i < n; i++) {
1759 tfile = rcu_dereference_protected(tun->tfiles[i], 1760 tfile = rtnl_dereference(tun->tfiles[i]);
1760 lockdep_rtnl_is_held());
1761 sk_detach_filter(tfile->socket.sk); 1761 sk_detach_filter(tfile->socket.sk);
1762 } 1762 }
1763 1763
@@ -1770,8 +1770,7 @@ static int tun_attach_filter(struct tun_struct *tun)
1770 struct tun_file *tfile; 1770 struct tun_file *tfile;
1771 1771
1772 for (i = 0; i < tun->numqueues; i++) { 1772 for (i = 0; i < tun->numqueues; i++) {
1773 tfile = rcu_dereference_protected(tun->tfiles[i], 1773 tfile = rtnl_dereference(tun->tfiles[i]);
1774 lockdep_rtnl_is_held());
1775 ret = sk_attach_filter(&tun->fprog, tfile->socket.sk); 1774 ret = sk_attach_filter(&tun->fprog, tfile->socket.sk);
1776 if (ret) { 1775 if (ret) {
1777 tun_detach_filter(tun, i); 1776 tun_detach_filter(tun, i);
@@ -1789,8 +1788,7 @@ static void tun_set_sndbuf(struct tun_struct *tun)
1789 int i; 1788 int i;
1790 1789
1791 for (i = 0; i < tun->numqueues; i++) { 1790 for (i = 0; i < tun->numqueues; i++) {
1792 tfile = rcu_dereference_protected(tun->tfiles[i], 1791 tfile = rtnl_dereference(tun->tfiles[i]);
1793 lockdep_rtnl_is_held());
1794 tfile->socket.sk->sk_sndbuf = tun->sndbuf; 1792 tfile->socket.sk->sk_sndbuf = tun->sndbuf;
1795 } 1793 }
1796} 1794}
@@ -1805,15 +1803,16 @@ static int tun_set_queue(struct file *file, struct ifreq *ifr)
1805 1803
1806 if (ifr->ifr_flags & IFF_ATTACH_QUEUE) { 1804 if (ifr->ifr_flags & IFF_ATTACH_QUEUE) {
1807 tun = tfile->detached; 1805 tun = tfile->detached;
1808 if (!tun) 1806 if (!tun) {
1809 ret = -EINVAL; 1807 ret = -EINVAL;
1810 else if (tun_not_capable(tun)) 1808 goto unlock;
1811 ret = -EPERM; 1809 }
1812 else 1810 ret = security_tun_dev_attach_queue(tun->security);
1813 ret = tun_attach(tun, file); 1811 if (ret < 0)
1812 goto unlock;
1813 ret = tun_attach(tun, file);
1814 } else if (ifr->ifr_flags & IFF_DETACH_QUEUE) { 1814 } else if (ifr->ifr_flags & IFF_DETACH_QUEUE) {
1815 tun = rcu_dereference_protected(tfile->tun, 1815 tun = rtnl_dereference(tfile->tun);
1816 lockdep_rtnl_is_held());
1817 if (!tun || !(tun->flags & TUN_TAP_MQ)) 1816 if (!tun || !(tun->flags & TUN_TAP_MQ))
1818 ret = -EINVAL; 1817 ret = -EINVAL;
1819 else 1818 else
@@ -1821,6 +1820,7 @@ static int tun_set_queue(struct file *file, struct ifreq *ifr)
1821 } else 1820 } else
1822 ret = -EINVAL; 1821 ret = -EINVAL;
1823 1822
1823unlock:
1824 rtnl_unlock(); 1824 rtnl_unlock();
1825 return ret; 1825 return ret;
1826} 1826}
@@ -1898,10 +1898,11 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
1898 /* Disable/Enable persist mode. Keep an extra reference to the 1898 /* Disable/Enable persist mode. Keep an extra reference to the
1899 * module to prevent the module being unprobed. 1899 * module to prevent the module being unprobed.
1900 */ 1900 */
1901 if (arg) { 1901 if (arg && !(tun->flags & TUN_PERSIST)) {
1902 tun->flags |= TUN_PERSIST; 1902 tun->flags |= TUN_PERSIST;
1903 __module_get(THIS_MODULE); 1903 __module_get(THIS_MODULE);
1904 } else { 1904 }
1905 if (!arg && (tun->flags & TUN_PERSIST)) {
1905 tun->flags &= ~TUN_PERSIST; 1906 tun->flags &= ~TUN_PERSIST;
1906 module_put(THIS_MODULE); 1907 module_put(THIS_MODULE);
1907 } 1908 }
diff --git a/drivers/net/usb/cdc_mbim.c b/drivers/net/usb/cdc_mbim.c
index 42f51c71ec1f..248d2dc765a5 100644
--- a/drivers/net/usb/cdc_mbim.c
+++ b/drivers/net/usb/cdc_mbim.c
@@ -374,6 +374,21 @@ static const struct driver_info cdc_mbim_info = {
374 .tx_fixup = cdc_mbim_tx_fixup, 374 .tx_fixup = cdc_mbim_tx_fixup,
375}; 375};
376 376
377/* MBIM and NCM devices should not need a ZLP after NTBs with
378 * dwNtbOutMaxSize length. This driver_info is for the exceptional
379 * devices requiring it anyway, allowing them to be supported without
380 * forcing the performance penalty on all the sane devices.
381 */
382static const struct driver_info cdc_mbim_info_zlp = {
383 .description = "CDC MBIM",
384 .flags = FLAG_NO_SETINT | FLAG_MULTI_PACKET | FLAG_WWAN | FLAG_SEND_ZLP,
385 .bind = cdc_mbim_bind,
386 .unbind = cdc_mbim_unbind,
387 .manage_power = cdc_mbim_manage_power,
388 .rx_fixup = cdc_mbim_rx_fixup,
389 .tx_fixup = cdc_mbim_tx_fixup,
390};
391
377static const struct usb_device_id mbim_devs[] = { 392static const struct usb_device_id mbim_devs[] = {
378 /* This duplicate NCM entry is intentional. MBIM devices can 393 /* This duplicate NCM entry is intentional. MBIM devices can
379 * be disguised as NCM by default, and this is necessary to 394 * be disguised as NCM by default, and this is necessary to
@@ -385,6 +400,10 @@ static const struct usb_device_id mbim_devs[] = {
385 { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE), 400 { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE),
386 .driver_info = (unsigned long)&cdc_mbim_info, 401 .driver_info = (unsigned long)&cdc_mbim_info,
387 }, 402 },
403 /* Sierra Wireless MC7710 need ZLPs */
404 { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x68a2, USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE),
405 .driver_info = (unsigned long)&cdc_mbim_info_zlp,
406 },
388 { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE), 407 { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE),
389 .driver_info = (unsigned long)&cdc_mbim_info, 408 .driver_info = (unsigned long)&cdc_mbim_info,
390 }, 409 },
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 71b6e92b8e9b..f94711caa08a 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -344,6 +344,23 @@ static const struct ethtool_ops cdc_ncm_ethtool_ops = {
344 .nway_reset = usbnet_nway_reset, 344 .nway_reset = usbnet_nway_reset,
345}; 345};
346 346
347/* return first slave interface if an IAD matches the given master */
348static struct usb_interface *get_iad_slave(struct usb_device *udev,
349 struct usb_interface *master) {
350 int i;
351 struct usb_interface_assoc_descriptor *iad;
352 u8 mnum = master->cur_altsetting->desc.bInterfaceNumber;
353
354 for (i = 0; i < USB_MAXIADS; i++) {
355 iad = udev->actconfig->intf_assoc[i];
356 if (!iad)
357 break;
358 if (iad->bFirstInterface == mnum && iad->bInterfaceCount == 2)
359 return usb_ifnum_to_if(udev, mnum + 1);
360 }
361 return NULL;
362}
363
347int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting) 364int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting)
348{ 365{
349 struct cdc_ncm_ctx *ctx; 366 struct cdc_ncm_ctx *ctx;
@@ -435,6 +452,16 @@ advance:
435 len -= temp; 452 len -= temp;
436 } 453 }
437 454
455 /* some buggy devices have an IAD but no CDC Union */
456 if (!ctx->union_desc) {
457 dev_dbg(&intf->dev, "missing CDC Union descriptor\n");
458 ctx->data = get_iad_slave(dev->udev, intf);
459 if (ctx->data) {
460 ctx->control = intf;
461 dev_dbg(&intf->dev, "got slave from IAD\n");
462 }
463 }
464
438 /* check if we got everything */ 465 /* check if we got everything */
439 if ((ctx->control == NULL) || (ctx->data == NULL) || 466 if ((ctx->control == NULL) || (ctx->data == NULL) ||
440 ((!ctx->mbim_desc) && ((ctx->ether_desc == NULL) || (ctx->control != intf)))) 467 ((!ctx->mbim_desc) && ((ctx->ether_desc == NULL) || (ctx->control != intf))))
@@ -497,7 +524,8 @@ advance:
497error2: 524error2:
498 usb_set_intfdata(ctx->control, NULL); 525 usb_set_intfdata(ctx->control, NULL);
499 usb_set_intfdata(ctx->data, NULL); 526 usb_set_intfdata(ctx->data, NULL);
500 usb_driver_release_interface(driver, ctx->data); 527 if (ctx->data != ctx->control)
528 usb_driver_release_interface(driver, ctx->data);
501error: 529error:
502 cdc_ncm_free((struct cdc_ncm_ctx *)dev->data[0]); 530 cdc_ncm_free((struct cdc_ncm_ctx *)dev->data[0]);
503 dev->data[0] = 0; 531 dev->data[0] = 0;
@@ -1155,6 +1183,20 @@ static const struct driver_info wwan_info = {
1155 .tx_fixup = cdc_ncm_tx_fixup, 1183 .tx_fixup = cdc_ncm_tx_fixup,
1156}; 1184};
1157 1185
1186/* Same as wwan_info, but with FLAG_NOARP */
1187static const struct driver_info wwan_noarp_info = {
1188 .description = "Mobile Broadband Network Device (NO ARP)",
1189 .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET
1190 | FLAG_WWAN | FLAG_NOARP,
1191 .bind = cdc_ncm_bind,
1192 .unbind = cdc_ncm_unbind,
1193 .check_connect = cdc_ncm_check_connect,
1194 .manage_power = usbnet_manage_power,
1195 .status = cdc_ncm_status,
1196 .rx_fixup = cdc_ncm_rx_fixup,
1197 .tx_fixup = cdc_ncm_tx_fixup,
1198};
1199
1158static const struct usb_device_id cdc_devs[] = { 1200static const struct usb_device_id cdc_devs[] = {
1159 /* Ericsson MBM devices like F5521gw */ 1201 /* Ericsson MBM devices like F5521gw */
1160 { .match_flags = USB_DEVICE_ID_MATCH_INT_INFO 1202 { .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
@@ -1194,6 +1236,13 @@ static const struct usb_device_id cdc_devs[] = {
1194 .driver_info = (unsigned long)&wwan_info, 1236 .driver_info = (unsigned long)&wwan_info,
1195 }, 1237 },
1196 1238
1239 /* Infineon(now Intel) HSPA Modem platform */
1240 { USB_DEVICE_AND_INTERFACE_INFO(0x1519, 0x0443,
1241 USB_CLASS_COMM,
1242 USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE),
1243 .driver_info = (unsigned long)&wwan_noarp_info,
1244 },
1245
1197 /* Generic CDC-NCM devices */ 1246 /* Generic CDC-NCM devices */
1198 { USB_INTERFACE_INFO(USB_CLASS_COMM, 1247 { USB_INTERFACE_INFO(USB_CLASS_COMM,
1199 USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE), 1248 USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE),
diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c
index 3f554c1149f3..011410f39c90 100644
--- a/drivers/net/usb/dm9601.c
+++ b/drivers/net/usb/dm9601.c
@@ -53,7 +53,6 @@
53#define DM_RX_OVERHEAD 7 /* 3 byte header + 4 byte crc tail */ 53#define DM_RX_OVERHEAD 7 /* 3 byte header + 4 byte crc tail */
54#define DM_TIMEOUT 1000 54#define DM_TIMEOUT 1000
55 55
56
57static int dm_read(struct usbnet *dev, u8 reg, u16 length, void *data) 56static int dm_read(struct usbnet *dev, u8 reg, u16 length, void *data)
58{ 57{
59 int err; 58 int err;
@@ -84,32 +83,23 @@ static int dm_write(struct usbnet *dev, u8 reg, u16 length, void *data)
84 83
85static int dm_write_reg(struct usbnet *dev, u8 reg, u8 value) 84static int dm_write_reg(struct usbnet *dev, u8 reg, u8 value)
86{ 85{
87 return usbnet_write_cmd(dev, DM_WRITE_REGS, 86 return usbnet_write_cmd(dev, DM_WRITE_REG,
88 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 87 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
89 value, reg, NULL, 0); 88 value, reg, NULL, 0);
90} 89}
91 90
92static void dm_write_async_helper(struct usbnet *dev, u8 reg, u8 value, 91static void dm_write_async(struct usbnet *dev, u8 reg, u16 length, void *data)
93 u16 length, void *data)
94{ 92{
95 usbnet_write_cmd_async(dev, DM_WRITE_REGS, 93 usbnet_write_cmd_async(dev, DM_WRITE_REGS,
96 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 94 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
97 value, reg, data, length); 95 0, reg, data, length);
98}
99
100static void dm_write_async(struct usbnet *dev, u8 reg, u16 length, void *data)
101{
102 netdev_dbg(dev->net, "dm_write_async() reg=0x%02x length=%d\n", reg, length);
103
104 dm_write_async_helper(dev, reg, 0, length, data);
105} 96}
106 97
107static void dm_write_reg_async(struct usbnet *dev, u8 reg, u8 value) 98static void dm_write_reg_async(struct usbnet *dev, u8 reg, u8 value)
108{ 99{
109 netdev_dbg(dev->net, "dm_write_reg_async() reg=0x%02x value=0x%02x\n", 100 usbnet_write_cmd_async(dev, DM_WRITE_REG,
110 reg, value); 101 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
111 102 value, reg, NULL, 0);
112 dm_write_async_helper(dev, reg, value, 0, NULL);
113} 103}
114 104
115static int dm_read_shared_word(struct usbnet *dev, int phy, u8 reg, __le16 *value) 105static int dm_read_shared_word(struct usbnet *dev, int phy, u8 reg, __le16 *value)
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 91d7cb9728eb..575a5839ee34 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -433,6 +433,7 @@ static const struct usb_device_id products[] = {
433 {QMI_FIXED_INTF(0x19d2, 0x0199, 1)}, /* ZTE MF820S */ 433 {QMI_FIXED_INTF(0x19d2, 0x0199, 1)}, /* ZTE MF820S */
434 {QMI_FIXED_INTF(0x19d2, 0x0200, 1)}, 434 {QMI_FIXED_INTF(0x19d2, 0x0200, 1)},
435 {QMI_FIXED_INTF(0x19d2, 0x0257, 3)}, /* ZTE MF821 */ 435 {QMI_FIXED_INTF(0x19d2, 0x0257, 3)}, /* ZTE MF821 */
436 {QMI_FIXED_INTF(0x19d2, 0x0265, 4)}, /* ONDA MT8205 4G LTE */
436 {QMI_FIXED_INTF(0x19d2, 0x0284, 4)}, /* ZTE MF880 */ 437 {QMI_FIXED_INTF(0x19d2, 0x0284, 4)}, /* ZTE MF880 */
437 {QMI_FIXED_INTF(0x19d2, 0x0326, 4)}, /* ZTE MF821D */ 438 {QMI_FIXED_INTF(0x19d2, 0x0326, 4)}, /* ZTE MF821D */
438 {QMI_FIXED_INTF(0x19d2, 0x1008, 4)}, /* ZTE (Vodafone) K3570-Z */ 439 {QMI_FIXED_INTF(0x19d2, 0x1008, 4)}, /* ZTE (Vodafone) K3570-Z */
@@ -458,6 +459,8 @@ static const struct usb_device_id products[] = {
458 {QMI_FIXED_INTF(0x1199, 0x68a2, 8)}, /* Sierra Wireless MC7710 in QMI mode */ 459 {QMI_FIXED_INTF(0x1199, 0x68a2, 8)}, /* Sierra Wireless MC7710 in QMI mode */
459 {QMI_FIXED_INTF(0x1199, 0x68a2, 19)}, /* Sierra Wireless MC7710 in QMI mode */ 460 {QMI_FIXED_INTF(0x1199, 0x68a2, 19)}, /* Sierra Wireless MC7710 in QMI mode */
460 {QMI_FIXED_INTF(0x1199, 0x901c, 8)}, /* Sierra Wireless EM7700 */ 461 {QMI_FIXED_INTF(0x1199, 0x901c, 8)}, /* Sierra Wireless EM7700 */
462 {QMI_FIXED_INTF(0x1bbb, 0x011e, 4)}, /* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */
463 {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */
461 464
462 /* 4. Gobi 1000 devices */ 465 /* 4. Gobi 1000 devices */
463 {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ 466 {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 3d4bf01641b4..f34b2ebee815 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1448,6 +1448,10 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
1448 if ((dev->driver_info->flags & FLAG_WWAN) != 0) 1448 if ((dev->driver_info->flags & FLAG_WWAN) != 0)
1449 strcpy(net->name, "wwan%d"); 1449 strcpy(net->name, "wwan%d");
1450 1450
1451 /* devices that cannot do ARP */
1452 if ((dev->driver_info->flags & FLAG_NOARP) != 0)
1453 net->flags |= IFF_NOARP;
1454
1451 /* maybe the remote can't receive an Ethernet MTU */ 1455 /* maybe the remote can't receive an Ethernet MTU */
1452 if (net->mtu > (dev->hard_mtu - net->hard_header_len)) 1456 if (net->mtu > (dev->hard_mtu - net->hard_header_len))
1453 net->mtu = dev->hard_mtu - net->hard_header_len; 1457 net->mtu = dev->hard_mtu - net->hard_header_len;
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 3b3fdf648ea7..656230e0d18c 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -505,7 +505,8 @@ static int vxlan_join_group(struct net_device *dev)
505 struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id); 505 struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id);
506 struct sock *sk = vn->sock->sk; 506 struct sock *sk = vn->sock->sk;
507 struct ip_mreqn mreq = { 507 struct ip_mreqn mreq = {
508 .imr_multiaddr.s_addr = vxlan->gaddr, 508 .imr_multiaddr.s_addr = vxlan->gaddr,
509 .imr_ifindex = vxlan->link,
509 }; 510 };
510 int err; 511 int err;
511 512
@@ -532,7 +533,8 @@ static int vxlan_leave_group(struct net_device *dev)
532 int err = 0; 533 int err = 0;
533 struct sock *sk = vn->sock->sk; 534 struct sock *sk = vn->sock->sk;
534 struct ip_mreqn mreq = { 535 struct ip_mreqn mreq = {
535 .imr_multiaddr.s_addr = vxlan->gaddr, 536 .imr_multiaddr.s_addr = vxlan->gaddr,
537 .imr_ifindex = vxlan->link,
536 }; 538 };
537 539
538 /* Only leave group when last vxlan is done. */ 540 /* Only leave group when last vxlan is done. */
@@ -1189,6 +1191,7 @@ static void vxlan_setup(struct net_device *dev)
1189 1191
1190 dev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM; 1192 dev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM;
1191 dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; 1193 dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;
1194 dev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
1192 1195
1193 spin_lock_init(&vxlan->hash_lock); 1196 spin_lock_init(&vxlan->hash_lock);
1194 1197
diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c b/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c
index 18b0bc51766b..bb7cc90bafb2 100644
--- a/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c
@@ -341,7 +341,7 @@ static struct rtl_hal_cfg rtl8723ae_hal_cfg = {
341 .maps[RTL_RC_HT_RATEMCS15] = DESC92_RATEMCS15, 341 .maps[RTL_RC_HT_RATEMCS15] = DESC92_RATEMCS15,
342}; 342};
343 343
344static struct pci_device_id rtl8723ae_pci_ids[] __devinitdata = { 344static struct pci_device_id rtl8723ae_pci_ids[] = {
345 {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8723, rtl8723ae_hal_cfg)}, 345 {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8723, rtl8723ae_hal_cfg)},
346 {}, 346 {},
347}; 347};
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index c26e28b4bd9f..7ffa43bd7cf9 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1015,29 +1015,10 @@ err:
1015 i = xennet_fill_frags(np, skb, &tmpq); 1015 i = xennet_fill_frags(np, skb, &tmpq);
1016 1016
1017 /* 1017 /*
1018 * Truesize approximates the size of true data plus 1018 * Truesize is the actual allocation size, even if the
1019 * any supervisor overheads. Adding hypervisor 1019 * allocation is only partially used.
1020 * overheads has been shown to significantly reduce 1020 */
1021 * achievable bandwidth with the default receive 1021 skb->truesize += PAGE_SIZE * skb_shinfo(skb)->nr_frags;
1022 * buffer size. It is therefore not wise to account
1023 * for it here.
1024 *
1025 * After alloc_skb(RX_COPY_THRESHOLD), truesize is set
1026 * to RX_COPY_THRESHOLD + the supervisor
1027 * overheads. Here, we add the size of the data pulled
1028 * in xennet_fill_frags().
1029 *
1030 * We also adjust for any unused space in the main
1031 * data area by subtracting (RX_COPY_THRESHOLD -
1032 * len). This is especially important with drivers
1033 * which split incoming packets into header and data,
1034 * using only 66 bytes of the main data area (see the
1035 * e1000 driver for example.) On such systems,
1036 * without this last adjustement, our achievable
1037 * receive throughout using the standard receive
1038 * buffer size was cut by 25%(!!!).
1039 */
1040 skb->truesize += skb->data_len - RX_COPY_THRESHOLD;
1041 skb->len += skb->data_len; 1022 skb->len += skb->data_len;
1042 1023
1043 if (rx->flags & XEN_NETRXF_csum_blank) 1024 if (rx->flags & XEN_NETRXF_csum_blank)