summaryrefslogtreecommitdiff
path: root/sys/dev/usb/if_rum.c
AgeCommit message (Collapse)Author
2022-08-12rum(4): Avoid uninitialized garbage in failed register read.riastradh
Reported-by: syzbot+f2cba71b1b1bc91029b3@syzkaller.appspotmail.com https://syzkaller.appspot.com/bug?id=7a01863d0fe34a4946516388c436991ba2beaa63
2020-03-15Define and implement a locking protocol for the ifmedia / mii layers:thorpej
- 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-14revert the 0x% -> %# change for fixed width formats pointed out by uwe.christos
2020-03-13PR/55068: sc.dying: Fix printf formats:christos
- no %s/%p for kernel log - 0x% -> %# - always %j for kernel log
2020-01-29Adopt <net/if_stats.h>.thorpej
2019-05-05remove explicit 'extern struct cfdriver <my>_cd;' and use ioconf.hmrg
2018-09-12Don't have modules depend on bpf; they will find the dependency dynamicallychristos
at runtime. Otherwise builtin modules will complain about non-builtin bpf.
2018-08-02Fix usb_rem_task_wait API.riastradh
- 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-07-29Use callout_halt and usb_rem_task_wait in rum(4) detach.riastradh
Also comment on sketchiness in rum_newstate that is beyond my scope right now. squash! 815cfdcb30208ae2d1cffe19b1cd4ef85ab19f3c
2018-06-26 Implement the BPF direction filter (BIOC[GS]DIRECTION). It provides backwardmsaitoh
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-05-01GC private 802.11 rateset declarations, use the standard ones.maya
Build tested only.
2018-01-21PR kern/52931 Kernel panics with Atheros usb wireless interfaceskrll
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
2017-05-23Also attach the MW-P54SS USB Wireless Broadband Router from Synetkhorben
Tested on NetBSD/amd64 (in HostAP mode)
2016-11-25+#include "opt_usb.h"skrll
2016-07-07KNF. Remove extra spaces. No functional change.msaitoh
2016-06-10Introduce m_set_rcvif and m_reset_rcvifozaki-r
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-05-26Introduce M_CLEARCTX and use it instead of open-coding rcvifozaki-r
No functional change.
2016-05-26Use M_GETCTXozaki-r
No functional change.
2016-04-23Merge nick-nhusbskrll
- 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
2015-08-30loadfirmware is not NetBSD function. Fix error message.ryoon
2015-04-08Added pmf hook.nonaka
2015-01-07Pass a correct firmware size (instead of 0) to firmware_freeozaki-r
firmware_free now uses kmem_free(9) instead of free(9), so we need to pass a correct size to it.
2014-03-29Fix an issue with 11g beacon frames.zafer
From FreeBSD Rev. 226465 Makes 11g wep, wpa2 and hostap work again.
2013-01-22- Add a USBD_MPSAFE flag to usbd_open_pipe. If not set, acquire KERNEL_LOCKjmcneill
before invoking xfer callbacks on this pipe. - Add an extra flags parameter to usb_init_task. If USBD_TASKQ_MPSAFE is not present, acquire KERNEL_LOCK before invoking the task callback.
2013-01-05fix debug variables.christos
- include opt_usb.h in usb.h so that USB_DEBUG gets set properly in it. - normalize and sort debugging variables
2013-01-05- need opt_usb.h if depending on USB_DEBUGchristos
- remove trailing whitespace - add missing KERNEL_RCSID
2012-12-27Consistent/Correct error message from failing usbd_set_config.skrll
Use aprint_error_dev.
2012-09-23add a bunch of devices. from openbsd.chs
2012-06-01Add a dependency on bpf module.nonaka
2012-05-31Remove duplicate entries.nonaka
2011-09-08PR/45344: Pierre Allegraud: Added Dlink DWA-110 in rum(4)christos
2011-08-25Update the module command-processing routine to match the ioconf filespgoyette
2011-08-23Update for modular buildpgoyette
2011-08-23In preparation for building this as a module, clean-up some gccpgoyette
-Wsign-compare issues so it will build with WARNS=4
2011-02-22make rum_ioctl look like other wireless drivers, now dhcpcd works andjmcneill
mdnsd doesn't hang my laptop
2011-02-21sync driver with openbsdjmcneill
2011-02-13fix typo (clean up the rx list on failure setting it up, not the tx list)dholland
from openbsd -r1.75, mentioned by Alexander Nasonov in PR 42667
2010-11-03Stop using the compatibility macros USB_ATTACH(), USB_DETACH(),dyoung
USB_MATCH(), et cetera. These files produce the same assembly (according to objdump -d) before and after the change, except for if_cue.c where two adjacent instructions inexplicably change order.
2010-04-05Push the bpf_ops usage back into bpf.h. Push the common ifp->if_bpfjoerg
check into the inline functions as well the fourth argument for bpf_attach.
2010-01-19Redefine bpf linkage through an always present op vector, i.e.pooka
#if NBPFILTER is no longer required in the client. This change doesn't yet add support for loading bpf as a module, since drivers can register before bpf is attached. However, callers of bpf can now be modularized. Dynamically loadable bpf could probably be done fairly easily with coordination from the stub driver and the real driver by registering attachments in the stub before the real driver is loaded and doing a handoff. ... and I'm not going to ponder the depths of unload here. Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump.
2009-12-06Simplify several device-activation hooks.dyoung
2009-09-28Attach DWA-111.pooka
XXX: Adapter seems to be generally functional, but at least on -nb5 WPA didn't work very well (managed to get authenticated and sometimes an address via dhcp, but that's it). I can't currently test non-wpa networks, so don't know if it's an issue only with wpa or with the connectivity in general.
2009-09-23fix up USB drivers printing of autoconf informationplunky
1. expand the USB_ATTACH_SETUP macro (requested by jmcneill) 2. reorder the attach function so that the first thing it does is print newlines. 3. after this, we can call usbd_devinfo_alloc(), which polls the device allowing a context switch, and aprint_normal() the device information. this avoids problems where autoconf messages are getting mixed up.
2009-08-02add Melco(Buffalo) WLI-UC-G 11b/11g wifi adaptor (rt2573).tshiozak
This works fine for 11b, but unstable for 11g.
2009-03-18bzero -> memsetcegger
2009-01-03remove extra semicolons.yamt
2008-11-07*** Summary ***dyoung
When a link-layer address changes (e.g., ifconfig ex0 link 02:de:ad:be:ef:02 active), send a gratuitous ARP and/or a Neighbor Advertisement to update the network-/link-layer address bindings on our LAN peers. Refuse a change of ethernet address to the address 00:00:00:00:00:00 or to any multicast/broadcast address. (Thanks matt@.) Reorder ifnet ioctl operations so that driver ioctls may inherit the functions of their "class"---ether_ioctl(), fddi_ioctl(), et cetera---and the class ioctls may inherit from the generic ioctl, ifioctl_common(), but both driver- and class-ioctls may override the generic behavior. Make network drivers share more code. Distinguish a "factory" link-layer address from others for the purposes of both protecting that address from deletion and computing EUI64. Return consistent, appropriate error codes from network drivers. Improve readability. KNF. *** Details *** In if_attach(), always initialize the interface ioctl routine, ifnet->if_ioctl, if the driver has not already initialized it. Delete if_ioctl == NULL tests everywhere else, because it cannot happen. In the ioctl routines of network interfaces, inherit common ioctl behaviors by calling either ifioctl_common() or whichever ioctl routine is appropriate for the class of interface---e.g., ether_ioctl() for ethernets. Stop (ab)using SIOCSIFADDR and start to use SIOCINITIFADDR. In the user->kernel interface, SIOCSIFADDR's argument was an ifreq, but on the protocol->ifnet interface, SIOCSIFADDR's argument was an ifaddr. That was confusing, and it would work against me as I make it possible for a network interface to overload most ioctls. On the protocol->ifnet interface, replace SIOCSIFADDR with SIOCINITIFADDR. In ifioctl(), return EPERM if userland tries to invoke SIOCINITIFADDR. In ifioctl(), give the interface the first shot at handling most interface ioctls, and give the protocol the second shot, instead of the other way around. Finally, let compatibility code (COMPAT_OSOCK) take a shot. Pull device initialization out of switch statements under SIOCINITIFADDR. For example, pull ..._init() out of any switch statement that looks like this: switch (...->sa_family) { case ...: ..._init(); ... break; ... default: ..._init(); ... break; } Rewrite many if-else clauses that handle all permutations of IFF_UP and IFF_RUNNING to use a switch statement, switch (x & (IFF_UP|IFF_RUNNING)) { case 0: ... break; case IFF_RUNNING: ... break; case IFF_UP: ... break; case IFF_UP|IFF_RUNNING: ... break; } unifdef lots of code containing #ifdef FreeBSD, #ifdef NetBSD, and #ifdef SIOCSIFMTU, especially in fwip(4) and in ndis(4). In ipw(4), remove an if_set_sadl() call that is out of place. In nfe(4), reuse the jumbo MTU logic in ether_ioctl(). Let ethernets register a callback for setting h/w state such as promiscuous mode and the multicast filter in accord with a change in the if_flags: ether_set_ifflags_cb() registers a callback that returns ENETRESET if the caller should reset the ethernet by calling if_init(), 0 on success, != 0 on failure. Pull common code from ex(4), gem(4), nfe(4), sip(4), tlp(4), vge(4) into ether_ioctl(), and register if_flags callbacks for those drivers. Return ENOTTY instead of EINVAL for inappropriate ioctls. In zyd(4), use ENXIO instead of ENOTTY to indicate that the device is not any longer attached. Add to if_set_sadl() a boolean 'factory' argument that indicates whether a link-layer address was assigned by the factory or some other source. In a comment, recommend using the factory address for generating an EUI64, and update in6_get_hw_ifid() to prefer a factory address to any other link-layer address. Add a routing message, RTM_LLINFO_UPD, that tells protocols to update the binding of network-layer addresses to link-layer addresses. Implement this message in IPv4 and IPv6 by sending a gratuitous ARP or a neighbor advertisement, respectively. Generate RTM_LLINFO_UPD messages on a change of an interface's link-layer address. In ether_ioctl(), do not let SIOCALIFADDR set a link-layer address that is broadcast/multicast or equal to 00:00:00:00:00:00. Make ether_ioctl() call ifioctl_common() to handle ioctls that it does not understand. In gif(4), initialize if_softc and use it, instead of assuming that the gif_softc and ifp overlap. Let ifioctl_common() handle SIOCGIFADDR. Sprinkle rtcache_invariants(), which checks on DIAGNOSTIC kernels that certain invariants on a struct route are satisfied. In agr(4), rewrite agr_ioctl_filter() to be a bit more explicit about the ioctls that we do not allow on an agr(4) member interface. bzero -> memset. Delete unnecessary casts to void *. Use sockaddr_in_init() and sockaddr_in6_init(). Compare pointers with NULL instead of "testing truth". Replace some instances of (type *)0 with NULL. Change some K&R prototypes to ANSI C, and join lines.
2008-10-21Addjun
corega K.K CG-WLUSB2GPX
2008-07-08Add a device ID seen in Kojinsha notebook. From Ryo Shimizu.uebayasi
2008-05-24Split device_t and softc for all USB device drivers, and related cosmeticcube
changes. Matthias Drochner kindly reviewed this patch, and tested ums, ubt, uaudio and ral. I tested umass myself.