Skip to content

Commit

Permalink
mac80211: do not pass AP VLAN vif pointers to drivers
Browse files Browse the repository at this point in the history
This fixes frequent WARN_ONs when using AP VLAN + aggregation, as these vifs
are virtual and not registered with drivers.
Use sta_info_get_bss instead of sta_info_get in aggregation callbacks, so
that these callbacks can find the station entry when called with the AP vif.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Felix Fietkau authored and John W. Linville committed Nov 28, 2011
1 parent 5ccc32f commit bc192f8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion net/mac80211/agg-rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void ieee80211_stop_rx_ba_session(struct ieee80211_vif *vif, u16 ba_rx_bitmap,
int i;

rcu_read_lock();
sta = sta_info_get(sdata, addr);
sta = sta_info_get_bss(sdata, addr);
if (!sta) {
rcu_read_unlock();
return;
Expand Down
4 changes: 2 additions & 2 deletions net/mac80211/agg-tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid)
}

mutex_lock(&local->sta_mtx);
sta = sta_info_get(sdata, ra);
sta = sta_info_get_bss(sdata, ra);
if (!sta) {
mutex_unlock(&local->sta_mtx);
#ifdef CONFIG_MAC80211_HT_DEBUG
Expand Down Expand Up @@ -684,7 +684,7 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid)

mutex_lock(&local->sta_mtx);

sta = sta_info_get(sdata, ra);
sta = sta_info_get_bss(sdata, ra);
if (!sta) {
#ifdef CONFIG_MAC80211_HT_DEBUG
printk(KERN_DEBUG "Could not find station: %pM\n", ra);
Expand Down
14 changes: 14 additions & 0 deletions net/mac80211/driver-ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ static inline void check_sdata_in_driver(struct ieee80211_sub_if_data *sdata)
WARN_ON(!(sdata->flags & IEEE80211_SDATA_IN_DRIVER));
}

static inline struct ieee80211_sub_if_data *
get_bss_sdata(struct ieee80211_sub_if_data *sdata)
{
if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
sdata = container_of(sdata->bss, struct ieee80211_sub_if_data,
u.ap);

return sdata;
}

static inline void drv_tx(struct ieee80211_local *local, struct sk_buff *skb)
{
local->ops->tx(&local->hw, skb);
Expand Down Expand Up @@ -421,6 +431,7 @@ static inline void drv_sta_notify(struct ieee80211_local *local,
enum sta_notify_cmd cmd,
struct ieee80211_sta *sta)
{
sdata = get_bss_sdata(sdata);
check_sdata_in_driver(sdata);

trace_drv_sta_notify(local, sdata, cmd, sta);
Expand All @@ -437,6 +448,7 @@ static inline int drv_sta_add(struct ieee80211_local *local,

might_sleep();

sdata = get_bss_sdata(sdata);
check_sdata_in_driver(sdata);

trace_drv_sta_add(local, sdata, sta);
Expand All @@ -454,6 +466,7 @@ static inline void drv_sta_remove(struct ieee80211_local *local,
{
might_sleep();

sdata = get_bss_sdata(sdata);
check_sdata_in_driver(sdata);

trace_drv_sta_remove(local, sdata, sta);
Expand Down Expand Up @@ -547,6 +560,7 @@ static inline int drv_ampdu_action(struct ieee80211_local *local,

might_sleep();

sdata = get_bss_sdata(sdata);
check_sdata_in_driver(sdata);

trace_drv_ampdu_action(local, sdata, action, sta, tid, ssn, buf_size);
Expand Down
4 changes: 0 additions & 4 deletions net/mac80211/sta_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,10 +351,6 @@ static int sta_info_finish_insert(struct sta_info *sta,

if (!sta->dummy || dummy_reinsert) {
/* notify driver */
if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
sdata = container_of(sdata->bss,
struct ieee80211_sub_if_data,
u.ap);
err = drv_sta_add(local, sdata, &sta->sta);
if (err) {
if (!async)
Expand Down

0 comments on commit bc192f8

Please sign in to comment.