mac80211: Use eth_<foo>_addr instead of memset
[pandora-kernel.git] / net / mac80211 / cfg.c
index e75d5c5..74f509c 100644 (file)
@@ -162,8 +162,13 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev,
                        return -EINVAL;
                break;
        case WLAN_CIPHER_SUITE_CCMP:
+       case WLAN_CIPHER_SUITE_CCMP_256:
        case WLAN_CIPHER_SUITE_AES_CMAC:
+       case WLAN_CIPHER_SUITE_BIP_CMAC_256:
+       case WLAN_CIPHER_SUITE_BIP_GMAC_128:
+       case WLAN_CIPHER_SUITE_BIP_GMAC_256:
        case WLAN_CIPHER_SUITE_GCMP:
+       case WLAN_CIPHER_SUITE_GCMP_256:
                break;
        default:
                cs = ieee80211_cs_get(local, params->cipher, sdata->vif.type);
@@ -348,6 +353,7 @@ static int ieee80211_get_key(struct wiphy *wiphy, struct net_device *dev,
                params.seq_len = 6;
                break;
        case WLAN_CIPHER_SUITE_CCMP:
+       case WLAN_CIPHER_SUITE_CCMP_256:
                pn64 = atomic64_read(&key->u.ccmp.tx_pn);
                seq[0] = pn64;
                seq[1] = pn64 >> 8;
@@ -359,6 +365,7 @@ static int ieee80211_get_key(struct wiphy *wiphy, struct net_device *dev,
                params.seq_len = 6;
                break;
        case WLAN_CIPHER_SUITE_AES_CMAC:
+       case WLAN_CIPHER_SUITE_BIP_CMAC_256:
                pn64 = atomic64_read(&key->u.aes_cmac.tx_pn);
                seq[0] = pn64;
                seq[1] = pn64 >> 8;
@@ -369,6 +376,30 @@ static int ieee80211_get_key(struct wiphy *wiphy, struct net_device *dev,
                params.seq = seq;
                params.seq_len = 6;
                break;
+       case WLAN_CIPHER_SUITE_BIP_GMAC_128:
+       case WLAN_CIPHER_SUITE_BIP_GMAC_256:
+               pn64 = atomic64_read(&key->u.aes_gmac.tx_pn);
+               seq[0] = pn64;
+               seq[1] = pn64 >> 8;
+               seq[2] = pn64 >> 16;
+               seq[3] = pn64 >> 24;
+               seq[4] = pn64 >> 32;
+               seq[5] = pn64 >> 40;
+               params.seq = seq;
+               params.seq_len = 6;
+               break;
+       case WLAN_CIPHER_SUITE_GCMP:
+       case WLAN_CIPHER_SUITE_GCMP_256:
+               pn64 = atomic64_read(&key->u.gcmp.tx_pn);
+               seq[0] = pn64;
+               seq[1] = pn64 >> 8;
+               seq[2] = pn64 >> 16;
+               seq[3] = pn64 >> 24;
+               seq[4] = pn64 >> 32;
+               seq[5] = pn64 >> 40;
+               params.seq = seq;
+               params.seq_len = 6;
+               break;
        }
 
        params.key = key->conf.key;
@@ -428,11 +459,13 @@ void sta_set_rate_info_tx(struct sta_info *sta,
                rinfo->legacy = DIV_ROUND_UP(brate, 1 << shift);
        }
        if (rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
-               rinfo->flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH;
-       if (rate->flags & IEEE80211_TX_RC_80_MHZ_WIDTH)
-               rinfo->flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH;
-       if (rate->flags & IEEE80211_TX_RC_160_MHZ_WIDTH)
-               rinfo->flags |= RATE_INFO_FLAGS_160_MHZ_WIDTH;
+               rinfo->bw = RATE_INFO_BW_40;
+       else if (rate->flags & IEEE80211_TX_RC_80_MHZ_WIDTH)
+               rinfo->bw = RATE_INFO_BW_80;
+       else if (rate->flags & IEEE80211_TX_RC_160_MHZ_WIDTH)
+               rinfo->bw = RATE_INFO_BW_160;
+       else
+               rinfo->bw = RATE_INFO_BW_20;
        if (rate->flags & IEEE80211_TX_RC_SHORT_GI)
                rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI;
 }
@@ -459,16 +492,21 @@ void sta_set_rate_info_rx(struct sta_info *sta, struct rate_info *rinfo)
                rinfo->legacy = DIV_ROUND_UP(brate, 1 << shift);
        }
 
-       if (sta->last_rx_rate_flag & RX_FLAG_40MHZ)
-               rinfo->flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH;
        if (sta->last_rx_rate_flag & RX_FLAG_SHORT_GI)
                rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI;
-       if (sta->last_rx_rate_vht_flag & RX_VHT_FLAG_80MHZ)
-               rinfo->flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH;
-       if (sta->last_rx_rate_vht_flag & RX_VHT_FLAG_80P80MHZ)
-               rinfo->flags |= RATE_INFO_FLAGS_80P80_MHZ_WIDTH;
-       if (sta->last_rx_rate_vht_flag & RX_VHT_FLAG_160MHZ)
-               rinfo->flags |= RATE_INFO_FLAGS_160_MHZ_WIDTH;
+
+       if (sta->last_rx_rate_flag & RX_FLAG_5MHZ)
+               rinfo->bw = RATE_INFO_BW_5;
+       else if (sta->last_rx_rate_flag & RX_FLAG_10MHZ)
+               rinfo->bw = RATE_INFO_BW_10;
+       else if (sta->last_rx_rate_flag & RX_FLAG_40MHZ)
+               rinfo->bw = RATE_INFO_BW_40;
+       else if (sta->last_rx_rate_vht_flag & RX_VHT_FLAG_80MHZ)
+               rinfo->bw = RATE_INFO_BW_80;
+       else if (sta->last_rx_rate_vht_flag & RX_VHT_FLAG_160MHZ)
+               rinfo->bw = RATE_INFO_BW_160;
+       else
+               rinfo->bw = RATE_INFO_BW_20;
 }
 
 static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev,
@@ -678,7 +716,8 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
                      BSS_CHANGED_BEACON_ENABLED |
                      BSS_CHANGED_BEACON |
                      BSS_CHANGED_SSID |
-                     BSS_CHANGED_P2P_PS;
+                     BSS_CHANGED_P2P_PS |
+                     BSS_CHANGED_TXPOWER;
        int err;
 
        old = sdata_dereference(sdata->u.ap.beacon, sdata);
@@ -1449,7 +1488,7 @@ static void mpath_set_pinfo(struct mesh_path *mpath, u8 *next_hop,
        if (next_hop_sta)
                memcpy(next_hop, next_hop_sta->sta.addr, ETH_ALEN);
        else
-               memset(next_hop, 0, ETH_ALEN);
+               eth_zero_addr(next_hop);
 
        memset(pinfo, 0, sizeof(*pinfo));
 
@@ -2102,6 +2141,8 @@ static int ieee80211_set_tx_power(struct wiphy *wiphy,
 {
        struct ieee80211_local *local = wiphy_priv(wiphy);
        struct ieee80211_sub_if_data *sdata;
+       enum nl80211_tx_power_setting txp_type = type;
+       bool update_txp_type = false;
 
        if (wdev) {
                sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
@@ -2109,6 +2150,7 @@ static int ieee80211_set_tx_power(struct wiphy *wiphy,
                switch (type) {
                case NL80211_TX_POWER_AUTOMATIC:
                        sdata->user_power_level = IEEE80211_UNSET_POWER_LEVEL;
+                       txp_type = NL80211_TX_POWER_LIMITED;
                        break;
                case NL80211_TX_POWER_LIMITED:
                case NL80211_TX_POWER_FIXED:
@@ -2118,7 +2160,12 @@ static int ieee80211_set_tx_power(struct wiphy *wiphy,
                        break;
                }
 
-               ieee80211_recalc_txpower(sdata);
+               if (txp_type != sdata->vif.bss_conf.txpower_type) {
+                       update_txp_type = true;
+                       sdata->vif.bss_conf.txpower_type = txp_type;
+               }
+
+               ieee80211_recalc_txpower(sdata, update_txp_type);
 
                return 0;
        }
@@ -2126,6 +2173,7 @@ static int ieee80211_set_tx_power(struct wiphy *wiphy,
        switch (type) {
        case NL80211_TX_POWER_AUTOMATIC:
                local->user_power_level = IEEE80211_UNSET_POWER_LEVEL;
+               txp_type = NL80211_TX_POWER_LIMITED;
                break;
        case NL80211_TX_POWER_LIMITED:
        case NL80211_TX_POWER_FIXED:
@@ -2136,10 +2184,14 @@ static int ieee80211_set_tx_power(struct wiphy *wiphy,
        }
 
        mutex_lock(&local->iflist_mtx);
-       list_for_each_entry(sdata, &local->interfaces, list)
+       list_for_each_entry(sdata, &local->interfaces, list) {
                sdata->user_power_level = local->user_power_level;
+               if (txp_type != sdata->vif.bss_conf.txpower_type)
+                       update_txp_type = true;
+               sdata->vif.bss_conf.txpower_type = txp_type;
+       }
        list_for_each_entry(sdata, &local->interfaces, list)
-               ieee80211_recalc_txpower(sdata);
+               ieee80211_recalc_txpower(sdata, update_txp_type);
        mutex_unlock(&local->iflist_mtx);
 
        return 0;
@@ -2556,7 +2608,7 @@ static int ieee80211_start_roc_work(struct ieee80211_local *local,
 
        /* if there's one pending or we're scanning, queue this one */
        if (!list_empty(&local->roc_list) ||
-           local->scanning || local->radar_detect_enabled)
+           local->scanning || ieee80211_is_radar_required(local))
                goto out_check_combine;
 
        /* if not HW assist, just queue & schedule work */
@@ -3664,7 +3716,7 @@ static int ieee80211_del_tx_ts(struct wiphy *wiphy, struct net_device *dev,
                 * queues.
                 */
                synchronize_net();
-               ieee80211_flush_queues(local, sdata);
+               ieee80211_flush_queues(local, sdata, false);
 
                /* restore the normal QoS parameters
                 * (unconditionally to avoid races)