Commit ffbe7c83 authored by Sujith Manoharan's avatar Sujith Manoharan Committed by John W. Linville

ath9k_htc: Calculate and set the HW opmode

Signed-off-by: default avatarSujith Manoharan <Sujith.Manoharan@atheros.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent da8d9d93
...@@ -166,6 +166,18 @@ static void ath9k_htc_set_bssid_mask(struct ath9k_htc_priv *priv, ...@@ -166,6 +166,18 @@ static void ath9k_htc_set_bssid_mask(struct ath9k_htc_priv *priv,
ath_hw_setbssidmask(common); ath_hw_setbssidmask(common);
} }
static void ath9k_htc_set_opmode(struct ath9k_htc_priv *priv)
{
if (priv->num_ibss_vif)
priv->ah->opmode = NL80211_IFTYPE_ADHOC;
else if (priv->num_ap_vif)
priv->ah->opmode = NL80211_IFTYPE_AP;
else
priv->ah->opmode = NL80211_IFTYPE_STATION;
ath9k_hw_setopmode(priv->ah);
}
void ath9k_htc_reset(struct ath9k_htc_priv *priv) void ath9k_htc_reset(struct ath9k_htc_priv *priv)
{ {
struct ath_hw *ah = priv->ah; struct ath_hw *ah = priv->ah;
...@@ -1252,12 +1264,12 @@ static int ath9k_htc_add_interface(struct ieee80211_hw *hw, ...@@ -1252,12 +1264,12 @@ static int ath9k_htc_add_interface(struct ieee80211_hw *hw,
ath9k_htc_set_bssid_mask(priv, vif); ath9k_htc_set_bssid_mask(priv, vif);
priv->ah->opmode = vif->type;
priv->vif_slot |= (1 << avp->index); priv->vif_slot |= (1 << avp->index);
priv->nvifs++; priv->nvifs++;
priv->vif = vif; priv->vif = vif;
INC_VIF(priv, vif->type); INC_VIF(priv, vif->type);
ath9k_htc_set_opmode(priv);
ath_dbg(common, ATH_DBG_CONFIG, ath_dbg(common, ATH_DBG_CONFIG,
"Attach a VIF of type: %d at idx: %d\n", vif->type, avp->index); "Attach a VIF of type: %d at idx: %d\n", vif->type, avp->index);
...@@ -1293,6 +1305,7 @@ static void ath9k_htc_remove_interface(struct ieee80211_hw *hw, ...@@ -1293,6 +1305,7 @@ static void ath9k_htc_remove_interface(struct ieee80211_hw *hw,
priv->vif = NULL; priv->vif = NULL;
DEC_VIF(priv, vif->type); DEC_VIF(priv, vif->type);
ath9k_htc_set_opmode(priv);
ath_dbg(common, ATH_DBG_CONFIG, "Detach Interface at idx: %d\n", avp->index); ath_dbg(common, ATH_DBG_CONFIG, "Detach Interface at idx: %d\n", avp->index);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment