···964964 newtype, vif->addr);965965 hwsim_check_magic(vif);966966967967+ /*968968+ * interface may change from non-AP to AP in969969+ * which case this needs to be set up again970970+ */971971+ vif->cab_queue = 0;972972+967973 return 0;968974}969975···13951389 return 0;13961390}1397139113981398-static void mac80211_hwsim_flush(struct ieee80211_hw *hw, bool drop)13921392+static void mac80211_hwsim_flush(struct ieee80211_hw *hw, u32 queues, bool drop)13991393{14001394 /* Not implemented, queues only on kernel side */14011395}
···11661166 * before switch channle or power save, or tx buffer packet11671167 * maybe send after offchannel or rf sleep, this may cause11681168 * dis-association by AP */11691169-static void rtl_op_flush(struct ieee80211_hw *hw, bool drop)11691169+static void rtl_op_flush(struct ieee80211_hw *hw, u32 queues, bool drop)11701170{11711171 struct rtl_priv *rtlpriv = rtl_priv(hw);11721172
···9393 * enum ieee80211_max_queues - maximum number of queues9494 *9595 * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues.9696+ * @IEEE80211_MAX_QUEUE_MAP: bitmap with maximum queues set9697 */9798enum ieee80211_max_queues {9899 IEEE80211_MAX_QUEUES = 16,100100+ IEEE80211_MAX_QUEUE_MAP = BIT(IEEE80211_MAX_QUEUES) - 1,99101};100102101103#define IEEE80211_INVAL_HW_QUEUE 0xff···10691067 * path needing to access it; even though the netdev carrier will always10701068 * be off when it is %NULL there can still be races and packets could be10711069 * processed after it switches back to %NULL.10701070+ * @debugfs_dir: debugfs dentry, can be used by drivers to create own per10711071+ * interface debug files. Note that it will be NULL for the virtual10721072+ * monitor interface (if that is requested.)10721073 * @drv_priv: data area for driver use, will always be aligned to10731074 * sizeof(void *).10741075 */···10871082 struct ieee80211_chanctx_conf __rcu *chanctx_conf;1088108310891084 u32 driver_flags;10851085+10861086+#ifdef CONFIG_MAC80211_DEBUGFS10871087+ struct dentry *debugfs_dir;10881088+#endif1090108910911090 /* must be last */10921091 u8 drv_priv[0] __aligned(sizeof(void *));···19551946 * filter those response frames except in the case of frames that19561947 * are buffered in the driver -- those must remain buffered to avoid19571948 * reordering. Because it is possible that no frames are released19581958- * in this case, the driver must call ieee80211_sta_eosp_irqsafe()19491949+ * in this case, the driver must call ieee80211_sta_eosp()19591950 * to indicate to mac80211 that the service period ended anyway.19601951 *19611952 * Finally, if frames from multiple TIDs are released from mac8021119621953 * but the driver might reorder them, it must clear & set the flags19631954 * appropriately (only the last frame may have %IEEE80211_TX_STATUS_EOSP)19641955 * and also take care of the EOSP and MORE_DATA bits in the frame.19651965- * The driver may also use ieee80211_sta_eosp_irqsafe() in this case.19561956+ * The driver may also use ieee80211_sta_eosp() in this case.19661957 */1967195819681959/**···22352226 * MAC address of the device going away.22362227 * Hence, this callback must be implemented. It can sleep.22372228 *22382238- * @add_interface_debugfs: Drivers can use this callback to add debugfs files22392239- * when a vif is added to mac80211. This callback and22402240- * @remove_interface_debugfs should be within a CONFIG_MAC80211_DEBUGFS22412241- * conditional. @remove_interface_debugfs must be provided for cleanup.22422242- * This callback can sleep.22432243- *22442244- * @remove_interface_debugfs: Remove the debugfs files which were added using22452245- * @add_interface_debugfs. This callback must remove all debugfs entries22462246- * that were added because mac80211 only removes interface debugfs when the22472247- * interface is destroyed, not when it is removed from the driver.22482248- * This callback can sleep.22492249- *22502229 * @config: Handler for configuration requests. IEEE 802.11 code calls this22512230 * function to change hardware configuration, e.g., channel.22522231 * This function should never fail but returns a negative error code···22552258 * @configure_filter: Configure the device's RX filter.22562259 * See the section "Frame filtering" for more information.22572260 * This callback must be implemented and can sleep.22612261+ *22622262+ * @set_multicast_list: Configure the device's interface specific RX multicast22632263+ * filter. This callback is optional. This callback must be atomic.22582264 *22592265 * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit22602266 * must be set or cleared for a given STA. Must be atomic.···24402440 * @testmode_dump: Implement a cfg80211 test mode dump. The callback can sleep.24412441 *24422442 * @flush: Flush all pending frames from the hardware queue, making sure24432443- * that the hardware queues are empty. If the parameter @drop is set24442444- * to %true, pending frames may be dropped. The callback can sleep.24432443+ * that the hardware queues are empty. The @queues parameter is a bitmap24442444+ * of queues to flush, which is useful if different virtual interfaces24452445+ * use different hardware queues; it may also indicate all queues.24462446+ * If the parameter @drop is set to %true, pending frames may be dropped.24472447+ * The callback can sleep.24452448 *24462449 * @channel_switch: Drivers that need (or want) to offload the channel24472450 * switch operation for CSAs received from the AP may implement this···25092506 * setting the EOSP flag in the QoS header of the frames. Also, when the25102507 * service period ends, the driver must set %IEEE80211_TX_STATUS_EOSP25112508 * on the last frame in the SP. Alternatively, it may call the function25122512- * ieee80211_sta_eosp_irqsafe() to inform mac80211 of the end of the SP.25092509+ * ieee80211_sta_eosp() to inform mac80211 of the end of the SP.25132510 * This callback must be atomic.25142511 * @allow_buffered_frames: Prepare device to allow the given number of frames25152512 * to go out to the given station. The frames will be sent by mac80211···25202517 * them between the TIDs, it must set the %IEEE80211_TX_STATUS_EOSP flag25212518 * on the last frame and clear it on all others and also handle the EOSP25222519 * bit in the QoS header correctly. Alternatively, it can also call the25232523- * ieee80211_sta_eosp_irqsafe() function.25202520+ * ieee80211_sta_eosp() function.25242521 * The @tids parameter is a bitmap and tells the driver which TIDs the25252522 * frames will be on; it will at most have two bits set.25262523 * This callback must be atomic.···26082605 unsigned int changed_flags,26092606 unsigned int *total_flags,26102607 u64 multicast);26082608+ void (*set_multicast_list)(struct ieee80211_hw *hw,26092609+ struct ieee80211_vif *vif, bool allmulti,26102610+ struct netdev_hw_addr_list *mc_list);26112611+26112612 int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta,26122613 bool set);26132614 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd,···26582651 struct ieee80211_vif *vif,26592652 struct ieee80211_sta *sta,26602653 struct dentry *dir);26612661- void (*add_interface_debugfs)(struct ieee80211_hw *hw,26622662- struct ieee80211_vif *vif,26632663- struct dentry *dir);26642664- void (*remove_interface_debugfs)(struct ieee80211_hw *hw,26652665- struct ieee80211_vif *vif,26662666- struct dentry *dir);26672654#endif26682655 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,26692656 enum sta_notify_cmd, struct ieee80211_sta *sta);···26922691 struct netlink_callback *cb,26932692 void *data, int len);26942693#endif26952695- void (*flush)(struct ieee80211_hw *hw, bool drop);26942694+ void (*flush)(struct ieee80211_hw *hw, u32 queues, bool drop);26962695 void (*channel_switch)(struct ieee80211_hw *hw,26972696 struct ieee80211_channel_switch *ch_switch);26982697 int (*napi_poll)(struct ieee80211_hw *hw, int budget);···38583857 * %IEEE80211_TX_STATUS_EOSP bit and call this function instead.38593858 * This applies for PS-Poll as well as uAPSD.38603859 *38613861- * Note that there is no non-_irqsafe version right now as38623862- * it wasn't needed, but just like _tx_status() and _rx()38633863- * must not be mixed in irqsafe/non-irqsafe versions, this38643864- * function must not be mixed with those either. Use the38653865- * all irqsafe, or all non-irqsafe, don't mix! If you need38663866- * the non-irqsafe version of this, you need to add it.38603860+ * Note that just like with _tx_status() and _rx() drivers must38613861+ * not mix calls to irqsafe/non-irqsafe versions, this function38623862+ * must not be mixed with those either. Use the all irqsafe, or38633863+ * all non-irqsafe, don't mix!38643864+ *38653865+ * NB: the _irqsafe version of this function doesn't exist, no38663866+ * driver needs it right now. Don't call this function if38673867+ * you'd need the _irqsafe version, look at the git history38683868+ * and restore the _irqsafe version!38673869 */38683868-void ieee80211_sta_eosp_irqsafe(struct ieee80211_sta *pubsta);38703870+void ieee80211_sta_eosp(struct ieee80211_sta *pubsta);3869387138703872/**38713873 * ieee80211_iter_keys - iterate keys programmed into the device
···1009100910101010 /* XXX: wait for a beacon first? */10111011 ieee80211_wake_queues_by_reason(&sdata->local->hw,10121012+ IEEE80211_MAX_QUEUE_MAP,10121013 IEEE80211_QUEUE_STOP_REASON_CSA);10131014 out:10141015 ifmgd->flags &= ~IEEE80211_STA_CSA_RECEIVED;···1109110811101109 if (sw_elem->mode)11111110 ieee80211_stop_queues_by_reason(&sdata->local->hw,11111111+ IEEE80211_MAX_QUEUE_MAP,11121112 IEEE80211_QUEUE_STOP_REASON_CSA);1113111311141114 if (sdata->local->ops->channel_switch) {···13771375 }1378137613791377 ieee80211_wake_queues_by_reason(&local->hw,13781378+ IEEE80211_MAX_QUEUE_MAP,13801379 IEEE80211_QUEUE_STOP_REASON_PS);13811380}13821381···14391436 else {14401437 ieee80211_send_nullfunc(local, sdata, 1);14411438 /* Flush to get the tx status of nullfunc frame */14421442- drv_flush(local, false);14391439+ ieee80211_flush_queues(local, sdata);14431440 }14441441 }14451442···1770176717711768 /* flush out any pending frame (e.g. DELBA) before deauth/disassoc */17721769 if (tx)17731773- drv_flush(local, false);17701770+ ieee80211_flush_queues(local, sdata);1774177117751772 /* deauthenticate/disassociate now */17761773 if (tx || frame_buf)···1779177617801777 /* flush out frame */17811778 if (tx)17821782- drv_flush(local, false);17791779+ ieee80211_flush_queues(local, sdata);1783178017841781 /* clear bssid only after building the needed mgmt frames */17851782 memset(ifmgd->bssid, 0, ETH_ALEN);···19511948 ifmgd->probe_timeout = jiffies + msecs_to_jiffies(probe_wait_ms);19521949 run_again(ifmgd, ifmgd->probe_timeout);19531950 if (sdata->local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS)19541954- drv_flush(sdata->local, false);19511951+ ieee80211_flush_queues(sdata->local, sdata);19551952}1956195319571954static void ieee80211_mgd_probe_ap(struct ieee80211_sub_if_data *sdata,···20742071 true, frame_buf);20752072 ifmgd->flags &= ~IEEE80211_STA_CSA_RECEIVED;20762073 ieee80211_wake_queues_by_reason(&sdata->local->hw,20742074+ IEEE80211_MAX_QUEUE_MAP,20772075 IEEE80211_QUEUE_STOP_REASON_CSA);20782076 mutex_unlock(&ifmgd->mtx);20792077
+4-4
net/mac80211/offchannel.c
···118118 * Stop queues and transmit all frames queued by the driver119119 * before sending nullfunc to enable powersave at the AP.120120 */121121- ieee80211_stop_queues_by_reason(&local->hw,121121+ ieee80211_stop_queues_by_reason(&local->hw, IEEE80211_MAX_QUEUE_MAP,122122 IEEE80211_QUEUE_STOP_REASON_OFFCHANNEL);123123- drv_flush(local, false);123123+ ieee80211_flush_queues(local, NULL);124124125125 mutex_lock(&local->iflist_mtx);126126 list_for_each_entry(sdata, &local->interfaces, list) {···181181 }182182 mutex_unlock(&local->iflist_mtx);183183184184- ieee80211_wake_queues_by_reason(&local->hw,184184+ ieee80211_wake_queues_by_reason(&local->hw, IEEE80211_MAX_QUEUE_MAP,185185 IEEE80211_QUEUE_STOP_REASON_OFFCHANNEL);186186}187187···373373 ieee80211_roc_notify_destroy(roc);374374375375 if (started) {376376- drv_flush(local, false);376376+ ieee80211_flush_queues(local, NULL);377377378378 local->tmp_channel = NULL;379379 ieee80211_hw_config(local, 0);
+4-2
net/mac80211/pm.c
···3030 }31313232 ieee80211_stop_queues_by_reason(hw,3333- IEEE80211_QUEUE_STOP_REASON_SUSPEND);3333+ IEEE80211_MAX_QUEUE_MAP,3434+ IEEE80211_QUEUE_STOP_REASON_SUSPEND);34353536 /* flush out all packets */3637 synchronize_net();37383838- drv_flush(local, false);3939+ ieee80211_flush_queues(local, NULL);39404041 local->quiescing = true;4142 /* make quiescing visible to timers everywhere */···6968 mutex_unlock(&local->sta_mtx);7069 }7170 ieee80211_wake_queues_by_reason(hw,7171+ IEEE80211_MAX_QUEUE_MAP,7272 IEEE80211_QUEUE_STOP_REASON_SUSPEND);7373 return err;7474 } else if (err > 0) {
+18-6
net/mac80211/rc80211_minstrel_ht.c
···202202 struct minstrel_rate_stats *mr;203203 unsigned int nsecs = 0;204204 unsigned int tp;205205+ unsigned int prob;205206206207 mr = &mi->groups[group].rates[rate];208208+ prob = mr->probability;207209208208- if (mr->probability < MINSTREL_FRAC(1, 10)) {210210+ if (prob < MINSTREL_FRAC(1, 10)) {209211 mr->cur_tp = 0;210212 return;211213 }214214+215215+ /*216216+ * For the throughput calculation, limit the probability value to 90% to217217+ * account for collision related packet error rate fluctuation218218+ */219219+ if (prob > MINSTREL_FRAC(9, 10))220220+ prob = MINSTREL_FRAC(9, 10);212221213222 if (group != MINSTREL_CCK_GROUP)214223 nsecs = 1000 * mi->overhead / MINSTREL_TRUNC(mi->avg_ampdu_len);···648639 /*649640 * Sampling might add some overhead (RTS, no aggregation)650641 * to the frame. Hence, don't use sampling for the currently651651- * used max TP rate.642642+ * used rates.652643 */653653- if (sample_idx == mi->max_tp_rate)644644+ if (sample_idx == mi->max_tp_rate ||645645+ sample_idx == mi->max_tp_rate2 ||646646+ sample_idx == mi->max_prob_rate)654647 return -1;648648+655649 /*656656- * When not using MRR, do not sample if the probability is already657657- * higher than 95% to avoid wasting airtime650650+ * Do not sample if the probability is already higher than 95%651651+ * to avoid wasting airtime.658652 */659659- if (!mp->has_mrr && (mr->probability > MINSTREL_FRAC(95, 100)))653653+ if (mr->probability > MINSTREL_FRAC(95, 100))660654 return -1;661655662656 /*
···556556 tim[id / 8] &= ~(1 << (id % 8));557557}558558559559+static inline bool __bss_tim_get(u8 *tim, u16 id)560560+{561561+ /*562562+ * This format has been mandated by the IEEE specifications,563563+ * so this line may not be changed to use the test_bit() format.564564+ */565565+ return tim[id / 8] & (1 << (id % 8));566566+}567567+559568static unsigned long ieee80211_tids_for_ac(int ac)560569{561570 /* If we ever support TIDs > 7, this obviously needs to be adjusted */···645636 done:646637 spin_lock_bh(&local->tim_lock);647638639639+ if (indicate_tim == __bss_tim_get(ps->tim, id))640640+ goto out_unlock;641641+648642 if (indicate_tim)649643 __bss_tim_set(ps->tim, id);650644 else···659647 local->tim_in_locked_section = false;660648 }661649650650+out_unlock:662651 spin_unlock_bh(&local->tim_lock);663652}664653···783770{784771 struct ieee80211_local *local;785772 struct ieee80211_sub_if_data *sdata;786786- int ret, i;773773+ int ret;787774788775 might_sleep();789776···810797811798 list_del_rcu(&sta->list);812799813813- mutex_lock(&local->key_mtx);814814- for (i = 0; i < NUM_DEFAULT_KEYS; i++)815815- __ieee80211_key_free(key_mtx_dereference(local, sta->gtk[i]),816816- true);817817- if (sta->ptk)818818- __ieee80211_key_free(key_mtx_dereference(local, sta->ptk),819819- true);820820- mutex_unlock(&local->key_mtx);800800+ /* this always calls synchronize_net() */801801+ ieee80211_free_sta_keys(local, sta);821802822803 sta->dead = true;823804···13971390}13981391EXPORT_SYMBOL(ieee80211_sta_block_awake);1399139214001400-void ieee80211_sta_eosp_irqsafe(struct ieee80211_sta *pubsta)13931393+void ieee80211_sta_eosp(struct ieee80211_sta *pubsta)14011394{14021395 struct sta_info *sta = container_of(pubsta, struct sta_info, sta);14031396 struct ieee80211_local *local = sta->local;14041404- struct sk_buff *skb;14051405- struct skb_eosp_msg_data *data;1406139714071398 trace_api_eosp(local, pubsta);1408139914091409- skb = alloc_skb(0, GFP_ATOMIC);14101410- if (!skb) {14111411- /* too bad ... but race is better than loss */14121412- clear_sta_flag(sta, WLAN_STA_SP);14131413- return;14141414- }14151415-14161416- data = (void *)skb->cb;14171417- memcpy(data->sta, pubsta->addr, ETH_ALEN);14181418- memcpy(data->iface, sta->sdata->vif.addr, ETH_ALEN);14191419- skb->pkt_type = IEEE80211_EOSP_MSG;14201420- skb_queue_tail(&local->skb_queue, skb);14211421- tasklet_schedule(&local->tasklet);14001400+ clear_sta_flag(sta, WLAN_STA_SP);14221401}14231423-EXPORT_SYMBOL(ieee80211_sta_eosp_irqsafe);14021402+EXPORT_SYMBOL(ieee80211_sta_eosp);1424140314251404void ieee80211_sta_set_buffered(struct ieee80211_sta *pubsta,14261405 u8 tid, bool buffered)
+5-4
net/mac80211/sta_info.h
···333333 unsigned long driver_buffered_tids;334334335335 /* Updated from RX path only, no locking requirements */336336- unsigned long rx_packets, rx_bytes;336336+ unsigned long rx_packets;337337+ u64 rx_bytes;337338 unsigned long wep_weak_iv_count;338339 unsigned long last_rx;339340 long last_connected;···354353 unsigned int fail_avg;355354356355 /* Updated from TX path only, no locking requirements */357357- unsigned long tx_packets;358358- unsigned long tx_bytes;359359- unsigned long tx_fragments;356356+ u32 tx_fragments;357357+ u64 tx_packets[IEEE80211_NUM_ACS];358358+ u64 tx_bytes[IEEE80211_NUM_ACS];360359 struct ieee80211_tx_rate last_tx_rate;361360 int last_rx_rate_idx;362361 u32 last_rx_rate_flag;