Commit Graph

100 Commits

Author SHA1 Message Date
nat 0a7d393224 Sprinkle a little delay. 2021-09-17 13:02:52 +00:00
nat 1a598e6b2a Initialize firmware mailbox counter when firmware is reset. 2021-09-17 13:00:20 +00:00
nat 97cfc6725d Serialize sending of firmware commands to device. 2021-09-17 12:58:31 +00:00
nat 34e4a68c60 Use urtwn_delay_ms were possibile.
NFC intended.
2021-09-17 12:55:10 +00:00
nat 7ed931797f Opps....Remove irrelavent debug code and don't free_m before IFQ_DEQUEUE().
Identified and reported by Patrick Welche and remedy found by Martin Husemann.
2021-03-02 22:21:38 +00:00
nat 37857f2468 Also free assocated mbufs. 2021-02-26 01:38:44 +00:00
mrg 605a7c24da replace printf "ERROR<n>" with device_printf() and useful messages. 2021-02-21 23:06:13 +00:00
yamt d4af37e952 if_urtwn.c: Plug a few leaks
Can be a cause of PR/55968
2021-02-02 10:46:17 +00:00
yamt 081d34a17b if_urtwn: Add a missing newline to an aprint_error_dev message 2021-02-02 00:27:38 +00:00
riastradh dd9425dfa7 urtwn(4): Check for allocation failure in urtwn_tx_beacon.
Candidate fix for PR kern/55968.
2021-02-01 06:59:37 +00:00
nia fed6c1129b add another TPLINK RTL8192EU variant
to avoid confusion use TP-Link's names for these variants, matching
FreeBSD
2021-02-01 04:46:33 +00:00
nia 45262cdc73 urtwn(4): add TPLINK WN821N to the list of USB device ids
reported by kfmut on the unitedbsd forums.
2021-01-31 18:05:38 +00:00
jdolecek 0b2511aeb5 mark several init-only functions as noinline to avoid bumping into the
stack limit
2020-06-27 14:34:45 +00:00
mrg ed31279e71 don't forget to destroy the new sc_media_mtx mutex.
now re-plugging and re-using the same softc doesn't give mutex
already initialised error.
2020-05-02 00:50:07 +00:00
nat a7c4415c1f Correct rx packet count for 8192EU. Tested OK. 2020-04-16 17:18:27 +00:00
skrll 0bcaf9360b Add D-Link DWA-121 rev B1 to list of supported devices
From Miguel Landaeta in kern/55140
2020-04-04 08:46:01 +00:00
thorpej 7a9a30c5e7 Define and implement a locking protocol for the ifmedia / mii layers:
- MP-safe drivers provide a mutex to ifmedia that is used to serialize
  access to media-related structures / hardware regsiters.  Converted
  drivers use the new ifmedia_init_with_lock() function for this.  The
  new name is provided to ease the transition.
- Un-converted drivers continue to call ifmedia_init(), which will supply
  a compatibility lock to be used instead.  Several media-related entry
  points must be aware of this compatibility lock, and are able to acquire
  it recursively a limited number of times, if needed.  This is a SPIN
  mutex with priority IPL_NET.
- This same lock is used to serialize access to PHY registers and other
  MII-related data structures.

The PHY drivers are modified to acquire and release the lock, as needed,
and assert the lock is held as a diagnostic aid.

The "usbnet" framework has had an overhaul of its internal locking
protocols to fit in with the media / mii changes, and the drivers adapted.

USB wifi drivers have been changed to provide their own adaptive mutex
to the ifmedia later via a new ieee80211_media_init_with_lock() function.
This is required because the USB drivers need an adaptive mutex.

Besised "usbnet", a few other drivers are converted: vmx, wm, ixgbe / ixv.

mcx also now calls ifmedia_init_with_lock() because it needs to also use
an adaptive mutex.  The mcx driver still needs to be fully converted to
NET_MPSAFE.
2020-03-15 23:04:50 +00:00
christos aa3d6ec155 revert the 0x% -> %# change for fixed width formats pointed out by uwe. 2020-03-14 02:35:33 +00:00
christos d3dde16c1a PR/55068: sc.dying: Fix printf formats:
- no %s/%p for kernel log
- 0x% -> %#
- always %j for kernel log
2020-03-13 18:17:40 +00:00
thorpej cdaa0e91f5 Adopt <net/if_stats.h>. 2020-01-29 06:35:28 +00:00
skrll c6828b08e2 Use modern interfaces and kill tsleep/wakeup. From nick-nhusb branch. 2020-01-15 08:20:13 +00:00
skrll 3db7d1a277 Trailing whitespace 2020-01-15 08:13:20 +00:00
maxv 954f6141d7 Fix gross use-after-free. Found by a custom query on LGTM. 2019-12-13 14:10:32 +00:00
mlelstv b9aa28ee06 Don't deregister twice with pmf. 2019-12-01 21:02:09 +00:00
mlelstv b9245c5465 Reset MCU ready status before resetting the MCU.
Fixes PR kern/54728
2019-12-01 21:01:19 +00:00
gson 8b9242afb5 Change 0x%jx -> %#jx as suggested by christos. 2019-11-26 10:34:16 +00:00
gson 88b2e353f0 Convert debug printfs to usbhist. 2019-11-26 10:24:17 +00:00
bad 6e08bf3e28 use ether_snprintf instead of open coding it. 2019-10-10 23:30:02 +00:00
mrg 6134657d6b move the call to rnd_attach_source() earlier and add a matching
call to rnd_detach_source() into detach.

fixes an attach-detach-reattach issue where the rnd source was
already known.
2019-08-19 07:20:07 +00:00
msaitoh 7f827af857 Avoid undefined behavior. Found by KUBSan. 2019-07-25 14:31:35 +00:00
msaitoh 21fb8e23a8 Add rnd(9) support. 2019-06-15 04:00:17 +00:00
christos aefefd4dcd add SIOCS80211CHANNEL special handling in monitor mode (from OpenBSD) 2019-03-07 14:55:49 +00:00
christos 93f9738b24 Add a software beacon.
XXX: As all the other usb software beacons this is driven at fixed intervals
when usb task fires.
2019-02-01 03:20:35 +00:00
tih c07c190fc4 Add D-Link DWA-131 rev E "Wireless N300 Nano USB Adapter"
OK: jmcneill
2018-12-20 15:16:07 +00:00
msaitoh 38ad04ccb5 Make IODATA WN-G150UMW work:
- Increase delay to prevent "could not send firmware command". The value
  is taken from FreeBSD.
-Increase delay to prevent "timeout waiting for firmware readiness". The
  vaule is taken from Linux.
2018-12-15 10:30:58 +00:00
mlelstv 695baa5ba5 Fix race in attachment. 2018-11-13 10:35:32 +00:00
christos 60d3fae6ae Don't have modules depend on bpf; they will find the dependency dynamically
at runtime. Otherwise builtin modules will complain about non-builtin bpf.
2018-09-12 21:57:18 +00:00
riastradh a1de014734 Fix usb_rem_task_wait API.
- Return whether it removed task from queue or not.
  . True if it was on the queue and we intercepted it before it ran.
  . False if we could not intercept it: either it wasn't queued,
    or it already ran.  (Up to caller to distinguish these cases.)
- Pass an optional interlock like callout_halt.

While here, simplify.

ok mrg@
2018-08-02 06:09:04 +00:00
jmcneill e03aac56c2 Skip urtwn_chip_stop for 88E family chips as we do for 92EU.
Doing "ifconfig urtwn0 down" with an RTL8188EU on Pinebook causes the
device to disappear from the built-in GL850G USB 2.0 hub. Since this
happens at reboot, an unplug/replug cycle is the only way to make the
device re-appear. Bypassing urtwn_chip_stop works around this issue.
2018-07-30 00:17:28 +00:00
riastradh e4eeae7602 Use usb_rem_task_wait in urtwn(4) detach. 2018-07-29 02:07:22 +00:00
thorpej 3e554dfa58 - Unify the "rtwn" and "urtwn" register definitions and initialization
tables into common header files shared by both drivers.
- Fix some register and bit definitions, from OpenBSD and verified against
  the vendor driver.
- Add some additional register / descriptor defnitions, from OpenBSD.
2018-06-29 04:02:10 +00:00
msaitoh 3cd62456f9 Implement the BPF direction filter (BIOC[GS]DIRECTION). It provides backward
compatibility with BIOC[GS]SEESENT ioctl. The userland interface is the same
as FreeBSD.

 This change also fixes a bug that the direction is misunderstand on some
environment by passing the direction to bpf_mtap*() instead of checking
m->m_pkthdr.rcvif.
2018-06-26 06:47:57 +00:00
nat bd032a9faa Fix support for 8192eu, notably TPLINK TL-WN823NV2, by using the right
registers when setting receiver gain.

Ok christos@.
2018-06-01 19:19:54 +00:00
dholland 32cded6cc9 Typos. 2018-02-08 09:05:16 +00:00
skrll b842161189 PR kern/52931 Kernel panics with Atheros usb wireless interface
Audit the flags to usbd_create_xfer so that USBD_FORCE_SHORT_XFER is
supplied wherever such a transfer is setup.  We can drop
USBD_SHORT_XFER_OK as it has not bearing on number of TDs
2018-01-21 13:57:11 +00:00
skrll c5f9f6e879 PR/52702 Malicious USB devices attaching as urtwn(4) can corrupt kernel memory
Patch from PR slighly updated by me
2017-11-17 13:27:09 +00:00
khorben 4228541099 Also attach the RTL8192EU from TP-LINK 2017-10-31 00:57:14 +00:00
jnemeth 0515d33fc8 PR/52212 - Kai-Uwe Eckhardt -- add TP-Link TL-WN722N v2 2017-05-03 15:34:05 +00:00
skrll c5a90c121f Whitespace 2016-12-04 10:08:26 +00:00
skrll a7c71d30d6 +#include "opt_usb.h" 2016-11-25 12:56:29 +00:00