2015-02-20 14:50:24

by Taehee Yoo

[permalink] [raw]
Subject: [PATCH] rtlwifi: rtl8192cu: Fix some beacon issue

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

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

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);
--
2.1.0



2015-04-29 00:53:52

by Larry Finger

[permalink] [raw]
Subject: Re: [PATCH] rtlwifi: rtl8192cu: Fix some beacon issue

On 04/28/2015 11:40 AM, Taehee Yoo wrote:
> 2015-04-29 1:21 GMT+09:00 Kalle Valo <[email protected]>:
>> Taehee Yoo <[email protected]> writes:
>>
>>> Sometimes rtl8192cu is not sending beacon frame.
>>> This patch fix this issue.
>>>
>>> Signed-off-by: Taehee Yoo <[email protected]>
>>
>> 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



2015-04-28 16:21:18

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH] rtlwifi: rtl8192cu: Fix some beacon issue

Taehee Yoo <[email protected]> writes:

> Sometimes rtl8192cu is not sending beacon frame.
> This patch fix this issue.
>
> Signed-off-by: Taehee Yoo <[email protected]>

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

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

--
Kalle Valo

2015-04-28 16:40:38

by Taehee Yoo

[permalink] [raw]
Subject: Re: [PATCH] rtlwifi: rtl8192cu: Fix some beacon issue

2015-04-29 1:21 GMT+09:00 Kalle Valo <[email protected]>:
> Taehee Yoo <[email protected]> writes:
>
>> Sometimes rtl8192cu is not sending beacon frame.
>> This patch fix this issue.
>>
>> Signed-off-by: Taehee Yoo <[email protected]>
>
> 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.