All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC 1/2] ath9k:  Fix up hardware mode and beacons with multiple vifs.
@ 2011-01-14 17:27 ` greearb at candelatech.com
  0 siblings, 0 replies; 26+ messages in thread
From: greearb @ 2011-01-14 17:27 UTC (permalink / raw)
  To: linux-wireless; +Cc: ath9k-devel, Ben Greear

From: Ben Greear <greearb@candelatech.com>

When using a mixture of AP and Station interfaces,
the hardware mode was using the type of the
last VIF registered.  Instead, we should keep track
of the number of different types of vifs and set the
mode accordingly.

In addtion, use the vif type instead of hardware opmode
when dealing with beacons.

Attempt to move some of the common setup code into smaller
methods so we can re-use it when changing vif mode as
well as adding/deleting vifs.

This needs review.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
:100644 100644 3108699... a2da259... M	drivers/net/wireless/ath/ath9k/ath9k.h
:100644 100644 385ba03... 8de591e... M	drivers/net/wireless/ath/ath9k/beacon.c
:100644 100644 0452580... 1a65e53... M	drivers/net/wireless/ath/ath9k/main.c
:100644 100644 ea2f67c... 9a2b4a8... M	drivers/net/wireless/ath/ath9k/recv.c
 drivers/net/wireless/ath/ath9k/ath9k.h  |   10 +-
 drivers/net/wireless/ath/ath9k/beacon.c |   14 +-
 drivers/net/wireless/ath/ath9k/main.c   |  263 ++++++++++++++++++++++---------
 drivers/net/wireless/ath/ath9k/recv.c   |   17 ++-
 4 files changed, 214 insertions(+), 90 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 3108699..a2da259 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -607,10 +607,15 @@ struct ath_softc {
 	u32 sc_flags; /* SC_OP_* */
 	u16 ps_flags; /* PS_* */
 	u16 curtxpow;
-	u8 nbcnvifs;
-	u16 nvifs;
 	bool ps_enabled;
 	bool ps_idle;
+	short nbcnvifs;
+	short nvifs;
+	short naps; /* number of APs */
+	short nmeshes;
+	short nstations;
+	short nwds;
+	short nadhocs;
 	unsigned long ps_usecount;
 
 	struct ath_config config;
@@ -694,6 +699,7 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw,
 void ath_radio_enable(struct ath_softc *sc, struct ieee80211_hw *hw);
 void ath_radio_disable(struct ath_softc *sc, struct ieee80211_hw *hw);
 bool ath9k_setpower(struct ath_softc *sc, enum ath9k_power_mode mode);
+bool ath9k_uses_beacons(int type);
 
 #ifdef CONFIG_PCI
 int ath_pci_init(void);
diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c
index 385ba03..8de591e 100644
--- a/drivers/net/wireless/ath/ath9k/beacon.c
+++ b/drivers/net/wireless/ath/ath9k/beacon.c
@@ -244,9 +244,7 @@ int ath_beacon_alloc(struct ath_wiphy *aphy, struct ieee80211_vif *vif)
 						 struct ath_buf, list);
 		list_del(&avp->av_bcbuf->list);
 
-		if (sc->sc_ah->opmode == NL80211_IFTYPE_AP ||
-		    sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC ||
-		    sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT) {
+		if (ath9k_uses_beacons(vif->type)) {
 			int slot;
 			/*
 			 * Assign the vif to a beacon xmit slot. As
@@ -282,7 +280,7 @@ int ath_beacon_alloc(struct ath_wiphy *aphy, struct ieee80211_vif *vif)
 	/* NB: the beacon data buffer must be 32-bit aligned. */
 	skb = ieee80211_beacon_get(sc->hw, vif);
 	if (skb == NULL) {
-		ath_dbg(common, ATH_DBG_BEACON, "cannot get skb\n");
+		ath_err(common, "ieee80211_beacon_get failed\n");
 		return -ENOMEM;
 	}
 
@@ -720,10 +718,10 @@ void ath_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif)
 		iftype = sc->sc_ah->opmode;
 	}
 
-		cur_conf->listen_interval = 1;
-		cur_conf->dtim_count = 1;
-		cur_conf->bmiss_timeout =
-			ATH_DEFAULT_BMISS_LIMIT * cur_conf->beacon_interval;
+	cur_conf->listen_interval = 1;
+	cur_conf->dtim_count = 1;
+	cur_conf->bmiss_timeout =
+		ATH_DEFAULT_BMISS_LIMIT * cur_conf->beacon_interval;
 
 	/*
 	 * It looks like mac80211 may end up using beacon interval of zero in
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 0452580..1a65e53 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1366,71 +1366,107 @@ static void ath9k_stop(struct ieee80211_hw *hw)
 	ath_dbg(common, ATH_DBG_CONFIG, "Driver halt\n");
 }
 
-static int ath9k_add_interface(struct ieee80211_hw *hw,
-			       struct ieee80211_vif *vif)
+static void decrement_vif_type(struct ath_softc *sc, int type)
 {
-	struct ath_wiphy *aphy = hw->priv;
-	struct ath_softc *sc = aphy->sc;
-	struct ath_hw *ah = sc->sc_ah;
-	struct ath_common *common = ath9k_hw_common(ah);
-	struct ath_vif *avp = (void *)vif->drv_priv;
-	enum nl80211_iftype ic_opmode = NL80211_IFTYPE_UNSPECIFIED;
-	int ret = 0;
-
-	mutex_lock(&sc->mutex);
-
-	switch (vif->type) {
+	switch (type) {
+	case NL80211_IFTYPE_AP:
+		sc->naps--;
+		break;
 	case NL80211_IFTYPE_STATION:
-		ic_opmode = NL80211_IFTYPE_STATION;
+		sc->nstations--;
+		break;
+	case NL80211_IFTYPE_ADHOC:
+		sc->nadhocs--;
+		break;
+	case NL80211_IFTYPE_MESH_POINT:
+		sc->nmeshes--;
 		break;
 	case NL80211_IFTYPE_WDS:
-		ic_opmode = NL80211_IFTYPE_WDS;
+		sc->nwds--;
 		break;
-	case NL80211_IFTYPE_ADHOC:
+	}
+}
+
+static void increment_vif_type(struct ath_softc *sc, int type)
+{
+	switch (type) {
 	case NL80211_IFTYPE_AP:
+		sc->naps++;
+		break;
+	case NL80211_IFTYPE_STATION:
+		sc->nstations++;
+		break;
+	case NL80211_IFTYPE_ADHOC:
+		sc->nadhocs++;
+		break;
 	case NL80211_IFTYPE_MESH_POINT:
-		if (sc->nbcnvifs >= ATH_BCBUF) {
-			ret = -ENOBUFS;
-			goto out;
-		}
-		ic_opmode = vif->type;
+		sc->nmeshes++;
+		break;
+	case NL80211_IFTYPE_WDS:
+		sc->nwds++;
 		break;
+	}
+}
+
+bool ath9k_uses_beacons(int type)
+{
+	switch (type) {
+	case NL80211_IFTYPE_AP:
+	case NL80211_IFTYPE_ADHOC:
+	case NL80211_IFTYPE_MESH_POINT:
+		return true;
 	default:
-		ath_err(common, "Interface type %d not yet supported\n",
-			vif->type);
-		ret = -EOPNOTSUPP;
-		goto out;
+		return false;
 	}
+}
 
-	ath_dbg(common, ATH_DBG_CONFIG,
-		"Attach a VIF of type: %d\n", ic_opmode);
+static void ath9k_reclaim_beacon(struct ath_softc *sc,
+				 struct ieee80211_vif *vif)
+{
+	struct ath_vif *avp = (void *)vif->drv_priv;
 
-	/* Set the VIF opmode */
-	avp->av_opmode = ic_opmode;
-	avp->av_bslot = -1;
+	/* Disable SWBA interrupt */
+	sc->sc_ah->imask &= ~ATH9K_INT_SWBA;
+	ath9k_ps_wakeup(sc);
+	ath9k_hw_set_interrupts(sc->sc_ah, sc->sc_ah->imask);
+	ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq);
+	tasklet_kill(&sc->bcon_tasklet);
+	ath9k_ps_restore(sc);
 
-	sc->nvifs++;
+	ath_beacon_return(sc, avp);
+	sc->sc_flags &= ~SC_OP_BEACONS;
 
-	ath9k_set_bssid_mask(hw, vif);
+	if (sc->nbcnvifs > 0) {
+		/* Re-enable beaconing */
+		sc->sc_ah->imask |= ATH9K_INT_SWBA;
+		ath9k_ps_wakeup(sc);
+		ath9k_hw_set_interrupts(sc->sc_ah, sc->sc_ah->imask);
+		ath9k_ps_restore(sc);
+	}
+}
 
-	if (sc->nvifs > 1)
-		goto out; /* skip global settings for secondary vif */
+/* Called with sc->mutex held, vif counts set up properly. */
+static void ath9k_do_vif_add_setup(struct ieee80211_hw *hw,
+				   struct ieee80211_vif *vif)
+{
+	struct ath_wiphy *aphy = hw->priv;
+	struct ath_softc *sc = aphy->sc;
+	struct ath_hw *ah = sc->sc_ah;
+	struct ath_common *common = ath9k_hw_common(ah);
 
-	if (ic_opmode == NL80211_IFTYPE_AP) {
+	ath9k_set_bssid_mask(hw, vif);
+
+	if (sc->naps > 0) {
 		ath9k_hw_set_tsfadjust(ah, 1);
 		sc->sc_flags |= SC_OP_TSF_RESET;
-	}
-
-	/* Set the device opmode */
-	ah->opmode = ic_opmode;
+		ah->opmode = NL80211_IFTYPE_AP;
+	} else
+		ah->opmode = vif->type;
 
 	/*
 	 * Enable MIB interrupts when there are hardware phy counters.
-	 * Note we only do this (at the moment) for station mode.
 	 */
-	if ((vif->type == NL80211_IFTYPE_STATION) ||
-	    (vif->type == NL80211_IFTYPE_ADHOC) ||
-	    (vif->type == NL80211_IFTYPE_MESH_POINT)) {
+	if ((sc->nstations + sc->nadhocs + sc->nmeshes) > 0) {
 		if (ah->config.enable_ani)
 			ah->imask |= ATH9K_INT_MIB;
 		ah->imask |= ATH9K_INT_TSFOOR;
@@ -1438,40 +1474,87 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
 
 	ath9k_hw_set_interrupts(ah, ah->imask);
 
-	if (vif->type == NL80211_IFTYPE_AP    ||
-	    vif->type == NL80211_IFTYPE_ADHOC) {
+	if ((sc->naps + sc->nadhocs) > 0) {
 		sc->sc_flags |= SC_OP_ANI_RUN;
 		ath_start_ani(common);
 	}
 
-out:
-	mutex_unlock(&sc->mutex);
-	return ret;
+	if (ath9k_uses_beacons(vif->type)) {
+		int error;
+		ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq);
+		/* This may fail because upper levels do not have beacons
+		 * properly configured yet.  That's OK, we assume it
+		 * will be properly configured and then we will be notified
+		 * in the info_changed method and set up beacons properly
+		 * there.
+		 */
+		error = ath_beacon_alloc(aphy, vif);
+		if (error)
+			ath9k_reclaim_beacon(sc, vif);
+		else
+			ath_beacon_config(sc, vif);
+	}
 }
 
-static void ath9k_reclaim_beacon(struct ath_softc *sc,
-				 struct ieee80211_vif *vif)
+
+static int ath9k_add_interface(struct ieee80211_hw *hw,
+			       struct ieee80211_vif *vif)
 {
+	struct ath_wiphy *aphy = hw->priv;
+	struct ath_softc *sc = aphy->sc;
+	struct ath_hw *ah = sc->sc_ah;
+	struct ath_common *common = ath9k_hw_common(ah);
 	struct ath_vif *avp = (void *)vif->drv_priv;
+	int ret = 0;
 
-	/* Disable SWBA interrupt */
-	sc->sc_ah->imask &= ~ATH9K_INT_SWBA;
-	ath9k_ps_wakeup(sc);
-	ath9k_hw_set_interrupts(sc->sc_ah, sc->sc_ah->imask);
-	ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq);
-	tasklet_kill(&sc->bcon_tasklet);
-	ath9k_ps_restore(sc);
+	mutex_lock(&sc->mutex);
 
-	ath_beacon_return(sc, avp);
-	sc->sc_flags &= ~SC_OP_BEACONS;
+	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 (sc->nbcnvifs > 0) {
-		/* Re-enable beaconing */
-		sc->sc_ah->imask |= ATH9K_INT_SWBA;
-		ath9k_ps_wakeup(sc);
-		ath9k_hw_set_interrupts(sc->sc_ah, sc->sc_ah->imask);
-		ath9k_ps_restore(sc);
+	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;
+		}
+	}
+
+	if ((vif->type == NL80211_IFTYPE_ADHOC) &&
+	    sc->nvifs > 0) {
+		ath_err(common, "Cannot create ADHOC interface when other"
+			" interfaces already exist.\n");
+		ret = -EINVAL;
+		goto out;
 	}
+
+	ath_dbg(common, ATH_DBG_CONFIG,
+		"Attach a VIF of type: %d\n", vif->type);
+
+	/* Set the VIF opmode */
+	avp->av_opmode = vif->type;
+	avp->av_bslot = -1;
+
+	increment_vif_type(sc, vif->type);
+	sc->nvifs++;
+
+	ath9k_do_vif_add_setup(hw, vif);
+out:
+	mutex_unlock(&sc->mutex);
+	return ret;
 }
 
 static int ath9k_change_interface(struct ieee80211_hw *hw,
@@ -1487,6 +1570,11 @@ static int ath9k_change_interface(struct ieee80211_hw *hw,
 	ath_dbg(common, ATH_DBG_CONFIG, "Change Interface\n");
 	mutex_lock(&sc->mutex);
 
+	decrement_vif_type(sc, vif->type);
+
+	if (ath9k_uses_beacons(vif->type))
+		ath9k_reclaim_beacon(sc, vif);
+
 	switch (new_type) {
 	case NL80211_IFTYPE_AP:
 	case NL80211_IFTYPE_ADHOC:
@@ -1497,12 +1585,11 @@ static int ath9k_change_interface(struct ieee80211_hw *hw,
 		}
 		break;
 	case NL80211_IFTYPE_STATION:
-		/* Stop ANI */
-		sc->sc_flags &= ~SC_OP_ANI_RUN;
-		del_timer_sync(&common->ani.timer);
-		if ((vif->type == NL80211_IFTYPE_AP) ||
-		    (vif->type == NL80211_IFTYPE_ADHOC))
-			ath9k_reclaim_beacon(sc, vif);
+		if ((sc->naps + sc->nadhocs) == 0) {
+			/* Stop ANI */
+			sc->sc_flags &= ~SC_OP_ANI_RUN;
+			del_timer_sync(&common->ani.timer);
+		}
 		break;
 	default:
 		ath_err(common, "Interface type %d not yet supported\n",
@@ -1513,6 +1600,8 @@ static int ath9k_change_interface(struct ieee80211_hw *hw,
 	vif->type = new_type;
 	vif->p2p = p2p;
 
+	increment_vif_type(sc, vif->type);
+	ath9k_do_vif_add_setup(hw, vif);
 out:
 	mutex_unlock(&sc->mutex);
 	return ret;
@@ -1524,22 +1613,40 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
 	struct ath_wiphy *aphy = hw->priv;
 	struct ath_softc *sc = aphy->sc;
 	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
+	struct ath_hw *ah = sc->sc_ah;
 
 	ath_dbg(common, ATH_DBG_CONFIG, "Detach Interface\n");
 
 	mutex_lock(&sc->mutex);
 
-	/* Stop ANI */
-	sc->sc_flags &= ~SC_OP_ANI_RUN;
-	del_timer_sync(&common->ani.timer);
+	decrement_vif_type(sc, vif->type);
+	sc->nvifs--;
+
+	if ((sc->naps + sc->nadhocs) == 0) {
+		/* Stop ANI */
+		sc->sc_flags &= ~SC_OP_ANI_RUN;
+		del_timer_sync(&common->ani.timer);
+	}
 
 	/* Reclaim beacon resources */
-	if ((sc->sc_ah->opmode == NL80211_IFTYPE_AP) ||
-	    (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC) ||
-	    (sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT))
+	if (ath9k_uses_beacons(vif->type))
 		ath9k_reclaim_beacon(sc, vif);
 
-	sc->nvifs--;
+	ath9k_set_bssid_mask(hw, NULL);
+
+	if (sc->naps == 0) {
+		ath9k_hw_set_tsfadjust(ah, 0);
+		sc->sc_flags &= ~SC_OP_TSF_RESET;
+		if (sc->nwds)
+			ah->opmode = NL80211_IFTYPE_WDS;
+		else if (sc->nmeshes)
+			ah->opmode = NL80211_IFTYPE_MESH_POINT;
+		else if (sc->nadhocs)
+			ah->opmode = NL80211_IFTYPE_ADHOC;
+		else
+			ah->opmode = NL80211_IFTYPE_STATION;
+	} else
+		ah->opmode = NL80211_IFTYPE_AP;
 
 	mutex_unlock(&sc->mutex);
 }
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index ea2f67c..9a2b4a8 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -589,8 +589,14 @@ static void ath_rx_ps_beacon(struct ath_softc *sc, struct sk_buff *skb)
 		return;
 
 	mgmt = (struct ieee80211_mgmt *)skb->data;
-	if (memcmp(common->curbssid, mgmt->bssid, ETH_ALEN) != 0)
+	if (memcmp(common->curbssid, mgmt->bssid, ETH_ALEN) != 0) {
+		/* TODO:  This doesn't work well if you have stations
+		 * associated to two different APs because curbssid
+		 * is just the last AP that any of the stations associated
+		 * with.
+		 */
 		return; /* not from our current AP */
+	}
 
 	sc->ps_flags &= ~PS_WAIT_FOR_BEACON;
 
@@ -980,13 +986,20 @@ static void ath9k_process_rssi(struct ath_common *common,
 	int last_rssi;
 	__le16 fc;
 
+	/* TODO:  Maybe need to accept this if we have STA vifs active?? */
 	if (ah->opmode != NL80211_IFTYPE_STATION)
 		return;
 
 	fc = hdr->frame_control;
 	if (!ieee80211_is_beacon(fc) ||
-	    compare_ether_addr(hdr->addr3, common->curbssid))
+	    compare_ether_addr(hdr->addr3, common->curbssid)) {
+		/* TODO:  This doesn't work well if you have stations
+		 * associated to two different APs because curbssid
+		 * is just the last AP that any of the stations associated
+		 * with.
+		 */
 		return;
+	}
 
 	if (rx_stats->rs_rssi != ATH9K_RSSI_BAD && !rx_stats->rs_moreaggr)
 		ATH_RSSI_LPF(aphy->last_rssi, rx_stats->rs_rssi);
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [ath9k-devel] [RFC 1/2] ath9k: Fix up hardware mode and beacons with multiple vifs.
@ 2011-01-14 17:27 ` greearb at candelatech.com
  0 siblings, 0 replies; 26+ messages in thread
From: greearb at candelatech.com @ 2011-01-14 17:27 UTC (permalink / raw)
  To: ath9k-devel

From: Ben Greear <greearb@candelatech.com>

When using a mixture of AP and Station interfaces,
the hardware mode was using the type of the
last VIF registered.  Instead, we should keep track
of the number of different types of vifs and set the
mode accordingly.

In addtion, use the vif type instead of hardware opmode
when dealing with beacons.

Attempt to move some of the common setup code into smaller
methods so we can re-use it when changing vif mode as
well as adding/deleting vifs.

This needs review.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
:100644 100644 3108699... a2da259... M	drivers/net/wireless/ath/ath9k/ath9k.h
:100644 100644 385ba03... 8de591e... M	drivers/net/wireless/ath/ath9k/beacon.c
:100644 100644 0452580... 1a65e53... M	drivers/net/wireless/ath/ath9k/main.c
:100644 100644 ea2f67c... 9a2b4a8... M	drivers/net/wireless/ath/ath9k/recv.c
 drivers/net/wireless/ath/ath9k/ath9k.h  |   10 +-
 drivers/net/wireless/ath/ath9k/beacon.c |   14 +-
 drivers/net/wireless/ath/ath9k/main.c   |  263 ++++++++++++++++++++++---------
 drivers/net/wireless/ath/ath9k/recv.c   |   17 ++-
 4 files changed, 214 insertions(+), 90 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 3108699..a2da259 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -607,10 +607,15 @@ struct ath_softc {
 	u32 sc_flags; /* SC_OP_* */
 	u16 ps_flags; /* PS_* */
 	u16 curtxpow;
-	u8 nbcnvifs;
-	u16 nvifs;
 	bool ps_enabled;
 	bool ps_idle;
+	short nbcnvifs;
+	short nvifs;
+	short naps; /* number of APs */
+	short nmeshes;
+	short nstations;
+	short nwds;
+	short nadhocs;
 	unsigned long ps_usecount;
 
 	struct ath_config config;
@@ -694,6 +699,7 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw,
 void ath_radio_enable(struct ath_softc *sc, struct ieee80211_hw *hw);
 void ath_radio_disable(struct ath_softc *sc, struct ieee80211_hw *hw);
 bool ath9k_setpower(struct ath_softc *sc, enum ath9k_power_mode mode);
+bool ath9k_uses_beacons(int type);
 
 #ifdef CONFIG_PCI
 int ath_pci_init(void);
diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c
index 385ba03..8de591e 100644
--- a/drivers/net/wireless/ath/ath9k/beacon.c
+++ b/drivers/net/wireless/ath/ath9k/beacon.c
@@ -244,9 +244,7 @@ int ath_beacon_alloc(struct ath_wiphy *aphy, struct ieee80211_vif *vif)
 						 struct ath_buf, list);
 		list_del(&avp->av_bcbuf->list);
 
-		if (sc->sc_ah->opmode == NL80211_IFTYPE_AP ||
-		    sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC ||
-		    sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT) {
+		if (ath9k_uses_beacons(vif->type)) {
 			int slot;
 			/*
 			 * Assign the vif to a beacon xmit slot. As
@@ -282,7 +280,7 @@ int ath_beacon_alloc(struct ath_wiphy *aphy, struct ieee80211_vif *vif)
 	/* NB: the beacon data buffer must be 32-bit aligned. */
 	skb = ieee80211_beacon_get(sc->hw, vif);
 	if (skb == NULL) {
-		ath_dbg(common, ATH_DBG_BEACON, "cannot get skb\n");
+		ath_err(common, "ieee80211_beacon_get failed\n");
 		return -ENOMEM;
 	}
 
@@ -720,10 +718,10 @@ void ath_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif)
 		iftype = sc->sc_ah->opmode;
 	}
 
-		cur_conf->listen_interval = 1;
-		cur_conf->dtim_count = 1;
-		cur_conf->bmiss_timeout =
-			ATH_DEFAULT_BMISS_LIMIT * cur_conf->beacon_interval;
+	cur_conf->listen_interval = 1;
+	cur_conf->dtim_count = 1;
+	cur_conf->bmiss_timeout =
+		ATH_DEFAULT_BMISS_LIMIT * cur_conf->beacon_interval;
 
 	/*
 	 * It looks like mac80211 may end up using beacon interval of zero in
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 0452580..1a65e53 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1366,71 +1366,107 @@ static void ath9k_stop(struct ieee80211_hw *hw)
 	ath_dbg(common, ATH_DBG_CONFIG, "Driver halt\n");
 }
 
-static int ath9k_add_interface(struct ieee80211_hw *hw,
-			       struct ieee80211_vif *vif)
+static void decrement_vif_type(struct ath_softc *sc, int type)
 {
-	struct ath_wiphy *aphy = hw->priv;
-	struct ath_softc *sc = aphy->sc;
-	struct ath_hw *ah = sc->sc_ah;
-	struct ath_common *common = ath9k_hw_common(ah);
-	struct ath_vif *avp = (void *)vif->drv_priv;
-	enum nl80211_iftype ic_opmode = NL80211_IFTYPE_UNSPECIFIED;
-	int ret = 0;
-
-	mutex_lock(&sc->mutex);
-
-	switch (vif->type) {
+	switch (type) {
+	case NL80211_IFTYPE_AP:
+		sc->naps--;
+		break;
 	case NL80211_IFTYPE_STATION:
-		ic_opmode = NL80211_IFTYPE_STATION;
+		sc->nstations--;
+		break;
+	case NL80211_IFTYPE_ADHOC:
+		sc->nadhocs--;
+		break;
+	case NL80211_IFTYPE_MESH_POINT:
+		sc->nmeshes--;
 		break;
 	case NL80211_IFTYPE_WDS:
-		ic_opmode = NL80211_IFTYPE_WDS;
+		sc->nwds--;
 		break;
-	case NL80211_IFTYPE_ADHOC:
+	}
+}
+
+static void increment_vif_type(struct ath_softc *sc, int type)
+{
+	switch (type) {
 	case NL80211_IFTYPE_AP:
+		sc->naps++;
+		break;
+	case NL80211_IFTYPE_STATION:
+		sc->nstations++;
+		break;
+	case NL80211_IFTYPE_ADHOC:
+		sc->nadhocs++;
+		break;
 	case NL80211_IFTYPE_MESH_POINT:
-		if (sc->nbcnvifs >= ATH_BCBUF) {
-			ret = -ENOBUFS;
-			goto out;
-		}
-		ic_opmode = vif->type;
+		sc->nmeshes++;
+		break;
+	case NL80211_IFTYPE_WDS:
+		sc->nwds++;
 		break;
+	}
+}
+
+bool ath9k_uses_beacons(int type)
+{
+	switch (type) {
+	case NL80211_IFTYPE_AP:
+	case NL80211_IFTYPE_ADHOC:
+	case NL80211_IFTYPE_MESH_POINT:
+		return true;
 	default:
-		ath_err(common, "Interface type %d not yet supported\n",
-			vif->type);
-		ret = -EOPNOTSUPP;
-		goto out;
+		return false;
 	}
+}
 
-	ath_dbg(common, ATH_DBG_CONFIG,
-		"Attach a VIF of type: %d\n", ic_opmode);
+static void ath9k_reclaim_beacon(struct ath_softc *sc,
+				 struct ieee80211_vif *vif)
+{
+	struct ath_vif *avp = (void *)vif->drv_priv;
 
-	/* Set the VIF opmode */
-	avp->av_opmode = ic_opmode;
-	avp->av_bslot = -1;
+	/* Disable SWBA interrupt */
+	sc->sc_ah->imask &= ~ATH9K_INT_SWBA;
+	ath9k_ps_wakeup(sc);
+	ath9k_hw_set_interrupts(sc->sc_ah, sc->sc_ah->imask);
+	ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq);
+	tasklet_kill(&sc->bcon_tasklet);
+	ath9k_ps_restore(sc);
 
-	sc->nvifs++;
+	ath_beacon_return(sc, avp);
+	sc->sc_flags &= ~SC_OP_BEACONS;
 
-	ath9k_set_bssid_mask(hw, vif);
+	if (sc->nbcnvifs > 0) {
+		/* Re-enable beaconing */
+		sc->sc_ah->imask |= ATH9K_INT_SWBA;
+		ath9k_ps_wakeup(sc);
+		ath9k_hw_set_interrupts(sc->sc_ah, sc->sc_ah->imask);
+		ath9k_ps_restore(sc);
+	}
+}
 
-	if (sc->nvifs > 1)
-		goto out; /* skip global settings for secondary vif */
+/* Called with sc->mutex held, vif counts set up properly. */
+static void ath9k_do_vif_add_setup(struct ieee80211_hw *hw,
+				   struct ieee80211_vif *vif)
+{
+	struct ath_wiphy *aphy = hw->priv;
+	struct ath_softc *sc = aphy->sc;
+	struct ath_hw *ah = sc->sc_ah;
+	struct ath_common *common = ath9k_hw_common(ah);
 
-	if (ic_opmode == NL80211_IFTYPE_AP) {
+	ath9k_set_bssid_mask(hw, vif);
+
+	if (sc->naps > 0) {
 		ath9k_hw_set_tsfadjust(ah, 1);
 		sc->sc_flags |= SC_OP_TSF_RESET;
-	}
-
-	/* Set the device opmode */
-	ah->opmode = ic_opmode;
+		ah->opmode = NL80211_IFTYPE_AP;
+	} else
+		ah->opmode = vif->type;
 
 	/*
 	 * Enable MIB interrupts when there are hardware phy counters.
-	 * Note we only do this (at the moment) for station mode.
 	 */
-	if ((vif->type == NL80211_IFTYPE_STATION) ||
-	    (vif->type == NL80211_IFTYPE_ADHOC) ||
-	    (vif->type == NL80211_IFTYPE_MESH_POINT)) {
+	if ((sc->nstations + sc->nadhocs + sc->nmeshes) > 0) {
 		if (ah->config.enable_ani)
 			ah->imask |= ATH9K_INT_MIB;
 		ah->imask |= ATH9K_INT_TSFOOR;
@@ -1438,40 +1474,87 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
 
 	ath9k_hw_set_interrupts(ah, ah->imask);
 
-	if (vif->type == NL80211_IFTYPE_AP    ||
-	    vif->type == NL80211_IFTYPE_ADHOC) {
+	if ((sc->naps + sc->nadhocs) > 0) {
 		sc->sc_flags |= SC_OP_ANI_RUN;
 		ath_start_ani(common);
 	}
 
-out:
-	mutex_unlock(&sc->mutex);
-	return ret;
+	if (ath9k_uses_beacons(vif->type)) {
+		int error;
+		ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq);
+		/* This may fail because upper levels do not have beacons
+		 * properly configured yet.  That's OK, we assume it
+		 * will be properly configured and then we will be notified
+		 * in the info_changed method and set up beacons properly
+		 * there.
+		 */
+		error = ath_beacon_alloc(aphy, vif);
+		if (error)
+			ath9k_reclaim_beacon(sc, vif);
+		else
+			ath_beacon_config(sc, vif);
+	}
 }
 
-static void ath9k_reclaim_beacon(struct ath_softc *sc,
-				 struct ieee80211_vif *vif)
+
+static int ath9k_add_interface(struct ieee80211_hw *hw,
+			       struct ieee80211_vif *vif)
 {
+	struct ath_wiphy *aphy = hw->priv;
+	struct ath_softc *sc = aphy->sc;
+	struct ath_hw *ah = sc->sc_ah;
+	struct ath_common *common = ath9k_hw_common(ah);
 	struct ath_vif *avp = (void *)vif->drv_priv;
+	int ret = 0;
 
-	/* Disable SWBA interrupt */
-	sc->sc_ah->imask &= ~ATH9K_INT_SWBA;
-	ath9k_ps_wakeup(sc);
-	ath9k_hw_set_interrupts(sc->sc_ah, sc->sc_ah->imask);
-	ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq);
-	tasklet_kill(&sc->bcon_tasklet);
-	ath9k_ps_restore(sc);
+	mutex_lock(&sc->mutex);
 
-	ath_beacon_return(sc, avp);
-	sc->sc_flags &= ~SC_OP_BEACONS;
+	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 (sc->nbcnvifs > 0) {
-		/* Re-enable beaconing */
-		sc->sc_ah->imask |= ATH9K_INT_SWBA;
-		ath9k_ps_wakeup(sc);
-		ath9k_hw_set_interrupts(sc->sc_ah, sc->sc_ah->imask);
-		ath9k_ps_restore(sc);
+	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;
+		}
+	}
+
+	if ((vif->type == NL80211_IFTYPE_ADHOC) &&
+	    sc->nvifs > 0) {
+		ath_err(common, "Cannot create ADHOC interface when other"
+			" interfaces already exist.\n");
+		ret = -EINVAL;
+		goto out;
 	}
+
+	ath_dbg(common, ATH_DBG_CONFIG,
+		"Attach a VIF of type: %d\n", vif->type);
+
+	/* Set the VIF opmode */
+	avp->av_opmode = vif->type;
+	avp->av_bslot = -1;
+
+	increment_vif_type(sc, vif->type);
+	sc->nvifs++;
+
+	ath9k_do_vif_add_setup(hw, vif);
+out:
+	mutex_unlock(&sc->mutex);
+	return ret;
 }
 
 static int ath9k_change_interface(struct ieee80211_hw *hw,
@@ -1487,6 +1570,11 @@ static int ath9k_change_interface(struct ieee80211_hw *hw,
 	ath_dbg(common, ATH_DBG_CONFIG, "Change Interface\n");
 	mutex_lock(&sc->mutex);
 
+	decrement_vif_type(sc, vif->type);
+
+	if (ath9k_uses_beacons(vif->type))
+		ath9k_reclaim_beacon(sc, vif);
+
 	switch (new_type) {
 	case NL80211_IFTYPE_AP:
 	case NL80211_IFTYPE_ADHOC:
@@ -1497,12 +1585,11 @@ static int ath9k_change_interface(struct ieee80211_hw *hw,
 		}
 		break;
 	case NL80211_IFTYPE_STATION:
-		/* Stop ANI */
-		sc->sc_flags &= ~SC_OP_ANI_RUN;
-		del_timer_sync(&common->ani.timer);
-		if ((vif->type == NL80211_IFTYPE_AP) ||
-		    (vif->type == NL80211_IFTYPE_ADHOC))
-			ath9k_reclaim_beacon(sc, vif);
+		if ((sc->naps + sc->nadhocs) == 0) {
+			/* Stop ANI */
+			sc->sc_flags &= ~SC_OP_ANI_RUN;
+			del_timer_sync(&common->ani.timer);
+		}
 		break;
 	default:
 		ath_err(common, "Interface type %d not yet supported\n",
@@ -1513,6 +1600,8 @@ static int ath9k_change_interface(struct ieee80211_hw *hw,
 	vif->type = new_type;
 	vif->p2p = p2p;
 
+	increment_vif_type(sc, vif->type);
+	ath9k_do_vif_add_setup(hw, vif);
 out:
 	mutex_unlock(&sc->mutex);
 	return ret;
@@ -1524,22 +1613,40 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
 	struct ath_wiphy *aphy = hw->priv;
 	struct ath_softc *sc = aphy->sc;
 	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
+	struct ath_hw *ah = sc->sc_ah;
 
 	ath_dbg(common, ATH_DBG_CONFIG, "Detach Interface\n");
 
 	mutex_lock(&sc->mutex);
 
-	/* Stop ANI */
-	sc->sc_flags &= ~SC_OP_ANI_RUN;
-	del_timer_sync(&common->ani.timer);
+	decrement_vif_type(sc, vif->type);
+	sc->nvifs--;
+
+	if ((sc->naps + sc->nadhocs) == 0) {
+		/* Stop ANI */
+		sc->sc_flags &= ~SC_OP_ANI_RUN;
+		del_timer_sync(&common->ani.timer);
+	}
 
 	/* Reclaim beacon resources */
-	if ((sc->sc_ah->opmode == NL80211_IFTYPE_AP) ||
-	    (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC) ||
-	    (sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT))
+	if (ath9k_uses_beacons(vif->type))
 		ath9k_reclaim_beacon(sc, vif);
 
-	sc->nvifs--;
+	ath9k_set_bssid_mask(hw, NULL);
+
+	if (sc->naps == 0) {
+		ath9k_hw_set_tsfadjust(ah, 0);
+		sc->sc_flags &= ~SC_OP_TSF_RESET;
+		if (sc->nwds)
+			ah->opmode = NL80211_IFTYPE_WDS;
+		else if (sc->nmeshes)
+			ah->opmode = NL80211_IFTYPE_MESH_POINT;
+		else if (sc->nadhocs)
+			ah->opmode = NL80211_IFTYPE_ADHOC;
+		else
+			ah->opmode = NL80211_IFTYPE_STATION;
+	} else
+		ah->opmode = NL80211_IFTYPE_AP;
 
 	mutex_unlock(&sc->mutex);
 }
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index ea2f67c..9a2b4a8 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -589,8 +589,14 @@ static void ath_rx_ps_beacon(struct ath_softc *sc, struct sk_buff *skb)
 		return;
 
 	mgmt = (struct ieee80211_mgmt *)skb->data;
-	if (memcmp(common->curbssid, mgmt->bssid, ETH_ALEN) != 0)
+	if (memcmp(common->curbssid, mgmt->bssid, ETH_ALEN) != 0) {
+		/* TODO:  This doesn't work well if you have stations
+		 * associated to two different APs because curbssid
+		 * is just the last AP that any of the stations associated
+		 * with.
+		 */
 		return; /* not from our current AP */
+	}
 
 	sc->ps_flags &= ~PS_WAIT_FOR_BEACON;
 
@@ -980,13 +986,20 @@ static void ath9k_process_rssi(struct ath_common *common,
 	int last_rssi;
 	__le16 fc;
 
+	/* TODO:  Maybe need to accept this if we have STA vifs active?? */
 	if (ah->opmode != NL80211_IFTYPE_STATION)
 		return;
 
 	fc = hdr->frame_control;
 	if (!ieee80211_is_beacon(fc) ||
-	    compare_ether_addr(hdr->addr3, common->curbssid))
+	    compare_ether_addr(hdr->addr3, common->curbssid)) {
+		/* TODO:  This doesn't work well if you have stations
+		 * associated to two different APs because curbssid
+		 * is just the last AP that any of the stations associated
+		 * with.
+		 */
 		return;
+	}
 
 	if (rx_stats->rs_rssi != ATH9K_RSSI_BAD && !rx_stats->rs_moreaggr)
 		ATH_RSSI_LPF(aphy->last_rssi, rx_stats->rs_rssi);
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [RFC 2/2] ath9k:  Add 'misc' file to debugfs, fix queue indexes.
  2011-01-14 17:27 ` [ath9k-devel] " greearb at candelatech.com
@ 2011-01-14 17:27   ` greearb at candelatech.com
  -1 siblings, 0 replies; 26+ messages in thread
From: greearb @ 2011-01-14 17:27 UTC (permalink / raw)
  To: linux-wireless; +Cc: ath9k-devel, Ben Greear

From: Ben Greear <greearb@candelatech.com>

Add a misc file to show hardware op-mode, irq setup,
number of various types of VIFs and more.

Also, previous patches were using the wrong xmit queue
indexes.  Change to use the internal ath9k indexes instead
of the mac80211 queue indexes.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
:100644 100644 b0cb792... 5005621... M	drivers/net/wireless/ath/ath9k/debug.c
 drivers/net/wireless/ath/ath9k/debug.c |  128 +++++++++++++++++++++++++++++---
 1 files changed, 116 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index b0cb792..5005621 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -595,10 +595,10 @@ static const struct file_operations fops_wiphy = {
 do {									\
 	len += snprintf(buf + len, size - len,				\
 			"%s%13u%11u%10u%10u\n", str,			\
-			(unsigned int)(sc->tx.txq[WME_AC_BE].elem),	\
-			(unsigned int)(sc->tx.txq[WME_AC_BK].elem),	\
-			(unsigned int)(sc->tx.txq[WME_AC_VI].elem),	\
-			(unsigned int)(sc->tx.txq[WME_AC_VO].elem));	\
+			(unsigned int)(sc->tx.txq[ATH_TXQ_AC_BE].elem),	\
+			(unsigned int)(sc->tx.txq[ATH_TXQ_AC_BK].elem),	\
+			(unsigned int)(sc->tx.txq[ATH_TXQ_AC_VI].elem),	\
+			(unsigned int)(sc->tx.txq[ATH_TXQ_AC_VO].elem));	\
 	if (len >= size)						\
 		goto done;						\
 } while(0)
@@ -607,10 +607,10 @@ do {									\
 do {									\
 	len += snprintf(buf + len, size - len,				\
 			"%s%13i%11i%10i%10i\n", str,			\
-			list_empty(&sc->tx.txq[WME_AC_BE].elem),	\
-			list_empty(&sc->tx.txq[WME_AC_BK].elem),	\
-			list_empty(&sc->tx.txq[WME_AC_VI].elem),	\
-			list_empty(&sc->tx.txq[WME_AC_VO].elem));	\
+			list_empty(&sc->tx.txq[ATH_TXQ_AC_BE].elem),	\
+			list_empty(&sc->tx.txq[ATH_TXQ_AC_BK].elem),	\
+			list_empty(&sc->tx.txq[ATH_TXQ_AC_VI].elem),	\
+			list_empty(&sc->tx.txq[ATH_TXQ_AC_VO].elem));	\
 	if (len >= size)						\
 		goto done;						\
 } while (0)
@@ -657,10 +657,10 @@ static ssize_t read_file_xmit(struct file *file, char __user *user_buf,
 	PR("hw-tx-proc-desc: ", txprocdesc);
 	len += snprintf(buf + len, size - len,
 			"%s%11p%11p%10p%10p\n", "txq-memory-address:",
-			&(sc->tx.txq[WME_AC_BE]),
-			&(sc->tx.txq[WME_AC_BK]),
-			&(sc->tx.txq[WME_AC_VI]),
-			&(sc->tx.txq[WME_AC_VO]));
+			&(sc->tx.txq[ATH_TXQ_AC_BE]),
+			&(sc->tx.txq[ATH_TXQ_AC_BK]),
+			&(sc->tx.txq[ATH_TXQ_AC_VI]),
+			&(sc->tx.txq[ATH_TXQ_AC_VO]));
 	if (len >= size)
 		goto done;
 
@@ -777,6 +777,99 @@ done:
 	return retval;
 }
 
+static ssize_t read_file_misc(struct file *file, char __user *user_buf,
+			      size_t count, loff_t *ppos)
+{
+	struct ath_softc *sc = file->private_data;
+	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
+	struct ath_hw *ah = sc->sc_ah;
+	char *buf;
+	unsigned int len = 0, size = 8000;
+	ssize_t retval = 0;
+	const char *tmp;
+	unsigned int reg;
+
+	buf = kzalloc(size, GFP_KERNEL);
+	if (buf == NULL)
+		return -ENOMEM;
+
+	switch (sc->sc_ah->opmode) {
+	case  NL80211_IFTYPE_ADHOC:
+		tmp = "ADHOC";
+		break;
+	case  NL80211_IFTYPE_MESH_POINT:
+		tmp = "MESH";
+		break;
+	case  NL80211_IFTYPE_AP:
+		tmp = "AP";
+		break;
+	case  NL80211_IFTYPE_STATION:
+		tmp = "STATION";
+		break;
+	default:
+		tmp = "???";
+		break;
+	}
+
+	len += snprintf(buf + len, size - len,
+			"curbssid: %pM\n"
+			"OP-Mode: %s(%i)\n"
+			"Beacon-Timer-Register: 0x%x\n",
+			common->curbssid,
+			tmp, (int)(sc->sc_ah->opmode),
+			REG_READ(ah, AR_BEACON_PERIOD));
+
+	reg = REG_READ(ah, AR_TIMER_MODE);
+	len += snprintf(buf + len, size - len, "Timer-Mode-Register: 0x%x (",
+			reg);
+	if (reg & AR_TBTT_TIMER_EN)
+		len += snprintf(buf + len, size - len, "TBTT ");
+	if (reg & AR_DBA_TIMER_EN)
+		len += snprintf(buf + len, size - len, "DBA ");
+	if (reg & AR_SWBA_TIMER_EN)
+		len += snprintf(buf + len, size - len, "SWBA ");
+	if (reg & AR_HCF_TIMER_EN)
+		len += snprintf(buf + len, size - len, "HCF ");
+	if (reg & AR_TIM_TIMER_EN)
+		len += snprintf(buf + len, size - len, "TIM ");
+	if (reg & AR_DTIM_TIMER_EN)
+		len += snprintf(buf + len, size - len, "DTIM ");
+	len += snprintf(buf + len, size - len, ")\n");
+
+	reg = sc->sc_ah->imask;
+	len += snprintf(buf + len, size - len, "imask: 0x%x (", reg);
+	if (reg & ATH9K_INT_SWBA)
+		len += snprintf(buf + len, size - len, "SWBA ");
+	if (reg & ATH9K_INT_BMISS)
+		len += snprintf(buf + len, size - len, "BMISS ");
+	if (reg & ATH9K_INT_CST)
+		len += snprintf(buf + len, size - len, "CST ");
+	if (reg & ATH9K_INT_RX)
+		len += snprintf(buf + len, size - len, "RX ");
+	if (reg & ATH9K_INT_RXHP)
+		len += snprintf(buf + len, size - len, "RXHP ");
+	if (reg & ATH9K_INT_RXLP)
+		len += snprintf(buf + len, size - len, "RXLP ");
+	if (reg & ATH9K_INT_BB_WATCHDOG)
+		len += snprintf(buf + len, size - len, "BB_WATCHDOG ");
+	/* there are other IRQs if one wanted to add them. */
+	len += snprintf(buf + len, size - len, ")\n");
+
+	len += snprintf(buf + len, size - len,
+			"VIF Counts: AP: %hi STA: %hi MESH: %hi WDS: %hi"
+			" ADHOC: %hi nvifs: %hi beacon-vifs: %hi\n",
+			sc->naps, sc->nstations, sc->nmeshes, sc->nwds,
+			sc->nadhocs, sc->nvifs, sc->nbcnvifs);
+
+	if (len > size)
+		len = size;
+
+	retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
+	kfree(buf);
+
+	return retval;
+}
+
 void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf,
 		       struct ath_tx_status *ts)
 {
@@ -822,6 +915,13 @@ static const struct file_operations fops_stations = {
 	.llseek = default_llseek,
 };
 
+static const struct file_operations fops_misc = {
+	.read = read_file_misc,
+	.open = ath9k_debugfs_open,
+	.owner = THIS_MODULE,
+	.llseek = default_llseek,
+};
+
 static ssize_t read_file_recv(struct file *file, char __user *user_buf,
 			      size_t count, loff_t *ppos)
 {
@@ -1063,6 +1163,10 @@ int ath9k_init_debug(struct ath_hw *ah)
 			sc, &fops_stations))
 		goto err;
 
+	if (!debugfs_create_file("misc", S_IRUSR, sc->debug.debugfs_phy,
+			sc, &fops_misc))
+		goto err;
+
 	if (!debugfs_create_file("recv", S_IRUSR, sc->debug.debugfs_phy,
 			sc, &fops_recv))
 		goto err;
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [ath9k-devel] [RFC 2/2] ath9k:  Add 'misc' file to debugfs, fix queue indexes.
@ 2011-01-14 17:27   ` greearb at candelatech.com
  0 siblings, 0 replies; 26+ messages in thread
From: greearb at candelatech.com @ 2011-01-14 17:27 UTC (permalink / raw)
  To: ath9k-devel

From: Ben Greear <greearb@candelatech.com>

Add a misc file to show hardware op-mode, irq setup,
number of various types of VIFs and more.

Also, previous patches were using the wrong xmit queue
indexes.  Change to use the internal ath9k indexes instead
of the mac80211 queue indexes.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
:100644 100644 b0cb792... 5005621... M	drivers/net/wireless/ath/ath9k/debug.c
 drivers/net/wireless/ath/ath9k/debug.c |  128 +++++++++++++++++++++++++++++---
 1 files changed, 116 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index b0cb792..5005621 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -595,10 +595,10 @@ static const struct file_operations fops_wiphy = {
 do {									\
 	len += snprintf(buf + len, size - len,				\
 			"%s%13u%11u%10u%10u\n", str,			\
-			(unsigned int)(sc->tx.txq[WME_AC_BE].elem),	\
-			(unsigned int)(sc->tx.txq[WME_AC_BK].elem),	\
-			(unsigned int)(sc->tx.txq[WME_AC_VI].elem),	\
-			(unsigned int)(sc->tx.txq[WME_AC_VO].elem));	\
+			(unsigned int)(sc->tx.txq[ATH_TXQ_AC_BE].elem),	\
+			(unsigned int)(sc->tx.txq[ATH_TXQ_AC_BK].elem),	\
+			(unsigned int)(sc->tx.txq[ATH_TXQ_AC_VI].elem),	\
+			(unsigned int)(sc->tx.txq[ATH_TXQ_AC_VO].elem));	\
 	if (len >= size)						\
 		goto done;						\
 } while(0)
@@ -607,10 +607,10 @@ do {									\
 do {									\
 	len += snprintf(buf + len, size - len,				\
 			"%s%13i%11i%10i%10i\n", str,			\
-			list_empty(&sc->tx.txq[WME_AC_BE].elem),	\
-			list_empty(&sc->tx.txq[WME_AC_BK].elem),	\
-			list_empty(&sc->tx.txq[WME_AC_VI].elem),	\
-			list_empty(&sc->tx.txq[WME_AC_VO].elem));	\
+			list_empty(&sc->tx.txq[ATH_TXQ_AC_BE].elem),	\
+			list_empty(&sc->tx.txq[ATH_TXQ_AC_BK].elem),	\
+			list_empty(&sc->tx.txq[ATH_TXQ_AC_VI].elem),	\
+			list_empty(&sc->tx.txq[ATH_TXQ_AC_VO].elem));	\
 	if (len >= size)						\
 		goto done;						\
 } while (0)
@@ -657,10 +657,10 @@ static ssize_t read_file_xmit(struct file *file, char __user *user_buf,
 	PR("hw-tx-proc-desc: ", txprocdesc);
 	len += snprintf(buf + len, size - len,
 			"%s%11p%11p%10p%10p\n", "txq-memory-address:",
-			&(sc->tx.txq[WME_AC_BE]),
-			&(sc->tx.txq[WME_AC_BK]),
-			&(sc->tx.txq[WME_AC_VI]),
-			&(sc->tx.txq[WME_AC_VO]));
+			&(sc->tx.txq[ATH_TXQ_AC_BE]),
+			&(sc->tx.txq[ATH_TXQ_AC_BK]),
+			&(sc->tx.txq[ATH_TXQ_AC_VI]),
+			&(sc->tx.txq[ATH_TXQ_AC_VO]));
 	if (len >= size)
 		goto done;
 
@@ -777,6 +777,99 @@ done:
 	return retval;
 }
 
+static ssize_t read_file_misc(struct file *file, char __user *user_buf,
+			      size_t count, loff_t *ppos)
+{
+	struct ath_softc *sc = file->private_data;
+	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
+	struct ath_hw *ah = sc->sc_ah;
+	char *buf;
+	unsigned int len = 0, size = 8000;
+	ssize_t retval = 0;
+	const char *tmp;
+	unsigned int reg;
+
+	buf = kzalloc(size, GFP_KERNEL);
+	if (buf == NULL)
+		return -ENOMEM;
+
+	switch (sc->sc_ah->opmode) {
+	case  NL80211_IFTYPE_ADHOC:
+		tmp = "ADHOC";
+		break;
+	case  NL80211_IFTYPE_MESH_POINT:
+		tmp = "MESH";
+		break;
+	case  NL80211_IFTYPE_AP:
+		tmp = "AP";
+		break;
+	case  NL80211_IFTYPE_STATION:
+		tmp = "STATION";
+		break;
+	default:
+		tmp = "???";
+		break;
+	}
+
+	len += snprintf(buf + len, size - len,
+			"curbssid: %pM\n"
+			"OP-Mode: %s(%i)\n"
+			"Beacon-Timer-Register: 0x%x\n",
+			common->curbssid,
+			tmp, (int)(sc->sc_ah->opmode),
+			REG_READ(ah, AR_BEACON_PERIOD));
+
+	reg = REG_READ(ah, AR_TIMER_MODE);
+	len += snprintf(buf + len, size - len, "Timer-Mode-Register: 0x%x (",
+			reg);
+	if (reg & AR_TBTT_TIMER_EN)
+		len += snprintf(buf + len, size - len, "TBTT ");
+	if (reg & AR_DBA_TIMER_EN)
+		len += snprintf(buf + len, size - len, "DBA ");
+	if (reg & AR_SWBA_TIMER_EN)
+		len += snprintf(buf + len, size - len, "SWBA ");
+	if (reg & AR_HCF_TIMER_EN)
+		len += snprintf(buf + len, size - len, "HCF ");
+	if (reg & AR_TIM_TIMER_EN)
+		len += snprintf(buf + len, size - len, "TIM ");
+	if (reg & AR_DTIM_TIMER_EN)
+		len += snprintf(buf + len, size - len, "DTIM ");
+	len += snprintf(buf + len, size - len, ")\n");
+
+	reg = sc->sc_ah->imask;
+	len += snprintf(buf + len, size - len, "imask: 0x%x (", reg);
+	if (reg & ATH9K_INT_SWBA)
+		len += snprintf(buf + len, size - len, "SWBA ");
+	if (reg & ATH9K_INT_BMISS)
+		len += snprintf(buf + len, size - len, "BMISS ");
+	if (reg & ATH9K_INT_CST)
+		len += snprintf(buf + len, size - len, "CST ");
+	if (reg & ATH9K_INT_RX)
+		len += snprintf(buf + len, size - len, "RX ");
+	if (reg & ATH9K_INT_RXHP)
+		len += snprintf(buf + len, size - len, "RXHP ");
+	if (reg & ATH9K_INT_RXLP)
+		len += snprintf(buf + len, size - len, "RXLP ");
+	if (reg & ATH9K_INT_BB_WATCHDOG)
+		len += snprintf(buf + len, size - len, "BB_WATCHDOG ");
+	/* there are other IRQs if one wanted to add them. */
+	len += snprintf(buf + len, size - len, ")\n");
+
+	len += snprintf(buf + len, size - len,
+			"VIF Counts: AP: %hi STA: %hi MESH: %hi WDS: %hi"
+			" ADHOC: %hi nvifs: %hi beacon-vifs: %hi\n",
+			sc->naps, sc->nstations, sc->nmeshes, sc->nwds,
+			sc->nadhocs, sc->nvifs, sc->nbcnvifs);
+
+	if (len > size)
+		len = size;
+
+	retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
+	kfree(buf);
+
+	return retval;
+}
+
 void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf,
 		       struct ath_tx_status *ts)
 {
@@ -822,6 +915,13 @@ static const struct file_operations fops_stations = {
 	.llseek = default_llseek,
 };
 
+static const struct file_operations fops_misc = {
+	.read = read_file_misc,
+	.open = ath9k_debugfs_open,
+	.owner = THIS_MODULE,
+	.llseek = default_llseek,
+};
+
 static ssize_t read_file_recv(struct file *file, char __user *user_buf,
 			      size_t count, loff_t *ppos)
 {
@@ -1063,6 +1163,10 @@ int ath9k_init_debug(struct ath_hw *ah)
 			sc, &fops_stations))
 		goto err;
 
+	if (!debugfs_create_file("misc", S_IRUSR, sc->debug.debugfs_phy,
+			sc, &fops_misc))
+		goto err;
+
 	if (!debugfs_create_file("recv", S_IRUSR, sc->debug.debugfs_phy,
 			sc, &fops_recv))
 		goto err;
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [ath9k-devel] [RFC 1/2] ath9k: Fix up hardware mode and beacons with multiple vifs.
  2011-01-14 17:27 ` [ath9k-devel] " greearb at candelatech.com
@ 2011-01-14 18:05   ` Felix Fietkau
  -1 siblings, 0 replies; 26+ messages in thread
From: Felix Fietkau @ 2011-01-14 18:05 UTC (permalink / raw)
  To: greearb; +Cc: linux-wireless, ath9k-devel

On 2011-01-14 6:27 PM, greearb@candelatech.com wrote:
> From: Ben Greear<greearb@candelatech.com>
>
> When using a mixture of AP and Station interfaces,
> the hardware mode was using the type of the
> last VIF registered.  Instead, we should keep track
> of the number of different types of vifs and set the
> mode accordingly.
>
> In addtion, use the vif type instead of hardware opmode
> when dealing with beacons.
>
> Attempt to move some of the common setup code into smaller
> methods so we can re-use it when changing vif mode as
> well as adding/deleting vifs.
>
> This needs review.
>
> Signed-off-by: Ben Greear<greearb@candelatech.com>
> ---
> :100644 100644 3108699... a2da259... M	drivers/net/wireless/ath/ath9k/ath9k.h
> :100644 100644 385ba03... 8de591e... M	drivers/net/wireless/ath/ath9k/beacon.c
> :100644 100644 0452580... 1a65e53... M	drivers/net/wireless/ath/ath9k/main.c
> :100644 100644 ea2f67c... 9a2b4a8... M	drivers/net/wireless/ath/ath9k/recv.c
>   drivers/net/wireless/ath/ath9k/ath9k.h  |   10 +-
>   drivers/net/wireless/ath/ath9k/beacon.c |   14 +-
>   drivers/net/wireless/ath/ath9k/main.c   |  263 ++++++++++++++++++++++---------
>   drivers/net/wireless/ath/ath9k/recv.c   |   17 ++-
>   4 files changed, 214 insertions(+), 90 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
> index 3108699..a2da259 100644
> --- a/drivers/net/wireless/ath/ath9k/ath9k.h
> +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
> @@ -607,10 +607,15 @@ struct ath_softc {
>   	u32 sc_flags; /* SC_OP_* */
>   	u16 ps_flags; /* PS_* */
>   	u16 curtxpow;
> -	u8 nbcnvifs;
> -	u16 nvifs;
>   	bool ps_enabled;
>   	bool ps_idle;
> +	short nbcnvifs;
> +	short nvifs;
> +	short naps; /* number of APs */
> +	short nmeshes;
> +	short nstations;
> +	short nwds;
> +	short nadhocs;
>   	unsigned long ps_usecount;
>
>   	struct ath_config config;
Do we really need all those counters? Wouldn't it be better to iterate 
over active interfaces instead?

> diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
> index ea2f67c..9a2b4a8 100644
> --- a/drivers/net/wireless/ath/ath9k/recv.c
> +++ b/drivers/net/wireless/ath/ath9k/recv.c
> @@ -589,8 +589,14 @@ static void ath_rx_ps_beacon(struct ath_softc *sc, struct sk_buff *skb)
>   		return;
>
>   	mgmt = (struct ieee80211_mgmt *)skb->data;
> -	if (memcmp(common->curbssid, mgmt->bssid, ETH_ALEN) != 0)
> +	if (memcmp(common->curbssid, mgmt->bssid, ETH_ALEN) != 0) {
> +		/* TODO:  This doesn't work well if you have stations
> +		 * associated to two different APs because curbssid
> +		 * is just the last AP that any of the stations associated
> +		 * with.
> +		 */
>   		return; /* not from our current AP */
> +	}
>
>   	sc->ps_flags&= ~PS_WAIT_FOR_BEACON;
>
> @@ -980,13 +986,20 @@ static void ath9k_process_rssi(struct ath_common *common,
>   	int last_rssi;
>   	__le16 fc;
>
> +	/* TODO:  Maybe need to accept this if we have STA vifs active?? */
>   	if (ah->opmode != NL80211_IFTYPE_STATION)
>   		return;
>
>   	fc = hdr->frame_control;
>   	if (!ieee80211_is_beacon(fc) ||
> -	    compare_ether_addr(hdr->addr3, common->curbssid))
> +	    compare_ether_addr(hdr->addr3, common->curbssid)) {
> +		/* TODO:  This doesn't work well if you have stations
> +		 * associated to two different APs because curbssid
> +		 * is just the last AP that any of the stations associated
> +		 * with.
> +		 */
>   		return;
> +	}
>
>   	if (rx_stats->rs_rssi != ATH9K_RSSI_BAD&&  !rx_stats->rs_moreaggr)
>   		ATH_RSSI_LPF(aphy->last_rssi, rx_stats->rs_rssi);
Checking for the STA opmode is correct, this code should not be used for 
STA+AP. For the multi-STA case, it may make sense to process the RSSI 
average per vif and using the minimum for ANI.

- Felix

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [ath9k-devel] [RFC 1/2] ath9k: Fix up hardware mode and beacons with multiple vifs.
@ 2011-01-14 18:05   ` Felix Fietkau
  0 siblings, 0 replies; 26+ messages in thread
From: Felix Fietkau @ 2011-01-14 18:05 UTC (permalink / raw)
  To: ath9k-devel

On 2011-01-14 6:27 PM, greearb at candelatech.com wrote:
> From: Ben Greear<greearb@candelatech.com>
>
> When using a mixture of AP and Station interfaces,
> the hardware mode was using the type of the
> last VIF registered.  Instead, we should keep track
> of the number of different types of vifs and set the
> mode accordingly.
>
> In addtion, use the vif type instead of hardware opmode
> when dealing with beacons.
>
> Attempt to move some of the common setup code into smaller
> methods so we can re-use it when changing vif mode as
> well as adding/deleting vifs.
>
> This needs review.
>
> Signed-off-by: Ben Greear<greearb@candelatech.com>
> ---
> :100644 100644 3108699... a2da259... M	drivers/net/wireless/ath/ath9k/ath9k.h
> :100644 100644 385ba03... 8de591e... M	drivers/net/wireless/ath/ath9k/beacon.c
> :100644 100644 0452580... 1a65e53... M	drivers/net/wireless/ath/ath9k/main.c
> :100644 100644 ea2f67c... 9a2b4a8... M	drivers/net/wireless/ath/ath9k/recv.c
>   drivers/net/wireless/ath/ath9k/ath9k.h  |   10 +-
>   drivers/net/wireless/ath/ath9k/beacon.c |   14 +-
>   drivers/net/wireless/ath/ath9k/main.c   |  263 ++++++++++++++++++++++---------
>   drivers/net/wireless/ath/ath9k/recv.c   |   17 ++-
>   4 files changed, 214 insertions(+), 90 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
> index 3108699..a2da259 100644
> --- a/drivers/net/wireless/ath/ath9k/ath9k.h
> +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
> @@ -607,10 +607,15 @@ struct ath_softc {
>   	u32 sc_flags; /* SC_OP_* */
>   	u16 ps_flags; /* PS_* */
>   	u16 curtxpow;
> -	u8 nbcnvifs;
> -	u16 nvifs;
>   	bool ps_enabled;
>   	bool ps_idle;
> +	short nbcnvifs;
> +	short nvifs;
> +	short naps; /* number of APs */
> +	short nmeshes;
> +	short nstations;
> +	short nwds;
> +	short nadhocs;
>   	unsigned long ps_usecount;
>
>   	struct ath_config config;
Do we really need all those counters? Wouldn't it be better to iterate 
over active interfaces instead?

> diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
> index ea2f67c..9a2b4a8 100644
> --- a/drivers/net/wireless/ath/ath9k/recv.c
> +++ b/drivers/net/wireless/ath/ath9k/recv.c
> @@ -589,8 +589,14 @@ static void ath_rx_ps_beacon(struct ath_softc *sc, struct sk_buff *skb)
>   		return;
>
>   	mgmt = (struct ieee80211_mgmt *)skb->data;
> -	if (memcmp(common->curbssid, mgmt->bssid, ETH_ALEN) != 0)
> +	if (memcmp(common->curbssid, mgmt->bssid, ETH_ALEN) != 0) {
> +		/* TODO:  This doesn't work well if you have stations
> +		 * associated to two different APs because curbssid
> +		 * is just the last AP that any of the stations associated
> +		 * with.
> +		 */
>   		return; /* not from our current AP */
> +	}
>
>   	sc->ps_flags&= ~PS_WAIT_FOR_BEACON;
>
> @@ -980,13 +986,20 @@ static void ath9k_process_rssi(struct ath_common *common,
>   	int last_rssi;
>   	__le16 fc;
>
> +	/* TODO:  Maybe need to accept this if we have STA vifs active?? */
>   	if (ah->opmode != NL80211_IFTYPE_STATION)
>   		return;
>
>   	fc = hdr->frame_control;
>   	if (!ieee80211_is_beacon(fc) ||
> -	    compare_ether_addr(hdr->addr3, common->curbssid))
> +	    compare_ether_addr(hdr->addr3, common->curbssid)) {
> +		/* TODO:  This doesn't work well if you have stations
> +		 * associated to two different APs because curbssid
> +		 * is just the last AP that any of the stations associated
> +		 * with.
> +		 */
>   		return;
> +	}
>
>   	if (rx_stats->rs_rssi != ATH9K_RSSI_BAD&&  !rx_stats->rs_moreaggr)
>   		ATH_RSSI_LPF(aphy->last_rssi, rx_stats->rs_rssi);
Checking for the STA opmode is correct, this code should not be used for 
STA+AP. For the multi-STA case, it may make sense to process the RSSI 
average per vif and using the minimum for ANI.

- Felix

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [ath9k-devel] [RFC 1/2] ath9k: Fix up hardware mode and beacons with multiple vifs.
  2011-01-14 18:05   ` Felix Fietkau
@ 2011-01-14 18:16     ` Ben Greear
  -1 siblings, 0 replies; 26+ messages in thread
From: Ben Greear @ 2011-01-14 18:16 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: linux-wireless, ath9k-devel

On 01/14/2011 10:05 AM, Felix Fietkau wrote:
> On 2011-01-14 6:27 PM, greearb@candelatech.com wrote:

>> diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h
>> b/drivers/net/wireless/ath/ath9k/ath9k.h
>> index 3108699..a2da259 100644
>> --- a/drivers/net/wireless/ath/ath9k/ath9k.h
>> +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
>> @@ -607,10 +607,15 @@ struct ath_softc {
>> u32 sc_flags; /* SC_OP_* */
>> u16 ps_flags; /* PS_* */
>> u16 curtxpow;
>> - u8 nbcnvifs;
>> - u16 nvifs;
>> bool ps_enabled;
>> bool ps_idle;
>> + short nbcnvifs;
>> + short nvifs;
>> + short naps; /* number of APs */
>> + short nmeshes;
>> + short nstations;
>> + short nwds;
>> + short nadhocs;
>> unsigned long ps_usecount;
>>
>> struct ath_config config;
> Do we really need all those counters? Wouldn't it be better to iterate
> over active interfaces instead?

Well, I like the counters.  If they ever do not match
expected results, it will be a clue that we have bugs
in our setup/teardown/change logic.

Seems we use counters like this for ath5k with good
results, btw.

>> if (!ieee80211_is_beacon(fc) ||
>> - compare_ether_addr(hdr->addr3, common->curbssid))
>> + compare_ether_addr(hdr->addr3, common->curbssid)) {
>> + /* TODO: This doesn't work well if you have stations
>> + * associated to two different APs because curbssid
>> + * is just the last AP that any of the stations associated
>> + * with.
>> + */
>> return;
>> + }
>>
>> if (rx_stats->rs_rssi != ATH9K_RSSI_BAD&& !rx_stats->rs_moreaggr)
>> ATH_RSSI_LPF(aphy->last_rssi, rx_stats->rs_rssi);
> Checking for the STA opmode is correct, this code should not be used for
> STA+AP. For the multi-STA case, it may make sense to process the RSSI
> average per vif and using the minimum for ANI.

Ok.  I'll leave that alone for now.

Thanks,
Ben


-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [ath9k-devel] [RFC 1/2] ath9k: Fix up hardware mode and beacons with multiple vifs.
@ 2011-01-14 18:16     ` Ben Greear
  0 siblings, 0 replies; 26+ messages in thread
From: Ben Greear @ 2011-01-14 18:16 UTC (permalink / raw)
  To: ath9k-devel

On 01/14/2011 10:05 AM, Felix Fietkau wrote:
> On 2011-01-14 6:27 PM, greearb at candelatech.com wrote:

>> diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h
>> b/drivers/net/wireless/ath/ath9k/ath9k.h
>> index 3108699..a2da259 100644
>> --- a/drivers/net/wireless/ath/ath9k/ath9k.h
>> +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
>> @@ -607,10 +607,15 @@ struct ath_softc {
>> u32 sc_flags; /* SC_OP_* */
>> u16 ps_flags; /* PS_* */
>> u16 curtxpow;
>> - u8 nbcnvifs;
>> - u16 nvifs;
>> bool ps_enabled;
>> bool ps_idle;
>> + short nbcnvifs;
>> + short nvifs;
>> + short naps; /* number of APs */
>> + short nmeshes;
>> + short nstations;
>> + short nwds;
>> + short nadhocs;
>> unsigned long ps_usecount;
>>
>> struct ath_config config;
> Do we really need all those counters? Wouldn't it be better to iterate
> over active interfaces instead?

Well, I like the counters.  If they ever do not match
expected results, it will be a clue that we have bugs
in our setup/teardown/change logic.

Seems we use counters like this for ath5k with good
results, btw.

>> if (!ieee80211_is_beacon(fc) ||
>> - compare_ether_addr(hdr->addr3, common->curbssid))
>> + compare_ether_addr(hdr->addr3, common->curbssid)) {
>> + /* TODO: This doesn't work well if you have stations
>> + * associated to two different APs because curbssid
>> + * is just the last AP that any of the stations associated
>> + * with.
>> + */
>> return;
>> + }
>>
>> if (rx_stats->rs_rssi != ATH9K_RSSI_BAD&& !rx_stats->rs_moreaggr)
>> ATH_RSSI_LPF(aphy->last_rssi, rx_stats->rs_rssi);
> Checking for the STA opmode is correct, this code should not be used for
> STA+AP. For the multi-STA case, it may make sense to process the RSSI
> average per vif and using the minimum for ANI.

Ok.  I'll leave that alone for now.

Thanks,
Ben


-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [RFC 1/2] ath9k:  Fix up hardware mode and beacons with multiple vifs.
  2011-01-14 17:27 ` [ath9k-devel] " greearb at candelatech.com
@ 2011-01-14 18:58   ` Steve Brown
  -1 siblings, 0 replies; 26+ messages in thread
From: Steve Brown @ 2011-01-14 18:58 UTC (permalink / raw)
  To: greearb; +Cc: linux-wireless, ath9k-devel

On Fri, 2011-01-14 at 09:27 -0800, greearb@candelatech.com wrote:
> From: Ben Greear <greearb@candelatech.com>
> 
> When using a mixture of AP and Station interfaces,
> the hardware mode was using the type of the
> last VIF registered.  Instead, we should keep track
> of the number of different types of vifs and set the
> mode accordingly.
> 
> In addtion, use the vif type instead of hardware opmode
> when dealing with beacons.
> 
> Attempt to move some of the common setup code into smaller
> methods so we can re-use it when changing vif mode as
> well as adding/deleting vifs.
> 
> This needs review.
> 
> Signed-off-by: Ben Greear <greearb@candelatech.com>
> ---
> :100644 100644 3108699... a2da259... M	drivers/net/wireless/ath/ath9k/ath9k.h
> :100644 100644 385ba03... 8de591e... M	drivers/net/wireless/ath/ath9k/beacon.c
> :100644 100644 0452580... 1a65e53... M	drivers/net/wireless/ath/ath9k/main.c
> :100644 100644 ea2f67c... 9a2b4a8... M	drivers/net/wireless/ath/ath9k/recv.c
>  drivers/net/wireless/ath/ath9k/ath9k.h  |   10 +-
>  drivers/net/wireless/ath/ath9k/beacon.c |   14 +-
>  drivers/net/wireless/ath/ath9k/main.c   |  263 ++++++++++++++++++++++---------
>  drivers/net/wireless/ath/ath9k/recv.c   |   17 ++-
>  4 files changed, 214 insertions(+), 90 deletions(-)
> 

It would be really useful to have both an AP and MESH vif. With the mesh
and ap vif's bridged, a station connected to the ap could ping outside
the mesh. Currently, if you add the mesh vif and then the ap vif, it
sort of works. The other way around, the mesh interval value causes
beacons to be sent only for the vif associated with slot 0.

Is it possible to consider this case as you overhaul ath9k beaconing?

Steve



^ permalink raw reply	[flat|nested] 26+ messages in thread

* [ath9k-devel] [RFC 1/2] ath9k: Fix up hardware mode and beacons with multiple vifs.
@ 2011-01-14 18:58   ` Steve Brown
  0 siblings, 0 replies; 26+ messages in thread
From: Steve Brown @ 2011-01-14 18:58 UTC (permalink / raw)
  To: ath9k-devel

On Fri, 2011-01-14 at 09:27 -0800, greearb at candelatech.com wrote:
> From: Ben Greear <greearb@candelatech.com>
> 
> When using a mixture of AP and Station interfaces,
> the hardware mode was using the type of the
> last VIF registered.  Instead, we should keep track
> of the number of different types of vifs and set the
> mode accordingly.
> 
> In addtion, use the vif type instead of hardware opmode
> when dealing with beacons.
> 
> Attempt to move some of the common setup code into smaller
> methods so we can re-use it when changing vif mode as
> well as adding/deleting vifs.
> 
> This needs review.
> 
> Signed-off-by: Ben Greear <greearb@candelatech.com>
> ---
> :100644 100644 3108699... a2da259... M	drivers/net/wireless/ath/ath9k/ath9k.h
> :100644 100644 385ba03... 8de591e... M	drivers/net/wireless/ath/ath9k/beacon.c
> :100644 100644 0452580... 1a65e53... M	drivers/net/wireless/ath/ath9k/main.c
> :100644 100644 ea2f67c... 9a2b4a8... M	drivers/net/wireless/ath/ath9k/recv.c
>  drivers/net/wireless/ath/ath9k/ath9k.h  |   10 +-
>  drivers/net/wireless/ath/ath9k/beacon.c |   14 +-
>  drivers/net/wireless/ath/ath9k/main.c   |  263 ++++++++++++++++++++++---------
>  drivers/net/wireless/ath/ath9k/recv.c   |   17 ++-
>  4 files changed, 214 insertions(+), 90 deletions(-)
> 

It would be really useful to have both an AP and MESH vif. With the mesh
and ap vif's bridged, a station connected to the ap could ping outside
the mesh. Currently, if you add the mesh vif and then the ap vif, it
sort of works. The other way around, the mesh interval value causes
beacons to be sent only for the vif associated with slot 0.

Is it possible to consider this case as you overhaul ath9k beaconing?

Steve

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [RFC 1/2] ath9k:  Fix up hardware mode and beacons with multiple vifs.
  2011-01-14 18:58   ` [ath9k-devel] " Steve Brown
@ 2011-01-14 19:12     ` Ben Greear
  -1 siblings, 0 replies; 26+ messages in thread
From: Ben Greear @ 2011-01-14 19:12 UTC (permalink / raw)
  To: sbrown; +Cc: linux-wireless, ath9k-devel

On 01/14/2011 10:58 AM, Steve Brown wrote:
> On Fri, 2011-01-14 at 09:27 -0800, greearb@candelatech.com wrote:
>> From: Ben Greear<greearb@candelatech.com>
>>
>> When using a mixture of AP and Station interfaces,
>> the hardware mode was using the type of the
>> last VIF registered.  Instead, we should keep track
>> of the number of different types of vifs and set the
>> mode accordingly.
>>
>> In addtion, use the vif type instead of hardware opmode
>> when dealing with beacons.
>>
>> Attempt to move some of the common setup code into smaller
>> methods so we can re-use it when changing vif mode as
>> well as adding/deleting vifs.
>>
>> This needs review.
>>
>> Signed-off-by: Ben Greear<greearb@candelatech.com>
>> ---
>> :100644 100644 3108699... a2da259... M	drivers/net/wireless/ath/ath9k/ath9k.h
>> :100644 100644 385ba03... 8de591e... M	drivers/net/wireless/ath/ath9k/beacon.c
>> :100644 100644 0452580... 1a65e53... M	drivers/net/wireless/ath/ath9k/main.c
>> :100644 100644 ea2f67c... 9a2b4a8... M	drivers/net/wireless/ath/ath9k/recv.c
>>   drivers/net/wireless/ath/ath9k/ath9k.h  |   10 +-
>>   drivers/net/wireless/ath/ath9k/beacon.c |   14 +-
>>   drivers/net/wireless/ath/ath9k/main.c   |  263 ++++++++++++++++++++++---------
>>   drivers/net/wireless/ath/ath9k/recv.c   |   17 ++-
>>   4 files changed, 214 insertions(+), 90 deletions(-)
>>
>
> It would be really useful to have both an AP and MESH vif. With the mesh
> and ap vif's bridged, a station connected to the ap could ping outside
> the mesh. Currently, if you add the mesh vif and then the ap vif, it
> sort of works. The other way around, the mesh interval value causes
> beacons to be sent only for the vif associated with slot 0.
>
> Is it possible to consider this case as you overhaul ath9k beaconing?

Perhaps someone else would be better.  I have no way to test mesh
right now, and still do not understand this code too well.

Hopefully the vif-counting work would help with dealing with
your scenario, however...

Also, could you try with my patch(es)?  Part of the problem with the old
code is that if you added mesh second, you would not be in AP mode anymore.
I think that part will be fixed now.  There may be other issues remaining,
however.

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [ath9k-devel] [RFC 1/2] ath9k: Fix up hardware mode and beacons with multiple vifs.
@ 2011-01-14 19:12     ` Ben Greear
  0 siblings, 0 replies; 26+ messages in thread
From: Ben Greear @ 2011-01-14 19:12 UTC (permalink / raw)
  To: ath9k-devel

On 01/14/2011 10:58 AM, Steve Brown wrote:
> On Fri, 2011-01-14 at 09:27 -0800, greearb at candelatech.com wrote:
>> From: Ben Greear<greearb@candelatech.com>
>>
>> When using a mixture of AP and Station interfaces,
>> the hardware mode was using the type of the
>> last VIF registered.  Instead, we should keep track
>> of the number of different types of vifs and set the
>> mode accordingly.
>>
>> In addtion, use the vif type instead of hardware opmode
>> when dealing with beacons.
>>
>> Attempt to move some of the common setup code into smaller
>> methods so we can re-use it when changing vif mode as
>> well as adding/deleting vifs.
>>
>> This needs review.
>>
>> Signed-off-by: Ben Greear<greearb@candelatech.com>
>> ---
>> :100644 100644 3108699... a2da259... M	drivers/net/wireless/ath/ath9k/ath9k.h
>> :100644 100644 385ba03... 8de591e... M	drivers/net/wireless/ath/ath9k/beacon.c
>> :100644 100644 0452580... 1a65e53... M	drivers/net/wireless/ath/ath9k/main.c
>> :100644 100644 ea2f67c... 9a2b4a8... M	drivers/net/wireless/ath/ath9k/recv.c
>>   drivers/net/wireless/ath/ath9k/ath9k.h  |   10 +-
>>   drivers/net/wireless/ath/ath9k/beacon.c |   14 +-
>>   drivers/net/wireless/ath/ath9k/main.c   |  263 ++++++++++++++++++++++---------
>>   drivers/net/wireless/ath/ath9k/recv.c   |   17 ++-
>>   4 files changed, 214 insertions(+), 90 deletions(-)
>>
>
> It would be really useful to have both an AP and MESH vif. With the mesh
> and ap vif's bridged, a station connected to the ap could ping outside
> the mesh. Currently, if you add the mesh vif and then the ap vif, it
> sort of works. The other way around, the mesh interval value causes
> beacons to be sent only for the vif associated with slot 0.
>
> Is it possible to consider this case as you overhaul ath9k beaconing?

Perhaps someone else would be better.  I have no way to test mesh
right now, and still do not understand this code too well.

Hopefully the vif-counting work would help with dealing with
your scenario, however...

Also, could you try with my patch(es)?  Part of the problem with the old
code is that if you added mesh second, you would not be in AP mode anymore.
I think that part will be fixed now.  There may be other issues remaining,
however.

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [RFC 1/2] ath9k: Fix up hardware mode and beacons with multiple vifs.
  2011-01-14 17:27 ` [ath9k-devel] " greearb at candelatech.com
@ 2011-01-14 23:19   ` Björn Smedman
  -1 siblings, 0 replies; 26+ messages in thread
From: Björn Smedman @ 2011-01-14 23:19 UTC (permalink / raw)
  To: greearb; +Cc: linux-wireless, ath9k-devel

On Fri, Jan 14, 2011 at 6:27 PM,  <greearb@candelatech.com> wrote:
> From: Ben Greear <greearb@candelatech.com>
>
> When using a mixture of AP and Station interfaces,
> the hardware mode was using the type of the
> last VIF registered.  Instead, we should keep track
> of the number of different types of vifs and set the
> mode accordingly.

Thank you for your efforts to get multi-vifs working better.

This is another comment that is a little out of place but when I see
the identifier beacon_interval in this context I cannot help bringing
up per-vif settings as a related problem: If I read the code (or
rather the lack of code) correctly the beacon interval of the last (or
first?) beaconing vif added will be used to set up beacon tx, whereas
the actual beacon contents will reflect the beacon intervals
configured for individual vifs which may all be different... The same
goes for e.g. tx queue configuration, no?

It feels like we need a general multi-vif cleanup here but it's too
big for me unfortunately.

/Björn

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [ath9k-devel] [RFC 1/2] ath9k: Fix up hardware mode and beacons with multiple vifs.
@ 2011-01-14 23:19   ` Björn Smedman
  0 siblings, 0 replies; 26+ messages in thread
From: Björn Smedman @ 2011-01-14 23:19 UTC (permalink / raw)
  To: ath9k-devel

On Fri, Jan 14, 2011 at 6:27 PM,  <greearb@candelatech.com> wrote:
> From: Ben Greear <greearb@candelatech.com>
>
> When using a mixture of AP and Station interfaces,
> the hardware mode was using the type of the
> last VIF registered. ?Instead, we should keep track
> of the number of different types of vifs and set the
> mode accordingly.

Thank you for your efforts to get multi-vifs working better.

This is another comment that is a little out of place but when I see
the identifier beacon_interval in this context I cannot help bringing
up per-vif settings as a related problem: If I read the code (or
rather the lack of code) correctly the beacon interval of the last (or
first?) beaconing vif added will be used to set up beacon tx, whereas
the actual beacon contents will reflect the beacon intervals
configured for individual vifs which may all be different... The same
goes for e.g. tx queue configuration, no?

It feels like we need a general multi-vif cleanup here but it's too
big for me unfortunately.

/Bj?rn

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [RFC 1/2] ath9k: Fix up hardware mode and beacons with multiple vifs.
  2011-01-14 23:19   ` [ath9k-devel] " Björn Smedman
@ 2011-01-14 23:24     ` Ben Greear
  -1 siblings, 0 replies; 26+ messages in thread
From: Ben Greear @ 2011-01-14 23:24 UTC (permalink / raw)
  To: Björn Smedman; +Cc: linux-wireless, ath9k-devel

On 01/14/2011 03:19 PM, Björn Smedman wrote:
> On Fri, Jan 14, 2011 at 6:27 PM,<greearb@candelatech.com>  wrote:
>> From: Ben Greear<greearb@candelatech.com>
>>
>> When using a mixture of AP and Station interfaces,
>> the hardware mode was using the type of the
>> last VIF registered.  Instead, we should keep track
>> of the number of different types of vifs and set the
>> mode accordingly.
>
> Thank you for your efforts to get multi-vifs working better.
>
> This is another comment that is a little out of place but when I see
> the identifier beacon_interval in this context I cannot help bringing
> up per-vif settings as a related problem: If I read the code (or
> rather the lack of code) correctly the beacon interval of the last (or
> first?) beaconing vif added will be used to set up beacon tx, whereas
> the actual beacon contents will reflect the beacon intervals
> configured for individual vifs which may all be different... The same
> goes for e.g. tx queue configuration, no?
>
> It feels like we need a general multi-vif cleanup here but it's too
> big for me unfortunately.

I haven't looked at beacons in that detail yet.

If I can get agreement on the current patch (and the dozen or so preceding it),
then I can take a closer look at beacon intervals.  I don't think that needs to
be done as part of this vif/opmode/beaconing cleanup though.

New patch is coming shortly, as soon as I get some testing completed.

Thanks,
Ben


-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [ath9k-devel] [RFC 1/2] ath9k: Fix up hardware mode and beacons with multiple vifs.
@ 2011-01-14 23:24     ` Ben Greear
  0 siblings, 0 replies; 26+ messages in thread
From: Ben Greear @ 2011-01-14 23:24 UTC (permalink / raw)
  To: ath9k-devel

On 01/14/2011 03:19 PM, Bj?rn Smedman wrote:
> On Fri, Jan 14, 2011 at 6:27 PM,<greearb@candelatech.com>  wrote:
>> From: Ben Greear<greearb@candelatech.com>
>>
>> When using a mixture of AP and Station interfaces,
>> the hardware mode was using the type of the
>> last VIF registered.  Instead, we should keep track
>> of the number of different types of vifs and set the
>> mode accordingly.
>
> Thank you for your efforts to get multi-vifs working better.
>
> This is another comment that is a little out of place but when I see
> the identifier beacon_interval in this context I cannot help bringing
> up per-vif settings as a related problem: If I read the code (or
> rather the lack of code) correctly the beacon interval of the last (or
> first?) beaconing vif added will be used to set up beacon tx, whereas
> the actual beacon contents will reflect the beacon intervals
> configured for individual vifs which may all be different... The same
> goes for e.g. tx queue configuration, no?
>
> It feels like we need a general multi-vif cleanup here but it's too
> big for me unfortunately.

I haven't looked at beacons in that detail yet.

If I can get agreement on the current patch (and the dozen or so preceding it),
then I can take a closer look at beacon intervals.  I don't think that needs to
be done as part of this vif/opmode/beaconing cleanup though.

New patch is coming shortly, as soon as I get some testing completed.

Thanks,
Ben


-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [ath9k-devel] [RFC 1/2] ath9k: Fix up hardware mode and beacons with multiple vifs.
  2011-01-14 23:19   ` [ath9k-devel] " Björn Smedman
@ 2011-01-15  0:55     ` Steve Brown
  -1 siblings, 0 replies; 26+ messages in thread
From: Steve Brown @ 2011-01-15  0:55 UTC (permalink / raw)
  To: Björn Smedman; +Cc: greearb, ath9k-devel, linux-wireless

On Sat, 2011-01-15 at 00:19 +0100, Björn Smedman wrote:

> Thank you for your efforts to get multi-vifs working better.
> 
> This is another comment that is a little out of place but when I see
> the identifier beacon_interval in this context I cannot help bringing
> up per-vif settings as a related problem: If I read the code (or
> rather the lack of code) correctly the beacon interval of the last (or
> first?) beaconing vif added will be used to set up beacon tx, whereas
> the actual beacon contents will reflect the beacon intervals
> configured for individual vifs which may all be different... The same
> goes for e.g. tx queue configuration, no?
> 
> It feels like we need a general multi-vif cleanup here but it's too
> big for me unfortunately.
> 
> /Björn
> _______________________________________________

For instance, an ap vif has a ~100ms interval and a mesh vif has a
~1000ms interval. I don't see how to avoid a per vif interval.

Steve


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [ath9k-devel] [RFC 1/2] ath9k: Fix up hardware mode and beacons with multiple vifs.
@ 2011-01-15  0:55     ` Steve Brown
  0 siblings, 0 replies; 26+ messages in thread
From: Steve Brown @ 2011-01-15  0:55 UTC (permalink / raw)
  To: ath9k-devel

On Sat, 2011-01-15 at 00:19 +0100, Bj?rn Smedman wrote:

> Thank you for your efforts to get multi-vifs working better.
> 
> This is another comment that is a little out of place but when I see
> the identifier beacon_interval in this context I cannot help bringing
> up per-vif settings as a related problem: If I read the code (or
> rather the lack of code) correctly the beacon interval of the last (or
> first?) beaconing vif added will be used to set up beacon tx, whereas
> the actual beacon contents will reflect the beacon intervals
> configured for individual vifs which may all be different... The same
> goes for e.g. tx queue configuration, no?
> 
> It feels like we need a general multi-vif cleanup here but it's too
> big for me unfortunately.
> 
> /Bj?rn
> _______________________________________________

For instance, an ap vif has a ~100ms interval and a mesh vif has a
~1000ms interval. I don't see how to avoid a per vif interval.

Steve

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [ath9k-devel] [RFC 1/2] ath9k: Fix up hardware mode and beacons with multiple vifs.
  2011-01-15  0:55     ` Steve Brown
@ 2011-01-15  1:20       ` Björn Smedman
  -1 siblings, 0 replies; 26+ messages in thread
From: Björn Smedman @ 2011-01-15  1:20 UTC (permalink / raw)
  To: sbrown; +Cc: greearb, ath9k-devel, linux-wireless

2011/1/15 Steve Brown <sbrown@cortland.com>:
> On Sat, 2011-01-15 at 00:19 +0100, Björn Smedman wrote:
>> This is another comment that is a little out of place but when I see
>> the identifier beacon_interval in this context I cannot help bringing
>> up per-vif settings as a related problem: If I read the code (or
>> rather the lack of code) correctly the beacon interval of the last (or
>> first?) beaconing vif added will be used to set up beacon tx, whereas
>> the actual beacon contents will reflect the beacon intervals
>> configured for individual vifs which may all be different... The same
>> goes for e.g. tx queue configuration, no?
[snip]
> For instance, an ap vif has a ~100ms interval and a mesh vif has a
> ~1000ms interval. I don't see how to avoid a per vif interval.

I agree. We should fix ath9k so it works correctly even if beacon
interval is different for different vifs (within some reasonable
limits).

In the mean time, as a workaround, try to configure the same beacon
interval for all vifs.

/Björn

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [ath9k-devel] [RFC 1/2] ath9k: Fix up hardware mode and beacons with multiple vifs.
@ 2011-01-15  1:20       ` Björn Smedman
  0 siblings, 0 replies; 26+ messages in thread
From: Björn Smedman @ 2011-01-15  1:20 UTC (permalink / raw)
  To: ath9k-devel

2011/1/15 Steve Brown <sbrown@cortland.com>:
> On Sat, 2011-01-15 at 00:19 +0100, Bj?rn Smedman wrote:
>> This is another comment that is a little out of place but when I see
>> the identifier beacon_interval in this context I cannot help bringing
>> up per-vif settings as a related problem: If I read the code (or
>> rather the lack of code) correctly the beacon interval of the last (or
>> first?) beaconing vif added will be used to set up beacon tx, whereas
>> the actual beacon contents will reflect the beacon intervals
>> configured for individual vifs which may all be different... The same
>> goes for e.g. tx queue configuration, no?
[snip]
> For instance, an ap vif has a ~100ms interval and a mesh vif has a
> ~1000ms interval. I don't see how to avoid a per vif interval.

I agree. We should fix ath9k so it works correctly even if beacon
interval is different for different vifs (within some reasonable
limits).

In the mean time, as a workaround, try to configure the same beacon
interval for all vifs.

/Bj?rn

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [ath9k-devel] [RFC 1/2] ath9k: Fix up hardware mode and beacons with multiple vifs.
  2011-01-14 18:05   ` Felix Fietkau
@ 2011-01-15  1:41     ` Björn Smedman
  -1 siblings, 0 replies; 26+ messages in thread
From: Björn Smedman @ 2011-01-15  1:41 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: greearb, linux-wireless, ath9k-devel

On Fri, Jan 14, 2011 at 7:05 PM, Felix Fietkau <nbd@openwrt.org> wrote:
> Do we really need all those counters? Wouldn't it be better to iterate over
> active interfaces instead?

I think iterating over active interfaces is better, especially if we
set up more fine-graned ah-> variables that make sense in themselves
for stuff like power save and tsf sync. But that's just my two cents.

As an example of something that may be more or less impossible to do
without iteration consider multiple vifs with different beacon
intervals. This could be handled by computing a greatest common
devisor of all beacon intervals and using this for SWBA.

/Björn

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [ath9k-devel] [RFC 1/2] ath9k: Fix up hardware mode and beacons with multiple vifs.
@ 2011-01-15  1:41     ` Björn Smedman
  0 siblings, 0 replies; 26+ messages in thread
From: Björn Smedman @ 2011-01-15  1:41 UTC (permalink / raw)
  To: ath9k-devel

On Fri, Jan 14, 2011 at 7:05 PM, Felix Fietkau <nbd@openwrt.org> wrote:
> Do we really need all those counters? Wouldn't it be better to iterate over
> active interfaces instead?

I think iterating over active interfaces is better, especially if we
set up more fine-graned ah-> variables that make sense in themselves
for stuff like power save and tsf sync. But that's just my two cents.

As an example of something that may be more or less impossible to do
without iteration consider multiple vifs with different beacon
intervals. This could be handled by computing a greatest common
devisor of all beacon intervals and using this for SWBA.

/Bj?rn

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [ath9k-devel] [RFC 1/2] ath9k: Fix up hardware mode and beacons with multiple vifs.
  2011-01-15  1:20       ` Björn Smedman
@ 2011-01-15 11:07         ` Jouni Malinen
  -1 siblings, 0 replies; 26+ messages in thread
From: Jouni Malinen @ 2011-01-15 11:07 UTC (permalink / raw)
  To: Björn Smedman; +Cc: sbrown, greearb, ath9k-devel, linux-wireless

On Sat, Jan 15, 2011 at 02:20:00AM +0100, Björn Smedman wrote:
> 2011/1/15 Steve Brown <sbrown@cortland.com>:
> > For instance, an ap vif has a ~100ms interval and a mesh vif has a
> > ~1000ms interval. I don't see how to avoid a per vif interval.
> 
> I agree. We should fix ath9k so it works correctly even if beacon
> interval is different for different vifs (within some reasonable
> limits).

Yes, up to a limit. Handling something like 100 TU on one vif and 1000
TU on another is fine, but something like 100 TU and 103 TU would need
to be forced to use the same interval. I've been thinking of adding some
kind of mechanism for the driver to override Beacon interval in such
cases (which would need to go back all the way to user space to hostapd
in case of AP mode).

-- 
Jouni Malinen                                            PGP id EFC895FA

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [ath9k-devel] [RFC 1/2] ath9k: Fix up hardware mode and beacons with multiple vifs.
@ 2011-01-15 11:07         ` Jouni Malinen
  0 siblings, 0 replies; 26+ messages in thread
From: Jouni Malinen @ 2011-01-15 11:07 UTC (permalink / raw)
  To: ath9k-devel

On Sat, Jan 15, 2011 at 02:20:00AM +0100, Bj?rn Smedman wrote:
> 2011/1/15 Steve Brown <sbrown@cortland.com>:
> > For instance, an ap vif has a ~100ms interval and a mesh vif has a
> > ~1000ms interval. I don't see how to avoid a per vif interval.
> 
> I agree. We should fix ath9k so it works correctly even if beacon
> interval is different for different vifs (within some reasonable
> limits).

Yes, up to a limit. Handling something like 100 TU on one vif and 1000
TU on another is fine, but something like 100 TU and 103 TU would need
to be forced to use the same interval. I've been thinking of adding some
kind of mechanism for the driver to override Beacon interval in such
cases (which would need to go back all the way to user space to hostapd
in case of AP mode).

-- 
Jouni Malinen                                            PGP id EFC895FA

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [ath9k-devel] [RFC 1/2] ath9k: Fix up hardware mode and beacons with multiple vifs.
  2011-01-15  1:41     ` Björn Smedman
@ 2011-01-15 14:54       ` Ben Greear
  -1 siblings, 0 replies; 26+ messages in thread
From: Ben Greear @ 2011-01-15 14:54 UTC (permalink / raw)
  To: Björn Smedman; +Cc: Felix Fietkau, linux-wireless, ath9k-devel

On 01/14/2011 05:41 PM, Björn Smedman wrote:
> On Fri, Jan 14, 2011 at 7:05 PM, Felix Fietkau<nbd@openwrt.org>  wrote:
>> Do we really need all those counters? Wouldn't it be better to iterate over
>> active interfaces instead?
>
> I think iterating over active interfaces is better, especially if we
> set up more fine-graned ah->  variables that make sense in themselves
> for stuff like power save and tsf sync. But that's just my two cents.
>
> As an example of something that may be more or less impossible to do
> without iteration consider multiple vifs with different beacon
> intervals. This could be handled by computing a greatest common
> devisor of all beacon intervals and using this for SWBA.

We already iterate when setting the bssid mask.  I could have that
method calculate the vif counts with little extra cost.  I want to avoid any more
linear iterations over the interface list if possible, so hopefully
I can re-use that one iteration and not add more...

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [ath9k-devel] [RFC 1/2] ath9k: Fix up hardware mode and beacons with multiple vifs.
@ 2011-01-15 14:54       ` Ben Greear
  0 siblings, 0 replies; 26+ messages in thread
From: Ben Greear @ 2011-01-15 14:54 UTC (permalink / raw)
  To: ath9k-devel

On 01/14/2011 05:41 PM, Bj?rn Smedman wrote:
> On Fri, Jan 14, 2011 at 7:05 PM, Felix Fietkau<nbd@openwrt.org>  wrote:
>> Do we really need all those counters? Wouldn't it be better to iterate over
>> active interfaces instead?
>
> I think iterating over active interfaces is better, especially if we
> set up more fine-graned ah->  variables that make sense in themselves
> for stuff like power save and tsf sync. But that's just my two cents.
>
> As an example of something that may be more or less impossible to do
> without iteration consider multiple vifs with different beacon
> intervals. This could be handled by computing a greatest common
> devisor of all beacon intervals and using this for SWBA.

We already iterate when setting the bssid mask.  I could have that
method calculate the vif counts with little extra cost.  I want to avoid any more
linear iterations over the interface list if possible, so hopefully
I can re-use that one iteration and not add more...

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2011-01-15 14:55 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-14 17:27 [RFC 1/2] ath9k: Fix up hardware mode and beacons with multiple vifs greearb
2011-01-14 17:27 ` [ath9k-devel] " greearb at candelatech.com
2011-01-14 17:27 ` [RFC 2/2] ath9k: Add 'misc' file to debugfs, fix queue indexes greearb
2011-01-14 17:27   ` [ath9k-devel] " greearb at candelatech.com
2011-01-14 18:05 ` [ath9k-devel] [RFC 1/2] ath9k: Fix up hardware mode and beacons with multiple vifs Felix Fietkau
2011-01-14 18:05   ` Felix Fietkau
2011-01-14 18:16   ` Ben Greear
2011-01-14 18:16     ` Ben Greear
2011-01-15  1:41   ` Björn Smedman
2011-01-15  1:41     ` Björn Smedman
2011-01-15 14:54     ` Ben Greear
2011-01-15 14:54       ` Ben Greear
2011-01-14 18:58 ` Steve Brown
2011-01-14 18:58   ` [ath9k-devel] " Steve Brown
2011-01-14 19:12   ` Ben Greear
2011-01-14 19:12     ` [ath9k-devel] " Ben Greear
2011-01-14 23:19 ` Björn Smedman
2011-01-14 23:19   ` [ath9k-devel] " Björn Smedman
2011-01-14 23:24   ` Ben Greear
2011-01-14 23:24     ` [ath9k-devel] " Ben Greear
2011-01-15  0:55   ` Steve Brown
2011-01-15  0:55     ` Steve Brown
2011-01-15  1:20     ` Björn Smedman
2011-01-15  1:20       ` Björn Smedman
2011-01-15 11:07       ` Jouni Malinen
2011-01-15 11:07         ` Jouni Malinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.