Skip to contentSkip to conversation

rtlwifi: rtl8192cu: Fix some beacon issue

PATCH In review Taehee Yoo 4 participants 9 messages Feb 20, 2015 – Apr 29, 2015 1 message not in the archive Networking drivers (wireless)

lore
Share & tools
lore

Taehee Yoo

author
#0 lore raw

PATCH 1/1 rtlwifi: rtl8192cu: Fix some beacon issue

Sometimes rtl8192cu is not sending beacon frame.
This patch fix this issue.

---
 drivers/net/wireless/rtlwifi/rtl8192cu/hw.c  | 40 +++++++++++++---------------
 drivers/net/wireless/rtlwifi/rtl8192cu/mac.c |  1 +
 2 files changed, 19 insertions(+), 22 deletions(-)
drivers/net/wireless/rtlwifi/rtl8192cu/hw.c +18 -22
index fe4b699..5ad5429 100644
@@ -1323,39 +1323,40 @@ static int _rtl92cu_set_media_status(struct ieee80211_hw *hw,
 	enum led_ctl_mode ledaction = LED_CTL_NO_LINK;
 
 	bt_msr &= 0xfc;
-	rtl_write_byte(rtlpriv, REG_BCN_MAX_ERR, 0xFF);
-	if (type == NL80211_IFTYPE_UNSPECIFIED || type ==
-	    NL80211_IFTYPE_STATION) {
-		_rtl92cu_stop_tx_beacon(hw);
-		_rtl92cu_enable_bcn_sub_func(hw);
-	} else if (type == NL80211_IFTYPE_ADHOC || type == NL80211_IFTYPE_AP) {
-		_rtl92cu_resume_tx_beacon(hw);
-		_rtl92cu_disable_bcn_sub_func(hw);
-	} else {
-		RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
-			 "Set HW_VAR_MEDIA_STATUS:No such media status(%x)\n",
-			 type);
-	}
+	bt_msr |= type;
+	rtl_write_byte(rtlpriv, REG_BCN_CTRL,
+		       rtl_read_byte(rtlpriv, REG_BCN_CTRL)|BIT(4));
+	rtl_write_byte(rtlpriv, MSR, bt_msr);
+	rtl_write_byte(rtlpriv, REG_DUAL_TSF_RST, BIT(0));
+
 	switch (type) {
 	case NL80211_IFTYPE_UNSPECIFIED:
-		bt_msr |= MSR_NOLINK;
 		ledaction = LED_CTL_LINK;
+		_rtl92cu_stop_tx_beacon(hw);
+		rtl_write_byte(rtlpriv, REG_BCN_CTRL, 0x19);
 		RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
 			 "Set Network type to NO LINK!\n");
 		break;
 	case NL80211_IFTYPE_ADHOC:
-		bt_msr |= MSR_ADHOC;
+		_rtl92cu_resume_tx_beacon(hw);
+		rtl_write_byte(rtlpriv, REG_BCN_CTRL, 0x1a);
 		RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
 			 "Set Network type to Ad Hoc!\n");
 		break;
 	case NL80211_IFTYPE_STATION:
-		bt_msr |= MSR_INFRA;
 		ledaction = LED_CTL_LINK;
+		_rtl92cu_stop_tx_beacon(hw);
+		rtl_write_byte(rtlpriv, REG_BCN_CTRL, 0x19);
 		RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
 			 "Set Network type to STA!\n");
 		break;
 	case NL80211_IFTYPE_AP:
-		bt_msr |= MSR_AP;
+		_rtl92cu_resume_tx_beacon(hw);
+		rtl_write_dword(rtlpriv, REG_BCN_CTRL, 0x12);
+		rtl_write_word(rtlpriv, REG_BCNTCFG, 0x00);
+		rtl_write_byte(rtlpriv, REG_BCN_CTRL,
+			       (DIS_TSF_UDT0_NORMAL_CHIP|EN_BCN_FUNCTION
+				| EN_TXBCN_RPT|EN_MBSSID));
 		RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
 			 "Set Network type to AP!\n");
 		break;
@@ -1364,12 +1365,7 @@ static int _rtl92cu_set_media_status(struct ieee80211_hw *hw,
 			 "Network type %d not supported!\n", type);
 		goto error_out;
 	}
-	rtl_write_byte(rtlpriv, (MSR), bt_msr);
 	rtlpriv->cfg->ops->led_control(hw, ledaction);
-	if ((bt_msr & MSR_MASK) == MSR_AP)
-		rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x00);
-	else
-		rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x66);
 	return 0;
 error_out:
 	return 1;
drivers/net/wireless/rtlwifi/rtl8192cu/mac.c +1 -0
index 133e395..7a00e92 100644
@@ -647,6 +647,7 @@ void rtl92c_init_beacon_parameters(struct ieee80211_hw *hw,
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	struct rtl_hal *rtlhal = rtl_hal(rtlpriv);
 
+	rtl_write_word(rtlpriv, REG_BCN_CTRL, 0x1010);
 	rtl_write_word(rtlpriv, REG_TBTT_PROHIBIT, 0x6404);/* ms */
 	rtl_write_byte(rtlpriv, REG_DRVERLYINT, DRIVER_EARLY_INT_TIME);/*ms*/
 	rtl_write_byte(rtlpriv, REG_BCNDMATIM, BCN_DMA_ATIME_INT_TIME);
Signature · 1 line
2.1.0
#1 lore raw
Quoted 5 lines · Taehee Yoo

Sometimes rtl8192cu is not sending beacon frame.
This patch fix this issue.

Tried this and it doesn't help. Beacon transmission still isn't consistent. Can hostapd have an effect on this?

author
#2 lore raw

2015-02-21 1:58 GMT+09:00 Mike Turner <[email protected]>:

Quoted 11 lines
Quoted 5 lines · Taehee Yoo

Sometimes rtl8192cu is not sending beacon frame.
This patch fix this issue.

Quoted 8 lines

Tried this and it doesn't help. Beacon transmission still isn't consistent. Can hostapd have an effect on this?

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

can you tell me hostapd options and detailed situation?

A message that is not in the archive (sent off-list or not yet received): CAMArcTXL7Ydka54p6HvRvP=LvFo+w56YnMMrSuUo+PnAsy1TbQ@mail.gmail.com

#4 lore raw
Quoted 9 lines · On Fri, Feb 20, 2015 at 5:16 PM, ap420073 . <[email protected]> wrote:

can you tell me hostapd options and detailed situation? 2015-02-21 1:58 GMT+09:00 Mike Turner : > Taehee Yoo writes: > >> >> Sometimes rtl8192cu is not sending beacon frame. >> This patch fix this issue. >> >> Signed-off-by: Taehee Yoo > > > > Tried this and it doesn't help. Beacon transmission still isn't > consistent. Can hostapd have an effect on this? > > > -- > To unsubscribe from this list: send the line "unsubscribe linux-wireless" in > the body of a message to [email protected] > More majordomo info at
http://vger.kernel.org/majordomo-info.html

hostapd.conf file here

interface=wlan0
driver=nl80211
channel=3
hw_mode=g
preamble=1
dtim_period=2
beacon_int=100
logger_syslog=-1
logger_syslog_level=0
logger_stdout=-1
logger_stdout_level=0
dump_file=/tmp/hostapd.dump
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
supported_rates=60 90 120 180 240 360 480 540
basic_rates=60 90 120 180 240
ssid=SSID_SETUP3
max_num_sta=5
macaddr_acl=0
auth_algs=3
ieee80211d=0
uapsd_advertisement_enabled=1
wep_rekey_period=0
own_ip_addr=127.0.0.1
wpa_group_rekey=0
wpa_strict_rekey=0
wpa_gmk_rekey=0
wpa_ptk_rekey=0
#ap_table_max_size=255
#ap_table_expiration_time=60
eap_server=1
disassoc_low_ack=1
ap_max_inactivity=4294967295

#WPA settings
#WPA algorithm used (WPA2 in this case)
wpa=2
#AP password
wpa_passphrase=Ssid_WIT
#WPA key mangement type
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
#encription algorithm
rsn_pairwise=CCMP

Hostapd version 1.0

Atmel ARM at91sam9g25 CPU on custom designed hardware using D-link DWA-121 USB WiFi adaptor.

Test using '/etc/init.d/hostapd stop' and '/etc/init.d/hostapd start' repeatedly.
Can get multiple working cycles before a failure, and can get multiple failed cycles before correct transmission.

author
#5 lore raw

hostapd 2.3 has no problem but i found problem that hostapd is not starting in hostapd 1.0.

would you like to try testing hostapd 2.3?

2015-02-21 2:24 GMT+09:00 Mike Turner <[email protected]>:

Quoted 67 lines · On Fri, Feb 20, 2015 at 5:16 PM, ap420073 . <[email protected]> wrote:
Quoted 9 lines

can you tell me hostapd options and detailed situation? 2015-02-21 1:58 GMT+09:00 Mike Turner : > Taehee Yoo writes: > >> >> Sometimes rtl8192cu is not sending beacon frame. >> This patch fix this issue. >> >> Signed-off-by: Taehee Yoo > > > > Tried this and it doesn't help. Beacon transmission still isn't > consistent. Can hostapd have an effect on this? > > > -- > To unsubscribe from this list: send the line "unsubscribe linux-wireless" in > the body of a message to [email protected] > More majordomo info at
http://vger.kernel.org/majordomo-info.html

hostapd.conf file here

interface=wlan0
driver=nl80211
channel=3
hw_mode=g
preamble=1
dtim_period=2
beacon_int=100
logger_syslog=-1
logger_syslog_level=0
logger_stdout=-1
logger_stdout_level=0
dump_file=/tmp/hostapd.dump
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
supported_rates=60 90 120 180 240 360 480 540
basic_rates=60 90 120 180 240
ssid=SSID_SETUP3
max_num_sta=5
macaddr_acl=0
auth_algs=3
ieee80211d=0
uapsd_advertisement_enabled=1
wep_rekey_period=0
own_ip_addr=127.0.0.1
wpa_group_rekey=0
wpa_strict_rekey=0
wpa_gmk_rekey=0
wpa_ptk_rekey=0
#ap_table_max_size=255
#ap_table_expiration_time=60
eap_server=1
disassoc_low_ack=1
ap_max_inactivity=4294967295

#WPA settings
#WPA algorithm used (WPA2 in this case)
wpa=2
#AP password
wpa_passphrase=Ssid_WIT
#WPA key mangement type
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
#encription algorithm
rsn_pairwise=CCMP

Hostapd version 1.0

Atmel ARM at91sam9g25 CPU on custom designed hardware using D-link DWA-121 USB WiFi adaptor.

Test using '/etc/init.d/hostapd stop' and '/etc/init.d/hostapd start' repeatedly.
Can get multiple working cycles before a failure, and can get multiple failed cycles before correct transmission.

#6 lore raw
Quoted 5 lines · On Fri, Feb 20, 2015 at 6:47 PM, ap420073 . <[email protected]> wrote:

hostapd 2.3 has no problem but i found problem that hostapd is not starting in hostapd 1.0.

would you like to try testing hostapd 2.3?

Unfortunately v2.3 has the some problem. After a few cycles of /etc/init.d/hostapd stop and start it sometimes stops sending the beacon. Further cycles may or may not start sending beacons as per my original posts.

author
#8 lore raw

2015-04-29 1:21 GMT+09:00 Kalle Valo <[email protected]>:

Quoted 5 lines
Quoted 3 lines · Taehee Yoo

Sometimes rtl8192cu is not sending beacon frame.
This patch fix this issue.

Quoted 8 lines
Quoted 1 line

Larry, what do you think? Should I apply this?

https://patchwork.kernel.org/patch/5856761/

--
Kalle Valo

i think that it is incomplete patch.
because it can not solve Mike's problem.

Apologize about incomplete patch.

#9 lore raw
Quoted 17 lines · Taehee Yoo

2015-04-29 1:21 GMT+09:00 Kalle Valo <[email protected]>:

Quoted 5 lines
Quoted 3 lines · Taehee Yoo

Sometimes rtl8192cu is not sending beacon frame.
This patch fix this issue.

Quoted 8 lines
Quoted 1 line

Larry, what do you think? Should I apply this?

https://patchwork.kernel.org/patch/5856761/

--
Kalle Valo

Quoted 4 lines

i think that it is incomplete patch.
because it can not solve Mike's problem.

Apologize about incomplete patch.

Kalle,

I have not been able to reproduce the problem, thus I could not comment as to whether the patch actually fixed anything.

Clearly, the patch should be dropped.

Thanks,

Larry