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

Revert "mac80211: Add airtime account and scheduling to TXQs"

This reverts commit b0d52ad821843a6c5badebd80feef9f871904fa6.

We need to revert the TXQ scheduling API due to conflicts
with a new driver, and this depends on that API.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>

+8 -121
-24
include/net/mac80211.h
··· 1188 1188 * HT or VHT is used (%RX_FLAG_HT/%RX_FLAG_VHT) 1189 1189 * @nss: number of streams (VHT and HE only) 1190 1190 * @flag: %RX_FLAG_\* 1191 - * @airtime: Duration of frame in usec. See @IEEE80211_HW_AIRTIME_ACCOUNTING for 1192 - * how to use this. 1193 1191 * @encoding: &enum mac80211_rx_encoding 1194 1192 * @bw: &enum rate_info_bw 1195 1193 * @enc_flags: uses bits from &enum mac80211_rx_encoding_flags ··· 1202 1204 u32 device_timestamp; 1203 1205 u32 ampdu_reference; 1204 1206 u32 flag; 1205 - u16 airtime; 1206 1207 u16 freq; 1207 1208 u8 enc_flags; 1208 1209 u8 encoding:2, bw:3; ··· 2066 2069 * @IEEE80211_HW_SUPPORTS_TDLS_BUFFER_STA: Hardware supports buffer STA on 2067 2070 * TDLS links. 2068 2071 * 2069 - * @IEEE80211_HW_AIRTIME_ACCOUNTING: Hardware supports accounting the airtime 2070 - * usage of other stations and reports it in the @tx_time and/or @airtime 2071 - * fields of the TX/RX status structs. 2072 - * When setting this flag, the driver should ensure that the respective 2073 - * fields in the TX and RX status structs are always either zero or 2074 - * contains a valid duration for the frame in usec. The driver can choose 2075 - * to report either or both of TX and RX airtime, but it is recommended to 2076 - * report both. 2077 - * The reported airtime should as a minimum include all time that is spent 2078 - * transmitting to the remote station, including overhead and padding, but 2079 - * not including time spent waiting for a TXOP. If the time is not reported 2080 - * by the hardware it can in some cases be calculated from the rate and 2081 - * known frame composition. When possible, the time should include any 2082 - * failed transmission attempts. 2083 - * For aggregated frames, there are two possible strategies to report the 2084 - * airtime: Either include the airtime of the entire aggregate in the first 2085 - * (or last) frame and leave the others at zero. Alternatively, include the 2086 - * overhead of the full aggregate in the first or last frame and report the 2087 - * time of each frame + padding not including the full aggregate overhead. 2088 - * 2089 2072 * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays 2090 2073 */ 2091 2074 enum ieee80211_hw_flags { ··· 2109 2132 IEEE80211_HW_REPORTS_LOW_ACK, 2110 2133 IEEE80211_HW_SUPPORTS_TX_FRAG, 2111 2134 IEEE80211_HW_SUPPORTS_TDLS_BUFFER_STA, 2112 - IEEE80211_HW_AIRTIME_ACCOUNTING, 2113 2135 2114 2136 /* keep last, obviously */ 2115 2137 NUM_IEEE80211_HW_FLAGS
-1
net/mac80211/debugfs.c
··· 212 212 FLAG(REPORTS_LOW_ACK), 213 213 FLAG(SUPPORTS_TX_FRAG), 214 214 FLAG(SUPPORTS_TDLS_BUFFER_STA), 215 - FLAG(AIRTIME_ACCOUNTING), 216 215 #undef FLAG 217 216 }; 218 217
-29
net/mac80211/debugfs_sta.c
··· 188 188 } 189 189 STA_OPS(aqm); 190 190 191 - static ssize_t sta_airtime_read(struct file *file, char __user *userbuf, 192 - size_t count, loff_t *ppos) 193 - { 194 - struct sta_info *sta = file->private_data; 195 - size_t bufsz = 200; 196 - char *buf = kzalloc(bufsz, GFP_KERNEL), *p = buf; 197 - ssize_t rv; 198 - 199 - if (!buf) 200 - return -ENOMEM; 201 - 202 - spin_lock_bh(&sta->lock); 203 - 204 - p += scnprintf(p, bufsz + buf - p, 205 - "RX: %llu us\nTX: %llu us\nDeficit: %lld us\n", 206 - sta->airtime_stats.rx_airtime, 207 - sta->airtime_stats.tx_airtime, 208 - sta->airtime_deficit); 209 - 210 - spin_unlock_bh(&sta->lock); 211 - rv = simple_read_from_buffer(userbuf, count, ppos, buf, p - buf); 212 - kfree(buf); 213 - return rv; 214 - } 215 - STA_OPS(airtime); 216 - 217 191 static ssize_t sta_agg_status_read(struct file *file, char __user *userbuf, 218 192 size_t count, loff_t *ppos) 219 193 { ··· 541 567 542 568 if (local->ops->wake_tx_queue) 543 569 DEBUGFS_ADD(aqm); 544 - 545 - if (ieee80211_hw_check(&local->hw, AIRTIME_ACCOUNTING)) 546 - DEBUGFS_ADD(airtime); 547 570 548 571 if (sizeof(sta->driver_buffered_tids) == sizeof(u32)) 549 572 debugfs_create_x32("driver_buffered_tids", 0400,
+2 -6
net/mac80211/ieee80211_i.h
··· 90 90 91 91 #define IEEE80211_MAX_NAN_INSTANCE_ID 255 92 92 93 - /* How much to increase airtime deficit on each scheduling round */ 94 - #define IEEE80211_AIRTIME_QUANTUM 1000 /* usec */ 95 - 96 93 struct ieee80211_fragment_entry { 97 94 struct sk_buff_head skb_list; 98 95 unsigned long first_frag_time; ··· 1123 1126 struct codel_vars *cvars; 1124 1127 struct codel_params cparams; 1125 1128 1126 - /* protects active_txqs_{new,old} and txqi->schedule_order */ 1129 + /* protects active_txqs and txqi->schedule_order */ 1127 1130 spinlock_t active_txq_lock; 1128 - struct list_head active_txqs_new; 1129 - struct list_head active_txqs_old; 1131 + struct list_head active_txqs; 1130 1132 1131 1133 const struct ieee80211_ops *ops; 1132 1134
+1 -2
net/mac80211/main.c
··· 619 619 spin_lock_init(&local->rx_path_lock); 620 620 spin_lock_init(&local->queue_stop_reason_lock); 621 621 622 - INIT_LIST_HEAD(&local->active_txqs_new); 623 - INIT_LIST_HEAD(&local->active_txqs_old); 622 + INIT_LIST_HEAD(&local->active_txqs); 624 623 spin_lock_init(&local->active_txq_lock); 625 624 626 625 INIT_LIST_HEAD(&local->chanctx_list);
-8
net/mac80211/rx.c
··· 1630 1630 if (ieee80211_vif_is_mesh(&rx->sdata->vif)) 1631 1631 ieee80211_mps_rx_h_sta_process(sta, hdr); 1632 1632 1633 - /* airtime accounting */ 1634 - if (status->airtime) { 1635 - spin_lock_bh(&sta->lock); 1636 - sta->airtime_stats.rx_airtime += status->airtime; 1637 - sta->airtime_deficit -= status->airtime; 1638 - spin_unlock_bh(&sta->lock); 1639 - } 1640 - 1641 1633 /* 1642 1634 * Drop (qos-)data::nullfunc frames silently, since they 1643 1635 * are used only to control station power saving mode.
-2
net/mac80211/sta_info.c
··· 425 425 sta->cparams.interval = MS2TIME(100); 426 426 sta->cparams.ecn = true; 427 427 428 - sta->airtime_deficit = IEEE80211_AIRTIME_QUANTUM; 429 - 430 428 sta_dbg(sdata, "Allocated STA %pM\n", sta->sta.addr); 431 429 432 430 return sta;
-7
net/mac80211/sta_info.h
··· 559 559 } tx_stats; 560 560 u16 tid_seq[IEEE80211_QOS_CTL_TID_MASK + 1]; 561 561 562 - /* Airtime stats and deficit, protected by lock */ 563 - struct { 564 - u64 rx_airtime; 565 - u64 tx_airtime; 566 - } airtime_stats; 567 - s64 airtime_deficit; 568 - 569 562 /* 570 563 * Aggregation information, locked with lock. 571 564 */
-16
net/mac80211/status.c
··· 823 823 ieee80211_lost_packet(sta, info); 824 824 } 825 825 } 826 - 827 - if (info->status.tx_time && 828 - ieee80211_hw_check(&local->hw, AIRTIME_ACCOUNTING)) { 829 - spin_lock_bh(&sta->lock); 830 - sta->airtime_stats.tx_airtime += info->status.tx_time; 831 - sta->airtime_deficit -= info->status.tx_time; 832 - spin_unlock_bh(&sta->lock); 833 - } 834 826 } 835 827 836 828 /* SNMP counters ··· 946 954 if (!acked) 947 955 sta->status_stats.retry_failed++; 948 956 sta->status_stats.retry_count += retry_count; 949 - 950 - if (info->status.tx_time && 951 - ieee80211_hw_check(&local->hw, AIRTIME_ACCOUNTING)) { 952 - spin_lock_bh(&sta->lock); 953 - sta->airtime_stats.tx_airtime += info->status.tx_time; 954 - sta->airtime_deficit -= info->status.tx_time; 955 - spin_unlock_bh(&sta->lock); 956 - } 957 957 958 958 if (acked) { 959 959 sta->status_stats.last_ack = jiffies;
+5 -26
net/mac80211/tx.c
··· 3566 3566 spin_lock_bh(&local->active_txq_lock); 3567 3567 3568 3568 if (list_empty(&txqi->schedule_order)) { 3569 - list_add_tail(&txqi->schedule_order, &local->active_txqs_new); 3569 + list_add_tail(&txqi->schedule_order, &local->active_txqs); 3570 3570 ret = true; 3571 3571 } 3572 3572 ··· 3580 3580 { 3581 3581 struct ieee80211_local *local = hw_to_local(hw); 3582 3582 struct txq_info *txqi = NULL; 3583 - struct list_head *head; 3584 3583 3585 3584 spin_lock_bh(&local->active_txq_lock); 3586 3585 3587 - begin: 3588 - head = &local->active_txqs_new; 3589 - if (list_empty(head)) { 3590 - head = &local->active_txqs_old; 3591 - if (list_empty(head)) 3592 - goto out; 3593 - } 3586 + if (list_empty(&local->active_txqs)) 3587 + goto out; 3594 3588 3595 - txqi = list_first_entry(head, struct txq_info, schedule_order); 3596 - 3597 - if (txqi->txq.sta) { 3598 - struct sta_info *sta = container_of(txqi->txq.sta, 3599 - struct sta_info, sta); 3600 - 3601 - spin_lock_bh(&sta->lock); 3602 - if (sta->airtime_deficit < 0) { 3603 - sta->airtime_deficit += IEEE80211_AIRTIME_QUANTUM; 3604 - list_move_tail(&txqi->schedule_order, 3605 - &local->active_txqs_old); 3606 - spin_unlock_bh(&sta->lock); 3607 - goto begin; 3608 - } 3609 - spin_unlock_bh(&sta->lock); 3610 - } 3611 - 3589 + txqi = list_first_entry(&local->active_txqs, 3590 + struct txq_info, schedule_order); 3612 3591 list_del_init(&txqi->schedule_order); 3613 3592 3614 3593 out: