svn commit: r344745 - in head/sys/dev/rtwn/rtl8192c: . usb

Andriy Voskoboinyk avos at FreeBSD.org
Mon Mar 4 03:02:16 UTC 2019


Author: avos
Date: Mon Mar  4 03:02:14 2019
New Revision: 344745
URL: https://svnweb.freebsd.org/changeset/base/344745

Log:
  rtwn_usb(4): fix Tx instability with RTL8192CU chipsets
  
  - Fix data frames transmission via POWER_STATUS register setup -
  it seems to be set by MACID_CONFIG firmware command, which was broken*
  in r290439 and later disabled in r307529.
  
  We can re-enable it later if / when firmware rate adaptation will be
  ready; however, this step will be required anyway - for firmware-less
  builds.
  
  - Force RTS / CTS protection frame rate to CCK1 (this rate works fine
  without any additional setup; no better workaround is known yet).
  
  The problem was not observed on the channel 1 or with CCK1 rate enforced
  ('ifconfig wlan0 ucastrate 1' for 11 b/g; not possible for 11n networks
  due to ifconfig(8) bug).
  
  * I'm not sure if it works before r290439 because - AFAIR - I never seen
  firmware rate adaptation working for 10-STABLE urtwn(4)
  (It needs EN_BCN bit set and RSSI updates at least).
  
  Tested with RTL8188CUS in STA mode
  (in regular mode and with disabled MRR - DARFRC*8 is set to 0)
  
  PR:		233949
  MFC after:	2 weeks

Modified:
  head/sys/dev/rtwn/rtl8192c/r92c_reg.h
  head/sys/dev/rtwn/rtl8192c/r92c_tx.c
  head/sys/dev/rtwn/rtl8192c/usb/r92cu_init.c

Modified: head/sys/dev/rtwn/rtl8192c/r92c_reg.h
==============================================================================
--- head/sys/dev/rtwn/rtl8192c/r92c_reg.h	Mon Mar  4 01:54:28 2019	(r344744)
+++ head/sys/dev/rtwn/rtl8192c/r92c_reg.h	Mon Mar  4 03:02:14 2019	(r344745)
@@ -148,6 +148,7 @@
 #define R92C_RD_RESP_PKT_TH		0x463
 #define R92C_INIRTS_RATE_SEL		0x480
 #define R92C_INIDATA_RATE_SEL(macid)	(0x484 + (macid))
+#define R92C_POWER_STATUS		0x4a4
 #define R92C_QUEUE_CTRL			0x4c6
 #define R92C_MAX_AGGR_NUM		0x4ca
 #define R92C_BAR_MODE_CTRL		0x4cc

Modified: head/sys/dev/rtwn/rtl8192c/r92c_tx.c
==============================================================================
--- head/sys/dev/rtwn/rtl8192c/r92c_tx.c	Mon Mar  4 01:54:28 2019	(r344744)
+++ head/sys/dev/rtwn/rtl8192c/r92c_tx.c	Mon Mar  4 03:02:14 2019	(r344745)
@@ -211,6 +211,12 @@ r92c_tx_setup_macid(void *buf, int id)
 	struct r92c_tx_desc *txd = (struct r92c_tx_desc *)buf;
 
 	txd->txdw1 |= htole32(SM(R92C_TXDW1_MACID, id));
+
+	/* XXX does not belong here */
+	/* XXX temporary (I hope) */
+	/* Force CCK1 for RTS / CTS frames (driver bug) */
+	txd->txdw4 &= ~htole32(SM(R92C_TXDW4_RTSRATE, R92C_TXDW4_RTSRATE_M));
+	txd->txdw4 &= ~htole32(R92C_TXDW4_RTS_SHORT);
 }
 
 void

Modified: head/sys/dev/rtwn/rtl8192c/usb/r92cu_init.c
==============================================================================
--- head/sys/dev/rtwn/rtl8192c/usb/r92cu_init.c	Mon Mar  4 01:54:28 2019	(r344744)
+++ head/sys/dev/rtwn/rtl8192c/usb/r92cu_init.c	Mon Mar  4 03:02:14 2019	(r344745)
@@ -357,6 +357,8 @@ void
 r92cu_post_init(struct rtwn_softc *sc)
 {
 
+	rtwn_write_4(sc, R92C_POWER_STATUS, 0x5);
+
 	/* Perform LO and IQ calibrations. */
 	r92c_iq_calib(sc);
 	/* Perform LC calibration. */


More information about the svn-src-head mailing list