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...@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...@9"!...@`p(29G5.`W5/("*0<!'@)/^21R*0 -M!`3@)>`D7?57D'`0X/]T1R57^,;OQI!P$>#...@e5_c&[\;D_:]...@n1d`04 -M=(#PY)!P$_#E5O1P`P(29@(27^5'9`=@"^5'9...@!>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@ -M5/OP1`3P[53^D`4(\.3U3O5/=3K_K5>O5A(+D9`$%'2`\.20<!/PY5;T8$N` -M0I!P$.`D_Y*3Y/VO5A(+D9`$%'2`\.20<!/PY5;T8"J`(9!P$.`D_Y)*...@6m -m5z...@n1d`04=(#PY)!p$_#e...@!y!p)>!$`?`B(N53<!HP8`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1V0( -M8`GE1V0)8`,"%ACD]2>0...@5/SPY3H48"T48"X48#8D_&!?)/E@'R0.<&GE -M1A,35#]u\`.$...@1p1^`8`"?...@#o;b...@$6b1x!!y48px@/3@"?#@"3E1C#B -M#50XPY0P4`9^`'\...@`1^`'\`($<$?0&``GT`[VU.)/^2.*)'LY(y...@!ge1c#b -M`].``<.2.:)'LY(x...@`>B1[.2.)(YD`(HX%3\12?PD'"<Y3KPH^5'\)!P0>4Z -M\"+DD`(I\#!'!...@`3e1?3_d`(H[_`BCU#262*/5-)8(N3U8L*OY5$48$84 -M8&(D`F`#`A<#TEEU50&0...@5'_p...@yr*0!#3@M`(;H^"T`A:CX+0"$7\@ -M$A8_D!`$X%3S\'51`8!SY5!P!75B`X!JD!(`X%0#<!%_(!(6/Y`"HN!4O_!U -M40*`4>50<`*`1I`"h...@ycn0!#?@9")P,Y`!BG1^\)`!EO"0...@1t"O"0$RC@ -M5/#PH^!4\/"CX%3Z\)`$`>!4^?...@%u50+d]5&`">50<`5U8@/U4>5B8!7" -M`>3U4<)9K6*O0!(7C>5BM`,"T@/2KR+"KS`!$N20`9;P]5'"6<(!?0*O0!(7 -MC>52%&`)!'!,=5(!=54#D`0!X$0.\)`3*.!$#_"CX$0/\*/@1`7PD!($=`/P -MD`*BX$3`\)`0!.!$#/#D]5+U53`""\("?0&O01(7C8`"P@/DD`&6\-*O(N_T -M8"WD_G04+O6"Y#1P]8/@M/\9=!0N]8+D-'#...@^_p=!pn]8+d-'#...@^wp(@Z^ -M!-4B(B*0<"K@,.%-PJ^0<"c...@d!`<\)!P*>"0$!WPD'`JX)`0'O"0...@]6*0 -M$![@(.'SD!`<X)!P*/"0...@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...@s`%!b`- +M`Q(9R"*0`8S@,.,;Y4PPX`1_0(`"?P"0$"_O\)`!C'0(\.20`:?PD`&,X##@ +M')`...@."T`A6CX+0!$)`!A."t...@0f0`8qt`?`2#<@BD`04X"#G`P(3*9!P$N#U +M5I`$!.`2"IT0V3$0O381`E`1.5$10E(10E,10...@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__[\*#9!P +M$>"T"`...@%u3x20<!...@5'__OP(2D'`1X&0(8...@m"`&=4x#...@y/4G(I!P +M$>`D_Y)'(I`$!.`EX"1=]5>0<!...@_w1')5?XQN_&D'`1X/]T2"57^,;OQN3] +MKU82"Y&0!!1T@/#DD'`3\.56]'`#`A,I`A,BY4=D!V`=Y4=D"&`7Y4=D"6`1 +MY4=D"F`+Y4=D"V`%Y4>T#`B0<!'@5`_U.N5'M`D(Y3JT`P/D]4;E1[0*".4Z +MM`$#Y/5&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\"*/4-)9(h]...@by/5B +mpj_e...@2!1@9B0"8`,"&-326755`9`"HN!4?_"CX"#G(Y`$-."T`ARCX+0" +M%Z/@M`(2?r`2%z^0...@5//P=5$!`AC4Y5!P!G5B`P(8U)`2`.!4`W`2?R`2 +m%z^0...@5+_p=5$"`AC4Y5!P`P(8SY`"H^`PY@,"&,n0...@9")@`P(8RY`! +MBG1^\)`!EO"0...@1t"O#E6+1R%>59M#40Y)`%`/"C=`CPHW0!\'0#\'\...@tj +MD!,HX)!P&O"0...@d'`;\)`3*.!4\/"CX%3P\.59M#44Y3ST8`:cx...@!20 +m...@5/o...@!3e//20$RI@".!4\D4\\(`$X%3Z\)`$`>!4_?...@%u50+d]5&` +M">50<`5U8@/U4>5B8!7"`>3U4<)9K6*O0!(9E.5BM`,"T@/2KR+"KS`!$N20 +M`9;P]5'"6<(!?0*O0!(9E.52%&`,!&`#`AF1=5(!=54#D`0!X$0.\)!P&N"0 +M$RCPD'`;X)`3*?#E//1@".4\1`&C\(`&D!,J=`7PD!($=`/PY5BT<A;E6;0U +M$9`%`'3B\*-T"/"C=`'P=`/p?p$2#2j0...@1,#PD!`$X$0,\.3U4O55,`() +MP@)]`:]!$AF4,`,"P@/DD`&6\-*O(N_T8"WD_G04+O6"Y#1P]8/@M/\9=!0N +M]8+D-'#...@^_p=!pn]8+d-'#...@^wp(@Z^!-4B(B*0<"K@,.%-PJ^0<"c...@d!`< +M\)!P*>"0$!WPD'`JX)`0'O"0...@]6*0$![@(.'SD!`<X)!P*/"0...@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"%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CB2.9`"*.!4_$4G\)!PG.4Z\*/E1_"0<$'E -M.O`BY)`"*?`P1P2O18`$Y47T_Y`"*._P(H]0TEDBCU326"+D]6+"K^51%&!& -M%&!B)`)@`P(7`])9=54!D`*BX%1_\*/@(.<BD`0TX+0"&Z/@M`(6H^"T`A%_ -M(!(6/Y`0!.!4\_!U40&`<^50<`...@.`:i`2`.!4`w`1?r`2%c^0...@5+_p -M=5$"@%'E4'`"@$:0`J/@(.8[D`0WX&0B<#.0`8IT?O"0`9;PD!($=`KPD!,H -MX%3P\*/@5/#PH^!4^O"0!`'@5/GP=6(!=54"Y/5...@`ge4'`%=6(#]5'E8F`5 -MP@'D]5'"6:UBKT`2%XWE8K0#`M(#TJ\BPJ\P`1+DD`&6\/51PEG"`7T"KT`2 -M%XWE4A1@"01P3'52`755`Y`$`>!$#O"0...@1`_ph^!$#_"CX$0%\)`2!'0# -M\)`"HN!$P/"0...@1`spy/52]5...@o"`GT!KT$2%XV``L(#Y)`!EO#2KR+O -M]&`MY/YT%"[...@n0t</6#X+3_&704+O6"Y#1P]8/O\'0<+O6"Y#1P]8/M\"(. -...@35(B(BD'`JX##A3<*OD'`HX)`0'/"0<"g...@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...@m`(5H^"T`1"0...@m($)D`&,=`'p...@w=(i`$...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/#D]5+U53`" +M"<("?0&O01(9E#`#`L(#Y)`!EO#2KR+O]&`MY/YT%"[...@n0t</6#X+3_&704 +M+O6"Y#1P]8/O\'0<+O6"Y#1P]8/M\"(....@35(B(BD'`JX##A3<*OD'`HX)`0 +M'/"0<"g...@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.bergam...@free.fr> * ported to FreeBSD by Akinori Furukoshi <moonlightak...@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 *** _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"