Skip to content

Commit

Permalink
Merge tag 'mac80211-for-davem-2017-11-20' of git://git.kernel.org/pub…
Browse files Browse the repository at this point in the history
…/scm/linux/kernel/git/jberg/mac80211

Johannes Berg says:

====================
A few things:
 * straggler timer conversions from Kees
 * memory leak fix in hwsim
 * fix some fallout from regdb changes if wireless is built-in
 * also free aggregation sessions in startup state when station
   goes away, to avoid crashing the timer
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Nov 21, 2017
2 parents b48b1f7 + 33ddd81 commit a13e8d4
Show file tree
Hide file tree
Showing 17 changed files with 155 additions and 137 deletions.
5 changes: 4 additions & 1 deletion drivers/net/wireless/mac80211_hwsim.c
Original file line number Diff line number Diff line change
Expand Up @@ -3108,6 +3108,7 @@ static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info)
{
struct hwsim_new_radio_params param = { 0 };
const char *hwname = NULL;
int ret;

param.reg_strict = info->attrs[HWSIM_ATTR_REG_STRICT_REG];
param.p2p_device = info->attrs[HWSIM_ATTR_SUPPORT_P2P_DEVICE];
Expand Down Expand Up @@ -3147,7 +3148,9 @@ static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info)
param.regd = hwsim_world_regdom_custom[idx];
}

return mac80211_hwsim_new_radio(info, &param);
ret = mac80211_hwsim_new_radio(info, &param);
kfree(hwname);
return ret;
}

static int hwsim_del_radio_nl(struct sk_buff *msg, struct genl_info *info)
Expand Down
41 changes: 17 additions & 24 deletions net/mac80211/agg-rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,21 +151,17 @@ EXPORT_SYMBOL(ieee80211_stop_rx_ba_session);
* After accepting the AddBA Request we activated a timer,
* resetting it after each frame that arrives from the originator.
*/
static void sta_rx_agg_session_timer_expired(unsigned long data)
static void sta_rx_agg_session_timer_expired(struct timer_list *t)
{
/* not an elegant detour, but there is no choice as the timer passes
* only one argument, and various sta_info are needed here, so init
* flow in sta_info_create gives the TID as data, while the timer_to_id
* array gives the sta through container_of */
u8 *ptid = (u8 *)data;
u8 *timer_to_id = ptid - *ptid;
struct sta_info *sta = container_of(timer_to_id, struct sta_info,
timer_to_tid[0]);
struct tid_ampdu_rx *tid_rx_timer =
from_timer(tid_rx_timer, t, session_timer);
struct sta_info *sta = tid_rx_timer->sta;
u8 tid = tid_rx_timer->tid;
struct tid_ampdu_rx *tid_rx;
unsigned long timeout;

rcu_read_lock();
tid_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[*ptid]);
tid_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[tid]);
if (!tid_rx) {
rcu_read_unlock();
return;
Expand All @@ -180,21 +176,18 @@ static void sta_rx_agg_session_timer_expired(unsigned long data)
rcu_read_unlock();

ht_dbg(sta->sdata, "RX session timer expired on %pM tid %d\n",
sta->sta.addr, (u16)*ptid);
sta->sta.addr, tid);

set_bit(*ptid, sta->ampdu_mlme.tid_rx_timer_expired);
set_bit(tid, sta->ampdu_mlme.tid_rx_timer_expired);
ieee80211_queue_work(&sta->local->hw, &sta->ampdu_mlme.work);
}

static void sta_rx_agg_reorder_timer_expired(unsigned long data)
static void sta_rx_agg_reorder_timer_expired(struct timer_list *t)
{
u8 *ptid = (u8 *)data;
u8 *timer_to_id = ptid - *ptid;
struct sta_info *sta = container_of(timer_to_id, struct sta_info,
timer_to_tid[0]);
struct tid_ampdu_rx *tid_rx = from_timer(tid_rx, t, reorder_timer);

rcu_read_lock();
ieee80211_release_reorder_timeout(sta, *ptid);
ieee80211_release_reorder_timeout(tid_rx->sta, tid_rx->tid);
rcu_read_unlock();
}

Expand Down Expand Up @@ -356,14 +349,12 @@ void ___ieee80211_start_rx_ba_session(struct sta_info *sta,
spin_lock_init(&tid_agg_rx->reorder_lock);

/* rx timer */
setup_deferrable_timer(&tid_agg_rx->session_timer,
sta_rx_agg_session_timer_expired,
(unsigned long)&sta->timer_to_tid[tid]);
timer_setup(&tid_agg_rx->session_timer,
sta_rx_agg_session_timer_expired, TIMER_DEFERRABLE);

/* rx reorder timer */
setup_timer(&tid_agg_rx->reorder_timer,
sta_rx_agg_reorder_timer_expired,
(unsigned long)&sta->timer_to_tid[tid]);
timer_setup(&tid_agg_rx->reorder_timer,
sta_rx_agg_reorder_timer_expired, 0);

/* prepare reordering buffer */
tid_agg_rx->reorder_buf =
Expand Down Expand Up @@ -399,6 +390,8 @@ void ___ieee80211_start_rx_ba_session(struct sta_info *sta,
tid_agg_rx->auto_seq = auto_seq;
tid_agg_rx->started = false;
tid_agg_rx->reorder_buf_filtered = 0;
tid_agg_rx->tid = tid;
tid_agg_rx->sta = sta;
status = WLAN_STATUS_SUCCESS;

/* activate it for RX */
Expand Down
49 changes: 23 additions & 26 deletions net/mac80211/agg-tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,11 @@ int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,

spin_lock_bh(&sta->lock);

/* free struct pending for start, if present */
tid_tx = sta->ampdu_mlme.tid_start_tx[tid];
kfree(tid_tx);
sta->ampdu_mlme.tid_start_tx[tid] = NULL;

tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
if (!tid_tx) {
spin_unlock_bh(&sta->lock);
Expand Down Expand Up @@ -422,15 +427,12 @@ int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
* add Block Ack response will arrive from the recipient.
* If this timer expires sta_addba_resp_timer_expired will be executed.
*/
static void sta_addba_resp_timer_expired(unsigned long data)
static void sta_addba_resp_timer_expired(struct timer_list *t)
{
/* not an elegant detour, but there is no choice as the timer passes
* only one argument, and both sta_info and TID are needed, so init
* flow in sta_info_create gives the TID as data, while the timer_to_id
* array gives the sta through container_of */
u16 tid = *(u8 *)data;
struct sta_info *sta = container_of((void *)data,
struct sta_info, timer_to_tid[tid]);
struct tid_ampdu_tx *tid_tx_timer =
from_timer(tid_tx_timer, t, addba_resp_timer);
struct sta_info *sta = tid_tx_timer->sta;
u8 tid = tid_tx_timer->tid;
struct tid_ampdu_tx *tid_tx;

/* check if the TID waits for addBA response */
Expand Down Expand Up @@ -525,21 +527,17 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid)
* After accepting the AddBA Response we activated a timer,
* resetting it after each frame that we send.
*/
static void sta_tx_agg_session_timer_expired(unsigned long data)
static void sta_tx_agg_session_timer_expired(struct timer_list *t)
{
/* not an elegant detour, but there is no choice as the timer passes
* only one argument, and various sta_info are needed here, so init
* flow in sta_info_create gives the TID as data, while the timer_to_id
* array gives the sta through container_of */
u8 *ptid = (u8 *)data;
u8 *timer_to_id = ptid - *ptid;
struct sta_info *sta = container_of(timer_to_id, struct sta_info,
timer_to_tid[0]);
struct tid_ampdu_tx *tid_tx_timer =
from_timer(tid_tx_timer, t, session_timer);
struct sta_info *sta = tid_tx_timer->sta;
u8 tid = tid_tx_timer->tid;
struct tid_ampdu_tx *tid_tx;
unsigned long timeout;

rcu_read_lock();
tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[*ptid]);
tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[tid]);
if (!tid_tx || test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) {
rcu_read_unlock();
return;
Expand All @@ -555,9 +553,9 @@ static void sta_tx_agg_session_timer_expired(unsigned long data)
rcu_read_unlock();

ht_dbg(sta->sdata, "tx session timer expired on %pM tid %d\n",
sta->sta.addr, (u16)*ptid);
sta->sta.addr, tid);

ieee80211_stop_tx_ba_session(&sta->sta, *ptid);
ieee80211_stop_tx_ba_session(&sta->sta, tid);
}

int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
Expand Down Expand Up @@ -670,16 +668,15 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
__set_bit(HT_AGG_STATE_WANT_START, &tid_tx->state);

tid_tx->timeout = timeout;
tid_tx->sta = sta;
tid_tx->tid = tid;

/* response timer */
setup_timer(&tid_tx->addba_resp_timer,
sta_addba_resp_timer_expired,
(unsigned long)&sta->timer_to_tid[tid]);
timer_setup(&tid_tx->addba_resp_timer, sta_addba_resp_timer_expired, 0);

/* tx timer */
setup_deferrable_timer(&tid_tx->session_timer,
sta_tx_agg_session_timer_expired,
(unsigned long)&sta->timer_to_tid[tid]);
timer_setup(&tid_tx->session_timer,
sta_tx_agg_session_timer_expired, TIMER_DEFERRABLE);

/* assign a dialog token */
sta->ampdu_mlme.dialog_token_allocator++;
Expand Down
7 changes: 3 additions & 4 deletions net/mac80211/ibss.c
Original file line number Diff line number Diff line change
Expand Up @@ -1711,10 +1711,10 @@ void ieee80211_ibss_work(struct ieee80211_sub_if_data *sdata)
sdata_unlock(sdata);
}

static void ieee80211_ibss_timer(unsigned long data)
static void ieee80211_ibss_timer(struct timer_list *t)
{
struct ieee80211_sub_if_data *sdata =
(struct ieee80211_sub_if_data *) data;
from_timer(sdata, t, u.ibss.timer);

ieee80211_queue_work(&sdata->local->hw, &sdata->work);
}
Expand All @@ -1723,8 +1723,7 @@ void ieee80211_ibss_setup_sdata(struct ieee80211_sub_if_data *sdata)
{
struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;

setup_timer(&ifibss->timer, ieee80211_ibss_timer,
(unsigned long) sdata);
timer_setup(&ifibss->timer, ieee80211_ibss_timer, 0);
INIT_LIST_HEAD(&ifibss->incomplete_stations);
spin_lock_init(&ifibss->incomplete_lock);
INIT_WORK(&ifibss->csa_connection_drop_work,
Expand Down
3 changes: 2 additions & 1 deletion net/mac80211/ieee80211_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,7 @@ struct tpt_led_trigger {
const struct ieee80211_tpt_blink *blink_table;
unsigned int blink_table_len;
struct timer_list timer;
struct ieee80211_local *local;
unsigned long prev_traffic;
unsigned long tx_bytes, rx_bytes;
unsigned int active, want;
Expand Down Expand Up @@ -1932,7 +1933,7 @@ static inline int ieee80211_ac_from_tid(int tid)

void ieee80211_dynamic_ps_enable_work(struct work_struct *work);
void ieee80211_dynamic_ps_disable_work(struct work_struct *work);
void ieee80211_dynamic_ps_timer(unsigned long data);
void ieee80211_dynamic_ps_timer(struct timer_list *t);
void ieee80211_send_nullfunc(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
bool powersave);
Expand Down
11 changes: 6 additions & 5 deletions net/mac80211/led.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,10 @@ static unsigned long tpt_trig_traffic(struct ieee80211_local *local,
return DIV_ROUND_UP(delta, 1024 / 8);
}

static void tpt_trig_timer(unsigned long data)
static void tpt_trig_timer(struct timer_list *t)
{
struct ieee80211_local *local = (void *)data;
struct tpt_led_trigger *tpt_trig = local->tpt_led_trigger;
struct tpt_led_trigger *tpt_trig = from_timer(tpt_trig, t, timer);
struct ieee80211_local *local = tpt_trig->local;
struct led_classdev *led_cdev;
unsigned long on, off, tpt;
int i;
Expand Down Expand Up @@ -306,8 +306,9 @@ __ieee80211_create_tpt_led_trigger(struct ieee80211_hw *hw,
tpt_trig->blink_table = blink_table;
tpt_trig->blink_table_len = blink_table_len;
tpt_trig->want = flags;
tpt_trig->local = local;

setup_timer(&tpt_trig->timer, tpt_trig_timer, (unsigned long)local);
timer_setup(&tpt_trig->timer, tpt_trig_timer, 0);

local->tpt_led_trigger = tpt_trig;

Expand All @@ -326,7 +327,7 @@ static void ieee80211_start_tpt_led_trig(struct ieee80211_local *local)
tpt_trig_traffic(local, tpt_trig);
tpt_trig->running = true;

tpt_trig_timer((unsigned long)local);
tpt_trig_timer(&tpt_trig->timer);
mod_timer(&tpt_trig->timer, round_jiffies(jiffies + HZ));
}

Expand Down
3 changes: 1 addition & 2 deletions net/mac80211/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -633,8 +633,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len,
ieee80211_dynamic_ps_enable_work);
INIT_WORK(&local->dynamic_ps_disable_work,
ieee80211_dynamic_ps_disable_work);
setup_timer(&local->dynamic_ps_timer,
ieee80211_dynamic_ps_timer, (unsigned long) local);
timer_setup(&local->dynamic_ps_timer, ieee80211_dynamic_ps_timer, 0);

INIT_WORK(&local->sched_scan_stopped_work,
ieee80211_sched_scan_stopped_work);
Expand Down
27 changes: 12 additions & 15 deletions net/mac80211/mesh.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ void ieee80211s_stop(void)
kmem_cache_destroy(rm_cache);
}

static void ieee80211_mesh_housekeeping_timer(unsigned long data)
static void ieee80211_mesh_housekeeping_timer(struct timer_list *t)
{
struct ieee80211_sub_if_data *sdata = (void *) data;
struct ieee80211_sub_if_data *sdata =
from_timer(sdata, t, u.mesh.housekeeping_timer);
struct ieee80211_local *local = sdata->local;
struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;

Expand Down Expand Up @@ -528,18 +529,18 @@ int mesh_add_vht_oper_ie(struct ieee80211_sub_if_data *sdata,
return 0;
}

static void ieee80211_mesh_path_timer(unsigned long data)
static void ieee80211_mesh_path_timer(struct timer_list *t)
{
struct ieee80211_sub_if_data *sdata =
(struct ieee80211_sub_if_data *) data;
from_timer(sdata, t, u.mesh.mesh_path_timer);

ieee80211_queue_work(&sdata->local->hw, &sdata->work);
}

static void ieee80211_mesh_path_root_timer(unsigned long data)
static void ieee80211_mesh_path_root_timer(struct timer_list *t)
{
struct ieee80211_sub_if_data *sdata =
(struct ieee80211_sub_if_data *) data;
from_timer(sdata, t, u.mesh.mesh_path_root_timer);
struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;

set_bit(MESH_WORK_ROOT, &ifmsh->wrkq_flags);
Expand Down Expand Up @@ -1442,9 +1443,8 @@ void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata)
struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
static u8 zero_addr[ETH_ALEN] = {};

setup_timer(&ifmsh->housekeeping_timer,
ieee80211_mesh_housekeeping_timer,
(unsigned long) sdata);
timer_setup(&ifmsh->housekeeping_timer,
ieee80211_mesh_housekeeping_timer, 0);

ifmsh->accepting_plinks = true;
atomic_set(&ifmsh->mpaths, 0);
Expand All @@ -1458,12 +1458,9 @@ void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata)

mesh_pathtbl_init(sdata);

setup_timer(&ifmsh->mesh_path_timer,
ieee80211_mesh_path_timer,
(unsigned long) sdata);
setup_timer(&ifmsh->mesh_path_root_timer,
ieee80211_mesh_path_root_timer,
(unsigned long) sdata);
timer_setup(&ifmsh->mesh_path_timer, ieee80211_mesh_path_timer, 0);
timer_setup(&ifmsh->mesh_path_root_timer,
ieee80211_mesh_path_root_timer, 0);
INIT_LIST_HEAD(&ifmsh->preq_queue.list);
skb_queue_head_init(&ifmsh->ps.bc_buf);
spin_lock_init(&ifmsh->mesh_preq_queue_lock);
Expand Down
2 changes: 1 addition & 1 deletion net/mac80211/mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ void mesh_path_tx_pending(struct mesh_path *mpath);
int mesh_pathtbl_init(struct ieee80211_sub_if_data *sdata);
void mesh_pathtbl_unregister(struct ieee80211_sub_if_data *sdata);
int mesh_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr);
void mesh_path_timer(unsigned long data);
void mesh_path_timer(struct timer_list *t);
void mesh_path_flush_by_nexthop(struct sta_info *sta);
void mesh_path_discard_frame(struct ieee80211_sub_if_data *sdata,
struct sk_buff *skb);
Expand Down
4 changes: 2 additions & 2 deletions net/mac80211/mesh_hwmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1194,9 +1194,9 @@ int mesh_nexthop_lookup(struct ieee80211_sub_if_data *sdata,
return err;
}

void mesh_path_timer(unsigned long data)
void mesh_path_timer(struct timer_list *t)
{
struct mesh_path *mpath = (void *) data;
struct mesh_path *mpath = from_timer(mpath, t, timer);
struct ieee80211_sub_if_data *sdata = mpath->sdata;
int ret;

Expand Down
3 changes: 1 addition & 2 deletions net/mac80211/mesh_pathtbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,7 @@ struct mesh_path *mesh_path_new(struct ieee80211_sub_if_data *sdata,
skb_queue_head_init(&new_mpath->frame_queue);
new_mpath->exp_time = jiffies;
spin_lock_init(&new_mpath->state_lock);
setup_timer(&new_mpath->timer, mesh_path_timer,
(unsigned long) new_mpath);
timer_setup(&new_mpath->timer, mesh_path_timer, 0);

return new_mpath;
}
Expand Down
Loading

0 comments on commit a13e8d4

Please sign in to comment.