svn commit: r288504 - head/sys/dev/usb/wlan

Adrian Chadd adrian at FreeBSD.org
Fri Oct 2 15:30:38 UTC 2015


Author: adrian
Date: Fri Oct  2 15:30:37 2015
New Revision: 288504
URL: https://svnweb.freebsd.org/changeset/base/288504

Log:
  rum(4): sync rum_enable_tsf(_sync) with run(4).
  
  Submitted by:	<s3erios at gmail.com>
  Differential Revision:	https://reviews.freebsd.org/D3611

Modified:
  head/sys/dev/usb/wlan/if_rum.c
  head/sys/dev/usb/wlan/if_rumreg.h

Modified: head/sys/dev/usb/wlan/if_rum.c
==============================================================================
--- head/sys/dev/usb/wlan/if_rum.c	Fri Oct  2 15:28:44 2015	(r288503)
+++ head/sys/dev/usb/wlan/if_rum.c	Fri Oct  2 15:30:37 2015	(r288504)
@@ -1730,12 +1730,35 @@ rum_enable_tsf_sync(struct rum_softc *sc
 
 	/* set beacon interval (in 1/16ms unit) */
 	tmp |= vap->iv_bss->ni_intval * 16;
+	tmp |= RT2573_TSF_TIMER_EN | RT2573_TBTT_TIMER_EN;
 
-	tmp |= RT2573_TSF_TICKING | RT2573_ENABLE_TBTT;
-	if (vap->iv_opmode == IEEE80211_M_STA)
-		tmp |= RT2573_TSF_MODE(1);
-	else
-		tmp |= RT2573_TSF_MODE(2) | RT2573_GENERATE_BEACON;
+	switch (vap->iv_opmode) {
+	case IEEE80211_M_STA:
+		/*
+		 * Local TSF is always updated with remote TSF on beacon
+		 * reception.
+		 */
+		tmp |= RT2573_TSF_SYNC_MODE(RT2573_TSF_SYNC_MODE_STA);
+		break;
+	case IEEE80211_M_IBSS:
+		/*
+		 * Local TSF is updated with remote TSF on beacon reception
+		 * only if the remote TSF is greater than local TSF.
+		 */
+		tmp |= RT2573_TSF_SYNC_MODE(RT2573_TSF_SYNC_MODE_IBSS);
+		tmp |= RT2573_BCN_TX_EN;
+		break;
+	case IEEE80211_M_HOSTAP:
+		/* SYNC with nobody */
+		tmp |= RT2573_TSF_SYNC_MODE(RT2573_TSF_SYNC_MODE_HOSTAP);
+		tmp |= RT2573_BCN_TX_EN;
+		break;
+	default:
+		device_printf(sc->sc_dev,
+		    "Enabling TSF failed. undefined opmode %d\n",
+		    vap->iv_opmode);
+		return;
+	}
 
 	rum_write(sc, RT2573_TXRX_CSR9, tmp);
 }
@@ -1743,8 +1766,8 @@ rum_enable_tsf_sync(struct rum_softc *sc
 static void
 rum_enable_tsf(struct rum_softc *sc)
 {
-	rum_modbits(sc, RT2573_TXRX_CSR9,
-	    RT2573_TSF_TICKING | RT2573_TSF_MODE(2), 0x00ffffff);
+	rum_modbits(sc, RT2573_TXRX_CSR9, RT2573_TSF_TIMER_EN |
+	    RT2573_TSF_SYNC_MODE(RT2573_TSF_SYNC_MODE_DIS), 0x00ffffff);
 }
 
 static void

Modified: head/sys/dev/usb/wlan/if_rumreg.h
==============================================================================
--- head/sys/dev/usb/wlan/if_rumreg.h	Fri Oct  2 15:28:44 2015	(r288503)
+++ head/sys/dev/usb/wlan/if_rumreg.h	Fri Oct  2 15:30:37 2015	(r288504)
@@ -124,11 +124,14 @@
 #define RT2573_MRR_CCK_FALLBACK	(1 << 22)
 
 /* possible flags for register TXRX_CSR9 */
-#define RT2573_TSF_TICKING	(1 << 16)
-#define RT2573_TSF_MODE(x)	(((x) & 0x3) << 17)
-/* TBTT stands for Target Beacon Transmission Time */
-#define RT2573_ENABLE_TBTT	(1 << 19)
-#define RT2573_GENERATE_BEACON	(1 << 20)
+#define RT2573_TSF_TIMER_EN		(1 << 16)
+#define RT2573_TSF_SYNC_MODE(x)		(((x) & 0x3) << 17)
+#define RT2573_TSF_SYNC_MODE_DIS	0
+#define RT2573_TSF_SYNC_MODE_STA	1
+#define RT2573_TSF_SYNC_MODE_IBSS	2
+#define RT2573_TSF_SYNC_MODE_HOSTAP	3
+#define RT2573_TBTT_TIMER_EN		(1 << 19)
+#define RT2573_BCN_TX_EN		(1 << 20)
 
 /* possible flags for register PHY_CSR0 */
 #define RT2573_PA_PE_2GHZ	(1 << 16)


More information about the svn-src-head mailing list