summaryrefslogtreecommitdiff
path: root/sys/dev/usb/if_upl.c
AgeCommit message (Collapse)Author
2018-10-02Make some USB ioctls return ENXIO, instead of EIO, if usbd_is_dying().Stefan Sperling
Brings us one step closer towards making this condition's error code consistent across all USB drivers. Patch by Moritz Buhl ok mpi@ bluhm@
2017-10-29IFF_NOARP has no effect if the interface don't use ether_input() norMartin Pieuchot
ether_output().
2017-01-22move counting if_opackets next to counting if_obytes in if_enqueue.David Gwynne
this means packets are consistently counted in one place, unlike the many and various ways that drivers thought they should do it. ok mpi@ deraadt@
2016-11-06Avoid calling usbd_set_config_no() in *_attach() and let the stack doMartin Pieuchot
it instead. If anything bad happen due to a malformed descriptor it makes no sense to try to attach a driver, and bail before probing. This is similar to the change to avoid calling usbd_set_config_index().
2016-04-13G/C IFQ_SET_READY().Martin Pieuchot
2015-11-25Network drivers should not include <net/route.h> or <net/netisr.h>Martin Pieuchot
2015-11-25replace IFF_OACTIVE manipulation with mpsafe operations.David Gwynne
there are two things shared between the network stack and drivers in the send path: the send queue and the IFF_OACTIVE flag. the send queue is now protected by a mutex. this diff makes the oactive functionality mpsafe too. IFF_OACTIVE is part of if_flags. there are two problems with that. firstly, if_flags is a short and we dont have any MI atomic operations to manipulate a short. secondly, while we could make the IFF_OACTIVE operates mpsafe, all changes to other flags would have to be made safe at the same time, otherwise a read-modify-write cycle on their updates could clobber the oactive change. instead, this moves the oactive mark into struct ifqueue and provides an API for changing it. there's ifq_set_oactive, ifq_clr_oactive, and ifq_is_oactive. these are modelled on ifsq_set_oactive, ifsq_clr_oactive, and ifsq_is_oactive in dragonflybsd. this diff includes changes to all the drivers manipulating IFF_OACTIVE to now use the ifsq_{set,clr_is}_oactive API too. ok kettenis@ mpi@ jmatthew@ deraadt@
2015-11-20shuffle struct ifqueue so in flight mbufs are protected by a mutex.David Gwynne
the code is refactored so the IFQ macros call newly implemented ifq functions. the ifq code is split so each discipline (priq and hfsc in our case) is an opaque set of operations that the common ifq code can call. the common code does the locking, accounting (ifq_len manipulation), and freeing of the mbuf if the disciplines enqueue function rejects it. theyre kind of like bufqs in the block layer with their fifo and nscan disciplines. the new api also supports atomic switching of disciplines at runtime. the hfsc setup in pf_ioctl.c has been tweaked to build a complete hfsc_if structure which it attaches to the send queue in a single operation, rather than attaching to the interface up front and building up a list of queues. the send queue is now mutexed, which raises the expectation that packets can be enqueued or purged on one cpu while another cpu is dequeueing them in a driver for transmission. a lot of drivers use IFQ_POLL to peek at an mbuf and attempt to fit it on the ring before committing to it with a later IFQ_DEQUEUE operation. if the mbuf gets freed in between the POLL and DEQUEUE operations, fireworks will ensue. to avoid this, the ifq api introduces ifq_deq_begin, ifq_deq_rollback, and ifq_deq_commit. ifq_deq_begin allows a driver to take the ifq mutex and get a reference to the mbuf they wish to try and tx. if there's space, they can ifq_deq_commit it to remove the mbuf and release the mutex. if there's no space, ifq_deq_rollback simply releases the mutex. this api was developed to make updating the drivers using IFQ_POLL easy, instead of having to do significant semantic changes to avoid POLL that we cannot test on all the hardware. the common code has been tested pretty hard, and all the driver modifications are straightforward except for de(4). if that breaks it can be dealt with later. ok mpi@ jmatthew@
2015-06-30Rename if_output() into if_enqueue() to avoid confusion with commentsMartin Pieuchot
talking about (*ifp->if_output)(). ok claudio@, dlg@
2015-06-24Increment if_ipackets in if_input().Martin Pieuchot
Note that pseudo-drivers not using if_input() are not affected by this conversion. ok mikeb@, kettenis@, claudio@, dlg@
2015-05-21Convert to if_output().Martin Pieuchot
2015-04-10Convert remaining USB Ethernet adapter to if_input().Martin Pieuchot
ok dlg@
2015-03-14Remove some includes include-what-you-use claims don'tJonathan Gray
have any direct symbols used. Tested for indirect use by compiling amd64/i386/sparc64 kernels. ok tedu@ deraadt@
2015-02-04Kill annoying comments about ether_input()Martin Pieuchot
2014-12-29Some missing break's.Brad Smith
2014-12-29Some cleaning up of the ioctl handling bits to bring things in lineBrad Smith
with the other drivers.
2014-12-22unifdef INETTed Unangst
2014-07-13No need for <netinet/in_systm.h> here.Martin Pieuchot
2014-07-12Kill a bunch of DVACT_DEACTIVATE handlers whose only purpose were toMartin Pieuchot
set the 'dying' flag of a device. Such handlers are useless now that usbd_detach() already set this flag. Even if the purpose of this flag is questionnable on OpenBSD because DVACT_DEACTIVATE acts as a pre-detach event, this is just a first small step towards the simplification of the autoconf(9) device states. This cleaning is now possible thanks to the work of pirofti@ to convert all the USB drivers to properly use usbd_is_dying(). Discussed many times with deraadt@
2014-01-07Remove unused fields.Martin Pieuchot
ok sasano@
2013-11-15Clean-up usbd_abort_pipe() usage.Paul Irofti
This function never fails. So change it's return type to void and adjust the copy-pasted callers that were checking the return. "If it compiles, ok" mpi@
2013-11-06Replace sc_dying in favour of usbd_is_dying() and usbd_deactivate().Paul Irofti
Okay mpi@
2013-10-29Kill sc_attached, attach and detach events for USB devices are triggeredMartin Pieuchot
by the same explore task and cannot happen in parallel.
2013-08-07Most network drivers include netinet/in_var.h, but apparently theyAlexander Bluhm
don't have to. Just remove these include lines. Compiled on amd64 i386 sparc64; OK henning@ mikeb@
2013-04-15Get rid of various 'typedef struct' definitions and use plain structureMarcus Glocker
definitions instead. We don't change usb.h for now to stay compatible with userland. Tested by mpi@ on macppc and myself on i386. ok mpi@
2013-02-07Remove dead code.Martin Pieuchot
ok mikeb@
2012-11-28- Use IF_Gbps(1) instead of IF_Mbps(1000)Brad Smith
- Use IF_Mbps() instead of multiplying the link speed by a bare value - Remove a useless comment as baudrate is already handled properly - Remove some commented out bits of code - Use IF_Mbps() instead of the bare value ok sthen@
2011-07-03Remove config_activate() and DVACT_ACTIVATE. PCMCIA's the only thingMatthew Dempsky
that's ever used it, and it's long since been changed to use DVACT_{QUIESCE,SUSPEND,RESUME} instead. ok deraadt@, dlg@; miod@ also agreed with this idea when I brought it up a few weeks ago
2011-01-25garbage collect "usb events". without /dev/usb there is no way to accessJacob Meuser
them from userland, and nothing in the kernel uses them. ok krw@, miod@
2010-12-17- use usb_lookup() instead of handrolled macro.Jasper Lievisse Adriaanse
ok jakemsr@
2010-12-06a couple unchecked if_detach() in detach routines that were missedJacob Meuser
in previous sweep (avoid NULL deref if the device didn't fully attach)
2010-09-24remove dying flag in detach() function.Yojiro Uo
The dying flag will be set in activate()/DEACTIVATE. ok deraadt@
2009-10-13Get rid of devact enum, substitute it with an int and coresponding defines.Paul Irofti
This is needed for the addition of further suspend/resume actions. Okay deraadt@, marco@.
2008-10-03Return ENOTTY for unknown ioctl's.Brad Smith
2008-06-26First pass at removing clauses 3 and 4 from NetBSD licenses.Ray Lai
Not sure what's more surprising: how long it took for NetBSD to catch up to the rest of the BSDs (including UCB), or the amount of code that NetBSD has claimed for itself without attributing to the actual authors. OK deraadt@
2007-10-11treat usb vendor/product names as a locator, and have usbd_print handle it,Theo de Raadt
so that it shows up before the :. as a result, all the usb devices do not need to have name printing code anymore. all this now works and prints nicely because usbd_probe_and_attach() is serialized. ok kettenis
2007-09-17remove unneeded malloc.h include.Federico G. Schwindt
2007-06-14Remove the definition and usage of the USB_DECLARE_DRIVER_CLASS andMarc Balmer
USB_DECLARE_DRIVER macros. No binary change. ok dlg.
2007-06-13Remove the definition and usage of the IF_INPUT macro which was definedMarc Balmer
as ether_input_mbuf which is itself a macro for ether_input. No binary change. ok dlg.
2007-06-12Remove the definition and use of the device_ptr_t which was a struct device *.Marc Balmer
No binary change. ok mk.
2007-06-10Remove the definition and use of the USBDEVNAME macro.Marc Balmer
(This might look easy, but it was a big diff. Thanks to dlg and especially jsg for looking over it; we found at least four mistakes in the initial diff.) ok jsg.
2007-06-10Remove the definition and use of the USBDEV macro. It only created confusionMarc Balmer
and the address of it's argument: USBDEV(sc->sc_dev) yields &sc->sc_dev. No binary changes. ok jsg.
2007-06-10Remove definitions and usage of usb_callout and related macros. These macrosMarc Balmer
were used as a layer of confusion^Wabstraction around the timeout(9) API. No binary change. ok jsg.
2007-06-09Remove the definition and use of if_deactivate(). It was defined empty andMarc Balmer
thus produced no code at all. No binary change. ok jsg.
2007-06-06Mechanical removal of USBBASEDEVICE. No binary change.Michael Knudsen
Tested by thib and myself. ok mbalmer jsg
2007-06-05Remove the "Static" declaration of many functions. It was defined to be emptyMarc Balmer
and it was not consistently used. It was confusing as it suggested these functions were static, which they were not. discussed with dlg and jsg, ok jsg.
2007-06-01Remove more Free(?)BSD and NetBSD #ifdef/#endifs. No functional norMarc Balmer
binary change. ok jsg
2007-05-27Farewell USB_{ATTACH,MATCH,DETACH}* you will not be missed.Jonathan Gray
ok deraadt@ krw@ mbalmer@
2007-05-21Remove logprintf macroJonathan Gray
2007-02-11Remove _KERNEL_OPT leftovers.Miod Vallat