ath9k_htc: Add support for mesh interfaces
PATCH 1/3 ath9k_htc: Add support for mesh interfaces
From: Javier Cardona <[email protected]>
More specifically, enable AP-style beaconing on mesh ifaces and change the hw capabilities to reflect mesh support.
Coexistence with a virtual STA interface was tested as working fine.
--- drivers/net/wireless/ath/ath9k/htc.h | 7 ++++++ drivers/net/wireless/ath/ath9k/htc_drv_beacon.c | 5 +++- drivers/net/wireless/ath/ath9k/htc_drv_init.c | 6 +++-- drivers/net/wireless/ath/ath9k/htc_drv_main.c | 29 ++++++++++++++++------- drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 2 +- 5 files changed, 37 insertions(+), 12 deletions(-)
drivers/net/wireless/ath/ath9k/htc.h +7 -0
@@ -208,6 +208,9 @@ struct ath9k_htc_target_rx_stats {case NL80211_IFTYPE_AP : \ _priv->num_ap_vif++; \break ; \ +case NL80211_IFTYPE_MESH_POINT : \ + _priv->num_mbss_vif++; \ +break ; \default : \break ; \ } \
@@ -224,6 +227,9 @@ struct ath9k_htc_target_rx_stats {case NL80211_IFTYPE_AP : \ _priv->num_ap_vif--; \break ; \ +case NL80211_IFTYPE_MESH_POINT : \ + _priv->num_mbss_vif--; \ +break ; \default : \break ; \ } \
@@ -450,6 +456,7 @@ struct ath9k_htc_priv {u8 sta_slot;u8 vif_sta_pos[ATH9K_HTC_MAX_VIF ];u8 num_ibss_vif; +u8 num_mbss_vif;u8 num_sta_vif;u8 num_sta_assoc_vif;u8 num_ap_vif;
drivers/net/wireless/ath/ath9k/htc_drv_beacon.c +4 -1
@@ -28,7 +28,8 @@ void ath9k_htc_beaconq_config(struct ath9k_htc_priv *priv)ath9k_hw_get_txq_props (ah, priv->beaconq, &qi); -if (priv->ah->opmode ==NL80211_IFTYPE_AP ) { +if (priv->ah->opmode ==NL80211_IFTYPE_AP || + priv->ah->opmode ==NL80211_IFTYPE_MESH_POINT ) { qi.tqi_aifs =1 ; qi.tqi_cwmin =0 ; qi.tqi_cwmax =0 ;
@@ -628,6 +629,7 @@ void ath9k_htc_beacon_config(struct ath9k_htc_priv *priv,case NL80211_IFTYPE_ADHOC :ath9k_htc_beacon_config_adhoc (priv, cur_conf);break ; +case NL80211_IFTYPE_MESH_POINT :case NL80211_IFTYPE_AP :ath9k_htc_beacon_config_ap (priv, cur_conf);break ;
@@ -649,6 +651,7 @@ void ath9k_htc_beacon_reconfig(struct ath9k_htc_priv *priv)case NL80211_IFTYPE_ADHOC :ath9k_htc_beacon_config_adhoc (priv, cur_conf);break ; +case NL80211_IFTYPE_MESH_POINT :case NL80211_IFTYPE_AP :ath9k_htc_beacon_config_ap (priv, cur_conf);break ;
drivers/net/wireless/ath/ath9k/htc_drv_init.c +4 -2
@@ -698,7 +698,8 @@ static const struct ieee80211_iface_limit if_limits[] = { { .max = 2, .types = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_P2P_CLIENT) }, { .max = 2, .types = BIT(NL80211_IFTYPE_AP) | - BIT(NL80211_IFTYPE_P2P_GO) }, +BIT (NL80211_IFTYPE_P2P_GO ) | + BIT(NL80211_IFTYPE_MESH_POINT) }, }; static const struct ieee80211_iface_combination if_comb = {
@@ -728,7 +729,8 @@ static void ath9k_set_hw_capab(struct ath9k_htc_priv *priv,BIT (NL80211_IFTYPE_ADHOC ) |BIT (NL80211_IFTYPE_AP ) |BIT (NL80211_IFTYPE_P2P_GO ) | -BIT (NL80211_IFTYPE_P2P_CLIENT ); +BIT (NL80211_IFTYPE_P2P_CLIENT ) | +BIT (NL80211_IFTYPE_MESH_POINT ); hw->wiphy->iface_combinations = &if_comb; hw->wiphy->n_iface_combinations =1 ;
drivers/net/wireless/ath/ath9k/htc_drv_main.c +21 -8
@@ -113,7 +113,9 @@ static void ath9k_htc_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif)struct ath9k_htc_priv *priv = data;struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; -if ((vif->type ==NL80211_IFTYPE_AP ) && bss_conf->enable_beacon) +if ((vif->type ==NL80211_IFTYPE_AP || + vif->type ==NL80211_IFTYPE_MESH_POINT ) && + bss_conf->enable_beacon) priv->reconfig_beacon = true;if (bss_conf->assoc) {
@@ -180,6 +182,8 @@ static void ath9k_htc_set_opmode(struct ath9k_htc_priv *priv) priv->ah->opmode =NL80211_IFTYPE_ADHOC ; else if (priv->num_ap_vif) priv->ah->opmode = NL80211_IFTYPE_AP; + else if (priv->num_mbss_vif) + priv->ah->opmode = NL80211_IFTYPE_MESH_POINT; else priv->ah->opmode = NL80211_IFTYPE_STATION;
@@ -1052,6 +1056,9 @@ static int ath9k_htc_add_interface(struct ieee80211_hw *hw,case NL80211_IFTYPE_AP : hvif.opmode =HTC_M_HOSTAP ;break ; +case NL80211_IFTYPE_MESH_POINT : + hvif.opmode =HTC_M_WDS ;/* close enough */ +break ;default :ath_err (common,"Interface type %d not yet supported\n" , vif->type);
@@ -1084,6 +1091,7 @@ static int ath9k_htc_add_interface(struct ieee80211_hw *hw,INC_VIF (priv, vif->type);if ((vif->type ==NL80211_IFTYPE_AP ) || + (vif->type ==NL80211_IFTYPE_MESH_POINT ) || (vif->type ==NL80211_IFTYPE_ADHOC ))ath9k_htc_assign_bslot (priv, vif);
@@ -1134,6 +1142,7 @@ static void ath9k_htc_remove_interface(struct ieee80211_hw *hw,DEC_VIF (priv, vif->type);if ((vif->type ==NL80211_IFTYPE_AP ) || + vif->type ==NL80211_IFTYPE_MESH_POINT || (vif->type ==NL80211_IFTYPE_ADHOC ))ath9k_htc_remove_bslot (priv, vif);
@@ -1525,9 +1534,10 @@ static void ath9k_htc_bss_info_changed(struct ieee80211_hw *hw,if ((changed &BSS_CHANGED_BEACON_ENABLED ) && !bss_conf->enable_beacon) {/* * Disable SWBA interrupt only if there are no -* AP/IBSS interfaces. +* concurrent AP/mesh or IBSS interfaces. */ -if ((priv->num_ap_vif <=1 ) || priv->num_ibss_vif) { +if ((priv->num_ap_vif + priv->num_mbss_vif <=1 ) || + priv->num_ibss_vif) {ath_dbg (common,CONFIG ,"Beacon disabled for BSS: %pM\n" , bss_conf->bssid);
@@ -1538,12 +1548,15 @@ static void ath9k_htc_bss_info_changed(struct ieee80211_hw *hw,if (changed &BSS_CHANGED_BEACON_INT ) {/* -* Reset the HW TSF for the first AP interface. +* Reset the HW TSF for the first AP or mesh interface. */ -if ((priv->ah->opmode ==NL80211_IFTYPE_AP ) && - (priv->nvifs ==1 ) && - (priv->num_ap_vif ==1 ) && - (vif->type ==NL80211_IFTYPE_AP )) { +if (priv->nvifs ==1 && + ((priv->ah->opmode ==NL80211_IFTYPE_AP && + vif->type ==NL80211_IFTYPE_AP && + priv->num_ap_vif ==1 ) || + (priv->ah->opmode ==NL80211_IFTYPE_MESH_POINT && + vif->type ==NL80211_IFTYPE_MESH_POINT && + priv->num_mbss_vif ==1 ))) {set_bit (OP_TSF_RESET , &priv->op_flags); } ath_dbg(common, CONFIG,
drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +1 -1
@@ -887,7 +887,7 @@ u32 ath9k_htc_calcrxfilter(struct ath9k_htc_priv *priv)if (priv->rxfilter &FIF_PSPOLL ) rfilt |=ATH9K_RX_FILTER_PSPOLL ; -if (priv->nvifs >1 ) +if (priv->nvifs >1 || priv->rxfilter &FIF_OTHER_BSS ) rfilt |=ATH9K_RX_FILTER_MCAST_BCAST_ALL ;return rfilt;
Signature · 1 line
1.7.10.4
PATCH 2/3 ath9k_htc: Claim support for mgmt frame protection
From: Javier Cardona <[email protected]>
Advertise support for management frame protection in hardware.
--- drivers/net/wireless/ath/ath9k/htc_drv_init.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/ath/ath9k/htc_drv_init.c +1 -0
@@ -722,6 +722,7 @@ static void ath9k_set_hw_capab(struct ath9k_htc_priv *priv,IEEE80211_HW_SUPPORTS_PS |IEEE80211_HW_PS_NULLFUNC_STACK |IEEE80211_HW_REPORTS_TX_ACK_STATUS | +IEEE80211_HW_MFP_CAPABLE |IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING ; hw->wiphy->interface_modes =
Signature · 1 line
1.7.10.4
PATCH 3/3 ath9k: use ap style beaconing for mesh
In reply to Thomas PedersenChun-Yeow and Javier Lopez contributed these changes to make mesh mode use the more similar AP beaconing mode and queue parameters. Should improve PS performance, interface concurrency (AP modes can coexist), and beacon interval stability.
AR9271 (ath9k_htc) mesh interfaces also need to be in AP operating mode.
--- drivers/net/wireless/ath/ath9k/beacon.c | 8 +++++--- drivers/net/wireless/ath/ath9k/hw.c | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath9k/beacon.c +5 -3
@@ -39,7 +39,8 @@ static void ath9k_beaconq_config(struct ath_softc *sc)ath9k_hw_get_txq_props (ah, sc->beacon.beaconq, &qi); -if (sc->sc_ah->opmode ==NL80211_IFTYPE_AP ) { +if (sc->sc_ah->opmode ==NL80211_IFTYPE_AP || + sc->sc_ah->opmode ==NL80211_IFTYPE_MESH_POINT ) {/* Always burst out beacon and CAB traffic. */ qi.tqi_aifs =1 ; qi.tqi_cwmin =0 ;
@@ -273,7 +274,8 @@ static int ath9k_beacon_choose_slot(struct ath_softc *sc)u64 tsf;int slot; -if (sc->sc_ah->opmode !=NL80211_IFTYPE_AP ) { +if (sc->sc_ah->opmode !=NL80211_IFTYPE_AP && + sc->sc_ah->opmode !=NL80211_IFTYPE_MESH_POINT ) {ath_dbg (common,BEACON ,"slot 0, tsf: %llu\n" ,ath9k_hw_gettsf64 (sc->sc_ah));return 0 ;
@@ -765,10 +767,10 @@ void ath9k_set_beacon(struct ath_softc *sc)switch (sc->sc_ah->opmode) {case NL80211_IFTYPE_AP : +case NL80211_IFTYPE_MESH_POINT :ath9k_beacon_config_ap (sc, cur_conf);break ;case NL80211_IFTYPE_ADHOC : -case NL80211_IFTYPE_MESH_POINT :ath9k_beacon_config_adhoc (sc, cur_conf);break ;case NL80211_IFTYPE_STATION :
drivers/net/wireless/ath/ath9k/hw.c +2 -2
@@ -1245,10 +1245,10 @@ static void ath9k_hw_set_operating_mode(struct ath_hw *ah, int opmode)switch (opmode) {case NL80211_IFTYPE_ADHOC : -case NL80211_IFTYPE_MESH_POINT : set |=AR_STA_ID1_ADHOC ;REG_SET_BIT (ah,AR_CFG ,AR_CFG_AP_ADHOC_INDICATION );break ; +case NL80211_IFTYPE_MESH_POINT :case NL80211_IFTYPE_AP : set |=AR_STA_ID1_STA_AP ;/* fall through */
@@ -2246,12 +2246,12 @@ void ath9k_hw_beaconinit(struct ath_hw *ah, u32 next_beacon, u32 beacon_period)switch (ah->opmode) {case NL80211_IFTYPE_ADHOC : -case NL80211_IFTYPE_MESH_POINT :REG_SET_BIT (ah,AR_TXCFG ,AR_TXCFG_ADHOC_BEACON_ATIM_TX_POLICY );REG_WRITE (ah,AR_NEXT_NDP_TIMER , next_beacon +TU_TO_USEC (ah->atim_window ? ah->atim_window :1 )); flags |=AR_NDP_TIMER_EN ; +case NL80211_IFTYPE_MESH_POINT :case NL80211_IFTYPE_AP :REG_WRITE (ah,AR_NEXT_TBTT_TIMER , next_beacon); REG_WRITE(ah, AR_NEXT_DMA_BEACON_ALERT, next_beacon -
Signature · 1 line
1.7.10.4