aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-10-14 00:40:23 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-10-14 00:40:23 -0400
commit29fbff8698fc0ac1a1d74584b258e0bf18b469f9 (patch)
tree94d58ffc05d03632100860a9cb5fb73560c851a7 /drivers/net
parentc4a86165d1ec70c8e592fa7b7cc7070971533021 (diff)
parent4eb6753c3324873752f56543e149956e39dd32b6 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Fix various build warnings in tlan/qed/xen-netback drivers, from Arnd Bergmann. 2) Propagate proper error code in strparser's strp_recv(), from Geert Uytterhoeven. 3) Fix accidental broadcast of RTM_GETTFILTER responses, from Eric Dumazret. 4) Need to use list_for_each_entry_safe() in qed driver, from Wei Yongjun. 5) Openvswitch 802.1AD bug fixes from Jiri Benc. 6) Cure BUILD_BUG_ON() in mlx5 driver, from Tom Herbert. 7) Fix UDP ipv6 checksumming in netvsc driver, from Stephen Hemminger. 8) stmmac driver fixes from Giuseppe CAVALLARO. 9) Fix access to mangled IP6CB in tcp, from Eric Dumazet. 10) Fix info leaks in tipc and rtnetlink, from Dan Carpenter. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (27 commits) net: bridge: add the multicast_flood flag attribute to brport_attrs net: axienet: Remove unused parameter from __axienet_device_reset liquidio: CN23XX: fix a loop timeout net: rtnl: info leak in rtnl_fill_vfinfo() tipc: info leak in __tipc_nl_add_udp_addr() net: ipv4: Do not drop to make_route if oif is l3mdev net: phy: Trigger state machine on state change and not polling. ipv6: tcp: restore IP6CB for pktoptions skbs netvsc: Remove mistaken udp.h inclusion. xen-netback: fix type mismatch warning stmmac: fix error check when init ptp stmmac: fix ptp init for gmac4 qed: fix old-style function definition netvsc: fix checksum on UDP IPV6 net_sched: reorder pernet ops and act ops registrations xen-netback: fix guest Rx stall detection (after guest Rx refactor) drivers/ptp: Fix kernel memory disclosure net/mlx5: Add MLX5_ARRAY_SET64 to fix BUILD_BUG_ON qmi_wwan: add support for Quectel EC21 and EC25 openvswitch: add NETIF_F_HW_VLAN_STAG_TX to internal dev ...
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c2
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c4
-rw-r--r--drivers/net/ethernet/qlogic/qed/qed_ll2.c4
-rw-r--r--drivers/net/ethernet/qlogic/qed/qed_roce.c2
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c21
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c10
-rw-r--r--drivers/net/ethernet/ti/tlan.c2
-rw-r--r--drivers/net/ethernet/xilinx/xilinx_axienet_main.c11
-rw-r--r--drivers/net/hyperv/netvsc_drv.c71
-rw-r--r--drivers/net/phy/phy.c22
-rw-r--r--drivers/net/usb/qmi_wwan.c30
-rw-r--r--drivers/net/xen-netback/common.h4
-rw-r--r--drivers/net/xen-netback/hash.c68
-rw-r--r--drivers/net/xen-netback/rx.c8
-rw-r--r--drivers/net/xen-netback/xenbus.c37
15 files changed, 213 insertions, 83 deletions
diff --git a/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c b/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c
index bddb198c0b74..380a64115a98 100644
--- a/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c
+++ b/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c
@@ -693,7 +693,7 @@ static int cn23xx_enable_io_queues(struct octeon_device *oct)
693 while ((reg_val & CN23XX_PKT_INPUT_CTL_RST) && 693 while ((reg_val & CN23XX_PKT_INPUT_CTL_RST) &&
694 !(reg_val & 694 !(reg_val &
695 CN23XX_PKT_INPUT_CTL_QUIET) && 695 CN23XX_PKT_INPUT_CTL_QUIET) &&
696 loop--) { 696 --loop) {
697 reg_val = octeon_read_csr64( 697 reg_val = octeon_read_csr64(
698 oct, 698 oct,
699 CN23XX_SLI_IQ_PKT_CONTROL64(q_no)); 699 CN23XX_SLI_IQ_PKT_CONTROL64(q_no));
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
index d4585154151d..cc4fd61914d3 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
@@ -287,7 +287,7 @@ retry:
287 287
288 goto retry; 288 goto retry;
289 } 289 }
290 MLX5_SET64(manage_pages_in, in, pas[i], addr); 290 MLX5_ARRAY_SET64(manage_pages_in, in, pas, i, addr);
291 } 291 }
292 292
293 MLX5_SET(manage_pages_in, in, opcode, MLX5_CMD_OP_MANAGE_PAGES); 293 MLX5_SET(manage_pages_in, in, opcode, MLX5_CMD_OP_MANAGE_PAGES);
@@ -344,7 +344,7 @@ static int reclaim_pages_cmd(struct mlx5_core_dev *dev,
344 if (fwp->func_id != func_id) 344 if (fwp->func_id != func_id)
345 continue; 345 continue;
346 346
347 MLX5_SET64(manage_pages_out, out, pas[i], fwp->addr); 347 MLX5_ARRAY_SET64(manage_pages_out, out, pas, i, fwp->addr);
348 i++; 348 i++;
349 } 349 }
350 350
diff --git a/drivers/net/ethernet/qlogic/qed/qed_ll2.c b/drivers/net/ethernet/qlogic/qed/qed_ll2.c
index a6db10717d5c..02a8be2faed7 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_ll2.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_ll2.c
@@ -1517,7 +1517,7 @@ static void qed_ll2_register_cb_ops(struct qed_dev *cdev,
1517static int qed_ll2_start(struct qed_dev *cdev, struct qed_ll2_params *params) 1517static int qed_ll2_start(struct qed_dev *cdev, struct qed_ll2_params *params)
1518{ 1518{
1519 struct qed_ll2_info ll2_info; 1519 struct qed_ll2_info ll2_info;
1520 struct qed_ll2_buffer *buffer; 1520 struct qed_ll2_buffer *buffer, *tmp_buffer;
1521 enum qed_ll2_conn_type conn_type; 1521 enum qed_ll2_conn_type conn_type;
1522 struct qed_ptt *p_ptt; 1522 struct qed_ptt *p_ptt;
1523 int rc, i; 1523 int rc, i;
@@ -1587,7 +1587,7 @@ static int qed_ll2_start(struct qed_dev *cdev, struct qed_ll2_params *params)
1587 1587
1588 /* Post all Rx buffers to FW */ 1588 /* Post all Rx buffers to FW */
1589 spin_lock_bh(&cdev->ll2->lock); 1589 spin_lock_bh(&cdev->ll2->lock);
1590 list_for_each_entry(buffer, &cdev->ll2->list, list) { 1590 list_for_each_entry_safe(buffer, tmp_buffer, &cdev->ll2->list, list) {
1591 rc = qed_ll2_post_rx_buffer(QED_LEADING_HWFN(cdev), 1591 rc = qed_ll2_post_rx_buffer(QED_LEADING_HWFN(cdev),
1592 cdev->ll2->handle, 1592 cdev->ll2->handle,
1593 buffer->phys_addr, 0, buffer, 1); 1593 buffer->phys_addr, 0, buffer, 1);
diff --git a/drivers/net/ethernet/qlogic/qed/qed_roce.c b/drivers/net/ethernet/qlogic/qed/qed_roce.c
index 23430059471c..76831a398bed 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_roce.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_roce.c
@@ -2947,7 +2947,7 @@ static const struct qed_rdma_ops qed_rdma_ops_pass = {
2947 .roce_ll2_stats = &qed_roce_ll2_stats, 2947 .roce_ll2_stats = &qed_roce_ll2_stats,
2948}; 2948};
2949 2949
2950const struct qed_rdma_ops *qed_get_rdma_ops() 2950const struct qed_rdma_ops *qed_get_rdma_ops(void)
2951{ 2951{
2952 return &qed_rdma_ops_pass; 2952 return &qed_rdma_ops_pass;
2953} 2953}
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 4c8c60af7985..6c85b61aaa0b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -650,20 +650,27 @@ static int stmmac_init_ptp(struct stmmac_priv *priv)
650 if (IS_ERR(priv->clk_ptp_ref)) { 650 if (IS_ERR(priv->clk_ptp_ref)) {
651 priv->clk_ptp_rate = clk_get_rate(priv->stmmac_clk); 651 priv->clk_ptp_rate = clk_get_rate(priv->stmmac_clk);
652 priv->clk_ptp_ref = NULL; 652 priv->clk_ptp_ref = NULL;
653 netdev_dbg(priv->dev, "PTP uses main clock\n");
653 } else { 654 } else {
654 clk_prepare_enable(priv->clk_ptp_ref); 655 clk_prepare_enable(priv->clk_ptp_ref);
655 priv->clk_ptp_rate = clk_get_rate(priv->clk_ptp_ref); 656 priv->clk_ptp_rate = clk_get_rate(priv->clk_ptp_ref);
657 netdev_dbg(priv->dev, "PTP rate %d\n", priv->clk_ptp_rate);
656 } 658 }
657 659
658 priv->adv_ts = 0; 660 priv->adv_ts = 0;
659 if (priv->dma_cap.atime_stamp && priv->extend_desc) 661 /* Check if adv_ts can be enabled for dwmac 4.x core */
662 if (priv->plat->has_gmac4 && priv->dma_cap.atime_stamp)
663 priv->adv_ts = 1;
664 /* Dwmac 3.x core with extend_desc can support adv_ts */
665 else if (priv->extend_desc && priv->dma_cap.atime_stamp)
660 priv->adv_ts = 1; 666 priv->adv_ts = 1;
661 667
662 if (netif_msg_hw(priv) && priv->dma_cap.time_stamp) 668 if (priv->dma_cap.time_stamp)
663 pr_debug("IEEE 1588-2002 Time Stamp supported\n"); 669 netdev_info(priv->dev, "IEEE 1588-2002 Timestamp supported\n");
664 670
665 if (netif_msg_hw(priv) && priv->adv_ts) 671 if (priv->adv_ts)
666 pr_debug("IEEE 1588-2008 Advanced Time Stamp supported\n"); 672 netdev_info(priv->dev,
673 "IEEE 1588-2008 Advanced Timestamp supported\n");
667 674
668 priv->hw->ptp = &stmmac_ptp; 675 priv->hw->ptp = &stmmac_ptp;
669 priv->hwts_tx_en = 0; 676 priv->hwts_tx_en = 0;
@@ -1702,8 +1709,8 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)
1702 1709
1703 if (init_ptp) { 1710 if (init_ptp) {
1704 ret = stmmac_init_ptp(priv); 1711 ret = stmmac_init_ptp(priv);
1705 if (ret && ret != -EOPNOTSUPP) 1712 if (ret)
1706 pr_warn("%s: failed PTP initialisation\n", __func__); 1713 netdev_warn(priv->dev, "PTP support cannot init.\n");
1707 } 1714 }
1708 1715
1709#ifdef CONFIG_DEBUG_FS 1716#ifdef CONFIG_DEBUG_FS
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
index 6e3b82972ce8..289d52725a6c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
@@ -186,10 +186,12 @@ int stmmac_ptp_register(struct stmmac_priv *priv)
186 priv->device); 186 priv->device);
187 if (IS_ERR(priv->ptp_clock)) { 187 if (IS_ERR(priv->ptp_clock)) {
188 priv->ptp_clock = NULL; 188 priv->ptp_clock = NULL;
189 pr_err("ptp_clock_register() failed on %s\n", priv->dev->name); 189 return PTR_ERR(priv->ptp_clock);
190 } else if (priv->ptp_clock) 190 }
191 pr_debug("Added PTP HW clock successfully on %s\n", 191
192 priv->dev->name); 192 spin_lock_init(&priv->ptp_lock);
193
194 netdev_dbg(priv->dev, "Added PTP HW clock successfully\n");
193 195
194 return 0; 196 return 0;
195} 197}
diff --git a/drivers/net/ethernet/ti/tlan.c b/drivers/net/ethernet/ti/tlan.c
index ece0ea0f6b38..6c7ec1ddd475 100644
--- a/drivers/net/ethernet/ti/tlan.c
+++ b/drivers/net/ethernet/ti/tlan.c
@@ -610,8 +610,8 @@ err_out_regions:
610#ifdef CONFIG_PCI 610#ifdef CONFIG_PCI
611 if (pdev) 611 if (pdev)
612 pci_release_regions(pdev); 612 pci_release_regions(pdev);
613#endif
614err_out: 613err_out:
614#endif
615 if (pdev) 615 if (pdev)
616 pci_disable_device(pdev); 616 pci_disable_device(pdev);
617 return rc; 617 return rc;
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index 35f9f9742a48..c688d68c39aa 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -431,8 +431,7 @@ static void axienet_setoptions(struct net_device *ndev, u32 options)
431 lp->options |= options; 431 lp->options |= options;
432} 432}
433 433
434static void __axienet_device_reset(struct axienet_local *lp, 434static void __axienet_device_reset(struct axienet_local *lp, off_t offset)
435 struct device *dev, off_t offset)
436{ 435{
437 u32 timeout; 436 u32 timeout;
438 /* Reset Axi DMA. This would reset Axi Ethernet core as well. The reset 437 /* Reset Axi DMA. This would reset Axi Ethernet core as well. The reset
@@ -468,8 +467,8 @@ static void axienet_device_reset(struct net_device *ndev)
468 u32 axienet_status; 467 u32 axienet_status;
469 struct axienet_local *lp = netdev_priv(ndev); 468 struct axienet_local *lp = netdev_priv(ndev);
470 469
471 __axienet_device_reset(lp, &ndev->dev, XAXIDMA_TX_CR_OFFSET); 470 __axienet_device_reset(lp, XAXIDMA_TX_CR_OFFSET);
472 __axienet_device_reset(lp, &ndev->dev, XAXIDMA_RX_CR_OFFSET); 471 __axienet_device_reset(lp, XAXIDMA_RX_CR_OFFSET);
473 472
474 lp->max_frm_size = XAE_MAX_VLAN_FRAME_SIZE; 473 lp->max_frm_size = XAE_MAX_VLAN_FRAME_SIZE;
475 lp->options |= XAE_OPTION_VLAN; 474 lp->options |= XAE_OPTION_VLAN;
@@ -1338,8 +1337,8 @@ static void axienet_dma_err_handler(unsigned long data)
1338 axienet_iow(lp, XAE_MDIO_MC_OFFSET, (mdio_mcreg & 1337 axienet_iow(lp, XAE_MDIO_MC_OFFSET, (mdio_mcreg &
1339 ~XAE_MDIO_MC_MDIOEN_MASK)); 1338 ~XAE_MDIO_MC_MDIOEN_MASK));
1340 1339
1341 __axienet_device_reset(lp, &ndev->dev, XAXIDMA_TX_CR_OFFSET); 1340 __axienet_device_reset(lp, XAXIDMA_TX_CR_OFFSET);
1342 __axienet_device_reset(lp, &ndev->dev, XAXIDMA_RX_CR_OFFSET); 1341 __axienet_device_reset(lp, XAXIDMA_RX_CR_OFFSET);
1343 1342
1344 axienet_iow(lp, XAE_MDIO_MC_OFFSET, mdio_mcreg); 1343 axienet_iow(lp, XAE_MDIO_MC_OFFSET, mdio_mcreg);
1345 axienet_mdio_wait_until_ready(lp); 1344 axienet_mdio_wait_until_ready(lp);
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 52eeb2f67276..f0919bd3a563 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -442,8 +442,6 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
442 } 442 }
443 443
444 net_trans_info = get_net_transport_info(skb, &hdr_offset); 444 net_trans_info = get_net_transport_info(skb, &hdr_offset);
445 if (net_trans_info == TRANSPORT_INFO_NOT_IP)
446 goto do_send;
447 445
448 /* 446 /*
449 * Setup the sendside checksum offload only if this is not a 447 * Setup the sendside checksum offload only if this is not a
@@ -478,56 +476,29 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
478 } 476 }
479 lso_info->lso_v2_transmit.tcp_header_offset = hdr_offset; 477 lso_info->lso_v2_transmit.tcp_header_offset = hdr_offset;
480 lso_info->lso_v2_transmit.mss = skb_shinfo(skb)->gso_size; 478 lso_info->lso_v2_transmit.mss = skb_shinfo(skb)->gso_size;
481 goto do_send; 479 } else if (skb->ip_summed == CHECKSUM_PARTIAL) {
482 } 480 if (net_trans_info & INFO_TCP) {
483 481 rndis_msg_size += NDIS_CSUM_PPI_SIZE;
484 if ((skb->ip_summed == CHECKSUM_NONE) || 482 ppi = init_ppi_data(rndis_msg, NDIS_CSUM_PPI_SIZE,
485 (skb->ip_summed == CHECKSUM_UNNECESSARY)) 483 TCPIP_CHKSUM_PKTINFO);
486 goto do_send; 484
487 485 csum_info = (struct ndis_tcp_ip_checksum_info *)((void *)ppi +
488 rndis_msg_size += NDIS_CSUM_PPI_SIZE; 486 ppi->ppi_offset);
489 ppi = init_ppi_data(rndis_msg, NDIS_CSUM_PPI_SIZE, 487
490 TCPIP_CHKSUM_PKTINFO); 488 if (net_trans_info & (INFO_IPV4 << 16))
491 489 csum_info->transmit.is_ipv4 = 1;
492 csum_info = (struct ndis_tcp_ip_checksum_info *)((void *)ppi + 490 else
493 ppi->ppi_offset); 491 csum_info->transmit.is_ipv6 = 1;
494 492
495 if (net_trans_info & (INFO_IPV4 << 16)) 493 csum_info->transmit.tcp_checksum = 1;
496 csum_info->transmit.is_ipv4 = 1; 494 csum_info->transmit.tcp_header_offset = hdr_offset;
497 else 495 } else {
498 csum_info->transmit.is_ipv6 = 1; 496 /* UDP checksum (and other) offload is not supported. */
499 497 if (skb_checksum_help(skb))
500 if (net_trans_info & INFO_TCP) { 498 goto drop;
501 csum_info->transmit.tcp_checksum = 1; 499 }
502 csum_info->transmit.tcp_header_offset = hdr_offset;
503 } else if (net_trans_info & INFO_UDP) {
504 /* UDP checksum offload is not supported on ws2008r2.
505 * Furthermore, on ws2012 and ws2012r2, there are some
506 * issues with udp checksum offload from Linux guests.
507 * (these are host issues).
508 * For now compute the checksum here.
509 */
510 struct udphdr *uh;
511 u16 udp_len;
512
513 ret = skb_cow_head(skb, 0);
514 if (ret)
515 goto no_memory;
516
517 uh = udp_hdr(skb);
518 udp_len = ntohs(uh->len);
519 uh->check = 0;
520 uh->check = csum_tcpudp_magic(ip_hdr(skb)->saddr,
521 ip_hdr(skb)->daddr,
522 udp_len, IPPROTO_UDP,
523 csum_partial(uh, udp_len, 0));
524 if (uh->check == 0)
525 uh->check = CSUM_MANGLED_0;
526
527 csum_info->transmit.udp_checksum = 0;
528 } 500 }
529 501
530do_send:
531 /* Start filling in the page buffers with the rndis hdr */ 502 /* Start filling in the page buffers with the rndis hdr */
532 rndis_msg->msg_len += rndis_msg_size; 503 rndis_msg->msg_len += rndis_msg_size;
533 packet->total_data_buflen = rndis_msg->msg_len; 504 packet->total_data_buflen = rndis_msg->msg_len;
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index c6f66832a1a6..f424b867f73e 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -608,6 +608,21 @@ void phy_start_machine(struct phy_device *phydev)
608} 608}
609 609
610/** 610/**
611 * phy_trigger_machine - trigger the state machine to run
612 *
613 * @phydev: the phy_device struct
614 *
615 * Description: There has been a change in state which requires that the
616 * state machine runs.
617 */
618
619static void phy_trigger_machine(struct phy_device *phydev)
620{
621 cancel_delayed_work_sync(&phydev->state_queue);
622 queue_delayed_work(system_power_efficient_wq, &phydev->state_queue, 0);
623}
624
625/**
611 * phy_stop_machine - stop the PHY state machine tracking 626 * phy_stop_machine - stop the PHY state machine tracking
612 * @phydev: target phy_device struct 627 * @phydev: target phy_device struct
613 * 628 *
@@ -639,6 +654,8 @@ static void phy_error(struct phy_device *phydev)
639 mutex_lock(&phydev->lock); 654 mutex_lock(&phydev->lock);
640 phydev->state = PHY_HALTED; 655 phydev->state = PHY_HALTED;
641 mutex_unlock(&phydev->lock); 656 mutex_unlock(&phydev->lock);
657
658 phy_trigger_machine(phydev);
642} 659}
643 660
644/** 661/**
@@ -800,8 +817,7 @@ void phy_change(struct work_struct *work)
800 } 817 }
801 818
802 /* reschedule state queue work to run as soon as possible */ 819 /* reschedule state queue work to run as soon as possible */
803 cancel_delayed_work_sync(&phydev->state_queue); 820 phy_trigger_machine(phydev);
804 queue_delayed_work(system_power_efficient_wq, &phydev->state_queue, 0);
805 return; 821 return;
806 822
807ignore: 823ignore:
@@ -890,6 +906,8 @@ void phy_start(struct phy_device *phydev)
890 /* if phy was suspended, bring the physical link up again */ 906 /* if phy was suspended, bring the physical link up again */
891 if (do_resume) 907 if (do_resume)
892 phy_resume(phydev); 908 phy_resume(phydev);
909
910 phy_trigger_machine(phydev);
893} 911}
894EXPORT_SYMBOL(phy_start); 912EXPORT_SYMBOL(phy_start);
895 913
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 9d1fce8a6e84..3ff76c6db4f6 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -59,6 +59,10 @@ enum qmi_wwan_flags {
59 QMI_WWAN_FLAG_RAWIP = 1 << 0, 59 QMI_WWAN_FLAG_RAWIP = 1 << 0,
60}; 60};
61 61
62enum qmi_wwan_quirks {
63 QMI_WWAN_QUIRK_DTR = 1 << 0, /* needs "set DTR" request */
64};
65
62static void qmi_wwan_netdev_setup(struct net_device *net) 66static void qmi_wwan_netdev_setup(struct net_device *net)
63{ 67{
64 struct usbnet *dev = netdev_priv(net); 68 struct usbnet *dev = netdev_priv(net);
@@ -411,9 +415,14 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf)
411 * clearing out state the clients might need. 415 * clearing out state the clients might need.
412 * 416 *
413 * MDM9x30 is the first QMI chipset with USB3 support. Abuse 417 * MDM9x30 is the first QMI chipset with USB3 support. Abuse
414 * this fact to enable the quirk. 418 * this fact to enable the quirk for all USB3 devices.
419 *
420 * There are also chipsets with the same "set DTR" requirement
421 * but without USB3 support. Devices based on these chips
422 * need a quirk flag in the device ID table.
415 */ 423 */
416 if (le16_to_cpu(dev->udev->descriptor.bcdUSB) >= 0x0201) { 424 if (dev->driver_info->data & QMI_WWAN_QUIRK_DTR ||
425 le16_to_cpu(dev->udev->descriptor.bcdUSB) >= 0x0201) {
417 qmi_wwan_manage_power(dev, 1); 426 qmi_wwan_manage_power(dev, 1);
418 qmi_wwan_change_dtr(dev, true); 427 qmi_wwan_change_dtr(dev, true);
419 } 428 }
@@ -526,6 +535,16 @@ static const struct driver_info qmi_wwan_info = {
526 .rx_fixup = qmi_wwan_rx_fixup, 535 .rx_fixup = qmi_wwan_rx_fixup,
527}; 536};
528 537
538static const struct driver_info qmi_wwan_info_quirk_dtr = {
539 .description = "WWAN/QMI device",
540 .flags = FLAG_WWAN,
541 .bind = qmi_wwan_bind,
542 .unbind = qmi_wwan_unbind,
543 .manage_power = qmi_wwan_manage_power,
544 .rx_fixup = qmi_wwan_rx_fixup,
545 .data = QMI_WWAN_QUIRK_DTR,
546};
547
529#define HUAWEI_VENDOR_ID 0x12D1 548#define HUAWEI_VENDOR_ID 0x12D1
530 549
531/* map QMI/wwan function by a fixed interface number */ 550/* map QMI/wwan function by a fixed interface number */
@@ -533,6 +552,11 @@ static const struct driver_info qmi_wwan_info = {
533 USB_DEVICE_INTERFACE_NUMBER(vend, prod, num), \ 552 USB_DEVICE_INTERFACE_NUMBER(vend, prod, num), \
534 .driver_info = (unsigned long)&qmi_wwan_info 553 .driver_info = (unsigned long)&qmi_wwan_info
535 554
555/* devices requiring "set DTR" quirk */
556#define QMI_QUIRK_SET_DTR(vend, prod, num) \
557 USB_DEVICE_INTERFACE_NUMBER(vend, prod, num), \
558 .driver_info = (unsigned long)&qmi_wwan_info_quirk_dtr
559
536/* Gobi 1000 QMI/wwan interface number is 3 according to qcserial */ 560/* Gobi 1000 QMI/wwan interface number is 3 according to qcserial */
537#define QMI_GOBI1K_DEVICE(vend, prod) \ 561#define QMI_GOBI1K_DEVICE(vend, prod) \
538 QMI_FIXED_INTF(vend, prod, 3) 562 QMI_FIXED_INTF(vend, prod, 3)
@@ -895,6 +919,8 @@ static const struct usb_device_id products[] = {
895 {QMI_FIXED_INTF(0x03f0, 0x4e1d, 8)}, /* HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module */ 919 {QMI_FIXED_INTF(0x03f0, 0x4e1d, 8)}, /* HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module */
896 {QMI_FIXED_INTF(0x22de, 0x9061, 3)}, /* WeTelecom WPD-600N */ 920 {QMI_FIXED_INTF(0x22de, 0x9061, 3)}, /* WeTelecom WPD-600N */
897 {QMI_FIXED_INTF(0x1e0e, 0x9001, 5)}, /* SIMCom 7230E */ 921 {QMI_FIXED_INTF(0x1e0e, 0x9001, 5)}, /* SIMCom 7230E */
922 {QMI_QUIRK_SET_DTR(0x2c7c, 0x0125, 4)}, /* Quectel EC25, EC20 R2.0 Mini PCIe */
923 {QMI_QUIRK_SET_DTR(0x2c7c, 0x0121, 4)}, /* Quectel EC21 Mini PCIe */
898 924
899 /* 4. Gobi 1000 devices */ 925 /* 4. Gobi 1000 devices */
900 {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ 926 {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h
index cf68149cbb55..3ce1f7da8647 100644
--- a/drivers/net/xen-netback/common.h
+++ b/drivers/net/xen-netback/common.h
@@ -407,4 +407,8 @@ u32 xenvif_set_hash_mapping(struct xenvif *vif, u32 gref, u32 len,
407 407
408void xenvif_set_skb_hash(struct xenvif *vif, struct sk_buff *skb); 408void xenvif_set_skb_hash(struct xenvif *vif, struct sk_buff *skb);
409 409
410#ifdef CONFIG_DEBUG_FS
411void xenvif_dump_hash_info(struct xenvif *vif, struct seq_file *m);
412#endif
413
410#endif /* __XEN_NETBACK__COMMON_H__ */ 414#endif /* __XEN_NETBACK__COMMON_H__ */
diff --git a/drivers/net/xen-netback/hash.c b/drivers/net/xen-netback/hash.c
index 613bac057650..e8c5dddc54ba 100644
--- a/drivers/net/xen-netback/hash.c
+++ b/drivers/net/xen-netback/hash.c
@@ -360,6 +360,74 @@ u32 xenvif_set_hash_mapping(struct xenvif *vif, u32 gref, u32 len,
360 return XEN_NETIF_CTRL_STATUS_SUCCESS; 360 return XEN_NETIF_CTRL_STATUS_SUCCESS;
361} 361}
362 362
363#ifdef CONFIG_DEBUG_FS
364void xenvif_dump_hash_info(struct xenvif *vif, struct seq_file *m)
365{
366 unsigned int i;
367
368 switch (vif->hash.alg) {
369 case XEN_NETIF_CTRL_HASH_ALGORITHM_TOEPLITZ:
370 seq_puts(m, "Hash Algorithm: TOEPLITZ\n");
371 break;
372
373 case XEN_NETIF_CTRL_HASH_ALGORITHM_NONE:
374 seq_puts(m, "Hash Algorithm: NONE\n");
375 /* FALLTHRU */
376 default:
377 return;
378 }
379
380 if (vif->hash.flags) {
381 seq_puts(m, "\nHash Flags:\n");
382
383 if (vif->hash.flags & XEN_NETIF_CTRL_HASH_TYPE_IPV4)
384 seq_puts(m, "- IPv4\n");
385 if (vif->hash.flags & XEN_NETIF_CTRL_HASH_TYPE_IPV4_TCP)
386 seq_puts(m, "- IPv4 + TCP\n");
387 if (vif->hash.flags & XEN_NETIF_CTRL_HASH_TYPE_IPV6)
388 seq_puts(m, "- IPv6\n");
389 if (vif->hash.flags & XEN_NETIF_CTRL_HASH_TYPE_IPV6_TCP)
390 seq_puts(m, "- IPv6 + TCP\n");
391 }
392
393 seq_puts(m, "\nHash Key:\n");
394
395 for (i = 0; i < XEN_NETBK_MAX_HASH_KEY_SIZE; ) {
396 unsigned int j, n;
397
398 n = 8;
399 if (i + n >= XEN_NETBK_MAX_HASH_KEY_SIZE)
400 n = XEN_NETBK_MAX_HASH_KEY_SIZE - i;
401
402 seq_printf(m, "[%2u - %2u]: ", i, i + n - 1);
403
404 for (j = 0; j < n; j++, i++)
405 seq_printf(m, "%02x ", vif->hash.key[i]);
406
407 seq_puts(m, "\n");
408 }
409
410 if (vif->hash.size != 0) {
411 seq_puts(m, "\nHash Mapping:\n");
412
413 for (i = 0; i < vif->hash.size; ) {
414 unsigned int j, n;
415
416 n = 8;
417 if (i + n >= vif->hash.size)
418 n = vif->hash.size - i;
419
420 seq_printf(m, "[%4u - %4u]: ", i, i + n - 1);
421
422 for (j = 0; j < n; j++, i++)
423 seq_printf(m, "%4u ", vif->hash.mapping[i]);
424
425 seq_puts(m, "\n");
426 }
427 }
428}
429#endif /* CONFIG_DEBUG_FS */
430
363void xenvif_init_hash(struct xenvif *vif) 431void xenvif_init_hash(struct xenvif *vif)
364{ 432{
365 if (xenvif_hash_cache_size == 0) 433 if (xenvif_hash_cache_size == 0)
diff --git a/drivers/net/xen-netback/rx.c b/drivers/net/xen-netback/rx.c
index 8e9ade6ccf18..b1cf7c6f407a 100644
--- a/drivers/net/xen-netback/rx.c
+++ b/drivers/net/xen-netback/rx.c
@@ -337,9 +337,9 @@ static void xenvif_rx_next_chunk(struct xenvif_queue *queue,
337 frag_data += pkt->frag_offset; 337 frag_data += pkt->frag_offset;
338 frag_len -= pkt->frag_offset; 338 frag_len -= pkt->frag_offset;
339 339
340 chunk_len = min(frag_len, XEN_PAGE_SIZE - offset); 340 chunk_len = min_t(size_t, frag_len, XEN_PAGE_SIZE - offset);
341 chunk_len = min(chunk_len, 341 chunk_len = min_t(size_t, chunk_len, XEN_PAGE_SIZE -
342 XEN_PAGE_SIZE - xen_offset_in_page(frag_data)); 342 xen_offset_in_page(frag_data));
343 343
344 pkt->frag_offset += chunk_len; 344 pkt->frag_offset += chunk_len;
345 345
@@ -425,6 +425,8 @@ void xenvif_rx_skb(struct xenvif_queue *queue)
425 425
426 xenvif_rx_next_skb(queue, &pkt); 426 xenvif_rx_next_skb(queue, &pkt);
427 427
428 queue->last_rx_time = jiffies;
429
428 do { 430 do {
429 struct xen_netif_rx_request *req; 431 struct xen_netif_rx_request *req;
430 struct xen_netif_rx_response *rsp; 432 struct xen_netif_rx_response *rsp;
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
index 7056404e3cb8..8674e188b697 100644
--- a/drivers/net/xen-netback/xenbus.c
+++ b/drivers/net/xen-netback/xenbus.c
@@ -165,7 +165,7 @@ xenvif_write_io_ring(struct file *filp, const char __user *buf, size_t count,
165 return count; 165 return count;
166} 166}
167 167
168static int xenvif_dump_open(struct inode *inode, struct file *filp) 168static int xenvif_io_ring_open(struct inode *inode, struct file *filp)
169{ 169{
170 int ret; 170 int ret;
171 void *queue = NULL; 171 void *queue = NULL;
@@ -179,13 +179,35 @@ static int xenvif_dump_open(struct inode *inode, struct file *filp)
179 179
180static const struct file_operations xenvif_dbg_io_ring_ops_fops = { 180static const struct file_operations xenvif_dbg_io_ring_ops_fops = {
181 .owner = THIS_MODULE, 181 .owner = THIS_MODULE,
182 .open = xenvif_dump_open, 182 .open = xenvif_io_ring_open,
183 .read = seq_read, 183 .read = seq_read,
184 .llseek = seq_lseek, 184 .llseek = seq_lseek,
185 .release = single_release, 185 .release = single_release,
186 .write = xenvif_write_io_ring, 186 .write = xenvif_write_io_ring,
187}; 187};
188 188
189static int xenvif_read_ctrl(struct seq_file *m, void *v)
190{
191 struct xenvif *vif = m->private;
192
193 xenvif_dump_hash_info(vif, m);
194
195 return 0;
196}
197
198static int xenvif_ctrl_open(struct inode *inode, struct file *filp)
199{
200 return single_open(filp, xenvif_read_ctrl, inode->i_private);
201}
202
203static const struct file_operations xenvif_dbg_ctrl_ops_fops = {
204 .owner = THIS_MODULE,
205 .open = xenvif_ctrl_open,
206 .read = seq_read,
207 .llseek = seq_lseek,
208 .release = single_release,
209};
210
189static void xenvif_debugfs_addif(struct xenvif *vif) 211static void xenvif_debugfs_addif(struct xenvif *vif)
190{ 212{
191 struct dentry *pfile; 213 struct dentry *pfile;
@@ -210,6 +232,17 @@ static void xenvif_debugfs_addif(struct xenvif *vif)
210 pr_warn("Creation of io_ring file returned %ld!\n", 232 pr_warn("Creation of io_ring file returned %ld!\n",
211 PTR_ERR(pfile)); 233 PTR_ERR(pfile));
212 } 234 }
235
236 if (vif->ctrl_irq) {
237 pfile = debugfs_create_file("ctrl",
238 S_IRUSR,
239 vif->xenvif_dbg_root,
240 vif,
241 &xenvif_dbg_ctrl_ops_fops);
242 if (IS_ERR_OR_NULL(pfile))
243 pr_warn("Creation of ctrl file returned %ld!\n",
244 PTR_ERR(pfile));
245 }
213 } else 246 } else
214 netdev_warn(vif->dev, 247 netdev_warn(vif->dev,
215 "Creation of vif debugfs dir returned %ld!\n", 248 "Creation of vif debugfs dir returned %ld!\n",