ath9k: support only one P2P interface
PATCH 1/2 ath9k: support only one P2P interface
Preparation for adding P2P powersave and multi-channel support.
--- drivers/net/wireless/ath/ath9k/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/init.c +2 -2
@@ -862,13 +862,13 @@ void ath9k_reload_chainmask_settings(struct ath_softc *sc)static const struct ieee80211_iface_limit if_limits[] = { { .max =2048 , .types =BIT (NL80211_IFTYPE_STATION ) | -BIT (NL80211_IFTYPE_P2P_CLIENT ) |BIT (NL80211_IFTYPE_WDS ) }, { .max =8 , .types = #ifdef CONFIG_MAC80211_MESHBIT (NL80211_IFTYPE_MESH_POINT ) | #endif -BIT (NL80211_IFTYPE_AP ) | +BIT (NL80211_IFTYPE_AP ) }, + { .max =1 , .types =BIT (NL80211_IFTYPE_P2P_CLIENT ) |BIT (NL80211_IFTYPE_P2P_GO ) }, };
Signature · 1 line
1.8.3.4 (Apple Git-47)
PATCH 2/2 ath9k: implement p2p client powersave support
Use generic TSF timers to trigger powersave state changes based information from the P2P NoA attribute.
Opportunistic Powersave is not handled, because the driver does not support powersave at the moment.
--- drivers/net/wireless/ath/ath9k/ath9k.h | 12 ++++ drivers/net/wireless/ath/ath9k/init.c | 6 ++ drivers/net/wireless/ath/ath9k/main.c | 104 +++++++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath9k/recv.c | 3 + 4 files changed, 125 insertions(+)
drivers/net/wireless/ath/ath9k/ath9k.h +12 -0
@@ -115,6 +115,9 @@ int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd,#define ATH_TXFIFO_DEPTH 8#define ATH_TX_ERROR 0x01 +/* Stop tx traffic 1ms before the GO goes away */ +#define ATH_P2P_PS_STOP_TIME 1000 +#define IEEE80211_SEQ_SEQ_SHIFT 4#define IEEE80211_SEQ_MAX 4096#define IEEE80211_WEP_IVLEN 3
@@ -363,11 +366,15 @@ void ath9k_release_buffered_frames(struct ieee80211_hw *hw,/********/ struct ath_vif { +struct ieee80211_vif *vif;struct ath_node mcast_node;int av_bslot;bool primary_sta_vif;__le64 tsf_adjust;/* TSF adjustment for staggered beacons */ struct ath_buf *av_bcbuf; + +/* P2P Client */ +struct ieee80211_noa_data noa; };struct ath9k_vif_iter_data {
@@ -472,6 +479,8 @@ int ath_update_survey_stats(struct ath_softc *sc);void ath_update_survey_nf (struct ath_softc *sc,int channel);void ath9k_queue_reset (struct ath_softc *sc,enum ath_reset_type type);void ath_ps_full_sleep (unsigned long data); +void ath9k_p2p_ps_timer (void *priv); +void ath9k_update_p2p_ps (struct ath_softc *sc,struct ieee80211_vif *vif);/**********/ /* BTCOEX */
@@ -731,6 +740,9 @@ struct ath_softc {struct completion paprd_complete;wait_queue_head_t tx_wait; +struct ath_gen_timer *p2p_ps_timer; +struct ath_vif *p2p_ps_vif; +unsigned long sc_flags;unsigned long driver_data;
drivers/net/wireless/ath/ath9k/init.c +6 -0
@@ -797,6 +797,9 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc,if (ret) goto err_btcoex; + sc->p2p_ps_timer =ath_gen_timer_alloc (sc->sc_ah, ath9k_p2p_ps_timer, +NULL , sc,AR_FIRST_NDP_TIMER ); +ath9k_cmn_init_crypto (sc->sc_ah);ath9k_init_misc (sc);ath_fill_led_pin (sc);
@@ -1067,6 +1070,9 @@ static void ath9k_deinit_softc(struct ath_softc *sc) {int i =0 ; +if (sc->p2p_ps_timer) +ath_gen_timer_free (sc->sc_ah, sc->p2p_ps_timer); +ath9k_deinit_btcoex (sc);for (i =0 ; i <ATH9K_NUM_TX_QUEUES ; i++)
drivers/net/wireless/ath/ath9k/main.c +104 -0
140 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/recv.c +3 -0
@@ -539,6 +539,9 @@ static void ath_rx_ps_beacon(struct ath_softc *sc, struct sk_buff *skb)ath_dbg (common,PS ,"Reconfigure beacon timers based on synchronized timestamp\n" );ath9k_set_beacon (sc); + +if (sc->p2p_ps_vif) +ath9k_update_p2p_ps (sc, sc->p2p_ps_vif->vif); }if (ath_beacon_dtim_pending_cab (skb)) {
Signature · 1 line
1.8.3.4 (Apple Git-47)
Re: [PATCH 2/2] ath9k: implement p2p client powersave support
drivers/net/wireless/ath/ath9k/init.c static void ath9k_deinit_softc(struct ath_softc *sc) · line 1075
Quoted 13 lines · Felix Fietkau
drivers/net/wireless/ath/ath9k/init.c +6
-0+ sc->p2p_ps_timer =ath_gen_timer_alloc (sc->sc_ah, ath9k_p2p_ps_timer, +NULL , sc,AR_FIRST_NDP_TIMER ); +ath9k_cmn_init_crypto (sc->sc_ah);ath9k_init_misc (sc);ath_fill_led_pin (sc);@@ -1067,6 +1070,9 @@ static void ath9k_deinit_softc(struct ath_softc *sc) {int i =0 ; +if (sc->p2p_ps_timer) +ath_gen_timer_free (sc->sc_ah, sc->p2p_ps_timer); +
Why do this in the global init/deinit routines ? Wouldn't the add/remove interface callbacks be a better place for this (based on vif->p2p), since this timer is needed only for p2p interfaces ?
drivers/net/wireless/ath/ath9k/main.c static void ath9k_bss_assoc_iter(void *data, u8 *mac, struct ieee80211_vif *vif) · line 1730
Quoted 2 lines
drivers/net/wireless/ath/ath9k/main.c +2
-0+if (sc->ps_flags &PS_BEACON_SYNC ) +return ;
I think sc_pm_lock is required to use sc->ps_flags.
Sujith
Re: [PATCH 2/2] ath9k: implement p2p client powersave support
Quoted 11 lines · Sujith Manoharan
Quoted 10 lines · Felix Fietkau
drivers/net/wireless/ath/ath9k/init.c +3
-0+ sc->p2p_ps_timer =ath_gen_timer_alloc (sc->sc_ah, ath9k_p2p_ps_timer, +NULL , sc,AR_FIRST_NDP_TIMER ); +ath9k_cmn_init_crypto (sc->sc_ah);ath9k_init_misc (sc);ath_fill_led_pin (sc);@@ -1067,6 +1070,9 @@ static void ath9k_deinit_softc(struct ath_softc *sc) {int i =0 ;
Quoted 7 lines
drivers/net/wireless/ath/ath9k/init.c static void ath9k_deinit_softc(struct ath_softc *sc) · line 1075
Quoted 3 lines
drivers/net/wireless/ath/ath9k/init.c +3
-0+if (sc->p2p_ps_timer) +ath_gen_timer_free (sc->sc_ah, sc->p2p_ps_timer); +Why do this in the global init/deinit routines ? Wouldn't the add/remove interface callbacks be a better place for this (based on
vif->p2p), since this timer is needed only for p2p interfaces ?
It only allocates a very small struct. Doing this in the interface add/remove callback means I'd have to handle interface change as well. I figured keeping it simple is better than micro-optimizing a single small memory allocation.
Quoted 4 lines
drivers/net/wireless/ath/ath9k/main.c static void ath9k_bss_assoc_iter(void *data, u8 *mac, struct ieee80211_vif *vif) · line 1730
Quoted 2 lines
drivers/net/wireless/ath/ath9k/main.c +2
-0+if (sc->ps_flags &PS_BEACON_SYNC ) +return ;I think
sc_pm_lockis required to usesc->ps_flags.
OK, will send v2 later.
- Felix
Re: [PATCH 2/2] ath9k: implement p2p client powersave support
Quoted 4 lines · Felix Fietkau
It only allocates a very small struct. Doing this in the interface add/remove callback means I'd have to handle interface change as well. I figured keeping it simple is better than micro-optimizing a single small memory allocation.
I think doing this in the interface callbacks would be cleaner since this won't be required for normal ap/sta operations at all.
Sujith
Re: [PATCH 2/2] ath9k: implement p2p client powersave support
Quoted 8 lines · Sujith Manoharan
Quoted 4 lines · Felix Fietkau
It only allocates a very small struct. Doing this in the interface add/remove callback means I'd have to handle interface change as well. I figured keeping it simple is better than micro-optimizing a single small memory allocation.
I think doing this in the interface callbacks would be cleaner since this won't be required for normal ap/sta operations at all.
Actually, I just remembered, that I'm also using this timer in my unfinished multi-channel concurrency patches (for channel switching), so I don't want to move it to the interface callbacks only to move it back again later.
- Felix