Skip to contentSkip to conversation

ath9k: Add sanity check for beacon_int in adhoc/mesh case

PATCH In review Jouni Malinen 3 participants 4 messages May 28, 2009 – Jun 1, 2009 Qualcomm Atheros ATH9K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ath9k: Add sanity check for beacon_int in adhoc/mesh case

It looks like mac80211 can request the driver to start beaconing with a beacon interval of zero in some cases (at least for mesh point). This does not sound correct and something may need to be fixed in mac80211. However, taken into account the unpleasantness of getting stuck in an infinite busy loop with rtnl_lock held, let's add a quick workaround in the driver to avoid the worst symptom while someone more familiar with the mesh implementation can figure out what should be done with mac80211 as far as beacon interval configuration is concerned.

---
 drivers/net/wireless/ath/ath9k/beacon.c |    8 ++++++++
 1 file changed, 8 insertions(+)
drivers/net/wireless/ath/ath9k/beacon.c +8 -0
@@ -673,6 +673,14 @@ static void ath_beacon_config_adhoc(stru
 
 	intval = conf->beacon_interval & ATH9K_BEACON_PERIOD;
 
+	/*
+	 * It looks like mac80211 may end up using beacon interval of zero in
+	 * some cases (at least for mesh point). Avoid getting into an
+	 * infinite loop by using a bit safer value instead..
+	 */
+	if (intval == 0)
+		intval = 100;
+
 	/* Pull nexttbtt forward to reflect the current TSF */
 
 	nexttbtt = TSF_TO_TU(sc->beacon.bc_tstamp >> 32, sc->beacon.bc_tstamp);
Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA
#1 lore raw

drivers/net/wireless/ath/ath9k/beacon.c static void ath_beacon_config_adhoc(stru · line 682

Quoted 7 lines · Jouni Malinen
drivers/net/wireless/ath/ath9k/beacon.c +7 -0
+	/*
+	 * It looks like mac80211 may end up using beacon interval of zero in
+	 * some cases (at least for mesh point). Avoid getting into an
+	 * infinite loop by using a bit safer value instead..
+	 */
+	if (intval == 0)
+		intval = 100;

Maybe a big fat warning here would help with debugging the issue?

Signature · 1 line
Kalle Valo
#2 lore raw
Quoted 11 lines · Kalle Valo

drivers/net/wireless/ath/ath9k/beacon.c static void ath_beacon_config_adhoc(stru · line 682

Quoted 7 lines · Jouni Malinen
drivers/net/wireless/ath/ath9k/beacon.c +7 -0
+     /*
+      * It looks like mac80211 may end up using beacon interval of zero in
+      * some cases (at least for mesh point). Avoid getting into an
+      * infinite loop by using a bit safer value instead..
+      */
+     if (intval == 0)
+             intval = 100;

Maybe a big fat warning here would help with debugging the issue?

If we agree that this should never happen, such a thing could be added. Though, it would probably be better to place that in mac80211 so that it would catch the issue with any driver. The beacon_int=0 notification is not really in any way specific to ath9k; only this workaround for driver behavior is.

- Jouni

#3 lore raw
Quoted 11 lines · Jouni Malinen
Quoted 10 lines · Kalle Valo
Quoted 7 lines · Jouni Malinen
drivers/net/wireless/ath/ath9k/beacon.c +7 -0
+     /*
+      * It looks like mac80211 may end up using beacon interval of zero in
+      * some cases (at least for mesh point). Avoid getting into an
+      * infinite loop by using a bit safer value instead..
+      */
+     if (intval == 0)
+             intval = 100;
Quoted 7 lines
Quoted 1 line

Maybe a big fat warning here would help with debugging the issue?

If we agree that this should never happen, such a thing could be added. Though, it would probably be better to place that in mac80211 so that it would catch the issue with any driver. The beacon_int=0 notification is not really in any way specific to ath9k; only this workaround for driver behavior is.

Has anyone identified why this happens? :) I'm not particularly happy with the mesh configuration code anyway, but this is a stupid thing that should be trivial to fix.

johannes