summaryrefslogtreecommitdiff
path: root/sys/dev/en/midway.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove the NATM framework including the en(4), fatm(4), hatm(4), andBrooks Davis2017-04-241-3367/+0
| | | | | | | | | | | | | | | | | | | | | | | | patm(4) devices. Maintaining an address family and framework has real costs when we make infrastructure improvements. In the case of NATM we support no devices manufactured in the last 20 years and some will not even work in modern motherboards (some newer devices that patm(4) could be updated to support apparently exist, but we do not currently have support). With this change, support remains for some netgraph modules that don't require NATM support code. It is unclear if all these should remain, though ng_atmllc certainly stands alone. Note well: FreeBSD 11 supports NATM and will continue to do so until at least September 30, 2021. Improvements to the code in FreeBSD 11 are certainly welcome. Reviewed by: philip Approved by: harti Notes: svn path=/head/; revision=317383
* sys: use our roundup2/rounddown2() macros when param.h is available.Pedro F. Giffuni2016-04-211-2/+2
| | | | | | | | | | | | | rounddown2 tends to produce longer lines than the original code and when the code has a high indentation level it was not really advantageous to do the replacement. This tries to strike a balance between readability using the macros and flexibility of having the expressions, so not everything is converted. Notes: svn path=/head/; revision=298433
* To ease changes to underlying mbuf structure and the mbuf allocator, reduceRobert Watson2015-01-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | the knowledge of mbuf layout, and in particular constants such as M_EXT, MLEN, MHLEN, and so on, in mbuf consumers by unifying various alignment utility functions (M_ALIGN(), MH_ALIGN(), MEXT_ALIGN() in a single M_ALIGN() macro, implemented by a now-inlined m_align() function: - Move m_align() from uipc_mbuf.c to mbuf.h; mark as __inline. - Reimplement M_ALIGN(), MH_ALIGN(), and MEXT_ALIGN() using m_align(). - Update consumers around the tree to simply use M_ALIGN(). This change eliminates a number of cases where mbuf consumers must be aware of whether or not mbufs returned by the allocator use external storage, but also assumptions about the size of the returned mbuf. This will make it easier to introduce changes in how we use external storage, as well as features such as variable-size mbufs. Differential Revision: https://reviews.freebsd.org/D1436 Reviewed by: glebius, trasz, gnn, bz Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=276692
* Mechanically convert to if_inc_counter().Gleb Smirnoff2014-09-191-4/+4
| | | | Notes: svn path=/head/; revision=271849
* In sys/dev/en/midway.c, #if 0 an unused static function.Dimitry Andric2013-12-291-0/+2
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=260038
* The r48589 promised to remove implicit inclusion of if_var.h soon. PrepareGleb Smirnoff2013-10-261-0/+1
| | | | | | | | | | | to this event, adding if_var.h to files that do need it. Also, include all includes that now are included due to implicit pollution via if_var.h Sponsored by: Netflix Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=257176
* Mechanically substitute flags from historic mbuf allocator withGleb Smirnoff2012-12-041-6/+6
| | | | | | | malloc(9) flags in sys/dev. Notes: svn path=/head/; revision=243857
* Final pass at having devices use their bus parent for dma tags. TheScott Long2012-03-121-2/+2
| | | | | | | | | | | | | | | | | | remaining drivers that haven't been converted have various problems or complexities that will be dealt with later. This list includes: hptrr, hptmv, hpt27xx - device aggregation across multiple parents drm - want to talk to the maintainer first tsec, sec - Openfirmware devices, not sure if changes are warranted fatm - Done except for unused testing code usb - want to talk to the maintainer first ce, cp, ctau, cx - Significant driver changes needed to convey parent info There are also devices tucked into architecture subtrees that I'll leave for the respective maintainers to deal with. Notes: svn path=/head/; revision=232883
* Specify a CTLTYPE_FOO so that a future sysctl(8) change does not needMatthew D Fleming2011-01-181-2/+2
| | | | | | | to rely on the format string. Notes: svn path=/head/; revision=217556
* Hide an unused variable in case we compile with neither INET nor INET6.Bjoern A. Zeeb2008-11-061-1/+5
| | | | | | | | | | NATM needs 'struct in_addr' to compile, which is a problem on its own but include in.h for now if we have NATM but neither INET or INET6. MFC after: 2 months Notes: svn path=/head/; revision=184712
* Replaced the misleading uses of a historical artefact M_TRYWAIT with M_WAIT.Ruslan Ermilov2008-03-251-20/+6
| | | | | | | | | | | | | Removed dead code that assumed that M_TRYWAIT can return NULL; it's not true since the advent of MBUMA. Reviewed by: arch There are ongoing disputes as to whether we want to switch to directly using UMA flags M_WAITOK/M_NOWAIT for mbuf(9) allocation. Notes: svn path=/head/; revision=177599
* Where I previously removed calls to kdb_enter(), now remove include ofRobert Watson2007-05-291-1/+0
| | | | | | | | | kdb.h. Pointed out by: bde Notes: svn path=/head/; revision=170093
* Rather than entering DDB with the message "unexpected error" and wedgingRobert Watson2007-05-271-2/+1
| | | | | | | | | the card, panic explicitly if EN_DEBUG is enabled. In the (default) case of !EN_DEBUG, the driver resets the card. Probably this case shouldn't exist at all. Notes: svn path=/head/; revision=170013
* Fix fat-fingering in previous commit.John Baldwin2006-12-291-1/+1
| | | | | | | Pointy hat to: jhb Notes: svn path=/head/; revision=165640
* Various bpf(4) related fixes to catch places up to the new bpf(4)John Baldwin2006-12-291-2/+2
| | | | | | | | | | | | | | | | semantics. - Stop testing bpf pointers for NULL. In some cases use bpf_peers_present() and then call the function directly inside the conditional block instead of the macro. - For places where the entire conditional block is the macro, remove the test and make the macro unconditional. - Use BPF_MTAP() in if_pfsync on FreeBSD instead of an expanded version of the old semantics. Reviewed by: csjp (older version) Notes: svn path=/head/; revision=165632
* - Consistently use if_printf() only in interface methods: if_start(),Gleb Smirnoff2006-09-151-18/+18
| | | | | | | | | | | if_watchdog, etc., or in functions used only in these methods. In all other functions in the driver use device_printf(). - Use __func__ instead of typing function name. Submitted by: Alex Lyashkov <umka sevcity.net> Notes: svn path=/head/; revision=162321
* Subtracting two pointers produces a ptrdiff_t not a size_t so useHartmut Brandt2006-03-211-9/+9
| | | | | | | the %td to print this instead of %zu or %d. Notes: svn path=/head/; revision=156951
* Drop the driver lock around atm_input() analogous to all the ethernetJohn Baldwin2005-10-271-0/+2
| | | | | | | | | drivers dropping the driver lock around ether_input(). Silence by: harti Notes: svn path=/head/; revision=151771
* Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE andRobert Watson2005-08-091-10/+10
| | | | | | | | | | | | | | | | | IFF_DRV_RUNNING, as well as the move from ifnet.if_flags to ifnet.if_drv_flags. Device drivers are now responsible for synchronizing access to these flags, as they are in if_drv_flags. This helps prevent races between the network stack and device driver in maintaining the interface flags field. Many __FreeBSD__ and __FreeBSD_version checks maintained and continued; some less so. Reviewed by: pjd, bz MFC after: 7 days Notes: svn path=/head/; revision=148887
* Stop embedding struct ifnet at the top of driver softcs. Instead theBrooks Davis2005-06-101-51/+52
| | | | | | | | | | | | | | | | | | | | | | | struct ifnet or the layer 2 common structure it was embedded in have been replaced with a struct ifnet pointer to be filled by a call to the new function, if_alloc(). The layer 2 common structure is also allocated via if_alloc() based on the interface type. It is hung off the new struct ifnet member, if_l2com. This change removes the size of these structures from the kernel ABI and will allow us to better manage them as interfaces come and go. Other changes of note: - Struct arpcom is no longer referenced in normal interface code. Instead the Ethernet address is accessed via the IFP2ENADDR() macro. To enforce this ac_enaddr has been renamed to _ac_enaddr. - The second argument to ether_ifattach is now always the mac address from driver private storage rather than sometimes being ac_enaddr. Reviewed by: sobomax, sam Notes: svn path=/head/; revision=147256
* Start each of the license/copyright comments with /*-, minor shuffle of linesWarner Losh2005-01-061-2/+1
| | | | Notes: svn path=/head/; revision=139749
* * Add a "how" argument to uma_zone constructors and initialization functionsBrian Feldman2004-08-021-21/+12
| | | | | | | | | | | | | | | | | | | | so that they know whether the allocation is supposed to be able to sleep or not. * Allow uma_zone constructors and initialation functions to return either success or error. Almost all of the ones in the tree currently return success unconditionally, but mbuf is a notable exception: the packet zone constructor wants to be able to fail if it cannot suballocate an mbuf cluster, and the mbuf allocators want to be able to fail in general in a MAC kernel if the MAC mbuf initializer fails. This fixes the panics people are seeing when they run out of memory for mbuf clusters. * Allow debug.nosleepwithlocks on WITNESS to be disabled, without changing the default. Both bmilekic and jeff have reviewed the changes made to make failable zone allocations work. Notes: svn path=/head/; revision=132987
* Update for the KDB framework:Marcel Moolenaar2004-07-101-3/+2
| | | | | | | | | o Call kdb_enter() instead of Debugger(). o Don't make such calls conditional upon KDB instead of DDB because they're already conditional upon EN_DEBUG. Notes: svn path=/head/; revision=131913
* All three of these drivers abused cv_waitq_empty in the same way by spinningScott Long2004-02-291-4/+1
| | | | | | | | | | | | on it in hopes of making sure that the waitq was empty before going on. This wasn't needed and probably never would have worked as intended. Now that cv_waitq_empty() and friends are gone, the code in these drivers that spins on it can go away too. This should unbreak LINT. Discussed with: kan Notes: svn path=/head/; revision=126396
* Move the locking of the softc up to before the allocation of theHartmut Brandt2003-12-171-4/+6
| | | | | | | | transmission map. This allocation accesses the softc so should be under the lock (it uses NOWAIT). Notes: svn path=/head/; revision=123593
* Replace the if_name and if_unit members of struct ifnet with new membersBrooks Davis2003-10-311-3/+2
| | | | | | | | | | | | | | | | if_xname, if_dname, and if_dunit. if_xname is the name of the interface and if_dname/unit are the driver name and instance. This change paves the way for interface renaming and enhanced pseudo device creation and configuration symantics. Approved By: re (in principle) Reviewed By: njl, imp Tested On: i386, amd64, sparc64 Obtained From: NetBSD (if_xname) Notes: svn path=/head/; revision=121816
* Remove the ATMIOCENA and ATMIOCDIS ioctl. Everyting has been convertedHartmut Brandt2003-08-061-31/+6
| | | | | | | | to use the new OPENVCC and CLOSEVCC calls that allow the sepcification of traffic parameters for the connections. Notes: svn path=/head/; revision=118548
* Honor the new ATMIO_FLAG_ASYNC that requests asynchronuous open/closeHartmut Brandt2003-08-061-1/+1
| | | | | | | operations on VCs. Notes: svn path=/head/; revision=118534
* When sending check that the channel is really open. Get the informationHartmut Brandt2003-08-061-7/+9
| | | | | | | | whether we use AAL5 or not from the aal field of the channel parameters instead of the flag in the pseudo header. This flag will go away soon. Notes: svn path=/head/; revision=118533
* Print an array index that is computed as ptrdiff_t with %tu.Hartmut Brandt2003-08-061-2/+2
| | | | Notes: svn path=/head/; revision=118532
* Change the format type to unbreak LINT on 64-bit platforms.David E. O'Brien2003-08-061-2/+2
| | | | Notes: svn path=/head/; revision=118523
* Implement per-VC statistics.Hartmut Brandt2003-08-051-1/+8
| | | | Notes: svn path=/head/; revision=118495
* Implement the ATMIOCOPENVCC and ATMIOCCLOSEVCC ioctls(). This was theHartmut Brandt2003-08-051-37/+82
| | | | | | | last driver that did not know about those. Notes: svn path=/head/; revision=118494
* Use the generic getvccs function from net/if_atmsubr.c and removeHartmut Brandt2003-08-051-54/+4
| | | | | | | the home-grown version. Notes: svn path=/head/; revision=118491
* Arrghhh. Remove debugging printf's that slipped in in the pre-previousHartmut Brandt2003-08-051-11/+1
| | | | | | | commit. Notes: svn path=/head/; revision=118490
* Use __FBSDID() as per style(9).Hartmut Brandt2003-08-051-2/+2
| | | | Notes: svn path=/head/; revision=118489
* Make the en(4) driver more like the other ATM drivers. This is theHartmut Brandt2003-08-051-233/+323
| | | | | | | | | | preparation for supporting the OPENVCC and CLOSEVCC ioctls which are needed for ng_atm. This required some re-organisation of the code (mostly converting array indexes to pointers). This also gives us an array of open vccs that will help in using the generic GETVCCS handler. Notes: svn path=/head/; revision=118487
* Move the clearing of the IFF_RUNNING flag into the reset routine.Hartmut Brandt2003-08-051-1/+2
| | | | | | | | Otherwise the interface will report RUNNING to ifconfig after doing 'ifconfig down' although it isn't running anymore. Notes: svn path=/head/; revision=118484
* Be careful to call bus_dmamap_load with BUS_DMA_NOWAIT so that theHartmut Brandt2003-07-151-7/+7
| | | | | | | | | callback will never be deferred. ATM needs to prevent cell and packet ordering. Also use the default mutex and lock functions (those that panic) for the tag creation. Notes: svn path=/head/; revision=117641
* Delete a superfluous semi-colon.Hartmut Brandt2003-07-041-1/+1
| | | | | | | Pointed out by: nick@garage.freebsd.pl Notes: svn path=/head/; revision=117227
* Mega busdma API commit.Scott Long2003-07-011-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add two new arguments to bus_dma_tag_create(): lockfunc and lockfuncarg. Lockfunc allows a driver to provide a function for managing its locking semantics while using busdma. At the moment, this is used for the asynchronous busdma_swi and callback mechanism. Two lockfunc implementations are provided: busdma_lock_mutex() performs standard mutex operations on the mutex that is specified from lockfuncarg. dftl_lock() is a panic implementation and is defaulted to when NULL, NULL are passed to bus_dma_tag_create(). The only time that NULL, NULL should ever be used is when the driver ensures that bus_dmamap_load() will not be deferred. Drivers that do not provide their own locking can pass busdma_lock_mutex,&Giant args in order to preserve the former behaviour. sparc64 and powerpc do not provide real busdma_swi functions, so this is largely a noop on those platforms. The busdma_swi on is64 is not properly locked yet, so warnings will be emitted on this platform when busdma callback deferrals happen. If anyone gets panics or warnings from dflt_lock() being called, please let me know right away. Reviewed by: tmm, gibbs Notes: svn path=/head/; revision=117126
* Implement the ioctl that returns a list of currently open VCCs.Hartmut Brandt2003-06-131-0/+70
| | | | Notes: svn path=/head/; revision=116297
* Make the midway driver use the new ATM phy driver. This allows one toHartmut Brandt2003-06-131-6/+79
| | | | | | | | | | toggle several media options (sonet/sdh, for example) with ifconfig and to see the carrier state in ifconfig's output. It gives also read/write access (given the right privilegs) to the S/Uni registers to user space programs. Notes: svn path=/head/; revision=116294
* Make the internal statistics sysctl an array of integers rather than a string.Hartmut Brandt2003-06-041-33/+10
| | | | | | | | | | | | While a string is readable without a tool, an array is easier to process for a monitoring application. This also prevents the extra hoops we need with sbufs and locking. Move the mtx_init() in en_attach() higher before the first failure point so that we can unconditionally destroy it in en_destroy(). Notes: svn path=/head/; revision=115833
* Fix off-by-one error in range check of VC index.Poul-Henning Kamp2003-05-311-1/+1
| | | | | | | Found by: FlexeLint Notes: svn path=/head/; revision=115496
* Define a link layer MIB for ATM. Most fields of this MIB are needed byHartmut Brandt2003-05-051-44/+67
| | | | | | | | | ILMI daemons. Factor out common softc fields for all ATM interfaces that need to be externally visible into an ifatm structure and make the midway driver using this structure and fill the MIB. Notes: svn path=/head/; revision=114739
* Add module data and version to the atm_subr and reference this info from theHartmut Brandt2003-04-291-3/+2
| | | | | | | | | | | | | | | | | | | (currently) only consumer (en). Add a sysctl node hw.atm where the atm drivers will hook on their hardware sysctl sub-trees. Make atm_ifattach call if_attach and remove the corresponding call to if_attach from en. Create atm_ifdetach and use that in en. While the last change actually changes the interface this is not a problem in practice because the only other consumer of this API is an older LANAI driver on the net, that is not ready for current anyway. Reviewed by: -atm Notes: svn path=/head/; revision=114201
* Convert the midway driver to use busdma. Except for this conversion theHartmut Brandt2003-04-251-2898/+2707
| | | | | | | | | | | | | | | | | | | | | | | following changes have been done: - stylify. The original code was too hard to read. - get rid of a number of compilation options (Adaptec-only, Eni-only, no-DMA). - more debugging features. - locking. This is not correct yet in the absence of interface layer locking, but is correct enough to not to cause lock order reversals. - remove RAW mode. There are no users of this in the tree and I doubt that there are any. - remove NetBSD compatibility code. There was no way to keep NetBSD non-busdma and FreeBSD busdma code together. - if_en now buildable as a module. This has been actively tested on sparc64 and i386 with ENI server and client cards and an Adaptec card (thanks to kjc). Reviewed by: mdodd, arr Notes: svn path=/head/; revision=114018
* clean up the en driver since it will survice for a while byKenjiro Cho2003-03-121-96/+0
| | | | | | | | | | | Harti Brandt's effort. remove the DMA test to detect problems of the first generation PCI chipsets back in 1998. it is no longer needed and has been the source of the false alarm that the driver uses too much stack space. Notes: svn path=/head/; revision=112135
* Update netisr handling; Each SWI now registers its queue, and all queueJonathan Lemon2003-03-041-0/+2
| | | | | | | | | | | | | drain routines are done by swi_net, which allows for better queue control at some future point. Packets may also be directly dispatched to a netisr instead of queued, this may be of interest at some installations, but currently defaults to off. Reviewed by: hsu, silby, jayanth, sam Sponsored by: DARPA, NAI Labs Notes: svn path=/head/; revision=111888