diff options
Diffstat (limited to 'drivers/net')
92 files changed, 1308 insertions, 797 deletions
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 84673ebcf428..df51d6025a90 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
| @@ -157,7 +157,7 @@ config IPVLAN | |||
| 157 | making it transparent to the connected L2 switch. | 157 | making it transparent to the connected L2 switch. |
| 158 | 158 | ||
| 159 | Ipvlan devices can be added using the "ip" command from the | 159 | Ipvlan devices can be added using the "ip" command from the |
| 160 | iproute2 package starting with the iproute2-X.Y.ZZ release: | 160 | iproute2 package starting with the iproute2-3.19 release: |
| 161 | 161 | ||
| 162 | "ip link add link <main-dev> [ NAME ] type ipvlan" | 162 | "ip link add link <main-dev> [ NAME ] type ipvlan" |
| 163 | 163 | ||
diff --git a/drivers/net/appletalk/Kconfig b/drivers/net/appletalk/Kconfig index 4ce6ca5f3d36..dc6b78e5342f 100644 --- a/drivers/net/appletalk/Kconfig +++ b/drivers/net/appletalk/Kconfig | |||
| @@ -40,7 +40,7 @@ config DEV_APPLETALK | |||
| 40 | 40 | ||
| 41 | config LTPC | 41 | config LTPC |
| 42 | tristate "Apple/Farallon LocalTalk PC support" | 42 | tristate "Apple/Farallon LocalTalk PC support" |
| 43 | depends on DEV_APPLETALK && (ISA || EISA) && ISA_DMA_API | 43 | depends on DEV_APPLETALK && (ISA || EISA) && ISA_DMA_API && VIRT_TO_BUS |
| 44 | help | 44 | help |
| 45 | This allows you to use the AppleTalk PC card to connect to LocalTalk | 45 | This allows you to use the AppleTalk PC card to connect to LocalTalk |
| 46 | networks. The card is also known as the Farallon PhoneNet PC card. | 46 | networks. The card is also known as the Farallon PhoneNet PC card. |
diff --git a/drivers/net/can/Kconfig b/drivers/net/can/Kconfig index 98d73aab52fe..58808f651452 100644 --- a/drivers/net/can/Kconfig +++ b/drivers/net/can/Kconfig | |||
| @@ -131,7 +131,7 @@ config CAN_RCAR | |||
| 131 | 131 | ||
| 132 | config CAN_XILINXCAN | 132 | config CAN_XILINXCAN |
| 133 | tristate "Xilinx CAN" | 133 | tristate "Xilinx CAN" |
| 134 | depends on ARCH_ZYNQ || MICROBLAZE || COMPILE_TEST | 134 | depends on ARCH_ZYNQ || ARM64 || MICROBLAZE || COMPILE_TEST |
| 135 | depends on COMMON_CLK && HAS_IOMEM | 135 | depends on COMMON_CLK && HAS_IOMEM |
| 136 | ---help--- | 136 | ---help--- |
| 137 | Xilinx CAN driver. This driver supports both soft AXI CAN IP and | 137 | Xilinx CAN driver. This driver supports both soft AXI CAN IP and |
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c index 3c82e02e3dae..b0f69248cb71 100644 --- a/drivers/net/can/dev.c +++ b/drivers/net/can/dev.c | |||
| @@ -579,6 +579,10 @@ struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf) | |||
| 579 | skb->pkt_type = PACKET_BROADCAST; | 579 | skb->pkt_type = PACKET_BROADCAST; |
| 580 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 580 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
| 581 | 581 | ||
| 582 | skb_reset_mac_header(skb); | ||
| 583 | skb_reset_network_header(skb); | ||
| 584 | skb_reset_transport_header(skb); | ||
| 585 | |||
| 582 | can_skb_reserve(skb); | 586 | can_skb_reserve(skb); |
| 583 | can_skb_prv(skb)->ifindex = dev->ifindex; | 587 | can_skb_prv(skb)->ifindex = dev->ifindex; |
| 584 | 588 | ||
| @@ -603,6 +607,10 @@ struct sk_buff *alloc_canfd_skb(struct net_device *dev, | |||
| 603 | skb->pkt_type = PACKET_BROADCAST; | 607 | skb->pkt_type = PACKET_BROADCAST; |
| 604 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 608 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
| 605 | 609 | ||
| 610 | skb_reset_mac_header(skb); | ||
| 611 | skb_reset_network_header(skb); | ||
| 612 | skb_reset_transport_header(skb); | ||
| 613 | |||
| 606 | can_skb_reserve(skb); | 614 | can_skb_reserve(skb); |
| 607 | can_skb_prv(skb)->ifindex = dev->ifindex; | 615 | can_skb_prv(skb)->ifindex = dev->ifindex; |
| 608 | 616 | ||
diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c index 2928f7003041..e97a08ce0b90 100644 --- a/drivers/net/can/usb/kvaser_usb.c +++ b/drivers/net/can/usb/kvaser_usb.c | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | * Copyright (C) 2015 Valeo S.A. | 14 | * Copyright (C) 2015 Valeo S.A. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | #include <linux/spinlock.h> | ||
| 18 | #include <linux/kernel.h> | ||
| 17 | #include <linux/completion.h> | 19 | #include <linux/completion.h> |
| 18 | #include <linux/module.h> | 20 | #include <linux/module.h> |
| 19 | #include <linux/netdevice.h> | 21 | #include <linux/netdevice.h> |
| @@ -466,10 +468,11 @@ struct kvaser_usb { | |||
| 466 | struct kvaser_usb_net_priv { | 468 | struct kvaser_usb_net_priv { |
| 467 | struct can_priv can; | 469 | struct can_priv can; |
| 468 | 470 | ||
| 469 | atomic_t active_tx_urbs; | 471 | spinlock_t tx_contexts_lock; |
| 470 | struct usb_anchor tx_submitted; | 472 | int active_tx_contexts; |
| 471 | struct kvaser_usb_tx_urb_context tx_contexts[MAX_TX_URBS]; | 473 | struct kvaser_usb_tx_urb_context tx_contexts[MAX_TX_URBS]; |
| 472 | 474 | ||
| 475 | struct usb_anchor tx_submitted; | ||
| 473 | struct completion start_comp, stop_comp; | 476 | struct completion start_comp, stop_comp; |
| 474 | 477 | ||
| 475 | struct kvaser_usb *dev; | 478 | struct kvaser_usb *dev; |
| @@ -584,8 +587,15 @@ static int kvaser_usb_wait_msg(const struct kvaser_usb *dev, u8 id, | |||
| 584 | while (pos <= actual_len - MSG_HEADER_LEN) { | 587 | while (pos <= actual_len - MSG_HEADER_LEN) { |
| 585 | tmp = buf + pos; | 588 | tmp = buf + pos; |
| 586 | 589 | ||
| 587 | if (!tmp->len) | 590 | /* Handle messages crossing the USB endpoint max packet |
| 588 | break; | 591 | * size boundary. Check kvaser_usb_read_bulk_callback() |
| 592 | * for further details. | ||
| 593 | */ | ||
| 594 | if (tmp->len == 0) { | ||
| 595 | pos = round_up(pos, | ||
| 596 | dev->bulk_in->wMaxPacketSize); | ||
| 597 | continue; | ||
| 598 | } | ||
| 589 | 599 | ||
| 590 | if (pos + tmp->len > actual_len) { | 600 | if (pos + tmp->len > actual_len) { |
| 591 | dev_err(dev->udev->dev.parent, | 601 | dev_err(dev->udev->dev.parent, |
| @@ -686,6 +696,7 @@ static void kvaser_usb_tx_acknowledge(const struct kvaser_usb *dev, | |||
| 686 | struct kvaser_usb_net_priv *priv; | 696 | struct kvaser_usb_net_priv *priv; |
| 687 | struct sk_buff *skb; | 697 | struct sk_buff *skb; |
| 688 | struct can_frame *cf; | 698 | struct can_frame *cf; |
| 699 | unsigned long flags; | ||
| 689 | u8 channel, tid; | 700 | u8 channel, tid; |
| 690 | 701 | ||
| 691 | channel = msg->u.tx_acknowledge_header.channel; | 702 | channel = msg->u.tx_acknowledge_header.channel; |
| @@ -729,12 +740,15 @@ static void kvaser_usb_tx_acknowledge(const struct kvaser_usb *dev, | |||
| 729 | 740 | ||
| 730 | stats->tx_packets++; | 741 | stats->tx_packets++; |
| 731 | stats->tx_bytes += context->dlc; | 742 | stats->tx_bytes += context->dlc; |
| 732 | can_get_echo_skb(priv->netdev, context->echo_index); | ||
| 733 | 743 | ||
| 734 | context->echo_index = MAX_TX_URBS; | 744 | spin_lock_irqsave(&priv->tx_contexts_lock, flags); |
| 735 | atomic_dec(&priv->active_tx_urbs); | ||
| 736 | 745 | ||
| 746 | can_get_echo_skb(priv->netdev, context->echo_index); | ||
| 747 | context->echo_index = MAX_TX_URBS; | ||
| 748 | --priv->active_tx_contexts; | ||
| 737 | netif_wake_queue(priv->netdev); | 749 | netif_wake_queue(priv->netdev); |
| 750 | |||
| 751 | spin_unlock_irqrestore(&priv->tx_contexts_lock, flags); | ||
| 738 | } | 752 | } |
| 739 | 753 | ||
| 740 | static void kvaser_usb_simple_msg_callback(struct urb *urb) | 754 | static void kvaser_usb_simple_msg_callback(struct urb *urb) |
| @@ -787,7 +801,6 @@ static int kvaser_usb_simple_msg_async(struct kvaser_usb_net_priv *priv, | |||
| 787 | netdev_err(netdev, "Error transmitting URB\n"); | 801 | netdev_err(netdev, "Error transmitting URB\n"); |
| 788 | usb_unanchor_urb(urb); | 802 | usb_unanchor_urb(urb); |
| 789 | usb_free_urb(urb); | 803 | usb_free_urb(urb); |
| 790 | kfree(buf); | ||
| 791 | return err; | 804 | return err; |
| 792 | } | 805 | } |
| 793 | 806 | ||
| @@ -796,17 +809,6 @@ static int kvaser_usb_simple_msg_async(struct kvaser_usb_net_priv *priv, | |||
| 796 | return 0; | 809 | return 0; |
| 797 | } | 810 | } |
| 798 | 811 | ||
| 799 | static void kvaser_usb_unlink_tx_urbs(struct kvaser_usb_net_priv *priv) | ||
| 800 | { | ||
| 801 | int i; | ||
| 802 | |||
| 803 | usb_kill_anchored_urbs(&priv->tx_submitted); | ||
| 804 | atomic_set(&priv->active_tx_urbs, 0); | ||
| 805 | |||
| 806 | for (i = 0; i < MAX_TX_URBS; i++) | ||
| 807 | priv->tx_contexts[i].echo_index = MAX_TX_URBS; | ||
| 808 | } | ||
| 809 | |||
| 810 | static void kvaser_usb_rx_error_update_can_state(struct kvaser_usb_net_priv *priv, | 812 | static void kvaser_usb_rx_error_update_can_state(struct kvaser_usb_net_priv *priv, |
| 811 | const struct kvaser_usb_error_summary *es, | 813 | const struct kvaser_usb_error_summary *es, |
| 812 | struct can_frame *cf) | 814 | struct can_frame *cf) |
| @@ -1317,8 +1319,19 @@ static void kvaser_usb_read_bulk_callback(struct urb *urb) | |||
| 1317 | while (pos <= urb->actual_length - MSG_HEADER_LEN) { | 1319 | while (pos <= urb->actual_length - MSG_HEADER_LEN) { |
| 1318 | msg = urb->transfer_buffer + pos; | 1320 | msg = urb->transfer_buffer + pos; |
| 1319 | 1321 | ||
| 1320 | if (!msg->len) | 1322 | /* The Kvaser firmware can only read and write messages that |
| 1321 | break; | 1323 | * does not cross the USB's endpoint wMaxPacketSize boundary. |
| 1324 | * If a follow-up command crosses such boundary, firmware puts | ||
| 1325 | * a placeholder zero-length command in its place then aligns | ||
| 1326 | * the real command to the next max packet size. | ||
| 1327 | * | ||
| 1328 | * Handle such cases or we're going to miss a significant | ||
| 1329 | * number of events in case of a heavy rx load on the bus. | ||
| 1330 | */ | ||
| 1331 | if (msg->len == 0) { | ||
| 1332 | pos = round_up(pos, dev->bulk_in->wMaxPacketSize); | ||
| 1333 | continue; | ||
| 1334 | } | ||
| 1322 | 1335 | ||
| 1323 | if (pos + msg->len > urb->actual_length) { | 1336 | if (pos + msg->len > urb->actual_length) { |
| 1324 | dev_err(dev->udev->dev.parent, "Format error\n"); | 1337 | dev_err(dev->udev->dev.parent, "Format error\n"); |
| @@ -1326,7 +1339,6 @@ static void kvaser_usb_read_bulk_callback(struct urb *urb) | |||
| 1326 | } | 1339 | } |
| 1327 | 1340 | ||
| 1328 | kvaser_usb_handle_message(dev, msg); | 1341 | kvaser_usb_handle_message(dev, msg); |
| 1329 | |||
| 1330 | pos += msg->len; | 1342 | pos += msg->len; |
| 1331 | } | 1343 | } |
| 1332 | 1344 | ||
| @@ -1498,6 +1510,24 @@ error: | |||
| 1498 | return err; | 1510 | return err; |
| 1499 | } | 1511 | } |
| 1500 | 1512 | ||
| 1513 | static void kvaser_usb_reset_tx_urb_contexts(struct kvaser_usb_net_priv *priv) | ||
| 1514 | { | ||
| 1515 | int i; | ||
| 1516 | |||
| 1517 | priv->active_tx_contexts = 0; | ||
| 1518 | for (i = 0; i < MAX_TX_URBS; i++) | ||
| 1519 | priv->tx_contexts[i].echo_index = MAX_TX_URBS; | ||
| 1520 | } | ||
| 1521 | |||
| 1522 | /* This method might sleep. Do not call it in the atomic context | ||
| 1523 | * of URB completions. | ||
| 1524 | */ | ||
| 1525 | static void kvaser_usb_unlink_tx_urbs(struct kvaser_usb_net_priv *priv) | ||
| 1526 | { | ||
| 1527 | usb_kill_anchored_urbs(&priv->tx_submitted); | ||
| 1528 | kvaser_usb_reset_tx_urb_contexts(priv); | ||
| 1529 | } | ||
| 1530 | |||
| 1501 | static void kvaser_usb_unlink_all_urbs(struct kvaser_usb *dev) | 1531 | static void kvaser_usb_unlink_all_urbs(struct kvaser_usb *dev) |
| 1502 | { | 1532 | { |
| 1503 | int i; | 1533 | int i; |
| @@ -1615,9 +1645,9 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb, | |||
| 1615 | struct urb *urb; | 1645 | struct urb *urb; |
| 1616 | void *buf; | 1646 | void *buf; |
| 1617 | struct kvaser_msg *msg; | 1647 | struct kvaser_msg *msg; |
| 1618 | int i, err; | 1648 | int i, err, ret = NETDEV_TX_OK; |
| 1619 | int ret = NETDEV_TX_OK; | ||
| 1620 | u8 *msg_tx_can_flags = NULL; /* GCC */ | 1649 | u8 *msg_tx_can_flags = NULL; /* GCC */ |
| 1650 | unsigned long flags; | ||
| 1621 | 1651 | ||
| 1622 | if (can_dropped_invalid_skb(netdev, skb)) | 1652 | if (can_dropped_invalid_skb(netdev, skb)) |
| 1623 | return NETDEV_TX_OK; | 1653 | return NETDEV_TX_OK; |
| @@ -1634,7 +1664,7 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb, | |||
| 1634 | if (!buf) { | 1664 | if (!buf) { |
| 1635 | stats->tx_dropped++; | 1665 | stats->tx_dropped++; |
| 1636 | dev_kfree_skb(skb); | 1666 | dev_kfree_skb(skb); |
| 1637 | goto nobufmem; | 1667 | goto freeurb; |
| 1638 | } | 1668 | } |
| 1639 | 1669 | ||
| 1640 | msg = buf; | 1670 | msg = buf; |
| @@ -1671,22 +1701,32 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb, | |||
| 1671 | if (cf->can_id & CAN_RTR_FLAG) | 1701 | if (cf->can_id & CAN_RTR_FLAG) |
| 1672 | *msg_tx_can_flags |= MSG_FLAG_REMOTE_FRAME; | 1702 | *msg_tx_can_flags |= MSG_FLAG_REMOTE_FRAME; |
| 1673 | 1703 | ||
| 1704 | spin_lock_irqsave(&priv->tx_contexts_lock, flags); | ||
| 1674 | for (i = 0; i < ARRAY_SIZE(priv->tx_contexts); i++) { | 1705 | for (i = 0; i < ARRAY_SIZE(priv->tx_contexts); i++) { |
| 1675 | if (priv->tx_contexts[i].echo_index == MAX_TX_URBS) { | 1706 | if (priv->tx_contexts[i].echo_index == MAX_TX_URBS) { |
| 1676 | context = &priv->tx_contexts[i]; | 1707 | context = &priv->tx_contexts[i]; |
| 1708 | |||
| 1709 | context->echo_index = i; | ||
| 1710 | can_put_echo_skb(skb, netdev, context->echo_index); | ||
| 1711 | ++priv->active_tx_contexts; | ||
| 1712 | if (priv->active_tx_contexts >= MAX_TX_URBS) | ||
| 1713 | netif_stop_queue(netdev); | ||
| 1714 | |||
| 1677 | break; | 1715 | break; |
| 1678 | } | 1716 | } |
| 1679 | } | 1717 | } |
| 1718 | spin_unlock_irqrestore(&priv->tx_contexts_lock, flags); | ||
| 1680 | 1719 | ||
| 1681 | /* This should never happen; it implies a flow control bug */ | 1720 | /* This should never happen; it implies a flow control bug */ |
| 1682 | if (!context) { | 1721 | if (!context) { |
| 1683 | netdev_warn(netdev, "cannot find free context\n"); | 1722 | netdev_warn(netdev, "cannot find free context\n"); |
| 1723 | |||
| 1724 | kfree(buf); | ||
| 1684 | ret = NETDEV_TX_BUSY; | 1725 | ret = NETDEV_TX_BUSY; |
| 1685 | goto releasebuf; | 1726 | goto freeurb; |
| 1686 | } | 1727 | } |
| 1687 | 1728 | ||
| 1688 | context->priv = priv; | 1729 | context->priv = priv; |
| 1689 | context->echo_index = i; | ||
| 1690 | context->dlc = cf->can_dlc; | 1730 | context->dlc = cf->can_dlc; |
| 1691 | 1731 | ||
| 1692 | msg->u.tx_can.tid = context->echo_index; | 1732 | msg->u.tx_can.tid = context->echo_index; |
| @@ -1698,18 +1738,17 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb, | |||
| 1698 | kvaser_usb_write_bulk_callback, context); | 1738 | kvaser_usb_write_bulk_callback, context); |
| 1699 | usb_anchor_urb(urb, &priv->tx_submitted); | 1739 | usb_anchor_urb(urb, &priv->tx_submitted); |
| 1700 | 1740 | ||
| 1701 | can_put_echo_skb(skb, netdev, context->echo_index); | ||
| 1702 | |||
| 1703 | atomic_inc(&priv->active_tx_urbs); | ||
| 1704 | |||
| 1705 | if (atomic_read(&priv->active_tx_urbs) >= MAX_TX_URBS) | ||
| 1706 | netif_stop_queue(netdev); | ||
| 1707 | |||
| 1708 | err = usb_submit_urb(urb, GFP_ATOMIC); | 1741 | err = usb_submit_urb(urb, GFP_ATOMIC); |
| 1709 | if (unlikely(err)) { | 1742 | if (unlikely(err)) { |
| 1743 | spin_lock_irqsave(&priv->tx_contexts_lock, flags); | ||
| 1744 | |||
| 1710 | can_free_echo_skb(netdev, context->echo_index); | 1745 | can_free_echo_skb(netdev, context->echo_index); |
| 1746 | context->echo_index = MAX_TX_URBS; | ||
| 1747 | --priv->active_tx_contexts; | ||
| 1748 | netif_wake_queue(netdev); | ||
| 1749 | |||
| 1750 | spin_unlock_irqrestore(&priv->tx_contexts_lock, flags); | ||
| 1711 | 1751 | ||
| 1712 | atomic_dec(&priv->active_tx_urbs); | ||
| 1713 | usb_unanchor_urb(urb); | 1752 | usb_unanchor_urb(urb); |
| 1714 | 1753 | ||
| 1715 | stats->tx_dropped++; | 1754 | stats->tx_dropped++; |
| @@ -1719,16 +1758,12 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb, | |||
| 1719 | else | 1758 | else |
| 1720 | netdev_warn(netdev, "Failed tx_urb %d\n", err); | 1759 | netdev_warn(netdev, "Failed tx_urb %d\n", err); |
| 1721 | 1760 | ||
| 1722 | goto releasebuf; | 1761 | goto freeurb; |
| 1723 | } | 1762 | } |
| 1724 | 1763 | ||
| 1725 | usb_free_urb(urb); | 1764 | ret = NETDEV_TX_OK; |
| 1726 | |||
| 1727 | return NETDEV_TX_OK; | ||
| 1728 | 1765 | ||
| 1729 | releasebuf: | 1766 | freeurb: |
| 1730 | kfree(buf); | ||
| 1731 | nobufmem: | ||
| 1732 | usb_free_urb(urb); | 1767 | usb_free_urb(urb); |
| 1733 | return ret; | 1768 | return ret; |
| 1734 | } | 1769 | } |
| @@ -1840,7 +1875,7 @@ static int kvaser_usb_init_one(struct usb_interface *intf, | |||
| 1840 | struct kvaser_usb *dev = usb_get_intfdata(intf); | 1875 | struct kvaser_usb *dev = usb_get_intfdata(intf); |
| 1841 | struct net_device *netdev; | 1876 | struct net_device *netdev; |
| 1842 | struct kvaser_usb_net_priv *priv; | 1877 | struct kvaser_usb_net_priv *priv; |
| 1843 | int i, err; | 1878 | int err; |
| 1844 | 1879 | ||
| 1845 | err = kvaser_usb_send_simple_msg(dev, CMD_RESET_CHIP, channel); | 1880 | err = kvaser_usb_send_simple_msg(dev, CMD_RESET_CHIP, channel); |
| 1846 | if (err) | 1881 | if (err) |
| @@ -1854,19 +1889,17 @@ static int kvaser_usb_init_one(struct usb_interface *intf, | |||
| 1854 | 1889 | ||
| 1855 | priv = netdev_priv(netdev); | 1890 | priv = netdev_priv(netdev); |
| 1856 | 1891 | ||
| 1892 | init_usb_anchor(&priv->tx_submitted); | ||
| 1857 | init_completion(&priv->start_comp); | 1893 | init_completion(&priv->start_comp); |
| 1858 | init_completion(&priv->stop_comp); | 1894 | init_completion(&priv->stop_comp); |
| 1859 | 1895 | ||
| 1860 | init_usb_anchor(&priv->tx_submitted); | ||
| 1861 | atomic_set(&priv->active_tx_urbs, 0); | ||
| 1862 | |||
| 1863 | for (i = 0; i < ARRAY_SIZE(priv->tx_contexts); i++) | ||
| 1864 | priv->tx_contexts[i].echo_index = MAX_TX_URBS; | ||
| 1865 | |||
| 1866 | priv->dev = dev; | 1896 | priv->dev = dev; |
| 1867 | priv->netdev = netdev; | 1897 | priv->netdev = netdev; |
| 1868 | priv->channel = channel; | 1898 | priv->channel = channel; |
| 1869 | 1899 | ||
| 1900 | spin_lock_init(&priv->tx_contexts_lock); | ||
| 1901 | kvaser_usb_reset_tx_urb_contexts(priv); | ||
| 1902 | |||
| 1870 | priv->can.state = CAN_STATE_STOPPED; | 1903 | priv->can.state = CAN_STATE_STOPPED; |
| 1871 | priv->can.clock.freq = CAN_USB_CLOCK; | 1904 | priv->can.clock.freq = CAN_USB_CLOCK; |
| 1872 | priv->can.bittiming_const = &kvaser_usb_bittiming_const; | 1905 | priv->can.bittiming_const = &kvaser_usb_bittiming_const; |
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_fd.c b/drivers/net/can/usb/peak_usb/pcan_usb_fd.c index 962c3f027383..0bac0f14edc3 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb_fd.c +++ b/drivers/net/can/usb/peak_usb/pcan_usb_fd.c | |||
| @@ -879,6 +879,10 @@ static int pcan_usb_fd_init(struct peak_usb_device *dev) | |||
| 879 | 879 | ||
| 880 | pdev->usb_if = ppdev->usb_if; | 880 | pdev->usb_if = ppdev->usb_if; |
| 881 | pdev->cmd_buffer_addr = ppdev->cmd_buffer_addr; | 881 | pdev->cmd_buffer_addr = ppdev->cmd_buffer_addr; |
| 882 | |||
| 883 | /* do a copy of the ctrlmode[_supported] too */ | ||
| 884 | dev->can.ctrlmode = ppdev->dev.can.ctrlmode; | ||
| 885 | dev->can.ctrlmode_supported = ppdev->dev.can.ctrlmode_supported; | ||
| 882 | } | 886 | } |
| 883 | 887 | ||
| 884 | pdev->usb_if->dev[dev->ctrl_idx] = dev; | 888 | pdev->usb_if->dev[dev->ctrl_idx] = dev; |
diff --git a/drivers/net/dsa/bcm_sf2.h b/drivers/net/dsa/bcm_sf2.h index ee9f650d5026..7b7053d3c5fa 100644 --- a/drivers/net/dsa/bcm_sf2.h +++ b/drivers/net/dsa/bcm_sf2.h | |||
| @@ -105,8 +105,8 @@ static inline u64 name##_readq(struct bcm_sf2_priv *priv, u32 off) \ | |||
| 105 | { \ | 105 | { \ |
| 106 | u32 indir, dir; \ | 106 | u32 indir, dir; \ |
| 107 | spin_lock(&priv->indir_lock); \ | 107 | spin_lock(&priv->indir_lock); \ |
| 108 | indir = reg_readl(priv, REG_DIR_DATA_READ); \ | ||
| 109 | dir = __raw_readl(priv->name + off); \ | 108 | dir = __raw_readl(priv->name + off); \ |
| 109 | indir = reg_readl(priv, REG_DIR_DATA_READ); \ | ||
| 110 | spin_unlock(&priv->indir_lock); \ | 110 | spin_unlock(&priv->indir_lock); \ |
| 111 | return (u64)indir << 32 | dir; \ | 111 | return (u64)indir << 32 | dir; \ |
| 112 | } \ | 112 | } \ |
diff --git a/drivers/net/ethernet/8390/axnet_cs.c b/drivers/net/ethernet/8390/axnet_cs.c index 7769c05543f1..ec6eac1f8c95 100644 --- a/drivers/net/ethernet/8390/axnet_cs.c +++ b/drivers/net/ethernet/8390/axnet_cs.c | |||
| @@ -484,11 +484,8 @@ static int axnet_open(struct net_device *dev) | |||
| 484 | link->open++; | 484 | link->open++; |
| 485 | 485 | ||
| 486 | info->link_status = 0x00; | 486 | info->link_status = 0x00; |
| 487 | init_timer(&info->watchdog); | 487 | setup_timer(&info->watchdog, ei_watchdog, (u_long)dev); |
| 488 | info->watchdog.function = ei_watchdog; | 488 | mod_timer(&info->watchdog, jiffies + HZ); |
| 489 | info->watchdog.data = (u_long)dev; | ||
| 490 | info->watchdog.expires = jiffies + HZ; | ||
| 491 | add_timer(&info->watchdog); | ||
| 492 | 489 | ||
| 493 | return ax_open(dev); | 490 | return ax_open(dev); |
| 494 | } /* axnet_open */ | 491 | } /* axnet_open */ |
diff --git a/drivers/net/ethernet/8390/pcnet_cs.c b/drivers/net/ethernet/8390/pcnet_cs.c index 9fb7b9d4fd6c..2777289a26c0 100644 --- a/drivers/net/ethernet/8390/pcnet_cs.c +++ b/drivers/net/ethernet/8390/pcnet_cs.c | |||
| @@ -918,11 +918,8 @@ static int pcnet_open(struct net_device *dev) | |||
| 918 | 918 | ||
| 919 | info->phy_id = info->eth_phy; | 919 | info->phy_id = info->eth_phy; |
| 920 | info->link_status = 0x00; | 920 | info->link_status = 0x00; |
| 921 | init_timer(&info->watchdog); | 921 | setup_timer(&info->watchdog, ei_watchdog, (u_long)dev); |
| 922 | info->watchdog.function = ei_watchdog; | 922 | mod_timer(&info->watchdog, jiffies + HZ); |
| 923 | info->watchdog.data = (u_long)dev; | ||
| 924 | info->watchdog.expires = jiffies + HZ; | ||
| 925 | add_timer(&info->watchdog); | ||
| 926 | 923 | ||
| 927 | return ei_open(dev); | 924 | return ei_open(dev); |
| 928 | } /* pcnet_open */ | 925 | } /* pcnet_open */ |
diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/ethernet/altera/altera_tse_main.c index 760c72c6e2ac..6725dc00750b 100644 --- a/drivers/net/ethernet/altera/altera_tse_main.c +++ b/drivers/net/ethernet/altera/altera_tse_main.c | |||
| @@ -376,7 +376,8 @@ static int tse_rx(struct altera_tse_private *priv, int limit) | |||
| 376 | u16 pktlength; | 376 | u16 pktlength; |
| 377 | u16 pktstatus; | 377 | u16 pktstatus; |
| 378 | 378 | ||
| 379 | while ((rxstatus = priv->dmaops->get_rx_status(priv)) != 0) { | 379 | while (((rxstatus = priv->dmaops->get_rx_status(priv)) != 0) && |
| 380 | (count < limit)) { | ||
| 380 | pktstatus = rxstatus >> 16; | 381 | pktstatus = rxstatus >> 16; |
| 381 | pktlength = rxstatus & 0xffff; | 382 | pktlength = rxstatus & 0xffff; |
| 382 | 383 | ||
| @@ -491,28 +492,27 @@ static int tse_poll(struct napi_struct *napi, int budget) | |||
| 491 | struct altera_tse_private *priv = | 492 | struct altera_tse_private *priv = |
| 492 | container_of(napi, struct altera_tse_private, napi); | 493 | container_of(napi, struct altera_tse_private, napi); |
| 493 | int rxcomplete = 0; | 494 | int rxcomplete = 0; |
| 494 | int txcomplete = 0; | ||
| 495 | unsigned long int flags; | 495 | unsigned long int flags; |
| 496 | 496 | ||
| 497 | txcomplete = tse_tx_complete(priv); | 497 | tse_tx_complete(priv); |
| 498 | 498 | ||
| 499 | rxcomplete = tse_rx(priv, budget); | 499 | rxcomplete = tse_rx(priv, budget); |
| 500 | 500 | ||
| 501 | if (rxcomplete >= budget || txcomplete > 0) | 501 | if (rxcomplete < budget) { |
| 502 | return rxcomplete; | ||
| 503 | 502 | ||
| 504 | napi_gro_flush(napi, false); | 503 | napi_gro_flush(napi, false); |
| 505 | __napi_complete(napi); | 504 | __napi_complete(napi); |
| 506 | 505 | ||
| 507 | netdev_dbg(priv->dev, | 506 | netdev_dbg(priv->dev, |
| 508 | "NAPI Complete, did %d packets with budget %d\n", | 507 | "NAPI Complete, did %d packets with budget %d\n", |
| 509 | txcomplete+rxcomplete, budget); | 508 | rxcomplete, budget); |
| 510 | 509 | ||
| 511 | spin_lock_irqsave(&priv->rxdma_irq_lock, flags); | 510 | spin_lock_irqsave(&priv->rxdma_irq_lock, flags); |
| 512 | priv->dmaops->enable_rxirq(priv); | 511 | priv->dmaops->enable_rxirq(priv); |
| 513 | priv->dmaops->enable_txirq(priv); | 512 | priv->dmaops->enable_txirq(priv); |
| 514 | spin_unlock_irqrestore(&priv->rxdma_irq_lock, flags); | 513 | spin_unlock_irqrestore(&priv->rxdma_irq_lock, flags); |
| 515 | return rxcomplete + txcomplete; | 514 | } |
| 515 | return rxcomplete; | ||
| 516 | } | 516 | } |
| 517 | 517 | ||
| 518 | /* DMA TX & RX FIFO interrupt routing | 518 | /* DMA TX & RX FIFO interrupt routing |
| @@ -521,7 +521,6 @@ static irqreturn_t altera_isr(int irq, void *dev_id) | |||
| 521 | { | 521 | { |
| 522 | struct net_device *dev = dev_id; | 522 | struct net_device *dev = dev_id; |
| 523 | struct altera_tse_private *priv; | 523 | struct altera_tse_private *priv; |
| 524 | unsigned long int flags; | ||
| 525 | 524 | ||
| 526 | if (unlikely(!dev)) { | 525 | if (unlikely(!dev)) { |
| 527 | pr_err("%s: invalid dev pointer\n", __func__); | 526 | pr_err("%s: invalid dev pointer\n", __func__); |
| @@ -529,20 +528,20 @@ static irqreturn_t altera_isr(int irq, void *dev_id) | |||
| 529 | } | 528 | } |
| 530 | priv = netdev_priv(dev); | 529 | priv = netdev_priv(dev); |
| 531 | 530 | ||
| 532 | /* turn off desc irqs and enable napi rx */ | 531 | spin_lock(&priv->rxdma_irq_lock); |
| 533 | spin_lock_irqsave(&priv->rxdma_irq_lock, flags); | 532 | /* reset IRQs */ |
| 533 | priv->dmaops->clear_rxirq(priv); | ||
| 534 | priv->dmaops->clear_txirq(priv); | ||
| 535 | spin_unlock(&priv->rxdma_irq_lock); | ||
| 534 | 536 | ||
| 535 | if (likely(napi_schedule_prep(&priv->napi))) { | 537 | if (likely(napi_schedule_prep(&priv->napi))) { |
| 538 | spin_lock(&priv->rxdma_irq_lock); | ||
| 536 | priv->dmaops->disable_rxirq(priv); | 539 | priv->dmaops->disable_rxirq(priv); |
| 537 | priv->dmaops->disable_txirq(priv); | 540 | priv->dmaops->disable_txirq(priv); |
| 541 | spin_unlock(&priv->rxdma_irq_lock); | ||
| 538 | __napi_schedule(&priv->napi); | 542 | __napi_schedule(&priv->napi); |
| 539 | } | 543 | } |
| 540 | 544 | ||
| 541 | /* reset IRQs */ | ||
| 542 | priv->dmaops->clear_rxirq(priv); | ||
| 543 | priv->dmaops->clear_txirq(priv); | ||
| 544 | |||
| 545 | spin_unlock_irqrestore(&priv->rxdma_irq_lock, flags); | ||
| 546 | 545 | ||
| 547 | return IRQ_HANDLED; | 546 | return IRQ_HANDLED; |
| 548 | } | 547 | } |
| @@ -1399,7 +1398,7 @@ static int altera_tse_probe(struct platform_device *pdev) | |||
| 1399 | } | 1398 | } |
| 1400 | 1399 | ||
| 1401 | if (of_property_read_u32(pdev->dev.of_node, "tx-fifo-depth", | 1400 | if (of_property_read_u32(pdev->dev.of_node, "tx-fifo-depth", |
| 1402 | &priv->rx_fifo_depth)) { | 1401 | &priv->tx_fifo_depth)) { |
| 1403 | dev_err(&pdev->dev, "cannot obtain tx-fifo-depth\n"); | 1402 | dev_err(&pdev->dev, "cannot obtain tx-fifo-depth\n"); |
| 1404 | ret = -ENXIO; | 1403 | ret = -ENXIO; |
| 1405 | goto err_free_netdev; | 1404 | goto err_free_netdev; |
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c index b93d4404d975..885b02b5be07 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c | |||
| @@ -609,6 +609,68 @@ static void xgbe_napi_disable(struct xgbe_prv_data *pdata, unsigned int del) | |||
| 609 | } | 609 | } |
| 610 | } | 610 | } |
| 611 | 611 | ||
| 612 | static int xgbe_request_irqs(struct xgbe_prv_data *pdata) | ||
| 613 | { | ||
| 614 | struct xgbe_channel *channel; | ||
| 615 | struct net_device *netdev = pdata->netdev; | ||
| 616 | unsigned int i; | ||
| 617 | int ret; | ||
| 618 | |||
| 619 | ret = devm_request_irq(pdata->dev, pdata->dev_irq, xgbe_isr, 0, | ||
| 620 | netdev->name, pdata); | ||
| 621 | if (ret) { | ||
| 622 | netdev_alert(netdev, "error requesting irq %d\n", | ||
| 623 | pdata->dev_irq); | ||
| 624 | return ret; | ||
| 625 | } | ||
| 626 | |||
| 627 | if (!pdata->per_channel_irq) | ||
| 628 | return 0; | ||
| 629 | |||
| 630 | channel = pdata->channel; | ||
| 631 | for (i = 0; i < pdata->channel_count; i++, channel++) { | ||
| 632 | snprintf(channel->dma_irq_name, | ||
| 633 | sizeof(channel->dma_irq_name) - 1, | ||
| 634 | "%s-TxRx-%u", netdev_name(netdev), | ||
| 635 | channel->queue_index); | ||
| 636 | |||
| 637 | ret = devm_request_irq(pdata->dev, channel->dma_irq, | ||
| 638 | xgbe_dma_isr, 0, | ||
| 639 | channel->dma_irq_name, channel); | ||
| 640 | if (ret) { | ||
| 641 | netdev_alert(netdev, "error requesting irq %d\n", | ||
| 642 | channel->dma_irq); | ||
| 643 | goto err_irq; | ||
| 644 | } | ||
| 645 | } | ||
| 646 | |||
| 647 | return 0; | ||
| 648 | |||
| 649 | err_irq: | ||
| 650 | /* Using an unsigned int, 'i' will go to UINT_MAX and exit */ | ||
| 651 | for (i--, channel--; i < pdata->channel_count; i--, channel--) | ||
| 652 | devm_free_irq(pdata->dev, channel->dma_irq, channel); | ||
| 653 | |||
| 654 | devm_free_irq(pdata->dev, pdata->dev_irq, pdata); | ||
| 655 | |||
| 656 | return ret; | ||
| 657 | } | ||
| 658 | |||
| 659 | static void xgbe_free_irqs(struct xgbe_prv_data *pdata) | ||
| 660 | { | ||
| 661 | struct xgbe_channel *channel; | ||
| 662 | unsigned int i; | ||
| 663 | |||
| 664 | devm_free_irq(pdata->dev, pdata->dev_irq, pdata); | ||
| 665 | |||
| 666 | if (!pdata->per_channel_irq) | ||
| 667 | return; | ||
| 668 | |||
| 669 | channel = pdata->channel; | ||
| 670 | for (i = 0; i < pdata->channel_count; i++, channel++) | ||
| 671 | devm_free_irq(pdata->dev, channel->dma_irq, channel); | ||
| 672 | } | ||
| 673 | |||
| 612 | void xgbe_init_tx_coalesce(struct xgbe_prv_data *pdata) | 674 | void xgbe_init_tx_coalesce(struct xgbe_prv_data *pdata) |
| 613 | { | 675 | { |
| 614 | struct xgbe_hw_if *hw_if = &pdata->hw_if; | 676 | struct xgbe_hw_if *hw_if = &pdata->hw_if; |
| @@ -810,20 +872,20 @@ int xgbe_powerdown(struct net_device *netdev, unsigned int caller) | |||
| 810 | return -EINVAL; | 872 | return -EINVAL; |
| 811 | } | 873 | } |
| 812 | 874 | ||
| 813 | phy_stop(pdata->phydev); | ||
| 814 | |||
| 815 | spin_lock_irqsave(&pdata->lock, flags); | 875 | spin_lock_irqsave(&pdata->lock, flags); |
| 816 | 876 | ||
| 817 | if (caller == XGMAC_DRIVER_CONTEXT) | 877 | if (caller == XGMAC_DRIVER_CONTEXT) |
| 818 | netif_device_detach(netdev); | 878 | netif_device_detach(netdev); |
| 819 | 879 | ||
| 820 | netif_tx_stop_all_queues(netdev); | 880 | netif_tx_stop_all_queues(netdev); |
| 821 | xgbe_napi_disable(pdata, 0); | ||
| 822 | 881 | ||
| 823 | /* Powerdown Tx/Rx */ | ||
| 824 | hw_if->powerdown_tx(pdata); | 882 | hw_if->powerdown_tx(pdata); |
| 825 | hw_if->powerdown_rx(pdata); | 883 | hw_if->powerdown_rx(pdata); |
| 826 | 884 | ||
| 885 | xgbe_napi_disable(pdata, 0); | ||
| 886 | |||
| 887 | phy_stop(pdata->phydev); | ||
| 888 | |||
| 827 | pdata->power_down = 1; | 889 | pdata->power_down = 1; |
| 828 | 890 | ||
| 829 | spin_unlock_irqrestore(&pdata->lock, flags); | 891 | spin_unlock_irqrestore(&pdata->lock, flags); |
| @@ -854,14 +916,14 @@ int xgbe_powerup(struct net_device *netdev, unsigned int caller) | |||
| 854 | 916 | ||
| 855 | phy_start(pdata->phydev); | 917 | phy_start(pdata->phydev); |
| 856 | 918 | ||
| 857 | /* Enable Tx/Rx */ | 919 | xgbe_napi_enable(pdata, 0); |
| 920 | |||
| 858 | hw_if->powerup_tx(pdata); | 921 | hw_if->powerup_tx(pdata); |
| 859 | hw_if->powerup_rx(pdata); | 922 | hw_if->powerup_rx(pdata); |
| 860 | 923 | ||
| 861 | if (caller == XGMAC_DRIVER_CONTEXT) | 924 | if (caller == XGMAC_DRIVER_CONTEXT) |
| 862 | netif_device_attach(netdev); | 925 | netif_device_attach(netdev); |
| 863 | 926 | ||
| 864 | xgbe_napi_enable(pdata, 0); | ||
| 865 | netif_tx_start_all_queues(netdev); | 927 | netif_tx_start_all_queues(netdev); |
| 866 | 928 | ||
| 867 | spin_unlock_irqrestore(&pdata->lock, flags); | 929 | spin_unlock_irqrestore(&pdata->lock, flags); |
| @@ -875,6 +937,7 @@ static int xgbe_start(struct xgbe_prv_data *pdata) | |||
| 875 | { | 937 | { |
| 876 | struct xgbe_hw_if *hw_if = &pdata->hw_if; | 938 | struct xgbe_hw_if *hw_if = &pdata->hw_if; |
| 877 | struct net_device *netdev = pdata->netdev; | 939 | struct net_device *netdev = pdata->netdev; |
| 940 | int ret; | ||
| 878 | 941 | ||
| 879 | DBGPR("-->xgbe_start\n"); | 942 | DBGPR("-->xgbe_start\n"); |
| 880 | 943 | ||
| @@ -884,17 +947,31 @@ static int xgbe_start(struct xgbe_prv_data *pdata) | |||
| 884 | 947 | ||
| 885 | phy_start(pdata->phydev); | 948 | phy_start(pdata->phydev); |
| 886 | 949 | ||
| 950 | xgbe_napi_enable(pdata, 1); | ||
| 951 | |||
| 952 | ret = xgbe_request_irqs(pdata); | ||
| 953 | if (ret) | ||
| 954 | goto err_napi; | ||
| 955 | |||
| 887 | hw_if->enable_tx(pdata); | 956 | hw_if->enable_tx(pdata); |
| 888 | hw_if->enable_rx(pdata); | 957 | hw_if->enable_rx(pdata); |
| 889 | 958 | ||
| 890 | xgbe_init_tx_timers(pdata); | 959 | xgbe_init_tx_timers(pdata); |
| 891 | 960 | ||
| 892 | xgbe_napi_enable(pdata, 1); | ||
| 893 | netif_tx_start_all_queues(netdev); | 961 | netif_tx_start_all_queues(netdev); |
| 894 | 962 | ||
| 895 | DBGPR("<--xgbe_start\n"); | 963 | DBGPR("<--xgbe_start\n"); |
| 896 | 964 | ||
| 897 | return 0; | 965 | return 0; |
| 966 | |||
| 967 | err_napi: | ||
| 968 | xgbe_napi_disable(pdata, 1); | ||
| 969 | |||
| 970 | phy_stop(pdata->phydev); | ||
| 971 | |||
| 972 | hw_if->exit(pdata); | ||
| 973 | |||
| 974 | return ret; | ||
| 898 | } | 975 | } |
| 899 | 976 | ||
| 900 | static void xgbe_stop(struct xgbe_prv_data *pdata) | 977 | static void xgbe_stop(struct xgbe_prv_data *pdata) |
| @@ -907,16 +984,21 @@ static void xgbe_stop(struct xgbe_prv_data *pdata) | |||
| 907 | 984 | ||
| 908 | DBGPR("-->xgbe_stop\n"); | 985 | DBGPR("-->xgbe_stop\n"); |
| 909 | 986 | ||
| 910 | phy_stop(pdata->phydev); | ||
| 911 | |||
| 912 | netif_tx_stop_all_queues(netdev); | 987 | netif_tx_stop_all_queues(netdev); |
| 913 | xgbe_napi_disable(pdata, 1); | ||
| 914 | 988 | ||
| 915 | xgbe_stop_tx_timers(pdata); | 989 | xgbe_stop_tx_timers(pdata); |
| 916 | 990 | ||
| 917 | hw_if->disable_tx(pdata); | 991 | hw_if->disable_tx(pdata); |
| 918 | hw_if->disable_rx(pdata); | 992 | hw_if->disable_rx(pdata); |
| 919 | 993 | ||
| 994 | xgbe_free_irqs(pdata); | ||
| 995 | |||
| 996 | xgbe_napi_disable(pdata, 1); | ||
| 997 | |||
| 998 | phy_stop(pdata->phydev); | ||
| 999 | |||
| 1000 | hw_if->exit(pdata); | ||
| 1001 | |||
| 920 | channel = pdata->channel; | 1002 | channel = pdata->channel; |
| 921 | for (i = 0; i < pdata->channel_count; i++, channel++) { | 1003 | for (i = 0; i < pdata->channel_count; i++, channel++) { |
| 922 | if (!channel->tx_ring) | 1004 | if (!channel->tx_ring) |
| @@ -931,10 +1013,6 @@ static void xgbe_stop(struct xgbe_prv_data *pdata) | |||
| 931 | 1013 | ||
| 932 | static void xgbe_restart_dev(struct xgbe_prv_data *pdata) | 1014 | static void xgbe_restart_dev(struct xgbe_prv_data *pdata) |
| 933 | { | 1015 | { |
| 934 | struct xgbe_channel *channel; | ||
| 935 | struct xgbe_hw_if *hw_if = &pdata->hw_if; | ||
| 936 | unsigned int i; | ||
| 937 | |||
| 938 | DBGPR("-->xgbe_restart_dev\n"); | 1016 | DBGPR("-->xgbe_restart_dev\n"); |
| 939 | 1017 | ||
| 940 | /* If not running, "restart" will happen on open */ | 1018 | /* If not running, "restart" will happen on open */ |
| @@ -942,19 +1020,10 @@ static void xgbe_restart_dev(struct xgbe_prv_data *pdata) | |||
| 942 | return; | 1020 | return; |
| 943 | 1021 | ||
| 944 | xgbe_stop(pdata); | 1022 | xgbe_stop(pdata); |
| 945 | synchronize_irq(pdata->dev_irq); | ||
| 946 | if (pdata->per_channel_irq) { | ||
| 947 | channel = pdata->channel; | ||
| 948 | for (i = 0; i < pdata->channel_count; i++, channel++) | ||
| 949 | synchronize_irq(channel->dma_irq); | ||
| 950 | } | ||
| 951 | 1023 | ||
| 952 | xgbe_free_tx_data(pdata); | 1024 | xgbe_free_tx_data(pdata); |
| 953 | xgbe_free_rx_data(pdata); | 1025 | xgbe_free_rx_data(pdata); |
| 954 | 1026 | ||
| 955 | /* Issue software reset to device */ | ||
| 956 | hw_if->exit(pdata); | ||
| 957 | |||
| 958 | xgbe_start(pdata); | 1027 | xgbe_start(pdata); |
| 959 | 1028 | ||
| 960 | DBGPR("<--xgbe_restart_dev\n"); | 1029 | DBGPR("<--xgbe_restart_dev\n"); |
| @@ -1283,10 +1352,7 @@ static void xgbe_packet_info(struct xgbe_prv_data *pdata, | |||
| 1283 | static int xgbe_open(struct net_device *netdev) | 1352 | static int xgbe_open(struct net_device *netdev) |
| 1284 | { | 1353 | { |
| 1285 | struct xgbe_prv_data *pdata = netdev_priv(netdev); | 1354 | struct xgbe_prv_data *pdata = netdev_priv(netdev); |
| 1286 | struct xgbe_hw_if *hw_if = &pdata->hw_if; | ||
| 1287 | struct xgbe_desc_if *desc_if = &pdata->desc_if; | 1355 | struct xgbe_desc_if *desc_if = &pdata->desc_if; |
| 1288 | struct xgbe_channel *channel = NULL; | ||
| 1289 | unsigned int i = 0; | ||
| 1290 | int ret; | 1356 | int ret; |
| 1291 | 1357 | ||
| 1292 | DBGPR("-->xgbe_open\n"); | 1358 | DBGPR("-->xgbe_open\n"); |
| @@ -1329,55 +1395,14 @@ static int xgbe_open(struct net_device *netdev) | |||
| 1329 | INIT_WORK(&pdata->restart_work, xgbe_restart); | 1395 | INIT_WORK(&pdata->restart_work, xgbe_restart); |
| 1330 | INIT_WORK(&pdata->tx_tstamp_work, xgbe_tx_tstamp); | 1396 | INIT_WORK(&pdata->tx_tstamp_work, xgbe_tx_tstamp); |
| 1331 | 1397 | ||
| 1332 | /* Request interrupts */ | ||
| 1333 | ret = devm_request_irq(pdata->dev, pdata->dev_irq, xgbe_isr, 0, | ||
| 1334 | netdev->name, pdata); | ||
| 1335 | if (ret) { | ||
| 1336 | netdev_alert(netdev, "error requesting irq %d\n", | ||
| 1337 | pdata->dev_irq); | ||
| 1338 | goto err_rings; | ||
| 1339 | } | ||
| 1340 | |||
| 1341 | if (pdata->per_channel_irq) { | ||
| 1342 | channel = pdata->channel; | ||
| 1343 | for (i = 0; i < pdata->channel_count; i++, channel++) { | ||
| 1344 | snprintf(channel->dma_irq_name, | ||
| 1345 | sizeof(channel->dma_irq_name) - 1, | ||
| 1346 | "%s-TxRx-%u", netdev_name(netdev), | ||
| 1347 | channel->queue_index); | ||
| 1348 | |||
| 1349 | ret = devm_request_irq(pdata->dev, channel->dma_irq, | ||
| 1350 | xgbe_dma_isr, 0, | ||
| 1351 | channel->dma_irq_name, channel); | ||
| 1352 | if (ret) { | ||
| 1353 | netdev_alert(netdev, | ||
| 1354 | "error requesting irq %d\n", | ||
| 1355 | channel->dma_irq); | ||
| 1356 | goto err_irq; | ||
| 1357 | } | ||
| 1358 | } | ||
| 1359 | } | ||
| 1360 | |||
| 1361 | ret = xgbe_start(pdata); | 1398 | ret = xgbe_start(pdata); |
| 1362 | if (ret) | 1399 | if (ret) |
| 1363 | goto err_start; | 1400 | goto err_rings; |
| 1364 | 1401 | ||
| 1365 | DBGPR("<--xgbe_open\n"); | 1402 | DBGPR("<--xgbe_open\n"); |
| 1366 | 1403 | ||
| 1367 | return 0; | 1404 | return 0; |
| 1368 | 1405 | ||
| 1369 | err_start: | ||
| 1370 | hw_if->exit(pdata); | ||
| 1371 | |||
| 1372 | err_irq: | ||
| 1373 | if (pdata->per_channel_irq) { | ||
| 1374 | /* Using an unsigned int, 'i' will go to UINT_MAX and exit */ | ||
| 1375 | for (i--, channel--; i < pdata->channel_count; i--, channel--) | ||
| 1376 | devm_free_irq(pdata->dev, channel->dma_irq, channel); | ||
| 1377 | } | ||
| 1378 | |||
| 1379 | devm_free_irq(pdata->dev, pdata->dev_irq, pdata); | ||
| 1380 | |||
| 1381 | err_rings: | 1406 | err_rings: |
| 1382 | desc_if->free_ring_resources(pdata); | 1407 | desc_if->free_ring_resources(pdata); |
| 1383 | 1408 | ||
| @@ -1399,30 +1424,16 @@ err_phy_init: | |||
| 1399 | static int xgbe_close(struct net_device *netdev) | 1424 | static int xgbe_close(struct net_device *netdev) |
| 1400 | { | 1425 | { |
| 1401 | struct xgbe_prv_data *pdata = netdev_priv(netdev); | 1426 | struct xgbe_prv_data *pdata = netdev_priv(netdev); |
| 1402 | struct xgbe_hw_if *hw_if = &pdata->hw_if; | ||
| 1403 | struct xgbe_desc_if *desc_if = &pdata->desc_if; | 1427 | struct xgbe_desc_if *desc_if = &pdata->desc_if; |
| 1404 | struct xgbe_channel *channel; | ||
| 1405 | unsigned int i; | ||
| 1406 | 1428 | ||
| 1407 | DBGPR("-->xgbe_close\n"); | 1429 | DBGPR("-->xgbe_close\n"); |
| 1408 | 1430 | ||
| 1409 | /* Stop the device */ | 1431 | /* Stop the device */ |
| 1410 | xgbe_stop(pdata); | 1432 | xgbe_stop(pdata); |
| 1411 | 1433 | ||
| 1412 | /* Issue software reset to device */ | ||
| 1413 | hw_if->exit(pdata); | ||
| 1414 | |||
| 1415 | /* Free the ring descriptors and buffers */ | 1434 | /* Free the ring descriptors and buffers */ |
| 1416 | desc_if->free_ring_resources(pdata); | 1435 | desc_if->free_ring_resources(pdata); |
| 1417 | 1436 | ||
| 1418 | /* Release the interrupts */ | ||
| 1419 | devm_free_irq(pdata->dev, pdata->dev_irq, pdata); | ||
| 1420 | if (pdata->per_channel_irq) { | ||
| 1421 | channel = pdata->channel; | ||
| 1422 | for (i = 0; i < pdata->channel_count; i++, channel++) | ||
| 1423 | devm_free_irq(pdata->dev, channel->dma_irq, channel); | ||
| 1424 | } | ||
| 1425 | |||
| 1426 | /* Free the channel and ring structures */ | 1437 | /* Free the channel and ring structures */ |
| 1427 | xgbe_free_channels(pdata); | 1438 | xgbe_free_channels(pdata); |
| 1428 | 1439 | ||
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c index 869d97fcf781..b927021c6c40 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c | |||
| @@ -593,7 +593,7 @@ static int xgene_enet_reset(struct xgene_enet_pdata *pdata) | |||
| 593 | if (!xgene_ring_mgr_init(pdata)) | 593 | if (!xgene_ring_mgr_init(pdata)) |
| 594 | return -ENODEV; | 594 | return -ENODEV; |
| 595 | 595 | ||
| 596 | if (!efi_enabled(EFI_BOOT)) { | 596 | if (pdata->clk) { |
| 597 | clk_prepare_enable(pdata->clk); | 597 | clk_prepare_enable(pdata->clk); |
| 598 | clk_disable_unprepare(pdata->clk); | 598 | clk_disable_unprepare(pdata->clk); |
| 599 | clk_prepare_enable(pdata->clk); | 599 | clk_prepare_enable(pdata->clk); |
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c index 4de62b210c85..635a83be7e5e 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c | |||
| @@ -1025,6 +1025,8 @@ static int xgene_enet_remove(struct platform_device *pdev) | |||
| 1025 | #ifdef CONFIG_ACPI | 1025 | #ifdef CONFIG_ACPI |
| 1026 | static const struct acpi_device_id xgene_enet_acpi_match[] = { | 1026 | static const struct acpi_device_id xgene_enet_acpi_match[] = { |
| 1027 | { "APMC0D05", }, | 1027 | { "APMC0D05", }, |
| 1028 | { "APMC0D30", }, | ||
| 1029 | { "APMC0D31", }, | ||
| 1028 | { } | 1030 | { } |
| 1029 | }; | 1031 | }; |
| 1030 | MODULE_DEVICE_TABLE(acpi, xgene_enet_acpi_match); | 1032 | MODULE_DEVICE_TABLE(acpi, xgene_enet_acpi_match); |
| @@ -1033,6 +1035,8 @@ MODULE_DEVICE_TABLE(acpi, xgene_enet_acpi_match); | |||
| 1033 | #ifdef CONFIG_OF | 1035 | #ifdef CONFIG_OF |
| 1034 | static struct of_device_id xgene_enet_of_match[] = { | 1036 | static struct of_device_id xgene_enet_of_match[] = { |
| 1035 | {.compatible = "apm,xgene-enet",}, | 1037 | {.compatible = "apm,xgene-enet",}, |
| 1038 | {.compatible = "apm,xgene1-sgenet",}, | ||
| 1039 | {.compatible = "apm,xgene1-xgenet",}, | ||
| 1036 | {}, | 1040 | {}, |
| 1037 | }; | 1041 | }; |
| 1038 | 1042 | ||
diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c index 21206d33b638..a7f2cc3e485e 100644 --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c | |||
| @@ -486,7 +486,7 @@ static int bcm_enet_poll(struct napi_struct *napi, int budget) | |||
| 486 | { | 486 | { |
| 487 | struct bcm_enet_priv *priv; | 487 | struct bcm_enet_priv *priv; |
| 488 | struct net_device *dev; | 488 | struct net_device *dev; |
| 489 | int tx_work_done, rx_work_done; | 489 | int rx_work_done; |
| 490 | 490 | ||
| 491 | priv = container_of(napi, struct bcm_enet_priv, napi); | 491 | priv = container_of(napi, struct bcm_enet_priv, napi); |
| 492 | dev = priv->net_dev; | 492 | dev = priv->net_dev; |
| @@ -498,14 +498,14 @@ static int bcm_enet_poll(struct napi_struct *napi, int budget) | |||
| 498 | ENETDMAC_IR, priv->tx_chan); | 498 | ENETDMAC_IR, priv->tx_chan); |
| 499 | 499 | ||
| 500 | /* reclaim sent skb */ | 500 | /* reclaim sent skb */ |
| 501 | tx_work_done = bcm_enet_tx_reclaim(dev, 0); | 501 | bcm_enet_tx_reclaim(dev, 0); |
| 502 | 502 | ||
| 503 | spin_lock(&priv->rx_lock); | 503 | spin_lock(&priv->rx_lock); |
| 504 | rx_work_done = bcm_enet_receive_queue(dev, budget); | 504 | rx_work_done = bcm_enet_receive_queue(dev, budget); |
| 505 | spin_unlock(&priv->rx_lock); | 505 | spin_unlock(&priv->rx_lock); |
| 506 | 506 | ||
| 507 | if (rx_work_done >= budget || tx_work_done > 0) { | 507 | if (rx_work_done >= budget) { |
| 508 | /* rx/tx queue is not yet empty/clean */ | 508 | /* rx queue is not yet empty/clean */ |
| 509 | return rx_work_done; | 509 | return rx_work_done; |
| 510 | } | 510 | } |
| 511 | 511 | ||
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c index 5b308a4a4d0e..783543ad1fcf 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c | |||
| @@ -274,9 +274,9 @@ static const struct bcm_sysport_stats bcm_sysport_gstrings_stats[] = { | |||
| 274 | /* RBUF misc statistics */ | 274 | /* RBUF misc statistics */ |
| 275 | STAT_RBUF("rbuf_ovflow_cnt", mib.rbuf_ovflow_cnt, RBUF_OVFL_DISC_CNTR), | 275 | STAT_RBUF("rbuf_ovflow_cnt", mib.rbuf_ovflow_cnt, RBUF_OVFL_DISC_CNTR), |
| 276 | STAT_RBUF("rbuf_err_cnt", mib.rbuf_err_cnt, RBUF_ERR_PKT_CNTR), | 276 | STAT_RBUF("rbuf_err_cnt", mib.rbuf_err_cnt, RBUF_ERR_PKT_CNTR), |
| 277 | STAT_MIB_RX("alloc_rx_buff_failed", mib.alloc_rx_buff_failed), | 277 | STAT_MIB_SOFT("alloc_rx_buff_failed", mib.alloc_rx_buff_failed), |
| 278 | STAT_MIB_RX("rx_dma_failed", mib.rx_dma_failed), | 278 | STAT_MIB_SOFT("rx_dma_failed", mib.rx_dma_failed), |
| 279 | STAT_MIB_TX("tx_dma_failed", mib.tx_dma_failed), | 279 | STAT_MIB_SOFT("tx_dma_failed", mib.tx_dma_failed), |
| 280 | }; | 280 | }; |
| 281 | 281 | ||
| 282 | #define BCM_SYSPORT_STATS_LEN ARRAY_SIZE(bcm_sysport_gstrings_stats) | 282 | #define BCM_SYSPORT_STATS_LEN ARRAY_SIZE(bcm_sysport_gstrings_stats) |
| @@ -345,6 +345,7 @@ static void bcm_sysport_update_mib_counters(struct bcm_sysport_priv *priv) | |||
| 345 | s = &bcm_sysport_gstrings_stats[i]; | 345 | s = &bcm_sysport_gstrings_stats[i]; |
| 346 | switch (s->type) { | 346 | switch (s->type) { |
| 347 | case BCM_SYSPORT_STAT_NETDEV: | 347 | case BCM_SYSPORT_STAT_NETDEV: |
| 348 | case BCM_SYSPORT_STAT_SOFT: | ||
| 348 | continue; | 349 | continue; |
| 349 | case BCM_SYSPORT_STAT_MIB_RX: | 350 | case BCM_SYSPORT_STAT_MIB_RX: |
| 350 | case BCM_SYSPORT_STAT_MIB_TX: | 351 | case BCM_SYSPORT_STAT_MIB_TX: |
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.h b/drivers/net/ethernet/broadcom/bcmsysport.h index fc19417d82a5..7e3d87a88c76 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.h +++ b/drivers/net/ethernet/broadcom/bcmsysport.h | |||
| @@ -570,6 +570,7 @@ enum bcm_sysport_stat_type { | |||
| 570 | BCM_SYSPORT_STAT_RUNT, | 570 | BCM_SYSPORT_STAT_RUNT, |
| 571 | BCM_SYSPORT_STAT_RXCHK, | 571 | BCM_SYSPORT_STAT_RXCHK, |
| 572 | BCM_SYSPORT_STAT_RBUF, | 572 | BCM_SYSPORT_STAT_RBUF, |
| 573 | BCM_SYSPORT_STAT_SOFT, | ||
| 573 | }; | 574 | }; |
| 574 | 575 | ||
| 575 | /* Macros to help define ethtool statistics */ | 576 | /* Macros to help define ethtool statistics */ |
| @@ -590,6 +591,7 @@ enum bcm_sysport_stat_type { | |||
| 590 | #define STAT_MIB_RX(str, m) STAT_MIB(str, m, BCM_SYSPORT_STAT_MIB_RX) | 591 | #define STAT_MIB_RX(str, m) STAT_MIB(str, m, BCM_SYSPORT_STAT_MIB_RX) |
| 591 | #define STAT_MIB_TX(str, m) STAT_MIB(str, m, BCM_SYSPORT_STAT_MIB_TX) | 592 | #define STAT_MIB_TX(str, m) STAT_MIB(str, m, BCM_SYSPORT_STAT_MIB_TX) |
| 592 | #define STAT_RUNT(str, m) STAT_MIB(str, m, BCM_SYSPORT_STAT_RUNT) | 593 | #define STAT_RUNT(str, m) STAT_MIB(str, m, BCM_SYSPORT_STAT_RUNT) |
| 594 | #define STAT_MIB_SOFT(str, m) STAT_MIB(str, m, BCM_SYSPORT_STAT_SOFT) | ||
| 593 | 595 | ||
| 594 | #define STAT_RXCHK(str, m, ofs) { \ | 596 | #define STAT_RXCHK(str, m, ofs) { \ |
| 595 | .stat_string = str, \ | 597 | .stat_string = str, \ |
diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c index 676ffe093180..0469f72c6e7e 100644 --- a/drivers/net/ethernet/broadcom/bgmac.c +++ b/drivers/net/ethernet/broadcom/bgmac.c | |||
| @@ -302,9 +302,6 @@ static int bgmac_dma_rx_skb_for_slot(struct bgmac *bgmac, | |||
| 302 | slot->skb = skb; | 302 | slot->skb = skb; |
| 303 | slot->dma_addr = dma_addr; | 303 | slot->dma_addr = dma_addr; |
| 304 | 304 | ||
| 305 | if (slot->dma_addr & 0xC0000000) | ||
| 306 | bgmac_warn(bgmac, "DMA address using 0xC0000000 bit(s), it may need translation trick\n"); | ||
| 307 | |||
| 308 | return 0; | 305 | return 0; |
| 309 | } | 306 | } |
| 310 | 307 | ||
| @@ -505,8 +502,6 @@ static int bgmac_dma_alloc(struct bgmac *bgmac) | |||
| 505 | ring->mmio_base); | 502 | ring->mmio_base); |
| 506 | goto err_dma_free; | 503 | goto err_dma_free; |
| 507 | } | 504 | } |
| 508 | if (ring->dma_base & 0xC0000000) | ||
| 509 | bgmac_warn(bgmac, "DMA address using 0xC0000000 bit(s), it may need translation trick\n"); | ||
| 510 | 505 | ||
| 511 | ring->unaligned = bgmac_dma_unaligned(bgmac, ring, | 506 | ring->unaligned = bgmac_dma_unaligned(bgmac, ring, |
| 512 | BGMAC_DMA_RING_TX); | 507 | BGMAC_DMA_RING_TX); |
| @@ -536,8 +531,6 @@ static int bgmac_dma_alloc(struct bgmac *bgmac) | |||
| 536 | err = -ENOMEM; | 531 | err = -ENOMEM; |
| 537 | goto err_dma_free; | 532 | goto err_dma_free; |
| 538 | } | 533 | } |
| 539 | if (ring->dma_base & 0xC0000000) | ||
| 540 | bgmac_warn(bgmac, "DMA address using 0xC0000000 bit(s), it may need translation trick\n"); | ||
| 541 | 534 | ||
| 542 | ring->unaligned = bgmac_dma_unaligned(bgmac, ring, | 535 | ring->unaligned = bgmac_dma_unaligned(bgmac, ring, |
| 543 | BGMAC_DMA_RING_RX); | 536 | BGMAC_DMA_RING_RX); |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 7155e1d2c208..996e215fc324 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
| @@ -12722,6 +12722,9 @@ static int bnx2x_init_dev(struct bnx2x *bp, struct pci_dev *pdev, | |||
| 12722 | pci_write_config_dword(bp->pdev, PCICFG_GRC_ADDRESS, | 12722 | pci_write_config_dword(bp->pdev, PCICFG_GRC_ADDRESS, |
| 12723 | PCICFG_VENDOR_ID_OFFSET); | 12723 | PCICFG_VENDOR_ID_OFFSET); |
| 12724 | 12724 | ||
| 12725 | /* Set PCIe reset type to fundamental for EEH recovery */ | ||
| 12726 | pdev->needs_freset = 1; | ||
| 12727 | |||
| 12725 | /* AER (Advanced Error reporting) configuration */ | 12728 | /* AER (Advanced Error reporting) configuration */ |
| 12726 | rc = pci_enable_pcie_error_reporting(pdev); | 12729 | rc = pci_enable_pcie_error_reporting(pdev); |
| 12727 | if (!rc) | 12730 | if (!rc) |
| @@ -12766,7 +12769,7 @@ static int bnx2x_init_dev(struct bnx2x *bp, struct pci_dev *pdev, | |||
| 12766 | NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 | | 12769 | NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 | |
| 12767 | NETIF_F_RXCSUM | NETIF_F_LRO | NETIF_F_GRO | | 12770 | NETIF_F_RXCSUM | NETIF_F_LRO | NETIF_F_GRO | |
| 12768 | NETIF_F_RXHASH | NETIF_F_HW_VLAN_CTAG_TX; | 12771 | NETIF_F_RXHASH | NETIF_F_HW_VLAN_CTAG_TX; |
| 12769 | if (!CHIP_IS_E1x(bp)) { | 12772 | if (!chip_is_e1x) { |
| 12770 | dev->hw_features |= NETIF_F_GSO_GRE | NETIF_F_GSO_UDP_TUNNEL | | 12773 | dev->hw_features |= NETIF_F_GSO_GRE | NETIF_F_GSO_UDP_TUNNEL | |
| 12771 | NETIF_F_GSO_IPIP | NETIF_F_GSO_SIT; | 12774 | NETIF_F_GSO_IPIP | NETIF_F_GSO_SIT; |
| 12772 | dev->hw_enc_features = | 12775 | dev->hw_enc_features = |
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c index ff83c46bc389..6befde61c203 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c | |||
| @@ -487,6 +487,7 @@ enum bcmgenet_stat_type { | |||
| 487 | BCMGENET_STAT_MIB_TX, | 487 | BCMGENET_STAT_MIB_TX, |
| 488 | BCMGENET_STAT_RUNT, | 488 | BCMGENET_STAT_RUNT, |
| 489 | BCMGENET_STAT_MISC, | 489 | BCMGENET_STAT_MISC, |
| 490 | BCMGENET_STAT_SOFT, | ||
| 490 | }; | 491 | }; |
| 491 | 492 | ||
| 492 | struct bcmgenet_stats { | 493 | struct bcmgenet_stats { |
| @@ -515,6 +516,7 @@ struct bcmgenet_stats { | |||
| 515 | #define STAT_GENET_MIB_RX(str, m) STAT_GENET_MIB(str, m, BCMGENET_STAT_MIB_RX) | 516 | #define STAT_GENET_MIB_RX(str, m) STAT_GENET_MIB(str, m, BCMGENET_STAT_MIB_RX) |
| 516 | #define STAT_GENET_MIB_TX(str, m) STAT_GENET_MIB(str, m, BCMGENET_STAT_MIB_TX) | 517 | #define STAT_GENET_MIB_TX(str, m) STAT_GENET_MIB(str, m, BCMGENET_STAT_MIB_TX) |
| 517 | #define STAT_GENET_RUNT(str, m) STAT_GENET_MIB(str, m, BCMGENET_STAT_RUNT) | 518 | #define STAT_GENET_RUNT(str, m) STAT_GENET_MIB(str, m, BCMGENET_STAT_RUNT) |
| 519 | #define STAT_GENET_SOFT_MIB(str, m) STAT_GENET_MIB(str, m, BCMGENET_STAT_SOFT) | ||
| 518 | 520 | ||
| 519 | #define STAT_GENET_MISC(str, m, offset) { \ | 521 | #define STAT_GENET_MISC(str, m, offset) { \ |
| 520 | .stat_string = str, \ | 522 | .stat_string = str, \ |
| @@ -614,9 +616,9 @@ static const struct bcmgenet_stats bcmgenet_gstrings_stats[] = { | |||
| 614 | UMAC_RBUF_OVFL_CNT), | 616 | UMAC_RBUF_OVFL_CNT), |
| 615 | STAT_GENET_MISC("rbuf_err_cnt", mib.rbuf_err_cnt, UMAC_RBUF_ERR_CNT), | 617 | STAT_GENET_MISC("rbuf_err_cnt", mib.rbuf_err_cnt, UMAC_RBUF_ERR_CNT), |
| 616 | STAT_GENET_MISC("mdf_err_cnt", mib.mdf_err_cnt, UMAC_MDF_ERR_CNT), | 618 | STAT_GENET_MISC("mdf_err_cnt", mib.mdf_err_cnt, UMAC_MDF_ERR_CNT), |
| 617 | STAT_GENET_MIB_RX("alloc_rx_buff_failed", mib.alloc_rx_buff_failed), | 619 | STAT_GENET_SOFT_MIB("alloc_rx_buff_failed", mib.alloc_rx_buff_failed), |
| 618 | STAT_GENET_MIB_RX("rx_dma_failed", mib.rx_dma_failed), | 620 | STAT_GENET_SOFT_MIB("rx_dma_failed", mib.rx_dma_failed), |
| 619 | STAT_GENET_MIB_TX("tx_dma_failed", mib.tx_dma_failed), | 621 | STAT_GENET_SOFT_MIB("tx_dma_failed", mib.tx_dma_failed), |
| 620 | }; | 622 | }; |
| 621 | 623 | ||
| 622 | #define BCMGENET_STATS_LEN ARRAY_SIZE(bcmgenet_gstrings_stats) | 624 | #define BCMGENET_STATS_LEN ARRAY_SIZE(bcmgenet_gstrings_stats) |
| @@ -668,6 +670,7 @@ static void bcmgenet_update_mib_counters(struct bcmgenet_priv *priv) | |||
| 668 | s = &bcmgenet_gstrings_stats[i]; | 670 | s = &bcmgenet_gstrings_stats[i]; |
| 669 | switch (s->type) { | 671 | switch (s->type) { |
| 670 | case BCMGENET_STAT_NETDEV: | 672 | case BCMGENET_STAT_NETDEV: |
| 673 | case BCMGENET_STAT_SOFT: | ||
| 671 | continue; | 674 | continue; |
| 672 | case BCMGENET_STAT_MIB_RX: | 675 | case BCMGENET_STAT_MIB_RX: |
| 673 | case BCMGENET_STAT_MIB_TX: | 676 | case BCMGENET_STAT_MIB_TX: |
| @@ -971,13 +974,14 @@ static inline void bcmgenet_tx_ring_int_disable(struct bcmgenet_priv *priv, | |||
| 971 | } | 974 | } |
| 972 | 975 | ||
| 973 | /* Unlocked version of the reclaim routine */ | 976 | /* Unlocked version of the reclaim routine */ |
| 974 | static void __bcmgenet_tx_reclaim(struct net_device *dev, | 977 | static unsigned int __bcmgenet_tx_reclaim(struct net_device *dev, |
| 975 | struct bcmgenet_tx_ring *ring) | 978 | struct bcmgenet_tx_ring *ring) |
| 976 | { | 979 | { |
| 977 | struct bcmgenet_priv *priv = netdev_priv(dev); | 980 | struct bcmgenet_priv *priv = netdev_priv(dev); |
| 978 | int last_tx_cn, last_c_index, num_tx_bds; | 981 | int last_tx_cn, last_c_index, num_tx_bds; |
| 979 | struct enet_cb *tx_cb_ptr; | 982 | struct enet_cb *tx_cb_ptr; |
| 980 | struct netdev_queue *txq; | 983 | struct netdev_queue *txq; |
| 984 | unsigned int pkts_compl = 0; | ||
| 981 | unsigned int bds_compl; | 985 | unsigned int bds_compl; |
| 982 | unsigned int c_index; | 986 | unsigned int c_index; |
| 983 | 987 | ||
| @@ -1005,6 +1009,7 @@ static void __bcmgenet_tx_reclaim(struct net_device *dev, | |||
| 1005 | tx_cb_ptr = ring->cbs + last_c_index; | 1009 | tx_cb_ptr = ring->cbs + last_c_index; |
| 1006 | bds_compl = 0; | 1010 | bds_compl = 0; |
| 1007 | if (tx_cb_ptr->skb) { | 1011 | if (tx_cb_ptr->skb) { |
| 1012 | pkts_compl++; | ||
| 1008 | bds_compl = skb_shinfo(tx_cb_ptr->skb)->nr_frags + 1; | 1013 | bds_compl = skb_shinfo(tx_cb_ptr->skb)->nr_frags + 1; |
| 1009 | dev->stats.tx_bytes += tx_cb_ptr->skb->len; | 1014 | dev->stats.tx_bytes += tx_cb_ptr->skb->len; |
| 1010 | dma_unmap_single(&dev->dev, | 1015 | dma_unmap_single(&dev->dev, |
| @@ -1028,23 +1033,45 @@ static void __bcmgenet_tx_reclaim(struct net_device *dev, | |||
| 1028 | last_c_index &= (num_tx_bds - 1); | 1033 | last_c_index &= (num_tx_bds - 1); |
| 1029 | } | 1034 | } |
| 1030 | 1035 | ||
| 1031 | if (ring->free_bds > (MAX_SKB_FRAGS + 1)) | 1036 | if (ring->free_bds > (MAX_SKB_FRAGS + 1)) { |
| 1032 | ring->int_disable(priv, ring); | 1037 | if (netif_tx_queue_stopped(txq)) |
| 1033 | 1038 | netif_tx_wake_queue(txq); | |
| 1034 | if (netif_tx_queue_stopped(txq)) | 1039 | } |
| 1035 | netif_tx_wake_queue(txq); | ||
| 1036 | 1040 | ||
| 1037 | ring->c_index = c_index; | 1041 | ring->c_index = c_index; |
| 1042 | |||
| 1043 | return pkts_compl; | ||
| 1038 | } | 1044 | } |
| 1039 | 1045 | ||
| 1040 | static void bcmgenet_tx_reclaim(struct net_device *dev, | 1046 | static unsigned int bcmgenet_tx_reclaim(struct net_device *dev, |
| 1041 | struct bcmgenet_tx_ring *ring) | 1047 | struct bcmgenet_tx_ring *ring) |
| 1042 | { | 1048 | { |
| 1049 | unsigned int released; | ||
| 1043 | unsigned long flags; | 1050 | unsigned long flags; |
| 1044 | 1051 | ||
| 1045 | spin_lock_irqsave(&ring->lock, flags); | 1052 | spin_lock_irqsave(&ring->lock, flags); |
| 1046 | __bcmgenet_tx_reclaim(dev, ring); | 1053 | released = __bcmgenet_tx_reclaim(dev, ring); |
| 1047 | spin_unlock_irqrestore(&ring->lock, flags); | 1054 | spin_unlock_irqrestore(&ring->lock, flags); |
| 1055 | |||
| 1056 | return released; | ||
| 1057 | } | ||
| 1058 | |||
| 1059 | static int bcmgenet_tx_poll(struct napi_struct *napi, int budget) | ||
| 1060 | { | ||
| 1061 | struct bcmgenet_tx_ring *ring = | ||
| 1062 | container_of(napi, struct bcmgenet_tx_ring, napi); | ||
| 1063 | unsigned int work_done = 0; | ||
| 1064 | |||
| 1065 | work_done = bcmgenet_tx_reclaim(ring->priv->dev, ring); | ||
| 1066 | |||
| 1067 | if (work_done == 0) { | ||
| 1068 | napi_complete(napi); | ||
| 1069 | ring->int_enable(ring->priv, ring); | ||
| 1070 | |||
| 1071 | return 0; | ||
| 1072 | } | ||
| 1073 | |||
| 1074 | return budget; | ||
| 1048 | } | 1075 | } |
| 1049 | 1076 | ||
| 1050 | static void bcmgenet_tx_reclaim_all(struct net_device *dev) | 1077 | static void bcmgenet_tx_reclaim_all(struct net_device *dev) |
| @@ -1302,10 +1329,8 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 1302 | bcmgenet_tdma_ring_writel(priv, ring->index, | 1329 | bcmgenet_tdma_ring_writel(priv, ring->index, |
| 1303 | ring->prod_index, TDMA_PROD_INDEX); | 1330 | ring->prod_index, TDMA_PROD_INDEX); |
| 1304 | 1331 | ||
| 1305 | if (ring->free_bds <= (MAX_SKB_FRAGS + 1)) { | 1332 | if (ring->free_bds <= (MAX_SKB_FRAGS + 1)) |
| 1306 | netif_tx_stop_queue(txq); | 1333 | netif_tx_stop_queue(txq); |
| 1307 | ring->int_enable(priv, ring); | ||
| 1308 | } | ||
| 1309 | 1334 | ||
| 1310 | out: | 1335 | out: |
| 1311 | spin_unlock_irqrestore(&ring->lock, flags); | 1336 | spin_unlock_irqrestore(&ring->lock, flags); |
| @@ -1621,6 +1646,7 @@ static int init_umac(struct bcmgenet_priv *priv) | |||
| 1621 | struct device *kdev = &priv->pdev->dev; | 1646 | struct device *kdev = &priv->pdev->dev; |
| 1622 | int ret; | 1647 | int ret; |
| 1623 | u32 reg, cpu_mask_clear; | 1648 | u32 reg, cpu_mask_clear; |
| 1649 | int index; | ||
| 1624 | 1650 | ||
| 1625 | dev_dbg(&priv->pdev->dev, "bcmgenet: init_umac\n"); | 1651 | dev_dbg(&priv->pdev->dev, "bcmgenet: init_umac\n"); |
| 1626 | 1652 | ||
| @@ -1647,7 +1673,7 @@ static int init_umac(struct bcmgenet_priv *priv) | |||
| 1647 | 1673 | ||
| 1648 | bcmgenet_intr_disable(priv); | 1674 | bcmgenet_intr_disable(priv); |
| 1649 | 1675 | ||
| 1650 | cpu_mask_clear = UMAC_IRQ_RXDMA_BDONE; | 1676 | cpu_mask_clear = UMAC_IRQ_RXDMA_BDONE | UMAC_IRQ_TXDMA_BDONE; |
| 1651 | 1677 | ||
| 1652 | dev_dbg(kdev, "%s:Enabling RXDMA_BDONE interrupt\n", __func__); | 1678 | dev_dbg(kdev, "%s:Enabling RXDMA_BDONE interrupt\n", __func__); |
| 1653 | 1679 | ||
| @@ -1674,6 +1700,10 @@ static int init_umac(struct bcmgenet_priv *priv) | |||
| 1674 | 1700 | ||
| 1675 | bcmgenet_intrl2_0_writel(priv, cpu_mask_clear, INTRL2_CPU_MASK_CLEAR); | 1701 | bcmgenet_intrl2_0_writel(priv, cpu_mask_clear, INTRL2_CPU_MASK_CLEAR); |
| 1676 | 1702 | ||
| 1703 | for (index = 0; index < priv->hw_params->tx_queues; index++) | ||
| 1704 | bcmgenet_intrl2_1_writel(priv, (1 << index), | ||
| 1705 | INTRL2_CPU_MASK_CLEAR); | ||
| 1706 | |||
| 1677 | /* Enable rx/tx engine.*/ | 1707 | /* Enable rx/tx engine.*/ |
| 1678 | dev_dbg(kdev, "done init umac\n"); | 1708 | dev_dbg(kdev, "done init umac\n"); |
| 1679 | 1709 | ||
| @@ -1693,6 +1723,8 @@ static void bcmgenet_init_tx_ring(struct bcmgenet_priv *priv, | |||
| 1693 | unsigned int first_bd; | 1723 | unsigned int first_bd; |
| 1694 | 1724 | ||
| 1695 | spin_lock_init(&ring->lock); | 1725 | spin_lock_init(&ring->lock); |
| 1726 | ring->priv = priv; | ||
| 1727 | netif_napi_add(priv->dev, &ring->napi, bcmgenet_tx_poll, 64); | ||
| 1696 | ring->index = index; | 1728 | ring->index = index; |
| 1697 | if (index == DESC_INDEX) { | 1729 | if (index == DESC_INDEX) { |
| 1698 | ring->queue = 0; | 1730 | ring->queue = 0; |
| @@ -1738,6 +1770,17 @@ static void bcmgenet_init_tx_ring(struct bcmgenet_priv *priv, | |||
| 1738 | TDMA_WRITE_PTR); | 1770 | TDMA_WRITE_PTR); |
| 1739 | bcmgenet_tdma_ring_writel(priv, index, end_ptr * words_per_bd - 1, | 1771 | bcmgenet_tdma_ring_writel(priv, index, end_ptr * words_per_bd - 1, |
| 1740 | DMA_END_ADDR); | 1772 | DMA_END_ADDR); |
| 1773 | |||
| 1774 | napi_enable(&ring->napi); | ||
| 1775 | } | ||
| 1776 | |||
| 1777 | static void bcmgenet_fini_tx_ring(struct bcmgenet_priv *priv, | ||
| 1778 | unsigned int index) | ||
| 1779 | { | ||
| 1780 | struct bcmgenet_tx_ring *ring = &priv->tx_rings[index]; | ||
| 1781 | |||
| 1782 | napi_disable(&ring->napi); | ||
| 1783 | netif_napi_del(&ring->napi); | ||
| 1741 | } | 1784 | } |
| 1742 | 1785 | ||
| 1743 | /* Initialize a RDMA ring */ | 1786 | /* Initialize a RDMA ring */ |
| @@ -1907,7 +1950,7 @@ static int bcmgenet_dma_teardown(struct bcmgenet_priv *priv) | |||
| 1907 | return ret; | 1950 | return ret; |
| 1908 | } | 1951 | } |
| 1909 | 1952 | ||
| 1910 | static void bcmgenet_fini_dma(struct bcmgenet_priv *priv) | 1953 | static void __bcmgenet_fini_dma(struct bcmgenet_priv *priv) |
| 1911 | { | 1954 | { |
| 1912 | int i; | 1955 | int i; |
| 1913 | 1956 | ||
| @@ -1926,6 +1969,18 @@ static void bcmgenet_fini_dma(struct bcmgenet_priv *priv) | |||
| 1926 | kfree(priv->tx_cbs); | 1969 | kfree(priv->tx_cbs); |
| 1927 | } | 1970 | } |
| 1928 | 1971 | ||
| 1972 | static void bcmgenet_fini_dma(struct bcmgenet_priv *priv) | ||
| 1973 | { | ||
| 1974 | int i; | ||
| 1975 | |||
| 1976 | bcmgenet_fini_tx_ring(priv, DESC_INDEX); | ||
| 1977 | |||
| 1978 | for (i = 0; i < priv->hw_params->tx_queues; i++) | ||
| 1979 | bcmgenet_fini_tx_ring(priv, i); | ||
| 1980 | |||
| 1981 | __bcmgenet_fini_dma(priv); | ||
| 1982 | } | ||
| 1983 | |||
| 1929 | /* init_edma: Initialize DMA control register */ | 1984 | /* init_edma: Initialize DMA control register */ |
| 1930 | static int bcmgenet_init_dma(struct bcmgenet_priv *priv) | 1985 | static int bcmgenet_init_dma(struct bcmgenet_priv *priv) |
| 1931 | { | 1986 | { |
| @@ -1952,7 +2007,7 @@ static int bcmgenet_init_dma(struct bcmgenet_priv *priv) | |||
| 1952 | priv->tx_cbs = kcalloc(priv->num_tx_bds, sizeof(struct enet_cb), | 2007 | priv->tx_cbs = kcalloc(priv->num_tx_bds, sizeof(struct enet_cb), |
| 1953 | GFP_KERNEL); | 2008 | GFP_KERNEL); |
| 1954 | if (!priv->tx_cbs) { | 2009 | if (!priv->tx_cbs) { |
| 1955 | bcmgenet_fini_dma(priv); | 2010 | __bcmgenet_fini_dma(priv); |
| 1956 | return -ENOMEM; | 2011 | return -ENOMEM; |
| 1957 | } | 2012 | } |
| 1958 | 2013 | ||
| @@ -1975,9 +2030,6 @@ static int bcmgenet_poll(struct napi_struct *napi, int budget) | |||
| 1975 | struct bcmgenet_priv, napi); | 2030 | struct bcmgenet_priv, napi); |
| 1976 | unsigned int work_done; | 2031 | unsigned int work_done; |
| 1977 | 2032 | ||
| 1978 | /* tx reclaim */ | ||
| 1979 | bcmgenet_tx_reclaim(priv->dev, &priv->tx_rings[DESC_INDEX]); | ||
| 1980 | |||
| 1981 | work_done = bcmgenet_desc_rx(priv, budget); | 2033 | work_done = bcmgenet_desc_rx(priv, budget); |
| 1982 | 2034 | ||
| 1983 | /* Advancing our consumer index*/ | 2035 | /* Advancing our consumer index*/ |
| @@ -2022,28 +2074,34 @@ static void bcmgenet_irq_task(struct work_struct *work) | |||
| 2022 | static irqreturn_t bcmgenet_isr1(int irq, void *dev_id) | 2074 | static irqreturn_t bcmgenet_isr1(int irq, void *dev_id) |
| 2023 | { | 2075 | { |
| 2024 | struct bcmgenet_priv *priv = dev_id; | 2076 | struct bcmgenet_priv *priv = dev_id; |
| 2077 | struct bcmgenet_tx_ring *ring; | ||
| 2025 | unsigned int index; | 2078 | unsigned int index; |
| 2026 | 2079 | ||
| 2027 | /* Save irq status for bottom-half processing. */ | 2080 | /* Save irq status for bottom-half processing. */ |
| 2028 | priv->irq1_stat = | 2081 | priv->irq1_stat = |
| 2029 | bcmgenet_intrl2_1_readl(priv, INTRL2_CPU_STAT) & | 2082 | bcmgenet_intrl2_1_readl(priv, INTRL2_CPU_STAT) & |
| 2030 | ~priv->int1_mask; | 2083 | ~bcmgenet_intrl2_1_readl(priv, INTRL2_CPU_MASK_STATUS); |
| 2031 | /* clear interrupts */ | 2084 | /* clear interrupts */ |
| 2032 | bcmgenet_intrl2_1_writel(priv, priv->irq1_stat, INTRL2_CPU_CLEAR); | 2085 | bcmgenet_intrl2_1_writel(priv, priv->irq1_stat, INTRL2_CPU_CLEAR); |
| 2033 | 2086 | ||
| 2034 | netif_dbg(priv, intr, priv->dev, | 2087 | netif_dbg(priv, intr, priv->dev, |
| 2035 | "%s: IRQ=0x%x\n", __func__, priv->irq1_stat); | 2088 | "%s: IRQ=0x%x\n", __func__, priv->irq1_stat); |
| 2089 | |||
| 2036 | /* Check the MBDONE interrupts. | 2090 | /* Check the MBDONE interrupts. |
| 2037 | * packet is done, reclaim descriptors | 2091 | * packet is done, reclaim descriptors |
| 2038 | */ | 2092 | */ |
| 2039 | if (priv->irq1_stat & 0x0000ffff) { | 2093 | for (index = 0; index < priv->hw_params->tx_queues; index++) { |
| 2040 | index = 0; | 2094 | if (!(priv->irq1_stat & BIT(index))) |
| 2041 | for (index = 0; index < 16; index++) { | 2095 | continue; |
| 2042 | if (priv->irq1_stat & (1 << index)) | 2096 | |
| 2043 | bcmgenet_tx_reclaim(priv->dev, | 2097 | ring = &priv->tx_rings[index]; |
| 2044 | &priv->tx_rings[index]); | 2098 | |
| 2099 | if (likely(napi_schedule_prep(&ring->napi))) { | ||
| 2100 | ring->int_disable(priv, ring); | ||
| 2101 | __napi_schedule(&ring->napi); | ||
| 2045 | } | 2102 | } |
| 2046 | } | 2103 | } |
| 2104 | |||
| 2047 | return IRQ_HANDLED; | 2105 | return IRQ_HANDLED; |
| 2048 | } | 2106 | } |
| 2049 | 2107 | ||
| @@ -2075,8 +2133,12 @@ static irqreturn_t bcmgenet_isr0(int irq, void *dev_id) | |||
| 2075 | } | 2133 | } |
| 2076 | if (priv->irq0_stat & | 2134 | if (priv->irq0_stat & |
| 2077 | (UMAC_IRQ_TXDMA_BDONE | UMAC_IRQ_TXDMA_PDONE)) { | 2135 | (UMAC_IRQ_TXDMA_BDONE | UMAC_IRQ_TXDMA_PDONE)) { |
| 2078 | /* Tx reclaim */ | 2136 | struct bcmgenet_tx_ring *ring = &priv->tx_rings[DESC_INDEX]; |
| 2079 | bcmgenet_tx_reclaim(priv->dev, &priv->tx_rings[DESC_INDEX]); | 2137 | |
| 2138 | if (likely(napi_schedule_prep(&ring->napi))) { | ||
| 2139 | ring->int_disable(priv, ring); | ||
| 2140 | __napi_schedule(&ring->napi); | ||
| 2141 | } | ||
| 2080 | } | 2142 | } |
| 2081 | if (priv->irq0_stat & (UMAC_IRQ_PHY_DET_R | | 2143 | if (priv->irq0_stat & (UMAC_IRQ_PHY_DET_R | |
| 2082 | UMAC_IRQ_PHY_DET_F | | 2144 | UMAC_IRQ_PHY_DET_F | |
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.h b/drivers/net/ethernet/broadcom/genet/bcmgenet.h index b36ddec0cc0a..0d370d168aee 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.h +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.h | |||
| @@ -520,6 +520,7 @@ struct bcmgenet_hw_params { | |||
| 520 | 520 | ||
| 521 | struct bcmgenet_tx_ring { | 521 | struct bcmgenet_tx_ring { |
| 522 | spinlock_t lock; /* ring lock */ | 522 | spinlock_t lock; /* ring lock */ |
| 523 | struct napi_struct napi; /* NAPI per tx queue */ | ||
| 523 | unsigned int index; /* ring index */ | 524 | unsigned int index; /* ring index */ |
| 524 | unsigned int queue; /* queue index */ | 525 | unsigned int queue; /* queue index */ |
| 525 | struct enet_cb *cbs; /* tx ring buffer control block*/ | 526 | struct enet_cb *cbs; /* tx ring buffer control block*/ |
| @@ -534,6 +535,7 @@ struct bcmgenet_tx_ring { | |||
| 534 | struct bcmgenet_tx_ring *); | 535 | struct bcmgenet_tx_ring *); |
| 535 | void (*int_disable)(struct bcmgenet_priv *priv, | 536 | void (*int_disable)(struct bcmgenet_priv *priv, |
| 536 | struct bcmgenet_tx_ring *); | 537 | struct bcmgenet_tx_ring *); |
| 538 | struct bcmgenet_priv *priv; | ||
| 537 | }; | 539 | }; |
| 538 | 540 | ||
| 539 | /* device context */ | 541 | /* device context */ |
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c b/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c index 149a0d70c108..b97122926d3a 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c | |||
| @@ -73,15 +73,17 @@ int bcmgenet_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | |||
| 73 | if (wol->wolopts & ~(WAKE_MAGIC | WAKE_MAGICSECURE)) | 73 | if (wol->wolopts & ~(WAKE_MAGIC | WAKE_MAGICSECURE)) |
| 74 | return -EINVAL; | 74 | return -EINVAL; |
| 75 | 75 | ||
| 76 | reg = bcmgenet_umac_readl(priv, UMAC_MPD_CTRL); | ||
| 76 | if (wol->wolopts & WAKE_MAGICSECURE) { | 77 | if (wol->wolopts & WAKE_MAGICSECURE) { |
| 77 | bcmgenet_umac_writel(priv, get_unaligned_be16(&wol->sopass[0]), | 78 | bcmgenet_umac_writel(priv, get_unaligned_be16(&wol->sopass[0]), |
| 78 | UMAC_MPD_PW_MS); | 79 | UMAC_MPD_PW_MS); |
| 79 | bcmgenet_umac_writel(priv, get_unaligned_be32(&wol->sopass[2]), | 80 | bcmgenet_umac_writel(priv, get_unaligned_be32(&wol->sopass[2]), |
| 80 | UMAC_MPD_PW_LS); | 81 | UMAC_MPD_PW_LS); |
| 81 | reg = bcmgenet_umac_readl(priv, UMAC_MPD_CTRL); | ||
| 82 | reg |= MPD_PW_EN; | 82 | reg |= MPD_PW_EN; |
| 83 | bcmgenet_umac_writel(priv, reg, UMAC_MPD_CTRL); | 83 | } else { |
| 84 | reg &= ~MPD_PW_EN; | ||
| 84 | } | 85 | } |
| 86 | bcmgenet_umac_writel(priv, reg, UMAC_MPD_CTRL); | ||
| 85 | 87 | ||
| 86 | /* Flag the device and relevant IRQ as wakeup capable */ | 88 | /* Flag the device and relevant IRQ as wakeup capable */ |
| 87 | if (wol->wolopts) { | 89 | if (wol->wolopts) { |
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index ad76b8e35a00..81d41539fcba 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c | |||
| @@ -2113,17 +2113,17 @@ static const struct net_device_ops macb_netdev_ops = { | |||
| 2113 | }; | 2113 | }; |
| 2114 | 2114 | ||
| 2115 | #if defined(CONFIG_OF) | 2115 | #if defined(CONFIG_OF) |
| 2116 | static struct macb_config pc302gem_config = { | 2116 | static const struct macb_config pc302gem_config = { |
| 2117 | .caps = MACB_CAPS_SG_DISABLED | MACB_CAPS_GIGABIT_MODE_AVAILABLE, | 2117 | .caps = MACB_CAPS_SG_DISABLED | MACB_CAPS_GIGABIT_MODE_AVAILABLE, |
| 2118 | .dma_burst_length = 16, | 2118 | .dma_burst_length = 16, |
| 2119 | }; | 2119 | }; |
| 2120 | 2120 | ||
| 2121 | static struct macb_config sama5d3_config = { | 2121 | static const struct macb_config sama5d3_config = { |
| 2122 | .caps = MACB_CAPS_SG_DISABLED | MACB_CAPS_GIGABIT_MODE_AVAILABLE, | 2122 | .caps = MACB_CAPS_SG_DISABLED | MACB_CAPS_GIGABIT_MODE_AVAILABLE, |
| 2123 | .dma_burst_length = 16, | 2123 | .dma_burst_length = 16, |
| 2124 | }; | 2124 | }; |
| 2125 | 2125 | ||
| 2126 | static struct macb_config sama5d4_config = { | 2126 | static const struct macb_config sama5d4_config = { |
| 2127 | .caps = 0, | 2127 | .caps = 0, |
| 2128 | .dma_burst_length = 4, | 2128 | .dma_burst_length = 4, |
| 2129 | }; | 2129 | }; |
| @@ -2154,7 +2154,7 @@ static void macb_configure_caps(struct macb *bp) | |||
| 2154 | if (bp->pdev->dev.of_node) { | 2154 | if (bp->pdev->dev.of_node) { |
| 2155 | match = of_match_node(macb_dt_ids, bp->pdev->dev.of_node); | 2155 | match = of_match_node(macb_dt_ids, bp->pdev->dev.of_node); |
| 2156 | if (match && match->data) { | 2156 | if (match && match->data) { |
| 2157 | config = (const struct macb_config *)match->data; | 2157 | config = match->data; |
| 2158 | 2158 | ||
| 2159 | bp->caps = config->caps; | 2159 | bp->caps = config->caps; |
| 2160 | /* | 2160 | /* |
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h index 31dc080f2437..ff85619a9732 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h | |||
| @@ -351,7 +351,7 @@ | |||
| 351 | 351 | ||
| 352 | /* Bitfields in MID */ | 352 | /* Bitfields in MID */ |
| 353 | #define MACB_IDNUM_OFFSET 16 | 353 | #define MACB_IDNUM_OFFSET 16 |
| 354 | #define MACB_IDNUM_SIZE 16 | 354 | #define MACB_IDNUM_SIZE 12 |
| 355 | #define MACB_REV_OFFSET 0 | 355 | #define MACB_REV_OFFSET 0 |
| 356 | #define MACB_REV_SIZE 16 | 356 | #define MACB_REV_SIZE 16 |
| 357 | 357 | ||
diff --git a/drivers/net/ethernet/chelsio/cxgb4/clip_tbl.c b/drivers/net/ethernet/chelsio/cxgb4/clip_tbl.c index 9062a8434246..c308429dd9c7 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/clip_tbl.c +++ b/drivers/net/ethernet/chelsio/cxgb4/clip_tbl.c | |||
| @@ -35,10 +35,10 @@ static inline unsigned int ipv6_clip_hash(struct clip_tbl *d, const u32 *key) | |||
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | static unsigned int clip_addr_hash(struct clip_tbl *ctbl, const u32 *addr, | 37 | static unsigned int clip_addr_hash(struct clip_tbl *ctbl, const u32 *addr, |
| 38 | int addr_len) | 38 | u8 v6) |
| 39 | { | 39 | { |
| 40 | return addr_len == 4 ? ipv4_clip_hash(ctbl, addr) : | 40 | return v6 ? ipv6_clip_hash(ctbl, addr) : |
| 41 | ipv6_clip_hash(ctbl, addr); | 41 | ipv4_clip_hash(ctbl, addr); |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | static int clip6_get_mbox(const struct net_device *dev, | 44 | static int clip6_get_mbox(const struct net_device *dev, |
| @@ -78,23 +78,22 @@ int cxgb4_clip_get(const struct net_device *dev, const u32 *lip, u8 v6) | |||
| 78 | struct clip_entry *ce, *cte; | 78 | struct clip_entry *ce, *cte; |
| 79 | u32 *addr = (u32 *)lip; | 79 | u32 *addr = (u32 *)lip; |
| 80 | int hash; | 80 | int hash; |
| 81 | int addr_len; | 81 | int ret = -1; |
| 82 | int ret = 0; | ||
| 83 | 82 | ||
| 84 | if (!ctbl) | 83 | if (!ctbl) |
| 85 | return 0; | 84 | return 0; |
| 86 | 85 | ||
| 87 | if (v6) | 86 | hash = clip_addr_hash(ctbl, addr, v6); |
| 88 | addr_len = 16; | ||
| 89 | else | ||
| 90 | addr_len = 4; | ||
| 91 | |||
| 92 | hash = clip_addr_hash(ctbl, addr, addr_len); | ||
| 93 | 87 | ||
| 94 | read_lock_bh(&ctbl->lock); | 88 | read_lock_bh(&ctbl->lock); |
| 95 | list_for_each_entry(cte, &ctbl->hash_list[hash], list) { | 89 | list_for_each_entry(cte, &ctbl->hash_list[hash], list) { |
| 96 | if (addr_len == cte->addr_len && | 90 | if (cte->addr6.sin6_family == AF_INET6 && v6) |
| 97 | memcmp(lip, cte->addr, cte->addr_len) == 0) { | 91 | ret = memcmp(lip, cte->addr6.sin6_addr.s6_addr, |
| 92 | sizeof(struct in6_addr)); | ||
| 93 | else if (cte->addr.sin_family == AF_INET && !v6) | ||
| 94 | ret = memcmp(lip, (char *)(&cte->addr.sin_addr), | ||
| 95 | sizeof(struct in_addr)); | ||
| 96 | if (!ret) { | ||
| 98 | ce = cte; | 97 | ce = cte; |
| 99 | read_unlock_bh(&ctbl->lock); | 98 | read_unlock_bh(&ctbl->lock); |
| 100 | goto found; | 99 | goto found; |
| @@ -111,15 +110,20 @@ int cxgb4_clip_get(const struct net_device *dev, const u32 *lip, u8 v6) | |||
| 111 | spin_lock_init(&ce->lock); | 110 | spin_lock_init(&ce->lock); |
| 112 | atomic_set(&ce->refcnt, 0); | 111 | atomic_set(&ce->refcnt, 0); |
| 113 | atomic_dec(&ctbl->nfree); | 112 | atomic_dec(&ctbl->nfree); |
| 114 | ce->addr_len = addr_len; | ||
| 115 | memcpy(ce->addr, lip, addr_len); | ||
| 116 | list_add_tail(&ce->list, &ctbl->hash_list[hash]); | 113 | list_add_tail(&ce->list, &ctbl->hash_list[hash]); |
| 117 | if (v6) { | 114 | if (v6) { |
| 115 | ce->addr6.sin6_family = AF_INET6; | ||
| 116 | memcpy(ce->addr6.sin6_addr.s6_addr, | ||
| 117 | lip, sizeof(struct in6_addr)); | ||
| 118 | ret = clip6_get_mbox(dev, (const struct in6_addr *)lip); | 118 | ret = clip6_get_mbox(dev, (const struct in6_addr *)lip); |
| 119 | if (ret) { | 119 | if (ret) { |
| 120 | write_unlock_bh(&ctbl->lock); | 120 | write_unlock_bh(&ctbl->lock); |
| 121 | return ret; | 121 | return ret; |
| 122 | } | 122 | } |
| 123 | } else { | ||
| 124 | ce->addr.sin_family = AF_INET; | ||
| 125 | memcpy((char *)(&ce->addr.sin_addr), lip, | ||
| 126 | sizeof(struct in_addr)); | ||
| 123 | } | 127 | } |
| 124 | } else { | 128 | } else { |
| 125 | write_unlock_bh(&ctbl->lock); | 129 | write_unlock_bh(&ctbl->lock); |
| @@ -140,19 +144,19 @@ void cxgb4_clip_release(const struct net_device *dev, const u32 *lip, u8 v6) | |||
| 140 | struct clip_entry *ce, *cte; | 144 | struct clip_entry *ce, *cte; |
| 141 | u32 *addr = (u32 *)lip; | 145 | u32 *addr = (u32 *)lip; |
| 142 | int hash; | 146 | int hash; |
| 143 | int addr_len; | 147 | int ret = -1; |
| 144 | |||
| 145 | if (v6) | ||
| 146 | addr_len = 16; | ||
| 147 | else | ||
| 148 | addr_len = 4; | ||
| 149 | 148 | ||
| 150 | hash = clip_addr_hash(ctbl, addr, addr_len); | 149 | hash = clip_addr_hash(ctbl, addr, v6); |
| 151 | 150 | ||
| 152 | read_lock_bh(&ctbl->lock); | 151 | read_lock_bh(&ctbl->lock); |
| 153 | list_for_each_entry(cte, &ctbl->hash_list[hash], list) { | 152 | list_for_each_entry(cte, &ctbl->hash_list[hash], list) { |
| 154 | if (addr_len == cte->addr_len && | 153 | if (cte->addr6.sin6_family == AF_INET6 && v6) |
| 155 | memcmp(lip, cte->addr, cte->addr_len) == 0) { | 154 | ret = memcmp(lip, cte->addr6.sin6_addr.s6_addr, |
| 155 | sizeof(struct in6_addr)); | ||
| 156 | else if (cte->addr.sin_family == AF_INET && !v6) | ||
| 157 | ret = memcmp(lip, (char *)(&cte->addr.sin_addr), | ||
| 158 | sizeof(struct in_addr)); | ||
| 159 | if (!ret) { | ||
| 156 | ce = cte; | 160 | ce = cte; |
| 157 | read_unlock_bh(&ctbl->lock); | 161 | read_unlock_bh(&ctbl->lock); |
| 158 | goto found; | 162 | goto found; |
| @@ -249,10 +253,7 @@ int clip_tbl_show(struct seq_file *seq, void *v) | |||
| 249 | for (i = 0 ; i < ctbl->clipt_size; ++i) { | 253 | for (i = 0 ; i < ctbl->clipt_size; ++i) { |
| 250 | list_for_each_entry(ce, &ctbl->hash_list[i], list) { | 254 | list_for_each_entry(ce, &ctbl->hash_list[i], list) { |
| 251 | ip[0] = '\0'; | 255 | ip[0] = '\0'; |
| 252 | if (ce->addr_len == 16) | 256 | sprintf(ip, "%pISc", &ce->addr); |
| 253 | sprintf(ip, "%pI6c", ce->addr); | ||
| 254 | else | ||
| 255 | sprintf(ip, "%pI4c", ce->addr); | ||
| 256 | seq_printf(seq, "%-25s %u\n", ip, | 257 | seq_printf(seq, "%-25s %u\n", ip, |
| 257 | atomic_read(&ce->refcnt)); | 258 | atomic_read(&ce->refcnt)); |
| 258 | } | 259 | } |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/clip_tbl.h b/drivers/net/ethernet/chelsio/cxgb4/clip_tbl.h index 2eaba0161cf8..35eb43c6bcbb 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/clip_tbl.h +++ b/drivers/net/ethernet/chelsio/cxgb4/clip_tbl.h | |||
| @@ -14,8 +14,10 @@ struct clip_entry { | |||
| 14 | spinlock_t lock; /* Hold while modifying clip reference */ | 14 | spinlock_t lock; /* Hold while modifying clip reference */ |
| 15 | atomic_t refcnt; | 15 | atomic_t refcnt; |
| 16 | struct list_head list; | 16 | struct list_head list; |
| 17 | u32 addr[4]; | 17 | union { |
| 18 | int addr_len; | 18 | struct sockaddr_in addr; |
| 19 | struct sockaddr_in6 addr6; | ||
| 20 | }; | ||
| 19 | }; | 21 | }; |
| 20 | 22 | ||
| 21 | struct clip_tbl { | 23 | struct clip_tbl { |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h index d6cda17efe6e..97842d03675b 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | |||
| @@ -1103,7 +1103,7 @@ int t4_restart_aneg(struct adapter *adap, unsigned int mbox, unsigned int port); | |||
| 1103 | #define T4_MEMORY_WRITE 0 | 1103 | #define T4_MEMORY_WRITE 0 |
| 1104 | #define T4_MEMORY_READ 1 | 1104 | #define T4_MEMORY_READ 1 |
| 1105 | int t4_memory_rw(struct adapter *adap, int win, int mtype, u32 addr, u32 len, | 1105 | int t4_memory_rw(struct adapter *adap, int win, int mtype, u32 addr, u32 len, |
| 1106 | __be32 *buf, int dir); | 1106 | void *buf, int dir); |
| 1107 | static inline int t4_memory_write(struct adapter *adap, int mtype, u32 addr, | 1107 | static inline int t4_memory_write(struct adapter *adap, int mtype, u32 addr, |
| 1108 | u32 len, __be32 *buf) | 1108 | u32 len, __be32 *buf) |
| 1109 | { | 1109 | { |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c index 4d643b65265e..1abdfa123c6c 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | |||
| @@ -449,7 +449,7 @@ int t4_edc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, u64 *ecc) | |||
| 449 | * @mtype: memory type: MEM_EDC0, MEM_EDC1 or MEM_MC | 449 | * @mtype: memory type: MEM_EDC0, MEM_EDC1 or MEM_MC |
| 450 | * @addr: address within indicated memory type | 450 | * @addr: address within indicated memory type |
| 451 | * @len: amount of memory to transfer | 451 | * @len: amount of memory to transfer |
| 452 | * @buf: host memory buffer | 452 | * @hbuf: host memory buffer |
| 453 | * @dir: direction of transfer T4_MEMORY_READ (1) or T4_MEMORY_WRITE (0) | 453 | * @dir: direction of transfer T4_MEMORY_READ (1) or T4_MEMORY_WRITE (0) |
| 454 | * | 454 | * |
| 455 | * Reads/writes an [almost] arbitrary memory region in the firmware: the | 455 | * Reads/writes an [almost] arbitrary memory region in the firmware: the |
| @@ -460,15 +460,17 @@ int t4_edc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, u64 *ecc) | |||
| 460 | * caller's responsibility to perform appropriate byte order conversions. | 460 | * caller's responsibility to perform appropriate byte order conversions. |
| 461 | */ | 461 | */ |
| 462 | int t4_memory_rw(struct adapter *adap, int win, int mtype, u32 addr, | 462 | int t4_memory_rw(struct adapter *adap, int win, int mtype, u32 addr, |
| 463 | u32 len, __be32 *buf, int dir) | 463 | u32 len, void *hbuf, int dir) |
| 464 | { | 464 | { |
| 465 | u32 pos, offset, resid, memoffset; | 465 | u32 pos, offset, resid, memoffset; |
| 466 | u32 edc_size, mc_size, win_pf, mem_reg, mem_aperture, mem_base; | 466 | u32 edc_size, mc_size, win_pf, mem_reg, mem_aperture, mem_base; |
| 467 | u32 *buf; | ||
| 467 | 468 | ||
| 468 | /* Argument sanity checks ... | 469 | /* Argument sanity checks ... |
| 469 | */ | 470 | */ |
| 470 | if (addr & 0x3) | 471 | if (addr & 0x3 || (uintptr_t)hbuf & 0x3) |
| 471 | return -EINVAL; | 472 | return -EINVAL; |
| 473 | buf = (u32 *)hbuf; | ||
| 472 | 474 | ||
| 473 | /* It's convenient to be able to handle lengths which aren't a | 475 | /* It's convenient to be able to handle lengths which aren't a |
| 474 | * multiple of 32-bits because we often end up transferring files to | 476 | * multiple of 32-bits because we often end up transferring files to |
| @@ -532,14 +534,45 @@ int t4_memory_rw(struct adapter *adap, int win, int mtype, u32 addr, | |||
| 532 | 534 | ||
| 533 | /* Transfer data to/from the adapter as long as there's an integral | 535 | /* Transfer data to/from the adapter as long as there's an integral |
| 534 | * number of 32-bit transfers to complete. | 536 | * number of 32-bit transfers to complete. |
| 537 | * | ||
| 538 | * A note on Endianness issues: | ||
| 539 | * | ||
| 540 | * The "register" reads and writes below from/to the PCI-E Memory | ||
| 541 | * Window invoke the standard adapter Big-Endian to PCI-E Link | ||
| 542 | * Little-Endian "swizzel." As a result, if we have the following | ||
| 543 | * data in adapter memory: | ||
| 544 | * | ||
| 545 | * Memory: ... | b0 | b1 | b2 | b3 | ... | ||
| 546 | * Address: i+0 i+1 i+2 i+3 | ||
| 547 | * | ||
| 548 | * Then a read of the adapter memory via the PCI-E Memory Window | ||
| 549 | * will yield: | ||
| 550 | * | ||
| 551 | * x = readl(i) | ||
| 552 | * 31 0 | ||
| 553 | * [ b3 | b2 | b1 | b0 ] | ||
| 554 | * | ||
| 555 | * If this value is stored into local memory on a Little-Endian system | ||
| 556 | * it will show up correctly in local memory as: | ||
| 557 | * | ||
| 558 | * ( ..., b0, b1, b2, b3, ... ) | ||
| 559 | * | ||
| 560 | * But on a Big-Endian system, the store will show up in memory | ||
| 561 | * incorrectly swizzled as: | ||
| 562 | * | ||
| 563 | * ( ..., b3, b2, b1, b0, ... ) | ||
| 564 | * | ||
| 565 | * So we need to account for this in the reads and writes to the | ||
| 566 | * PCI-E Memory Window below by undoing the register read/write | ||
| 567 | * swizzels. | ||
| 535 | */ | 568 | */ |
| 536 | while (len > 0) { | 569 | while (len > 0) { |
| 537 | if (dir == T4_MEMORY_READ) | 570 | if (dir == T4_MEMORY_READ) |
| 538 | *buf++ = (__force __be32) t4_read_reg(adap, | 571 | *buf++ = le32_to_cpu((__force __le32)t4_read_reg(adap, |
| 539 | mem_base + offset); | 572 | mem_base + offset)); |
| 540 | else | 573 | else |
| 541 | t4_write_reg(adap, mem_base + offset, | 574 | t4_write_reg(adap, mem_base + offset, |
| 542 | (__force u32) *buf++); | 575 | (__force u32)cpu_to_le32(*buf++)); |
| 543 | offset += sizeof(__be32); | 576 | offset += sizeof(__be32); |
| 544 | len -= sizeof(__be32); | 577 | len -= sizeof(__be32); |
| 545 | 578 | ||
| @@ -568,15 +601,16 @@ int t4_memory_rw(struct adapter *adap, int win, int mtype, u32 addr, | |||
| 568 | */ | 601 | */ |
| 569 | if (resid) { | 602 | if (resid) { |
| 570 | union { | 603 | union { |
| 571 | __be32 word; | 604 | u32 word; |
| 572 | char byte[4]; | 605 | char byte[4]; |
| 573 | } last; | 606 | } last; |
| 574 | unsigned char *bp; | 607 | unsigned char *bp; |
| 575 | int i; | 608 | int i; |
| 576 | 609 | ||
| 577 | if (dir == T4_MEMORY_READ) { | 610 | if (dir == T4_MEMORY_READ) { |
| 578 | last.word = (__force __be32) t4_read_reg(adap, | 611 | last.word = le32_to_cpu( |
| 579 | mem_base + offset); | 612 | (__force __le32)t4_read_reg(adap, |
| 613 | mem_base + offset)); | ||
| 580 | for (bp = (unsigned char *)buf, i = resid; i < 4; i++) | 614 | for (bp = (unsigned char *)buf, i = resid; i < 4; i++) |
| 581 | bp[i] = last.byte[i]; | 615 | bp[i] = last.byte[i]; |
| 582 | } else { | 616 | } else { |
| @@ -584,7 +618,7 @@ int t4_memory_rw(struct adapter *adap, int win, int mtype, u32 addr, | |||
| 584 | for (i = resid; i < 4; i++) | 618 | for (i = resid; i < 4; i++) |
| 585 | last.byte[i] = 0; | 619 | last.byte[i] = 0; |
| 586 | t4_write_reg(adap, mem_base + offset, | 620 | t4_write_reg(adap, mem_base + offset, |
| 587 | (__force u32) last.word); | 621 | (__force u32)cpu_to_le32(last.word)); |
| 588 | } | 622 | } |
| 589 | } | 623 | } |
| 590 | 624 | ||
| @@ -1086,7 +1120,7 @@ int t4_prep_fw(struct adapter *adap, struct fw_info *fw_info, | |||
| 1086 | } | 1120 | } |
| 1087 | 1121 | ||
| 1088 | /* Installed successfully, update the cached header too. */ | 1122 | /* Installed successfully, update the cached header too. */ |
| 1089 | memcpy(card_fw, fs_fw, sizeof(*card_fw)); | 1123 | *card_fw = *fs_fw; |
| 1090 | card_fw_usable = 1; | 1124 | card_fw_usable = 1; |
| 1091 | *reset = 0; /* already reset as part of load_fw */ | 1125 | *reset = 0; /* already reset as part of load_fw */ |
| 1092 | } | 1126 | } |
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c index 9cbe038a388e..a5179bfcdc2c 100644 --- a/drivers/net/ethernet/cisco/enic/enic_main.c +++ b/drivers/net/ethernet/cisco/enic/enic_main.c | |||
| @@ -272,8 +272,8 @@ static irqreturn_t enic_isr_legacy(int irq, void *data) | |||
| 272 | } | 272 | } |
| 273 | 273 | ||
| 274 | if (ENIC_TEST_INTR(pba, notify_intr)) { | 274 | if (ENIC_TEST_INTR(pba, notify_intr)) { |
| 275 | vnic_intr_return_all_credits(&enic->intr[notify_intr]); | ||
| 276 | enic_notify_check(enic); | 275 | enic_notify_check(enic); |
| 276 | vnic_intr_return_all_credits(&enic->intr[notify_intr]); | ||
| 277 | } | 277 | } |
| 278 | 278 | ||
| 279 | if (ENIC_TEST_INTR(pba, err_intr)) { | 279 | if (ENIC_TEST_INTR(pba, err_intr)) { |
| @@ -346,8 +346,8 @@ static irqreturn_t enic_isr_msix_notify(int irq, void *data) | |||
| 346 | struct enic *enic = data; | 346 | struct enic *enic = data; |
| 347 | unsigned int intr = enic_msix_notify_intr(enic); | 347 | unsigned int intr = enic_msix_notify_intr(enic); |
| 348 | 348 | ||
| 349 | vnic_intr_return_all_credits(&enic->intr[intr]); | ||
| 350 | enic_notify_check(enic); | 349 | enic_notify_check(enic); |
| 350 | vnic_intr_return_all_credits(&enic->intr[intr]); | ||
| 351 | 351 | ||
| 352 | return IRQ_HANDLED; | 352 | return IRQ_HANDLED; |
| 353 | } | 353 | } |
diff --git a/drivers/net/ethernet/dec/tulip/tulip_core.c b/drivers/net/ethernet/dec/tulip/tulip_core.c index 3b42556f7f8d..ed41559bae77 100644 --- a/drivers/net/ethernet/dec/tulip/tulip_core.c +++ b/drivers/net/ethernet/dec/tulip/tulip_core.c | |||
| @@ -589,7 +589,7 @@ static void tulip_tx_timeout(struct net_device *dev) | |||
| 589 | (unsigned int)tp->rx_ring[i].buffer1, | 589 | (unsigned int)tp->rx_ring[i].buffer1, |
| 590 | (unsigned int)tp->rx_ring[i].buffer2, | 590 | (unsigned int)tp->rx_ring[i].buffer2, |
| 591 | buf[0], buf[1], buf[2]); | 591 | buf[0], buf[1], buf[2]); |
| 592 | for (j = 0; buf[j] != 0xee && j < 1600; j++) | 592 | for (j = 0; ((j < 1600) && buf[j] != 0xee); j++) |
| 593 | if (j < 100) | 593 | if (j < 100) |
| 594 | pr_cont(" %02x", buf[j]); | 594 | pr_cont(" %02x", buf[j]); |
| 595 | pr_cont(" j=%d\n", j); | 595 | pr_cont(" j=%d\n", j); |
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 9bb6220663b2..78e1ce09b1ab 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c | |||
| @@ -1189,13 +1189,12 @@ static void | |||
| 1189 | fec_enet_tx_queue(struct net_device *ndev, u16 queue_id) | 1189 | fec_enet_tx_queue(struct net_device *ndev, u16 queue_id) |
| 1190 | { | 1190 | { |
| 1191 | struct fec_enet_private *fep; | 1191 | struct fec_enet_private *fep; |
| 1192 | struct bufdesc *bdp, *bdp_t; | 1192 | struct bufdesc *bdp; |
| 1193 | unsigned short status; | 1193 | unsigned short status; |
| 1194 | struct sk_buff *skb; | 1194 | struct sk_buff *skb; |
| 1195 | struct fec_enet_priv_tx_q *txq; | 1195 | struct fec_enet_priv_tx_q *txq; |
| 1196 | struct netdev_queue *nq; | 1196 | struct netdev_queue *nq; |
| 1197 | int index = 0; | 1197 | int index = 0; |
| 1198 | int i, bdnum; | ||
| 1199 | int entries_free; | 1198 | int entries_free; |
| 1200 | 1199 | ||
| 1201 | fep = netdev_priv(ndev); | 1200 | fep = netdev_priv(ndev); |
| @@ -1216,29 +1215,18 @@ fec_enet_tx_queue(struct net_device *ndev, u16 queue_id) | |||
| 1216 | if (bdp == txq->cur_tx) | 1215 | if (bdp == txq->cur_tx) |
| 1217 | break; | 1216 | break; |
| 1218 | 1217 | ||
| 1219 | bdp_t = bdp; | 1218 | index = fec_enet_get_bd_index(txq->tx_bd_base, bdp, fep); |
| 1220 | bdnum = 1; | ||
| 1221 | index = fec_enet_get_bd_index(txq->tx_bd_base, bdp_t, fep); | ||
| 1222 | skb = txq->tx_skbuff[index]; | ||
| 1223 | while (!skb) { | ||
| 1224 | bdp_t = fec_enet_get_nextdesc(bdp_t, fep, queue_id); | ||
| 1225 | index = fec_enet_get_bd_index(txq->tx_bd_base, bdp_t, fep); | ||
| 1226 | skb = txq->tx_skbuff[index]; | ||
| 1227 | bdnum++; | ||
| 1228 | } | ||
| 1229 | if (skb_shinfo(skb)->nr_frags && | ||
| 1230 | (status = bdp_t->cbd_sc) & BD_ENET_TX_READY) | ||
| 1231 | break; | ||
| 1232 | 1219 | ||
| 1233 | for (i = 0; i < bdnum; i++) { | 1220 | skb = txq->tx_skbuff[index]; |
| 1234 | if (!IS_TSO_HEADER(txq, bdp->cbd_bufaddr)) | ||
| 1235 | dma_unmap_single(&fep->pdev->dev, bdp->cbd_bufaddr, | ||
| 1236 | bdp->cbd_datlen, DMA_TO_DEVICE); | ||
| 1237 | bdp->cbd_bufaddr = 0; | ||
| 1238 | if (i < bdnum - 1) | ||
| 1239 | bdp = fec_enet_get_nextdesc(bdp, fep, queue_id); | ||
| 1240 | } | ||
| 1241 | txq->tx_skbuff[index] = NULL; | 1221 | txq->tx_skbuff[index] = NULL; |
| 1222 | if (!IS_TSO_HEADER(txq, bdp->cbd_bufaddr)) | ||
| 1223 | dma_unmap_single(&fep->pdev->dev, bdp->cbd_bufaddr, | ||
| 1224 | bdp->cbd_datlen, DMA_TO_DEVICE); | ||
| 1225 | bdp->cbd_bufaddr = 0; | ||
| 1226 | if (!skb) { | ||
| 1227 | bdp = fec_enet_get_nextdesc(bdp, fep, queue_id); | ||
| 1228 | continue; | ||
| 1229 | } | ||
| 1242 | 1230 | ||
| 1243 | /* Check for errors. */ | 1231 | /* Check for errors. */ |
| 1244 | if (status & (BD_ENET_TX_HB | BD_ENET_TX_LC | | 1232 | if (status & (BD_ENET_TX_HB | BD_ENET_TX_LC | |
| @@ -1479,8 +1467,7 @@ fec_enet_rx_queue(struct net_device *ndev, int budget, u16 queue_id) | |||
| 1479 | 1467 | ||
| 1480 | vlan_packet_rcvd = true; | 1468 | vlan_packet_rcvd = true; |
| 1481 | 1469 | ||
| 1482 | skb_copy_to_linear_data_offset(skb, VLAN_HLEN, | 1470 | memmove(skb->data + VLAN_HLEN, data, ETH_ALEN * 2); |
| 1483 | data, (2 * ETH_ALEN)); | ||
| 1484 | skb_pull(skb, VLAN_HLEN); | 1471 | skb_pull(skb, VLAN_HLEN); |
| 1485 | } | 1472 | } |
| 1486 | 1473 | ||
| @@ -1597,7 +1584,7 @@ fec_enet_interrupt(int irq, void *dev_id) | |||
| 1597 | writel(int_events, fep->hwp + FEC_IEVENT); | 1584 | writel(int_events, fep->hwp + FEC_IEVENT); |
| 1598 | fec_enet_collect_events(fep, int_events); | 1585 | fec_enet_collect_events(fep, int_events); |
| 1599 | 1586 | ||
| 1600 | if (fep->work_tx || fep->work_rx) { | 1587 | if ((fep->work_tx || fep->work_rx) && fep->link) { |
| 1601 | ret = IRQ_HANDLED; | 1588 | ret = IRQ_HANDLED; |
| 1602 | 1589 | ||
| 1603 | if (napi_schedule_prep(&fep->napi)) { | 1590 | if (napi_schedule_prep(&fep->napi)) { |
| @@ -3383,7 +3370,6 @@ fec_drv_remove(struct platform_device *pdev) | |||
| 3383 | regulator_disable(fep->reg_phy); | 3370 | regulator_disable(fep->reg_phy); |
| 3384 | if (fep->ptp_clock) | 3371 | if (fep->ptp_clock) |
| 3385 | ptp_clock_unregister(fep->ptp_clock); | 3372 | ptp_clock_unregister(fep->ptp_clock); |
| 3386 | fec_enet_clk_enable(ndev, false); | ||
| 3387 | of_node_put(fep->phy_node); | 3373 | of_node_put(fep->phy_node); |
| 3388 | free_netdev(ndev); | 3374 | free_netdev(ndev); |
| 3389 | 3375 | ||
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c index 43df78882e48..7bf3682cdf47 100644 --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c | |||
| @@ -747,6 +747,18 @@ static int gfar_parse_group(struct device_node *np, | |||
| 747 | return 0; | 747 | return 0; |
| 748 | } | 748 | } |
| 749 | 749 | ||
| 750 | static int gfar_of_group_count(struct device_node *np) | ||
| 751 | { | ||
| 752 | struct device_node *child; | ||
| 753 | int num = 0; | ||
| 754 | |||
| 755 | for_each_available_child_of_node(np, child) | ||
| 756 | if (!of_node_cmp(child->name, "queue-group")) | ||
| 757 | num++; | ||
| 758 | |||
| 759 | return num; | ||
| 760 | } | ||
| 761 | |||
| 750 | static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev) | 762 | static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev) |
| 751 | { | 763 | { |
| 752 | const char *model; | 764 | const char *model; |
| @@ -784,7 +796,7 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev) | |||
| 784 | num_rx_qs = 1; | 796 | num_rx_qs = 1; |
| 785 | } else { /* MQ_MG_MODE */ | 797 | } else { /* MQ_MG_MODE */ |
| 786 | /* get the actual number of supported groups */ | 798 | /* get the actual number of supported groups */ |
| 787 | unsigned int num_grps = of_get_available_child_count(np); | 799 | unsigned int num_grps = gfar_of_group_count(np); |
| 788 | 800 | ||
| 789 | if (num_grps == 0 || num_grps > MAXGROUPS) { | 801 | if (num_grps == 0 || num_grps > MAXGROUPS) { |
| 790 | dev_err(&ofdev->dev, "Invalid # of int groups(%d)\n", | 802 | dev_err(&ofdev->dev, "Invalid # of int groups(%d)\n", |
| @@ -851,7 +863,10 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev) | |||
| 851 | 863 | ||
| 852 | /* Parse and initialize group specific information */ | 864 | /* Parse and initialize group specific information */ |
| 853 | if (priv->mode == MQ_MG_MODE) { | 865 | if (priv->mode == MQ_MG_MODE) { |
| 854 | for_each_child_of_node(np, child) { | 866 | for_each_available_child_of_node(np, child) { |
| 867 | if (of_node_cmp(child->name, "queue-group")) | ||
| 868 | continue; | ||
| 869 | |||
| 855 | err = gfar_parse_group(child, priv, model); | 870 | err = gfar_parse_group(child, priv, model); |
| 856 | if (err) | 871 | if (err) |
| 857 | goto err_grp_init; | 872 | goto err_grp_init; |
| @@ -3162,8 +3177,8 @@ static void adjust_link(struct net_device *dev) | |||
| 3162 | struct phy_device *phydev = priv->phydev; | 3177 | struct phy_device *phydev = priv->phydev; |
| 3163 | 3178 | ||
| 3164 | if (unlikely(phydev->link != priv->oldlink || | 3179 | if (unlikely(phydev->link != priv->oldlink || |
| 3165 | phydev->duplex != priv->oldduplex || | 3180 | (phydev->link && (phydev->duplex != priv->oldduplex || |
| 3166 | phydev->speed != priv->oldspeed)) | 3181 | phydev->speed != priv->oldspeed)))) |
| 3167 | gfar_update_link_state(priv); | 3182 | gfar_update_link_state(priv); |
| 3168 | } | 3183 | } |
| 3169 | 3184 | ||
diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c index e8a1adb7a962..c05e50759621 100644 --- a/drivers/net/ethernet/ibm/ehea/ehea_main.c +++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c | |||
| @@ -3262,6 +3262,139 @@ static void ehea_remove_device_sysfs(struct platform_device *dev) | |||
| 3262 | device_remove_file(&dev->dev, &dev_attr_remove_port); | 3262 | device_remove_file(&dev->dev, &dev_attr_remove_port); |
| 3263 | } | 3263 | } |
| 3264 | 3264 | ||
| 3265 | static int ehea_reboot_notifier(struct notifier_block *nb, | ||
| 3266 | unsigned long action, void *unused) | ||
| 3267 | { | ||
| 3268 | if (action == SYS_RESTART) { | ||
| 3269 | pr_info("Reboot: freeing all eHEA resources\n"); | ||
| 3270 | ibmebus_unregister_driver(&ehea_driver); | ||
| 3271 | } | ||
| 3272 | return NOTIFY_DONE; | ||
| 3273 | } | ||
| 3274 | |||
| 3275 | static struct notifier_block ehea_reboot_nb = { | ||
| 3276 | .notifier_call = ehea_reboot_notifier, | ||
| 3277 | }; | ||
| 3278 | |||
| 3279 | static int ehea_mem_notifier(struct notifier_block *nb, | ||
| 3280 | unsigned long action, void *data) | ||
| 3281 | { | ||
| 3282 | int ret = NOTIFY_BAD; | ||
| 3283 | struct memory_notify *arg = data; | ||
| 3284 | |||
| 3285 | mutex_lock(&dlpar_mem_lock); | ||
| 3286 | |||
| 3287 | switch (action) { | ||
| 3288 | case MEM_CANCEL_OFFLINE: | ||
| 3289 | pr_info("memory offlining canceled"); | ||
| 3290 | /* Fall through: re-add canceled memory block */ | ||
| 3291 | |||
| 3292 | case MEM_ONLINE: | ||
| 3293 | pr_info("memory is going online"); | ||
| 3294 | set_bit(__EHEA_STOP_XFER, &ehea_driver_flags); | ||
| 3295 | if (ehea_add_sect_bmap(arg->start_pfn, arg->nr_pages)) | ||
| 3296 | goto out_unlock; | ||
| 3297 | ehea_rereg_mrs(); | ||
| 3298 | break; | ||
| 3299 | |||
| 3300 | case MEM_GOING_OFFLINE: | ||
| 3301 | pr_info("memory is going offline"); | ||
| 3302 | set_bit(__EHEA_STOP_XFER, &ehea_driver_flags); | ||
| 3303 | if (ehea_rem_sect_bmap(arg->start_pfn, arg->nr_pages)) | ||
| 3304 | goto out_unlock; | ||
| 3305 | ehea_rereg_mrs(); | ||
| 3306 | break; | ||
| 3307 | |||
| 3308 | default: | ||
| 3309 | break; | ||
| 3310 | } | ||
| 3311 | |||
| 3312 | ehea_update_firmware_handles(); | ||
| 3313 | ret = NOTIFY_OK; | ||
| 3314 | |||
| 3315 | out_unlock: | ||
| 3316 | mutex_unlock(&dlpar_mem_lock); | ||
| 3317 | return ret; | ||
| 3318 | } | ||
| 3319 | |||
| 3320 | static struct notifier_block ehea_mem_nb = { | ||
| 3321 | .notifier_call = ehea_mem_notifier, | ||
| 3322 | }; | ||
| 3323 | |||
| 3324 | static void ehea_crash_handler(void) | ||
| 3325 | { | ||
| 3326 | int i; | ||
| 3327 | |||
| 3328 | if (ehea_fw_handles.arr) | ||
| 3329 | for (i = 0; i < ehea_fw_handles.num_entries; i++) | ||
| 3330 | ehea_h_free_resource(ehea_fw_handles.arr[i].adh, | ||
| 3331 | ehea_fw_handles.arr[i].fwh, | ||
| 3332 | FORCE_FREE); | ||
| 3333 | |||
| 3334 | if (ehea_bcmc_regs.arr) | ||
| 3335 | for (i = 0; i < ehea_bcmc_regs.num_entries; i++) | ||
| 3336 | ehea_h_reg_dereg_bcmc(ehea_bcmc_regs.arr[i].adh, | ||
| 3337 | ehea_bcmc_regs.arr[i].port_id, | ||
| 3338 | ehea_bcmc_regs.arr[i].reg_type, | ||
| 3339 | ehea_bcmc_regs.arr[i].macaddr, | ||
| 3340 | 0, H_DEREG_BCMC); | ||
| 3341 | } | ||
| 3342 | |||
| 3343 | static atomic_t ehea_memory_hooks_registered; | ||
| 3344 | |||
| 3345 | /* Register memory hooks on probe of first adapter */ | ||
| 3346 | static int ehea_register_memory_hooks(void) | ||
| 3347 | { | ||
| 3348 | int ret = 0; | ||
| 3349 | |||
| 3350 | if (atomic_inc_and_test(&ehea_memory_hooks_registered)) | ||
| 3351 | return 0; | ||
| 3352 | |||
| 3353 | ret = ehea_create_busmap(); | ||
| 3354 | if (ret) { | ||
| 3355 | pr_info("ehea_create_busmap failed\n"); | ||
| 3356 | goto out; | ||
| 3357 | } | ||
| 3358 | |||
| 3359 | ret = register_reboot_notifier(&ehea_reboot_nb); | ||
| 3360 | if (ret) { | ||
| 3361 | pr_info("register_reboot_notifier failed\n"); | ||
| 3362 | goto out; | ||
| 3363 | } | ||
| 3364 | |||
| 3365 | ret = register_memory_notifier(&ehea_mem_nb); | ||
| 3366 | if (ret) { | ||
| 3367 | pr_info("register_memory_notifier failed\n"); | ||
| 3368 | goto out2; | ||
| 3369 | } | ||
| 3370 | |||
| 3371 | ret = crash_shutdown_register(ehea_crash_handler); | ||
| 3372 | if (ret) { | ||
| 3373 | pr_info("crash_shutdown_register failed\n"); | ||
| 3374 | goto out3; | ||
| 3375 | } | ||
| 3376 | |||
| 3377 | return 0; | ||
| 3378 | |||
| 3379 | out3: | ||
| 3380 | unregister_memory_notifier(&ehea_mem_nb); | ||
| 3381 | out2: | ||
| 3382 | unregister_reboot_notifier(&ehea_reboot_nb); | ||
| 3383 | out: | ||
| 3384 | return ret; | ||
| 3385 | } | ||
| 3386 | |||
| 3387 | static void ehea_unregister_memory_hooks(void) | ||
| 3388 | { | ||
| 3389 | if (atomic_read(&ehea_memory_hooks_registered)) | ||
| 3390 | return; | ||
| 3391 | |||
| 3392 | unregister_reboot_notifier(&ehea_reboot_nb); | ||
| 3393 | if (crash_shutdown_unregister(ehea_crash_handler)) | ||
| 3394 | pr_info("failed unregistering crash handler\n"); | ||
| 3395 | unregister_memory_notifier(&ehea_mem_nb); | ||
| 3396 | } | ||
| 3397 | |||
| 3265 | static int ehea_probe_adapter(struct platform_device *dev) | 3398 | static int ehea_probe_adapter(struct platform_device *dev) |
| 3266 | { | 3399 | { |
| 3267 | struct ehea_adapter *adapter; | 3400 | struct ehea_adapter *adapter; |
| @@ -3269,6 +3402,10 @@ static int ehea_probe_adapter(struct platform_device *dev) | |||
| 3269 | int ret; | 3402 | int ret; |
| 3270 | int i; | 3403 | int i; |
| 3271 | 3404 | ||
| 3405 | ret = ehea_register_memory_hooks(); | ||
| 3406 | if (ret) | ||
| 3407 | return ret; | ||
| 3408 | |||
| 3272 | if (!dev || !dev->dev.of_node) { | 3409 | if (!dev || !dev->dev.of_node) { |
| 3273 | pr_err("Invalid ibmebus device probed\n"); | 3410 | pr_err("Invalid ibmebus device probed\n"); |
| 3274 | return -EINVAL; | 3411 | return -EINVAL; |
| @@ -3392,81 +3529,6 @@ static int ehea_remove(struct platform_device *dev) | |||
| 3392 | return 0; | 3529 | return 0; |
| 3393 | } | 3530 | } |
| 3394 | 3531 | ||
| 3395 | static void ehea_crash_handler(void) | ||
| 3396 | { | ||
| 3397 | int i; | ||
| 3398 | |||
| 3399 | if (ehea_fw_handles.arr) | ||
| 3400 | for (i = 0; i < ehea_fw_handles.num_entries; i++) | ||
| 3401 | ehea_h_free_resource(ehea_fw_handles.arr[i].adh, | ||
| 3402 | ehea_fw_handles.arr[i].fwh, | ||
| 3403 | FORCE_FREE); | ||
| 3404 | |||
| 3405 | if (ehea_bcmc_regs.arr) | ||
| 3406 | for (i = 0; i < ehea_bcmc_regs.num_entries; i++) | ||
| 3407 | ehea_h_reg_dereg_bcmc(ehea_bcmc_regs.arr[i].adh, | ||
| 3408 | ehea_bcmc_regs.arr[i].port_id, | ||
| 3409 | ehea_bcmc_regs.arr[i].reg_type, | ||
| 3410 | ehea_bcmc_regs.arr[i].macaddr, | ||
| 3411 | 0, H_DEREG_BCMC); | ||
| 3412 | } | ||
| 3413 | |||
| 3414 | static int ehea_mem_notifier(struct notifier_block *nb, | ||
| 3415 | unsigned long action, void *data) | ||
| 3416 | { | ||
| 3417 | int ret = NOTIFY_BAD; | ||
| 3418 | struct memory_notify *arg = data; | ||
| 3419 | |||
| 3420 | mutex_lock(&dlpar_mem_lock); | ||
| 3421 | |||
| 3422 | switch (action) { | ||
| 3423 | case MEM_CANCEL_OFFLINE: | ||
| 3424 | pr_info("memory offlining canceled"); | ||
| 3425 | /* Readd canceled memory block */ | ||
| 3426 | case MEM_ONLINE: | ||
| 3427 | pr_info("memory is going online"); | ||
| 3428 | set_bit(__EHEA_STOP_XFER, &ehea_driver_flags); | ||
| 3429 | if (ehea_add_sect_bmap(arg->start_pfn, arg->nr_pages)) | ||
| 3430 | goto out_unlock; | ||
| 3431 | ehea_rereg_mrs(); | ||
| 3432 | break; | ||
| 3433 | case MEM_GOING_OFFLINE: | ||
| 3434 | pr_info("memory is going offline"); | ||
| 3435 | set_bit(__EHEA_STOP_XFER, &ehea_driver_flags); | ||
| 3436 | if (ehea_rem_sect_bmap(arg->start_pfn, arg->nr_pages)) | ||
| 3437 | goto out_unlock; | ||
| 3438 | ehea_rereg_mrs(); | ||
| 3439 | break; | ||
| 3440 | default: | ||
| 3441 | break; | ||
| 3442 | } | ||
| 3443 | |||
| 3444 | ehea_update_firmware_handles(); | ||
| 3445 | ret = NOTIFY_OK; | ||
| 3446 | |||
| 3447 | out_unlock: | ||
| 3448 | mutex_unlock(&dlpar_mem_lock); | ||
| 3449 | return ret; | ||
| 3450 | } | ||
| 3451 | |||
| 3452 | static struct notifier_block ehea_mem_nb = { | ||
| 3453 | .notifier_call = ehea_mem_notifier, | ||
| 3454 | }; | ||
| 3455 | |||
| 3456 | static int ehea_reboot_notifier(struct notifier_block *nb, | ||
| 3457 | unsigned long action, void *unused) | ||
| 3458 | { | ||
| 3459 | if (action == SYS_RESTART) { | ||
| 3460 | pr_info("Reboot: freeing all eHEA resources\n"); | ||
| 3461 | ibmebus_unregister_driver(&ehea_driver); | ||
| 3462 | } | ||
| 3463 | return NOTIFY_DONE; | ||
| 3464 | } | ||
| 3465 | |||
| 3466 | static struct notifier_block ehea_reboot_nb = { | ||
| 3467 | .notifier_call = ehea_reboot_notifier, | ||
| 3468 | }; | ||
| 3469 | |||
| 3470 | static int check_module_parm(void) | 3532 | static int check_module_parm(void) |
| 3471 | { | 3533 | { |
| 3472 | int ret = 0; | 3534 | int ret = 0; |
| @@ -3520,26 +3582,10 @@ static int __init ehea_module_init(void) | |||
| 3520 | if (ret) | 3582 | if (ret) |
| 3521 | goto out; | 3583 | goto out; |
| 3522 | 3584 | ||
| 3523 | ret = ehea_create_busmap(); | ||
| 3524 | if (ret) | ||
| 3525 | goto out; | ||
| 3526 | |||
| 3527 | ret = register_reboot_notifier(&ehea_reboot_nb); | ||
| 3528 | if (ret) | ||
| 3529 | pr_info("failed registering reboot notifier\n"); | ||
| 3530 | |||
| 3531 | ret = register_memory_notifier(&ehea_mem_nb); | ||
| 3532 | if (ret) | ||
| 3533 | pr_info("failed registering memory remove notifier\n"); | ||
| 3534 | |||
| 3535 | ret = crash_shutdown_register(ehea_crash_handler); | ||
| 3536 | if (ret) | ||
| 3537 | pr_info("failed registering crash handler\n"); | ||
| 3538 | |||
| 3539 | ret = ibmebus_register_driver(&ehea_driver); | 3585 | ret = ibmebus_register_driver(&ehea_driver); |
| 3540 | if (ret) { | 3586 | if (ret) { |
| 3541 | pr_err("failed registering eHEA device driver on ebus\n"); | 3587 | pr_err("failed registering eHEA device driver on ebus\n"); |
| 3542 | goto out2; | 3588 | goto out; |
| 3543 | } | 3589 | } |
| 3544 | 3590 | ||
| 3545 | ret = driver_create_file(&ehea_driver.driver, | 3591 | ret = driver_create_file(&ehea_driver.driver, |
| @@ -3547,32 +3593,22 @@ static int __init ehea_module_init(void) | |||
| 3547 | if (ret) { | 3593 | if (ret) { |
| 3548 | pr_err("failed to register capabilities attribute, ret=%d\n", | 3594 | pr_err("failed to register capabilities attribute, ret=%d\n", |
| 3549 | ret); | 3595 | ret); |
| 3550 | goto out3; | 3596 | goto out2; |
| 3551 | } | 3597 | } |
| 3552 | 3598 | ||
| 3553 | return ret; | 3599 | return ret; |
| 3554 | 3600 | ||
| 3555 | out3: | ||
| 3556 | ibmebus_unregister_driver(&ehea_driver); | ||
| 3557 | out2: | 3601 | out2: |
| 3558 | unregister_memory_notifier(&ehea_mem_nb); | 3602 | ibmebus_unregister_driver(&ehea_driver); |
| 3559 | unregister_reboot_notifier(&ehea_reboot_nb); | ||
| 3560 | crash_shutdown_unregister(ehea_crash_handler); | ||
| 3561 | out: | 3603 | out: |
| 3562 | return ret; | 3604 | return ret; |
| 3563 | } | 3605 | } |
| 3564 | 3606 | ||
| 3565 | static void __exit ehea_module_exit(void) | 3607 | static void __exit ehea_module_exit(void) |
| 3566 | { | 3608 | { |
| 3567 | int ret; | ||
| 3568 | |||
| 3569 | driver_remove_file(&ehea_driver.driver, &driver_attr_capabilities); | 3609 | driver_remove_file(&ehea_driver.driver, &driver_attr_capabilities); |
| 3570 | ibmebus_unregister_driver(&ehea_driver); | 3610 | ibmebus_unregister_driver(&ehea_driver); |
| 3571 | unregister_reboot_notifier(&ehea_reboot_nb); | 3611 | ehea_unregister_memory_hooks(); |
| 3572 | ret = crash_shutdown_unregister(ehea_crash_handler); | ||
| 3573 | if (ret) | ||
| 3574 | pr_info("failed unregistering crash handler\n"); | ||
| 3575 | unregister_memory_notifier(&ehea_mem_nb); | ||
| 3576 | kfree(ehea_fw_handles.arr); | 3612 | kfree(ehea_fw_handles.arr); |
| 3577 | kfree(ehea_bcmc_regs.arr); | 3613 | kfree(ehea_bcmc_regs.arr); |
| 3578 | ehea_destroy_busmap(); | 3614 | ehea_destroy_busmap(); |
diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c index 21978cc019e7..cd7675ac5bf9 100644 --- a/drivers/net/ethernet/ibm/ibmveth.c +++ b/drivers/net/ethernet/ibm/ibmveth.c | |||
| @@ -1136,6 +1136,8 @@ restart_poll: | |||
| 1136 | ibmveth_replenish_task(adapter); | 1136 | ibmveth_replenish_task(adapter); |
| 1137 | 1137 | ||
| 1138 | if (frames_processed < budget) { | 1138 | if (frames_processed < budget) { |
| 1139 | napi_complete(napi); | ||
| 1140 | |||
| 1139 | /* We think we are done - reenable interrupts, | 1141 | /* We think we are done - reenable interrupts, |
| 1140 | * then check once more to make sure we are done. | 1142 | * then check once more to make sure we are done. |
| 1141 | */ | 1143 | */ |
| @@ -1144,8 +1146,6 @@ restart_poll: | |||
| 1144 | 1146 | ||
| 1145 | BUG_ON(lpar_rc != H_SUCCESS); | 1147 | BUG_ON(lpar_rc != H_SUCCESS); |
| 1146 | 1148 | ||
| 1147 | napi_complete(napi); | ||
| 1148 | |||
| 1149 | if (ibmveth_rxq_pending_buffer(adapter) && | 1149 | if (ibmveth_rxq_pending_buffer(adapter) && |
| 1150 | napi_reschedule(napi)) { | 1150 | napi_reschedule(napi)) { |
| 1151 | lpar_rc = h_vio_signal(adapter->vdev->unit_address, | 1151 | lpar_rc = h_vio_signal(adapter->vdev->unit_address, |
| @@ -1327,6 +1327,28 @@ static unsigned long ibmveth_get_desired_dma(struct vio_dev *vdev) | |||
| 1327 | return ret; | 1327 | return ret; |
| 1328 | } | 1328 | } |
| 1329 | 1329 | ||
| 1330 | static int ibmveth_set_mac_addr(struct net_device *dev, void *p) | ||
| 1331 | { | ||
| 1332 | struct ibmveth_adapter *adapter = netdev_priv(dev); | ||
| 1333 | struct sockaddr *addr = p; | ||
| 1334 | u64 mac_address; | ||
| 1335 | int rc; | ||
| 1336 | |||
| 1337 | if (!is_valid_ether_addr(addr->sa_data)) | ||
| 1338 | return -EADDRNOTAVAIL; | ||
| 1339 | |||
| 1340 | mac_address = ibmveth_encode_mac_addr(addr->sa_data); | ||
| 1341 | rc = h_change_logical_lan_mac(adapter->vdev->unit_address, mac_address); | ||
| 1342 | if (rc) { | ||
| 1343 | netdev_err(adapter->netdev, "h_change_logical_lan_mac failed with rc=%d\n", rc); | ||
| 1344 | return rc; | ||
| 1345 | } | ||
| 1346 | |||
| 1347 | ether_addr_copy(dev->dev_addr, addr->sa_data); | ||
| 1348 | |||
| 1349 | return 0; | ||
| 1350 | } | ||
| 1351 | |||
| 1330 | static const struct net_device_ops ibmveth_netdev_ops = { | 1352 | static const struct net_device_ops ibmveth_netdev_ops = { |
| 1331 | .ndo_open = ibmveth_open, | 1353 | .ndo_open = ibmveth_open, |
| 1332 | .ndo_stop = ibmveth_close, | 1354 | .ndo_stop = ibmveth_close, |
| @@ -1337,7 +1359,7 @@ static const struct net_device_ops ibmveth_netdev_ops = { | |||
| 1337 | .ndo_fix_features = ibmveth_fix_features, | 1359 | .ndo_fix_features = ibmveth_fix_features, |
| 1338 | .ndo_set_features = ibmveth_set_features, | 1360 | .ndo_set_features = ibmveth_set_features, |
| 1339 | .ndo_validate_addr = eth_validate_addr, | 1361 | .ndo_validate_addr = eth_validate_addr, |
| 1340 | .ndo_set_mac_address = eth_mac_addr, | 1362 | .ndo_set_mac_address = ibmveth_set_mac_addr, |
| 1341 | #ifdef CONFIG_NET_POLL_CONTROLLER | 1363 | #ifdef CONFIG_NET_POLL_CONTROLLER |
| 1342 | .ndo_poll_controller = ibmveth_poll_controller, | 1364 | .ndo_poll_controller = ibmveth_poll_controller, |
| 1343 | #endif | 1365 | #endif |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c index 11a9ffebf8d8..6aea65dae5ed 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_common.c +++ b/drivers/net/ethernet/intel/i40e/i40e_common.c | |||
| @@ -868,8 +868,9 @@ i40e_status i40e_pf_reset(struct i40e_hw *hw) | |||
| 868 | * The grst delay value is in 100ms units, and we'll wait a | 868 | * The grst delay value is in 100ms units, and we'll wait a |
| 869 | * couple counts longer to be sure we don't just miss the end. | 869 | * couple counts longer to be sure we don't just miss the end. |
| 870 | */ | 870 | */ |
| 871 | grst_del = rd32(hw, I40E_GLGEN_RSTCTL) & I40E_GLGEN_RSTCTL_GRSTDEL_MASK | 871 | grst_del = (rd32(hw, I40E_GLGEN_RSTCTL) & |
| 872 | >> I40E_GLGEN_RSTCTL_GRSTDEL_SHIFT; | 872 | I40E_GLGEN_RSTCTL_GRSTDEL_MASK) >> |
| 873 | I40E_GLGEN_RSTCTL_GRSTDEL_SHIFT; | ||
| 873 | for (cnt = 0; cnt < grst_del + 2; cnt++) { | 874 | for (cnt = 0; cnt < grst_del + 2; cnt++) { |
| 874 | reg = rd32(hw, I40E_GLGEN_RSTAT); | 875 | reg = rd32(hw, I40E_GLGEN_RSTAT); |
| 875 | if (!(reg & I40E_GLGEN_RSTAT_DEVSTATE_MASK)) | 876 | if (!(reg & I40E_GLGEN_RSTAT_DEVSTATE_MASK)) |
| @@ -2846,7 +2847,7 @@ i40e_status i40e_aq_add_udp_tunnel(struct i40e_hw *hw, | |||
| 2846 | 2847 | ||
| 2847 | status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details); | 2848 | status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details); |
| 2848 | 2849 | ||
| 2849 | if (!status) | 2850 | if (!status && filter_index) |
| 2850 | *filter_index = resp->index; | 2851 | *filter_index = resp->index; |
| 2851 | 2852 | ||
| 2852 | return status; | 2853 | return status; |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_dcb_nl.c b/drivers/net/ethernet/intel/i40e/i40e_dcb_nl.c index 183dcb63ce98..a11c70ca5a28 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_dcb_nl.c +++ b/drivers/net/ethernet/intel/i40e/i40e_dcb_nl.c | |||
| @@ -40,7 +40,7 @@ static void i40e_get_pfc_delay(struct i40e_hw *hw, u16 *delay) | |||
| 40 | u32 val; | 40 | u32 val; |
| 41 | 41 | ||
| 42 | val = rd32(hw, I40E_PRTDCB_GENC); | 42 | val = rd32(hw, I40E_PRTDCB_GENC); |
| 43 | *delay = (u16)(val & I40E_PRTDCB_GENC_PFCLDA_MASK >> | 43 | *delay = (u16)((val & I40E_PRTDCB_GENC_PFCLDA_MASK) >> |
| 44 | I40E_PRTDCB_GENC_PFCLDA_SHIFT); | 44 | I40E_PRTDCB_GENC_PFCLDA_SHIFT); |
| 45 | } | 45 | } |
| 46 | 46 | ||
diff --git a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c index 61236f983971..c17ee77100d3 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c +++ b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c | |||
| @@ -989,8 +989,10 @@ static ssize_t i40e_dbg_command_write(struct file *filp, | |||
| 989 | if (!cmd_buf) | 989 | if (!cmd_buf) |
| 990 | return count; | 990 | return count; |
| 991 | bytes_not_copied = copy_from_user(cmd_buf, buffer, count); | 991 | bytes_not_copied = copy_from_user(cmd_buf, buffer, count); |
| 992 | if (bytes_not_copied < 0) | 992 | if (bytes_not_copied < 0) { |
| 993 | kfree(cmd_buf); | ||
| 993 | return bytes_not_copied; | 994 | return bytes_not_copied; |
| 995 | } | ||
| 994 | if (bytes_not_copied > 0) | 996 | if (bytes_not_copied > 0) |
| 995 | count -= bytes_not_copied; | 997 | count -= bytes_not_copied; |
| 996 | cmd_buf[count] = '\0'; | 998 | cmd_buf[count] = '\0'; |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index cbe281be1c9f..dadda3c5d658 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c | |||
| @@ -1512,7 +1512,12 @@ static void i40e_vsi_setup_queue_map(struct i40e_vsi *vsi, | |||
| 1512 | vsi->tc_config.numtc = numtc; | 1512 | vsi->tc_config.numtc = numtc; |
| 1513 | vsi->tc_config.enabled_tc = enabled_tc ? enabled_tc : 1; | 1513 | vsi->tc_config.enabled_tc = enabled_tc ? enabled_tc : 1; |
| 1514 | /* Number of queues per enabled TC */ | 1514 | /* Number of queues per enabled TC */ |
| 1515 | num_tc_qps = vsi->alloc_queue_pairs/numtc; | 1515 | /* In MFP case we can have a much lower count of MSIx |
| 1516 | * vectors available and so we need to lower the used | ||
| 1517 | * q count. | ||
| 1518 | */ | ||
| 1519 | qcount = min_t(int, vsi->alloc_queue_pairs, pf->num_lan_msix); | ||
| 1520 | num_tc_qps = qcount / numtc; | ||
| 1516 | num_tc_qps = min_t(int, num_tc_qps, I40E_MAX_QUEUES_PER_TC); | 1521 | num_tc_qps = min_t(int, num_tc_qps, I40E_MAX_QUEUES_PER_TC); |
| 1517 | 1522 | ||
| 1518 | /* Setup queue offset/count for all TCs for given VSI */ | 1523 | /* Setup queue offset/count for all TCs for given VSI */ |
| @@ -2684,8 +2689,15 @@ static void i40e_vsi_config_dcb_rings(struct i40e_vsi *vsi) | |||
| 2684 | u16 qoffset, qcount; | 2689 | u16 qoffset, qcount; |
| 2685 | int i, n; | 2690 | int i, n; |
| 2686 | 2691 | ||
| 2687 | if (!(vsi->back->flags & I40E_FLAG_DCB_ENABLED)) | 2692 | if (!(vsi->back->flags & I40E_FLAG_DCB_ENABLED)) { |
| 2688 | return; | 2693 | /* Reset the TC information */ |
| 2694 | for (i = 0; i < vsi->num_queue_pairs; i++) { | ||
| 2695 | rx_ring = vsi->rx_rings[i]; | ||
| 2696 | tx_ring = vsi->tx_rings[i]; | ||
| 2697 | rx_ring->dcb_tc = 0; | ||
| 2698 | tx_ring->dcb_tc = 0; | ||
| 2699 | } | ||
| 2700 | } | ||
| 2689 | 2701 | ||
| 2690 | for (n = 0; n < I40E_MAX_TRAFFIC_CLASS; n++) { | 2702 | for (n = 0; n < I40E_MAX_TRAFFIC_CLASS; n++) { |
| 2691 | if (!(vsi->tc_config.enabled_tc & (1 << n))) | 2703 | if (!(vsi->tc_config.enabled_tc & (1 << n))) |
| @@ -3830,6 +3842,12 @@ static void i40e_clear_interrupt_scheme(struct i40e_pf *pf) | |||
| 3830 | { | 3842 | { |
| 3831 | int i; | 3843 | int i; |
| 3832 | 3844 | ||
| 3845 | i40e_stop_misc_vector(pf); | ||
| 3846 | if (pf->flags & I40E_FLAG_MSIX_ENABLED) { | ||
| 3847 | synchronize_irq(pf->msix_entries[0].vector); | ||
| 3848 | free_irq(pf->msix_entries[0].vector, pf); | ||
| 3849 | } | ||
| 3850 | |||
| 3833 | i40e_put_lump(pf->irq_pile, 0, I40E_PILE_VALID_BIT-1); | 3851 | i40e_put_lump(pf->irq_pile, 0, I40E_PILE_VALID_BIT-1); |
| 3834 | for (i = 0; i < pf->num_alloc_vsi; i++) | 3852 | for (i = 0; i < pf->num_alloc_vsi; i++) |
| 3835 | if (pf->vsi[i]) | 3853 | if (pf->vsi[i]) |
| @@ -5254,8 +5272,14 @@ static int i40e_handle_lldp_event(struct i40e_pf *pf, | |||
| 5254 | 5272 | ||
| 5255 | /* Wait for the PF's Tx queues to be disabled */ | 5273 | /* Wait for the PF's Tx queues to be disabled */ |
| 5256 | ret = i40e_pf_wait_txq_disabled(pf); | 5274 | ret = i40e_pf_wait_txq_disabled(pf); |
| 5257 | if (!ret) | 5275 | if (ret) { |
| 5276 | /* Schedule PF reset to recover */ | ||
| 5277 | set_bit(__I40E_PF_RESET_REQUESTED, &pf->state); | ||
| 5278 | i40e_service_event_schedule(pf); | ||
| 5279 | } else { | ||
| 5258 | i40e_pf_unquiesce_all_vsi(pf); | 5280 | i40e_pf_unquiesce_all_vsi(pf); |
| 5281 | } | ||
| 5282 | |||
| 5259 | exit: | 5283 | exit: |
| 5260 | return ret; | 5284 | return ret; |
| 5261 | } | 5285 | } |
| @@ -5587,7 +5611,8 @@ static void i40e_check_hang_subtask(struct i40e_pf *pf) | |||
| 5587 | int i, v; | 5611 | int i, v; |
| 5588 | 5612 | ||
| 5589 | /* If we're down or resetting, just bail */ | 5613 | /* If we're down or resetting, just bail */ |
| 5590 | if (test_bit(__I40E_CONFIG_BUSY, &pf->state)) | 5614 | if (test_bit(__I40E_DOWN, &pf->state) || |
| 5615 | test_bit(__I40E_CONFIG_BUSY, &pf->state)) | ||
| 5591 | return; | 5616 | return; |
| 5592 | 5617 | ||
| 5593 | /* for each VSI/netdev | 5618 | /* for each VSI/netdev |
| @@ -9533,6 +9558,7 @@ static void i40e_remove(struct pci_dev *pdev) | |||
| 9533 | set_bit(__I40E_DOWN, &pf->state); | 9558 | set_bit(__I40E_DOWN, &pf->state); |
| 9534 | del_timer_sync(&pf->service_timer); | 9559 | del_timer_sync(&pf->service_timer); |
| 9535 | cancel_work_sync(&pf->service_task); | 9560 | cancel_work_sync(&pf->service_task); |
| 9561 | i40e_fdir_teardown(pf); | ||
| 9536 | 9562 | ||
| 9537 | if (pf->flags & I40E_FLAG_SRIOV_ENABLED) { | 9563 | if (pf->flags & I40E_FLAG_SRIOV_ENABLED) { |
| 9538 | i40e_free_vfs(pf); | 9564 | i40e_free_vfs(pf); |
| @@ -9559,12 +9585,6 @@ static void i40e_remove(struct pci_dev *pdev) | |||
| 9559 | if (pf->vsi[pf->lan_vsi]) | 9585 | if (pf->vsi[pf->lan_vsi]) |
| 9560 | i40e_vsi_release(pf->vsi[pf->lan_vsi]); | 9586 | i40e_vsi_release(pf->vsi[pf->lan_vsi]); |
| 9561 | 9587 | ||
| 9562 | i40e_stop_misc_vector(pf); | ||
| 9563 | if (pf->flags & I40E_FLAG_MSIX_ENABLED) { | ||
| 9564 | synchronize_irq(pf->msix_entries[0].vector); | ||
| 9565 | free_irq(pf->msix_entries[0].vector, pf); | ||
| 9566 | } | ||
| 9567 | |||
| 9568 | /* shutdown and destroy the HMC */ | 9588 | /* shutdown and destroy the HMC */ |
| 9569 | if (pf->hw.hmc.hmc_obj) { | 9589 | if (pf->hw.hmc.hmc_obj) { |
| 9570 | ret_code = i40e_shutdown_lan_hmc(&pf->hw); | 9590 | ret_code = i40e_shutdown_lan_hmc(&pf->hw); |
| @@ -9718,6 +9738,8 @@ static void i40e_shutdown(struct pci_dev *pdev) | |||
| 9718 | wr32(hw, I40E_PFPM_APM, (pf->wol_en ? I40E_PFPM_APM_APME_MASK : 0)); | 9738 | wr32(hw, I40E_PFPM_APM, (pf->wol_en ? I40E_PFPM_APM_APME_MASK : 0)); |
| 9719 | wr32(hw, I40E_PFPM_WUFC, (pf->wol_en ? I40E_PFPM_WUFC_MAG_MASK : 0)); | 9739 | wr32(hw, I40E_PFPM_WUFC, (pf->wol_en ? I40E_PFPM_WUFC_MAG_MASK : 0)); |
| 9720 | 9740 | ||
| 9741 | i40e_clear_interrupt_scheme(pf); | ||
| 9742 | |||
| 9721 | if (system_state == SYSTEM_POWER_OFF) { | 9743 | if (system_state == SYSTEM_POWER_OFF) { |
| 9722 | pci_wake_from_d3(pdev, pf->wol_en); | 9744 | pci_wake_from_d3(pdev, pf->wol_en); |
| 9723 | pci_set_power_state(pdev, PCI_D3hot); | 9745 | pci_set_power_state(pdev, PCI_D3hot); |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_nvm.c b/drivers/net/ethernet/intel/i40e/i40e_nvm.c index 3e70f2e45a47..5defe0d63514 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_nvm.c +++ b/drivers/net/ethernet/intel/i40e/i40e_nvm.c | |||
| @@ -679,9 +679,11 @@ static i40e_status i40e_nvmupd_state_writing(struct i40e_hw *hw, | |||
| 679 | { | 679 | { |
| 680 | i40e_status status; | 680 | i40e_status status; |
| 681 | enum i40e_nvmupd_cmd upd_cmd; | 681 | enum i40e_nvmupd_cmd upd_cmd; |
| 682 | bool retry_attempt = false; | ||
| 682 | 683 | ||
| 683 | upd_cmd = i40e_nvmupd_validate_command(hw, cmd, errno); | 684 | upd_cmd = i40e_nvmupd_validate_command(hw, cmd, errno); |
| 684 | 685 | ||
| 686 | retry: | ||
| 685 | switch (upd_cmd) { | 687 | switch (upd_cmd) { |
| 686 | case I40E_NVMUPD_WRITE_CON: | 688 | case I40E_NVMUPD_WRITE_CON: |
| 687 | status = i40e_nvmupd_nvm_write(hw, cmd, bytes, errno); | 689 | status = i40e_nvmupd_nvm_write(hw, cmd, bytes, errno); |
| @@ -725,6 +727,39 @@ static i40e_status i40e_nvmupd_state_writing(struct i40e_hw *hw, | |||
| 725 | *errno = -ESRCH; | 727 | *errno = -ESRCH; |
| 726 | break; | 728 | break; |
| 727 | } | 729 | } |
| 730 | |||
| 731 | /* In some circumstances, a multi-write transaction takes longer | ||
| 732 | * than the default 3 minute timeout on the write semaphore. If | ||
| 733 | * the write failed with an EBUSY status, this is likely the problem, | ||
| 734 | * so here we try to reacquire the semaphore then retry the write. | ||
| 735 | * We only do one retry, then give up. | ||
| 736 | */ | ||
| 737 | if (status && (hw->aq.asq_last_status == I40E_AQ_RC_EBUSY) && | ||
| 738 | !retry_attempt) { | ||
| 739 | i40e_status old_status = status; | ||
| 740 | u32 old_asq_status = hw->aq.asq_last_status; | ||
| 741 | u32 gtime; | ||
| 742 | |||
| 743 | gtime = rd32(hw, I40E_GLVFGEN_TIMER); | ||
| 744 | if (gtime >= hw->nvm.hw_semaphore_timeout) { | ||
| 745 | i40e_debug(hw, I40E_DEBUG_ALL, | ||
| 746 | "NVMUPD: write semaphore expired (%d >= %lld), retrying\n", | ||
| 747 | gtime, hw->nvm.hw_semaphore_timeout); | ||
| 748 | i40e_release_nvm(hw); | ||
| 749 | status = i40e_acquire_nvm(hw, I40E_RESOURCE_WRITE); | ||
| 750 | if (status) { | ||
| 751 | i40e_debug(hw, I40E_DEBUG_ALL, | ||
| 752 | "NVMUPD: write semaphore reacquire failed aq_err = %d\n", | ||
| 753 | hw->aq.asq_last_status); | ||
| 754 | status = old_status; | ||
| 755 | hw->aq.asq_last_status = old_asq_status; | ||
| 756 | } else { | ||
| 757 | retry_attempt = true; | ||
| 758 | goto retry; | ||
| 759 | } | ||
| 760 | } | ||
| 761 | } | ||
| 762 | |||
| 728 | return status; | 763 | return status; |
| 729 | } | 764 | } |
| 730 | 765 | ||
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c index 2206d2d36f0f..bbf1b1247ac4 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c | |||
| @@ -586,6 +586,20 @@ void i40e_free_tx_resources(struct i40e_ring *tx_ring) | |||
| 586 | } | 586 | } |
| 587 | 587 | ||
| 588 | /** | 588 | /** |
| 589 | * i40e_get_head - Retrieve head from head writeback | ||
| 590 | * @tx_ring: tx ring to fetch head of | ||
| 591 | * | ||
| 592 | * Returns value of Tx ring head based on value stored | ||
| 593 | * in head write-back location | ||
| 594 | **/ | ||
| 595 | static inline u32 i40e_get_head(struct i40e_ring *tx_ring) | ||
| 596 | { | ||
| 597 | void *head = (struct i40e_tx_desc *)tx_ring->desc + tx_ring->count; | ||
| 598 | |||
| 599 | return le32_to_cpu(*(volatile __le32 *)head); | ||
| 600 | } | ||
| 601 | |||
| 602 | /** | ||
| 589 | * i40e_get_tx_pending - how many tx descriptors not processed | 603 | * i40e_get_tx_pending - how many tx descriptors not processed |
| 590 | * @tx_ring: the ring of descriptors | 604 | * @tx_ring: the ring of descriptors |
| 591 | * | 605 | * |
| @@ -594,10 +608,16 @@ void i40e_free_tx_resources(struct i40e_ring *tx_ring) | |||
| 594 | **/ | 608 | **/ |
| 595 | static u32 i40e_get_tx_pending(struct i40e_ring *ring) | 609 | static u32 i40e_get_tx_pending(struct i40e_ring *ring) |
| 596 | { | 610 | { |
| 597 | u32 ntu = ((ring->next_to_clean <= ring->next_to_use) | 611 | u32 head, tail; |
| 598 | ? ring->next_to_use | 612 | |
| 599 | : ring->next_to_use + ring->count); | 613 | head = i40e_get_head(ring); |
| 600 | return ntu - ring->next_to_clean; | 614 | tail = readl(ring->tail); |
| 615 | |||
| 616 | if (head != tail) | ||
| 617 | return (head < tail) ? | ||
| 618 | tail - head : (tail + ring->count - head); | ||
| 619 | |||
| 620 | return 0; | ||
| 601 | } | 621 | } |
| 602 | 622 | ||
| 603 | /** | 623 | /** |
| @@ -606,6 +626,8 @@ static u32 i40e_get_tx_pending(struct i40e_ring *ring) | |||
| 606 | **/ | 626 | **/ |
| 607 | static bool i40e_check_tx_hang(struct i40e_ring *tx_ring) | 627 | static bool i40e_check_tx_hang(struct i40e_ring *tx_ring) |
| 608 | { | 628 | { |
| 629 | u32 tx_done = tx_ring->stats.packets; | ||
| 630 | u32 tx_done_old = tx_ring->tx_stats.tx_done_old; | ||
| 609 | u32 tx_pending = i40e_get_tx_pending(tx_ring); | 631 | u32 tx_pending = i40e_get_tx_pending(tx_ring); |
| 610 | struct i40e_pf *pf = tx_ring->vsi->back; | 632 | struct i40e_pf *pf = tx_ring->vsi->back; |
| 611 | bool ret = false; | 633 | bool ret = false; |
| @@ -623,41 +645,25 @@ static bool i40e_check_tx_hang(struct i40e_ring *tx_ring) | |||
| 623 | * run the check_tx_hang logic with a transmit completion | 645 | * run the check_tx_hang logic with a transmit completion |
| 624 | * pending but without time to complete it yet. | 646 | * pending but without time to complete it yet. |
| 625 | */ | 647 | */ |
| 626 | if ((tx_ring->tx_stats.tx_done_old == tx_ring->stats.packets) && | 648 | if ((tx_done_old == tx_done) && tx_pending) { |
| 627 | (tx_pending >= I40E_MIN_DESC_PENDING)) { | ||
| 628 | /* make sure it is true for two checks in a row */ | 649 | /* make sure it is true for two checks in a row */ |
| 629 | ret = test_and_set_bit(__I40E_HANG_CHECK_ARMED, | 650 | ret = test_and_set_bit(__I40E_HANG_CHECK_ARMED, |
| 630 | &tx_ring->state); | 651 | &tx_ring->state); |
| 631 | } else if ((tx_ring->tx_stats.tx_done_old == tx_ring->stats.packets) && | 652 | } else if (tx_done_old == tx_done && |
| 632 | (tx_pending < I40E_MIN_DESC_PENDING) && | 653 | (tx_pending < I40E_MIN_DESC_PENDING) && (tx_pending > 0)) { |
| 633 | (tx_pending > 0)) { | ||
| 634 | if (I40E_DEBUG_FLOW & pf->hw.debug_mask) | 654 | if (I40E_DEBUG_FLOW & pf->hw.debug_mask) |
| 635 | dev_info(tx_ring->dev, "HW needs some more descs to do a cacheline flush. tx_pending %d, queue %d", | 655 | dev_info(tx_ring->dev, "HW needs some more descs to do a cacheline flush. tx_pending %d, queue %d", |
| 636 | tx_pending, tx_ring->queue_index); | 656 | tx_pending, tx_ring->queue_index); |
| 637 | pf->tx_sluggish_count++; | 657 | pf->tx_sluggish_count++; |
| 638 | } else { | 658 | } else { |
| 639 | /* update completed stats and disarm the hang check */ | 659 | /* update completed stats and disarm the hang check */ |
| 640 | tx_ring->tx_stats.tx_done_old = tx_ring->stats.packets; | 660 | tx_ring->tx_stats.tx_done_old = tx_done; |
| 641 | clear_bit(__I40E_HANG_CHECK_ARMED, &tx_ring->state); | 661 | clear_bit(__I40E_HANG_CHECK_ARMED, &tx_ring->state); |
| 642 | } | 662 | } |
| 643 | 663 | ||
| 644 | return ret; | 664 | return ret; |
| 645 | } | 665 | } |
| 646 | 666 | ||
| 647 | /** | ||
| 648 | * i40e_get_head - Retrieve head from head writeback | ||
| 649 | * @tx_ring: tx ring to fetch head of | ||
| 650 | * | ||
| 651 | * Returns value of Tx ring head based on value stored | ||
| 652 | * in head write-back location | ||
| 653 | **/ | ||
| 654 | static inline u32 i40e_get_head(struct i40e_ring *tx_ring) | ||
| 655 | { | ||
| 656 | void *head = (struct i40e_tx_desc *)tx_ring->desc + tx_ring->count; | ||
| 657 | |||
| 658 | return le32_to_cpu(*(volatile __le32 *)head); | ||
| 659 | } | ||
| 660 | |||
| 661 | #define WB_STRIDE 0x3 | 667 | #define WB_STRIDE 0x3 |
| 662 | 668 | ||
| 663 | /** | 669 | /** |
| @@ -2140,6 +2146,67 @@ static int i40e_maybe_stop_tx(struct i40e_ring *tx_ring, int size) | |||
| 2140 | } | 2146 | } |
| 2141 | 2147 | ||
| 2142 | /** | 2148 | /** |
| 2149 | * i40e_chk_linearize - Check if there are more than 8 fragments per packet | ||
| 2150 | * @skb: send buffer | ||
| 2151 | * @tx_flags: collected send information | ||
| 2152 | * @hdr_len: size of the packet header | ||
| 2153 | * | ||
| 2154 | * Note: Our HW can't scatter-gather more than 8 fragments to build | ||
| 2155 | * a packet on the wire and so we need to figure out the cases where we | ||
| 2156 | * need to linearize the skb. | ||
| 2157 | **/ | ||
| 2158 | static bool i40e_chk_linearize(struct sk_buff *skb, u32 tx_flags, | ||
| 2159 | const u8 hdr_len) | ||
| 2160 | { | ||
| 2161 | struct skb_frag_struct *frag; | ||
| 2162 | bool linearize = false; | ||
| 2163 | unsigned int size = 0; | ||
| 2164 | u16 num_frags; | ||
| 2165 | u16 gso_segs; | ||
| 2166 | |||
| 2167 | num_frags = skb_shinfo(skb)->nr_frags; | ||
| 2168 | gso_segs = skb_shinfo(skb)->gso_segs; | ||
| 2169 | |||
| 2170 | if (tx_flags & (I40E_TX_FLAGS_TSO | I40E_TX_FLAGS_FSO)) { | ||
| 2171 | u16 j = 1; | ||
| 2172 | |||
| 2173 | if (num_frags < (I40E_MAX_BUFFER_TXD)) | ||
| 2174 | goto linearize_chk_done; | ||
| 2175 | /* try the simple math, if we have too many frags per segment */ | ||
| 2176 | if (DIV_ROUND_UP((num_frags + gso_segs), gso_segs) > | ||
| 2177 | I40E_MAX_BUFFER_TXD) { | ||
| 2178 | linearize = true; | ||
| 2179 | goto linearize_chk_done; | ||
| 2180 | } | ||
| 2181 | frag = &skb_shinfo(skb)->frags[0]; | ||
| 2182 | size = hdr_len; | ||
| 2183 | /* we might still have more fragments per segment */ | ||
| 2184 | do { | ||
| 2185 | size += skb_frag_size(frag); | ||
| 2186 | frag++; j++; | ||
| 2187 | if (j == I40E_MAX_BUFFER_TXD) { | ||
| 2188 | if (size < skb_shinfo(skb)->gso_size) { | ||
| 2189 | linearize = true; | ||
| 2190 | break; | ||
| 2191 | } | ||
| 2192 | j = 1; | ||
| 2193 | size -= skb_shinfo(skb)->gso_size; | ||
| 2194 | if (size) | ||
| 2195 | j++; | ||
| 2196 | size += hdr_len; | ||
| 2197 | } | ||
| 2198 | num_frags--; | ||
| 2199 | } while (num_frags); | ||
| 2200 | } else { | ||
| 2201 | if (num_frags >= I40E_MAX_BUFFER_TXD) | ||
| 2202 | linearize = true; | ||
| 2203 | } | ||
| 2204 | |||
| 2205 | linearize_chk_done: | ||
| 2206 | return linearize; | ||
| 2207 | } | ||
| 2208 | |||
| 2209 | /** | ||
| 2143 | * i40e_tx_map - Build the Tx descriptor | 2210 | * i40e_tx_map - Build the Tx descriptor |
| 2144 | * @tx_ring: ring to send buffer on | 2211 | * @tx_ring: ring to send buffer on |
| 2145 | * @skb: send buffer | 2212 | * @skb: send buffer |
| @@ -2396,6 +2463,10 @@ static netdev_tx_t i40e_xmit_frame_ring(struct sk_buff *skb, | |||
| 2396 | if (tsyn) | 2463 | if (tsyn) |
| 2397 | tx_flags |= I40E_TX_FLAGS_TSYN; | 2464 | tx_flags |= I40E_TX_FLAGS_TSYN; |
| 2398 | 2465 | ||
| 2466 | if (i40e_chk_linearize(skb, tx_flags, hdr_len)) | ||
| 2467 | if (skb_linearize(skb)) | ||
| 2468 | goto out_drop; | ||
| 2469 | |||
| 2399 | skb_tx_timestamp(skb); | 2470 | skb_tx_timestamp(skb); |
| 2400 | 2471 | ||
| 2401 | /* always enable CRC insertion offload */ | 2472 | /* always enable CRC insertion offload */ |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.h b/drivers/net/ethernet/intel/i40e/i40e_txrx.h index 18b00231d2f1..dff0baeb1ecc 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.h +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.h | |||
| @@ -112,6 +112,7 @@ enum i40e_dyn_idx_t { | |||
| 112 | 112 | ||
| 113 | #define i40e_rx_desc i40e_32byte_rx_desc | 113 | #define i40e_rx_desc i40e_32byte_rx_desc |
| 114 | 114 | ||
| 115 | #define I40E_MAX_BUFFER_TXD 8 | ||
| 115 | #define I40E_MIN_TX_LEN 17 | 116 | #define I40E_MIN_TX_LEN 17 |
| 116 | #define I40E_MAX_DATA_PER_TXD 8192 | 117 | #define I40E_MAX_DATA_PER_TXD 8192 |
| 117 | 118 | ||
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c index 29004382f462..708891571dae 100644 --- a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c | |||
| @@ -126,6 +126,20 @@ void i40evf_free_tx_resources(struct i40e_ring *tx_ring) | |||
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | /** | 128 | /** |
| 129 | * i40e_get_head - Retrieve head from head writeback | ||
| 130 | * @tx_ring: tx ring to fetch head of | ||
| 131 | * | ||
| 132 | * Returns value of Tx ring head based on value stored | ||
| 133 | * in head write-back location | ||
| 134 | **/ | ||
| 135 | static inline u32 i40e_get_head(struct i40e_ring *tx_ring) | ||
| 136 | { | ||
| 137 | void *head = (struct i40e_tx_desc *)tx_ring->desc + tx_ring->count; | ||
| 138 | |||
| 139 | return le32_to_cpu(*(volatile __le32 *)head); | ||
| 140 | } | ||
| 141 | |||
| 142 | /** | ||
| 129 | * i40e_get_tx_pending - how many tx descriptors not processed | 143 | * i40e_get_tx_pending - how many tx descriptors not processed |
| 130 | * @tx_ring: the ring of descriptors | 144 | * @tx_ring: the ring of descriptors |
| 131 | * | 145 | * |
| @@ -134,10 +148,16 @@ void i40evf_free_tx_resources(struct i40e_ring *tx_ring) | |||
| 134 | **/ | 148 | **/ |
| 135 | static u32 i40e_get_tx_pending(struct i40e_ring *ring) | 149 | static u32 i40e_get_tx_pending(struct i40e_ring *ring) |
| 136 | { | 150 | { |
| 137 | u32 ntu = ((ring->next_to_clean <= ring->next_to_use) | 151 | u32 head, tail; |
| 138 | ? ring->next_to_use | 152 | |
| 139 | : ring->next_to_use + ring->count); | 153 | head = i40e_get_head(ring); |
| 140 | return ntu - ring->next_to_clean; | 154 | tail = readl(ring->tail); |
| 155 | |||
| 156 | if (head != tail) | ||
| 157 | return (head < tail) ? | ||
| 158 | tail - head : (tail + ring->count - head); | ||
| 159 | |||
| 160 | return 0; | ||
| 141 | } | 161 | } |
| 142 | 162 | ||
| 143 | /** | 163 | /** |
| @@ -146,6 +166,8 @@ static u32 i40e_get_tx_pending(struct i40e_ring *ring) | |||
| 146 | **/ | 166 | **/ |
| 147 | static bool i40e_check_tx_hang(struct i40e_ring *tx_ring) | 167 | static bool i40e_check_tx_hang(struct i40e_ring *tx_ring) |
| 148 | { | 168 | { |
| 169 | u32 tx_done = tx_ring->stats.packets; | ||
| 170 | u32 tx_done_old = tx_ring->tx_stats.tx_done_old; | ||
| 149 | u32 tx_pending = i40e_get_tx_pending(tx_ring); | 171 | u32 tx_pending = i40e_get_tx_pending(tx_ring); |
| 150 | bool ret = false; | 172 | bool ret = false; |
| 151 | 173 | ||
| @@ -162,36 +184,20 @@ static bool i40e_check_tx_hang(struct i40e_ring *tx_ring) | |||
| 162 | * run the check_tx_hang logic with a transmit completion | 184 | * run the check_tx_hang logic with a transmit completion |
| 163 | * pending but without time to complete it yet. | 185 | * pending but without time to complete it yet. |
| 164 | */ | 186 | */ |
| 165 | if ((tx_ring->tx_stats.tx_done_old == tx_ring->stats.packets) && | 187 | if ((tx_done_old == tx_done) && tx_pending) { |
| 166 | (tx_pending >= I40E_MIN_DESC_PENDING)) { | ||
| 167 | /* make sure it is true for two checks in a row */ | 188 | /* make sure it is true for two checks in a row */ |
| 168 | ret = test_and_set_bit(__I40E_HANG_CHECK_ARMED, | 189 | ret = test_and_set_bit(__I40E_HANG_CHECK_ARMED, |
| 169 | &tx_ring->state); | 190 | &tx_ring->state); |
| 170 | } else if (!(tx_ring->tx_stats.tx_done_old == tx_ring->stats.packets) || | 191 | } else if (tx_done_old == tx_done && |
| 171 | !(tx_pending < I40E_MIN_DESC_PENDING) || | 192 | (tx_pending < I40E_MIN_DESC_PENDING) && (tx_pending > 0)) { |
| 172 | !(tx_pending > 0)) { | ||
| 173 | /* update completed stats and disarm the hang check */ | 193 | /* update completed stats and disarm the hang check */ |
| 174 | tx_ring->tx_stats.tx_done_old = tx_ring->stats.packets; | 194 | tx_ring->tx_stats.tx_done_old = tx_done; |
| 175 | clear_bit(__I40E_HANG_CHECK_ARMED, &tx_ring->state); | 195 | clear_bit(__I40E_HANG_CHECK_ARMED, &tx_ring->state); |
| 176 | } | 196 | } |
| 177 | 197 | ||
| 178 | return ret; | 198 | return ret; |
| 179 | } | 199 | } |
| 180 | 200 | ||
| 181 | /** | ||
| 182 | * i40e_get_head - Retrieve head from head writeback | ||
| 183 | * @tx_ring: tx ring to fetch head of | ||
| 184 | * | ||
| 185 | * Returns value of Tx ring head based on value stored | ||
| 186 | * in head write-back location | ||
| 187 | **/ | ||
| 188 | static inline u32 i40e_get_head(struct i40e_ring *tx_ring) | ||
| 189 | { | ||
| 190 | void *head = (struct i40e_tx_desc *)tx_ring->desc + tx_ring->count; | ||
| 191 | |||
| 192 | return le32_to_cpu(*(volatile __le32 *)head); | ||
| 193 | } | ||
| 194 | |||
| 195 | #define WB_STRIDE 0x3 | 201 | #define WB_STRIDE 0x3 |
| 196 | 202 | ||
| 197 | /** | 203 | /** |
| @@ -1206,17 +1212,16 @@ static int i40e_tso(struct i40e_ring *tx_ring, struct sk_buff *skb, | |||
| 1206 | if (err < 0) | 1212 | if (err < 0) |
| 1207 | return err; | 1213 | return err; |
| 1208 | 1214 | ||
| 1209 | if (protocol == htons(ETH_P_IP)) { | 1215 | iph = skb->encapsulation ? inner_ip_hdr(skb) : ip_hdr(skb); |
| 1210 | iph = skb->encapsulation ? inner_ip_hdr(skb) : ip_hdr(skb); | 1216 | ipv6h = skb->encapsulation ? inner_ipv6_hdr(skb) : ipv6_hdr(skb); |
| 1217 | |||
| 1218 | if (iph->version == 4) { | ||
| 1211 | tcph = skb->encapsulation ? inner_tcp_hdr(skb) : tcp_hdr(skb); | 1219 | tcph = skb->encapsulation ? inner_tcp_hdr(skb) : tcp_hdr(skb); |
| 1212 | iph->tot_len = 0; | 1220 | iph->tot_len = 0; |
| 1213 | iph->check = 0; | 1221 | iph->check = 0; |
| 1214 | tcph->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr, | 1222 | tcph->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr, |
| 1215 | 0, IPPROTO_TCP, 0); | 1223 | 0, IPPROTO_TCP, 0); |
| 1216 | } else if (skb_is_gso_v6(skb)) { | 1224 | } else if (ipv6h->version == 6) { |
| 1217 | |||
| 1218 | ipv6h = skb->encapsulation ? inner_ipv6_hdr(skb) | ||
| 1219 | : ipv6_hdr(skb); | ||
| 1220 | tcph = skb->encapsulation ? inner_tcp_hdr(skb) : tcp_hdr(skb); | 1225 | tcph = skb->encapsulation ? inner_tcp_hdr(skb) : tcp_hdr(skb); |
| 1221 | ipv6h->payload_len = 0; | 1226 | ipv6h->payload_len = 0; |
| 1222 | tcph->check = ~csum_ipv6_magic(&ipv6h->saddr, &ipv6h->daddr, | 1227 | tcph->check = ~csum_ipv6_magic(&ipv6h->saddr, &ipv6h->daddr, |
| @@ -1274,13 +1279,9 @@ static void i40e_tx_enable_csum(struct sk_buff *skb, u32 tx_flags, | |||
| 1274 | I40E_TX_CTX_EXT_IP_IPV4_NO_CSUM; | 1279 | I40E_TX_CTX_EXT_IP_IPV4_NO_CSUM; |
| 1275 | } | 1280 | } |
| 1276 | } else if (tx_flags & I40E_TX_FLAGS_IPV6) { | 1281 | } else if (tx_flags & I40E_TX_FLAGS_IPV6) { |
| 1277 | if (tx_flags & I40E_TX_FLAGS_TSO) { | 1282 | *cd_tunneling |= I40E_TX_CTX_EXT_IP_IPV6; |
| 1278 | *cd_tunneling |= I40E_TX_CTX_EXT_IP_IPV6; | 1283 | if (tx_flags & I40E_TX_FLAGS_TSO) |
| 1279 | ip_hdr(skb)->check = 0; | 1284 | ip_hdr(skb)->check = 0; |
| 1280 | } else { | ||
| 1281 | *cd_tunneling |= | ||
| 1282 | I40E_TX_CTX_EXT_IP_IPV4_NO_CSUM; | ||
| 1283 | } | ||
| 1284 | } | 1285 | } |
| 1285 | 1286 | ||
| 1286 | /* Now set the ctx descriptor fields */ | 1287 | /* Now set the ctx descriptor fields */ |
| @@ -1290,6 +1291,11 @@ static void i40e_tx_enable_csum(struct sk_buff *skb, u32 tx_flags, | |||
| 1290 | ((skb_inner_network_offset(skb) - | 1291 | ((skb_inner_network_offset(skb) - |
| 1291 | skb_transport_offset(skb)) >> 1) << | 1292 | skb_transport_offset(skb)) >> 1) << |
| 1292 | I40E_TXD_CTX_QW0_NATLEN_SHIFT; | 1293 | I40E_TXD_CTX_QW0_NATLEN_SHIFT; |
| 1294 | if (this_ip_hdr->version == 6) { | ||
| 1295 | tx_flags &= ~I40E_TX_FLAGS_IPV4; | ||
| 1296 | tx_flags |= I40E_TX_FLAGS_IPV6; | ||
| 1297 | } | ||
| 1298 | |||
| 1293 | 1299 | ||
| 1294 | } else { | 1300 | } else { |
| 1295 | network_hdr_len = skb_network_header_len(skb); | 1301 | network_hdr_len = skb_network_header_len(skb); |
| @@ -1380,6 +1386,67 @@ static void i40e_create_tx_ctx(struct i40e_ring *tx_ring, | |||
| 1380 | context_desc->type_cmd_tso_mss = cpu_to_le64(cd_type_cmd_tso_mss); | 1386 | context_desc->type_cmd_tso_mss = cpu_to_le64(cd_type_cmd_tso_mss); |
| 1381 | } | 1387 | } |
| 1382 | 1388 | ||
| 1389 | /** | ||
| 1390 | * i40e_chk_linearize - Check if there are more than 8 fragments per packet | ||
| 1391 | * @skb: send buffer | ||
| 1392 | * @tx_flags: collected send information | ||
| 1393 | * @hdr_len: size of the packet header | ||
| 1394 | * | ||
| 1395 | * Note: Our HW can't scatter-gather more than 8 fragments to build | ||
| 1396 | * a packet on the wire and so we need to figure out the cases where we | ||
| 1397 | * need to linearize the skb. | ||
| 1398 | **/ | ||
| 1399 | static bool i40e_chk_linearize(struct sk_buff *skb, u32 tx_flags, | ||
| 1400 | const u8 hdr_len) | ||
| 1401 | { | ||
| 1402 | struct skb_frag_struct *frag; | ||
| 1403 | bool linearize = false; | ||
| 1404 | unsigned int size = 0; | ||
| 1405 | u16 num_frags; | ||
| 1406 | u16 gso_segs; | ||
| 1407 | |||
| 1408 | num_frags = skb_shinfo(skb)->nr_frags; | ||
| 1409 | gso_segs = skb_shinfo(skb)->gso_segs; | ||
| 1410 | |||
| 1411 | if (tx_flags & (I40E_TX_FLAGS_TSO | I40E_TX_FLAGS_FSO)) { | ||
| 1412 | u16 j = 1; | ||
| 1413 | |||
| 1414 | if (num_frags < (I40E_MAX_BUFFER_TXD)) | ||
| 1415 | goto linearize_chk_done; | ||
| 1416 | /* try the simple math, if we have too many frags per segment */ | ||
| 1417 | if (DIV_ROUND_UP((num_frags + gso_segs), gso_segs) > | ||
| 1418 | I40E_MAX_BUFFER_TXD) { | ||
| 1419 | linearize = true; | ||
| 1420 | goto linearize_chk_done; | ||
| 1421 | } | ||
| 1422 | frag = &skb_shinfo(skb)->frags[0]; | ||
| 1423 | size = hdr_len; | ||
| 1424 | /* we might still have more fragments per segment */ | ||
| 1425 | do { | ||
| 1426 | size += skb_frag_size(frag); | ||
| 1427 | frag++; j++; | ||
| 1428 | if (j == I40E_MAX_BUFFER_TXD) { | ||
| 1429 | if (size < skb_shinfo(skb)->gso_size) { | ||
| 1430 | linearize = true; | ||
| 1431 | break; | ||
| 1432 | } | ||
| 1433 | j = 1; | ||
| 1434 | size -= skb_shinfo(skb)->gso_size; | ||
| 1435 | if (size) | ||
| 1436 | j++; | ||
| 1437 | size += hdr_len; | ||
| 1438 | } | ||
| 1439 | num_frags--; | ||
| 1440 | } while (num_frags); | ||
| 1441 | } else { | ||
| 1442 | if (num_frags >= I40E_MAX_BUFFER_TXD) | ||
| 1443 | linearize = true; | ||
| 1444 | } | ||
| 1445 | |||
| 1446 | linearize_chk_done: | ||
| 1447 | return linearize; | ||
| 1448 | } | ||
| 1449 | |||
| 1383 | /** | 1450 | /** |
| 1384 | * i40e_tx_map - Build the Tx descriptor | 1451 | * i40e_tx_map - Build the Tx descriptor |
| 1385 | * @tx_ring: ring to send buffer on | 1452 | * @tx_ring: ring to send buffer on |
| @@ -1654,6 +1721,10 @@ static netdev_tx_t i40e_xmit_frame_ring(struct sk_buff *skb, | |||
| 1654 | else if (tso) | 1721 | else if (tso) |
| 1655 | tx_flags |= I40E_TX_FLAGS_TSO; | 1722 | tx_flags |= I40E_TX_FLAGS_TSO; |
| 1656 | 1723 | ||
| 1724 | if (i40e_chk_linearize(skb, tx_flags, hdr_len)) | ||
| 1725 | if (skb_linearize(skb)) | ||
| 1726 | goto out_drop; | ||
| 1727 | |||
| 1657 | skb_tx_timestamp(skb); | 1728 | skb_tx_timestamp(skb); |
| 1658 | 1729 | ||
| 1659 | /* always enable CRC insertion offload */ | 1730 | /* always enable CRC insertion offload */ |
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_txrx.h b/drivers/net/ethernet/intel/i40evf/i40e_txrx.h index 4e15903b2b6d..c950a038237c 100644 --- a/drivers/net/ethernet/intel/i40evf/i40e_txrx.h +++ b/drivers/net/ethernet/intel/i40evf/i40e_txrx.h | |||
| @@ -112,6 +112,7 @@ enum i40e_dyn_idx_t { | |||
| 112 | 112 | ||
| 113 | #define i40e_rx_desc i40e_32byte_rx_desc | 113 | #define i40e_rx_desc i40e_32byte_rx_desc |
| 114 | 114 | ||
| 115 | #define I40E_MAX_BUFFER_TXD 8 | ||
| 115 | #define I40E_MIN_TX_LEN 17 | 116 | #define I40E_MIN_TX_LEN 17 |
| 116 | #define I40E_MAX_DATA_PER_TXD 8192 | 117 | #define I40E_MAX_DATA_PER_TXD 8192 |
| 117 | 118 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index 2a210c4efb89..ebce5bb24df9 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
| @@ -1698,8 +1698,6 @@ int mlx4_en_start_port(struct net_device *dev) | |||
| 1698 | /* Schedule multicast task to populate multicast list */ | 1698 | /* Schedule multicast task to populate multicast list */ |
| 1699 | queue_work(mdev->workqueue, &priv->rx_mode_task); | 1699 | queue_work(mdev->workqueue, &priv->rx_mode_task); |
| 1700 | 1700 | ||
| 1701 | mlx4_set_stats_bitmap(mdev->dev, &priv->stats_bitmap); | ||
| 1702 | |||
| 1703 | #ifdef CONFIG_MLX4_EN_VXLAN | 1701 | #ifdef CONFIG_MLX4_EN_VXLAN |
| 1704 | if (priv->mdev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) | 1702 | if (priv->mdev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) |
| 1705 | vxlan_get_rx_port(dev); | 1703 | vxlan_get_rx_port(dev); |
| @@ -2853,6 +2851,8 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | |||
| 2853 | queue_delayed_work(mdev->workqueue, &priv->service_task, | 2851 | queue_delayed_work(mdev->workqueue, &priv->service_task, |
| 2854 | SERVICE_TASK_DELAY); | 2852 | SERVICE_TASK_DELAY); |
| 2855 | 2853 | ||
| 2854 | mlx4_set_stats_bitmap(mdev->dev, &priv->stats_bitmap); | ||
| 2855 | |||
| 2856 | return 0; | 2856 | return 0; |
| 2857 | 2857 | ||
| 2858 | out: | 2858 | out: |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_selftest.c b/drivers/net/ethernet/mellanox/mlx4/en_selftest.c index 2d8ee66138e8..a61009f4b2df 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_selftest.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_selftest.c | |||
| @@ -81,12 +81,14 @@ static int mlx4_en_test_loopback(struct mlx4_en_priv *priv) | |||
| 81 | { | 81 | { |
| 82 | u32 loopback_ok = 0; | 82 | u32 loopback_ok = 0; |
| 83 | int i; | 83 | int i; |
| 84 | 84 | bool gro_enabled; | |
| 85 | 85 | ||
| 86 | priv->loopback_ok = 0; | 86 | priv->loopback_ok = 0; |
| 87 | priv->validate_loopback = 1; | 87 | priv->validate_loopback = 1; |
| 88 | gro_enabled = priv->dev->features & NETIF_F_GRO; | ||
| 88 | 89 | ||
| 89 | mlx4_en_update_loopback_state(priv->dev, priv->dev->features); | 90 | mlx4_en_update_loopback_state(priv->dev, priv->dev->features); |
| 91 | priv->dev->features &= ~NETIF_F_GRO; | ||
| 90 | 92 | ||
| 91 | /* xmit */ | 93 | /* xmit */ |
| 92 | if (mlx4_en_test_loopback_xmit(priv)) { | 94 | if (mlx4_en_test_loopback_xmit(priv)) { |
| @@ -108,6 +110,10 @@ static int mlx4_en_test_loopback(struct mlx4_en_priv *priv) | |||
| 108 | mlx4_en_test_loopback_exit: | 110 | mlx4_en_test_loopback_exit: |
| 109 | 111 | ||
| 110 | priv->validate_loopback = 0; | 112 | priv->validate_loopback = 0; |
| 113 | |||
| 114 | if (gro_enabled) | ||
| 115 | priv->dev->features |= NETIF_F_GRO; | ||
| 116 | |||
| 111 | mlx4_en_update_loopback_state(priv->dev, priv->dev->features); | 117 | mlx4_en_update_loopback_state(priv->dev, priv->dev->features); |
| 112 | return !loopback_ok; | 118 | return !loopback_ok; |
| 113 | } | 119 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h index 2a8268e6be15..ebbe244e80dd 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | |||
| @@ -453,7 +453,7 @@ struct mlx4_en_port_stats { | |||
| 453 | unsigned long rx_chksum_none; | 453 | unsigned long rx_chksum_none; |
| 454 | unsigned long rx_chksum_complete; | 454 | unsigned long rx_chksum_complete; |
| 455 | unsigned long tx_chksum_offload; | 455 | unsigned long tx_chksum_offload; |
| 456 | #define NUM_PORT_STATS 9 | 456 | #define NUM_PORT_STATS 10 |
| 457 | }; | 457 | }; |
| 458 | 458 | ||
| 459 | struct mlx4_en_perf_stats { | 459 | struct mlx4_en_perf_stats { |
diff --git a/drivers/net/ethernet/mellanox/mlx4/qp.c b/drivers/net/ethernet/mellanox/mlx4/qp.c index 2bb8553bd905..eda29dbbfcd2 100644 --- a/drivers/net/ethernet/mellanox/mlx4/qp.c +++ b/drivers/net/ethernet/mellanox/mlx4/qp.c | |||
| @@ -412,7 +412,6 @@ err_icm: | |||
| 412 | 412 | ||
| 413 | EXPORT_SYMBOL_GPL(mlx4_qp_alloc); | 413 | EXPORT_SYMBOL_GPL(mlx4_qp_alloc); |
| 414 | 414 | ||
| 415 | #define MLX4_UPDATE_QP_SUPPORTED_ATTRS MLX4_UPDATE_QP_SMAC | ||
| 416 | int mlx4_update_qp(struct mlx4_dev *dev, u32 qpn, | 415 | int mlx4_update_qp(struct mlx4_dev *dev, u32 qpn, |
| 417 | enum mlx4_update_qp_attr attr, | 416 | enum mlx4_update_qp_attr attr, |
| 418 | struct mlx4_update_qp_params *params) | 417 | struct mlx4_update_qp_params *params) |
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c index 486e3d26cd4a..d97ca88c55b5 100644 --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | |||
| @@ -713,7 +713,7 @@ static int update_vport_qp_param(struct mlx4_dev *dev, | |||
| 713 | struct mlx4_vport_oper_state *vp_oper; | 713 | struct mlx4_vport_oper_state *vp_oper; |
| 714 | struct mlx4_priv *priv; | 714 | struct mlx4_priv *priv; |
| 715 | u32 qp_type; | 715 | u32 qp_type; |
| 716 | int port; | 716 | int port, err = 0; |
| 717 | 717 | ||
| 718 | port = (qpc->pri_path.sched_queue & 0x40) ? 2 : 1; | 718 | port = (qpc->pri_path.sched_queue & 0x40) ? 2 : 1; |
| 719 | priv = mlx4_priv(dev); | 719 | priv = mlx4_priv(dev); |
| @@ -738,7 +738,9 @@ static int update_vport_qp_param(struct mlx4_dev *dev, | |||
| 738 | } else { | 738 | } else { |
| 739 | struct mlx4_update_qp_params params = {.flags = 0}; | 739 | struct mlx4_update_qp_params params = {.flags = 0}; |
| 740 | 740 | ||
| 741 | mlx4_update_qp(dev, qpn, MLX4_UPDATE_QP_VSD, ¶ms); | 741 | err = mlx4_update_qp(dev, qpn, MLX4_UPDATE_QP_VSD, ¶ms); |
| 742 | if (err) | ||
| 743 | goto out; | ||
| 742 | } | 744 | } |
| 743 | } | 745 | } |
| 744 | 746 | ||
| @@ -773,7 +775,8 @@ static int update_vport_qp_param(struct mlx4_dev *dev, | |||
| 773 | qpc->pri_path.feup |= MLX4_FSM_FORCE_ETH_SRC_MAC; | 775 | qpc->pri_path.feup |= MLX4_FSM_FORCE_ETH_SRC_MAC; |
| 774 | qpc->pri_path.grh_mylmc = (0x80 & qpc->pri_path.grh_mylmc) + vp_oper->mac_idx; | 776 | qpc->pri_path.grh_mylmc = (0x80 & qpc->pri_path.grh_mylmc) + vp_oper->mac_idx; |
| 775 | } | 777 | } |
| 776 | return 0; | 778 | out: |
| 779 | return err; | ||
| 777 | } | 780 | } |
| 778 | 781 | ||
| 779 | static int mpt_mask(struct mlx4_dev *dev) | 782 | static int mpt_mask(struct mlx4_dev *dev) |
diff --git a/drivers/net/ethernet/pasemi/pasemi_mac.c b/drivers/net/ethernet/pasemi/pasemi_mac.c index 44e8d7d25547..57a6e6cd74fc 100644 --- a/drivers/net/ethernet/pasemi/pasemi_mac.c +++ b/drivers/net/ethernet/pasemi/pasemi_mac.c | |||
| @@ -1239,11 +1239,9 @@ static int pasemi_mac_open(struct net_device *dev) | |||
| 1239 | if (mac->phydev) | 1239 | if (mac->phydev) |
| 1240 | phy_start(mac->phydev); | 1240 | phy_start(mac->phydev); |
| 1241 | 1241 | ||
| 1242 | init_timer(&mac->tx->clean_timer); | 1242 | setup_timer(&mac->tx->clean_timer, pasemi_mac_tx_timer, |
| 1243 | mac->tx->clean_timer.function = pasemi_mac_tx_timer; | 1243 | (unsigned long)mac->tx); |
| 1244 | mac->tx->clean_timer.data = (unsigned long)mac->tx; | 1244 | mod_timer(&mac->tx->clean_timer, jiffies + HZ); |
| 1245 | mac->tx->clean_timer.expires = jiffies+HZ; | ||
| 1246 | add_timer(&mac->tx->clean_timer); | ||
| 1247 | 1245 | ||
| 1248 | return 0; | 1246 | return 0; |
| 1249 | 1247 | ||
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic.h b/drivers/net/ethernet/qlogic/netxen/netxen_nic.h index 6e426ae94692..0a5e204a0179 100644 --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic.h +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic.h | |||
| @@ -354,7 +354,7 @@ struct cmd_desc_type0 { | |||
| 354 | 354 | ||
| 355 | } __attribute__ ((aligned(64))); | 355 | } __attribute__ ((aligned(64))); |
| 356 | 356 | ||
| 357 | /* Note: sizeof(rcv_desc) should always be a mutliple of 2 */ | 357 | /* Note: sizeof(rcv_desc) should always be a multiple of 2 */ |
| 358 | struct rcv_desc { | 358 | struct rcv_desc { |
| 359 | __le16 reference_handle; | 359 | __le16 reference_handle; |
| 360 | __le16 reserved; | 360 | __le16 reserved; |
| @@ -499,7 +499,7 @@ struct uni_data_desc{ | |||
| 499 | #define NETXEN_IMAGE_START 0x43000 /* compressed image */ | 499 | #define NETXEN_IMAGE_START 0x43000 /* compressed image */ |
| 500 | #define NETXEN_SECONDARY_START 0x200000 /* backup images */ | 500 | #define NETXEN_SECONDARY_START 0x200000 /* backup images */ |
| 501 | #define NETXEN_PXE_START 0x3E0000 /* PXE boot rom */ | 501 | #define NETXEN_PXE_START 0x3E0000 /* PXE boot rom */ |
| 502 | #define NETXEN_USER_START 0x3E8000 /* Firmare info */ | 502 | #define NETXEN_USER_START 0x3E8000 /* Firmware info */ |
| 503 | #define NETXEN_FIXED_START 0x3F0000 /* backup of crbinit */ | 503 | #define NETXEN_FIXED_START 0x3F0000 /* backup of crbinit */ |
| 504 | #define NETXEN_USER_START_OLD NETXEN_PXE_START /* very old flash */ | 504 | #define NETXEN_USER_START_OLD NETXEN_PXE_START /* very old flash */ |
| 505 | 505 | ||
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h index fa4317611fd6..f221126a5c4e 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | |||
| @@ -314,7 +314,7 @@ struct qlcnic_fdt { | |||
| 314 | #define QLCNIC_BRDCFG_START 0x4000 /* board config */ | 314 | #define QLCNIC_BRDCFG_START 0x4000 /* board config */ |
| 315 | #define QLCNIC_BOOTLD_START 0x10000 /* bootld */ | 315 | #define QLCNIC_BOOTLD_START 0x10000 /* bootld */ |
| 316 | #define QLCNIC_IMAGE_START 0x43000 /* compressed image */ | 316 | #define QLCNIC_IMAGE_START 0x43000 /* compressed image */ |
| 317 | #define QLCNIC_USER_START 0x3E8000 /* Firmare info */ | 317 | #define QLCNIC_USER_START 0x3E8000 /* Firmware info */ |
| 318 | 318 | ||
| 319 | #define QLCNIC_FW_VERSION_OFFSET (QLCNIC_USER_START+0x408) | 319 | #define QLCNIC_FW_VERSION_OFFSET (QLCNIC_USER_START+0x408) |
| 320 | #define QLCNIC_FW_SIZE_OFFSET (QLCNIC_USER_START+0x40c) | 320 | #define QLCNIC_FW_SIZE_OFFSET (QLCNIC_USER_START+0x40c) |
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index ad0020af2193..c70ab40d8698 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
| @@ -2561,7 +2561,7 @@ static int rtl_check_firmware(struct rtl8169_private *tp, struct rtl_fw *rtl_fw) | |||
| 2561 | int rc = -EINVAL; | 2561 | int rc = -EINVAL; |
| 2562 | 2562 | ||
| 2563 | if (!rtl_fw_format_ok(tp, rtl_fw)) { | 2563 | if (!rtl_fw_format_ok(tp, rtl_fw)) { |
| 2564 | netif_err(tp, ifup, dev, "invalid firwmare\n"); | 2564 | netif_err(tp, ifup, dev, "invalid firmware\n"); |
| 2565 | goto out; | 2565 | goto out; |
| 2566 | } | 2566 | } |
| 2567 | 2567 | ||
| @@ -5067,8 +5067,6 @@ static void rtl_hw_reset(struct rtl8169_private *tp) | |||
| 5067 | RTL_W8(ChipCmd, CmdReset); | 5067 | RTL_W8(ChipCmd, CmdReset); |
| 5068 | 5068 | ||
| 5069 | rtl_udelay_loop_wait_low(tp, &rtl_chipcmd_cond, 100, 100); | 5069 | rtl_udelay_loop_wait_low(tp, &rtl_chipcmd_cond, 100, 100); |
| 5070 | |||
| 5071 | netdev_reset_queue(tp->dev); | ||
| 5072 | } | 5070 | } |
| 5073 | 5071 | ||
| 5074 | static void rtl_request_uncached_firmware(struct rtl8169_private *tp) | 5072 | static void rtl_request_uncached_firmware(struct rtl8169_private *tp) |
| @@ -7049,7 +7047,6 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, | |||
| 7049 | u32 status, len; | 7047 | u32 status, len; |
| 7050 | u32 opts[2]; | 7048 | u32 opts[2]; |
| 7051 | int frags; | 7049 | int frags; |
| 7052 | bool stop_queue; | ||
| 7053 | 7050 | ||
| 7054 | if (unlikely(!TX_FRAGS_READY_FOR(tp, skb_shinfo(skb)->nr_frags))) { | 7051 | if (unlikely(!TX_FRAGS_READY_FOR(tp, skb_shinfo(skb)->nr_frags))) { |
| 7055 | netif_err(tp, drv, dev, "BUG! Tx Ring full when queue awake!\n"); | 7052 | netif_err(tp, drv, dev, "BUG! Tx Ring full when queue awake!\n"); |
| @@ -7090,8 +7087,6 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, | |||
| 7090 | 7087 | ||
| 7091 | txd->opts2 = cpu_to_le32(opts[1]); | 7088 | txd->opts2 = cpu_to_le32(opts[1]); |
| 7092 | 7089 | ||
| 7093 | netdev_sent_queue(dev, skb->len); | ||
| 7094 | |||
| 7095 | skb_tx_timestamp(skb); | 7090 | skb_tx_timestamp(skb); |
| 7096 | 7091 | ||
| 7097 | /* Force memory writes to complete before releasing descriptor */ | 7092 | /* Force memory writes to complete before releasing descriptor */ |
| @@ -7106,16 +7101,11 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, | |||
| 7106 | 7101 | ||
| 7107 | tp->cur_tx += frags + 1; | 7102 | tp->cur_tx += frags + 1; |
| 7108 | 7103 | ||
| 7109 | stop_queue = !TX_FRAGS_READY_FOR(tp, MAX_SKB_FRAGS); | 7104 | RTL_W8(TxPoll, NPQ); |
| 7110 | 7105 | ||
| 7111 | if (!skb->xmit_more || stop_queue || | 7106 | mmiowb(); |
| 7112 | netif_xmit_stopped(netdev_get_tx_queue(dev, 0))) { | ||
| 7113 | RTL_W8(TxPoll, NPQ); | ||
| 7114 | |||
| 7115 | mmiowb(); | ||
| 7116 | } | ||
| 7117 | 7107 | ||
| 7118 | if (stop_queue) { | 7108 | if (!TX_FRAGS_READY_FOR(tp, MAX_SKB_FRAGS)) { |
| 7119 | /* Avoid wrongly optimistic queue wake-up: rtl_tx thread must | 7109 | /* Avoid wrongly optimistic queue wake-up: rtl_tx thread must |
| 7120 | * not miss a ring update when it notices a stopped queue. | 7110 | * not miss a ring update when it notices a stopped queue. |
| 7121 | */ | 7111 | */ |
| @@ -7198,7 +7188,6 @@ static void rtl8169_pcierr_interrupt(struct net_device *dev) | |||
| 7198 | static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp) | 7188 | static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp) |
| 7199 | { | 7189 | { |
| 7200 | unsigned int dirty_tx, tx_left; | 7190 | unsigned int dirty_tx, tx_left; |
| 7201 | unsigned int bytes_compl = 0, pkts_compl = 0; | ||
| 7202 | 7191 | ||
| 7203 | dirty_tx = tp->dirty_tx; | 7192 | dirty_tx = tp->dirty_tx; |
| 7204 | smp_rmb(); | 7193 | smp_rmb(); |
| @@ -7222,8 +7211,10 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp) | |||
| 7222 | rtl8169_unmap_tx_skb(&tp->pci_dev->dev, tx_skb, | 7211 | rtl8169_unmap_tx_skb(&tp->pci_dev->dev, tx_skb, |
| 7223 | tp->TxDescArray + entry); | 7212 | tp->TxDescArray + entry); |
| 7224 | if (status & LastFrag) { | 7213 | if (status & LastFrag) { |
| 7225 | pkts_compl++; | 7214 | u64_stats_update_begin(&tp->tx_stats.syncp); |
| 7226 | bytes_compl += tx_skb->skb->len; | 7215 | tp->tx_stats.packets++; |
| 7216 | tp->tx_stats.bytes += tx_skb->skb->len; | ||
| 7217 | u64_stats_update_end(&tp->tx_stats.syncp); | ||
| 7227 | dev_kfree_skb_any(tx_skb->skb); | 7218 | dev_kfree_skb_any(tx_skb->skb); |
| 7228 | tx_skb->skb = NULL; | 7219 | tx_skb->skb = NULL; |
| 7229 | } | 7220 | } |
| @@ -7232,13 +7223,6 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp) | |||
| 7232 | } | 7223 | } |
| 7233 | 7224 | ||
| 7234 | if (tp->dirty_tx != dirty_tx) { | 7225 | if (tp->dirty_tx != dirty_tx) { |
| 7235 | netdev_completed_queue(tp->dev, pkts_compl, bytes_compl); | ||
| 7236 | |||
| 7237 | u64_stats_update_begin(&tp->tx_stats.syncp); | ||
| 7238 | tp->tx_stats.packets += pkts_compl; | ||
| 7239 | tp->tx_stats.bytes += bytes_compl; | ||
| 7240 | u64_stats_update_end(&tp->tx_stats.syncp); | ||
| 7241 | |||
| 7242 | tp->dirty_tx = dirty_tx; | 7226 | tp->dirty_tx = dirty_tx; |
| 7243 | /* Sync with rtl8169_start_xmit: | 7227 | /* Sync with rtl8169_start_xmit: |
| 7244 | * - publish dirty_tx ring index (write barrier) | 7228 | * - publish dirty_tx ring index (write barrier) |
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index 4da8bd263997..736d5d1624a1 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c | |||
| @@ -508,7 +508,6 @@ static struct sh_eth_cpu_data r8a779x_data = { | |||
| 508 | .tpauser = 1, | 508 | .tpauser = 1, |
| 509 | .hw_swap = 1, | 509 | .hw_swap = 1, |
| 510 | .rmiimode = 1, | 510 | .rmiimode = 1, |
| 511 | .shift_rd0 = 1, | ||
| 512 | }; | 511 | }; |
| 513 | 512 | ||
| 514 | static void sh_eth_set_rate_sh7724(struct net_device *ndev) | 513 | static void sh_eth_set_rate_sh7724(struct net_device *ndev) |
| @@ -1392,6 +1391,9 @@ static void sh_eth_dev_exit(struct net_device *ndev) | |||
| 1392 | msleep(2); /* max frame time at 10 Mbps < 1250 us */ | 1391 | msleep(2); /* max frame time at 10 Mbps < 1250 us */ |
| 1393 | sh_eth_get_stats(ndev); | 1392 | sh_eth_get_stats(ndev); |
| 1394 | sh_eth_reset(ndev); | 1393 | sh_eth_reset(ndev); |
| 1394 | |||
| 1395 | /* Set MAC address again */ | ||
| 1396 | update_mac_address(ndev); | ||
| 1395 | } | 1397 | } |
| 1396 | 1398 | ||
| 1397 | /* free Tx skb function */ | 1399 | /* free Tx skb function */ |
| @@ -1407,6 +1409,8 @@ static int sh_eth_txfree(struct net_device *ndev) | |||
| 1407 | txdesc = &mdp->tx_ring[entry]; | 1409 | txdesc = &mdp->tx_ring[entry]; |
| 1408 | if (txdesc->status & cpu_to_edmac(mdp, TD_TACT)) | 1410 | if (txdesc->status & cpu_to_edmac(mdp, TD_TACT)) |
| 1409 | break; | 1411 | break; |
| 1412 | /* TACT bit must be checked before all the following reads */ | ||
| 1413 | rmb(); | ||
| 1410 | /* Free the original skb. */ | 1414 | /* Free the original skb. */ |
| 1411 | if (mdp->tx_skbuff[entry]) { | 1415 | if (mdp->tx_skbuff[entry]) { |
| 1412 | dma_unmap_single(&ndev->dev, txdesc->addr, | 1416 | dma_unmap_single(&ndev->dev, txdesc->addr, |
| @@ -1444,6 +1448,8 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota) | |||
| 1444 | limit = boguscnt; | 1448 | limit = boguscnt; |
| 1445 | rxdesc = &mdp->rx_ring[entry]; | 1449 | rxdesc = &mdp->rx_ring[entry]; |
| 1446 | while (!(rxdesc->status & cpu_to_edmac(mdp, RD_RACT))) { | 1450 | while (!(rxdesc->status & cpu_to_edmac(mdp, RD_RACT))) { |
| 1451 | /* RACT bit must be checked before all the following reads */ | ||
| 1452 | rmb(); | ||
| 1447 | desc_status = edmac_to_cpu(mdp, rxdesc->status); | 1453 | desc_status = edmac_to_cpu(mdp, rxdesc->status); |
| 1448 | pkt_len = rxdesc->frame_length; | 1454 | pkt_len = rxdesc->frame_length; |
| 1449 | 1455 | ||
| @@ -1455,8 +1461,8 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota) | |||
| 1455 | 1461 | ||
| 1456 | /* In case of almost all GETHER/ETHERs, the Receive Frame State | 1462 | /* In case of almost all GETHER/ETHERs, the Receive Frame State |
| 1457 | * (RFS) bits in the Receive Descriptor 0 are from bit 9 to | 1463 | * (RFS) bits in the Receive Descriptor 0 are from bit 9 to |
| 1458 | * bit 0. However, in case of the R8A7740, R8A779x, and | 1464 | * bit 0. However, in case of the R8A7740 and R7S72100 |
| 1459 | * R7S72100 the RFS bits are from bit 25 to bit 16. So, the | 1465 | * the RFS bits are from bit 25 to bit 16. So, the |
| 1460 | * driver needs right shifting by 16. | 1466 | * driver needs right shifting by 16. |
| 1461 | */ | 1467 | */ |
| 1462 | if (mdp->cd->shift_rd0) | 1468 | if (mdp->cd->shift_rd0) |
| @@ -1523,6 +1529,7 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota) | |||
| 1523 | skb_checksum_none_assert(skb); | 1529 | skb_checksum_none_assert(skb); |
| 1524 | rxdesc->addr = dma_addr; | 1530 | rxdesc->addr = dma_addr; |
| 1525 | } | 1531 | } |
| 1532 | wmb(); /* RACT bit must be set after all the above writes */ | ||
| 1526 | if (entry >= mdp->num_rx_ring - 1) | 1533 | if (entry >= mdp->num_rx_ring - 1) |
| 1527 | rxdesc->status |= | 1534 | rxdesc->status |= |
| 1528 | cpu_to_edmac(mdp, RD_RACT | RD_RFP | RD_RDEL); | 1535 | cpu_to_edmac(mdp, RD_RACT | RD_RFP | RD_RDEL); |
| @@ -1535,7 +1542,7 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota) | |||
| 1535 | /* If we don't need to check status, don't. -KDU */ | 1542 | /* If we don't need to check status, don't. -KDU */ |
| 1536 | if (!(sh_eth_read(ndev, EDRRR) & EDRRR_R)) { | 1543 | if (!(sh_eth_read(ndev, EDRRR) & EDRRR_R)) { |
| 1537 | /* fix the values for the next receiving if RDE is set */ | 1544 | /* fix the values for the next receiving if RDE is set */ |
| 1538 | if (intr_status & EESR_RDE) { | 1545 | if (intr_status & EESR_RDE && mdp->reg_offset[RDFAR] != 0) { |
| 1539 | u32 count = (sh_eth_read(ndev, RDFAR) - | 1546 | u32 count = (sh_eth_read(ndev, RDFAR) - |
| 1540 | sh_eth_read(ndev, RDLAR)) >> 4; | 1547 | sh_eth_read(ndev, RDLAR)) >> 4; |
| 1541 | 1548 | ||
| @@ -2174,7 +2181,7 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
| 2174 | } | 2181 | } |
| 2175 | spin_unlock_irqrestore(&mdp->lock, flags); | 2182 | spin_unlock_irqrestore(&mdp->lock, flags); |
| 2176 | 2183 | ||
| 2177 | if (skb_padto(skb, ETH_ZLEN)) | 2184 | if (skb_put_padto(skb, ETH_ZLEN)) |
| 2178 | return NETDEV_TX_OK; | 2185 | return NETDEV_TX_OK; |
| 2179 | 2186 | ||
| 2180 | entry = mdp->cur_tx % mdp->num_tx_ring; | 2187 | entry = mdp->cur_tx % mdp->num_tx_ring; |
| @@ -2192,6 +2199,7 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
| 2192 | } | 2199 | } |
| 2193 | txdesc->buffer_length = skb->len; | 2200 | txdesc->buffer_length = skb->len; |
| 2194 | 2201 | ||
| 2202 | wmb(); /* TACT bit must be set after all the above writes */ | ||
| 2195 | if (entry >= mdp->num_tx_ring - 1) | 2203 | if (entry >= mdp->num_tx_ring - 1) |
| 2196 | txdesc->status |= cpu_to_edmac(mdp, TD_TACT | TD_TDLE); | 2204 | txdesc->status |= cpu_to_edmac(mdp, TD_TACT | TD_TDLE); |
| 2197 | else | 2205 | else |
diff --git a/drivers/net/ethernet/rocker/rocker.c b/drivers/net/ethernet/rocker/rocker.c index 34389b6aa67c..9fb6948e14c6 100644 --- a/drivers/net/ethernet/rocker/rocker.c +++ b/drivers/net/ethernet/rocker/rocker.c | |||
| @@ -1257,9 +1257,9 @@ static void rocker_port_set_enable(struct rocker_port *rocker_port, bool enable) | |||
| 1257 | u64 val = rocker_read64(rocker_port->rocker, PORT_PHYS_ENABLE); | 1257 | u64 val = rocker_read64(rocker_port->rocker, PORT_PHYS_ENABLE); |
| 1258 | 1258 | ||
| 1259 | if (enable) | 1259 | if (enable) |
| 1260 | val |= 1 << rocker_port->lport; | 1260 | val |= 1ULL << rocker_port->lport; |
| 1261 | else | 1261 | else |
| 1262 | val &= ~(1 << rocker_port->lport); | 1262 | val &= ~(1ULL << rocker_port->lport); |
| 1263 | rocker_write64(rocker_port->rocker, PORT_PHYS_ENABLE, val); | 1263 | rocker_write64(rocker_port->rocker, PORT_PHYS_ENABLE, val); |
| 1264 | } | 1264 | } |
| 1265 | 1265 | ||
| @@ -4201,6 +4201,8 @@ static int rocker_probe_ports(struct rocker *rocker) | |||
| 4201 | 4201 | ||
| 4202 | alloc_size = sizeof(struct rocker_port *) * rocker->port_count; | 4202 | alloc_size = sizeof(struct rocker_port *) * rocker->port_count; |
| 4203 | rocker->ports = kmalloc(alloc_size, GFP_KERNEL); | 4203 | rocker->ports = kmalloc(alloc_size, GFP_KERNEL); |
| 4204 | if (!rocker->ports) | ||
| 4205 | return -ENOMEM; | ||
| 4204 | for (i = 0; i < rocker->port_count; i++) { | 4206 | for (i = 0; i < rocker->port_count; i++) { |
| 4205 | err = rocker_probe_port(rocker, i); | 4207 | err = rocker_probe_port(rocker, i); |
| 4206 | if (err) | 4208 | if (err) |
diff --git a/drivers/net/ethernet/smsc/smc91c92_cs.c b/drivers/net/ethernet/smsc/smc91c92_cs.c index 6b33127ab352..3449893aea8d 100644 --- a/drivers/net/ethernet/smsc/smc91c92_cs.c +++ b/drivers/net/ethernet/smsc/smc91c92_cs.c | |||
| @@ -1070,11 +1070,8 @@ static int smc_open(struct net_device *dev) | |||
| 1070 | smc->packets_waiting = 0; | 1070 | smc->packets_waiting = 0; |
| 1071 | 1071 | ||
| 1072 | smc_reset(dev); | 1072 | smc_reset(dev); |
| 1073 | init_timer(&smc->media); | 1073 | setup_timer(&smc->media, media_check, (u_long)dev); |
| 1074 | smc->media.function = media_check; | 1074 | mod_timer(&smc->media, jiffies + HZ); |
| 1075 | smc->media.data = (u_long) dev; | ||
| 1076 | smc->media.expires = jiffies + HZ; | ||
| 1077 | add_timer(&smc->media); | ||
| 1078 | 1075 | ||
| 1079 | return 0; | 1076 | return 0; |
| 1080 | } /* smc_open */ | 1077 | } /* smc_open */ |
diff --git a/drivers/net/ethernet/smsc/smc91x.c b/drivers/net/ethernet/smsc/smc91x.c index 88a55f95fe09..8678e39aba08 100644 --- a/drivers/net/ethernet/smsc/smc91x.c +++ b/drivers/net/ethernet/smsc/smc91x.c | |||
| @@ -91,6 +91,11 @@ static const char version[] = | |||
| 91 | 91 | ||
| 92 | #include "smc91x.h" | 92 | #include "smc91x.h" |
| 93 | 93 | ||
| 94 | #if defined(CONFIG_ASSABET_NEPONSET) | ||
| 95 | #include <mach/assabet.h> | ||
| 96 | #include <mach/neponset.h> | ||
| 97 | #endif | ||
| 98 | |||
| 94 | #ifndef SMC_NOWAIT | 99 | #ifndef SMC_NOWAIT |
| 95 | # define SMC_NOWAIT 0 | 100 | # define SMC_NOWAIT 0 |
| 96 | #endif | 101 | #endif |
| @@ -2243,10 +2248,9 @@ static int smc_drv_probe(struct platform_device *pdev) | |||
| 2243 | const struct of_device_id *match = NULL; | 2248 | const struct of_device_id *match = NULL; |
| 2244 | struct smc_local *lp; | 2249 | struct smc_local *lp; |
| 2245 | struct net_device *ndev; | 2250 | struct net_device *ndev; |
| 2246 | struct resource *res; | 2251 | struct resource *res, *ires; |
| 2247 | unsigned int __iomem *addr; | 2252 | unsigned int __iomem *addr; |
| 2248 | unsigned long irq_flags = SMC_IRQ_FLAGS; | 2253 | unsigned long irq_flags = SMC_IRQ_FLAGS; |
| 2249 | unsigned long irq_resflags; | ||
| 2250 | int ret; | 2254 | int ret; |
| 2251 | 2255 | ||
| 2252 | ndev = alloc_etherdev(sizeof(struct smc_local)); | 2256 | ndev = alloc_etherdev(sizeof(struct smc_local)); |
| @@ -2338,25 +2342,23 @@ static int smc_drv_probe(struct platform_device *pdev) | |||
| 2338 | goto out_free_netdev; | 2342 | goto out_free_netdev; |
| 2339 | } | 2343 | } |
| 2340 | 2344 | ||
| 2341 | ndev->irq = platform_get_irq(pdev, 0); | 2345 | ires = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
| 2342 | if (ndev->irq <= 0) { | 2346 | if (!ires) { |
| 2343 | ret = -ENODEV; | 2347 | ret = -ENODEV; |
| 2344 | goto out_release_io; | 2348 | goto out_release_io; |
| 2345 | } | 2349 | } |
| 2346 | /* | 2350 | |
| 2347 | * If this platform does not specify any special irqflags, or if | 2351 | ndev->irq = ires->start; |
| 2348 | * the resource supplies a trigger, override the irqflags with | 2352 | |
| 2349 | * the trigger flags from the resource. | 2353 | if (irq_flags == -1 || ires->flags & IRQF_TRIGGER_MASK) |
| 2350 | */ | 2354 | irq_flags = ires->flags & IRQF_TRIGGER_MASK; |
| 2351 | irq_resflags = irqd_get_trigger_type(irq_get_irq_data(ndev->irq)); | ||
| 2352 | if (irq_flags == -1 || irq_resflags & IRQF_TRIGGER_MASK) | ||
| 2353 | irq_flags = irq_resflags & IRQF_TRIGGER_MASK; | ||
| 2354 | 2355 | ||
| 2355 | ret = smc_request_attrib(pdev, ndev); | 2356 | ret = smc_request_attrib(pdev, ndev); |
| 2356 | if (ret) | 2357 | if (ret) |
| 2357 | goto out_release_io; | 2358 | goto out_release_io; |
| 2358 | #if defined(CONFIG_SA1100_ASSABET) | 2359 | #if defined(CONFIG_ASSABET_NEPONSET) |
| 2359 | neponset_ncr_set(NCR_ENET_OSC_EN); | 2360 | if (machine_is_assabet() && machine_has_neponset()) |
| 2361 | neponset_ncr_set(NCR_ENET_OSC_EN); | ||
| 2360 | #endif | 2362 | #endif |
| 2361 | platform_set_drvdata(pdev, ndev); | 2363 | platform_set_drvdata(pdev, ndev); |
| 2362 | ret = smc_enable_device(pdev); | 2364 | ret = smc_enable_device(pdev); |
diff --git a/drivers/net/ethernet/smsc/smc91x.h b/drivers/net/ethernet/smsc/smc91x.h index be67baf5f677..3a18501d1068 100644 --- a/drivers/net/ethernet/smsc/smc91x.h +++ b/drivers/net/ethernet/smsc/smc91x.h | |||
| @@ -39,14 +39,7 @@ | |||
| 39 | * Define your architecture specific bus configuration parameters here. | 39 | * Define your architecture specific bus configuration parameters here. |
| 40 | */ | 40 | */ |
| 41 | 41 | ||
| 42 | #if defined(CONFIG_ARCH_LUBBOCK) ||\ | 42 | #if defined(CONFIG_ARM) |
| 43 | defined(CONFIG_MACH_MAINSTONE) ||\ | ||
| 44 | defined(CONFIG_MACH_ZYLONITE) ||\ | ||
| 45 | defined(CONFIG_MACH_LITTLETON) ||\ | ||
| 46 | defined(CONFIG_MACH_ZYLONITE2) ||\ | ||
| 47 | defined(CONFIG_ARCH_VIPER) ||\ | ||
| 48 | defined(CONFIG_MACH_STARGATE2) ||\ | ||
| 49 | defined(CONFIG_ARCH_VERSATILE) | ||
| 50 | 43 | ||
| 51 | #include <asm/mach-types.h> | 44 | #include <asm/mach-types.h> |
| 52 | 45 | ||
| @@ -74,95 +67,8 @@ | |||
| 74 | /* We actually can't write halfwords properly if not word aligned */ | 67 | /* We actually can't write halfwords properly if not word aligned */ |
| 75 | static inline void SMC_outw(u16 val, void __iomem *ioaddr, int reg) | 68 | static inline void SMC_outw(u16 val, void __iomem *ioaddr, int reg) |
| 76 | { | 69 | { |
| 77 | if ((machine_is_mainstone() || machine_is_stargate2()) && reg & 2) { | 70 | if ((machine_is_mainstone() || machine_is_stargate2() || |
| 78 | unsigned int v = val << 16; | 71 | machine_is_pxa_idp()) && reg & 2) { |
| 79 | v |= readl(ioaddr + (reg & ~2)) & 0xffff; | ||
| 80 | writel(v, ioaddr + (reg & ~2)); | ||
| 81 | } else { | ||
| 82 | writew(val, ioaddr + reg); | ||
| 83 | } | ||
| 84 | } | ||
| 85 | |||
| 86 | #elif defined(CONFIG_SA1100_PLEB) | ||
| 87 | /* We can only do 16-bit reads and writes in the static memory space. */ | ||
| 88 | #define SMC_CAN_USE_8BIT 1 | ||
| 89 | #define SMC_CAN_USE_16BIT 1 | ||
| 90 | #define SMC_CAN_USE_32BIT 0 | ||
| 91 | #define SMC_IO_SHIFT 0 | ||
| 92 | #define SMC_NOWAIT 1 | ||
| 93 | |||
| 94 | #define SMC_inb(a, r) readb((a) + (r)) | ||
| 95 | #define SMC_insb(a, r, p, l) readsb((a) + (r), p, (l)) | ||
| 96 | #define SMC_inw(a, r) readw((a) + (r)) | ||
| 97 | #define SMC_insw(a, r, p, l) readsw((a) + (r), p, l) | ||
| 98 | #define SMC_outb(v, a, r) writeb(v, (a) + (r)) | ||
| 99 | #define SMC_outsb(a, r, p, l) writesb((a) + (r), p, (l)) | ||
| 100 | #define SMC_outw(v, a, r) writew(v, (a) + (r)) | ||
| 101 | #define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l) | ||
| 102 | |||
| 103 | #define SMC_IRQ_FLAGS (-1) | ||
| 104 | |||
| 105 | #elif defined(CONFIG_SA1100_ASSABET) | ||
| 106 | |||
| 107 | #include <mach/neponset.h> | ||
| 108 | |||
| 109 | /* We can only do 8-bit reads and writes in the static memory space. */ | ||
| 110 | #define SMC_CAN_USE_8BIT 1 | ||
| 111 | #define SMC_CAN_USE_16BIT 0 | ||
| 112 | #define SMC_CAN_USE_32BIT 0 | ||
| 113 | #define SMC_NOWAIT 1 | ||
| 114 | |||
| 115 | /* The first two address lines aren't connected... */ | ||
| 116 | #define SMC_IO_SHIFT 2 | ||
| 117 | |||
| 118 | #define SMC_inb(a, r) readb((a) + (r)) | ||
| 119 | #define SMC_outb(v, a, r) writeb(v, (a) + (r)) | ||
| 120 | #define SMC_insb(a, r, p, l) readsb((a) + (r), p, (l)) | ||
| 121 | #define SMC_outsb(a, r, p, l) writesb((a) + (r), p, (l)) | ||
| 122 | #define SMC_IRQ_FLAGS (-1) /* from resource */ | ||
| 123 | |||
| 124 | #elif defined(CONFIG_MACH_LOGICPD_PXA270) || \ | ||
| 125 | defined(CONFIG_MACH_NOMADIK_8815NHK) | ||
| 126 | |||
| 127 | #define SMC_CAN_USE_8BIT 0 | ||
| 128 | #define SMC_CAN_USE_16BIT 1 | ||
| 129 | #define SMC_CAN_USE_32BIT 0 | ||
| 130 | #define SMC_IO_SHIFT 0 | ||
| 131 | #define SMC_NOWAIT 1 | ||
| 132 | |||
| 133 | #define SMC_inw(a, r) readw((a) + (r)) | ||
| 134 | #define SMC_outw(v, a, r) writew(v, (a) + (r)) | ||
| 135 | #define SMC_insw(a, r, p, l) readsw((a) + (r), p, l) | ||
| 136 | #define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l) | ||
| 137 | |||
| 138 | #elif defined(CONFIG_ARCH_INNOKOM) || \ | ||
| 139 | defined(CONFIG_ARCH_PXA_IDP) || \ | ||
| 140 | defined(CONFIG_ARCH_RAMSES) || \ | ||
| 141 | defined(CONFIG_ARCH_PCM027) | ||
| 142 | |||
| 143 | #define SMC_CAN_USE_8BIT 1 | ||
| 144 | #define SMC_CAN_USE_16BIT 1 | ||
| 145 | #define SMC_CAN_USE_32BIT 1 | ||
| 146 | #define SMC_IO_SHIFT 0 | ||
| 147 | #define SMC_NOWAIT 1 | ||
| 148 | #define SMC_USE_PXA_DMA 1 | ||
| 149 | |||
| 150 | #define SMC_inb(a, r) readb((a) + (r)) | ||
| 151 | #define SMC_inw(a, r) readw((a) + (r)) | ||
| 152 | #define SMC_inl(a, r) readl((a) + (r)) | ||
| 153 | #define SMC_outb(v, a, r) writeb(v, (a) + (r)) | ||
| 154 | #define SMC_outl(v, a, r) writel(v, (a) + (r)) | ||
| 155 | #define SMC_insl(a, r, p, l) readsl((a) + (r), p, l) | ||
| 156 | #define SMC_outsl(a, r, p, l) writesl((a) + (r), p, l) | ||
| 157 | #define SMC_insw(a, r, p, l) readsw((a) + (r), p, l) | ||
| 158 | #define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l) | ||
| 159 | #define SMC_IRQ_FLAGS (-1) /* from resource */ | ||
| 160 | |||
| 161 | /* We actually can't write halfwords properly if not word aligned */ | ||
| 162 | static inline void | ||
| 163 | SMC_outw(u16 val, void __iomem *ioaddr, int reg) | ||
| 164 | { | ||
| 165 | if (reg & 2) { | ||
| 166 | unsigned int v = val << 16; | 72 | unsigned int v = val << 16; |
| 167 | v |= readl(ioaddr + (reg & ~2)) & 0xffff; | 73 | v |= readl(ioaddr + (reg & ~2)) & 0xffff; |
| 168 | writel(v, ioaddr + (reg & ~2)); | 74 | writel(v, ioaddr + (reg & ~2)); |
| @@ -237,20 +143,6 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg) | |||
| 237 | #define RPC_LSA_DEFAULT RPC_LED_100_10 | 143 | #define RPC_LSA_DEFAULT RPC_LED_100_10 |
| 238 | #define RPC_LSB_DEFAULT RPC_LED_TX_RX | 144 | #define RPC_LSB_DEFAULT RPC_LED_TX_RX |
| 239 | 145 | ||
| 240 | #elif defined(CONFIG_ARCH_MSM) | ||
| 241 | |||
| 242 | #define SMC_CAN_USE_8BIT 0 | ||
| 243 | #define SMC_CAN_USE_16BIT 1 | ||
| 244 | #define SMC_CAN_USE_32BIT 0 | ||
| 245 | #define SMC_NOWAIT 1 | ||
| 246 | |||
| 247 | #define SMC_inw(a, r) readw((a) + (r)) | ||
| 248 | #define SMC_outw(v, a, r) writew(v, (a) + (r)) | ||
| 249 | #define SMC_insw(a, r, p, l) readsw((a) + (r), p, l) | ||
| 250 | #define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l) | ||
| 251 | |||
| 252 | #define SMC_IRQ_FLAGS IRQF_TRIGGER_HIGH | ||
| 253 | |||
| 254 | #elif defined(CONFIG_COLDFIRE) | 146 | #elif defined(CONFIG_COLDFIRE) |
| 255 | 147 | ||
| 256 | #define SMC_CAN_USE_8BIT 0 | 148 | #define SMC_CAN_USE_8BIT 0 |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 55e89b3838f1..a0ea84fe6519 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
| @@ -310,11 +310,11 @@ bool stmmac_eee_init(struct stmmac_priv *priv) | |||
| 310 | spin_lock_irqsave(&priv->lock, flags); | 310 | spin_lock_irqsave(&priv->lock, flags); |
| 311 | if (!priv->eee_active) { | 311 | if (!priv->eee_active) { |
| 312 | priv->eee_active = 1; | 312 | priv->eee_active = 1; |
| 313 | init_timer(&priv->eee_ctrl_timer); | 313 | setup_timer(&priv->eee_ctrl_timer, |
| 314 | priv->eee_ctrl_timer.function = stmmac_eee_ctrl_timer; | 314 | stmmac_eee_ctrl_timer, |
| 315 | priv->eee_ctrl_timer.data = (unsigned long)priv; | 315 | (unsigned long)priv); |
| 316 | priv->eee_ctrl_timer.expires = STMMAC_LPI_T(eee_timer); | 316 | mod_timer(&priv->eee_ctrl_timer, |
| 317 | add_timer(&priv->eee_ctrl_timer); | 317 | STMMAC_LPI_T(eee_timer)); |
| 318 | 318 | ||
| 319 | priv->hw->mac->set_eee_timer(priv->hw, | 319 | priv->hw->mac->set_eee_timer(priv->hw, |
| 320 | STMMAC_DEFAULT_LIT_LS, | 320 | STMMAC_DEFAULT_LIT_LS, |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index fb846ebba1d9..f9b42f11950f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | |||
| @@ -272,6 +272,37 @@ static int stmmac_pltfr_probe(struct platform_device *pdev) | |||
| 272 | struct stmmac_priv *priv = NULL; | 272 | struct stmmac_priv *priv = NULL; |
| 273 | struct plat_stmmacenet_data *plat_dat = NULL; | 273 | struct plat_stmmacenet_data *plat_dat = NULL; |
| 274 | const char *mac = NULL; | 274 | const char *mac = NULL; |
| 275 | int irq, wol_irq, lpi_irq; | ||
| 276 | |||
| 277 | /* Get IRQ information early to have an ability to ask for deferred | ||
| 278 | * probe if needed before we went too far with resource allocation. | ||
| 279 | */ | ||
| 280 | irq = platform_get_irq_byname(pdev, "macirq"); | ||
| 281 | if (irq < 0) { | ||
| 282 | if (irq != -EPROBE_DEFER) { | ||
| 283 | dev_err(dev, | ||
| 284 | "MAC IRQ configuration information not found\n"); | ||
| 285 | } | ||
| 286 | return irq; | ||
| 287 | } | ||
| 288 | |||
| 289 | /* On some platforms e.g. SPEAr the wake up irq differs from the mac irq | ||
| 290 | * The external wake up irq can be passed through the platform code | ||
| 291 | * named as "eth_wake_irq" | ||
| 292 | * | ||
| 293 | * In case the wake up interrupt is not passed from the platform | ||
| 294 | * so the driver will continue to use the mac irq (ndev->irq) | ||
| 295 | */ | ||
| 296 | wol_irq = platform_get_irq_byname(pdev, "eth_wake_irq"); | ||
| 297 | if (wol_irq < 0) { | ||
| 298 | if (wol_irq == -EPROBE_DEFER) | ||
| 299 | return -EPROBE_DEFER; | ||
| 300 | wol_irq = irq; | ||
| 301 | } | ||
| 302 | |||
| 303 | lpi_irq = platform_get_irq_byname(pdev, "eth_lpi"); | ||
| 304 | if (lpi_irq == -EPROBE_DEFER) | ||
| 305 | return -EPROBE_DEFER; | ||
| 275 | 306 | ||
| 276 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 307 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 277 | addr = devm_ioremap_resource(dev, res); | 308 | addr = devm_ioremap_resource(dev, res); |
| @@ -323,39 +354,15 @@ static int stmmac_pltfr_probe(struct platform_device *pdev) | |||
| 323 | return PTR_ERR(priv); | 354 | return PTR_ERR(priv); |
| 324 | } | 355 | } |
| 325 | 356 | ||
| 357 | /* Copy IRQ values to priv structure which is now avaialble */ | ||
| 358 | priv->dev->irq = irq; | ||
| 359 | priv->wol_irq = wol_irq; | ||
| 360 | priv->lpi_irq = lpi_irq; | ||
| 361 | |||
| 326 | /* Get MAC address if available (DT) */ | 362 | /* Get MAC address if available (DT) */ |
| 327 | if (mac) | 363 | if (mac) |
| 328 | memcpy(priv->dev->dev_addr, mac, ETH_ALEN); | 364 | memcpy(priv->dev->dev_addr, mac, ETH_ALEN); |
| 329 | 365 | ||
| 330 | /* Get the MAC information */ | ||
| 331 | priv->dev->irq = platform_get_irq_byname(pdev, "macirq"); | ||
| 332 | if (priv->dev->irq < 0) { | ||
| 333 | if (priv->dev->irq != -EPROBE_DEFER) { | ||
| 334 | netdev_err(priv->dev, | ||
| 335 | "MAC IRQ configuration information not found\n"); | ||
| 336 | } | ||
| 337 | return priv->dev->irq; | ||
| 338 | } | ||
| 339 | |||
| 340 | /* | ||
| 341 | * On some platforms e.g. SPEAr the wake up irq differs from the mac irq | ||
| 342 | * The external wake up irq can be passed through the platform code | ||
| 343 | * named as "eth_wake_irq" | ||
| 344 | * | ||
| 345 | * In case the wake up interrupt is not passed from the platform | ||
| 346 | * so the driver will continue to use the mac irq (ndev->irq) | ||
| 347 | */ | ||
| 348 | priv->wol_irq = platform_get_irq_byname(pdev, "eth_wake_irq"); | ||
| 349 | if (priv->wol_irq < 0) { | ||
| 350 | if (priv->wol_irq == -EPROBE_DEFER) | ||
| 351 | return -EPROBE_DEFER; | ||
| 352 | priv->wol_irq = priv->dev->irq; | ||
| 353 | } | ||
| 354 | |||
| 355 | priv->lpi_irq = platform_get_irq_byname(pdev, "eth_lpi"); | ||
| 356 | if (priv->lpi_irq == -EPROBE_DEFER) | ||
| 357 | return -EPROBE_DEFER; | ||
| 358 | |||
| 359 | platform_set_drvdata(pdev, priv->dev); | 366 | platform_set_drvdata(pdev, priv->dev); |
| 360 | 367 | ||
| 361 | pr_debug("STMMAC platform driver registration completed"); | 368 | pr_debug("STMMAC platform driver registration completed"); |
diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c index 4b51f903fb73..0c5842aeb807 100644 --- a/drivers/net/ethernet/sun/niu.c +++ b/drivers/net/ethernet/sun/niu.c | |||
| @@ -6989,10 +6989,10 @@ static int niu_class_to_ethflow(u64 class, int *flow_type) | |||
| 6989 | *flow_type = IP_USER_FLOW; | 6989 | *flow_type = IP_USER_FLOW; |
| 6990 | break; | 6990 | break; |
| 6991 | default: | 6991 | default: |
| 6992 | return 0; | 6992 | return -EINVAL; |
| 6993 | } | 6993 | } |
| 6994 | 6994 | ||
| 6995 | return 1; | 6995 | return 0; |
| 6996 | } | 6996 | } |
| 6997 | 6997 | ||
| 6998 | static int niu_ethflow_to_class(int flow_type, u64 *class) | 6998 | static int niu_ethflow_to_class(int flow_type, u64 *class) |
| @@ -7198,11 +7198,9 @@ static int niu_get_ethtool_tcam_entry(struct niu *np, | |||
| 7198 | class = (tp->key[0] & TCAM_V4KEY0_CLASS_CODE) >> | 7198 | class = (tp->key[0] & TCAM_V4KEY0_CLASS_CODE) >> |
| 7199 | TCAM_V4KEY0_CLASS_CODE_SHIFT; | 7199 | TCAM_V4KEY0_CLASS_CODE_SHIFT; |
| 7200 | ret = niu_class_to_ethflow(class, &fsp->flow_type); | 7200 | ret = niu_class_to_ethflow(class, &fsp->flow_type); |
| 7201 | |||
| 7202 | if (ret < 0) { | 7201 | if (ret < 0) { |
| 7203 | netdev_info(np->dev, "niu%d: niu_class_to_ethflow failed\n", | 7202 | netdev_info(np->dev, "niu%d: niu_class_to_ethflow failed\n", |
| 7204 | parent->index); | 7203 | parent->index); |
| 7205 | ret = -EINVAL; | ||
| 7206 | goto out; | 7204 | goto out; |
| 7207 | } | 7205 | } |
| 7208 | 7206 | ||
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 7d8dd0d2182e..a1bbaf6352ba 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
| @@ -1103,7 +1103,7 @@ static inline void cpsw_add_dual_emac_def_ale_entries( | |||
| 1103 | cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast, | 1103 | cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast, |
| 1104 | port_mask, ALE_VLAN, slave->port_vlan, 0); | 1104 | port_mask, ALE_VLAN, slave->port_vlan, 0); |
| 1105 | cpsw_ale_add_ucast(priv->ale, priv->mac_addr, | 1105 | cpsw_ale_add_ucast(priv->ale, priv->mac_addr, |
| 1106 | priv->host_port, ALE_VLAN, slave->port_vlan); | 1106 | priv->host_port, ALE_VLAN | ALE_SECURE, slave->port_vlan); |
| 1107 | } | 1107 | } |
| 1108 | 1108 | ||
| 1109 | static void soft_reset_slave(struct cpsw_slave *slave) | 1109 | static void soft_reset_slave(struct cpsw_slave *slave) |
| @@ -2466,6 +2466,7 @@ static int cpsw_remove(struct platform_device *pdev) | |||
| 2466 | return 0; | 2466 | return 0; |
| 2467 | } | 2467 | } |
| 2468 | 2468 | ||
| 2469 | #ifdef CONFIG_PM_SLEEP | ||
| 2469 | static int cpsw_suspend(struct device *dev) | 2470 | static int cpsw_suspend(struct device *dev) |
| 2470 | { | 2471 | { |
| 2471 | struct platform_device *pdev = to_platform_device(dev); | 2472 | struct platform_device *pdev = to_platform_device(dev); |
| @@ -2518,11 +2519,9 @@ static int cpsw_resume(struct device *dev) | |||
| 2518 | } | 2519 | } |
| 2519 | return 0; | 2520 | return 0; |
| 2520 | } | 2521 | } |
| 2522 | #endif | ||
| 2521 | 2523 | ||
| 2522 | static const struct dev_pm_ops cpsw_pm_ops = { | 2524 | static SIMPLE_DEV_PM_OPS(cpsw_pm_ops, cpsw_suspend, cpsw_resume); |
| 2523 | .suspend = cpsw_suspend, | ||
| 2524 | .resume = cpsw_resume, | ||
| 2525 | }; | ||
| 2526 | 2525 | ||
| 2527 | static const struct of_device_id cpsw_of_mtable[] = { | 2526 | static const struct of_device_id cpsw_of_mtable[] = { |
| 2528 | { .compatible = "ti,cpsw", }, | 2527 | { .compatible = "ti,cpsw", }, |
diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c index 98655b44b97e..c00084d689f3 100644 --- a/drivers/net/ethernet/ti/davinci_mdio.c +++ b/drivers/net/ethernet/ti/davinci_mdio.c | |||
| @@ -423,6 +423,7 @@ static int davinci_mdio_remove(struct platform_device *pdev) | |||
| 423 | return 0; | 423 | return 0; |
| 424 | } | 424 | } |
| 425 | 425 | ||
| 426 | #ifdef CONFIG_PM_SLEEP | ||
| 426 | static int davinci_mdio_suspend(struct device *dev) | 427 | static int davinci_mdio_suspend(struct device *dev) |
| 427 | { | 428 | { |
| 428 | struct davinci_mdio_data *data = dev_get_drvdata(dev); | 429 | struct davinci_mdio_data *data = dev_get_drvdata(dev); |
| @@ -464,10 +465,10 @@ static int davinci_mdio_resume(struct device *dev) | |||
| 464 | 465 | ||
| 465 | return 0; | 466 | return 0; |
| 466 | } | 467 | } |
| 468 | #endif | ||
| 467 | 469 | ||
| 468 | static const struct dev_pm_ops davinci_mdio_pm_ops = { | 470 | static const struct dev_pm_ops davinci_mdio_pm_ops = { |
| 469 | .suspend_late = davinci_mdio_suspend, | 471 | SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume) |
| 470 | .resume_early = davinci_mdio_resume, | ||
| 471 | }; | 472 | }; |
| 472 | 473 | ||
| 473 | #if IS_ENABLED(CONFIG_OF) | 474 | #if IS_ENABLED(CONFIG_OF) |
diff --git a/drivers/net/ethernet/wiznet/w5100.c b/drivers/net/ethernet/wiznet/w5100.c index a495931a66a1..0e0fbb5842b3 100644 --- a/drivers/net/ethernet/wiznet/w5100.c +++ b/drivers/net/ethernet/wiznet/w5100.c | |||
| @@ -498,9 +498,9 @@ static int w5100_napi_poll(struct napi_struct *napi, int budget) | |||
| 498 | } | 498 | } |
| 499 | 499 | ||
| 500 | if (rx_count < budget) { | 500 | if (rx_count < budget) { |
| 501 | napi_complete(napi); | ||
| 501 | w5100_write(priv, W5100_IMR, IR_S0); | 502 | w5100_write(priv, W5100_IMR, IR_S0); |
| 502 | mmiowb(); | 503 | mmiowb(); |
| 503 | napi_complete(napi); | ||
| 504 | } | 504 | } |
| 505 | 505 | ||
| 506 | return rx_count; | 506 | return rx_count; |
diff --git a/drivers/net/ethernet/wiznet/w5300.c b/drivers/net/ethernet/wiznet/w5300.c index 09322d9db578..4b310002258d 100644 --- a/drivers/net/ethernet/wiznet/w5300.c +++ b/drivers/net/ethernet/wiznet/w5300.c | |||
| @@ -418,9 +418,9 @@ static int w5300_napi_poll(struct napi_struct *napi, int budget) | |||
| 418 | } | 418 | } |
| 419 | 419 | ||
| 420 | if (rx_count < budget) { | 420 | if (rx_count < budget) { |
| 421 | napi_complete(napi); | ||
| 421 | w5300_write(priv, W5300_IMR, IR_S0); | 422 | w5300_write(priv, W5300_IMR, IR_S0); |
| 422 | mmiowb(); | 423 | mmiowb(); |
| 423 | napi_complete(napi); | ||
| 424 | } | 424 | } |
| 425 | 425 | ||
| 426 | return rx_count; | 426 | return rx_count; |
diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c index f7e0f0f7c2e2..9e16a2819d48 100644 --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c | |||
| @@ -938,7 +938,7 @@ static void eth_set_mcast_list(struct net_device *dev) | |||
| 938 | int i; | 938 | int i; |
| 939 | static const u8 allmulti[] = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 }; | 939 | static const u8 allmulti[] = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 }; |
| 940 | 940 | ||
| 941 | if (dev->flags & IFF_ALLMULTI) { | 941 | if ((dev->flags & IFF_ALLMULTI) && !(dev->flags & IFF_PROMISC)) { |
| 942 | for (i = 0; i < ETH_ALEN; i++) { | 942 | for (i = 0; i < ETH_ALEN; i++) { |
| 943 | __raw_writel(allmulti[i], &port->regs->mcast_addr[i]); | 943 | __raw_writel(allmulti[i], &port->regs->mcast_addr[i]); |
| 944 | __raw_writel(allmulti[i], &port->regs->mcast_mask[i]); | 944 | __raw_writel(allmulti[i], &port->regs->mcast_mask[i]); |
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index e40fdfccc9c1..27ecc5c4fa26 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c | |||
| @@ -654,11 +654,14 @@ static void macvtap_skb_to_vnet_hdr(struct macvtap_queue *q, | |||
| 654 | } /* else everything is zero */ | 654 | } /* else everything is zero */ |
| 655 | } | 655 | } |
| 656 | 656 | ||
| 657 | /* Neighbour code has some assumptions on HH_DATA_MOD alignment */ | ||
| 658 | #define MACVTAP_RESERVE HH_DATA_OFF(ETH_HLEN) | ||
| 659 | |||
| 657 | /* Get packet from user space buffer */ | 660 | /* Get packet from user space buffer */ |
| 658 | static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, | 661 | static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, |
| 659 | struct iov_iter *from, int noblock) | 662 | struct iov_iter *from, int noblock) |
| 660 | { | 663 | { |
| 661 | int good_linear = SKB_MAX_HEAD(NET_IP_ALIGN); | 664 | int good_linear = SKB_MAX_HEAD(MACVTAP_RESERVE); |
| 662 | struct sk_buff *skb; | 665 | struct sk_buff *skb; |
| 663 | struct macvlan_dev *vlan; | 666 | struct macvlan_dev *vlan; |
| 664 | unsigned long total_len = iov_iter_count(from); | 667 | unsigned long total_len = iov_iter_count(from); |
| @@ -722,7 +725,7 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, | |||
| 722 | linear = macvtap16_to_cpu(q, vnet_hdr.hdr_len); | 725 | linear = macvtap16_to_cpu(q, vnet_hdr.hdr_len); |
| 723 | } | 726 | } |
| 724 | 727 | ||
| 725 | skb = macvtap_alloc_skb(&q->sk, NET_IP_ALIGN, copylen, | 728 | skb = macvtap_alloc_skb(&q->sk, MACVTAP_RESERVE, copylen, |
| 726 | linear, noblock, &err); | 729 | linear, noblock, &err); |
| 727 | if (!skb) | 730 | if (!skb) |
| 728 | goto err; | 731 | goto err; |
diff --git a/drivers/net/phy/amd-xgbe-phy.c b/drivers/net/phy/amd-xgbe-phy.c index 9e3af54c9010..32efbd48f326 100644 --- a/drivers/net/phy/amd-xgbe-phy.c +++ b/drivers/net/phy/amd-xgbe-phy.c | |||
| @@ -92,6 +92,8 @@ MODULE_DESCRIPTION("AMD 10GbE (amd-xgbe) PHY driver"); | |||
| 92 | #define XGBE_PHY_CDR_RATE_PROPERTY "amd,serdes-cdr-rate" | 92 | #define XGBE_PHY_CDR_RATE_PROPERTY "amd,serdes-cdr-rate" |
| 93 | #define XGBE_PHY_PQ_SKEW_PROPERTY "amd,serdes-pq-skew" | 93 | #define XGBE_PHY_PQ_SKEW_PROPERTY "amd,serdes-pq-skew" |
| 94 | #define XGBE_PHY_TX_AMP_PROPERTY "amd,serdes-tx-amp" | 94 | #define XGBE_PHY_TX_AMP_PROPERTY "amd,serdes-tx-amp" |
| 95 | #define XGBE_PHY_DFE_CFG_PROPERTY "amd,serdes-dfe-tap-config" | ||
| 96 | #define XGBE_PHY_DFE_ENA_PROPERTY "amd,serdes-dfe-tap-enable" | ||
| 95 | 97 | ||
| 96 | #define XGBE_PHY_SPEEDS 3 | 98 | #define XGBE_PHY_SPEEDS 3 |
| 97 | #define XGBE_PHY_SPEED_1000 0 | 99 | #define XGBE_PHY_SPEED_1000 0 |
| @@ -177,10 +179,12 @@ MODULE_DESCRIPTION("AMD 10GbE (amd-xgbe) PHY driver"); | |||
| 177 | #define SPEED_10000_BLWC 0 | 179 | #define SPEED_10000_BLWC 0 |
| 178 | #define SPEED_10000_CDR 0x7 | 180 | #define SPEED_10000_CDR 0x7 |
| 179 | #define SPEED_10000_PLL 0x1 | 181 | #define SPEED_10000_PLL 0x1 |
| 180 | #define SPEED_10000_PQ 0x1e | 182 | #define SPEED_10000_PQ 0x12 |
| 181 | #define SPEED_10000_RATE 0x0 | 183 | #define SPEED_10000_RATE 0x0 |
| 182 | #define SPEED_10000_TXAMP 0xa | 184 | #define SPEED_10000_TXAMP 0xa |
| 183 | #define SPEED_10000_WORD 0x7 | 185 | #define SPEED_10000_WORD 0x7 |
| 186 | #define SPEED_10000_DFE_TAP_CONFIG 0x1 | ||
| 187 | #define SPEED_10000_DFE_TAP_ENABLE 0x7f | ||
| 184 | 188 | ||
| 185 | #define SPEED_2500_BLWC 1 | 189 | #define SPEED_2500_BLWC 1 |
| 186 | #define SPEED_2500_CDR 0x2 | 190 | #define SPEED_2500_CDR 0x2 |
| @@ -189,6 +193,8 @@ MODULE_DESCRIPTION("AMD 10GbE (amd-xgbe) PHY driver"); | |||
| 189 | #define SPEED_2500_RATE 0x1 | 193 | #define SPEED_2500_RATE 0x1 |
| 190 | #define SPEED_2500_TXAMP 0xf | 194 | #define SPEED_2500_TXAMP 0xf |
| 191 | #define SPEED_2500_WORD 0x1 | 195 | #define SPEED_2500_WORD 0x1 |
| 196 | #define SPEED_2500_DFE_TAP_CONFIG 0x3 | ||
| 197 | #define SPEED_2500_DFE_TAP_ENABLE 0x0 | ||
| 192 | 198 | ||
| 193 | #define SPEED_1000_BLWC 1 | 199 | #define SPEED_1000_BLWC 1 |
| 194 | #define SPEED_1000_CDR 0x2 | 200 | #define SPEED_1000_CDR 0x2 |
| @@ -197,16 +203,25 @@ MODULE_DESCRIPTION("AMD 10GbE (amd-xgbe) PHY driver"); | |||
| 197 | #define SPEED_1000_RATE 0x3 | 203 | #define SPEED_1000_RATE 0x3 |
| 198 | #define SPEED_1000_TXAMP 0xf | 204 | #define SPEED_1000_TXAMP 0xf |
| 199 | #define SPEED_1000_WORD 0x1 | 205 | #define SPEED_1000_WORD 0x1 |
| 206 | #define SPEED_1000_DFE_TAP_CONFIG 0x3 | ||
| 207 | #define SPEED_1000_DFE_TAP_ENABLE 0x0 | ||
| 200 | 208 | ||
| 201 | /* SerDes RxTx register offsets */ | 209 | /* SerDes RxTx register offsets */ |
| 210 | #define RXTX_REG6 0x0018 | ||
| 202 | #define RXTX_REG20 0x0050 | 211 | #define RXTX_REG20 0x0050 |
| 212 | #define RXTX_REG22 0x0058 | ||
| 203 | #define RXTX_REG114 0x01c8 | 213 | #define RXTX_REG114 0x01c8 |
| 214 | #define RXTX_REG129 0x0204 | ||
| 204 | 215 | ||
| 205 | /* SerDes RxTx register entry bit positions and sizes */ | 216 | /* SerDes RxTx register entry bit positions and sizes */ |
| 217 | #define RXTX_REG6_RESETB_RXD_INDEX 8 | ||
| 218 | #define RXTX_REG6_RESETB_RXD_WIDTH 1 | ||
| 206 | #define RXTX_REG20_BLWC_ENA_INDEX 2 | 219 | #define RXTX_REG20_BLWC_ENA_INDEX 2 |
| 207 | #define RXTX_REG20_BLWC_ENA_WIDTH 1 | 220 | #define RXTX_REG20_BLWC_ENA_WIDTH 1 |
| 208 | #define RXTX_REG114_PQ_REG_INDEX 9 | 221 | #define RXTX_REG114_PQ_REG_INDEX 9 |
| 209 | #define RXTX_REG114_PQ_REG_WIDTH 7 | 222 | #define RXTX_REG114_PQ_REG_WIDTH 7 |
| 223 | #define RXTX_REG129_RXDFE_CONFIG_INDEX 14 | ||
| 224 | #define RXTX_REG129_RXDFE_CONFIG_WIDTH 2 | ||
| 210 | 225 | ||
| 211 | /* Bit setting and getting macros | 226 | /* Bit setting and getting macros |
| 212 | * The get macro will extract the current bit field value from within | 227 | * The get macro will extract the current bit field value from within |
| @@ -333,6 +348,18 @@ static const u32 amd_xgbe_phy_serdes_tx_amp[] = { | |||
| 333 | SPEED_10000_TXAMP, | 348 | SPEED_10000_TXAMP, |
| 334 | }; | 349 | }; |
| 335 | 350 | ||
| 351 | static const u32 amd_xgbe_phy_serdes_dfe_tap_cfg[] = { | ||
| 352 | SPEED_1000_DFE_TAP_CONFIG, | ||
| 353 | SPEED_2500_DFE_TAP_CONFIG, | ||
| 354 | SPEED_10000_DFE_TAP_CONFIG, | ||
| 355 | }; | ||
| 356 | |||
| 357 | static const u32 amd_xgbe_phy_serdes_dfe_tap_ena[] = { | ||
| 358 | SPEED_1000_DFE_TAP_ENABLE, | ||
| 359 | SPEED_2500_DFE_TAP_ENABLE, | ||
| 360 | SPEED_10000_DFE_TAP_ENABLE, | ||
| 361 | }; | ||
| 362 | |||
| 336 | enum amd_xgbe_phy_an { | 363 | enum amd_xgbe_phy_an { |
| 337 | AMD_XGBE_AN_READY = 0, | 364 | AMD_XGBE_AN_READY = 0, |
| 338 | AMD_XGBE_AN_PAGE_RECEIVED, | 365 | AMD_XGBE_AN_PAGE_RECEIVED, |
| @@ -393,6 +420,8 @@ struct amd_xgbe_phy_priv { | |||
| 393 | u32 serdes_cdr_rate[XGBE_PHY_SPEEDS]; | 420 | u32 serdes_cdr_rate[XGBE_PHY_SPEEDS]; |
| 394 | u32 serdes_pq_skew[XGBE_PHY_SPEEDS]; | 421 | u32 serdes_pq_skew[XGBE_PHY_SPEEDS]; |
| 395 | u32 serdes_tx_amp[XGBE_PHY_SPEEDS]; | 422 | u32 serdes_tx_amp[XGBE_PHY_SPEEDS]; |
| 423 | u32 serdes_dfe_tap_cfg[XGBE_PHY_SPEEDS]; | ||
| 424 | u32 serdes_dfe_tap_ena[XGBE_PHY_SPEEDS]; | ||
| 396 | 425 | ||
| 397 | /* Auto-negotiation state machine support */ | 426 | /* Auto-negotiation state machine support */ |
| 398 | struct mutex an_mutex; | 427 | struct mutex an_mutex; |
| @@ -481,11 +510,16 @@ static void amd_xgbe_phy_serdes_complete_ratechange(struct phy_device *phydev) | |||
| 481 | status = XSIR0_IOREAD(priv, SIR0_STATUS); | 510 | status = XSIR0_IOREAD(priv, SIR0_STATUS); |
| 482 | if (XSIR_GET_BITS(status, SIR0_STATUS, RX_READY) && | 511 | if (XSIR_GET_BITS(status, SIR0_STATUS, RX_READY) && |
| 483 | XSIR_GET_BITS(status, SIR0_STATUS, TX_READY)) | 512 | XSIR_GET_BITS(status, SIR0_STATUS, TX_READY)) |
| 484 | return; | 513 | goto rx_reset; |
| 485 | } | 514 | } |
| 486 | 515 | ||
| 487 | netdev_dbg(phydev->attached_dev, "SerDes rx/tx not ready (%#hx)\n", | 516 | netdev_dbg(phydev->attached_dev, "SerDes rx/tx not ready (%#hx)\n", |
| 488 | status); | 517 | status); |
| 518 | |||
| 519 | rx_reset: | ||
| 520 | /* Perform Rx reset for the DFE changes */ | ||
| 521 | XRXTX_IOWRITE_BITS(priv, RXTX_REG6, RESETB_RXD, 0); | ||
| 522 | XRXTX_IOWRITE_BITS(priv, RXTX_REG6, RESETB_RXD, 1); | ||
| 489 | } | 523 | } |
| 490 | 524 | ||
| 491 | static int amd_xgbe_phy_xgmii_mode(struct phy_device *phydev) | 525 | static int amd_xgbe_phy_xgmii_mode(struct phy_device *phydev) |
| @@ -534,6 +568,10 @@ static int amd_xgbe_phy_xgmii_mode(struct phy_device *phydev) | |||
| 534 | priv->serdes_blwc[XGBE_PHY_SPEED_10000]); | 568 | priv->serdes_blwc[XGBE_PHY_SPEED_10000]); |
| 535 | XRXTX_IOWRITE_BITS(priv, RXTX_REG114, PQ_REG, | 569 | XRXTX_IOWRITE_BITS(priv, RXTX_REG114, PQ_REG, |
| 536 | priv->serdes_pq_skew[XGBE_PHY_SPEED_10000]); | 570 | priv->serdes_pq_skew[XGBE_PHY_SPEED_10000]); |
| 571 | XRXTX_IOWRITE_BITS(priv, RXTX_REG129, RXDFE_CONFIG, | ||
| 572 | priv->serdes_dfe_tap_cfg[XGBE_PHY_SPEED_10000]); | ||
| 573 | XRXTX_IOWRITE(priv, RXTX_REG22, | ||
| 574 | priv->serdes_dfe_tap_ena[XGBE_PHY_SPEED_10000]); | ||
| 537 | 575 | ||
| 538 | amd_xgbe_phy_serdes_complete_ratechange(phydev); | 576 | amd_xgbe_phy_serdes_complete_ratechange(phydev); |
| 539 | 577 | ||
| @@ -586,6 +624,10 @@ static int amd_xgbe_phy_gmii_2500_mode(struct phy_device *phydev) | |||
| 586 | priv->serdes_blwc[XGBE_PHY_SPEED_2500]); | 624 | priv->serdes_blwc[XGBE_PHY_SPEED_2500]); |
| 587 | XRXTX_IOWRITE_BITS(priv, RXTX_REG114, PQ_REG, | 625 | XRXTX_IOWRITE_BITS(priv, RXTX_REG114, PQ_REG, |
| 588 | priv->serdes_pq_skew[XGBE_PHY_SPEED_2500]); | 626 | priv->serdes_pq_skew[XGBE_PHY_SPEED_2500]); |
| 627 | XRXTX_IOWRITE_BITS(priv, RXTX_REG129, RXDFE_CONFIG, | ||
| 628 | priv->serdes_dfe_tap_cfg[XGBE_PHY_SPEED_2500]); | ||
| 629 | XRXTX_IOWRITE(priv, RXTX_REG22, | ||
| 630 | priv->serdes_dfe_tap_ena[XGBE_PHY_SPEED_2500]); | ||
| 589 | 631 | ||
| 590 | amd_xgbe_phy_serdes_complete_ratechange(phydev); | 632 | amd_xgbe_phy_serdes_complete_ratechange(phydev); |
| 591 | 633 | ||
| @@ -638,6 +680,10 @@ static int amd_xgbe_phy_gmii_mode(struct phy_device *phydev) | |||
| 638 | priv->serdes_blwc[XGBE_PHY_SPEED_1000]); | 680 | priv->serdes_blwc[XGBE_PHY_SPEED_1000]); |
| 639 | XRXTX_IOWRITE_BITS(priv, RXTX_REG114, PQ_REG, | 681 | XRXTX_IOWRITE_BITS(priv, RXTX_REG114, PQ_REG, |
| 640 | priv->serdes_pq_skew[XGBE_PHY_SPEED_1000]); | 682 | priv->serdes_pq_skew[XGBE_PHY_SPEED_1000]); |
| 683 | XRXTX_IOWRITE_BITS(priv, RXTX_REG129, RXDFE_CONFIG, | ||
| 684 | priv->serdes_dfe_tap_cfg[XGBE_PHY_SPEED_1000]); | ||
| 685 | XRXTX_IOWRITE(priv, RXTX_REG22, | ||
| 686 | priv->serdes_dfe_tap_ena[XGBE_PHY_SPEED_1000]); | ||
| 641 | 687 | ||
| 642 | amd_xgbe_phy_serdes_complete_ratechange(phydev); | 688 | amd_xgbe_phy_serdes_complete_ratechange(phydev); |
| 643 | 689 | ||
| @@ -1668,6 +1714,38 @@ static int amd_xgbe_phy_probe(struct phy_device *phydev) | |||
| 1668 | sizeof(priv->serdes_tx_amp)); | 1714 | sizeof(priv->serdes_tx_amp)); |
| 1669 | } | 1715 | } |
| 1670 | 1716 | ||
| 1717 | if (device_property_present(phy_dev, XGBE_PHY_DFE_CFG_PROPERTY)) { | ||
| 1718 | ret = device_property_read_u32_array(phy_dev, | ||
| 1719 | XGBE_PHY_DFE_CFG_PROPERTY, | ||
| 1720 | priv->serdes_dfe_tap_cfg, | ||
| 1721 | XGBE_PHY_SPEEDS); | ||
| 1722 | if (ret) { | ||
| 1723 | dev_err(dev, "invalid %s property\n", | ||
| 1724 | XGBE_PHY_DFE_CFG_PROPERTY); | ||
| 1725 | goto err_sir1; | ||
| 1726 | } | ||
| 1727 | } else { | ||
| 1728 | memcpy(priv->serdes_dfe_tap_cfg, | ||
| 1729 | amd_xgbe_phy_serdes_dfe_tap_cfg, | ||
| 1730 | sizeof(priv->serdes_dfe_tap_cfg)); | ||
| 1731 | } | ||
| 1732 | |||
| 1733 | if (device_property_present(phy_dev, XGBE_PHY_DFE_ENA_PROPERTY)) { | ||
| 1734 | ret = device_property_read_u32_array(phy_dev, | ||
| 1735 | XGBE_PHY_DFE_ENA_PROPERTY, | ||
| 1736 | priv->serdes_dfe_tap_ena, | ||
| 1737 | XGBE_PHY_SPEEDS); | ||
| 1738 | if (ret) { | ||
| 1739 | dev_err(dev, "invalid %s property\n", | ||
| 1740 | XGBE_PHY_DFE_ENA_PROPERTY); | ||
| 1741 | goto err_sir1; | ||
| 1742 | } | ||
| 1743 | } else { | ||
| 1744 | memcpy(priv->serdes_dfe_tap_ena, | ||
| 1745 | amd_xgbe_phy_serdes_dfe_tap_ena, | ||
| 1746 | sizeof(priv->serdes_dfe_tap_ena)); | ||
| 1747 | } | ||
| 1748 | |||
| 1671 | phydev->priv = priv; | 1749 | phydev->priv = priv; |
| 1672 | 1750 | ||
| 1673 | if (!priv->adev || acpi_disabled) | 1751 | if (!priv->adev || acpi_disabled) |
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index cdcac6aa4260..52cd8db2c57d 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
| @@ -236,6 +236,25 @@ static inline unsigned int phy_find_valid(unsigned int idx, u32 features) | |||
| 236 | } | 236 | } |
| 237 | 237 | ||
| 238 | /** | 238 | /** |
| 239 | * phy_check_valid - check if there is a valid PHY setting which matches | ||
| 240 | * speed, duplex, and feature mask | ||
| 241 | * @speed: speed to match | ||
| 242 | * @duplex: duplex to match | ||
| 243 | * @features: A mask of the valid settings | ||
| 244 | * | ||
| 245 | * Description: Returns true if there is a valid setting, false otherwise. | ||
| 246 | */ | ||
| 247 | static inline bool phy_check_valid(int speed, int duplex, u32 features) | ||
| 248 | { | ||
| 249 | unsigned int idx; | ||
| 250 | |||
| 251 | idx = phy_find_valid(phy_find_setting(speed, duplex), features); | ||
| 252 | |||
| 253 | return settings[idx].speed == speed && settings[idx].duplex == duplex && | ||
| 254 | (settings[idx].setting & features); | ||
| 255 | } | ||
| 256 | |||
| 257 | /** | ||
| 239 | * phy_sanitize_settings - make sure the PHY is set to supported speed and duplex | 258 | * phy_sanitize_settings - make sure the PHY is set to supported speed and duplex |
| 240 | * @phydev: the target phy_device struct | 259 | * @phydev: the target phy_device struct |
| 241 | * | 260 | * |
| @@ -1045,7 +1064,6 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable) | |||
| 1045 | int eee_lp, eee_cap, eee_adv; | 1064 | int eee_lp, eee_cap, eee_adv; |
| 1046 | u32 lp, cap, adv; | 1065 | u32 lp, cap, adv; |
| 1047 | int status; | 1066 | int status; |
| 1048 | unsigned int idx; | ||
| 1049 | 1067 | ||
| 1050 | /* Read phy status to properly get the right settings */ | 1068 | /* Read phy status to properly get the right settings */ |
| 1051 | status = phy_read_status(phydev); | 1069 | status = phy_read_status(phydev); |
| @@ -1077,8 +1095,7 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable) | |||
| 1077 | 1095 | ||
| 1078 | adv = mmd_eee_adv_to_ethtool_adv_t(eee_adv); | 1096 | adv = mmd_eee_adv_to_ethtool_adv_t(eee_adv); |
| 1079 | lp = mmd_eee_adv_to_ethtool_adv_t(eee_lp); | 1097 | lp = mmd_eee_adv_to_ethtool_adv_t(eee_lp); |
| 1080 | idx = phy_find_setting(phydev->speed, phydev->duplex); | 1098 | if (!phy_check_valid(phydev->speed, phydev->duplex, lp & adv)) |
| 1081 | if (!(lp & adv & settings[idx].setting)) | ||
| 1082 | goto eee_exit_err; | 1099 | goto eee_exit_err; |
| 1083 | 1100 | ||
| 1084 | if (clk_stop_enable) { | 1101 | if (clk_stop_enable) { |
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index 0e62274e884a..7d394846afc2 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c | |||
| @@ -43,9 +43,7 @@ | |||
| 43 | 43 | ||
| 44 | static struct team_port *team_port_get_rcu(const struct net_device *dev) | 44 | static struct team_port *team_port_get_rcu(const struct net_device *dev) |
| 45 | { | 45 | { |
| 46 | struct team_port *port = rcu_dereference(dev->rx_handler_data); | 46 | return rcu_dereference(dev->rx_handler_data); |
| 47 | |||
| 48 | return team_port_exists(dev) ? port : NULL; | ||
| 49 | } | 47 | } |
| 50 | 48 | ||
| 51 | static struct team_port *team_port_get_rtnl(const struct net_device *dev) | 49 | static struct team_port *team_port_get_rtnl(const struct net_device *dev) |
| @@ -1732,11 +1730,11 @@ static int team_set_mac_address(struct net_device *dev, void *p) | |||
| 1732 | if (dev->type == ARPHRD_ETHER && !is_valid_ether_addr(addr->sa_data)) | 1730 | if (dev->type == ARPHRD_ETHER && !is_valid_ether_addr(addr->sa_data)) |
| 1733 | return -EADDRNOTAVAIL; | 1731 | return -EADDRNOTAVAIL; |
| 1734 | memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); | 1732 | memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); |
| 1735 | rcu_read_lock(); | 1733 | mutex_lock(&team->lock); |
| 1736 | list_for_each_entry_rcu(port, &team->port_list, list) | 1734 | list_for_each_entry(port, &team->port_list, list) |
| 1737 | if (team->ops.port_change_dev_addr) | 1735 | if (team->ops.port_change_dev_addr) |
| 1738 | team->ops.port_change_dev_addr(team, port); | 1736 | team->ops.port_change_dev_addr(team, port); |
| 1739 | rcu_read_unlock(); | 1737 | mutex_unlock(&team->lock); |
| 1740 | return 0; | 1738 | return 0; |
| 1741 | } | 1739 | } |
| 1742 | 1740 | ||
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig index 3bd9678315ad..7ba8d0885f12 100644 --- a/drivers/net/usb/Kconfig +++ b/drivers/net/usb/Kconfig | |||
| @@ -161,6 +161,7 @@ config USB_NET_AX8817X | |||
| 161 | * Linksys USB200M | 161 | * Linksys USB200M |
| 162 | * Netgear FA120 | 162 | * Netgear FA120 |
| 163 | * Sitecom LN-029 | 163 | * Sitecom LN-029 |
| 164 | * Sitecom LN-028 | ||
| 164 | * Intellinet USB 2.0 Ethernet | 165 | * Intellinet USB 2.0 Ethernet |
| 165 | * ST Lab USB 2.0 Ethernet | 166 | * ST Lab USB 2.0 Ethernet |
| 166 | * TrendNet TU2-ET100 | 167 | * TrendNet TU2-ET100 |
diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c index bf49792062a2..1173a24feda3 100644 --- a/drivers/net/usb/asix_devices.c +++ b/drivers/net/usb/asix_devices.c | |||
| @@ -979,6 +979,10 @@ static const struct usb_device_id products [] = { | |||
| 979 | USB_DEVICE (0x0df6, 0x0056), | 979 | USB_DEVICE (0x0df6, 0x0056), |
| 980 | .driver_info = (unsigned long) &ax88178_info, | 980 | .driver_info = (unsigned long) &ax88178_info, |
| 981 | }, { | 981 | }, { |
| 982 | // Sitecom LN-028 "USB 2.0 10/100/1000 Ethernet adapter" | ||
| 983 | USB_DEVICE (0x0df6, 0x061c), | ||
| 984 | .driver_info = (unsigned long) &ax88178_info, | ||
| 985 | }, { | ||
| 982 | // corega FEther USB2-TX | 986 | // corega FEther USB2-TX |
| 983 | USB_DEVICE (0x07aa, 0x0017), | 987 | USB_DEVICE (0x07aa, 0x0017), |
| 984 | .driver_info = (unsigned long) &ax8817x_info, | 988 | .driver_info = (unsigned long) &ax8817x_info, |
diff --git a/drivers/net/usb/cx82310_eth.c b/drivers/net/usb/cx82310_eth.c index 3eed708a6182..fe48f4c51373 100644 --- a/drivers/net/usb/cx82310_eth.c +++ b/drivers/net/usb/cx82310_eth.c | |||
| @@ -300,9 +300,18 @@ static const struct driver_info cx82310_info = { | |||
| 300 | .tx_fixup = cx82310_tx_fixup, | 300 | .tx_fixup = cx82310_tx_fixup, |
| 301 | }; | 301 | }; |
| 302 | 302 | ||
| 303 | #define USB_DEVICE_CLASS(vend, prod, cl, sc, pr) \ | ||
| 304 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ | ||
| 305 | USB_DEVICE_ID_MATCH_DEV_INFO, \ | ||
| 306 | .idVendor = (vend), \ | ||
| 307 | .idProduct = (prod), \ | ||
| 308 | .bDeviceClass = (cl), \ | ||
| 309 | .bDeviceSubClass = (sc), \ | ||
| 310 | .bDeviceProtocol = (pr) | ||
| 311 | |||
| 303 | static const struct usb_device_id products[] = { | 312 | static const struct usb_device_id products[] = { |
| 304 | { | 313 | { |
| 305 | USB_DEVICE_AND_INTERFACE_INFO(0x0572, 0xcb01, 0xff, 0, 0), | 314 | USB_DEVICE_CLASS(0x0572, 0xcb01, 0xff, 0, 0), |
| 306 | .driver_info = (unsigned long) &cx82310_info | 315 | .driver_info = (unsigned long) &cx82310_info |
| 307 | }, | 316 | }, |
| 308 | { }, | 317 | { }, |
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index 9cdfb3fe9c15..778e91531fac 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c | |||
| @@ -1594,7 +1594,7 @@ hso_wait_modem_status(struct hso_serial *serial, unsigned long arg) | |||
| 1594 | } | 1594 | } |
| 1595 | cprev = cnow; | 1595 | cprev = cnow; |
| 1596 | } | 1596 | } |
| 1597 | current->state = TASK_RUNNING; | 1597 | __set_current_state(TASK_RUNNING); |
| 1598 | remove_wait_queue(&tiocmget->waitq, &wait); | 1598 | remove_wait_queue(&tiocmget->waitq, &wait); |
| 1599 | 1599 | ||
| 1600 | return ret; | 1600 | return ret; |
diff --git a/drivers/net/usb/plusb.c b/drivers/net/usb/plusb.c index 3d18bb0eee85..1bfe0fcaccf5 100644 --- a/drivers/net/usb/plusb.c +++ b/drivers/net/usb/plusb.c | |||
| @@ -134,6 +134,11 @@ static const struct usb_device_id products [] = { | |||
| 134 | }, { | 134 | }, { |
| 135 | USB_DEVICE(0x050d, 0x258a), /* Belkin F5U258/F5U279 (PL-25A1) */ | 135 | USB_DEVICE(0x050d, 0x258a), /* Belkin F5U258/F5U279 (PL-25A1) */ |
| 136 | .driver_info = (unsigned long) &prolific_info, | 136 | .driver_info = (unsigned long) &prolific_info, |
| 137 | }, { | ||
| 138 | USB_DEVICE(0x3923, 0x7825), /* National Instruments USB | ||
| 139 | * Host-to-Host Cable | ||
| 140 | */ | ||
| 141 | .driver_info = (unsigned long) &prolific_info, | ||
| 137 | }, | 142 | }, |
| 138 | 143 | ||
| 139 | { }, // END | 144 | { }, // END |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index f1ff3666f090..59b0e9754ae3 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
| @@ -1448,8 +1448,10 @@ static void virtnet_free_queues(struct virtnet_info *vi) | |||
| 1448 | { | 1448 | { |
| 1449 | int i; | 1449 | int i; |
| 1450 | 1450 | ||
| 1451 | for (i = 0; i < vi->max_queue_pairs; i++) | 1451 | for (i = 0; i < vi->max_queue_pairs; i++) { |
| 1452 | napi_hash_del(&vi->rq[i].napi); | ||
| 1452 | netif_napi_del(&vi->rq[i].napi); | 1453 | netif_napi_del(&vi->rq[i].napi); |
| 1454 | } | ||
| 1453 | 1455 | ||
| 1454 | kfree(vi->rq); | 1456 | kfree(vi->rq); |
| 1455 | kfree(vi->sq); | 1457 | kfree(vi->sq); |
| @@ -1948,11 +1950,8 @@ static int virtnet_freeze(struct virtio_device *vdev) | |||
| 1948 | cancel_delayed_work_sync(&vi->refill); | 1950 | cancel_delayed_work_sync(&vi->refill); |
| 1949 | 1951 | ||
| 1950 | if (netif_running(vi->dev)) { | 1952 | if (netif_running(vi->dev)) { |
| 1951 | for (i = 0; i < vi->max_queue_pairs; i++) { | 1953 | for (i = 0; i < vi->max_queue_pairs; i++) |
| 1952 | napi_disable(&vi->rq[i].napi); | 1954 | napi_disable(&vi->rq[i].napi); |
| 1953 | napi_hash_del(&vi->rq[i].napi); | ||
| 1954 | netif_napi_del(&vi->rq[i].napi); | ||
| 1955 | } | ||
| 1956 | } | 1955 | } |
| 1957 | 1956 | ||
| 1958 | remove_vq_common(vi); | 1957 | remove_vq_common(vi); |
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 1e0a775ea882..f8528a4cf54f 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
| @@ -1218,7 +1218,7 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb) | |||
| 1218 | goto drop; | 1218 | goto drop; |
| 1219 | 1219 | ||
| 1220 | flags &= ~VXLAN_HF_RCO; | 1220 | flags &= ~VXLAN_HF_RCO; |
| 1221 | vni &= VXLAN_VID_MASK; | 1221 | vni &= VXLAN_VNI_MASK; |
| 1222 | } | 1222 | } |
| 1223 | 1223 | ||
| 1224 | /* For backwards compatibility, only allow reserved fields to be | 1224 | /* For backwards compatibility, only allow reserved fields to be |
| @@ -1239,7 +1239,7 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb) | |||
| 1239 | flags &= ~VXLAN_GBP_USED_BITS; | 1239 | flags &= ~VXLAN_GBP_USED_BITS; |
| 1240 | } | 1240 | } |
| 1241 | 1241 | ||
| 1242 | if (flags || (vni & ~VXLAN_VID_MASK)) { | 1242 | if (flags || vni & ~VXLAN_VNI_MASK) { |
| 1243 | /* If there are any unprocessed flags remaining treat | 1243 | /* If there are any unprocessed flags remaining treat |
| 1244 | * this as a malformed packet. This behavior diverges from | 1244 | * this as a malformed packet. This behavior diverges from |
| 1245 | * VXLAN RFC (RFC7348) which stipulates that bits in reserved | 1245 | * VXLAN RFC (RFC7348) which stipulates that bits in reserved |
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c index 83c39e2858bf..88d121d43c08 100644 --- a/drivers/net/wan/cosa.c +++ b/drivers/net/wan/cosa.c | |||
| @@ -806,21 +806,21 @@ static ssize_t cosa_read(struct file *file, | |||
| 806 | spin_lock_irqsave(&cosa->lock, flags); | 806 | spin_lock_irqsave(&cosa->lock, flags); |
| 807 | add_wait_queue(&chan->rxwaitq, &wait); | 807 | add_wait_queue(&chan->rxwaitq, &wait); |
| 808 | while (!chan->rx_status) { | 808 | while (!chan->rx_status) { |
| 809 | current->state = TASK_INTERRUPTIBLE; | 809 | set_current_state(TASK_INTERRUPTIBLE); |
| 810 | spin_unlock_irqrestore(&cosa->lock, flags); | 810 | spin_unlock_irqrestore(&cosa->lock, flags); |
| 811 | schedule(); | 811 | schedule(); |
| 812 | spin_lock_irqsave(&cosa->lock, flags); | 812 | spin_lock_irqsave(&cosa->lock, flags); |
| 813 | if (signal_pending(current) && chan->rx_status == 0) { | 813 | if (signal_pending(current) && chan->rx_status == 0) { |
| 814 | chan->rx_status = 1; | 814 | chan->rx_status = 1; |
| 815 | remove_wait_queue(&chan->rxwaitq, &wait); | 815 | remove_wait_queue(&chan->rxwaitq, &wait); |
| 816 | current->state = TASK_RUNNING; | 816 | __set_current_state(TASK_RUNNING); |
| 817 | spin_unlock_irqrestore(&cosa->lock, flags); | 817 | spin_unlock_irqrestore(&cosa->lock, flags); |
| 818 | mutex_unlock(&chan->rlock); | 818 | mutex_unlock(&chan->rlock); |
| 819 | return -ERESTARTSYS; | 819 | return -ERESTARTSYS; |
| 820 | } | 820 | } |
| 821 | } | 821 | } |
| 822 | remove_wait_queue(&chan->rxwaitq, &wait); | 822 | remove_wait_queue(&chan->rxwaitq, &wait); |
| 823 | current->state = TASK_RUNNING; | 823 | __set_current_state(TASK_RUNNING); |
| 824 | kbuf = chan->rxdata; | 824 | kbuf = chan->rxdata; |
| 825 | count = chan->rxsize; | 825 | count = chan->rxsize; |
| 826 | spin_unlock_irqrestore(&cosa->lock, flags); | 826 | spin_unlock_irqrestore(&cosa->lock, flags); |
| @@ -890,14 +890,14 @@ static ssize_t cosa_write(struct file *file, | |||
| 890 | spin_lock_irqsave(&cosa->lock, flags); | 890 | spin_lock_irqsave(&cosa->lock, flags); |
| 891 | add_wait_queue(&chan->txwaitq, &wait); | 891 | add_wait_queue(&chan->txwaitq, &wait); |
| 892 | while (!chan->tx_status) { | 892 | while (!chan->tx_status) { |
| 893 | current->state = TASK_INTERRUPTIBLE; | 893 | set_current_state(TASK_INTERRUPTIBLE); |
| 894 | spin_unlock_irqrestore(&cosa->lock, flags); | 894 | spin_unlock_irqrestore(&cosa->lock, flags); |
| 895 | schedule(); | 895 | schedule(); |
| 896 | spin_lock_irqsave(&cosa->lock, flags); | 896 | spin_lock_irqsave(&cosa->lock, flags); |
| 897 | if (signal_pending(current) && chan->tx_status == 0) { | 897 | if (signal_pending(current) && chan->tx_status == 0) { |
| 898 | chan->tx_status = 1; | 898 | chan->tx_status = 1; |
| 899 | remove_wait_queue(&chan->txwaitq, &wait); | 899 | remove_wait_queue(&chan->txwaitq, &wait); |
| 900 | current->state = TASK_RUNNING; | 900 | __set_current_state(TASK_RUNNING); |
| 901 | chan->tx_status = 1; | 901 | chan->tx_status = 1; |
| 902 | spin_unlock_irqrestore(&cosa->lock, flags); | 902 | spin_unlock_irqrestore(&cosa->lock, flags); |
| 903 | up(&chan->wsem); | 903 | up(&chan->wsem); |
| @@ -905,7 +905,7 @@ static ssize_t cosa_write(struct file *file, | |||
| 905 | } | 905 | } |
| 906 | } | 906 | } |
| 907 | remove_wait_queue(&chan->txwaitq, &wait); | 907 | remove_wait_queue(&chan->txwaitq, &wait); |
| 908 | current->state = TASK_RUNNING; | 908 | __set_current_state(TASK_RUNNING); |
| 909 | up(&chan->wsem); | 909 | up(&chan->wsem); |
| 910 | spin_unlock_irqrestore(&cosa->lock, flags); | 910 | spin_unlock_irqrestore(&cosa->lock, flags); |
| 911 | kfree(kbuf); | 911 | kfree(kbuf); |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index ccbdb05b28cd..75345c1e8c34 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
| @@ -5370,6 +5370,7 @@ static void b43_supported_bands(struct b43_wldev *dev, bool *have_2ghz_phy, | |||
| 5370 | case 0x432a: /* BCM4321 */ | 5370 | case 0x432a: /* BCM4321 */ |
| 5371 | case 0x432d: /* BCM4322 */ | 5371 | case 0x432d: /* BCM4322 */ |
| 5372 | case 0x4352: /* BCM43222 */ | 5372 | case 0x4352: /* BCM43222 */ |
| 5373 | case 0x435a: /* BCM43228 */ | ||
| 5373 | case 0x4333: /* BCM4331 */ | 5374 | case 0x4333: /* BCM4331 */ |
| 5374 | case 0x43a2: /* BCM4360 */ | 5375 | case 0x43a2: /* BCM4360 */ |
| 5375 | case 0x43b3: /* BCM4352 */ | 5376 | case 0x43b3: /* BCM4352 */ |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/vendor.c b/drivers/net/wireless/brcm80211/brcmfmac/vendor.c index 50cdf7090198..8eff2753abad 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/vendor.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/vendor.c | |||
| @@ -39,13 +39,22 @@ static int brcmf_cfg80211_vndr_cmds_dcmd_handler(struct wiphy *wiphy, | |||
| 39 | void *dcmd_buf = NULL, *wr_pointer; | 39 | void *dcmd_buf = NULL, *wr_pointer; |
| 40 | u16 msglen, maxmsglen = PAGE_SIZE - 0x100; | 40 | u16 msglen, maxmsglen = PAGE_SIZE - 0x100; |
| 41 | 41 | ||
| 42 | brcmf_dbg(TRACE, "cmd %x set %d len %d\n", cmdhdr->cmd, cmdhdr->set, | 42 | if (len < sizeof(*cmdhdr)) { |
| 43 | cmdhdr->len); | 43 | brcmf_err("vendor command too short: %d\n", len); |
| 44 | return -EINVAL; | ||
| 45 | } | ||
| 44 | 46 | ||
| 45 | vif = container_of(wdev, struct brcmf_cfg80211_vif, wdev); | 47 | vif = container_of(wdev, struct brcmf_cfg80211_vif, wdev); |
| 46 | ifp = vif->ifp; | 48 | ifp = vif->ifp; |
| 47 | 49 | ||
| 48 | len -= sizeof(struct brcmf_vndr_dcmd_hdr); | 50 | brcmf_dbg(TRACE, "ifidx=%d, cmd=%d\n", ifp->ifidx, cmdhdr->cmd); |
| 51 | |||
| 52 | if (cmdhdr->offset > len) { | ||
| 53 | brcmf_err("bad buffer offset %d > %d\n", cmdhdr->offset, len); | ||
| 54 | return -EINVAL; | ||
| 55 | } | ||
| 56 | |||
| 57 | len -= cmdhdr->offset; | ||
| 49 | ret_len = cmdhdr->len; | 58 | ret_len = cmdhdr->len; |
| 50 | if (ret_len > 0 || len > 0) { | 59 | if (ret_len > 0 || len > 0) { |
| 51 | if (len > BRCMF_DCMD_MAXLEN) { | 60 | if (len > BRCMF_DCMD_MAXLEN) { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c index c3817fae16c0..06f6cc08f451 100644 --- a/drivers/net/wireless/iwlwifi/iwl-1000.c +++ b/drivers/net/wireless/iwlwifi/iwl-1000.c | |||
| @@ -95,7 +95,8 @@ static const struct iwl_eeprom_params iwl1000_eeprom_params = { | |||
| 95 | .nvm_calib_ver = EEPROM_1000_TX_POWER_VERSION, \ | 95 | .nvm_calib_ver = EEPROM_1000_TX_POWER_VERSION, \ |
| 96 | .base_params = &iwl1000_base_params, \ | 96 | .base_params = &iwl1000_base_params, \ |
| 97 | .eeprom_params = &iwl1000_eeprom_params, \ | 97 | .eeprom_params = &iwl1000_eeprom_params, \ |
| 98 | .led_mode = IWL_LED_BLINK | 98 | .led_mode = IWL_LED_BLINK, \ |
| 99 | .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K | ||
| 99 | 100 | ||
| 100 | const struct iwl_cfg iwl1000_bgn_cfg = { | 101 | const struct iwl_cfg iwl1000_bgn_cfg = { |
| 101 | .name = "Intel(R) Centrino(R) Wireless-N 1000 BGN", | 102 | .name = "Intel(R) Centrino(R) Wireless-N 1000 BGN", |
| @@ -121,7 +122,8 @@ const struct iwl_cfg iwl1000_bg_cfg = { | |||
| 121 | .base_params = &iwl1000_base_params, \ | 122 | .base_params = &iwl1000_base_params, \ |
| 122 | .eeprom_params = &iwl1000_eeprom_params, \ | 123 | .eeprom_params = &iwl1000_eeprom_params, \ |
| 123 | .led_mode = IWL_LED_RF_STATE, \ | 124 | .led_mode = IWL_LED_RF_STATE, \ |
| 124 | .rx_with_siso_diversity = true | 125 | .rx_with_siso_diversity = true, \ |
| 126 | .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K | ||
| 125 | 127 | ||
| 126 | const struct iwl_cfg iwl100_bgn_cfg = { | 128 | const struct iwl_cfg iwl100_bgn_cfg = { |
| 127 | .name = "Intel(R) Centrino(R) Wireless-N 100 BGN", | 129 | .name = "Intel(R) Centrino(R) Wireless-N 100 BGN", |
diff --git a/drivers/net/wireless/iwlwifi/iwl-2000.c b/drivers/net/wireless/iwlwifi/iwl-2000.c index 21e5d0843a62..890b95f497d6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-2000.c +++ b/drivers/net/wireless/iwlwifi/iwl-2000.c | |||
| @@ -123,7 +123,9 @@ static const struct iwl_eeprom_params iwl20x0_eeprom_params = { | |||
| 123 | .nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION, \ | 123 | .nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION, \ |
| 124 | .base_params = &iwl2000_base_params, \ | 124 | .base_params = &iwl2000_base_params, \ |
| 125 | .eeprom_params = &iwl20x0_eeprom_params, \ | 125 | .eeprom_params = &iwl20x0_eeprom_params, \ |
| 126 | .led_mode = IWL_LED_RF_STATE | 126 | .led_mode = IWL_LED_RF_STATE, \ |
| 127 | .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K | ||
| 128 | |||
| 127 | 129 | ||
| 128 | const struct iwl_cfg iwl2000_2bgn_cfg = { | 130 | const struct iwl_cfg iwl2000_2bgn_cfg = { |
| 129 | .name = "Intel(R) Centrino(R) Wireless-N 2200 BGN", | 131 | .name = "Intel(R) Centrino(R) Wireless-N 2200 BGN", |
| @@ -149,7 +151,8 @@ const struct iwl_cfg iwl2000_2bgn_d_cfg = { | |||
| 149 | .nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION, \ | 151 | .nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION, \ |
| 150 | .base_params = &iwl2030_base_params, \ | 152 | .base_params = &iwl2030_base_params, \ |
| 151 | .eeprom_params = &iwl20x0_eeprom_params, \ | 153 | .eeprom_params = &iwl20x0_eeprom_params, \ |
| 152 | .led_mode = IWL_LED_RF_STATE | 154 | .led_mode = IWL_LED_RF_STATE, \ |
| 155 | .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K | ||
| 153 | 156 | ||
| 154 | const struct iwl_cfg iwl2030_2bgn_cfg = { | 157 | const struct iwl_cfg iwl2030_2bgn_cfg = { |
| 155 | .name = "Intel(R) Centrino(R) Wireless-N 2230 BGN", | 158 | .name = "Intel(R) Centrino(R) Wireless-N 2230 BGN", |
| @@ -170,7 +173,8 @@ const struct iwl_cfg iwl2030_2bgn_cfg = { | |||
| 170 | .base_params = &iwl2000_base_params, \ | 173 | .base_params = &iwl2000_base_params, \ |
| 171 | .eeprom_params = &iwl20x0_eeprom_params, \ | 174 | .eeprom_params = &iwl20x0_eeprom_params, \ |
| 172 | .led_mode = IWL_LED_RF_STATE, \ | 175 | .led_mode = IWL_LED_RF_STATE, \ |
| 173 | .rx_with_siso_diversity = true | 176 | .rx_with_siso_diversity = true, \ |
| 177 | .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K | ||
| 174 | 178 | ||
| 175 | const struct iwl_cfg iwl105_bgn_cfg = { | 179 | const struct iwl_cfg iwl105_bgn_cfg = { |
| 176 | .name = "Intel(R) Centrino(R) Wireless-N 105 BGN", | 180 | .name = "Intel(R) Centrino(R) Wireless-N 105 BGN", |
| @@ -197,7 +201,8 @@ const struct iwl_cfg iwl105_bgn_d_cfg = { | |||
| 197 | .base_params = &iwl2030_base_params, \ | 201 | .base_params = &iwl2030_base_params, \ |
| 198 | .eeprom_params = &iwl20x0_eeprom_params, \ | 202 | .eeprom_params = &iwl20x0_eeprom_params, \ |
| 199 | .led_mode = IWL_LED_RF_STATE, \ | 203 | .led_mode = IWL_LED_RF_STATE, \ |
| 200 | .rx_with_siso_diversity = true | 204 | .rx_with_siso_diversity = true, \ |
| 205 | .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K | ||
| 201 | 206 | ||
| 202 | const struct iwl_cfg iwl135_bgn_cfg = { | 207 | const struct iwl_cfg iwl135_bgn_cfg = { |
| 203 | .name = "Intel(R) Centrino(R) Wireless-N 135 BGN", | 208 | .name = "Intel(R) Centrino(R) Wireless-N 135 BGN", |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index 332bbede39e5..724194e23414 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
| @@ -93,7 +93,8 @@ static const struct iwl_eeprom_params iwl5000_eeprom_params = { | |||
| 93 | .nvm_calib_ver = EEPROM_5000_TX_POWER_VERSION, \ | 93 | .nvm_calib_ver = EEPROM_5000_TX_POWER_VERSION, \ |
| 94 | .base_params = &iwl5000_base_params, \ | 94 | .base_params = &iwl5000_base_params, \ |
| 95 | .eeprom_params = &iwl5000_eeprom_params, \ | 95 | .eeprom_params = &iwl5000_eeprom_params, \ |
| 96 | .led_mode = IWL_LED_BLINK | 96 | .led_mode = IWL_LED_BLINK, \ |
| 97 | .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K | ||
| 97 | 98 | ||
| 98 | const struct iwl_cfg iwl5300_agn_cfg = { | 99 | const struct iwl_cfg iwl5300_agn_cfg = { |
| 99 | .name = "Intel(R) Ultimate N WiFi Link 5300 AGN", | 100 | .name = "Intel(R) Ultimate N WiFi Link 5300 AGN", |
| @@ -158,7 +159,8 @@ const struct iwl_cfg iwl5350_agn_cfg = { | |||
| 158 | .base_params = &iwl5000_base_params, \ | 159 | .base_params = &iwl5000_base_params, \ |
| 159 | .eeprom_params = &iwl5000_eeprom_params, \ | 160 | .eeprom_params = &iwl5000_eeprom_params, \ |
| 160 | .led_mode = IWL_LED_BLINK, \ | 161 | .led_mode = IWL_LED_BLINK, \ |
| 161 | .internal_wimax_coex = true | 162 | .internal_wimax_coex = true, \ |
| 163 | .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K | ||
| 162 | 164 | ||
| 163 | const struct iwl_cfg iwl5150_agn_cfg = { | 165 | const struct iwl_cfg iwl5150_agn_cfg = { |
| 164 | .name = "Intel(R) WiMAX/WiFi Link 5150 AGN", | 166 | .name = "Intel(R) WiMAX/WiFi Link 5150 AGN", |
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c index 8f2c3c8c6b84..21b2630763dc 100644 --- a/drivers/net/wireless/iwlwifi/iwl-6000.c +++ b/drivers/net/wireless/iwlwifi/iwl-6000.c | |||
| @@ -145,7 +145,8 @@ static const struct iwl_eeprom_params iwl6000_eeprom_params = { | |||
| 145 | .nvm_calib_ver = EEPROM_6005_TX_POWER_VERSION, \ | 145 | .nvm_calib_ver = EEPROM_6005_TX_POWER_VERSION, \ |
| 146 | .base_params = &iwl6000_g2_base_params, \ | 146 | .base_params = &iwl6000_g2_base_params, \ |
| 147 | .eeprom_params = &iwl6000_eeprom_params, \ | 147 | .eeprom_params = &iwl6000_eeprom_params, \ |
| 148 | .led_mode = IWL_LED_RF_STATE | 148 | .led_mode = IWL_LED_RF_STATE, \ |
| 149 | .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K | ||
| 149 | 150 | ||
| 150 | const struct iwl_cfg iwl6005_2agn_cfg = { | 151 | const struct iwl_cfg iwl6005_2agn_cfg = { |
| 151 | .name = "Intel(R) Centrino(R) Advanced-N 6205 AGN", | 152 | .name = "Intel(R) Centrino(R) Advanced-N 6205 AGN", |
| @@ -199,7 +200,8 @@ const struct iwl_cfg iwl6005_2agn_mow2_cfg = { | |||
| 199 | .nvm_calib_ver = EEPROM_6030_TX_POWER_VERSION, \ | 200 | .nvm_calib_ver = EEPROM_6030_TX_POWER_VERSION, \ |
| 200 | .base_params = &iwl6000_g2_base_params, \ | 201 | .base_params = &iwl6000_g2_base_params, \ |
| 201 | .eeprom_params = &iwl6000_eeprom_params, \ | 202 | .eeprom_params = &iwl6000_eeprom_params, \ |
| 202 | .led_mode = IWL_LED_RF_STATE | 203 | .led_mode = IWL_LED_RF_STATE, \ |
| 204 | .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K | ||
| 203 | 205 | ||
| 204 | const struct iwl_cfg iwl6030_2agn_cfg = { | 206 | const struct iwl_cfg iwl6030_2agn_cfg = { |
| 205 | .name = "Intel(R) Centrino(R) Advanced-N 6230 AGN", | 207 | .name = "Intel(R) Centrino(R) Advanced-N 6230 AGN", |
| @@ -235,7 +237,8 @@ const struct iwl_cfg iwl6030_2bg_cfg = { | |||
| 235 | .nvm_calib_ver = EEPROM_6030_TX_POWER_VERSION, \ | 237 | .nvm_calib_ver = EEPROM_6030_TX_POWER_VERSION, \ |
| 236 | .base_params = &iwl6000_g2_base_params, \ | 238 | .base_params = &iwl6000_g2_base_params, \ |
| 237 | .eeprom_params = &iwl6000_eeprom_params, \ | 239 | .eeprom_params = &iwl6000_eeprom_params, \ |
| 238 | .led_mode = IWL_LED_RF_STATE | 240 | .led_mode = IWL_LED_RF_STATE, \ |
| 241 | .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K | ||
| 239 | 242 | ||
| 240 | const struct iwl_cfg iwl6035_2agn_cfg = { | 243 | const struct iwl_cfg iwl6035_2agn_cfg = { |
| 241 | .name = "Intel(R) Centrino(R) Advanced-N 6235 AGN", | 244 | .name = "Intel(R) Centrino(R) Advanced-N 6235 AGN", |
| @@ -290,7 +293,8 @@ const struct iwl_cfg iwl130_bg_cfg = { | |||
| 290 | .nvm_calib_ver = EEPROM_6000_TX_POWER_VERSION, \ | 293 | .nvm_calib_ver = EEPROM_6000_TX_POWER_VERSION, \ |
| 291 | .base_params = &iwl6000_base_params, \ | 294 | .base_params = &iwl6000_base_params, \ |
| 292 | .eeprom_params = &iwl6000_eeprom_params, \ | 295 | .eeprom_params = &iwl6000_eeprom_params, \ |
| 293 | .led_mode = IWL_LED_BLINK | 296 | .led_mode = IWL_LED_BLINK, \ |
| 297 | .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K | ||
| 294 | 298 | ||
| 295 | const struct iwl_cfg iwl6000i_2agn_cfg = { | 299 | const struct iwl_cfg iwl6000i_2agn_cfg = { |
| 296 | .name = "Intel(R) Centrino(R) Advanced-N 6200 AGN", | 300 | .name = "Intel(R) Centrino(R) Advanced-N 6200 AGN", |
| @@ -322,7 +326,8 @@ const struct iwl_cfg iwl6000i_2bg_cfg = { | |||
| 322 | .base_params = &iwl6050_base_params, \ | 326 | .base_params = &iwl6050_base_params, \ |
| 323 | .eeprom_params = &iwl6000_eeprom_params, \ | 327 | .eeprom_params = &iwl6000_eeprom_params, \ |
| 324 | .led_mode = IWL_LED_BLINK, \ | 328 | .led_mode = IWL_LED_BLINK, \ |
| 325 | .internal_wimax_coex = true | 329 | .internal_wimax_coex = true, \ |
| 330 | .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K | ||
| 326 | 331 | ||
| 327 | const struct iwl_cfg iwl6050_2agn_cfg = { | 332 | const struct iwl_cfg iwl6050_2agn_cfg = { |
| 328 | .name = "Intel(R) Centrino(R) Advanced-N + WiMAX 6250 AGN", | 333 | .name = "Intel(R) Centrino(R) Advanced-N + WiMAX 6250 AGN", |
| @@ -347,7 +352,8 @@ const struct iwl_cfg iwl6050_2abg_cfg = { | |||
| 347 | .base_params = &iwl6050_base_params, \ | 352 | .base_params = &iwl6050_base_params, \ |
| 348 | .eeprom_params = &iwl6000_eeprom_params, \ | 353 | .eeprom_params = &iwl6000_eeprom_params, \ |
| 349 | .led_mode = IWL_LED_BLINK, \ | 354 | .led_mode = IWL_LED_BLINK, \ |
| 350 | .internal_wimax_coex = true | 355 | .internal_wimax_coex = true, \ |
| 356 | .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K | ||
| 351 | 357 | ||
| 352 | const struct iwl_cfg iwl6150_bgn_cfg = { | 358 | const struct iwl_cfg iwl6150_bgn_cfg = { |
| 353 | .name = "Intel(R) Centrino(R) Wireless-N + WiMAX 6150 BGN", | 359 | .name = "Intel(R) Centrino(R) Wireless-N + WiMAX 6150 BGN", |
diff --git a/drivers/net/wireless/iwlwifi/mvm/coex.c b/drivers/net/wireless/iwlwifi/mvm/coex.c index 1ec4d55155f7..7810c41cf9a7 100644 --- a/drivers/net/wireless/iwlwifi/mvm/coex.c +++ b/drivers/net/wireless/iwlwifi/mvm/coex.c | |||
| @@ -793,7 +793,8 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac, | |||
| 793 | if (!vif->bss_conf.assoc) | 793 | if (!vif->bss_conf.assoc) |
| 794 | smps_mode = IEEE80211_SMPS_AUTOMATIC; | 794 | smps_mode = IEEE80211_SMPS_AUTOMATIC; |
| 795 | 795 | ||
| 796 | if (IWL_COEX_IS_RRC_ON(mvm->last_bt_notif.ttc_rrc_status, | 796 | if (mvmvif->phy_ctxt && |
| 797 | IWL_COEX_IS_RRC_ON(mvm->last_bt_notif.ttc_rrc_status, | ||
| 797 | mvmvif->phy_ctxt->id)) | 798 | mvmvif->phy_ctxt->id)) |
| 798 | smps_mode = IEEE80211_SMPS_AUTOMATIC; | 799 | smps_mode = IEEE80211_SMPS_AUTOMATIC; |
| 799 | 800 | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/coex_legacy.c b/drivers/net/wireless/iwlwifi/mvm/coex_legacy.c index d530ef3da107..542ee74f290a 100644 --- a/drivers/net/wireless/iwlwifi/mvm/coex_legacy.c +++ b/drivers/net/wireless/iwlwifi/mvm/coex_legacy.c | |||
| @@ -832,7 +832,8 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac, | |||
| 832 | if (!vif->bss_conf.assoc) | 832 | if (!vif->bss_conf.assoc) |
| 833 | smps_mode = IEEE80211_SMPS_AUTOMATIC; | 833 | smps_mode = IEEE80211_SMPS_AUTOMATIC; |
| 834 | 834 | ||
| 835 | if (data->notif->rrc_enabled & BIT(mvmvif->phy_ctxt->id)) | 835 | if (mvmvif->phy_ctxt && |
| 836 | data->notif->rrc_enabled & BIT(mvmvif->phy_ctxt->id)) | ||
| 836 | smps_mode = IEEE80211_SMPS_AUTOMATIC; | 837 | smps_mode = IEEE80211_SMPS_AUTOMATIC; |
| 837 | 838 | ||
| 838 | IWL_DEBUG_COEX(data->mvm, | 839 | IWL_DEBUG_COEX(data->mvm, |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index 1ff7ec08532d..09654e73a533 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c | |||
| @@ -405,7 +405,10 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) | |||
| 405 | hw->wiphy->bands[IEEE80211_BAND_5GHZ] = | 405 | hw->wiphy->bands[IEEE80211_BAND_5GHZ] = |
| 406 | &mvm->nvm_data->bands[IEEE80211_BAND_5GHZ]; | 406 | &mvm->nvm_data->bands[IEEE80211_BAND_5GHZ]; |
| 407 | 407 | ||
| 408 | if (mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_BEAMFORMER) | 408 | if ((mvm->fw->ucode_capa.capa[0] & |
| 409 | IWL_UCODE_TLV_CAPA_BEAMFORMER) && | ||
| 410 | (mvm->fw->ucode_capa.api[0] & | ||
| 411 | IWL_UCODE_TLV_API_LQ_SS_PARAMS)) | ||
| 409 | hw->wiphy->bands[IEEE80211_BAND_5GHZ]->vht_cap.cap |= | 412 | hw->wiphy->bands[IEEE80211_BAND_5GHZ]->vht_cap.cap |= |
| 410 | IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE; | 413 | IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE; |
| 411 | } | 414 | } |
| @@ -2215,7 +2218,19 @@ static void iwl_mvm_mac_cancel_hw_scan(struct ieee80211_hw *hw, | |||
| 2215 | 2218 | ||
| 2216 | mutex_lock(&mvm->mutex); | 2219 | mutex_lock(&mvm->mutex); |
| 2217 | 2220 | ||
| 2218 | iwl_mvm_cancel_scan(mvm); | 2221 | /* Due to a race condition, it's possible that mac80211 asks |
| 2222 | * us to stop a hw_scan when it's already stopped. This can | ||
| 2223 | * happen, for instance, if we stopped the scan ourselves, | ||
| 2224 | * called ieee80211_scan_completed() and the userspace called | ||
| 2225 | * cancel scan scan before ieee80211_scan_work() could run. | ||
| 2226 | * To handle that, simply return if the scan is not running. | ||
| 2227 | */ | ||
| 2228 | /* FIXME: for now, we ignore this race for UMAC scans, since | ||
| 2229 | * they don't set the scan_status. | ||
| 2230 | */ | ||
| 2231 | if ((mvm->scan_status == IWL_MVM_SCAN_OS) || | ||
| 2232 | (mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_UMAC_SCAN)) | ||
| 2233 | iwl_mvm_cancel_scan(mvm); | ||
| 2219 | 2234 | ||
| 2220 | mutex_unlock(&mvm->mutex); | 2235 | mutex_unlock(&mvm->mutex); |
| 2221 | } | 2236 | } |
| @@ -2559,12 +2574,29 @@ static int iwl_mvm_mac_sched_scan_stop(struct ieee80211_hw *hw, | |||
| 2559 | int ret; | 2574 | int ret; |
| 2560 | 2575 | ||
| 2561 | mutex_lock(&mvm->mutex); | 2576 | mutex_lock(&mvm->mutex); |
| 2577 | |||
| 2578 | /* Due to a race condition, it's possible that mac80211 asks | ||
| 2579 | * us to stop a sched_scan when it's already stopped. This | ||
| 2580 | * can happen, for instance, if we stopped the scan ourselves, | ||
| 2581 | * called ieee80211_sched_scan_stopped() and the userspace called | ||
| 2582 | * stop sched scan scan before ieee80211_sched_scan_stopped_work() | ||
| 2583 | * could run. To handle this, simply return if the scan is | ||
| 2584 | * not running. | ||
| 2585 | */ | ||
| 2586 | /* FIXME: for now, we ignore this race for UMAC scans, since | ||
| 2587 | * they don't set the scan_status. | ||
| 2588 | */ | ||
| 2589 | if (mvm->scan_status != IWL_MVM_SCAN_SCHED && | ||
| 2590 | !(mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_UMAC_SCAN)) { | ||
| 2591 | mutex_unlock(&mvm->mutex); | ||
| 2592 | return 0; | ||
| 2593 | } | ||
| 2594 | |||
| 2562 | ret = iwl_mvm_scan_offload_stop(mvm, false); | 2595 | ret = iwl_mvm_scan_offload_stop(mvm, false); |
| 2563 | mutex_unlock(&mvm->mutex); | 2596 | mutex_unlock(&mvm->mutex); |
| 2564 | iwl_mvm_wait_for_async_handlers(mvm); | 2597 | iwl_mvm_wait_for_async_handlers(mvm); |
| 2565 | 2598 | ||
| 2566 | return ret; | 2599 | return ret; |
| 2567 | |||
| 2568 | } | 2600 | } |
| 2569 | 2601 | ||
| 2570 | static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, | 2602 | static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, |
diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.c b/drivers/net/wireless/iwlwifi/mvm/rs.c index 194bd1f939ca..efa9688a4cf1 100644 --- a/drivers/net/wireless/iwlwifi/mvm/rs.c +++ b/drivers/net/wireless/iwlwifi/mvm/rs.c | |||
| @@ -134,9 +134,12 @@ enum rs_column_mode { | |||
| 134 | #define MAX_NEXT_COLUMNS 7 | 134 | #define MAX_NEXT_COLUMNS 7 |
| 135 | #define MAX_COLUMN_CHECKS 3 | 135 | #define MAX_COLUMN_CHECKS 3 |
| 136 | 136 | ||
| 137 | struct rs_tx_column; | ||
| 138 | |||
| 137 | typedef bool (*allow_column_func_t) (struct iwl_mvm *mvm, | 139 | typedef bool (*allow_column_func_t) (struct iwl_mvm *mvm, |
| 138 | struct ieee80211_sta *sta, | 140 | struct ieee80211_sta *sta, |
| 139 | struct iwl_scale_tbl_info *tbl); | 141 | struct iwl_scale_tbl_info *tbl, |
| 142 | const struct rs_tx_column *next_col); | ||
| 140 | 143 | ||
| 141 | struct rs_tx_column { | 144 | struct rs_tx_column { |
| 142 | enum rs_column_mode mode; | 145 | enum rs_column_mode mode; |
| @@ -147,13 +150,15 @@ struct rs_tx_column { | |||
| 147 | }; | 150 | }; |
| 148 | 151 | ||
| 149 | static bool rs_ant_allow(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | 152 | static bool rs_ant_allow(struct iwl_mvm *mvm, struct ieee80211_sta *sta, |
| 150 | struct iwl_scale_tbl_info *tbl) | 153 | struct iwl_scale_tbl_info *tbl, |
| 154 | const struct rs_tx_column *next_col) | ||
| 151 | { | 155 | { |
| 152 | return iwl_mvm_bt_coex_is_ant_avail(mvm, tbl->rate.ant); | 156 | return iwl_mvm_bt_coex_is_ant_avail(mvm, next_col->ant); |
| 153 | } | 157 | } |
| 154 | 158 | ||
| 155 | static bool rs_mimo_allow(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | 159 | static bool rs_mimo_allow(struct iwl_mvm *mvm, struct ieee80211_sta *sta, |
| 156 | struct iwl_scale_tbl_info *tbl) | 160 | struct iwl_scale_tbl_info *tbl, |
| 161 | const struct rs_tx_column *next_col) | ||
| 157 | { | 162 | { |
| 158 | if (!sta->ht_cap.ht_supported) | 163 | if (!sta->ht_cap.ht_supported) |
| 159 | return false; | 164 | return false; |
| @@ -171,7 +176,8 @@ static bool rs_mimo_allow(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | |||
| 171 | } | 176 | } |
| 172 | 177 | ||
| 173 | static bool rs_siso_allow(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | 178 | static bool rs_siso_allow(struct iwl_mvm *mvm, struct ieee80211_sta *sta, |
| 174 | struct iwl_scale_tbl_info *tbl) | 179 | struct iwl_scale_tbl_info *tbl, |
| 180 | const struct rs_tx_column *next_col) | ||
| 175 | { | 181 | { |
| 176 | if (!sta->ht_cap.ht_supported) | 182 | if (!sta->ht_cap.ht_supported) |
| 177 | return false; | 183 | return false; |
| @@ -180,7 +186,8 @@ static bool rs_siso_allow(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | |||
| 180 | } | 186 | } |
| 181 | 187 | ||
| 182 | static bool rs_sgi_allow(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | 188 | static bool rs_sgi_allow(struct iwl_mvm *mvm, struct ieee80211_sta *sta, |
| 183 | struct iwl_scale_tbl_info *tbl) | 189 | struct iwl_scale_tbl_info *tbl, |
| 190 | const struct rs_tx_column *next_col) | ||
| 184 | { | 191 | { |
| 185 | struct rs_rate *rate = &tbl->rate; | 192 | struct rs_rate *rate = &tbl->rate; |
| 186 | struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; | 193 | struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; |
| @@ -1590,7 +1597,7 @@ static enum rs_column rs_get_next_column(struct iwl_mvm *mvm, | |||
| 1590 | 1597 | ||
| 1591 | for (j = 0; j < MAX_COLUMN_CHECKS; j++) { | 1598 | for (j = 0; j < MAX_COLUMN_CHECKS; j++) { |
| 1592 | allow_func = next_col->checks[j]; | 1599 | allow_func = next_col->checks[j]; |
| 1593 | if (allow_func && !allow_func(mvm, sta, tbl)) | 1600 | if (allow_func && !allow_func(mvm, sta, tbl, next_col)) |
| 1594 | break; | 1601 | break; |
| 1595 | } | 1602 | } |
| 1596 | 1603 | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c b/drivers/net/wireless/iwlwifi/mvm/scan.c index 7e9aa3cb3254..c47c8051da77 100644 --- a/drivers/net/wireless/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/iwlwifi/mvm/scan.c | |||
| @@ -1128,8 +1128,10 @@ int iwl_mvm_scan_offload_stop(struct iwl_mvm *mvm, bool notify) | |||
| 1128 | if (mvm->scan_status == IWL_MVM_SCAN_NONE) | 1128 | if (mvm->scan_status == IWL_MVM_SCAN_NONE) |
| 1129 | return 0; | 1129 | return 0; |
| 1130 | 1130 | ||
| 1131 | if (iwl_mvm_is_radio_killed(mvm)) | 1131 | if (iwl_mvm_is_radio_killed(mvm)) { |
| 1132 | ret = 0; | ||
| 1132 | goto out; | 1133 | goto out; |
| 1134 | } | ||
| 1133 | 1135 | ||
| 1134 | if (mvm->scan_status != IWL_MVM_SCAN_SCHED && | 1136 | if (mvm->scan_status != IWL_MVM_SCAN_SCHED && |
| 1135 | (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_LMAC_SCAN) || | 1137 | (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_LMAC_SCAN) || |
| @@ -1148,16 +1150,14 @@ int iwl_mvm_scan_offload_stop(struct iwl_mvm *mvm, bool notify) | |||
| 1148 | IWL_DEBUG_SCAN(mvm, "Send stop %sscan failed %d\n", | 1150 | IWL_DEBUG_SCAN(mvm, "Send stop %sscan failed %d\n", |
| 1149 | sched ? "offloaded " : "", ret); | 1151 | sched ? "offloaded " : "", ret); |
| 1150 | iwl_remove_notification(&mvm->notif_wait, &wait_scan_done); | 1152 | iwl_remove_notification(&mvm->notif_wait, &wait_scan_done); |
| 1151 | return ret; | 1153 | goto out; |
| 1152 | } | 1154 | } |
| 1153 | 1155 | ||
| 1154 | IWL_DEBUG_SCAN(mvm, "Successfully sent stop %sscan\n", | 1156 | IWL_DEBUG_SCAN(mvm, "Successfully sent stop %sscan\n", |
| 1155 | sched ? "offloaded " : ""); | 1157 | sched ? "offloaded " : ""); |
| 1156 | 1158 | ||
| 1157 | ret = iwl_wait_notification(&mvm->notif_wait, &wait_scan_done, 1 * HZ); | 1159 | ret = iwl_wait_notification(&mvm->notif_wait, &wait_scan_done, 1 * HZ); |
| 1158 | if (ret) | 1160 | out: |
| 1159 | return ret; | ||
| 1160 | |||
| 1161 | /* | 1161 | /* |
| 1162 | * Clear the scan status so the next scan requests will succeed. This | 1162 | * Clear the scan status so the next scan requests will succeed. This |
| 1163 | * also ensures the Rx handler doesn't do anything, as the scan was | 1163 | * also ensures the Rx handler doesn't do anything, as the scan was |
| @@ -1167,7 +1167,6 @@ int iwl_mvm_scan_offload_stop(struct iwl_mvm *mvm, bool notify) | |||
| 1167 | if (mvm->scan_status == IWL_MVM_SCAN_OS) | 1167 | if (mvm->scan_status == IWL_MVM_SCAN_OS) |
| 1168 | iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN); | 1168 | iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN); |
| 1169 | 1169 | ||
| 1170 | out: | ||
| 1171 | mvm->scan_status = IWL_MVM_SCAN_NONE; | 1170 | mvm->scan_status = IWL_MVM_SCAN_NONE; |
| 1172 | 1171 | ||
| 1173 | if (notify) { | 1172 | if (notify) { |
| @@ -1177,7 +1176,7 @@ out: | |||
| 1177 | ieee80211_scan_completed(mvm->hw, true); | 1176 | ieee80211_scan_completed(mvm->hw, true); |
| 1178 | } | 1177 | } |
| 1179 | 1178 | ||
| 1180 | return 0; | 1179 | return ret; |
| 1181 | } | 1180 | } |
| 1182 | 1181 | ||
| 1183 | static void iwl_mvm_unified_scan_fill_tx_cmd(struct iwl_mvm *mvm, | 1182 | static void iwl_mvm_unified_scan_fill_tx_cmd(struct iwl_mvm *mvm, |
diff --git a/drivers/net/wireless/iwlwifi/mvm/time-event.c b/drivers/net/wireless/iwlwifi/mvm/time-event.c index 54fafbf9a711..f8d6f306dd76 100644 --- a/drivers/net/wireless/iwlwifi/mvm/time-event.c +++ b/drivers/net/wireless/iwlwifi/mvm/time-event.c | |||
| @@ -750,8 +750,7 @@ void iwl_mvm_stop_roc(struct iwl_mvm *mvm) | |||
| 750 | * request | 750 | * request |
| 751 | */ | 751 | */ |
| 752 | list_for_each_entry(te_data, &mvm->time_event_list, list) { | 752 | list_for_each_entry(te_data, &mvm->time_event_list, list) { |
| 753 | if (te_data->vif->type == NL80211_IFTYPE_P2P_DEVICE && | 753 | if (te_data->vif->type == NL80211_IFTYPE_P2P_DEVICE) { |
| 754 | te_data->running) { | ||
| 755 | mvmvif = iwl_mvm_vif_from_mac80211(te_data->vif); | 754 | mvmvif = iwl_mvm_vif_from_mac80211(te_data->vif); |
| 756 | is_p2p = true; | 755 | is_p2p = true; |
| 757 | goto remove_te; | 756 | goto remove_te; |
| @@ -766,10 +765,8 @@ void iwl_mvm_stop_roc(struct iwl_mvm *mvm) | |||
| 766 | * request | 765 | * request |
| 767 | */ | 766 | */ |
| 768 | list_for_each_entry(te_data, &mvm->aux_roc_te_list, list) { | 767 | list_for_each_entry(te_data, &mvm->aux_roc_te_list, list) { |
| 769 | if (te_data->running) { | 768 | mvmvif = iwl_mvm_vif_from_mac80211(te_data->vif); |
| 770 | mvmvif = iwl_mvm_vif_from_mac80211(te_data->vif); | 769 | goto remove_te; |
| 771 | goto remove_te; | ||
| 772 | } | ||
| 773 | } | 770 | } |
| 774 | 771 | ||
| 775 | remove_te: | 772 | remove_te: |
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 4a4c6586a8d2..8908be6dbc48 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
| @@ -946,7 +946,8 @@ static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw, | |||
| 946 | goto nla_put_failure; | 946 | goto nla_put_failure; |
| 947 | 947 | ||
| 948 | genlmsg_end(skb, msg_head); | 948 | genlmsg_end(skb, msg_head); |
| 949 | genlmsg_unicast(&init_net, skb, dst_portid); | 949 | if (genlmsg_unicast(&init_net, skb, dst_portid)) |
| 950 | goto err_free_txskb; | ||
| 950 | 951 | ||
| 951 | /* Enqueue the packet */ | 952 | /* Enqueue the packet */ |
| 952 | skb_queue_tail(&data->pending, my_skb); | 953 | skb_queue_tail(&data->pending, my_skb); |
| @@ -955,6 +956,8 @@ static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw, | |||
| 955 | return; | 956 | return; |
| 956 | 957 | ||
| 957 | nla_put_failure: | 958 | nla_put_failure: |
| 959 | nlmsg_free(skb); | ||
| 960 | err_free_txskb: | ||
| 958 | printk(KERN_DEBUG "mac80211_hwsim: error occurred in %s\n", __func__); | 961 | printk(KERN_DEBUG "mac80211_hwsim: error occurred in %s\n", __func__); |
| 959 | ieee80211_free_txskb(hw, my_skb); | 962 | ieee80211_free_txskb(hw, my_skb); |
| 960 | data->tx_failed++; | 963 | data->tx_failed++; |
diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c index 1d4677460711..074f716020aa 100644 --- a/drivers/net/wireless/rtlwifi/base.c +++ b/drivers/net/wireless/rtlwifi/base.c | |||
| @@ -1386,8 +1386,11 @@ u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx) | |||
| 1386 | } | 1386 | } |
| 1387 | 1387 | ||
| 1388 | return true; | 1388 | return true; |
| 1389 | } else if (0x86DD == ether_type) { | 1389 | } else if (ETH_P_IPV6 == ether_type) { |
| 1390 | return true; | 1390 | /* TODO: Handle any IPv6 cases that need special handling. |
| 1391 | * For now, always return false | ||
| 1392 | */ | ||
| 1393 | goto end; | ||
| 1391 | } | 1394 | } |
| 1392 | 1395 | ||
| 1393 | end: | 1396 | end: |
diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c index f38227afe099..3aa8648080c8 100644 --- a/drivers/net/xen-netback/interface.c +++ b/drivers/net/xen-netback/interface.c | |||
| @@ -340,12 +340,11 @@ static void xenvif_get_ethtool_stats(struct net_device *dev, | |||
| 340 | unsigned int num_queues = vif->num_queues; | 340 | unsigned int num_queues = vif->num_queues; |
| 341 | int i; | 341 | int i; |
| 342 | unsigned int queue_index; | 342 | unsigned int queue_index; |
| 343 | struct xenvif_stats *vif_stats; | ||
| 344 | 343 | ||
| 345 | for (i = 0; i < ARRAY_SIZE(xenvif_stats); i++) { | 344 | for (i = 0; i < ARRAY_SIZE(xenvif_stats); i++) { |
| 346 | unsigned long accum = 0; | 345 | unsigned long accum = 0; |
| 347 | for (queue_index = 0; queue_index < num_queues; ++queue_index) { | 346 | for (queue_index = 0; queue_index < num_queues; ++queue_index) { |
| 348 | vif_stats = &vif->queues[queue_index].stats; | 347 | void *vif_stats = &vif->queues[queue_index].stats; |
| 349 | accum += *(unsigned long *)(vif_stats + xenvif_stats[i].offset); | 348 | accum += *(unsigned long *)(vif_stats + xenvif_stats[i].offset); |
| 350 | } | 349 | } |
| 351 | data[i] = accum; | 350 | data[i] = accum; |
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c index f7a31d2cb3f1..997cf0901ac2 100644 --- a/drivers/net/xen-netback/netback.c +++ b/drivers/net/xen-netback/netback.c | |||
| @@ -96,6 +96,7 @@ static void xenvif_idx_release(struct xenvif_queue *queue, u16 pending_idx, | |||
| 96 | static void make_tx_response(struct xenvif_queue *queue, | 96 | static void make_tx_response(struct xenvif_queue *queue, |
| 97 | struct xen_netif_tx_request *txp, | 97 | struct xen_netif_tx_request *txp, |
| 98 | s8 st); | 98 | s8 st); |
| 99 | static void push_tx_responses(struct xenvif_queue *queue); | ||
| 99 | 100 | ||
| 100 | static inline int tx_work_todo(struct xenvif_queue *queue); | 101 | static inline int tx_work_todo(struct xenvif_queue *queue); |
| 101 | 102 | ||
| @@ -657,6 +658,7 @@ static void xenvif_tx_err(struct xenvif_queue *queue, | |||
| 657 | do { | 658 | do { |
| 658 | spin_lock_irqsave(&queue->response_lock, flags); | 659 | spin_lock_irqsave(&queue->response_lock, flags); |
| 659 | make_tx_response(queue, txp, XEN_NETIF_RSP_ERROR); | 660 | make_tx_response(queue, txp, XEN_NETIF_RSP_ERROR); |
| 661 | push_tx_responses(queue); | ||
| 660 | spin_unlock_irqrestore(&queue->response_lock, flags); | 662 | spin_unlock_irqrestore(&queue->response_lock, flags); |
| 661 | if (cons == end) | 663 | if (cons == end) |
| 662 | break; | 664 | break; |
| @@ -1343,7 +1345,7 @@ static int xenvif_handle_frag_list(struct xenvif_queue *queue, struct sk_buff *s | |||
| 1343 | { | 1345 | { |
| 1344 | unsigned int offset = skb_headlen(skb); | 1346 | unsigned int offset = skb_headlen(skb); |
| 1345 | skb_frag_t frags[MAX_SKB_FRAGS]; | 1347 | skb_frag_t frags[MAX_SKB_FRAGS]; |
| 1346 | int i; | 1348 | int i, f; |
| 1347 | struct ubuf_info *uarg; | 1349 | struct ubuf_info *uarg; |
| 1348 | struct sk_buff *nskb = skb_shinfo(skb)->frag_list; | 1350 | struct sk_buff *nskb = skb_shinfo(skb)->frag_list; |
| 1349 | 1351 | ||
| @@ -1383,23 +1385,25 @@ static int xenvif_handle_frag_list(struct xenvif_queue *queue, struct sk_buff *s | |||
| 1383 | frags[i].page_offset = 0; | 1385 | frags[i].page_offset = 0; |
| 1384 | skb_frag_size_set(&frags[i], len); | 1386 | skb_frag_size_set(&frags[i], len); |
| 1385 | } | 1387 | } |
| 1386 | /* swap out with old one */ | ||
| 1387 | memcpy(skb_shinfo(skb)->frags, | ||
| 1388 | frags, | ||
| 1389 | i * sizeof(skb_frag_t)); | ||
| 1390 | skb_shinfo(skb)->nr_frags = i; | ||
| 1391 | skb->truesize += i * PAGE_SIZE; | ||
| 1392 | 1388 | ||
| 1393 | /* remove traces of mapped pages and frag_list */ | 1389 | /* Copied all the bits from the frag list -- free it. */ |
| 1394 | skb_frag_list_init(skb); | 1390 | skb_frag_list_init(skb); |
| 1391 | xenvif_skb_zerocopy_prepare(queue, nskb); | ||
| 1392 | kfree_skb(nskb); | ||
| 1393 | |||
| 1394 | /* Release all the original (foreign) frags. */ | ||
| 1395 | for (f = 0; f < skb_shinfo(skb)->nr_frags; f++) | ||
| 1396 | skb_frag_unref(skb, f); | ||
| 1395 | uarg = skb_shinfo(skb)->destructor_arg; | 1397 | uarg = skb_shinfo(skb)->destructor_arg; |
| 1396 | /* increase inflight counter to offset decrement in callback */ | 1398 | /* increase inflight counter to offset decrement in callback */ |
| 1397 | atomic_inc(&queue->inflight_packets); | 1399 | atomic_inc(&queue->inflight_packets); |
| 1398 | uarg->callback(uarg, true); | 1400 | uarg->callback(uarg, true); |
| 1399 | skb_shinfo(skb)->destructor_arg = NULL; | 1401 | skb_shinfo(skb)->destructor_arg = NULL; |
| 1400 | 1402 | ||
| 1401 | xenvif_skb_zerocopy_prepare(queue, nskb); | 1403 | /* Fill the skb with the new (local) frags. */ |
| 1402 | kfree_skb(nskb); | 1404 | memcpy(skb_shinfo(skb)->frags, frags, i * sizeof(skb_frag_t)); |
| 1405 | skb_shinfo(skb)->nr_frags = i; | ||
| 1406 | skb->truesize += i * PAGE_SIZE; | ||
| 1403 | 1407 | ||
| 1404 | return 0; | 1408 | return 0; |
| 1405 | } | 1409 | } |
| @@ -1652,13 +1656,20 @@ static void xenvif_idx_release(struct xenvif_queue *queue, u16 pending_idx, | |||
| 1652 | unsigned long flags; | 1656 | unsigned long flags; |
| 1653 | 1657 | ||
| 1654 | pending_tx_info = &queue->pending_tx_info[pending_idx]; | 1658 | pending_tx_info = &queue->pending_tx_info[pending_idx]; |
| 1659 | |||
| 1655 | spin_lock_irqsave(&queue->response_lock, flags); | 1660 | spin_lock_irqsave(&queue->response_lock, flags); |
| 1661 | |||
| 1656 | make_tx_response(queue, &pending_tx_info->req, status); | 1662 | make_tx_response(queue, &pending_tx_info->req, status); |
| 1657 | index = pending_index(queue->pending_prod); | 1663 | |
| 1664 | /* Release the pending index before pusing the Tx response so | ||
| 1665 | * its available before a new Tx request is pushed by the | ||
| 1666 | * frontend. | ||
| 1667 | */ | ||
| 1668 | index = pending_index(queue->pending_prod++); | ||
| 1658 | queue->pending_ring[index] = pending_idx; | 1669 | queue->pending_ring[index] = pending_idx; |
| 1659 | /* TX shouldn't use the index before we give it back here */ | 1670 | |
| 1660 | mb(); | 1671 | push_tx_responses(queue); |
| 1661 | queue->pending_prod++; | 1672 | |
| 1662 | spin_unlock_irqrestore(&queue->response_lock, flags); | 1673 | spin_unlock_irqrestore(&queue->response_lock, flags); |
| 1663 | } | 1674 | } |
| 1664 | 1675 | ||
| @@ -1669,7 +1680,6 @@ static void make_tx_response(struct xenvif_queue *queue, | |||
| 1669 | { | 1680 | { |
| 1670 | RING_IDX i = queue->tx.rsp_prod_pvt; | 1681 | RING_IDX i = queue->tx.rsp_prod_pvt; |
| 1671 | struct xen_netif_tx_response *resp; | 1682 | struct xen_netif_tx_response *resp; |
| 1672 | int notify; | ||
| 1673 | 1683 | ||
| 1674 | resp = RING_GET_RESPONSE(&queue->tx, i); | 1684 | resp = RING_GET_RESPONSE(&queue->tx, i); |
| 1675 | resp->id = txp->id; | 1685 | resp->id = txp->id; |
| @@ -1679,6 +1689,12 @@ static void make_tx_response(struct xenvif_queue *queue, | |||
| 1679 | RING_GET_RESPONSE(&queue->tx, ++i)->status = XEN_NETIF_RSP_NULL; | 1689 | RING_GET_RESPONSE(&queue->tx, ++i)->status = XEN_NETIF_RSP_NULL; |
| 1680 | 1690 | ||
| 1681 | queue->tx.rsp_prod_pvt = ++i; | 1691 | queue->tx.rsp_prod_pvt = ++i; |
| 1692 | } | ||
| 1693 | |||
| 1694 | static void push_tx_responses(struct xenvif_queue *queue) | ||
| 1695 | { | ||
| 1696 | int notify; | ||
| 1697 | |||
| 1682 | RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&queue->tx, notify); | 1698 | RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&queue->tx, notify); |
| 1683 | if (notify) | 1699 | if (notify) |
| 1684 | notify_remote_via_irq(queue->tx_irq); | 1700 | notify_remote_via_irq(queue->tx_irq); |
