Commit Graph

88 Commits

Author SHA1 Message Date
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
mlelstv
2610f5dfb8 match RTL8188EU device from vendor ABOCOM. 2016-11-04 20:44:57 +00:00
nat
041ac2d003 Add support for Realtek 8192EU.
OK christos@
2016-10-12 03:23:29 +00:00
nat
989fb94197 IQ Calibration for urtwn devices.
Addresses PR/47781.

OK christos@
2016-10-12 02:56:45 +00:00
nat
c2d8ad4435 Stop urtwn devices from usb suspend, allow remote wifi activity wakeup.
Addresses PR/51111.

OK christos@
2016-10-12 02:50:44 +00:00
christos
cb71a6cf14 PR/51529: Jake Slazenger: D-Link DWA 125 rev. D1 USB wireless network adapter
support
2016-10-04 21:36:38 +00:00
ozaki-r
d938d837b3 Introduce m_set_rcvif and m_reset_rcvif
The API is used to set (or reset) a received interface of a mbuf.
They are counterpart of m_get_rcvif, which will come in another
commit, hide internal of rcvif operation, and reduce the diff of
the upcoming change.

No functional change.
2016-06-10 13:27:10 +00:00
ozaki-r
6bbd2477a9 Introduce M_CLEARCTX and use it instead of open-coding rcvif
No functional change.
2016-05-26 05:04:46 +00:00
ozaki-r
ea0349e714 Use M_GETCTX
No functional change.
2016-05-26 05:01:11 +00:00
skrll
4e8e66439e Merge nick-nhusb
- API / infrastructure changes to support memory management changes.
- Memory management improvements and bug fixes.
- HCDs should now be MP safe
- conversion to KERNHIST based debug
- FS/LS isoc support on ehci(4).
- conversion to kmem(9)
- Some USB 3 support - mostly from Takahiro HAYASHI (t-hash).
- interrupt transfers now get proper DMA operations
- general bug fixes
    - kern/48308
    - uhub status notification improvements
    - umass(4) probe fix (applied to HEAD already)
    - ohci(4) short transfer fix
2016-04-23 10:15:27 +00:00
nonaka
af98b0b25e Use correct register definition. 2016-01-18 02:45:05 +00:00
christos
3570a3e5e8 PR/50672: Andriy Voskoboinyk: fix write to the wrong register. 2016-01-17 22:32:09 +00:00
leot
5e4b22043b Add support for Realtek RTL8188CU_3. 2015-12-10 14:28:04 +00:00