Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next

+375 -258
+1 -1
Documentation/DocBook/80211.tmpl
··· 437 437 </section> 438 438 !Finclude/net/mac80211.h ieee80211_get_buffered_bc 439 439 !Finclude/net/mac80211.h ieee80211_beacon_get 440 - !Finclude/net/mac80211.h ieee80211_sta_eosp_irqsafe 440 + !Finclude/net/mac80211.h ieee80211_sta_eosp 441 441 !Finclude/net/mac80211.h ieee80211_frame_release_type 442 442 !Finclude/net/mac80211.h ieee80211_sta_ps_transition 443 443 !Finclude/net/mac80211.h ieee80211_sta_ps_transition_ni
+1 -1
drivers/net/wireless/ath/ar5523/ar5523.c
··· 1091 1091 return ret; 1092 1092 } 1093 1093 1094 - static void ar5523_flush(struct ieee80211_hw *hw, bool drop) 1094 + static void ar5523_flush(struct ieee80211_hw *hw, u32 queues, bool drop) 1095 1095 { 1096 1096 struct ar5523 *ar = hw->priv; 1097 1097
+1 -1
drivers/net/wireless/ath/ath9k/main.c
··· 1745 1745 mutex_unlock(&sc->mutex); 1746 1746 } 1747 1747 1748 - static void ath9k_flush(struct ieee80211_hw *hw, bool drop) 1748 + static void ath9k_flush(struct ieee80211_hw *hw, u32 queues, bool drop) 1749 1749 { 1750 1750 struct ath_softc *sc = hw->priv; 1751 1751 struct ath_hw *ah = sc->sc_ah;
+1 -1
drivers/net/wireless/ath/carl9170/main.c
··· 1703 1703 return 0; 1704 1704 } 1705 1705 1706 - static void carl9170_op_flush(struct ieee80211_hw *hw, bool drop) 1706 + static void carl9170_op_flush(struct ieee80211_hw *hw, u32 queues, bool drop) 1707 1707 { 1708 1708 struct ar9170 *ar = hw->priv; 1709 1709 unsigned int vid;
+1 -1
drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
··· 724 724 return result; 725 725 } 726 726 727 - static void brcms_ops_flush(struct ieee80211_hw *hw, bool drop) 727 + static void brcms_ops_flush(struct ieee80211_hw *hw, u32 queues, bool drop) 728 728 { 729 729 struct brcms_info *wl = hw->priv; 730 730 int ret;
+1 -2
drivers/net/wireless/iwlegacy/common.c
··· 4704 4704 } 4705 4705 EXPORT_SYMBOL(il_mac_change_interface); 4706 4706 4707 - void 4708 - il_mac_flush(struct ieee80211_hw *hw, bool drop) 4707 + void il_mac_flush(struct ieee80211_hw *hw, u32 queues, bool drop) 4709 4708 { 4710 4709 struct il_priv *il = hw->priv; 4711 4710 unsigned long timeout = jiffies + msecs_to_jiffies(500);
+1 -1
drivers/net/wireless/iwlegacy/common.h
··· 1720 1720 struct ieee80211_vif *vif); 1721 1721 int il_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1722 1722 enum nl80211_iftype newtype, bool newp2p); 1723 - void il_mac_flush(struct ieee80211_hw *hw, bool drop); 1723 + void il_mac_flush(struct ieee80211_hw *hw, u32 queues, bool drop); 1724 1724 int il_alloc_txq_mem(struct il_priv *il); 1725 1725 void il_free_txq_mem(struct il_priv *il); 1726 1726
+1 -1
drivers/net/wireless/iwlwifi/dvm/mac80211.c
··· 1100 1100 FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL; 1101 1101 } 1102 1102 1103 - static void iwlagn_mac_flush(struct ieee80211_hw *hw, bool drop) 1103 + static void iwlagn_mac_flush(struct ieee80211_hw *hw, u32 queues, bool drop) 1104 1104 { 1105 1105 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); 1106 1106
+7 -1
drivers/net/wireless/mac80211_hwsim.c
··· 964 964 newtype, vif->addr); 965 965 hwsim_check_magic(vif); 966 966 967 + /* 968 + * interface may change from non-AP to AP in 969 + * which case this needs to be set up again 970 + */ 971 + vif->cab_queue = 0; 972 + 967 973 return 0; 968 974 } 969 975 ··· 1395 1389 return 0; 1396 1390 } 1397 1391 1398 - static void mac80211_hwsim_flush(struct ieee80211_hw *hw, bool drop) 1392 + static void mac80211_hwsim_flush(struct ieee80211_hw *hw, u32 queues, bool drop) 1399 1393 { 1400 1394 /* Not implemented, queues only on kernel side */ 1401 1395 }
+1 -1
drivers/net/wireless/p54/main.c
··· 670 670 return total; 671 671 } 672 672 673 - static void p54_flush(struct ieee80211_hw *dev, bool drop) 673 + static void p54_flush(struct ieee80211_hw *dev, u32 queues, bool drop) 674 674 { 675 675 struct p54_common *priv = dev->priv; 676 676 unsigned int total, i;
+1 -1
drivers/net/wireless/rt2x00/rt2x00.h
··· 1366 1366 struct ieee80211_vif *vif, u16 queue, 1367 1367 const struct ieee80211_tx_queue_params *params); 1368 1368 void rt2x00mac_rfkill_poll(struct ieee80211_hw *hw); 1369 - void rt2x00mac_flush(struct ieee80211_hw *hw, bool drop); 1369 + void rt2x00mac_flush(struct ieee80211_hw *hw, u32 queues, bool drop); 1370 1370 int rt2x00mac_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant); 1371 1371 int rt2x00mac_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant); 1372 1372 void rt2x00mac_get_ringparam(struct ieee80211_hw *hw,
+1 -1
drivers/net/wireless/rt2x00/rt2x00mac.c
··· 748 748 } 749 749 EXPORT_SYMBOL_GPL(rt2x00mac_rfkill_poll); 750 750 751 - void rt2x00mac_flush(struct ieee80211_hw *hw, bool drop) 751 + void rt2x00mac_flush(struct ieee80211_hw *hw, u32 queues, bool drop) 752 752 { 753 753 struct rt2x00_dev *rt2x00dev = hw->priv; 754 754 struct data_queue *queue;
+1 -1
drivers/net/wireless/rtlwifi/core.c
··· 1166 1166 * before switch channle or power save, or tx buffer packet 1167 1167 * maybe send after offchannel or rf sleep, this may cause 1168 1168 * dis-association by AP */ 1169 - static void rtl_op_flush(struct ieee80211_hw *hw, bool drop) 1169 + static void rtl_op_flush(struct ieee80211_hw *hw, u32 queues, bool drop) 1170 1170 { 1171 1171 struct rtl_priv *rtlpriv = rtl_priv(hw); 1172 1172
+1 -1
drivers/net/wireless/ti/wlcore/main.c
··· 4946 4946 mutex_unlock(&wl->mutex); 4947 4947 } 4948 4948 4949 - static void wlcore_op_flush(struct ieee80211_hw *hw, bool drop) 4949 + static void wlcore_op_flush(struct ieee80211_hw *hw, u32 queues, bool drop) 4950 4950 { 4951 4951 struct wl1271 *wl = hw->priv; 4952 4952
+36 -32
include/net/mac80211.h
··· 93 93 * enum ieee80211_max_queues - maximum number of queues 94 94 * 95 95 * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues. 96 + * @IEEE80211_MAX_QUEUE_MAP: bitmap with maximum queues set 96 97 */ 97 98 enum ieee80211_max_queues { 98 99 IEEE80211_MAX_QUEUES = 16, 100 + IEEE80211_MAX_QUEUE_MAP = BIT(IEEE80211_MAX_QUEUES) - 1, 99 101 }; 100 102 101 103 #define IEEE80211_INVAL_HW_QUEUE 0xff ··· 1069 1067 * path needing to access it; even though the netdev carrier will always 1070 1068 * be off when it is %NULL there can still be races and packets could be 1071 1069 * processed after it switches back to %NULL. 1070 + * @debugfs_dir: debugfs dentry, can be used by drivers to create own per 1071 + * interface debug files. Note that it will be NULL for the virtual 1072 + * monitor interface (if that is requested.) 1072 1073 * @drv_priv: data area for driver use, will always be aligned to 1073 1074 * sizeof(void *). 1074 1075 */ ··· 1087 1082 struct ieee80211_chanctx_conf __rcu *chanctx_conf; 1088 1083 1089 1084 u32 driver_flags; 1085 + 1086 + #ifdef CONFIG_MAC80211_DEBUGFS 1087 + struct dentry *debugfs_dir; 1088 + #endif 1090 1089 1091 1090 /* must be last */ 1092 1091 u8 drv_priv[0] __aligned(sizeof(void *)); ··· 1955 1946 * filter those response frames except in the case of frames that 1956 1947 * are buffered in the driver -- those must remain buffered to avoid 1957 1948 * reordering. Because it is possible that no frames are released 1958 - * in this case, the driver must call ieee80211_sta_eosp_irqsafe() 1949 + * in this case, the driver must call ieee80211_sta_eosp() 1959 1950 * to indicate to mac80211 that the service period ended anyway. 1960 1951 * 1961 1952 * Finally, if frames from multiple TIDs are released from mac80211 1962 1953 * but the driver might reorder them, it must clear & set the flags 1963 1954 * appropriately (only the last frame may have %IEEE80211_TX_STATUS_EOSP) 1964 1955 * and also take care of the EOSP and MORE_DATA bits in the frame. 1965 - * The driver may also use ieee80211_sta_eosp_irqsafe() in this case. 1956 + * The driver may also use ieee80211_sta_eosp() in this case. 1966 1957 */ 1967 1958 1968 1959 /** ··· 2235 2226 * MAC address of the device going away. 2236 2227 * Hence, this callback must be implemented. It can sleep. 2237 2228 * 2238 - * @add_interface_debugfs: Drivers can use this callback to add debugfs files 2239 - * when a vif is added to mac80211. This callback and 2240 - * @remove_interface_debugfs should be within a CONFIG_MAC80211_DEBUGFS 2241 - * conditional. @remove_interface_debugfs must be provided for cleanup. 2242 - * This callback can sleep. 2243 - * 2244 - * @remove_interface_debugfs: Remove the debugfs files which were added using 2245 - * @add_interface_debugfs. This callback must remove all debugfs entries 2246 - * that were added because mac80211 only removes interface debugfs when the 2247 - * interface is destroyed, not when it is removed from the driver. 2248 - * This callback can sleep. 2249 - * 2250 2229 * @config: Handler for configuration requests. IEEE 802.11 code calls this 2251 2230 * function to change hardware configuration, e.g., channel. 2252 2231 * This function should never fail but returns a negative error code ··· 2255 2258 * @configure_filter: Configure the device's RX filter. 2256 2259 * See the section "Frame filtering" for more information. 2257 2260 * This callback must be implemented and can sleep. 2261 + * 2262 + * @set_multicast_list: Configure the device's interface specific RX multicast 2263 + * filter. This callback is optional. This callback must be atomic. 2258 2264 * 2259 2265 * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit 2260 2266 * must be set or cleared for a given STA. Must be atomic. ··· 2440 2440 * @testmode_dump: Implement a cfg80211 test mode dump. The callback can sleep. 2441 2441 * 2442 2442 * @flush: Flush all pending frames from the hardware queue, making sure 2443 - * that the hardware queues are empty. If the parameter @drop is set 2444 - * to %true, pending frames may be dropped. The callback can sleep. 2443 + * that the hardware queues are empty. The @queues parameter is a bitmap 2444 + * of queues to flush, which is useful if different virtual interfaces 2445 + * use different hardware queues; it may also indicate all queues. 2446 + * If the parameter @drop is set to %true, pending frames may be dropped. 2447 + * The callback can sleep. 2445 2448 * 2446 2449 * @channel_switch: Drivers that need (or want) to offload the channel 2447 2450 * switch operation for CSAs received from the AP may implement this ··· 2509 2506 * setting the EOSP flag in the QoS header of the frames. Also, when the 2510 2507 * service period ends, the driver must set %IEEE80211_TX_STATUS_EOSP 2511 2508 * on the last frame in the SP. Alternatively, it may call the function 2512 - * ieee80211_sta_eosp_irqsafe() to inform mac80211 of the end of the SP. 2509 + * ieee80211_sta_eosp() to inform mac80211 of the end of the SP. 2513 2510 * This callback must be atomic. 2514 2511 * @allow_buffered_frames: Prepare device to allow the given number of frames 2515 2512 * to go out to the given station. The frames will be sent by mac80211 ··· 2520 2517 * them between the TIDs, it must set the %IEEE80211_TX_STATUS_EOSP flag 2521 2518 * on the last frame and clear it on all others and also handle the EOSP 2522 2519 * bit in the QoS header correctly. Alternatively, it can also call the 2523 - * ieee80211_sta_eosp_irqsafe() function. 2520 + * ieee80211_sta_eosp() function. 2524 2521 * The @tids parameter is a bitmap and tells the driver which TIDs the 2525 2522 * frames will be on; it will at most have two bits set. 2526 2523 * This callback must be atomic. ··· 2608 2605 unsigned int changed_flags, 2609 2606 unsigned int *total_flags, 2610 2607 u64 multicast); 2608 + void (*set_multicast_list)(struct ieee80211_hw *hw, 2609 + struct ieee80211_vif *vif, bool allmulti, 2610 + struct netdev_hw_addr_list *mc_list); 2611 + 2611 2612 int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta, 2612 2613 bool set); 2613 2614 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd, ··· 2658 2651 struct ieee80211_vif *vif, 2659 2652 struct ieee80211_sta *sta, 2660 2653 struct dentry *dir); 2661 - void (*add_interface_debugfs)(struct ieee80211_hw *hw, 2662 - struct ieee80211_vif *vif, 2663 - struct dentry *dir); 2664 - void (*remove_interface_debugfs)(struct ieee80211_hw *hw, 2665 - struct ieee80211_vif *vif, 2666 - struct dentry *dir); 2667 2654 #endif 2668 2655 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 2669 2656 enum sta_notify_cmd, struct ieee80211_sta *sta); ··· 2692 2691 struct netlink_callback *cb, 2693 2692 void *data, int len); 2694 2693 #endif 2695 - void (*flush)(struct ieee80211_hw *hw, bool drop); 2694 + void (*flush)(struct ieee80211_hw *hw, u32 queues, bool drop); 2696 2695 void (*channel_switch)(struct ieee80211_hw *hw, 2697 2696 struct ieee80211_channel_switch *ch_switch); 2698 2697 int (*napi_poll)(struct ieee80211_hw *hw, int budget); ··· 3858 3857 * %IEEE80211_TX_STATUS_EOSP bit and call this function instead. 3859 3858 * This applies for PS-Poll as well as uAPSD. 3860 3859 * 3861 - * Note that there is no non-_irqsafe version right now as 3862 - * it wasn't needed, but just like _tx_status() and _rx() 3863 - * must not be mixed in irqsafe/non-irqsafe versions, this 3864 - * function must not be mixed with those either. Use the 3865 - * all irqsafe, or all non-irqsafe, don't mix! If you need 3866 - * the non-irqsafe version of this, you need to add it. 3860 + * Note that just like with _tx_status() and _rx() drivers must 3861 + * not mix calls to irqsafe/non-irqsafe versions, this function 3862 + * must not be mixed with those either. Use the all irqsafe, or 3863 + * all non-irqsafe, don't mix! 3864 + * 3865 + * NB: the _irqsafe version of this function doesn't exist, no 3866 + * driver needs it right now. Don't call this function if 3867 + * you'd need the _irqsafe version, look at the git history 3868 + * and restore the _irqsafe version! 3867 3869 */ 3868 - void ieee80211_sta_eosp_irqsafe(struct ieee80211_sta *pubsta); 3870 + void ieee80211_sta_eosp(struct ieee80211_sta *pubsta); 3869 3871 3870 3872 /** 3871 3873 * ieee80211_iter_keys - iterate keys programmed into the device
+17 -12
net/mac80211/cfg.c
··· 175 175 * add it to the device after the station. 176 176 */ 177 177 if (!sta || !test_sta_flag(sta, WLAN_STA_ASSOC)) { 178 - ieee80211_key_free(sdata->local, key); 178 + ieee80211_key_free_unused(key); 179 179 err = -ENOENT; 180 180 goto out_unlock; 181 181 } ··· 214 214 } 215 215 216 216 err = ieee80211_key_link(key, sdata, sta); 217 - if (err) 218 - ieee80211_key_free(sdata->local, key); 219 217 220 218 out_unlock: 221 219 mutex_unlock(&sdata->local->sta_mtx); ··· 252 254 goto out_unlock; 253 255 } 254 256 255 - __ieee80211_key_free(key, true); 257 + ieee80211_key_free(key, true); 256 258 257 259 ret = 0; 258 260 out_unlock: ··· 443 445 struct ieee80211_sub_if_data *sdata = sta->sdata; 444 446 struct ieee80211_local *local = sdata->local; 445 447 struct timespec uptime; 448 + u64 packets = 0; 449 + int ac; 446 450 447 451 sinfo->generation = sdata->local->sta_generation; 448 452 449 453 sinfo->filled = STATION_INFO_INACTIVE_TIME | 450 - STATION_INFO_RX_BYTES | 451 - STATION_INFO_TX_BYTES | 454 + STATION_INFO_RX_BYTES64 | 455 + STATION_INFO_TX_BYTES64 | 452 456 STATION_INFO_RX_PACKETS | 453 457 STATION_INFO_TX_PACKETS | 454 458 STATION_INFO_TX_RETRIES | ··· 467 467 sinfo->connected_time = uptime.tv_sec - sta->last_connected; 468 468 469 469 sinfo->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx); 470 + sinfo->tx_bytes = 0; 471 + for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { 472 + sinfo->tx_bytes += sta->tx_bytes[ac]; 473 + packets += sta->tx_packets[ac]; 474 + } 475 + sinfo->tx_packets = packets; 470 476 sinfo->rx_bytes = sta->rx_bytes; 471 - sinfo->tx_bytes = sta->tx_bytes; 472 477 sinfo->rx_packets = sta->rx_packets; 473 - sinfo->tx_packets = sta->tx_packets; 474 478 sinfo->tx_retries = sta->tx_retry_count; 475 479 sinfo->tx_failed = sta->tx_retry_failed; 476 480 sinfo->rx_dropped_misc = sta->rx_dropped; ··· 602 598 data[i++] += sta->rx_fragments; \ 603 599 data[i++] += sta->rx_dropped; \ 604 600 \ 605 - data[i++] += sta->tx_packets; \ 606 - data[i++] += sta->tx_bytes; \ 601 + data[i++] += sinfo.tx_packets; \ 602 + data[i++] += sinfo.tx_bytes; \ 607 603 data[i++] += sta->tx_fragments; \ 608 604 data[i++] += sta->tx_filtered_count; \ 609 605 data[i++] += sta->tx_retry_failed; \ ··· 625 621 if (!(sta && !WARN_ON(sta->sdata->dev != dev))) 626 622 goto do_survey; 627 623 624 + sinfo.filled = 0; 625 + sta_set_sinfo(sta, &sinfo); 626 + 628 627 i = 0; 629 628 ADD_STA_STATS(sta); 630 629 631 630 data[i++] = sta->sta_state; 632 631 633 - sinfo.filled = 0; 634 - sta_set_sinfo(sta, &sinfo); 635 632 636 633 if (sinfo.filled & STATION_INFO_TX_BITRATE) 637 634 data[i] = 100000 *
+5 -5
net/mac80211/debugfs_key.c
··· 295 295 char buf[50]; 296 296 struct ieee80211_key *key; 297 297 298 - if (!sdata->debugfs.dir) 298 + if (!sdata->vif.debugfs_dir) 299 299 return; 300 300 301 301 lockdep_assert_held(&sdata->local->key_mtx); ··· 311 311 sprintf(buf, "../keys/%d", key->debugfs.cnt); 312 312 sdata->debugfs.default_unicast_key = 313 313 debugfs_create_symlink("default_unicast_key", 314 - sdata->debugfs.dir, buf); 314 + sdata->vif.debugfs_dir, buf); 315 315 } 316 316 317 317 if (sdata->debugfs.default_multicast_key) { ··· 325 325 sprintf(buf, "../keys/%d", key->debugfs.cnt); 326 326 sdata->debugfs.default_multicast_key = 327 327 debugfs_create_symlink("default_multicast_key", 328 - sdata->debugfs.dir, buf); 328 + sdata->vif.debugfs_dir, buf); 329 329 } 330 330 } 331 331 ··· 334 334 char buf[50]; 335 335 struct ieee80211_key *key; 336 336 337 - if (!sdata->debugfs.dir) 337 + if (!sdata->vif.debugfs_dir) 338 338 return; 339 339 340 340 key = key_mtx_dereference(sdata->local, ··· 343 343 sprintf(buf, "../keys/%d", key->debugfs.cnt); 344 344 sdata->debugfs.default_mgmt_key = 345 345 debugfs_create_symlink("default_mgmt_key", 346 - sdata->debugfs.dir, buf); 346 + sdata->vif.debugfs_dir, buf); 347 347 } else 348 348 ieee80211_debugfs_key_remove_mgmt_default(sdata); 349 349 }
+11 -11
net/mac80211/debugfs_netdev.c
··· 521 521 #endif 522 522 523 523 #define DEBUGFS_ADD_MODE(name, mode) \ 524 - debugfs_create_file(#name, mode, sdata->debugfs.dir, \ 524 + debugfs_create_file(#name, mode, sdata->vif.debugfs_dir, \ 525 525 sdata, &name##_ops); 526 526 527 527 #define DEBUGFS_ADD(name) DEBUGFS_ADD_MODE(name, 0400) ··· 577 577 static void add_mesh_stats(struct ieee80211_sub_if_data *sdata) 578 578 { 579 579 struct dentry *dir = debugfs_create_dir("mesh_stats", 580 - sdata->debugfs.dir); 580 + sdata->vif.debugfs_dir); 581 581 #define MESHSTATS_ADD(name)\ 582 582 debugfs_create_file(#name, 0400, dir, sdata, &name##_ops); 583 583 ··· 594 594 static void add_mesh_config(struct ieee80211_sub_if_data *sdata) 595 595 { 596 596 struct dentry *dir = debugfs_create_dir("mesh_config", 597 - sdata->debugfs.dir); 597 + sdata->vif.debugfs_dir); 598 598 599 599 #define MESHPARAMS_ADD(name) \ 600 600 debugfs_create_file(#name, 0600, dir, sdata, &name##_ops); ··· 631 631 632 632 static void add_files(struct ieee80211_sub_if_data *sdata) 633 633 { 634 - if (!sdata->debugfs.dir) 634 + if (!sdata->vif.debugfs_dir) 635 635 return; 636 636 637 637 DEBUGFS_ADD(flags); ··· 673 673 char buf[10+IFNAMSIZ]; 674 674 675 675 sprintf(buf, "netdev:%s", sdata->name); 676 - sdata->debugfs.dir = debugfs_create_dir(buf, 676 + sdata->vif.debugfs_dir = debugfs_create_dir(buf, 677 677 sdata->local->hw.wiphy->debugfsdir); 678 - if (sdata->debugfs.dir) 678 + if (sdata->vif.debugfs_dir) 679 679 sdata->debugfs.subdir_stations = debugfs_create_dir("stations", 680 - sdata->debugfs.dir); 680 + sdata->vif.debugfs_dir); 681 681 add_files(sdata); 682 682 } 683 683 684 684 void ieee80211_debugfs_remove_netdev(struct ieee80211_sub_if_data *sdata) 685 685 { 686 - if (!sdata->debugfs.dir) 686 + if (!sdata->vif.debugfs_dir) 687 687 return; 688 688 689 - debugfs_remove_recursive(sdata->debugfs.dir); 690 - sdata->debugfs.dir = NULL; 689 + debugfs_remove_recursive(sdata->vif.debugfs_dir); 690 + sdata->vif.debugfs_dir = NULL; 691 691 } 692 692 693 693 void ieee80211_debugfs_rename_netdev(struct ieee80211_sub_if_data *sdata) ··· 695 695 struct dentry *dir; 696 696 char buf[10 + IFNAMSIZ]; 697 697 698 - dir = sdata->debugfs.dir; 698 + dir = sdata->vif.debugfs_dir; 699 699 700 700 if (!dir) 701 701 return;
+20 -40
net/mac80211/driver-ops.h
··· 241 241 return ret; 242 242 } 243 243 244 + static inline void drv_set_multicast_list(struct ieee80211_local *local, 245 + struct ieee80211_sub_if_data *sdata, 246 + struct netdev_hw_addr_list *mc_list) 247 + { 248 + bool allmulti = sdata->flags & IEEE80211_SDATA_ALLMULTI; 249 + 250 + trace_drv_set_multicast_list(local, sdata, mc_list->count); 251 + 252 + check_sdata_in_driver(sdata); 253 + 254 + if (local->ops->set_multicast_list) 255 + local->ops->set_multicast_list(&local->hw, &sdata->vif, 256 + allmulti, mc_list); 257 + trace_drv_return_void(local); 258 + } 259 + 244 260 static inline void drv_configure_filter(struct ieee80211_local *local, 245 261 unsigned int changed_flags, 246 262 unsigned int *total_flags, ··· 547 531 local->ops->sta_remove_debugfs(&local->hw, &sdata->vif, 548 532 sta, dir); 549 533 } 550 - 551 - static inline 552 - void drv_add_interface_debugfs(struct ieee80211_local *local, 553 - struct ieee80211_sub_if_data *sdata) 554 - { 555 - might_sleep(); 556 - 557 - check_sdata_in_driver(sdata); 558 - 559 - if (!local->ops->add_interface_debugfs) 560 - return; 561 - 562 - local->ops->add_interface_debugfs(&local->hw, &sdata->vif, 563 - sdata->debugfs.dir); 564 - } 565 - 566 - static inline 567 - void drv_remove_interface_debugfs(struct ieee80211_local *local, 568 - struct ieee80211_sub_if_data *sdata) 569 - { 570 - might_sleep(); 571 - 572 - check_sdata_in_driver(sdata); 573 - 574 - if (!local->ops->remove_interface_debugfs) 575 - return; 576 - 577 - local->ops->remove_interface_debugfs(&local->hw, &sdata->vif, 578 - sdata->debugfs.dir); 579 - } 580 - #else 581 - static inline 582 - void drv_add_interface_debugfs(struct ieee80211_local *local, 583 - struct ieee80211_sub_if_data *sdata) {} 584 - static inline 585 - void drv_remove_interface_debugfs(struct ieee80211_local *local, 586 - struct ieee80211_sub_if_data *sdata) {} 587 534 #endif 588 535 589 536 static inline __must_check ··· 720 741 local->ops->rfkill_poll(&local->hw); 721 742 } 722 743 723 - static inline void drv_flush(struct ieee80211_local *local, bool drop) 744 + static inline void drv_flush(struct ieee80211_local *local, 745 + u32 queues, bool drop) 724 746 { 725 747 might_sleep(); 726 748 727 - trace_drv_flush(local, drop); 749 + trace_drv_flush(local, queues, drop); 728 750 if (local->ops->flush) 729 - local->ops->flush(&local->hw, drop); 751 + local->ops->flush(&local->hw, queues, drop); 730 752 trace_drv_return_void(local); 731 753 } 732 754
+5 -6
net/mac80211/ieee80211_i.h
··· 758 758 759 759 #ifdef CONFIG_MAC80211_DEBUGFS 760 760 struct { 761 - struct dentry *dir; 762 761 struct dentry *subdir_stations; 763 762 struct dentry *default_unicast_key; 764 763 struct dentry *default_multicast_key; ··· 799 800 enum { 800 801 IEEE80211_RX_MSG = 1, 801 802 IEEE80211_TX_STATUS_MSG = 2, 802 - IEEE80211_EOSP_MSG = 3, 803 - }; 804 - 805 - struct skb_eosp_msg_data { 806 - u8 sta[ETH_ALEN], iface[ETH_ALEN]; 807 803 }; 808 804 809 805 enum queue_stop_reason { ··· 809 815 IEEE80211_QUEUE_STOP_REASON_SUSPEND, 810 816 IEEE80211_QUEUE_STOP_REASON_SKB_ADD, 811 817 IEEE80211_QUEUE_STOP_REASON_OFFCHANNEL, 818 + IEEE80211_QUEUE_STOP_REASON_FLUSH, 812 819 }; 813 820 814 821 #ifdef CONFIG_MAC80211_LEDS ··· 1523 1528 struct ieee80211_hdr *hdr, bool ack); 1524 1529 1525 1530 void ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw, 1531 + unsigned long queues, 1526 1532 enum queue_stop_reason reason); 1527 1533 void ieee80211_stop_queues_by_reason(struct ieee80211_hw *hw, 1534 + unsigned long queues, 1528 1535 enum queue_stop_reason reason); 1529 1536 void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue, 1530 1537 enum queue_stop_reason reason); ··· 1543 1546 { 1544 1547 ieee80211_add_pending_skbs_fn(local, skbs, NULL, NULL); 1545 1548 } 1549 + void ieee80211_flush_queues(struct ieee80211_local *local, 1550 + struct ieee80211_sub_if_data *sdata); 1546 1551 1547 1552 void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata, 1548 1553 u16 transaction, u16 auth_alg, u16 status,
+12 -5
net/mac80211/iface.c
··· 92 92 if (local->hw.conf.flags & IEEE80211_CONF_IDLE) 93 93 return 0; 94 94 95 - drv_flush(local, false); 95 + ieee80211_flush_queues(local, NULL); 96 96 97 97 local->hw.conf.flags |= IEEE80211_CONF_IDLE; 98 98 return IEEE80211_CONF_CHANGE_IDLE; ··· 557 557 goto err_del_interface; 558 558 } 559 559 560 - drv_add_interface_debugfs(local, sdata); 561 - 562 560 if (sdata->vif.type == NL80211_IFTYPE_AP) { 563 561 local->fif_pspoll++; 564 562 local->fif_probe_req++; ··· 844 846 case NL80211_IFTYPE_AP: 845 847 skb_queue_purge(&sdata->skb_queue); 846 848 847 - drv_remove_interface_debugfs(local, sdata); 848 - 849 849 if (going_down) 850 850 drv_remove_interface(local, sdata); 851 851 } ··· 915 919 atomic_dec(&local->iff_promiscs); 916 920 sdata->flags ^= IEEE80211_SDATA_PROMISC; 917 921 } 922 + 923 + /* 924 + * TODO: If somebody needs this on AP interfaces, 925 + * it can be enabled easily but multicast 926 + * addresses from VLANs need to be synced. 927 + */ 928 + if (sdata->vif.type != NL80211_IFTYPE_MONITOR && 929 + sdata->vif.type != NL80211_IFTYPE_AP_VLAN && 930 + sdata->vif.type != NL80211_IFTYPE_AP) 931 + drv_set_multicast_list(local, sdata, &dev->mc); 932 + 918 933 spin_lock_bh(&local->filter_lock); 919 934 __hw_addr_sync(&local->mc_list, &dev->mc, dev->addr_len); 920 935 spin_unlock_bh(&local->filter_lock);
+96 -35
net/mac80211/key.c
··· 248 248 } 249 249 250 250 251 - static void __ieee80211_key_replace(struct ieee80211_sub_if_data *sdata, 252 - struct sta_info *sta, 253 - bool pairwise, 254 - struct ieee80211_key *old, 255 - struct ieee80211_key *new) 251 + static void ieee80211_key_replace(struct ieee80211_sub_if_data *sdata, 252 + struct sta_info *sta, 253 + bool pairwise, 254 + struct ieee80211_key *old, 255 + struct ieee80211_key *new) 256 256 { 257 257 int idx; 258 258 bool defunikey, defmultikey, defmgmtkey; ··· 397 397 return key; 398 398 } 399 399 400 - static void __ieee80211_key_destroy(struct ieee80211_key *key, 401 - bool delay_tailroom) 400 + static void ieee80211_key_free_common(struct ieee80211_key *key) 402 401 { 403 - if (!key) 404 - return; 405 - 406 - /* 407 - * Synchronize so the TX path can no longer be using 408 - * this key before we free/remove it. 409 - */ 410 - synchronize_net(); 411 - 412 - if (key->local) 413 - ieee80211_key_disable_hw_accel(key); 414 - 415 402 if (key->conf.cipher == WLAN_CIPHER_SUITE_CCMP) 416 403 ieee80211_aes_key_free(key->u.ccmp.tfm); 417 404 if (key->conf.cipher == WLAN_CIPHER_SUITE_AES_CMAC) 418 405 ieee80211_aes_cmac_key_free(key->u.aes_cmac.tfm); 406 + kfree(key); 407 + } 408 + 409 + static void __ieee80211_key_destroy(struct ieee80211_key *key, 410 + bool delay_tailroom) 411 + { 412 + if (key->local) 413 + ieee80211_key_disable_hw_accel(key); 414 + 419 415 if (key->local) { 420 416 struct ieee80211_sub_if_data *sdata = key->sdata; 421 417 ··· 427 431 } 428 432 } 429 433 430 - kfree(key); 434 + ieee80211_key_free_common(key); 435 + } 436 + 437 + static void ieee80211_key_destroy(struct ieee80211_key *key, 438 + bool delay_tailroom) 439 + { 440 + if (!key) 441 + return; 442 + 443 + /* 444 + * Synchronize so the TX path can no longer be using 445 + * this key before we free/remove it. 446 + */ 447 + synchronize_net(); 448 + 449 + __ieee80211_key_destroy(key, delay_tailroom); 450 + } 451 + 452 + void ieee80211_key_free_unused(struct ieee80211_key *key) 453 + { 454 + WARN_ON(key->sdata || key->local); 455 + ieee80211_key_free_common(key); 431 456 } 432 457 433 458 int ieee80211_key_link(struct ieee80211_key *key, ··· 479 462 480 463 increment_tailroom_need_count(sdata); 481 464 482 - __ieee80211_key_replace(sdata, sta, pairwise, old_key, key); 483 - __ieee80211_key_destroy(old_key, true); 465 + ieee80211_key_replace(sdata, sta, pairwise, old_key, key); 466 + ieee80211_key_destroy(old_key, true); 484 467 485 468 ieee80211_debugfs_key_add(key); 486 469 487 470 ret = ieee80211_key_enable_hw_accel(key); 471 + 472 + if (ret) 473 + ieee80211_key_free(key, true); 488 474 489 475 mutex_unlock(&sdata->local->key_mtx); 490 476 491 477 return ret; 492 478 } 493 479 494 - void __ieee80211_key_free(struct ieee80211_key *key, bool delay_tailroom) 480 + void ieee80211_key_free(struct ieee80211_key *key, bool delay_tailroom) 495 481 { 496 482 if (!key) 497 483 return; ··· 503 483 * Replace key with nothingness if it was ever used. 504 484 */ 505 485 if (key->sdata) 506 - __ieee80211_key_replace(key->sdata, key->sta, 486 + ieee80211_key_replace(key->sdata, key->sta, 507 487 key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE, 508 488 key, NULL); 509 - __ieee80211_key_destroy(key, delay_tailroom); 510 - } 511 - 512 - void ieee80211_key_free(struct ieee80211_local *local, 513 - struct ieee80211_key *key) 514 - { 515 - mutex_lock(&local->key_mtx); 516 - __ieee80211_key_free(key, true); 517 - mutex_unlock(&local->key_mtx); 489 + ieee80211_key_destroy(key, delay_tailroom); 518 490 } 519 491 520 492 void ieee80211_enable_keys(struct ieee80211_sub_if_data *sdata) ··· 566 554 void ieee80211_free_keys(struct ieee80211_sub_if_data *sdata) 567 555 { 568 556 struct ieee80211_key *key, *tmp; 557 + LIST_HEAD(keys); 569 558 570 559 cancel_delayed_work_sync(&sdata->dec_tailroom_needed_wk); 571 560 ··· 578 565 579 566 ieee80211_debugfs_key_remove_mgmt_default(sdata); 580 567 581 - list_for_each_entry_safe(key, tmp, &sdata->key_list, list) 582 - __ieee80211_key_free(key, false); 568 + list_for_each_entry_safe(key, tmp, &sdata->key_list, list) { 569 + ieee80211_key_replace(key->sdata, key->sta, 570 + key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE, 571 + key, NULL); 572 + list_add_tail(&key->list, &keys); 573 + } 583 574 584 575 ieee80211_debugfs_key_update_default(sdata); 576 + 577 + if (!list_empty(&keys)) { 578 + synchronize_net(); 579 + list_for_each_entry_safe(key, tmp, &keys, list) 580 + __ieee80211_key_destroy(key, false); 581 + } 585 582 586 583 WARN_ON_ONCE(sdata->crypto_tx_tailroom_needed_cnt || 587 584 sdata->crypto_tx_tailroom_pending_dec); 588 585 589 586 mutex_unlock(&sdata->local->key_mtx); 587 + } 588 + 589 + void ieee80211_free_sta_keys(struct ieee80211_local *local, 590 + struct sta_info *sta) 591 + { 592 + struct ieee80211_key *key, *tmp; 593 + LIST_HEAD(keys); 594 + int i; 595 + 596 + mutex_lock(&local->key_mtx); 597 + for (i = 0; i < NUM_DEFAULT_KEYS; i++) { 598 + key = key_mtx_dereference(local, sta->gtk[i]); 599 + if (!key) 600 + continue; 601 + ieee80211_key_replace(key->sdata, key->sta, 602 + key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE, 603 + key, NULL); 604 + list_add(&key->list, &keys); 605 + } 606 + 607 + key = key_mtx_dereference(local, sta->ptk); 608 + if (key) { 609 + ieee80211_key_replace(key->sdata, key->sta, 610 + key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE, 611 + key, NULL); 612 + list_add(&key->list, &keys); 613 + } 614 + 615 + /* 616 + * NB: the station code relies on this being 617 + * done even if there aren't any keys 618 + */ 619 + synchronize_net(); 620 + 621 + list_for_each_entry_safe(key, tmp, &keys, list) 622 + __ieee80211_key_destroy(key, true); 623 + 624 + mutex_unlock(&local->key_mtx); 590 625 } 591 626 592 627 void ieee80211_delayed_tailroom_dec(struct work_struct *wk)
+8 -7
net/mac80211/key.h
··· 129 129 size_t seq_len, const u8 *seq); 130 130 /* 131 131 * Insert a key into data structures (sdata, sta if necessary) 132 - * to make it used, free old key. 132 + * to make it used, free old key. On failure, also free the new key. 133 133 */ 134 - int __must_check ieee80211_key_link(struct ieee80211_key *key, 135 - struct ieee80211_sub_if_data *sdata, 136 - struct sta_info *sta); 137 - void __ieee80211_key_free(struct ieee80211_key *key, bool delay_tailroom); 138 - void ieee80211_key_free(struct ieee80211_local *local, 139 - struct ieee80211_key *key); 134 + int ieee80211_key_link(struct ieee80211_key *key, 135 + struct ieee80211_sub_if_data *sdata, 136 + struct sta_info *sta); 137 + void ieee80211_key_free(struct ieee80211_key *key, bool delay_tailroom); 138 + void ieee80211_key_free_unused(struct ieee80211_key *key); 140 139 void ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, int idx, 141 140 bool uni, bool multi); 142 141 void ieee80211_set_default_mgmt_key(struct ieee80211_sub_if_data *sdata, 143 142 int idx); 144 143 void ieee80211_free_keys(struct ieee80211_sub_if_data *sdata); 144 + void ieee80211_free_sta_keys(struct ieee80211_local *local, 145 + struct sta_info *sta); 145 146 void ieee80211_enable_keys(struct ieee80211_sub_if_data *sdata); 146 147 147 148 #define key_mtx_dereference(local, ref) \
+2 -20
net/mac80211/main.c
··· 100 100 int power; 101 101 enum nl80211_channel_type channel_type; 102 102 u32 offchannel_flag; 103 - bool scanning = false; 104 103 105 104 offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL; 106 105 if (local->scan_channel) { ··· 146 147 changed |= IEEE80211_CONF_CHANGE_SMPS; 147 148 } 148 149 149 - scanning = test_bit(SCAN_SW_SCANNING, &local->scanning) || 150 - test_bit(SCAN_ONCHANNEL_SCANNING, &local->scanning) || 151 - test_bit(SCAN_HW_SCANNING, &local->scanning); 152 150 power = chan->max_power; 153 151 154 152 rcu_read_lock(); ··· 222 226 static void ieee80211_tasklet_handler(unsigned long data) 223 227 { 224 228 struct ieee80211_local *local = (struct ieee80211_local *) data; 225 - struct sta_info *sta, *tmp; 226 - struct skb_eosp_msg_data *eosp_data; 227 229 struct sk_buff *skb; 228 230 229 231 while ((skb = skb_dequeue(&local->skb_queue)) || ··· 236 242 case IEEE80211_TX_STATUS_MSG: 237 243 skb->pkt_type = 0; 238 244 ieee80211_tx_status(&local->hw, skb); 239 - break; 240 - case IEEE80211_EOSP_MSG: 241 - eosp_data = (void *)skb->cb; 242 - for_each_sta_info(local, eosp_data->sta, sta, tmp) { 243 - /* skip wrong virtual interface */ 244 - if (memcmp(eosp_data->iface, 245 - sta->sdata->vif.addr, ETH_ALEN)) 246 - continue; 247 - clear_sta_flag(sta, WLAN_STA_SP); 248 - break; 249 - } 250 - dev_kfree_skb(skb); 251 245 break; 252 246 default: 253 247 WARN(1, "mac80211: Packet is of unknown type %d\n", ··· 277 295 "Hardware restart was requested\n"); 278 296 279 297 /* use this reason, ieee80211_reconfig will unblock it */ 280 - ieee80211_stop_queues_by_reason(hw, 281 - IEEE80211_QUEUE_STOP_REASON_SUSPEND); 298 + ieee80211_stop_queues_by_reason(hw, IEEE80211_MAX_QUEUE_MAP, 299 + IEEE80211_QUEUE_STOP_REASON_SUSPEND); 282 300 283 301 /* 284 302 * Stop all Rx during the reconfig. We don't want state changes
+1 -4
net/mac80211/mesh.c
··· 699 699 static int 700 700 ieee80211_mesh_rebuild_beacon(struct ieee80211_if_mesh *ifmsh) 701 701 { 702 - struct ieee80211_sub_if_data *sdata; 703 702 struct beacon_data *old_bcn; 704 703 int ret; 705 - sdata = container_of(ifmsh, struct ieee80211_sub_if_data, u.mesh); 706 704 707 705 mutex_lock(&ifmsh->mtx); 708 706 ··· 831 833 struct ieee80211_mgmt *hdr; 832 834 struct ieee802_11_elems elems; 833 835 size_t baselen; 834 - u8 *pos, *end; 836 + u8 *pos; 835 837 836 - end = ((u8 *) mgmt) + len; 837 838 pos = mgmt->u.probe_req.variable; 838 839 baselen = (u8 *) pos - (u8 *) mgmt; 839 840 if (baselen > len)
+8 -4
net/mac80211/mlme.c
··· 1009 1009 1010 1010 /* XXX: wait for a beacon first? */ 1011 1011 ieee80211_wake_queues_by_reason(&sdata->local->hw, 1012 + IEEE80211_MAX_QUEUE_MAP, 1012 1013 IEEE80211_QUEUE_STOP_REASON_CSA); 1013 1014 out: 1014 1015 ifmgd->flags &= ~IEEE80211_STA_CSA_RECEIVED; ··· 1109 1108 1110 1109 if (sw_elem->mode) 1111 1110 ieee80211_stop_queues_by_reason(&sdata->local->hw, 1111 + IEEE80211_MAX_QUEUE_MAP, 1112 1112 IEEE80211_QUEUE_STOP_REASON_CSA); 1113 1113 1114 1114 if (sdata->local->ops->channel_switch) { ··· 1377 1375 } 1378 1376 1379 1377 ieee80211_wake_queues_by_reason(&local->hw, 1378 + IEEE80211_MAX_QUEUE_MAP, 1380 1379 IEEE80211_QUEUE_STOP_REASON_PS); 1381 1380 } 1382 1381 ··· 1439 1436 else { 1440 1437 ieee80211_send_nullfunc(local, sdata, 1); 1441 1438 /* Flush to get the tx status of nullfunc frame */ 1442 - drv_flush(local, false); 1439 + ieee80211_flush_queues(local, sdata); 1443 1440 } 1444 1441 } 1445 1442 ··· 1770 1767 1771 1768 /* flush out any pending frame (e.g. DELBA) before deauth/disassoc */ 1772 1769 if (tx) 1773 - drv_flush(local, false); 1770 + ieee80211_flush_queues(local, sdata); 1774 1771 1775 1772 /* deauthenticate/disassociate now */ 1776 1773 if (tx || frame_buf) ··· 1779 1776 1780 1777 /* flush out frame */ 1781 1778 if (tx) 1782 - drv_flush(local, false); 1779 + ieee80211_flush_queues(local, sdata); 1783 1780 1784 1781 /* clear bssid only after building the needed mgmt frames */ 1785 1782 memset(ifmgd->bssid, 0, ETH_ALEN); ··· 1951 1948 ifmgd->probe_timeout = jiffies + msecs_to_jiffies(probe_wait_ms); 1952 1949 run_again(ifmgd, ifmgd->probe_timeout); 1953 1950 if (sdata->local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) 1954 - drv_flush(sdata->local, false); 1951 + ieee80211_flush_queues(sdata->local, sdata); 1955 1952 } 1956 1953 1957 1954 static void ieee80211_mgd_probe_ap(struct ieee80211_sub_if_data *sdata, ··· 2074 2071 true, frame_buf); 2075 2072 ifmgd->flags &= ~IEEE80211_STA_CSA_RECEIVED; 2076 2073 ieee80211_wake_queues_by_reason(&sdata->local->hw, 2074 + IEEE80211_MAX_QUEUE_MAP, 2077 2075 IEEE80211_QUEUE_STOP_REASON_CSA); 2078 2076 mutex_unlock(&ifmgd->mtx); 2079 2077
+4 -4
net/mac80211/offchannel.c
··· 118 118 * Stop queues and transmit all frames queued by the driver 119 119 * before sending nullfunc to enable powersave at the AP. 120 120 */ 121 - ieee80211_stop_queues_by_reason(&local->hw, 121 + ieee80211_stop_queues_by_reason(&local->hw, IEEE80211_MAX_QUEUE_MAP, 122 122 IEEE80211_QUEUE_STOP_REASON_OFFCHANNEL); 123 - drv_flush(local, false); 123 + ieee80211_flush_queues(local, NULL); 124 124 125 125 mutex_lock(&local->iflist_mtx); 126 126 list_for_each_entry(sdata, &local->interfaces, list) { ··· 181 181 } 182 182 mutex_unlock(&local->iflist_mtx); 183 183 184 - ieee80211_wake_queues_by_reason(&local->hw, 184 + ieee80211_wake_queues_by_reason(&local->hw, IEEE80211_MAX_QUEUE_MAP, 185 185 IEEE80211_QUEUE_STOP_REASON_OFFCHANNEL); 186 186 } 187 187 ··· 373 373 ieee80211_roc_notify_destroy(roc); 374 374 375 375 if (started) { 376 - drv_flush(local, false); 376 + ieee80211_flush_queues(local, NULL); 377 377 378 378 local->tmp_channel = NULL; 379 379 ieee80211_hw_config(local, 0);
+4 -2
net/mac80211/pm.c
··· 30 30 } 31 31 32 32 ieee80211_stop_queues_by_reason(hw, 33 - IEEE80211_QUEUE_STOP_REASON_SUSPEND); 33 + IEEE80211_MAX_QUEUE_MAP, 34 + IEEE80211_QUEUE_STOP_REASON_SUSPEND); 34 35 35 36 /* flush out all packets */ 36 37 synchronize_net(); 37 38 38 - drv_flush(local, false); 39 + ieee80211_flush_queues(local, NULL); 39 40 40 41 local->quiescing = true; 41 42 /* make quiescing visible to timers everywhere */ ··· 69 68 mutex_unlock(&local->sta_mtx); 70 69 } 71 70 ieee80211_wake_queues_by_reason(hw, 71 + IEEE80211_MAX_QUEUE_MAP, 72 72 IEEE80211_QUEUE_STOP_REASON_SUSPEND); 73 73 return err; 74 74 } else if (err > 0) {
+18 -6
net/mac80211/rc80211_minstrel_ht.c
··· 202 202 struct minstrel_rate_stats *mr; 203 203 unsigned int nsecs = 0; 204 204 unsigned int tp; 205 + unsigned int prob; 205 206 206 207 mr = &mi->groups[group].rates[rate]; 208 + prob = mr->probability; 207 209 208 - if (mr->probability < MINSTREL_FRAC(1, 10)) { 210 + if (prob < MINSTREL_FRAC(1, 10)) { 209 211 mr->cur_tp = 0; 210 212 return; 211 213 } 214 + 215 + /* 216 + * For the throughput calculation, limit the probability value to 90% to 217 + * account for collision related packet error rate fluctuation 218 + */ 219 + if (prob > MINSTREL_FRAC(9, 10)) 220 + prob = MINSTREL_FRAC(9, 10); 212 221 213 222 if (group != MINSTREL_CCK_GROUP) 214 223 nsecs = 1000 * mi->overhead / MINSTREL_TRUNC(mi->avg_ampdu_len); ··· 648 639 /* 649 640 * Sampling might add some overhead (RTS, no aggregation) 650 641 * to the frame. Hence, don't use sampling for the currently 651 - * used max TP rate. 642 + * used rates. 652 643 */ 653 - if (sample_idx == mi->max_tp_rate) 644 + if (sample_idx == mi->max_tp_rate || 645 + sample_idx == mi->max_tp_rate2 || 646 + sample_idx == mi->max_prob_rate) 654 647 return -1; 648 + 655 649 /* 656 - * When not using MRR, do not sample if the probability is already 657 - * higher than 95% to avoid wasting airtime 650 + * Do not sample if the probability is already higher than 95% 651 + * to avoid wasting airtime. 658 652 */ 659 - if (!mp->has_mrr && (mr->probability > MINSTREL_FRAC(95, 100))) 653 + if (mr->probability > MINSTREL_FRAC(95, 100)) 660 654 return -1; 661 655 662 656 /*
+2 -5
net/mac80211/scan.c
··· 153 153 u8 *elements; 154 154 struct ieee80211_channel *channel; 155 155 size_t baselen; 156 - bool beacon; 157 156 struct ieee802_11_elems elems; 158 157 159 158 if (skb->len < 24 || ··· 174 175 175 176 elements = mgmt->u.probe_resp.variable; 176 177 baselen = offsetof(struct ieee80211_mgmt, u.probe_resp.variable); 177 - beacon = false; 178 178 } else { 179 179 baselen = offsetof(struct ieee80211_mgmt, u.beacon.variable); 180 180 elements = mgmt->u.beacon.variable; 181 - beacon = true; 182 181 } 183 182 184 183 if (baselen > skb->len) ··· 332 335 ieee80211_offchannel_stop_vifs(local); 333 336 334 337 /* ensure nullfunc is transmitted before leaving operating channel */ 335 - drv_flush(local, false); 338 + ieee80211_flush_queues(local, NULL); 336 339 337 340 ieee80211_configure_filter(local); 338 341 ··· 668 671 ieee80211_offchannel_stop_vifs(local); 669 672 670 673 if (local->ops->flush) { 671 - drv_flush(local, false); 674 + ieee80211_flush_queues(local, NULL); 672 675 *next_delay = 0; 673 676 } else 674 677 *next_delay = HZ / 10;
+19 -26
net/mac80211/sta_info.c
··· 556 556 tim[id / 8] &= ~(1 << (id % 8)); 557 557 } 558 558 559 + static inline bool __bss_tim_get(u8 *tim, u16 id) 560 + { 561 + /* 562 + * This format has been mandated by the IEEE specifications, 563 + * so this line may not be changed to use the test_bit() format. 564 + */ 565 + return tim[id / 8] & (1 << (id % 8)); 566 + } 567 + 559 568 static unsigned long ieee80211_tids_for_ac(int ac) 560 569 { 561 570 /* If we ever support TIDs > 7, this obviously needs to be adjusted */ ··· 645 636 done: 646 637 spin_lock_bh(&local->tim_lock); 647 638 639 + if (indicate_tim == __bss_tim_get(ps->tim, id)) 640 + goto out_unlock; 641 + 648 642 if (indicate_tim) 649 643 __bss_tim_set(ps->tim, id); 650 644 else ··· 659 647 local->tim_in_locked_section = false; 660 648 } 661 649 650 + out_unlock: 662 651 spin_unlock_bh(&local->tim_lock); 663 652 } 664 653 ··· 783 770 { 784 771 struct ieee80211_local *local; 785 772 struct ieee80211_sub_if_data *sdata; 786 - int ret, i; 773 + int ret; 787 774 788 775 might_sleep(); 789 776 ··· 810 797 811 798 list_del_rcu(&sta->list); 812 799 813 - mutex_lock(&local->key_mtx); 814 - for (i = 0; i < NUM_DEFAULT_KEYS; i++) 815 - __ieee80211_key_free(key_mtx_dereference(local, sta->gtk[i]), 816 - true); 817 - if (sta->ptk) 818 - __ieee80211_key_free(key_mtx_dereference(local, sta->ptk), 819 - true); 820 - mutex_unlock(&local->key_mtx); 800 + /* this always calls synchronize_net() */ 801 + ieee80211_free_sta_keys(local, sta); 821 802 822 803 sta->dead = true; 823 804 ··· 1397 1390 } 1398 1391 EXPORT_SYMBOL(ieee80211_sta_block_awake); 1399 1392 1400 - void ieee80211_sta_eosp_irqsafe(struct ieee80211_sta *pubsta) 1393 + void ieee80211_sta_eosp(struct ieee80211_sta *pubsta) 1401 1394 { 1402 1395 struct sta_info *sta = container_of(pubsta, struct sta_info, sta); 1403 1396 struct ieee80211_local *local = sta->local; 1404 - struct sk_buff *skb; 1405 - struct skb_eosp_msg_data *data; 1406 1397 1407 1398 trace_api_eosp(local, pubsta); 1408 1399 1409 - skb = alloc_skb(0, GFP_ATOMIC); 1410 - if (!skb) { 1411 - /* too bad ... but race is better than loss */ 1412 - clear_sta_flag(sta, WLAN_STA_SP); 1413 - return; 1414 - } 1415 - 1416 - data = (void *)skb->cb; 1417 - memcpy(data->sta, pubsta->addr, ETH_ALEN); 1418 - memcpy(data->iface, sta->sdata->vif.addr, ETH_ALEN); 1419 - skb->pkt_type = IEEE80211_EOSP_MSG; 1420 - skb_queue_tail(&local->skb_queue, skb); 1421 - tasklet_schedule(&local->tasklet); 1400 + clear_sta_flag(sta, WLAN_STA_SP); 1422 1401 } 1423 - EXPORT_SYMBOL(ieee80211_sta_eosp_irqsafe); 1402 + EXPORT_SYMBOL(ieee80211_sta_eosp); 1424 1403 1425 1404 void ieee80211_sta_set_buffered(struct ieee80211_sta *pubsta, 1426 1405 u8 tid, bool buffered)
+5 -4
net/mac80211/sta_info.h
··· 333 333 unsigned long driver_buffered_tids; 334 334 335 335 /* Updated from RX path only, no locking requirements */ 336 - unsigned long rx_packets, rx_bytes; 336 + unsigned long rx_packets; 337 + u64 rx_bytes; 337 338 unsigned long wep_weak_iv_count; 338 339 unsigned long last_rx; 339 340 long last_connected; ··· 354 353 unsigned int fail_avg; 355 354 356 355 /* Updated from TX path only, no locking requirements */ 357 - unsigned long tx_packets; 358 - unsigned long tx_bytes; 359 - unsigned long tx_fragments; 356 + u32 tx_fragments; 357 + u64 tx_packets[IEEE80211_NUM_ACS]; 358 + u64 tx_bytes[IEEE80211_NUM_ACS]; 360 359 struct ieee80211_tx_rate last_tx_rate; 361 360 int last_rx_rate_idx; 362 361 u32 last_rx_rate_flag;
+31 -4
net/mac80211/trace.h
··· 431 431 ) 432 432 ); 433 433 434 + TRACE_EVENT(drv_set_multicast_list, 435 + TP_PROTO(struct ieee80211_local *local, 436 + struct ieee80211_sub_if_data *sdata, int mc_count), 437 + 438 + TP_ARGS(local, sdata, mc_count), 439 + 440 + TP_STRUCT__entry( 441 + LOCAL_ENTRY 442 + __field(bool, allmulti) 443 + __field(int, mc_count) 444 + ), 445 + 446 + TP_fast_assign( 447 + LOCAL_ASSIGN; 448 + __entry->allmulti = sdata->flags & IEEE80211_SDATA_ALLMULTI; 449 + __entry->mc_count = mc_count; 450 + ), 451 + 452 + TP_printk( 453 + LOCAL_PR_FMT " configure mc filter, count=%d, allmulti=%d", 454 + LOCAL_PR_ARG, __entry->mc_count, __entry->allmulti 455 + ) 456 + ); 457 + 434 458 TRACE_EVENT(drv_configure_filter, 435 459 TP_PROTO(struct ieee80211_local *local, 436 460 unsigned int changed_flags, ··· 964 940 ); 965 941 966 942 TRACE_EVENT(drv_flush, 967 - TP_PROTO(struct ieee80211_local *local, bool drop), 943 + TP_PROTO(struct ieee80211_local *local, 944 + u32 queues, bool drop), 968 945 969 - TP_ARGS(local, drop), 946 + TP_ARGS(local, queues, drop), 970 947 971 948 TP_STRUCT__entry( 972 949 LOCAL_ENTRY 973 950 __field(bool, drop) 951 + __field(u32, queues) 974 952 ), 975 953 976 954 TP_fast_assign( 977 955 LOCAL_ASSIGN; 978 956 __entry->drop = drop; 957 + __entry->queues = queues; 979 958 ), 980 959 981 960 TP_printk( 982 - LOCAL_PR_FMT " drop:%d", 983 - LOCAL_PR_ARG, __entry->drop 961 + LOCAL_PR_FMT " queues:0x%x drop:%d", 962 + LOCAL_PR_ARG, __entry->queues, __entry->drop 984 963 ) 985 964 ); 986 965
+6 -2
net/mac80211/tx.c
··· 233 233 234 234 if (local->hw.conf.flags & IEEE80211_CONF_PS) { 235 235 ieee80211_stop_queues_by_reason(&local->hw, 236 + IEEE80211_MAX_QUEUE_MAP, 236 237 IEEE80211_QUEUE_STOP_REASON_PS); 237 238 ifmgd->flags &= ~IEEE80211_STA_NULLFUNC_ACKED; 238 239 ieee80211_queue_work(&local->hw, ··· 992 991 ieee80211_tx_h_stats(struct ieee80211_tx_data *tx) 993 992 { 994 993 struct sk_buff *skb; 994 + int ac = -1; 995 995 996 996 if (!tx->sta) 997 997 return TX_CONTINUE; 998 998 999 - tx->sta->tx_packets++; 1000 999 skb_queue_walk(&tx->skbs, skb) { 1000 + ac = skb_get_queue_mapping(skb); 1001 1001 tx->sta->tx_fragments++; 1002 - tx->sta->tx_bytes += skb->len; 1002 + tx->sta->tx_bytes[ac] += skb->len; 1003 1003 } 1004 + if (ac >= 0) 1005 + tx->sta->tx_packets[ac]++; 1004 1006 1005 1007 return TX_CONTINUE; 1006 1008 }
+41 -7
net/mac80211/util.c
··· 453 453 } 454 454 455 455 void ieee80211_stop_queues_by_reason(struct ieee80211_hw *hw, 456 - enum queue_stop_reason reason) 456 + unsigned long queues, 457 + enum queue_stop_reason reason) 457 458 { 458 459 struct ieee80211_local *local = hw_to_local(hw); 459 460 unsigned long flags; ··· 462 461 463 462 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); 464 463 465 - for (i = 0; i < hw->queues; i++) 464 + for_each_set_bit(i, &queues, hw->queues) 466 465 __ieee80211_stop_queue(hw, i, reason); 467 466 468 467 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); ··· 470 469 471 470 void ieee80211_stop_queues(struct ieee80211_hw *hw) 472 471 { 473 - ieee80211_stop_queues_by_reason(hw, 472 + ieee80211_stop_queues_by_reason(hw, IEEE80211_MAX_QUEUE_MAP, 474 473 IEEE80211_QUEUE_STOP_REASON_DRIVER); 475 474 } 476 475 EXPORT_SYMBOL(ieee80211_stop_queues); ··· 492 491 EXPORT_SYMBOL(ieee80211_queue_stopped); 493 492 494 493 void ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw, 494 + unsigned long queues, 495 495 enum queue_stop_reason reason) 496 496 { 497 497 struct ieee80211_local *local = hw_to_local(hw); ··· 501 499 502 500 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); 503 501 504 - for (i = 0; i < hw->queues; i++) 502 + for_each_set_bit(i, &queues, hw->queues) 505 503 __ieee80211_wake_queue(hw, i, reason); 506 504 507 505 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); ··· 509 507 510 508 void ieee80211_wake_queues(struct ieee80211_hw *hw) 511 509 { 512 - ieee80211_wake_queues_by_reason(hw, IEEE80211_QUEUE_STOP_REASON_DRIVER); 510 + ieee80211_wake_queues_by_reason(hw, IEEE80211_MAX_QUEUE_MAP, 511 + IEEE80211_QUEUE_STOP_REASON_DRIVER); 513 512 } 514 513 EXPORT_SYMBOL(ieee80211_wake_queues); 514 + 515 + void ieee80211_flush_queues(struct ieee80211_local *local, 516 + struct ieee80211_sub_if_data *sdata) 517 + { 518 + u32 queues; 519 + 520 + if (!local->ops->flush) 521 + return; 522 + 523 + if (sdata && local->hw.flags & IEEE80211_HW_QUEUE_CONTROL) { 524 + int ac; 525 + 526 + queues = 0; 527 + 528 + for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) 529 + queues |= BIT(sdata->vif.hw_queue[ac]); 530 + if (sdata->vif.cab_queue != IEEE80211_INVAL_HW_QUEUE) 531 + queues |= BIT(sdata->vif.cab_queue); 532 + } else { 533 + /* all queues */ 534 + queues = BIT(local->hw.queues) - 1; 535 + } 536 + 537 + ieee80211_stop_queues_by_reason(&local->hw, IEEE80211_MAX_QUEUE_MAP, 538 + IEEE80211_QUEUE_STOP_REASON_FLUSH); 539 + 540 + drv_flush(local, queues, false); 541 + 542 + ieee80211_wake_queues_by_reason(&local->hw, IEEE80211_MAX_QUEUE_MAP, 543 + IEEE80211_QUEUE_STOP_REASON_FLUSH); 544 + } 515 545 516 546 void ieee80211_iterate_active_interfaces( 517 547 struct ieee80211_hw *hw, u32 iter_flags, ··· 1685 1651 mutex_unlock(&local->sta_mtx); 1686 1652 } 1687 1653 1688 - ieee80211_wake_queues_by_reason(hw, 1689 - IEEE80211_QUEUE_STOP_REASON_SUSPEND); 1654 + ieee80211_wake_queues_by_reason(hw, IEEE80211_MAX_QUEUE_MAP, 1655 + IEEE80211_QUEUE_STOP_REASON_SUSPEND); 1690 1656 1691 1657 /* 1692 1658 * If this is for hw restart things are still running.
+3 -1
net/wireless/core.c
··· 1096 1096 goto out_fail_reg; 1097 1097 1098 1098 cfg80211_wq = create_singlethread_workqueue("cfg80211"); 1099 - if (!cfg80211_wq) 1099 + if (!cfg80211_wq) { 1100 + err = -ENOMEM; 1100 1101 goto out_fail_wq; 1102 + } 1101 1103 1102 1104 return 0; 1103 1105
+1 -1
net/wireless/sme.c
··· 234 234 wdev_unlock(wdev); 235 235 continue; 236 236 } 237 - if (wdev->sme_state != CFG80211_SME_CONNECTING) { 237 + if (wdev->sme_state != CFG80211_SME_CONNECTING || !wdev->conn) { 238 238 wdev_unlock(wdev); 239 239 continue; 240 240 }