[Zrouter-src-freebsd] [rt2860-in-ral] 5 new revisions pushed by r... at ddteam.net on 2012-03-28 13:21 GMT

rt2860-in-ral at googlecode.com rt2860-in-ral at googlecode.com
Wed Mar 28 13:21:49 UTC 2012


5 new revisions:

Revision: 91eea58b37d4
Author:   Aleksandr Rybalko <ray at ddteam.net>
Date:     Wed Mar 28 06:08:52 2012
Log:      Update RT2860_DPRINTF to allow format w/o arguments.
http://code.google.com/p/rt2860-in-ral/source/detail?r=91eea58b37d4

Revision: 4e6aadf3834b
Author:   Aleksandr Rybalko <ray at ddteam.net>
Date:     Wed Mar 28 06:10:19 2012
Log:      Update/fix EEPROM address + fix MAC reg names to known.
http://code.google.com/p/rt2860-in-ral/source/detail?r=4e6aadf3834b

Revision: 05a4e237c179
Author:   Aleksandr Rybalko <ray at ddteam.net>
Date:     Wed Mar 28 06:18:19 2012
Log:      revert wrong
http://code.google.com/p/rt2860-in-ral/source/detail?r=05a4e237c179

Revision: c634fc19aee6
Author:   Aleksandr Rybalko <ray at ddteam.net>
Date:     Wed Mar 28 06:21:18 2012
Log:      1. Fix read of RT2860_EEPROM_PWR[25]GHZ_BASE, it must step two  
times o...
http://code.google.com/p/rt2860-in-ral/source/detail?r=c634fc19aee6

Revision: 74a8a34ad66f
Author:   Aleksandr Rybalko <ray at ddteam.net>
Date:     Wed Mar 28 06:21:50 2012
Log:      Update RT2860_DPRINTF to allow format w/o arguments.
http://code.google.com/p/rt2860-in-ral/source/detail?r=74a8a34ad66f

==============================================================================
Revision: 91eea58b37d4
Author:   Aleksandr Rybalko <ray at ddteam.net>
Date:     Wed Mar 28 06:08:52 2012
Log:      Update RT2860_DPRINTF to allow format w/o arguments.
http://code.google.com/p/rt2860-in-ral/source/detail?r=91eea58b37d4

Modified:
  /sys/dev/ral/rt2860.c

=======================================
--- /sys/dev/ral/rt2860.c	Wed Mar 21 12:37:51 2012
+++ /sys/dev/ral/rt2860.c	Wed Mar 28 06:08:52 2012
@@ -253,9 +253,7 @@
  static int rt2860_tx_data(struct rt2860_softc *sc,
  			  struct mbuf *m, struct ieee80211_node *ni, int qid);

-static void rt2860_tx_coherent_intr(struct rt2860_softc *sc);
-static void rt2860_rx_coherent_intr(struct rt2860_softc *sc);
-static void rt2860_txrx_coherent_intr(struct rt2860_softc *sc);
+static void rt2860_reset_dma(struct rt2860_softc *sc);
  static void rt2860_fifo_sta_full_intr(struct rt2860_softc *sc);
  static void rt2860_rx_intr(struct rt2860_softc *sc);
  static void rt2860_tx_intr(struct rt2860_softc *sc, int qid);
@@ -312,7 +310,8 @@
  	uint32_t	reg;
  	uint32_t	val;
  } rt2860_def_mac[] = {
-	RT2860_DEF_MAC
+	RT2870_DEF_MAC
+//	RT2860_DEF_MAC
  };

  static const struct {
@@ -345,7 +344,8 @@
  /*
   * rt2860_attach
   */
-int rt2860_attach(device_t dev, int id)
+int
+rt2860_attach(device_t dev, int id)
  {
  	struct rt2860_softc *sc;
  	struct ifnet *ifp;
@@ -370,9 +370,7 @@
  		"debug", CTLFLAG_RW, &sc->debug, 0, "rt2860 debug level");
  #endif

-	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY,
-		"%s: attaching\n",
-		device_get_nameunit(sc->sc_dev));
+	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY, "attaching\n");

  	/* wait for NIC to initialize */
  	for (ntries = 0; ntries < 100; ntries++) {
@@ -595,7 +593,8 @@
  /*
   * rt2860_detach
   */
-int rt2860_detach(void *xsc)
+int
+rt2860_detach(void *xsc)
  {
  	struct rt2860_softc *sc = xsc;
  	struct ifnet *ifp;
@@ -605,9 +604,7 @@
  	ifp = sc->sc_ifp;
  	ic = ifp->if_l2com;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY,
-		"%s: detaching\n",
-		device_get_nameunit(sc->sc_dev));
+	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY, "detaching\n");

  	RT2860_SOFTC_LOCK(sc);

@@ -648,9 +645,7 @@
  {
  	struct rt2860_softc *sc = xsc;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY,
-		"%s: shutting down\n",
-		device_get_nameunit(sc->sc_dev));
+	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY, "shutting down\n");

  	rt2860_stop(sc);

@@ -667,9 +662,7 @@
  {
  	struct rt2860_softc *sc = xsc;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY,
-		"%s: suspending\n",
-		device_get_nameunit(sc->sc_dev));
+	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY, "suspending\n");

  	rt2860_stop(sc);

@@ -689,9 +682,7 @@

  	ifp = sc->sc_ifp;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY,
-		"%s: resuming\n",
-		device_get_nameunit(sc->sc_dev));
+	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY, "resuming\n");

  	if (ifp->if_flags & IFF_UP)
  		rt2860_init(sc);
@@ -801,7 +792,8 @@
  /*
   * rt2860_init_channels_ht40
   */
-static void rt2860_init_channels_ht40(struct rt2860_softc *sc)
+static void
+rt2860_init_channels_ht40(struct rt2860_softc *sc)
  {
  	struct ifnet *ifp;
  	struct ieee80211com *ic;
@@ -968,7 +960,8 @@
  /*
   * rt2860_init_locked
   */
-static void rt2860_init_locked(void *priv)
+static void
+rt2860_init_locked(void *priv)
  {
  #define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
  	struct rt2860_softc *sc;
@@ -984,9 +977,7 @@
  	ifp = sc->sc_ifp;
  	ic = ifp->if_l2com;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY,
-		"%s: initializing\n",
-		device_get_nameunit(sc->sc_dev));
+	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY, "initializing\n");

  	RT2860_SOFTC_ASSERT_LOCKED(sc);

@@ -1004,7 +995,7 @@
  		sc->flags |= RT2860_SOFTC_FLAGS_UCODE_LOADED;

  		/* Blink every TX */
-		RAL_WRITE(sc, RT2860_LED_CFG,
+		RAL_WRITE(sc, RT2860_LED_CFG,
  		    LED_CFG_LED_POLARITY |
  		    LED_CFG_Y_LED_MODE_ONTX |
  		    LED_CFG_G_LED_MODE_ONTX |
@@ -1102,7 +1093,6 @@
  		device_printf(sc->sc_dev, "timeout waiting for MAC\n");
  		goto fail;
  	}
-
  	/* clear Host to MCU mailbox */

  	RAL_WRITE(sc, RT2860_REG_H2M_MAILBOX_BBP_AGENT, 0);
@@ -1364,7 +1354,8 @@
  /*
   * rt2860_init
   */
-static void rt2860_init(void *priv)
+static void
+rt2860_init(void *priv)
  {
  	struct rt2860_softc *sc;

@@ -1380,7 +1371,8 @@
  /*
   * rt2860_init_bbp
   */
-static int rt2860_init_bbp(struct rt2860_softc *sc)
+static int
+rt2860_init_bbp(struct rt2860_softc *sc)
  {
  #define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
  	int ntries, i;
@@ -1418,7 +1410,8 @@
  /*
   * rt2860_stop_locked
   */
-static void rt2860_stop_locked(void *priv)
+static void
+rt2860_stop_locked(void *priv)
  {
  	struct rt2860_softc *sc;
  	struct ifnet *ifp;
@@ -1429,9 +1422,7 @@
  	ifp = sc->sc_ifp;
  	ic = ifp->if_l2com;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY,
-		"%s: stopping\n",
-		device_get_nameunit(sc->sc_dev));
+	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY, "stopping\n");

  	RT2860_SOFTC_ASSERT_LOCKED(sc);

@@ -1482,7 +1473,8 @@
  /*
   * rt2860_stop
   */
-static void rt2860_stop(void *priv)
+static void
+rt2860_stop(void *priv)
  {
  	struct rt2860_softc *sc;

@@ -1498,7 +1490,8 @@
  /*
   * rt2860_start
   */
-static void rt2860_start(struct ifnet *ifp)
+static void
+rt2860_start(struct ifnet *ifp)
  {
  	struct rt2860_softc *sc;
  #ifdef RT2860_NO_HW_CRYPTO
@@ -1544,12 +1537,12 @@

  		RT2860_SOFTC_TX_RING_LOCK(&sc->tx_ring[qid]);

-		if (sc->tx_ring[qid].data_queued >= RT2860_SOFTC_TX_RING_DATA_COUNT) {
+		if (sc->tx_ring[qid].data_queued >=
+		    RT2860_SOFTC_TX_RING_DATA_COUNT) {
  			RT2860_SOFTC_TX_RING_UNLOCK(&sc->tx_ring[qid]);

  			RT2860_DPRINTF(sc, RT2860_DEBUG_TX,
-				"%s: if_start: Tx ring with qid=%d is full\n",
-				device_get_nameunit(sc->sc_dev), qid);
+			    "if_start: Tx ring with qid=%d is full\n", qid);

  			m_freem(m);
  			ieee80211_free_node(ni);
@@ -1587,7 +1580,8 @@
  /*
   * rt2860_ioctl
   */
-static int rt2860_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
+static int
+rt2860_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -1647,10 +1641,11 @@
  /*
   * rt2860_vap_create
   */
-static struct ieee80211vap *rt2860_vap_create(struct ieee80211com *ic,
-	const char name[IFNAMSIZ], int unit, enum ieee80211_opmode opmode,
-	int flags, const uint8_t bssid[IEEE80211_ADDR_LEN],
-	const uint8_t mac[IEEE80211_ADDR_LEN])
+static struct ieee80211vap *
+rt2860_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ],
+    int unit, enum ieee80211_opmode opmode, int flags,
+    const uint8_t bssid[IEEE80211_ADDR_LEN],
+    const uint8_t mac[IEEE80211_ADDR_LEN])
  {
  	struct rt2860_softc *sc;
  	struct ifnet *ifp;
@@ -1660,10 +1655,8 @@
  	ifp = ic->ic_ifp;
  	sc = ifp->if_softc;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_STATE,
-		"%s: VAP create: opmode=%s\n",
-		device_get_nameunit(sc->sc_dev),
-		ieee80211_opmode_name[opmode]);
+	RT2860_DPRINTF(sc, RT2860_DEBUG_STATE, "VAP create: opmode=%s\n",
+	    ieee80211_opmode_name[opmode]);

  	switch (opmode) {
  	case IEEE80211_M_IBSS:
@@ -1772,7 +1765,8 @@
  /*
   * rt2860_vap_delete
   */
-static void rt2860_vap_delete(struct ieee80211vap *vap)
+static void
+rt2860_vap_delete(struct ieee80211vap *vap)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -1786,9 +1780,8 @@
  	rvap = (struct rt2860_softc_vap *) vap;
  	opmode = vap->iv_opmode;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_STATE,
-		"%s: VAP delete: opmode=%s\n",
-		device_get_nameunit(sc->sc_dev), ieee80211_opmode_name[opmode]);
+	RT2860_DPRINTF(sc, RT2860_DEBUG_STATE, "VAP delete: opmode=%s\n",
+	    ieee80211_opmode_name[opmode]);

  	rt2860_amrr_cleanup(&rvap->amrr);

@@ -1833,7 +1826,8 @@
  /*
   * rt2860_reset_vap
   */
-static int rt2860_vap_reset(struct ieee80211vap *vap, u_long cmd)
+static int
+rt2860_vap_reset(struct ieee80211vap *vap, u_long cmd)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -1846,9 +1840,7 @@
  	sc = ifp->if_softc;
  	rvap = (struct rt2860_softc_vap *) vap;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_STATE,
-		"%s: VAP reset: cmd=%lu\n",
-		device_get_nameunit(sc->sc_dev), cmd);
+	RT2860_DPRINTF(sc, RT2860_DEBUG_STATE, "VAP reset: cmd=%lu\n", cmd);

  	error = 0;

@@ -1886,8 +1878,9 @@
  /*
   * rt2860_vap_newstate
   */
-static int rt2860_vap_newstate(struct ieee80211vap *vap,
-	enum ieee80211_state nstate, int arg)
+static int
+rt2860_vap_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate,
+    int arg)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -1904,10 +1897,8 @@

  	ostate = vap->iv_state;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_STATE,
-		"%s: VAP newstate: %s -> %s\n",
-		device_get_nameunit(sc->sc_dev),
-		ieee80211_state_name[ostate], ieee80211_state_name[nstate]);
+	RT2860_DPRINTF(sc, RT2860_DEBUG_STATE, "VAP newstate: %s -> %s\n",
+	    ieee80211_state_name[ostate], ieee80211_state_name[nstate]);

  	error = rvap->newstate(vap, nstate, arg);
  	if (error != 0)
@@ -1974,7 +1965,8 @@
  /*
   * rt2860_vap_key_update_begin
   */
-static void rt2860_vap_key_update_begin(struct ieee80211vap *vap)
+static void
+rt2860_vap_key_update_begin(struct ieee80211vap *vap)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -1984,9 +1976,7 @@
  	ifp = ic->ic_ifp;
  	sc = ifp->if_softc;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_KEY,
-		"%s: VAP key update begin\n",
-		device_get_nameunit(sc->sc_dev));
+	RT2860_DPRINTF(sc, RT2860_DEBUG_KEY, "VAP key update begin\n");

  	taskqueue_block(sc->taskqueue);

@@ -1996,7 +1986,8 @@
  /*
   * rt2860_vap_key_update_end
   */
-static void rt2860_vap_key_update_end(struct ieee80211vap *vap)
+static void
+rt2860_vap_key_update_end(struct ieee80211vap *vap)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2006,9 +1997,7 @@
  	ifp = ic->ic_ifp;
  	sc = ifp->if_softc;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_KEY,
-		"%s: VAP key update end\n",
-		device_get_nameunit(sc->sc_dev));
+	RT2860_DPRINTF(sc, RT2860_DEBUG_KEY, "VAP key update end\n");

  	IF_UNLOCK(&ifp->if_snd);

@@ -2018,8 +2007,9 @@
  /*
   * rt2860_vap_key_set
   */
-static int rt2860_vap_key_set(struct ieee80211vap *vap,
-	const struct ieee80211_key *k, const uint8_t mac[IEEE80211_ADDR_LEN])
+static int
+rt2860_vap_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k,
+    const uint8_t mac[IEEE80211_ADDR_LEN])
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2053,9 +2043,9 @@
  	sc = ifp->if_softc;

  	RT2860_DPRINTF(sc, RT2860_DEBUG_KEY,
-		"%s: VAP key set: keyix=%d, keylen=%d, macaddr=%s, mode=%d, group=%d\n",
-		device_get_nameunit(sc->sc_dev), k->wk_keyix, k->wk_keylen,  
ether_sprintf(k->wk_macaddr),
-		mode, (k->wk_flags & IEEE80211_KEY_GROUP) ? 1 : 0);
+	    "VAP key set: keyix=%d, keylen=%d, macaddr=%s, mode=%d, group=%d\n",
+	    k->wk_keyix, k->wk_keylen, ether_sprintf(k->wk_macaddr),
+	    mode, (k->wk_flags & IEEE80211_KEY_GROUP) ? 1 : 0);

  	if (!(k->wk_flags & IEEE80211_KEY_GROUP)) {
  		/* install pairwise key */
@@ -2097,9 +2087,8 @@
  			iv[7] = (k->wk_keytsc >> 40);

  			RT2860_DPRINTF(sc, RT2860_DEBUG_KEY,
-				"%s: VAP key set: iv=%02x %02x %02x %02x %02x %02x %02x %02x\n",
-				device_get_nameunit(sc->sc_dev),
-				iv[0], iv[1], iv[2], iv[3], iv[4], iv[5], iv[6], iv[7]);
+			    "VAP key set: iv=%02x %02x %02x %02x %02x %02x %02x %02x\n",
+			    iv[0], iv[1], iv[2], iv[3], iv[4], iv[5], iv[6], iv[7]);
  		}

  		RAL_WRITE_REGION_1(sc, RT2860_REG_IVEIV(wcid), iv, 8);
@@ -2136,11 +2125,15 @@
  			RAL_WRITE_REGION_1(sc, key_base, k->wk_key, 16);

  			if (vap->iv_opmode != IEEE80211_M_HOSTAP) {
-				RAL_WRITE_REGION_1(sc, key_base + 16, &k->wk_key[16], 8);
-				RAL_WRITE_REGION_1(sc, key_base + 24, &k->wk_key[24], 8);
+				RAL_WRITE_REGION_1(sc, key_base + 16,
+				    &k->wk_key[16], 8);
+				RAL_WRITE_REGION_1(sc, key_base + 24,
+				    &k->wk_key[24], 8);
  			} else {
-				RAL_WRITE_REGION_1(sc, key_base + 16, &k->wk_key[24], 8);
-				RAL_WRITE_REGION_1(sc, key_base + 24, &k->wk_key[16], 8);
+				RAL_WRITE_REGION_1(sc, key_base + 16,
+				    &k->wk_key[24], 8);
+				RAL_WRITE_REGION_1(sc, key_base + 24,
+				    &k->wk_key[16], 8);
  			}
  		} else {
  			RAL_WRITE_REGION_1(sc, key_base, k->wk_key, k->wk_keylen);
@@ -2159,7 +2152,8 @@

  				iv[3] = (k->wk_keyix << 6);
  			} else {
-				if (k->wk_cipher->ic_cipher == IEEE80211_CIPHER_TKIP) {
+				if (k->wk_cipher->ic_cipher ==
+				    IEEE80211_CIPHER_TKIP) {
  					iv[0] = (k->wk_keytsc >> 8);
  					iv[1] = ((iv[0] | 0x20) & 0x7f);
  					iv[2] = k->wk_keytsc;
@@ -2171,16 +2165,18 @@
  					iv[2] = 0;
  				}

-				iv[3] = ((k->wk_keyix << 6) | IEEE80211_WEP_EXTIV);
+				iv[3] = ((k->wk_keyix << 6) |
+				    IEEE80211_WEP_EXTIV);
  				iv[4] = (k->wk_keytsc >> 16);
  				iv[5] = (k->wk_keytsc >> 24);
  				iv[6] = (k->wk_keytsc >> 32);
  				iv[7] = (k->wk_keytsc >> 40);

  				RT2860_DPRINTF(sc, RT2860_DEBUG_KEY,
-					"%s: VAP key set: iv=%02x %02x %02x %02x %02x %02x %02x %02x\n",
-					device_get_nameunit(sc->sc_dev),
-					iv[0], iv[1], iv[2], iv[3], iv[4], iv[5], iv[6], iv[7]);
+				    "VAP key set: iv=%02x %02x %02x %02x "
+				    "%02x %02x %02x %02x\n",
+				    iv[0], iv[1], iv[2], iv[3],
+				    iv[4], iv[5], iv[6], iv[7]);
  			}

  			RAL_WRITE_REGION_1(sc, RT2860_REG_IVEIV(wcid), iv, 8);
@@ -2198,8 +2194,8 @@
  /*
   * rt2860_vap_key_delete
   */
-static int rt2860_vap_key_delete(struct ieee80211vap *vap,
-	const struct ieee80211_key *k)
+static int
+rt2860_vap_key_delete(struct ieee80211vap *vap, const struct ieee80211_key  
*k)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2212,8 +2208,8 @@
  	sc = ifp->if_softc;

  	RT2860_DPRINTF(sc, RT2860_DEBUG_KEY,
-		"%s: VAP key delete: keyix=%d, keylen=%d, macaddr=%s, group=%d\n",
-		device_get_nameunit(sc->sc_dev), k->wk_keyix, k->wk_keylen,  
ether_sprintf(k->wk_macaddr),
+		"VAP key delete: keyix=%d, keylen=%d, macaddr=%s, group=%d\n",
+		k->wk_keyix, k->wk_keylen, ether_sprintf(k->wk_macaddr),
  		(k->wk_flags & IEEE80211_KEY_GROUP) ? 1 : 0);

  	if (k->wk_flags & IEEE80211_KEY_GROUP) {
@@ -2244,7 +2240,8 @@
  /*
   * rt2860_vap_update_beacon
   */
-static void rt2860_vap_update_beacon(struct ieee80211vap *vap, int what)
+static void
+rt2860_vap_update_beacon(struct ieee80211vap *vap, int what)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2262,8 +2259,7 @@
  	bo = &rvap->beacon_offsets;

  	RT2860_DPRINTF(sc, RT2860_DEBUG_BEACON,
-		"%s: VAP update beacon: what=%d\n",
-		device_get_nameunit(sc->sc_dev), what);
+	    "VAP update beacon: what=%d\n", what);

  	setbit(bo->bo_flags, what);

@@ -2281,7 +2277,8 @@
  /*
   * rt2860_media_change
   */
-static int rt2860_media_change(struct ifnet *ifp)
+static int
+rt2860_media_change(struct ifnet *ifp)
  {
  	int error;

@@ -2293,8 +2290,9 @@
  /*
   * rt2860_node_alloc
   */
-static struct ieee80211_node *rt2860_node_alloc(struct ieee80211vap *vap,
-	const uint8_t mac[IEEE80211_ADDR_LEN])
+static struct ieee80211_node *
+rt2860_node_alloc(struct ieee80211vap *vap,
+    const uint8_t mac[IEEE80211_ADDR_LEN])
  {
  	return malloc(sizeof(struct rt2860_softc_node),
  		M_80211_NODE, M_NOWAIT | M_ZERO);
@@ -2303,7 +2301,8 @@
  /*
   * rt2860_node_cleanup
   */
-static void rt2860_node_cleanup(struct ieee80211_node *ni)
+static void
+rt2860_node_cleanup(struct ieee80211_node *ni)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2318,9 +2317,8 @@
  	rni = (struct rt2860_softc_node *) ni;

  	RT2860_DPRINTF(sc, RT2860_DEBUG_NODE,
-		"%s: node cleanup: macaddr=%s, associd=0x%04x, staid=0x%02x\n",
-		device_get_nameunit(sc->sc_dev), ether_sprintf(ni->ni_macaddr),
-		ni->ni_associd, rni->staid);
+	    "node cleanup: macaddr=%s, associd=0x%04x, staid=0x%02x\n",
+	    ether_sprintf(ni->ni_macaddr), ni->ni_associd, rni->staid);

  	if (rni->staid != 0) {
  		vapid = 0;
@@ -2345,8 +2343,9 @@
  /*
   * rt2860_node_getmimoinfo
   */
-static void rt2860_node_getmimoinfo(const struct ieee80211_node *ni,
-	struct ieee80211_mimo_info *mi)
+static void
+rt2860_node_getmimoinfo(const struct ieee80211_node *ni,
+    struct ieee80211_mimo_info *mi)
  {
  	const struct rt2860_softc_node *rni;
  	int i;
@@ -2362,9 +2361,9 @@
  /*
   * rt2860_setregdomain
   */
-static int rt2860_setregdomain(struct ieee80211com *ic,
-	struct ieee80211_regdomain *reg,
-	int nchans, struct ieee80211_channel chans[])
+static int
+rt2860_setregdomain(struct ieee80211com *ic, struct ieee80211_regdomain  
*reg,
+    int nchans, struct ieee80211_channel chans[])
  {
  	struct rt2860_softc *sc;
  	struct ifnet *ifp;
@@ -2373,9 +2372,9 @@
  	sc = ifp->if_softc;

  	RT2860_DPRINTF(sc, RT2860_DEBUG_STATE,
-		"%s: set regulatory domain: country=%d, country code string=%c%c,  
location=%c\n",
-		device_get_nameunit(sc->sc_dev),
-		reg->country, reg->isocc[0], reg->isocc[1], reg->location);
+	    "set regulatory domain: country=%d, country code string=%c%c, "
+	    "location=%c\n",
+	    reg->country, reg->isocc[0], reg->isocc[1], reg->location);

  	return 0;
  }
@@ -2383,8 +2382,9 @@
  /*
   * rt2860_getradiocaps
   */
-static void rt2860_getradiocaps(struct ieee80211com *ic,
-	int maxchans, int *nchans, struct ieee80211_channel chans[])
+static void
+rt2860_getradiocaps(struct ieee80211com *ic, int maxchans, int *nchans,
+    struct ieee80211_channel chans[])
  {
  	*nchans = (ic->ic_nchans >= maxchans) ? maxchans : ic->ic_nchans;

@@ -2394,7 +2394,8 @@
  /*
   * rt2860_scan_start
   */
-static void rt2860_scan_start(struct ieee80211com *ic)
+static void
+rt2860_scan_start(struct ieee80211com *ic)
  {
  	struct rt2860_softc *sc;
  	struct ifnet *ifp;
@@ -2412,7 +2413,8 @@
  /*
   * rt2860_scan_end
   */
-static void rt2860_scan_end(struct ieee80211com *ic)
+static void
+rt2860_scan_end(struct ieee80211com *ic)
  {
  	struct rt2860_softc *sc;
  	struct ifnet *ifp;
@@ -2430,7 +2432,8 @@
  /*
   * rt2860_set_channel
   */
-static void rt2860_set_channel(struct ieee80211com *ic)
+static void
+rt2860_set_channel(struct ieee80211com *ic)
  {
  	struct rt2860_softc *sc;
  	struct ifnet *ifp;
@@ -2439,12 +2442,12 @@
  	sc = ifp->if_softc;

  	RT2860_DPRINTF(sc, RT2860_DEBUG_CHAN,
-		"%s: set channel: channel=%u, HT%s%s\n",
-		device_get_nameunit(sc->sc_dev),
+		"set channel: channel=%u, HT%s%s\n",
  		ieee80211_chan2ieee(ic, ic->ic_curchan),
  		!IEEE80211_IS_CHAN_HT(ic->ic_curchan) ? " disabled" :
-			IEEE80211_IS_CHAN_HT20(ic->ic_curchan) ? "20":
-				IEEE80211_IS_CHAN_HT40U(ic->ic_curchan) ? "40U" : "40D",
+		    IEEE80211_IS_CHAN_HT20(ic->ic_curchan) ? "20":
+			IEEE80211_IS_CHAN_HT40U(ic->ic_curchan) ?
+			    "40U" : "40D",
  		(ic->ic_flags & IEEE80211_F_SCAN) ? ", scanning" : "");

  	RT2860_SOFTC_LOCK(sc);
@@ -2457,7 +2460,8 @@
  /*
   * rt2860_newassoc
   */
-static void rt2860_newassoc(struct ieee80211_node *ni, int isnew)
+static void
+rt2860_newassoc(struct ieee80211_node *ni, int isnew)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2496,13 +2500,15 @@
  		rt2860_amrr_node_init(&rvap->amrr, &sc->amrr_node[wcid], ni);

  		RT2860_DPRINTF(sc, RT2860_DEBUG_RATE,
-			"%s: initial%s node Tx rate: associd=0x%04x, rate=0x%02x, max  
rate=0x%02x\n",
-			device_get_nameunit(sc->sc_dev),
-			(ni->ni_flags & IEEE80211_NODE_HT) ? " HT" : "",
-			ni->ni_associd, ni->ni_txrate,
-			(ni->ni_flags & IEEE80211_NODE_HT) ?
-				(ni->ni_htrates.rs_rates[ni->ni_htrates.rs_nrates - 1] |  
IEEE80211_RATE_MCS) :
-				(ni->ni_rates.rs_rates[ni->ni_rates.rs_nrates - 1] &  
IEEE80211_RATE_VAL));
+		    "initial%s node Tx rate: associd=0x%04x, rate=0x%02x, "
+		    "max rate=0x%02x\n",
+		    (ni->ni_flags & IEEE80211_NODE_HT) ? " HT" : "",
+		    ni->ni_associd, ni->ni_txrate,
+		    (ni->ni_flags & IEEE80211_NODE_HT) ?
+		    (ni->ni_htrates.rs_rates[ni->ni_htrates.rs_nrates - 1] |
+			IEEE80211_RATE_MCS) :
+		    (ni->ni_rates.rs_rates[ni->ni_rates.rs_nrates - 1] &
+			IEEE80211_RATE_VAL));

  		rt2860_asic_updateprot(sc);
  		rt2860_asic_updateslot(sc);
@@ -2510,18 +2516,20 @@
  	}

  	RT2860_DPRINTF(sc, RT2860_DEBUG_NODE,
-		"%s: new association: isnew=%d, macaddr=%s, associd=0x%04x,  
staid=0x%02x, QoS %s, ERP %s, HT %s\n",
-		device_get_nameunit(sc->sc_dev), isnew, ether_sprintf(ni->ni_macaddr),
-		ni->ni_associd, rni->staid,
-		(ni->ni_flags & IEEE80211_NODE_QOS) ? "enabled" : "disabled",
-		(ni->ni_flags & IEEE80211_NODE_ERP) ? "enabled" : "disabled",
-		(ni->ni_flags & IEEE80211_NODE_HT) ? "enabled" : "disabled");
+	    "new association: isnew=%d, macaddr=%s, associd=0x%04x, "
+	    "staid=0x%02x, QoS %s, ERP %s, HT %s\n",
+	    isnew, ether_sprintf(ni->ni_macaddr),
+	    ni->ni_associd, rni->staid,
+	    (ni->ni_flags & IEEE80211_NODE_QOS) ? "enabled" : "disabled",
+	    (ni->ni_flags & IEEE80211_NODE_ERP) ? "enabled" : "disabled",
+	    (ni->ni_flags & IEEE80211_NODE_HT) ? "enabled" : "disabled");
  }

  /*
   * rt2860_updateslot
   */
-static void rt2860_updateslot(struct ifnet *ifp)
+static void
+rt2860_updateslot(struct ifnet *ifp)
  {
  	struct rt2860_softc *sc;

@@ -2533,7 +2541,8 @@
  /*
   * rt2860_update_promisc
   */
-static void rt2860_update_promisc(struct ifnet *ifp)
+static void
+rt2860_update_promisc(struct ifnet *ifp)
  {
  	struct rt2860_softc *sc;

@@ -2547,7 +2556,8 @@
  /*
   * rt2860_update_mcast
   */
-static void rt2860_update_mcast(struct ifnet *ifp)
+static void
+rt2860_update_mcast(struct ifnet *ifp)
  {
  	struct rt2860_softc *sc;

@@ -2557,7 +2567,8 @@
  /*
   * rt2860_wme_update
   */
-static int rt2860_wme_update(struct ieee80211com *ic)
+static int
+rt2860_wme_update(struct ieee80211com *ic)
  {
  	struct rt2860_softc *sc;
  	struct ifnet *ifp;
@@ -2573,8 +2584,9 @@
  /*
   * rt2860_raw_xmit
   */
-static int rt2860_raw_xmit(struct ieee80211_node *ni, struct mbuf *m,
-	const struct ieee80211_bpf_params *params)
+static int
+rt2860_raw_xmit(struct ieee80211_node *ni, struct mbuf *m,
+    const struct ieee80211_bpf_params *params)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2596,12 +2608,13 @@
  	}

  	RT2860_SOFTC_TX_RING_LOCK(&sc->tx_ring[sc->tx_ring_mgtqid]);
-	if (sc->tx_ring[sc->tx_ring_mgtqid].data_queued >=  
RT2860_SOFTC_TX_RING_DATA_COUNT) {
+	if (sc->tx_ring[sc->tx_ring_mgtqid].data_queued >=
+	    RT2860_SOFTC_TX_RING_DATA_COUNT) {
  		RT2860_SOFTC_TX_RING_UNLOCK(&sc->tx_ring[sc->tx_ring_mgtqid]);

  		RT2860_DPRINTF(sc, RT2860_DEBUG_TX,
-			"%s: raw xmit: Tx ring with qid=%d is full\n",
-			device_get_nameunit(sc->sc_dev), sc->tx_ring_mgtqid);
+			"raw xmit: Tx ring with qid=%d is full\n",
+			sc->tx_ring_mgtqid);

  		ifp->if_drv_flags |= IFF_DRV_OACTIVE;

@@ -2673,9 +2686,9 @@
  /*
   * rt2860_recv_action
   */
-static int rt2860_recv_action(struct ieee80211_node *ni,
-	const struct ieee80211_frame *wh,
-	const uint8_t *frm, const uint8_t *efrm)
+static int
+rt2860_recv_action(struct ieee80211_node *ni,
+    const struct ieee80211_frame *wh, const uint8_t *frm, const uint8_t  
*efrm)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2702,8 +2715,9 @@
  			wcid = rni->staid;

  			RT2860_DPRINTF(sc, RT2860_DEBUG_BA,
-				"%s: received DELBA request: associd=0x%04x, staid=0x%02x, tid=%d\n",
-				device_get_nameunit(sc->sc_dev), ni->ni_associd, rni->staid, tid);
+			    "received DELBA request: associd=0x%04x, "
+			    "staid=0x%02x, tid=%d\n",
+			    ni->ni_associd, rni->staid, tid);

  			if (rni->staid != 0) {
  				RT2860_SOFTC_LOCK(sc);
@@ -2722,8 +2736,8 @@
  /*
   * rt2860_send_action
   */
-static int rt2860_send_action(struct ieee80211_node *ni,
-	int cat, int act, void *sa)
+static int
+rt2860_send_action(struct ieee80211_node *ni, int cat, int act, void *sa)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2743,42 +2757,47 @@

  	if (cat == IEEE80211_ACTION_CAT_BA) {
  		switch (act) {
-			/* IEEE80211_ACTION_BA_ADDBA_RESPONSE */
-			case IEEE80211_ACTION_BA_ADDBA_RESPONSE:
-				status = args[1];
-				baparamset = args[2];
-				tid = RT2860_MS(baparamset, IEEE80211_BAPS_TID);
-				bufsize = RT2860_MS(baparamset, IEEE80211_BAPS_BUFSIZ);
-
-				RT2860_DPRINTF(sc, RT2860_DEBUG_BA,
-					"%s: sending ADDBA response: associd=0x%04x, staid=0x%02x, status=%d,  
tid=%d, bufsize=%d\n",
-					device_get_nameunit(sc->sc_dev), ni->ni_associd, rni->staid, status,  
tid, bufsize);
-
-				if (status == IEEE80211_STATUS_SUCCESS) {
-					RT2860_SOFTC_LOCK(sc);
-
-					rt2860_asic_add_ba_session(sc, wcid, tid);
-					RT2860_SOFTC_UNLOCK(sc);
-
-				}
+		/* IEEE80211_ACTION_BA_ADDBA_RESPONSE */
+		case IEEE80211_ACTION_BA_ADDBA_RESPONSE:
+			status = args[1];
+			baparamset = args[2];
+			tid = RT2860_MS(baparamset, IEEE80211_BAPS_TID);
+			bufsize = RT2860_MS(baparamset, IEEE80211_BAPS_BUFSIZ);
+
+			RT2860_DPRINTF(sc, RT2860_DEBUG_BA,
+			    "sending ADDBA response: associd=0x%04x, "
+			    "staid=0x%02x, status=%d, tid=%d, bufsize=%d\n",
+			    ni->ni_associd,
+			    rni->staid, status, tid, bufsize);
+
+			if (status == IEEE80211_STATUS_SUCCESS) {
+				RT2860_SOFTC_LOCK(sc);
+
+				rt2860_asic_add_ba_session(sc, wcid, tid);
+				RT2860_SOFTC_UNLOCK(sc);
+
+			}
  			break;

-			/* IEEE80211_ACTION_BA_DELBA */
-			case IEEE80211_ACTION_BA_DELBA:
-				baparamset = RT2860_SM(args[0], IEEE80211_DELBAPS_TID) | args[1];
-				tid = RT2860_MS(baparamset, IEEE80211_DELBAPS_TID);
-
-				RT2860_DPRINTF(sc, RT2860_DEBUG_BA,
-					"%s: sending DELBA request: associd=0x%04x, staid=0x%02x, tid=%d\n",
-					device_get_nameunit(sc->sc_dev), ni->ni_associd, rni->staid, tid);
-
-				if (RT2860_MS(baparamset, IEEE80211_DELBAPS_INIT) !=  
IEEE80211_DELBAPS_INIT) {
-					RT2860_SOFTC_LOCK(sc);
-
-					rt2860_asic_del_ba_session(sc, wcid, tid);
-					RT2860_SOFTC_UNLOCK(sc);
-
-				}
+		/* IEEE80211_ACTION_BA_DELBA */
+		case IEEE80211_ACTION_BA_DELBA:
+			baparamset = RT2860_SM(args[0],
+			    IEEE80211_DELBAPS_TID) | args[1];
+			tid = RT2860_MS(baparamset, IEEE80211_DELBAPS_TID);
+
+			RT2860_DPRINTF(sc, RT2860_DEBUG_BA,
+				"sending DELBA request: associd=0x%04x, "
+				"staid=0x%02x, tid=%d\n",
+				ni->ni_associd, rni->staid, tid);
+
+			if (RT2860_MS(baparamset, IEEE80211_DELBAPS_INIT) !=
+			    IEEE80211_DELBAPS_INIT) {
+				RT2860_SOFTC_LOCK(sc);
+
+				rt2860_asic_del_ba_session(sc, wcid, tid);
+				RT2860_SOFTC_UNLOCK(sc);
+
+			}
  			break;
  		}
  	}
@@ -2789,9 +2808,9 @@
  /*
   * rt2860_addba_response
   */
-static int rt2860_addba_response(struct ieee80211_node *ni,
-	struct ieee80211_tx_ampdu *tap,
-	int status, int baparamset, int batimeout)
+static int
+rt2860_addba_response(struct ieee80211_node *ni,
+    struct ieee80211_tx_ampdu *tap, int status, int baparamset, int  
batimeout)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2840,10 +2859,10 @@
  	}

  	RT2860_DPRINTF(sc, RT2860_DEBUG_BA,
-		"%s: received ADDBA response: associd=0x%04x, staid=0x%02x, status=%d,  
tid=%d, "
-		"old bufsize=%d, new bufsize=%d\n",
-		device_get_nameunit(sc->sc_dev), ni->ni_associd, rni->staid, status, tid,
-		old_bufsize, new_bufsize);
+	    "received ADDBA response: associd=0x%04x, staid=0x%02x, "
+	    "status=%d, tid=%d, old bufsize=%d, new bufsize=%d\n",
+	    ni->ni_associd, rni->staid,
+	    status, tid, old_bufsize, new_bufsize);

  	ret = sc->addba_response(ni, tap, status, baparamset, batimeout);

@@ -2863,8 +2882,8 @@
  /*
   * rt2860_addba_stop
   */
-static void rt2860_addba_stop(struct ieee80211_node *ni,
-	struct ieee80211_tx_ampdu *tap)
+static void
+rt2860_addba_stop(struct ieee80211_node *ni, struct ieee80211_tx_ampdu  
*tap)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2880,8 +2899,8 @@
  	tid = WME_AC_TO_TID(tap->txa_ac);

  	RT2860_DPRINTF(sc, RT2860_DEBUG_BA,
-	    "%s: stopping A-MPDU Tx: associd=0x%04x, staid=0x%02x, tid=%d\n",
-	    device_get_nameunit(sc->sc_dev), ni->ni_associd, rni->staid, tid);
+	    "stopping A-MPDU Tx: associd=0x%04x, staid=0x%02x, tid=%d\n",
+	    ni->ni_associd, rni->staid, tid);

  	if (tap->txa_flags & IEEE80211_AGGR_RUNNING) {
  		if (sc->tx_ampdu_sessions > 0) {
@@ -2904,9 +2923,10 @@
  /*
   * rt2860_ampdu_rx_start
   */
-static int rt2860_ampdu_rx_start(struct ieee80211_node *ni,
-	struct ieee80211_rx_ampdu *rap,
-	int baparamset, int batimeout, int baseqctl)
+static int
+rt2860_ampdu_rx_start(struct ieee80211_node *ni,
+    struct ieee80211_rx_ampdu *rap, int baparamset, int batimeout,
+    int baseqctl)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2922,8 +2942,8 @@
  	tid = RT2860_MS(baparamset, IEEE80211_BAPS_TID);

  	RT2860_DPRINTF(sc, RT2860_DEBUG_BA,
-		"%s: starting A-MPDU Rx: associd=0x%04x, staid=0x%02x, tid=%d\n",
-		device_get_nameunit(sc->sc_dev), ni->ni_associd, rni->staid, tid);
+	    "starting A-MPDU Rx: associd=0x%04x, staid=0x%02x, tid=%d\n",
+	    ni->ni_associd, rni->staid, tid);

  	if (!(rap->rxa_flags & IEEE80211_AGGR_RUNNING))
  		sc->rx_ampdu_sessions++;
@@ -2934,8 +2954,9 @@
  /*
   * rt2860_ampdu_rx_stop
   */
-static void rt2860_ampdu_rx_stop(struct ieee80211_node *ni,
-	struct ieee80211_rx_ampdu *rap)
+static void
+rt2860_ampdu_rx_stop(struct ieee80211_node *ni,
+    struct ieee80211_rx_ampdu *rap)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2948,8 +2969,8 @@
  	rni = (struct rt2860_softc_node *) ni;

  	RT2860_DPRINTF(sc, RT2860_DEBUG_BA,
-		"%s: stopping A-MPDU Rx: associd=0x%04x, staid=0x%02x\n",
-		device_get_nameunit(sc->sc_dev), ni->ni_associd, rni->staid);
+		"stopping A-MPDU Rx: associd=0x%04x, staid=0x%02x\n",
+		 ni->ni_associd, rni->staid);

  	if (rap->rxa_flags & IEEE80211_AGGR_RUNNING) {
  		if (sc->rx_ampdu_sessions > 0)
@@ -2966,8 +2987,9 @@
  /*
   * rt2860_send_bar
   */
-static int rt2860_send_bar(struct ieee80211_node *ni,
-	struct ieee80211_tx_ampdu *tap, ieee80211_seq seqno)
+static int
+rt2860_send_bar(struct ieee80211_node *ni, struct ieee80211_tx_ampdu *tap,
+    ieee80211_seq seqno)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -3018,8 +3040,8 @@
  	ieee80211_ref_node(ni);

  	RT2860_DPRINTF(sc, RT2860_DEBUG_BA,
-		"%s: sending BAR: associd=0x%04x, staid=0x%02x, tid=%d, seqno=%d\n",
-		device_get_nameunit(sc->sc_dev), ni->ni_associd, rni->staid, tid, seqno);
+		"sending BAR: associd=0x%04x, staid=0x%02x, tid=%d, seqno=%d\n",
+		 ni->ni_associd, rni->staid, tid, seqno);
***The diff for this file has been truncated for email.***

==============================================================================
Revision: 4e6aadf3834b
Author:   Aleksandr Rybalko <ray at ddteam.net>
Date:     Wed Mar 28 06:10:19 2012
Log:      Update/fix EEPROM address + fix MAC reg names to known.
http://code.google.com/p/rt2860-in-ral/source/detail?r=4e6aadf3834b

Modified:
  /sys/dev/ral/rt2860reg.h

=======================================
--- /sys/dev/ral/rt2860reg.h	Wed Mar 21 07:49:56 2012
+++ /sys/dev/ral/rt2860reg.h	Wed Mar 28 06:10:19 2012
@@ -766,6 +766,7 @@
  #define RT2860_EEPROM_RSSI2_2GHZ	0x24
  #define RT2860_EEPROM_RSSI1_5GHZ	0x25
  #define RT2860_EEPROM_RSSI2_5GHZ	0x26
+#define RT2860_EEPROM_MAX_TXPWR		0x27
  #define RT2860_EEPROM_DELTAPWR		0x28
  #define RT2860_EEPROM_PWR2GHZ_BASE1	0x29
  #define RT2860_EEPROM_PWR2GHZ_BASE2	0x30
@@ -782,8 +783,12 @@
  #define RT2860_EEPROM_TSSI4_5GHZ	0x6d
  #define RT2860_EEPROM_TSSI5_5GHZ	0x6e
  #define RT2860_EEPROM_RPWR		0x6f
+#define RT2860_EEPROM_TXPWR_2G_20	0x6f
+#define RT2860_EEPROM_TXPWR_2G_40	0x77
+#define RT2860_EEPROM_TXPWR_5G_20	0x7d
+#define RT2860_EEPROM_TXPWR_5G_40	0x85
  #define RT2860_EEPROM_BBP_BASE		0x78
-#define RT3071_EEPROM_RF_BASE		0x82
+#define RT3071_EEPROM_RF_BASE		0x41

  /*
   * Control and status registers access macros.
@@ -872,8 +877,8 @@
  	{ RT2860_AUTO_RSP_CFG,		0x00000013 },	\
  	{ RT2860_CCK_PROT_CFG,		0x05740003 },	\
  	{ RT2860_OFDM_PROT_CFG,		0x05740003 },	\
-	{ RT2860_PBF_CFG,		0x00f40006 },	\
-	{ RT2860_WPDMA_GLO_CFG,		0x00000030 },	\
+	{ RT2860_REG_PBF_CFG,		0x00f40006 },	\
+	{ RT2860_REG_SCHDMA_WPDMA_GLO_CFG, 0x00000030 },	\
  	{ RT2860_GF20_PROT_CFG,		0x01744004 },	\
  	{ RT2860_GF40_PROT_CFG,		0x03f44084 },	\
  	{ RT2860_MM20_PROT_CFG,		0x01744004 },	\

==============================================================================
Revision: 05a4e237c179
Author:   Aleksandr Rybalko <ray at ddteam.net>
Date:     Wed Mar 28 06:18:19 2012
Log:      revert wrong
http://code.google.com/p/rt2860-in-ral/source/detail?r=05a4e237c179

Modified:
  /sys/dev/ral/rt2860.c

=======================================
--- /sys/dev/ral/rt2860.c	Wed Mar 28 06:08:52 2012
+++ /sys/dev/ral/rt2860.c	Wed Mar 28 06:18:19 2012
@@ -253,7 +253,9 @@
  static int rt2860_tx_data(struct rt2860_softc *sc,
  			  struct mbuf *m, struct ieee80211_node *ni, int qid);

-static void rt2860_reset_dma(struct rt2860_softc *sc);
+static void rt2860_tx_coherent_intr(struct rt2860_softc *sc);
+static void rt2860_rx_coherent_intr(struct rt2860_softc *sc);
+static void rt2860_txrx_coherent_intr(struct rt2860_softc *sc);
  static void rt2860_fifo_sta_full_intr(struct rt2860_softc *sc);
  static void rt2860_rx_intr(struct rt2860_softc *sc);
  static void rt2860_tx_intr(struct rt2860_softc *sc, int qid);
@@ -310,8 +312,7 @@
  	uint32_t	reg;
  	uint32_t	val;
  } rt2860_def_mac[] = {
-	RT2870_DEF_MAC
-//	RT2860_DEF_MAC
+	RT2860_DEF_MAC
  };

  static const struct {
@@ -344,8 +345,7 @@
  /*
   * rt2860_attach
   */
-int
-rt2860_attach(device_t dev, int id)
+int rt2860_attach(device_t dev, int id)
  {
  	struct rt2860_softc *sc;
  	struct ifnet *ifp;
@@ -370,7 +370,9 @@
  		"debug", CTLFLAG_RW, &sc->debug, 0, "rt2860 debug level");
  #endif

-	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY, "attaching\n");
+	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY,
+		"%s: attaching\n",
+		device_get_nameunit(sc->sc_dev));

  	/* wait for NIC to initialize */
  	for (ntries = 0; ntries < 100; ntries++) {
@@ -593,8 +595,7 @@
  /*
   * rt2860_detach
   */
-int
-rt2860_detach(void *xsc)
+int rt2860_detach(void *xsc)
  {
  	struct rt2860_softc *sc = xsc;
  	struct ifnet *ifp;
@@ -604,7 +605,9 @@
  	ifp = sc->sc_ifp;
  	ic = ifp->if_l2com;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY, "detaching\n");
+	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY,
+		"%s: detaching\n",
+		device_get_nameunit(sc->sc_dev));

  	RT2860_SOFTC_LOCK(sc);

@@ -645,7 +648,9 @@
  {
  	struct rt2860_softc *sc = xsc;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY, "shutting down\n");
+	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY,
+		"%s: shutting down\n",
+		device_get_nameunit(sc->sc_dev));

  	rt2860_stop(sc);

@@ -662,7 +667,9 @@
  {
  	struct rt2860_softc *sc = xsc;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY, "suspending\n");
+	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY,
+		"%s: suspending\n",
+		device_get_nameunit(sc->sc_dev));

  	rt2860_stop(sc);

@@ -682,7 +689,9 @@

  	ifp = sc->sc_ifp;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY, "resuming\n");
+	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY,
+		"%s: resuming\n",
+		device_get_nameunit(sc->sc_dev));

  	if (ifp->if_flags & IFF_UP)
  		rt2860_init(sc);
@@ -792,8 +801,7 @@
  /*
   * rt2860_init_channels_ht40
   */
-static void
-rt2860_init_channels_ht40(struct rt2860_softc *sc)
+static void rt2860_init_channels_ht40(struct rt2860_softc *sc)
  {
  	struct ifnet *ifp;
  	struct ieee80211com *ic;
@@ -960,8 +968,7 @@
  /*
   * rt2860_init_locked
   */
-static void
-rt2860_init_locked(void *priv)
+static void rt2860_init_locked(void *priv)
  {
  #define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
  	struct rt2860_softc *sc;
@@ -977,7 +984,9 @@
  	ifp = sc->sc_ifp;
  	ic = ifp->if_l2com;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY, "initializing\n");
+	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY,
+		"%s: initializing\n",
+		device_get_nameunit(sc->sc_dev));

  	RT2860_SOFTC_ASSERT_LOCKED(sc);

@@ -995,7 +1004,7 @@
  		sc->flags |= RT2860_SOFTC_FLAGS_UCODE_LOADED;

  		/* Blink every TX */
-		RAL_WRITE(sc, RT2860_LED_CFG,
+		RAL_WRITE(sc, RT2860_LED_CFG,
  		    LED_CFG_LED_POLARITY |
  		    LED_CFG_Y_LED_MODE_ONTX |
  		    LED_CFG_G_LED_MODE_ONTX |
@@ -1093,6 +1102,7 @@
  		device_printf(sc->sc_dev, "timeout waiting for MAC\n");
  		goto fail;
  	}
+
  	/* clear Host to MCU mailbox */

  	RAL_WRITE(sc, RT2860_REG_H2M_MAILBOX_BBP_AGENT, 0);
@@ -1354,8 +1364,7 @@
  /*
   * rt2860_init
   */
-static void
-rt2860_init(void *priv)
+static void rt2860_init(void *priv)
  {
  	struct rt2860_softc *sc;

@@ -1371,8 +1380,7 @@
  /*
   * rt2860_init_bbp
   */
-static int
-rt2860_init_bbp(struct rt2860_softc *sc)
+static int rt2860_init_bbp(struct rt2860_softc *sc)
  {
  #define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
  	int ntries, i;
@@ -1410,8 +1418,7 @@
  /*
   * rt2860_stop_locked
   */
-static void
-rt2860_stop_locked(void *priv)
+static void rt2860_stop_locked(void *priv)
  {
  	struct rt2860_softc *sc;
  	struct ifnet *ifp;
@@ -1422,7 +1429,9 @@
  	ifp = sc->sc_ifp;
  	ic = ifp->if_l2com;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY, "stopping\n");
+	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY,
+		"%s: stopping\n",
+		device_get_nameunit(sc->sc_dev));

  	RT2860_SOFTC_ASSERT_LOCKED(sc);

@@ -1473,8 +1482,7 @@
  /*
   * rt2860_stop
   */
-static void
-rt2860_stop(void *priv)
+static void rt2860_stop(void *priv)
  {
  	struct rt2860_softc *sc;

@@ -1490,8 +1498,7 @@
  /*
   * rt2860_start
   */
-static void
-rt2860_start(struct ifnet *ifp)
+static void rt2860_start(struct ifnet *ifp)
  {
  	struct rt2860_softc *sc;
  #ifdef RT2860_NO_HW_CRYPTO
@@ -1537,12 +1544,12 @@

  		RT2860_SOFTC_TX_RING_LOCK(&sc->tx_ring[qid]);

-		if (sc->tx_ring[qid].data_queued >=
-		    RT2860_SOFTC_TX_RING_DATA_COUNT) {
+		if (sc->tx_ring[qid].data_queued >= RT2860_SOFTC_TX_RING_DATA_COUNT) {
  			RT2860_SOFTC_TX_RING_UNLOCK(&sc->tx_ring[qid]);

  			RT2860_DPRINTF(sc, RT2860_DEBUG_TX,
-			    "if_start: Tx ring with qid=%d is full\n", qid);
+				"%s: if_start: Tx ring with qid=%d is full\n",
+				device_get_nameunit(sc->sc_dev), qid);

  			m_freem(m);
  			ieee80211_free_node(ni);
@@ -1580,8 +1587,7 @@
  /*
   * rt2860_ioctl
   */
-static int
-rt2860_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
+static int rt2860_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -1641,11 +1647,10 @@
  /*
   * rt2860_vap_create
   */
-static struct ieee80211vap *
-rt2860_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ],
-    int unit, enum ieee80211_opmode opmode, int flags,
-    const uint8_t bssid[IEEE80211_ADDR_LEN],
-    const uint8_t mac[IEEE80211_ADDR_LEN])
+static struct ieee80211vap *rt2860_vap_create(struct ieee80211com *ic,
+	const char name[IFNAMSIZ], int unit, enum ieee80211_opmode opmode,
+	int flags, const uint8_t bssid[IEEE80211_ADDR_LEN],
+	const uint8_t mac[IEEE80211_ADDR_LEN])
  {
  	struct rt2860_softc *sc;
  	struct ifnet *ifp;
@@ -1655,8 +1660,10 @@
  	ifp = ic->ic_ifp;
  	sc = ifp->if_softc;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_STATE, "VAP create: opmode=%s\n",
-	    ieee80211_opmode_name[opmode]);
+	RT2860_DPRINTF(sc, RT2860_DEBUG_STATE,
+		"%s: VAP create: opmode=%s\n",
+		device_get_nameunit(sc->sc_dev),
+		ieee80211_opmode_name[opmode]);

  	switch (opmode) {
  	case IEEE80211_M_IBSS:
@@ -1765,8 +1772,7 @@
  /*
   * rt2860_vap_delete
   */
-static void
-rt2860_vap_delete(struct ieee80211vap *vap)
+static void rt2860_vap_delete(struct ieee80211vap *vap)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -1780,8 +1786,9 @@
  	rvap = (struct rt2860_softc_vap *) vap;
  	opmode = vap->iv_opmode;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_STATE, "VAP delete: opmode=%s\n",
-	    ieee80211_opmode_name[opmode]);
+	RT2860_DPRINTF(sc, RT2860_DEBUG_STATE,
+		"%s: VAP delete: opmode=%s\n",
+		device_get_nameunit(sc->sc_dev), ieee80211_opmode_name[opmode]);

  	rt2860_amrr_cleanup(&rvap->amrr);

@@ -1826,8 +1833,7 @@
  /*
   * rt2860_reset_vap
   */
-static int
-rt2860_vap_reset(struct ieee80211vap *vap, u_long cmd)
+static int rt2860_vap_reset(struct ieee80211vap *vap, u_long cmd)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -1840,7 +1846,9 @@
  	sc = ifp->if_softc;
  	rvap = (struct rt2860_softc_vap *) vap;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_STATE, "VAP reset: cmd=%lu\n", cmd);
+	RT2860_DPRINTF(sc, RT2860_DEBUG_STATE,
+		"%s: VAP reset: cmd=%lu\n",
+		device_get_nameunit(sc->sc_dev), cmd);

  	error = 0;

@@ -1878,9 +1886,8 @@
  /*
   * rt2860_vap_newstate
   */
-static int
-rt2860_vap_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate,
-    int arg)
+static int rt2860_vap_newstate(struct ieee80211vap *vap,
+	enum ieee80211_state nstate, int arg)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -1897,8 +1904,10 @@

  	ostate = vap->iv_state;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_STATE, "VAP newstate: %s -> %s\n",
-	    ieee80211_state_name[ostate], ieee80211_state_name[nstate]);
+	RT2860_DPRINTF(sc, RT2860_DEBUG_STATE,
+		"%s: VAP newstate: %s -> %s\n",
+		device_get_nameunit(sc->sc_dev),
+		ieee80211_state_name[ostate], ieee80211_state_name[nstate]);

  	error = rvap->newstate(vap, nstate, arg);
  	if (error != 0)
@@ -1965,8 +1974,7 @@
  /*
   * rt2860_vap_key_update_begin
   */
-static void
-rt2860_vap_key_update_begin(struct ieee80211vap *vap)
+static void rt2860_vap_key_update_begin(struct ieee80211vap *vap)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -1976,7 +1984,9 @@
  	ifp = ic->ic_ifp;
  	sc = ifp->if_softc;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_KEY, "VAP key update begin\n");
+	RT2860_DPRINTF(sc, RT2860_DEBUG_KEY,
+		"%s: VAP key update begin\n",
+		device_get_nameunit(sc->sc_dev));

  	taskqueue_block(sc->taskqueue);

@@ -1986,8 +1996,7 @@
  /*
   * rt2860_vap_key_update_end
   */
-static void
-rt2860_vap_key_update_end(struct ieee80211vap *vap)
+static void rt2860_vap_key_update_end(struct ieee80211vap *vap)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -1997,7 +2006,9 @@
  	ifp = ic->ic_ifp;
  	sc = ifp->if_softc;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_KEY, "VAP key update end\n");
+	RT2860_DPRINTF(sc, RT2860_DEBUG_KEY,
+		"%s: VAP key update end\n",
+		device_get_nameunit(sc->sc_dev));

  	IF_UNLOCK(&ifp->if_snd);

@@ -2007,9 +2018,8 @@
  /*
   * rt2860_vap_key_set
   */
-static int
-rt2860_vap_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k,
-    const uint8_t mac[IEEE80211_ADDR_LEN])
+static int rt2860_vap_key_set(struct ieee80211vap *vap,
+	const struct ieee80211_key *k, const uint8_t mac[IEEE80211_ADDR_LEN])
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2043,9 +2053,9 @@
  	sc = ifp->if_softc;

  	RT2860_DPRINTF(sc, RT2860_DEBUG_KEY,
-	    "VAP key set: keyix=%d, keylen=%d, macaddr=%s, mode=%d, group=%d\n",
-	    k->wk_keyix, k->wk_keylen, ether_sprintf(k->wk_macaddr),
-	    mode, (k->wk_flags & IEEE80211_KEY_GROUP) ? 1 : 0);
+		"%s: VAP key set: keyix=%d, keylen=%d, macaddr=%s, mode=%d, group=%d\n",
+		device_get_nameunit(sc->sc_dev), k->wk_keyix, k->wk_keylen,  
ether_sprintf(k->wk_macaddr),
+		mode, (k->wk_flags & IEEE80211_KEY_GROUP) ? 1 : 0);

  	if (!(k->wk_flags & IEEE80211_KEY_GROUP)) {
  		/* install pairwise key */
@@ -2087,8 +2097,9 @@
  			iv[7] = (k->wk_keytsc >> 40);

  			RT2860_DPRINTF(sc, RT2860_DEBUG_KEY,
-			    "VAP key set: iv=%02x %02x %02x %02x %02x %02x %02x %02x\n",
-			    iv[0], iv[1], iv[2], iv[3], iv[4], iv[5], iv[6], iv[7]);
+				"%s: VAP key set: iv=%02x %02x %02x %02x %02x %02x %02x %02x\n",
+				device_get_nameunit(sc->sc_dev),
+				iv[0], iv[1], iv[2], iv[3], iv[4], iv[5], iv[6], iv[7]);
  		}

  		RAL_WRITE_REGION_1(sc, RT2860_REG_IVEIV(wcid), iv, 8);
@@ -2125,15 +2136,11 @@
  			RAL_WRITE_REGION_1(sc, key_base, k->wk_key, 16);

  			if (vap->iv_opmode != IEEE80211_M_HOSTAP) {
-				RAL_WRITE_REGION_1(sc, key_base + 16,
-				    &k->wk_key[16], 8);
-				RAL_WRITE_REGION_1(sc, key_base + 24,
-				    &k->wk_key[24], 8);
+				RAL_WRITE_REGION_1(sc, key_base + 16, &k->wk_key[16], 8);
+				RAL_WRITE_REGION_1(sc, key_base + 24, &k->wk_key[24], 8);
  			} else {
-				RAL_WRITE_REGION_1(sc, key_base + 16,
-				    &k->wk_key[24], 8);
-				RAL_WRITE_REGION_1(sc, key_base + 24,
-				    &k->wk_key[16], 8);
+				RAL_WRITE_REGION_1(sc, key_base + 16, &k->wk_key[24], 8);
+				RAL_WRITE_REGION_1(sc, key_base + 24, &k->wk_key[16], 8);
  			}
  		} else {
  			RAL_WRITE_REGION_1(sc, key_base, k->wk_key, k->wk_keylen);
@@ -2152,8 +2159,7 @@

  				iv[3] = (k->wk_keyix << 6);
  			} else {
-				if (k->wk_cipher->ic_cipher ==
-				    IEEE80211_CIPHER_TKIP) {
+				if (k->wk_cipher->ic_cipher == IEEE80211_CIPHER_TKIP) {
  					iv[0] = (k->wk_keytsc >> 8);
  					iv[1] = ((iv[0] | 0x20) & 0x7f);
  					iv[2] = k->wk_keytsc;
@@ -2165,18 +2171,16 @@
  					iv[2] = 0;
  				}

-				iv[3] = ((k->wk_keyix << 6) |
-				    IEEE80211_WEP_EXTIV);
+				iv[3] = ((k->wk_keyix << 6) | IEEE80211_WEP_EXTIV);
  				iv[4] = (k->wk_keytsc >> 16);
  				iv[5] = (k->wk_keytsc >> 24);
  				iv[6] = (k->wk_keytsc >> 32);
  				iv[7] = (k->wk_keytsc >> 40);

  				RT2860_DPRINTF(sc, RT2860_DEBUG_KEY,
-				    "VAP key set: iv=%02x %02x %02x %02x "
-				    "%02x %02x %02x %02x\n",
-				    iv[0], iv[1], iv[2], iv[3],
-				    iv[4], iv[5], iv[6], iv[7]);
+					"%s: VAP key set: iv=%02x %02x %02x %02x %02x %02x %02x %02x\n",
+					device_get_nameunit(sc->sc_dev),
+					iv[0], iv[1], iv[2], iv[3], iv[4], iv[5], iv[6], iv[7]);
  			}

  			RAL_WRITE_REGION_1(sc, RT2860_REG_IVEIV(wcid), iv, 8);
@@ -2194,8 +2198,8 @@
  /*
   * rt2860_vap_key_delete
   */
-static int
-rt2860_vap_key_delete(struct ieee80211vap *vap, const struct ieee80211_key  
*k)
+static int rt2860_vap_key_delete(struct ieee80211vap *vap,
+	const struct ieee80211_key *k)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2208,8 +2212,8 @@
  	sc = ifp->if_softc;

  	RT2860_DPRINTF(sc, RT2860_DEBUG_KEY,
-		"VAP key delete: keyix=%d, keylen=%d, macaddr=%s, group=%d\n",
-		k->wk_keyix, k->wk_keylen, ether_sprintf(k->wk_macaddr),
+		"%s: VAP key delete: keyix=%d, keylen=%d, macaddr=%s, group=%d\n",
+		device_get_nameunit(sc->sc_dev), k->wk_keyix, k->wk_keylen,  
ether_sprintf(k->wk_macaddr),
  		(k->wk_flags & IEEE80211_KEY_GROUP) ? 1 : 0);

  	if (k->wk_flags & IEEE80211_KEY_GROUP) {
@@ -2240,8 +2244,7 @@
  /*
   * rt2860_vap_update_beacon
   */
-static void
-rt2860_vap_update_beacon(struct ieee80211vap *vap, int what)
+static void rt2860_vap_update_beacon(struct ieee80211vap *vap, int what)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2259,7 +2262,8 @@
  	bo = &rvap->beacon_offsets;

  	RT2860_DPRINTF(sc, RT2860_DEBUG_BEACON,
-	    "VAP update beacon: what=%d\n", what);
+		"%s: VAP update beacon: what=%d\n",
+		device_get_nameunit(sc->sc_dev), what);

  	setbit(bo->bo_flags, what);

@@ -2277,8 +2281,7 @@
  /*
   * rt2860_media_change
   */
-static int
-rt2860_media_change(struct ifnet *ifp)
+static int rt2860_media_change(struct ifnet *ifp)
  {
  	int error;

@@ -2290,9 +2293,8 @@
  /*
   * rt2860_node_alloc
   */
-static struct ieee80211_node *
-rt2860_node_alloc(struct ieee80211vap *vap,
-    const uint8_t mac[IEEE80211_ADDR_LEN])
+static struct ieee80211_node *rt2860_node_alloc(struct ieee80211vap *vap,
+	const uint8_t mac[IEEE80211_ADDR_LEN])
  {
  	return malloc(sizeof(struct rt2860_softc_node),
  		M_80211_NODE, M_NOWAIT | M_ZERO);
@@ -2301,8 +2303,7 @@
  /*
   * rt2860_node_cleanup
   */
-static void
-rt2860_node_cleanup(struct ieee80211_node *ni)
+static void rt2860_node_cleanup(struct ieee80211_node *ni)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2317,8 +2318,9 @@
  	rni = (struct rt2860_softc_node *) ni;

  	RT2860_DPRINTF(sc, RT2860_DEBUG_NODE,
-	    "node cleanup: macaddr=%s, associd=0x%04x, staid=0x%02x\n",
-	    ether_sprintf(ni->ni_macaddr), ni->ni_associd, rni->staid);
+		"%s: node cleanup: macaddr=%s, associd=0x%04x, staid=0x%02x\n",
+		device_get_nameunit(sc->sc_dev), ether_sprintf(ni->ni_macaddr),
+		ni->ni_associd, rni->staid);

  	if (rni->staid != 0) {
  		vapid = 0;
@@ -2343,9 +2345,8 @@
  /*
   * rt2860_node_getmimoinfo
   */
-static void
-rt2860_node_getmimoinfo(const struct ieee80211_node *ni,
-    struct ieee80211_mimo_info *mi)
+static void rt2860_node_getmimoinfo(const struct ieee80211_node *ni,
+	struct ieee80211_mimo_info *mi)
  {
  	const struct rt2860_softc_node *rni;
  	int i;
@@ -2361,9 +2362,9 @@
  /*
   * rt2860_setregdomain
   */
-static int
-rt2860_setregdomain(struct ieee80211com *ic, struct ieee80211_regdomain  
*reg,
-    int nchans, struct ieee80211_channel chans[])
+static int rt2860_setregdomain(struct ieee80211com *ic,
+	struct ieee80211_regdomain *reg,
+	int nchans, struct ieee80211_channel chans[])
  {
  	struct rt2860_softc *sc;
  	struct ifnet *ifp;
@@ -2372,9 +2373,9 @@
  	sc = ifp->if_softc;

  	RT2860_DPRINTF(sc, RT2860_DEBUG_STATE,
-	    "set regulatory domain: country=%d, country code string=%c%c, "
-	    "location=%c\n",
-	    reg->country, reg->isocc[0], reg->isocc[1], reg->location);
+		"%s: set regulatory domain: country=%d, country code string=%c%c,  
location=%c\n",
+		device_get_nameunit(sc->sc_dev),
+		reg->country, reg->isocc[0], reg->isocc[1], reg->location);

  	return 0;
  }
@@ -2382,9 +2383,8 @@
  /*
   * rt2860_getradiocaps
   */
-static void
-rt2860_getradiocaps(struct ieee80211com *ic, int maxchans, int *nchans,
-    struct ieee80211_channel chans[])
+static void rt2860_getradiocaps(struct ieee80211com *ic,
+	int maxchans, int *nchans, struct ieee80211_channel chans[])
  {
  	*nchans = (ic->ic_nchans >= maxchans) ? maxchans : ic->ic_nchans;

@@ -2394,8 +2394,7 @@
  /*
   * rt2860_scan_start
   */
-static void
-rt2860_scan_start(struct ieee80211com *ic)
+static void rt2860_scan_start(struct ieee80211com *ic)
  {
  	struct rt2860_softc *sc;
  	struct ifnet *ifp;
@@ -2413,8 +2412,7 @@
  /*
   * rt2860_scan_end
   */
-static void
-rt2860_scan_end(struct ieee80211com *ic)
+static void rt2860_scan_end(struct ieee80211com *ic)
  {
  	struct rt2860_softc *sc;
  	struct ifnet *ifp;
@@ -2432,8 +2430,7 @@
  /*
   * rt2860_set_channel
   */
-static void
-rt2860_set_channel(struct ieee80211com *ic)
+static void rt2860_set_channel(struct ieee80211com *ic)
  {
  	struct rt2860_softc *sc;
  	struct ifnet *ifp;
@@ -2442,12 +2439,12 @@
  	sc = ifp->if_softc;

  	RT2860_DPRINTF(sc, RT2860_DEBUG_CHAN,
-		"set channel: channel=%u, HT%s%s\n",
+		"%s: set channel: channel=%u, HT%s%s\n",
+		device_get_nameunit(sc->sc_dev),
  		ieee80211_chan2ieee(ic, ic->ic_curchan),
  		!IEEE80211_IS_CHAN_HT(ic->ic_curchan) ? " disabled" :
-		    IEEE80211_IS_CHAN_HT20(ic->ic_curchan) ? "20":
-			IEEE80211_IS_CHAN_HT40U(ic->ic_curchan) ?
-			    "40U" : "40D",
+			IEEE80211_IS_CHAN_HT20(ic->ic_curchan) ? "20":
+				IEEE80211_IS_CHAN_HT40U(ic->ic_curchan) ? "40U" : "40D",
  		(ic->ic_flags & IEEE80211_F_SCAN) ? ", scanning" : "");

  	RT2860_SOFTC_LOCK(sc);
@@ -2460,8 +2457,7 @@
  /*
   * rt2860_newassoc
   */
-static void
-rt2860_newassoc(struct ieee80211_node *ni, int isnew)
+static void rt2860_newassoc(struct ieee80211_node *ni, int isnew)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2500,15 +2496,13 @@
  		rt2860_amrr_node_init(&rvap->amrr, &sc->amrr_node[wcid], ni);

  		RT2860_DPRINTF(sc, RT2860_DEBUG_RATE,
-		    "initial%s node Tx rate: associd=0x%04x, rate=0x%02x, "
-		    "max rate=0x%02x\n",
-		    (ni->ni_flags & IEEE80211_NODE_HT) ? " HT" : "",
-		    ni->ni_associd, ni->ni_txrate,
-		    (ni->ni_flags & IEEE80211_NODE_HT) ?
-		    (ni->ni_htrates.rs_rates[ni->ni_htrates.rs_nrates - 1] |
-			IEEE80211_RATE_MCS) :
-		    (ni->ni_rates.rs_rates[ni->ni_rates.rs_nrates - 1] &
-			IEEE80211_RATE_VAL));
+			"%s: initial%s node Tx rate: associd=0x%04x, rate=0x%02x, max  
rate=0x%02x\n",
+			device_get_nameunit(sc->sc_dev),
+			(ni->ni_flags & IEEE80211_NODE_HT) ? " HT" : "",
+			ni->ni_associd, ni->ni_txrate,
+			(ni->ni_flags & IEEE80211_NODE_HT) ?
+				(ni->ni_htrates.rs_rates[ni->ni_htrates.rs_nrates - 1] |  
IEEE80211_RATE_MCS) :
+				(ni->ni_rates.rs_rates[ni->ni_rates.rs_nrates - 1] &  
IEEE80211_RATE_VAL));

  		rt2860_asic_updateprot(sc);
  		rt2860_asic_updateslot(sc);
@@ -2516,20 +2510,18 @@
  	}

  	RT2860_DPRINTF(sc, RT2860_DEBUG_NODE,
-	    "new association: isnew=%d, macaddr=%s, associd=0x%04x, "
-	    "staid=0x%02x, QoS %s, ERP %s, HT %s\n",
-	    isnew, ether_sprintf(ni->ni_macaddr),
-	    ni->ni_associd, rni->staid,
-	    (ni->ni_flags & IEEE80211_NODE_QOS) ? "enabled" : "disabled",
-	    (ni->ni_flags & IEEE80211_NODE_ERP) ? "enabled" : "disabled",
-	    (ni->ni_flags & IEEE80211_NODE_HT) ? "enabled" : "disabled");
+		"%s: new association: isnew=%d, macaddr=%s, associd=0x%04x,  
staid=0x%02x, QoS %s, ERP %s, HT %s\n",
+		device_get_nameunit(sc->sc_dev), isnew, ether_sprintf(ni->ni_macaddr),
+		ni->ni_associd, rni->staid,
+		(ni->ni_flags & IEEE80211_NODE_QOS) ? "enabled" : "disabled",
+		(ni->ni_flags & IEEE80211_NODE_ERP) ? "enabled" : "disabled",
+		(ni->ni_flags & IEEE80211_NODE_HT) ? "enabled" : "disabled");
  }

  /*
   * rt2860_updateslot
   */
-static void
-rt2860_updateslot(struct ifnet *ifp)
+static void rt2860_updateslot(struct ifnet *ifp)
  {
  	struct rt2860_softc *sc;

@@ -2541,8 +2533,7 @@
  /*
   * rt2860_update_promisc
   */
-static void
-rt2860_update_promisc(struct ifnet *ifp)
+static void rt2860_update_promisc(struct ifnet *ifp)
  {
  	struct rt2860_softc *sc;

@@ -2556,8 +2547,7 @@
  /*
   * rt2860_update_mcast
   */
-static void
-rt2860_update_mcast(struct ifnet *ifp)
+static void rt2860_update_mcast(struct ifnet *ifp)
  {
  	struct rt2860_softc *sc;

@@ -2567,8 +2557,7 @@
  /*
   * rt2860_wme_update
   */
-static int
-rt2860_wme_update(struct ieee80211com *ic)
+static int rt2860_wme_update(struct ieee80211com *ic)
  {
  	struct rt2860_softc *sc;
  	struct ifnet *ifp;
@@ -2584,9 +2573,8 @@
  /*
   * rt2860_raw_xmit
   */
-static int
-rt2860_raw_xmit(struct ieee80211_node *ni, struct mbuf *m,
-    const struct ieee80211_bpf_params *params)
+static int rt2860_raw_xmit(struct ieee80211_node *ni, struct mbuf *m,
+	const struct ieee80211_bpf_params *params)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2608,13 +2596,12 @@
  	}

  	RT2860_SOFTC_TX_RING_LOCK(&sc->tx_ring[sc->tx_ring_mgtqid]);
-	if (sc->tx_ring[sc->tx_ring_mgtqid].data_queued >=
-	    RT2860_SOFTC_TX_RING_DATA_COUNT) {
+	if (sc->tx_ring[sc->tx_ring_mgtqid].data_queued >=  
RT2860_SOFTC_TX_RING_DATA_COUNT) {
  		RT2860_SOFTC_TX_RING_UNLOCK(&sc->tx_ring[sc->tx_ring_mgtqid]);

  		RT2860_DPRINTF(sc, RT2860_DEBUG_TX,
-			"raw xmit: Tx ring with qid=%d is full\n",
-			sc->tx_ring_mgtqid);
+			"%s: raw xmit: Tx ring with qid=%d is full\n",
+			device_get_nameunit(sc->sc_dev), sc->tx_ring_mgtqid);

  		ifp->if_drv_flags |= IFF_DRV_OACTIVE;

@@ -2686,9 +2673,9 @@
  /*
   * rt2860_recv_action
   */
-static int
-rt2860_recv_action(struct ieee80211_node *ni,
-    const struct ieee80211_frame *wh, const uint8_t *frm, const uint8_t  
*efrm)
+static int rt2860_recv_action(struct ieee80211_node *ni,
+	const struct ieee80211_frame *wh,
+	const uint8_t *frm, const uint8_t *efrm)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2715,9 +2702,8 @@
  			wcid = rni->staid;

  			RT2860_DPRINTF(sc, RT2860_DEBUG_BA,
-			    "received DELBA request: associd=0x%04x, "
-			    "staid=0x%02x, tid=%d\n",
-			    ni->ni_associd, rni->staid, tid);
+				"%s: received DELBA request: associd=0x%04x, staid=0x%02x, tid=%d\n",
+				device_get_nameunit(sc->sc_dev), ni->ni_associd, rni->staid, tid);

  			if (rni->staid != 0) {
  				RT2860_SOFTC_LOCK(sc);
@@ -2736,8 +2722,8 @@
  /*
   * rt2860_send_action
   */
-static int
-rt2860_send_action(struct ieee80211_node *ni, int cat, int act, void *sa)
+static int rt2860_send_action(struct ieee80211_node *ni,
+	int cat, int act, void *sa)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2757,47 +2743,42 @@

  	if (cat == IEEE80211_ACTION_CAT_BA) {
  		switch (act) {
-		/* IEEE80211_ACTION_BA_ADDBA_RESPONSE */
-		case IEEE80211_ACTION_BA_ADDBA_RESPONSE:
-			status = args[1];
-			baparamset = args[2];
-			tid = RT2860_MS(baparamset, IEEE80211_BAPS_TID);
-			bufsize = RT2860_MS(baparamset, IEEE80211_BAPS_BUFSIZ);
-
-			RT2860_DPRINTF(sc, RT2860_DEBUG_BA,
-			    "sending ADDBA response: associd=0x%04x, "
-			    "staid=0x%02x, status=%d, tid=%d, bufsize=%d\n",
-			    ni->ni_associd,
-			    rni->staid, status, tid, bufsize);
-
-			if (status == IEEE80211_STATUS_SUCCESS) {
-				RT2860_SOFTC_LOCK(sc);
-
-				rt2860_asic_add_ba_session(sc, wcid, tid);
-				RT2860_SOFTC_UNLOCK(sc);
-
-			}
+			/* IEEE80211_ACTION_BA_ADDBA_RESPONSE */
+			case IEEE80211_ACTION_BA_ADDBA_RESPONSE:
+				status = args[1];
+				baparamset = args[2];
+				tid = RT2860_MS(baparamset, IEEE80211_BAPS_TID);
+				bufsize = RT2860_MS(baparamset, IEEE80211_BAPS_BUFSIZ);
+
+				RT2860_DPRINTF(sc, RT2860_DEBUG_BA,
+					"%s: sending ADDBA response: associd=0x%04x, staid=0x%02x, status=%d,  
tid=%d, bufsize=%d\n",
+					device_get_nameunit(sc->sc_dev), ni->ni_associd, rni->staid, status,  
tid, bufsize);
+
+				if (status == IEEE80211_STATUS_SUCCESS) {
+					RT2860_SOFTC_LOCK(sc);
+
+					rt2860_asic_add_ba_session(sc, wcid, tid);
+					RT2860_SOFTC_UNLOCK(sc);
+
+				}
  			break;

-		/* IEEE80211_ACTION_BA_DELBA */
-		case IEEE80211_ACTION_BA_DELBA:
-			baparamset = RT2860_SM(args[0],
-			    IEEE80211_DELBAPS_TID) | args[1];
-			tid = RT2860_MS(baparamset, IEEE80211_DELBAPS_TID);
-
-			RT2860_DPRINTF(sc, RT2860_DEBUG_BA,
-				"sending DELBA request: associd=0x%04x, "
-				"staid=0x%02x, tid=%d\n",
-				ni->ni_associd, rni->staid, tid);
-
-			if (RT2860_MS(baparamset, IEEE80211_DELBAPS_INIT) !=
-			    IEEE80211_DELBAPS_INIT) {
-				RT2860_SOFTC_LOCK(sc);
-
-				rt2860_asic_del_ba_session(sc, wcid, tid);
-				RT2860_SOFTC_UNLOCK(sc);
-
-			}
+			/* IEEE80211_ACTION_BA_DELBA */
+			case IEEE80211_ACTION_BA_DELBA:
+				baparamset = RT2860_SM(args[0], IEEE80211_DELBAPS_TID) | args[1];
+				tid = RT2860_MS(baparamset, IEEE80211_DELBAPS_TID);
+
+				RT2860_DPRINTF(sc, RT2860_DEBUG_BA,
+					"%s: sending DELBA request: associd=0x%04x, staid=0x%02x, tid=%d\n",
+					device_get_nameunit(sc->sc_dev), ni->ni_associd, rni->staid, tid);
+
+				if (RT2860_MS(baparamset, IEEE80211_DELBAPS_INIT) !=  
IEEE80211_DELBAPS_INIT) {
+					RT2860_SOFTC_LOCK(sc);
+
+					rt2860_asic_del_ba_session(sc, wcid, tid);
+					RT2860_SOFTC_UNLOCK(sc);
+
+				}
  			break;
  		}
  	}
@@ -2808,9 +2789,9 @@
  /*
   * rt2860_addba_response
   */
-static int
-rt2860_addba_response(struct ieee80211_node *ni,
-    struct ieee80211_tx_ampdu *tap, int status, int baparamset, int  
batimeout)
+static int rt2860_addba_response(struct ieee80211_node *ni,
+	struct ieee80211_tx_ampdu *tap,
+	int status, int baparamset, int batimeout)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2859,10 +2840,10 @@
  	}

  	RT2860_DPRINTF(sc, RT2860_DEBUG_BA,
-	    "received ADDBA response: associd=0x%04x, staid=0x%02x, "
-	    "status=%d, tid=%d, old bufsize=%d, new bufsize=%d\n",
-	    ni->ni_associd, rni->staid,
-	    status, tid, old_bufsize, new_bufsize);
+		"%s: received ADDBA response: associd=0x%04x, staid=0x%02x, status=%d,  
tid=%d, "
+		"old bufsize=%d, new bufsize=%d\n",
+		device_get_nameunit(sc->sc_dev), ni->ni_associd, rni->staid, status, tid,
+		old_bufsize, new_bufsize);

  	ret = sc->addba_response(ni, tap, status, baparamset, batimeout);

@@ -2882,8 +2863,8 @@
  /*
   * rt2860_addba_stop
   */
-static void
-rt2860_addba_stop(struct ieee80211_node *ni, struct ieee80211_tx_ampdu  
*tap)
+static void rt2860_addba_stop(struct ieee80211_node *ni,
+	struct ieee80211_tx_ampdu *tap)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2899,8 +2880,8 @@
  	tid = WME_AC_TO_TID(tap->txa_ac);

  	RT2860_DPRINTF(sc, RT2860_DEBUG_BA,
-	    "stopping A-MPDU Tx: associd=0x%04x, staid=0x%02x, tid=%d\n",
-	    ni->ni_associd, rni->staid, tid);
+	    "%s: stopping A-MPDU Tx: associd=0x%04x, staid=0x%02x, tid=%d\n",
+	    device_get_nameunit(sc->sc_dev), ni->ni_associd, rni->staid, tid);

  	if (tap->txa_flags & IEEE80211_AGGR_RUNNING) {
  		if (sc->tx_ampdu_sessions > 0) {
@@ -2923,10 +2904,9 @@
  /*
   * rt2860_ampdu_rx_start
   */
-static int
-rt2860_ampdu_rx_start(struct ieee80211_node *ni,
-    struct ieee80211_rx_ampdu *rap, int baparamset, int batimeout,
-    int baseqctl)
+static int rt2860_ampdu_rx_start(struct ieee80211_node *ni,
+	struct ieee80211_rx_ampdu *rap,
+	int baparamset, int batimeout, int baseqctl)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2942,8 +2922,8 @@
  	tid = RT2860_MS(baparamset, IEEE80211_BAPS_TID);

  	RT2860_DPRINTF(sc, RT2860_DEBUG_BA,
-	    "starting A-MPDU Rx: associd=0x%04x, staid=0x%02x, tid=%d\n",
-	    ni->ni_associd, rni->staid, tid);
+		"%s: starting A-MPDU Rx: associd=0x%04x, staid=0x%02x, tid=%d\n",
+		device_get_nameunit(sc->sc_dev), ni->ni_associd, rni->staid, tid);

  	if (!(rap->rxa_flags & IEEE80211_AGGR_RUNNING))
  		sc->rx_ampdu_sessions++;
@@ -2954,9 +2934,8 @@
  /*
   * rt2860_ampdu_rx_stop
   */
-static void
-rt2860_ampdu_rx_stop(struct ieee80211_node *ni,
-    struct ieee80211_rx_ampdu *rap)
+static void rt2860_ampdu_rx_stop(struct ieee80211_node *ni,
+	struct ieee80211_rx_ampdu *rap)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2969,8 +2948,8 @@
  	rni = (struct rt2860_softc_node *) ni;

  	RT2860_DPRINTF(sc, RT2860_DEBUG_BA,
-		"stopping A-MPDU Rx: associd=0x%04x, staid=0x%02x\n",
-		 ni->ni_associd, rni->staid);
+		"%s: stopping A-MPDU Rx: associd=0x%04x, staid=0x%02x\n",
+		device_get_nameunit(sc->sc_dev), ni->ni_associd, rni->staid);

  	if (rap->rxa_flags & IEEE80211_AGGR_RUNNING) {
  		if (sc->rx_ampdu_sessions > 0)
@@ -2987,9 +2966,8 @@
  /*
   * rt2860_send_bar
   */
-static int
-rt2860_send_bar(struct ieee80211_node *ni, struct ieee80211_tx_ampdu *tap,
-    ieee80211_seq seqno)
+static int rt2860_send_bar(struct ieee80211_node *ni,
+	struct ieee80211_tx_ampdu *tap, ieee80211_seq seqno)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -3040,8 +3018,8 @@
  	ieee80211_ref_node(ni);

  	RT2860_DPRINTF(sc, RT2860_DEBUG_BA,
-		"sending BAR: associd=0x%04x, staid=0x%02x, tid=%d, seqno=%d\n",
-		 ni->ni_associd, rni->staid, tid, seqno);
+		"%s: sending BAR: associd=0x%04x, staid=0x%02x, tid=%d, seqno=%d\n",
+		device_get_nameunit(sc->sc_dev), ni->ni_associd, rni->staid, tid, seqno);
***The diff for this file has been truncated for email.***

==============================================================================
Revision: c634fc19aee6
Author:   Aleksandr Rybalko <ray at ddteam.net>
Date:     Wed Mar 28 06:21:18 2012
Log:      1. Fix read of RT2860_EEPROM_PWR[25]GHZ_BASE, it must step two  
times on single entry.
2. style(9) changes.
http://code.google.com/p/rt2860-in-ral/source/detail?r=c634fc19aee6

Modified:
  /sys/dev/ral/rt2860.c

=======================================
--- /sys/dev/ral/rt2860.c	Wed Mar 28 06:18:19 2012
+++ /sys/dev/ral/rt2860.c	Wed Mar 28 06:21:18 2012
@@ -253,9 +253,7 @@
  static int rt2860_tx_data(struct rt2860_softc *sc,
  			  struct mbuf *m, struct ieee80211_node *ni, int qid);

-static void rt2860_tx_coherent_intr(struct rt2860_softc *sc);
-static void rt2860_rx_coherent_intr(struct rt2860_softc *sc);
-static void rt2860_txrx_coherent_intr(struct rt2860_softc *sc);
+static void rt2860_reset_dma(struct rt2860_softc *sc);
  static void rt2860_fifo_sta_full_intr(struct rt2860_softc *sc);
  static void rt2860_rx_intr(struct rt2860_softc *sc);
  static void rt2860_tx_intr(struct rt2860_softc *sc, int qid);
@@ -345,7 +343,8 @@
  /*
   * rt2860_attach
   */
-int rt2860_attach(device_t dev, int id)
+int
+rt2860_attach(device_t dev, int id)
  {
  	struct rt2860_softc *sc;
  	struct ifnet *ifp;
@@ -370,9 +369,7 @@
  		"debug", CTLFLAG_RW, &sc->debug, 0, "rt2860 debug level");
  #endif

-	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY,
-		"%s: attaching\n",
-		device_get_nameunit(sc->sc_dev));
+	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY, "attaching\n");

  	/* wait for NIC to initialize */
  	for (ntries = 0; ntries < 100; ntries++) {
@@ -595,7 +592,8 @@
  /*
   * rt2860_detach
   */
-int rt2860_detach(void *xsc)
+int
+rt2860_detach(void *xsc)
  {
  	struct rt2860_softc *sc = xsc;
  	struct ifnet *ifp;
@@ -605,9 +603,7 @@
  	ifp = sc->sc_ifp;
  	ic = ifp->if_l2com;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY,
-		"%s: detaching\n",
-		device_get_nameunit(sc->sc_dev));
+	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY, "detaching\n");

  	RT2860_SOFTC_LOCK(sc);

@@ -648,9 +644,7 @@
  {
  	struct rt2860_softc *sc = xsc;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY,
-		"%s: shutting down\n",
-		device_get_nameunit(sc->sc_dev));
+	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY, "shutting down\n");

  	rt2860_stop(sc);

@@ -667,9 +661,7 @@
  {
  	struct rt2860_softc *sc = xsc;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY,
-		"%s: suspending\n",
-		device_get_nameunit(sc->sc_dev));
+	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY, "suspending\n");

  	rt2860_stop(sc);

@@ -689,9 +681,7 @@

  	ifp = sc->sc_ifp;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY,
-		"%s: resuming\n",
-		device_get_nameunit(sc->sc_dev));
+	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY, "resuming\n");

  	if (ifp->if_flags & IFF_UP)
  		rt2860_init(sc);
@@ -801,7 +791,8 @@
  /*
   * rt2860_init_channels_ht40
   */
-static void rt2860_init_channels_ht40(struct rt2860_softc *sc)
+static void
+rt2860_init_channels_ht40(struct rt2860_softc *sc)
  {
  	struct ifnet *ifp;
  	struct ieee80211com *ic;
@@ -968,7 +959,8 @@
  /*
   * rt2860_init_locked
   */
-static void rt2860_init_locked(void *priv)
+static void
+rt2860_init_locked(void *priv)
  {
  #define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
  	struct rt2860_softc *sc;
@@ -984,9 +976,7 @@
  	ifp = sc->sc_ifp;
  	ic = ifp->if_l2com;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY,
-		"%s: initializing\n",
-		device_get_nameunit(sc->sc_dev));
+	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY, "initializing\n");

  	RT2860_SOFTC_ASSERT_LOCKED(sc);

@@ -1004,7 +994,7 @@
  		sc->flags |= RT2860_SOFTC_FLAGS_UCODE_LOADED;

  		/* Blink every TX */
-		RAL_WRITE(sc, RT2860_LED_CFG,
+		RAL_WRITE(sc, RT2860_LED_CFG,
  		    LED_CFG_LED_POLARITY |
  		    LED_CFG_Y_LED_MODE_ONTX |
  		    LED_CFG_G_LED_MODE_ONTX |
@@ -1102,7 +1092,6 @@
  		device_printf(sc->sc_dev, "timeout waiting for MAC\n");
  		goto fail;
  	}
-
  	/* clear Host to MCU mailbox */

  	RAL_WRITE(sc, RT2860_REG_H2M_MAILBOX_BBP_AGENT, 0);
@@ -1364,7 +1353,8 @@
  /*
   * rt2860_init
   */
-static void rt2860_init(void *priv)
+static void
+rt2860_init(void *priv)
  {
  	struct rt2860_softc *sc;

@@ -1380,7 +1370,8 @@
  /*
   * rt2860_init_bbp
   */
-static int rt2860_init_bbp(struct rt2860_softc *sc)
+static int
+rt2860_init_bbp(struct rt2860_softc *sc)
  {
  #define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
  	int ntries, i;
@@ -1418,7 +1409,8 @@
  /*
   * rt2860_stop_locked
   */
-static void rt2860_stop_locked(void *priv)
+static void
+rt2860_stop_locked(void *priv)
  {
  	struct rt2860_softc *sc;
  	struct ifnet *ifp;
@@ -1429,9 +1421,7 @@
  	ifp = sc->sc_ifp;
  	ic = ifp->if_l2com;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY,
-		"%s: stopping\n",
-		device_get_nameunit(sc->sc_dev));
+	RT2860_DPRINTF(sc, RT2860_DEBUG_ANY, "stopping\n");

  	RT2860_SOFTC_ASSERT_LOCKED(sc);

@@ -1482,7 +1472,8 @@
  /*
   * rt2860_stop
   */
-static void rt2860_stop(void *priv)
+static void
+rt2860_stop(void *priv)
  {
  	struct rt2860_softc *sc;

@@ -1498,7 +1489,8 @@
  /*
   * rt2860_start
   */
-static void rt2860_start(struct ifnet *ifp)
+static void
+rt2860_start(struct ifnet *ifp)
  {
  	struct rt2860_softc *sc;
  #ifdef RT2860_NO_HW_CRYPTO
@@ -1544,12 +1536,12 @@

  		RT2860_SOFTC_TX_RING_LOCK(&sc->tx_ring[qid]);

-		if (sc->tx_ring[qid].data_queued >= RT2860_SOFTC_TX_RING_DATA_COUNT) {
+		if (sc->tx_ring[qid].data_queued >=
+		    RT2860_SOFTC_TX_RING_DATA_COUNT) {
  			RT2860_SOFTC_TX_RING_UNLOCK(&sc->tx_ring[qid]);

  			RT2860_DPRINTF(sc, RT2860_DEBUG_TX,
-				"%s: if_start: Tx ring with qid=%d is full\n",
-				device_get_nameunit(sc->sc_dev), qid);
+			    "if_start: Tx ring with qid=%d is full\n", qid);

  			m_freem(m);
  			ieee80211_free_node(ni);
@@ -1587,7 +1579,8 @@
  /*
   * rt2860_ioctl
   */
-static int rt2860_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
+static int
+rt2860_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -1647,10 +1640,11 @@
  /*
   * rt2860_vap_create
   */
-static struct ieee80211vap *rt2860_vap_create(struct ieee80211com *ic,
-	const char name[IFNAMSIZ], int unit, enum ieee80211_opmode opmode,
-	int flags, const uint8_t bssid[IEEE80211_ADDR_LEN],
-	const uint8_t mac[IEEE80211_ADDR_LEN])
+static struct ieee80211vap *
+rt2860_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ],
+    int unit, enum ieee80211_opmode opmode, int flags,
+    const uint8_t bssid[IEEE80211_ADDR_LEN],
+    const uint8_t mac[IEEE80211_ADDR_LEN])
  {
  	struct rt2860_softc *sc;
  	struct ifnet *ifp;
@@ -1660,10 +1654,8 @@
  	ifp = ic->ic_ifp;
  	sc = ifp->if_softc;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_STATE,
-		"%s: VAP create: opmode=%s\n",
-		device_get_nameunit(sc->sc_dev),
-		ieee80211_opmode_name[opmode]);
+	RT2860_DPRINTF(sc, RT2860_DEBUG_STATE, "VAP create: opmode=%s\n",
+	    ieee80211_opmode_name[opmode]);

  	switch (opmode) {
  	case IEEE80211_M_IBSS:
@@ -1772,7 +1764,8 @@
  /*
   * rt2860_vap_delete
   */
-static void rt2860_vap_delete(struct ieee80211vap *vap)
+static void
+rt2860_vap_delete(struct ieee80211vap *vap)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -1786,9 +1779,8 @@
  	rvap = (struct rt2860_softc_vap *) vap;
  	opmode = vap->iv_opmode;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_STATE,
-		"%s: VAP delete: opmode=%s\n",
-		device_get_nameunit(sc->sc_dev), ieee80211_opmode_name[opmode]);
+	RT2860_DPRINTF(sc, RT2860_DEBUG_STATE, "VAP delete: opmode=%s\n",
+	    ieee80211_opmode_name[opmode]);

  	rt2860_amrr_cleanup(&rvap->amrr);

@@ -1833,7 +1825,8 @@
  /*
   * rt2860_reset_vap
   */
-static int rt2860_vap_reset(struct ieee80211vap *vap, u_long cmd)
+static int
+rt2860_vap_reset(struct ieee80211vap *vap, u_long cmd)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -1846,9 +1839,7 @@
  	sc = ifp->if_softc;
  	rvap = (struct rt2860_softc_vap *) vap;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_STATE,
-		"%s: VAP reset: cmd=%lu\n",
-		device_get_nameunit(sc->sc_dev), cmd);
+	RT2860_DPRINTF(sc, RT2860_DEBUG_STATE, "VAP reset: cmd=%lu\n", cmd);

  	error = 0;

@@ -1886,8 +1877,9 @@
  /*
   * rt2860_vap_newstate
   */
-static int rt2860_vap_newstate(struct ieee80211vap *vap,
-	enum ieee80211_state nstate, int arg)
+static int
+rt2860_vap_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate,
+    int arg)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -1904,10 +1896,8 @@

  	ostate = vap->iv_state;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_STATE,
-		"%s: VAP newstate: %s -> %s\n",
-		device_get_nameunit(sc->sc_dev),
-		ieee80211_state_name[ostate], ieee80211_state_name[nstate]);
+	RT2860_DPRINTF(sc, RT2860_DEBUG_STATE, "VAP newstate: %s -> %s\n",
+	    ieee80211_state_name[ostate], ieee80211_state_name[nstate]);

  	error = rvap->newstate(vap, nstate, arg);
  	if (error != 0)
@@ -1974,7 +1964,8 @@
  /*
   * rt2860_vap_key_update_begin
   */
-static void rt2860_vap_key_update_begin(struct ieee80211vap *vap)
+static void
+rt2860_vap_key_update_begin(struct ieee80211vap *vap)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -1984,9 +1975,7 @@
  	ifp = ic->ic_ifp;
  	sc = ifp->if_softc;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_KEY,
-		"%s: VAP key update begin\n",
-		device_get_nameunit(sc->sc_dev));
+	RT2860_DPRINTF(sc, RT2860_DEBUG_KEY, "VAP key update begin\n");

  	taskqueue_block(sc->taskqueue);

@@ -1996,7 +1985,8 @@
  /*
   * rt2860_vap_key_update_end
   */
-static void rt2860_vap_key_update_end(struct ieee80211vap *vap)
+static void
+rt2860_vap_key_update_end(struct ieee80211vap *vap)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2006,9 +1996,7 @@
  	ifp = ic->ic_ifp;
  	sc = ifp->if_softc;

-	RT2860_DPRINTF(sc, RT2860_DEBUG_KEY,
-		"%s: VAP key update end\n",
-		device_get_nameunit(sc->sc_dev));
+	RT2860_DPRINTF(sc, RT2860_DEBUG_KEY, "VAP key update end\n");

  	IF_UNLOCK(&ifp->if_snd);

@@ -2018,8 +2006,9 @@
  /*
   * rt2860_vap_key_set
   */
-static int rt2860_vap_key_set(struct ieee80211vap *vap,
-	const struct ieee80211_key *k, const uint8_t mac[IEEE80211_ADDR_LEN])
+static int
+rt2860_vap_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k,
+    const uint8_t mac[IEEE80211_ADDR_LEN])
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2053,9 +2042,9 @@
  	sc = ifp->if_softc;

  	RT2860_DPRINTF(sc, RT2860_DEBUG_KEY,
-		"%s: VAP key set: keyix=%d, keylen=%d, macaddr=%s, mode=%d, group=%d\n",
-		device_get_nameunit(sc->sc_dev), k->wk_keyix, k->wk_keylen,  
ether_sprintf(k->wk_macaddr),
-		mode, (k->wk_flags & IEEE80211_KEY_GROUP) ? 1 : 0);
+	    "VAP key set: keyix=%d, keylen=%d, macaddr=%s, mode=%d, group=%d\n",
+	    k->wk_keyix, k->wk_keylen, ether_sprintf(k->wk_macaddr),
+	    mode, (k->wk_flags & IEEE80211_KEY_GROUP) ? 1 : 0);

  	if (!(k->wk_flags & IEEE80211_KEY_GROUP)) {
  		/* install pairwise key */
@@ -2097,9 +2086,8 @@
  			iv[7] = (k->wk_keytsc >> 40);

  			RT2860_DPRINTF(sc, RT2860_DEBUG_KEY,
-				"%s: VAP key set: iv=%02x %02x %02x %02x %02x %02x %02x %02x\n",
-				device_get_nameunit(sc->sc_dev),
-				iv[0], iv[1], iv[2], iv[3], iv[4], iv[5], iv[6], iv[7]);
+			    "VAP key set: iv=%02x %02x %02x %02x %02x %02x %02x %02x\n",
+			    iv[0], iv[1], iv[2], iv[3], iv[4], iv[5], iv[6], iv[7]);
  		}

  		RAL_WRITE_REGION_1(sc, RT2860_REG_IVEIV(wcid), iv, 8);
@@ -2136,11 +2124,15 @@
  			RAL_WRITE_REGION_1(sc, key_base, k->wk_key, 16);

  			if (vap->iv_opmode != IEEE80211_M_HOSTAP) {
-				RAL_WRITE_REGION_1(sc, key_base + 16, &k->wk_key[16], 8);
-				RAL_WRITE_REGION_1(sc, key_base + 24, &k->wk_key[24], 8);
+				RAL_WRITE_REGION_1(sc, key_base + 16,
+				    &k->wk_key[16], 8);
+				RAL_WRITE_REGION_1(sc, key_base + 24,
+				    &k->wk_key[24], 8);
  			} else {
-				RAL_WRITE_REGION_1(sc, key_base + 16, &k->wk_key[24], 8);
-				RAL_WRITE_REGION_1(sc, key_base + 24, &k->wk_key[16], 8);
+				RAL_WRITE_REGION_1(sc, key_base + 16,
+				    &k->wk_key[24], 8);
+				RAL_WRITE_REGION_1(sc, key_base + 24,
+				    &k->wk_key[16], 8);
  			}
  		} else {
  			RAL_WRITE_REGION_1(sc, key_base, k->wk_key, k->wk_keylen);
@@ -2159,7 +2151,8 @@

  				iv[3] = (k->wk_keyix << 6);
  			} else {
-				if (k->wk_cipher->ic_cipher == IEEE80211_CIPHER_TKIP) {
+				if (k->wk_cipher->ic_cipher ==
+				    IEEE80211_CIPHER_TKIP) {
  					iv[0] = (k->wk_keytsc >> 8);
  					iv[1] = ((iv[0] | 0x20) & 0x7f);
  					iv[2] = k->wk_keytsc;
@@ -2171,16 +2164,18 @@
  					iv[2] = 0;
  				}

-				iv[3] = ((k->wk_keyix << 6) | IEEE80211_WEP_EXTIV);
+				iv[3] = ((k->wk_keyix << 6) |
+				    IEEE80211_WEP_EXTIV);
  				iv[4] = (k->wk_keytsc >> 16);
  				iv[5] = (k->wk_keytsc >> 24);
  				iv[6] = (k->wk_keytsc >> 32);
  				iv[7] = (k->wk_keytsc >> 40);

  				RT2860_DPRINTF(sc, RT2860_DEBUG_KEY,
-					"%s: VAP key set: iv=%02x %02x %02x %02x %02x %02x %02x %02x\n",
-					device_get_nameunit(sc->sc_dev),
-					iv[0], iv[1], iv[2], iv[3], iv[4], iv[5], iv[6], iv[7]);
+				    "VAP key set: iv=%02x %02x %02x %02x "
+				    "%02x %02x %02x %02x\n",
+				    iv[0], iv[1], iv[2], iv[3],
+				    iv[4], iv[5], iv[6], iv[7]);
  			}

  			RAL_WRITE_REGION_1(sc, RT2860_REG_IVEIV(wcid), iv, 8);
@@ -2198,8 +2193,8 @@
  /*
   * rt2860_vap_key_delete
   */
-static int rt2860_vap_key_delete(struct ieee80211vap *vap,
-	const struct ieee80211_key *k)
+static int
+rt2860_vap_key_delete(struct ieee80211vap *vap, const struct ieee80211_key  
*k)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2212,8 +2207,8 @@
  	sc = ifp->if_softc;

  	RT2860_DPRINTF(sc, RT2860_DEBUG_KEY,
-		"%s: VAP key delete: keyix=%d, keylen=%d, macaddr=%s, group=%d\n",
-		device_get_nameunit(sc->sc_dev), k->wk_keyix, k->wk_keylen,  
ether_sprintf(k->wk_macaddr),
+		"VAP key delete: keyix=%d, keylen=%d, macaddr=%s, group=%d\n",
+		k->wk_keyix, k->wk_keylen, ether_sprintf(k->wk_macaddr),
  		(k->wk_flags & IEEE80211_KEY_GROUP) ? 1 : 0);

  	if (k->wk_flags & IEEE80211_KEY_GROUP) {
@@ -2244,7 +2239,8 @@
  /*
   * rt2860_vap_update_beacon
   */
-static void rt2860_vap_update_beacon(struct ieee80211vap *vap, int what)
+static void
+rt2860_vap_update_beacon(struct ieee80211vap *vap, int what)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2262,8 +2258,7 @@
  	bo = &rvap->beacon_offsets;

  	RT2860_DPRINTF(sc, RT2860_DEBUG_BEACON,
-		"%s: VAP update beacon: what=%d\n",
-		device_get_nameunit(sc->sc_dev), what);
+	    "VAP update beacon: what=%d\n", what);

  	setbit(bo->bo_flags, what);

@@ -2281,7 +2276,8 @@
  /*
   * rt2860_media_change
   */
-static int rt2860_media_change(struct ifnet *ifp)
+static int
+rt2860_media_change(struct ifnet *ifp)
  {
  	int error;

@@ -2293,8 +2289,9 @@
  /*
   * rt2860_node_alloc
   */
-static struct ieee80211_node *rt2860_node_alloc(struct ieee80211vap *vap,
-	const uint8_t mac[IEEE80211_ADDR_LEN])
+static struct ieee80211_node *
+rt2860_node_alloc(struct ieee80211vap *vap,
+    const uint8_t mac[IEEE80211_ADDR_LEN])
  {
  	return malloc(sizeof(struct rt2860_softc_node),
  		M_80211_NODE, M_NOWAIT | M_ZERO);
@@ -2303,7 +2300,8 @@
  /*
   * rt2860_node_cleanup
   */
-static void rt2860_node_cleanup(struct ieee80211_node *ni)
+static void
+rt2860_node_cleanup(struct ieee80211_node *ni)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2318,9 +2316,8 @@
  	rni = (struct rt2860_softc_node *) ni;

  	RT2860_DPRINTF(sc, RT2860_DEBUG_NODE,
-		"%s: node cleanup: macaddr=%s, associd=0x%04x, staid=0x%02x\n",
-		device_get_nameunit(sc->sc_dev), ether_sprintf(ni->ni_macaddr),
-		ni->ni_associd, rni->staid);
+	    "node cleanup: macaddr=%s, associd=0x%04x, staid=0x%02x\n",
+	    ether_sprintf(ni->ni_macaddr), ni->ni_associd, rni->staid);

  	if (rni->staid != 0) {
  		vapid = 0;
@@ -2345,8 +2342,9 @@
  /*
   * rt2860_node_getmimoinfo
   */
-static void rt2860_node_getmimoinfo(const struct ieee80211_node *ni,
-	struct ieee80211_mimo_info *mi)
+static void
+rt2860_node_getmimoinfo(const struct ieee80211_node *ni,
+    struct ieee80211_mimo_info *mi)
  {
  	const struct rt2860_softc_node *rni;
  	int i;
@@ -2362,9 +2360,9 @@
  /*
   * rt2860_setregdomain
   */
-static int rt2860_setregdomain(struct ieee80211com *ic,
-	struct ieee80211_regdomain *reg,
-	int nchans, struct ieee80211_channel chans[])
+static int
+rt2860_setregdomain(struct ieee80211com *ic, struct ieee80211_regdomain  
*reg,
+    int nchans, struct ieee80211_channel chans[])
  {
  	struct rt2860_softc *sc;
  	struct ifnet *ifp;
@@ -2373,9 +2371,9 @@
  	sc = ifp->if_softc;

  	RT2860_DPRINTF(sc, RT2860_DEBUG_STATE,
-		"%s: set regulatory domain: country=%d, country code string=%c%c,  
location=%c\n",
-		device_get_nameunit(sc->sc_dev),
-		reg->country, reg->isocc[0], reg->isocc[1], reg->location);
+	    "set regulatory domain: country=%d, country code string=%c%c, "
+	    "location=%c\n",
+	    reg->country, reg->isocc[0], reg->isocc[1], reg->location);

  	return 0;
  }
@@ -2383,8 +2381,9 @@
  /*
   * rt2860_getradiocaps
   */
-static void rt2860_getradiocaps(struct ieee80211com *ic,
-	int maxchans, int *nchans, struct ieee80211_channel chans[])
+static void
+rt2860_getradiocaps(struct ieee80211com *ic, int maxchans, int *nchans,
+    struct ieee80211_channel chans[])
  {
  	*nchans = (ic->ic_nchans >= maxchans) ? maxchans : ic->ic_nchans;

@@ -2394,7 +2393,8 @@
  /*
   * rt2860_scan_start
   */
-static void rt2860_scan_start(struct ieee80211com *ic)
+static void
+rt2860_scan_start(struct ieee80211com *ic)
  {
  	struct rt2860_softc *sc;
  	struct ifnet *ifp;
@@ -2412,7 +2412,8 @@
  /*
   * rt2860_scan_end
   */
-static void rt2860_scan_end(struct ieee80211com *ic)
+static void
+rt2860_scan_end(struct ieee80211com *ic)
  {
  	struct rt2860_softc *sc;
  	struct ifnet *ifp;
@@ -2430,7 +2431,8 @@
  /*
   * rt2860_set_channel
   */
-static void rt2860_set_channel(struct ieee80211com *ic)
+static void
+rt2860_set_channel(struct ieee80211com *ic)
  {
  	struct rt2860_softc *sc;
  	struct ifnet *ifp;
@@ -2439,12 +2441,12 @@
  	sc = ifp->if_softc;

  	RT2860_DPRINTF(sc, RT2860_DEBUG_CHAN,
-		"%s: set channel: channel=%u, HT%s%s\n",
-		device_get_nameunit(sc->sc_dev),
+		"set channel: channel=%u, HT%s%s\n",
  		ieee80211_chan2ieee(ic, ic->ic_curchan),
  		!IEEE80211_IS_CHAN_HT(ic->ic_curchan) ? " disabled" :
-			IEEE80211_IS_CHAN_HT20(ic->ic_curchan) ? "20":
-				IEEE80211_IS_CHAN_HT40U(ic->ic_curchan) ? "40U" : "40D",
+		    IEEE80211_IS_CHAN_HT20(ic->ic_curchan) ? "20":
+			IEEE80211_IS_CHAN_HT40U(ic->ic_curchan) ?
+			    "40U" : "40D",
  		(ic->ic_flags & IEEE80211_F_SCAN) ? ", scanning" : "");

  	RT2860_SOFTC_LOCK(sc);
@@ -2457,7 +2459,8 @@
  /*
   * rt2860_newassoc
   */
-static void rt2860_newassoc(struct ieee80211_node *ni, int isnew)
+static void
+rt2860_newassoc(struct ieee80211_node *ni, int isnew)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2496,13 +2499,15 @@
  		rt2860_amrr_node_init(&rvap->amrr, &sc->amrr_node[wcid], ni);

  		RT2860_DPRINTF(sc, RT2860_DEBUG_RATE,
-			"%s: initial%s node Tx rate: associd=0x%04x, rate=0x%02x, max  
rate=0x%02x\n",
-			device_get_nameunit(sc->sc_dev),
-			(ni->ni_flags & IEEE80211_NODE_HT) ? " HT" : "",
-			ni->ni_associd, ni->ni_txrate,
-			(ni->ni_flags & IEEE80211_NODE_HT) ?
-				(ni->ni_htrates.rs_rates[ni->ni_htrates.rs_nrates - 1] |  
IEEE80211_RATE_MCS) :
-				(ni->ni_rates.rs_rates[ni->ni_rates.rs_nrates - 1] &  
IEEE80211_RATE_VAL));
+		    "initial%s node Tx rate: associd=0x%04x, rate=0x%02x, "
+		    "max rate=0x%02x\n",
+		    (ni->ni_flags & IEEE80211_NODE_HT) ? " HT" : "",
+		    ni->ni_associd, ni->ni_txrate,
+		    (ni->ni_flags & IEEE80211_NODE_HT) ?
+		    (ni->ni_htrates.rs_rates[ni->ni_htrates.rs_nrates - 1] |
+			IEEE80211_RATE_MCS) :
+		    (ni->ni_rates.rs_rates[ni->ni_rates.rs_nrates - 1] &
+			IEEE80211_RATE_VAL));

  		rt2860_asic_updateprot(sc);
  		rt2860_asic_updateslot(sc);
@@ -2510,18 +2515,20 @@
  	}

  	RT2860_DPRINTF(sc, RT2860_DEBUG_NODE,
-		"%s: new association: isnew=%d, macaddr=%s, associd=0x%04x,  
staid=0x%02x, QoS %s, ERP %s, HT %s\n",
-		device_get_nameunit(sc->sc_dev), isnew, ether_sprintf(ni->ni_macaddr),
-		ni->ni_associd, rni->staid,
-		(ni->ni_flags & IEEE80211_NODE_QOS) ? "enabled" : "disabled",
-		(ni->ni_flags & IEEE80211_NODE_ERP) ? "enabled" : "disabled",
-		(ni->ni_flags & IEEE80211_NODE_HT) ? "enabled" : "disabled");
+	    "new association: isnew=%d, macaddr=%s, associd=0x%04x, "
+	    "staid=0x%02x, QoS %s, ERP %s, HT %s\n",
+	    isnew, ether_sprintf(ni->ni_macaddr),
+	    ni->ni_associd, rni->staid,
+	    (ni->ni_flags & IEEE80211_NODE_QOS) ? "enabled" : "disabled",
+	    (ni->ni_flags & IEEE80211_NODE_ERP) ? "enabled" : "disabled",
+	    (ni->ni_flags & IEEE80211_NODE_HT) ? "enabled" : "disabled");
  }

  /*
   * rt2860_updateslot
   */
-static void rt2860_updateslot(struct ifnet *ifp)
+static void
+rt2860_updateslot(struct ifnet *ifp)
  {
  	struct rt2860_softc *sc;

@@ -2533,7 +2540,8 @@
  /*
   * rt2860_update_promisc
   */
-static void rt2860_update_promisc(struct ifnet *ifp)
+static void
+rt2860_update_promisc(struct ifnet *ifp)
  {
  	struct rt2860_softc *sc;

@@ -2547,7 +2555,8 @@
  /*
   * rt2860_update_mcast
   */
-static void rt2860_update_mcast(struct ifnet *ifp)
+static void
+rt2860_update_mcast(struct ifnet *ifp)
  {
  	struct rt2860_softc *sc;

@@ -2557,7 +2566,8 @@
  /*
   * rt2860_wme_update
   */
-static int rt2860_wme_update(struct ieee80211com *ic)
+static int
+rt2860_wme_update(struct ieee80211com *ic)
  {
  	struct rt2860_softc *sc;
  	struct ifnet *ifp;
@@ -2573,8 +2583,9 @@
  /*
   * rt2860_raw_xmit
   */
-static int rt2860_raw_xmit(struct ieee80211_node *ni, struct mbuf *m,
-	const struct ieee80211_bpf_params *params)
+static int
+rt2860_raw_xmit(struct ieee80211_node *ni, struct mbuf *m,
+    const struct ieee80211_bpf_params *params)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2596,12 +2607,13 @@
  	}

  	RT2860_SOFTC_TX_RING_LOCK(&sc->tx_ring[sc->tx_ring_mgtqid]);
-	if (sc->tx_ring[sc->tx_ring_mgtqid].data_queued >=  
RT2860_SOFTC_TX_RING_DATA_COUNT) {
+	if (sc->tx_ring[sc->tx_ring_mgtqid].data_queued >=
+	    RT2860_SOFTC_TX_RING_DATA_COUNT) {
  		RT2860_SOFTC_TX_RING_UNLOCK(&sc->tx_ring[sc->tx_ring_mgtqid]);

  		RT2860_DPRINTF(sc, RT2860_DEBUG_TX,
-			"%s: raw xmit: Tx ring with qid=%d is full\n",
-			device_get_nameunit(sc->sc_dev), sc->tx_ring_mgtqid);
+			"raw xmit: Tx ring with qid=%d is full\n",
+			sc->tx_ring_mgtqid);

  		ifp->if_drv_flags |= IFF_DRV_OACTIVE;

@@ -2673,9 +2685,9 @@
  /*
   * rt2860_recv_action
   */
-static int rt2860_recv_action(struct ieee80211_node *ni,
-	const struct ieee80211_frame *wh,
-	const uint8_t *frm, const uint8_t *efrm)
+static int
+rt2860_recv_action(struct ieee80211_node *ni,
+    const struct ieee80211_frame *wh, const uint8_t *frm, const uint8_t  
*efrm)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2702,8 +2714,9 @@
  			wcid = rni->staid;

  			RT2860_DPRINTF(sc, RT2860_DEBUG_BA,
-				"%s: received DELBA request: associd=0x%04x, staid=0x%02x, tid=%d\n",
-				device_get_nameunit(sc->sc_dev), ni->ni_associd, rni->staid, tid);
+			    "received DELBA request: associd=0x%04x, "
+			    "staid=0x%02x, tid=%d\n",
+			    ni->ni_associd, rni->staid, tid);

  			if (rni->staid != 0) {
  				RT2860_SOFTC_LOCK(sc);
@@ -2722,8 +2735,8 @@
  /*
   * rt2860_send_action
   */
-static int rt2860_send_action(struct ieee80211_node *ni,
-	int cat, int act, void *sa)
+static int
+rt2860_send_action(struct ieee80211_node *ni, int cat, int act, void *sa)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2743,42 +2756,47 @@

  	if (cat == IEEE80211_ACTION_CAT_BA) {
  		switch (act) {
-			/* IEEE80211_ACTION_BA_ADDBA_RESPONSE */
-			case IEEE80211_ACTION_BA_ADDBA_RESPONSE:
-				status = args[1];
-				baparamset = args[2];
-				tid = RT2860_MS(baparamset, IEEE80211_BAPS_TID);
-				bufsize = RT2860_MS(baparamset, IEEE80211_BAPS_BUFSIZ);
-
-				RT2860_DPRINTF(sc, RT2860_DEBUG_BA,
-					"%s: sending ADDBA response: associd=0x%04x, staid=0x%02x, status=%d,  
tid=%d, bufsize=%d\n",
-					device_get_nameunit(sc->sc_dev), ni->ni_associd, rni->staid, status,  
tid, bufsize);
-
-				if (status == IEEE80211_STATUS_SUCCESS) {
-					RT2860_SOFTC_LOCK(sc);
-
-					rt2860_asic_add_ba_session(sc, wcid, tid);
-					RT2860_SOFTC_UNLOCK(sc);
-
-				}
+		/* IEEE80211_ACTION_BA_ADDBA_RESPONSE */
+		case IEEE80211_ACTION_BA_ADDBA_RESPONSE:
+			status = args[1];
+			baparamset = args[2];
+			tid = RT2860_MS(baparamset, IEEE80211_BAPS_TID);
+			bufsize = RT2860_MS(baparamset, IEEE80211_BAPS_BUFSIZ);
+
+			RT2860_DPRINTF(sc, RT2860_DEBUG_BA,
+			    "sending ADDBA response: associd=0x%04x, "
+			    "staid=0x%02x, status=%d, tid=%d, bufsize=%d\n",
+			    ni->ni_associd,
+			    rni->staid, status, tid, bufsize);
+
+			if (status == IEEE80211_STATUS_SUCCESS) {
+				RT2860_SOFTC_LOCK(sc);
+
+				rt2860_asic_add_ba_session(sc, wcid, tid);
+				RT2860_SOFTC_UNLOCK(sc);
+
+			}
  			break;

-			/* IEEE80211_ACTION_BA_DELBA */
-			case IEEE80211_ACTION_BA_DELBA:
-				baparamset = RT2860_SM(args[0], IEEE80211_DELBAPS_TID) | args[1];
-				tid = RT2860_MS(baparamset, IEEE80211_DELBAPS_TID);
-
-				RT2860_DPRINTF(sc, RT2860_DEBUG_BA,
-					"%s: sending DELBA request: associd=0x%04x, staid=0x%02x, tid=%d\n",
-					device_get_nameunit(sc->sc_dev), ni->ni_associd, rni->staid, tid);
-
-				if (RT2860_MS(baparamset, IEEE80211_DELBAPS_INIT) !=  
IEEE80211_DELBAPS_INIT) {
-					RT2860_SOFTC_LOCK(sc);
-
-					rt2860_asic_del_ba_session(sc, wcid, tid);
-					RT2860_SOFTC_UNLOCK(sc);
-
-				}
+		/* IEEE80211_ACTION_BA_DELBA */
+		case IEEE80211_ACTION_BA_DELBA:
+			baparamset = RT2860_SM(args[0],
+			    IEEE80211_DELBAPS_TID) | args[1];
+			tid = RT2860_MS(baparamset, IEEE80211_DELBAPS_TID);
+
+			RT2860_DPRINTF(sc, RT2860_DEBUG_BA,
+				"sending DELBA request: associd=0x%04x, "
+				"staid=0x%02x, tid=%d\n",
+				ni->ni_associd, rni->staid, tid);
+
+			if (RT2860_MS(baparamset, IEEE80211_DELBAPS_INIT) !=
+			    IEEE80211_DELBAPS_INIT) {
+				RT2860_SOFTC_LOCK(sc);
+
+				rt2860_asic_del_ba_session(sc, wcid, tid);
+				RT2860_SOFTC_UNLOCK(sc);
+
+			}
  			break;
  		}
  	}
@@ -2789,9 +2807,9 @@
  /*
   * rt2860_addba_response
   */
-static int rt2860_addba_response(struct ieee80211_node *ni,
-	struct ieee80211_tx_ampdu *tap,
-	int status, int baparamset, int batimeout)
+static int
+rt2860_addba_response(struct ieee80211_node *ni,
+    struct ieee80211_tx_ampdu *tap, int status, int baparamset, int  
batimeout)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2840,10 +2858,10 @@
  	}

  	RT2860_DPRINTF(sc, RT2860_DEBUG_BA,
-		"%s: received ADDBA response: associd=0x%04x, staid=0x%02x, status=%d,  
tid=%d, "
-		"old bufsize=%d, new bufsize=%d\n",
-		device_get_nameunit(sc->sc_dev), ni->ni_associd, rni->staid, status, tid,
-		old_bufsize, new_bufsize);
+	    "received ADDBA response: associd=0x%04x, staid=0x%02x, "
+	    "status=%d, tid=%d, old bufsize=%d, new bufsize=%d\n",
+	    ni->ni_associd, rni->staid,
+	    status, tid, old_bufsize, new_bufsize);

  	ret = sc->addba_response(ni, tap, status, baparamset, batimeout);

@@ -2863,8 +2881,8 @@
  /*
   * rt2860_addba_stop
   */
-static void rt2860_addba_stop(struct ieee80211_node *ni,
-	struct ieee80211_tx_ampdu *tap)
+static void
+rt2860_addba_stop(struct ieee80211_node *ni, struct ieee80211_tx_ampdu  
*tap)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2880,8 +2898,8 @@
  	tid = WME_AC_TO_TID(tap->txa_ac);

  	RT2860_DPRINTF(sc, RT2860_DEBUG_BA,
-	    "%s: stopping A-MPDU Tx: associd=0x%04x, staid=0x%02x, tid=%d\n",
-	    device_get_nameunit(sc->sc_dev), ni->ni_associd, rni->staid, tid);
+	    "stopping A-MPDU Tx: associd=0x%04x, staid=0x%02x, tid=%d\n",
+	    ni->ni_associd, rni->staid, tid);

  	if (tap->txa_flags & IEEE80211_AGGR_RUNNING) {
  		if (sc->tx_ampdu_sessions > 0) {
@@ -2904,9 +2922,10 @@
  /*
   * rt2860_ampdu_rx_start
   */
-static int rt2860_ampdu_rx_start(struct ieee80211_node *ni,
-	struct ieee80211_rx_ampdu *rap,
-	int baparamset, int batimeout, int baseqctl)
+static int
+rt2860_ampdu_rx_start(struct ieee80211_node *ni,
+    struct ieee80211_rx_ampdu *rap, int baparamset, int batimeout,
+    int baseqctl)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2922,8 +2941,8 @@
  	tid = RT2860_MS(baparamset, IEEE80211_BAPS_TID);

  	RT2860_DPRINTF(sc, RT2860_DEBUG_BA,
-		"%s: starting A-MPDU Rx: associd=0x%04x, staid=0x%02x, tid=%d\n",
-		device_get_nameunit(sc->sc_dev), ni->ni_associd, rni->staid, tid);
+	    "starting A-MPDU Rx: associd=0x%04x, staid=0x%02x, tid=%d\n",
+	    ni->ni_associd, rni->staid, tid);

  	if (!(rap->rxa_flags & IEEE80211_AGGR_RUNNING))
  		sc->rx_ampdu_sessions++;
@@ -2934,8 +2953,9 @@
  /*
   * rt2860_ampdu_rx_stop
   */
-static void rt2860_ampdu_rx_stop(struct ieee80211_node *ni,
-	struct ieee80211_rx_ampdu *rap)
+static void
+rt2860_ampdu_rx_stop(struct ieee80211_node *ni,
+    struct ieee80211_rx_ampdu *rap)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -2948,8 +2968,8 @@
  	rni = (struct rt2860_softc_node *) ni;

  	RT2860_DPRINTF(sc, RT2860_DEBUG_BA,
-		"%s: stopping A-MPDU Rx: associd=0x%04x, staid=0x%02x\n",
-		device_get_nameunit(sc->sc_dev), ni->ni_associd, rni->staid);
+		"stopping A-MPDU Rx: associd=0x%04x, staid=0x%02x\n",
+		 ni->ni_associd, rni->staid);

  	if (rap->rxa_flags & IEEE80211_AGGR_RUNNING) {
  		if (sc->rx_ampdu_sessions > 0)
@@ -2966,8 +2986,9 @@
  /*
   * rt2860_send_bar
   */
-static int rt2860_send_bar(struct ieee80211_node *ni,
-	struct ieee80211_tx_ampdu *tap, ieee80211_seq seqno)
+static int
+rt2860_send_bar(struct ieee80211_node *ni, struct ieee80211_tx_ampdu *tap,
+    ieee80211_seq seqno)
  {
  	struct rt2860_softc *sc;
  	struct ieee80211com *ic;
@@ -3018,8 +3039,8 @@
  	ieee80211_ref_node(ni);

  	RT2860_DPRINTF(sc, RT2860_DEBUG_BA,
-		"%s: sending BAR: associd=0x%04x, staid=0x%02x, tid=%d, seqno=%d\n",
-		device_get_nameunit(sc->sc_dev), ni->ni_associd, rni->staid, tid, seqno);
+		"sending BAR: associd=0x%04x, staid=0x%02x, tid=%d, seqno=%d\n",
+		 ni->ni_associd, rni->staid, tid, seqno);

  	ret = ic->ic_raw_xmit(ni, m, NULL);
  	if (ret != 0)
@@ -3032,7 +3053,8 @@
  /*
   * rt2860_amrr_update_iter_func
   */
-static void rt2860_amrr_update_iter_func(void *arg, struct ieee80211_node  
*ni)
+static void
+rt2860_amrr_update_iter_func(void *arg, struct ieee80211_node *ni)
***The diff for this file has been truncated for email.***

==============================================================================
Revision: 74a8a34ad66f
Author:   Aleksandr Rybalko <ray at ddteam.net>
Date:     Wed Mar 28 06:21:50 2012
Log:      Update RT2860_DPRINTF to allow format w/o arguments.
http://code.google.com/p/rt2860-in-ral/source/detail?r=74a8a34ad66f

Modified:
  /sys/dev/ral/rt2860var.h

=======================================
--- /sys/dev/ral/rt2860var.h	Wed Mar 21 07:49:23 2012
+++ /sys/dev/ral/rt2860var.h	Wed Mar 28 06:21:50 2012
@@ -40,12 +40,13 @@
  	RT2860_DEBUG_ANY = 0xffffffff
  };

-#define RT2860_DPRINTF(sc, m, fmt, ...)		\
-    do { if ((sc)->debug & (m)) printf(fmt, __VA_ARGS__); } while (0)
+#define RT2860_DPRINTF(sc, m, ...)		\
+    do { if ((sc)->debug & (m)) 		\
+    device_printf(sc->sc_dev, __VA_ARGS__); } while (0)

  #else

-#define RT2860_DPRINTF(sc, m, fmt, ...)
+#define RT2860_DPRINTF(sc, m, ...)

  #endif /* #ifdef RT2860_DEBUG */



More information about the Zrouter-src-freebsd mailing list