diff mbox

rtlwifi: rtl8192cu: Fix some beacon issue

Message ID 1424443813-13634-1-git-send-email-ap420073@gmail.com (mailing list archive)
State Rejected
Delegated to: Kalle Valo
Headers show

Commit Message

Taehee Yoo Feb. 20, 2015, 2:50 p.m. UTC
Sometimes rtl8192cu is not sending beacon frame.
This patch fix this issue.

Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---
 drivers/net/wireless/rtlwifi/rtl8192cu/hw.c  | 40 +++++++++++++---------------
 drivers/net/wireless/rtlwifi/rtl8192cu/mac.c |  1 +
 2 files changed, 19 insertions(+), 22 deletions(-)

Comments

Mike Turner Feb. 20, 2015, 4:58 p.m. UTC | #1
Taehee Yoo <ap420073@...> writes:

> 
> Sometimes rtl8192cu is not sending beacon frame.
> This patch fix this issue.
> 
> Signed-off-by: Taehee Yoo <ap420073@...>



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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Taehee Yoo Feb. 20, 2015, 5:22 p.m. UTC | #2
2015-02-21 1:58 GMT+09:00 Mike Turner <miketurner.forum@gmail.com>:
>
> Taehee Yoo <ap420073@...> writes:
>
> >
> > Sometimes rtl8192cu is not sending beacon frame.
> > This patch fix this issue.
> >
> > Signed-off-by: Taehee Yoo <ap420073@...>
>
>
>
> 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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



can you tell me hostapd options and detailed situation?
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mike Turner Feb. 20, 2015, 5:24 p.m. UTC | #3
On Fri, Feb 20, 2015 at 5:16 PM, ap420073 . <ap420073@gmail.com> 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
> majordomo@vger.kernel.org > 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.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Taehee Yoo Feb. 20, 2015, 6:47 p.m. UTC | #4
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 <miketurner.forum@gmail.com>:
> On Fri, Feb 20, 2015 at 5:16 PM, ap420073 . <ap420073@gmail.com> 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
>> majordomo@vger.kernel.org > 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.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mike Turner Feb. 23, 2015, 2:15 p.m. UTC | #5
On Fri, Feb 20, 2015 at 6:47 PM, ap420073 . <ap420073@gmail.com> 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.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kalle Valo April 28, 2015, 4:21 p.m. UTC | #6
Taehee Yoo <ap420073@gmail.com> writes:

> Sometimes rtl8192cu is not sending beacon frame.
> This patch fix this issue.
>
> Signed-off-by: Taehee Yoo <ap420073@gmail.com>

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

https://patchwork.kernel.org/patch/5856761/
Taehee Yoo April 28, 2015, 4:40 p.m. UTC | #7
2015-04-29 1:21 GMT+09:00 Kalle Valo <kvalo@codeaurora.org>:
> Taehee Yoo <ap420073@gmail.com> writes:
>
>> Sometimes rtl8192cu is not sending beacon frame.
>> This patch fix this issue.
>>
>> Signed-off-by: Taehee Yoo <ap420073@gmail.com>
>
> 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.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Larry Finger April 29, 2015, 12:53 a.m. UTC | #8
On 04/28/2015 11:40 AM, Taehee Yoo wrote:
> 2015-04-29 1:21 GMT+09:00 Kalle Valo <kvalo@codeaurora.org>:
>> Taehee Yoo <ap420073@gmail.com> writes:
>>
>>> Sometimes rtl8192cu is not sending beacon frame.
>>> This patch fix this issue.
>>>
>>> Signed-off-by: Taehee Yoo <ap420073@gmail.com>
>>
>> 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.

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


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

Patch

diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
index fe4b699..5ad5429 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
@@ -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;
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c b/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c
index 133e395..7a00e92 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c
@@ -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);