aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/ethernet/atheros/atl1c/atl1c_main.c71
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c12
-rw-r--r--drivers/net/ethernet/cadence/macb.c5
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c1
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c7
-rw-r--r--drivers/net/ethernet/realtek/r8169.c86
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c2
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c10
-rw-r--r--drivers/net/usb/qmi_wwan.c1
-rw-r--r--drivers/net/wireless/mwl8k.c36
-rw-r--r--net/batman-adv/distributed-arp-table.c2
-rw-r--r--net/bridge/br_stp_bpdu.c2
-rw-r--r--net/core/datagram.c2
-rw-r--r--net/ipv4/arp.c21
-rw-r--r--net/ipv6/netfilter/ip6t_NPT.c18
-rw-r--r--net/mac80211/cfg.c3
-rw-r--r--net/mac80211/mlme.c11
-rw-r--r--net/netfilter/ipvs/ip_vs_proto_sctp.c35
-rw-r--r--net/netfilter/ipvs/ip_vs_sync.c2
-rw-r--r--net/sched/sch_htb.c4
-rw-r--r--net/sctp/Kconfig4
-rw-r--r--net/sctp/ipv6.c5
22 files changed, 191 insertions, 149 deletions
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
index 56d3f697e0c7..0035c01660b6 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
@@ -21,7 +21,7 @@
21 21
22#include "atl1c.h" 22#include "atl1c.h"
23 23
24#define ATL1C_DRV_VERSION "1.0.1.0-NAPI" 24#define ATL1C_DRV_VERSION "1.0.1.1-NAPI"
25char atl1c_driver_name[] = "atl1c"; 25char atl1c_driver_name[] = "atl1c";
26char atl1c_driver_version[] = ATL1C_DRV_VERSION; 26char atl1c_driver_version[] = ATL1C_DRV_VERSION;
27 27
@@ -1652,6 +1652,7 @@ static int atl1c_alloc_rx_buffer(struct atl1c_adapter *adapter)
1652 u16 num_alloc = 0; 1652 u16 num_alloc = 0;
1653 u16 rfd_next_to_use, next_next; 1653 u16 rfd_next_to_use, next_next;
1654 struct atl1c_rx_free_desc *rfd_desc; 1654 struct atl1c_rx_free_desc *rfd_desc;
1655 dma_addr_t mapping;
1655 1656
1656 next_next = rfd_next_to_use = rfd_ring->next_to_use; 1657 next_next = rfd_next_to_use = rfd_ring->next_to_use;
1657 if (++next_next == rfd_ring->count) 1658 if (++next_next == rfd_ring->count)
@@ -1678,9 +1679,18 @@ static int atl1c_alloc_rx_buffer(struct atl1c_adapter *adapter)
1678 ATL1C_SET_BUFFER_STATE(buffer_info, ATL1C_BUFFER_BUSY); 1679 ATL1C_SET_BUFFER_STATE(buffer_info, ATL1C_BUFFER_BUSY);
1679 buffer_info->skb = skb; 1680 buffer_info->skb = skb;
1680 buffer_info->length = adapter->rx_buffer_len; 1681 buffer_info->length = adapter->rx_buffer_len;
1681 buffer_info->dma = pci_map_single(pdev, vir_addr, 1682 mapping = pci_map_single(pdev, vir_addr,
1682 buffer_info->length, 1683 buffer_info->length,
1683 PCI_DMA_FROMDEVICE); 1684 PCI_DMA_FROMDEVICE);
1685 if (unlikely(pci_dma_mapping_error(pdev, mapping))) {
1686 dev_kfree_skb(skb);
1687 buffer_info->skb = NULL;
1688 buffer_info->length = 0;
1689 ATL1C_SET_BUFFER_STATE(buffer_info, ATL1C_BUFFER_FREE);
1690 netif_warn(adapter, rx_err, adapter->netdev, "RX pci_map_single failed");
1691 break;
1692 }
1693 buffer_info->dma = mapping;
1684 ATL1C_SET_PCIMAP_TYPE(buffer_info, ATL1C_PCIMAP_SINGLE, 1694 ATL1C_SET_PCIMAP_TYPE(buffer_info, ATL1C_PCIMAP_SINGLE,
1685 ATL1C_PCIMAP_FROMDEVICE); 1695 ATL1C_PCIMAP_FROMDEVICE);
1686 rfd_desc->buffer_addr = cpu_to_le64(buffer_info->dma); 1696 rfd_desc->buffer_addr = cpu_to_le64(buffer_info->dma);
@@ -2015,7 +2025,29 @@ check_sum:
2015 return 0; 2025 return 0;
2016} 2026}
2017 2027
2018static void atl1c_tx_map(struct atl1c_adapter *adapter, 2028static void atl1c_tx_rollback(struct atl1c_adapter *adpt,
2029 struct atl1c_tpd_desc *first_tpd,
2030 enum atl1c_trans_queue type)
2031{
2032 struct atl1c_tpd_ring *tpd_ring = &adpt->tpd_ring[type];
2033 struct atl1c_buffer *buffer_info;
2034 struct atl1c_tpd_desc *tpd;
2035 u16 first_index, index;
2036
2037 first_index = first_tpd - (struct atl1c_tpd_desc *)tpd_ring->desc;
2038 index = first_index;
2039 while (index != tpd_ring->next_to_use) {
2040 tpd = ATL1C_TPD_DESC(tpd_ring, index);
2041 buffer_info = &tpd_ring->buffer_info[index];
2042 atl1c_clean_buffer(adpt->pdev, buffer_info, 0);
2043 memset(tpd, 0, sizeof(struct atl1c_tpd_desc));
2044 if (++index == tpd_ring->count)
2045 index = 0;
2046 }
2047 tpd_ring->next_to_use = first_index;
2048}
2049
2050static int atl1c_tx_map(struct atl1c_adapter *adapter,
2019 struct sk_buff *skb, struct atl1c_tpd_desc *tpd, 2051 struct sk_buff *skb, struct atl1c_tpd_desc *tpd,
2020 enum atl1c_trans_queue type) 2052 enum atl1c_trans_queue type)
2021{ 2053{
@@ -2040,7 +2072,10 @@ static void atl1c_tx_map(struct atl1c_adapter *adapter,
2040 buffer_info->length = map_len; 2072 buffer_info->length = map_len;
2041 buffer_info->dma = pci_map_single(adapter->pdev, 2073 buffer_info->dma = pci_map_single(adapter->pdev,
2042 skb->data, hdr_len, PCI_DMA_TODEVICE); 2074 skb->data, hdr_len, PCI_DMA_TODEVICE);
2043 ATL1C_SET_BUFFER_STATE(buffer_info, ATL1C_BUFFER_BUSY); 2075 if (unlikely(pci_dma_mapping_error(adapter->pdev,
2076 buffer_info->dma)))
2077 goto err_dma;
2078
2044 ATL1C_SET_PCIMAP_TYPE(buffer_info, ATL1C_PCIMAP_SINGLE, 2079 ATL1C_SET_PCIMAP_TYPE(buffer_info, ATL1C_PCIMAP_SINGLE,
2045 ATL1C_PCIMAP_TODEVICE); 2080 ATL1C_PCIMAP_TODEVICE);
2046 mapped_len += map_len; 2081 mapped_len += map_len;
@@ -2062,6 +2097,10 @@ static void atl1c_tx_map(struct atl1c_adapter *adapter,
2062 buffer_info->dma = 2097 buffer_info->dma =
2063 pci_map_single(adapter->pdev, skb->data + mapped_len, 2098 pci_map_single(adapter->pdev, skb->data + mapped_len,
2064 buffer_info->length, PCI_DMA_TODEVICE); 2099 buffer_info->length, PCI_DMA_TODEVICE);
2100 if (unlikely(pci_dma_mapping_error(adapter->pdev,
2101 buffer_info->dma)))
2102 goto err_dma;
2103
2065 ATL1C_SET_BUFFER_STATE(buffer_info, ATL1C_BUFFER_BUSY); 2104 ATL1C_SET_BUFFER_STATE(buffer_info, ATL1C_BUFFER_BUSY);
2066 ATL1C_SET_PCIMAP_TYPE(buffer_info, ATL1C_PCIMAP_SINGLE, 2105 ATL1C_SET_PCIMAP_TYPE(buffer_info, ATL1C_PCIMAP_SINGLE,
2067 ATL1C_PCIMAP_TODEVICE); 2106 ATL1C_PCIMAP_TODEVICE);
@@ -2083,6 +2122,9 @@ static void atl1c_tx_map(struct atl1c_adapter *adapter,
2083 frag, 0, 2122 frag, 0,
2084 buffer_info->length, 2123 buffer_info->length,
2085 DMA_TO_DEVICE); 2124 DMA_TO_DEVICE);
2125 if (dma_mapping_error(&adapter->pdev->dev, buffer_info->dma))
2126 goto err_dma;
2127
2086 ATL1C_SET_BUFFER_STATE(buffer_info, ATL1C_BUFFER_BUSY); 2128 ATL1C_SET_BUFFER_STATE(buffer_info, ATL1C_BUFFER_BUSY);
2087 ATL1C_SET_PCIMAP_TYPE(buffer_info, ATL1C_PCIMAP_PAGE, 2129 ATL1C_SET_PCIMAP_TYPE(buffer_info, ATL1C_PCIMAP_PAGE,
2088 ATL1C_PCIMAP_TODEVICE); 2130 ATL1C_PCIMAP_TODEVICE);
@@ -2095,6 +2137,13 @@ static void atl1c_tx_map(struct atl1c_adapter *adapter,
2095 /* The last buffer info contain the skb address, 2137 /* The last buffer info contain the skb address,
2096 so it will be free after unmap */ 2138 so it will be free after unmap */
2097 buffer_info->skb = skb; 2139 buffer_info->skb = skb;
2140
2141 return 0;
2142
2143err_dma:
2144 buffer_info->dma = 0;
2145 buffer_info->length = 0;
2146 return -1;
2098} 2147}
2099 2148
2100static void atl1c_tx_queue(struct atl1c_adapter *adapter, struct sk_buff *skb, 2149static void atl1c_tx_queue(struct atl1c_adapter *adapter, struct sk_buff *skb,
@@ -2157,10 +2206,18 @@ static netdev_tx_t atl1c_xmit_frame(struct sk_buff *skb,
2157 if (skb_network_offset(skb) != ETH_HLEN) 2206 if (skb_network_offset(skb) != ETH_HLEN)
2158 tpd->word1 |= 1 << TPD_ETH_TYPE_SHIFT; /* Ethernet frame */ 2207 tpd->word1 |= 1 << TPD_ETH_TYPE_SHIFT; /* Ethernet frame */
2159 2208
2160 atl1c_tx_map(adapter, skb, tpd, type); 2209 if (atl1c_tx_map(adapter, skb, tpd, type) < 0) {
2161 atl1c_tx_queue(adapter, skb, tpd, type); 2210 netif_info(adapter, tx_done, adapter->netdev,
2211 "tx-skb droppted due to dma error\n");
2212 /* roll back tpd/buffer */
2213 atl1c_tx_rollback(adapter, tpd, type);
2214 spin_unlock_irqrestore(&adapter->tx_lock, flags);
2215 dev_kfree_skb(skb);
2216 } else {
2217 atl1c_tx_queue(adapter, skb, tpd, type);
2218 spin_unlock_irqrestore(&adapter->tx_lock, flags);
2219 }
2162 2220
2163 spin_unlock_irqrestore(&adapter->tx_lock, flags);
2164 return NETDEV_TX_OK; 2221 return NETDEV_TX_OK;
2165} 2222}
2166 2223
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index f771ddfba646..a5edac8df67b 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -504,13 +504,11 @@ static int bnx2x_fill_frag_skb(struct bnx2x *bp, struct bnx2x_fastpath *fp,
504 skb_shinfo(skb)->gso_size = bnx2x_set_lro_mss(bp, 504 skb_shinfo(skb)->gso_size = bnx2x_set_lro_mss(bp,
505 tpa_info->parsing_flags, len_on_bd); 505 tpa_info->parsing_flags, len_on_bd);
506 506
507 /* set for GRO */ 507 skb_shinfo(skb)->gso_type =
508 if (fp->mode == TPA_MODE_GRO) 508 (GET_FLAG(tpa_info->parsing_flags,
509 skb_shinfo(skb)->gso_type = 509 PARSING_FLAGS_OVER_ETHERNET_PROTOCOL) ==
510 (GET_FLAG(tpa_info->parsing_flags, 510 PRS_FLAG_OVERETH_IPV6) ?
511 PARSING_FLAGS_OVER_ETHERNET_PROTOCOL) == 511 SKB_GSO_TCPV6 : SKB_GSO_TCPV4;
512 PRS_FLAG_OVERETH_IPV6) ?
513 SKB_GSO_TCPV6 : SKB_GSO_TCPV4;
514 } 512 }
515 513
516 514
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index a9b0830fb39d..b9d4bb9530e5 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -693,6 +693,11 @@ static int macb_poll(struct napi_struct *napi, int budget)
693 * get notified when new packets arrive. 693 * get notified when new packets arrive.
694 */ 694 */
695 macb_writel(bp, IER, MACB_RX_INT_FLAGS); 695 macb_writel(bp, IER, MACB_RX_INT_FLAGS);
696
697 /* Packets received while interrupts were disabled */
698 status = macb_readl(bp, RSR);
699 if (unlikely(status))
700 napi_reschedule(napi);
696 } 701 }
697 702
698 /* TODO: Handle errors */ 703 /* TODO: Handle errors */
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 20a5af6d87d0..b3e3294cfe53 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -1401,6 +1401,7 @@ static void ixgbe_set_rsc_gso_size(struct ixgbe_ring *ring,
1401 /* set gso_size to avoid messing up TCP MSS */ 1401 /* set gso_size to avoid messing up TCP MSS */
1402 skb_shinfo(skb)->gso_size = DIV_ROUND_UP((skb->len - hdr_len), 1402 skb_shinfo(skb)->gso_size = DIV_ROUND_UP((skb->len - hdr_len),
1403 IXGBE_CB(skb)->append_cnt); 1403 IXGBE_CB(skb)->append_cnt);
1404 skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
1404} 1405}
1405 1406
1406static void ixgbe_update_rsc_stats(struct ixgbe_ring *rx_ring, 1407static void ixgbe_update_rsc_stats(struct ixgbe_ring *rx_ring,
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
index 6f82812d0fab..09aa310b6194 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
@@ -986,8 +986,13 @@ qlcnic_process_lro(struct qlcnic_adapter *adapter,
986 th->seq = htonl(seq_number); 986 th->seq = htonl(seq_number);
987 length = skb->len; 987 length = skb->len;
988 988
989 if (adapter->flags & QLCNIC_FW_LRO_MSS_CAP) 989 if (adapter->flags & QLCNIC_FW_LRO_MSS_CAP) {
990 skb_shinfo(skb)->gso_size = qlcnic_get_lro_sts_mss(sts_data1); 990 skb_shinfo(skb)->gso_size = qlcnic_get_lro_sts_mss(sts_data1);
991 if (skb->protocol == htons(ETH_P_IPV6))
992 skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
993 else
994 skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
995 }
991 996
992 if (vid != 0xffff) 997 if (vid != 0xffff)
993 __vlan_hwaccel_put_tag(skb, vid); 998 __vlan_hwaccel_put_tag(skb, vid);
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 11702324a071..998974f78742 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -450,7 +450,6 @@ enum rtl8168_registers {
450#define PWM_EN (1 << 22) 450#define PWM_EN (1 << 22)
451#define RXDV_GATED_EN (1 << 19) 451#define RXDV_GATED_EN (1 << 19)
452#define EARLY_TALLY_EN (1 << 16) 452#define EARLY_TALLY_EN (1 << 16)
453#define FORCE_CLK (1 << 15) /* force clock request */
454}; 453};
455 454
456enum rtl_register_content { 455enum rtl_register_content {
@@ -514,7 +513,6 @@ enum rtl_register_content {
514 PMEnable = (1 << 0), /* Power Management Enable */ 513 PMEnable = (1 << 0), /* Power Management Enable */
515 514
516 /* Config2 register p. 25 */ 515 /* Config2 register p. 25 */
517 ClkReqEn = (1 << 7), /* Clock Request Enable */
518 MSIEnable = (1 << 5), /* 8169 only. Reserved in the 8168. */ 516 MSIEnable = (1 << 5), /* 8169 only. Reserved in the 8168. */
519 PCI_Clock_66MHz = 0x01, 517 PCI_Clock_66MHz = 0x01,
520 PCI_Clock_33MHz = 0x00, 518 PCI_Clock_33MHz = 0x00,
@@ -535,7 +533,6 @@ enum rtl_register_content {
535 Spi_en = (1 << 3), 533 Spi_en = (1 << 3),
536 LanWake = (1 << 1), /* LanWake enable/disable */ 534 LanWake = (1 << 1), /* LanWake enable/disable */
537 PMEStatus = (1 << 0), /* PME status can be reset by PCI RST# */ 535 PMEStatus = (1 << 0), /* PME status can be reset by PCI RST# */
538 ASPM_en = (1 << 0), /* ASPM enable */
539 536
540 /* TBICSR p.28 */ 537 /* TBICSR p.28 */
541 TBIReset = 0x80000000, 538 TBIReset = 0x80000000,
@@ -684,7 +681,6 @@ enum features {
684 RTL_FEATURE_WOL = (1 << 0), 681 RTL_FEATURE_WOL = (1 << 0),
685 RTL_FEATURE_MSI = (1 << 1), 682 RTL_FEATURE_MSI = (1 << 1),
686 RTL_FEATURE_GMII = (1 << 2), 683 RTL_FEATURE_GMII = (1 << 2),
687 RTL_FEATURE_FW_LOADED = (1 << 3),
688}; 684};
689 685
690struct rtl8169_counters { 686struct rtl8169_counters {
@@ -2389,10 +2385,8 @@ static void rtl_apply_firmware(struct rtl8169_private *tp)
2389 struct rtl_fw *rtl_fw = tp->rtl_fw; 2385 struct rtl_fw *rtl_fw = tp->rtl_fw;
2390 2386
2391 /* TODO: release firmware once rtl_phy_write_fw signals failures. */ 2387 /* TODO: release firmware once rtl_phy_write_fw signals failures. */
2392 if (!IS_ERR_OR_NULL(rtl_fw)) { 2388 if (!IS_ERR_OR_NULL(rtl_fw))
2393 rtl_phy_write_fw(tp, rtl_fw); 2389 rtl_phy_write_fw(tp, rtl_fw);
2394 tp->features |= RTL_FEATURE_FW_LOADED;
2395 }
2396} 2390}
2397 2391
2398static void rtl_apply_firmware_cond(struct rtl8169_private *tp, u8 reg, u16 val) 2392static void rtl_apply_firmware_cond(struct rtl8169_private *tp, u8 reg, u16 val)
@@ -2403,31 +2397,6 @@ static void rtl_apply_firmware_cond(struct rtl8169_private *tp, u8 reg, u16 val)
2403 rtl_apply_firmware(tp); 2397 rtl_apply_firmware(tp);
2404} 2398}
2405 2399
2406static void r810x_aldps_disable(struct rtl8169_private *tp)
2407{
2408 rtl_writephy(tp, 0x1f, 0x0000);
2409 rtl_writephy(tp, 0x18, 0x0310);
2410 msleep(100);
2411}
2412
2413static void r810x_aldps_enable(struct rtl8169_private *tp)
2414{
2415 if (!(tp->features & RTL_FEATURE_FW_LOADED))
2416 return;
2417
2418 rtl_writephy(tp, 0x1f, 0x0000);
2419 rtl_writephy(tp, 0x18, 0x8310);
2420}
2421
2422static void r8168_aldps_enable_1(struct rtl8169_private *tp)
2423{
2424 if (!(tp->features & RTL_FEATURE_FW_LOADED))
2425 return;
2426
2427 rtl_writephy(tp, 0x1f, 0x0000);
2428 rtl_w1w0_phy(tp, 0x15, 0x1000, 0x0000);
2429}
2430
2431static void rtl8169s_hw_phy_config(struct rtl8169_private *tp) 2400static void rtl8169s_hw_phy_config(struct rtl8169_private *tp)
2432{ 2401{
2433 static const struct phy_reg phy_reg_init[] = { 2402 static const struct phy_reg phy_reg_init[] = {
@@ -3218,8 +3187,6 @@ static void rtl8168e_2_hw_phy_config(struct rtl8169_private *tp)
3218 rtl_w1w0_phy(tp, 0x10, 0x0000, 0x0400); 3187 rtl_w1w0_phy(tp, 0x10, 0x0000, 0x0400);
3219 rtl_writephy(tp, 0x1f, 0x0000); 3188 rtl_writephy(tp, 0x1f, 0x0000);
3220 3189
3221 r8168_aldps_enable_1(tp);
3222
3223 /* Broken BIOS workaround: feed GigaMAC registers with MAC address. */ 3190 /* Broken BIOS workaround: feed GigaMAC registers with MAC address. */
3224 rtl_rar_exgmac_set(tp, tp->dev->dev_addr); 3191 rtl_rar_exgmac_set(tp, tp->dev->dev_addr);
3225} 3192}
@@ -3294,8 +3261,6 @@ static void rtl8168f_1_hw_phy_config(struct rtl8169_private *tp)
3294 rtl_writephy(tp, 0x05, 0x8b85); 3261 rtl_writephy(tp, 0x05, 0x8b85);
3295 rtl_w1w0_phy(tp, 0x06, 0x4000, 0x0000); 3262 rtl_w1w0_phy(tp, 0x06, 0x4000, 0x0000);
3296 rtl_writephy(tp, 0x1f, 0x0000); 3263 rtl_writephy(tp, 0x1f, 0x0000);
3297
3298 r8168_aldps_enable_1(tp);
3299} 3264}
3300 3265
3301static void rtl8168f_2_hw_phy_config(struct rtl8169_private *tp) 3266static void rtl8168f_2_hw_phy_config(struct rtl8169_private *tp)
@@ -3303,8 +3268,6 @@ static void rtl8168f_2_hw_phy_config(struct rtl8169_private *tp)
3303 rtl_apply_firmware(tp); 3268 rtl_apply_firmware(tp);
3304 3269
3305 rtl8168f_hw_phy_config(tp); 3270 rtl8168f_hw_phy_config(tp);
3306
3307 r8168_aldps_enable_1(tp);
3308} 3271}
3309 3272
3310static void rtl8411_hw_phy_config(struct rtl8169_private *tp) 3273static void rtl8411_hw_phy_config(struct rtl8169_private *tp)
@@ -3402,8 +3365,6 @@ static void rtl8411_hw_phy_config(struct rtl8169_private *tp)
3402 rtl_w1w0_phy(tp, 0x19, 0x0000, 0x0001); 3365 rtl_w1w0_phy(tp, 0x19, 0x0000, 0x0001);
3403 rtl_w1w0_phy(tp, 0x10, 0x0000, 0x0400); 3366 rtl_w1w0_phy(tp, 0x10, 0x0000, 0x0400);
3404 rtl_writephy(tp, 0x1f, 0x0000); 3367 rtl_writephy(tp, 0x1f, 0x0000);
3405
3406 r8168_aldps_enable_1(tp);
3407} 3368}
3408 3369
3409static void rtl8168g_1_hw_phy_config(struct rtl8169_private *tp) 3370static void rtl8168g_1_hw_phy_config(struct rtl8169_private *tp)
@@ -3489,19 +3450,21 @@ static void rtl8105e_hw_phy_config(struct rtl8169_private *tp)
3489 }; 3450 };
3490 3451
3491 /* Disable ALDPS before ram code */ 3452 /* Disable ALDPS before ram code */
3492 r810x_aldps_disable(tp); 3453 rtl_writephy(tp, 0x1f, 0x0000);
3454 rtl_writephy(tp, 0x18, 0x0310);
3455 msleep(100);
3493 3456
3494 rtl_apply_firmware(tp); 3457 rtl_apply_firmware(tp);
3495 3458
3496 rtl_writephy_batch(tp, phy_reg_init, ARRAY_SIZE(phy_reg_init)); 3459 rtl_writephy_batch(tp, phy_reg_init, ARRAY_SIZE(phy_reg_init));
3497
3498 r810x_aldps_enable(tp);
3499} 3460}
3500 3461
3501static void rtl8402_hw_phy_config(struct rtl8169_private *tp) 3462static void rtl8402_hw_phy_config(struct rtl8169_private *tp)
3502{ 3463{
3503 /* Disable ALDPS before setting firmware */ 3464 /* Disable ALDPS before setting firmware */
3504 r810x_aldps_disable(tp); 3465 rtl_writephy(tp, 0x1f, 0x0000);
3466 rtl_writephy(tp, 0x18, 0x0310);
3467 msleep(20);
3505 3468
3506 rtl_apply_firmware(tp); 3469 rtl_apply_firmware(tp);
3507 3470
@@ -3511,8 +3474,6 @@ static void rtl8402_hw_phy_config(struct rtl8169_private *tp)
3511 rtl_writephy(tp, 0x10, 0x401f); 3474 rtl_writephy(tp, 0x10, 0x401f);
3512 rtl_writephy(tp, 0x19, 0x7030); 3475 rtl_writephy(tp, 0x19, 0x7030);
3513 rtl_writephy(tp, 0x1f, 0x0000); 3476 rtl_writephy(tp, 0x1f, 0x0000);
3514
3515 r810x_aldps_enable(tp);
3516} 3477}
3517 3478
3518static void rtl8106e_hw_phy_config(struct rtl8169_private *tp) 3479static void rtl8106e_hw_phy_config(struct rtl8169_private *tp)
@@ -3525,7 +3486,9 @@ static void rtl8106e_hw_phy_config(struct rtl8169_private *tp)
3525 }; 3486 };
3526 3487
3527 /* Disable ALDPS before ram code */ 3488 /* Disable ALDPS before ram code */
3528 r810x_aldps_disable(tp); 3489 rtl_writephy(tp, 0x1f, 0x0000);
3490 rtl_writephy(tp, 0x18, 0x0310);
3491 msleep(100);
3529 3492
3530 rtl_apply_firmware(tp); 3493 rtl_apply_firmware(tp);
3531 3494
@@ -3533,8 +3496,6 @@ static void rtl8106e_hw_phy_config(struct rtl8169_private *tp)
3533 rtl_writephy_batch(tp, phy_reg_init, ARRAY_SIZE(phy_reg_init)); 3496 rtl_writephy_batch(tp, phy_reg_init, ARRAY_SIZE(phy_reg_init));
3534 3497
3535 rtl_eri_write(tp, 0x1d0, ERIAR_MASK_0011, 0x0000, ERIAR_EXGMAC); 3498 rtl_eri_write(tp, 0x1d0, ERIAR_MASK_0011, 0x0000, ERIAR_EXGMAC);
3536
3537 r810x_aldps_enable(tp);
3538} 3499}
3539 3500
3540static void rtl_hw_phy_config(struct net_device *dev) 3501static void rtl_hw_phy_config(struct net_device *dev)
@@ -5051,6 +5012,8 @@ static void rtl_hw_start_8168e_2(struct rtl8169_private *tp)
5051 5012
5052 RTL_W8(MaxTxPacketSize, EarlySize); 5013 RTL_W8(MaxTxPacketSize, EarlySize);
5053 5014
5015 rtl_disable_clock_request(pdev);
5016
5054 RTL_W32(TxConfig, RTL_R32(TxConfig) | TXCFG_AUTO_FIFO); 5017 RTL_W32(TxConfig, RTL_R32(TxConfig) | TXCFG_AUTO_FIFO);
5055 RTL_W8(MCU, RTL_R8(MCU) & ~NOW_IS_OOB); 5018 RTL_W8(MCU, RTL_R8(MCU) & ~NOW_IS_OOB);
5056 5019
@@ -5059,8 +5022,7 @@ static void rtl_hw_start_8168e_2(struct rtl8169_private *tp)
5059 5022
5060 RTL_W8(DLLPR, RTL_R8(DLLPR) | PFM_EN); 5023 RTL_W8(DLLPR, RTL_R8(DLLPR) | PFM_EN);
5061 RTL_W32(MISC, RTL_R32(MISC) | PWM_EN); 5024 RTL_W32(MISC, RTL_R32(MISC) | PWM_EN);
5062 RTL_W8(Config5, (RTL_R8(Config5) & ~Spi_en) | ASPM_en); 5025 RTL_W8(Config5, RTL_R8(Config5) & ~Spi_en);
5063 RTL_W8(Config2, RTL_R8(Config2) | ClkReqEn);
5064} 5026}
5065 5027
5066static void rtl_hw_start_8168f(struct rtl8169_private *tp) 5028static void rtl_hw_start_8168f(struct rtl8169_private *tp)
@@ -5085,12 +5047,13 @@ static void rtl_hw_start_8168f(struct rtl8169_private *tp)
5085 5047
5086 RTL_W8(MaxTxPacketSize, EarlySize); 5048 RTL_W8(MaxTxPacketSize, EarlySize);
5087 5049
5050 rtl_disable_clock_request(pdev);
5051
5088 RTL_W32(TxConfig, RTL_R32(TxConfig) | TXCFG_AUTO_FIFO); 5052 RTL_W32(TxConfig, RTL_R32(TxConfig) | TXCFG_AUTO_FIFO);
5089 RTL_W8(MCU, RTL_R8(MCU) & ~NOW_IS_OOB); 5053 RTL_W8(MCU, RTL_R8(MCU) & ~NOW_IS_OOB);
5090 RTL_W8(DLLPR, RTL_R8(DLLPR) | PFM_EN); 5054 RTL_W8(DLLPR, RTL_R8(DLLPR) | PFM_EN);
5091 RTL_W32(MISC, RTL_R32(MISC) | PWM_EN | FORCE_CLK); 5055 RTL_W32(MISC, RTL_R32(MISC) | PWM_EN);
5092 RTL_W8(Config5, (RTL_R8(Config5) & ~Spi_en) | ASPM_en); 5056 RTL_W8(Config5, RTL_R8(Config5) & ~Spi_en);
5093 RTL_W8(Config2, RTL_R8(Config2) | ClkReqEn);
5094} 5057}
5095 5058
5096static void rtl_hw_start_8168f_1(struct rtl8169_private *tp) 5059static void rtl_hw_start_8168f_1(struct rtl8169_private *tp)
@@ -5147,10 +5110,8 @@ static void rtl_hw_start_8168g_1(struct rtl8169_private *tp)
5147 rtl_w1w0_eri(tp, 0xdc, ERIAR_MASK_0001, 0x01, 0x00, ERIAR_EXGMAC); 5110 rtl_w1w0_eri(tp, 0xdc, ERIAR_MASK_0001, 0x01, 0x00, ERIAR_EXGMAC);
5148 5111
5149 RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb); 5112 RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb);
5150 RTL_W32(MISC, (RTL_R32(MISC) | FORCE_CLK) & ~RXDV_GATED_EN); 5113 RTL_W32(MISC, RTL_R32(MISC) & ~RXDV_GATED_EN);
5151 RTL_W8(MaxTxPacketSize, EarlySize); 5114 RTL_W8(MaxTxPacketSize, EarlySize);
5152 RTL_W8(Config5, RTL_R8(Config5) | ASPM_en);
5153 RTL_W8(Config2, RTL_R8(Config2) | ClkReqEn);
5154 5115
5155 rtl_eri_write(tp, 0xc0, ERIAR_MASK_0011, 0x0000, ERIAR_EXGMAC); 5116 rtl_eri_write(tp, 0xc0, ERIAR_MASK_0011, 0x0000, ERIAR_EXGMAC);
5156 rtl_eri_write(tp, 0xb8, ERIAR_MASK_0011, 0x0000, ERIAR_EXGMAC); 5117 rtl_eri_write(tp, 0xb8, ERIAR_MASK_0011, 0x0000, ERIAR_EXGMAC);
@@ -5366,9 +5327,6 @@ static void rtl_hw_start_8105e_1(struct rtl8169_private *tp)
5366 5327
5367 RTL_W8(MCU, RTL_R8(MCU) | EN_NDP | EN_OOB_RESET); 5328 RTL_W8(MCU, RTL_R8(MCU) | EN_NDP | EN_OOB_RESET);
5368 RTL_W8(DLLPR, RTL_R8(DLLPR) | PFM_EN); 5329 RTL_W8(DLLPR, RTL_R8(DLLPR) | PFM_EN);
5369 RTL_W8(Config5, RTL_R8(Config5) | ASPM_en);
5370 RTL_W8(Config2, RTL_R8(Config2) | ClkReqEn);
5371 RTL_W32(MISC, RTL_R32(MISC) | FORCE_CLK);
5372 5330
5373 rtl_ephy_init(tp, e_info_8105e_1, ARRAY_SIZE(e_info_8105e_1)); 5331 rtl_ephy_init(tp, e_info_8105e_1, ARRAY_SIZE(e_info_8105e_1));
5374} 5332}
@@ -5394,9 +5352,6 @@ static void rtl_hw_start_8402(struct rtl8169_private *tp)
5394 5352
5395 RTL_W32(TxConfig, RTL_R32(TxConfig) | TXCFG_AUTO_FIFO); 5353 RTL_W32(TxConfig, RTL_R32(TxConfig) | TXCFG_AUTO_FIFO);
5396 RTL_W8(MCU, RTL_R8(MCU) & ~NOW_IS_OOB); 5354 RTL_W8(MCU, RTL_R8(MCU) & ~NOW_IS_OOB);
5397 RTL_W8(Config5, RTL_R8(Config5) | ASPM_en);
5398 RTL_W8(Config2, RTL_R8(Config2) | ClkReqEn);
5399 RTL_W32(MISC, RTL_R32(MISC) | FORCE_CLK);
5400 5355
5401 rtl_ephy_init(tp, e_info_8402, ARRAY_SIZE(e_info_8402)); 5356 rtl_ephy_init(tp, e_info_8402, ARRAY_SIZE(e_info_8402));
5402 5357
@@ -5418,10 +5373,7 @@ static void rtl_hw_start_8106(struct rtl8169_private *tp)
5418 /* Force LAN exit from ASPM if Rx/Tx are not idle */ 5373 /* Force LAN exit from ASPM if Rx/Tx are not idle */
5419 RTL_W32(FuncEvent, RTL_R32(FuncEvent) | 0x002800); 5374 RTL_W32(FuncEvent, RTL_R32(FuncEvent) | 0x002800);
5420 5375
5421 RTL_W32(MISC, 5376 RTL_W32(MISC, (RTL_R32(MISC) | DISABLE_LAN_EN) & ~EARLY_TALLY_EN);
5422 (RTL_R32(MISC) | DISABLE_LAN_EN | FORCE_CLK) & ~EARLY_TALLY_EN);
5423 RTL_W8(Config5, RTL_R8(Config5) | ASPM_en);
5424 RTL_W8(Config2, RTL_R8(Config2) | ClkReqEn);
5425 RTL_W8(MCU, RTL_R8(MCU) | EN_NDP | EN_OOB_RESET); 5377 RTL_W8(MCU, RTL_R8(MCU) | EN_NDP | EN_OOB_RESET);
5426 RTL_W8(DLLPR, RTL_R8(DLLPR) & ~PFM_EN); 5378 RTL_W8(DLLPR, RTL_R8(DLLPR) & ~PFM_EN);
5427} 5379}
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index f07c0612abf6..b75f4b286895 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -69,7 +69,7 @@
69 69
70#undef STMMAC_XMIT_DEBUG 70#undef STMMAC_XMIT_DEBUG
71/*#define STMMAC_XMIT_DEBUG*/ 71/*#define STMMAC_XMIT_DEBUG*/
72#ifdef STMMAC_TX_DEBUG 72#ifdef STMMAC_XMIT_DEBUG
73#define TX_DBG(fmt, args...) printk(fmt, ## args) 73#define TX_DBG(fmt, args...) printk(fmt, ## args)
74#else 74#else
75#define TX_DBG(fmt, args...) do { } while (0) 75#define TX_DBG(fmt, args...) do { } while (0)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index 0376a5e6b2bf..0b9829fe3eea 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -188,8 +188,6 @@ int stmmac_mdio_register(struct net_device *ndev)
188 goto bus_register_fail; 188 goto bus_register_fail;
189 } 189 }
190 190
191 priv->mii = new_bus;
192
193 found = 0; 191 found = 0;
194 for (addr = 0; addr < PHY_MAX_ADDR; addr++) { 192 for (addr = 0; addr < PHY_MAX_ADDR; addr++) {
195 struct phy_device *phydev = new_bus->phy_map[addr]; 193 struct phy_device *phydev = new_bus->phy_map[addr];
@@ -237,8 +235,14 @@ int stmmac_mdio_register(struct net_device *ndev)
237 } 235 }
238 } 236 }
239 237
240 if (!found) 238 if (!found) {
241 pr_warning("%s: No PHY found\n", ndev->name); 239 pr_warning("%s: No PHY found\n", ndev->name);
240 mdiobus_unregister(new_bus);
241 mdiobus_free(new_bus);
242 return -ENODEV;
243 }
244
245 priv->mii = new_bus;
242 246
243 return 0; 247 return 0;
244 248
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index c8e05e27f38c..19d903598b0d 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -411,6 +411,7 @@ static const struct usb_device_id products[] = {
411 }, 411 },
412 412
413 /* 3. Combined interface devices matching on interface number */ 413 /* 3. Combined interface devices matching on interface number */
414 {QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */
414 {QMI_FIXED_INTF(0x12d1, 0x140c, 1)}, /* Huawei E173 */ 415 {QMI_FIXED_INTF(0x12d1, 0x140c, 1)}, /* Huawei E173 */
415 {QMI_FIXED_INTF(0x19d2, 0x0002, 1)}, 416 {QMI_FIXED_INTF(0x19d2, 0x0002, 1)},
416 {QMI_FIXED_INTF(0x19d2, 0x0012, 1)}, 417 {QMI_FIXED_INTF(0x19d2, 0x0012, 1)},
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c
index 83564d36e801..a00a03ea4ec9 100644
--- a/drivers/net/wireless/mwl8k.c
+++ b/drivers/net/wireless/mwl8k.c
@@ -318,20 +318,20 @@ struct mwl8k_sta {
318#define MWL8K_STA(_sta) ((struct mwl8k_sta *)&((_sta)->drv_priv)) 318#define MWL8K_STA(_sta) ((struct mwl8k_sta *)&((_sta)->drv_priv))
319 319
320static const struct ieee80211_channel mwl8k_channels_24[] = { 320static const struct ieee80211_channel mwl8k_channels_24[] = {
321 { .center_freq = 2412, .hw_value = 1, }, 321 { .band = IEEE80211_BAND_2GHZ, .center_freq = 2412, .hw_value = 1, },
322 { .center_freq = 2417, .hw_value = 2, }, 322 { .band = IEEE80211_BAND_2GHZ, .center_freq = 2417, .hw_value = 2, },
323 { .center_freq = 2422, .hw_value = 3, }, 323 { .band = IEEE80211_BAND_2GHZ, .center_freq = 2422, .hw_value = 3, },
324 { .center_freq = 2427, .hw_value = 4, }, 324 { .band = IEEE80211_BAND_2GHZ, .center_freq = 2427, .hw_value = 4, },
325 { .center_freq = 2432, .hw_value = 5, }, 325 { .band = IEEE80211_BAND_2GHZ, .center_freq = 2432, .hw_value = 5, },
326 { .center_freq = 2437, .hw_value = 6, }, 326 { .band = IEEE80211_BAND_2GHZ, .center_freq = 2437, .hw_value = 6, },
327 { .center_freq = 2442, .hw_value = 7, }, 327 { .band = IEEE80211_BAND_2GHZ, .center_freq = 2442, .hw_value = 7, },
328 { .center_freq = 2447, .hw_value = 8, }, 328 { .band = IEEE80211_BAND_2GHZ, .center_freq = 2447, .hw_value = 8, },
329 { .center_freq = 2452, .hw_value = 9, }, 329 { .band = IEEE80211_BAND_2GHZ, .center_freq = 2452, .hw_value = 9, },
330 { .center_freq = 2457, .hw_value = 10, }, 330 { .band = IEEE80211_BAND_2GHZ, .center_freq = 2457, .hw_value = 10, },
331 { .center_freq = 2462, .hw_value = 11, }, 331 { .band = IEEE80211_BAND_2GHZ, .center_freq = 2462, .hw_value = 11, },
332 { .center_freq = 2467, .hw_value = 12, }, 332 { .band = IEEE80211_BAND_2GHZ, .center_freq = 2467, .hw_value = 12, },
333 { .center_freq = 2472, .hw_value = 13, }, 333 { .band = IEEE80211_BAND_2GHZ, .center_freq = 2472, .hw_value = 13, },
334 { .center_freq = 2484, .hw_value = 14, }, 334 { .band = IEEE80211_BAND_2GHZ, .center_freq = 2484, .hw_value = 14, },
335}; 335};
336 336
337static const struct ieee80211_rate mwl8k_rates_24[] = { 337static const struct ieee80211_rate mwl8k_rates_24[] = {
@@ -352,10 +352,10 @@ static const struct ieee80211_rate mwl8k_rates_24[] = {
352}; 352};
353 353
354static const struct ieee80211_channel mwl8k_channels_50[] = { 354static const struct ieee80211_channel mwl8k_channels_50[] = {
355 { .center_freq = 5180, .hw_value = 36, }, 355 { .band = IEEE80211_BAND_5GHZ, .center_freq = 5180, .hw_value = 36, },
356 { .center_freq = 5200, .hw_value = 40, }, 356 { .band = IEEE80211_BAND_5GHZ, .center_freq = 5200, .hw_value = 40, },
357 { .center_freq = 5220, .hw_value = 44, }, 357 { .band = IEEE80211_BAND_5GHZ, .center_freq = 5220, .hw_value = 44, },
358 { .center_freq = 5240, .hw_value = 48, }, 358 { .band = IEEE80211_BAND_5GHZ, .center_freq = 5240, .hw_value = 48, },
359}; 359};
360 360
361static const struct ieee80211_rate mwl8k_rates_50[] = { 361static const struct ieee80211_rate mwl8k_rates_50[] = {
diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c
index 183f97a86bb2..553921511e4e 100644
--- a/net/batman-adv/distributed-arp-table.c
+++ b/net/batman-adv/distributed-arp-table.c
@@ -440,7 +440,7 @@ static bool batadv_is_orig_node_eligible(struct batadv_dat_candidate *res,
440 /* this is an hash collision with the temporary selected node. Choose 440 /* this is an hash collision with the temporary selected node. Choose
441 * the one with the lowest address 441 * the one with the lowest address
442 */ 442 */
443 if ((tmp_max == max) && 443 if ((tmp_max == max) && max_orig_node &&
444 (batadv_compare_eth(candidate->orig, max_orig_node->orig) > 0)) 444 (batadv_compare_eth(candidate->orig, max_orig_node->orig) > 0))
445 goto out; 445 goto out;
446 446
diff --git a/net/bridge/br_stp_bpdu.c b/net/bridge/br_stp_bpdu.c
index 7f884e3fb955..8660ea3be705 100644
--- a/net/bridge/br_stp_bpdu.c
+++ b/net/bridge/br_stp_bpdu.c
@@ -16,6 +16,7 @@
16#include <linux/etherdevice.h> 16#include <linux/etherdevice.h>
17#include <linux/llc.h> 17#include <linux/llc.h>
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <linux/pkt_sched.h>
19#include <net/net_namespace.h> 20#include <net/net_namespace.h>
20#include <net/llc.h> 21#include <net/llc.h>
21#include <net/llc_pdu.h> 22#include <net/llc_pdu.h>
@@ -40,6 +41,7 @@ static void br_send_bpdu(struct net_bridge_port *p,
40 41
41 skb->dev = p->dev; 42 skb->dev = p->dev;
42 skb->protocol = htons(ETH_P_802_2); 43 skb->protocol = htons(ETH_P_802_2);
44 skb->priority = TC_PRIO_CONTROL;
43 45
44 skb_reserve(skb, LLC_RESERVE); 46 skb_reserve(skb, LLC_RESERVE);
45 memcpy(__skb_put(skb, length), data, length); 47 memcpy(__skb_put(skb, length), data, length);
diff --git a/net/core/datagram.c b/net/core/datagram.c
index 0337e2b76862..368f9c3f9dc6 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -187,7 +187,7 @@ struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned int flags,
187 skb_queue_walk(queue, skb) { 187 skb_queue_walk(queue, skb) {
188 *peeked = skb->peeked; 188 *peeked = skb->peeked;
189 if (flags & MSG_PEEK) { 189 if (flags & MSG_PEEK) {
190 if (*off >= skb->len) { 190 if (*off >= skb->len && skb->len) {
191 *off -= skb->len; 191 *off -= skb->len;
192 continue; 192 continue;
193 } 193 }
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 9547a273b9e9..ded146b217f1 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -928,24 +928,25 @@ static void parp_redo(struct sk_buff *skb)
928static int arp_rcv(struct sk_buff *skb, struct net_device *dev, 928static int arp_rcv(struct sk_buff *skb, struct net_device *dev,
929 struct packet_type *pt, struct net_device *orig_dev) 929 struct packet_type *pt, struct net_device *orig_dev)
930{ 930{
931 struct arphdr *arp; 931 const struct arphdr *arp;
932
933 if (dev->flags & IFF_NOARP ||
934 skb->pkt_type == PACKET_OTHERHOST ||
935 skb->pkt_type == PACKET_LOOPBACK)
936 goto freeskb;
937
938 skb = skb_share_check(skb, GFP_ATOMIC);
939 if (!skb)
940 goto out_of_mem;
932 941
933 /* ARP header, plus 2 device addresses, plus 2 IP addresses. */ 942 /* ARP header, plus 2 device addresses, plus 2 IP addresses. */
934 if (!pskb_may_pull(skb, arp_hdr_len(dev))) 943 if (!pskb_may_pull(skb, arp_hdr_len(dev)))
935 goto freeskb; 944 goto freeskb;
936 945
937 arp = arp_hdr(skb); 946 arp = arp_hdr(skb);
938 if (arp->ar_hln != dev->addr_len || 947 if (arp->ar_hln != dev->addr_len || arp->ar_pln != 4)
939 dev->flags & IFF_NOARP ||
940 skb->pkt_type == PACKET_OTHERHOST ||
941 skb->pkt_type == PACKET_LOOPBACK ||
942 arp->ar_pln != 4)
943 goto freeskb; 948 goto freeskb;
944 949
945 skb = skb_share_check(skb, GFP_ATOMIC);
946 if (skb == NULL)
947 goto out_of_mem;
948
949 memset(NEIGH_CB(skb), 0, sizeof(struct neighbour_cb)); 950 memset(NEIGH_CB(skb), 0, sizeof(struct neighbour_cb));
950 951
951 return NF_HOOK(NFPROTO_ARP, NF_ARP_IN, skb, dev, NULL, arp_process); 952 return NF_HOOK(NFPROTO_ARP, NF_ARP_IN, skb, dev, NULL, arp_process);
diff --git a/net/ipv6/netfilter/ip6t_NPT.c b/net/ipv6/netfilter/ip6t_NPT.c
index 7302b0b7b642..83acc1405a18 100644
--- a/net/ipv6/netfilter/ip6t_NPT.c
+++ b/net/ipv6/netfilter/ip6t_NPT.c
@@ -9,6 +9,7 @@
9#include <linux/module.h> 9#include <linux/module.h>
10#include <linux/skbuff.h> 10#include <linux/skbuff.h>
11#include <linux/ipv6.h> 11#include <linux/ipv6.h>
12#include <net/ipv6.h>
12#include <linux/netfilter.h> 13#include <linux/netfilter.h>
13#include <linux/netfilter_ipv6.h> 14#include <linux/netfilter_ipv6.h>
14#include <linux/netfilter_ipv6/ip6t_NPT.h> 15#include <linux/netfilter_ipv6/ip6t_NPT.h>
@@ -18,11 +19,20 @@ static int ip6t_npt_checkentry(const struct xt_tgchk_param *par)
18{ 19{
19 struct ip6t_npt_tginfo *npt = par->targinfo; 20 struct ip6t_npt_tginfo *npt = par->targinfo;
20 __wsum src_sum = 0, dst_sum = 0; 21 __wsum src_sum = 0, dst_sum = 0;
22 struct in6_addr pfx;
21 unsigned int i; 23 unsigned int i;
22 24
23 if (npt->src_pfx_len > 64 || npt->dst_pfx_len > 64) 25 if (npt->src_pfx_len > 64 || npt->dst_pfx_len > 64)
24 return -EINVAL; 26 return -EINVAL;
25 27
28 /* Ensure that LSB of prefix is zero */
29 ipv6_addr_prefix(&pfx, &npt->src_pfx.in6, npt->src_pfx_len);
30 if (!ipv6_addr_equal(&pfx, &npt->src_pfx.in6))
31 return -EINVAL;
32 ipv6_addr_prefix(&pfx, &npt->dst_pfx.in6, npt->dst_pfx_len);
33 if (!ipv6_addr_equal(&pfx, &npt->dst_pfx.in6))
34 return -EINVAL;
35
26 for (i = 0; i < ARRAY_SIZE(npt->src_pfx.in6.s6_addr16); i++) { 36 for (i = 0; i < ARRAY_SIZE(npt->src_pfx.in6.s6_addr16); i++) {
27 src_sum = csum_add(src_sum, 37 src_sum = csum_add(src_sum,
28 (__force __wsum)npt->src_pfx.in6.s6_addr16[i]); 38 (__force __wsum)npt->src_pfx.in6.s6_addr16[i]);
@@ -30,7 +40,7 @@ static int ip6t_npt_checkentry(const struct xt_tgchk_param *par)
30 (__force __wsum)npt->dst_pfx.in6.s6_addr16[i]); 40 (__force __wsum)npt->dst_pfx.in6.s6_addr16[i]);
31 } 41 }
32 42
33 npt->adjustment = (__force __sum16) csum_sub(src_sum, dst_sum); 43 npt->adjustment = ~csum_fold(csum_sub(src_sum, dst_sum));
34 return 0; 44 return 0;
35} 45}
36 46
@@ -51,7 +61,7 @@ static bool ip6t_npt_map_pfx(const struct ip6t_npt_tginfo *npt,
51 61
52 idx = i / 32; 62 idx = i / 32;
53 addr->s6_addr32[idx] &= mask; 63 addr->s6_addr32[idx] &= mask;
54 addr->s6_addr32[idx] |= npt->dst_pfx.in6.s6_addr32[idx]; 64 addr->s6_addr32[idx] |= ~mask & npt->dst_pfx.in6.s6_addr32[idx];
55 } 65 }
56 66
57 if (pfx_len <= 48) 67 if (pfx_len <= 48)
@@ -66,8 +76,8 @@ static bool ip6t_npt_map_pfx(const struct ip6t_npt_tginfo *npt,
66 return false; 76 return false;
67 } 77 }
68 78
69 sum = (__force __sum16) csum_add((__force __wsum)addr->s6_addr16[idx], 79 sum = ~csum_fold(csum_add(csum_unfold((__force __sum16)addr->s6_addr16[idx]),
70 npt->adjustment); 80 csum_unfold(npt->adjustment)));
71 if (sum == CSUM_MANGLED_0) 81 if (sum == CSUM_MANGLED_0)
72 sum = 0; 82 sum = 0;
73 *(__force __sum16 *)&addr->s6_addr16[idx] = sum; 83 *(__force __sum16 *)&addr->s6_addr16[idx] = sum;
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 516fbc96feff..0479c64aa83c 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2004,7 +2004,8 @@ static int ieee80211_set_mcast_rate(struct wiphy *wiphy, struct net_device *dev,
2004{ 2004{
2005 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 2005 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2006 2006
2007 memcpy(sdata->vif.bss_conf.mcast_rate, rate, sizeof(rate)); 2007 memcpy(sdata->vif.bss_conf.mcast_rate, rate,
2008 sizeof(int) * IEEE80211_NUM_BANDS);
2008 2009
2009 return 0; 2010 return 0;
2010} 2011}
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index a3552929a21d..5107248af7fb 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -3400,6 +3400,7 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata,
3400 3400
3401 ret = 0; 3401 ret = 0;
3402 3402
3403out:
3403 while (!cfg80211_chandef_usable(sdata->local->hw.wiphy, chandef, 3404 while (!cfg80211_chandef_usable(sdata->local->hw.wiphy, chandef,
3404 IEEE80211_CHAN_DISABLED)) { 3405 IEEE80211_CHAN_DISABLED)) {
3405 if (WARN_ON(chandef->width == NL80211_CHAN_WIDTH_20_NOHT)) { 3406 if (WARN_ON(chandef->width == NL80211_CHAN_WIDTH_20_NOHT)) {
@@ -3408,14 +3409,13 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata,
3408 goto out; 3409 goto out;
3409 } 3410 }
3410 3411
3411 ret = chandef_downgrade(chandef); 3412 ret |= chandef_downgrade(chandef);
3412 } 3413 }
3413 3414
3414 if (chandef->width != vht_chandef.width) 3415 if (chandef->width != vht_chandef.width)
3415 sdata_info(sdata, 3416 sdata_info(sdata,
3416 "local regulatory prevented using AP HT/VHT configuration, downgraded\n"); 3417 "capabilities/regulatory prevented using AP HT/VHT configuration, downgraded\n");
3417 3418
3418out:
3419 WARN_ON_ONCE(!cfg80211_chandef_valid(chandef)); 3419 WARN_ON_ONCE(!cfg80211_chandef_valid(chandef));
3420 return ret; 3420 return ret;
3421} 3421}
@@ -3529,8 +3529,11 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,
3529 */ 3529 */
3530 ret = ieee80211_vif_use_channel(sdata, &chandef, 3530 ret = ieee80211_vif_use_channel(sdata, &chandef,
3531 IEEE80211_CHANCTX_SHARED); 3531 IEEE80211_CHANCTX_SHARED);
3532 while (ret && chandef.width != NL80211_CHAN_WIDTH_20_NOHT) 3532 while (ret && chandef.width != NL80211_CHAN_WIDTH_20_NOHT) {
3533 ifmgd->flags |= chandef_downgrade(&chandef); 3533 ifmgd->flags |= chandef_downgrade(&chandef);
3534 ret = ieee80211_vif_use_channel(sdata, &chandef,
3535 IEEE80211_CHANCTX_SHARED);
3536 }
3534 return ret; 3537 return ret;
3535} 3538}
3536 3539
diff --git a/net/netfilter/ipvs/ip_vs_proto_sctp.c b/net/netfilter/ipvs/ip_vs_proto_sctp.c
index 746048b13ef3..ae8ec6f27688 100644
--- a/net/netfilter/ipvs/ip_vs_proto_sctp.c
+++ b/net/netfilter/ipvs/ip_vs_proto_sctp.c
@@ -61,14 +61,27 @@ sctp_conn_schedule(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd,
61 return 1; 61 return 1;
62} 62}
63 63
64static void sctp_nat_csum(struct sk_buff *skb, sctp_sctphdr_t *sctph,
65 unsigned int sctphoff)
66{
67 __u32 crc32;
68 struct sk_buff *iter;
69
70 crc32 = sctp_start_cksum((__u8 *)sctph, skb_headlen(skb) - sctphoff);
71 skb_walk_frags(skb, iter)
72 crc32 = sctp_update_cksum((u8 *) iter->data,
73 skb_headlen(iter), crc32);
74 sctph->checksum = sctp_end_cksum(crc32);
75
76 skb->ip_summed = CHECKSUM_UNNECESSARY;
77}
78
64static int 79static int
65sctp_snat_handler(struct sk_buff *skb, struct ip_vs_protocol *pp, 80sctp_snat_handler(struct sk_buff *skb, struct ip_vs_protocol *pp,
66 struct ip_vs_conn *cp, struct ip_vs_iphdr *iph) 81 struct ip_vs_conn *cp, struct ip_vs_iphdr *iph)
67{ 82{
68 sctp_sctphdr_t *sctph; 83 sctp_sctphdr_t *sctph;
69 unsigned int sctphoff = iph->len; 84 unsigned int sctphoff = iph->len;
70 struct sk_buff *iter;
71 __be32 crc32;
72 85
73#ifdef CONFIG_IP_VS_IPV6 86#ifdef CONFIG_IP_VS_IPV6
74 if (cp->af == AF_INET6 && iph->fragoffs) 87 if (cp->af == AF_INET6 && iph->fragoffs)
@@ -92,13 +105,7 @@ sctp_snat_handler(struct sk_buff *skb, struct ip_vs_protocol *pp,
92 sctph = (void *) skb_network_header(skb) + sctphoff; 105 sctph = (void *) skb_network_header(skb) + sctphoff;
93 sctph->source = cp->vport; 106 sctph->source = cp->vport;
94 107
95 /* Calculate the checksum */ 108 sctp_nat_csum(skb, sctph, sctphoff);
96 crc32 = sctp_start_cksum((u8 *) sctph, skb_headlen(skb) - sctphoff);
97 skb_walk_frags(skb, iter)
98 crc32 = sctp_update_cksum((u8 *) iter->data, skb_headlen(iter),
99 crc32);
100 crc32 = sctp_end_cksum(crc32);
101 sctph->checksum = crc32;
102 109
103 return 1; 110 return 1;
104} 111}
@@ -109,8 +116,6 @@ sctp_dnat_handler(struct sk_buff *skb, struct ip_vs_protocol *pp,
109{ 116{
110 sctp_sctphdr_t *sctph; 117 sctp_sctphdr_t *sctph;
111 unsigned int sctphoff = iph->len; 118 unsigned int sctphoff = iph->len;
112 struct sk_buff *iter;
113 __be32 crc32;
114 119
115#ifdef CONFIG_IP_VS_IPV6 120#ifdef CONFIG_IP_VS_IPV6
116 if (cp->af == AF_INET6 && iph->fragoffs) 121 if (cp->af == AF_INET6 && iph->fragoffs)
@@ -134,13 +139,7 @@ sctp_dnat_handler(struct sk_buff *skb, struct ip_vs_protocol *pp,
134 sctph = (void *) skb_network_header(skb) + sctphoff; 139 sctph = (void *) skb_network_header(skb) + sctphoff;
135 sctph->dest = cp->dport; 140 sctph->dest = cp->dport;
136 141
137 /* Calculate the checksum */ 142 sctp_nat_csum(skb, sctph, sctphoff);
138 crc32 = sctp_start_cksum((u8 *) sctph, skb_headlen(skb) - sctphoff);
139 skb_walk_frags(skb, iter)
140 crc32 = sctp_update_cksum((u8 *) iter->data, skb_headlen(iter),
141 crc32);
142 crc32 = sctp_end_cksum(crc32);
143 sctph->checksum = crc32;
144 143
145 return 1; 144 return 1;
146} 145}
diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c
index effa10c9e4e3..44fd10c539ac 100644
--- a/net/netfilter/ipvs/ip_vs_sync.c
+++ b/net/netfilter/ipvs/ip_vs_sync.c
@@ -1795,6 +1795,8 @@ int start_sync_thread(struct net *net, int state, char *mcast_ifn, __u8 syncid)
1795 GFP_KERNEL); 1795 GFP_KERNEL);
1796 if (!tinfo->buf) 1796 if (!tinfo->buf)
1797 goto outtinfo; 1797 goto outtinfo;
1798 } else {
1799 tinfo->buf = NULL;
1798 } 1800 }
1799 tinfo->id = id; 1801 tinfo->id = id;
1800 1802
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 51561eafcb72..79e8ed4ac7ce 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -1135,9 +1135,9 @@ static int htb_dump_class(struct Qdisc *sch, unsigned long arg,
1135 memset(&opt, 0, sizeof(opt)); 1135 memset(&opt, 0, sizeof(opt));
1136 1136
1137 opt.rate.rate = cl->rate.rate_bps >> 3; 1137 opt.rate.rate = cl->rate.rate_bps >> 3;
1138 opt.buffer = cl->buffer; 1138 opt.buffer = PSCHED_NS2TICKS(cl->buffer);
1139 opt.ceil.rate = cl->ceil.rate_bps >> 3; 1139 opt.ceil.rate = cl->ceil.rate_bps >> 3;
1140 opt.cbuffer = cl->cbuffer; 1140 opt.cbuffer = PSCHED_NS2TICKS(cl->cbuffer);
1141 opt.quantum = cl->quantum; 1141 opt.quantum = cl->quantum;
1142 opt.prio = cl->prio; 1142 opt.prio = cl->prio;
1143 opt.level = cl->level; 1143 opt.level = cl->level;
diff --git a/net/sctp/Kconfig b/net/sctp/Kconfig
index 7521d944c0fb..cf4852814e0c 100644
--- a/net/sctp/Kconfig
+++ b/net/sctp/Kconfig
@@ -3,8 +3,8 @@
3# 3#
4 4
5menuconfig IP_SCTP 5menuconfig IP_SCTP
6 tristate "The SCTP Protocol (EXPERIMENTAL)" 6 tristate "The SCTP Protocol"
7 depends on INET && EXPERIMENTAL 7 depends on INET
8 depends on IPV6 || IPV6=n 8 depends on IPV6 || IPV6=n
9 select CRYPTO 9 select CRYPTO
10 select CRYPTO_HMAC 10 select CRYPTO_HMAC
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index f3f0f4dc31dd..391a245d5203 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -326,9 +326,10 @@ static void sctp_v6_get_dst(struct sctp_transport *t, union sctp_addr *saddr,
326 */ 326 */
327 rcu_read_lock(); 327 rcu_read_lock();
328 list_for_each_entry_rcu(laddr, &bp->address_list, list) { 328 list_for_each_entry_rcu(laddr, &bp->address_list, list) {
329 if (!laddr->valid && laddr->state != SCTP_ADDR_SRC) 329 if (!laddr->valid)
330 continue; 330 continue;
331 if ((laddr->a.sa.sa_family == AF_INET6) && 331 if ((laddr->state == SCTP_ADDR_SRC) &&
332 (laddr->a.sa.sa_family == AF_INET6) &&
332 (scope <= sctp_scope(&laddr->a))) { 333 (scope <= sctp_scope(&laddr->a))) {
333 bmatchlen = sctp_v6_addr_match_len(daddr, &laddr->a); 334 bmatchlen = sctp_v6_addr_match_len(daddr, &laddr->a);
334 if (!baddr || (matchlen < bmatchlen)) { 335 if (!baddr || (matchlen < bmatchlen)) {