summaryrefslogtreecommitdiff
path: root/sys/dev/an/if_an.c
Commit message (Collapse)AuthorAgeFilesLines
* an: clean up empty lines in .c and .h filesMateusz Guzik2020-09-011-10/+0
| | | | Notes: svn path=/head/; revision=365112
* [if_an] unbreak!Adrian Chadd2020-07-191-1/+1
| | | | | | | | | .. I missed this when checking drivers. Differential Revision: https://reviews.freebsd.org/D25723 Notes: svn path=/head/; revision=363328
* Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)Pawel Biernacki2020-02-261-5/+9
| | | | | | | | | | | | | | | | | | | r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are still not MPSAFE (or already are but aren’t properly marked). Use it in preparation for a general review of all nodes. This is non-functional change that adds annotations to SYSCTL_NODE and SYSCTL_PROC nodes using one of the soon-to-be-required flags. Mark all obvious cases as MPSAFE. All entries that haven't been marked as MPSAFE before are by default marked as NEEDGIANT Approved by: kib (mentor, blanket) Commented by: kib, gallatin, melifaro Differential Revision: https://reviews.freebsd.org/D23718 Notes: svn path=/head/; revision=358333
* an(4): Require privileges for all SIOCGAIRONET requests.Mark Johnston2019-12-171-8/+15
| | | | | | | | | | | | | | | | SIOCGAIRONET allows userspace to query an(4) for various device properties and configuration, which appears to potentially include sensitive information such as WEP keys (an(4) seems to predate WPA). Also avoid races by copying in the request structure to a temporary buffer before locking and modifying the device softc. Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com> MFC after: 3 days Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=355864
* Use an accessor function to access ifr_data.Brooks Davis2018-03-301-6/+12
| | | | | | | | | | | | | | | | This fixes 32-bit compat (no ioctl command defintions are required as struct ifreq is the same size). This is believed to be sufficent to fully support ifconfig on 32-bit systems. Reviewed by: kib Obtained from: CheriBSD MFC after: 1 week Relnotes: yes Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14900 Notes: svn path=/head/; revision=331797
* spdx: initial adoption of licensing ID tags.Pedro F. Giffuni2017-11-181-0/+2
| | | | | | | | | | | | | | | | | | | | The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Initially, only tag files that use BSD 4-Clause "Original" license. RelNotes: yes Differential Revision: https://reviews.freebsd.org/D13133 Notes: svn path=/head/; revision=325966
* sys/dev: Replace zero with NULL for pointers.Pedro F. Giffuni2017-02-201-1/+1
| | | | | | | | | | | Makes things easier to read, plus architectures may set NULL to something different than zero. Found with: devel/coccinelle MFC after: 3 weeks Notes: svn path=/head/; revision=313982
* Reject ioctl commands for FLSHGCHR and FLSHPCHR if the size is greaterSean Bruno2016-05-241-0/+6
| | | | | | | | | | | | than sc->areq. This is a bounds check to ensure we're not just cramming arbitrarily sized nonsense into the driver and overflowing the heap. PR: 209545 Submitted by: cturt@hardenedbsd.org MFC after: 2 weeks Notes: svn path=/head/; revision=300612
* Move mutex initialization from PCI probe to PCI attach. Drivers are notScott Long2016-05-121-17/+0
| | | | | | | | | | | allowed to create any persistent state in their probe routine because it's not guaranteed that they'll win the election and be allowed to attach. Submitted by: Matthew Macy MFC after: 3 days Notes: svn path=/head/; revision=299544
* sys/dev: minor spelling fixes.Pedro F. Giffuni2016-05-031-1/+1
| | | | | | | Most affect comments, very few have user-visible effects. Notes: svn path=/head/; revision=298955
* Migrate many bus_alloc_resource() calls to bus_alloc_resource_anywhere().Justin Hibbits2016-02-271-6/+6
| | | | | | | | | | | Most calls to bus_alloc_resource() use "anywhere" as the range, with a given count. Migrate these to use the new bus_alloc_resource_anywhere() API. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D5370 Notes: svn path=/head/; revision=296137
* In order to reduce use of M_EXT outside of the mbuf allocator andRobert Watson2015-01-061-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | socket-buffer implementations, introduce a return value for MCLGET() (and m_cljget() that underlies it) to allow the caller to avoid testing M_EXT itself. Update all callers to use the return value. With this change, very few network device drivers remain aware of M_EXT; the primary exceptions lie in mbuf-chain pretty printers for debugging, and in a few cases, custom mbuf and cluster allocation implementations. NB: This is a difficult-to-test change as it touches many drivers for which I don't have physical devices. Instead we've gone for intensive review, but further post-commit review would definitely be appreciated to spot errors where changes could not easily be made mechanically, but were largely mechanical in nature. Differential Revision: https://reviews.freebsd.org/D1440 Reviewed by: adrian, bz, gnn Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=276750
* Mechanically convert to if_inc_counter().Gleb Smirnoff2014-09-191-20/+20
| | | | Notes: svn path=/head/; revision=271849
* last is set and not used, most likely a cut and paste error from otherWarner Losh2014-08-081-3/+1
| | | | | | | sysctl setting functions in this module. Notes: svn path=/head/; revision=269712
* Don't destroy bus_dma maps created by bus_dmamem_alloc(). In some cases,John Baldwin2014-06-101-8/+0
| | | | | | | | | | | | don't create a map before calling bus_dmamem_alloc() (such maps were leaked). It is believed that the extra destroy of the map was generally harmless since bus_dmamem_alloc() often uses special maps for which bus_dmamap_destroy() is a no-op (e.g. on x86). Reviewed by: scottl Notes: svn path=/head/; revision=267340
* Fix several panics when initialization of an ISA or PC-CARD device fails:Gavin Atkinson2013-12-141-4/+5
| | | | | | | | | | | | | | | o Assign sc->an_dev in an_probe() (which isn't really a probe function in the standard newbus sense) as we may need it for printing errors. o Use device_printf() rather than if_printf() in an_reset() - this is called from an_probe() long before the ifp structure is initialised in an_attach(). o Initialize the ifp structure early in an_attach() as we use if_printf() in cases where allocation of descriptors etc fails. MFC after: 3 days Notes: svn path=/head/; revision=259393
* 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-4/+4
| | | | | | | malloc(9) flags in sys/dev. Notes: svn path=/head/; revision=243857
* ether_ifattach() sets if_mtu to ETHERMTU, don't bother set it againKevin Lo2012-01-071-1/+0
| | | | | | | Reviewed by: yongari Notes: svn path=/head/; revision=229767
* Fix some net80211 enum nits:Bernhard Schmidt2011-12-171-2/+2
| | | | | | | | | | | | | - ic_vap_create() uses an ieee80211_opmode argument - ieee80211_rate2media() takes an ieee80211_phymode argument - ieee80211_plcp2rate() takes an ieee80211_phytype argument - cast to enum ieee80211_protmode and ieee80211_roamingmode to silence compiler warnings Submitted by: arundel@ Notes: svn path=/head/; revision=228621
* Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.Ed Schouten2011-11-071-1/+2
| | | | | | | | | The SYSCTL_NODE macro defines a list that stores all child-elements of that node. If there's no SYSCTL_DECL macro anywhere else, there's no reason why it shouldn't be static. Notes: svn path=/head/; revision=227309
* Remove duplicate header includesKevin Lo2011-06-281-1/+0
| | | | Notes: svn path=/head/; revision=223624
* Add new tunable 'net.link.ifqmaxlen' to set default send interfaceMaxim Sobolev2010-05-031-2/+2
| | | | | | | | | | | | | queue length. The default value for this parameter is 50, which is quite low for many of today's uses and the only way to modify this parameter right now is to edit if_var.h file. Also add read-only sysctl with the same name, so that it's possible to retrieve the current value. MFC after: 1 month Notes: svn path=/head/; revision=207554
* - For 350 chips, don't set various INTR bits in TX control word; turning INTRJohn Baldwin2009-11-241-3/+3
| | | | | | | | | | | | bits on seems to confuse hardware TX engine. - For 350 chips, set TX desc's buffer physical address before turning on the TX desc valid bit. Submitted by: Jeremy O'Brien obrien654j | gmail, sephe Obtained from: DragonFly BSD Notes: svn path=/head/; revision=199757
* Use bus_*() rather than bus_space_*().John Baldwin2009-11-241-3/+0
| | | | Notes: svn path=/head/; revision=199756
* - Locking fixes to not do silly things like drop the lock only to call aJohn Baldwin2009-11-101-76/+66
| | | | | | | | | | | | function that immediately reacquires the lock. Also removes recursive locking. - Use the statistics timer to drive the transmit watchdog instead of using if_watchdog and if_timer. Tested by: gavin Notes: svn path=/head/; revision=199154
* - Use device_printf() instead of printf() with an explicit unit numberJohn Baldwin2009-11-061-1/+1
| | | | | | | | | | | | in the PCI attach routine. - Simplify PCI probe. - Remove no-longer-used 'unit' from an_attach() parameters. PR: kern/126924 Submitted by: gavin Notes: svn path=/head/; revision=198995
* Use device_printf() and if_printf() instead of printf() with an explicitJohn Baldwin2009-11-061-68/+61
| | | | | | | unit number and remove 'unit' members from softc. Notes: svn path=/head/; revision=198987
* Shutdown routine returns int.Warner Losh2009-02-041-2/+2
| | | | Notes: svn path=/head/; revision=188128
* In case INET is not defined, then ANCACHE is not defined andBjoern A. Zeeb2008-11-061-0/+2
| | | | | | | | | | | the sc does not have 'an_have_rssimap' variable. Add an ANCACHE check to poperly hide the case and make an(4) compile without INET. MFC after: 2 months Notes: svn path=/head/; revision=184708
* Style changes from avatar.Doug Ambrisko2008-01-181-39/+39
| | | | | | | Submitted by: avatar Notes: svn path=/head/; revision=175446
* First real attempt at proper locking. The locking is a little complicatedDoug Ambrisko2008-01-181-121/+248
| | | | | | | | | | | | | | | | | | | | | | | since the the command and data that is being built to be sent to or read from the HW lives in the softc. Commands are later run via an_setdef etc. In the ioctl path various references are kept to the data stored in the softc so it needs to be protected. Almost think of the command in the softc a global variable since it essentially is. Since locking wasn't done in this type of context the commands would get corrupted. Thanks to avatar@ for catching some lock issues and dhw@ for testing. Things are a lot more stable except for the MPI-350 cards. My an(4) remote laptop stays on the network now. The driver should be changed so that it uses private memory that is passed to the functions that talk to the card. Then only those functions would really need to grab locks. Reviewed by: avatar@ Notes: svn path=/head/; revision=175445
* MFP4(129048): Eliminating an unnecessary check on an_gone insideTai-hwa Liang2007-11-271-4/+0
| | | | | | | | | | | an_stats_update() since a properly locked callout_stop(9) does do the right thing. Reviewed by: ambrisko, jhb MFC after: 3 days Notes: svn path=/head/; revision=173975
* MFP4(128855, 129015):Tai-hwa Liang2007-11-161-10/+17
| | | | | | | | | | | | | | | | | | | | - Trying to eliminate another racing by replacing the timeout(9) with callout APIs. In addition to that, the callout_drain() in an_detach() help us to avoid a possible panic-on-free due to the callout API tries to lock a destroyed mutex. - In an_stats_update(), check the return value of an_read_record(). This should reduce the chance of device removal(PCCARD) panic [2]. - Adding a comment to state the fact that an_stats_update() is now called via callout(9) with a lock held [2]. Submitted by: jhb [1], ambrisko [2] Reviewed by: jhb, ambrisko Reported by: dhw Tested by: dhw MFC after: 3 days Notes: svn path=/head/; revision=173668
* Fixing invalid channel display in ifconfig(8) by implementing requiredTai-hwa Liang2007-09-101-0/+17
| | | | | | | | | | | | | | | | | | ioctl(). Note that other information provided by ifconfig(8) such like "list chan" or "list ap" are still not available at this moment. Before an(4) is connected to wlan(4), users are encouraged to use ancontrol(8) to retrieve aforementioned information. Reported by: dhw (http://lists.freebsd.org/pipermail/freebsd-current/2007-July/074848.html) Reviewed by: ambrisko Tested by: dhw Approved by: re (bmah) Notes: svn path=/head/; revision=172112
* MFP4(123687): Closing another LOR by dropping the driver lock around callsTai-hwa Liang2007-08-071-1/+3
| | | | | | | | | | | to if_input(). Reviewed by: ambrisko Tested by: dhw Approved by: re (kensmith) Notes: svn path=/head/; revision=171775
* MFP4(123686): Fixing various ancontrol(8) related panics by dropping locksTai-hwa Liang2007-08-021-12/+60
| | | | | | | | | | | around copyin()/copyout(). Reviewed by: sam, thompsa Tested by: dhw Approved by: re (kensmith) Notes: svn path=/head/; revision=171692
* Remove assignment to uninitialized variable that wasn't then used anyway.Matt Jacob2007-06-081-2/+0
| | | | Notes: svn path=/head/; revision=170409
* Sweep kernel replacing suser(9) calls with priv(9) calls, assigningRobert Watson2006-11-061-5/+6
| | | | | | | | | | | | | | | | specific privilege names to a broad range of privileges. These may require some future tweaking. Sponsored by: nCircle Network Security, Inc. Obtained from: TrustedBSD Project Discussed on: arch@ Reviewed (at least in part) by: mlaier, jmg, pjd, bde, ceri, Alex Lyashkov <umka at sevcity dot net>, Skip Ford <skip dot ford at verizon dot net>, Antoine Brodin <antoine dot brodin at laposte dot net> Notes: svn path=/head/; revision=164033
* Since DELAY() was moved, most <machine/clock.h> #includes have beenPoul-Henning Kamp2006-05-161-1/+0
| | | | | | | unnecessary. Notes: svn path=/head/; revision=158651
* Silence the strict-alias warnings. Make a trip through (void *) whenWarner Losh2006-02-041-16/+16
| | | | | | | | | casting a structure to a uint32_t *. Many drivers in the tree do this, but I'll not update them until these changes can be reviewed by the pedantic standards folks. Notes: svn path=/head/; revision=155321
* Since the A-Z range is contained in the previous check, the else-if isNate Lawson2006-01-261-3/+2
| | | | | | | | | | | dead code. Clean up both by using isprint() instead, since that's what it really wants. Coverity ID: 100 Found by: Coverity Prevent Notes: svn path=/head/; revision=154866
* Don't leak mbufs and mbuf clusters in several error-handling situationsRobert Watson2006-01-151-0/+4
| | | | | | | | | | in the if_an receive routine. Found with: Coverity Prevent (tm) MFC after: 1 week Notes: svn path=/head/; revision=154394
* If frame length is excessive, don't leak an mbuf and cluster whenRobert Watson2006-01-151-0/+1
| | | | | | | | | | abandoning processing. Found with: Coverity Prevent (tm) MFC after: 1 week Notes: svn path=/head/; revision=154393
* - Store pointer to the link-level address right in "struct ifnet"Ruslan Ermilov2005-11-111-2/+3
| | | | | | | | | | | | | rather than in ifindex_table[]; all (except one) accesses are through ifp anyway. IF_LLADDR() works faster, and all (except one) ifaddr_byindex() users were converted to use ifp->if_addr. - Stop storing a (pointer to) Ethernet address in "struct arpcom", and drop the IFP2ENADDR() macro; all users have been converted to use IF_LLADDR() instead. Notes: svn path=/head/; revision=152315
* - Make IFP2ENADDR() a pointer to IF_LLADDR() rather than anotherRuslan Ermilov2005-11-111-6/+0
| | | | | | | | | | | copy of Ethernet address. - Change iso88025_ifattach() and fddi_ifattach() to accept MAC address as an argument, similar to ether_ifattach(), to make this work. Notes: svn path=/head/; revision=152296
* MFp4: KNF (mostly remove K&R function definitions). Fix some spaces leftWarner Losh2005-09-221-176/+82
| | | | | | | | | | over from de__Ping. # Didn't fix the -Exxxx return statements that appaer to be linuxisms # (and wrong) since I don't have hardware to test with. Notes: svn path=/head/; revision=150446
* Make sure that we call if_free(ifp) after bus_teardown_intr. Since weWarner Losh2005-09-191-1/+1
| | | | | | | | | | could get an interrupt after we free the ifp, and the interrupt handler depended on the ifp being still alive, this could, in theory, cause a crash. Eliminate this possibility by moving the if_free to after the bus_teardown_intr() call. Notes: svn path=/head/; revision=150306
* Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE andRobert Watson2005-08-091-12/+12
| | | | | | | | | | | | | | | | | 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
* Do not lock an to check gone flag. Only need to hold the lock to setMaksim Yevmenkin2005-08-021-2/+1
| | | | | | | | | | the gone flag. Reviewed by: imp MFC after: 1 day Notes: svn path=/head/; revision=148639