| .. | .. |
|---|
| 891 | 891 | struct fw_header { |
|---|
| 892 | 892 | u8 checksum[32]; |
|---|
| 893 | 893 | char version[RTL_VER_SIZE]; |
|---|
| 894 | | - struct fw_block blocks[0]; |
|---|
| 894 | + struct fw_block blocks[]; |
|---|
| 895 | 895 | } __packed; |
|---|
| 896 | 896 | |
|---|
| 897 | 897 | /** |
|---|
| .. | .. |
|---|
| 930 | 930 | __le32 reserved; |
|---|
| 931 | 931 | __le16 fw_ver_reg; |
|---|
| 932 | 932 | u8 fw_ver_data; |
|---|
| 933 | | - char info[0]; |
|---|
| 933 | + char info[]; |
|---|
| 934 | 934 | } __packed; |
|---|
| 935 | 935 | |
|---|
| 936 | 936 | /** |
|---|
| .. | .. |
|---|
| 982 | 982 | __le16 bp_start; |
|---|
| 983 | 983 | __le16 bp_num; |
|---|
| 984 | 984 | __le16 bp[4]; |
|---|
| 985 | | - char info[0]; |
|---|
| 985 | + char info[]; |
|---|
| 986 | 986 | } __packed; |
|---|
| 987 | 987 | |
|---|
| 988 | 988 | enum rtl_fw_type { |
|---|
| .. | .. |
|---|
| 1504 | 1504 | |
|---|
| 1505 | 1505 | sa->sa_family = dev->type; |
|---|
| 1506 | 1506 | |
|---|
| 1507 | | - if (tp->version == RTL_VER_01) { |
|---|
| 1508 | | - ret = pla_ocp_read(tp, PLA_IDR, 8, sa->sa_data); |
|---|
| 1509 | | - } else { |
|---|
| 1510 | | - /* if device doesn't support MAC pass through this will |
|---|
| 1511 | | - * be expected to be non-zero |
|---|
| 1512 | | - */ |
|---|
| 1513 | | - ret = vendor_mac_passthru_addr_read(tp, sa); |
|---|
| 1514 | | - if (ret < 0) |
|---|
| 1515 | | - ret = pla_ocp_read(tp, PLA_BACKUP, 8, sa->sa_data); |
|---|
| 1507 | + ret = eth_platform_get_mac_address(&tp->udev->dev, sa->sa_data); |
|---|
| 1508 | + if (ret < 0) { |
|---|
| 1509 | + if (tp->version == RTL_VER_01) { |
|---|
| 1510 | + ret = pla_ocp_read(tp, PLA_IDR, 8, sa->sa_data); |
|---|
| 1511 | + } else { |
|---|
| 1512 | + /* if device doesn't support MAC pass through this will |
|---|
| 1513 | + * be expected to be non-zero |
|---|
| 1514 | + */ |
|---|
| 1515 | + ret = vendor_mac_passthru_addr_read(tp, sa); |
|---|
| 1516 | + if (ret < 0) |
|---|
| 1517 | + ret = pla_ocp_read(tp, PLA_BACKUP, 8, |
|---|
| 1518 | + sa->sa_data); |
|---|
| 1519 | + } |
|---|
| 1516 | 1520 | } |
|---|
| 1517 | 1521 | |
|---|
| 1518 | 1522 | if (ret < 0) { |
|---|
| .. | .. |
|---|
| 1678 | 1682 | case -ECONNRESET: /* unlink */ |
|---|
| 1679 | 1683 | case -ESHUTDOWN: |
|---|
| 1680 | 1684 | netif_device_detach(tp->netdev); |
|---|
| 1681 | | - /* fall through */ |
|---|
| 1685 | + fallthrough; |
|---|
| 1682 | 1686 | case -ENOENT: |
|---|
| 1683 | 1687 | case -EPROTO: |
|---|
| 1684 | 1688 | netif_info(tp, intr, tp->netdev, |
|---|
| 1685 | 1689 | "Stop submitting intr, status %d\n", status); |
|---|
| 1686 | 1690 | return; |
|---|
| 1687 | 1691 | case -EOVERFLOW: |
|---|
| 1688 | | - netif_info(tp, intr, tp->netdev, "intr status -EOVERFLOW\n"); |
|---|
| 1692 | + if (net_ratelimit()) |
|---|
| 1693 | + netif_info(tp, intr, tp->netdev, |
|---|
| 1694 | + "intr status -EOVERFLOW\n"); |
|---|
| 1689 | 1695 | goto resubmit; |
|---|
| 1690 | 1696 | /* -EPIPE: should clear the halt */ |
|---|
| 1691 | 1697 | default: |
|---|
| .. | .. |
|---|
| 1916 | 1922 | { |
|---|
| 1917 | 1923 | if (skb_shinfo(skb)->gso_size) { |
|---|
| 1918 | 1924 | netdev_features_t features = tp->netdev->features; |
|---|
| 1925 | + struct sk_buff *segs, *seg, *next; |
|---|
| 1919 | 1926 | struct sk_buff_head seg_list; |
|---|
| 1920 | | - struct sk_buff *segs, *nskb; |
|---|
| 1921 | 1927 | |
|---|
| 1922 | 1928 | features &= ~(NETIF_F_SG | NETIF_F_IPV6_CSUM | NETIF_F_TSO6); |
|---|
| 1923 | 1929 | segs = skb_gso_segment(skb, features); |
|---|
| .. | .. |
|---|
| 1926 | 1932 | |
|---|
| 1927 | 1933 | __skb_queue_head_init(&seg_list); |
|---|
| 1928 | 1934 | |
|---|
| 1929 | | - do { |
|---|
| 1930 | | - nskb = segs; |
|---|
| 1931 | | - segs = segs->next; |
|---|
| 1932 | | - nskb->next = NULL; |
|---|
| 1933 | | - __skb_queue_tail(&seg_list, nskb); |
|---|
| 1934 | | - } while (segs); |
|---|
| 1935 | + skb_list_walk_safe(segs, seg, next) { |
|---|
| 1936 | + skb_mark_not_on_list(seg); |
|---|
| 1937 | + __skb_queue_tail(&seg_list, seg); |
|---|
| 1938 | + } |
|---|
| 1935 | 1939 | |
|---|
| 1936 | 1940 | skb_queue_splice(&seg_list, list); |
|---|
| 1937 | 1941 | dev_kfree_skb(skb); |
|---|
| .. | .. |
|---|
| 1948 | 1952 | stats->tx_dropped++; |
|---|
| 1949 | 1953 | dev_kfree_skb(skb); |
|---|
| 1950 | 1954 | } |
|---|
| 1951 | | -} |
|---|
| 1952 | | - |
|---|
| 1953 | | -/* msdn_giant_send_check() |
|---|
| 1954 | | - * According to the document of microsoft, the TCP Pseudo Header excludes the |
|---|
| 1955 | | - * packet length for IPv6 TCP large packets. |
|---|
| 1956 | | - */ |
|---|
| 1957 | | -static int msdn_giant_send_check(struct sk_buff *skb) |
|---|
| 1958 | | -{ |
|---|
| 1959 | | - const struct ipv6hdr *ipv6h; |
|---|
| 1960 | | - struct tcphdr *th; |
|---|
| 1961 | | - int ret; |
|---|
| 1962 | | - |
|---|
| 1963 | | - ret = skb_cow_head(skb, 0); |
|---|
| 1964 | | - if (ret) |
|---|
| 1965 | | - return ret; |
|---|
| 1966 | | - |
|---|
| 1967 | | - ipv6h = ipv6_hdr(skb); |
|---|
| 1968 | | - th = tcp_hdr(skb); |
|---|
| 1969 | | - |
|---|
| 1970 | | - th->check = 0; |
|---|
| 1971 | | - th->check = ~tcp_v6_check(0, &ipv6h->saddr, &ipv6h->daddr, 0); |
|---|
| 1972 | | - |
|---|
| 1973 | | - return ret; |
|---|
| 1974 | 1955 | } |
|---|
| 1975 | 1956 | |
|---|
| 1976 | 1957 | static inline void rtl_tx_vlan_tag(struct tx_desc *desc, struct sk_buff *skb) |
|---|
| .. | .. |
|---|
| 2018 | 1999 | break; |
|---|
| 2019 | 2000 | |
|---|
| 2020 | 2001 | case htons(ETH_P_IPV6): |
|---|
| 2021 | | - if (msdn_giant_send_check(skb)) { |
|---|
| 2002 | + if (skb_cow_head(skb, 0)) { |
|---|
| 2022 | 2003 | ret = TX_CSUM_TSO; |
|---|
| 2023 | 2004 | goto unavailable; |
|---|
| 2024 | 2005 | } |
|---|
| 2006 | + tcp_v6_gso_csum_prep(skb); |
|---|
| 2025 | 2007 | opts1 |= GTSENDV6; |
|---|
| 2026 | 2008 | break; |
|---|
| 2027 | 2009 | |
|---|
| .. | .. |
|---|
| 2526 | 2508 | } |
|---|
| 2527 | 2509 | } |
|---|
| 2528 | 2510 | |
|---|
| 2529 | | -static void rtl8152_tx_timeout(struct net_device *netdev) |
|---|
| 2511 | +static void rtl8152_tx_timeout(struct net_device *netdev, unsigned int txqueue) |
|---|
| 2530 | 2512 | { |
|---|
| 2531 | 2513 | struct r8152 *tp = netdev_priv(netdev); |
|---|
| 2532 | 2514 | |
|---|
| .. | .. |
|---|
| 3248 | 3230 | r8152_mdio_write(tp, MII_BMCR, data); |
|---|
| 3249 | 3231 | |
|---|
| 3250 | 3232 | data = r8153_phy_status(tp, PHY_STAT_LAN_ON); |
|---|
| 3251 | | - /* fall through */ |
|---|
| 3233 | + fallthrough; |
|---|
| 3252 | 3234 | |
|---|
| 3253 | 3235 | default: |
|---|
| 3254 | 3236 | if (data != PHY_STAT_LAN_ON) |
|---|
| .. | .. |
|---|
| 3452 | 3434 | case RTL_VER_09: |
|---|
| 3453 | 3435 | default: |
|---|
| 3454 | 3436 | if (type == MCU_TYPE_USB) { |
|---|
| 3455 | | - ocp_write_byte(tp, MCU_TYPE_USB, USB_BP2_EN, 0); |
|---|
| 3437 | + ocp_write_word(tp, MCU_TYPE_USB, USB_BP2_EN, 0); |
|---|
| 3456 | 3438 | |
|---|
| 3457 | 3439 | ocp_write_word(tp, MCU_TYPE_USB, USB_BP_8, 0); |
|---|
| 3458 | 3440 | ocp_write_word(tp, MCU_TYPE_USB, USB_BP_9, 0); |
|---|
| .. | .. |
|---|
| 4841 | 4823 | tp->ups_info.speed_duplex = NWAY_1000M_FULL; |
|---|
| 4842 | 4824 | break; |
|---|
| 4843 | 4825 | } |
|---|
| 4844 | | - /* fall through */ |
|---|
| 4826 | + fallthrough; |
|---|
| 4845 | 4827 | default: |
|---|
| 4846 | 4828 | ret = -EINVAL; |
|---|
| 4847 | 4829 | goto out; |
|---|
| .. | .. |
|---|
| 5634 | 5616 | /* reset the MAC adddress in case of policy change */ |
|---|
| 5635 | 5617 | if (determine_ethernet_addr(tp, &sa) >= 0) { |
|---|
| 5636 | 5618 | rtnl_lock(); |
|---|
| 5637 | | - dev_set_mac_address (tp->netdev, &sa); |
|---|
| 5619 | + dev_set_mac_address (tp->netdev, &sa, NULL); |
|---|
| 5638 | 5620 | rtnl_unlock(); |
|---|
| 5639 | 5621 | } |
|---|
| 5640 | 5622 | |
|---|
| .. | .. |
|---|
| 6355 | 6337 | } |
|---|
| 6356 | 6338 | |
|---|
| 6357 | 6339 | static const struct ethtool_ops ops = { |
|---|
| 6340 | + .supported_coalesce_params = ETHTOOL_COALESCE_USECS, |
|---|
| 6358 | 6341 | .get_drvinfo = rtl8152_get_drvinfo, |
|---|
| 6359 | 6342 | .get_link = ethtool_op_get_link, |
|---|
| 6360 | 6343 | .nway_reset = rtl8152_nway_reset, |
|---|
| .. | .. |
|---|
| 6539 | 6522 | ops->in_nway = rtl8153_in_nway; |
|---|
| 6540 | 6523 | ops->hw_phy_cfg = r8153_hw_phy_cfg; |
|---|
| 6541 | 6524 | ops->autosuspend_en = rtl8153_runtime_enable; |
|---|
| 6542 | | - tp->rx_buf_sz = 32 * 1024; |
|---|
| 6525 | + if (tp->udev->speed < USB_SPEED_SUPER) |
|---|
| 6526 | + tp->rx_buf_sz = 16 * 1024; |
|---|
| 6527 | + else |
|---|
| 6528 | + tp->rx_buf_sz = 32 * 1024; |
|---|
| 6543 | 6529 | tp->eee_en = true; |
|---|
| 6544 | 6530 | tp->eee_adv = MDIO_EEE_1000T | MDIO_EEE_100TX; |
|---|
| 6545 | 6531 | break; |
|---|
| .. | .. |
|---|
| 6884 | 6870 | {REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x0927)}, |
|---|
| 6885 | 6871 | {REALTEK_USB_DEVICE(VENDOR_ID_SAMSUNG, 0xa101)}, |
|---|
| 6886 | 6872 | {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x304f)}, |
|---|
| 6873 | + {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3054)}, |
|---|
| 6887 | 6874 | {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3062)}, |
|---|
| 6888 | 6875 | {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3069)}, |
|---|
| 6889 | 6876 | {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3082)}, |
|---|