Skip to contentSkip to conversation

rtl8192cu beacon fix unreliable

DISCUSSION Mike Turner 2 participants 4 messages Feb 13, 2015 – Feb 20, 2015 1 message not in the archive Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

When using hostapd and an rtl8192cu Wireless USB adaptor the beacon doesn't start sometimes. This was tested with the

kernel/git/davem/net-next.git repository

and

3423eb92315865d76cb8d488513bfef6ab9251d0

This behaviour is apparently random. If the beacon starts OK then it continues. If a beacon isn't generated then it never starts. Repeating cycles of hostapd stop/start may or may not generate a beacon. There are no specific error messages displayed either on console or in syslog. I have repeated hostapd stop/start a number of consecutive times and received a beacon each time, however I have also done this a number of times and never generated a beacon.

We have succesfully used the pvaret-rtl8192cu driver which is based on the vendor driver and used that in conjunction with the modified hostapd code that requires use of the rtl871xdrv driver interface and as far as we have seen it always generates a beacon.

Platform is a custom designed Atmel-ARM CPU (AT91SAM9G25) with a D-Link DWA-121.

#1 lore raw
Quoted 17 lines · Mike Turner

When using hostapd and an rtl8192cu Wireless USB adaptor the beacon doesn't start sometimes. This was tested with the

kernel/git/davem/net-next.git repository

and

3423eb92315865d76cb8d488513bfef6ab9251d0

This behaviour is apparently random. If the beacon starts OK then it continues. If a beacon isn't generated then it never starts. Repeating cycles of hostapd stop/start may or may not generate a beacon. There are no specific error messages displayed either on console or in syslog. I have repeated hostapd stop/start a number of consecutive times and received a beacon each time, however I have also done this a number of times and never generated a beacon.

Quoted 7 lines

We have succesfully used the pvaret-rtl8192cu driver which is based on the vendor driver and used that in conjunction with the modified hostapd code that requires use of the rtl871xdrv driver interface and as far as we have seen it always generates a beacon.

Platform is a custom designed Atmel-ARM CPU (AT91SAM9G25) with a D-Link DWA-121.

Is send_beacon_frame() being called even when the beacon fails to start? Adding a pr_info() at the start of the routine should answer that question.

Larry

#3 lore raw
In reply to a message not in the archive
Quoted 8 lines · Mike Turner

Sorry,

I know personal replies aren't liked, however couldn't see how to send a reply to your reply to my original post. (if you can tell me how to do that then I will in future)

Anyway, I had already checked the send_beacon_frame() call and it gets called whether or not the beacon starts.

If you use the web interface at Gmail, you can enable "reply all" in Settings=>Settings.

One other thing. Most mailing lists prefer bottom, not top, posting. That way you can read the thread in chronological order.

There must be some kind of race condition that sometimes makes the beacon start fail. Please try the attached patch to see if it helps.

Larry

drivers/net/wireless/rtlwifi/core.c +3 -3
Index: wireless-drivers/drivers/net/wireless/rtlwifi/core.c
===================================================================
@@ -1010,8 +1010,7 @@ static int rtl_op_conf_tx(struct ieee802
 	return 0;
 }
 
-static void send_beacon_frame(struct ieee80211_hw *hw,
-			      struct ieee80211_vif *vif)
+void rtl_send_beacon_frame(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	struct sk_buff *skb = ieee80211_beacon_get(hw, vif);
@@ -1019,6 +1018,7 @@ static void send_beacon_frame(struct iee
 	if (skb)
 		rtlpriv->intf_ops->adapter_tx(hw, NULL, skb, NULL);
 }
+EXPORT_SYMBOL(rtl_send_beacon_frame);
 
 static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
 				    struct ieee80211_vif *vif,
@@ -1050,7 +1050,7 @@ static void rtl_op_bss_info_changed(stru
 
 				if (rtlpriv->cfg->ops->linked_set_reg)
 					rtlpriv->cfg->ops->linked_set_reg(hw);
-				send_beacon_frame(hw, vif);
+				rtl_send_beacon_frame(hw, vif);
 			}
 		}
 		if ((changed & BSS_CHANGED_BEACON_ENABLED &&
drivers/net/wireless/rtlwifi/core.h +1 -0
Index: wireless-drivers/drivers/net/wireless/rtlwifi/core.h
===================================================================
@@ -85,5 +85,6 @@ void rtl_bb_delay(struct ieee80211_hw *h
 bool rtl_cmd_send_packet(struct ieee80211_hw *hw, struct sk_buff *skb);
 bool rtl_btc_status_false(void);
 void rtl_dm_diginit(struct ieee80211_hw *hw, u32 cur_igval);
+void rtl_send_beacon_frame(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
 
 #endif
drivers/net/wireless/rtlwifi/rtl8192cu/hw.c +2 -0
Index: wireless-drivers/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
===================================================================
@@ -30,6 +30,7 @@
 #include "../wifi.h"
 #include "../efuse.h"
 #include "../base.h"
+#include "../core.h"
 #include "../cam.h"
 #include "../ps.h"
 #include "../usb.h"
@@ -1529,6 +1530,7 @@ void rtl92cu_set_beacon_interval(struct
 	RT_TRACE(rtlpriv, COMP_BEACON, DBG_DMESG, "beacon_interval:%d\n",
 		 bcn_interval);
 	rtl_write_word(rtlpriv, REG_BCN_INTERVAL, bcn_interval);
+	rtl_send_beacon_frame(hw, mac->vif);
 }
 
 void rtl92cu_update_interrupt_mask(struct ieee80211_hw *hw,
#4 lore raw
In reply to Larry Finger
Quoted 24 lines · Larry Finger
Quoted 23 lines · Mike Turner

When using hostapd and an rtl8192cu Wireless USB adaptor the beacon doesn't start sometimes. This was tested with the

kernel/git/davem/net-next.git repository

and

3423eb92315865d76cb8d488513bfef6ab9251d0

This behaviour is apparently random. If the beacon starts OK then it continues. If a beacon isn't generated then it never starts. Repeating cycles of hostapd stop/start may or may not generate a beacon. There are no specific error messages displayed either on console or in syslog. I have repeated hostapd stop/start a number of consecutive times and received a beacon each time, however I have also done this a number of times and never generated a beacon.

We have succesfully used the pvaret-rtl8192cu driver which is based on the vendor driver and used that in conjunction with the modified hostapd code that requires use of the rtl871xdrv driver interface and as far as we have seen it always generates a beacon.

Quoted 10 lines
Quoted 2 lines

Platform is a custom designed Atmel-ARM CPU (AT91SAM9G25) with a D-Link DWA-121.

Is send_beacon_frame() being called even when the beacon fails to start? Adding a pr_info() at the start of the routine should answer that question.

Larry

Just tried your patch, however it failed on the 3rd restart - this is a resend as it bounced from linux-wireless previously due to content type.