svn commit: r208019 - in head/sys: contrib/dev/run dev/usb/wlan
Andrew Thompson
thompsa at FreeBSD.org
Thu May 13 00:19:04 UTC 2010
Author: thompsa
Date: Thu May 13 00:19:03 2010
New Revision: 208019
URL: http://svn.freebsd.org/changeset/base/208019
Log:
Sync run(4) driver from author's site.
Submitted by: Akinori Furukoshi
Obtained from: git://gitorious.org/run/run.git
Modified:
head/sys/contrib/dev/run/rt2870.fw.uu
head/sys/dev/usb/wlan/if_run.c
head/sys/dev/usb/wlan/if_runreg.h
head/sys/dev/usb/wlan/if_runvar.h
Modified: head/sys/contrib/dev/run/rt2870.fw.uu
==============================================================================
--- head/sys/contrib/dev/run/rt2870.fw.uu Wed May 12 23:40:44 2010 (r208018)
+++ head/sys/contrib/dev/run/rt2870.fw.uu Thu May 13 00:19:03 2010 (r208019)
@@ -1,112 +1,108 @@
-# Copyright (c) 2007, Ralink Technology Corporation
+# Copyright (c) 2007, Ralink Technology Corporation
# All rights reserved.
#
-# Redistribution. Redistribution and use in binary form, without
-# modification, are permitted provided that the following conditions are
+# Redistribution. Redistribution and use in binary form, without
+# modification, are permitted provided that the following conditions are
# met:
-#
-# * Redistributions must reproduce the above copyright notice and the
-# following disclaimer in the documentation and/or other materials
-# provided with the distribution.
+#
+# * Redistributions must reproduce the above copyright notice and the
+# following disclaimer in the documentation and/or other materials
+# provided with the distribution.
# * Neither the name of Ralink Technology Corporation nor the names of its
# suppliers may be used to endorse or promote products derived from this
-# software without specific prior written permission.
-# * No reverse engineering, decompilation, or disassembly of this software
+# software without specific prior written permission.
+# * No reverse engineering, decompilation, or disassembly of this software
# is permitted.
-#
-# Limited patent license. Ralink Technology Corporation grants a world-wide,
-# royalty-free, non-exclusive license under patents it now or hereafter
-# owns or controls to make, have made, use, import, offer to sell and
-# sell ("Utilize") this software, but solely to the extent that any
-# such patent is necessary to Utilize the software alone, or in
-# combination with an operating system licensed under an approved Open
-# Source license as listed by the Open Source Initiative at
-# http://opensource.org/licenses. The patent license shall not apply to
-# any other combinations which include this software. No hardware per
+#
+# Limited patent license. Ralink Technology Corporation grants a world-wide,
+# royalty-free, non-exclusive license under patents it now or hereafter
+# owns or controls to make, have made, use, import, offer to sell and
+# sell ("Utilize") this software, but solely to the extent that any
+# such patent is necessary to Utilize the software alone, or in
+# combination with an operating system licensed under an approved Open
+# Source license as listed by the Open Source Initiative at
+# http://opensource.org/licenses. The patent license shall not apply to
+# any other combinations which include this software. No hardware per
# se is licensed hereunder.
-#
-# DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
-# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
-# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
-# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
-# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+#
+# DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
# DAMAGE.
-begin 644 rt2870.fw
-M____`A`H`A`R`A!X`A)G`A)H`A*'`A*,$A*((@(620(7'P(3=P(2C3`%!B`-
-M`Q(7P2*0`8S@,.,;Y4PPX`1_0(`"?P"0$"_O\)`!C'0(\.20`:?PD`&,X##@
-M')`!@."T`A6CX+0!$)`!A."T at 0F0`8QT`?`2#<@BD`04X"#G`P(29I!P$N#U
-M5I`$!.`2"IT0MS$0X%`1!%$1#5(1#5,1#5013E41?G`1J7$1UW(2'7,2/H``
-M`!)F(`(#,`,=?0*O5A(+D9`$%'2`\.20<!/PY5;T<`,"$F8"$E^%5D'2`B*0
-M<!#@5']D`F`#`A)FD'`1X&0(8`C at 9"!@`P(29G5.`W5/("*0<!'@)/^21R*0
-M!`3@)>`D7?57D'`0X/]T1R57^,;OQI!P$>#_=$@E5_C&[\;D_:]6$@N1D`04
-M=(#PY)!P$_#E5O1P`P(29@(27^5'9`=@"^5'9`A@!>5'M`D(D'`1X%0/]3KE
-M1[0)".4ZM`,#Y/5&Y/VO5A(+D=($(I!P$.#^D'`1X/WM^.;U5_VO5A(+D9`$
-M%'2`\.20<!/PY5;T<`,"$F8"$E^0<!#@_I!P$>#][?6"CH/@]5?]KU82"Y&0
-M!!1T@/#DD'`3\.56]'`#`A)F`A)?D!`"X+1P'J/@M#`9D`4(X$0!\/V0!07@
-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B(B*0<"K@,.%-PJ^0<"C at D!`<\)!P*>"0$!WPD'`JX)`0'O"0$!S@]6*0
-M$![@(.'SD!`<X)!P*/"0$!W at D'`I\)`0'N"0<"KP,$H'D'`DX$0!\,(%TJ\B
-M(B(`````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
-M````````````````````````````````````````````````````````````
+#
+# This file contains two 4KB firmware, first half is RT2870 and last half
+# is RT3071. On each 4KB firmware, 3rd last byte is major version number and
+# 2nd last byte is minor version number.
+# This file comes with
+# RT2870 v. 0.17
+# RT3071 v. 0.17
+begin 644 rt2870.fw.uu
+M____`A`H`A`R`A!X`A,J`A,K`A-*`A-/$A-+(@(7N0(8\`(42`(3 at S`%!B`-
+M`Q(9R"*0`8S@,.,;Y4PPX`1_0(`"?P"0$"_O\)`!C'0(\.20`:?PD`&,X##@
+M')`!@."T`A6CX+0!$)`!A."T at 0F0`8QT`?`2#<@BD`04X"#G`P(3*9!P$N#U
+M5I`$!.`2"IT0V3$0O381`E`1.5$10E(10E,10E01 at U41TE82,'`26W$2B7(2
+MX',3`8```!,ID'`1X/4\Y)!P$_"0!!1T@/#E5O1P`P(3*0(3(B`"`S`#'7T"
+MKU82"Y&0!!1T@/#DD'`3\.56]'`#`A,I`A,BA59!T@(BD'`0X%1__[\*#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\9=!0N
+M]8+D-'#U@^_P=!PN]8+D-'#U@^WP(@Z^!-4B(B*0<"K@,.%-PJ^0<"C at D!`<
+M\)!P*>"0$!WPD'`JX)`0'O"0$!S@]6*0$![@(.'SD!`<X)!P*/"0$!W at D'`I
+M\)`0'N"0<"KP,$H'D'`DX$0!\,(%TJ\B(B(`````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
@@ -128,54 +124,6 @@ M```````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
-M``````````````````````````````````````````````````````````R4
-M/____P(0*`(0,@(0>`(29P(2:`(2AP(2C!(2B"("%DD"%Q\"$W<"$HTP!08@
-M#0,2%\$BD`&,X##C&^5,,.`$?T"``G\`D!`O[_"0`8QT"/#DD`&G\)`!C.`P
-MX!R0`8#@M`(5H^"T`1"0`83 at M($)D`&,=`'P$@W=(I`$%.`@YP,"$F:0<!+@
-M]5:0!`3@$@JV$+<Q$.!0$011$0U2$0U3$0U4$4Y5$7YP$:EQ$==R$AUS$CZ`
-M```29B`"`S`#'7T"KU82"ZJ0!!1T@/#DD'`3\.56]'`#`A)F`A)?A59!T@(B
-MD'`0X%1_9`)@`P(29I!P$>!D"&`(X&0 at 8`,"$F9U3 at -U3R`BD'`1X"3_DD<B
-MD`0$X"7@)%WU5Y!P$.#_=$<E5_C&[\:0<!'@_W1()5?XQN_&Y/VO5A(+JI`$
-M%'2`\.20<!/PY5;T<`,"$F8"$E_E1V0'8`OE1V0(8`7E1[0)")!P$>!4#_4Z
-MY4>T"0CE.K0#`^3U1N3]KU82"ZK2!"*0<!#@_I!P$>#][?CF]5?]KU82"ZJ0
-M!!1T@/#DD'`3\.56]'`#`A)F`A)?D'`0X/Z0<!'@_>WU at HZ#X/57_:]6$@NJ
-MD`04=(#PY)!P$_#E5O1P`P(29@(27Y`0`N"T<!ZCX+0P&9`%".!$`?#]D`4%
-MX%3[\$0$\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M\"(.
-MO at 35(B(BD'`JX##A3<*OD'`HX)`0'/"0<"G at D!`=\)!P*N"0$![PD!`<X/5B
-MD!`>X"#A\Y`0'."0<"CPD!`=X)!P*?"0$![@D'`J\#!*!Y!P).!$`?#"!=*O
-M(B(B````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
@@ -187,6 +135,65 @@ M```````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
+M`````````````````````````````````````````````````````````!'"
+M>O___P(0*`(0,@(0>`(3*@(3*P(32@(33Q(32R("%[D"&/`"%$@"$X,P!08@
+M#0,2&<@BD`&,X##C&^5,,.`$?T"``G\`D!`O[_"0`8QT"/#DD`&G\)`!C.`P
+MX!R0`8#@M`(5H^"T`1"0`83 at M($)D`&,=`'P$@W=(I`$%.`@YP,"$RF0<!+@
+M]5:0!`3@$@JV$-DQ$+TV$0)0$3E1$4)2$4)3$4)4$8-5$=)6$C!P$EMQ$HER
+M$N!S$P&````3*9!P$>#U/.20<!/PD`04=(#PY5;T<`,"$RD"$R(@`@,P`QU]
+M`J]6$@NJD`04=(#PY)!P$_#E5O1P`P(3*0(3(H560=("(I!P$.!4?_^_"@V0
+M<!'@M`@&=4X!=4^$D'`0X%1__[\"$I!P$>!D"&`$X+0@!G5.`W5/(.3U)R*0
+M<!'@)/^21R*0!`3@)>`D7?57D'`0X/]T1R57^,;OQI!P$>#_=$@E5_C&[\;D
+M_:]6$@NJD`04=(#PY)!P$_#E5O1P`P(3*0(3(N5'9`=@'>5'9`A@%^5'9`E@
+M$>5'9`I@"^5'9`M@!>5'M`P(D'`1X%0/]3KE1[0)".4ZM`,#Y/5&Y4>T"@CE
+M.K0!`^3U1N3]KU82"ZK2!"*0<!'@]/^0<!#@7_^0<!'@52=/D'`8\)!P$>"0
+M<!GPY/VO5A(+JC`5!-(4@":0<!C@]2>0`BG at _Y!P&>#^[UZ0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&0`J+ at 5'_PH^`@YR.0!#3 at M`(<H^"T
+M`A>CX+0"$G\@$A>OD!`$X%3S\'51`0(8U.50<`9U8@,"&-20$@#@5`-P$G\@
+M$A>OD`*BX%2_\'51`@(8U.50<`,"&,^0`J/@,.8#`AC+D`0WX&0B8`,"&,N0
+M`8IT?O"0`9;PD!($=`KPY5BT<A7E6;0U$.20!0#PHW0(\*-T`?!T`_!_`1(-
+M2)`3*."0<!KPD!,IX)!P&_"0$RC at 5/#PH^!4\/#E6;0U%.4\]&`&H^!4\X`4
+MD!,JX%3[\(`4Y3STD!,J8`C at 5/)%//"`!.!4^O"0!`'@5/WP=6(!=54"Y/51
+M@`GE4'`%=6(#]5'E8F`5P@'D]5'"6:UBKT`2&93E8K0#`M(#TJ\BPJ\P`1+D
+MD`&6\/51PEG"`7T"KT`2&93E4A1@#`1@`P(9D752`755`Y`$`>!$#O"0<!K@
+MD!,H\)!P&^"0$RGPY3ST8`CE/$0!H_"`!I`3*G0%\)`2!'0#\.58M'(6Y5FT
+M-1&0!0!TXO"C=`CPHW0!\'0#\'\!$@U(D`*BX$3`\)`0!.!$#/#D]5+U53`"
+M"<("?0&O01(9E#`#`L(#Y)`!EO#2KR+O]&`MY/YT%"[U at N0T</6#X+3_&704
+M+O6"Y#1P]8/O\'0<+O6"Y#1P]8/M\"(.O at 35(B(BD'`JX##A3<*OD'`HX)`0
+M'/"0<"G at D!`=\)!P*N"0$![PD!`<X/5BD!`>X"#A\Y`0'."0<"CPD!`=X)!P
+M*?"0$![@D'`J\#!*!Y!P).!$`?#"!=*O(B(B````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
@@ -219,7 +226,7 @@ M```````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
-M```````````````````````````````````````````````````````````"
-"F\``
+M```````````````````````````````````````````````````````````1
+"=X$`
`
end
Modified: head/sys/dev/usb/wlan/if_run.c
==============================================================================
--- head/sys/dev/usb/wlan/if_run.c Wed May 12 23:40:44 2010 (r208018)
+++ head/sys/dev/usb/wlan/if_run.c Thu May 13 00:19:03 2010 (r208019)
@@ -1,5 +1,3 @@
-/* $FreeBSD$ */
-
/*-
* Copyright (c) 2008,2010 Damien Bergamini <damien.bergamini at free.fr>
* ported to FreeBSD by Akinori Furukoshi <moonlightakkiy at yahoo.ca>
@@ -39,7 +37,6 @@ __FBSDID("$FreeBSD$");
#include <sys/module.h>
#include <sys/bus.h>
#include <sys/endian.h>
-#include <sys/systm.h>
#include <sys/linker.h>
#include <sys/firmware.h>
#include <sys/kdb.h>
@@ -74,7 +71,7 @@ __FBSDID("$FreeBSD$");
#define USB_DEBUG_VAR run_debug
#include <dev/usb/usb_debug.h>
-#include "if_runreg.h" /* shared with ral(4) */
+#include "if_runreg.h"
#include "if_runvar.h"
#define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
@@ -93,6 +90,12 @@ SYSCTL_INT(_hw_usb_run, OID_AUTO, debug,
#define IEEE80211_HAS_ADDR4(wh) \
(((wh)->i_fc[1] & IEEE80211_FC1_DIR_MASK) == IEEE80211_FC1_DIR_DSTODS)
+/*
+ * Because of LOR in run_key_delete(), use atomic instead.
+ * '& RUN_CMDQ_MASQ' is to loop cmdq[].
+ */
+#define RUN_CMDQ_GET(c) (atomic_fetchadd_32((c), 1) & RUN_CMDQ_MASQ)
+
static const struct usb_device_id run_devs[] = {
{ USB_VP(USB_VENDOR_ABOCOM, USB_PRODUCT_ABOCOM_RT2770) },
{ USB_VP(USB_VENDOR_ABOCOM, USB_PRODUCT_ABOCOM_RT2870) },
@@ -312,6 +315,7 @@ static struct ieee80211vap *run_vap_crea
const uint8_t bssid[IEEE80211_ADDR_LEN], const uint8_t
mac[IEEE80211_ADDR_LEN]);
static void run_vap_delete(struct ieee80211vap *);
+static void run_cmdq_cb(void *, int);
static void run_setup_tx_list(struct run_softc *,
struct run_endpoint_queue *);
static void run_unsetup_tx_list(struct run_softc *,
@@ -342,23 +346,24 @@ static struct ieee80211_node *run_node_a
static int run_media_change(struct ifnet *);
static int run_newstate(struct ieee80211vap *, enum ieee80211_state, int);
static int run_wme_update(struct ieee80211com *);
-static void run_wme_update_cb(void *, int);
+static void run_wme_update_cb(void *);
static void run_key_update_begin(struct ieee80211vap *);
static void run_key_update_end(struct ieee80211vap *);
-static int run_key_set(struct ieee80211vap *, const struct ieee80211_key *,
+static void run_key_set_cb(void *);
+static int run_key_set(struct ieee80211vap *, struct ieee80211_key *,
const uint8_t mac[IEEE80211_ADDR_LEN]);
-static int run_key_delete(struct ieee80211vap *,
- const struct ieee80211_key *);
-static void run_ratectl_start(struct run_softc *, struct ieee80211_node *);
+static void run_key_delete_cb(void *);
+static int run_key_delete(struct ieee80211vap *, struct ieee80211_key *);
static void run_ratectl_to(void *);
static void run_ratectl_cb(void *, int);
+static void run_drain_fifo(void *);
static void run_iter_func(void *, struct ieee80211_node *);
+static void run_newassoc_cb(void *);
static void run_newassoc(struct ieee80211_node *, int);
static void run_rx_frame(struct run_softc *, struct mbuf *, uint32_t);
static void run_tx_free(struct run_endpoint_queue *pq,
struct run_tx_data *, int);
-static void run_set_tx_desc(struct run_softc *, struct run_tx_data *,
- uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t);
+static void run_set_tx_desc(struct run_softc *, struct run_tx_data *);
static int run_tx(struct run_softc *, struct mbuf *,
struct ieee80211_node *);
static int run_tx_mgt(struct run_softc *, struct mbuf *,
@@ -382,11 +387,10 @@ static int run_set_chan(struct run_softc
static void run_set_channel(struct ieee80211com *);
static void run_scan_start(struct ieee80211com *);
static void run_scan_end(struct ieee80211com *);
-static uint8_t run_rate2mcs(uint8_t);
static void run_update_beacon(struct ieee80211vap *, int);
-static void run_update_beacon_locked(struct ieee80211vap *, int);
+static void run_update_beacon_cb(void *);
static void run_updateprot(struct ieee80211com *);
-static void run_usb_timeout_cb(void *, int);
+static void run_usb_timeout_cb(void *);
static void run_reset_livelock(struct run_softc *);
static void run_enable_tsf_sync(struct run_softc *);
static void run_enable_mrr(struct run_softc *);
@@ -396,6 +400,7 @@ static void run_set_leds(struct run_soft
static void run_set_bssid(struct run_softc *, const uint8_t *);
static void run_set_macaddr(struct run_softc *, const uint8_t *);
static void run_updateslot(struct ifnet *);
+static void run_update_mcast(struct ifnet *);
static int8_t run_rssi2dbm(struct run_softc *, uint8_t, uint8_t);
static void run_update_promisc_locked(struct ifnet *);
static void run_update_promisc(struct ifnet *);
@@ -411,7 +416,7 @@ static void run_stop(void *);
static void run_delay(struct run_softc *, unsigned int);
static const struct {
- uint32_t reg;
+ uint16_t reg;
uint32_t val;
} rt2870_def_mac[] = {
RT2870_DEF_MAC
@@ -551,6 +556,7 @@ run_attach(device_t self)
MTX_NETWORK_LOCK, MTX_DEF);
iface_index = RT2860_IFACE_INDEX;
+
error = usbd_transfer_setup(uaa->device, &iface_index,
sc->sc_xfer, run_config, RUN_N_XFER, sc, &sc->sc_mtx);
if (error) {
@@ -616,15 +622,15 @@ run_attach(device_t self)
ic->ic_ifp = ifp;
ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */
ic->ic_opmode = IEEE80211_M_STA; /* default to BSS mode */
-#if 0
- ic->ic_state = IEEE80211_S_INIT;
-#endif
+
/* set device capabilities */
ic->ic_caps =
IEEE80211_C_STA | /* station mode supported */
IEEE80211_C_MONITOR | /* monitor mode supported */
IEEE80211_C_IBSS |
IEEE80211_C_HOSTAP |
+ IEEE80211_C_WDS | /* 4-address traffic works */
+ IEEE80211_C_MBSS |
IEEE80211_C_SHPREAMBLE | /* short preamble supported */
IEEE80211_C_SHSLOT | /* short slot time supported */
IEEE80211_C_WME | /* WME */
@@ -671,6 +677,7 @@ run_attach(device_t self)
ic->ic_node_alloc = run_node_alloc;
ic->ic_newassoc = run_newassoc;
//ic->ic_updateslot = run_updateslot;
+ ic->ic_update_mcast = run_update_mcast;
ic->ic_wme.wme_update = run_wme_update;
ic->ic_raw_xmit = run_raw_xmit;
ic->ic_update_promisc = run_update_promisc;
@@ -684,6 +691,10 @@ run_attach(device_t self)
&sc->sc_rxtap.wr_ihdr, sizeof(sc->sc_rxtap),
RUN_RX_RADIOTAP_PRESENT);
+ TASK_INIT(&sc->cmdq_task, 0, run_cmdq_cb, sc);
+ TASK_INIT(&sc->ratectl_task, 0, run_ratectl_cb, sc);
+ callout_init((struct callout *)&sc->ratectl_ch, 1);
+
if (bootverbose)
ieee80211_announce(ic);
@@ -713,6 +724,10 @@ run_detach(device_t self)
if (ifp) {
ic = ifp->if_l2com;
+ /* drain tasks */
+ usb_callout_drain(&sc->ratectl_ch);
+ ieee80211_draintask(ic, &sc->cmdq_task);
+ ieee80211_draintask(ic, &sc->ratectl_task);
ieee80211_ifdetach(ic);
if_free(ifp);
}
@@ -728,41 +743,92 @@ run_vap_create(struct ieee80211com *ic,
const uint8_t bssid[IEEE80211_ADDR_LEN],
const uint8_t mac[IEEE80211_ADDR_LEN])
{
- struct run_softc *sc = ic->ic_ifp->if_softc;
+ struct ifnet *ifp = ic->ic_ifp;
+ struct run_softc *sc = ifp->if_softc;
struct run_vap *rvp;
struct ieee80211vap *vap;
+ int i;
- if (!TAILQ_EMPTY(&ic->ic_vaps)) /* only one at a time */
+ if(sc->rvp_cnt >= RUN_VAP_MAX){
+ if_printf(ifp, "number of VAPs maxed out\n");
return NULL;
- sc->sc_rvp = rvp = (struct run_vap *) malloc(sizeof(struct run_vap),
+ }
+
+ switch (opmode) {
+ case IEEE80211_M_STA:
+ /* enable s/w bmiss handling for sta mode */
+ flags |= IEEE80211_CLONE_NOBEACONS;
+ /* fall though */
+ case IEEE80211_M_IBSS:
+ case IEEE80211_M_MONITOR:
+ case IEEE80211_M_HOSTAP:
+ case IEEE80211_M_MBSS:
+ /* other than WDS vaps, only one at a time */
+ if (!TAILQ_EMPTY(&ic->ic_vaps))
+ return NULL;
+ break;
+ case IEEE80211_M_WDS:
+ TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next){
+ if(vap->iv_opmode != IEEE80211_M_HOSTAP)
+ continue;
+ /* WDS vap's always share the local mac address. */
+ flags &= ~IEEE80211_CLONE_BSSID;
+ break;
+ }
+ if(vap == NULL){
+ if_printf(ifp, "wds only supported in ap mode\n");
+ return NULL;
+ }
+ break;
+ default:
+ if_printf(ifp, "unknown opmode %d\n", opmode);
+ return NULL;
+ }
+
+ rvp = (struct run_vap *) malloc(sizeof(struct run_vap),
M_80211_VAP, M_NOWAIT | M_ZERO);
if (rvp == NULL)
return NULL;
vap = &rvp->vap;
- /* enable s/w bmiss handling for sta mode */
- ieee80211_vap_setup(ic, vap, name, unit, opmode,
- flags | IEEE80211_CLONE_NOBEACONS, bssid, mac);
+ ieee80211_vap_setup(ic, vap, name, unit, opmode, flags, bssid, mac);
vap->iv_key_update_begin = run_key_update_begin;
vap->iv_key_update_end = run_key_update_end;
- vap->iv_key_delete = run_key_delete;
- vap->iv_key_set = run_key_set;
vap->iv_update_beacon = run_update_beacon;
+ vap->iv_max_aid = RT2870_WCID_MAX;
+ /*
+ * To delete the right key from h/w, we need wcid.
+ * Luckily, there is unused space in ieee80211_key{}, wk_pad,
+ * and matching wcid will be written into there. So, cast
+ * some spells to remove 'const' from ieee80211_key{}
+ */
+ vap->iv_key_delete = (void *)run_key_delete;
+ vap->iv_key_set = (void *)run_key_set;
/* override state transition machine */
rvp->newstate = vap->iv_newstate;
vap->iv_newstate = run_newstate;
- TASK_INIT(&rvp->ratectl_task, 0, run_ratectl_cb, rvp);
- TASK_INIT(&sc->wme_task, 0, run_wme_update_cb, ic);
- TASK_INIT(&sc->usb_timeout_task, 0, run_usb_timeout_cb, sc);
- callout_init((struct callout *)&rvp->ratectl_ch, 1);
ieee80211_ratectl_init(vap);
ieee80211_ratectl_setinterval(vap, 1000 /* 1 sec */);
/* complete setup */
ieee80211_vap_attach(vap, run_media_change, ieee80211_media_status);
- ic->ic_opmode = opmode;
+
+ /* make sure id is always unique */
+ for(i = 0; i < RUN_VAP_MAX; i++){
+ if((sc->rvp_bmap & 1 << i) == 0){
+ sc->rvp_bmap |= 1 << i;
+ rvp->rvp_id = i;
+ break;
+ }
+ }
+ if(sc->rvp_cnt++ == 0)
+ ic->ic_opmode = opmode;
+
+ DPRINTF("rvp_id=%d bmap=%x rvp_cnt=%d\n",
+ rvp->rvp_id, sc->rvp_bmap, sc->rvp_cnt);
+
return vap;
}
@@ -773,6 +839,7 @@ run_vap_delete(struct ieee80211vap *vap)
struct ifnet *ifp;
struct ieee80211com *ic;
struct run_softc *sc;
+ uint8_t rvp_id;
if(vap == NULL)
return;
@@ -783,19 +850,59 @@ run_vap_delete(struct ieee80211vap *vap)
sc = ifp->if_softc;
RUN_LOCK(sc);
- sc->sc_rvp->ratectl_run = RUN_RATECTL_OFF;
- RUN_UNLOCK(sc);
- /* drain them all */
- usb_callout_drain(&sc->sc_rvp->ratectl_ch);
- ieee80211_draintask(ic, &sc->sc_rvp->ratectl_task);
- ieee80211_draintask(ic, &sc->wme_task);
- ieee80211_draintask(ic, &sc->usb_timeout_task);
+ rvp_id = rvp->rvp_id;
+ sc->ratectl_run &= ~(1 << rvp_id);
+ sc->rvp_bmap &= ~(1 << rvp_id);
+ run_set_region_4(sc, RT2860_SKEY(rvp_id, 0), 0, 128);
+ run_set_region_4(sc, RT2860_BCN_BASE(rvp_id), 0, 512);
+ --sc->rvp_cnt;
+
+ DPRINTF("vap=%p rvp_id=%d bmap=%x rvp_cnt=%d\n",
+ vap, rvp_id, sc->rvp_bmap, sc->rvp_cnt);
+
+ RUN_UNLOCK(sc);
ieee80211_ratectl_deinit(vap);
ieee80211_vap_detach(vap);
free(rvp, M_80211_VAP);
- sc->sc_rvp = NULL;
+}
+
+/*
+ * There are numbers of functions need to be called in context thread.
+ * Rather than creating taskqueue event for each of those functions,
+ * here is all-for-one taskqueue callback function. This function
+ * gurantees deferred functions are executed in the same order they
+ * were enqueued.
+ * '& RUN_CMDQ_MASQ' is to loop cmdq[].
+ */
+static void
+run_cmdq_cb(void *arg, int pending)
+{
+ struct run_softc *sc = arg;
+ uint8_t i;
+
+ /* call cmdq[].func locked */
+ RUN_LOCK(sc);
+ for(i = sc->cmdq_exec; sc->cmdq[i].func && pending;
+ i = sc->cmdq_exec, pending--){
+ DPRINTFN(6, "cmdq_exec=%d pending=%d\n", i, pending);
+ if(sc->cmdq_run == RUN_CMDQ_GO){
+ /*
+ * If arg0 is NULL, callback func needs more
+ * than one arg. So, pass ptr to cmdq struct.
+ */
+ if(sc->cmdq[i].arg0)
+ sc->cmdq[i].func(sc->cmdq[i].arg0);
+ else
+ sc->cmdq[i].func(&sc->cmdq[i]);
+ }
+ sc->cmdq[i].arg0 = NULL;
+ sc->cmdq[i].func = NULL;
+ sc->cmdq_exec++;
+ sc->cmdq_exec &= RUN_CMDQ_MASQ;
+ }
+ RUN_UNLOCK(sc);
}
static void
@@ -1415,6 +1522,7 @@ run_read_eeprom(struct run_softc *sc)
DPRINTF("EEPROM RF rev=0x%02x chains=%dT%dR\n",
sc->rf_rev, sc->ntxchains, sc->nrxchains);
+ /* check if RF supports automatic Tx access gain control */
run_srom_read(sc, RT2860_EEPROM_CONFIG, &val);
DPRINTF("EEPROM CFG 0x%04x\n", val);
/* check if driver should patch the DAC issue */
@@ -1489,10 +1597,10 @@ run_read_eeprom(struct run_softc *sc)
for (ridx = 0; ridx < 5; ridx++) {
uint32_t reg;
- run_srom_read(sc, RT2860_EEPROM_RPWR + ridx, &val);
- reg = (uint32_t)val << 16;
- run_srom_read(sc, RT2860_EEPROM_RPWR + ridx + 1, &val);
- reg |= val;
+ run_srom_read(sc, RT2860_EEPROM_RPWR + ridx * 2, &val);
+ reg = val;
+ run_srom_read(sc, RT2860_EEPROM_RPWR + ridx * 2 + 1, &val);
+ reg |= (uint32_t)val << 16;
sc->txpow20mhz[ridx] = reg;
sc->txpow40mhz_2ghz[ridx] = b4inc(reg, delta_2ghz);
@@ -1575,19 +1683,21 @@ run_node_alloc(struct ieee80211vap *vap,
static int
run_media_change(struct ifnet *ifp)
{
+ struct ieee80211vap *vap = ifp->if_softc;
+ struct ieee80211com *ic = vap->iv_ic;
const struct ieee80211_txparam *tp;
- struct run_softc *sc = ifp->if_softc;
- struct ieee80211com *ic = sc->sc_ifp->if_l2com;
- struct ieee80211vap *vap = &sc->sc_rvp->vap;
+ struct run_softc *sc = ic->ic_ifp->if_softc;
+ struct run_node *rn = (void *)vap->iv_bss;
uint8_t rate, ridx;
int error;
RUN_LOCK(sc);
error = ieee80211_media_change(ifp);
- if (error != ENETRESET)
+ if (error != ENETRESET){
RUN_UNLOCK(sc);
return error;
+ }
tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_curchan)];
if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) {
@@ -1596,13 +1706,16 @@ run_media_change(struct ifnet *ifp)
for (ridx = 0; ridx < RT2860_RIDX_MAX; ridx++)
if (rt2860_rates[ridx].rate == rate)
break;
- sc->fixed_ridx = ridx;
+ rn->fix_ridx = ridx;
+ DPRINTF("rate=%d, fix_ridx=%d\n", rate, rn->fix_ridx);
}
+#if 0
if ((ifp->if_flags & IFF_UP) &&
(ifp->if_drv_flags & IFF_DRV_RUNNING)){
run_init_locked(sc);
}
+#endif
RUN_UNLOCK(sc);
@@ -1618,8 +1731,11 @@ run_newstate(struct ieee80211vap *vap, e
struct run_vap *rvp = RUN_VAP(vap);
enum ieee80211_state ostate;
struct ieee80211_node *ni;
+ uint32_t sta[3];
uint32_t tmp;
- uint8_t wcid;
+ uint8_t ratectl;
+ uint8_t restart_ratectl = 0;
+ uint8_t bid = 1 << rvp->rvp_id;
ostate = vap->iv_state;
DPRINTF("%s -> %s\n",
@@ -1629,8 +1745,9 @@ run_newstate(struct ieee80211vap *vap, e
IEEE80211_UNLOCK(ic);
RUN_LOCK(sc);
- sc->sc_rvp->ratectl_run = RUN_RATECTL_OFF;
- usb_callout_stop(&rvp->ratectl_ch);
+ ratectl = sc->ratectl_run; /* remember current state */
+ sc->ratectl_run = RUN_RATECTL_OFF;
+ usb_callout_stop(&sc->ratectl_ch);
if (ostate == IEEE80211_S_RUN) {
/* turn link LED off */
@@ -1639,8 +1756,16 @@ run_newstate(struct ieee80211vap *vap, e
switch (nstate) {
case IEEE80211_S_INIT:
- if (ostate == IEEE80211_S_RUN) {
- /* abort TSF synchronization */
+ restart_ratectl = 1;
+
+ if (ostate != IEEE80211_S_RUN)
+ break;
+
+ ratectl &= ~bid;
+ sc->runbmap &= ~bid;
+
+ /* abort TSF synchronization if there is no vap running */
+ if(--sc->running == 0){
run_read(sc, RT2860_BCN_TIME_CFG, &tmp);
run_write(sc, RT2860_BCN_TIME_CFG,
tmp & ~(RT2860_BCN_TX_EN | RT2860_TSF_TIMER_EN |
@@ -1648,8 +1773,42 @@ run_newstate(struct ieee80211vap *vap, e
}
break;
+
case IEEE80211_S_RUN:
ni = vap->iv_bss;
+ if(!(sc->runbmap & bid)){
+ if(sc->running++)
+ restart_ratectl = 1;
+ sc->runbmap |= bid;
+ }
+
+ switch(vap->iv_opmode){
+ case IEEE80211_M_HOSTAP:
+ case IEEE80211_M_MBSS:
+ sc->ap_running |= bid;
+ ic->ic_opmode = vap->iv_opmode;
+ run_update_beacon_cb(vap);
+ break;
+ case IEEE80211_M_IBSS:
+ sc->adhoc_running |= bid;
+ if(!sc->ap_running)
+ ic->ic_opmode = vap->iv_opmode;
+ run_update_beacon_cb(vap);
+ break;
+ case IEEE80211_M_STA:
+ sc->sta_running |= bid;
+ if(!sc->ap_running && !sc->adhoc_running)
+ ic->ic_opmode = vap->iv_opmode;
+
+ /* read statistic counters (clear on read) */
+ run_read_region_1(sc, RT2860_TX_STA_CNT0,
+ (uint8_t *)sta, sizeof sta);
+
+ break;
+ default:
+ ic->ic_opmode = vap->iv_opmode;
+ break;
+ }
if (vap->iv_opmode != IEEE80211_M_MONITOR) {
run_updateslot(ic->ic_ifp);
@@ -1658,31 +1817,17 @@ run_newstate(struct ieee80211vap *vap, e
run_set_basicrates(sc);
IEEE80211_ADDR_COPY(sc->sc_bssid, ni->ni_bssid);
run_set_bssid(sc, ni->ni_bssid);
- }
-
- if (vap->iv_opmode == IEEE80211_M_STA) {
- /* add BSS entry to the WCID table */
- wcid = RUN_AID2WCID(ni->ni_associd);
- run_write_region_1(sc, RT2860_WCID_ENTRY(wcid),
- ni->ni_macaddr, IEEE80211_ADDR_LEN);
- }
-
- if (vap->iv_opmode == IEEE80211_M_HOSTAP ||
- vap->iv_opmode == IEEE80211_M_IBSS)
- run_update_beacon_locked(vap, 0);
-
- if (vap->iv_opmode != IEEE80211_M_MONITOR) {
run_enable_tsf_sync(sc);
- } /* else tsf */
- /* enable automatic rate adaptation */
- tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_curchan)];
- if (tp->ucastrate == IEEE80211_FIXED_RATE_NONE)
- run_ratectl_start(sc, ni);
+ /* enable automatic rate adaptation */
+ tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_curchan)];
+ if (tp->ucastrate == IEEE80211_FIXED_RATE_NONE)
+ ratectl |= bid;
+ }
/* turn link LED on */
run_set_leds(sc, RT2860_LED_RADIO |
- (IEEE80211_IS_CHAN_2GHZ(vap->iv_bss->ni_chan) ?
+ (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan) ?
RT2860_LED_LINK_2GHZ : RT2860_LED_LINK_5GHZ));
break;
@@ -1691,34 +1836,26 @@ run_newstate(struct ieee80211vap *vap, e
break;
}
+ /* restart amrr for running VAPs */
+ if((sc->ratectl_run = ratectl) && restart_ratectl)
+ usb_callout_reset(&sc->ratectl_ch, hz, run_ratectl_to, sc);
+
RUN_UNLOCK(sc);
IEEE80211_LOCK(ic);
return(rvp->newstate(vap, nstate, arg));
}
-/* another taskqueue, so usbd_do_request() can go sleep */
-static int
-run_wme_update(struct ieee80211com *ic)
-{
- struct run_softc *sc = ic->ic_ifp->if_softc;
-
- ieee80211_runtask(ic, &sc->wme_task);
-
- /* return whatever, upper layer desn't care anyway */
- return 0;
-}
-
/* ARGSUSED */
static void
-run_wme_update_cb(void *arg, int pending)
+run_wme_update_cb(void *arg)
{
struct ieee80211com *ic = arg;
struct run_softc *sc = ic->ic_ifp->if_softc;
struct ieee80211_wme_state *wmesp = &ic->ic_wme;
int aci, error = 0;
- RUN_LOCK(sc);
+ RUN_LOCK_ASSERT(sc, MA_OWNED);
/* update MAC TX configuration registers */
for (aci = 0; aci < WME_NUM_AC; aci++) {
@@ -1761,19 +1898,39 @@ err:
if(error)
DPRINTF("WME update failed\n");
- RUN_UNLOCK(sc);
return;
}
+static int
+run_wme_update(struct ieee80211com *ic)
+{
+ struct run_softc *sc = ic->ic_ifp->if_softc;
+
+ /* sometime called wothout lock */
+ if(mtx_owned(&ic->ic_comlock.mtx)){
+ uint32_t i = RUN_CMDQ_GET(&sc->cmdq_store);
+ DPRINTF("cmdq_store=%d\n", i);
+ sc->cmdq[i].func = run_wme_update_cb;
+ sc->cmdq[i].arg0 = ic;
+ ieee80211_runtask(ic, &sc->cmdq_task);
+ return (0);
+ }
+
+ RUN_LOCK(sc);
+ run_wme_update_cb(ic);
+ RUN_UNLOCK(sc);
+
+ /* return whatever, upper layer desn't care anyway */
+ return (0);
+}
+
static void
run_key_update_begin(struct ieee80211vap *vap)
{
/*
- * Because run_key_delete() needs special attention
- * on lock related operation, lock handling is being done
- * differently in run_key_set and _delete.
- *
- * So, we don't use key_update_begin and _end.
+ * To avoid out-of-order events, both run_key_set() and
+ * _delete() are deferred and handled by run_cmdq_cb().
+ * So, there is nothing we need to do here.
*/
}
@@ -1783,37 +1940,31 @@ run_key_update_end(struct ieee80211vap *
/* null */
}
-/*
- * return 0 on error
- */
-static int
-run_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k,
- const uint8_t mac[IEEE80211_ADDR_LEN])
+static void
+run_key_set_cb(void *arg)
{
+ struct run_cmdq *cmdq = arg;
+ struct ieee80211vap *vap = cmdq->arg1;
+ struct ieee80211_key *k = cmdq->k;
struct ieee80211com *ic = vap->iv_ic;
- struct ifnet *ifp = ic->ic_ifp;
- struct run_softc *sc = ifp->if_softc;
+ struct run_softc *sc = ic->ic_ifp->if_softc;
struct ieee80211_node *ni;
uint32_t attr;
uint16_t base, associd;
uint8_t mode, wcid, txmic, rxmic, iv[8];
- int error = 0;
- RUN_LOCK(sc);
+ RUN_LOCK_ASSERT(sc, MA_OWNED);
if(vap->iv_opmode == IEEE80211_M_HOSTAP){
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-all
mailing list