Author: adrian
Date: Sat Oct  3 17:30:57 2015
New Revision: 288621
URL: https://svnweb.freebsd.org/changeset/base/288621

Log:
  rum(4): simplify rum_set_bssid(), rum_set_macaddr() and rum_update_promisc()
  
  Tested:
  
  * rum0: MAC/BBP RT2573 (rev 0x2573a), RF RT2528, STA mode
  
  Submitted by: <[email protected]>
  Differential Revision:        https://reviews.freebsd.org/D3626

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

Modified: head/sys/dev/usb/wlan/if_rum.c
==============================================================================
--- head/sys/dev/usb/wlan/if_rum.c      Sat Oct  3 17:28:46 2015        
(r288620)
+++ head/sys/dev/usb/wlan/if_rum.c      Sat Oct  3 17:30:57 2015        
(r288621)
@@ -1872,25 +1872,21 @@ rum_update_slot(struct rum_softc *sc)
 static void
 rum_set_bssid(struct rum_softc *sc, const uint8_t *bssid)
 {
-       uint32_t tmp;
-
-       tmp = bssid[0] | bssid[1] << 8 | bssid[2] << 16 | bssid[3] << 24;
-       rum_write(sc, RT2573_MAC_CSR4, tmp);
 
-       tmp = bssid[4] | bssid[5] << 8 | RT2573_ONE_BSSID << 16;
-       rum_write(sc, RT2573_MAC_CSR5, tmp);
+       rum_write(sc, RT2573_MAC_CSR4,
+           bssid[0] | bssid[1] << 8 | bssid[2] << 16 | bssid[3] << 24);
+       rum_write(sc, RT2573_MAC_CSR5,
+           bssid[4] | bssid[5] << 8 | RT2573_NUM_BSSID_MSK(1));
 }
 
 static void
 rum_set_macaddr(struct rum_softc *sc, const uint8_t *addr)
 {
-       uint32_t tmp;
-
-       tmp = addr[0] | addr[1] << 8 | addr[2] << 16 | addr[3] << 24;
-       rum_write(sc, RT2573_MAC_CSR2, tmp);
 
-       tmp = addr[4] | addr[5] << 8 | 0xff << 16;
-       rum_write(sc, RT2573_MAC_CSR3, tmp);
+       rum_write(sc, RT2573_MAC_CSR2,
+           addr[0] | addr[1] << 8 | addr[2] << 16 | addr[3] << 24);
+       rum_write(sc, RT2573_MAC_CSR3,
+           addr[4] | addr[5] << 8 | 0xff << 16);
 }
 
 static void
@@ -1913,11 +1909,8 @@ rum_update_promisc(struct ieee80211com *
        struct rum_softc *sc = ic->ic_softc;
 
        RUM_LOCK(sc);
-       if (!sc->sc_running) {
-               RUM_UNLOCK(sc);
-               return;
-       }
-       rum_setpromisc(sc);
+       if (sc->sc_running)
+               rum_setpromisc(sc);
        RUM_UNLOCK(sc);
 }
 

Modified: head/sys/dev/usb/wlan/if_rumreg.h
==============================================================================
--- head/sys/dev/usb/wlan/if_rumreg.h   Sat Oct  3 17:28:46 2015        
(r288620)
+++ head/sys/dev/usb/wlan/if_rumreg.h   Sat Oct  3 17:30:57 2015        
(r288621)
@@ -101,7 +101,7 @@
 #define RT2573_HOST_READY      (1 << 2)
 
 /* possible flags for register MAC_CSR5 */
-#define RT2573_ONE_BSSID       3
+#define RT2573_NUM_BSSID_MSK(n)        (((n * 3) & 3) << 16)
 
 /* possible flags for register TXRX_CSR0 */
 /* Tx filter flags are in the low 16 bits */
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to