Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Oct 2015 22:22:26 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r288638 - head/sys/dev/usb/wlan
Message-ID:  <201510032222.t93MMQTE047135@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Sat Oct  3 22:22:26 2015
New Revision: 288638
URL: https://svnweb.freebsd.org/changeset/base/288638

Log:
  rum(4): set short/long retry limits
  
  Now device will use retry limit, which is set via 'ifconfig <interface>
  maxretry <number>'.
  
  Tested:
  
  * Tested on WUSB54GC, STA mode.
  
  Submitted by:	<s3erios@gmail.com>
  Differential Revision:	https://reviews.freebsd.org/D3689

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

Modified: head/sys/dev/usb/wlan/if_rum.c
==============================================================================
--- head/sys/dev/usb/wlan/if_rum.c	Sat Oct  3 22:15:59 2015	(r288637)
+++ head/sys/dev/usb/wlan/if_rum.c	Sat Oct  3 22:22:26 2015	(r288638)
@@ -207,6 +207,8 @@ static void		rum_select_band(struct rum_
 			    struct ieee80211_channel *);
 static void		rum_set_chan(struct rum_softc *,
 			    struct ieee80211_channel *);
+static void		rum_set_maxretry(struct rum_softc *,
+			    struct ieee80211vap *);
 static int		rum_enable_tsf_sync(struct rum_softc *);
 static void		rum_enable_tsf(struct rum_softc *);
 static void		rum_abort_tsf_sync(struct rum_softc *);
@@ -819,7 +821,8 @@ rum_newstate(struct ieee80211vap *vap, e
 		ni = ieee80211_ref_node(vap->iv_bss);
 
 		if (vap->iv_opmode != IEEE80211_M_MONITOR) {
-			if (ic->ic_bsschan == IEEE80211_CHAN_ANYC) {
+			if (ic->ic_bsschan == IEEE80211_CHAN_ANYC ||
+			    ni->ni_chan == IEEE80211_CHAN_ANYC) {
 				ret = EINVAL;
 				goto run_fail;
 			}
@@ -827,6 +830,7 @@ rum_newstate(struct ieee80211vap *vap, e
 			rum_enable_mrr(sc);
 			rum_set_txpreamble(sc);
 			rum_set_basicrates(sc);
+			rum_set_maxretry(sc, vap);
 			IEEE80211_ADDR_COPY(sc->sc_bssid, ni->ni_bssid);
 			rum_set_bssid(sc, sc->sc_bssid);
 		}
@@ -1946,6 +1950,21 @@ rum_set_chan(struct rum_softc *sc, struc
 	rum_pause(sc, hz / 100);
 }
 
+static void
+rum_set_maxretry(struct rum_softc *sc, struct ieee80211vap *vap)
+{
+	const struct ieee80211_txparam *tp;
+	struct ieee80211_node *ni = vap->iv_bss;
+	struct rum_vap *rvp = RUM_VAP(vap);
+
+	tp = &vap->iv_txparms[ieee80211_chan2mode(ni->ni_chan)];
+	rvp->maxretry = tp->maxretry < 0xf ? tp->maxretry : 0xf;
+
+	rum_modbits(sc, RT2573_TXRX_CSR4, RT2573_SHORT_RETRY(rvp->maxretry) |
+	    RT2573_LONG_RETRY(rvp->maxretry),
+	    RT2573_SHORT_RETRY_MASK | RT2573_LONG_RETRY_MASK);
+}
+
 /*
  * Enable TSF synchronization and tell h/w to start sending beacons for IBSS
  * and HostAP operating modes.

Modified: head/sys/dev/usb/wlan/if_rumreg.h
==============================================================================
--- head/sys/dev/usb/wlan/if_rumreg.h	Sat Oct  3 22:15:59 2015	(r288637)
+++ head/sys/dev/usb/wlan/if_rumreg.h	Sat Oct  3 22:22:26 2015	(r288638)
@@ -153,6 +153,10 @@
 #define RT2573_SHORT_PREAMBLE	(1 << 18)
 #define RT2573_MRR_ENABLED	(1 << 19)
 #define RT2573_MRR_CCK_FALLBACK	(1 << 22)
+#define RT2573_LONG_RETRY(max)	((max) << 24)
+#define RT2573_LONG_RETRY_MASK	(0xf << 24)
+#define RT2573_SHORT_RETRY(max)	((max) << 28)
+#define RT2573_SHORT_RETRY_MASK	(0xf << 28)
 
 /* possible flags for register TXRX_CSR9 */
 #define RT2573_TSF_TIMER_EN		(1 << 16)

Modified: head/sys/dev/usb/wlan/if_rumvar.h
==============================================================================
--- head/sys/dev/usb/wlan/if_rumvar.h	Sat Oct  3 22:15:59 2015	(r288637)
+++ head/sys/dev/usb/wlan/if_rumvar.h	Sat Oct  3 22:22:26 2015	(r288638)
@@ -92,6 +92,7 @@ struct rum_vap {
 	struct mbuf			*bcn_mbuf;
 	struct usb_callout		ratectl_ch;
 	struct task			ratectl_task;
+	uint8_t				maxretry;
 
 	int				(*newstate)(struct ieee80211vap *,
 					    enum ieee80211_state, int);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201510032222.t93MMQTE047135>