From: Mohammed Shafi Shajakhan <[email protected]>
*Remove all the checks that will be handled by cfg80211
based on the interface combination advertised. For instance,
driver supports at the maximum 8 beaconing interface, while
we advertise maximum 8 beaconing interface in the interface
combination support.
*cfg80211 will take care of not allowing
us to add an interface that is not supported by the
driver, further if the change_interface changes the
old interface to a beaconing interface while we had
reached the max limit of 8 beaconing interface, again
cfg80211 takes care of this stuff!
So remove all these checks.
*Beautify placing PS wrappers in the appropriate
position.
Signed-off-by: Mohammed Shafi Shajakhan <[email protected]>
---
drivers/net/wireless/ath/ath9k/main.c | 57 ++++++---------------------------
1 files changed, 10 insertions(+), 47 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 8a2b04d..d308b44 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -986,47 +986,21 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
struct ath_softc *sc = hw->priv;
struct ath_hw *ah = sc->sc_ah;
struct ath_common *common = ath9k_hw_common(ah);
- int ret = 0;
- ath9k_ps_wakeup(sc);
mutex_lock(&sc->mutex);
- switch (vif->type) {
- case NL80211_IFTYPE_STATION:
- case NL80211_IFTYPE_WDS:
- case NL80211_IFTYPE_ADHOC:
- case NL80211_IFTYPE_AP:
- case NL80211_IFTYPE_MESH_POINT:
- break;
- default:
- ath_err(common, "Interface type %d not yet supported\n",
- vif->type);
- ret = -EOPNOTSUPP;
- goto out;
- }
-
- if (ath9k_uses_beacons(vif->type)) {
- if (sc->nbcnvifs >= ATH_BCBUF) {
- ath_err(common, "Not enough beacon buffers when adding"
- " new interface of type: %i\n",
- vif->type);
- ret = -ENOBUFS;
- goto out;
- }
- }
-
ath_dbg(common, CONFIG, "Attach a VIF of type: %d\n", vif->type);
-
sc->nvifs++;
+ ath9k_ps_wakeup(sc);
ath9k_calculate_summary_state(hw, vif);
+ ath9k_ps_restore(sc);
+
if (ath9k_uses_beacons(vif->type))
ath9k_beacon_assign_slot(sc, vif);
-out:
mutex_unlock(&sc->mutex);
- ath9k_ps_restore(sc);
- return ret;
+ return 0;
}
static int ath9k_change_interface(struct ieee80211_hw *hw,
@@ -1036,21 +1010,9 @@ static int ath9k_change_interface(struct ieee80211_hw *hw,
{
struct ath_softc *sc = hw->priv;
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
- int ret = 0;
ath_dbg(common, CONFIG, "Change Interface\n");
-
mutex_lock(&sc->mutex);
- ath9k_ps_wakeup(sc);
-
- if (ath9k_uses_beacons(new_type) &&
- !ath9k_uses_beacons(vif->type)) {
- if (sc->nbcnvifs >= ATH_BCBUF) {
- ath_err(common, "No beacon slot available\n");
- ret = -ENOBUFS;
- goto out;
- }
- }
if (ath9k_uses_beacons(vif->type))
ath9k_beacon_remove_slot(sc, vif);
@@ -1058,14 +1020,15 @@ static int ath9k_change_interface(struct ieee80211_hw *hw,
vif->type = new_type;
vif->p2p = p2p;
+ ath9k_ps_wakeup(sc);
ath9k_calculate_summary_state(hw, vif);
+ ath9k_ps_restore(sc);
+
if (ath9k_uses_beacons(vif->type))
ath9k_beacon_assign_slot(sc, vif);
-out:
- ath9k_ps_restore(sc);
mutex_unlock(&sc->mutex);
- return ret;
+ return 0;
}
static void ath9k_remove_interface(struct ieee80211_hw *hw,
@@ -1076,7 +1039,6 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
ath_dbg(common, CONFIG, "Detach Interface\n");
- ath9k_ps_wakeup(sc);
mutex_lock(&sc->mutex);
sc->nvifs--;
@@ -1084,10 +1046,11 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
if (ath9k_uses_beacons(vif->type))
ath9k_beacon_remove_slot(sc, vif);
+ ath9k_ps_wakeup(sc);
ath9k_calculate_summary_state(hw, NULL);
+ ath9k_ps_restore(sc);
mutex_unlock(&sc->mutex);
- ath9k_ps_restore(sc);
}
static void ath9k_enable_ps(struct ath_softc *sc)
--
1.7.0.4
Hi John,
On Thu, Aug 23, 2012 at 6:53 PM, Mohammed Shafi Shajakhan
<[email protected]> wrote:
> From: Mohammed Shafi Shajakhan <[email protected]>
>
> *Remove all the checks that will be handled by cfg80211
> based on the interface combination advertised. For instance,
> driver supports at the maximum 8 beaconing interface, while
> we advertise maximum 8 beaconing interface in the interface
> combination support.
>
> *cfg80211 will take care of not allowing
> us to add an interface that is not supported by the
> driver, further if the change_interface changes the
> old interface to a beaconing interface while we had
> reached the max limit of 8 beaconing interface, again
> cfg80211 takes care of this stuff!
> So remove all these checks.
>
> *Beautify placing PS wrappers in the appropriate
> position.
>
> Signed-off-by: Mohammed Shafi Shajakhan <[email protected]>
> ---
> drivers/net/wireless/ath/ath9k/main.c | 57 ++++++---------------------------
> 1 files changed, 10 insertions(+), 47 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
> index 8a2b04d..d308b44 100644
> --- a/drivers/net/wireless/ath/ath9k/main.c
> +++ b/drivers/net/wireless/ath/ath9k/main.c
> @@ -986,47 +986,21 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
> struct ath_softc *sc = hw->priv;
> struct ath_hw *ah = sc->sc_ah;
> struct ath_common *common = ath9k_hw_common(ah);
> - int ret = 0;
>
> - ath9k_ps_wakeup(sc);
> mutex_lock(&sc->mutex);
>
> - switch (vif->type) {
> - case NL80211_IFTYPE_STATION:
> - case NL80211_IFTYPE_WDS:
> - case NL80211_IFTYPE_ADHOC:
> - case NL80211_IFTYPE_AP:
> - case NL80211_IFTYPE_MESH_POINT:
> - break;
> - default:
> - ath_err(common, "Interface type %d not yet supported\n",
> - vif->type);
> - ret = -EOPNOTSUPP;
> - goto out;
> - }
> -
> - if (ath9k_uses_beacons(vif->type)) {
> - if (sc->nbcnvifs >= ATH_BCBUF) {
> - ath_err(common, "Not enough beacon buffers when adding"
> - " new interface of type: %i\n",
> - vif->type);
> - ret = -ENOBUFS;
> - goto out;
> - }
> - }
> -
> ath_dbg(common, CONFIG, "Attach a VIF of type: %d\n", vif->type);
> -
> sc->nvifs++;
>
> + ath9k_ps_wakeup(sc);
> ath9k_calculate_summary_state(hw, vif);
> + ath9k_ps_restore(sc);
> +
> if (ath9k_uses_beacons(vif->type))
> ath9k_beacon_assign_slot(sc, vif);
>
> -out:
> mutex_unlock(&sc->mutex);
> - ath9k_ps_restore(sc);
> - return ret;
> + return 0;
> }
>
> static int ath9k_change_interface(struct ieee80211_hw *hw,
> @@ -1036,21 +1010,9 @@ static int ath9k_change_interface(struct ieee80211_hw *hw,
> {
> struct ath_softc *sc = hw->priv;
> struct ath_common *common = ath9k_hw_common(sc->sc_ah);
> - int ret = 0;
>
> ath_dbg(common, CONFIG, "Change Interface\n");
> -
> mutex_lock(&sc->mutex);
> - ath9k_ps_wakeup(sc);
> -
> - if (ath9k_uses_beacons(new_type) &&
> - !ath9k_uses_beacons(vif->type)) {
> - if (sc->nbcnvifs >= ATH_BCBUF) {
> - ath_err(common, "No beacon slot available\n");
> - ret = -ENOBUFS;
> - goto out;
> - }
> - }
>
> if (ath9k_uses_beacons(vif->type))
> ath9k_beacon_remove_slot(sc, vif);
> @@ -1058,14 +1020,15 @@ static int ath9k_change_interface(struct ieee80211_hw *hw,
> vif->type = new_type;
> vif->p2p = p2p;
>
> + ath9k_ps_wakeup(sc);
> ath9k_calculate_summary_state(hw, vif);
> + ath9k_ps_restore(sc);
> +
> if (ath9k_uses_beacons(vif->type))
> ath9k_beacon_assign_slot(sc, vif);
>
> -out:
> - ath9k_ps_restore(sc);
> mutex_unlock(&sc->mutex);
> - return ret;
> + return 0;
> }
>
> static void ath9k_remove_interface(struct ieee80211_hw *hw,
> @@ -1076,7 +1039,6 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
>
> ath_dbg(common, CONFIG, "Detach Interface\n");
>
> - ath9k_ps_wakeup(sc);
> mutex_lock(&sc->mutex);
>
> sc->nvifs--;
> @@ -1084,10 +1046,11 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
> if (ath9k_uses_beacons(vif->type))
> ath9k_beacon_remove_slot(sc, vif);
>
> + ath9k_ps_wakeup(sc);
> ath9k_calculate_summary_state(hw, NULL);
> + ath9k_ps_restore(sc);
>
> mutex_unlock(&sc->mutex);
> - ath9k_ps_restore(sc);
> }
>
> static void ath9k_enable_ps(struct ath_softc *sc)
please wait, will send a v2 version for patches 1 to 6 (including
Antonio's ath9k_htc change
for coexisting IBSS interface change( need to verify that there are no issues)).
> --
> 1.7.0.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
thanks,
shafi
From: Mohammed Shafi Shajakhan <[email protected]>
Once the driver advertizes interface combination logic
based on its firmware/hardware limitation, cfg80211
takes care of all the necessary logic such as maximum
beaconing vifs, standlone interface etc.
Signed-off-by: Mohammed Shafi Shajakhan <[email protected]>
---
drivers/net/wireless/ath/ath9k/htc_drv_main.c | 20 --------------------
1 files changed, 0 insertions(+), 20 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index c32f6e3..51c69f2 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1040,26 +1040,6 @@ static int ath9k_htc_add_interface(struct ieee80211_hw *hw,
mutex_lock(&priv->mutex);
- if (priv->nvifs >= ATH9K_HTC_MAX_VIF) {
- mutex_unlock(&priv->mutex);
- return -ENOBUFS;
- }
-
- if (priv->num_ibss_vif ||
- (priv->nvifs && vif->type == NL80211_IFTYPE_ADHOC)) {
- ath_err(common, "IBSS coexistence with other modes is not allowed\n");
- mutex_unlock(&priv->mutex);
- return -ENOBUFS;
- }
-
- if (((vif->type == NL80211_IFTYPE_AP) ||
- (vif->type == NL80211_IFTYPE_ADHOC)) &&
- ((priv->num_ap_vif + priv->num_ibss_vif) >= ATH9K_HTC_MAX_BCN_VIF)) {
- ath_err(common, "Max. number of beaconing interfaces reached\n");
- mutex_unlock(&priv->mutex);
- return -ENOBUFS;
- }
-
ath9k_htc_ps_wakeup(priv);
memset(&hvif, 0, sizeof(struct ath9k_htc_target_vif));
memcpy(&hvif.myaddr, vif->addr, ETH_ALEN);
--
1.7.0.4
From: Mohammed Shafi Shajakhan <[email protected]>
Signed-off-by: Mohammed Shafi Shajakhan <[email protected]>
---
drivers/net/wireless/ath/ath9k/ath9k.h | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 7373e4b..216b8b7 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -423,7 +423,6 @@ void ath9k_beacon_assign_slot(struct ath_softc *sc, struct ieee80211_vif *vif);
void ath9k_beacon_remove_slot(struct ath_softc *sc, struct ieee80211_vif *vif);
void ath9k_set_tsfadjust(struct ath_softc *sc, struct ieee80211_vif *vif);
void ath9k_set_beacon(struct ath_softc *sc);
-void ath9k_set_beaconing_status(struct ath_softc *sc, bool status);
/*******************/
/* Link Monitoring */
--
1.7.0.4
From: Mohammed Shafi Shajakhan <[email protected]>
Signed-off-by: Mohammed Shafi Shajakhan <[email protected]>
---
drivers/net/wireless/ath/ath9k/htc_drv_main.c | 14 +++++---------
1 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index 51c69f2..73cbee5 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -489,24 +489,20 @@ static int ath9k_htc_add_station(struct ath9k_htc_priv *priv,
ista = (struct ath9k_htc_sta *) sta->drv_priv;
memcpy(&tsta.macaddr, sta->addr, ETH_ALEN);
memcpy(&tsta.bssid, common->curbssid, ETH_ALEN);
- tsta.is_vif_sta = 0;
ista->index = sta_idx;
+ tsta.is_vif_sta = 0;
+ maxampdu = 1 << (IEEE80211_HT_MAX_AMPDU_FACTOR +
+ sta->ht_cap.ampdu_factor);
+ tsta.maxampdu = cpu_to_be16(maxampdu);
} else {
memcpy(&tsta.macaddr, vif->addr, ETH_ALEN);
tsta.is_vif_sta = 1;
+ tsta.maxampdu = cpu_to_be16(0xffff);
}
tsta.sta_index = sta_idx;
tsta.vif_index = avp->index;
- if (!sta) {
- tsta.maxampdu = cpu_to_be16(0xffff);
- } else {
- maxampdu = 1 << (IEEE80211_HT_MAX_AMPDU_FACTOR +
- sta->ht_cap.ampdu_factor);
- tsta.maxampdu = cpu_to_be16(maxampdu);
- }
-
WMI_CMD_BUF(WMI_NODE_CREATE_CMDID, &tsta);
if (ret) {
if (sta)
--
1.7.0.4
From: Mohammed Shafi Shajakhan <[email protected]>
This will allow us to create virtual interface the driver supports.
Also this ensures multivif support and limitation advertised
by the driver is taken care in cfg80211 itself.
Signed-off-by: Mohammed Shafi Shajakhan <[email protected]>
---
drivers/net/wireless/ath/ath9k/htc_drv_init.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
index a035a38..b6a824e 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
@@ -689,6 +689,20 @@ err_hw:
return ret;
}
+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) },
+};
+
+static const struct ieee80211_iface_combination if_comb = {
+ .limits = if_limits,
+ .n_limits = ARRAY_SIZE(if_limits),
+ .max_interfaces = 2,
+ .num_different_channels = 1,
+};
+
static void ath9k_set_hw_capab(struct ath9k_htc_priv *priv,
struct ieee80211_hw *hw)
{
@@ -711,6 +725,9 @@ static void ath9k_set_hw_capab(struct ath9k_htc_priv *priv,
BIT(NL80211_IFTYPE_P2P_GO) |
BIT(NL80211_IFTYPE_P2P_CLIENT);
+ hw->wiphy->iface_combinations = &if_comb;
+ hw->wiphy->n_iface_combinations = 1;
+
hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN |
--
1.7.0.4
From: Mohammed Shafi Shajakhan <[email protected]>
Additionally it has a neat debug message informing us
that we are stopping the ANI algorithm.
Signed-off-by: Mohammed Shafi Shajakhan <[email protected]>
---
drivers/net/wireless/ath/ath9k/main.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index d308b44..3923ad9 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -2223,7 +2223,7 @@ static int ath9k_suspend(struct ieee80211_hw *hw,
mutex_lock(&sc->mutex);
ath_cancel_work(sc);
- del_timer_sync(&common->ani.timer);
+ ath_stop_ani(sc);
del_timer_sync(&sc->rx_poll_timer);
if (test_bit(SC_OP_INVALID, &sc->sc_flags)) {
--
1.7.0.4