Skip to contentSkip to conversation

mwifiex: toggle carrier state in start_ap/stop_ap.

PATCH Applied Amitkumar Karwar 2 participants 2 messages Oct 26, 2015 – Oct 28, 2015 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mwifiex: toggle carrier state in start_ap/stop_ap.

From: Marty Faltesek <[email protected]>

In uap mode the carrier is not enabled until after the first STA joins. The carrier triggers the bridge to start its state machine, and if STP is enabled, it takes 4 seconds as it transitions from disabled to forwarding. During this time the bridge drops all traffic, and the EAPOL handshake times out after 3 seconds, preventing stations from joining.

Follow the logic used in mac80211 and start the carrier in start_ap and disable it in stop_ap. This has a nice benefit of allowing the first station connection time to be reduced by up to 75% when STP is in use.

---
v2: Move only netdev queue status change code to start/stop AP handlers. Discarded other changes in v1 which had side effects (Avinash Patil)

---
 drivers/net/wireless/mwifiex/cfg80211.c  | 8 ++++++++
 drivers/net/wireless/mwifiex/uap_event.c | 7 -------
 2 files changed, 8 insertions(+), 7 deletions(-)
drivers/net/wireless/mwifiex/cfg80211.c +8 -0
index b7ac45f..4073116 100644
@@ -1821,6 +1821,10 @@ static int mwifiex_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *dev)
 		return -1;
 	}
 
+	if (netif_carrier_ok(priv->netdev))
+		netif_carrier_off(priv->netdev);
+	mwifiex_stop_net_dev_queue(priv->netdev, priv->adapter);
+
 	return 0;
 }
 
@@ -1925,6 +1929,10 @@ static int mwifiex_cfg80211_start_ap(struct wiphy *wiphy,
 	if (mwifiex_set_mgmt_ies(priv, &params->beacon))
 		return -1;
 
+	if (!netif_carrier_ok(priv->netdev))
+		netif_carrier_on(priv->netdev);
+	mwifiex_wake_up_net_dev_queue(priv->netdev, priv->adapter);
+
 	memcpy(&priv->bss_cfg, bss_cfg, sizeof(priv->bss_cfg));
 	kfree(bss_cfg);
 	return 0;
drivers/net/wireless/mwifiex/uap_event.c +0 -7
index 078834c..86ff542 100644
@@ -179,19 +179,12 @@ int mwifiex_process_uap_event(struct mwifiex_private *priv)
 	case EVENT_UAP_BSS_IDLE:
 		priv->media_connected = false;
 		priv->port_open = false;
-		if (netif_carrier_ok(priv->netdev))
-			netif_carrier_off(priv->netdev);
-		mwifiex_stop_net_dev_queue(priv->netdev, adapter);
-
 		mwifiex_clean_txrx(priv);
 		mwifiex_del_all_sta_list(priv);
 		break;
 	case EVENT_UAP_BSS_ACTIVE:
 		priv->media_connected = true;
 		priv->port_open = true;
-		if (!netif_carrier_ok(priv->netdev))
-			netif_carrier_on(priv->netdev);
-		mwifiex_wake_up_net_dev_queue(priv->netdev, adapter);
 		break;
 	case EVENT_UAP_BSS_START:
 		mwifiex_dbg(adapter, EVENT,
Signature · 1 line
1.8.1.4
Applied
#1 lore raw
Quoted 9 lines

From: Marty Faltesek <[email protected]>

In uap mode the carrier is not enabled until after the first STA joins. The carrier triggers the bridge to start its state machine, and if STP is enabled, it takes 4 seconds as it transitions from disabled to forwarding. During this time the bridge drops all traffic, and the EAPOL handshake times out after 3 seconds, preventing stations from joining.

Quoted 7 lines

Follow the logic used in mac80211 and start the carrier in start_ap and disable it in stop_ap. This has a nice benefit of allowing the first station connection time to be reduced by up to 75% when STP is in use.

Thanks, applied to wireless-drivers-next.git.

Kalle Valo