linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Fwd: Realtek 8192CU not working
       [not found] <CALvqYaTZrtSsP9GQzH4B988KjPg+LRCcyREKZ1zkjoaEDKPHNA@mail.gmail.com>
@ 2013-04-24 14:16 ` Michael Stahn
  2013-04-24 14:49   ` Larry Finger
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Stahn @ 2013-04-24 14:16 UTC (permalink / raw)
  To: linux-wireless

Hi,

I just checked out the 3.7.10-Kernel driver for the wireless Adapter
EW 7811Un 802.11n, ID 7392:7811 and it doesn't work: The driver gets
loaded but some IRQ-errors show up. Using the original driver doesn't
work either 1) driver needs patching for new kernel-API 2) Patched
Driver gets loaded but USB directly suspends and the device seems to
shut down permanently (ifconfig wlan0 up leads to error). I can't
paste any traces now but perhaps these problems can be confirmed after
all.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Fwd: Realtek 8192CU not working
  2013-04-24 14:16 ` Fwd: Realtek 8192CU not working Michael Stahn
@ 2013-04-24 14:49   ` Larry Finger
       [not found]     ` <CALvqYaQt+nL-PxSeEUNpsG9SWV+--S64ksr1UR+8TPg5dVPKXA@mail.gmail.com>
  0 siblings, 1 reply; 10+ messages in thread
From: Larry Finger @ 2013-04-24 14:49 UTC (permalink / raw)
  To: Michael Stahn; +Cc: linux-wireless

On 04/24/2013 09:16 AM, Michael Stahn wrote:
> Hi,
>
> I just checked out the 3.7.10-Kernel driver for the wireless Adapter
> EW 7811Un 802.11n, ID 7392:7811 and it doesn't work: The driver gets
> loaded but some IRQ-errors show up. Using the original driver doesn't
> work either 1) driver needs patching for new kernel-API 2) Patched
> Driver gets loaded but USB directly suspends and the device seems to
> shut down permanently (ifconfig wlan0 up leads to error). I can't
> paste any traces now but perhaps these problems can be confirmed after
> all.

Without the error traces, there is little I can do.

Larry



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Fwd: Realtek 8192CU not working
       [not found]     ` <CALvqYaQt+nL-PxSeEUNpsG9SWV+--S64ksr1UR+8TPg5dVPKXA@mail.gmail.com>
@ 2013-04-24 16:47       ` Larry Finger
  2013-04-24 17:19         ` Michael Stahn
  0 siblings, 1 reply; 10+ messages in thread
From: Larry Finger @ 2013-04-24 16:47 UTC (permalink / raw)
  To: Michael Stahn; +Cc: linux-wireless

On 04/24/2013 11:20 AM, Michael Stahn wrote:
> I've just recompiled the kernel and executed the following procedure:
> modprobe rtl8192cu -> plugin in Wlan-Stick -> connect wlan via
> Networkmanager (no connection was established, credentials are
> correct) -> unplug Stick. Attachment contains the dmes-output.

Please do not drop the Cc to the Linux wireless mailing list unless you are 
requested to send something of a sensitive nature. Always use "Reply to all".

[  448.211707] rtl8192cu: MAC auto ON okay!
[  448.248820] rtl8192cu: Tx queue select: 0x05
[  448.615206] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[  464.990166] ehci_hcd 0000:00:16.2: detected XactErr len 0/15360 retry 1
[  464.990540] ehci_hcd 0000:00:16.2: detected XactErr len 0/15360 retry 2
[  464.990613] hub 3-0:1.0: state 7 ports 4 chg 0000 evt 0004
[  464.990642] ehci_hcd 0000:00:16.2: GetStatus port:2 status 001002 0  ACK 
POWER sig=se0 CSC
[  464.990661] hub 3-0:1.0: port 2, status 0100, change 0001, 12 Mb/s
[  464.990672] usb 3-2: USB disconnect, device number 3

That error is something in the USB hub driver. What is your architecture?

To get a little more detail, please rebuild your kernel with CONFIG_USB_DEBUG 
set and post the full log on some paste site. I will likely need to have the 
help of the USB expert on this matter, but we need more details first.

Larry


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Fwd: Realtek 8192CU not working
  2013-04-24 16:47       ` Larry Finger
@ 2013-04-24 17:19         ` Michael Stahn
  2013-04-24 17:27           ` Michael Stahn
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Stahn @ 2013-04-24 17:19 UTC (permalink / raw)
  To: Larry Finger; +Cc: linux-wireless

I'm using a i686 Architecture on AMD E2-1800 APU with Radeon(tm) HD
Graphics AuthenticAMD GNU/Linux with linux 3.7.10. CONFIG_USB_DEBUG
was allready set. I've used an USB 3.0 port previously and now
rechecked everything with a USB2.0 port. The result is nearly the
same: first connection succeeds (ping response), doing a manual
reconnect to the AP leads to the same error. I've done several
ifconfig down/ups at the end with no change.
dmesg gives: http://bpaste.net/show/93912/

2013/4/24 Larry Finger <Larry.Finger@lwfinger.net>:
> On 04/24/2013 11:20 AM, Michael Stahn wrote:
>>
>> I've just recompiled the kernel and executed the following procedure:
>> modprobe rtl8192cu -> plugin in Wlan-Stick -> connect wlan via
>> Networkmanager (no connection was established, credentials are
>> correct) -> unplug Stick. Attachment contains the dmes-output.
>
>
> Please do not drop the Cc to the Linux wireless mailing list unless you are
> requested to send something of a sensitive nature. Always use "Reply to
> all".
>
> [  448.211707] rtl8192cu: MAC auto ON okay!
> [  448.248820] rtl8192cu: Tx queue select: 0x05
> [  448.615206] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
> [  464.990166] ehci_hcd 0000:00:16.2: detected XactErr len 0/15360 retry 1
> [  464.990540] ehci_hcd 0000:00:16.2: detected XactErr len 0/15360 retry 2
> [  464.990613] hub 3-0:1.0: state 7 ports 4 chg 0000 evt 0004
> [  464.990642] ehci_hcd 0000:00:16.2: GetStatus port:2 status 001002 0  ACK
> POWER sig=se0 CSC
> [  464.990661] hub 3-0:1.0: port 2, status 0100, change 0001, 12 Mb/s
> [  464.990672] usb 3-2: USB disconnect, device number 3
>
> That error is something in the USB hub driver. What is your architecture?
>
> To get a little more detail, please rebuild your kernel with
> CONFIG_USB_DEBUG set and post the full log on some paste site. I will likely
> need to have the help of the USB expert on this matter, but we need more
> details first.
>
> Larry
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Fwd: Realtek 8192CU not working
  2013-04-24 17:19         ` Michael Stahn
@ 2013-04-24 17:27           ` Michael Stahn
  2013-04-24 17:42             ` Larry Finger
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Stahn @ 2013-04-24 17:27 UTC (permalink / raw)
  To: Larry Finger; +Cc: linux-wireless

okay now it gets a little awkward: un/reloading the driver seems to
fix the authentication-problem (ip gets assigned), but no ping
succeeds..
http://bpaste.net/show/93913/

2013/4/24 Michael Stahn <michael.stahn.42@gmail.com>:
> I'm using a i686 Architecture on AMD E2-1800 APU with Radeon(tm) HD
> Graphics AuthenticAMD GNU/Linux with linux 3.7.10. CONFIG_USB_DEBUG
> was allready set. I've used an USB 3.0 port previously and now
> rechecked everything with a USB2.0 port. The result is nearly the
> same: first connection succeeds (ping response), doing a manual
> reconnect to the AP leads to the same error. I've done several
> ifconfig down/ups at the end with no change.
> dmesg gives: http://bpaste.net/show/93912/
>
> 2013/4/24 Larry Finger <Larry.Finger@lwfinger.net>:
>> On 04/24/2013 11:20 AM, Michael Stahn wrote:
>>>
>>> I've just recompiled the kernel and executed the following procedure:
>>> modprobe rtl8192cu -> plugin in Wlan-Stick -> connect wlan via
>>> Networkmanager (no connection was established, credentials are
>>> correct) -> unplug Stick. Attachment contains the dmes-output.
>>
>>
>> Please do not drop the Cc to the Linux wireless mailing list unless you are
>> requested to send something of a sensitive nature. Always use "Reply to
>> all".
>>
>> [  448.211707] rtl8192cu: MAC auto ON okay!
>> [  448.248820] rtl8192cu: Tx queue select: 0x05
>> [  448.615206] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
>> [  464.990166] ehci_hcd 0000:00:16.2: detected XactErr len 0/15360 retry 1
>> [  464.990540] ehci_hcd 0000:00:16.2: detected XactErr len 0/15360 retry 2
>> [  464.990613] hub 3-0:1.0: state 7 ports 4 chg 0000 evt 0004
>> [  464.990642] ehci_hcd 0000:00:16.2: GetStatus port:2 status 001002 0  ACK
>> POWER sig=se0 CSC
>> [  464.990661] hub 3-0:1.0: port 2, status 0100, change 0001, 12 Mb/s
>> [  464.990672] usb 3-2: USB disconnect, device number 3
>>
>> That error is something in the USB hub driver. What is your architecture?
>>
>> To get a little more detail, please rebuild your kernel with
>> CONFIG_USB_DEBUG set and post the full log on some paste site. I will likely
>> need to have the help of the USB expert on this matter, but we need more
>> details first.
>>
>> Larry
>>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Fwd: Realtek 8192CU not working
  2013-04-24 17:27           ` Michael Stahn
@ 2013-04-24 17:42             ` Larry Finger
       [not found]               ` <CALvqYaQTQ5=ER=F1-bxnJQKkFjrg6UH+1JWLexUPVZ3cFBG5UQ@mail.gmail.com>
  0 siblings, 1 reply; 10+ messages in thread
From: Larry Finger @ 2013-04-24 17:42 UTC (permalink / raw)
  To: Michael Stahn; +Cc: linux-wireless

On 04/24/2013 12:27 PM, Michael Stahn wrote:
> okay now it gets a little awkward: un/reloading the driver seems to
> fix the authentication-problem (ip gets assigned), but no ping
> succeeds..
> http://bpaste.net/show/93913/
>
> 2013/4/24 Michael Stahn <michael.stahn.42@gmail.com>:
>> I'm using a i686 Architecture on AMD E2-1800 APU with Radeon(tm) HD
>> Graphics AuthenticAMD GNU/Linux with linux 3.7.10. CONFIG_USB_DEBUG
>> was allready set. I've used an USB 3.0 port previously and now
>> rechecked everything with a USB2.0 port. The result is nearly the
>> same: first connection succeeds (ping response), doing a manual
>> reconnect to the AP leads to the same error. I've done several
>> ifconfig down/ups at the end with no change.
>> dmesg gives: http://bpaste.net/show/93912/

To be able to work on the error messages from ehci-hcd, it is likely that we 
will need all the messages associated with the initialization of the hub. That 
is the reason that I asked that you post the entire dmesg output, starting at 
time 0.

What encryption are you using?

Larry



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Fwd: Realtek 8192CU not working
       [not found]                 ` <51786303.3070107@lwfinger.net>
@ 2013-04-24 23:08                   ` Michael Stahn
  2013-04-24 23:18                     ` Larry Finger
  2013-04-25 23:08                     ` Larry Finger
  0 siblings, 2 replies; 10+ messages in thread
From: Michael Stahn @ 2013-04-24 23:08 UTC (permalink / raw)
  To: Larry Finger, linux-wireless

This kind of error doesn't seem to show up on the USB 2.0 interface. I
just configured the AP for WPA+TKIP but no change. Now the Adapter
won't connect anymore even I reload the module..pretty random error.
I'll try some other ideas in the next days...

2013/4/25 Larry Finger <Larry.Finger@lwfinger.net>:
> On 04/24/2013 05:24 PM, Michael Stahn wrote:
>>
>> I'm using WPA/PSK, attached is the whole kernel dump.
>>
>
> I don't see the "ehci_hcd 0000:00:16.2: detected XactErr len 0/15360 retry
> 1" problem in this dump.
>
> If you are just having trouble connecting, there is an unknown problem. The
> driver can connect with WPA2, but not WPA.
>
> Larry
>
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Fwd: Realtek 8192CU not working
  2013-04-24 23:08                   ` Michael Stahn
@ 2013-04-24 23:18                     ` Larry Finger
  2013-04-25 23:08                     ` Larry Finger
  1 sibling, 0 replies; 10+ messages in thread
From: Larry Finger @ 2013-04-24 23:18 UTC (permalink / raw)
  To: Michael Stahn; +Cc: linux-wireless

On 04/24/2013 06:08 PM, Michael Stahn wrote:
> This kind of error doesn't seem to show up on the USB 2.0 interface. I
> just configured the AP for WPA+TKIP but no change. Now the Adapter
> won't connect anymore even I reload the module..pretty random error.
> I'll try some other ideas in the next days...

OK, the USB3.0 error is a different matter. You should report that on the USB 
mailing list.

You need WPA2-AES/CCMP encryption for it to work. I'm looking into that problem now.

Larry



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Fwd: Realtek 8192CU not working
  2013-04-24 23:08                   ` Michael Stahn
  2013-04-24 23:18                     ` Larry Finger
@ 2013-04-25 23:08                     ` Larry Finger
  2013-04-26 10:42                       ` Michael Stahn
  1 sibling, 1 reply; 10+ messages in thread
From: Larry Finger @ 2013-04-25 23:08 UTC (permalink / raw)
  To: Michael Stahn; +Cc: linux-wireless

[-- Attachment #1: Type: text/plain, Size: 423 bytes --]

On 04/24/2013 06:08 PM, Michael Stahn wrote:
> This kind of error doesn't seem to show up on the USB 2.0 interface. I
> just configured the AP for WPA+TKIP but no change. Now the Adapter
> won't connect anymore even I reload the module..pretty random error.
> I'll try some other ideas in the next days...

I found some problems today. With the attached patched, my device connects to 
WEP, WPA and WPA2 networks.

Larry



[-- Attachment #2: rtl8192cu_fix_WPA_WEP --]
[-- Type: text/plain, Size: 11539 bytes --]

Index: wireless-testing-save/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c
===================================================================
--- wireless-testing-save.orig/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c
+++ wireless-testing-save/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c
@@ -289,14 +289,30 @@ void rtl92c_set_key(struct ieee80211_hw
 				macaddr = cam_const_broad;
 				entry_id = key_index;
 			} else {
+				if (mac->opmode == NL80211_IFTYPE_AP ||
+				    mac->opmode == NL80211_IFTYPE_MESH_POINT) {
+					entry_id = rtl_cam_get_free_entry(hw,
+								 p_macaddr);
+					if (entry_id >=  TOTAL_CAM_ENTRY) {
+						RT_TRACE(rtlpriv, COMP_SEC,
+							 DBG_EMERG,
+							 "Can not find free hw security cam entry\n");
+						return;
+					}
+				} else {
+					entry_id = CAM_PAIRWISE_KEY_POSITION;
+				}
+
 				key_index = PAIRWISE_KEYIDX;
-				entry_id = CAM_PAIRWISE_KEY_POSITION;
 				is_pairwise = true;
 			}
 		}
 		if (rtlpriv->sec.key_len[key_index] == 0) {
 			RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG,
 				 "delete one entry\n");
+			if (mac->opmode == NL80211_IFTYPE_AP ||
+			    mac->opmode == NL80211_IFTYPE_MESH_POINT)
+				rtl_cam_del_entry(hw, p_macaddr);
 			rtl_cam_delete_one_entry(hw, p_macaddr, entry_id);
 		} else {
 			RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD,
Index: wireless-testing-save/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
===================================================================
--- wireless-testing-save.orig/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
+++ wireless-testing-save/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
@@ -896,7 +896,7 @@ void rtl92cu_enable_hw_security_config(s
 	u8 sec_reg_value = 0x0;
 	struct rtl_hal *rtlhal = rtl_hal(rtlpriv);
 
-	RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
+	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
 		 "PairwiseEncAlgorithm = %d GroupEncAlgorithm = %d\n",
 		 rtlpriv->sec.pairwise_enc_algorithm,
 		 rtlpriv->sec.group_enc_algorithm);
@@ -913,7 +913,7 @@ void rtl92cu_enable_hw_security_config(s
 	if (IS_NORMAL_CHIP(rtlhal->version))
 		sec_reg_value |= (SCR_RXBCUSEDK | SCR_TXBCUSEDK);
 	rtl_write_byte(rtlpriv, REG_CR + 1, 0x02);
-	RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, "The SECR-value %x\n",
+	RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, "The SECR-value %x\n",
 		 sec_reg_value);
 	rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_WPA_CONFIG, &sec_reg_value);
 }
@@ -1973,26 +1973,35 @@ void rtl92cu_set_hw_reg(struct ieee80211
 	}
 }
 
-void rtl92cu_update_hal_rate_table(struct ieee80211_hw *hw,
-				   struct ieee80211_sta *sta,
-				   u8 rssi_level)
+static void rtl92cu_update_hal_rate_table(struct ieee80211_hw *hw,
+					  struct ieee80211_sta *sta)
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	struct rtl_phy *rtlphy = &(rtlpriv->phy);
 	struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
-	u32 ratr_value = (u32) mac->basic_rates;
-	u8 *mcsrate = mac->mcs;
+	struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
+	u32 ratr_value;
 	u8 ratr_index = 0;
 	u8 nmode = mac->ht_enable;
-	u8 mimo_ps = 1;
-	u16 shortgi_rate = 0;
-	u32 tmp_ratr_value = 0;
+	u8 mimo_ps = IEEE80211_SMPS_OFF;
+	u16 shortgi_rate;
+	u32 tmp_ratr_value;
 	u8 curtxbw_40mhz = mac->bw_40;
-	u8 curshortgi_40mhz = mac->sgi_40;
-	u8 curshortgi_20mhz = mac->sgi_20;
+	u8 curshortgi_40mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40) ?
+			       1 : 0;
+	u8 curshortgi_20mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20) ?
+			       1 : 0;
 	enum wireless_mode wirelessmode = mac->mode;
 
-	ratr_value |= ((*(u16 *) (mcsrate))) << 12;
+	if (rtlhal->current_bandtype == BAND_ON_5G)
+		ratr_value = sta->supp_rates[1] << 4;
+	else
+		ratr_value = sta->supp_rates[0];
+	if (mac->opmode == NL80211_IFTYPE_ADHOC)
+		ratr_value = 0xfff;
+
+	ratr_value |= (sta->ht_cap.mcs.rx_mask[1] << 20 |
+			sta->ht_cap.mcs.rx_mask[0] << 12);
 	switch (wirelessmode) {
 	case WIRELESS_MODE_B:
 		if (ratr_value & 0x0000000c)
@@ -2006,7 +2015,7 @@ void rtl92cu_update_hal_rate_table(struc
 	case WIRELESS_MODE_N_24G:
 	case WIRELESS_MODE_N_5G:
 		nmode = 1;
-		if (mimo_ps == 0) {
+		if (mimo_ps == IEEE80211_SMPS_STATIC) {
 			ratr_value &= 0x0007F005;
 		} else {
 			u32 ratr_mask;
@@ -2016,8 +2025,7 @@ void rtl92cu_update_hal_rate_table(struc
 				ratr_mask = 0x000ff005;
 			else
 				ratr_mask = 0x0f0ff005;
-			if (curtxbw_40mhz)
-				ratr_mask |= 0x00000010;
+
 			ratr_value &= ratr_mask;
 		}
 		break;
@@ -2026,41 +2034,74 @@ void rtl92cu_update_hal_rate_table(struc
 			ratr_value &= 0x000ff0ff;
 		else
 			ratr_value &= 0x0f0ff0ff;
+
 		break;
 	}
+
 	ratr_value &= 0x0FFFFFFF;
-	if (nmode && ((curtxbw_40mhz && curshortgi_40mhz) ||
-	    (!curtxbw_40mhz && curshortgi_20mhz))) {
+
+	if (nmode && ((curtxbw_40mhz &&
+			 curshortgi_40mhz) || (!curtxbw_40mhz &&
+					       curshortgi_20mhz))) {
+
 		ratr_value |= 0x10000000;
 		tmp_ratr_value = (ratr_value >> 12);
+
 		for (shortgi_rate = 15; shortgi_rate > 0; shortgi_rate--) {
 			if ((1 << shortgi_rate) & tmp_ratr_value)
 				break;
 		}
+
 		shortgi_rate = (shortgi_rate << 12) | (shortgi_rate << 8) |
-			       (shortgi_rate << 4) | (shortgi_rate);
+		    (shortgi_rate << 4) | (shortgi_rate);
 	}
+
 	rtl_write_dword(rtlpriv, REG_ARFR0 + ratr_index * 4, ratr_value);
+
+	RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, "%x\n",
+		 rtl_read_dword(rtlpriv, REG_ARFR0));
 }
 
-void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, u8 rssi_level)
+static void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw,
+					 struct ieee80211_sta *sta,
+					 u8 rssi_level)
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	struct rtl_phy *rtlphy = &(rtlpriv->phy);
 	struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
-	u32 ratr_bitmap = (u32) mac->basic_rates;
-	u8 *p_mcsrate = mac->mcs;
-	u8 ratr_index = 0;
-	u8 curtxbw_40mhz = mac->bw_40;
-	u8 curshortgi_40mhz = mac->sgi_40;
-	u8 curshortgi_20mhz = mac->sgi_20;
-	enum wireless_mode wirelessmode = mac->mode;
+	struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
+	struct rtl_sta_info *sta_entry = NULL;
+	u32 ratr_bitmap;
+	u8 ratr_index;
+	u8 curtxbw_40mhz = (sta->bandwidth >= IEEE80211_STA_RX_BW_40) ? 1 : 0;
+	u8 curshortgi_40mhz = curtxbw_40mhz &&
+			      (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40) ?
+				1 : 0;
+	u8 curshortgi_20mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20) ?
+				1 : 0;
+	enum wireless_mode wirelessmode = 0;
 	bool shortgi = false;
 	u8 rate_mask[5];
 	u8 macid = 0;
-	u8 mimops = 1;
+	u8 mimo_ps = IEEE80211_SMPS_OFF;
 
-	ratr_bitmap |= (p_mcsrate[1] << 20) | (p_mcsrate[0] << 12);
+	sta_entry = (struct rtl_sta_info *) sta->drv_priv;
+	wirelessmode = sta_entry->wireless_mode;
+	if (mac->opmode == NL80211_IFTYPE_STATION ||
+	    mac->opmode == NL80211_IFTYPE_MESH_POINT)
+		curtxbw_40mhz = mac->bw_40;
+	else if (mac->opmode == NL80211_IFTYPE_AP ||
+		mac->opmode == NL80211_IFTYPE_ADHOC)
+		macid = sta->aid + 1;
+
+	if (rtlhal->current_bandtype == BAND_ON_5G)
+		ratr_bitmap = sta->supp_rates[1] << 4;
+	else
+		ratr_bitmap = sta->supp_rates[0];
+	if (mac->opmode == NL80211_IFTYPE_ADHOC)
+		ratr_bitmap = 0xfff;
+	ratr_bitmap |= (sta->ht_cap.mcs.rx_mask[1] << 20 |
+			sta->ht_cap.mcs.rx_mask[0] << 12);
 	switch (wirelessmode) {
 	case WIRELESS_MODE_B:
 		ratr_index = RATR_INX_WIRELESS_B;
@@ -2071,6 +2112,7 @@ void rtl92cu_update_hal_rate_mask(struct
 		break;
 	case WIRELESS_MODE_G:
 		ratr_index = RATR_INX_WIRELESS_GB;
+
 		if (rssi_level == 1)
 			ratr_bitmap &= 0x00000f00;
 		else if (rssi_level == 2)
@@ -2085,7 +2127,8 @@ void rtl92cu_update_hal_rate_mask(struct
 	case WIRELESS_MODE_N_24G:
 	case WIRELESS_MODE_N_5G:
 		ratr_index = RATR_INX_WIRELESS_NGB;
-		if (mimops == 0) {
+
+		if (mimo_ps == IEEE80211_SMPS_STATIC) {
 			if (rssi_level == 1)
 				ratr_bitmap &= 0x00070000;
 			else if (rssi_level == 2)
@@ -2128,8 +2171,10 @@ void rtl92cu_update_hal_rate_mask(struct
 				}
 			}
 		}
+
 		if ((curtxbw_40mhz && curshortgi_40mhz) ||
 		    (!curtxbw_40mhz && curshortgi_20mhz)) {
+
 			if (macid == 0)
 				shortgi = true;
 			else if (macid == 1)
@@ -2138,21 +2183,39 @@ void rtl92cu_update_hal_rate_mask(struct
 		break;
 	default:
 		ratr_index = RATR_INX_WIRELESS_NGB;
+
 		if (rtlphy->rf_type == RF_1T2R)
 			ratr_bitmap &= 0x000ff0ff;
 		else
 			ratr_bitmap &= 0x0f0ff0ff;
 		break;
 	}
-	RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, "ratr_bitmap :%x\n",
-		 ratr_bitmap);
-	*(u32 *)&rate_mask = ((ratr_bitmap & 0x0fffffff) |
-				      ratr_index << 28);
+	sta_entry->ratr_index = ratr_index;
+
+	RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG,
+		 "ratr_bitmap :%x\n", ratr_bitmap);
+	*(u32 *)&rate_mask = (ratr_bitmap & 0x0fffffff) |
+				     (ratr_index << 28);
 	rate_mask[4] = macid | (shortgi ? 0x20 : 0x00) | 0x80;
 	RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG,
 		 "Rate_index:%x, ratr_val:%x, %5phC\n",
 		 ratr_index, ratr_bitmap, rate_mask);
 	rtl92c_fill_h2c_cmd(hw, H2C_RA_MASK, 5, rate_mask);
+
+	if (macid != 0)
+		sta_entry->ratr_index = ratr_index;
+}
+
+void rtl92cu_update_hal_rate_tbl(struct ieee80211_hw *hw,
+				 struct ieee80211_sta *sta,
+				 u8 rssi_level)
+{
+	struct rtl_priv *rtlpriv = rtl_priv(hw);
+
+	if (rtlpriv->dm.useramask)
+		rtl92cu_update_hal_rate_mask(hw, sta, rssi_level);
+	else
+		rtl92cu_update_hal_rate_table(hw, sta);
 }
 
 void rtl92cu_update_channel_access_setting(struct ieee80211_hw *hw)
Index: wireless-testing-save/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h
===================================================================
--- wireless-testing-save.orig/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h
+++ wireless-testing-save/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h
@@ -98,10 +98,6 @@ void rtl92cu_update_interrupt_mask(struc
 				   u32 add_msr, u32 rm_msr);
 void rtl92cu_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val);
 void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val);
-void rtl92cu_update_hal_rate_table(struct ieee80211_hw *hw,
-				   struct ieee80211_sta *sta,
-				   u8 rssi_level);
-void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, u8 rssi_level);
 
 void rtl92cu_update_channel_access_setting(struct ieee80211_hw *hw);
 bool rtl92cu_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 * valid);
Index: wireless-testing-save/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
===================================================================
--- wireless-testing-save.orig/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
+++ wireless-testing-save/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
@@ -106,8 +106,7 @@ static struct rtl_hal_ops rtl8192cu_hal_
 	.update_interrupt_mask = rtl92cu_update_interrupt_mask,
 	.get_hw_reg = rtl92cu_get_hw_reg,
 	.set_hw_reg = rtl92cu_set_hw_reg,
-	.update_rate_tbl = rtl92cu_update_hal_rate_table,
-	.update_rate_mask = rtl92cu_update_hal_rate_mask,
+	.update_rate_tbl = rtl92cu_update_hal_rate_tbl,
 	.fill_tx_desc = rtl92cu_tx_fill_desc,
 	.fill_fake_txdesc = rtl92cu_fill_fake_txdesc,
 	.fill_tx_cmddesc = rtl92cu_tx_fill_cmddesc,
Index: wireless-testing-save/drivers/net/wireless/rtlwifi/rtl8192cu/sw.h
===================================================================
--- wireless-testing-save.orig/drivers/net/wireless/rtlwifi/rtl8192cu/sw.h
+++ wireless-testing-save/drivers/net/wireless/rtlwifi/rtl8192cu/sw.h
@@ -49,5 +49,8 @@ bool rtl92cu_phy_set_rf_power_state(stru
 u32 rtl92cu_phy_query_rf_reg(struct ieee80211_hw *hw,
 			    enum radio_path rfpath, u32 regaddr, u32 bitmask);
 void rtl92cu_phy_set_bw_mode_callback(struct ieee80211_hw *hw);
+void rtl92cu_update_hal_rate_tbl(struct ieee80211_hw *hw,
+				 struct ieee80211_sta *sta,
+				 u8 rssi_level);
 
 #endif

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Fwd: Realtek 8192CU not working
  2013-04-25 23:08                     ` Larry Finger
@ 2013-04-26 10:42                       ` Michael Stahn
  0 siblings, 0 replies; 10+ messages in thread
From: Michael Stahn @ 2013-04-26 10:42 UTC (permalink / raw)
  To: Larry Finger; +Cc: linux-wireless

thx, I'll try it out in the next days.

2013/4/26 Larry Finger <Larry.Finger@lwfinger.net>:
> On 04/24/2013 06:08 PM, Michael Stahn wrote:
>>
>> This kind of error doesn't seem to show up on the USB 2.0 interface. I
>> just configured the AP for WPA+TKIP but no change. Now the Adapter
>> won't connect anymore even I reload the module..pretty random error.
>> I'll try some other ideas in the next days...
>
>
> I found some problems today. With the attached patched, my device connects
> to WEP, WPA and WPA2 networks.
>
> Larry
>
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-04-26 10:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CALvqYaTZrtSsP9GQzH4B988KjPg+LRCcyREKZ1zkjoaEDKPHNA@mail.gmail.com>
2013-04-24 14:16 ` Fwd: Realtek 8192CU not working Michael Stahn
2013-04-24 14:49   ` Larry Finger
     [not found]     ` <CALvqYaQt+nL-PxSeEUNpsG9SWV+--S64ksr1UR+8TPg5dVPKXA@mail.gmail.com>
2013-04-24 16:47       ` Larry Finger
2013-04-24 17:19         ` Michael Stahn
2013-04-24 17:27           ` Michael Stahn
2013-04-24 17:42             ` Larry Finger
     [not found]               ` <CALvqYaQTQ5=ER=F1-bxnJQKkFjrg6UH+1JWLexUPVZ3cFBG5UQ@mail.gmail.com>
     [not found]                 ` <51786303.3070107@lwfinger.net>
2013-04-24 23:08                   ` Michael Stahn
2013-04-24 23:18                     ` Larry Finger
2013-04-25 23:08                     ` Larry Finger
2013-04-26 10:42                       ` Michael Stahn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).