These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / net / wireless / mac80211_hwsim.c
index d5c0a1a..c00a7da 100644 (file)
@@ -787,7 +787,7 @@ static void mac80211_hwsim_set_tsf(struct ieee80211_hw *hw,
        struct mac80211_hwsim_data *data = hw->priv;
        u64 now = mac80211_hwsim_get_tsf(hw, vif);
        u32 bcn_int = data->beacon_int;
-       u64 delta = abs64(tsf - now);
+       u64 delta = abs(tsf - now);
 
        /* adjust after beaconing with new timestamp at old TBTT */
        if (tsf > now) {
@@ -1286,7 +1286,7 @@ static void mac80211_hwsim_tx(struct ieee80211_hw *hw,
        if (control->sta)
                hwsim_check_sta_magic(control->sta);
 
-       if (hw->flags & IEEE80211_HW_SUPPORTS_RC_TABLE)
+       if (ieee80211_hw_check(hw, SUPPORTS_RC_TABLE))
                ieee80211_get_tx_rates(txi->control.vif, control->sta, skb,
                                       txi->control.rates,
                                       ARRAY_SIZE(txi->control.rates));
@@ -1395,7 +1395,7 @@ static void mac80211_hwsim_tx_frame(struct ieee80211_hw *hw,
 {
        u32 _pid = ACCESS_ONCE(wmediumd_portid);
 
-       if (hw->flags & IEEE80211_HW_SUPPORTS_RC_TABLE) {
+       if (ieee80211_hw_check(hw, SUPPORTS_RC_TABLE)) {
                struct ieee80211_tx_info *txi = IEEE80211_SKB_CB(skb);
                ieee80211_get_tx_rates(txi->control.vif, NULL, skb,
                                       txi->control.rates,
@@ -1432,7 +1432,7 @@ static void mac80211_hwsim_beacon_tx(void *arg, u8 *mac,
        if (skb == NULL)
                return;
        info = IEEE80211_SKB_CB(skb);
-       if (hw->flags & IEEE80211_HW_SUPPORTS_RC_TABLE)
+       if (ieee80211_hw_check(hw, SUPPORTS_RC_TABLE))
                ieee80211_get_tx_rates(vif, NULL, skb,
                                       info->control.rates,
                                       ARRAY_SIZE(info->control.rates));
@@ -1554,8 +1554,6 @@ static void mac80211_hwsim_configure_filter(struct ieee80211_hw *hw,
        wiphy_debug(hw->wiphy, "%s\n", __func__);
 
        data->rx_filter = 0;
-       if (*total_flags & FIF_PROMISC_IN_BSS)
-               data->rx_filter |= FIF_PROMISC_IN_BSS;
        if (*total_flags & FIF_ALLMULTI)
                data->rx_filter |= FIF_ALLMULTI;
 
@@ -1821,7 +1819,7 @@ static int mac80211_hwsim_ampdu_action(struct ieee80211_hw *hw,
                                       struct ieee80211_vif *vif,
                                       enum ieee80211_ampdu_mlme_action action,
                                       struct ieee80211_sta *sta, u16 tid, u16 *ssn,
-                                      u8 buf_size)
+                                      u8 buf_size, bool amsdu)
 {
        switch (action) {
        case IEEE80211_AMPDU_TX_START:
@@ -2192,9 +2190,8 @@ static void hwsim_mcast_config_msg(struct sk_buff *mcast_skb,
                                   struct genl_info *info)
 {
        if (info)
-               genl_notify(&hwsim_genl_family, mcast_skb,
-                           genl_info_net(info), info->snd_portid,
-                           HWSIM_MCGRP_CONFIG, info->nlhdr, GFP_KERNEL);
+               genl_notify(&hwsim_genl_family, mcast_skb, info,
+                           HWSIM_MCGRP_CONFIG, GFP_KERNEL);
        else
                genlmsg_multicast(&hwsim_genl_family, mcast_skb, 0,
                                  HWSIM_MCGRP_CONFIG, GFP_KERNEL);
@@ -2393,15 +2390,17 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
        if (param->p2p_device)
                hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_DEVICE);
 
-       hw->flags = IEEE80211_HW_MFP_CAPABLE |
-                   IEEE80211_HW_SIGNAL_DBM |
-                   IEEE80211_HW_AMPDU_AGGREGATION |
-                   IEEE80211_HW_WANT_MONITOR_VIF |
-                   IEEE80211_HW_QUEUE_CONTROL |
-                   IEEE80211_HW_SUPPORTS_HT_CCK_RATES |
-                   IEEE80211_HW_CHANCTX_STA_CSA;
+       ieee80211_hw_set(hw, SUPPORT_FAST_XMIT);
+       ieee80211_hw_set(hw, CHANCTX_STA_CSA);
+       ieee80211_hw_set(hw, SUPPORTS_HT_CCK_RATES);
+       ieee80211_hw_set(hw, QUEUE_CONTROL);
+       ieee80211_hw_set(hw, WANT_MONITOR_VIF);
+       ieee80211_hw_set(hw, AMPDU_AGGREGATION);
+       ieee80211_hw_set(hw, MFP_CAPABLE);
+       ieee80211_hw_set(hw, SIGNAL_DBM);
+       ieee80211_hw_set(hw, TDLS_WIDER_BW);
        if (rctbl)
-               hw->flags |= IEEE80211_HW_SUPPORTS_RC_TABLE;
+               ieee80211_hw_set(hw, SUPPORTS_RC_TABLE);
 
        hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS |
                            WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
@@ -2438,6 +2437,31 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
                        sband->n_channels = ARRAY_SIZE(hwsim_channels_5ghz);
                        sband->bitrates = data->rates + 4;
                        sband->n_bitrates = ARRAY_SIZE(hwsim_rates) - 4;
+
+                       sband->vht_cap.vht_supported = true;
+                       sband->vht_cap.cap =
+                               IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 |
+                               IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ |
+                               IEEE80211_VHT_CAP_RXLDPC |
+                               IEEE80211_VHT_CAP_SHORT_GI_80 |
+                               IEEE80211_VHT_CAP_SHORT_GI_160 |
+                               IEEE80211_VHT_CAP_TXSTBC |
+                               IEEE80211_VHT_CAP_RXSTBC_1 |
+                               IEEE80211_VHT_CAP_RXSTBC_2 |
+                               IEEE80211_VHT_CAP_RXSTBC_3 |
+                               IEEE80211_VHT_CAP_RXSTBC_4 |
+                               IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK;
+                       sband->vht_cap.vht_mcs.rx_mcs_map =
+                               cpu_to_le16(IEEE80211_VHT_MCS_SUPPORT_0_9 << 0 |
+                                           IEEE80211_VHT_MCS_SUPPORT_0_9 << 2 |
+                                           IEEE80211_VHT_MCS_SUPPORT_0_9 << 4 |
+                                           IEEE80211_VHT_MCS_SUPPORT_0_9 << 6 |
+                                           IEEE80211_VHT_MCS_SUPPORT_0_9 << 8 |
+                                           IEEE80211_VHT_MCS_SUPPORT_0_9 << 10 |
+                                           IEEE80211_VHT_MCS_SUPPORT_0_9 << 12 |
+                                           IEEE80211_VHT_MCS_SUPPORT_0_9 << 14);
+                       sband->vht_cap.vht_mcs.tx_mcs_map =
+                               sband->vht_cap.vht_mcs.rx_mcs_map;
                        break;
                default:
                        continue;
@@ -2458,31 +2482,6 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
                sband->ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED;
 
                hw->wiphy->bands[band] = sband;
-
-               sband->vht_cap.vht_supported = true;
-               sband->vht_cap.cap =
-                       IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 |
-                       IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ |
-                       IEEE80211_VHT_CAP_RXLDPC |
-                       IEEE80211_VHT_CAP_SHORT_GI_80 |
-                       IEEE80211_VHT_CAP_SHORT_GI_160 |
-                       IEEE80211_VHT_CAP_TXSTBC |
-                       IEEE80211_VHT_CAP_RXSTBC_1 |
-                       IEEE80211_VHT_CAP_RXSTBC_2 |
-                       IEEE80211_VHT_CAP_RXSTBC_3 |
-                       IEEE80211_VHT_CAP_RXSTBC_4 |
-                       IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK;
-               sband->vht_cap.vht_mcs.rx_mcs_map =
-                       cpu_to_le16(IEEE80211_VHT_MCS_SUPPORT_0_8 << 0 |
-                                   IEEE80211_VHT_MCS_SUPPORT_0_8 << 2 |
-                                   IEEE80211_VHT_MCS_SUPPORT_0_9 << 4 |
-                                   IEEE80211_VHT_MCS_SUPPORT_0_8 << 6 |
-                                   IEEE80211_VHT_MCS_SUPPORT_0_8 << 8 |
-                                   IEEE80211_VHT_MCS_SUPPORT_0_9 << 10 |
-                                   IEEE80211_VHT_MCS_SUPPORT_0_9 << 12 |
-                                   IEEE80211_VHT_MCS_SUPPORT_0_8 << 14);
-               sband->vht_cap.vht_mcs.tx_mcs_map =
-                       sband->vht_cap.vht_mcs.rx_mcs_map;
        }
 
        /* By default all radios belong to the first group */
@@ -2510,7 +2509,7 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
        }
 
        if (param->no_vif)
-               hw->flags |= IEEE80211_HW_NO_AUTO_VIF;
+               ieee80211_hw_set(hw, NO_AUTO_VIF);
 
        err = ieee80211_register_hw(hw);
        if (err < 0) {
@@ -2677,7 +2676,7 @@ static void hwsim_mon_setup(struct net_device *dev)
        dev->netdev_ops = &hwsim_netdev_ops;
        dev->destructor = free_netdev;
        ether_setup(dev);
-       dev->tx_queue_len = 0;
+       dev->priv_flags |= IFF_NO_QUEUE;
        dev->type = ARPHRD_IEEE80211_RADIOTAP;
        eth_zero_addr(dev->dev_addr);
        dev->dev_addr[0] = 0x12;
@@ -3121,8 +3120,10 @@ static int hwsim_init_netlink(void)
                goto failure;
 
        rc = netlink_register_notifier(&hwsim_netlink_notifier);
-       if (rc)
+       if (rc) {
+               genl_unregister_family(&hwsim_genl_family);
                goto failure;
+       }
 
        return 0;