ath9k patches
cover ath9k patches
From: Sujith Manoharan <[email protected]>
This series continues to cleanup the channel context code, trying to make a clear separation between the two modes of operation.
All the pending patches (including the earlier series) are here:
http://msujith.org/dir/patches/wl/Aug-23-2014/
Sujith
Sujith Manoharan (18):
ath9k: Add a routine for initializing channel contexts
ath9k: Add a routine to tear down channel contexts
ath9k: Make ath_chanctx_work static
ath9k: Cleanup mgd_prepare_tx callback
ath9k: Conditionally compile a few functions
ath9k: Exclude more functions
ath9k: Conditionally compile more functions
ath9k: Make ath_chanctx_offchan_switch static
ath9k: Make ath_chanctx_get_oper_chan static
ath9k: Make ath_chanctx_switch static
ath9k: Fix channel context events
ath9k: Fix function declarations
ath9k: Add wrappers for beacon events
ath9k: Add ath9k_chanctx_wake_queues
ath9k: Add ath9k_offchannel_init
ath9k: Use ath_chanctx_check_active properly
ath9k: Fix function argument type
ath9k: Fix 'offchannel' in ath_softc
drivers/net/wireless/ath/ath9k/ath9k.h | 68 ++- drivers/net/wireless/ath/ath9k/beacon.c | 10 +- drivers/net/wireless/ath/ath9k/channel.c | 839 ++++++++++++++++--------------- drivers/net/wireless/ath/ath9k/init.c | 7 +- drivers/net/wireless/ath/ath9k/main.c | 64 ++- drivers/net/wireless/ath/ath9k/recv.c | 7 +- drivers/net/wireless/ath/ath9k/wow.c | 3 +- drivers/net/wireless/ath/ath9k/xmit.c | 7 +- 8 files changed, 556 insertions(+), 449 deletions(-)
Signature · 1 line
2.0.4
PATCH 1/18 ath9k: Add a routine for initializing channel contexts
From: Sujith Manoharan <[email protected]>
Setup the offchannel/sched timers and the chanctx work inside the new function.
--- drivers/net/wireless/ath/ath9k/ath9k.h | 6 ++++-- drivers/net/wireless/ath/ath9k/channel.c | 28 +++++++++++++++++++--------- drivers/net/wireless/ath/ath9k/init.c | 6 ++---- 3 files changed, 25 insertions(+), 15 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +4 -2
@@ -422,7 +422,6 @@ void ath_chanctx_set_channel(struct ath_softc *sc, struct ath_chanctx *ctx,void ath_chanctx_switch (struct ath_softc *sc,struct ath_chanctx *ctx,struct cfg80211_chan_def *chandef);void ath_chanctx_check_active (struct ath_softc *sc,struct ath_chanctx *ctx); -void ath_offchannel_timer (unsigned long data);void ath_offchannel_channel_change (struct ath_softc *sc);void ath_chanctx_offchan_switch (struct ath_softc *sc,struct ieee80211_channel *chan);
@@ -430,7 +429,6 @@ struct ath_chanctx *ath_chanctx_get_oper_chan(struct ath_softc *sc, bool active);void ath_chanctx_event (struct ath_softc *sc,struct ieee80211_vif *vif,enum ath_chanctx_event ev); -void ath_chanctx_timer (unsigned long data);void ath_offchannel_next (struct ath_softc *sc);void ath_scan_complete (struct ath_softc *sc,bool abort);void ath_roc_complete (struct ath_softc *sc,bool abort);
@@ -438,6 +436,7 @@ void ath_roc_complete(struct ath_softc *sc, bool abort);#ifdef CONFIG_ATH9K_CHANNEL_CONTEXT bool ath9k_is_chanctx_enabled (void );void ath9k_fill_chanctx_ops (void ); +void ath9k_init_channel_context (struct ath_softc *sc);int ath9k_init_p2p (struct ath_softc *sc);void ath9k_deinit_p2p (struct ath_softc *sc); void ath9k_p2p_remove_vif(struct ath_softc *sc,
@@ -454,6 +453,9 @@ static inline bool ath9k_is_chanctx_enabled(void)static inline void ath9k_fill_chanctx_ops (void ) { } +static inline void ath9k_init_channel_context (struct ath_softc *sc) +{ +}static inline int ath9k_init_p2p (struct ath_softc *sc) {return 0 ;
drivers/net/wireless/ath/ath9k/channel.c +19 -9
@@ -499,13 +499,6 @@ static void ath_chanctx_adjust_tbtt_delta(struct ath_softc *sc) prev->tsf_val += offset; } -void ath_chanctx_timer (unsigned long data) -{ -struct ath_softc *sc = (struct ath_softc *) data; - -ath_chanctx_event (sc,NULL ,ATH_CHANCTX_EVENT_TSF_TIMER ); -} -/* Configure the TSF based hardware timer for a channel switch. * Also set up backup software timer, in case the gen timer fails. * This could be caused by a hardware reset.
@@ -907,7 +900,16 @@ void ath_offchannel_channel_change(struct ath_softc *sc) } } -void ath_offchannel_timer (unsigned long data) +#ifdef CONFIG_ATH9K_CHANNEL_CONTEXT + +static void ath_chanctx_timer (unsigned long data) +{ +struct ath_softc *sc = (struct ath_softc *) data; + +ath_chanctx_event (sc,NULL ,ATH_CHANCTX_EVENT_TSF_TIMER ); +} + +static void ath_offchannel_timer (unsigned long data) {struct ath_softc *sc = (struct ath_softc *)data;struct ath_chanctx *ctx;
@@ -947,7 +949,15 @@ void ath_offchannel_timer(unsigned long data) } } -#ifdef CONFIG_ATH9K_CHANNEL_CONTEXT +void ath9k_init_channel_context (struct ath_softc *sc) +{ +INIT_WORK (&sc->chanctx_work, ath_chanctx_work); + +setup_timer (&sc->offchannel.timer, ath_offchannel_timer, + (unsigned long )sc); +setup_timer (&sc->sched.timer, ath_chanctx_timer, + (unsigned long )sc); +}bool ath9k_is_chanctx_enabled (void ) {
drivers/net/wireless/ath/ath9k/init.c +2 -4
@@ -571,11 +571,9 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc,setup_timer (&sc->sleep_timer, ath_ps_full_sleep, (unsigned long )sc);INIT_WORK (&sc->hw_reset_work, ath_reset_work);INIT_WORK (&sc->paprd_work, ath_paprd_calibrate); -INIT_WORK (&sc->chanctx_work, ath_chanctx_work);INIT_DELAYED_WORK (&sc->hw_pll_work, ath_hw_pll_work); -setup_timer (&sc->offchannel.timer, ath_offchannel_timer, - (unsigned long )sc); -setup_timer (&sc->sched.timer, ath_chanctx_timer, (unsigned long )sc); + +ath9k_init_channel_context (sc);/* * Cache line size is used to size and align various
Signature · 1 line
2.0.4
PATCH 2/18 ath9k: Add a routine to tear down channel contexts
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
--- drivers/net/wireless/ath/ath9k/ath9k.h | 4 ++++ drivers/net/wireless/ath/ath9k/channel.c | 5 +++++ drivers/net/wireless/ath/ath9k/main.c | 3 ++- drivers/net/wireless/ath/ath9k/wow.c | 3 ++- 4 files changed, 13 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +4 -0
@@ -437,6 +437,7 @@ void ath_roc_complete(struct ath_softc *sc, bool abort);bool ath9k_is_chanctx_enabled (void );void ath9k_fill_chanctx_ops (void );void ath9k_init_channel_context (struct ath_softc *sc); +void ath9k_deinit_channel_context (struct ath_softc *sc);int ath9k_init_p2p (struct ath_softc *sc);void ath9k_deinit_p2p (struct ath_softc *sc); void ath9k_p2p_remove_vif(struct ath_softc *sc,
@@ -456,6 +457,9 @@ static inline void ath9k_fill_chanctx_ops(void)static inline void ath9k_init_channel_context (struct ath_softc *sc) { } +static inline void ath9k_deinit_channel_context (struct ath_softc *sc) +{ +}static inline int ath9k_init_p2p (struct ath_softc *sc) {return 0 ;
drivers/net/wireless/ath/ath9k/channel.c +5 -0
@@ -959,6 +959,11 @@ void ath9k_init_channel_context(struct ath_softc *sc) (unsigned long)sc); } +void ath9k_deinit_channel_context (struct ath_softc *sc) +{ +cancel_work_sync (&sc->chanctx_work); +} +bool ath9k_is_chanctx_enabled (void ) {return (ath9k_use_chanctx ==1 );
drivers/net/wireless/ath/ath9k/main.c +2 -1
@@ -822,7 +822,8 @@ static void ath9k_stop(struct ieee80211_hw *hw)struct ath_common *common =ath9k_hw_common (ah);bool prev_idle; -cancel_work_sync (&sc->chanctx_work); +ath9k_deinit_channel_context (sc); +mutex_lock (&sc->mutex);ath_cancel_work (sc);
drivers/net/wireless/ath/ath9k/wow.c +2 -1
@@ -193,7 +193,8 @@ int ath9k_suspend(struct ieee80211_hw *hw,u32 wow_triggers_enabled =0 ;int ret =0 ; -cancel_work_sync (&sc->chanctx_work); +ath9k_deinit_channel_context (sc); +mutex_lock (&sc->mutex);ath_cancel_work (sc);
Signature · 1 line
2.0.4
PATCH 3/18 ath9k: Make ath_chanctx_work static
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
Also compile it conditionally based onCONFIG_ATH9K_CHANNEL_CONTEXT.
--- drivers/net/wireless/ath/ath9k/ath9k.h | 1 - drivers/net/wireless/ath/ath9k/channel.c | 18 +++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +0 -1
@@ -633,7 +633,6 @@ void ath9k_csa_update(struct ath_softc *sc);#define ATH_PAPRD_TIMEOUT 100/* msecs */ #define ATH_PLL_WORK_INTERVAL 100 -void ath_chanctx_work (struct work_struct *work);void ath_tx_complete_poll_work (struct work_struct *work);void ath_reset_work (struct work_struct *work);bool ath_hw_check (struct ath_softc *sc);
drivers/net/wireless/ath/ath9k/channel.c +9 -9
@@ -305,15 +305,6 @@ static void ath_chanctx_set_next(struct ath_softc *sc, bool force)ath_chanctx_event (sc,NULL ,ATH_CHANCTX_EVENT_SWITCH ); } -void ath_chanctx_work (struct work_struct *work) -{ - struct ath_softc *sc = container_of(work, struct ath_softc, - chanctx_work); -mutex_lock (&sc->mutex); -ath_chanctx_set_next (sc, false); -mutex_unlock (&sc->mutex); -} -void ath_chanctx_init (struct ath_softc *sc) {struct ath_chanctx *ctx;
@@ -949,6 +940,15 @@ static void ath_offchannel_timer(unsigned long data) } } +static void ath_chanctx_work (struct work_struct *work) +{ + struct ath_softc *sc = container_of(work, struct ath_softc, + chanctx_work); +mutex_lock (&sc->mutex); +ath_chanctx_set_next (sc, false); +mutex_unlock (&sc->mutex); +} +void ath9k_init_channel_context (struct ath_softc *sc) {INIT_WORK (&sc->chanctx_work, ath_chanctx_work);
Signature · 1 line
2.0.4
PATCH 4/18 ath9k: Cleanup mgd_prepare_tx callback
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
Rename the callback from ath9k_chanctx_force_active() to ath9k_mgd_prepare_tx(). Also, move it to main.c and group it with the other callbacks.
--- drivers/net/wireless/ath/ath9k/ath9k.h | 4 ++-- drivers/net/wireless/ath/ath9k/channel.c | 32 +------------------------------- drivers/net/wireless/ath/ath9k/main.c | 32 +++++++++++++++++++++++++++++++- 3 files changed, 34 insertions(+), 34 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +2 -2
@@ -408,8 +408,6 @@ struct ath_offchannel { ctx <= &sc->chanctx[ARRAY_SIZE (sc->chanctx) -1 ]; \ ctx++) -void ath9k_chanctx_force_active (struct ieee80211_hw *hw, -struct ieee80211_vif *vif);static inline struct ath_chanctx *ath_chanctx_get (struct ieee80211_chanctx_conf *ctx) {
@@ -446,6 +444,8 @@ void ath9k_p2p_beacon_sync(struct ath_softc *sc);void ath9k_p2p_bss_info_changed (struct ath_softc *sc,struct ieee80211_vif *vif);void ath9k_p2p_ps_timer (void *priv); + +void ath_chanctx_set_next (struct ath_softc *sc,bool force);#else static inline bool ath9k_is_chanctx_enabled (void ) {
drivers/net/wireless/ath/ath9k/channel.c +1 -31
@@ -243,7 +243,7 @@ static bool ath_chanctx_defer_switch(struct ath_softc *sc)return true; } -static void ath_chanctx_set_next (struct ath_softc *sc,bool force) +void ath_chanctx_set_next (struct ath_softc *sc,bool force) {struct timespec ts;bool measure_time = false;
@@ -336,36 +336,6 @@ void ath_chanctx_init(struct ath_softc *sc) } -void ath9k_chanctx_force_active (struct ieee80211_hw *hw, -struct ieee80211_vif *vif) -{ -struct ath_softc *sc = hw->priv; -struct ath_common *common =ath9k_hw_common (sc->sc_ah); -struct ath_vif *avp = (struct ath_vif *) vif->drv_priv; -bool changed = false; - -if (!test_bit (ATH_OP_MULTI_CHANNEL , &common->op_flags)) -return ; - -if (!avp->chanctx) -return ; - -mutex_lock (&sc->mutex); - -spin_lock_bh (&sc->chan_lock); -if (sc->next_chan || (sc->cur_chan != avp->chanctx)) { - sc->next_chan = avp->chanctx; - changed = true; - } - sc->sched.state =ATH_CHANCTX_STATE_FORCE_ACTIVE ; -spin_unlock_bh (&sc->chan_lock); - -if (changed) -ath_chanctx_set_next (sc, true); - -mutex_unlock (&sc->mutex); -} -void ath_chanctx_switch (struct ath_softc *sc,struct ath_chanctx *ctx,struct cfg80211_chan_def *chandef) {
drivers/net/wireless/ath/ath9k/main.c +31 -1
@@ -2340,6 +2340,36 @@ static void ath9k_unassign_vif_chanctx(struct ieee80211_hw *hw,mutex_unlock (&sc->mutex); } +static void ath9k_mgd_prepare_tx (struct ieee80211_hw *hw, +struct ieee80211_vif *vif) +{ +struct ath_softc *sc = hw->priv; +struct ath_common *common =ath9k_hw_common (sc->sc_ah); +struct ath_vif *avp = (struct ath_vif *) vif->drv_priv; +bool changed = false; + +if (!test_bit (ATH_OP_MULTI_CHANNEL , &common->op_flags)) +return ; + +if (!avp->chanctx) +return ; + +mutex_lock (&sc->mutex); + +spin_lock_bh (&sc->chan_lock); +if (sc->next_chan || (sc->cur_chan != avp->chanctx)) { + sc->next_chan = avp->chanctx; + changed = true; + } + sc->sched.state =ATH_CHANCTX_STATE_FORCE_ACTIVE ; +spin_unlock_bh (&sc->chan_lock); + +if (changed) +ath_chanctx_set_next (sc, true); + +mutex_unlock (&sc->mutex); +} +void ath9k_fill_chanctx_ops (void ) {if (!ath9k_is_chanctx_enabled ())
@@ -2354,7 +2384,7 @@ void ath9k_fill_chanctx_ops(void) ath9k_ops.change_chanctx = ath9k_change_chanctx; ath9k_ops.assign_vif_chanctx = ath9k_assign_vif_chanctx; ath9k_ops.unassign_vif_chanctx = ath9k_unassign_vif_chanctx; - ath9k_ops.mgd_prepare_tx = ath9k_chanctx_force_active; + ath9k_ops.mgd_prepare_tx = ath9k_mgd_prepare_tx; }#endif
Signature · 1 line
2.0.4
PATCH 5/18 ath9k: Conditionally compile a few functions
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
Exclude these functions when CONFIG_ATH9K_CHANNEL_CONTEXT is not enabled:
ath_chanctx_send_vif_ps_frame()ath_chanctx_send_ps_frame()ath_chanctx_defer_switch()ath_chanctx_set_next()
--- drivers/net/wireless/ath/ath9k/channel.c | 292 +++++++++++++++---------------- 1 file changed, 146 insertions(+), 146 deletions(-)
drivers/net/wireless/ath/ath9k/channel.c +146 -146
@@ -118,53 +118,6 @@ static int ath_set_channel(struct ath_softc *sc)return 0 ; } -static bool -ath_chanctx_send_vif_ps_frame (struct ath_softc *sc,struct ath_vif *avp, -bool powersave) -{ -struct ieee80211_vif *vif = avp->vif; -struct ieee80211_sta *sta =NULL ; -struct ieee80211_hdr_3addr *nullfunc; -struct ath_tx_control txctl; -struct sk_buff *skb; -int band = sc->cur_chan->chandef.chan->band; - -switch (vif->type) { -case NL80211_IFTYPE_STATION : -if (!vif->bss_conf.assoc) -return false; - - skb =ieee80211_nullfunc_get (sc->hw, vif); -if (!skb) -return false; - - nullfunc = (struct ieee80211_hdr_3addr *) skb->data; -if (powersave) - nullfunc->frame_control |= -cpu_to_le16 (IEEE80211_FCTL_PM ); - -skb_set_queue_mapping (skb,IEEE80211_AC_VO ); -if (!ieee80211_tx_prepare_skb (sc->hw, vif, skb, band, &sta)) { -dev_kfree_skb_any (skb); -return false; - } -break ; -default : -return false; - } - -memset (&txctl,0 ,sizeof (txctl)); - txctl.txq = sc->tx.txq_map[IEEE80211_AC_VO ]; - txctl.sta = sta; - txctl.force_channel = true; -if (ath_tx_start (sc->hw, skb, &txctl)) { -ieee80211_free_txskb (sc->hw, skb); -return false; - } - -return true; -} -void ath_chanctx_check_active (struct ath_softc *sc,struct ath_chanctx *ctx) {struct ath_common *common =ath9k_hw_common (sc->sc_ah);
@@ -206,105 +159,6 @@ void ath_chanctx_check_active(struct ath_softc *sc, struct ath_chanctx *ctx)ath_chanctx_event (sc,NULL ,ATH_CHANCTX_EVENT_ENABLE_MULTICHANNEL ); } -static bool -ath_chanctx_send_ps_frame (struct ath_softc *sc,bool powersave) -{ -struct ath_vif *avp; -bool sent = false; - -rcu_read_lock (); -list_for_each_entry (avp, &sc->cur_chan->vifs, list) { -if (ath_chanctx_send_vif_ps_frame (sc, avp, powersave)) - sent = true; - } -rcu_read_unlock (); - -return sent; -} - -static bool ath_chanctx_defer_switch (struct ath_softc *sc) -{ -if (sc->cur_chan == &sc->offchannel.chan) -return false; - -switch (sc->sched.state) { -case ATH_CHANCTX_STATE_SWITCH : -return false; -case ATH_CHANCTX_STATE_IDLE : -if (!sc->cur_chan->switch_after_beacon) -return false; - - sc->sched.state =ATH_CHANCTX_STATE_WAIT_FOR_BEACON ; -break ; -default : -break ; - } - -return true; -} - -void ath_chanctx_set_next (struct ath_softc *sc,bool force) -{ -struct timespec ts; -bool measure_time = false; -bool send_ps = false; - -spin_lock_bh (&sc->chan_lock); -if (!sc->next_chan) { -spin_unlock_bh (&sc->chan_lock); -return ; - } - -if (!force &&ath_chanctx_defer_switch (sc)) { -spin_unlock_bh (&sc->chan_lock); -return ; - } - -if (sc->cur_chan != sc->next_chan) { - sc->cur_chan->stopped = true; -spin_unlock_bh (&sc->chan_lock); - -if (sc->next_chan == &sc->offchannel.chan) { -getrawmonotonic (&ts); - measure_time = true; - } -__ath9k_flush (sc->hw, ~0 , true); - -if (ath_chanctx_send_ps_frame (sc, true)) -__ath9k_flush (sc->hw,BIT (IEEE80211_AC_VO ), false); - - send_ps = true; -spin_lock_bh (&sc->chan_lock); - -if (sc->cur_chan != &sc->offchannel.chan) { -getrawmonotonic (&sc->cur_chan->tsf_ts); - sc->cur_chan->tsf_val =ath9k_hw_gettsf64 (sc->sc_ah); - } - } - sc->cur_chan = sc->next_chan; - sc->cur_chan->stopped = false; - sc->next_chan =NULL ; - sc->sched.offchannel_duration =0 ; -if (sc->sched.state !=ATH_CHANCTX_STATE_FORCE_ACTIVE ) - sc->sched.state =ATH_CHANCTX_STATE_IDLE ; - -spin_unlock_bh (&sc->chan_lock); - -if (sc->sc_ah->chip_fullsleep || -memcmp (&sc->cur_chandef, &sc->cur_chan->chandef, -sizeof (sc->cur_chandef))) { -ath_set_channel (sc); -if (measure_time) - sc->sched.channel_switch_time = -ath9k_hw_get_tsf_offset (&ts,NULL ); - } -if (send_ps) -ath_chanctx_send_ps_frame (sc, false); - -ath_offchannel_channel_change (sc); -ath_chanctx_event (sc,NULL ,ATH_CHANCTX_EVENT_SWITCH ); -} -void ath_chanctx_init (struct ath_softc *sc) {struct ath_chanctx *ctx;
@@ -910,6 +764,152 @@ static void ath_offchannel_timer(unsigned long data) } } +static bool +ath_chanctx_send_vif_ps_frame (struct ath_softc *sc,struct ath_vif *avp, +bool powersave) +{ +struct ieee80211_vif *vif = avp->vif; +struct ieee80211_sta *sta =NULL ; +struct ieee80211_hdr_3addr *nullfunc; +struct ath_tx_control txctl; +struct sk_buff *skb; +int band = sc->cur_chan->chandef.chan->band; + +switch (vif->type) { +case NL80211_IFTYPE_STATION : +if (!vif->bss_conf.assoc) +return false; + + skb =ieee80211_nullfunc_get (sc->hw, vif); +if (!skb) +return false; + + nullfunc = (struct ieee80211_hdr_3addr *) skb->data; +if (powersave) + nullfunc->frame_control |= +cpu_to_le16 (IEEE80211_FCTL_PM ); + +skb_set_queue_mapping (skb,IEEE80211_AC_VO ); +if (!ieee80211_tx_prepare_skb (sc->hw, vif, skb, band, &sta)) { +dev_kfree_skb_any (skb); +return false; + } +break ; +default : +return false; + } + +memset (&txctl,0 ,sizeof (txctl)); + txctl.txq = sc->tx.txq_map[IEEE80211_AC_VO ]; + txctl.sta = sta; + txctl.force_channel = true; +if (ath_tx_start (sc->hw, skb, &txctl)) { +ieee80211_free_txskb (sc->hw, skb); +return false; + } + +return true; +} + +static bool +ath_chanctx_send_ps_frame (struct ath_softc *sc,bool powersave) +{ +struct ath_vif *avp; +bool sent = false; + +rcu_read_lock (); +list_for_each_entry (avp, &sc->cur_chan->vifs, list) { +if (ath_chanctx_send_vif_ps_frame (sc, avp, powersave)) + sent = true; + } +rcu_read_unlock (); + +return sent; +} + +static bool ath_chanctx_defer_switch (struct ath_softc *sc) +{ +if (sc->cur_chan == &sc->offchannel.chan) +return false; + +switch (sc->sched.state) { +case ATH_CHANCTX_STATE_SWITCH : +return false; +case ATH_CHANCTX_STATE_IDLE : +if (!sc->cur_chan->switch_after_beacon) +return false; + + sc->sched.state =ATH_CHANCTX_STATE_WAIT_FOR_BEACON ; +break ; +default : +break ; + } + +return true; +} + +void ath_chanctx_set_next (struct ath_softc *sc,bool force) +{ +struct timespec ts; +bool measure_time = false; +bool send_ps = false; + +spin_lock_bh (&sc->chan_lock); +if (!sc->next_chan) { +spin_unlock_bh (&sc->chan_lock); +return ; + } + +if (!force &&ath_chanctx_defer_switch (sc)) { +spin_unlock_bh (&sc->chan_lock); +return ; + } + +if (sc->cur_chan != sc->next_chan) { + sc->cur_chan->stopped = true; +spin_unlock_bh (&sc->chan_lock); + +if (sc->next_chan == &sc->offchannel.chan) { +getrawmonotonic (&ts); + measure_time = true; + } +__ath9k_flush (sc->hw, ~0 , true); + +if (ath_chanctx_send_ps_frame (sc, true)) +__ath9k_flush (sc->hw,BIT (IEEE80211_AC_VO ), false); + + send_ps = true; +spin_lock_bh (&sc->chan_lock); + +if (sc->cur_chan != &sc->offchannel.chan) { +getrawmonotonic (&sc->cur_chan->tsf_ts); + sc->cur_chan->tsf_val =ath9k_hw_gettsf64 (sc->sc_ah); + } + } + sc->cur_chan = sc->next_chan; + sc->cur_chan->stopped = false; + sc->next_chan =NULL ; + sc->sched.offchannel_duration =0 ; +if (sc->sched.state !=ATH_CHANCTX_STATE_FORCE_ACTIVE ) + sc->sched.state =ATH_CHANCTX_STATE_IDLE ; + +spin_unlock_bh (&sc->chan_lock); + +if (sc->sc_ah->chip_fullsleep || +memcmp (&sc->cur_chandef, &sc->cur_chan->chandef, +sizeof (sc->cur_chandef))) { +ath_set_channel (sc); +if (measure_time) + sc->sched.channel_switch_time = +ath9k_hw_get_tsf_offset (&ts,NULL ); + } +if (send_ps) +ath_chanctx_send_ps_frame (sc, false); + +ath_offchannel_channel_change (sc); +ath_chanctx_event (sc,NULL ,ATH_CHANCTX_EVENT_SWITCH ); +} +static void ath_chanctx_work (struct work_struct *work) { struct ath_softc *sc = container_of(work, struct ath_softc,
Signature · 1 line
2.0.4
PATCH 6/18 ath9k: Exclude more functions
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
Use CONFIG_ATH9K_CHANNEL_CONTEXT to exclude more functions:
ath_offchannel_channel_change()ath_scan_channel_start()ath_scan_send_probe()
--- drivers/net/wireless/ath/ath9k/ath9k.h | 1 - drivers/net/wireless/ath/ath9k/channel.c | 120 +++++++++++++++---------------- 2 files changed, 60 insertions(+), 61 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +0 -1
@@ -420,7 +420,6 @@ void ath_chanctx_set_channel(struct ath_softc *sc, struct ath_chanctx *ctx,void ath_chanctx_switch (struct ath_softc *sc,struct ath_chanctx *ctx,struct cfg80211_chan_def *chandef);void ath_chanctx_check_active (struct ath_softc *sc,struct ath_chanctx *ctx); -void ath_offchannel_channel_change (struct ath_softc *sc);void ath_chanctx_offchan_switch (struct ath_softc *sc,struct ieee80211_channel *chan); struct ath_chanctx *ath_chanctx_get_oper_chan(struct ath_softc *sc,
drivers/net/wireless/ath/ath9k/channel.c +60 -60
144 lines not on this page · raw message
Signature · 1 line
2.0.4
PATCH 7/18 ath9k: Conditionally compile more functions
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
Use CONFIG_ATH9K_CHANNEL_CONTEXT to exclude:
ath_scan_complete()ath_roc_complete()ath_offchannel_next()ath_scan_next_channel()ath_scan_channel_duration()
--- drivers/net/wireless/ath/ath9k/channel.c | 38 ++++++++++++++++---------------- 1 file changed, 19 insertions(+), 19 deletions(-)
drivers/net/wireless/ath/ath9k/channel.c +19 -19
@@ -507,6 +507,25 @@ void ath_chanctx_event(struct ath_softc *sc, struct ieee80211_vif *vif,spin_unlock_bh (&sc->chan_lock); } +#ifdef CONFIG_ATH9K_CHANNEL_CONTEXT + +static const char *offchannel_state_string (enum ath_offchannel_state state) +{ +#define case_rtn_string (val) case val: return #val + +switch (state) { +case_rtn_string (ATH_OFFCHANNEL_IDLE ); +case_rtn_string (ATH_OFFCHANNEL_PROBE_SEND ); +case_rtn_string (ATH_OFFCHANNEL_PROBE_WAIT ); +case_rtn_string (ATH_OFFCHANNEL_SUSPEND ); +case_rtn_string (ATH_OFFCHANNEL_ROC_START ); +case_rtn_string (ATH_OFFCHANNEL_ROC_WAIT ); +case_rtn_string (ATH_OFFCHANNEL_ROC_DONE ); +default : +return "unknown" ; + } +} +static int ath_scan_channel_duration (struct ath_softc *sc,struct ieee80211_channel *chan) {
@@ -599,25 +618,6 @@ void ath_scan_complete(struct ath_softc *sc, bool abort)ath9k_ps_restore (sc); } -#ifdef CONFIG_ATH9K_CHANNEL_CONTEXT - -static const char *offchannel_state_string (enum ath_offchannel_state state) -{ -#define case_rtn_string (val) case val: return #val - -switch (state) { -case_rtn_string (ATH_OFFCHANNEL_IDLE ); -case_rtn_string (ATH_OFFCHANNEL_PROBE_SEND ); -case_rtn_string (ATH_OFFCHANNEL_PROBE_WAIT ); -case_rtn_string (ATH_OFFCHANNEL_SUSPEND ); -case_rtn_string (ATH_OFFCHANNEL_ROC_START ); -case_rtn_string (ATH_OFFCHANNEL_ROC_WAIT ); -case_rtn_string (ATH_OFFCHANNEL_ROC_DONE ); -default : -return "unknown" ; - } -} -static void ath_scan_send_probe (struct ath_softc *sc,struct cfg80211_ssid *ssid) {
Signature · 1 line
2.0.4
PATCH 8/18 ath9k: Make ath_chanctx_offchan_switch static
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
--- drivers/net/wireless/ath/ath9k/ath9k.h | 2 -- drivers/net/wireless/ath/ath9k/channel.c | 26 +++++++++++++------------- 2 files changed, 13 insertions(+), 15 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +0 -2
@@ -420,8 +420,6 @@ void ath_chanctx_set_channel(struct ath_softc *sc, struct ath_chanctx *ctx,void ath_chanctx_switch (struct ath_softc *sc,struct ath_chanctx *ctx,struct cfg80211_chan_def *chandef);void ath_chanctx_check_active (struct ath_softc *sc,struct ath_chanctx *ctx); -void ath_chanctx_offchan_switch (struct ath_softc *sc, -struct ieee80211_channel *chan);struct ath_chanctx *ath_chanctx_get_oper_chan (struct ath_softc *sc,bool active); void ath_chanctx_event(struct ath_softc *sc, struct ieee80211_vif *vif,
drivers/net/wireless/ath/ath9k/channel.c +13 -13
@@ -244,19 +244,6 @@ struct ath_chanctx *ath_chanctx_get_oper_chan(struct ath_softc *sc, bool active)return &sc->chanctx[0 ]; } -void ath_chanctx_offchan_switch (struct ath_softc *sc, -struct ieee80211_channel *chan) -{ -struct ath_common *common =ath9k_hw_common (sc->sc_ah); -struct cfg80211_chan_def chandef; - -cfg80211_chandef_create (&chandef, chan,NL80211_CHAN_NO_HT ); -ath_dbg (common,CHAN_CTX , -"Channel definition created: %d MHz\n" , chandef.center_freq1); - -ath_chanctx_switch (sc, &sc->offchannel.chan, &chandef); -} -static struct ath_chanctx *ath_chanctx_get_next (struct ath_softc *sc,struct ath_chanctx *ctx) {
@@ -537,6 +524,19 @@ static int ath_scan_channel_duration(struct ath_softc *sc,return (HZ /16 );/* ~60 ms */ } +static void ath_chanctx_offchan_switch (struct ath_softc *sc, +struct ieee80211_channel *chan) +{ +struct ath_common *common =ath9k_hw_common (sc->sc_ah); +struct cfg80211_chan_def chandef; + +cfg80211_chandef_create (&chandef, chan,NL80211_CHAN_NO_HT ); +ath_dbg (common,CHAN_CTX , +"Channel definition created: %d MHz\n" , chandef.center_freq1); + +ath_chanctx_switch (sc, &sc->offchannel.chan, &chandef); +} +static void ath_scan_next_channel (struct ath_softc *sc) {
Signature · 1 line
2.0.4
PATCH 9/18 ath9k: Make ath_chanctx_get_oper_chan static
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
--- drivers/net/wireless/ath/ath9k/ath9k.h | 2 -- drivers/net/wireless/ath/ath9k/channel.c | 35 ++++++++++++++++---------------- 2 files changed, 18 insertions(+), 19 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +0 -2
@@ -420,8 +420,6 @@ void ath_chanctx_set_channel(struct ath_softc *sc, struct ath_chanctx *ctx,void ath_chanctx_switch (struct ath_softc *sc,struct ath_chanctx *ctx,struct cfg80211_chan_def *chandef);void ath_chanctx_check_active (struct ath_softc *sc,struct ath_chanctx *ctx); -struct ath_chanctx *ath_chanctx_get_oper_chan (struct ath_softc *sc, -bool active);void ath_chanctx_event (struct ath_softc *sc,struct ieee80211_vif *vif,enum ath_chanctx_event ev);void ath_offchannel_next (struct ath_softc *sc);
drivers/net/wireless/ath/ath9k/channel.c +18 -17
@@ -227,23 +227,6 @@ void ath_chanctx_set_channel(struct ath_softc *sc, struct ath_chanctx *ctx,ath_set_channel (sc); } -struct ath_chanctx *ath_chanctx_get_oper_chan (struct ath_softc *sc,bool active) -{ -struct ath_chanctx *ctx; - -ath_for_each_chanctx (sc, ctx) { -if (!ctx->assigned ||list_empty (&ctx->vifs)) -continue ; -if (active && !ctx->active) -continue ; - -if (ctx->switch_after_beacon) -return ctx; - } - -return &sc->chanctx[0 ]; -} -static struct ath_chanctx *ath_chanctx_get_next (struct ath_softc *sc,struct ath_chanctx *ctx) {
@@ -537,6 +520,24 @@ static void ath_chanctx_offchan_switch(struct ath_softc *sc,ath_chanctx_switch (sc, &sc->offchannel.chan, &chandef); } +static struct ath_chanctx *ath_chanctx_get_oper_chan (struct ath_softc *sc, +bool active) +{ +struct ath_chanctx *ctx; + +ath_for_each_chanctx (sc, ctx) { +if (!ctx->assigned ||list_empty (&ctx->vifs)) +continue ; +if (active && !ctx->active) +continue ; + +if (ctx->switch_after_beacon) +return ctx; + } + +return &sc->chanctx[0 ]; +} +static void ath_scan_next_channel (struct ath_softc *sc) {
Signature · 1 line
2.0.4
PATCH 10/18 ath9k: Make ath_chanctx_switch static
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
--- drivers/net/wireless/ath/ath9k/ath9k.h | 2 - drivers/net/wireless/ath/ath9k/channel.c | 74 ++++++++++++++++---------------- 2 files changed, 37 insertions(+), 39 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +0 -2
@@ -417,8 +417,6 @@ ath_chanctx_get(struct ieee80211_chanctx_conf *ctx)void ath_chanctx_init (struct ath_softc *sc);void ath_chanctx_set_channel (struct ath_softc *sc,struct ath_chanctx *ctx,struct cfg80211_chan_def *chandef); -void ath_chanctx_switch (struct ath_softc *sc,struct ath_chanctx *ctx, -struct cfg80211_chan_def *chandef);void ath_chanctx_check_active (struct ath_softc *sc,struct ath_chanctx *ctx);void ath_chanctx_event (struct ath_softc *sc,struct ieee80211_vif *vif,enum ath_chanctx_event ev);
drivers/net/wireless/ath/ath9k/channel.c +37 -37
86 lines not on this page · raw message
Signature · 1 line
2.0.4
PATCH 11/18 ath9k: Fix channel context events
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
Check if channel context usage is enabled before calling ath_chanctx_event() from various parts of the driver. Also, make sure that ath_chanctx_event() is compiled only when CONFIG_ATH9K_CHANNEL_CONTEXT is enabled.
--- drivers/net/wireless/ath/ath9k/ath9k.h | 9 +++++-- drivers/net/wireless/ath/ath9k/beacon.c | 13 +++++++--- drivers/net/wireless/ath/ath9k/channel.c | 44 +++++++++++++++++--------------- drivers/net/wireless/ath/ath9k/main.c | 8 ++++-- drivers/net/wireless/ath/ath9k/recv.c | 9 ++++--- drivers/net/wireless/ath/ath9k/xmit.c | 7 +++-- 6 files changed, 57 insertions(+), 33 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +7 -2
@@ -418,8 +418,6 @@ void ath_chanctx_init(struct ath_softc *sc);void ath_chanctx_set_channel (struct ath_softc *sc,struct ath_chanctx *ctx,struct cfg80211_chan_def *chandef);void ath_chanctx_check_active (struct ath_softc *sc,struct ath_chanctx *ctx); -void ath_chanctx_event (struct ath_softc *sc,struct ieee80211_vif *vif, -enum ath_chanctx_event ev);void ath_offchannel_next (struct ath_softc *sc);void ath_scan_complete (struct ath_softc *sc,bool abort);void ath_roc_complete (struct ath_softc *sc,bool abort);
@@ -438,6 +436,8 @@ void ath9k_p2p_bss_info_changed(struct ath_softc *sc, struct ieee80211_vif *vif);void ath9k_p2p_ps_timer (void *priv); +void ath_chanctx_event (struct ath_softc *sc,struct ieee80211_vif *vif, +enum ath_chanctx_event ev);void ath_chanctx_set_next (struct ath_softc *sc,bool force);#else static inline bool ath9k_is_chanctx_enabled (void )
@@ -453,6 +453,11 @@ static inline void ath9k_init_channel_context(struct ath_softc *sc)static inline void ath9k_deinit_channel_context (struct ath_softc *sc) { } +static inline void ath_chanctx_event (struct ath_softc *sc, +struct ieee80211_vif *vif, +enum ath_chanctx_event ev) +{ +}static inline int ath9k_init_p2p (struct ath_softc *sc) {return 0 ;
drivers/net/wireless/ath/ath9k/beacon.c +9 -4
@@ -427,9 +427,11 @@ void ath9k_beacon_tasklet(unsigned long data)/* EDMA devices check that in the tx completion function. */ if (!edma) { -if (sc->sched.beacon_pending) -ath_chanctx_event (sc,NULL , -ATH_CHANCTX_EVENT_BEACON_SENT ); +if (ath9k_is_chanctx_enabled ()) { +if (sc->sched.beacon_pending) +ath_chanctx_event (sc,NULL , +ATH_CHANCTX_EVENT_BEACON_SENT ); + }if (ath9k_csa_is_finished (sc, vif))return ;
@@ -438,7 +440,10 @@ void ath9k_beacon_tasklet(unsigned long data)if (!vif || !vif->bss_conf.enable_beacon)return ; -ath_chanctx_event (sc, vif,ATH_CHANCTX_EVENT_BEACON_PREPARE ); +if (ath9k_is_chanctx_enabled ()) { +ath_chanctx_event (sc, vif,ATH_CHANCTX_EVENT_BEACON_PREPARE ); + } + bf =ath9k_beacon_generate (sc->hw, vif);if (sc->beacon.bmisscnt !=0 ) {
drivers/net/wireless/ath/ath9k/channel.c +24 -20
62 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/main.c +6 -2
@@ -1684,8 +1684,12 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw, bss_conf->bssid, bss_conf->assoc);ath9k_calculate_summary_state (sc, avp->chanctx); -if (bss_conf->assoc) -ath_chanctx_event (sc, vif,ATH_CHANCTX_EVENT_ASSOC ); + +if (ath9k_is_chanctx_enabled ()) { +if (bss_conf->assoc) +ath_chanctx_event (sc, vif, +ATH_CHANCTX_EVENT_ASSOC ); + } }if (changed &BSS_CHANGED_IBSS ) {
drivers/net/wireless/ath/ath9k/recv.c +6 -3
@@ -892,9 +892,12 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc,return -EINVAL ; } -if (rx_stats->is_mybeacon) { - sc->sched.next_tbtt = rx_stats->rs_tstamp; -ath_chanctx_event (sc,NULL ,ATH_CHANCTX_EVENT_BEACON_RECEIVED ); +if (ath9k_is_chanctx_enabled ()) { +if (rx_stats->is_mybeacon) { + sc->sched.next_tbtt = rx_stats->rs_tstamp; +ath_chanctx_event (sc,NULL , +ATH_CHANCTX_EVENT_BEACON_RECEIVED ); + } }ath9k_cmn_process_rssi (common, hw, rx_stats, rx_status);
drivers/net/wireless/ath/ath9k/xmit.c +5 -2
@@ -2632,8 +2632,11 @@ void ath_tx_edma_tasklet(struct ath_softc *sc) sc->beacon.tx_processed = true; sc->beacon.tx_last = !(ts.ts_status &ATH9K_TXERR_MASK ); -ath_chanctx_event (sc,NULL , -ATH_CHANCTX_EVENT_BEACON_SENT ); +if (ath9k_is_chanctx_enabled ()) { +ath_chanctx_event (sc,NULL , +ATH_CHANCTX_EVENT_BEACON_SENT ); + } +ath9k_csa_update (sc);continue ; }
Signature · 1 line
2.0.4
PATCH 12/18 ath9k: Fix function declarations
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
These routines are required only whenCONFIG_ATH9K_CHANNEL_CONTEXT is enabled.
--- drivers/net/wireless/ath/ath9k/ath9k.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +3 -3
@@ -418,9 +418,6 @@ void ath_chanctx_init(struct ath_softc *sc);void ath_chanctx_set_channel (struct ath_softc *sc,struct ath_chanctx *ctx,struct cfg80211_chan_def *chandef);void ath_chanctx_check_active (struct ath_softc *sc,struct ath_chanctx *ctx); -void ath_offchannel_next (struct ath_softc *sc); -void ath_scan_complete (struct ath_softc *sc,bool abort); -void ath_roc_complete (struct ath_softc *sc,bool abort);#ifdef CONFIG_ATH9K_CHANNEL_CONTEXT bool ath9k_is_chanctx_enabled (void );
@@ -439,6 +436,9 @@ void ath9k_p2p_ps_timer(void *priv);void ath_chanctx_event (struct ath_softc *sc,struct ieee80211_vif *vif,enum ath_chanctx_event ev);void ath_chanctx_set_next (struct ath_softc *sc,bool force); +void ath_offchannel_next (struct ath_softc *sc); +void ath_scan_complete (struct ath_softc *sc,bool abort); +void ath_roc_complete (struct ath_softc *sc,bool abort);#else static inline bool ath9k_is_chanctx_enabled (void ) {
Signature · 1 line
2.0.4
PATCH 13/18 ath9k: Add wrappers for beacon events
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
Using these wrappers allows us to move the 'sched' variable in ath_softc inside CONFIG_ATH9K_CHANNEL_CONTEXT.
--- drivers/net/wireless/ath/ath9k/ath9k.h | 14 +++++++++++++- drivers/net/wireless/ath/ath9k/beacon.c | 5 ++--- drivers/net/wireless/ath/ath9k/channel.c | 14 ++++++++++++++ drivers/net/wireless/ath/ath9k/recv.c | 8 +++----- 4 files changed, 32 insertions(+), 9 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +13 -1
@@ -433,6 +433,10 @@ void ath9k_p2p_bss_info_changed(struct ath_softc *sc, struct ieee80211_vif *vif);void ath9k_p2p_ps_timer (void *priv); +void ath_chanctx_beacon_recv_ev (struct ath_softc *sc,u32 ts, +enum ath_chanctx_event ev); +void ath_chanctx_beacon_sent_ev (struct ath_softc *sc, +enum ath_chanctx_event ev);void ath_chanctx_event (struct ath_softc *sc,struct ieee80211_vif *vif,enum ath_chanctx_event ev);void ath_chanctx_set_next (struct ath_softc *sc,bool force);
@@ -453,6 +457,14 @@ static inline void ath9k_init_channel_context(struct ath_softc *sc)static inline void ath9k_deinit_channel_context (struct ath_softc *sc) { } +static inline void ath_chanctx_beacon_recv_ev (struct ath_softc *sc,u32 ts, +enum ath_chanctx_event ev) +{ +} +static inline void ath_chanctx_beacon_sent_ev (struct ath_softc *sc, +enum ath_chanctx_event ev) +{ +}static inline void ath_chanctx_event (struct ath_softc *sc,struct ieee80211_vif *vif,enum ath_chanctx_event ev)
@@ -901,6 +913,7 @@ struct ath_softc {#ifdef CONFIG_ATH9K_CHANNEL_CONTEXT struct ath_gen_timer *p2p_ps_timer;struct ath_vif *p2p_ps_vif; +struct ath_chanctx_sched sched;#endif unsigned long driver_data;
@@ -925,7 +938,6 @@ struct ath_softc {struct ath_chanctx *next_chan;spinlock_t chan_lock;struct ath_offchannel offchannel; -struct ath_chanctx_sched sched;#ifdef CONFIG_MAC80211_LEDS bool led_registered;
drivers/net/wireless/ath/ath9k/beacon.c +2 -3
@@ -428,9 +428,8 @@ void ath9k_beacon_tasklet(unsigned long data)/* EDMA devices check that in the tx completion function. */ if (!edma) {if (ath9k_is_chanctx_enabled ()) { -if (sc->sched.beacon_pending) -ath_chanctx_event (sc,NULL , -ATH_CHANCTX_EVENT_BEACON_SENT ); +ath_chanctx_beacon_sent_ev (sc, +ATH_CHANCTX_EVENT_BEACON_SENT ); }if (ath9k_csa_is_finished (sc, vif))
drivers/net/wireless/ath/ath9k/channel.c +14 -0
@@ -463,6 +463,20 @@ void ath_chanctx_event(struct ath_softc *sc, struct ieee80211_vif *vif,spin_unlock_bh (&sc->chan_lock); } +void ath_chanctx_beacon_sent_ev (struct ath_softc *sc, +enum ath_chanctx_event ev) +{ +if (sc->sched.beacon_pending) +ath_chanctx_event (sc,NULL , ev); +} + +void ath_chanctx_beacon_recv_ev (struct ath_softc *sc,u32 ts, +enum ath_chanctx_event ev) +{ + sc->sched.next_tbtt = ts; +ath_chanctx_event (sc,NULL , ev); +} +static int ath_scan_channel_duration (struct ath_softc *sc,struct ieee80211_channel *chan) {
drivers/net/wireless/ath/ath9k/recv.c +3 -5
@@ -893,11 +893,9 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc, }if (ath9k_is_chanctx_enabled ()) { -if (rx_stats->is_mybeacon) { - sc->sched.next_tbtt = rx_stats->rs_tstamp; -ath_chanctx_event (sc,NULL , -ATH_CHANCTX_EVENT_BEACON_RECEIVED ); - } +if (rx_stats->is_mybeacon) +ath_chanctx_beacon_recv_ev (sc, rx_stats->rs_tstamp, +ATH_CHANCTX_EVENT_BEACON_RECEIVED ); }ath9k_cmn_process_rssi (common, hw, rx_stats, rx_status);
Signature · 1 line
2.0.4
PATCH 14/18 ath9k: Add ath9k_chanctx_wake_queues
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
Introduce a function that handles queues in channel context mode.
--- drivers/net/wireless/ath/ath9k/ath9k.h | 4 ++++ drivers/net/wireless/ath/ath9k/channel.c | 26 ++++++++++++++++++++++++++ drivers/net/wireless/ath/ath9k/main.c | 15 ++------------- 3 files changed, 32 insertions(+), 13 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +4 -0
@@ -432,6 +432,7 @@ void ath9k_p2p_beacon_sync(struct ath_softc *sc);void ath9k_p2p_bss_info_changed (struct ath_softc *sc,struct ieee80211_vif *vif);void ath9k_p2p_ps_timer (void *priv); +void ath9k_chanctx_wake_queues (struct ath_softc *sc);void ath_chanctx_beacon_recv_ev (struct ath_softc *sc,u32 ts,enum ath_chanctx_event ev);
@@ -491,6 +492,9 @@ static inline void ath9k_p2p_bss_info_changed(struct ath_softc *sc,static inline void ath9k_p2p_ps_timer (struct ath_softc *sc) { } +static inline void ath9k_chanctx_wake_queues (struct ath_softc *sc) +{ +}#endif /* CONFIG_ATH9K_CHANNEL_CONTEXT */ int ath_reset_internal (struct ath_softc *sc,struct ath9k_channel *hchan);
drivers/net/wireless/ath/ath9k/channel.c +26 -0
@@ -196,6 +196,10 @@ void ath_chanctx_set_channel(struct ath_softc *sc, struct ath_chanctx *ctx,#ifdef CONFIG_ATH9K_CHANNEL_CONTEXT +/**********************************************************/ +/* Functions to handle the channel context state machine. */ +/**********************************************************/ +static const char *offchannel_state_string (enum ath_offchannel_state state) {#define case_rtn_string (val) case val: return #val
@@ -958,6 +962,28 @@ bool ath9k_is_chanctx_enabled(void)return (ath9k_use_chanctx ==1 ); } +/********************/ +/* Queue management */ +/********************/ + +void ath9k_chanctx_wake_queues (struct ath_softc *sc) +{ +struct ath_hw *ah = sc->sc_ah; +int i; + +if (sc->cur_chan == &sc->offchannel.chan) { +ieee80211_wake_queue (sc->hw, + sc->hw->offchannel_tx_hw_queue); + }else { +for (i =0 ; i <IEEE80211_NUM_ACS ; i++) +ieee80211_wake_queue (sc->hw, + sc->cur_chan->hw_queue_base + i); + } + +if (ah->opmode ==NL80211_IFTYPE_AP ) +ieee80211_wake_queue (sc->hw, sc->hw->queues -2 ); +} +/*****************/ /* P2P Powersave */ /*****************/
drivers/net/wireless/ath/ath9k/main.c +2 -13
@@ -223,7 +223,6 @@ static bool ath_complete_reset(struct ath_softc *sc, bool start)struct ath_hw *ah = sc->sc_ah;struct ath_common *common =ath9k_hw_common (ah);unsigned long flags; -int i;if (ath_startrecv (sc) !=0 ) {ath_err (common,"Unable to restart recv logic\n" );
@@ -270,18 +269,8 @@ static bool ath_complete_reset(struct ath_softc *sc, bool start)if (!ath9k_is_chanctx_enabled ())ieee80211_wake_queues (sc->hw); -else { -if (sc->cur_chan == &sc->offchannel.chan) -ieee80211_wake_queue (sc->hw, - sc->hw->offchannel_tx_hw_queue); -else { -for (i =0 ; i <IEEE80211_NUM_ACS ; i++) -ieee80211_wake_queue (sc->hw, - sc->cur_chan->hw_queue_base + i); - } -if (ah->opmode ==NL80211_IFTYPE_AP ) -ieee80211_wake_queue (sc->hw, sc->hw->queues -2 ); - } +else +ath9k_chanctx_wake_queues (sc);ath9k_p2p_ps_timer (sc);
Signature · 1 line
2.0.4
PATCH 15/18 ath9k: Add ath9k_offchannel_init
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
This patch adds a routine to setup the offchannel
instance in ath_softc.
--- drivers/net/wireless/ath/ath9k/ath9k.h | 4 ++++ drivers/net/wireless/ath/ath9k/channel.c | 33 ++++++++++++++++++++++++-------- drivers/net/wireless/ath/ath9k/init.c | 1 + 3 files changed, 30 insertions(+), 8 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +4 -0
@@ -423,6 +423,7 @@ void ath_chanctx_check_active(struct ath_softc *sc, struct ath_chanctx *ctx);bool ath9k_is_chanctx_enabled (void );void ath9k_fill_chanctx_ops (void );void ath9k_init_channel_context (struct ath_softc *sc); +void ath9k_offchannel_init (struct ath_softc *sc);void ath9k_deinit_channel_context (struct ath_softc *sc);int ath9k_init_p2p (struct ath_softc *sc);void ath9k_deinit_p2p (struct ath_softc *sc);
@@ -455,6 +456,9 @@ static inline void ath9k_fill_chanctx_ops(void)static inline void ath9k_init_channel_context (struct ath_softc *sc) { } +static inline void ath9k_offchannel_init (struct ath_softc *sc) +{ +}static inline void ath9k_deinit_channel_context (struct ath_softc *sc) { }
drivers/net/wireless/ath/ath9k/channel.c +25 -8
@@ -167,14 +167,6 @@ void ath_chanctx_init(struct ath_softc *sc)for (j =0 ; j <ARRAY_SIZE (ctx->acq); j++)INIT_LIST_HEAD (&ctx->acq[j]); } - ctx = &sc->offchannel.chan; -cfg80211_chandef_create (&ctx->chandef, chan,NL80211_CHAN_HT20 ); -INIT_LIST_HEAD (&ctx->vifs); - ctx->txpower =ATH_TXPOWER_MAX ; -for (j =0 ; j <ARRAY_SIZE (ctx->acq); j++) -INIT_LIST_HEAD (&ctx->acq[j]); - sc->offchannel.chan.offchannel = true; - } void ath_chanctx_set_channel(struct ath_softc *sc, struct ath_chanctx *ctx,
@@ -942,6 +934,31 @@ static void ath_chanctx_work(struct work_struct *work)mutex_unlock (&sc->mutex); } +void ath9k_offchannel_init (struct ath_softc *sc) +{ +struct ath_chanctx *ctx; +struct ath_common *common =ath9k_hw_common (sc->sc_ah); +struct ieee80211_supported_band *sband; +struct ieee80211_channel *chan; +int i; + + sband = &common->sbands[IEEE80211_BAND_2GHZ ]; +if (!sband->n_channels) + sband = &common->sbands[IEEE80211_BAND_5GHZ ]; + + chan = &sband->channels[0 ]; + + ctx = &sc->offchannel.chan; +INIT_LIST_HEAD (&ctx->vifs); + ctx->txpower =ATH_TXPOWER_MAX ; +cfg80211_chandef_create (&ctx->chandef, chan,NL80211_CHAN_HT20 ); + +for (i =0 ; i <ARRAY_SIZE (ctx->acq); i++) +INIT_LIST_HEAD (&ctx->acq[i]); + + sc->offchannel.chan.offchannel = true; +} +void ath9k_init_channel_context (struct ath_softc *sc) {INIT_WORK (&sc->chanctx_work, ath_chanctx_work);
drivers/net/wireless/ath/ath9k/init.c +1 -0
@@ -610,6 +610,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc,ath9k_init_misc (sc);ath_fill_led_pin (sc);ath_chanctx_init (sc); +ath9k_offchannel_init (sc);if (common->bus_ops->aspm_init) common->bus_ops->aspm_init (common);
Signature · 1 line
2.0.4
PATCH 16/18 ath9k: Use ath_chanctx_check_active properly
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
ath_chanctx_check_active() is required only when channel contexts are used. Make sure that it is not called in normal usage.
--- drivers/net/wireless/ath/ath9k/ath9k.h | 7 ++- drivers/net/wireless/ath/ath9k/channel.c | 90 ++++++++++++++++---------------- 2 files changed, 50 insertions(+), 47 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +5 -2
@@ -417,8 +417,6 @@ ath_chanctx_get(struct ieee80211_chanctx_conf *ctx)void ath_chanctx_init (struct ath_softc *sc);void ath_chanctx_set_channel (struct ath_softc *sc,struct ath_chanctx *ctx,struct cfg80211_chan_def *chandef); -void ath_chanctx_check_active (struct ath_softc *sc,struct ath_chanctx *ctx); -#ifdef CONFIG_ATH9K_CHANNEL_CONTEXT bool ath9k_is_chanctx_enabled (void );void ath9k_fill_chanctx_ops (void );
@@ -434,6 +432,7 @@ void ath9k_p2p_bss_info_changed(struct ath_softc *sc, struct ieee80211_vif *vif);void ath9k_p2p_ps_timer (void *priv);void ath9k_chanctx_wake_queues (struct ath_softc *sc); +void ath_chanctx_check_active (struct ath_softc *sc,struct ath_chanctx *ctx);void ath_chanctx_beacon_recv_ev (struct ath_softc *sc,u32 ts,enum ath_chanctx_event ev);
@@ -499,6 +498,10 @@ static inline void ath9k_p2p_ps_timer(struct ath_softc *sc)static inline void ath9k_chanctx_wake_queues (struct ath_softc *sc) { } +static inline void ath_chanctx_check_active (struct ath_softc *sc, +struct ath_chanctx *ctx) +{ +}#endif /* CONFIG_ATH9K_CHANNEL_CONTEXT */ int ath_reset_internal (struct ath_softc *sc,struct ath9k_channel *hchan);
drivers/net/wireless/ath/ath9k/channel.c +45 -45
102 lines not on this page · raw message
Signature · 1 line
2.0.4
PATCH 17/18 ath9k: Fix function argument type
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
ath9k_vif_iter() was earlier used as an iterator routine when calling a mac80211 utility. This is no longer the case and hence we can mention the argument type explicitly.
--- drivers/net/wireless/ath/ath9k/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/main.c +2 -2
@@ -893,9 +893,9 @@ static bool ath9k_uses_beacons(int type) } } -static void ath9k_vif_iter (void *data,u8 *mac,struct ieee80211_vif *vif) +static void ath9k_vif_iter (struct ath9k_vif_iter_data *iter_data, +u8 *mac,struct ieee80211_vif *vif) { -struct ath9k_vif_iter_data *iter_data = data;int i;if (iter_data->has_hw_macaddr) {
Signature · 1 line
2.0.4
PATCH 18/18 ath9k: Fix 'offchannel' in ath_softc
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
Finally move the 'offchannel' instance in ath_softc inside a CONFIG_ATH9K_CHANNEL_CONTEXT cage. The offchannel usage in ath9k_calculate_iter_data() is closed off with an ifdef for now, since the state/opmode calculation is common for both the channel context mode and the normal mode.
--- drivers/net/wireless/ath/ath9k/ath9k.h | 2 +- drivers/net/wireless/ath/ath9k/main.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/ath9k.h +1 -1
@@ -925,6 +925,7 @@ struct ath_softc {struct ath_gen_timer *p2p_ps_timer;struct ath_vif *p2p_ps_vif;struct ath_chanctx_sched sched; +struct ath_offchannel offchannel;#endif unsigned long driver_data;
@@ -948,7 +949,6 @@ struct ath_softc {struct ath_chanctx *cur_chan;struct ath_chanctx *next_chan;spinlock_t chan_lock; -struct ath_offchannel offchannel;#ifdef CONFIG_MAC80211_LEDS bool led_registered;
drivers/net/wireless/ath/ath9k/main.c +2 -0
@@ -958,6 +958,7 @@ void ath9k_calculate_iter_data(struct ath_softc *sc,list_for_each_entry (avp, &ctx->vifs, list)ath9k_vif_iter (iter_data, avp->vif->addr, avp->vif); +#ifdef CONFIG_ATH9K_CHANNEL_CONTEXT if (ctx == &sc->offchannel.chan) {struct ieee80211_vif *vif;
@@ -970,6 +971,7 @@ void ath9k_calculate_iter_data(struct ath_softc *sc,ath9k_vif_iter (iter_data, vif->addr, vif); iter_data->beacons = false; } +#endif } static void ath9k_set_assoc_state(struct ath_softc *sc,
Signature · 1 line
2.0.4