svn commit: r335351 - in head/sys/dev/rtwn: rtl8812a rtl8812a/usb rtl8821a/usb
Author: avos Date: Tue Jun 19 00:38:28 2018 New Revision: 335351 URL: https://svnweb.freebsd.org/changeset/base/335351 Log: rtwn(4): decode some bit fields + merge duplicate code. Add macros for R12A_RXDMA_PRO register (descriptions were seen in the RTL8822B vendor driver) and merge 2 r21au_init_burstlen() copies. No functional change intended. Modified: head/sys/dev/rtwn/rtl8812a/r12a_reg.h head/sys/dev/rtwn/rtl8812a/usb/r12au.h head/sys/dev/rtwn/rtl8812a/usb/r12au_init.c head/sys/dev/rtwn/rtl8821a/usb/r21au.h head/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c head/sys/dev/rtwn/rtl8821a/usb/r21au_init.c Modified: head/sys/dev/rtwn/rtl8812a/r12a_reg.h == --- head/sys/dev/rtwn/rtl8812a/r12a_reg.h Tue Jun 19 00:27:30 2018 (r335350) +++ head/sys/dev/rtwn/rtl8812a/r12a_reg.h Tue Jun 19 00:38:28 2018 (r335351) @@ -58,6 +58,16 @@ /* Bits for R92C_LEDCFG2. */ #define R12A_LEDCFG2_ENA 0x20 +/* Bits for R12A_RXDMA_PRO. */ +#define R12A_DMA_MODE 0x02 +#define R12A_BURST_CNT_M 0x0c +#define R12A_BURST_CNT_S 2 +#define R12A_BURST_SZ_M0x30 +#define R12A_BURST_SZ_S4 +#define R12A_BURST_SZ_USB3 0 +#define R12A_BURST_SZ_USB2 1 +#define R12A_BURST_SZ_USB1 2 + /* Bits for R12A_CCK_CHECK. */ #define R12A_CCK_CHECK_BCN10x20 #define R12A_CCK_CHECK_5GHZ0x80 Modified: head/sys/dev/rtwn/rtl8812a/usb/r12au.h == --- head/sys/dev/rtwn/rtl8812a/usb/r12au.h Tue Jun 19 00:27:30 2018 (r335350) +++ head/sys/dev/rtwn/rtl8812a/usb/r12au.h Tue Jun 19 00:38:28 2018 (r335351) @@ -37,6 +37,7 @@ */ /* r12au_init.c */ void r12au_init_rx_agg(struct rtwn_softc *); +void r12au_init_burstlen_usb2(struct rtwn_softc *); void r12au_init_burstlen(struct rtwn_softc *); void r12au_init_ampdu_fwhw(struct rtwn_softc *); void r12au_init_ampdu(struct rtwn_softc *); Modified: head/sys/dev/rtwn/rtl8812a/usb/r12au_init.c == --- head/sys/dev/rtwn/rtl8812a/usb/r12au_init.c Tue Jun 19 00:27:30 2018 (r335350) +++ head/sys/dev/rtwn/rtl8812a/usb/r12au_init.c Tue Jun 19 00:38:28 2018 (r335351) @@ -72,19 +72,32 @@ r12au_init_rx_agg(struct rtwn_softc *sc) } void +r12au_init_burstlen_usb2(struct rtwn_softc *sc) +{ + const uint8_t dma_count = R12A_DMA_MODE | SM(R12A_BURST_CNT, 3); + + if ((rtwn_read_1(sc, R92C_USB_INFO) & 0x30) == 0) { + /* Set burst packet length to 512 B. */ + rtwn_setbits_1(sc, R12A_RXDMA_PRO, R12A_BURST_SZ_M, + dma_count | SM(R12A_BURST_SZ, R12A_BURST_SZ_USB2)); + } else { + /* Set burst packet length to 64 B. */ + rtwn_setbits_1(sc, R12A_RXDMA_PRO, R12A_BURST_SZ_M, + dma_count | SM(R12A_BURST_SZ, R12A_BURST_SZ_USB1)); + } +} + +void r12au_init_burstlen(struct rtwn_softc *sc) { - if (rtwn_read_1(sc, R92C_TYPE_ID + 3) & 0x80) { - if ((rtwn_read_1(sc, R92C_USB_INFO) & 0x30) == 0) { - /* Set burst packet length to 512 B. */ - rtwn_setbits_1(sc, R12A_RXDMA_PRO, 0x20, 0x1e); - } else { - /* Set burst packet length to 64 B. */ - rtwn_setbits_1(sc, R12A_RXDMA_PRO, 0x10, 0x2e); - } - } else {/* USB 3.0 */ + const uint8_t dma_count = R12A_DMA_MODE | SM(R12A_BURST_CNT, 3); + + if (rtwn_read_1(sc, R92C_TYPE_ID + 3) & 0x80) + r12au_init_burstlen_usb2(sc); + else { /* USB 3.0 */ /* Set burst packet length to 1 KB. */ - rtwn_setbits_1(sc, R12A_RXDMA_PRO, 0x30, 0x0e); + rtwn_setbits_1(sc, R12A_RXDMA_PRO, R12A_BURST_SZ_M, + dma_count | SM(R12A_BURST_SZ, R12A_BURST_SZ_USB3)); rtwn_setbits_1(sc, 0xf008, 0x18, 0); } Modified: head/sys/dev/rtwn/rtl8821a/usb/r21au.h == --- head/sys/dev/rtwn/rtl8821a/usb/r21au.h Tue Jun 19 00:27:30 2018 (r335350) +++ head/sys/dev/rtwn/rtl8821a/usb/r21au.h Tue Jun 19 00:38:28 2018 (r335351) @@ -37,7 +37,6 @@ */ /* r21au_init.c */ void r21au_init_tx_agg(struct rtwn_softc *); -void r21au_init_burstlen(struct rtwn_softc *); /* r21au_dfs.c */ void r21au_chan_check(void *, int); Modified: head/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c == --- head/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c Tue Jun 19 00:27:30 2018(r335350) +++ head/sys/dev/rtwn/
svn commit: r327369 - head/sys/net80211
Author: avos Date: Sat Dec 30 00:24:53 2017 New Revision: 327369 URL: https://svnweb.freebsd.org/changeset/base/327369 Log: net80211: handle VHT nodes in ieee80211_node_setuptxparms() Select proper mode when node can do VHT. Currently there are no drivers with VHT support in the tree, so this should be noop. Reviewed by: adrian Differential Revision:https://reviews.freebsd.org/D9806 Modified: head/sys/net80211/ieee80211_node.c Modified: head/sys/net80211/ieee80211_node.c == --- head/sys/net80211/ieee80211_node.c Sat Dec 30 00:22:47 2017 (r327368) +++ head/sys/net80211/ieee80211_node.c Sat Dec 30 00:24:53 2017 (r327369) @@ -243,7 +243,12 @@ ieee80211_node_setuptxparms(struct ieee80211_node *ni) struct ieee80211vap *vap = ni->ni_vap; enum ieee80211_phymode mode; - if (ni->ni_flags & IEEE80211_NODE_HT) { + if (ni->ni_flags & IEEE80211_NODE_VHT) { + if (IEEE80211_IS_CHAN_5GHZ(ni->ni_chan)) + mode = IEEE80211_MODE_VHT_5GHZ; + else + mode = IEEE80211_MODE_VHT_2GHZ; + } else if (ni->ni_flags & IEEE80211_NODE_HT) { if (IEEE80211_IS_CHAN_5GHZ(ni->ni_chan)) mode = IEEE80211_MODE_11NA; else ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r327371 - head/sys/net80211
Author: avos Date: Sat Dec 30 00:40:34 2017 New Revision: 327371 URL: https://svnweb.freebsd.org/changeset/base/327371 Log: net80211: sanitize input for ieee80211_output() - Add some basic checks for i_fc* bits (ToDS, FromDS, MoreFrag, Protected); those are used / checked across various places in Tx path. - Mark injected 802.11 frame as encapsulated (just as it should be). - Classify 802.11 frame in a proper way (extract ether_type from LLC header for Data frames, use AC_BE queue for others (NoData / Management / Control). - Subtract header length from tx_bytes statistics (so it will correspond to the comment). Was checked with RTL8188EU (AP) + Intel 6205 (STA). Reviewed by: adrian Differential Revision:https://reviews.freebsd.org/D13161 Modified: head/sys/net80211/ieee80211_output.c Modified: head/sys/net80211/ieee80211_output.c == --- head/sys/net80211/ieee80211_output.cSat Dec 30 00:26:42 2017 (r327370) +++ head/sys/net80211/ieee80211_output.cSat Dec 30 00:40:34 2017 (r327371) @@ -551,6 +551,59 @@ ieee80211_raw_output(struct ieee80211vap *vap, struct return (error); } +static int +ieee80211_validate_frame(struct mbuf *m, +const struct ieee80211_bpf_params *params) +{ + struct ieee80211_frame *wh; + int type; + + if (m->m_pkthdr.len < sizeof(struct ieee80211_frame_ack)) + return (EINVAL); + + wh = mtod(m, struct ieee80211_frame *); + if ((wh->i_fc[0] & IEEE80211_FC0_VERSION_MASK) != + IEEE80211_FC0_VERSION_0) + return (EINVAL); + + type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; + if (type != IEEE80211_FC0_TYPE_DATA) { + if ((wh->i_fc[1] & IEEE80211_FC1_DIR_MASK) != + IEEE80211_FC1_DIR_NODS) + return (EINVAL); + + if (type != IEEE80211_FC0_TYPE_MGT && + (wh->i_fc[1] & IEEE80211_FC1_MORE_FRAG) != 0) + return (EINVAL); + + /* XXX skip other field checks? */ + } + + if ((params && (params->ibp_flags & IEEE80211_BPF_CRYPTO) != 0) || + (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) != 0) { + int subtype; + + subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK; + + /* +* See IEEE Std 802.11-2012, +* 8.2.4.1.9 'Protected Frame field' +*/ + /* XXX no support for robust management frames yet. */ + if (!(type == IEEE80211_FC0_TYPE_DATA || + (type == IEEE80211_FC0_TYPE_MGT && +subtype == IEEE80211_FC0_SUBTYPE_AUTH))) + return (EINVAL); + + wh->i_fc[1] |= IEEE80211_FC1_PROTECTED; + } + + if (m->m_pkthdr.len < ieee80211_anyhdrsize(wh)) + return (EINVAL); + + return (0); +} + /* * 802.11 output routine. This is (currently) used only to * connect bpf write calls to the 802.11 layer for injecting @@ -561,6 +614,7 @@ ieee80211_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, struct route *ro) { #define senderr(e) do { error = (e); goto bad;} while (0) + const struct ieee80211_bpf_params *params = NULL; struct ieee80211_node *ni = NULL; struct ieee80211vap *vap; struct ieee80211_frame *wh; @@ -606,14 +660,20 @@ ieee80211_output(struct ifnet *ifp, struct mbuf *m, senderr(EIO); /* XXX bypass bridge, pfil, carp, etc. */ - if (m->m_pkthdr.len < sizeof(struct ieee80211_frame_ack)) - senderr(EIO); /* XXX */ + /* +* NB: DLT_IEEE802_11_RADIO identifies the parameters are +* present by setting the sa_len field of the sockaddr (yes, +* this is a hack). +* NB: we assume sa_data is suitably aligned to cast. +*/ + if (dst->sa_len != 0) + params = (const struct ieee80211_bpf_params *)dst->sa_data; + + error = ieee80211_validate_frame(m, params); + if (error != 0) + senderr(error); + wh = mtod(m, struct ieee80211_frame *); - if ((wh->i_fc[0] & IEEE80211_FC0_VERSION_MASK) != - IEEE80211_FC0_VERSION_0) - senderr(EIO); /* XXX */ - if (m->m_pkthdr.len < ieee80211_anyhdrsize(wh)) - senderr(EIO); /* XXX */ /* locate destination node */ switch (wh->i_fc[1] & IEEE80211_FC1_DIR_MASK) { @@ -626,7 +686,7 @@ ieee80211_output(struct ifnet *ifp, struct mbuf *m, ni = ieee80211_find_txnode(vap, wh->i_addr3); break; default: - senderr(EIO); /* XXX */ + senderr(EDOOFUS); } if (ni == NULL) { /* @@ -645,32 +705,28 @@ ieee80211_output(struct ifnet *ifp, struct mbuf *m, *
Re: svn commit: r324673 - head/sys/kern
Sat, 31 Mar 2018 12:19:18 +0300 було написано Harry Schmalzbauer : Bezüglich Andriy Voskoboinyk's Nachricht vom 17.10.2017 00:50 (localtime): Tue, 17 Oct 2017 00:53:28 +0300 було написано Bryan Drewery : On 10/16/2017 2:46 PM, Andriy Voskoboinyk wrote: Author: avos Date: Mon Oct 16 21:46:11 2017 New Revision: 324673 URL: https://svnweb.freebsd.org/changeset/base/324673 Log: mbuf(9): unbreak m_fragment() How was it broken Due to m_cat() usage reason (as described below); this part was not changed since function creation in r119644. and since when? No idea here - probably, it was partially working until m_cat() improvement in r242256. P.S. Just checked with m_fragment(m, M_NOWAIT, -2) placed right before ieee80211_mbuf_defrag() (from D4077) and various m_len printf's before and after - it defragments frames before this change and works as intended after it. - Fix it by replacing m_cat() with m_prev->m_next = m_new (m_cat() will try to append data - as a result, there will be no fragmentation). - Move some constants out of the loop. Was previously tested with D4077. Differential Revision:https://reviews.freebsd.org/D4090 Will r324673 be MFCd before 11.2? Thanks, -harry Done in r331847. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r319087 - head/sys/dev/rtwn/rtl8192e/usb
Author: avos Date: Sun May 28 22:38:19 2017 New Revision: 319087 URL: https://svnweb.freebsd.org/changeset/base/319087 Log: rtwn_usb: fix build with 'options RTWN_WITHOUT_UCODE' Modified: head/sys/dev/rtwn/rtl8192e/usb/r92eu_attach.c Modified: head/sys/dev/rtwn/rtl8192e/usb/r92eu_attach.c == --- head/sys/dev/rtwn/rtl8192e/usb/r92eu_attach.c Sun May 28 21:42:47 2017(r319086) +++ head/sys/dev/rtwn/rtl8192e/usb/r92eu_attach.c Sun May 28 22:38:19 2017(r319087) @@ -141,11 +141,13 @@ r92eu_attach(struct rtwn_usb_softc *uc) sc->sc_vap_preattach= rtwn_nop_softc_vap; sc->sc_postattach = rtwn_nop_softc; sc->sc_detach_private = r92e_detach_private; - sc->sc_set_media_status = r92e_set_media_status; #ifndef RTWN_WITHOUT_UCODE + sc->sc_set_media_status = r92e_set_media_status; sc->sc_set_rsvd_page= r88e_set_rsvd_page; sc->sc_set_pwrmode = r92e_set_pwrmode; sc->sc_set_rssi = rtwn_nop_softc; /* XXX TODO? */ +#else + sc->sc_set_media_status = rtwn_nop_softc_int; #endif sc->sc_beacon_init = r12a_beacon_init; sc->sc_beacon_enable= r92c_beacon_enable; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r319088 - head/sys/dev/rtwn
Author: avos Date: Sun May 28 22:51:06 2017 New Revision: 319088 URL: https://svnweb.freebsd.org/changeset/base/319088 Log: rtwn: fix connection problems with 'options RTWN_WITHOUT_UCODE' sc_set_media_status() callback may involve some generic code in addition to firmware-specific part (e.g., link status register setup for RTL8188E); so, remove 'RTWN_WITHOUT_UCODE' ifdefs around it. Tested with RTL8188CUS, RTL8188EU and RTL8821AU, STA mode. Modified: head/sys/dev/rtwn/if_rtwn.c Modified: head/sys/dev/rtwn/if_rtwn.c == --- head/sys/dev/rtwn/if_rtwn.c Sun May 28 22:38:19 2017(r319087) +++ head/sys/dev/rtwn/if_rtwn.c Sun May 28 22:51:06 2017(r319088) @@ -91,9 +91,9 @@ static struct ieee80211vap *rtwn_vap_cre static voidrtwn_vap_delete(struct ieee80211vap *); static int rtwn_read_chipid(struct rtwn_softc *); static int rtwn_ioctl_reset(struct ieee80211vap *, u_long); -#ifndef RTWN_WITHOUT_UCODE static voidrtwn_set_media_status(struct rtwn_softc *, union sec_param *); +#ifndef RTWN_WITHOUT_UCODE static int rtwn_tx_fwpkt_check(struct rtwn_softc *, struct ieee80211vap *); static int rtwn_construct_nulldata(struct rtwn_softc *, @@ -703,13 +703,13 @@ rtwn_ioctl_reset(struct ieee80211vap *va return (error); } -#ifndef RTWN_WITHOUT_UCODE static void rtwn_set_media_status(struct rtwn_softc *sc, union sec_param *data) { sc->sc_set_media_status(sc, data->macid); } +#ifndef RTWN_WITHOUT_UCODE static int rtwn_tx_fwpkt_check(struct rtwn_softc *sc, struct ieee80211vap *vap) { @@ -1743,11 +1743,9 @@ rtwn_newassoc(struct ieee80211_node *ni, return; } -#ifndef RTWN_WITHOUT_UCODE /* Notify firmware. */ id |= RTWN_MACID_VALID; rtwn_cmd_sleepable(sc, &id, sizeof(id), rtwn_set_media_status); -#endif } static void @@ -1759,10 +1757,8 @@ rtwn_node_free(struct ieee80211_node *ni RTWN_NT_LOCK(sc); if (un->id != RTWN_MACID_UNDEFINED) { sc->node_list[un->id] = NULL; -#ifndef RTWN_WITHOUT_UCODE rtwn_cmd_sleepable(sc, &un->id, sizeof(un->id), rtwn_set_media_status); -#endif } RTWN_NT_UNLOCK(sc); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r319460 - head/sys/net80211
Author: avos Date: Thu Jun 1 20:46:43 2017 New Revision: 319460 URL: https://svnweb.freebsd.org/changeset/base/319460 Log: net80211: initialize i_seq for A-MPDU frames. Fragment number field (part of i_seq) is used for AAD calculation; as a result, without this patch every driver without h/w crypto support need to clear it before ieee80211_crypto_encap(). Also fixes rtwn(4) A-MPDU Tx with dev.rtwn.%d.hwcrypto tunable set to 0 (h/w crypto is disabled). Tested with: * Intel 6205, STA mode. * RTL8188EU, STA mode. Differential Revision:https://reviews.freebsd.org/D10753 Modified: head/sys/net80211/ieee80211_output.c Modified: head/sys/net80211/ieee80211_output.c == --- head/sys/net80211/ieee80211_output.cThu Jun 1 20:29:48 2017 (r319459) +++ head/sys/net80211/ieee80211_output.cThu Jun 1 20:46:43 2017 (r319460) @@ -779,6 +779,9 @@ ieee80211_send_setup( tap = &ni->ni_tx_ampdu[tid]; if (tid != IEEE80211_NONQOS_TID && IEEE80211_AMPDU_RUNNING(tap)) { m->m_flags |= M_AMPDU_MPDU; + + /* NB: zero out i_seq field (for s/w encryption etc) */ + *(uint16_t *)&wh->i_seq[0] = 0; } else { if (IEEE80211_HAS_SEQ(type & IEEE80211_FC0_TYPE_MASK, type & IEEE80211_FC0_SUBTYPE_MASK)) @@ -1610,6 +1613,9 @@ ieee80211_encap(struct ieee80211vap *vap, struct ieee8 *(uint16_t *)wh->i_seq = htole16(seqno << IEEE80211_SEQ_SEQ_SHIFT); M_SEQNO_SET(m, seqno); + } else { + /* NB: zero out i_seq field (for s/w encryption etc) */ + *(uint16_t *)wh->i_seq = 0; } } else { /* ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r319476 - in head/sys/dev/rtwn: rtl8192c rtl8812a
Author: avos Date: Thu Jun 1 21:20:44 2017 New Revision: 319476 URL: https://svnweb.freebsd.org/changeset/base/319476 Log: rtwn: drop obsolete (since r319460) code. Tested with RTL8188EU, STA mode. Modified: head/sys/dev/rtwn/rtl8192c/r92c_tx.c head/sys/dev/rtwn/rtl8812a/r12a_tx.c Modified: head/sys/dev/rtwn/rtl8192c/r92c_tx.c == --- head/sys/dev/rtwn/rtl8192c/r92c_tx.cThu Jun 1 21:07:32 2017 (r319475) +++ head/sys/dev/rtwn/rtl8192c/r92c_tx.cThu Jun 1 21:20:44 2017 (r319476) @@ -331,8 +331,6 @@ r92c_fill_tx_desc(struct rtwn_softc *sc, struct ieee80 if (m->m_flags & M_AMPDU_MPDU) { seqno = ni->ni_txseqs[tid]; - /* NB: clear Fragment Number field. */ - *(uint16_t *)wh->i_seq = 0; ni->ni_txseqs[tid]++; } else seqno = M_SEQNO_GET(m) % IEEE80211_SEQ_RANGE; Modified: head/sys/dev/rtwn/rtl8812a/r12a_tx.c == --- head/sys/dev/rtwn/rtl8812a/r12a_tx.cThu Jun 1 21:07:32 2017 (r319475) +++ head/sys/dev/rtwn/rtl8812a/r12a_tx.cThu Jun 1 21:20:44 2017 (r319476) @@ -338,8 +338,6 @@ r12a_fill_tx_desc(struct rtwn_softc *sc, struct ieee80 if (m->m_flags & M_AMPDU_MPDU) { seqno = ni->ni_txseqs[tid]; - /* NB: clear Fragment Number field. */ - *(uint16_t *)wh->i_seq = 0; ni->ni_txseqs[tid]++; } else seqno = M_SEQNO_GET(m) % IEEE80211_SEQ_RANGE; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r319733 - in head: . share/man/man4 sys/modules/rtwn
Author: avos Date: Fri Jun 9 07:08:58 2017 New Revision: 319733 URL: https://svnweb.freebsd.org/changeset/base/319733 Log: rtwn: rename module (if_rtwn.ko -> rtwn.ko) to match module name + drop manpage link. Reported by: mav, hselasky Modified: head/ObsoleteFiles.inc head/share/man/man4/Makefile head/sys/modules/rtwn/Makefile Modified: head/ObsoleteFiles.inc == --- head/ObsoleteFiles.inc Fri Jun 9 03:34:38 2017(r319732) +++ head/ObsoleteFiles.inc Fri Jun 9 07:08:58 2017(r319733) @@ -38,6 +38,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20170609: drop obsolete manpage link (if_rtwn.ko -> rtwn.ko) +OLD_FILES+=usr/share/man/man4/if_rtwn.4.gz # 20170531: removal of groff OLD_FILES+=usr/bin/addftinfo OLD_FILES+=usr/bin/afmtodit Modified: head/share/man/man4/Makefile == --- head/share/man/man4/MakefileFri Jun 9 03:34:38 2017 (r319732) +++ head/share/man/man4/MakefileFri Jun 9 07:08:58 2017 (r319733) @@ -700,7 +700,6 @@ MLINKS+=pms.4 pmspcv.4 MLINKS+=ral.4 if_ral.4 MLINKS+=re.4 if_re.4 MLINKS+=rl.4 if_rl.4 -MLINKS+=rtwn.4 if_rtwn.4 MLINKS+=rtwn_pci.4 if_rtwn_pci.4 MLINKS+=rue.4 if_rue.4 MLINKS+=scsi.4 CAM.4 \ Modified: head/sys/modules/rtwn/Makefile == --- head/sys/modules/rtwn/Makefile Fri Jun 9 03:34:38 2017 (r319732) +++ head/sys/modules/rtwn/Makefile Fri Jun 9 07:08:58 2017 (r319733) @@ -5,7 +5,7 @@ SYSDIR?=${SRCTOP}/sys .include "${SYSDIR}/conf/kern.opts.mk" -KMOD = if_rtwn +KMOD = rtwn SRCS = if_rtwn.c if_rtwn_tx.c if_rtwn_rx.c if_rtwn_beacon.c \ if_rtwn_calib.c if_rtwn_cam.c if_rtwn_task.c if_rtwn_efuse.c \ if_rtwn_fw.c if_rtwn_nop.h if_rtwnreg.h if_rtwnvar.h if_rtwn_tx.h \ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r320640 - in head/sys/dev/rtwn: . usb
Author: avos Date: Tue Jul 4 07:07:08 2017 New Revision: 320640 URL: https://svnweb.freebsd.org/changeset/base/320640 Log: rtwn_usb: reject too long (>16K) mbufs. While here move RTWN_TXBUFSZ constant from common to USB specific code (it's not used anywhere else). Modified: head/sys/dev/rtwn/if_rtwnvar.h head/sys/dev/rtwn/usb/rtwn_usb_attach.c head/sys/dev/rtwn/usb/rtwn_usb_ep.c head/sys/dev/rtwn/usb/rtwn_usb_tx.c head/sys/dev/rtwn/usb/rtwn_usb_var.h Modified: head/sys/dev/rtwn/if_rtwnvar.h == --- head/sys/dev/rtwn/if_rtwnvar.h Tue Jul 4 05:37:58 2017 (r320639) +++ head/sys/dev/rtwn/if_rtwnvar.h Tue Jul 4 07:07:08 2017 (r320640) @@ -25,8 +25,6 @@ #define RTWN_TX_DESC_SIZE 64 -#define RTWN_TXBUFSZ (16 * 1024) - #define RTWN_BCN_MAX_SIZE 512 #define RTWN_CAM_ENTRY_LIMIT 64 Modified: head/sys/dev/rtwn/usb/rtwn_usb_attach.c == --- head/sys/dev/rtwn/usb/rtwn_usb_attach.c Tue Jul 4 05:37:58 2017 (r320639) +++ head/sys/dev/rtwn/usb/rtwn_usb_attach.c Tue Jul 4 07:07:08 2017 (r320640) @@ -155,7 +155,7 @@ rtwn_usb_alloc_tx_list(struct rtwn_softc *sc) int error, i; error = rtwn_usb_alloc_list(sc, uc->uc_tx, RTWN_USB_TX_LIST_COUNT, - RTWN_TXBUFSZ); + RTWN_USB_TXBUFSZ); if (error != 0) return (error); Modified: head/sys/dev/rtwn/usb/rtwn_usb_ep.c == --- head/sys/dev/rtwn/usb/rtwn_usb_ep.c Tue Jul 4 05:37:58 2017 (r320639) +++ head/sys/dev/rtwn/usb/rtwn_usb_ep.c Tue Jul 4 07:07:08 2017 (r320640) @@ -73,7 +73,7 @@ static const struct usb_config rtwn_config_common[RTWN .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, - .bufsize = RTWN_TXBUFSZ, + .bufsize = RTWN_USB_TXBUFSZ, .flags = { .ext_buffer = 1, .pipe_bof = 1, @@ -86,7 +86,7 @@ static const struct usb_config rtwn_config_common[RTWN .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, - .bufsize = RTWN_TXBUFSZ, + .bufsize = RTWN_USB_TXBUFSZ, .flags = { .ext_buffer = 1, .pipe_bof = 1, @@ -99,7 +99,7 @@ static const struct usb_config rtwn_config_common[RTWN .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, - .bufsize = RTWN_TXBUFSZ, + .bufsize = RTWN_USB_TXBUFSZ, .flags = { .ext_buffer = 1, .pipe_bof = 1, @@ -112,7 +112,7 @@ static const struct usb_config rtwn_config_common[RTWN .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, - .bufsize = RTWN_TXBUFSZ, + .bufsize = RTWN_USB_TXBUFSZ, .flags = { .ext_buffer = 1, .pipe_bof = 1, Modified: head/sys/dev/rtwn/usb/rtwn_usb_tx.c == --- head/sys/dev/rtwn/usb/rtwn_usb_tx.c Tue Jul 4 05:37:58 2017 (r320639) +++ head/sys/dev/rtwn/usb/rtwn_usb_tx.c Tue Jul 4 07:07:08 2017 (r320640) @@ -233,6 +233,9 @@ rtwn_usb_tx_start(struct rtwn_softc *sc, struct ieee80 RTWN_ASSERT_LOCKED(sc); + if (m->m_pkthdr.len + sc->txdesc_len > RTWN_USB_TXBUFSZ) + return (EINVAL); + data = rtwn_usb_getbuf(uc); if (data == NULL) return (ENOBUFS); Modified: head/sys/dev/rtwn/usb/rtwn_usb_var.h == --- head/sys/dev/rtwn/usb/rtwn_usb_var.hTue Jul 4 05:37:58 2017 (r320639) +++ head/sys/dev/rtwn/usb/rtwn_usb_var.hTue Jul 4 07:07:08 2017 (r320640) @@ -21,6 +21,8 @@ #ifndef RTWN_USBVAR_H #define RTWN_USBVAR_H +#define RTWN_USB_TXBUFSZ (16 * 1024) + #define RTWN_IFACE_INDEX 0 #define RTWN_USB_RX_LIST_COUNT 1 ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r320725 - in head/sys/dev/rtwn: . pci usb
Author: avos Date: Thu Jul 6 07:37:33 2017 New Revision: 320725 URL: https://svnweb.freebsd.org/changeset/base/320725 Log: rtwn: add Rx descriptor structures for common code. Remove any chipset specific usage of Rx descriptor structure / bits from common code to prevent misuse of fields that may differ between various chipsets. Checked with: RTL8821AU in STA mode. Modified: head/sys/dev/rtwn/if_rtwn_rx.c head/sys/dev/rtwn/if_rtwnreg.h head/sys/dev/rtwn/pci/rtwn_pci_attach.c head/sys/dev/rtwn/pci/rtwn_pci_rx.c head/sys/dev/rtwn/pci/rtwn_pci_rx.h head/sys/dev/rtwn/pci/rtwn_pci_var.h head/sys/dev/rtwn/usb/rtwn_usb_rx.c Modified: head/sys/dev/rtwn/if_rtwn_rx.c == --- head/sys/dev/rtwn/if_rtwn_rx.c Thu Jul 6 07:37:03 2017 (r320724) +++ head/sys/dev/rtwn/if_rtwn_rx.c Thu Jul 6 07:37:33 2017 (r320725) @@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include void @@ -190,7 +189,8 @@ rtwn_get_tsf(struct rtwn_softc *sc, uint64_t *buf, int } static uint64_t -rtwn_extend_rx_tsf(struct rtwn_softc *sc, const struct r92c_rx_stat *stat) +rtwn_extend_rx_tsf(struct rtwn_softc *sc, +const struct rtwn_rx_stat_common *stat) { uint64_t tsft; uint32_t rxdw3, tsfl, tsfl_curr; @@ -198,7 +198,7 @@ rtwn_extend_rx_tsf(struct rtwn_softc *sc, const struct rxdw3 = le32toh(stat->rxdw3); tsfl = le32toh(stat->tsf_low); - id = MS(rxdw3, R92C_RXDW3_BSSID_FIT); + id = MS(rxdw3, RTWN_RXDW3_BSSID01_FIT); switch (id) { case 1: @@ -241,7 +241,7 @@ rtwn_rx_common(struct rtwn_softc *sc, struct mbuf *m, struct ieee80211_frame_min *wh; struct ieee80211_rx_stats rxs; struct rtwn_node *un; - struct r92c_rx_stat *stat; + struct rtwn_rx_stat_common *stat; void *physt; uint32_t rxdw0; int8_t rssi; @@ -250,10 +250,10 @@ rtwn_rx_common(struct rtwn_softc *sc, struct mbuf *m, stat = desc; rxdw0 = le32toh(stat->rxdw0); - cipher = MS(rxdw0, R92C_RXDW0_CIPHER); - infosz = MS(rxdw0, R92C_RXDW0_INFOSZ) * 8; - pktlen = MS(rxdw0, R92C_RXDW0_PKTLEN); - shift = MS(rxdw0, R92C_RXDW0_SHIFT); + cipher = MS(rxdw0, RTWN_RXDW0_CIPHER); + infosz = MS(rxdw0, RTWN_RXDW0_INFOSZ) * 8; + pktlen = MS(rxdw0, RTWN_RXDW0_PKTLEN); + shift = MS(rxdw0, RTWN_RXDW0_SHIFT); wh = (struct ieee80211_frame_min *)(mtodo(m, shift + infosz)); if ((wh->i_fc[1] & IEEE80211_FC1_PROTECTED) && @@ -268,7 +268,7 @@ rtwn_rx_common(struct rtwn_softc *sc, struct mbuf *m, ni = NULL; un = RTWN_NODE(ni); - if (infosz != 0 && (rxdw0 & R92C_RXDW0_PHYST)) + if (infosz != 0 && (rxdw0 & RTWN_RXDW0_PHYST)) physt = (void *)mtodo(m, shift); else physt = (un != NULL) ? &un->last_physt : &sc->last_physt; @@ -284,7 +284,7 @@ rtwn_rx_common(struct rtwn_softc *sc, struct mbuf *m, /* Add some common bits. */ /* NB: should not happen. */ - if (rxdw0 & R92C_RXDW0_CRCERR) + if (rxdw0 & RTWN_RXDW0_CRCERR) rxs.c_pktflags |= IEEE80211_RX_F_FAIL_FCSCRC; rxs.r_flags |= IEEE80211_R_TSF_START; /* XXX undocumented */ @@ -298,7 +298,7 @@ rtwn_rx_common(struct rtwn_softc *sc, struct mbuf *m, /* XXX TODO: we really need a rate-to-string method */ RTWN_DPRINTF(sc, RTWN_DEBUG_RSSI, "%s: rssi %d, rate %d\n", __func__, rssi, rxs.c_rate); - if (un != NULL && infosz != 0 && (rxdw0 & R92C_RXDW0_PHYST)) { + if (un != NULL && infosz != 0 && (rxdw0 & RTWN_RXDW0_PHYST)) { /* Update our average RSSI. */ rtwn_update_avgrssi(sc, un, rssi, is_cck); } Modified: head/sys/dev/rtwn/if_rtwnreg.h == --- head/sys/dev/rtwn/if_rtwnreg.h Thu Jul 6 07:37:03 2017 (r320724) +++ head/sys/dev/rtwn/if_rtwnreg.h Thu Jul 6 07:37:33 2017 (r320725) @@ -48,6 +48,55 @@ struct rtwn_tx_desc_common { } txdw7; } __packed __attribute__((aligned(4))); +/* Common part of Rx descriptor. */ +struct rtwn_rx_stat_common { + uint32_trxdw0; +#define RTWN_RXDW0_PKTLEN_M0x3fff +#define RTWN_RXDW0_PKTLEN_S0 +#define RTWN_RXDW0_CRCERR 0x4000 +#define RTWN_RXDW0_ICVERR 0x8000 +#define RTWN_RXDW0_INFOSZ_M0x000f +#define RTWN_RXDW0_INFOSZ_S16 +#define RTWN_RXDW0_CIPHER_M0x0070 +#define RTWN_RXDW0_CIPHER_S20 +#define RTWN_RXDW0_QOS 0x0080 +#define RTWN_RXDW0_SHIFT_M 0x0300 +#define RTWN_RXDW0_SHIFT_S 24 +#define RTWN_RXDW0_PHYST 0x0400 +#define RTWN_RXDW0_SWDEC 0x0800 +#define RTWN_RXDW0_LS 0x1000 +#define RTWN_RXDW0_FS 0x2000 +#define RTWN_RXDW0_E
svn commit: r307529 - in head: . etc etc/devd share/doc/legal/realtek share/man/man4 sys/conf sys/contrib/dev/rtwn sys/contrib/dev/urtwn sys/dev/rtwn sys/dev/rtwn/pci sys/dev/rtwn/rtl8188e sys/dev/...
ot;0x0074"; + action "kldload -n if_rtwn_usb"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x0df6"; match "product" "0x061c"; action "kldload -n if_axe"; }; @@ -3257,8 +3305,8 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x0e66"; - match "product" "0x0019"; - action "kldload -n if_urtwn"; + match "product" "(0x0019|0x0023)"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -3330,7 +3378,7 @@ nomatch 32 { match "mode" "host"; match "vendor" "0x0eb0"; match "product" "0x9071"; - action "kldload -n if_urtwn"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -3490,7 +3538,7 @@ nomatch 32 { match "mode" "host"; match "vendor" "0x103c"; match "product" "0x1629"; - action "kldload -n if_urtwn"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -3976,6 +4024,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x13b1"; + match "product" "0x003f"; + action "kldload -n if_rtwn_usb"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x13d2"; match "product" "0x0400"; action "kldload -n if_kue"; @@ -4018,7 +4074,7 @@ nomatch 32 { match "mode" "host"; match "vendor" "0x13d3"; match "product" "(0x3357|0x3358|0x3359)"; - action "kldload -n if_urtwn"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -4569,6 +4625,14 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x1740"; + match "product" "0x0100"; + action "kldload -n if_rtwn_usb"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x1740"; match "product" "(0x0605|0x0615)"; action "kldload -n if_run"; }; @@ -4961,8 +5025,8 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x2001"; - match "product" "(0x3307|0x3308|0x3309|0x330a|0x330d|0x330f|0x3310)"; - action "kldload -n if_urtwn"; + match "product" "(0x3307|0x3308|0x3309|0x330a|0x330d|0x330f|0x3310|0x3314|0x3315|0x3316|0x3318)"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -5042,7 +5106,7 @@ nomatch 32 { match "mode" "host"; match "vendor" "0x2019"; match "product" "(0x1201|0x4902)"; - action "kldload -n if_urtwn"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -5089,8 +5153,8 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x2019"; - match "product" "(0xab2a|0xab2b|0xab2e)"; - action "kldload -n if_urtwn"; + match "product" "(0xab2a|0xab2b|0xab2e|0xab30)"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -5130,7 +5194,7 @@ nomatch 32 { match "mode" "host"; match "vendor" "0x2019"; match "product" "0xed17"; - action "kldload -n if_urtwn"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -5170,7 +5234,7 @@ nomatch 32 { match "mode" "host"; match "vendor" "0x20f4"; match "product" "0x624d"; - action "kldload -n if_urtwn"; + action "kldload -n if_rtwn_usb"; }; nomatch 32 { @@ -5185,8 +5249,8 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" &
svn commit: r307532 - in head: . share/man/man4
Author: avos Date: Mon Oct 17 21:35:13 2016 New Revision: 307532 URL: https://svnweb.freebsd.org/changeset/base/307532 Log: Fix dates + add an UPDATING entry. Modified: head/ObsoleteFiles.inc head/UPDATING head/share/man/man4/rtwn.4 head/share/man/man4/rtwn_pci.4 head/share/man/man4/rtwn_usb.4 Modified: head/ObsoleteFiles.inc == --- head/ObsoleteFiles.inc Mon Oct 17 20:57:54 2016(r307531) +++ head/ObsoleteFiles.inc Mon Oct 17 21:35:13 2016(r307532) @@ -38,7 +38,7 @@ # xargs -n1 | sort | uniq -d; # done -# 20161016: urtwn(4) was merged into rtwn(4) +# 20161017: urtwn(4) was merged into rtwn(4) OLD_FILES+=usr/share/man/man4/urtwn.4.gz OLD_FILES+=usr/share/man/man4/urtwnfw.4.gz # 20161015: Remove GNU rcs Modified: head/UPDATING == --- head/UPDATING Mon Oct 17 20:57:54 2016(r307531) +++ head/UPDATING Mon Oct 17 21:35:13 2016(r307532) @@ -31,6 +31,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12 disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20161017: + The urtwn(4) driver was merged into rtwn(4) and now consists of + rtwn(4) main module + rtwn_usb(4) and rtwn_pci(4) bus-specific + parts. + Also, firmware for RTL8188CE was renamed due to possible name + conflict (rtwnrtl8192cU(B) -> rtwnrtl8192cE(B)) + 20161015: GNU rcs has been removed from base. It is available as packages: - rcs: Latest GPLv3 GNU rcs version. Modified: head/share/man/man4/rtwn.4 == --- head/share/man/man4/rtwn.4 Mon Oct 17 20:57:54 2016(r307531) +++ head/share/man/man4/rtwn.4 Mon Oct 17 21:35:13 2016(r307532) @@ -18,7 +18,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 19, 2016 +.Dd October 17, 2016 .Dt RTWN 4 .Os .Sh NAME Modified: head/share/man/man4/rtwn_pci.4 == --- head/share/man/man4/rtwn_pci.4 Mon Oct 17 20:57:54 2016 (r307531) +++ head/share/man/man4/rtwn_pci.4 Mon Oct 17 21:35:13 2016 (r307532) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\"/ -.Dd September 19, 2016 +.Dd October 17, 2016 .Dt RTWN_PCI 4 .Os .Sh NAME Modified: head/share/man/man4/rtwn_usb.4 == --- head/share/man/man4/rtwn_usb.4 Mon Oct 17 20:57:54 2016 (r307531) +++ head/share/man/man4/rtwn_usb.4 Mon Oct 17 21:35:13 2016 (r307532) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\"/ -.Dd September 19, 2016 +.Dd October 17, 2016 .Dt RTWN_USB 4 .Os .Sh NAME ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r307577 - head/sys/dev/rtwn/usb
Author: avos Date: Tue Oct 18 21:17:31 2016 New Revision: 307577 URL: https://svnweb.freebsd.org/changeset/base/307577 Log: rtwn(4): fix build with 'options IEEE80211_SUPPORT_SUPERG' Modified: head/sys/dev/rtwn/usb/rtwn_usb_rx.c head/sys/dev/rtwn/usb/rtwn_usb_tx.c Modified: head/sys/dev/rtwn/usb/rtwn_usb_rx.c == --- head/sys/dev/rtwn/usb/rtwn_usb_rx.c Tue Oct 18 20:17:57 2016 (r307576) +++ head/sys/dev/rtwn/usb/rtwn_usb_rx.c Tue Oct 18 21:17:31 2016 (r307577) @@ -216,7 +216,7 @@ rtwn_report_intr(struct rtwn_usb_softc * * NB: this will executed only when 'report' bit is set. */ if (sc->sc_tx_n_active > 0 && --sc->sc_tx_n_active <= 1) - rtwn_cmd_sleepable(uc, NULL, 0, rtwn_ff_flush_all); + rtwn_cmd_sleepable(sc, NULL, 0, rtwn_ff_flush_all); #endif break; case RTWN_RX_OTHER: @@ -327,7 +327,7 @@ finish: */ #ifdef IEEE80211_SUPPORT_SUPERG if (!(sc->sc_flags & RTWN_FW_LOADED)) - rtwn_cmd_sleepable(uc, NULL, 0, rtwn_ff_flush_all); + rtwn_cmd_sleepable(sc, NULL, 0, rtwn_ff_flush_all); #endif /* Kick-start more transmit in case we stalled */ Modified: head/sys/dev/rtwn/usb/rtwn_usb_tx.c == --- head/sys/dev/rtwn/usb/rtwn_usb_tx.c Tue Oct 18 20:17:57 2016 (r307576) +++ head/sys/dev/rtwn/usb/rtwn_usb_tx.c Tue Oct 18 21:17:31 2016 (r307577) @@ -207,7 +207,7 @@ finish: * XXX TODO: just make this a callout timer schedule so we can * flush the FF staging queue if we're approaching idle. */ - rtwn_cmd_sleepable(uc, NULL, 0, rtwn_ff_flush_all); + rtwn_cmd_sleepable(sc, NULL, 0, rtwn_ff_flush_all); } #endif /* Kick-start more transmit */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r308355 - head/sys/dev/rtwn
Author: avos Date: Sat Nov 5 22:47:09 2016 New Revision: 308355 URL: https://svnweb.freebsd.org/changeset/base/308355 Log: rtwn: pause beacon queue during scanning. Tested with RTL8821AU, AP + AP mode. Modified: head/sys/dev/rtwn/if_rtwn.c Modified: head/sys/dev/rtwn/if_rtwn.c == --- head/sys/dev/rtwn/if_rtwn.c Sat Nov 5 22:41:22 2016(r308354) +++ head/sys/dev/rtwn/if_rtwn.c Sat Nov 5 22:47:09 2016(r308355) @@ -1513,6 +1513,8 @@ rtwn_scan_start(struct ieee80211com *ic) struct rtwn_softc *sc = ic->ic_softc; RTWN_LOCK(sc); + /* Pause beaconing. */ + rtwn_setbits_1(sc, R92C_TXPAUSE, 0, R92C_TX_QUEUE_BCN); /* Receive beacons / probe responses from any BSSID. */ if (sc->bcn_vaps == 0) rtwn_set_rx_bssid_all(sc, 1); @@ -1547,6 +1549,9 @@ rtwn_scan_end(struct ieee80211com *ic) /* Restore basic rates mask. */ rtwn_calc_basicrates(sc); + + /* Resume beaconing. */ + rtwn_setbits_1(sc, R92C_TXPAUSE, R92C_TX_QUEUE_BCN, 0); RTWN_UNLOCK(sc); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r308356 - in head/sys/dev/rtwn: . rtl8812a
Author: avos Date: Sat Nov 5 23:21:30 2016 New Revision: 308356 URL: https://svnweb.freebsd.org/changeset/base/308356 Log: rtwn: fix Rx filter setup for some multi-vap configuratons. - Correctly refresh Rx filter when AP (IBSS) vap is created after STA vap. - Block any RCR updates during TSF correction (IBSS mode). - Set CBSSID* bits during vap creation, not when it was started / stopped. - Cache current state to prevent unnecessary register reads. Tested with RTL8188CE, STA + AP mode. Modified: head/sys/dev/rtwn/if_rtwn.c head/sys/dev/rtwn/if_rtwn_rx.c head/sys/dev/rtwn/if_rtwn_rx.h head/sys/dev/rtwn/if_rtwnvar.h head/sys/dev/rtwn/rtl8812a/r12a_caps.c Modified: head/sys/dev/rtwn/if_rtwn.c == --- head/sys/dev/rtwn/if_rtwn.c Sat Nov 5 22:47:09 2016(r308355) +++ head/sys/dev/rtwn/if_rtwn.c Sat Nov 5 23:21:30 2016(r308356) @@ -917,6 +917,9 @@ rtwn_tsf_sync_adhoc_task(void *arg, int /* Accept beacons with the same BSSID. */ rtwn_set_rx_bssid_all(sc, 0); + /* Deny RCR updates. */ + sc->sc_flags |= RTWN_RCR_LOCKED; + /* Enable synchronization. */ rtwn_setbits_1(sc, R92C_BCN_CTRL(uvp->id), R92C_BCN_CTRL_DIS_TSF_UDT0, 0); @@ -929,6 +932,7 @@ rtwn_tsf_sync_adhoc_task(void *arg, int 0, R92C_BCN_CTRL_DIS_TSF_UDT0); /* Accept all beacons. */ + sc->sc_flags &= ~RTWN_RCR_LOCKED; rtwn_set_rx_bssid_all(sc, 1); /* Schedule next TSF synchronization. */ @@ -1193,7 +1197,6 @@ rtwn_run(struct rtwn_softc *sc, struct i struct ieee80211com *ic = vap->iv_ic; struct rtwn_vap *uvp = RTWN_VAP(vap); struct ieee80211_node *ni; - uint32_t reg; uint8_t mode; int error; @@ -1246,18 +1249,6 @@ rtwn_run(struct rtwn_softc *sc, struct i rtwn_write_1(sc, R92C_TXPAUSE, 0); } - /* Allow Rx from our BSSID only. */ - if (ic->ic_promisc == 0) { - reg = rtwn_read_4(sc, R92C_RCR); - - if (sc->bcn_vaps == 0) - reg |= R92C_RCR_CBSSID_BCN; - if (sc->ap_vaps == 0) - reg |= R92C_RCR_CBSSID_DATA; - - rtwn_write_4(sc, R92C_RCR, reg); - } - #ifndef RTWN_WITHOUT_UCODE /* Upload (QoS) Null Data frame to firmware. */ /* Note: do this for port 0 only. */ Modified: head/sys/dev/rtwn/if_rtwn_rx.c == --- head/sys/dev/rtwn/if_rtwn_rx.c Sat Nov 5 22:47:09 2016 (r308355) +++ head/sys/dev/rtwn/if_rtwn_rx.c Sat Nov 5 23:21:30 2016 (r308356) @@ -362,7 +362,7 @@ rtwn_rxfilter_update_mgt(struct rtwn_sof { uint16_t filter; - filter = 0x7f3f; + filter = 0x7f7f; if (sc->bcn_vaps == 0) {/* STA and/or MONITOR mode vaps */ filter &= ~( R92C_RXFLTMAP_SUBTYPE(IEEE80211_FC0_SUBTYPE_ASSOC_REQ) | @@ -393,7 +393,6 @@ rtwn_rxfilter_update(struct rtwn_softc * void rtwn_rxfilter_init(struct rtwn_softc *sc) { - uint32_t rcr; RTWN_ASSERT_LOCKED(sc); @@ -406,47 +405,60 @@ rtwn_rxfilter_init(struct rtwn_softc *sc /* Reject all data frames. */ rtwn_write_2(sc, R92C_RXFLTMAP2, 0x); - rcr = sc->rcr; - rcr |= R92C_RCR_AM | R92C_RCR_AB | R92C_RCR_APM | - R92C_RCR_HTC_LOC_CTRL | R92C_RCR_APP_PHYSTS | - R92C_RCR_APP_ICV | R92C_RCR_APP_MIC; - - /* Set Rx filter. */ - rtwn_write_4(sc, R92C_RCR, rcr); + /* Append generic Rx filter bits. */ + sc->rcr |= R92C_RCR_AM | R92C_RCR_AB | R92C_RCR_APM | + R92C_RCR_HTC_LOC_CTRL | R92C_RCR_APP_PHYSTS | + R92C_RCR_APP_ICV | R92C_RCR_APP_MIC; /* Update dynamic Rx filter parts. */ rtwn_rxfilter_update(sc); } void +rtwn_rxfilter_set(struct rtwn_softc *sc) +{ + if (!(sc->sc_flags & RTWN_RCR_LOCKED)) + rtwn_write_4(sc, R92C_RCR, sc->rcr); +} + +void rtwn_set_rx_bssid_all(struct rtwn_softc *sc, int enable) { + if (enable) - rtwn_setbits_4(sc, R92C_RCR, R92C_RCR_CBSSID_BCN, 0); + sc->rcr &= ~R92C_RCR_CBSSID_BCN; else - rtwn_setbits_4(sc, R92C_RCR, 0, R92C_RCR_CBSSID_BCN); + sc->rcr |= R92C_RCR_CBSSID_BCN; + rtwn_rxfilter_set(sc); } void rtwn_set_promisc(struct rtwn_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; - uint32_t mask1, mask2; + uint32_t mask_all, mask_min; RTWN_ASSERT_LOCKED(sc); - mask1 = R92C_RCR_ACF | R92C_RCR_ADF | R92C_RCR_AMF | R92C_RCR_AAP; - mask2 = R92C_RCR_APM; + mask_all = R92C_RCR_ACF | R92C_RCR_ADF | R92C_RCR_AMF | R92C_RCR_AAP; + mask_min = R92C_RCR_APM; - if (sc->vaps_running != 0) { - if (sc->bcn_vaps == 0)
svn commit: r308377 - head/sys/dev/rtwn
Author: avos Date: Sun Nov 6 17:12:02 2016 New Revision: 308377 URL: https://svnweb.freebsd.org/changeset/base/308377 Log: rtwn: reset watchdog timer on device shutdown. Modified: head/sys/dev/rtwn/if_rtwn.c Modified: head/sys/dev/rtwn/if_rtwn.c == --- head/sys/dev/rtwn/if_rtwn.c Sun Nov 6 16:44:33 2016(r308376) +++ head/sys/dev/rtwn/if_rtwn.c Sun Nov 6 17:12:02 2016(r308377) @@ -1966,6 +1966,7 @@ rtwn_stop(struct rtwn_softc *sc) #ifndef D4054 callout_stop(&sc->sc_watchdog_to); + sc->sc_tx_timer = 0; #endif sc->sc_flags &= ~(RTWN_STARTED | RTWN_RUNNING | RTWN_FW_LOADED); sc->sc_flags &= ~RTWN_TEMP_MEASURED; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r308380 - head/sys/dev/rtwn/rtl8192c/pci
Author: avos Date: Sun Nov 6 17:24:16 2016 New Revision: 308380 URL: https://svnweb.freebsd.org/changeset/base/308380 Log: rtwn: reduce shutdown time for RTL8188CE. Modified: head/sys/dev/rtwn/rtl8192c/pci/r92ce_fw.c Modified: head/sys/dev/rtwn/rtl8192c/pci/r92ce_fw.c == --- head/sys/dev/rtwn/rtl8192c/pci/r92ce_fw.c Sun Nov 6 17:21:26 2016 (r308379) +++ head/sys/dev/rtwn/rtl8192c/pci/r92ce_fw.c Sun Nov 6 17:24:16 2016 (r308380) @@ -69,6 +69,7 @@ r92ce_fw_reset(struct rtwn_softc *sc, in * We must sleep for one second to let the firmware settle. * Accessing registers too early will hang the whole system. */ - rtwn_delay(sc, 1000 * 1000); + if (reason == RTWN_FW_RESET_DOWNLOAD) + rtwn_delay(sc, 1000 * 1000); } #endif ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r308381 - head/sys/dev/rtwn/pci
Author: avos Date: Sun Nov 6 18:11:19 2016 New Revision: 308381 URL: https://svnweb.freebsd.org/changeset/base/308381 Log: rtwn: fix Tx ring cleanup. Do not try to clear stale Tx descriptor entries when there are some running vaps; just free node references - rtwn_pci_tx_done() will free mbufs without creating holes in the Tx descriptor space. Also, reset only 2 first entries in the beacon ring - other will not be used anyway. Tested with RTL8188CE, STA + STA mode. Modified: head/sys/dev/rtwn/pci/rtwn_pci_attach.c Modified: head/sys/dev/rtwn/pci/rtwn_pci_attach.c == --- head/sys/dev/rtwn/pci/rtwn_pci_attach.c Sun Nov 6 17:24:16 2016 (r308380) +++ head/sys/dev/rtwn/pci/rtwn_pci_attach.c Sun Nov 6 18:11:19 2016 (r308381) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -75,6 +76,8 @@ static intrtwn_pci_alloc_rx_list(struct static voidrtwn_pci_reset_rx_list(struct rtwn_softc *); static voidrtwn_pci_free_rx_list(struct rtwn_softc *); static int rtwn_pci_alloc_tx_list(struct rtwn_softc *, int); +static voidrtwn_pci_reset_tx_ring_stopped(struct rtwn_softc *, int); +static voidrtwn_pci_reset_beacon_ring(struct rtwn_softc *, int); static voidrtwn_pci_reset_tx_list(struct rtwn_softc *, struct ieee80211vap *, int); static voidrtwn_pci_free_tx_list(struct rtwn_softc *, int); @@ -312,48 +315,109 @@ fail: } static void -rtwn_pci_reset_tx_list(struct rtwn_softc *sc, struct ieee80211vap *vap, -int qid) +rtwn_pci_reset_tx_ring_stopped(struct rtwn_softc *sc, int qid) { - struct rtwn_vap *uvp = RTWN_VAP(vap); struct rtwn_pci_softc *pc = RTWN_PCI_SOFTC(sc); - struct rtwn_tx_ring *tx_ring = &pc->tx_ring[qid]; - int i, id; - - id = (uvp != NULL ? uvp->id : RTWN_VAP_ID_INVALID); + struct rtwn_tx_ring *ring = &pc->tx_ring[qid]; + int i; for (i = 0; i < RTWN_PCI_TX_LIST_COUNT; i++) { - struct rtwn_tx_data *tx_data = &tx_ring->tx_data[i]; + struct rtwn_tx_data *data = &ring->tx_data[i]; + void *desc = (uint8_t *)ring->desc + sc->txdesc_len * i; - if (vap == NULL || (tx_data->ni == NULL && - (tx_data->id == id || id == RTWN_VAP_ID_INVALID)) || - (tx_data->ni != NULL && tx_data->ni->ni_vap == vap)) { - void *tx_desc = - (uint8_t *)tx_ring->desc + sc->txdesc_len * i; - - rtwn_pci_copy_tx_desc(pc, tx_desc, NULL); - - if (tx_data->m != NULL) { - bus_dmamap_sync(tx_ring->data_dmat, - tx_data->map, BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(tx_ring->data_dmat, - tx_data->map); - m_freem(tx_data->m); - tx_data->m = NULL; - } - if (tx_data->ni != NULL) { - ieee80211_free_node(tx_data->ni); - tx_data->ni = NULL; - } + rtwn_pci_copy_tx_desc(pc, desc, NULL); + + if (data->m != NULL) { + bus_dmamap_sync(ring->data_dmat, data->map, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(ring->data_dmat, data->map); + m_freem(data->m); + data->m = NULL; + } + if (data->ni != NULL) { + ieee80211_free_node(data->ni); + data->ni = NULL; } } - bus_dmamap_sync(tx_ring->desc_dmat, tx_ring->desc_map, + bus_dmamap_sync(ring->desc_dmat, ring->desc_map, BUS_DMASYNC_POSTWRITE); sc->qfullmsk &= ~(1 << qid); - tx_ring->queued = 0; - tx_ring->last = tx_ring->cur = 0; + ring->queued = 0; + ring->last = ring->cur = 0; +} + +/* + * Clear entry 0 (or 1) in the beacon queue (other are not used). + */ +static void +rtwn_pci_reset_beacon_ring(struct rtwn_softc *sc, int id) +{ + struct rtwn_pci_softc *pc = RTWN_PCI_SOFTC(sc); + struct rtwn_tx_ring *ring = &pc->tx_ring[RTWN_PCI_BEACON_QUEUE]; + struct rtwn_tx_data *data = &ring->tx_data[id]; + struct rtwn_tx_desc_common *txd = (struct rtwn_tx_desc_common *) + ((uint8_t *)ring->desc + id * sc->txdesc_len); + + bus_dmamap_sync(ring->desc_dmat, ring->desc_map, BUS_DMASYNC_POSTREAD); + if (txd->flags0 & RTWN_FLAGS0_OWN) { + /* Clear OWN bit. */ + txd->flags0 &= ~RTWN_FLAGS0_OWN; + bus_dmamap_sync(ring->desc_dmat, ring->desc_map, + BUS_DMASYNC_PREWR
svn commit: r308384 - in head/sys/dev/rtwn: pci usb
Author: avos Date: Sun Nov 6 19:17:39 2016 New Revision: 308384 URL: https://svnweb.freebsd.org/changeset/base/308384 Log: rtwn_pci: omit tx_done() stage if device is not running. rtwn_usb: drain USB transfers during device shutdown; this fixes possible panic with 'options IEEE80211_SUPPORT_SUPERG' during device detach. Tested with RTL8188CE, STA mode. Modified: head/sys/dev/rtwn/pci/rtwn_pci_rx.c head/sys/dev/rtwn/usb/rtwn_usb_attach.c Modified: head/sys/dev/rtwn/pci/rtwn_pci_rx.c == --- head/sys/dev/rtwn/pci/rtwn_pci_rx.c Sun Nov 6 19:16:46 2016 (r308383) +++ head/sys/dev/rtwn/pci/rtwn_pci_rx.c Sun Nov 6 19:17:39 2016 (r308384) @@ -274,13 +274,14 @@ rtwn_pci_intr(void *arg) status = rtwn_classify_intr(sc, &tx_rings, 0); RTWN_DPRINTF(sc, RTWN_DEBUG_INTR, "%s: status %08X, tx_rings %08X\n", __func__, status, tx_rings); - if (status == 0 && tx_rings == 0) { - RTWN_UNLOCK(sc); - return; - } + if (status == 0 && tx_rings == 0) + goto unlock; - if (status & RTWN_PCI_INTR_RX) + if (status & RTWN_PCI_INTR_RX) { rtwn_pci_rx_done(sc); + if (!(sc->sc_flags & RTWN_RUNNING)) + goto unlock; + } if (tx_rings != 0) for (i = 0; i < RTWN_PCI_NTXQUEUES; i++) @@ -289,5 +290,6 @@ rtwn_pci_intr(void *arg) if (sc->sc_flags & RTWN_RUNNING) rtwn_pci_enable_intr(pc); +unlock: RTWN_UNLOCK(sc); } Modified: head/sys/dev/rtwn/usb/rtwn_usb_attach.c == --- head/sys/dev/rtwn/usb/rtwn_usb_attach.c Sun Nov 6 19:16:46 2016 (r308383) +++ head/sys/dev/rtwn/usb/rtwn_usb_attach.c Sun Nov 6 19:17:39 2016 (r308384) @@ -273,8 +273,10 @@ rtwn_usb_abort_xfers(struct rtwn_softc * RTWN_ASSERT_LOCKED(sc); /* abort any pending transfers */ + RTWN_UNLOCK(sc); for (i = 0; i < RTWN_N_TRANSFER; i++) - usbd_transfer_stop(uc->uc_xfer[i]); + usbd_transfer_drain(uc->uc_xfer[i]); + RTWN_LOCK(sc); } static int ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r308387 - head/etc
Author: avos Date: Sun Nov 6 19:51:01 2016 New Revision: 308387 URL: https://svnweb.freebsd.org/changeset/base/308387 Log: Fix device driver name if devd.conf + move it into appropriate place. Noticed by: Idwer Vollering Modified: head/etc/devd.conf Modified: head/etc/devd.conf == --- head/etc/devd.conf Sun Nov 6 19:37:22 2016(r308386) +++ head/etc/devd.conf Sun Nov 6 19:51:01 2016(r308387) @@ -23,8 +23,8 @@ options { esp|ida|iir|ips|isp|mlx|mly|mpt|ncr|ncv|nsp|stg|sym|trm)\ [0-9]+"; set wifi-driver-regex - "(ath|bwi|bwn|ipw|iwi|iwm|iwn|malo|mwl|ral|rsu|rum|run|uath|\ - upgt|ural|urtw|rtwn_usb|wi|wpi|wtap|zyd)[0-9]+"; + "(ath|bwi|bwn|ipw|iwi|iwm|iwn|malo|mwl|ral|rsu|rtwn|rum|run|\ + uath|upgt|ural|urtw|wi|wpi|wtap|zyd)[0-9]+"; }; # Note that the attach/detach with the highest value wins, so that one can ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r308389 - in head/sys/dev/rtwn: . pci rtl8192c rtl8192c/pci usb
Author: avos Date: Sun Nov 6 23:13:13 2016 New Revision: 308389 URL: https://svnweb.freebsd.org/changeset/base/308389 Log: rtwn: add HOSTAP / IBSS mode support for RTL8188CE. NOTE: some multi-vap configurations (e.g., STA+IBSS) are not stable; that will be fixed later. Tested with: - RTL8188CE, STA + AP mode; - RTL8188CE, IBSS mode; - RTL8188CUS, IBSS mode; - RTL8188EU, IBSS mode. Relnotes: yes Modified: head/sys/dev/rtwn/if_rtwn.c head/sys/dev/rtwn/if_rtwn_beacon.c head/sys/dev/rtwn/if_rtwnvar.h head/sys/dev/rtwn/pci/rtwn_pci_attach.c head/sys/dev/rtwn/pci/rtwn_pci_tx.c head/sys/dev/rtwn/pci/rtwn_pci_var.h head/sys/dev/rtwn/rtl8192c/pci/r92ce_attach.c head/sys/dev/rtwn/rtl8192c/r92c_beacon.c head/sys/dev/rtwn/usb/rtwn_usb_attach.c Modified: head/sys/dev/rtwn/if_rtwn.c == --- head/sys/dev/rtwn/if_rtwn.c Sun Nov 6 21:41:26 2016(r308388) +++ head/sys/dev/rtwn/if_rtwn.c Sun Nov 6 23:13:13 2016(r308389) @@ -628,10 +628,10 @@ rtwn_vap_delete(struct ieee80211vap *vap ieee80211_draintask(ic, &ic->ic_parent_task); RTWN_LOCK(sc); - if (uvp->bcn_mbuf != NULL) - m_freem(uvp->bcn_mbuf); /* Cancel any unfinished Tx. */ rtwn_reset_lists(sc, vap); + if (uvp->bcn_mbuf != NULL) + m_freem(uvp->bcn_mbuf); rtwn_vap_decrement_counters(sc, vap->iv_opmode, uvp->id); rtwn_set_ic_opmode(sc); if (sc->sc_flags & RTWN_RUNNING) @@ -822,8 +822,10 @@ rtwn_push_nulldata(struct rtwn_softc *sc rtwn_setbits_1_shift(sc, R92C_FWHW_TXQ_CTRL, R92C_FWHW_TXQ_CTRL_REAL_BEACON, 0, 2); - if (uvp->bcn_mbuf != NULL) + if (uvp->bcn_mbuf != NULL) { + rtwn_beacon_unload(sc, uvp->id); m_freem(uvp->bcn_mbuf); + } m->m_pkthdr.len = m->m_len = required_size - sc->txdesc_len; uvp->bcn_mbuf = m; @@ -1268,6 +1270,9 @@ rtwn_run(struct rtwn_softc *sc, struct i } #endif + /* Enable TSF synchronization. */ + rtwn_tsf_sync_enable(sc, vap); + if (vap->iv_opmode == IEEE80211_M_HOSTAP || vap->iv_opmode == IEEE80211_M_IBSS) { error = rtwn_setup_beacon(sc, ni); @@ -1282,9 +1287,6 @@ rtwn_run(struct rtwn_softc *sc, struct i /* Set ACK preamble type. */ rtwn_set_ack_preamble(sc); - /* Enable TSF synchronization. */ - rtwn_tsf_sync_enable(sc, vap); - /* Set basic rates mask. */ rtwn_calc_basicrates(sc); Modified: head/sys/dev/rtwn/if_rtwn_beacon.c == --- head/sys/dev/rtwn/if_rtwn_beacon.c Sun Nov 6 21:41:26 2016 (r308388) +++ head/sys/dev/rtwn/if_rtwn_beacon.c Sun Nov 6 23:13:13 2016 (r308389) @@ -54,6 +54,7 @@ rtwn_reset_beacon_valid(struct rtwn_soft KASSERT (id == 0 || id == 1, ("wrong port id %d\n", id)); + /* XXX cannot be cleared on RTL8188CE */ rtwn_setbits_1_shift(sc, sc->bcn_status_reg[id], R92C_TDECTRL_BCN_VALID, 0, 2); @@ -79,7 +80,7 @@ rtwn_check_beacon_valid(struct rtwn_soft __func__, id); break; } - rtwn_delay(sc, 100); + rtwn_delay(sc, sc->bcn_check_interval); } if (ntries == 10) return (ETIMEDOUT); @@ -123,8 +124,10 @@ rtwn_setup_beacon(struct rtwn_softc *sc, return (ENOMEM); } - if (uvp->bcn_mbuf != NULL) + if (uvp->bcn_mbuf != NULL) { + rtwn_beacon_unload(sc, uvp->id); m_freem(uvp->bcn_mbuf); + } uvp->bcn_mbuf = m; @@ -173,6 +176,7 @@ rtwn_update_beacon(struct ieee80211vap * return; } } + rtwn_beacon_update_begin(sc, vap); RTWN_UNLOCK(sc); if (item == IEEE80211_BEACON_TIM) @@ -183,6 +187,7 @@ rtwn_update_beacon(struct ieee80211vap * RTWN_LOCK(sc); rtwn_tx_beacon(sc, uvp); + rtwn_beacon_update_end(sc, vap); RTWN_UNLOCK(sc); } Modified: head/sys/dev/rtwn/if_rtwnvar.h == --- head/sys/dev/rtwn/if_rtwnvar.h Sun Nov 6 21:41:26 2016 (r308388) +++ head/sys/dev/rtwn/if_rtwnvar.h Sun Nov 6 23:13:13 2016 (r308389) @@ -277,6 +277,14 @@ struct rtwn_softc { uint16_t(*sc_get_qmap)(struct rtwn_softc *); void(*sc_set_desc_addr)(struct rtwn_softc *); void(*sc_drop_incorrect_tx)(struct rtwn_softc *); + void(*sc_beacon_update_begin)(struct rtwn_softc *, + struct ieee80211vap *); + void(*sc_beacon_update_end)(struct rtwn_softc *, + struct ieee80211v
svn commit: r308575 - in head: share/man/man4 sys/dev/rtwn sys/dev/rtwn/pci sys/dev/rtwn/rtl8192c/pci sys/dev/rtwn/usb
Author: avos Date: Sat Nov 12 17:58:37 2016 New Revision: 308575 URL: https://svnweb.freebsd.org/changeset/base/308575 Log: rtwn: enable 11n support for RTL8188CE. - Increase Rx buffer size from MCLBYTES to MJUMPAGESIZE. - Provide an additional defragmentation routine for frames larger than MCLBYTES; that is required by A-MSDU / Atheros Fast-Frames support to work with current Tx path implementation. Enabled features list for RTL8188CE: - Atheros Fast-Frames; - A-MPDU (Tx / Rx); - A-MSDU (Tx / Rx; 4k only); - Short Guard Interval. Tested with: - RTL8188CE (STA+AP) + RTL8821AU (STA). - RTL8188CE (STA) + RTL8188CUS (AP). Relnotes: yes Modified: head/share/man/man4/rtwn_pci.4 head/sys/dev/rtwn/if_rtwn_tx.h head/sys/dev/rtwn/pci/rtwn_pci_attach.c head/sys/dev/rtwn/pci/rtwn_pci_rx.c head/sys/dev/rtwn/pci/rtwn_pci_tx.c head/sys/dev/rtwn/rtl8192c/pci/r92ce_attach.c head/sys/dev/rtwn/usb/rtwn_usb_rx.c Modified: head/share/man/man4/rtwn_pci.4 == --- head/share/man/man4/rtwn_pci.4 Sat Nov 12 17:36:28 2016 (r308574) +++ head/share/man/man4/rtwn_pci.4 Sat Nov 12 17:58:37 2016 (r308575) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\"/ -.Dd October 17, 2016 +.Dd November 12, 2016 .Dt RTWN_PCI 4 .Os .Sh NAME @@ -58,6 +58,3 @@ It operates in the 2GHz spectrum only. .Xr rtwnfw 4 , .Xr rtwn_usb 4 , .Xr pci 4 -.Sh CAVEATS -Most 802.11 capabilities were turned off; some more testing -is required to re-enable them. Modified: head/sys/dev/rtwn/if_rtwn_tx.h == --- head/sys/dev/rtwn/if_rtwn_tx.h Sat Nov 12 17:36:28 2016 (r308574) +++ head/sys/dev/rtwn/if_rtwn_tx.h Sat Nov 12 17:58:37 2016 (r308575) @@ -20,7 +20,9 @@ #define IF_RTWN_TX_H void rtwn_drain_mbufq(struct rtwn_softc *); +#ifdef IEEE80211_SUPPORT_SUPERG void rtwn_ff_flush_all(struct rtwn_softc *, union sec_param *); +#endif intrtwn_transmit(struct ieee80211com *, struct mbuf *); void rtwn_start(struct rtwn_softc *); intrtwn_raw_xmit(struct ieee80211_node *, struct mbuf *, Modified: head/sys/dev/rtwn/pci/rtwn_pci_attach.c == --- head/sys/dev/rtwn/pci/rtwn_pci_attach.c Sat Nov 12 17:36:28 2016 (r308574) +++ head/sys/dev/rtwn/pci/rtwn_pci_attach.c Sat Nov 12 17:58:37 2016 (r308575) @@ -149,8 +149,8 @@ rtwn_pci_alloc_rx_list(struct rtwn_softc /* Create RX buffer DMA tag. */ error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), 1, 0, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, - 1, MCLBYTES, 0, NULL, NULL, &rx_ring->data_dmat); + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + MJUMPAGESIZE, 1, MJUMPAGESIZE, 0, NULL, NULL, &rx_ring->data_dmat); if (error != 0) { device_printf(sc->sc_dev, "could not create rx buf DMA tag\n"); goto fail; @@ -166,7 +166,8 @@ rtwn_pci_alloc_rx_list(struct rtwn_softc goto fail; } - rx_data->m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); + rx_data->m = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, + MJUMPAGESIZE); if (rx_data->m == NULL) { device_printf(sc->sc_dev, "could not allocate rx mbuf\n"); @@ -175,8 +176,8 @@ rtwn_pci_alloc_rx_list(struct rtwn_softc } error = bus_dmamap_load(rx_ring->data_dmat, rx_data->map, - mtod(rx_data->m, void *), MCLBYTES, rtwn_pci_dma_map_addr, - &rx_data->paddr, BUS_DMA_NOWAIT); + mtod(rx_data->m, void *), MJUMPAGESIZE, + rtwn_pci_dma_map_addr, &rx_data->paddr, BUS_DMA_NOWAIT); if (error != 0) { device_printf(sc->sc_dev, "could not load rx buf DMA map"); @@ -184,7 +185,7 @@ rtwn_pci_alloc_rx_list(struct rtwn_softc } rtwn_pci_setup_rx_desc(pc, &rx_ring->desc[i], rx_data->paddr, - MCLBYTES, i); + MJUMPAGESIZE, i); } rx_ring->cur = 0; @@ -206,7 +207,7 @@ rtwn_pci_reset_rx_list(struct rtwn_softc for (i = 0; i < RTWN_PCI_RX_LIST_COUNT; i++) { rx_data = &rx_ring->rx_data[i]; rtwn_pci_setup_rx_desc(pc, &rx_ring->desc[i], - rx_data->paddr, MCLBYTES, i); + rx_data->paddr, MJUMPAGESIZE, i); } rx_ring->cur = 0; } @@ -287,8 +288,8 @@ rtwn_pci_alloc_tx_list(struct rtwn_softc BUS_DMASYNC_PREWRITE); error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), 1, 0, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_M
svn commit: r308650 - in head/sys/dev/rtwn: rtl8192c/usb rtl8812a/usb rtl8821a/usb
Author: avos Date: Mon Nov 14 20:37:07 2016 New Revision: 308650 URL: https://svnweb.freebsd.org/changeset/base/308650 Log: rtwn: drop excessive includes. Since rom_defs.h is included in rxxx_var.h there is no need to include both of them. Submitted by: kevlo Modified: head/sys/dev/rtwn/rtl8192c/usb/r92cu_attach.c head/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c head/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c Modified: head/sys/dev/rtwn/rtl8192c/usb/r92cu_attach.c == --- head/sys/dev/rtwn/rtl8192c/usb/r92cu_attach.c Mon Nov 14 19:53:46 2016(r308649) +++ head/sys/dev/rtwn/rtl8192c/usb/r92cu_attach.c Mon Nov 14 20:37:07 2016(r308650) @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: head/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c == --- head/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c Mon Nov 14 19:53:46 2016(r308649) +++ head/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c Mon Nov 14 20:37:07 2016(r308650) @@ -68,7 +68,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c == --- head/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c Mon Nov 14 19:53:46 2016(r308649) +++ head/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c Mon Nov 14 20:37:07 2016(r308650) @@ -61,7 +61,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r308656 - head/sys/net80211
Author: avos Date: Mon Nov 14 23:51:28 2016 New Revision: 308656 URL: https://svnweb.freebsd.org/changeset/base/308656 Log: net80211: switch from ieee80211_iterate_nodes() to ieee80211_iterate_nodes_vap() where possible; this should make the code a bit cleaner. Modified: head/sys/net80211/ieee80211_adhoc.c head/sys/net80211/ieee80211_hostap.c head/sys/net80211/ieee80211_ioctl.c head/sys/net80211/ieee80211_node.c head/sys/net80211/ieee80211_tdma.c Modified: head/sys/net80211/ieee80211_adhoc.c == --- head/sys/net80211/ieee80211_adhoc.c Mon Nov 14 22:39:33 2016 (r308655) +++ head/sys/net80211/ieee80211_adhoc.c Mon Nov 14 23:51:28 2016 (r308656) @@ -120,9 +120,9 @@ adhoc_vattach(struct ieee80211vap *vap) static void sta_leave(void *arg, struct ieee80211_node *ni) { - struct ieee80211vap *vap = arg; + struct ieee80211vap *vap = ni->ni_vap; - if (ni->ni_vap == vap && ni != vap->iv_bss) + if (ni != vap->iv_bss) ieee80211_node_leave(ni); } @@ -164,7 +164,8 @@ adhoc_newstate(struct ieee80211vap *vap, switch (ostate) { case IEEE80211_S_RUN: /* beacon miss */ /* purge station table; entries are stale */ - ieee80211_iterate_nodes(&ic->ic_sta, sta_leave, vap); + ieee80211_iterate_nodes_vap(&ic->ic_sta, vap, + sta_leave, NULL); /* fall thru... */ case IEEE80211_S_INIT: if (vap->iv_des_chan != IEEE80211_CHAN_ANYC && Modified: head/sys/net80211/ieee80211_hostap.c == --- head/sys/net80211/ieee80211_hostap.cMon Nov 14 22:39:33 2016 (r308655) +++ head/sys/net80211/ieee80211_hostap.cMon Nov 14 23:51:28 2016 (r308656) @@ -107,9 +107,8 @@ hostap_vattach(struct ieee80211vap *vap) static void sta_disassoc(void *arg, struct ieee80211_node *ni) { - struct ieee80211vap *vap = arg; - if (ni->ni_vap == vap && ni->ni_associd != 0) { + if (ni->ni_associd != 0) { IEEE80211_SEND_MGMT(ni, IEEE80211_FC0_SUBTYPE_DISASSOC, IEEE80211_REASON_ASSOC_LEAVE); ieee80211_node_leave(ni); @@ -119,9 +118,9 @@ sta_disassoc(void *arg, struct ieee80211 static void sta_csa(void *arg, struct ieee80211_node *ni) { - struct ieee80211vap *vap = arg; + struct ieee80211vap *vap = ni->ni_vap; - if (ni->ni_vap == vap && ni->ni_associd != 0) + if (ni->ni_associd != 0) if (ni->ni_inact > vap->iv_inact_init) { ni->ni_inact = vap->iv_inact_init; IEEE80211_NOTE(vap, IEEE80211_MSG_INACT, ni, @@ -132,9 +131,8 @@ sta_csa(void *arg, struct ieee80211_node static void sta_drop(void *arg, struct ieee80211_node *ni) { - struct ieee80211vap *vap = arg; - if (ni->ni_vap == vap && ni->ni_associd != 0) + if (ni->ni_associd != 0) ieee80211_node_leave(ni); } @@ -179,7 +177,8 @@ hostap_newstate(struct ieee80211vap *vap ieee80211_dfs_cac_stop(vap); break; case IEEE80211_S_RUN: - ieee80211_iterate_nodes(&ic->ic_sta, sta_disassoc, vap); + ieee80211_iterate_nodes_vap(&ic->ic_sta, vap, + sta_disassoc, NULL); break; default: break; @@ -195,7 +194,8 @@ hostap_newstate(struct ieee80211vap *vap switch (ostate) { case IEEE80211_S_CSA: case IEEE80211_S_RUN: - ieee80211_iterate_nodes(&ic->ic_sta, sta_disassoc, vap); + ieee80211_iterate_nodes_vap(&ic->ic_sta, vap, + sta_disassoc, NULL); /* * Clear overlapping BSS state; the beacon frame * will be reconstructed on transition to the RUN @@ -289,7 +289,8 @@ hostap_newstate(struct ieee80211vap *vap * Shorten inactivity timer of associated stations * to weed out sta's that don't follow a CSA. */ - ieee80211_iterate_nodes(&ic->ic_sta, sta_csa, vap); + ieee80211_iterate_nodes_vap(&ic->ic_sta, vap, + sta_csa, NULL); /* * Update bss node channel to reflect where * we landed after CSA. @@ -340,7 +341,8 @@ hostap_newstate(struct ieee80211vap *vap * such as capabilities and the negotiated rate * set may/will be wrong).
svn commit: r309070 - head/share/man/man4
Author: avos Date: Wed Nov 23 22:57:47 2016 New Revision: 309070 URL: https://svnweb.freebsd.org/changeset/base/309070 Log: rtwn.4: fix hostapd(8) man page section. Modified: head/share/man/man4/rtwn.4 Modified: head/share/man/man4/rtwn.4 == --- head/share/man/man4/rtwn.4 Wed Nov 23 22:50:20 2016(r309069) +++ head/share/man/man4/rtwn.4 Wed Nov 23 22:57:47 2016(r309070) @@ -198,7 +198,6 @@ The driver will reset the hardware. This should not happen. .El .Sh SEE ALSO -.Xr hostapd 4 , .Xr intro 4 , .Xr netintro 4 , .Xr rtwn_pci 4 , @@ -210,6 +209,7 @@ This should not happen. .Xr wlan_tkip 4 , .Xr wlan_wep 4 , .Xr wlan_xauth 4 , +.Xr hostapd 8 , .Xr ifconfig 8 , .Xr wpa_supplicant 8 .Sh HISTORY ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r309196 - head/sys/dev/usb/wlan
Author: avos Date: Sat Nov 26 20:26:29 2016 New Revision: 309196 URL: https://svnweb.freebsd.org/changeset/base/309196 Log: rsu: fix R92S_TXDW1_QSEL_H2C definition (0x1f -> 0x13). Without this fix firmware ignores all but first 32 commands (= almost everything (except plain Tx / Rx) stops working). Tested with ASUS USB-N10. Modified: head/sys/dev/usb/wlan/if_rsureg.h Modified: head/sys/dev/usb/wlan/if_rsureg.h == --- head/sys/dev/usb/wlan/if_rsureg.h Sat Nov 26 17:55:46 2016 (r309195) +++ head/sys/dev/usb/wlan/if_rsureg.h Sat Nov 26 20:26:29 2016 (r309196) @@ -573,7 +573,7 @@ struct r92s_tx_desc { #define R92S_TXDW1_QSEL_M 0x1f00 #define R92S_TXDW1_QSEL_S 8 #define R92S_TXDW1_QSEL_BE 0x03 -#define R92S_TXDW1_QSEL_H2C0x1f +#define R92S_TXDW1_QSEL_H2C0x13 #define R92S_TXDW1_NONQOS 0x0001 #define R92S_TXDW1_KEYIDX_M0x0006 #define R92S_TXDW1_KEYIDX_S17 ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r309210 - head/sys/dev/usb/wlan
Author: avos Date: Sun Nov 27 12:03:34 2016 New Revision: 309210 URL: https://svnweb.freebsd.org/changeset/base/309210 Log: rsu: various scanning fixes. - Set IEEE80211_FEXT_SCAN_OFFLOAD flag; firmware can send null data frames when associated. - Check IEEE80211_SCAN_ACTIVE scan flag instead of IEEE80211_F_ASCAN ic flag; the last is never set since r170530. - Eliminate software scan (net80211) <-> site_survey (driver) race: * override ic_scan_curchan and ic_scan_mindwell pointers so net80211 will not try to finish scanning automatically; * inform net80211 about current status via ieee80211_cancel_scan() and ieee80211_scan_done(); * remove corresponding workaround from rsu_join_bss(). Now the driver can associate to an AP with hidden SSID. Tested with Asus USB-N10. Modified: head/sys/dev/usb/wlan/if_rsu.c head/sys/dev/usb/wlan/if_rsureg.h Modified: head/sys/dev/usb/wlan/if_rsu.c == --- head/sys/dev/usb/wlan/if_rsu.c Sun Nov 27 09:20:58 2016 (r309209) +++ head/sys/dev/usb/wlan/if_rsu.c Sun Nov 27 12:03:34 2016 (r309210) @@ -173,6 +173,8 @@ static void rsu_scan_end(struct ieee8021 static voidrsu_getradiocaps(struct ieee80211com *, int, int *, struct ieee80211_channel[]); static voidrsu_set_channel(struct ieee80211com *); +static voidrsu_scan_curchan(struct ieee80211_scan_state *, unsigned long); +static voidrsu_scan_mindwell(struct ieee80211_scan_state *); static voidrsu_update_mcast(struct ieee80211com *); static int rsu_alloc_rx_list(struct rsu_softc *); static voidrsu_free_rx_list(struct rsu_softc *); @@ -203,7 +205,8 @@ static int rsu_newstate(struct ieee80211 static voidrsu_set_key(struct rsu_softc *, const struct ieee80211_key *); static voidrsu_delete_key(struct rsu_softc *, const struct ieee80211_key *); #endif -static int rsu_site_survey(struct rsu_softc *, struct ieee80211vap *); +static int rsu_site_survey(struct rsu_softc *, + struct ieee80211_scan_ssid *); static int rsu_join_bss(struct rsu_softc *, struct ieee80211_node *); static int rsu_disconnect(struct rsu_softc *); static int rsu_hwrssi_to_rssi(struct rsu_softc *, int hw_rssi); @@ -537,6 +540,7 @@ rsu_attach(device_t self) ic->ic_txstream = sc->sc_ntxstream; ic->ic_rxstream = sc->sc_nrxstream; } + ic->ic_flags_ext |= IEEE80211_FEXT_SCAN_OFFLOAD; rsu_getradiocaps(ic, IEEE80211_CHAN_MAX, &ic->ic_nchans, ic->ic_channels); @@ -547,6 +551,8 @@ rsu_attach(device_t self) ic->ic_scan_end = rsu_scan_end; ic->ic_getradiocaps = rsu_getradiocaps; ic->ic_set_channel = rsu_set_channel; + ic->ic_scan_curchan = rsu_scan_curchan; + ic->ic_scan_mindwell = rsu_scan_mindwell; ic->ic_vap_create = rsu_vap_create; ic->ic_vap_delete = rsu_vap_delete; ic->ic_update_mcast = rsu_update_mcast; @@ -680,16 +686,21 @@ static void rsu_scan_start(struct ieee80211com *ic) { struct rsu_softc *sc = ic->ic_softc; + struct ieee80211_scan_state *ss = ic->ic_scan; + struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); int error; /* Scanning is done by the firmware. */ RSU_LOCK(sc); - /* XXX TODO: force awake if in in network-sleep? */ - error = rsu_site_survey(sc, TAILQ_FIRST(&ic->ic_vaps)); + sc->sc_active_scan = !!(ss->ss_flags & IEEE80211_SCAN_ACTIVE); + /* XXX TODO: force awake if in network-sleep? */ + error = rsu_site_survey(sc, ss->ss_nssid > 0 ? &ss->ss_ssid[0] : NULL); RSU_UNLOCK(sc); - if (error != 0) + if (error != 0) { device_printf(sc->sc_dev, "could not send site survey command\n"); + ieee80211_cancel_scan(vap); + } } static void @@ -722,6 +733,24 @@ rsu_set_channel(struct ieee80211com *ic } static void +rsu_scan_curchan(struct ieee80211_scan_state *ss, unsigned long maxdwell) +{ + /* Scan is done in rsu_scan_start(). */ +} + +/** + * Called by the net80211 framework to indicate + * the minimum dwell time has been met, terminate the scan. + * We don't actually terminate the scan as the firmware will notify + * us when it's finished and we have no way to interrupt it. + */ +static void +rsu_scan_mindwell(struct ieee80211_scan_state *ss) +{ + /* NB: don't try to abort scan; wait for firmware to finish */ +} + +static void rsu_update_mcast(struct ieee80211com *ic) { /* XXX do nothing? */ @@ -1323,31 +1352,36 @@ rsu_delete_key(struct rsu_softc *sc, con #endif static int -rsu_site_survey(struct rsu_softc *sc, struct ieee80211vap *vap) +rsu_site_survey(struct rsu_softc *sc, struct ieee80211_scan_ssid *ssid) { struct r92s_fw_cmd_sitesurvey cmd; - struct ieee80211com *ic = &sc->sc_ic; - int
svn commit: r309214 - head/sys/dev/usb/wlan
Author: avos Date: Sun Nov 27 18:06:03 2016 New Revision: 309214 URL: https://svnweb.freebsd.org/changeset/base/309214 Log: rsu: add support for hardware multicast filter setup. The algorithm is the same as in rtwn(4). Tested with Asus USB-N10 (STA) + RTL8188CUS (AP). Modified: head/sys/dev/usb/wlan/if_rsu.c head/sys/dev/usb/wlan/if_rsureg.h Modified: head/sys/dev/usb/wlan/if_rsu.c == --- head/sys/dev/usb/wlan/if_rsu.c Sun Nov 27 14:27:51 2016 (r309213) +++ head/sys/dev/usb/wlan/if_rsu.c Sun Nov 27 18:06:03 2016 (r309214) @@ -175,6 +175,8 @@ static void rsu_getradiocaps(struct ieee static voidrsu_set_channel(struct ieee80211com *); static voidrsu_scan_curchan(struct ieee80211_scan_state *, unsigned long); static voidrsu_scan_mindwell(struct ieee80211_scan_state *); +static uint8_t rsu_get_multi_pos(const uint8_t[]); +static voidrsu_set_multi(struct rsu_softc *); static voidrsu_update_mcast(struct ieee80211com *); static int rsu_alloc_rx_list(struct rsu_softc *); static voidrsu_free_rx_list(struct rsu_softc *); @@ -750,10 +752,78 @@ rsu_scan_mindwell(struct ieee80211_scan_ /* NB: don't try to abort scan; wait for firmware to finish */ } +/* + * The same as rtwn_get_multi_pos() / rtwn_set_multi(). + */ +static uint8_t +rsu_get_multi_pos(const uint8_t maddr[]) +{ + uint64_t mask = 0x4d101df481b4; + uint8_t pos = 0x27; /* initial value */ + int i, j; + + for (i = 0; i < IEEE80211_ADDR_LEN; i++) + for (j = (i == 0) ? 1 : 0; j < 8; j++) + if ((maddr[i] >> j) & 1) + pos ^= (mask >> (i * 8 + j - 1)); + + pos &= 0x3f; + + return (pos); +} + +static void +rsu_set_multi(struct rsu_softc *sc) +{ + struct ieee80211com *ic = &sc->sc_ic; + uint32_t mfilt[2]; + + RSU_ASSERT_LOCKED(sc); + + /* general structure was copied from ath(4). */ + if (ic->ic_allmulti == 0) { + struct ieee80211vap *vap; + struct ifnet *ifp; + struct ifmultiaddr *ifma; + + /* +* Merge multicast addresses to form the hardware filter. +*/ + mfilt[0] = mfilt[1] = 0; + TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { + ifp = vap->iv_ifp; + if_maddr_rlock(ifp); + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + caddr_t dl; + uint8_t pos; + + dl = LLADDR((struct sockaddr_dl *) + ifma->ifma_addr); + pos = rsu_get_multi_pos(dl); + + mfilt[pos / 32] |= (1 << (pos % 32)); + } + if_maddr_runlock(ifp); + } + } else + mfilt[0] = mfilt[1] = ~0; + + rsu_write_4(sc, R92S_MAR + 0, mfilt[0]); + rsu_write_4(sc, R92S_MAR + 4, mfilt[1]); + + RSU_DPRINTF(sc, RSU_DEBUG_STATE, "%s: MC filter %08x:%08x\n", + __func__, mfilt[0], mfilt[1]); +} + static void rsu_update_mcast(struct ieee80211com *ic) { -/* XXX do nothing? */ + struct rsu_softc *sc = ic->ic_softc; + + RSU_LOCK(sc); + if (sc->sc_running) + rsu_set_multi(sc); + RSU_UNLOCK(sc); } static int @@ -2925,6 +2995,9 @@ rsu_init(struct rsu_softc *sc) goto fail; } + /* Setup multicast filter (must be done after firmware loading). */ + rsu_set_multi(sc); + /* Set PS mode fully active */ error = rsu_set_fw_power_state(sc, RSU_PWR_ACTIVE); Modified: head/sys/dev/usb/wlan/if_rsureg.h == --- head/sys/dev/usb/wlan/if_rsureg.h Sun Nov 27 14:27:51 2016 (r309213) +++ head/sys/dev/usb/wlan/if_rsureg.h Sun Nov 27 18:06:03 2016 (r309214) @@ -48,6 +48,7 @@ #define R92S_MACIDSETTING 0x0050 #define R92S_MACID (R92S_MACIDSETTING + 0x000) +#define R92S_MAR (R92S_MACIDSETTING + 0x010) #define R92S_GP0x01e0 #define R92S_GPIO_CTRL (R92S_GP + 0x00c) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r309479 - head/sys/dev/usb/wlan
Author: avos Date: Sat Dec 3 14:26:58 2016 New Revision: 309479 URL: https://svnweb.freebsd.org/changeset/base/309479 Log: rsu: remove unused structures / variables. Modified: head/sys/dev/usb/wlan/if_rsu.c head/sys/dev/usb/wlan/if_rsureg.h Modified: head/sys/dev/usb/wlan/if_rsu.c == --- head/sys/dev/usb/wlan/if_rsu.c Sat Dec 3 05:29:35 2016 (r309478) +++ head/sys/dev/usb/wlan/if_rsu.c Sat Dec 3 14:26:58 2016 (r309479) @@ -2937,9 +2937,6 @@ rsu_init(struct rsu_softc *sc) /* Ensure the mbuf queue is drained */ rsu_drain_mbufq(sc); - /* Init host async commands ring. */ - sc->cmdq.cur = sc->cmdq.next = sc->cmdq.queued = 0; - /* Reset power management state. */ rsu_write_1(sc, R92S_USB_HRPWM, 0); Modified: head/sys/dev/usb/wlan/if_rsureg.h == --- head/sys/dev/usb/wlan/if_rsureg.h Sat Dec 3 05:29:35 2016 (r309478) +++ head/sys/dev/usb/wlan/if_rsureg.h Sat Dec 3 14:26:58 2016 (r309479) @@ -625,8 +625,6 @@ struct r92s_add_ba_req { #define RSU_RX_LIST_COUNT 100 #define RSU_TX_LIST_COUNT 32 -#define RSU_HOST_CMD_RING_COUNT32 - #define RSU_RXBUFSZ(8 * 1024) #define RSU_TXBUFSZ\ ((sizeof(struct r92s_tx_desc) + IEEE80211_MAX_LEN + 3) & ~3) @@ -700,27 +698,6 @@ struct rsu_tx_radiotap_header { struct rsu_softc; -struct rsu_host_cmd { - void(*cb)(struct rsu_softc *, void *); - uint8_t data[256]; -}; - -struct rsu_cmd_newstate { - enum ieee80211_statestate; - int arg; -}; - -struct rsu_cmd_key { - struct ieee80211_keykey; -}; - -struct rsu_host_cmd_ring { - struct rsu_host_cmd cmd[RSU_HOST_CMD_RING_COUNT]; - int cur; - int next; - int queued; -}; - enum { RSU_BULK_RX, RSU_BULK_TX_BE_BK, /* = WME_AC_BE/BK */ @@ -755,12 +732,9 @@ struct rsu_softc { struct mbufqsc_snd; device_tsc_dev; struct usb_device *sc_udev; - int (*sc_newstate)(struct ieee80211com *, - enum ieee80211_state, int); - struct usbd_interface *sc_iface; + struct timeout_task calib_task; struct task tx_task; - const uint8_t *qid2idx; struct mtx sc_mtx; int sc_ht; int sc_nendpoints; @@ -775,10 +749,8 @@ struct rsu_softc { uint8_t sc_rftype; int8_t sc_nrxstream; int8_t sc_ntxstream; - struct rsu_host_cmd_ringcmdq; struct rsu_data sc_rx[RSU_RX_LIST_COUNT]; struct rsu_data sc_tx[RSU_TX_LIST_COUNT]; - struct rsu_data *fwcmd_data; uint8_t cmd_seq; uint8_t rom[128]; struct usb_xfer *sc_xfer[RSU_N_TRANSFER]; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r309481 - head/sys/dev/usb/wlan
Author: avos Date: Sat Dec 3 16:02:53 2016 New Revision: 309481 URL: https://svnweb.freebsd.org/changeset/base/309481 Log: rsu: fix frame processing in the Rx path (similar to r292207). - Fill in Rx radiotap header correctly (for every packet in a chain; not once per chain). - Fix rate / flags fields in Rx radiotap. - Add debug messages for discarded frames. - Pass received control (< sizeof(struct ieee80211_frame)) frames to net80211 (if allowed by device filter; cannot happen yet). Tested with Asus USB-N10. Differential Revision:https://reviews.freebsd.org/D5723 Modified: head/sys/dev/usb/wlan/if_rsu.c Modified: head/sys/dev/usb/wlan/if_rsu.c == --- head/sys/dev/usb/wlan/if_rsu.c Sat Dec 3 14:41:53 2016 (r309480) +++ head/sys/dev/usb/wlan/if_rsu.c Sat Dec 3 16:02:53 2016 (r309481) @@ -219,7 +219,10 @@ static voidrsu_rx_multi_event(struct rs #if 0 static int8_t rsu_get_rssi(struct rsu_softc *, int, void *); #endif -static struct mbuf * rsu_rx_frame(struct rsu_softc *, uint8_t *, int); +static struct mbuf * rsu_rx_copy_to_mbuf(struct rsu_softc *, + struct r92s_rx_stat *, int); +static struct ieee80211_node * rsu_rx_frame(struct rsu_softc *, struct mbuf *, + int8_t *); static struct mbuf * rsu_rx_multi_frame(struct rsu_softc *, uint8_t *, int); static struct mbuf * rsu_rxeof(struct usb_xfer *, struct rsu_data *); @@ -1827,64 +1830,76 @@ rsu_get_rssi(struct rsu_softc *sc, int r #endif static struct mbuf * -rsu_rx_frame(struct rsu_softc *sc, uint8_t *buf, int pktlen) +rsu_rx_copy_to_mbuf(struct rsu_softc *sc, struct r92s_rx_stat *stat, +int totlen) { struct ieee80211com *ic = &sc->sc_ic; - struct ieee80211_frame *wh; + struct mbuf *m; + uint32_t rxdw0; + int pktlen; + + rxdw0 = le32toh(stat->rxdw0); + if (__predict_false(rxdw0 & R92S_RXDW0_CRCERR)) { + RSU_DPRINTF(sc, RSU_DEBUG_RX, + "%s: RX flags error (CRC)\n", __func__); + goto fail; + } + + pktlen = MS(rxdw0, R92S_RXDW0_PKTLEN); + if (__predict_false(pktlen < sizeof (struct ieee80211_frame_ack))) { + RSU_DPRINTF(sc, RSU_DEBUG_RX, + "%s: frame is too short: %d\n", __func__, pktlen); + goto fail; + } + + m = m_get2(totlen, M_NOWAIT, MT_DATA, M_PKTHDR); + if (__predict_false(m == NULL)) { + device_printf(sc->sc_dev, "%s: could not allocate RX mbuf\n", + __func__); + goto fail; + } + + /* Finalize mbuf. */ + memcpy(mtod(m, uint8_t *), (uint8_t *)stat, totlen); + m->m_pkthdr.len = m->m_len = totlen; + + return (m); +fail: + counter_u64_add(ic->ic_ierrors, 1); + return (NULL); +} + +static struct ieee80211_node * +rsu_rx_frame(struct rsu_softc *sc, struct mbuf *m, int8_t *rssi_p) +{ + struct ieee80211com *ic = &sc->sc_ic; + struct ieee80211_frame_min *wh; struct r92s_rx_stat *stat; uint32_t rxdw0, rxdw3; - struct mbuf *m; uint8_t rate; int infosz; - stat = (struct r92s_rx_stat *)buf; + stat = mtod(m, struct r92s_rx_stat *); rxdw0 = le32toh(stat->rxdw0); rxdw3 = le32toh(stat->rxdw3); - if (__predict_false(rxdw0 & R92S_RXDW0_CRCERR)) { - counter_u64_add(ic->ic_ierrors, 1); - return NULL; - } - if (__predict_false(pktlen < sizeof(*wh) || pktlen > MCLBYTES)) { - counter_u64_add(ic->ic_ierrors, 1); - return NULL; - } - rate = MS(rxdw3, R92S_RXDW3_RATE); infosz = MS(rxdw0, R92S_RXDW0_INFOSZ) * 8; #if 0 /* Get RSSI from PHY status descriptor if present. */ if (infosz != 0) - *rssi = rsu_get_rssi(sc, rate, &stat[1]); + *rssi_p = rsu_get_rssi(sc, rate, &stat[1]); else - *rssi = 0; #endif - - RSU_DPRINTF(sc, RSU_DEBUG_RX, - "%s: Rx frame len=%d rate=%d infosz=%d\n", - __func__, pktlen, rate, infosz); - - m = m_get2(pktlen, M_NOWAIT, MT_DATA, M_PKTHDR); - if (__predict_false(m == NULL)) { - counter_u64_add(ic->ic_ierrors, 1); - return NULL; - } - /* Hardware does Rx TCP checksum offload. */ - if (rxdw3 & R92S_RXDW3_TCPCHKVALID) { - if (__predict_true(rxdw3 & R92S_RXDW3_TCPCHKRPT)) - m->m_pkthdr.csum_flags |= CSUM_DATA_VALID; - } - wh = (struct ieee80211_frame *)((uint8_t *)&stat[1] + infosz); - memcpy(mtod(m, uint8_t *), wh, pktlen); - m->m_pkthdr.len = m->m_len = pktlen; + *rssi_p = 0; if (ieee80211_radiotap_active(ic)) { struct rsu_rx_radiotap_header *tap = &sc->sc_rxtap;
svn commit: r309486 - head/sys/dev/rtwn
Author: avos Date: Sat Dec 3 17:27:10 2016 New Revision: 309486 URL: https://svnweb.freebsd.org/changeset/base/309486 Log: rtwn: fix bitmap size calculation. Tested with RTL8188CE, STA mode. Modified: head/sys/dev/rtwn/if_rtwnvar.h Modified: head/sys/dev/rtwn/if_rtwnvar.h == --- head/sys/dev/rtwn/if_rtwnvar.h Sat Dec 3 17:17:42 2016 (r309485) +++ head/sys/dev/rtwn/if_rtwnvar.h Sat Dec 3 17:27:10 2016 (r309486) @@ -207,8 +207,8 @@ struct rtwn_softc { int vaps_running; int monvaps_running; - uint16_tnext_rom_addr; - uint8_t keys_bmap[roundup2(RTWN_CAM_ENTRY_LIMIT, NBBY)]; + uint16_tnext_rom_addr; + uint8_t keys_bmap[howmany(RTWN_CAM_ENTRY_LIMIT, NBBY)]; struct rtwn_vap *vaps[RTWN_PORT_COUNT]; struct ieee80211_node *node_list[RTWN_MACID_LIMIT]; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r309534 - head/etc
Author: avos Date: Sun Dec 4 15:58:34 2016 New Revision: 309534 URL: https://svnweb.freebsd.org/changeset/base/309534 Log: Do not try to recreate wlan(4) interface if it already exists. This should fix error messages caused by devd(8) during startup: Starting Network: lo0 wlan0. ... Starting devd. ifconfig: SIOCS80211: Device busy wpa_supplicant already running? (pid=323). MFC after:2 weeks Modified: head/etc/pccard_ether Modified: head/etc/pccard_ether == --- head/etc/pccard_ether Sun Dec 4 15:55:59 2016(r309533) +++ head/etc/pccard_ether Sun Dec 4 15:58:34 2016(r309534) @@ -120,6 +120,9 @@ pccard_ether_restart() pccard_ether_startchildren() { for child in `get_if_var $ifn wlans_IF`; do + if ifexists $child; then + continue + fi /etc/rc.d/netif quietstart $child done } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r309541 - head/sys/dev/usb/wlan
Author: avos Date: Sun Dec 4 21:40:49 2016 New Revision: 309541 URL: https://svnweb.freebsd.org/changeset/base/309541 Log: rsu: fix RSSI reporting, partially revert r288414. - Append RCR_APP_PHYSTS bit after firmware loading - otherwise firmware will reset the register and this modification will be lost. (without it Rx PHY descriptor section will contain garbage). - Check if R92S_RXDW0_PHYST bit is set (like it is done in rtwn(4)) - even if infosz is non-zero the section may not contain anything useful. - In case, if descriptor is absent (A-MPDU?) use last calibrated RSSI (rtwn(4) uses RSSI from the previous (sub)frame; probably, this approach should be used here too). Tested with Asus USB-N10, STA mode. Modified: head/sys/dev/usb/wlan/if_rsu.c head/sys/dev/usb/wlan/if_rsureg.h Modified: head/sys/dev/usb/wlan/if_rsu.c == --- head/sys/dev/usb/wlan/if_rsu.c Sun Dec 4 21:13:26 2016 (r309540) +++ head/sys/dev/usb/wlan/if_rsu.c Sun Dec 4 21:40:49 2016 (r309541) @@ -24,7 +24,6 @@ __FBSDID("$FreeBSD$"); * TODO: * o h/w crypto * o hostap / ibss / mesh - * o sensible RSSI levels * o power-save operation */ @@ -216,9 +215,7 @@ static void rsu_event_survey(struct rsu_ static voidrsu_event_join_bss(struct rsu_softc *, uint8_t *, int); static voidrsu_rx_event(struct rsu_softc *, uint8_t, uint8_t *, int); static voidrsu_rx_multi_event(struct rsu_softc *, uint8_t *, int); -#if 0 static int8_t rsu_get_rssi(struct rsu_softc *, int, void *); -#endif static struct mbuf * rsu_rx_copy_to_mbuf(struct rsu_softc *, struct r92s_rx_stat *, int); static struct ieee80211_node * rsu_rx_frame(struct rsu_softc *, struct mbuf *, @@ -1806,7 +1803,6 @@ rsu_rx_multi_event(struct rsu_softc *sc, } } -#if 0 static int8_t rsu_get_rssi(struct rsu_softc *sc, int rate, void *physt) { @@ -1827,7 +1823,6 @@ rsu_get_rssi(struct rsu_softc *sc, int r } return (rssi); } -#endif static struct mbuf * rsu_rx_copy_to_mbuf(struct rsu_softc *sc, struct r92s_rx_stat *stat, @@ -1886,13 +1881,13 @@ rsu_rx_frame(struct rsu_softc *sc, struc rate = MS(rxdw3, R92S_RXDW3_RATE); infosz = MS(rxdw0, R92S_RXDW0_INFOSZ) * 8; -#if 0 /* Get RSSI from PHY status descriptor if present. */ - if (infosz != 0) + if (infosz != 0 && (rxdw0 & R92S_RXDW0_PHYST)) *rssi_p = rsu_get_rssi(sc, rate, &stat[1]); - else -#endif - *rssi_p = 0; + else { + /* Cheat and get the last calibrated RSSI */ + *rssi_p = rsu_hwrssi_to_rssi(sc, sc->sc_currssi); + } if (ieee80211_radiotap_active(ic)) { struct rsu_rx_radiotap_header *tap = &sc->sc_rxtap; @@ -1920,11 +1915,8 @@ rsu_rx_frame(struct rsu_softc *sc, struc /* Bit 7 set means HT MCS instead of rate. */ tap->wr_rate = 0x80 | (rate - 12); } -#if 0 - tap->wr_dbm_antsignal = *rssi; -#endif - /* XXX not nice */ - tap->wr_dbm_antsignal = rsu_hwrssi_to_rssi(sc, sc->sc_currssi); + + tap->wr_dbm_antsignal = *rssi_p; tap->wr_chan_freq = htole16(ic->ic_curchan->ic_freq); tap->wr_chan_flags = htole16(ic->ic_curchan->ic_flags); }; @@ -2075,9 +2067,6 @@ tr_setup: m->m_next = NULL; ni = rsu_rx_frame(sc, m, &rssi); - - /* Cheat and get the last calibrated RSSI */ - rssi = rsu_hwrssi_to_rssi(sc, sc->sc_currssi); RSU_UNLOCK(sc); if (ni != NULL) { @@ -2988,9 +2977,6 @@ rsu_init(struct rsu_softc *sc) /* Enable Rx TCP checksum offload. */ rsu_write_4(sc, R92S_RCR, rsu_read_4(sc, R92S_RCR) | 0x0400); - /* Append PHY status. */ - rsu_write_4(sc, R92S_RCR, - rsu_read_4(sc, R92S_RCR) | 0x0200); rsu_write_4(sc, R92S_CR, rsu_read_4(sc, R92S_CR) & ~0xff00); @@ -3026,6 +3012,10 @@ rsu_init(struct rsu_softc *sc) goto fail; } + /* Append PHY status. */ + rsu_write_4(sc, R92S_RCR, + rsu_read_4(sc, R92S_RCR) | 0x0200); + /* Setup multicast filter (must be done after firmware loading). */ rsu_set_multi(sc); Modified: head/sys/dev/usb/wlan/if_rsureg.h == --- head/sys/dev/usb/wlan/if_rsureg.h Sun Dec 4 21:13:26 2016 (r309540) +++ head/sys/dev/usb/wlan/if_rsureg.h Sun Dec 4 21:40:49 2016 (r309541) @@ -510,6 +510,7 @@ struct r92s_rx_stat { #define R92S_RXDW0_QOS 0x0080 #define R92S_RXDW0_SHIFT_M 0x0300 #define R92S_RXDW0_SHIFT_S 24 +#define R92S
svn commit: r309586 - head/sys/dev/usb/wlan
Author: avos Date: Tue Dec 6 00:13:49 2016 New Revision: 309586 URL: https://svnweb.freebsd.org/changeset/base/309586 Log: rsu: add hardware crypto support (WEP, TKIP and CCMP). This change includes firmware commands for key setup + some additional checking via CAMREAD / CAMWRITE registers. Nothing (except rsu_delete_key() for pairwise keys) is deferred; to ensure that things are done in order rsu_set_key() will wait until key deletion task will be finished. Tested with Asus USB-N10 (all ciphers). Differences from initial (reviewed) patch: - Pause AC queues before disassociation - since CMD_DISCONNECT clears crypto state all pending frames must be processed / dropped before it. - Check sc_running flag before trying to set static keys. - Clear key index from bitmap even when firmware command fails (it will be invalidated via CAMWRITE anyway). Reviewed by: adrian, kevlo Tested by:kevlo Differential Revision:https://reviews.freebsd.org/D8706 Modified: head/sys/dev/usb/wlan/if_rsu.c head/sys/dev/usb/wlan/if_rsureg.h Modified: head/sys/dev/usb/wlan/if_rsu.c == --- head/sys/dev/usb/wlan/if_rsu.c Tue Dec 6 00:12:09 2016 (r309585) +++ head/sys/dev/usb/wlan/if_rsu.c Tue Dec 6 00:13:49 2016 (r309586) @@ -22,8 +22,8 @@ __FBSDID("$FreeBSD$"); * Driver for Realtek RTL8188SU/RTL8191SU/RTL8192SU. * * TODO: - * o h/w crypto - * o hostap / ibss / mesh + * o tx a-mpdu + * o monitor / hostap / ibss / mesh * o power-save operation */ @@ -102,6 +102,7 @@ TUNABLE_INT("hw.usb.rsu.enable_11n", &rs #defineRSU_DEBUG_FW0x0100 #defineRSU_DEBUG_FWDBG 0x0200 #defineRSU_DEBUG_AMPDU 0x0400 +#defineRSU_DEBUG_KEY 0x0800 static const STRUCT_USB_HOST_ID rsu_devs[] = { #defineRSU_HT_NOT_SUPPORTED 0 @@ -202,10 +203,25 @@ static intrsu_fw_cmd(struct rsu_softc * static voidrsu_calib_task(void *, int); static voidrsu_tx_task(void *, int); static int rsu_newstate(struct ieee80211vap *, enum ieee80211_state, int); -#ifdef notyet -static voidrsu_set_key(struct rsu_softc *, const struct ieee80211_key *); -static voidrsu_delete_key(struct rsu_softc *, const struct ieee80211_key *); -#endif +static int rsu_key_alloc(struct ieee80211vap *, struct ieee80211_key *, + ieee80211_keyix *, ieee80211_keyix *); +static int rsu_process_key(struct ieee80211vap *, + const struct ieee80211_key *, int); +static int rsu_key_set(struct ieee80211vap *, + const struct ieee80211_key *); +static int rsu_key_delete(struct ieee80211vap *, + const struct ieee80211_key *); +static int rsu_cam_read(struct rsu_softc *, uint8_t, uint32_t *); +static voidrsu_cam_write(struct rsu_softc *, uint8_t, uint32_t); +static int rsu_key_check(struct rsu_softc *, ieee80211_keyix, int); +static uint8_t rsu_crypto_mode(struct rsu_softc *, u_int, int); +static int rsu_set_key_group(struct rsu_softc *, + const struct ieee80211_key *); +static int rsu_set_key_pair(struct rsu_softc *, + const struct ieee80211_key *); +static int rsu_reinit_static_keys(struct rsu_softc *); +static int rsu_delete_key(struct rsu_softc *sc, ieee80211_keyix); +static voidrsu_delete_key_pair_cb(void *, int); static int rsu_site_survey(struct rsu_softc *, struct ieee80211_scan_ssid *); static int rsu_join_bss(struct rsu_softc *, struct ieee80211_node *); @@ -437,8 +453,10 @@ rsu_attach(device_t self) mtx_init(&sc->sc_mtx, device_get_nameunit(self), MTX_NETWORK_LOCK, MTX_DEF); + RSU_DELKEY_BMAP_LOCK_INIT(sc); TIMEOUT_TASK_INIT(taskqueue_thread, &sc->calib_task, 0, rsu_calib_task, sc); + TASK_INIT(&sc->del_key_task, 0, rsu_delete_key_pair_cb, sc); TASK_INIT(&sc->tx_task, 0, rsu_tx_task, sc); mbufq_init(&sc->sc_snd, ifqmaxlen); @@ -524,6 +542,11 @@ rsu_attach(device_t self) IEEE80211_C_SHSLOT |/* Short slot time supported. */ IEEE80211_C_WPA;/* WPA/RSN. */ + ic->ic_cryptocaps = + IEEE80211_CRYPTO_WEP | + IEEE80211_CRYPTO_TKIP | + IEEE80211_CRYPTO_AES_CCM; + /* Check if HT support is present. */ if (sc->sc_ht) { device_printf(sc->sc_dev, "%s: enabling 11n\n", __func__); @@ -608,8 +631,10 @@ rsu_detach(device_t self) ieee80211_ifdetach(ic); taskqueue_drain_timeout(taskqueue_thread, &sc->calib_task); + taskqueue_drain(taskqueue_thread, &sc->del_key_task); taskqueue_drain(taskqueue_thread, &sc->tx_task); + RSU_DELKEY_BMAP_LOCK_DESTROY(sc); mtx_destroy(&sc->sc_mtx); return (0); @@ -662,6
svn commit: r309603 - head/sys/dev/usb/wlan
Author: avos Date: Tue Dec 6 06:12:01 2016 New Revision: 309603 URL: https://svnweb.freebsd.org/changeset/base/309603 Log: rsu: fix printf format specifiers. Modified: head/sys/dev/usb/wlan/if_rsu.c Modified: head/sys/dev/usb/wlan/if_rsu.c == --- head/sys/dev/usb/wlan/if_rsu.c Tue Dec 6 06:04:13 2016 (r309602) +++ head/sys/dev/usb/wlan/if_rsu.c Tue Dec 6 06:12:01 2016 (r309603) @@ -1473,7 +1473,7 @@ rsu_process_key(struct ieee80211vap *vap if (&vap->iv_nw_keys[0] <= k && k < &vap->iv_nw_keys[IEEE80211_WEP_NKID]) { KASSERT(k->wk_keyix < nitems(sc->group_keys), - ("keyix %d > %d\n", k->wk_keyix, nitems(sc->group_keys))); + ("keyix %u > %zu\n", k->wk_keyix, nitems(sc->group_keys))); RSU_LOCK(sc); sc->group_keys[k->wk_keyix] = (set ? k : NULL); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r309686 - in head/sys: dev/ath dev/mwl dev/rtwn dev/usb/wlan net80211
Author: avos Date: Wed Dec 7 22:16:07 2016 New Revision: 309686 URL: https://svnweb.freebsd.org/changeset/base/309686 Log: net80211 + drivers: convert to ieee80211_crypto_get_key_wepidx(). Proposed by: adrian Modified: head/sys/dev/ath/if_ath_keycache.c head/sys/dev/mwl/if_mwl.c head/sys/dev/rtwn/if_rtwn_cam.c head/sys/dev/usb/wlan/if_rsu.c head/sys/dev/usb/wlan/if_rum.c head/sys/net80211/ieee80211_crypto.c Modified: head/sys/dev/ath/if_ath_keycache.c == --- head/sys/dev/ath/if_ath_keycache.c Wed Dec 7 22:01:09 2016 (r309685) +++ head/sys/dev/ath/if_ath_keycache.c Wed Dec 7 22:16:07 2016 (r309686) @@ -449,7 +449,8 @@ ath_key_alloc(struct ieee80211vap *vap, * have no way to check if they've already * been allocated. */ - *keyix = *rxkeyix = k - vap->iv_nw_keys; + *keyix = *rxkeyix = + ieee80211_crypto_get_key_wepidx(vap, k); return 1; } /* Modified: head/sys/dev/mwl/if_mwl.c == --- head/sys/dev/mwl/if_mwl.c Wed Dec 7 22:01:09 2016(r309685) +++ head/sys/dev/mwl/if_mwl.c Wed Dec 7 22:16:07 2016(r309686) @@ -1529,7 +1529,7 @@ mwl_key_alloc(struct ieee80211vap *vap, return 0; } /* give the caller what they requested */ - *keyix = *rxkeyix = k - vap->iv_nw_keys; + *keyix = *rxkeyix = ieee80211_crypto_get_key_wepidx(vap, k); } else { /* * Firmware handles key allocation. Modified: head/sys/dev/rtwn/if_rtwn_cam.c == --- head/sys/dev/rtwn/if_rtwn_cam.c Wed Dec 7 22:01:09 2016 (r309685) +++ head/sys/dev/rtwn/if_rtwn_cam.c Wed Dec 7 22:16:07 2016 (r309686) @@ -118,7 +118,11 @@ rtwn_key_alloc(struct ieee80211vap *vap, if (&vap->iv_nw_keys[0] <= k && k < &vap->iv_nw_keys[IEEE80211_WEP_NKID]) { +#if __FreeBSD_version > 1200018 + *keyix = ieee80211_crypto_get_key_wepidx(vap, k); +#else *keyix = k - vap->iv_nw_keys; +#endif if (sc->sc_hwcrypto != RTWN_CRYPTO_FULL) k->wk_flags |= IEEE80211_KEY_SWCRYPT; else { Modified: head/sys/dev/usb/wlan/if_rsu.c == --- head/sys/dev/usb/wlan/if_rsu.c Wed Dec 7 22:01:09 2016 (r309685) +++ head/sys/dev/usb/wlan/if_rsu.c Wed Dec 7 22:16:07 2016 (r309686) @@ -1428,7 +1428,7 @@ rsu_key_alloc(struct ieee80211vap *vap, if (&vap->iv_nw_keys[0] <= k && k < &vap->iv_nw_keys[IEEE80211_WEP_NKID]) { - *keyix = k - vap->iv_nw_keys; + *keyix = ieee80211_crypto_get_key_wepidx(vap, k); } else { if (vap->iv_opmode != IEEE80211_M_STA) { *keyix = 0; Modified: head/sys/dev/usb/wlan/if_rum.c == --- head/sys/dev/usb/wlan/if_rum.c Wed Dec 7 22:01:09 2016 (r309685) +++ head/sys/dev/usb/wlan/if_rum.c Wed Dec 7 22:16:07 2016 (r309686) @@ -3046,7 +3046,7 @@ rum_key_alloc(struct ieee80211vap *vap, } else *keyix = 0; } else { - *keyix = k - vap->iv_nw_keys; + *keyix = ieee80211_crypto_get_key_wepidx(vap, k); } *rxkeyix = *keyix; return 1; Modified: head/sys/net80211/ieee80211_crypto.c == --- head/sys/net80211/ieee80211_crypto.cWed Dec 7 22:01:09 2016 (r309685) +++ head/sys/net80211/ieee80211_crypto.cWed Dec 7 22:16:07 2016 (r309686) @@ -78,7 +78,7 @@ null_key_alloc(struct ieee80211vap *vap, return 0; *keyix = 0; /* NB: use key index 0 for ucast key */ } else { - *keyix = k - vap->iv_nw_keys; + *keyix = ieee80211_crypto_get_key_wepidx(vap, k); } *rxkeyix = IEEE80211_KEYIX_NONE;/* XXX maybe *keyix? */ return 1; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r309695 - head/sys/net80211
Author: avos Date: Wed Dec 7 23:33:59 2016 New Revision: 309695 URL: https://svnweb.freebsd.org/changeset/base/309695 Log: net80211: remove obsolete comment. The described LOR should be fixed in r302283. Modified: head/sys/net80211/ieee80211_superg.c Modified: head/sys/net80211/ieee80211_superg.c == --- head/sys/net80211/ieee80211_superg.cWed Dec 7 23:32:42 2016 (r309694) +++ head/sys/net80211/ieee80211_superg.cWed Dec 7 23:33:59 2016 (r309695) @@ -909,12 +909,6 @@ ieee80211_ff_node_init(struct ieee80211_ ieee80211_ff_node_cleanup(ni); } -/* - * Note: this comlock acquisition LORs with the node lock: - * - * 1: sta_join1 -> NODE_LOCK -> node_free -> node_cleanup -> ff_node_cleanup -> COM_LOCK - * 2: TBD - */ void ieee80211_ff_node_cleanup(struct ieee80211_node *ni) { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r309721 - head/sys/dev/usb/wlan
Author: avos Date: Thu Dec 8 20:54:54 2016 New Revision: 309721 URL: https://svnweb.freebsd.org/changeset/base/309721 Log: rsu: fix incorrect register addresses. Modified: head/sys/dev/usb/wlan/if_rsureg.h Modified: head/sys/dev/usb/wlan/if_rsureg.h == --- head/sys/dev/usb/wlan/if_rsureg.h Thu Dec 8 19:28:12 2016 (r309720) +++ head/sys/dev/usb/wlan/if_rsureg.h Thu Dec 8 20:54:54 2016 (r309721) @@ -51,16 +51,16 @@ #define R92S_MACID (R92S_MACIDSETTING + 0x000) #define R92S_MAR (R92S_MACIDSETTING + 0x010) -#define R92S_GP0x01e0 -#define R92S_GPIO_CTRL (R92S_GP + 0x00c) -#define R92S_GPIO_IO_SEL (R92S_GP + 0x00e) -#define R92S_MAC_PINMUX_CTRL (R92S_GP + 0x011) - #define R92S_SECURITY 0x0240 #define R92S_CAMCMD(R92S_SECURITY + 0x000) #define R92S_CAMWRITE (R92S_SECURITY + 0x004) #define R92S_CAMREAD (R92S_SECURITY + 0x008) +#define R92S_GP0x02e0 +#define R92S_GPIO_CTRL (R92S_GP + 0x00c) +#define R92S_GPIO_IO_SEL (R92S_GP + 0x00e) +#define R92S_MAC_PINMUX_CTRL (R92S_GP + 0x011) + #define R92S_IOCMD_CTRL0x0370 #define R92S_IOCMD_DATA0x0374 ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r309806 - head/sys/dev/usb/wlan
Author: avos Date: Sat Dec 10 13:30:16 2016 New Revision: 309806 URL: https://svnweb.freebsd.org/changeset/base/309806 Log: rsu: add TSF field into Rx radiotap. Tested with Asus USB-N10. Modified: head/sys/dev/usb/wlan/if_rsu.c head/sys/dev/usb/wlan/if_rsureg.h Modified: head/sys/dev/usb/wlan/if_rsu.c == --- head/sys/dev/usb/wlan/if_rsu.c Sat Dec 10 13:29:51 2016 (r309805) +++ head/sys/dev/usb/wlan/if_rsu.c Sat Dec 10 13:30:16 2016 (r309806) @@ -234,6 +234,8 @@ static void rsu_rx_multi_event(struct rs static int8_t rsu_get_rssi(struct rsu_softc *, int, void *); static struct mbuf * rsu_rx_copy_to_mbuf(struct rsu_softc *, struct r92s_rx_stat *, int); +static uint32_trsu_get_tsf_low(struct rsu_softc *); +static uint32_trsu_get_tsf_high(struct rsu_softc *); static struct ieee80211_node * rsu_rx_frame(struct rsu_softc *, struct mbuf *, int8_t *); static struct mbuf * rsu_rx_multi_frame(struct rsu_softc *, uint8_t *, int); @@ -2223,6 +2225,18 @@ fail: return (NULL); } +static uint32_t +rsu_get_tsf_low(struct rsu_softc *sc) +{ + return (rsu_read_4(sc, R92S_TSFTR)); +} + +static uint32_t +rsu_get_tsf_high(struct rsu_softc *sc) +{ + return (rsu_read_4(sc, R92S_TSFTR + 4)); +} + static struct ieee80211_node * rsu_rx_frame(struct rsu_softc *sc, struct mbuf *m, int8_t *rssi_p) { @@ -2254,6 +2268,12 @@ rsu_rx_frame(struct rsu_softc *sc, struc /* Map HW rate index to 802.11 rate. */ tap->wr_flags = 0; /* TODO */ + tap->wr_tsft = rsu_get_tsf_high(sc); + if (le32toh(stat->tsf_low) > rsu_get_tsf_low(sc)) + tap->wr_tsft--; + tap->wr_tsft = (uint64_t)htole32(tap->wr_tsft) << 32; + tap->wr_tsft += stat->tsf_low; + if (rate < 12) { switch (rate) { /* CCK. */ Modified: head/sys/dev/usb/wlan/if_rsureg.h == --- head/sys/dev/usb/wlan/if_rsureg.h Sat Dec 10 13:29:51 2016 (r309805) +++ head/sys/dev/usb/wlan/if_rsureg.h Sat Dec 10 13:30:16 2016 (r309806) @@ -51,6 +51,9 @@ #define R92S_MACID (R92S_MACIDSETTING + 0x000) #define R92S_MAR (R92S_MACIDSETTING + 0x010) +#define R92S_TIMECTRL 0x0080 +#define R92S_TSFTR (R92S_TIMECTRL + 0x000) + #define R92S_SECURITY 0x0240 #define R92S_CAMCMD(R92S_SECURITY + 0x000) #define R92S_CAMWRITE (R92S_SECURITY + 0x004) @@ -592,7 +595,7 @@ struct r92s_rx_stat { #define R92S_RXDW3_HTC 0x4000 uint32_trxdw4; - uint32_trxdw5; + uint32_ttsf_low; } __packed __aligned(4); /* Rx PHY descriptor. */ @@ -735,6 +738,7 @@ static const uint8_t rsu_qid2idx_11ep[] struct rsu_rx_radiotap_header { struct ieee80211_radiotap_header wr_ihdr; + uint64_twr_tsft; uint8_t wr_flags; uint8_t wr_rate; uint16_twr_chan_freq; @@ -743,7 +747,8 @@ struct rsu_rx_radiotap_header { } __packed __aligned(8); #define RSU_RX_RADIOTAP_PRESENT\ - (1 << IEEE80211_RADIOTAP_FLAGS |\ + (1 << IEEE80211_RADIOTAP_TSFT | \ +1 << IEEE80211_RADIOTAP_FLAGS |\ 1 << IEEE80211_RADIOTAP_RATE | \ 1 << IEEE80211_RADIOTAP_CHANNEL | \ 1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r309821 - head/sys/dev/usb/wlan
Author: avos Date: Sat Dec 10 17:06:55 2016 New Revision: 309821 URL: https://svnweb.freebsd.org/changeset/base/309821 Log: rsu: increase Rx buffer size from 8k to 30k. This is required for USB Rx aggregation (and fixes 'could not allocate RX mbuf' / few other failures). While here, reduce the number of Rx buffers from 100 to 1 - the driver never uses more than one Rx buffer. Tested with Asus USB-N10. Modified: head/sys/dev/usb/wlan/if_rsureg.h Modified: head/sys/dev/usb/wlan/if_rsureg.h == --- head/sys/dev/usb/wlan/if_rsureg.h Sat Dec 10 16:41:55 2016 (r309820) +++ head/sys/dev/usb/wlan/if_rsureg.h Sat Dec 10 17:06:55 2016 (r309821) @@ -688,10 +688,10 @@ struct r92s_add_ba_req { /* * Driver definitions. */ -#define RSU_RX_LIST_COUNT 100 +#define RSU_RX_LIST_COUNT 1 #define RSU_TX_LIST_COUNT 32 -#define RSU_RXBUFSZ(8 * 1024) +#define RSU_RXBUFSZ(30 * 1024) #define RSU_TXBUFSZ\ ((sizeof(struct r92s_tx_desc) + IEEE80211_MAX_LEN + 3) & ~3) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r309825 - head/sys/dev/usb/wlan
Author: avos Date: Sat Dec 10 18:47:13 2016 New Revision: 309825 URL: https://svnweb.freebsd.org/changeset/base/309825 Log: rsu: add promiscuous mode support. - Add partial promiscuous mode support (no management frames; they cannot be received by the firmware and net80211 at the same time). - Add monitor mode support (all frames). Tested with Asus, USB-N10. Modified: head/sys/dev/usb/wlan/if_rsu.c head/sys/dev/usb/wlan/if_rsureg.h Modified: head/sys/dev/usb/wlan/if_rsu.c == --- head/sys/dev/usb/wlan/if_rsu.c Sat Dec 10 18:29:39 2016 (r309824) +++ head/sys/dev/usb/wlan/if_rsu.c Sat Dec 10 18:47:13 2016 (r309825) @@ -23,7 +23,7 @@ __FBSDID("$FreeBSD$"); * * TODO: * o tx a-mpdu - * o monitor / hostap / ibss / mesh + * o hostap / ibss / mesh * o power-save operation */ @@ -175,6 +175,7 @@ static void rsu_getradiocaps(struct ieee static voidrsu_set_channel(struct ieee80211com *); static voidrsu_scan_curchan(struct ieee80211_scan_state *, unsigned long); static voidrsu_scan_mindwell(struct ieee80211_scan_state *); +static voidrsu_update_promisc(struct ieee80211com *); static uint8_t rsu_get_multi_pos(const uint8_t[]); static voidrsu_set_multi(struct rsu_softc *); static voidrsu_update_mcast(struct ieee80211com *); @@ -202,6 +203,9 @@ static int rsu_read_rom(struct rsu_softc static int rsu_fw_cmd(struct rsu_softc *, uint8_t, void *, int); static voidrsu_calib_task(void *, int); static voidrsu_tx_task(void *, int); +static voidrsu_set_led(struct rsu_softc *, int); +static int rsu_monitor_newstate(struct ieee80211vap *, + enum ieee80211_state, int); static int rsu_newstate(struct ieee80211vap *, enum ieee80211_state, int); static int rsu_key_alloc(struct ieee80211vap *, struct ieee80211_key *, ieee80211_keyix *, ieee80211_keyix *); @@ -244,6 +248,9 @@ static struct mbuf * static voidrsu_txeof(struct usb_xfer *, struct rsu_data *); static int rsu_raw_xmit(struct ieee80211_node *, struct mbuf *, const struct ieee80211_bpf_params *); +static voidrsu_rxfilter_init(struct rsu_softc *); +static voidrsu_rxfilter_set(struct rsu_softc *, uint32_t, uint32_t); +static voidrsu_rxfilter_refresh(struct rsu_softc *); static voidrsu_init(struct rsu_softc *); static int rsu_tx_start(struct rsu_softc *, struct ieee80211_node *, struct mbuf *, struct rsu_data *); @@ -536,6 +543,7 @@ rsu_attach(device_t self) /* Set device capabilities. */ ic->ic_caps = IEEE80211_C_STA | /* station mode */ + IEEE80211_C_MONITOR | /* monitor mode supported */ #if 0 IEEE80211_C_BGSCAN |/* Background scan. */ #endif @@ -582,6 +590,7 @@ rsu_attach(device_t self) ic->ic_scan_mindwell = rsu_scan_mindwell; ic->ic_vap_create = rsu_vap_create; ic->ic_vap_delete = rsu_vap_delete; + ic->ic_update_promisc = rsu_update_promisc; ic->ic_update_mcast = rsu_update_mcast; ic->ic_parent = rsu_parent; ic->ic_transmit = rsu_transmit; @@ -688,7 +697,10 @@ rsu_vap_create(struct ieee80211com *ic, /* override state transition machine */ uvp->newstate = vap->iv_newstate; - vap->iv_newstate = rsu_newstate; + if (opmode == IEEE80211_M_MONITOR) + vap->iv_newstate = rsu_monitor_newstate; + else + vap->iv_newstate = rsu_newstate; vap->iv_key_alloc = rsu_key_alloc; vap->iv_key_set = rsu_key_set; vap->iv_key_delete = rsu_key_delete; @@ -759,9 +771,30 @@ rsu_getradiocaps(struct ieee80211com *ic } static void -rsu_set_channel(struct ieee80211com *ic __unused) +rsu_set_channel(struct ieee80211com *ic) { - /* We are unable to switch channels, yet. */ + struct rsu_softc *sc = ic->ic_softc; + + /* +* Only need to set the channel in Monitor mode. AP scanning and auth +* are already taken care of by their respective firmware commands. +*/ + if (ic->ic_opmode == IEEE80211_M_MONITOR) { + struct r92s_set_channel cmd; + int error; + + cmd.channel = IEEE80211_CHAN2IEEE(ic->ic_curchan); + + RSU_LOCK(sc); + error = rsu_fw_cmd(sc, R92S_CMD_SET_CHANNEL, &cmd, + sizeof(cmd)); + if (error != 0) { + device_printf(sc->sc_dev, + "%s: error %d setting channel\n", __func__, + error); + } + RSU_UNLOCK(sc); + } } static void @@ -782,6 +815,17 @@ rsu_scan_mindwell(struct ieee80211_scan_ /* NB: don't try to abort scan; wait for firmware to finish */ } +static void +rsu_update_promisc(struct ieee80211com
svn commit: r309826 - head/share/man/man4
Author: avos Date: Sat Dec 10 19:14:51 2016 New Revision: 309826 URL: https://svnweb.freebsd.org/changeset/base/309826 Log: rsu(4): refresh the manpage. - Add monitor mode into the list of supported modes. - Describe promiscuous mode limitations in CAVEATS section. Reported by: adrian Modified: head/share/man/man4/rsu.4 Modified: head/share/man/man4/rsu.4 == --- head/share/man/man4/rsu.4 Sat Dec 10 18:47:13 2016(r309825) +++ head/share/man/man4/rsu.4 Sat Dec 10 19:14:51 2016(r309826) @@ -15,7 +15,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd December 5, 2016 +.Dd December 10, 2016 .Dt RSU 4 .Os .Sh NAME @@ -78,6 +78,12 @@ Also known as mode, this is used when associating with an access point, through which all traffic passes. This mode is the default. +.It monitor mode +In this mode the driver is able to receive packets without +associating with an access point. +This disables the internal receive filter and enables the card to +capture packets from networks which it wouldn't normally have access to, +or to scan for access points. .El .Pp The @@ -183,3 +189,9 @@ The .Nm driver currently does not support 802.11n transmit aggregation, either A-MSDU or A-MPDU. +.Pp +The +.Nm +driver does not capture management frames in non-monitor modes; +without this limitation some firmware functions (e.g., 'join bss') +will not work properly. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r309827 - head/sys/dev/usb/wlan
Author: avos Date: Sat Dec 10 20:19:57 2016 New Revision: 309827 URL: https://svnweb.freebsd.org/changeset/base/309827 Log: rsu: use bitmap for all debug messages. - Replace all remaining DPRINTF(N)'s with RSU_DPRINTF. - Add new RSU_DEBUG_USB flag to track error codes returned by usbd_do_request_flags(). - Improve few messages. Modified: head/sys/dev/usb/wlan/if_rsu.c Modified: head/sys/dev/usb/wlan/if_rsu.c == --- head/sys/dev/usb/wlan/if_rsu.c Sat Dec 10 19:14:51 2016 (r309826) +++ head/sys/dev/usb/wlan/if_rsu.c Sat Dec 10 20:19:57 2016 (r309827) @@ -68,9 +68,6 @@ __FBSDID("$FreeBSD$"); #include #include "usbdevs.h" -#define USB_DEBUG_VAR rsu_debug -#include - #include #ifdef USB_DEBUG @@ -103,6 +100,7 @@ TUNABLE_INT("hw.usb.rsu.enable_11n", &rs #defineRSU_DEBUG_FWDBG 0x0200 #defineRSU_DEBUG_AMPDU 0x0400 #defineRSU_DEBUG_KEY 0x0800 +#defineRSU_DEBUG_USB 0x1000 static const STRUCT_USB_HOST_ID rsu_devs[] = { #defineRSU_HT_NOT_SUPPORTED 0 @@ -665,8 +663,9 @@ rsu_do_request(struct rsu_softc *sc, str req, data, 0, NULL, 250 /* ms */); if (err == 0 || err == USB_ERR_NOT_CONFIGURED) break; - DPRINTFN(1, "Control request failed, %s (retrying)\n", - usbd_errstr(err)); + RSU_DPRINTF(sc, RSU_DEBUG_USB, + "Control request failed, %s (retries left: %d)\n", + usbd_errstr(err), ntries); rsu_ms_delay(sc, 10); } @@ -1207,7 +1206,7 @@ rsu_read_rom(struct rsu_softc *sc) } } #ifdef USB_DEBUG - if (rsu_debug >= 5) { + if (rsu_debug & RSU_DEBUG_RESET) { /* Dump ROM content. */ printf("\n"); for (i = 0; i < sizeof(sc->rom); i++) @@ -1294,7 +1293,7 @@ rsu_calib_task(void *arg, int pending __ rsu_read_1(sc, R92S_GPIO_IO_SEL) & ~R92S_GPIO_WPS); reg = rsu_read_1(sc, R92S_GPIO_CTRL); if (reg != 0xff && (reg & R92S_GPIO_WPS)) - DPRINTF(("WPS PBC is pushed\n")); + RSU_DPRINTF(sc, RSU_DEBUG_CALIB, "WPS PBC is pushed\n"); #endif /* Read current signal level. */ if (rsu_fw_iocmd(sc, 0xf401) == 0) { @@ -2113,7 +2112,7 @@ rsu_event_join_bss(struct rsu_softc *sc, tmp = le32toh(rsp->associd); if (tmp >= vap->iv_max_aid) { - DPRINTF("Assoc ID overflow\n"); + RSU_DPRINTF(sc, RSU_DEBUG_ANY, "Assoc ID overflow\n"); tmp = 1; } RSU_DPRINTF(sc, RSU_DEBUG_STATE | RSU_DEBUG_FWCMD, @@ -2306,8 +2305,9 @@ rsu_rx_copy_to_mbuf(struct rsu_softc *sc m = m_get2(totlen, M_NOWAIT, MT_DATA, M_PKTHDR); if (__predict_false(m == NULL)) { - device_printf(sc->sc_dev, "%s: could not allocate RX mbuf\n", - __func__); + device_printf(sc->sc_dev, + "%s: could not allocate RX mbuf, totlen %d\n", + __func__, totlen); goto fail; } @@ -2490,7 +2490,7 @@ rsu_rxeof(struct usb_xfer *xfer, struct usbd_xfer_status(xfer, &len, NULL, NULL, NULL); if (__predict_false(len < sizeof(*stat))) { - DPRINTF("xfer too short %d\n", len); + RSU_DPRINTF(sc, RSU_DEBUG_RX, "xfer too short %d\n", len); counter_u64_add(ic->ic_ierrors, 1); return (NULL); } @@ -3251,8 +3251,9 @@ rsu_load_firmware(struct rsu_softc *sc) error = EINVAL; goto fail; } - DPRINTF("FW V%d %02x-%02x %02x:%02x\n", le16toh(hdr->version), - hdr->month, hdr->day, hdr->hour, hdr->minute); + RSU_DPRINTF(sc, RSU_DEBUG_FW, "FW V%d %02x-%02x %02x:%02x\n", + le16toh(hdr->version), hdr->month, hdr->day, hdr->hour, + hdr->minute); /* Make sure that driver and firmware are in sync. */ if (hdr->privsz != htole32(sizeof(*dmem))) { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r309825 - head/sys/dev/usb/wlan
Sat, 10 Dec 2016 20:57:32 +0200 було написано Adrian Chadd : Done in r309826. Would you mind updating the manpage to state this monitor/promisc difference in the LIMITATIONS section, or something? Thanks! -a On 10 December 2016 at 10:47, Andriy Voskoboinyk wrote: Author: avos Date: Sat Dec 10 18:47:13 2016 New Revision: 309825 URL: https://svnweb.freebsd.org/changeset/base/309825 Log: rsu: add promiscuous mode support. - Add partial promiscuous mode support (no management frames; they cannot be received by the firmware and net80211 at the same time). - Add monitor mode support (all frames). Tested with Asus, USB-N10. Modified: head/sys/dev/usb/wlan/if_rsu.c head/sys/dev/usb/wlan/if_rsureg.h Modified: head/sys/dev/usb/wlan/if_rsu.c == --- head/sys/dev/usb/wlan/if_rsu.c Sat Dec 10 18:29:39 2016 (r309824) +++ head/sys/dev/usb/wlan/if_rsu.c Sat Dec 10 18:47:13 2016 (r309825) @@ -23,7 +23,7 @@ __FBSDID("$FreeBSD$"); * * TODO: * o tx a-mpdu - * o monitor / hostap / ibss / mesh + * o hostap / ibss / mesh * o power-save operation */ @@ -175,6 +175,7 @@ static void rsu_getradiocaps(struct ieee static voidrsu_set_channel(struct ieee80211com *); static voidrsu_scan_curchan(struct ieee80211_scan_state *, unsigned long); static voidrsu_scan_mindwell(struct ieee80211_scan_state *); +static voidrsu_update_promisc(struct ieee80211com *); static uint8_t rsu_get_multi_pos(const uint8_t[]); static voidrsu_set_multi(struct rsu_softc *); static voidrsu_update_mcast(struct ieee80211com *); @@ -202,6 +203,9 @@ static int rsu_read_rom(struct rsu_softc static int rsu_fw_cmd(struct rsu_softc *, uint8_t, void *, int); static voidrsu_calib_task(void *, int); static voidrsu_tx_task(void *, int); +static voidrsu_set_led(struct rsu_softc *, int); +static int rsu_monitor_newstate(struct ieee80211vap *, + enum ieee80211_state, int); static int rsu_newstate(struct ieee80211vap *, enum ieee80211_state, int); static int rsu_key_alloc(struct ieee80211vap *, struct ieee80211_key *, ieee80211_keyix *, ieee80211_keyix *); @@ -244,6 +248,9 @@ static struct mbuf * static voidrsu_txeof(struct usb_xfer *, struct rsu_data *); static int rsu_raw_xmit(struct ieee80211_node *, struct mbuf *, const struct ieee80211_bpf_params *); +static voidrsu_rxfilter_init(struct rsu_softc *); +static voidrsu_rxfilter_set(struct rsu_softc *, uint32_t, uint32_t); +static voidrsu_rxfilter_refresh(struct rsu_softc *); static voidrsu_init(struct rsu_softc *); static int rsu_tx_start(struct rsu_softc *, struct ieee80211_node *, struct mbuf *, struct rsu_data *); @@ -536,6 +543,7 @@ rsu_attach(device_t self) /* Set device capabilities. */ ic->ic_caps = IEEE80211_C_STA | /* station mode */ + IEEE80211_C_MONITOR | /* monitor mode supported */ #if 0 IEEE80211_C_BGSCAN |/* Background scan. */ #endif @@ -582,6 +590,7 @@ rsu_attach(device_t self) ic->ic_scan_mindwell = rsu_scan_mindwell; ic->ic_vap_create = rsu_vap_create; ic->ic_vap_delete = rsu_vap_delete; + ic->ic_update_promisc = rsu_update_promisc; ic->ic_update_mcast = rsu_update_mcast; ic->ic_parent = rsu_parent; ic->ic_transmit = rsu_transmit; @@ -688,7 +697,10 @@ rsu_vap_create(struct ieee80211com *ic, /* override state transition machine */ uvp->newstate = vap->iv_newstate; - vap->iv_newstate = rsu_newstate; + if (opmode == IEEE80211_M_MONITOR) + vap->iv_newstate = rsu_monitor_newstate; + else + vap->iv_newstate = rsu_newstate; vap->iv_key_alloc = rsu_key_alloc; vap->iv_key_set = rsu_key_set; vap->iv_key_delete = rsu_key_delete; @@ -759,9 +771,30 @@ rsu_getradiocaps(struct ieee80211com *ic } static void -rsu_set_channel(struct ieee80211com *ic __unused) +rsu_set_channel(struct ieee80211com *ic) { - /* We are unable to switch channels, yet. */ + struct rsu_softc *sc = ic->ic_softc; + + /* +* Only need to set the channel in Monitor mode. AP scanning and auth +* are already taken care of by their respective firmware commands. +*/ + if (ic->ic_opmode == IEEE80211_M_MONITOR) { + struct r92s_set_channel cmd; + int error; + + cmd.channel = IEEE80211_CHAN2IEEE(ic->ic_curchan); + + RSU_LOCK(sc); + error = rsu_fw_cmd(sc, R92S_CMD_SET_CHANNEL, &cmd, + sizeof(cmd)); + if (error != 0) { + device_printf(sc->sc_d
svn commit: r309838 - head/sys/dev/usb/wlan
Author: avos Date: Sat Dec 10 22:31:49 2016 New Revision: 309838 URL: https://svnweb.freebsd.org/changeset/base/309838 Log: rsu: various initialization fixes. - Do not ignore initialization errors; call ieee80211_stop() when initialization failed. - Use usb_pause_mtx() instead of DELAY() while waiting for firmware loading; this fixes system freeze during firmware startup. - Do not execute rsu_stop() when device is powered off; fixes 'unknown board type (rfconfig=0xff)' error when the device is reattached. Tested with Asus USB-N10. Modified: head/sys/dev/usb/wlan/if_rsu.c Modified: head/sys/dev/usb/wlan/if_rsu.c == --- head/sys/dev/usb/wlan/if_rsu.c Sat Dec 10 22:08:33 2016 (r309837) +++ head/sys/dev/usb/wlan/if_rsu.c Sat Dec 10 22:31:49 2016 (r309838) @@ -249,7 +249,7 @@ static int rsu_raw_xmit(struct ieee80211 static voidrsu_rxfilter_init(struct rsu_softc *); static voidrsu_rxfilter_set(struct rsu_softc *, uint32_t, uint32_t); static voidrsu_rxfilter_refresh(struct rsu_softc *); -static voidrsu_init(struct rsu_softc *); +static int rsu_init(struct rsu_softc *); static int rsu_tx_start(struct rsu_softc *, struct ieee80211_node *, struct mbuf *, struct rsu_data *); static int rsu_transmit(struct ieee80211com *, struct mbuf *); @@ -620,9 +620,7 @@ rsu_detach(device_t self) struct rsu_softc *sc = device_get_softc(self); struct ieee80211com *ic = &sc->sc_ic; - RSU_LOCK(sc); rsu_stop(sc); - RSU_UNLOCK(sc); usbd_transfer_unsetup(sc->sc_xfer, RSU_N_TRANSFER); @@ -2921,20 +2919,17 @@ static void rsu_parent(struct ieee80211com *ic) { struct rsu_softc *sc = ic->ic_softc; - int startall = 0; - RSU_LOCK(sc); if (ic->ic_nrunning > 0) { - if (!sc->sc_running) { - rsu_init(sc); - startall = 1; + if (rsu_init(sc) == 0) + ieee80211_start_all(ic); + else { + struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); + if (vap != NULL) + ieee80211_stop(vap); } - } else if (sc->sc_running) + } else rsu_stop(sc); - RSU_UNLOCK(sc); - - if (startall) - ieee80211_start_all(ic); } /* @@ -3484,7 +3479,7 @@ rsu_rxfilter_refresh(struct rsu_softc *s rsu_rxfilter_set(sc, mask_min, mask_all); } -static void +static int rsu_init(struct rsu_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; @@ -3493,7 +3488,12 @@ rsu_init(struct rsu_softc *sc) int error; int i; - RSU_ASSERT_LOCKED(sc); + RSU_LOCK(sc); + + if (sc->sc_running) { + RSU_UNLOCK(sc); + return (0); + } /* Ensure the mbuf queue is drained */ rsu_drain_mbufq(sc); @@ -3538,7 +3538,7 @@ rsu_init(struct rsu_softc *sc) rsu_write_region_1(sc, R92S_MACID, macaddr, IEEE80211_ADDR_LEN); /* It really takes 1.5 seconds for the firmware to boot: */ - rsu_ms_delay(sc, 2000); + usb_pause_mtx(&sc->sc_mtx, USB_MS_TO_TICKS(2000)); RSU_DPRINTF(sc, RSU_DEBUG_RESET, "%s: setting MAC address to %s\n", __func__, @@ -3570,11 +3570,16 @@ rsu_init(struct rsu_softc *sc) /* We're ready to go. */ sc->sc_running = 1; - return; + RSU_UNLOCK(sc); + + return (0); fail: /* Need to stop all failed transfers, if any */ for (i = 0; i != RSU_N_TRANSFER; i++) usbd_transfer_stop(sc->sc_xfer[i]); + RSU_UNLOCK(sc); + + return (error); } static void @@ -3582,7 +3587,11 @@ rsu_stop(struct rsu_softc *sc) { int i; - RSU_ASSERT_LOCKED(sc); + RSU_LOCK(sc); + if (!sc->sc_running) { + RSU_UNLOCK(sc); + return; + } sc->sc_running = 0; sc->sc_vap_is_running = 0; @@ -3605,6 +3614,7 @@ rsu_stop(struct rsu_softc *sc) /* Ensure the mbuf queue is drained */ rsu_drain_mbufq(sc); + RSU_UNLOCK(sc); } /* ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r309852 - head/sys/dev/usb/wlan
Author: avos Date: Sun Dec 11 17:15:25 2016 New Revision: 309852 URL: https://svnweb.freebsd.org/changeset/base/309852 Log: rsu: fix and enable Rx TCP checksum offloading. Tested with Asus USB-N10, STA mode. Modified: head/sys/dev/usb/wlan/if_rsu.c head/sys/dev/usb/wlan/if_rsureg.h Modified: head/sys/dev/usb/wlan/if_rsu.c == --- head/sys/dev/usb/wlan/if_rsu.c Sun Dec 11 13:26:35 2016 (r309851) +++ head/sys/dev/usb/wlan/if_rsu.c Sun Dec 11 17:15:25 2016 (r309852) @@ -255,6 +255,7 @@ static int rsu_tx_start(struct rsu_softc static int rsu_transmit(struct ieee80211com *, struct mbuf *); static voidrsu_start(struct rsu_softc *); static void_rsu_start(struct rsu_softc *); +static int rsu_ioctl_net(struct ieee80211com *, u_long, void *); static voidrsu_parent(struct ieee80211com *); static voidrsu_stop(struct rsu_softc *); static voidrsu_ms_delay(struct rsu_softc *, int); @@ -444,6 +445,7 @@ rsu_attach(device_t self) device_set_usb_desc(self); sc->sc_udev = uaa->device; sc->sc_dev = self; + sc->sc_rx_checksum_enable = 1; if (rsu_enable_11n) sc->sc_ht = !! (USB_GET_DRIVER_INFO(uaa) & RSU_HT_SUPPORTED); @@ -590,6 +592,7 @@ rsu_attach(device_t self) ic->ic_vap_delete = rsu_vap_delete; ic->ic_update_promisc = rsu_update_promisc; ic->ic_update_mcast = rsu_update_mcast; + ic->ic_ioctl = rsu_ioctl_net; ic->ic_parent = rsu_parent; ic->ic_transmit = rsu_transmit; ic->ic_send_mgmt = rsu_send_mgmt; @@ -676,8 +679,10 @@ rsu_vap_create(struct ieee80211com *ic, const uint8_t bssid[IEEE80211_ADDR_LEN], const uint8_t mac[IEEE80211_ADDR_LEN]) { + struct rsu_softc *sc = ic->ic_softc; struct rsu_vap *uvp; struct ieee80211vap *vap; + struct ifnet *ifp; if (!TAILQ_EMPTY(&ic->ic_vaps)) /* only one at a time */ return (NULL); @@ -692,6 +697,13 @@ rsu_vap_create(struct ieee80211com *ic, return (NULL); } + ifp = vap->iv_ifp; + ifp->if_capabilities = IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6; + RSU_LOCK(sc); + if (sc->sc_rx_checksum_enable) + ifp->if_capenable |= IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6; + RSU_UNLOCK(sc); + /* override state transition machine */ uvp->newstate = vap->iv_newstate; if (opmode == IEEE80211_M_MONITOR) @@ -2396,9 +2408,37 @@ rsu_rx_frame(struct rsu_softc *sc, struc }; /* Hardware does Rx TCP checksum offload. */ + /* +* This flag can be set for some other +* (e.g., EAPOL) frame types, so don't rely on it. +*/ if (rxdw3 & R92S_RXDW3_TCPCHKVALID) { - if (__predict_true(rxdw3 & R92S_RXDW3_TCPCHKRPT)) + RSU_DPRINTF(sc, RSU_DEBUG_RX, + "%s: TCP/IP checksums: %schecked / %schecked\n", + __func__, + (rxdw3 & R92S_RXDW3_TCPCHKRPT) ? "" : "not ", + (rxdw3 & R92S_RXDW3_IPCHKRPT) ? "" : "not "); + + /* +* 'IP header checksum valid' bit will not be set if +* the frame was not checked / has incorrect checksum / +* does not have checksum (IPv6). +* +* NB: if DF bit is not set then frame will not be checked. +*/ + if (rxdw3 & R92S_RXDW3_IPCHKRPT) { + m->m_pkthdr.csum_flags = CSUM_IP_CHECKED; + m->m_pkthdr.csum_flags |= CSUM_IP_VALID; + } + + /* +* This is independent of the above check. +*/ + if (rxdw3 & R92S_RXDW3_TCPCHKRPT) { m->m_pkthdr.csum_flags |= CSUM_DATA_VALID; + m->m_pkthdr.csum_flags |= CSUM_PSEUDO_HDR; + m->m_pkthdr.csum_data = 0x; + } } /* Drop descriptor. */ @@ -2915,6 +2955,59 @@ rsu_start(struct rsu_softc *sc) taskqueue_enqueue(taskqueue_thread, &sc->tx_task); } +static int +rsu_ioctl_net(struct ieee80211com *ic, u_long cmd, void *data) +{ + struct rsu_softc *sc = ic->ic_softc; + struct ifreq *ifr = (struct ifreq *)data; + int error; + + error = 0; + switch (cmd) { + case SIOCSIFCAP: + { + struct ieee80211vap *vap; + int rxmask; + + rxmask = ifr->ifr_reqcap & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6); + + RSU_LOCK(sc); + /* Both RXCSUM bits must be set (or unset). */ + if (sc->sc_rx_checksum_enable && + rxmask != (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) { + rxmask = 0; + sc->sc_rx_checksum_enable = 0; + rs
svn commit: r345754 - head/sys/dev/usb/wlan
Author: avos Date: Sun Mar 31 14:18:02 2019 New Revision: 345754 URL: https://svnweb.freebsd.org/changeset/base/345754 Log: run(4): properly set F_DATAPAD radiotap flag if frame has padding between frame header and data. This will fix 'Mysterious OLPC stuff' for received frames and wrong CCMP / TKIP / data decoding for transmitted frames in net/wireshark dissector. While here, drop unneeded comment - net80211 handles padding requirements for Tx & Rx without driver adjustment. Tested with D-Link DWA-140 rev B3, STA mode. MFC after:1 week Modified: head/sys/dev/usb/wlan/if_run.c Modified: head/sys/dev/usb/wlan/if_run.c == --- head/sys/dev/usb/wlan/if_run.c Sun Mar 31 13:41:20 2019 (r345753) +++ head/sys/dev/usb/wlan/if_run.c Sun Mar 31 14:18:02 2019 (r345754) @@ -2851,10 +2851,6 @@ run_rx_frame(struct run_softc *sc, struct mbuf *m, uin } if (flags & RT2860_RX_L2PAD) { - /* -* XXX OpenBSD removes padding between header -* and payload here... -*/ RUN_DPRINTF(sc, RUN_DEBUG_RECV, "received RT2860_RX_L2PAD frame\n"); len += 2; @@ -2896,6 +2892,8 @@ run_rx_frame(struct run_softc *sc, struct mbuf *m, uin uint16_t phy; tap->wr_flags = 0; + if (flags & RT2860_RX_L2PAD) + tap->wr_flags |= IEEE80211_RADIOTAP_F_DATAPAD; tap->wr_antsignal = rssi; tap->wr_antenna = ant; tap->wr_dbm_antsignal = run_rssi2dbm(sc, rssi, ant); @@ -3162,14 +3160,23 @@ tr_setup: vap = data->ni->ni_vap; if (ieee80211_radiotap_active_vap(vap)) { + const struct ieee80211_frame *wh; struct run_tx_radiotap_header *tap = &sc->sc_txtap; struct rt2860_txwi *txwi = (struct rt2860_txwi *)(&data->desc + sizeof(struct rt2870_txd)); + int has_l2pad; + + wh = mtod(m, struct ieee80211_frame *); + has_l2pad = IEEE80211_HAS_ADDR4(wh) != + IEEE80211_QOS_HAS_SEQ(wh); + tap->wt_flags = 0; tap->wt_rate = rt2860_rates[data->ridx].rate; tap->wt_hwqueue = index; if (le16toh(txwi->phy) & RT2860_PHY_SHPRE) tap->wt_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; + if (has_l2pad) + tap->wt_flags |= IEEE80211_RADIOTAP_F_DATAPAD; ieee80211_radiotap_tx(vap, m); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r345729 - head/sys/dev/usb/wlan
Author: avos Date: Sat Mar 30 09:24:06 2019 New Revision: 345729 URL: https://svnweb.freebsd.org/changeset/base/345729 Log: urtw(4): export TSF timestamp for received frames via radiotap Tested with Netgear WG111 v3 (RTL8187B), STA mode. MFC after:1 week Modified: head/sys/dev/usb/wlan/if_urtw.c head/sys/dev/usb/wlan/if_urtwvar.h Modified: head/sys/dev/usb/wlan/if_urtw.c == --- head/sys/dev/usb/wlan/if_urtw.c Sat Mar 30 07:29:20 2019 (r345728) +++ head/sys/dev/usb/wlan/if_urtw.c Sat Mar 30 09:24:06 2019 (r345729) @@ -3932,6 +3932,7 @@ urtw_rxeof(struct usb_xfer *xfer, struct urtw_data *da struct urtw_softc *sc = data->sc; struct ieee80211com *ic = &sc->sc_ic; uint8_t noise = 0, rate; + uint64_t mactime; usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL); @@ -3951,6 +3952,9 @@ urtw_rxeof(struct usb_xfer *xfer, struct urtw_data *da /* XXX correct? */ rssi = rx->rssi & URTW_RX_RSSI_MASK; noise = rx->noise; + + if (ieee80211_radiotap_active(ic)) + mactime = rx->mactime; } else { struct urtw_8187l_rxhdr *rx; @@ -3967,6 +3971,9 @@ urtw_rxeof(struct usb_xfer *xfer, struct urtw_data *da /* XXX correct? */ rssi = rx->rssi & URTW_RX_8187L_RSSI_MASK; noise = rx->noise; + + if (ieee80211_radiotap_active(ic)) + mactime = rx->mactime; } if (flen < IEEE80211_ACK_LEN) @@ -3986,6 +3993,7 @@ urtw_rxeof(struct usb_xfer *xfer, struct urtw_data *da if (ieee80211_radiotap_active(ic)) { struct urtw_rx_radiotap_header *tap = &sc->sc_rxtap; + tap->wr_tsf = mactime; tap->wr_flags = 0; tap->wr_dbm_antsignal = (int8_t)rssi; } Modified: head/sys/dev/usb/wlan/if_urtwvar.h == --- head/sys/dev/usb/wlan/if_urtwvar.h Sat Mar 30 07:29:20 2019 (r345728) +++ head/sys/dev/usb/wlan/if_urtwvar.h Sat Mar 30 09:24:06 2019 (r345729) @@ -55,6 +55,7 @@ typedef STAILQ_HEAD(, urtw_data) urtw_datahead; struct urtw_rx_radiotap_header { struct ieee80211_radiotap_header wr_ihdr; + uint64_twr_tsf; uint8_t wr_flags; uint8_t wr_pad; uint16_twr_chan_freq; @@ -63,7 +64,8 @@ struct urtw_rx_radiotap_header { } __packed __aligned(8); #define URTW_RX_RADIOTAP_PRESENT \ - ((1 << IEEE80211_RADIOTAP_FLAGS) | \ + ((1 << IEEE80211_RADIOTAP_TSFT) | \ +(1 << IEEE80211_RADIOTAP_FLAGS) | \ (1 << IEEE80211_RADIOTAP_CHANNEL) |\ (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL)) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r345751 - head/sys/dev/usb/wlan
Author: avos Date: Sun Mar 31 09:52:36 2019 New Revision: 345751 URL: https://svnweb.freebsd.org/changeset/base/345751 Log: uath(4), urtw(4): restart driver if device does not respond after Tx request MFC after:1 week Modified: head/sys/dev/usb/wlan/if_uath.c head/sys/dev/usb/wlan/if_urtw.c Modified: head/sys/dev/usb/wlan/if_uath.c == --- head/sys/dev/usb/wlan/if_uath.c Sun Mar 31 06:21:32 2019 (r345750) +++ head/sys/dev/usb/wlan/if_uath.c Sun Mar 31 09:52:36 2019 (r345751) @@ -1276,8 +1276,8 @@ uath_watchdog(void *arg) if (sc->sc_tx_timer > 0) { if (--sc->sc_tx_timer == 0) { device_printf(sc->sc_dev, "device timeout\n"); - /*uath_init(sc); XXX needs a process context! */ counter_u64_add(ic->ic_oerrors, 1); + ieee80211_restart_all(ic); return; } callout_reset(&sc->watchdog_ch, hz, uath_watchdog, sc); Modified: head/sys/dev/usb/wlan/if_urtw.c == --- head/sys/dev/usb/wlan/if_urtw.c Sun Mar 31 06:21:32 2019 (r345750) +++ head/sys/dev/usb/wlan/if_urtw.c Sun Mar 31 09:52:36 2019 (r345751) @@ -1891,11 +1891,13 @@ static void urtw_watchdog(void *arg) { struct urtw_softc *sc = arg; + struct ieee80211com *ic = &sc->sc_ic; if (sc->sc_txtimer > 0) { if (--sc->sc_txtimer == 0) { device_printf(sc->sc_dev, "device timeout\n"); - counter_u64_add(sc->sc_ic.ic_oerrors, 1); + counter_u64_add(ic->ic_oerrors, 1); + ieee80211_restart_all(ic); return; } callout_reset(&sc->sc_watchdog_ch, hz, urtw_watchdog, sc); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r345753 - head/sys/dev/usb/wlan
Author: avos Date: Sun Mar 31 13:41:20 2019 New Revision: 345753 URL: https://svnweb.freebsd.org/changeset/base/345753 Log: run(4): do not clear PROTECTED bit if frame was not decrypted by NIC. Tested with D-Link DWA-140 rev B3, STA / MONITOR modes. MFC after:1 week Modified: head/sys/dev/usb/wlan/if_run.c Modified: head/sys/dev/usb/wlan/if_run.c == --- head/sys/dev/usb/wlan/if_run.c Sun Mar 31 11:31:01 2019 (r345752) +++ head/sys/dev/usb/wlan/if_run.c Sun Mar 31 13:41:20 2019 (r345753) @@ -2865,8 +2865,8 @@ run_rx_frame(struct run_softc *sc, struct mbuf *m, uin wh = mtod(m, struct ieee80211_frame *); - /* XXX wrong for monitor mode */ - if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { + if ((wh->i_fc[1] & IEEE80211_FC1_PROTECTED) != 0 && + (flags & RT2860_RX_DEC) != 0) { wh->i_fc[1] &= ~IEEE80211_FC1_PROTECTED; m->m_flags |= M_WEP; } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r346073 - in head/sys/dev: iwi otus usb/wlan
Author: avos Date: Wed Apr 10 08:17:56 2019 New Revision: 346073 URL: https://svnweb.freebsd.org/changeset/base/346073 Log: urtw(4), otus(4), iwi(4): allow to set non-default MAC address via ifconfig(8) Tested with Netgear WG111 v3 (RTL8187B, urtw(4)), STA mode. MFC after:1 week Modified: head/sys/dev/iwi/if_iwi.c head/sys/dev/otus/if_otus.c head/sys/dev/usb/wlan/if_urtw.c Modified: head/sys/dev/iwi/if_iwi.c == --- head/sys/dev/iwi/if_iwi.c Wed Apr 10 07:51:13 2019(r346072) +++ head/sys/dev/iwi/if_iwi.c Wed Apr 10 08:17:56 2019(r346073) @@ -2576,15 +2576,18 @@ static int iwi_config(struct iwi_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; + struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); struct iwi_configuration config; struct iwi_txpower power; + uint8_t *macaddr; uint32_t data; int error, i; IWI_LOCK_ASSERT(sc); - DPRINTF(("Setting MAC address to %6D\n", ic->ic_macaddr, ":")); - error = iwi_cmd(sc, IWI_CMD_SET_MAC_ADDRESS, ic->ic_macaddr, + macaddr = vap ? vap->iv_myaddr : ic->ic_macaddr; + DPRINTF(("Setting MAC address to %6D\n", macaddr, ":")); + error = iwi_cmd(sc, IWI_CMD_SET_MAC_ADDRESS, macaddr, IEEE80211_ADDR_LEN); if (error != 0) return error; Modified: head/sys/dev/otus/if_otus.c == --- head/sys/dev/otus/if_otus.c Wed Apr 10 07:51:13 2019(r346072) +++ head/sys/dev/otus/if_otus.c Wed Apr 10 08:17:56 2019(r346073) @@ -3108,7 +3108,7 @@ otus_set_operating_mode(struct otus_softc *sc) */ IEEE80211_ADDR_COPY(bssid, zero_macaddr); vap = TAILQ_FIRST(&ic->ic_vaps); - macaddr = ic->ic_macaddr; + macaddr = vap ? vap->iv_myaddr : ic->ic_macaddr; switch (ic->ic_opmode) { case IEEE80211_M_STA: Modified: head/sys/dev/usb/wlan/if_urtw.c == --- head/sys/dev/usb/wlan/if_urtw.c Wed Apr 10 07:51:13 2019 (r346072) +++ head/sys/dev/usb/wlan/if_urtw.c Wed Apr 10 08:17:56 2019 (r346073) @@ -752,6 +752,7 @@ static void urtw_free_tx_data_list(struct urtw_softc static voidurtw_free_rx_data_list(struct urtw_softc *); static voidurtw_free_data_list(struct urtw_softc *, struct urtw_data data[], int, int); +static usb_error_t urtw_set_macaddr(struct urtw_softc *, const uint8_t *); static usb_error_t urtw_adapter_start(struct urtw_softc *); static usb_error_t urtw_adapter_start_b(struct urtw_softc *); static usb_error_t urtw_set_mode(struct urtw_softc *, uint32_t); @@ -1187,9 +1188,23 @@ fail: } static usb_error_t +urtw_set_macaddr(struct urtw_softc *sc, const uint8_t *macaddr) +{ + usb_error_t error; + + urtw_write32_m(sc, URTW_MAC0, ((const uint32_t *)macaddr)[0]); + urtw_write16_m(sc, URTW_MAC4, ((const uint32_t *)macaddr)[1] & 0x); + +fail: + return (error); +} + +static usb_error_t urtw_adapter_start(struct urtw_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; + struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); + const uint8_t *macaddr; usb_error_t error; error = urtw_reset(sc); @@ -1209,8 +1224,11 @@ urtw_adapter_start(struct urtw_softc *sc) if (error) goto fail; /* applying MAC address again. */ - urtw_write32_m(sc, URTW_MAC0, ((uint32_t *)ic->ic_macaddr)[0]); - urtw_write16_m(sc, URTW_MAC4, ((uint32_t *)ic->ic_macaddr)[1] & 0x); + macaddr = vap ? vap->iv_myaddr : ic->ic_macaddr; + urtw_set_macaddr(sc, macaddr); + if (error) + goto fail; + error = urtw_set_mode(sc, URTW_EPROM_CMD_NORMAL); if (error) goto fail; @@ -3180,6 +3198,8 @@ static usb_error_t urtw_8225v2b_rf_init(struct urtw_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; + struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); + const uint8_t *macaddr; unsigned int i; uint8_t data8; usb_error_t error; @@ -3227,8 +3247,10 @@ urtw_8225v2b_rf_init(struct urtw_softc *sc) urtw_write8_m(sc, URTW_CONFIG1, data8); /* applying MAC address again. */ - urtw_write32_m(sc, URTW_MAC0, ((uint32_t *)ic->ic_macaddr)[0]); - urtw_write16_m(sc, URTW_MAC4, ((uint32_t *)ic->ic_macaddr)[1] & 0x); + macaddr = vap ? vap->iv_myaddr : ic->ic_macaddr; + error = urtw_set_macaddr(sc, macaddr); + if (error) + goto fail; error = urtw_set_mode(sc, URTW_EPROM_CMD_NORMAL); if (error) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.or
svn commit: r350885 - head/sys/dev/rtwn/pci
Author: avos Date: Mon Aug 12 08:01:21 2019 New Revision: 350885 URL: https://svnweb.freebsd.org/changeset/base/350885 Log: rtwn_pci: add device ID for RTL8192CE. PR: 239795 Submitted by: James Parsons MFC after:1 week Relnotes: yes Modified: head/sys/dev/rtwn/pci/rtwn_pci_attach.h Modified: head/sys/dev/rtwn/pci/rtwn_pci_attach.h == --- head/sys/dev/rtwn/pci/rtwn_pci_attach.h Mon Aug 12 05:25:40 2019 (r350884) +++ head/sys/dev/rtwn/pci/rtwn_pci_attach.h Mon Aug 12 08:01:21 2019 (r350885) @@ -35,6 +35,7 @@ struct rtwn_pci_ident { static const struct rtwn_pci_ident rtwn_pci_ident_table[] = { { 0x10ec, 0x8176, "Realtek RTL8188CE", RTWN_CHIP_RTL8192CE }, { 0x10ec, 0x8179, "Realtek RTL8188EE", RTWN_CHIP_RTL8188EE }, + { 0x10ec, 0x8178, "Realtek RTL8192CE", RTWN_CHIP_RTL8192CE }, { 0, 0, NULL, RTWN_CHIP_MAX_PCI } }; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r324656 - head/lib/libifconfig
Author: avos Date: Mon Oct 16 06:54:26 2017 New Revision: 324656 URL: https://svnweb.freebsd.org/changeset/base/324656 Log: libifconfig: allow to get original interface name via ifconfig_get_orig_name() Uses the same method as in tools/tools/ifinfo/ifinfo.c (via net.link.generic sysctl). Tested with modified wlandebug(8). Differential Revision:https://reviews.freebsd.org/D12554 Modified: head/lib/libifconfig/libifconfig.c head/lib/libifconfig/libifconfig.h Modified: head/lib/libifconfig/libifconfig.c == --- head/lib/libifconfig/libifconfig.c Mon Oct 16 04:46:28 2017 (r324655) +++ head/lib/libifconfig/libifconfig.c Mon Oct 16 06:54:26 2017 (r324656) @@ -61,9 +61,43 @@ * $FreeBSD$ */ + /* + * Copyright 1996 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that both the above copyright notice and this + * permission notice appear in all copies, that both the above + * copyright notice and this permission notice appear in all + * supporting documentation, and that the name of M.I.T. not be used + * in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. M.I.T. makes + * no representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS + * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT + * SHALL M.I.T. 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. + * + * $FreeBSD$ + */ + +#include #include +#include #include +#include #include #include @@ -245,6 +279,67 @@ ifconfig_set_name(ifconfig_handle_t *h, const char *na free(tmpname); return (0); +} + +int +ifconfig_get_orig_name(ifconfig_handle_t *h, const char *ifname, +char **orig_name) +{ + struct ifmibdata ifmd; + size_t len; + int name[6]; + int i, maxifno; + + name[0] = CTL_NET; + name[1] = PF_LINK; + name[2] = NETLINK_GENERIC; + name[3] = IFMIB_SYSTEM; + name[4] = IFMIB_IFCOUNT; + + len = sizeof maxifno; + if (sysctl(name, 5, &maxifno, &len, 0, 0) < 0) { + h->error.errtype = OTHER; + h->error.errcode = errno; + return (-1); + } + + name[3] = IFMIB_IFDATA; + name[5] = IFDATA_GENERAL; + for (i = 1; i <= maxifno; i++) { + len = sizeof ifmd; + name[4] = i; + if (sysctl(name, 6, &ifmd, &len, 0, 0) < 0) { + if (errno == ENOENT) + continue; + + goto fail; + } + + if (strncmp(ifmd.ifmd_name, ifname, IFNAMSIZ) != 0) + continue; + + len = 0; + name[5] = IFDATA_DRIVERNAME; + if (sysctl(name, 6, NULL, &len, 0, 0) < 0) + goto fail; + + *orig_name = malloc(len); + if (*orig_name == NULL) + goto fail; + + if (sysctl(name, 6, *orig_name, &len, 0, 0) < 0) { + free(*orig_name); + *orig_name = NULL; + goto fail; + } + + return (0); + } + +fail: + h->error.errtype = OTHER; + h->error.errcode = (i <= maxifno) ? errno : ENOENT; + return (-1); } int Modified: head/lib/libifconfig/libifconfig.h == --- head/lib/libifconfig/libifconfig.h Mon Oct 16 04:46:28 2017 (r324655) +++ head/lib/libifconfig/libifconfig.h Mon Oct 16 06:54:26 2017 (r324656) @@ -82,6 +82,8 @@ int ifconfig_set_description(ifconfig_handle_t *h, con int ifconfig_unset_description(ifconfig_handle_t *h, const char *name); int ifconfig_set_name(ifconfig_handle_t *h, const char *name, const char *newname); +int ifconfig_get_orig_name(ifconfig_handle_t *h, const char *ifname, +char **orig_name); int ifconfig_set_mtu(ifconfig_handle_t *h, const char *name, const int mtu); int ifco
svn commit: r324657 - head/usr.sbin/wlandebug
Author: avos Date: Mon Oct 16 07:01:27 2017 New Revision: 324657 URL: https://svnweb.freebsd.org/changeset/base/324657 Log: wlandebug(8): obtain original interface name via ifconfig_get_orig_name() Modified: head/usr.sbin/wlandebug/Makefile head/usr.sbin/wlandebug/wlandebug.c Modified: head/usr.sbin/wlandebug/Makefile == --- head/usr.sbin/wlandebug/MakefileMon Oct 16 06:54:26 2017 (r324656) +++ head/usr.sbin/wlandebug/MakefileMon Oct 16 07:01:27 2017 (r324657) @@ -3,6 +3,8 @@ PROG= wlandebug MAN= wlandebug.8 +LIBADD+= ifconfig + WARNS?=2 .include Modified: head/usr.sbin/wlandebug/wlandebug.c == --- head/usr.sbin/wlandebug/wlandebug.c Mon Oct 16 06:54:26 2017 (r324656) +++ head/usr.sbin/wlandebug/wlandebug.c Mon Oct 16 07:01:27 2017 (r324657) @@ -43,6 +43,8 @@ #include #include +#include + #defineN(a)(sizeof(a)/sizeof(a[0])) const char *progname; @@ -160,6 +162,21 @@ setoid(char oid[], size_t oidlen, const char *wlan) #endif } +static void +get_orig_iface_name(char *oid, size_t oid_size, char *name) +{ + struct ifconfig_handle *h; + char *orig_name; + + h = ifconfig_open(); + if (ifconfig_get_orig_name(h, name, &orig_name) < 0) + errc(1, ifconfig_err_errno(h), "cannot get interface name"); + + ifconfig_close(h); + setoid(oid, oid_size, orig_name); + free(orig_name); +} + int main(int argc, char *argv[]) { @@ -179,9 +196,7 @@ main(int argc, char *argv[]) } else if (strcmp(argv[1], "-i") == 0) { if (argc <= 2) errx(1, "missing interface name for -i option"); - if (strncmp(argv[2], "wlan", 4) != 0) - errx(1, "expecting a wlan interface name"); - setoid(oid, sizeof(oid), argv[2]); + get_orig_iface_name(oid, sizeof(oid), argv[2]); argc -= 2, argv += 2; } else if (strcmp(argv[1], "-?") == 0) usage(); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r324658 - head/usr.sbin/wlandebug
Author: avos Date: Mon Oct 16 07:15:50 2017 New Revision: 324658 URL: https://svnweb.freebsd.org/changeset/base/324658 Log: wlandebug(8): add a sanity check. Modified: head/usr.sbin/wlandebug/wlandebug.c Modified: head/usr.sbin/wlandebug/wlandebug.c == --- head/usr.sbin/wlandebug/wlandebug.c Mon Oct 16 07:01:27 2017 (r324657) +++ head/usr.sbin/wlandebug/wlandebug.c Mon Oct 16 07:15:50 2017 (r324658) @@ -172,6 +172,9 @@ get_orig_iface_name(char *oid, size_t oid_size, char * if (ifconfig_get_orig_name(h, name, &orig_name) < 0) errc(1, ifconfig_err_errno(h), "cannot get interface name"); + if (strlen(orig_name) < strlen("wlan") + 1) + errx(1, "expecting a wlan interface name"); + ifconfig_close(h); setoid(oid, oid_size, orig_name); free(orig_name); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r324656 - head/lib/libifconfig
Mon, 16 Oct 2017 19:06:55 +0300 було написано Alan Somers : On Mon, Oct 16, 2017 at 12:54 AM, Andriy Voskoboinyk wrote: Author: avos Date: Mon Oct 16 06:54:26 2017 New Revision: 324656 URL: https://svnweb.freebsd.org/changeset/base/324656 Log: libifconfig: allow to get original interface name via ifconfig_get_orig_name() Uses the same method as in tools/tools/ifinfo/ifinfo.c (via net.link.generic sysctl). Tested with modified wlandebug(8). Differential Revision:https://reviews.freebsd.org/D12554 Modified: head/lib/libifconfig/libifconfig.c head/lib/libifconfig/libifconfig.h The original author of libifconfig keeps her work at Github. To reduce divergence, we should submit changes there first, or else convince her to start using our SVN repository. Did you at least ask her for review? https://github.com/savagedlight/libifconfig It was placed at https://github.com/Savagedlight/libifconfig/pull/52; should I back this change out until it will be reviewed? -Alan ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r324672 - head/sys/net
Author: avos Date: Mon Oct 16 21:21:31 2017 New Revision: 324672 URL: https://svnweb.freebsd.org/changeset/base/324672 Log: ifnet(9): split ifc_alloc_unit() (should simplify code flow) Allocate smallest unit number from pool via ifc_alloc_unit_next() and exact unit number (if available) via ifc_alloc_unit_specific(). While here, address possible deadlock (mentioned in PR). PR: 217401 MFC after:5 days Differential Revision:https://reviews.freebsd.org/D12551 Modified: head/sys/net/if_clone.c Modified: head/sys/net/if_clone.c == --- head/sys/net/if_clone.c Mon Oct 16 20:21:51 2017(r324671) +++ head/sys/net/if_clone.c Mon Oct 16 21:21:31 2017(r324672) @@ -595,44 +595,56 @@ ifc_name2unit(const char *name, int *unit) return (0); } -int -ifc_alloc_unit(struct if_clone *ifc, int *unit) +static int +ifc_alloc_unit_specific(struct if_clone *ifc, int *unit) { char name[IFNAMSIZ]; - int wildcard; - wildcard = (*unit < 0); -retry: if (*unit > ifc->ifc_maxunit) return (ENOSPC); - if (*unit < 0) { - *unit = alloc_unr(ifc->ifc_unrhdr); - if (*unit == -1) - return (ENOSPC); - } else { - *unit = alloc_unr_specific(ifc->ifc_unrhdr, *unit); - if (*unit == -1) { - if (wildcard) { - (*unit)++; - goto retry; - } else - return (EEXIST); - } - } + if (alloc_unr_specific(ifc->ifc_unrhdr, *unit) == -1) + return (EEXIST); + snprintf(name, IFNAMSIZ, "%s%d", ifc->ifc_name, *unit); if (ifunit(name) != NULL) { free_unr(ifc->ifc_unrhdr, *unit); - if (wildcard) { - (*unit)++; - goto retry; - } else - return (EEXIST); + return (EEXIST); } IF_CLONE_ADDREF(ifc); return (0); +} + +static int +ifc_alloc_unit_next(struct if_clone *ifc, int *unit) +{ + int error; + + *unit = alloc_unr(ifc->ifc_unrhdr); + if (*unit == -1) + return (ENOSPC); + + free_unr(ifc->ifc_unrhdr, *unit); + for (;;) { + error = ifc_alloc_unit_specific(ifc, unit); + if (error != EEXIST) + break; + + (*unit)++; + } + + return (error); +} + +int +ifc_alloc_unit(struct if_clone *ifc, int *unit) +{ + if (*unit < 0) + return (ifc_alloc_unit_next(ifc, unit)); + else + return (ifc_alloc_unit_specific(ifc, unit)); } void ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r324673 - head/sys/kern
Author: avos Date: Mon Oct 16 21:46:11 2017 New Revision: 324673 URL: https://svnweb.freebsd.org/changeset/base/324673 Log: mbuf(9): unbreak m_fragment() - Fix it by replacing m_cat() with m_prev->m_next = m_new (m_cat() will try to append data - as a result, there will be no fragmentation). - Move some constants out of the loop. Was previously tested with D4077. Differential Revision:https://reviews.freebsd.org/D4090 Modified: head/sys/kern/uipc_mbuf.c Modified: head/sys/kern/uipc_mbuf.c == --- head/sys/kern/uipc_mbuf.c Mon Oct 16 21:21:31 2017(r324672) +++ head/sys/kern/uipc_mbuf.c Mon Oct 16 21:46:11 2017(r324673) @@ -1449,62 +1449,59 @@ bad: struct mbuf * m_fragment(struct mbuf *m0, int how, int length) { - struct mbuf *m_new = NULL, *m_final = NULL; - int progress = 0; + struct mbuf *m_first, *m_last; + int divisor = 255, progress = 0, fraglen; if (!(m0->m_flags & M_PKTHDR)) return (m0); - if ((length == 0) || (length < -2)) + if (length == 0 || length < -2) return (m0); + if (length > MCLBYTES) + length = MCLBYTES; + if (length < 0 && divisor > MCLBYTES) + divisor = MCLBYTES; + if (length == -1) + length = 1 + (arc4random() % divisor); + if (length > 0) + fraglen = length; m_fixhdr(m0); /* Needed sanity check */ - m_final = m_getcl(how, MT_DATA, M_PKTHDR); - - if (m_final == NULL) + m_first = m_getcl(how, MT_DATA, M_PKTHDR); + if (m_first == NULL) goto nospace; - if (m_dup_pkthdr(m_final, m0, how) == 0) + if (m_dup_pkthdr(m_first, m0, how) == 0) goto nospace; - m_new = m_final; + m_last = m_first; - if (length == -1) - length = 1 + (arc4random() & 255); - while (progress < m0->m_pkthdr.len) { - int fraglen; - - if (length > 0) - fraglen = length; - else - fraglen = 1 + (arc4random() & 255); + if (length == -2) + fraglen = 1 + (arc4random() % divisor); if (fraglen > m0->m_pkthdr.len - progress) fraglen = m0->m_pkthdr.len - progress; - if (fraglen > MCLBYTES) - fraglen = MCLBYTES; - - if (m_new == NULL) { - m_new = m_getcl(how, MT_DATA, 0); + if (progress != 0) { + struct mbuf *m_new = m_getcl(how, MT_DATA, 0); if (m_new == NULL) goto nospace; + + m_last->m_next = m_new; + m_last = m_new; } - m_copydata(m0, progress, fraglen, mtod(m_new, caddr_t)); + m_copydata(m0, progress, fraglen, mtod(m_last, caddr_t)); progress += fraglen; - m_new->m_len = fraglen; - if (m_new != m_final) - m_cat(m_final, m_new); - m_new = NULL; + m_last->m_len = fraglen; } m_freem(m0); - m0 = m_final; + m0 = m_first; return (m0); nospace: - if (m_final) - m_freem(m_final); + if (m_first) + m_freem(m_first); /* Return the original chain on failure */ return (m0); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r324656 - head/lib/libifconfig
On Mon, Oct 16, 2017 at 06:54:26AM +, Andriy Voskoboinyk wrote: Author: avos Date: Mon Oct 16 06:54:26 2017 New Revision: 324656 URL: https://svnweb.freebsd.org/changeset/base/324656 Log: libifconfig: allow to get original interface name via ifconfig_get_orig_name() Uses the same method as in tools/tools/ifinfo/ifinfo.c (via net.link.generic sysctl). Tested with modified wlandebug(8). Differential Revision:https://reviews.freebsd.org/D12554 Modified: head/lib/libifconfig/libifconfig.c head/lib/libifconfig/libifconfig.h Modified: head/lib/libifconfig/libifconfig.c == --- head/lib/libifconfig/libifconfig.c Mon Oct 16 04:46:28 2017 (r324655) +++ head/lib/libifconfig/libifconfig.c Mon Oct 16 06:54:26 2017 (r324656) @@ -61,9 +61,43 @@ * $FreeBSD$ */ + /* + * Copyright 1996 Massachusetts Institute of Technology + * 1996? This file was already under a BSD license, why adding an extra MIT license to it? It would be better to keep it under BSD license imho This one came unchanged from tools/tools/ifinfo/ifinfo.c (with modified code from it); I'm not sure if it can be just omitted. Best regards, Bapt ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r324673 - head/sys/kern
Tue, 17 Oct 2017 00:53:28 +0300 було написано Bryan Drewery : On 10/16/2017 2:46 PM, Andriy Voskoboinyk wrote: Author: avos Date: Mon Oct 16 21:46:11 2017 New Revision: 324673 URL: https://svnweb.freebsd.org/changeset/base/324673 Log: mbuf(9): unbreak m_fragment() How was it broken Due to m_cat() usage reason (as described below); this part was not changed since function creation in r119644. and since when? No idea here - probably, it was partially working until m_cat() improvement in r242256. P.S. Just checked with m_fragment(m, M_NOWAIT, -2) placed right before ieee80211_mbuf_defrag() (from D4077) and various m_len printf's before and after - it defragments frames before this change and works as intended after it. - Fix it by replacing m_cat() with m_prev->m_next = m_new (m_cat() will try to append data - as a result, there will be no fragmentation). - Move some constants out of the loop. Was previously tested with D4077. Differential Revision:https://reviews.freebsd.org/D4090 ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r325137 - in head/sys/dev: rtwn/usb usb
Author: avos Date: Mon Oct 30 08:57:08 2017 New Revision: 325137 URL: https://svnweb.freebsd.org/changeset/base/325137 Log: rtwn_usb(4): add few USB IDs. Submitted by: wfpo...@yandex.ru (via github). Modified: head/sys/dev/rtwn/usb/rtwn_usb_attach.h head/sys/dev/usb/usbdevs Modified: head/sys/dev/rtwn/usb/rtwn_usb_attach.h == --- head/sys/dev/rtwn/usb/rtwn_usb_attach.h Mon Oct 30 08:56:39 2017 (r325136) +++ head/sys/dev/rtwn/usb/rtwn_usb_attach.h Mon Oct 30 08:57:08 2017 (r325137) @@ -137,6 +137,8 @@ static const STRUCT_USB_HOST_ID rtwn_devs[] = { RTWN_RTL8812AU_DEV(SENAO, EUB1200AC), RTWN_RTL8812AU_DEV(SITECOMEU, WLA7100), RTWN_RTL8812AU_DEV(TPLINK, T4U), + RTWN_RTL8812AU_DEV(TPLINK, T4UV2), + RTWN_RTL8812AU_DEV(TPLINK, T4UHV2), RTWN_RTL8812AU_DEV(TRENDNET,TEW805UB), RTWN_RTL8812AU_DEV(ZYXEL, NWD6605), #undef RTWN_RTL8812AU_DEV Modified: head/sys/dev/usb/usbdevs == --- head/sys/dev/usb/usbdevsMon Oct 30 08:56:39 2017(r325136) +++ head/sys/dev/usb/usbdevsMon Oct 30 08:57:08 2017(r325137) @@ -4537,6 +4537,8 @@ product TOSHIBA TRANSMEMORY 0x6545 USB ThumbDrive product TPLINK T4U 0x0101 Archer T4U product TPLINK WN822NV40x0108 TL-WN822N v4 product TPLINK WN823NV20x0109 TL-WN823N v2 +product TPLINK T4UV2 0x010d Archer T4U ver 2 +product TPLINK T4UHV2 0x010e Archer T4UH ver 2 /* Trek Technology products */ product TREK THUMBDRIVE0x ThumbDrive ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r325252 - head/etc/devd
Author: avos Date: Tue Oct 31 23:33:24 2017 New Revision: 325252 URL: https://svnweb.freebsd.org/changeset/base/325252 Log: Regenerate etc/devd/usb.conf Reminded by: hselasky Modified: head/etc/devd/usb.conf Modified: head/etc/devd/usb.conf == --- head/etc/devd/usb.conf Tue Oct 31 23:17:17 2017(r325251) +++ head/etc/devd/usb.conf Tue Oct 31 23:33:24 2017(r325252) @@ -1401,6 +1401,14 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x067b"; + match "product" "0x27a1"; + action "kldload -n udbp"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x067b"; match "product" "(0x331a|0xaaa0|0xaaa2)"; action "kldload -n uplcom"; }; @@ -5313,7 +5321,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x2357"; - match "product" "(0x0101|0x0108|0x0109)"; + match "product" "(0x0101|0x0108|0x0109|0x010d|0x010e)"; action "kldload -n if_rtwn_usb"; }; @@ -5913,5 +5921,5 @@ nomatch 32 { action "kldload -n umass"; }; -# 2757 USB entries processed +# 2760 USB entries processed ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r325303 - head/sys/dev/usb/wlan
Author: avos Date: Thu Nov 2 00:17:52 2017 New Revision: 325303 URL: https://svnweb.freebsd.org/changeset/base/325303 Log: rsu(4): trim code for Rx rate calculation. Include ridx <-> rate conversion functions from rtwn(4) + reuse already calculated value for ieee80211_radiotap(9). Tested with Asus USB-N10, STA mode. Modified: head/sys/dev/usb/wlan/if_rsu.c Modified: head/sys/dev/usb/wlan/if_rsu.c == --- head/sys/dev/usb/wlan/if_rsu.c Wed Nov 1 23:20:04 2017 (r325302) +++ head/sys/dev/usb/wlan/if_rsu.c Thu Nov 2 00:17:52 2017 (r325303) @@ -68,8 +68,11 @@ __FBSDID("$FreeBSD$"); #include #include "usbdevs.h" +#include /* XXX */ #include +#define RSU_RATE_IS_CCKRTWN_RATE_IS_CCK + #ifdef USB_DEBUG static int rsu_debug = 0; SYSCTL_NODE(_hw_usb, OID_AUTO, rsu, CTLFLAG_RW, 0, "USB rsu"); @@ -2382,44 +2385,6 @@ rsu_rx_frame(struct rsu_softc *sc, struct mbuf *m) rssi = rsu_hwrssi_to_rssi(sc, sc->sc_currssi); } - if (ieee80211_radiotap_active(ic)) { - struct rsu_rx_radiotap_header *tap = &sc->sc_rxtap; - - /* Map HW rate index to 802.11 rate. */ - tap->wr_flags = 0; /* TODO */ - tap->wr_tsft = rsu_get_tsf_high(sc); - if (le32toh(stat->tsf_low) > rsu_get_tsf_low(sc)) - tap->wr_tsft--; - tap->wr_tsft = (uint64_t)htole32(tap->wr_tsft) << 32; - tap->wr_tsft += stat->tsf_low; - - if (rate < 12) { - switch (rate) { - /* CCK. */ - case 0: tap->wr_rate = 2; break; - case 1: tap->wr_rate = 4; break; - case 2: tap->wr_rate = 11; break; - case 3: tap->wr_rate = 22; break; - /* OFDM. */ - case 4: tap->wr_rate = 12; break; - case 5: tap->wr_rate = 18; break; - case 6: tap->wr_rate = 24; break; - case 7: tap->wr_rate = 36; break; - case 8: tap->wr_rate = 48; break; - case 9: tap->wr_rate = 72; break; - case 10: tap->wr_rate = 96; break; - case 11: tap->wr_rate = 108; break; - } - } else {/* MCS0~15. */ - /* Bit 7 set means HT MCS instead of rate. */ - tap->wr_rate = 0x80 | (rate - 12); - } - - tap->wr_dbm_antsignal = rssi; - tap->wr_chan_freq = htole16(ic->ic_curchan->ic_freq); - tap->wr_chan_flags = htole16(ic->ic_curchan->ic_flags); - }; - /* Hardware does Rx TCP checksum offload. */ /* * This flag can be set for some other @@ -2465,64 +2430,33 @@ rsu_rx_frame(struct rsu_softc *sc, struct mbuf *m) rxs.c_nf = -96; /* Rate */ - if (!(rxdw3 & R92S_RXDW3_HTC)) { - switch (rate) { - /* CCK. */ - case 0: - rxs.c_rate = 2; + if (rate < 12) { + rxs.c_rate = ridx2rate[rate]; + if (RSU_RATE_IS_CCK(rate)) rxs.c_pktflags |= IEEE80211_RX_F_CCK; - break; - case 1: - rxs.c_rate = 4; - rxs.c_pktflags |= IEEE80211_RX_F_CCK; - break; - case 2: - rxs.c_rate = 11; - rxs.c_pktflags |= IEEE80211_RX_F_CCK; - break; - case 3: - rxs.c_rate = 22; - rxs.c_pktflags |= IEEE80211_RX_F_CCK; - break; - /* OFDM. */ - case 4: - rxs.c_rate = 12; + else rxs.c_pktflags |= IEEE80211_RX_F_OFDM; - break; - case 5: - rxs.c_rate = 18; - rxs.c_pktflags |= IEEE80211_RX_F_OFDM; - break; - case 6: - rxs.c_rate = 24; - rxs.c_pktflags |= IEEE80211_RX_F_OFDM; - break; - case 7: - rxs.c_rate = 36; - rxs.c_pktflags |= IEEE80211_RX_F_OFDM; - break; - case 8: - rxs.c_rate = 48; - rxs.c_pktflags |= IEEE80211_RX_F_OFDM; - break; - case 9: - rxs.c_rate = 72; - rxs.c_pktflags |= IEEE80211_RX_F_OFDM; - break; - case
svn commit: r325349 - head/usr.sbin/pmcstat
Author: avos Date: Fri Nov 3 00:12:32 2017 New Revision: 325349 URL: https://svnweb.freebsd.org/changeset/base/325349 Log: pmcstat(8): unbreak build with LDFLAGS+=-Wl,--as-needed libpmcstat.a requires libelf.so; reorder them accordingly. Modified: head/usr.sbin/pmcstat/Makefile Modified: head/usr.sbin/pmcstat/Makefile == --- head/usr.sbin/pmcstat/Makefile Thu Nov 2 23:00:04 2017 (r325348) +++ head/usr.sbin/pmcstat/Makefile Fri Nov 3 00:12:32 2017 (r325349) @@ -5,7 +5,7 @@ PROG= pmcstat MAN= pmcstat.8 -LIBADD=elf kvm pmc m ncursesw pmcstat +LIBADD=kvm pmc m ncursesw pmcstat elf SRCS= pmcstat.c pmcstat.h pmcstat_log.c \ pmcpl_callgraph.c pmcpl_gprof.c pmcpl_annotate.c \ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326000 - head/usr.sbin/wlandebug
Author: avos Date: Sun Nov 19 20:13:11 2017 New Revision: 326000 URL: https://svnweb.freebsd.org/changeset/base/326000 Log: wlandebug(8): allow fallback to old behavior + improve name checks. - Treat passed interface name as original if ifconfig_get_orig_name() fails. - Reject interface name if it does not start from "wlan". Modified: head/usr.sbin/wlandebug/wlandebug.c Modified: head/usr.sbin/wlandebug/wlandebug.c == --- head/usr.sbin/wlandebug/wlandebug.c Sun Nov 19 12:36:03 2017 (r325999) +++ head/usr.sbin/wlandebug/wlandebug.c Sun Nov 19 20:13:11 2017 (r326000) @@ -169,15 +169,19 @@ get_orig_iface_name(char *oid, size_t oid_size, char * char *orig_name; h = ifconfig_open(); - if (ifconfig_get_orig_name(h, name, &orig_name) < 0) - errc(1, ifconfig_err_errno(h), "cannot get interface name"); + if (ifconfig_get_orig_name(h, name, &orig_name) < 0) { + /* check for original interface name. */ + orig_name = name; + } - if (strlen(orig_name) < strlen("wlan") + 1) + if (strlen(orig_name) < strlen("wlan") + 1 || + strncmp(orig_name, "wlan", 4) != 0) errx(1, "expecting a wlan interface name"); ifconfig_close(h); setoid(oid, oid_size, orig_name); - free(orig_name); + if (orig_name != name) + free(orig_name); } int ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326001 - head/etc
Author: avos Date: Sun Nov 19 20:18:21 2017 New Revision: 326001 URL: https://svnweb.freebsd.org/changeset/base/326001 Log: Reduce code duplication for wlan(4) interface creation in network.subr. Since wlandebug(8) can accept any (original or changed) interface name this part may be simplified a bit. Modified: head/etc/network.subr Modified: head/etc/network.subr == --- head/etc/network.subr Sun Nov 19 20:13:11 2017(r326000) +++ head/etc/network.subr Sun Nov 19 20:18:21 2017(r326001) @@ -1270,22 +1270,14 @@ wlan_up() fi if expr $child : 'wlan[0-9][0-9]*$' >/dev/null 2>&1; then ${IFCONFIG_CMD} $child create ${create_args} && cfg=0 - if [ $? -eq 0 ]; then - _list="$_list $child" - fi - if [ -n "${debug_flags}" ]; then - wlandebug -i $child ${debug_flags} - fi else - i=`${IFCONFIG_CMD} wlan create ${create_args}` - # XXXGL: wlandebug should accept any name - if [ -n "${debug_flags}" ]; then - wlandebug -i $i ${debug_flags} - fi - ${IFCONFIG_CMD} $i name $child && cfg=0 - if [ $? -eq 0 ]; then - _list="$_list $child" - fi + ${IFCONFIG_CMD} wlan create ${create_args} name $child && cfg=0 + fi + if [ $? -eq 0 ]; then + _list="$_list $child" + fi + if [ -n "${debug_flags}" ]; then + wlandebug -i $child ${debug_flags} fi done done ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r345252 - head/sys/net80211
Author: avos Date: Mon Mar 18 02:40:22 2019 New Revision: 345252 URL: https://svnweb.freebsd.org/changeset/base/345252 Log: net80211: correct check for SMPS node flags updates Update node flags when driver supports SMPS, not when it is disabled or in dynamic mode ((iv_htcaps & HTCAP_SMPS) != 0). Checked with RTL8188EE (1T1R), STA mode - 'smps' word should disappear from 'ifconfig wlan0' output. MFC after:2 weeks Modified: head/sys/net80211/ieee80211_ht.c Modified: head/sys/net80211/ieee80211_ht.c == --- head/sys/net80211/ieee80211_ht.cSun Mar 17 22:26:50 2019 (r345251) +++ head/sys/net80211/ieee80211_ht.cMon Mar 18 02:40:22 2019 (r345252) @@ -1727,7 +1727,7 @@ ieee80211_ht_updateparams(struct ieee80211_node *ni, const struct ieee80211_ie_htinfo *htinfo; ieee80211_parse_htcap(ni, htcapie); - if (vap->iv_htcaps & IEEE80211_HTCAP_SMPS) + if (vap->iv_htcaps & IEEE80211_HTC_SMPS) htcap_update_mimo_ps(ni); htcap_update_shortgi(ni); htcap_update_ldpc(ni); @@ -1880,7 +1880,7 @@ ieee80211_ht_updatehtcap(struct ieee80211_node *ni, co struct ieee80211vap *vap = ni->ni_vap; ieee80211_parse_htcap(ni, htcapie); - if (vap->iv_htcaps & IEEE80211_HTCAP_SMPS) + if (vap->iv_htcaps & IEEE80211_HTC_SMPS) htcap_update_mimo_ps(ni); htcap_update_shortgi(ni); htcap_update_ldpc(ni); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r345318 - head/usr.bin/lockf
Author: avos Date: Wed Mar 20 07:40:38 2019 New Revision: 345318 URL: https://svnweb.freebsd.org/changeset/base/345318 Log: lockf(1): return EX_UNAVAILABLE if -n is used and the lock file does not exist Apply EX_UNAVAILABLE patch part from PR 170775 to match the documentation. Checked with a command from PR 210770: lockf -n /tmp/doesnotexist echo; echo $? PR: 210770 MFC after:1 week Modified: head/usr.bin/lockf/lockf.c Modified: head/usr.bin/lockf/lockf.c == --- head/usr.bin/lockf/lockf.c Wed Mar 20 07:24:21 2019(r345317) +++ head/usr.bin/lockf/lockf.c Wed Mar 20 07:40:38 2019(r345318) @@ -174,6 +174,8 @@ acquire_lock(const char *name, int flags) if ((fd = open(name, O_RDONLY|O_EXLOCK|flags, 0666)) == -1) { if (errno == EAGAIN || errno == EINTR) return (-1); + else if (errno == ENOENT && (flags & O_CREAT) == 0) + err(EX_UNAVAILABLE, "%s", name); err(EX_CANTCREAT, "cannot open %s", name); } return (fd); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r345493 - head/sys/dev/usb/wlan
Author: avos Date: Mon Mar 25 09:10:07 2019 New Revision: 345493 URL: https://svnweb.freebsd.org/changeset/base/345493 Log: run(4): merge some common TSF-related code into run_disable_tsf() No functional change intended. MFC after:5 days Modified: head/sys/dev/usb/wlan/if_run.c Modified: head/sys/dev/usb/wlan/if_run.c == --- head/sys/dev/usb/wlan/if_run.c Mon Mar 25 07:48:52 2019 (r345492) +++ head/sys/dev/usb/wlan/if_run.c Mon Mar 25 09:10:07 2019 (r345493) @@ -464,6 +464,7 @@ static void run_usb_timeout_cb(void *); static voidrun_reset_livelock(struct run_softc *); static voidrun_enable_tsf_sync(struct run_softc *); static voidrun_enable_tsf(struct run_softc *); +static voidrun_disable_tsf(struct run_softc *); static voidrun_get_tsf(struct run_softc *, uint64_t *); static voidrun_enable_mrr(struct run_softc *); static voidrun_set_txpreamble(struct run_softc *); @@ -2090,7 +2091,6 @@ run_newstate(struct ieee80211vap *vap, enum ieee80211_ struct run_vap *rvp = RUN_VAP(vap); enum ieee80211_state ostate; uint32_t sta[3]; - uint32_t tmp; uint8_t ratectl; uint8_t restart_ratectl = 0; uint8_t bid = 1 << rvp->rvp_id; @@ -2123,12 +2123,8 @@ run_newstate(struct ieee80211vap *vap, enum ieee80211_ 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 | - RT2860_TBTT_TIMER_EN)); - } + if (--sc->running == 0) + run_disable_tsf(sc); break; case IEEE80211_S_RUN: @@ -4863,15 +4859,11 @@ static void run_scan_start(struct ieee80211com *ic) { struct run_softc *sc = ic->ic_softc; - uint32_t tmp; RUN_LOCK(sc); /* abort TSF synchronization */ - run_read(sc, RT2860_BCN_TIME_CFG, &tmp); - run_write(sc, RT2860_BCN_TIME_CFG, - tmp & ~(RT2860_BCN_TX_EN | RT2860_TSF_TIMER_EN | - RT2860_TBTT_TIMER_EN)); + run_disable_tsf(sc); run_set_bssid(sc, ieee80211broadcastaddr); RUN_UNLOCK(sc); @@ -5158,6 +5150,18 @@ run_enable_tsf(struct run_softc *sc) } static void +run_disable_tsf(struct run_softc *sc) +{ + uint32_t tmp; + + if (run_read(sc, RT2860_BCN_TIME_CFG, &tmp) == 0) { + tmp &= ~(RT2860_BCN_TX_EN | RT2860_TSF_TIMER_EN | + RT2860_TBTT_TIMER_EN); + run_write(sc, RT2860_BCN_TIME_CFG, tmp); + } +} + +static void run_get_tsf(struct run_softc *sc, uint64_t *buf) { run_read_region_1(sc, RT2860_TSF_TIMER_DW0, (uint8_t *)buf, @@ -6108,10 +6112,7 @@ run_init_locked(struct run_softc *sc) } /* abort TSF synchronization */ - run_read(sc, RT2860_BCN_TIME_CFG, &tmp); - tmp &= ~(RT2860_BCN_TX_EN | RT2860_TSF_TIMER_EN | - RT2860_TBTT_TIMER_EN); - run_write(sc, RT2860_BCN_TIME_CFG, tmp); + run_disable_tsf(sc); /* clear RX WCID search table */ run_set_region_4(sc, RT2860_WCID_ENTRY(0), 0, 512); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r345729 - head/sys/dev/usb/wlan
Author: avos Date: Sat Mar 30 09:24:06 2019 New Revision: 345729 URL: https://svnweb.freebsd.org/changeset/base/345729 Log: urtw(4): export TSF timestamp for received frames via radiotap Tested with Netgear WG111 v3 (RTL8187B), STA mode. MFC after:1 week Modified: head/sys/dev/usb/wlan/if_urtw.c head/sys/dev/usb/wlan/if_urtwvar.h Modified: head/sys/dev/usb/wlan/if_urtw.c == --- head/sys/dev/usb/wlan/if_urtw.c Sat Mar 30 07:29:20 2019 (r345728) +++ head/sys/dev/usb/wlan/if_urtw.c Sat Mar 30 09:24:06 2019 (r345729) @@ -3932,6 +3932,7 @@ urtw_rxeof(struct usb_xfer *xfer, struct urtw_data *da struct urtw_softc *sc = data->sc; struct ieee80211com *ic = &sc->sc_ic; uint8_t noise = 0, rate; + uint64_t mactime; usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL); @@ -3951,6 +3952,9 @@ urtw_rxeof(struct usb_xfer *xfer, struct urtw_data *da /* XXX correct? */ rssi = rx->rssi & URTW_RX_RSSI_MASK; noise = rx->noise; + + if (ieee80211_radiotap_active(ic)) + mactime = rx->mactime; } else { struct urtw_8187l_rxhdr *rx; @@ -3967,6 +3971,9 @@ urtw_rxeof(struct usb_xfer *xfer, struct urtw_data *da /* XXX correct? */ rssi = rx->rssi & URTW_RX_8187L_RSSI_MASK; noise = rx->noise; + + if (ieee80211_radiotap_active(ic)) + mactime = rx->mactime; } if (flen < IEEE80211_ACK_LEN) @@ -3986,6 +3993,7 @@ urtw_rxeof(struct usb_xfer *xfer, struct urtw_data *da if (ieee80211_radiotap_active(ic)) { struct urtw_rx_radiotap_header *tap = &sc->sc_rxtap; + tap->wr_tsf = mactime; tap->wr_flags = 0; tap->wr_dbm_antsignal = (int8_t)rssi; } Modified: head/sys/dev/usb/wlan/if_urtwvar.h == --- head/sys/dev/usb/wlan/if_urtwvar.h Sat Mar 30 07:29:20 2019 (r345728) +++ head/sys/dev/usb/wlan/if_urtwvar.h Sat Mar 30 09:24:06 2019 (r345729) @@ -55,6 +55,7 @@ typedef STAILQ_HEAD(, urtw_data) urtw_datahead; struct urtw_rx_radiotap_header { struct ieee80211_radiotap_header wr_ihdr; + uint64_twr_tsf; uint8_t wr_flags; uint8_t wr_pad; uint16_twr_chan_freq; @@ -63,7 +64,8 @@ struct urtw_rx_radiotap_header { } __packed __aligned(8); #define URTW_RX_RADIOTAP_PRESENT \ - ((1 << IEEE80211_RADIOTAP_FLAGS) | \ + ((1 << IEEE80211_RADIOTAP_TSFT) | \ +(1 << IEEE80211_RADIOTAP_FLAGS) | \ (1 << IEEE80211_RADIOTAP_CHANNEL) |\ (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL)) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r345751 - head/sys/dev/usb/wlan
Author: avos Date: Sun Mar 31 09:52:36 2019 New Revision: 345751 URL: https://svnweb.freebsd.org/changeset/base/345751 Log: uath(4), urtw(4): restart driver if device does not respond after Tx request MFC after:1 week Modified: head/sys/dev/usb/wlan/if_uath.c head/sys/dev/usb/wlan/if_urtw.c Modified: head/sys/dev/usb/wlan/if_uath.c == --- head/sys/dev/usb/wlan/if_uath.c Sun Mar 31 06:21:32 2019 (r345750) +++ head/sys/dev/usb/wlan/if_uath.c Sun Mar 31 09:52:36 2019 (r345751) @@ -1276,8 +1276,8 @@ uath_watchdog(void *arg) if (sc->sc_tx_timer > 0) { if (--sc->sc_tx_timer == 0) { device_printf(sc->sc_dev, "device timeout\n"); - /*uath_init(sc); XXX needs a process context! */ counter_u64_add(ic->ic_oerrors, 1); + ieee80211_restart_all(ic); return; } callout_reset(&sc->watchdog_ch, hz, uath_watchdog, sc); Modified: head/sys/dev/usb/wlan/if_urtw.c == --- head/sys/dev/usb/wlan/if_urtw.c Sun Mar 31 06:21:32 2019 (r345750) +++ head/sys/dev/usb/wlan/if_urtw.c Sun Mar 31 09:52:36 2019 (r345751) @@ -1891,11 +1891,13 @@ static void urtw_watchdog(void *arg) { struct urtw_softc *sc = arg; + struct ieee80211com *ic = &sc->sc_ic; if (sc->sc_txtimer > 0) { if (--sc->sc_txtimer == 0) { device_printf(sc->sc_dev, "device timeout\n"); - counter_u64_add(sc->sc_ic.ic_oerrors, 1); + counter_u64_add(ic->ic_oerrors, 1); + ieee80211_restart_all(ic); return; } callout_reset(&sc->sc_watchdog_ch, hz, urtw_watchdog, sc); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r345753 - head/sys/dev/usb/wlan
Author: avos Date: Sun Mar 31 13:41:20 2019 New Revision: 345753 URL: https://svnweb.freebsd.org/changeset/base/345753 Log: run(4): do not clear PROTECTED bit if frame was not decrypted by NIC. Tested with D-Link DWA-140 rev B3, STA / MONITOR modes. MFC after:1 week Modified: head/sys/dev/usb/wlan/if_run.c Modified: head/sys/dev/usb/wlan/if_run.c == --- head/sys/dev/usb/wlan/if_run.c Sun Mar 31 11:31:01 2019 (r345752) +++ head/sys/dev/usb/wlan/if_run.c Sun Mar 31 13:41:20 2019 (r345753) @@ -2865,8 +2865,8 @@ run_rx_frame(struct run_softc *sc, struct mbuf *m, uin wh = mtod(m, struct ieee80211_frame *); - /* XXX wrong for monitor mode */ - if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { + if ((wh->i_fc[1] & IEEE80211_FC1_PROTECTED) != 0 && + (flags & RT2860_RX_DEC) != 0) { wh->i_fc[1] &= ~IEEE80211_FC1_PROTECTED; m->m_flags |= M_WEP; } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r345754 - head/sys/dev/usb/wlan
Author: avos Date: Sun Mar 31 14:18:02 2019 New Revision: 345754 URL: https://svnweb.freebsd.org/changeset/base/345754 Log: run(4): properly set F_DATAPAD radiotap flag if frame has padding between frame header and data. This will fix 'Mysterious OLPC stuff' for received frames and wrong CCMP / TKIP / data decoding for transmitted frames in net/wireshark dissector. While here, drop unneeded comment - net80211 handles padding requirements for Tx & Rx without driver adjustment. Tested with D-Link DWA-140 rev B3, STA mode. MFC after:1 week Modified: head/sys/dev/usb/wlan/if_run.c Modified: head/sys/dev/usb/wlan/if_run.c == --- head/sys/dev/usb/wlan/if_run.c Sun Mar 31 13:41:20 2019 (r345753) +++ head/sys/dev/usb/wlan/if_run.c Sun Mar 31 14:18:02 2019 (r345754) @@ -2851,10 +2851,6 @@ run_rx_frame(struct run_softc *sc, struct mbuf *m, uin } if (flags & RT2860_RX_L2PAD) { - /* -* XXX OpenBSD removes padding between header -* and payload here... -*/ RUN_DPRINTF(sc, RUN_DEBUG_RECV, "received RT2860_RX_L2PAD frame\n"); len += 2; @@ -2896,6 +2892,8 @@ run_rx_frame(struct run_softc *sc, struct mbuf *m, uin uint16_t phy; tap->wr_flags = 0; + if (flags & RT2860_RX_L2PAD) + tap->wr_flags |= IEEE80211_RADIOTAP_F_DATAPAD; tap->wr_antsignal = rssi; tap->wr_antenna = ant; tap->wr_dbm_antsignal = run_rssi2dbm(sc, rssi, ant); @@ -3162,14 +3160,23 @@ tr_setup: vap = data->ni->ni_vap; if (ieee80211_radiotap_active_vap(vap)) { + const struct ieee80211_frame *wh; struct run_tx_radiotap_header *tap = &sc->sc_txtap; struct rt2860_txwi *txwi = (struct rt2860_txwi *)(&data->desc + sizeof(struct rt2870_txd)); + int has_l2pad; + + wh = mtod(m, struct ieee80211_frame *); + has_l2pad = IEEE80211_HAS_ADDR4(wh) != + IEEE80211_QOS_HAS_SEQ(wh); + tap->wt_flags = 0; tap->wt_rate = rt2860_rates[data->ridx].rate; tap->wt_hwqueue = index; if (le16toh(txwi->phy) & RT2860_PHY_SHPRE) tap->wt_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; + if (has_l2pad) + tap->wt_flags |= IEEE80211_RADIOTAP_F_DATAPAD; ieee80211_radiotap_tx(vap, m); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r346073 - in head/sys/dev: iwi otus usb/wlan
Author: avos Date: Wed Apr 10 08:17:56 2019 New Revision: 346073 URL: https://svnweb.freebsd.org/changeset/base/346073 Log: urtw(4), otus(4), iwi(4): allow to set non-default MAC address via ifconfig(8) Tested with Netgear WG111 v3 (RTL8187B, urtw(4)), STA mode. MFC after:1 week Modified: head/sys/dev/iwi/if_iwi.c head/sys/dev/otus/if_otus.c head/sys/dev/usb/wlan/if_urtw.c Modified: head/sys/dev/iwi/if_iwi.c == --- head/sys/dev/iwi/if_iwi.c Wed Apr 10 07:51:13 2019(r346072) +++ head/sys/dev/iwi/if_iwi.c Wed Apr 10 08:17:56 2019(r346073) @@ -2576,15 +2576,18 @@ static int iwi_config(struct iwi_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; + struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); struct iwi_configuration config; struct iwi_txpower power; + uint8_t *macaddr; uint32_t data; int error, i; IWI_LOCK_ASSERT(sc); - DPRINTF(("Setting MAC address to %6D\n", ic->ic_macaddr, ":")); - error = iwi_cmd(sc, IWI_CMD_SET_MAC_ADDRESS, ic->ic_macaddr, + macaddr = vap ? vap->iv_myaddr : ic->ic_macaddr; + DPRINTF(("Setting MAC address to %6D\n", macaddr, ":")); + error = iwi_cmd(sc, IWI_CMD_SET_MAC_ADDRESS, macaddr, IEEE80211_ADDR_LEN); if (error != 0) return error; Modified: head/sys/dev/otus/if_otus.c == --- head/sys/dev/otus/if_otus.c Wed Apr 10 07:51:13 2019(r346072) +++ head/sys/dev/otus/if_otus.c Wed Apr 10 08:17:56 2019(r346073) @@ -3108,7 +3108,7 @@ otus_set_operating_mode(struct otus_softc *sc) */ IEEE80211_ADDR_COPY(bssid, zero_macaddr); vap = TAILQ_FIRST(&ic->ic_vaps); - macaddr = ic->ic_macaddr; + macaddr = vap ? vap->iv_myaddr : ic->ic_macaddr; switch (ic->ic_opmode) { case IEEE80211_M_STA: Modified: head/sys/dev/usb/wlan/if_urtw.c == --- head/sys/dev/usb/wlan/if_urtw.c Wed Apr 10 07:51:13 2019 (r346072) +++ head/sys/dev/usb/wlan/if_urtw.c Wed Apr 10 08:17:56 2019 (r346073) @@ -752,6 +752,7 @@ static void urtw_free_tx_data_list(struct urtw_softc static voidurtw_free_rx_data_list(struct urtw_softc *); static voidurtw_free_data_list(struct urtw_softc *, struct urtw_data data[], int, int); +static usb_error_t urtw_set_macaddr(struct urtw_softc *, const uint8_t *); static usb_error_t urtw_adapter_start(struct urtw_softc *); static usb_error_t urtw_adapter_start_b(struct urtw_softc *); static usb_error_t urtw_set_mode(struct urtw_softc *, uint32_t); @@ -1187,9 +1188,23 @@ fail: } static usb_error_t +urtw_set_macaddr(struct urtw_softc *sc, const uint8_t *macaddr) +{ + usb_error_t error; + + urtw_write32_m(sc, URTW_MAC0, ((const uint32_t *)macaddr)[0]); + urtw_write16_m(sc, URTW_MAC4, ((const uint32_t *)macaddr)[1] & 0x); + +fail: + return (error); +} + +static usb_error_t urtw_adapter_start(struct urtw_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; + struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); + const uint8_t *macaddr; usb_error_t error; error = urtw_reset(sc); @@ -1209,8 +1224,11 @@ urtw_adapter_start(struct urtw_softc *sc) if (error) goto fail; /* applying MAC address again. */ - urtw_write32_m(sc, URTW_MAC0, ((uint32_t *)ic->ic_macaddr)[0]); - urtw_write16_m(sc, URTW_MAC4, ((uint32_t *)ic->ic_macaddr)[1] & 0x); + macaddr = vap ? vap->iv_myaddr : ic->ic_macaddr; + urtw_set_macaddr(sc, macaddr); + if (error) + goto fail; + error = urtw_set_mode(sc, URTW_EPROM_CMD_NORMAL); if (error) goto fail; @@ -3180,6 +3198,8 @@ static usb_error_t urtw_8225v2b_rf_init(struct urtw_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; + struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); + const uint8_t *macaddr; unsigned int i; uint8_t data8; usb_error_t error; @@ -3227,8 +3247,10 @@ urtw_8225v2b_rf_init(struct urtw_softc *sc) urtw_write8_m(sc, URTW_CONFIG1, data8); /* applying MAC address again. */ - urtw_write32_m(sc, URTW_MAC0, ((uint32_t *)ic->ic_macaddr)[0]); - urtw_write16_m(sc, URTW_MAC4, ((uint32_t *)ic->ic_macaddr)[1] & 0x); + macaddr = vap ? vap->iv_myaddr : ic->ic_macaddr; + error = urtw_set_macaddr(sc, macaddr); + if (error) + goto fail; error = urtw_set_mode(sc, URTW_EPROM_CMD_NORMAL); if (error) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/
svn commit: r315583 - head/sys/net80211
Author: avos Date: Sun Mar 19 20:05:21 2017 New Revision: 315583 URL: https://svnweb.freebsd.org/changeset/base/315583 Log: net80211: add a timer to flush fast-frames queues. This should allow to drop 'ieee80211_ff_[age/flush]' calls from drivers (an additional call can be made from ieee80211_tx_complete() for non-default ieee80211_ffagemax values to prevent stalls - but it will require an additional counter for transmitted frames). Tested with RTL8821AU, STA mode (A-MSDU part only). Reviewed by: adrian Differential Revision:https://reviews.freebsd.org/D9984 Modified: head/sys/net80211/ieee80211_superg.c head/sys/net80211/ieee80211_superg.h Modified: head/sys/net80211/ieee80211_superg.c == --- head/sys/net80211/ieee80211_superg.cSun Mar 19 20:04:57 2017 (r315582) +++ head/sys/net80211/ieee80211_superg.cSun Mar 19 20:05:21 2017 (r315583) @@ -94,6 +94,33 @@ SYSCTL_PROC(_net_wlan, OID_AUTO, ffagema &ieee80211_ffagemax, 0, ieee80211_sysctl_msecs_ticks, "I", "max hold time for fast-frame staging (ms)"); +static void +ff_age_all(void *arg, int npending) +{ + struct ieee80211com *ic = arg; + + /* XXX cache timer value somewhere (racy) */ + ieee80211_ff_age_all(ic, ieee80211_ffagemax + 1); +} + +static void +ff_check_cancel_age_timer(struct ieee80211com *ic) +{ + struct ieee80211_superg *sg = ic->ic_superg; + + IEEE80211_FF_LOCK_ASSERT(ic); + + if (sg->ff_stageq[WME_AC_VO].depth == 0 && + sg->ff_stageq[WME_AC_VI].depth == 0 && + sg->ff_stageq[WME_AC_BE].depth == 0 && + sg->ff_stageq[WME_AC_BK].depth == 0) { + struct timeout_task *qtask = &sg->ff_qtimer; + + /* NB: may be called from the task itself */ + (void) taskqueue_cancel_timeout(ic->ic_tq, qtask, NULL); + } +} + void ieee80211_superg_attach(struct ieee80211com *ic) { @@ -109,6 +136,7 @@ ieee80211_superg_attach(struct ieee80211 __func__); return; } + TIMEOUT_TASK_INIT(ic->ic_tq, &sg->ff_qtimer, 0, ff_age_all, ic); ic->ic_superg = sg; /* @@ -122,12 +150,16 @@ ieee80211_superg_attach(struct ieee80211 void ieee80211_superg_detach(struct ieee80211com *ic) { - IEEE80211_FF_LOCK_DESTROY(ic); if (ic->ic_superg != NULL) { + struct timeout_task *qtask = &ic->ic_superg->ff_qtimer; + + while (taskqueue_cancel_timeout(ic->ic_tq, qtask, NULL) != 0) + taskqueue_drain_timeout(ic->ic_tq, qtask); IEEE80211_FREE(ic->ic_superg, M_80211_VAP); ic->ic_superg = NULL; } + IEEE80211_FF_LOCK_DESTROY(ic); } void @@ -647,9 +679,10 @@ ieee80211_ff_age(struct ieee80211com *ic sq->head = m->m_nextpkt; sq->depth--; } - if (m == NULL) + if (m == NULL) { sq->tail = NULL; - else + ff_check_cancel_age_timer(ic); + } else M_AGE_SUB(m, quanta); IEEE80211_FF_UNLOCK(ic); @@ -668,8 +701,13 @@ stageq_add(struct ieee80211com *ic, stru if (sq->tail != NULL) { sq->tail->m_nextpkt = m; age -= M_AGE_GET(sq->head); - } else + } else { sq->head = m; + + /* Do not restart the timer if task was already scheduled. */ + struct timeout_task *qtask = &ic->ic_superg->ff_qtimer; + taskqueue_enqueue_timeout(ic->ic_tq, qtask, -age); + } KASSERT(age >= 0, ("age %d", age)); M_AGE_SET(m, age); m->m_nextpkt = NULL; @@ -694,6 +732,7 @@ stageq_remove(struct ieee80211com *ic, s if (sq->tail == m) sq->tail = mprev; sq->depth--; + ff_check_cancel_age_timer(ic); return; } mprev = m; Modified: head/sys/net80211/ieee80211_superg.h == --- head/sys/net80211/ieee80211_superg.hSun Mar 19 20:04:57 2017 (r315582) +++ head/sys/net80211/ieee80211_superg.hSun Mar 19 20:05:21 2017 (r315583) @@ -66,6 +66,8 @@ struct ieee80211_stageq { struct ieee80211_superg { /* fast-frames staging q */ struct ieee80211_stageq ff_stageq[WME_NUM_AC]; + /* flush queues automatically */ + struct timeout_task ff_qtimer; }; void ieee80211_superg_attach(struct ieee80211com *); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r315584 - in head/sys/dev/rtwn: pci usb
Author: avos Date: Sun Mar 19 20:51:28 2017 New Revision: 315584 URL: https://svnweb.freebsd.org/changeset/base/315584 Log: rtwn: drop unneeded (after r315583) code. Tested with RTL8188EU, HOSTAP mode + RTL8821AU, STA mode (fast-frames / A-MSDU). Modified: head/sys/dev/rtwn/pci/rtwn_pci_rx.c head/sys/dev/rtwn/usb/rtwn_usb_rx.c Modified: head/sys/dev/rtwn/pci/rtwn_pci_rx.c == --- head/sys/dev/rtwn/pci/rtwn_pci_rx.c Sun Mar 19 20:05:21 2017 (r315583) +++ head/sys/dev/rtwn/pci/rtwn_pci_rx.c Sun Mar 19 20:51:28 2017 (r315584) @@ -280,17 +280,6 @@ rtwn_pci_rx_done(struct rtwn_softc *sc) ring->cur = (ring->cur + 1) % RTWN_PCI_RX_LIST_COUNT; } - - /* Finished receive; age anything left on the FF queue by a little bump */ - /* -* XXX TODO: just make this a callout timer schedule so we can -* flush the FF staging queue if we're approaching idle. -*/ -#ifdef IEEE80211_SUPPORT_SUPERG - if (!(sc->sc_flags & RTWN_FW_LOADED) || - sc->sc_ratectl != RTWN_RATECTL_NET80211) - rtwn_cmd_sleepable(sc, NULL, 0, rtwn_ff_flush_all); -#endif } void Modified: head/sys/dev/rtwn/usb/rtwn_usb_rx.c == --- head/sys/dev/rtwn/usb/rtwn_usb_rx.c Sun Mar 19 20:05:21 2017 (r315583) +++ head/sys/dev/rtwn/usb/rtwn_usb_rx.c Sun Mar 19 20:51:28 2017 (r315584) @@ -319,17 +319,6 @@ tr_setup: break; } finish: - /* Finished receive; age anything left on the FF queue by a little bump */ - /* -* XXX TODO: just make this a callout timer schedule so we can -* flush the FF staging queue if we're approaching idle. -*/ -#ifdef IEEE80211_SUPPORT_SUPERG - if (!(sc->sc_flags & RTWN_FW_LOADED) || - sc->sc_ratectl != RTWN_RATECTL_NET80211) - rtwn_cmd_sleepable(sc, NULL, 0, rtwn_ff_flush_all); -#endif - /* Kick-start more transmit in case we stalled */ rtwn_start(sc); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r315594 - head/sys/net80211
Author: avos Date: Sun Mar 19 22:18:44 2017 New Revision: 315594 URL: https://svnweb.freebsd.org/changeset/base/315594 Log: net80211: do not cancel callout when FF queue is empty. This should reduce overhead for aggregates (since every second frame clears the queue and reschedules the task there is no need to cancel the callout here; let it just run once at the end - even if queue is empty). Reported by: adrian Modified: head/sys/net80211/ieee80211_superg.c Modified: head/sys/net80211/ieee80211_superg.c == --- head/sys/net80211/ieee80211_superg.cSun Mar 19 22:14:22 2017 (r315593) +++ head/sys/net80211/ieee80211_superg.cSun Mar 19 22:18:44 2017 (r315594) @@ -103,24 +103,6 @@ ff_age_all(void *arg, int npending) ieee80211_ff_age_all(ic, ieee80211_ffagemax + 1); } -static void -ff_check_cancel_age_timer(struct ieee80211com *ic) -{ - struct ieee80211_superg *sg = ic->ic_superg; - - IEEE80211_FF_LOCK_ASSERT(ic); - - if (sg->ff_stageq[WME_AC_VO].depth == 0 && - sg->ff_stageq[WME_AC_VI].depth == 0 && - sg->ff_stageq[WME_AC_BE].depth == 0 && - sg->ff_stageq[WME_AC_BK].depth == 0) { - struct timeout_task *qtask = &sg->ff_qtimer; - - /* NB: may be called from the task itself */ - (void) taskqueue_cancel_timeout(ic->ic_tq, qtask, NULL); - } -} - void ieee80211_superg_attach(struct ieee80211com *ic) { @@ -679,10 +661,9 @@ ieee80211_ff_age(struct ieee80211com *ic sq->head = m->m_nextpkt; sq->depth--; } - if (m == NULL) { + if (m == NULL) sq->tail = NULL; - ff_check_cancel_age_timer(ic); - } else + else M_AGE_SUB(m, quanta); IEEE80211_FF_UNLOCK(ic); @@ -732,7 +713,6 @@ stageq_remove(struct ieee80211com *ic, s if (sq->tail == m) sq->tail = mprev; sq->depth--; - ff_check_cancel_age_timer(ic); return; } mprev = m; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r315596 - head/sys/net80211
Author: avos Date: Sun Mar 19 23:05:03 2017 New Revision: 315596 URL: https://svnweb.freebsd.org/changeset/base/315596 Log: net80211: reschedule tasks properly after r315594. Modified: head/sys/net80211/ieee80211_superg.c Modified: head/sys/net80211/ieee80211_superg.c == --- head/sys/net80211/ieee80211_superg.cSun Mar 19 23:04:58 2017 (r315595) +++ head/sys/net80211/ieee80211_superg.cSun Mar 19 23:05:03 2017 (r315596) @@ -685,9 +685,8 @@ stageq_add(struct ieee80211com *ic, stru } else { sq->head = m; - /* Do not restart the timer if task was already scheduled. */ struct timeout_task *qtask = &ic->ic_superg->ff_qtimer; - taskqueue_enqueue_timeout(ic->ic_tq, qtask, -age); + taskqueue_enqueue_timeout(ic->ic_tq, qtask, age); } KASSERT(age >= 0, ("age %d", age)); M_AGE_SET(m, age); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r315623 - head/sys/dev/rtwn
Author: avos Date: Mon Mar 20 08:10:35 2017 New Revision: 315623 URL: https://svnweb.freebsd.org/changeset/base/315623 Log: rtwn: fix node id assignment. Do not assign new id if node is reused. Tested with RTL8821AU, HOSTAP mode + RTL8188EU, STA mode (with inactivity timeout == 90) Modified: head/sys/dev/rtwn/if_rtwn.c Modified: head/sys/dev/rtwn/if_rtwn.c == --- head/sys/dev/rtwn/if_rtwn.c Mon Mar 20 06:12:55 2017(r315622) +++ head/sys/dev/rtwn/if_rtwn.c Mon Mar 20 08:10:35 2017(r315623) @@ -1718,13 +1718,13 @@ rtwn_node_alloc(struct ieee80211vap *vap } static void -rtwn_newassoc(struct ieee80211_node *ni, int isnew) +rtwn_newassoc(struct ieee80211_node *ni, int isnew __unused) { struct rtwn_softc *sc = ni->ni_ic->ic_softc; struct rtwn_node *un = RTWN_NODE(ni); int id; - if (!isnew) + if (un->id != RTWN_MACID_UNDEFINED) return; RTWN_NT_LOCK(sc); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r315917 - head/sys/net80211
Author: avos Date: Fri Mar 24 22:29:51 2017 New Revision: 315917 URL: https://svnweb.freebsd.org/changeset/base/315917 Log: net80211: fix possible panic when wlan(4) interface is destroyed. If this is the last running vap wait until device will be powered off (fixes panic when 'ifconfig wlan0 destroy' is executed for running iwn(4) interface). Tested with: - Intel 6205, STA mode. - RTL8188EU, STA / IBSS modes. - RTL8821AU, STA / HOSTAP modes. Modified: head/sys/net80211/ieee80211.c Modified: head/sys/net80211/ieee80211.c == --- head/sys/net80211/ieee80211.c Fri Mar 24 18:28:48 2017 (r315916) +++ head/sys/net80211/ieee80211.c Fri Mar 24 22:29:51 2017 (r315917) @@ -728,6 +728,7 @@ ieee80211_vap_detach(struct ieee80211vap ieee80211_draintask(ic, &vap->iv_nstate_task); ieee80211_draintask(ic, &vap->iv_swbmiss_task); ieee80211_draintask(ic, &vap->iv_wme_task); + ieee80211_draintask(ic, &ic->ic_parent_task); /* XXX band-aid until ifnet handles this for us */ taskqueue_drain(taskqueue_swi, &ifp->if_linktask); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r315946 - head/sys/dev/iwn
Author: avos Date: Sat Mar 25 13:15:43 2017 New Revision: 315946 URL: https://svnweb.freebsd.org/changeset/base/315946 Log: iwn: add few missing notification types into iwn_intr_str() Modified: head/sys/dev/iwn/if_iwn_debug.h Modified: head/sys/dev/iwn/if_iwn_debug.h == --- head/sys/dev/iwn/if_iwn_debug.h Sat Mar 25 12:53:20 2017 (r315945) +++ head/sys/dev/iwn/if_iwn_debug.h Sat Mar 25 13:15:43 2017 (r315946) @@ -72,6 +72,7 @@ iwn_intr_str(uint8_t cmd) case IWN_RX_PHY:return "RX_PHY"; case IWN_MPDU_RX_DONE: return "MPDU_RX_DONE"; case IWN_RX_DONE: return "RX_DONE"; + case IWN_RX_COMPRESSED_BA: return "RX_COMPRESSED_BA"; /* Command Notifications */ case IWN_CMD_RXON: return "IWN_CMD_RXON"; @@ -81,6 +82,7 @@ iwn_intr_str(uint8_t cmd) case IWN_CMD_LINK_QUALITY: return "IWN_CMD_LINK_QUALITY"; case IWN_CMD_SET_LED: return "IWN_CMD_SET_LED"; case IWN5000_CMD_WIMAX_COEX:return "IWN5000_CMD_WIMAX_COEX"; + case IWN_TEMP_NOTIFICATION: return "IWN_TEMP_NOTIFICATION"; case IWN5000_CMD_CALIB_CONFIG: return "IWN5000_CMD_CALIB_CONFIG"; case IWN5000_CMD_CALIB_RESULT: return "IWN5000_CMD_CALIB_RESULT"; case IWN5000_CMD_CALIB_COMPLETE: return "IWN5000_CMD_CALIB_COMPLETE"; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r315958 - head/sys/dev/iwn
Author: avos Date: Sat Mar 25 15:57:47 2017 New Revision: 315958 URL: https://svnweb.freebsd.org/changeset/base/315958 Log: iwn: do not try to update node configuration when the node does not exist. Firmware will just respond with status '0x8' (node does not exist) or will hang -> cause 'device timeout's (sometimes). Modified: head/sys/dev/iwn/if_iwn.c head/sys/dev/iwn/if_iwnreg.h Modified: head/sys/dev/iwn/if_iwn.c == --- head/sys/dev/iwn/if_iwn.c Sat Mar 25 15:47:29 2017(r315957) +++ head/sys/dev/iwn/if_iwn.c Sat Mar 25 15:57:47 2017(r315958) @@ -2651,7 +2651,15 @@ iwn_read_eeprom_enhinfo(struct iwn_softc static struct ieee80211_node * iwn_node_alloc(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN]) { - return malloc(sizeof (struct iwn_node), M_80211_NODE,M_NOWAIT | M_ZERO); + struct iwn_node *wn; + + wn = malloc(sizeof (struct iwn_node), M_80211_NODE, M_NOWAIT | M_ZERO); + if (wn == NULL) + return (NULL); + + wn->id = IWN_ID_UNDEFINED; + + return (&wn->ni); } static __inline int @@ -7355,6 +7363,9 @@ iwn_ampdu_rx_start(struct ieee80211_node tid = MS(le16toh(baparamset), IEEE80211_BAPS_TID); ssn = MS(le16toh(baseqctl), IEEE80211_BASEQ_START); + if (wn->id == IWN_ID_UNDEFINED) + return (ENOENT); + memset(&node, 0, sizeof node); node.id = wn->id; node.control = IWN_NODE_UPDATE; @@ -7386,6 +7397,9 @@ iwn_ampdu_rx_stop(struct ieee80211_node DPRINTF(sc, IWN_DEBUG_TRACE, "->Doing %s\n", __func__); + if (wn->id == IWN_ID_UNDEFINED) + goto end; + /* XXX: tid as an argument */ for (tid = 0; tid < WME_NUM_TID; tid++) { if (&ni->ni_rx_ampdu[tid] == rap) @@ -7399,6 +7413,7 @@ iwn_ampdu_rx_stop(struct ieee80211_node node.delba_tid = tid; DPRINTF(sc, IWN_DEBUG_RECV, "DELBA RA=%d TID=%d\n", wn->id, tid); (void)ops->add_node(sc, &node, 1); +end: sc->sc_ampdu_rx_stop(ni, rap); } @@ -7473,6 +7488,9 @@ iwn_ampdu_tx_start(struct ieee80211com * DPRINTF(sc, IWN_DEBUG_TRACE, "->Doing %s\n", __func__); + if (wn->id == IWN_ID_UNDEFINED) + return (0); + /* Enable TX for the specified RA/TID. */ wn->disable_tid &= ~(1 << tid); memset(&node, 0, sizeof node); Modified: head/sys/dev/iwn/if_iwnreg.h == --- head/sys/dev/iwn/if_iwnreg.hSat Mar 25 15:47:29 2017 (r315957) +++ head/sys/dev/iwn/if_iwnreg.hSat Mar 25 15:57:47 2017 (r315958) @@ -690,13 +690,15 @@ struct iwn_node_info { uint8_t macaddr[IEEE80211_ADDR_LEN]; uint16_treserved2; uint8_t id; -#define IWN_ID_BSS 0 +#define IWN_ID_BSS 0 #defineIWN_STA_ID 1 -#defineIWN_PAN_ID_BCAST14 +#defineIWN_PAN_ID_BCAST14 #define IWN5000_ID_BROADCAST 15 #define IWN4965_ID_BROADCAST 31 +#define IWN_ID_UNDEFINED (uint8_t)-1 + uint8_t flags; #define IWN_FLAG_SET_KEY (1 << 0) #define IWN_FLAG_SET_DISABLE_TID (1 << 1) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r315966 - head/sys/dev/iwn
Author: avos Date: Sat Mar 25 22:07:21 2017 New Revision: 315966 URL: https://svnweb.freebsd.org/changeset/base/315966 Log: iwn: fix return code conflict in iwn_init_locked() Do not try to use errno(2) codes here; instead, just return unique value (1) when radio is disabled via hardware switch and another one (-1) for any other error in initialization path. Tested with Intel 6205, STA mode. Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c == --- head/sys/dev/iwn/if_iwn.c Sat Mar 25 21:46:02 2017(r315965) +++ head/sys/dev/iwn/if_iwn.c Sat Mar 25 22:07:21 2017(r315966) @@ -5120,7 +5120,7 @@ iwn_parent(struct ieee80211com *ic) case 0: ieee80211_start_all(ic); break; - case EAGAIN: + case 1: /* radio is disabled via RFkill switch */ taskqueue_enqueue(sc->sc_tq, &sc->sc_rftoggle_task); break; @@ -8879,8 +8879,10 @@ iwn_init_locked(struct iwn_softc *sc) /* Check that the radio is not disabled by hardware switch. */ if (!(IWN_READ(sc, IWN_GP_CNTRL) & IWN_GP_CNTRL_RFKILL)) { - error = EAGAIN; - goto fail; + iwn_stop_locked(sc); + DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end\n",__func__); + + return (1); } /* Read firmware images from the filesystem. */ @@ -8921,7 +8923,7 @@ fail: DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end in error\n",__func__); - return (error); + return (-1); } static int ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r315981 - head/sys/dev/iwn
Author: avos Date: Sun Mar 26 09:10:01 2017 New Revision: 315981 URL: https://svnweb.freebsd.org/changeset/base/315981 Log: iwn: omit unneeded bus_dmamap_sync() calls when compiled without 'options IWN_DEBUG' Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c == --- head/sys/dev/iwn/if_iwn.c Sun Mar 26 08:54:08 2017(r315980) +++ head/sys/dev/iwn/if_iwn.c Sun Mar 26 09:10:01 2017(r315981) @@ -3944,6 +3944,7 @@ iwn_notif_intr(struct iwn_softc *sc) sc->errptr = le32toh(uc->errptr); break; } +#ifdef IWN_DEBUG case IWN_STATE_CHANGED: { /* @@ -3953,27 +3954,26 @@ iwn_notif_intr(struct iwn_softc *sc) */ bus_dmamap_sync(sc->rxq.data_dmat, data->map, BUS_DMASYNC_POSTREAD); -#ifdef IWN_DEBUG + uint32_t *status = (uint32_t *)(desc + 1); DPRINTF(sc, IWN_DEBUG_INTR | IWN_DEBUG_STATE, "state changed to %x\n", le32toh(*status)); -#endif break; } case IWN_START_SCAN: { bus_dmamap_sync(sc->rxq.data_dmat, data->map, BUS_DMASYNC_POSTREAD); -#ifdef IWN_DEBUG + struct iwn_start_scan *scan = (struct iwn_start_scan *)(desc + 1); DPRINTF(sc, IWN_DEBUG_ANY, "%s: scanning channel %d status %x\n", __func__, scan->chan, le32toh(scan->status)); -#endif break; } +#endif case IWN_STOP_SCAN: { bus_dmamap_sync(sc->rxq.data_dmat, data->map, ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r315982 - head/sys/dev/iwn
Author: avos Date: Sun Mar 26 09:41:08 2017 New Revision: 315982 URL: https://svnweb.freebsd.org/changeset/base/315982 Log: iwn: deduplicate code in iwn_tx_data() and iwn_tx_data_raw(). Some code was additionally moved for (future) lock splitting. Tested with Intel 6205, STA mode. Differential Revision:https://reviews.freebsd.org/D10106 Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c == --- head/sys/dev/iwn/if_iwn.c Sun Mar 26 09:10:01 2017(r315981) +++ head/sys/dev/iwn/if_iwn.c Sun Mar 26 09:41:08 2017(r315982) @@ -232,6 +232,8 @@ static int iwn_tx_data(struct iwn_softc static int iwn_tx_data_raw(struct iwn_softc *, struct mbuf *, struct ieee80211_node *, const struct ieee80211_bpf_params *params); +static int iwn_tx_cmd(struct iwn_softc *, struct mbuf *, + struct ieee80211_node *, struct iwn_tx_ring *); static voidiwn_xmit_task(void *arg0, int pending); static int iwn_raw_xmit(struct ieee80211_node *, struct mbuf *, const struct ieee80211_bpf_params *); @@ -4392,32 +4394,25 @@ iwn_tx_rate_to_linkq_offset(struct iwn_s static int iwn_tx_data(struct iwn_softc *sc, struct mbuf *m, struct ieee80211_node *ni) { - struct iwn_ops *ops = &sc->ops; const struct ieee80211_txparam *tp = ni->ni_txparms; struct ieee80211vap *vap = ni->ni_vap; struct ieee80211com *ic = ni->ni_ic; struct iwn_node *wn = (void *)ni; struct iwn_tx_ring *ring; - struct iwn_tx_desc *desc; - struct iwn_tx_data *data; struct iwn_tx_cmd *cmd; struct iwn_cmd_data *tx; struct ieee80211_frame *wh; struct ieee80211_key *k = NULL; - struct mbuf *m1; uint32_t flags; - uint16_t qos; - u_int hdrlen; - bus_dma_segment_t *seg, segs[IWN_MAX_SCATTER]; + uint16_t seqno, qos; uint8_t tid, type; - int ac, i, totlen, error, pad, nsegs = 0, rate; + int ac, totlen, rate; DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__); IWN_LOCK_ASSERT(sc); wh = mtod(m, struct ieee80211_frame *); - hdrlen = ieee80211_anyhdrsize(wh); type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; /* Select EDCA Access Category and TX ring for this frame. */ @@ -4428,7 +4423,21 @@ iwn_tx_data(struct iwn_softc *sc, struct qos = 0; tid = 0; } - ac = M_WME_GETAC(m); + + /* Choose a TX rate index. */ + if (type == IEEE80211_FC0_TYPE_MGT || + type == IEEE80211_FC0_TYPE_CTL || + (m->m_flags & M_EAPOL) != 0) + rate = tp->mgmtrate; + else if (IEEE80211_IS_MULTICAST(wh->i_addr1)) + rate = tp->mcastrate; + else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) + rate = tp->ucastrate; + else { + /* XXX pass pktlen */ + (void) ieee80211_ratectl_rate(ni, NULL, 0); + rate = ni->ni_txrate; + } /* * XXX TODO: Group addressed frames aren't aggregated and must @@ -4436,12 +4445,13 @@ iwn_tx_data(struct iwn_softc *sc, struct * assigned from net80211. */ + ac = M_WME_GETAC(m); + seqno = ni->ni_txseqs[tid]; if (m->m_flags & M_AMPDU_MPDU) { - uint16_t seqno; struct ieee80211_tx_ampdu *tap = &ni->ni_tx_ampdu[ac]; if (!IEEE80211_AMPDU_RUNNING(tap)) { - return EINVAL; + return (EINVAL); } /* @@ -4452,39 +4462,10 @@ iwn_tx_data(struct iwn_softc *sc, struct * being used! */ ac = *(int *)tap->txa_private; - seqno = ni->ni_txseqs[tid]; *(uint16_t *)wh->i_seq = htole16(seqno << IEEE80211_SEQ_SEQ_SHIFT); - ring = &sc->txq[ac]; - if ((seqno % 256) != ring->cur) { - device_printf(sc->sc_dev, - "%s: m=%p: seqno (%d) (%d) != ring index (%d) !\n", - __func__, - m, - seqno, - seqno % 256, - ring->cur); - } ni->ni_txseqs[tid]++; } - ring = &sc->txq[ac]; - desc = &ring->desc[ring->cur]; - data = &ring->data[ring->cur]; - - /* Choose a TX rate index. */ - if (type == IEEE80211_FC0_TYPE_MGT || - type == IEEE80211_FC0_TYPE_CTL || - (m->m_flags & M_EAPOL) != 0) - rate = tp->mgmtrate; - else if (IEEE80211_IS_MULTICAST(wh->i_addr1)) - rate = tp->mcastrate; - else if (tp->ucastrate != IEEE80211_FIXED_RATE
svn commit: r315988 - head/sys/dev/iwn
Author: avos Date: Sun Mar 26 16:46:39 2017 New Revision: 315988 URL: https://svnweb.freebsd.org/changeset/base/315988 Log: iwn: drop unneeded bus_dmamap_sync() calls. 1) They are using wrong tag (Tx) + map (Rx) combination. 2) Rx descriptor is already synchronized in iwn_notif_intr() 3) It's not needed for transmitted data since device does not change mbuf contents. Tested with Intel 6205 (amd64), STA mode. Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c == --- head/sys/dev/iwn/if_iwn.c Sun Mar 26 14:37:12 2017(r315987) +++ head/sys/dev/iwn/if_iwn.c Sun Mar 26 16:46:39 2017(r315988) @@ -3516,11 +3516,7 @@ iwn4965_tx_done(struct iwn_softc *sc, st struct iwn_rx_data *data) { struct iwn4965_tx_stat *stat = (struct iwn4965_tx_stat *)(desc + 1); - struct iwn_tx_ring *ring; - int qid; - - qid = desc->qid & 0xf; - ring = &sc->txq[qid]; + int qid = desc->qid & 0xf; DPRINTF(sc, IWN_DEBUG_XMIT, "%s: " "qid %d idx %d RTS retries %d ACK retries %d nkill %d rate %x duration %d status %x\n", @@ -3531,7 +3527,6 @@ iwn4965_tx_done(struct iwn_softc *sc, st stat->rate, le16toh(stat->duration), le32toh(stat->status)); - bus_dmamap_sync(ring->data_dmat, data->map, BUS_DMASYNC_POSTREAD); if (qid >= sc->firstaggqueue) { iwn_ampdu_tx_done(sc, qid, desc->idx, stat->nframes, stat->rtsfailcnt, stat->ackfailcnt, &stat->status); @@ -3546,11 +3541,7 @@ iwn5000_tx_done(struct iwn_softc *sc, st struct iwn_rx_data *data) { struct iwn5000_tx_stat *stat = (struct iwn5000_tx_stat *)(desc + 1); - struct iwn_tx_ring *ring; - int qid; - - qid = desc->qid & 0xf; - ring = &sc->txq[qid]; + int qid = desc->qid & 0xf; DPRINTF(sc, IWN_DEBUG_XMIT, "%s: " "qid %d idx %d RTS retries %d ACK retries %d nkill %d rate %x duration %d status %x\n", @@ -3566,7 +3557,6 @@ iwn5000_tx_done(struct iwn_softc *sc, st iwn5000_reset_sched(sc, desc->qid & 0xf, desc->idx); #endif - bus_dmamap_sync(ring->data_dmat, data->map, BUS_DMASYNC_POSTREAD); if (qid >= sc->firstaggqueue) { iwn_ampdu_tx_done(sc, qid, desc->idx, stat->nframes, stat->rtsfailcnt, stat->ackfailcnt, &stat->status); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r315992 - head/sys/dev/iwn
Author: avos Date: Sun Mar 26 17:59:51 2017 New Revision: 315992 URL: https://svnweb.freebsd.org/changeset/base/315992 Log: iwn: fix error handling for one well-known corner case. Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c == --- head/sys/dev/iwn/if_iwn.c Sun Mar 26 17:46:42 2017(r315991) +++ head/sys/dev/iwn/if_iwn.c Sun Mar 26 17:59:51 2017(r315992) @@ -4739,9 +4739,19 @@ iwn_tx_cmd(struct iwn_softc *sc, struct error = bus_dmamap_load_mbuf_sg(ring->data_dmat, data->map, m, segs, &nsegs, BUS_DMA_NOWAIT); if (error != 0) { + /* XXX fix this */ + /* +* NB: Do not return error; +* original mbuf does not exist anymore. +*/ device_printf(sc->sc_dev, - "%s: can't map mbuf (error %d)\n", __func__, error); - return error; + "%s: can't map mbuf (error %d)\n", + __func__, error); + if_inc_counter(ni->ni_vap->iv_ifp, + IFCOUNTER_OERRORS, 1); + ieee80211_free_node(ni); + m_freem(m); + return 0; } } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r315996 - head/sys/dev/iwn
Author: avos Date: Sun Mar 26 18:06:51 2017 New Revision: 315996 URL: https://svnweb.freebsd.org/changeset/base/315996 Log: iwn: fix debug message Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c == --- head/sys/dev/iwn/if_iwn.c Sun Mar 26 18:06:22 2017(r315995) +++ head/sys/dev/iwn/if_iwn.c Sun Mar 26 18:06:51 2017(r315996) @@ -3292,8 +3292,8 @@ iwn5000_rx_calib_results(struct iwn_soft /* Runtime firmware should not send such a notification. */ if (sc->sc_flags & IWN_FLAG_CALIB_DONE){ - DPRINTF(sc, IWN_DEBUG_TRACE, "->%s received after clib done\n", - __func__); + DPRINTF(sc, IWN_DEBUG_TRACE, + "->%s received after calib done\n", __func__); return; } len = (le32toh(desc->len) & 0x3fff) - 4; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r316010 - head/sys/dev/iwm
Author: avos Date: Mon Mar 27 07:02:27 2017 New Revision: 316010 URL: https://svnweb.freebsd.org/changeset/base/316010 Log: iwm: fix build without IWM_DEBUG. Reported by: O. Hartmann Reviewed by: adrian Differential Revision:https://reviews.freebsd.org/D10146 Modified: head/sys/dev/iwm/if_iwm_scan.c Modified: head/sys/dev/iwm/if_iwm_scan.c == --- head/sys/dev/iwm/if_iwm_scan.c Mon Mar 27 06:37:03 2017 (r316009) +++ head/sys/dev/iwm/if_iwm_scan.c Mon Mar 27 07:02:27 2017 (r316010) @@ -201,6 +201,7 @@ iwm_mvm_scan_rate_n_flags(struct iwm_sof return htole32(IWM_RATE_6M_PLCP | tx_ant); } +#ifdef IWM_DEBUG static const char * iwm_mvm_ebs_status_str(enum iwm_scan_ebs_status status) { @@ -216,12 +217,18 @@ iwm_mvm_ebs_status_str(enum iwm_scan_ebs } } +static const char * +iwm_mvm_offload_status_str(enum iwm_scan_offload_complete_status status) +{ + return (status == IWM_SCAN_OFFLOAD_ABORTED) ? "aborted" : "completed"; +} +#endif + void iwm_mvm_rx_lmac_scan_complete_notif(struct iwm_softc *sc, struct iwm_rx_packet *pkt) { struct iwm_periodic_scan_complete *scan_notif = (void *)pkt->data; - boolean_t aborted = (scan_notif->status == IWM_SCAN_OFFLOAD_ABORTED); /* If this happens, the firmware has mistakenly sent an LMAC * notification during UMAC scans -- warn and ignore it. @@ -234,7 +241,7 @@ iwm_mvm_rx_lmac_scan_complete_notif(stru } IWM_DPRINTF(sc, IWM_DEBUG_SCAN, "Regular scan %s, EBS status %s (FW)\n", - aborted ? "aborted" : "completed", + iwm_mvm_offload_status_str(scan_notif->status), iwm_mvm_ebs_status_str(scan_notif->ebs_status)); sc->last_ebs_successful = @@ -248,13 +255,11 @@ iwm_mvm_rx_umac_scan_complete_notif(stru struct iwm_rx_packet *pkt) { struct iwm_umac_scan_complete *notif = (void *)pkt->data; - uint32_t uid = le32toh(notif->uid); - boolean_t aborted = (notif->status == IWM_SCAN_OFFLOAD_ABORTED); IWM_DPRINTF(sc, IWM_DEBUG_SCAN, "Scan completed, uid %u, status %s, EBS status %s\n", - uid, - aborted ? "aborted" : "completed", + le32toh(notif->uid), + iwm_mvm_offload_status_str(notif->status), iwm_mvm_ebs_status_str(notif->ebs_status)); if (notif->ebs_status != IWM_SCAN_EBS_SUCCESS && ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r315981 - head/sys/dev/iwn
Sun, 26 Mar 2017 17:43:18 +0300 було написано Hartmann, O. : On Sun, 26 Mar 2017 09:10:02 + (UTC) Andriy Voskoboinyk wrote: Author: avos Date: Sun Mar 26 09:10:01 2017 New Revision: 315981 URL: https://svnweb.freebsd.org/changeset/base/315981 Log: iwn: omit unneeded bus_dmamap_sync() calls when compiled without 'options IWN_DEBUG' Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c == --- head/sys/dev/iwn/if_iwn.c Sun Mar 26 08:54:08 2017 (r315980) +++ head/sys/dev/iwn/if_iwn.c Sun Mar 26 09:10:01 2017(r315981) @@ -3944,6 +3944,7 @@ iwn_notif_intr(struct iwn_softc *sc) sc->errptr = le32toh(uc->errptr); break; } +#ifdef IWN_DEBUG case IWN_STATE_CHANGED: { /* @@ -3953,27 +3954,26 @@ iwn_notif_intr(struct iwn_softc *sc) */ bus_dmamap_sync(sc->rxq.data_dmat, data->map, BUS_DMASYNC_POSTREAD); -#ifdef IWN_DEBUG + uint32_t *status = (uint32_t *)(desc + 1); DPRINTF(sc, IWN_DEBUG_INTR | IWN_DEBUG_STATE, "state changed to %x\n", le32toh(*status)); -#endif break; } case IWN_START_SCAN: { bus_dmamap_sync(sc->rxq.data_dmat, data->map, BUS_DMASYNC_POSTREAD); -#ifdef IWN_DEBUG + struct iwn_start_scan *scan = (struct iwn_start_scan *)(desc + 1); DPRINTF(sc, IWN_DEBUG_ANY, "%s: scanning channel %d status %x\n", __func__, scan->chan, le32toh(scan->status)); -#endif break; } +#endif case IWN_STOP_SCAN: { bus_dmamap_sync(sc->rxq.data_dmat, data->map, ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org" It seems when iwm is configured in a kernel without debugging enabled, builkernel failsas shown below: [...] -- stage 3.1: building everything -- cd /usr/obj/usr/src/sys/HERMANN; COMPILER_VERSION=4 COMPILER_TYPE=clang COMPILER_FREEBSD_VERSION=126 MAKEOBJDIRPREFIX=/usr/obj MACHINE_ARCH=amd64 MACHINE=amd64 CPUTYPE=native BUILD_TOOLS_META=.NOMETA_CMP GROFF_BIN_PATH=/usr/obj/usr/src/tmp/legacy/usr/bin GROFF_FONT_PATH=/usr/obj/usr/src/tmp/legacy/usr/share/groff_font GROFF_TMAC_PATH=/usr/obj/usr/src/tmp/legacy/usr/share/tmac CC="cc -target x86_64-unknown-freebsd12.0 --sysroot=/usr/obj/usr/src/tmp -B/usr/obj/usr/src/tmp/usr/bin" CXX="c++ -target x86_64-unknown-freebsd12.0 --sysroot=/usr/obj/usr/src/tmp -B/usr/obj/usr/src/tmp/usr/bin" CPP="cpp -target x86_64-unknown-freebsd12.0 --sysroot=/usr/obj/usr/src/tmp -B/usr/obj/usr/src/tmp/usr/bin" AS="as" AR="ar" LD="ld" LLVM_LINK="" NM=nm OBJCOPY="objcopy" RANLIB=ranlib STRINGS= SIZE="size" INSTALL="sh /usr/src/tools/install.sh" PATH=/usr/obj/usr/src/tmp/legacy/usr/sbin:/usr/obj/usr/src/tmp/legacy/usr/bin:/usr/obj/usr/src/tmp/legacy/bin:/usr/obj/usr/src/tmp/usr/sbin:/usr/obj/usr/src/tmp/usr/bin:/sbin:/bin:/usr/sbin:/usr/bin make -m /usr/src/share/mk KERNEL=kernel all -DNO_MODULES_OBJ Building /usr/obj/usr/src/sys/HERMANN/if_iwm_scan.o /usr/src/sys/dev/iwm/if_iwm_scan.c:224:12: error: unused variable 'aborted' [-Werror,-Wunused-variable] boolean_t aborted = (scan_notif->status == IWM_SCAN_OFFLOAD_ABORTED); ^ /usr/src/sys/dev/iwm/if_iwm_scan.c:251:11: error: unused variable 'uid' [-Werror,-Wunused-variable] uint32_t uid = le32toh(notif->uid); Fixed in r316010. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r316114 - head/sys/dev/iwn
Author: avos Date: Tue Mar 28 22:31:48 2017 New Revision: 316114 URL: https://svnweb.freebsd.org/changeset/base/316114 Log: iwn: drop duplicate synchronization requests. Rx descriptor / payload is already synchronized in iwn_notif_intr() (before accessing desc->type / desc->qid fields). Tested with Intel 6205, STA mode. Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c == --- head/sys/dev/iwn/if_iwn.c Tue Mar 28 21:54:36 2017(r316113) +++ head/sys/dev/iwn/if_iwn.c Tue Mar 28 22:31:48 2017(r316114) @@ -196,16 +196,13 @@ static void iwn_newassoc(struct ieee8021 static int iwn_media_change(struct ifnet *); static int iwn_newstate(struct ieee80211vap *, enum ieee80211_state, int); static voidiwn_calib_timeout(void *); -static voidiwn_rx_phy(struct iwn_softc *, struct iwn_rx_desc *, - struct iwn_rx_data *); +static voidiwn_rx_phy(struct iwn_softc *, struct iwn_rx_desc *); static voidiwn_rx_done(struct iwn_softc *, struct iwn_rx_desc *, struct iwn_rx_data *); -static voidiwn_rx_compressed_ba(struct iwn_softc *, struct iwn_rx_desc *, - struct iwn_rx_data *); +static voidiwn_rx_compressed_ba(struct iwn_softc *, struct iwn_rx_desc *); static voidiwn5000_rx_calib_results(struct iwn_softc *, - struct iwn_rx_desc *, struct iwn_rx_data *); -static voidiwn_rx_statistics(struct iwn_softc *, struct iwn_rx_desc *, - struct iwn_rx_data *); + struct iwn_rx_desc *); +static voidiwn_rx_statistics(struct iwn_softc *, struct iwn_rx_desc *); static voidiwn4965_tx_done(struct iwn_softc *, struct iwn_rx_desc *, struct iwn_rx_data *); static voidiwn5000_tx_done(struct iwn_softc *, struct iwn_rx_desc *, @@ -2975,13 +2972,11 @@ iwn_calib_timeout(void *arg) * followed by an MPDU_RX_DONE notification. */ static void -iwn_rx_phy(struct iwn_softc *sc, struct iwn_rx_desc *desc, -struct iwn_rx_data *data) +iwn_rx_phy(struct iwn_softc *sc, struct iwn_rx_desc *desc) { struct iwn_rx_stat *stat = (struct iwn_rx_stat *)(desc + 1); DPRINTF(sc, IWN_DEBUG_CALIBRATE, "%s: received PHY stats\n", __func__); - bus_dmamap_sync(sc->rxq.data_dmat, data->map, BUS_DMASYNC_POSTREAD); /* Save RX statistics, they will be used on MPDU_RX_DONE. */ memcpy(&sc->last_rx_stat, stat, sizeof (*stat)); @@ -3021,8 +3016,6 @@ iwn_rx_done(struct iwn_softc *sc, struct } else stat = (struct iwn_rx_stat *)(desc + 1); - bus_dmamap_sync(ring->data_dmat, data->map, BUS_DMASYNC_POSTREAD); - if (stat->cfg_phy_len > IWN_STAT_MAXLEN) { device_printf(sc->sc_dev, "%s: invalid RX statistic header, len %d\n", __func__, @@ -3176,8 +3169,7 @@ iwn_rx_done(struct iwn_softc *sc, struct /* Process an incoming Compressed BlockAck. */ static void -iwn_rx_compressed_ba(struct iwn_softc *sc, struct iwn_rx_desc *desc, -struct iwn_rx_data *data) +iwn_rx_compressed_ba(struct iwn_softc *sc, struct iwn_rx_desc *desc) { struct ieee80211_ratectl_tx_status *txs = &sc->sc_txs; struct iwn_ops *ops = &sc->ops; @@ -3196,8 +3188,6 @@ iwn_rx_compressed_ba(struct iwn_softc *s DPRINTF(sc, IWN_DEBUG_TRACE | IWN_DEBUG_XMIT, "->%s begin\n", __func__); - bus_dmamap_sync(sc->rxq.data_dmat, data->map, BUS_DMASYNC_POSTREAD); - qid = le16toh(ba->qid); txq = &sc->txq[ba->qid]; tap = sc->qid2tap[ba->qid]; @@ -3282,8 +3272,7 @@ iwn_rx_compressed_ba(struct iwn_softc *s * firmware on response to a CMD_CALIB_CONFIG command (5000 only). */ static void -iwn5000_rx_calib_results(struct iwn_softc *sc, struct iwn_rx_desc *desc, -struct iwn_rx_data *data) +iwn5000_rx_calib_results(struct iwn_softc *sc, struct iwn_rx_desc *desc) { struct iwn_phy_calib *calib = (struct iwn_phy_calib *)(desc + 1); int len, idx = -1; @@ -3297,7 +3286,6 @@ iwn5000_rx_calib_results(struct iwn_soft return; } len = (le32toh(desc->len) & 0x3fff) - 4; - bus_dmamap_sync(sc->rxq.data_dmat, data->map, BUS_DMASYNC_POSTREAD); switch (calib->code) { case IWN5000_PHY_CALIB_DC: @@ -3406,8 +3394,7 @@ iwn_stats_update(struct iwn_softc *sc, s * The latter is sent by the firmware after each received beacon. */ static void -iwn_rx_statistics(struct iwn_softc *sc, struct iwn_rx_desc *desc, -struct iwn_rx_data *data) +iwn_rx_statistics(struct iwn_softc *sc, struct iwn_rx_desc *desc) { struct iwn_ops *ops = &sc->ops; struct ieee80211com *ic = &sc->sc_ic; @@ -3427,8 +3414,6 @@ iwn_rx_statistics(struct iwn_softc *sc, return; } - bus_dmamap_sync(sc->rxq.data_dmat, data->map, BUS_DMASYNC_POSTREAD); - DPRINTF(sc, I
svn commit: r316116 - head/sys/dev/iwn
Author: avos Date: Tue Mar 28 22:40:51 2017 New Revision: 316116 URL: https://svnweb.freebsd.org/changeset/base/316116 Log: iwn: remove unneeded cast. Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c == --- head/sys/dev/iwn/if_iwn.c Tue Mar 28 22:32:11 2017(r316115) +++ head/sys/dev/iwn/if_iwn.c Tue Mar 28 22:40:51 2017(r316116) @@ -2994,7 +2994,7 @@ iwn_rx_done(struct iwn_softc *sc, struct struct iwn_ops *ops = &sc->ops; struct ieee80211com *ic = &sc->sc_ic; struct iwn_rx_ring *ring = &sc->rxq; - struct ieee80211_frame *wh; + struct ieee80211_frame_min *wh; struct ieee80211_node *ni; struct mbuf *m, *m1; struct iwn_rx_stat *stat; @@ -3096,9 +3096,9 @@ iwn_rx_done(struct iwn_softc *sc, struct m->m_pkthdr.len = m->m_len = len; /* Grab a reference to the source node. */ - wh = mtod(m, struct ieee80211_frame *); + wh = mtod(m, struct ieee80211_frame_min *); if (len >= sizeof(struct ieee80211_frame_min)) - ni = ieee80211_find_rxnode(ic, (struct ieee80211_frame_min *)wh); + ni = ieee80211_find_rxnode(ic, wh); else ni = NULL; nf = (ni != NULL && ni->ni_vap->iv_state == IEEE80211_S_RUN && @@ -3130,7 +3130,7 @@ iwn_rx_done(struct iwn_softc *sc, struct if (sc->sc_beacon_wait) { uint8_t type, subtype; /* NB: Re-assign wh */ - wh = mtod(m, struct ieee80211_frame *); + wh = mtod(m, struct ieee80211_frame_min *); type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK; /* ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r316415 - head/sys/dev/iwn
Author: avos Date: Sun Apr 2 13:24:58 2017 New Revision: 316415 URL: https://svnweb.freebsd.org/changeset/base/316415 Log: iwn: use correct mask for queue ids (0xf -> 0x1f). Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c == --- head/sys/dev/iwn/if_iwn.c Sun Apr 2 12:37:43 2017(r316414) +++ head/sys/dev/iwn/if_iwn.c Sun Apr 2 13:24:58 2017(r316415) @@ -3501,7 +3501,7 @@ iwn4965_tx_done(struct iwn_softc *sc, st struct iwn_rx_data *data) { struct iwn4965_tx_stat *stat = (struct iwn4965_tx_stat *)(desc + 1); - int qid = desc->qid & 0xf; + int qid = desc->qid & IWN_RX_DESC_QID_MSK; DPRINTF(sc, IWN_DEBUG_XMIT, "%s: " "qid %d idx %d RTS retries %d ACK retries %d nkill %d rate %x duration %d status %x\n", @@ -3526,7 +3526,7 @@ iwn5000_tx_done(struct iwn_softc *sc, st struct iwn_rx_data *data) { struct iwn5000_tx_stat *stat = (struct iwn5000_tx_stat *)(desc + 1); - int qid = desc->qid & 0xf; + int qid = desc->qid & IWN_RX_DESC_QID_MSK; DPRINTF(sc, IWN_DEBUG_XMIT, "%s: " "qid %d idx %d RTS retries %d ACK retries %d nkill %d rate %x duration %d status %x\n", @@ -3539,7 +3539,7 @@ iwn5000_tx_done(struct iwn_softc *sc, st #ifdef notyet /* Reset TX scheduler slot. */ - iwn5000_reset_sched(sc, desc->qid & 0xf, desc->idx); + iwn5000_reset_sched(sc, qid, desc->idx); #endif if (qid >= sc->firstaggqueue) { @@ -3559,7 +3559,7 @@ iwn_tx_done(struct iwn_softc *sc, struct int ackfailcnt, uint8_t status) { struct ieee80211_ratectl_tx_status *txs = &sc->sc_txs; - struct iwn_tx_ring *ring = &sc->txq[desc->qid & 0xf]; + struct iwn_tx_ring *ring = &sc->txq[desc->qid & IWN_RX_DESC_QID_MSK]; struct iwn_tx_data *data = &ring->data[desc->idx]; struct mbuf *m; struct ieee80211_node *ni; @@ -3833,9 +3833,9 @@ iwn_notif_intr(struct iwn_softc *sc) DPRINTF(sc, IWN_DEBUG_RECV, "%s: cur=%d; qid %x idx %d flags %x type %d(%s) len %d\n", - __func__, sc->rxq.cur, desc->qid & 0xf, desc->idx, desc->flags, - desc->type, iwn_intr_str(desc->type), - le16toh(desc->len)); + __func__, sc->rxq.cur, desc->qid & IWN_RX_DESC_QID_MSK, + desc->idx, desc->flags, desc->type, + iwn_intr_str(desc->type), le16toh(desc->len)); if (!(desc->qid & IWN_UNSOLICITED_RX_NOTIF))/* Reply to a command. */ iwn_cmd_done(sc, desc); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r316723 - in head/sys/dev/rtwn: rtl8188e rtl8192c rtl8812a
Author: avos Date: Wed Apr 12 07:21:54 2017 New Revision: 316723 URL: https://svnweb.freebsd.org/changeset/base/316723 Log: rtwn: remove out-of-bounds access + fix debug output. Omit unused rates while initializing / dumping Tx power values. They were not accessed anywhere (except for debugging), so this is (mostly) no-op. Tested with * RTL8188EU, STA mode. * RTL8812AU, STA mode. Found by: PVS-Studio Modified: head/sys/dev/rtwn/rtl8188e/r88e_chan.c head/sys/dev/rtwn/rtl8192c/r92c_chan.c head/sys/dev/rtwn/rtl8812a/r12a_chan.c Modified: head/sys/dev/rtwn/rtl8188e/r88e_chan.c == --- head/sys/dev/rtwn/rtl8188e/r88e_chan.c Wed Apr 12 06:24:35 2017 (r316722) +++ head/sys/dev/rtwn/rtl8188e/r88e_chan.c Wed Apr 12 07:21:54 2017 (r316723) @@ -110,7 +110,7 @@ r88e_get_txpower(struct rtwn_softc *sc, for (ridx = RTWN_RIDX_CCK1; ridx <= RTWN_RIDX_CCK11; ridx++) power[ridx] = base->pwr[0][ridx]; } - for (ridx = RTWN_RIDX_OFDM6; ridx < RTWN_RIDX_COUNT; ridx++) { + for (ridx = RTWN_RIDX_OFDM6; ridx <= max_mcs; ridx++) { if (rs->regulatory == 3) power[ridx] = base->pwr[0][ridx]; else if (rs->regulatory == 1) { Modified: head/sys/dev/rtwn/rtl8192c/r92c_chan.c == --- head/sys/dev/rtwn/rtl8192c/r92c_chan.c Wed Apr 12 06:24:35 2017 (r316722) +++ head/sys/dev/rtwn/rtl8192c/r92c_chan.c Wed Apr 12 07:21:54 2017 (r316723) @@ -229,13 +229,13 @@ r92c_set_txpower(struct rtwn_softc *sc, rtwn_r92c_get_txpower(sc, i, c, power); #ifdef RTWN_DEBUG if (sc->sc_debug & RTWN_DEBUG_TXPWR) { - int ridx; + int max_mcs, ridx; + + max_mcs = RTWN_RIDX_MCS(sc->ntxchains * 8 - 1); /* Dump per-rate Tx power values. */ printf("Tx power for chain %d:\n", i); - for (ridx = RTWN_RIDX_CCK1; -ridx < RTWN_RIDX_COUNT; -ridx++) + for (ridx = RTWN_RIDX_CCK1; ridx <= max_mcs; ridx++) printf("Rate %d = %u\n", ridx, power[ridx]); } #endif Modified: head/sys/dev/rtwn/rtl8812a/r12a_chan.c == --- head/sys/dev/rtwn/rtl8812a/r12a_chan.c Wed Apr 12 06:24:35 2017 (r316722) +++ head/sys/dev/rtwn/rtl8812a/r12a_chan.c Wed Apr 12 07:21:54 2017 (r316723) @@ -247,7 +247,7 @@ r12a_get_txpower(struct rtwn_softc *sc, if (sc->sc_debug & RTWN_DEBUG_TXPWR) { /* Dump per-rate Tx power values. */ printf("Tx power for chain %d:\n", chain); - for (ridx = RTWN_RIDX_CCK1; ridx < RTWN_RIDX_COUNT; ridx++) + for (ridx = RTWN_RIDX_CCK1; ridx <= max_mcs; ridx++) printf("Rate %d = %u\n", ridx, power[ridx]); } #endif ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r330666 - head/sys/dev/iwi
Author: avos Date: Thu Mar 8 18:42:23 2018 New Revision: 330666 URL: https://svnweb.freebsd.org/changeset/base/330666 Log: iwi(4): factor out rateset setup into iwi_set_rateset(). No functional change intended. Modified: head/sys/dev/iwi/if_iwi.c Modified: head/sys/dev/iwi/if_iwi.c == --- head/sys/dev/iwi/if_iwi.c Thu Mar 8 17:23:18 2018(r330665) +++ head/sys/dev/iwi/if_iwi.c Thu Mar 8 18:42:23 2018(r330666) @@ -2550,11 +2550,36 @@ iwi_setwepkeys(struct iwi_softc *sc, struct ieee80211v } static int +iwi_set_rateset(struct iwi_softc *sc, const struct ieee80211_rateset *net_rs, +int mode, int type) +{ + struct iwi_rateset rs; + int i; + + memset(&rs, 0, sizeof(rs)); + rs.mode = mode; + rs.type = type; + rs.nrates = net_rs->rs_nrates; + if (rs.nrates > nitems(rs.rates)) { + DPRINTF(("Truncating negotiated rate set from %u\n", + rs.nrates)); + rs.nrates = nitems(rs.rates); + } + memcpy(rs.rates, net_rs->rs_rates, rs.nrates); + DPRINTF(("Setting .11%c%s %s rates (%u)\n", + mode == IWI_MODE_11A ? 'a' : 'b', + mode == IWI_MODE_11G ? "g" : "", + type == IWI_RATESET_TYPE_SUPPORTED ? "supported" : "negotiated", + rs.nrates)); + + return (iwi_cmd(sc, IWI_CMD_SET_RATES, &rs, sizeof(rs))); +} + +static int iwi_config(struct iwi_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; struct iwi_configuration config; - struct iwi_rateset rs; struct iwi_txpower power; uint32_t data; int error, i; @@ -2603,25 +2628,13 @@ iwi_config(struct iwi_softc *sc) return error; } - memset(&rs, 0, sizeof rs); - rs.mode = IWI_MODE_11G; - rs.type = IWI_RATESET_TYPE_SUPPORTED; - rs.nrates = ic->ic_sup_rates[IEEE80211_MODE_11G].rs_nrates; - memcpy(rs.rates, ic->ic_sup_rates[IEEE80211_MODE_11G].rs_rates, - rs.nrates); - DPRINTF(("Setting .11bg supported rates (%u)\n", rs.nrates)); - error = iwi_cmd(sc, IWI_CMD_SET_RATES, &rs, sizeof rs); + error = iwi_set_rateset(sc, &ic->ic_sup_rates[IEEE80211_MODE_11G], + IWI_MODE_11G, IWI_RATESET_TYPE_SUPPORTED); if (error != 0) return error; - memset(&rs, 0, sizeof rs); - rs.mode = IWI_MODE_11A; - rs.type = IWI_RATESET_TYPE_SUPPORTED; - rs.nrates = ic->ic_sup_rates[IEEE80211_MODE_11A].rs_nrates; - memcpy(rs.rates, ic->ic_sup_rates[IEEE80211_MODE_11A].rs_rates, - rs.nrates); - DPRINTF(("Setting .11a supported rates (%u)\n", rs.nrates)); - error = iwi_cmd(sc, IWI_CMD_SET_RATES, &rs, sizeof rs); + error = iwi_set_rateset(sc, &ic->ic_sup_rates[IEEE80211_MODE_11A], + IWI_MODE_11A, IWI_RATESET_TYPE_SUPPORTED); if (error != 0) return error; @@ -2815,7 +2828,6 @@ iwi_auth_and_assoc(struct iwi_softc *sc, struct ieee80 struct ieee80211_node *ni; struct iwi_configuration config; struct iwi_associate *assoc = &sc->assoc; - struct iwi_rateset rs; uint16_t capinfo; uint32_t data; int error, mode; @@ -2885,18 +2897,8 @@ iwi_auth_and_assoc(struct iwi_softc *sc, struct ieee80 goto done; /* the rate set has already been "negotiated" */ - memset(&rs, 0, sizeof rs); - rs.mode = mode; - rs.type = IWI_RATESET_TYPE_NEGOTIATED; - rs.nrates = ni->ni_rates.rs_nrates; - if (rs.nrates > IWI_RATESET_SIZE) { - DPRINTF(("Truncating negotiated rate set from %u\n", - rs.nrates)); - rs.nrates = IWI_RATESET_SIZE; - } - memcpy(rs.rates, ni->ni_rates.rs_rates, rs.nrates); - DPRINTF(("Setting negotiated rates (%u)\n", rs.nrates)); - error = iwi_cmd(sc, IWI_CMD_SET_RATES, &rs, sizeof rs); + error = iwi_set_rateset(sc, &ni->ni_rates, mode, + IWI_RATESET_TYPE_NEGOTIATED); if (error != 0) goto done; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r330688 - in head/sys: dev/bwn dev/ral dev/usb/wlan net80211
Author: avos Date: Fri Mar 9 11:33:56 2018 New Revision: 330688 URL: https://svnweb.freebsd.org/changeset/base/330688 Log: net80211: wrap protection frame allocation into ieee80211_alloc_prot() Move copy-pasted code for RTS/CTS frame allocation into net80211. While here, add stat / debug message for allocation failures (copied from run(4)) + return error here in bwn(4). Reviewed by: adrian Differential Revision:https://reviews.freebsd.org/D14628 Modified: head/sys/dev/bwn/if_bwn.c head/sys/dev/ral/rt2560.c head/sys/dev/ral/rt2661.c head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_run.c head/sys/dev/usb/wlan/if_ural.c head/sys/net80211/ieee80211_output.c head/sys/net80211/ieee80211_proto.h Modified: head/sys/dev/bwn/if_bwn.c == --- head/sys/dev/bwn/if_bwn.c Fri Mar 9 10:34:44 2018(r330687) +++ head/sys/dev/bwn/if_bwn.c Fri Mar 9 11:33:56 2018(r330688) @@ -6401,15 +6401,14 @@ bwn_set_txhdr(struct bwn_mac *mac, struct ieee80211_no struct bwn_softc *sc = mac->mac_sc; struct ieee80211_frame *wh; struct ieee80211_frame *protwh; - struct ieee80211_frame_cts *cts; - struct ieee80211_frame_rts *rts; const struct ieee80211_txparam *tp = ni->ni_txparms; struct ieee80211vap *vap = ni->ni_vap; struct ieee80211com *ic = &sc->sc_ic; struct mbuf *mprot; + uint8_t *prot_ptr; unsigned int len; uint32_t macctl = 0; - int protdur, rts_rate, rts_rate_fb, ismcast, isshort, rix, type; + int rts_rate, rts_rate_fb, ismcast, isshort, rix, type; uint16_t phyctl = 0; uint8_t rate, rate_fb; int fill_phy_ctl1 = 0; @@ -6528,7 +6527,8 @@ bwn_set_txhdr(struct bwn_mac *mac, struct ieee80211_no m->m_pkthdr.len + IEEE80211_CRC_LEN > vap->iv_rtsthreshold) macctl |= BWN_TX_MAC_LONGFRAME; - if (ic->ic_flags & IEEE80211_F_USEPROT) { + if ((ic->ic_flags & IEEE80211_F_USEPROT) && + ic->ic_protmode != IEEE80211_PROT_NONE) { /* Note: don't fall back to CCK rates for 5G */ if (phy->gmode) rts_rate = BWN_CCK_RATE_1MB; @@ -6537,60 +6537,34 @@ bwn_set_txhdr(struct bwn_mac *mac, struct ieee80211_no rts_rate_fb = bwn_get_fbrate(rts_rate); /* XXX 'rate' here is hardware rate now, not the net80211 rate */ - protdur = ieee80211_compute_duration(ic->ic_rt, - m->m_pkthdr.len, rate, isshort) + - + ieee80211_ack_duration(ic->ic_rt, rate, isshort); + mprot = ieee80211_alloc_prot(ni, m, rate, ic->ic_protmode); + if (mprot == NULL) { + if_inc_counter(vap->iv_ifp, IFCOUNTER_OERRORS, 1); + device_printf(sc->sc_dev, + "could not allocate mbuf for protection mode %d\n", + ic->ic_protmode); + return (ENOBUFS); + } - if (ic->ic_protmode == IEEE80211_PROT_CTSONLY) { + switch (mac->mac_fw.fw_hdr_format) { + case BWN_FW_HDR_351: + prot_ptr = txhdr->body.r351.rts_frame; + break; + case BWN_FW_HDR_410: + prot_ptr = txhdr->body.r410.rts_frame; + break; + case BWN_FW_HDR_598: + prot_ptr = txhdr->body.r598.rts_frame; + break; + } - switch (mac->mac_fw.fw_hdr_format) { - case BWN_FW_HDR_351: - cts = (struct ieee80211_frame_cts *) - txhdr->body.r351.rts_frame; - break; - case BWN_FW_HDR_410: - cts = (struct ieee80211_frame_cts *) - txhdr->body.r410.rts_frame; - break; - case BWN_FW_HDR_598: - cts = (struct ieee80211_frame_cts *) - txhdr->body.r598.rts_frame; - break; - } + bcopy(mtod(mprot, uint8_t *), prot_ptr, mprot->m_pkthdr.len); + m_freem(mprot); - mprot = ieee80211_alloc_cts(ic, ni->ni_vap->iv_myaddr, - protdur); - KASSERT(mprot != NULL, ("failed to alloc mbuf\n")); - bcopy(mtod(mprot, uint8_t *), (uint8_t *)cts, - mprot->m_pkthdr.len); - m_freem(mprot); + if (ic->ic_protmode == IEEE80211_PROT_CTSONLY) { macctl |= BWN_TX_MAC_SEND_CTSTOSELF;
svn commit: r330747 - head/sys/dev/usb/wlan
Author: avos Date: Sat Mar 10 22:52:39 2018 New Revision: 330747 URL: https://svnweb.freebsd.org/changeset/base/330747 Log: run(4): drop few unused variables. Found by: Clang static analyzer Modified: head/sys/dev/usb/wlan/if_run.c Modified: head/sys/dev/usb/wlan/if_run.c == --- head/sys/dev/usb/wlan/if_run.c Sat Mar 10 22:47:26 2018 (r330746) +++ head/sys/dev/usb/wlan/if_run.c Sat Mar 10 22:52:39 2018 (r330747) @@ -3483,7 +3483,6 @@ run_tx_mgt(struct run_softc *sc, struct mbuf *m, struc struct rt2860_txwi *txwi; uint16_t dur; uint8_t ridx = rn->mgt_ridx; - uint8_t type; uint8_t xflags = 0; uint8_t wflags = 0; @@ -3491,8 +3490,6 @@ run_tx_mgt(struct run_softc *sc, struct mbuf *m, struc wh = mtod(m, struct ieee80211_frame *); - type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; - /* tell hardware to add timestamp for probe responses */ if ((wh->i_fc[0] & (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_MASK)) == @@ -3609,11 +3606,9 @@ run_tx_param(struct run_softc *sc, struct mbuf *m, str const struct ieee80211_bpf_params *params) { struct ieee80211com *ic = ni->ni_ic; - struct ieee80211_frame *wh; struct run_tx_data *data; struct rt2870_txd *txd; struct rt2860_txwi *txwi; - uint8_t type; uint8_t ridx; uint8_t rate; uint8_t opflags = 0; @@ -3623,9 +3618,6 @@ run_tx_param(struct run_softc *sc, struct mbuf *m, str RUN_LOCK_ASSERT(sc, MA_OWNED); KASSERT(params != NULL, ("no raw xmit params")); - - wh = mtod(m, struct ieee80211_frame *); - type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; rate = params->ibp_rate0; if (!ieee80211_isratevalid(ic->ic_rt, rate)) { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r330749 - in head/sys: dev/usb/wlan modules/usb/rum modules/usb/run modules/usb/uath modules/usb/upgt modules/usb/ural modules/usb/urtw modules/usb/zyd
Author: avos Date: Sat Mar 10 23:16:24 2018 New Revision: 330749 URL: https://svnweb.freebsd.org/changeset/base/330749 Log: usb/wlan/*: properly include "opt_wlan.h" into all drivers Without it driver cannot be loaded when wlan(4) module is built with 'options IEEE80211_DEBUG_REFCNT'. Modified: head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_run.c head/sys/dev/usb/wlan/if_uath.c head/sys/dev/usb/wlan/if_upgt.c head/sys/dev/usb/wlan/if_ural.c head/sys/dev/usb/wlan/if_urtw.c head/sys/dev/usb/wlan/if_zyd.c head/sys/modules/usb/rum/Makefile head/sys/modules/usb/run/Makefile head/sys/modules/usb/uath/Makefile head/sys/modules/usb/upgt/Makefile head/sys/modules/usb/ural/Makefile head/sys/modules/usb/urtw/Makefile head/sys/modules/usb/zyd/Makefile Modified: head/sys/dev/usb/wlan/if_rum.c == --- head/sys/dev/usb/wlan/if_rum.c Sat Mar 10 23:04:03 2018 (r330748) +++ head/sys/dev/usb/wlan/if_rum.c Sat Mar 10 23:16:24 2018 (r330749) @@ -27,6 +27,8 @@ __FBSDID("$FreeBSD$"); * http://www.ralinktech.com.tw/ */ +#include "opt_wlan.h" + #include #include #include Modified: head/sys/dev/usb/wlan/if_run.c == --- head/sys/dev/usb/wlan/if_run.c Sat Mar 10 23:04:03 2018 (r330748) +++ head/sys/dev/usb/wlan/if_run.c Sat Mar 10 23:16:24 2018 (r330749) @@ -25,6 +25,8 @@ __FBSDID("$FreeBSD$"); * http://www.ralinktech.com/ */ +#include "opt_wlan.h" + #include #include #include Modified: head/sys/dev/usb/wlan/if_uath.c == --- head/sys/dev/usb/wlan/if_uath.c Sat Mar 10 23:04:03 2018 (r330748) +++ head/sys/dev/usb/wlan/if_uath.c Sat Mar 10 23:16:24 2018 (r330749) @@ -67,6 +67,9 @@ __FBSDID("$FreeBSD$"); * for these devices does not work in this way and so does not work * with this driver. */ + +#include "opt_wlan.h" + #include #include #include Modified: head/sys/dev/usb/wlan/if_upgt.c == --- head/sys/dev/usb/wlan/if_upgt.c Sat Mar 10 23:04:03 2018 (r330748) +++ head/sys/dev/usb/wlan/if_upgt.c Sat Mar 10 23:16:24 2018 (r330749) @@ -17,6 +17,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "opt_wlan.h" + #include #include #include Modified: head/sys/dev/usb/wlan/if_ural.c == --- head/sys/dev/usb/wlan/if_ural.c Sat Mar 10 23:04:03 2018 (r330748) +++ head/sys/dev/usb/wlan/if_ural.c Sat Mar 10 23:16:24 2018 (r330749) @@ -28,6 +28,8 @@ __FBSDID("$FreeBSD$"); * http://www.ralinktech.com/ */ +#include "opt_wlan.h" + #include #include #include Modified: head/sys/dev/usb/wlan/if_urtw.c == --- head/sys/dev/usb/wlan/if_urtw.c Sat Mar 10 23:04:03 2018 (r330748) +++ head/sys/dev/usb/wlan/if_urtw.c Sat Mar 10 23:16:24 2018 (r330749) @@ -16,6 +16,9 @@ #include __FBSDID("$FreeBSD$"); + +#include "opt_wlan.h" + #include #include #include Modified: head/sys/dev/usb/wlan/if_zyd.c == --- head/sys/dev/usb/wlan/if_zyd.c Sat Mar 10 23:04:03 2018 (r330748) +++ head/sys/dev/usb/wlan/if_zyd.c Sat Mar 10 23:16:24 2018 (r330749) @@ -26,6 +26,8 @@ __FBSDID("$FreeBSD$"); * ZyDAS ZD1211/ZD1211B USB WLAN driver. */ +#include "opt_wlan.h" + #include #include #include Modified: head/sys/modules/usb/rum/Makefile == --- head/sys/modules/usb/rum/Makefile Sat Mar 10 23:04:03 2018 (r330748) +++ head/sys/modules/usb/rum/Makefile Sat Mar 10 23:16:24 2018 (r330749) @@ -30,7 +30,7 @@ S=${SRCTOP}/sys .PATH: $S/dev/usb/wlan KMOD= if_rum -SRCS= opt_bus.h opt_usb.h device_if.h bus_if.h usb_if.h usbdevs.h \ - if_rum.c +SRCS= opt_bus.h opt_usb.h opt_wlan.h device_if.h bus_if.h usb_if.h \ + usbdevs.h if_rum.c .include Modified: head/sys/modules/usb/run/Makefile == --- head/sys/modules/usb/run/Makefile Sat Mar 10 23:04:03 2018 (r330748) +++ head/sys/modules/usb/run/Makefile Sat Mar 10 23:16:24 2018 (r330749) @@ -30,7 +30,7 @@ S=${SRCTOP}/sys .PATH: $S/dev/usb/wlan KMOD= if_run -SRCS= opt_bus.h opt_usb.h device_if.h bus_if.h usb_if.h usbdevs.h \ - if_run.c +SRCS= opt_bus.h opt_usb.h opt_wlan.h device_if.h bus_if.h usb_if.h \ + usbdevs.h if_run.c .include Modified: head/sys/modules/us
svn commit: r330750 - in head/sys/dev/rtwn: rtl8188e rtl8192c
Author: avos Date: Sat Mar 10 23:47:03 2018 New Revision: 330750 URL: https://svnweb.freebsd.org/changeset/base/330750 Log: rtwn(4): reset Tx power values before calling get_txpower() for RTL8192C / RTL8188E (like it is done for other chipsets). Modified: head/sys/dev/rtwn/rtl8188e/r88e_chan.c head/sys/dev/rtwn/rtl8192c/r92c_chan.c Modified: head/sys/dev/rtwn/rtl8188e/r88e_chan.c == --- head/sys/dev/rtwn/rtl8188e/r88e_chan.c Sat Mar 10 23:16:24 2018 (r330749) +++ head/sys/dev/rtwn/rtl8188e/r88e_chan.c Sat Mar 10 23:47:03 2018 (r330750) @@ -104,8 +104,6 @@ r88e_get_txpower(struct rtwn_softc *sc, int chain, max_mcs = RTWN_RIDX_HT_MCS(sc->ntxchains * 8 - 1); KASSERT(max_mcs <= RTWN_RIDX_COUNT, ("increase ridx limit\n")); - memset(power, 0, max_mcs * sizeof(power[0])); - /* Compute per-CCK rate Tx power. */ cckpow = rt->cck_tx_pwr[group]; for (ridx = RTWN_RIDX_CCK1; ridx <= RTWN_RIDX_CCK11; ridx++) { Modified: head/sys/dev/rtwn/rtl8192c/r92c_chan.c == --- head/sys/dev/rtwn/rtl8192c/r92c_chan.c Sat Mar 10 23:16:24 2018 (r330749) +++ head/sys/dev/rtwn/rtl8192c/r92c_chan.c Sat Mar 10 23:47:03 2018 (r330750) @@ -102,7 +102,6 @@ r92c_get_txpower(struct rtwn_softc *sc, int chain, max_mcs = RTWN_RIDX_HT_MCS(sc->ntxchains * 8 - 1); KASSERT(max_mcs <= RTWN_RIDX_COUNT, ("increase ridx limit\n")); - memset(power, 0, max_mcs * sizeof(power[0])); if (rs->regulatory == 0) { for (ridx = RTWN_RIDX_CCK1; ridx <= RTWN_RIDX_CCK11; ridx++) power[ridx] = base[chain].pwr[0][ridx]; @@ -225,6 +224,7 @@ r92c_set_txpower(struct rtwn_softc *sc, struct ieee802 int i; for (i = 0; i < sc->ntxchains; i++) { + memset(power, 0, sizeof(power)); /* Compute per-rate Tx power values. */ rtwn_r92c_get_txpower(sc, i, c, power); #ifdef RTWN_DEBUG ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"