CVS commit: [phil-wifi] src/sys/dev/usb
Module Name:src Committed By: nat Date: Mon Apr 27 07:38:25 UTC 2020 Modified Files: src/sys/dev/usb [phil-wifi]: if_urtwn.c Log Message: Software crypto definitions from FreeBSD. To generate a diff of this commit: cvs rdiff -u -r1.59.2.17 -r1.59.2.18 src/sys/dev/usb/if_urtwn.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/usb/if_urtwn.c diff -u src/sys/dev/usb/if_urtwn.c:1.59.2.17 src/sys/dev/usb/if_urtwn.c:1.59.2.18 --- src/sys/dev/usb/if_urtwn.c:1.59.2.17 Mon Apr 27 07:37:01 2020 +++ src/sys/dev/usb/if_urtwn.c Mon Apr 27 07:38:25 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_urtwn.c,v 1.59.2.17 2020/04/27 07:37:01 nat Exp $ */ +/* $NetBSD: if_urtwn.c,v 1.59.2.18 2020/04/27 07:38:25 nat Exp $ */ /* $OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $ */ /*- @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.59.2.17 2020/04/27 07:37:01 nat Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.59.2.18 2020/04/27 07:38:25 nat Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -527,6 +527,11 @@ urtwn_attach(device_t parent, device_t s IEEE80211_HTCAP_SHORTGI40; /* short GI in 40MHz */ #endif + ic->ic_cryptocaps = + IEEE80211_CRYPTO_WEP | + IEEE80211_CRYPTO_TKIP | + IEEE80211_CRYPTO_AES_CCM; + ic->ic_txstream = sc->ntxchains; ic->ic_rxstream = sc->nrxchains;
CVS commit: [phil-wifi] src/sys/dev/usb
Module Name:src Committed By: nat Date: Mon Apr 27 07:37:01 UTC 2020 Modified Files: src/sys/dev/usb [phil-wifi]: if_urtwn.c Log Message: Fix resource leak in rx/tx free lists. To generate a diff of this commit: cvs rdiff -u -r1.59.2.16 -r1.59.2.17 src/sys/dev/usb/if_urtwn.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/usb/if_urtwn.c diff -u src/sys/dev/usb/if_urtwn.c:1.59.2.16 src/sys/dev/usb/if_urtwn.c:1.59.2.17 --- src/sys/dev/usb/if_urtwn.c:1.59.2.16 Sat Apr 25 14:40:11 2020 +++ src/sys/dev/usb/if_urtwn.c Mon Apr 27 07:37:01 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_urtwn.c,v 1.59.2.16 2020/04/25 14:40:11 nat Exp $ */ +/* $NetBSD: if_urtwn.c,v 1.59.2.17 2020/04/27 07:37:01 nat Exp $ */ /* $OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $ */ /*- @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.59.2.16 2020/04/25 14:40:11 nat Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.59.2.17 2020/04/27 07:37:01 nat Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -814,19 +814,23 @@ urtwn_alloc_rx_list(struct urtwn_softc * static void urtwn_free_rx_list(struct urtwn_softc *sc) { + struct urtwn_rx_data *data = NULL; struct usbd_xfer *xfer; - size_t i; DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__)); /* NB: Caller must abort pipe first. */ for (size_t j = 0; j < sc->rx_npipe; j++) { - for (i = 0; i < URTWN_RX_LIST_COUNT; i++) { + mutex_enter(&sc->sc_rx_mtx); + while (!TAILQ_EMPTY(&sc->rx_free_list[j])) { + data = TAILQ_FIRST(&sc->rx_free_list[j]); + TAILQ_REMOVE(&sc->rx_free_list[j], data, next); CTASSERT(sizeof(xfer) == sizeof(void *)); - xfer = atomic_swap_ptr(&sc->rx_data[j][i].xfer, NULL); + xfer = atomic_swap_ptr(&data->xfer, NULL); if (xfer != NULL) usbd_destroy_xfer(xfer); } + mutex_exit(&sc->sc_rx_mtx); } } @@ -875,19 +879,23 @@ urtwn_alloc_tx_list(struct urtwn_softc * static void urtwn_free_tx_list(struct urtwn_softc *sc) { + struct urtwn_tx_data *data = NULL; struct usbd_xfer *xfer; - size_t i; DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__)); /* NB: Caller must abort pipe first. */ for (size_t j = 0; j < sc->tx_npipe; j++) { - for (i = 0; i < URTWN_TX_LIST_COUNT; i++) { + mutex_enter(&sc->sc_tx_mtx); + while (!TAILQ_EMPTY(&sc->tx_free_list[j])) { + data = TAILQ_FIRST(&sc->tx_free_list[j]); + TAILQ_REMOVE(&sc->tx_free_list[j], data, next); CTASSERT(sizeof(xfer) == sizeof(void *)); - xfer = atomic_swap_ptr(&sc->tx_data[j][i].xfer, NULL); + xfer = atomic_swap_ptr(&data->xfer, NULL); if (xfer != NULL) usbd_destroy_xfer(xfer); } + mutex_exit(&sc->sc_tx_mtx); } }
CVS commit: [phil-wifi] src/sys/dev/usb
Module Name:src Committed By: nat Date: Sat Apr 25 14:40:12 UTC 2020 Modified Files: src/sys/dev/usb [phil-wifi]: if_urtwn.c Log Message: Remove configuring 40Mhz channels for now. Avoid duplicate state transitions in urtwn_newstate. Avoid changing channel parameters in urtwn_newstate. Rework of tx desc parameters for all types of packets. Don't create a percpuq as the stack is not expecting it //XXX not sure Tested connections to an open 11n network with 8188CUS, 8192CU and 8192EU usb adaptors. To generate a diff of this commit: cvs rdiff -u -r1.59.2.15 -r1.59.2.16 src/sys/dev/usb/if_urtwn.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/usb/if_urtwn.c diff -u src/sys/dev/usb/if_urtwn.c:1.59.2.15 src/sys/dev/usb/if_urtwn.c:1.59.2.16 --- src/sys/dev/usb/if_urtwn.c:1.59.2.15 Sat Apr 25 09:32:16 2020 +++ src/sys/dev/usb/if_urtwn.c Sat Apr 25 14:40:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_urtwn.c,v 1.59.2.15 2020/04/25 09:32:16 nat Exp $ */ +/* $NetBSD: if_urtwn.c,v 1.59.2.16 2020/04/25 14:40:11 nat Exp $ */ /* $OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $ */ /*- @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.59.2.15 2020/04/25 09:32:16 nat Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.59.2.16 2020/04/25 14:40:11 nat Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -2173,7 +2173,7 @@ urtwn_newstate_cb(struct urtwn_softc *sc /* 802.11b/g */ urtwn_write_1(sc, R92C_INIRTS_RATE_SEL, 3); } else /* IEEE_MODE_11NG */ - urtwn_write_1(sc, R92C_INIRTS_RATE_SEL, 12); /* MCS 0 */ + urtwn_write_1(sc, R92C_INIRTS_RATE_SEL, 11); /* Enable Rx of data frames. */ urtwn_write_2(sc, R92C_RXFLTMAP2, 0x); @@ -2227,7 +2227,7 @@ urtwn_newstate_cb(struct urtwn_softc *sc urtwn_write_1(sc, R92C_T2T_SIFS + 1, sifs_time); /* Initialize rate adaptation. */ - if (ISSET(sc->chip, URTWN_CHIP_88E) || + if (1 || ISSET(sc->chip, URTWN_CHIP_88E) || ISSET(sc->chip, URTWN_CHIP_92EU)) ni->ni_txrate = ni->ni_rates.rs_nrates - 1; else @@ -2311,6 +2311,8 @@ urtwn_newstate(struct ieee80211vap *vap, break; case IEEE80211_S_RUN: + if (nstate == IEEE80211_S_RUN) + break; /* Turn link LED off. */ urtwn_set_led(sc, URTWN_LED_LINK, 0); @@ -2328,9 +2330,11 @@ urtwn_newstate(struct ieee80211vap *vap, urtwn_read_1(sc, R92C_BCN_CTRL) | R92C_BCN_CTRL_DIS_TSF_UDT0); +#if 0 /* Back to 20MHz mode */ urtwn_set_chan(sc, ic->ic_curchan, IEEE80211_HTINFO_2NDCHAN_NONE); +#endif if (ic->ic_opmode == IEEE80211_M_IBSS || ic->ic_opmode == IEEE80211_M_HOSTAP) { @@ -2364,6 +2368,8 @@ urtwn_newstate(struct ieee80211vap *vap, break; case IEEE80211_S_SCAN: + if (ostate == IEEE80211_S_SCAN) + break; if (ostate != IEEE80211_S_SCAN) { /* * Begin of scanning @@ -2404,8 +2410,10 @@ urtwn_newstate(struct ieee80211vap *vap, urtwn_write_1(sc, R92C_TXPAUSE, urtwn_read_1(sc, R92C_TXPAUSE) | 0x0f); +#if 0 urtwn_set_chan(sc, ic->ic_curchan, IEEE80211_HTINFO_2NDCHAN_NONE); +#endif /* Start periodic scan. */ if (!sc->sc_dying) @@ -2413,6 +2421,8 @@ urtwn_newstate(struct ieee80211vap *vap, break; case IEEE80211_S_AUTH: + if (ostate == IEEE80211_S_AUTH) + break; /* Set initial gain under link. */ reg = urtwn_bb_read(sc, R92C_OFDM0_AGCCORE1(0)); reg = RW(reg, R92C_OFDM0_AGCCORE1_GAIN, 0x32); @@ -2432,24 +2442,32 @@ urtwn_newstate(struct ieee80211vap *vap, urtwn_read_4(sc, R92C_RCR) & ~(R92C_RCR_CBSSID_DATA | R92C_RCR_CBSSID_BCN)); +#if 0 urtwn_set_chan(sc, ic->ic_curchan, IEEE80211_HTINFO_2NDCHAN_NONE); +#endif break; case IEEE80211_S_ASSOC: break; case IEEE80211_S_RUN: + if (ostate == IEEE80211_S_RUN) + break; ni = vap->iv_bss; +#if 0 /* XXX: Set 20MHz mode */ urtwn_set_chan(sc, ic->ic_curchan, IEEE80211_HTINFO_2NDCHAN_NONE); +#endif if (ic->ic_opmode == IEEE80211_M_MONITOR) { +#if 0 /* Back to 20MHz mode */ urtwn_set_chan(sc, ic->ic_curchan, IEEE80211_HTINFO_2NDCHAN_NONE); +#endif /* Set media status to 'No Link'. */ urtwn_set_nettype0_msr(sc, R92C_CR_NETTYPE_NOLINK); @@ -3108,9 +3126,6 @@ urtwn_tx(struct urtwn_softc *sc, struct R92C_TXDW0_OWN | R92C_TXDW0_FSG | R92C_TXDW0_LSG); } - if (ic->ic_curmode == IEEE80211_MODE_11NG) - txd->txdw5 |= htole32(R92C_TXDW5_SGI); - if (IEEE80211_IS_MULTICAST(wh->i_addr1)) txd->txdw0 |= htole32(R92C_TXDW0_BMCAST); @@ -3120,15 +3135,21 @@ urtwn_tx(struct urtwn_softc *sc, struct device_xname(sc->sc_dev), __func__, padsize)); txd->txdw1 |= htole32(SM(R92C_TXDW1_PKTOFF, (padsize / 8))); } + if (ic->ic_curmode == IEEE80211_MODE_11B) { + raid = R92C_RAID_11B; + txd->txdw5 |= htole32(SM(R92C_TXDW5_DATARATE, 0)); + } else if (ic->ic_curmode == IEEE80211_MODE_11G) { +
CVS commit: [phil-wifi] src/sys/dev/usb
Module Name:src Committed By: nat Date: Sat Apr 25 09:32:16 UTC 2020 Modified Files: src/sys/dev/usb [phil-wifi]: if_urtwn.c Log Message: Compete some more of 11n support. htcaps and streams values from FreeBSD. To generate a diff of this commit: cvs rdiff -u -r1.59.2.14 -r1.59.2.15 src/sys/dev/usb/if_urtwn.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/usb/if_urtwn.c diff -u src/sys/dev/usb/if_urtwn.c:1.59.2.14 src/sys/dev/usb/if_urtwn.c:1.59.2.15 --- src/sys/dev/usb/if_urtwn.c:1.59.2.14 Tue Apr 21 18:42:38 2020 +++ src/sys/dev/usb/if_urtwn.c Sat Apr 25 09:32:16 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_urtwn.c,v 1.59.2.14 2020/04/21 18:42:38 martin Exp $ */ +/* $NetBSD: if_urtwn.c,v 1.59.2.15 2020/04/25 09:32:16 nat Exp $ */ /* $OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $ */ /*- @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.59.2.14 2020/04/21 18:42:38 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.59.2.15 2020/04/25 09:32:16 nat Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -515,6 +515,21 @@ urtwn_attach(device_t parent, device_t s IEEE80211_C_WME | /* 802.11e */ IEEE80211_C_WPA; /* 802.11i */ + ic->ic_htcaps = + IEEE80211_HTC_HT | + IEEE80211_HTCAP_SHORTGI20 | /* short GI in 20MHz */ +#if 0 + IEEE80211_HTCAP_MAXAMSDU_3839 | /* max A-MSDU length */ +#endif + IEEE80211_HTCAP_SMPS_OFF; /* SM PS mode disabled */ +#if 0 + IEEE80211_HTCAP_CHWIDTH40 | /* 40 MHz channel width */ + IEEE80211_HTCAP_SHORTGI40; /* short GI in 40MHz */ +#endif + + ic->ic_txstream = sc->ntxchains; + ic->ic_rxstream = sc->nrxchains; + ic->ic_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; #ifdef should_delete_NNN @@ -3667,7 +3682,8 @@ urtwn_getradiocaps(struct ieee80211com * setbit(bands, IEEE80211_MODE_11G); setbit(bands, IEEE80211_MODE_11NG); ieee80211_add_channel_list_2ghz(chans, maxchans, nchans, - urtwn_chan_2ghz, nitems(urtwn_chan_2ghz), bands, 0); + urtwn_chan_2ghz, nitems(urtwn_chan_2ghz), bands, IEEE80211_CHAN_HT20 | + IEEE80211_CHAN_HT40U | IEEE80211_CHAN_HT40D); }
CVS commit: [phil-wifi] src/sys/dev/usb
Module Name:src Committed By: nat Date: Sun Apr 19 13:57:23 UTC 2020 Modified Files: src/sys/dev/usb [phil-wifi]: if_urtwn.c Log Message: Initial 11n support for urtwn. Compile tested only... More to come. To generate a diff of this commit: cvs rdiff -u -r1.59.2.12 -r1.59.2.13 src/sys/dev/usb/if_urtwn.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/usb/if_urtwn.c diff -u src/sys/dev/usb/if_urtwn.c:1.59.2.12 src/sys/dev/usb/if_urtwn.c:1.59.2.13 --- src/sys/dev/usb/if_urtwn.c:1.59.2.12 Fri Apr 17 13:44:37 2020 +++ src/sys/dev/usb/if_urtwn.c Sun Apr 19 13:57:23 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_urtwn.c,v 1.59.2.12 2020/04/17 13:44:37 martin Exp $ */ +/* $NetBSD: if_urtwn.c,v 1.59.2.13 2020/04/19 13:57:23 nat Exp $ */ /* $OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $ */ /*- @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.59.2.12 2020/04/17 13:44:37 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.59.2.13 2020/04/19 13:57:23 nat Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -1651,9 +1651,10 @@ urtwn_ra_init(struct ieee80211vap *vap) } if (ic->ic_curmode == IEEE80211_MODE_11B) { mode = R92C_RAID_11B; - } else { + } else if (ic->ic_curmode == IEEE80211_MODE_11G) { mode = R92C_RAID_11BG; - } + } else /* mode = IEEE80211_MODE_11NG */ + mode = R92C_RAID_11GN; DPRINTFN(DBG_INIT, ("%s: %s: mode=%#x rates=%#x, basicrates=%#x, " "maxrate=%zx, maxbasicrate=%zx\n", device_xname(sc->sc_dev), __func__, mode, rates, basicrates, @@ -2153,10 +2154,11 @@ urtwn_newstate_cb(struct urtwn_softc *sc if (ic->ic_curmode == IEEE80211_MODE_11B) { urtwn_write_1(sc, R92C_INIRTS_RATE_SEL, 0); - } else { + } else if (ic->ic_curmode == IEEE80211_MODE_11G) { /* 802.11b/g */ urtwn_write_1(sc, R92C_INIRTS_RATE_SEL, 3); - } + } else /* IEEE_MODE_11NG */ + urtwn_write_1(sc, R92C_INIRTS_RATE_SEL, 12); /* MCS 0 */ /* Enable Rx of data frames. */ urtwn_write_2(sc, R92C_RXFLTMAP2, 0x); @@ -2464,10 +2466,11 @@ urtwn_newstate(struct ieee80211vap *vap, if (ic->ic_curmode == IEEE80211_MODE_11B) { urtwn_write_1(sc, R92C_INIRTS_RATE_SEL, 0); - } else { + } else if (ic->ic_curmode == IEEE80211_MODE_11G) { /* 802.11b/g */ urtwn_write_1(sc, R92C_INIRTS_RATE_SEL, 3); - } + } else /* IEEE_MODE_11NG */ + urtwn_write_1(sc, R92C_INIRTS_RATE_SEL, 12); /* MCS 0 */ /* Enable Rx of data frames. */ urtwn_write_2(sc, R92C_RXFLTMAP2, 0x); @@ -3090,6 +3093,9 @@ urtwn_tx(struct urtwn_softc *sc, struct R92C_TXDW0_OWN | R92C_TXDW0_FSG | R92C_TXDW0_LSG); } + if (ic->ic_curmode == IEEE80211_MODE_11NG) + txd->txdw5 |= htole32(R92C_TXDW5_SGI); + if (IEEE80211_IS_MULTICAST(wh->i_addr1)) txd->txdw0 |= htole32(R92C_TXDW0_BMCAST); @@ -3104,8 +3110,10 @@ urtwn_tx(struct urtwn_softc *sc, struct type == IEEE80211_FC0_TYPE_DATA) { if (ic->ic_curmode == IEEE80211_MODE_11B) raid = R92C_RAID_11B; - else + else if (ic->ic_curmode == IEEE80211_MODE_11G) raid = R92C_RAID_11BG; + else /* IEEE80211_MODE_11NG */ + raid = R92C_RAID_11GN; DPRINTFN(DBG_TX, ("%s: %s: data packet: tid=%d, raid=%d\n", device_xname(sc->sc_dev), __func__, tid, raid)); @@ -3657,6 +3665,7 @@ urtwn_getradiocaps(struct ieee80211com * memset(bands, 0, sizeof(bands)); setbit(bands, IEEE80211_MODE_11B); setbit(bands, IEEE80211_MODE_11G); + setbit(bands, IEEE80211_MODE_11NG); ieee80211_add_channel_list_2ghz(chans, maxchans, nchans, urtwn_chan_2ghz, nitems(urtwn_chan_2ghz), bands, 0); }
CVS commit: [phil-wifi] src/sys/dev/usb
Module Name:src Committed By: martin Date: Fri Apr 17 13:44:38 UTC 2020 Modified Files: src/sys/dev/usb [phil-wifi]: if_urtwn.c Log Message: Make it compilable with URTWN_DEBUG To generate a diff of this commit: cvs rdiff -u -r1.59.2.11 -r1.59.2.12 src/sys/dev/usb/if_urtwn.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/usb/if_urtwn.c diff -u src/sys/dev/usb/if_urtwn.c:1.59.2.11 src/sys/dev/usb/if_urtwn.c:1.59.2.12 --- src/sys/dev/usb/if_urtwn.c:1.59.2.11 Thu Apr 16 17:24:49 2020 +++ src/sys/dev/usb/if_urtwn.c Fri Apr 17 13:44:37 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_urtwn.c,v 1.59.2.11 2020/04/16 17:24:49 nat Exp $ */ +/* $NetBSD: if_urtwn.c,v 1.59.2.12 2020/04/17 13:44:37 martin Exp $ */ /* $OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $ */ /*- @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.59.2.11 2020/04/16 17:24:49 nat Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.59.2.12 2020/04/17 13:44:37 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -3452,7 +3452,9 @@ urtwn_parent(struct ieee80211com *ic) static void urtwn_scan_start(struct ieee80211com *ic) { - //struct urtwn_softc *sc = ic->ic_softc; +#ifdef URTWN_DEBUG + struct urtwn_softc *sc = ic->ic_softc; +#endif //uint32_t reg; //int s; @@ -3515,7 +3517,9 @@ urtwn_scan_start(struct ieee80211com *ic static void urtwn_scan_end(struct ieee80211com *ic) { - //struct urtwn_softc *sc = ic->ic_softc; +#ifdef URTWN_DEBUG + struct urtwn_softc *sc = ic->ic_softc; +#endif DPRINTFN(DBG_FN, ("%s: %s\n",device_xname(sc->sc_dev), __func__));
CVS commit: [phil-wifi] src/sys/dev/usb
Module Name:src Committed By: nat Date: Thu Apr 16 15:33:08 UTC 2020 Modified Files: src/sys/dev/usb [phil-wifi]: if_urtwn.c Log Message: Use if_stat functions. To generate a diff of this commit: cvs rdiff -u -r1.59.2.9 -r1.59.2.10 src/sys/dev/usb/if_urtwn.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/usb/if_urtwn.c diff -u src/sys/dev/usb/if_urtwn.c:1.59.2.9 src/sys/dev/usb/if_urtwn.c:1.59.2.10 --- src/sys/dev/usb/if_urtwn.c:1.59.2.9 Mon Apr 13 08:04:49 2020 +++ src/sys/dev/usb/if_urtwn.c Thu Apr 16 15:33:07 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_urtwn.c,v 1.59.2.9 2020/04/13 08:04:49 martin Exp $ */ +/* $NetBSD: if_urtwn.c,v 1.59.2.10 2020/04/16 15:33:07 nat Exp $ */ /* $OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $ */ /*- @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.59.2.9 2020/04/13 08:04:49 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.59.2.10 2020/04/16 15:33:07 nat Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -2762,7 +2762,7 @@ urtwn_rx_frame(struct urtwn_softc *sc, u */ DPRINTFN(DBG_RX, ("%s: %s: CRC error\n", device_xname(sc->sc_dev), __func__)); - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); return; } @@ -2775,13 +2775,13 @@ urtwn_rx_frame(struct urtwn_softc *sc, u DPRINTFN(DBG_RX, ("%s: %s: packet too short %d\n", device_xname(sc->sc_dev), __func__, pktlen)); vap->iv_stats.is_rx_tooshort++; - ifp->if_ierrors++; + if_statinc(ifp,if_ierrors); return; } if (__predict_false(pktlen > MCLBYTES)) { DPRINTFN(DBG_RX, ("%s: %s: packet too big %d\n", device_xname(sc->sc_dev), __func__, pktlen)); - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); return; } @@ -2805,7 +2805,7 @@ urtwn_rx_frame(struct urtwn_softc *sc, u if (__predict_false(m == NULL)) { aprint_error_dev(sc->sc_dev, "couldn't allocate rx mbuf\n"); vap->iv_stats.is_rx_nobuf++; - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); return; } if (pktlen > (int)MHLEN) { @@ -2815,7 +2815,7 @@ urtwn_rx_frame(struct urtwn_softc *sc, u "couldn't allocate rx mbuf cluster\n"); m_freem(m); vap->iv_stats.is_rx_nobuf++; - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); return; } } @@ -3000,13 +3000,13 @@ urtwn_txeof(struct usbd_xfer *xfer, void usbd_clear_endpoint_stall_async(pipe); } printf("ERROR1\n"); - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); } splx(s); return; } - ifp->if_opackets++; + if_statinc(ifp, if_opackets); urtwn_start(ifp); splx(s); @@ -3308,7 +3308,7 @@ urtwn_start(struct ifnet *ifp) if (m->m_len < (int)sizeof(*eh) && (m = m_pullup(m, sizeof(*eh))) == NULL) { printf("ERROR6\n"); - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); continue; } eh = mtod(m, struct ether_header *); @@ -3316,7 +3316,7 @@ urtwn_start(struct ifnet *ifp) if (ni == NULL) { m_freem(m); printf("ERROR5\n"); - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); continue; } @@ -3327,7 +3327,7 @@ urtwn_start(struct ifnet *ifp) m_freem(m); ieee80211_free_node(ni); printf("ERROR3\n"); - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); continue; } m_freem(m); @@ -3352,7 +3352,7 @@ urtwn_watchdog(struct ifnet *ifp) aprint_error_dev(sc->sc_dev, "device timeout\n"); /* urtwn_init(ifp); XXX needs a process context! */ printf("ERROR2\n"); - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); return; } ifp->if_timer = 1; @@ -3449,7 +3449,7 @@ urtwn_parent(struct ieee80211com *ic) static void urtwn_scan_start(struct ieee80211com *ic) { - struct urtwn_softc *sc = ic->ic_softc; + //struct urtwn_softc *sc = ic->ic_softc; //uint32_t reg; //int s; @@ -3512,7 +3512,7 @@ urtwn_scan_start(struct ieee80211com *ic static void urtwn_scan_end(struct ieee80211com *ic) { - struct urtwn_softc *sc = ic->ic_softc; + //struct urtwn_softc *sc = ic->ic_softc; DPRINTFN(DBG_FN, ("%s: %s\n",device_xname(sc->sc_dev), __func__)); @@ -3565,9 +3565,9 @@ urtwn_transmit(struct ieee80211com *ic, IF_ENQUEUE(&sc->sc_sendq, m); -vap->iv_ifp->if_obytes += pktlen; +if_statadd(vap->iv_ifp, if_obytes, pktlen); if (mcast) -vap->iv_ifp->if_omcasts++; +if_statinc(vap->iv_ifp, if_omcasts); if ((vap->iv_ifp->if_flags & IFF_OACTIVE) == 0) if_start_lock(vap->iv_ifp); @@ -3626,7 +3626,7 @@ urtwn_raw_xmit(struct ieee80211_node *ni error = urtwn_tx(sc, m, ni, data); if (error != 0) { printf("ERROR3\n"); - vap->iv_ifp->if_oerrors++; +if_statinc(vap->iv_ifp, if_oerrors); } else { sc->tx_timer = 5; vap->iv_ifp->if_t
CVS commit: [phil-wifi] src/sys/dev/usb
Module Name:src Committed By: nat Date: Thu Apr 16 15:32:24 UTC 2020 Modified Files: src/sys/dev/usb [phil-wifi]: if_urtwnvar.h Log Message: Pull in To generate a diff of this commit: cvs rdiff -u -r1.10.16.5 -r1.10.16.6 src/sys/dev/usb/if_urtwnvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/usb/if_urtwnvar.h diff -u src/sys/dev/usb/if_urtwnvar.h:1.10.16.5 src/sys/dev/usb/if_urtwnvar.h:1.10.16.6 --- src/sys/dev/usb/if_urtwnvar.h:1.10.16.5 Mon Apr 13 08:04:49 2020 +++ src/sys/dev/usb/if_urtwnvar.h Thu Apr 16 15:32:24 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_urtwnvar.h,v 1.10.16.5 2020/04/13 08:04:49 martin Exp $ */ +/* $NetBSD: if_urtwnvar.h,v 1.10.16.6 2020/04/16 15:32:24 nat Exp $ */ /* $OpenBSD: if_urtwnreg.h,v 1.3 2010/11/16 18:02:59 damien Exp $ */ /*- @@ -19,6 +19,8 @@ #ifndef _IF_URTWNVAR_H_ #define _IF_URTWNVAR_H_ +#include + /* * Driver definitions. */