various mac80211 patches
Subsystems (2)
cover various mac80211 patches
Hi Johannes,
Here are a few patches we have on our internal tree. Ilan's has been applied already but somehow wasn't merged. Since I know you apply patches in the merge window and rebase them, I am afraid it got lost, so I am resending it here just as a heads up.
There are bugfixes (Gregory's one, my tx power thing and Eliad's teardown related patch), along with improvements. A few improvements are needed for bugfix on the driver side, but I think they don't deserve to be merged in 4.4. Your call obviously.
Eliad Peller (2):
mac80211: add atomic uploaded keys iterator
mac80211: don't teardown sdata on sdata stop
Emmanuel Grumbach (2):
mac80211: allow the driver to send EOSP when needed
mac80211: ensure we don't update tx power on a non-running sdata
Gregory Greenman (1):
mac80211: always set the buf_size in AddBA req to 64
Ilan Peer (1):
cfg80211: Add missing tracing to cfg80211
Johannes Berg (2):
cfg80211: add complete data to station add/change tracing
mac80211: allow driver to prevent two stations w/ same address
include/net/mac80211.h | 58 ++++++++++++++++- net/mac80211/agg-tx.c | 3 +- net/mac80211/debugfs.c | 1 + net/mac80211/iface.c | 5 +- net/mac80211/key.c | 56 +++++++++++++++-- net/mac80211/sta_info.c | 163 +++++++++++++++++++++++++++++++++++------------- net/mac80211/sta_info.h | 2 + net/mac80211/trace.h | 25 ++++++++ net/wireless/nl80211.c | 9 ++- net/wireless/rdev-ops.h | 43 +++++++++++++ net/wireless/trace.h | 99 +++++++++++++++++++++++++++++ 11 files changed, 405 insertions(+), 59 deletions(-)
Signature · 1 line
2.5.0
PATCH 1/8 cfg80211: Add missing tracing to cfg80211
From: Ilan Peer <[email protected]>
Add missing tracing for:
1. start_radar_detection()
2. set_mcast_rates()
3. set_coalesce()
--- net/wireless/nl80211.c | 9 ++++---- net/wireless/rdev-ops.h | 43 ++++++++++++++++++++++++++++++++++ net/wireless/trace.h | 61 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+), 5 deletions(-)
net/wireless/nl80211.c +4 -5
@@ -6507,8 +6507,7 @@ static int nl80211_start_radar_detection(struct sk_buff *skb,if (WARN_ON (!cac_time_ms)) cac_time_ms =IEEE80211_DFS_MIN_CAC_TIME_MS ; - err = rdev->ops->start_radar_detection (&rdev->wiphy, dev, &chandef, - cac_time_ms); + err =rdev_start_radar_detection (rdev, dev, &chandef, cac_time_ms);if (!err) { wdev->chandef = chandef; wdev->cac_started = true;
@@ -7571,7 +7570,7 @@ static int nl80211_set_mcast_rate(struct sk_buff *skb, struct genl_info *info)if (!nl80211_parse_mcast_rate (rdev, mcast_rate, nla_rate))return -EINVAL ; - err = rdev->ops->set_mcast_rate (&rdev->wiphy, dev, mcast_rate); + err =rdev_set_mcast_rate (rdev, dev, mcast_rate);return err; }
@@ -9716,7 +9715,7 @@ static int nl80211_set_coalesce(struct sk_buff *skb, struct genl_info *info)if (!info->attrs[NL80211_ATTR_COALESCE_RULE ]) {cfg80211_rdev_free_coalesce (rdev); - rdev->ops->set_coalesce (&rdev->wiphy,NULL ); +rdev_set_coalesce (rdev,NULL );return 0 ; }
@@ -9744,7 +9743,7 @@ static int nl80211_set_coalesce(struct sk_buff *skb, struct genl_info *info) i++; } - err = rdev->ops->set_coalesce (&rdev->wiphy, &new_coalesce); + err =rdev_set_coalesce (rdev, &new_coalesce);if (err) goto error;
net/wireless/rdev-ops.h +43 -0
47 lines not on this page · raw message
net/wireless/trace.h +61 -0
67 lines not on this page · raw message
Signature · 1 line
2.5.0
PATCH 2/8 cfg80211: add complete data to station add/change tracing
In reply to Emmanuel GrumbachFrom: Johannes Berg <[email protected]>
Complete the tracepoint with the missing data - it's not printed by default (a lot of it is dynamic arrays) but will be recorded and be available during post-processing.
--- net/wireless/trace.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)
net/wireless/trace.h +38 -0
@@ -623,12 +623,24 @@ DECLARE_EVENT_CLASS(station_add_change, __field(u32, sta_flags_set) __field(u32, sta_modify_mask) __field(int, listen_interval) + __field(u16, capability) __field(u16, aid) __field(u8, plink_action) __field(u8, plink_state) __field(u8, uapsd_queues) + __field(u8, max_sp) + __field(u8, opmode_notif) + __field(bool, opmode_notif_used) __array(u8, ht_capa, (int)sizeof(struct ieee80211_ht_cap)) + __array(u8, vht_capa, (int)sizeof(struct ieee80211_vht_cap)) __array(char, vlan, IFNAMSIZ) +__dynamic_array (u8, supported_rates, + params->supported_rates_len) + __dynamic_array(u8, ext_capab, params->ext_capab_len) +__dynamic_array (u8, supported_channels, + params->supported_channels_len) +__dynamic_array (u8, supported_oper_classes, + params->supported_oper_classes_len) ),TP_fast_assign ( WIPHY_ASSIGN;
@@ -646,9 +658,35 @@ DECLARE_EVENT_CLASS(station_add_change,if (params->ht_capa)memcpy (__entry->ht_capa, params->ht_capa,sizeof (struct ieee80211_ht_cap )); +memset (__entry->vht_capa,0 ,sizeof (struct ieee80211_vht_cap )); +if (params->vht_capa) +memcpy (__entry->vht_capa, params->vht_capa, +sizeof (struct ieee80211_vht_cap ));memset (__entry->vlan,0 ,sizeof (__entry->vlan));if (params->vlan)memcpy (__entry->vlan, params->vlan->name,IFNAMSIZ ); +if (params->supported_rates && params->supported_rates_len) +memcpy (__get_dynamic_array (supported_rates), + params->supported_rates, + params->supported_rates_len); +if (params->ext_capab && params->ext_capab_len) +memcpy (__get_dynamic_array (ext_capab), + params->ext_capab, + params->ext_capab_len); +if (params->supported_channels && + params->supported_channels_len) +memcpy (__get_dynamic_array (supported_channels), + params->supported_channels, + params->supported_channels_len); +if (params->supported_oper_classes && + params->supported_oper_classes_len) +memcpy (__get_dynamic_array (supported_oper_classes), + params->supported_oper_classes, + params->supported_oper_classes_len); + __entry->max_sp = params->max_sp; + __entry->capability = params->capability; + __entry->opmode_notif = params->opmode_notif; + __entry->opmode_notif_used = params->opmode_notif_used; ),TP_printk (WIPHY_PR_FMT ", " NETDEV_PR_FMT ", station mac: " MAC_PR_FMT ", station flags mask: %u, station flags set: %u, "
Signature · 1 line
2.5.0
PATCH 3/8 mac80211: allow driver to prevent two stations w/ same address
In reply to Emmanuel GrumbachFrom: Johannes Berg <[email protected]>
Some devices or drivers cannot deal with having the same station address for different virtual interfaces, say as a client to two virtual AP interfaces. Rather than requiring each driver with a limitation like that to enforce it, add a hardware flag for it.
--- include/net/mac80211.h | 6 ++++++ net/mac80211/debugfs.c | 1 + net/mac80211/sta_info.c | 18 ++++++++++++++++-- 3 files changed, 23 insertions(+), 2 deletions(-)
include/net/mac80211.h +6 -0
@@ -1901,6 +1901,11 @@ struct ieee80211_txq {* @IEEE80211_HW_BEACON_TX_STATUS: The device/driver provides TX status * for sent beacons. * +* @IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR: Hardware (or driver) requires that each +* station has a unique address, i.e. each station entry can be identified +* by just its MAC address; this prevents, for example, the same station +* from connecting to two virtual AP interfaces at the same time. +* * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays */ enum ieee80211_hw_flags {
@@ -1936,6 +1941,7 @@ enum ieee80211_hw_flags {IEEE80211_HW_TDLS_WIDER_BW ,IEEE80211_HW_SUPPORTS_AMSDU_IN_AMPDU ,IEEE80211_HW_BEACON_TX_STATUS , +IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR ,/* keep last, obviously */ NUM_IEEE80211_HW_FLAGS
net/mac80211/debugfs.c +1 -0
@@ -125,6 +125,7 @@ static const char *hw_flag_names[NUM_IEEE80211_HW_FLAGS + 1] = {FLAG (TDLS_WIDER_BW ),FLAG (SUPPORTS_AMSDU_IN_AMPDU ),FLAG (BEACON_TX_STATUS ), +FLAG (NEEDS_UNIQUE_STA_ADDR ),/* keep last for the build bug below */ (void *)0x1
net/mac80211/sta_info.c +16 -2
@@ -435,6 +435,19 @@ static int sta_info_insert_check(struct sta_info *sta) is_multicast_ether_addr(sta->sta.addr)))return -EINVAL ; +/* Strictly speaking this isn't necessary as we hold the mutex, but +* the rhashtable code can't really deal with that distinction. We +* do require the mutex for correctness though. +*/ +rcu_read_lock (); +lockdep_assert_held (&sdata->local->sta_mtx); +if (ieee80211_hw_check (&sdata->local->hw,NEEDS_UNIQUE_STA_ADDR ) && +ieee80211_find_sta_by_ifaddr (&sdata->local->hw, sta->addr,NULL )) { +rcu_read_unlock (); +return -ENOTUNIQ ; + } +rcu_read_unlock (); +return 0 ; }
@@ -554,14 +567,15 @@ int sta_info_insert_rcu(struct sta_info *sta) __acquires(RCU)might_sleep (); +mutex_lock (&local->sta_mtx); + err =sta_info_insert_check (sta);if (err) { +mutex_unlock (&local->sta_mtx);rcu_read_lock (); goto out_free; } -mutex_lock (&local->sta_mtx); - err =sta_info_insert_finish (sta);if (err) goto out_free;
Signature · 1 line
2.5.0
PATCH 4/8 mac80211: allow the driver to send EOSP when needed
In reply to Emmanuel GrumbachThis can happen when the driver needs to send less frames than expected and then needs to close the SP. Mac80211 still needs to set the more_data properly based on its buffer state (ps_tx_buffer and buffered frames on other TIDs).
To that end, refactor the code that delivers frames upon uAPSD trigger frames to be able to get only the more_data bit without actually delivering those frames in case the driver is just asking to set a NDP with EOSP and MORE_DATA bit properly set.
--- include/net/mac80211.h | 22 ++++++++ net/mac80211/sta_info.c | 144 +++++++++++++++++++++++++++++++++--------------- net/mac80211/trace.h | 25 +++++++++ 3 files changed, 148 insertions(+), 43 deletions(-)
include/net/mac80211.h +22 -0
@@ -4867,6 +4867,28 @@ void ieee80211_sta_block_awake(struct ieee80211_hw *hw,void ieee80211_sta_eosp (struct ieee80211_sta *pubsta);/** +* ieee80211_send_eosp_nullfunc - ask mac80211 to send NDP with EOSP +* @pubsta: the station +* @tid: the tid of the NDP +* +* Sometimes the device understands that it needs to close +* the Service Period unexpectedly. This can happen when +* sending frames that are filling holes in the BA window. +* In this case, the device can ask mac80211 to send a +* Nullfunc frame with EOSP set. When that happens, the +* driver must have called ieee80211_sta_set_buffered() to +* let mac80211 know that there are no buffered frames any +* more, otherwise mac80211 will get the more_data bit wrong. +* The low level driver must have made sure that the frame +* will be sent despite the station being in power-save. +* Mac80211 won't call allow_buffered_frames(). +* Note that calling this function, doesn't exempt the driver +* from closing the EOSP properly, it will still have to call +* ieee80211_sta_eosp when the NDP is sent. +*/ +void ieee80211_send_eosp_nullfunc (struct ieee80211_sta *pubsta,int tid); + +/** * ieee80211_iter_keys - iterate keys programmed into the device * @hw: pointer obtained from ieee80211_alloc_hw() * @vif: virtual interface to iterate, may be %NULL for all
net/mac80211/sta_info.c +101 -43
216 lines not on this page · raw message
net/mac80211/trace.h +25 -0
@@ -2027,6 +2027,31 @@ TRACE_EVENT(api_eosp, ) ); +TRACE_EVENT (api_send_eosp_nullfunc, + TP_PROTO(struct ieee80211_local *local, + struct ieee80211_sta *sta, + u8 tid), + +TP_ARGS (local, sta, tid), + +TP_STRUCT__entry ( + LOCAL_ENTRY + STA_ENTRY +__field (u8, tid) + ), + +TP_fast_assign ( + LOCAL_ASSIGN; + STA_ASSIGN; + __entry->tid = tid; + ), + +TP_printk ( + LOCAL_PR_FMT STA_PR_FMT " tid:%d", +LOCAL_PR_ARG ,STA_PR_ARG , __entry->tid + ) +); + TRACE_EVENT(api_sta_set_buffered, TP_PROTO(struct ieee80211_local *local, struct ieee80211_sta *sta,
Signature · 1 line
2.5.0
PATCH 5/8 mac80211: add atomic uploaded keys iterator
In reply to Emmanuel GrumbachFrom: Eliad Peller <[email protected]>
add ieee80211_iter_keys_rcu() to iterate over uploaded keys in atomic context (when rcu is locked)
The station removal code removes the keys only after calling synchronize_net(), so it's not safe to iterate the keys at this point (and postponing the actual key deletion with call_rcu() might result in some badly-ordered ops calls).
Add a flag to indicate a station is being removed, and skip the configured keys if it's set.
--- include/net/mac80211.h | 24 +++++++++++++++++++++ net/mac80211/key.c | 56 +++++++++++++++++++++++++++++++++++++++++++++---- net/mac80211/sta_info.c | 1 + net/mac80211/sta_info.h | 2 ++ 4 files changed, 79 insertions(+), 4 deletions(-)
include/net/mac80211.h +24 -0
@@ -4916,6 +4916,30 @@ void ieee80211_iter_keys(struct ieee80211_hw *hw, void *iter_data);/** +* ieee80211_iter_keys_rcu - iterate keys programmed into the device +* @hw: pointer obtained from ieee80211_alloc_hw() +* @vif: virtual interface to iterate, may be %NULL for all +* @iter: iterator function that will be called for each key +* @iter_data: custom data to pass to the iterator function +* +* This function can be used to iterate all the keys known to +* mac80211, even those that weren't previously programmed into +* the device. Note that due to locking reasons, keys of station +* in removal process will be skipped. +* +* This function requires being called in an RCU critical section, +* and thus iter must be atomic. +*/ +void ieee80211_iter_keys_rcu (struct ieee80211_hw *hw, +struct ieee80211_vif *vif, +void (*iter)(struct ieee80211_hw *hw, +struct ieee80211_vif *vif, +struct ieee80211_sta *sta, +struct ieee80211_key_conf *key, +void *data), +void *iter_data); + +/** * ieee80211_iter_chan_contexts_atomic - iterate channel contexts * @hw: pointre obtained from ieee80211_alloc_hw(). * @iter: iterator function
net/mac80211/key.c +52 -4
86 lines not on this page · raw message
net/mac80211/sta_info.c +1 -0
@@ -883,6 +883,7 @@ static int __must_check __sta_info_destroy_part1(struct sta_info *sta) }list_del_rcu (&sta->list); + sta->removed = true;drv_sta_pre_rcu_remove (local, sta->sdata, sta);
net/mac80211/sta_info.h +2 -0
@@ -367,6 +367,7 @@ DECLARE_EWMA(signal, 1024, 8)* @mesh: mesh STA information * @debugfs: debug filesystem info * @dead: set to true when sta is unlinked +* @removed: set to true when sta is being removed from sta_list * @uploaded: set to true when sta is uploaded to the driver * @sta: station information we share with the driver * @sta_state: duplicates information about station state (for debug)
@@ -412,6 +413,7 @@ struct sta_info {u16 listen_interval;bool dead; +bool removed;bool uploaded;
Signature · 1 line
2.5.0
PATCH 6/8 mac80211: always set the buf_size in AddBA req to 64
In reply to Emmanuel GrumbachFrom: Gregory Greenman <[email protected]>
Advertising reordering window in ADDBA less than 64 can crash some APs, an example is LinkSys WRT120N (with FW v1.0.07 build 002 Jun 18 2012). On the other hand, a driver may need to limit Tx A-MPDU size for its own reasons, like specific HW limitations.
--- include/net/mac80211.h | 6 ++++-- net/mac80211/agg-tx.c | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-)
include/net/mac80211.h +4 -2
@@ -2009,8 +2009,10 @@ enum ieee80211_hw_flags {* it shouldn't be set. * * @max_tx_aggregation_subframes: maximum number of subframes in an -* aggregate an HT driver will transmit, used by the peer as a -* hint to size its reorder buffer. +* aggregate an HT driver will transmit. Though ADDBA will advertise +* a constant value of 64 as some older APs can crash if the window +* size is smaller (an example is LinkSys WRT120N with FW v1.0.07 +* build 002 Jun 18 2012). * * @offchannel_tx_hw_queue: HW queue ID to use for offchannel TX * (if %IEEE80211_HW_QUEUE_CONTROL is set)
net/mac80211/agg-tx.c +2 -1
@@ -500,7 +500,7 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid)/* send AddBA request */ ieee80211_send_addba_request (sdata, sta->sta.addr, tid, tid_tx->dialog_token, start_seq_num, - local->hw.max_tx_aggregation_subframes, +IEEE80211_MAX_AMPDU_BUF , tid_tx->timeout); }
@@ -926,6 +926,7 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local, amsdu = capab &IEEE80211_ADDBA_PARAM_AMSDU_MASK ; tid = (capab &IEEE80211_ADDBA_PARAM_TID_MASK ) >>2 ; buf_size = (capab &IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK ) >>6 ; + buf_size =min (buf_size, local->hw.max_tx_aggregation_subframes);mutex_lock (&sta->ampdu_mlme.mtx);
Signature · 1 line
2.5.0
PATCH 7/8 mac80211: ensure we don't update tx power on a non-running sdata
In reply to Emmanuel GrumbachWe can't update the Tx power on the device unless it is running.
This fixes https://bugzilla.kernel.org/show_bug.cgi?id=101521.
--- net/mac80211/iface.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/mac80211/iface.c +2 -1
@@ -76,7 +76,8 @@ bool __ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata)void ieee80211_recalc_txpower (struct ieee80211_sub_if_data *sdata,bool update_bss) { -if (__ieee80211_recalc_txpower (sdata) || update_bss) +if (__ieee80211_recalc_txpower (sdata) || + (update_bss &&ieee80211_sdata_running (sdata)))ieee80211_bss_info_change_notify (sdata,BSS_CHANGED_TXPOWER ); }
Signature · 1 line
2.5.0
PATCH 8/8 mac80211: don't teardown sdata on sdata stop
In reply to Emmanuel GrumbachFrom: Eliad Peller <[email protected]>
Interfaces are being initialized (setup) on addition, and torn down on removal.
However, p2p device is being torn down when stopped, resulting in the next p2p start operation being done on uninitialized interface.
Solve it by calling ieee80211_teardown_sdata() only on interface removal (for the non-netdev case).
--- net/mac80211/iface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/iface.c +1 -1
@@ -1861,6 +1861,7 @@ void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata)if (sdata->dev) {unregister_netdevice (sdata->dev); }else { +ieee80211_teardown_sdata (sdata);cfg80211_unregister_wdev (&sdata->wdev);kfree (sdata); }
@@ -1871,7 +1872,6 @@ void ieee80211_sdata_stop(struct ieee80211_sub_if_data *sdata)if (WARN_ON_ONCE (!test_bit (SDATA_STATE_RUNNING , &sdata->state)))return ;ieee80211_do_stop (sdata, true); -ieee80211_teardown_sdata (sdata); }void ieee80211_remove_interfaces (struct ieee80211_local *local)
Signature · 1 line
2.5.0
I'm ignoring patches 1-3 since I already have them pending.
I've applied 6-8 to mac80211 now.
I'll leave 4 and 5 pending for now and apply them to mac80211-next, unless you speak up now and tell me you really want those driver fixes they prepare for. Doesn't really seem relevant though.
johannes
Quoted 7 lines · Johannes Berg
I'm ignoring patches 1-3 since I already have them pending.
I've applied 6-8 to mac80211 now.
I'll leave 4 and 5 pending for now and apply them to mac80211-next, unless you speak up now and tell me you really want those driver fixes they prepare for. Doesn't really seem relevant though.
mac80211-next is good enough for 4 and 5.
Johannes Berg
maintainerQuoted 4 lines · Emmanuel
Quoted 2 lines · Johannes Berg
I'm ignoring patches 1-3 since I already have them pending.
Quoted 8 lines
Quoted 6 lines
I've applied 6-8 to mac80211 now.
I'll leave 4 and 5 pending for now and apply them to mac80211-next, unless you speak up now and tell me you really want those driver fixes
they prepare for. Doesn't really seem relevant though.mac80211-next is good enough for 4 and 5.
Ok, applied there.
johannes