Commit Graph

109 Commits

Author SHA1 Message Date
riastradh 048ca36a11 urtwn(4): Ditch old queued commands on overflow.
Don't increment ring->queued past what the task will decrement.

This is a stop-gap measure; really, we should just have one task for
each operation that is deferred to the task thread.

PR kern/57965
2024-02-28 20:18:13 +00:00
maya 9b0ba0f262 Add Mercusys NW150US V2 USB support
No changes needed, other than recognizing it as working.

From Daeil Lee in PR/57819
2024-01-06 00:26:26 +00:00
mrg f8570f8a97 fix simple mis-matched function prototype and definitions.
most of these are like, eg

   void foo(int[2]);

with either of these

   void foo(int*) { ... }
   void foo(int[]) { ... }

in some cases (such as stat or utimes* calls found in our header files),
we now match standard definition from opengroup.

found by GCC 12.
2023-08-01 07:04:14 +00:00
mrg d6a34bb1ef various debug updates for some usb drivers
- several new *_DEBUG_DEFAULT options that allow usb debug values to
  be set to a default that is non-zero:
  EHCI_DEBUG_DEFAULT, UGEN_DEBUG_DEFAULT, URTWN_DEBUG_DEFAULT,
  UMS_DEBUG_DEFAULT, and USB_DEBUG_DEFAULT
- ugen debug uses fewer usbhist lines for the same info
- ums.c converted from printf() to usbhist
2023-07-20 20:00:34 +00:00
mlelstv 6441916c01 Don't report errors as timeout. 2022-07-31 12:59:26 +00:00
brook fcd3f3e4f7 if_urtwn.c: add the TRENDnet TEW-648UBM 2022-06-23 13:46:27 +00:00
mlelstv fb37289010 revert accidental last commit (except ukbd.c) 2022-04-06 22:01:45 +00:00
mlelstv 0e42e7d3b0 remove debug printf 2022-04-06 21:51:29 +00:00
jnemeth 01654ab70b add Edimax N150 adapter; tested on my PBP 2021-10-21 20:18:16 +00:00
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