summaryrefslogtreecommitdiffstats
path: root/sys/net/if.h
Commit message (Collapse)AuthorAgeFilesLines
* Add TSO support on VLANs. Intentionally separated IFCAP_VLAN_HWTSOyongari2010-02-201-0/+1
| | | | | | | | from IFCAP_VLAN_HWTAGGING. I think some hardwares may be able to TSO over VLAN without VLAN hardware tagging. Driver changes and userland support will follow. Reviewed by: thompsa
* Revised revision 199201 (add interface description capability as inspireddelphij2010-01-271-0/+10
| | | | | | | | by OpenBSD), based on comments from many, including rwatson, jhb, brooks and others. Sponsored by: iXsystems, Inc. MFC after: 1 month
* Change vlan interfaces to cope more usefully with the parent interface beingjhb2009-12-291-0/+1
| | | | | | | | | | | | | | renamed. Previously the vlan interfaces would lose their configuration as if the parent interface had been physically removed. Now vlan interfaces ignore rename events. - Add a new ifnet flag (IFF_RENAMING) that is set while an ifnet is being renamed. This flag can be checked in ifnet departure/arrival event handlers to treat rename events differently. - Change the ifnet departure event handler in the if_vlan(4) driver to ignore departure events due to a trunk interface being renamed. Reviewed by: brooks, rwatson MFC after: 1 week
* Revert revision 199201 for now as it has introduced a kernel vulnerabilitydelphij2009-11-121-2/+0
| | | | and requires more polishing.
* Add interface description capability as inspired by OpenBSD.delphij2009-11-111-0/+2
| | | | MFC after: 3 months
* Manage vnets via the jail system. If a jail is given the booleanjamie2009-06-151-0/+2
| | | | | | | | | | | parameter "vnet" when it is created, a new vnet instance will be created along with the jail. Networks interfaces can be moved between prisons with an ioctl similar to the one that moves them between vimages. For now vnets will co-exist under both jails and vimages, but soon struct vimage will be going away. Reviewed by: zec, julian Approved by: bz (mentor)
* When user_frac in the polling subsystem is low it is going to busy theattilio2009-05-301-0/+1
| | | | | | | | | | | | | | | | | | | | | CPU for too long period than necessary. Additively, interfaces are kept polled (in the tick) even if no more packets are available. In order to avoid such situations a new generic mechanism can be implemented in proactive way, keeping track of the time spent on any packet and fragmenting the time for any tick, stopping the processing as soon as possible. In order to implement such mechanism, the polling handler needs to change, returning the number of packets processed. While the intended logic is not part of this patch, the polling KPI is broken by this commit, adding an int return value and the new flag IFCAP_POLLING_NOCOUNT (which will signal that the return value is meaningless for the installed handler and checking should be skipped). Bump __FreeBSD_version in order to signal such situation. Reviewed by: emaste Sponsored by: Sandvine Incorporated
* Add a new interface flag, IFF_DYING, which is set when a device driverrwatson2009-04-231-1/+3
| | | | | | | | | | | | | | calls if_free(), and remains set if the refcount is elevated. IF_DYING skips the bit in the if_flags bitmask previously used by IFF_NEEDSGIANT, so that an MFC can be done without changing which bit is used, as IFF_NEEDSGIANT is still present in 7.x. ifnet_byindex_ref() checks for IFF_DYING and returns NULL if it is set, preventing new references from by acquired by index, preventing monitoring sysctls from seeing it. Other lookup mechanisms currently do not check IFF_DYING, but may need to in the future. MFC after: 3 weeks
* Remove IFF_NEEDSGIANT interface flag: we no longer provide ifnet-layerrwatson2009-04-181-3/+1
| | | | infrastructure to support non-MPSAFE network device drivers.
* remove unnecessary forward declarationluigi2009-02-161-2/+0
|
* Fix to bug kern/126850. Only dispatch event hander if thejfv2008-08-281-16/+17
| | | | | | | interface had a parent (was attached). Reviewed by: EvilSam MFC after: 1 week
* Trim some noise from some #ifdef's. This had leaked into the compat32jhb2008-07-301-1/+1
| | | | | | | support for bpf(4) due to hacks in the Y! tree for a truss32 binary (since superseded by native support for 32-bit binaries in truss itself). MFC after: 1 week
* Add IFF_NEEDSGIANT to IFF_CANTCHANGE, to prevent user-level codeiedowse2008-03-271-1/+2
| | | | | | | | | | from clearing the IFF_NEEDSGIANT flag on Giant-locked interfaces. In particular, wpa_supplicant was doing this on USB interfaces, causing panics when Giant-locked code was then called without Giant. Submitted by: Alexey Popov Reviewed by: rwatson MFC after: 3 days
* fix bonehead cut and paste error in last commitkmacy2007-12-151-1/+1
|
* Create separate capability flags for TCP over IPv4 and TCP over IPv6kmacy2007-12-151-1/+3
|
* add interface capability for TOEkmacy2007-12-151-0/+1
|
* Wake On Lan (WOL) infrastructuresam2007-12-101-2/+6
| | | | | Submitted by: Stefan Sperling <stsp@stsp.name> Reviewed by: brooks
* Add IFCAP_LRO flag for drivers to announce their TCP Large Receive Offloadandre2007-06-111-0/+1
| | | | capabilities.
* The struct if_data members ifi_recvquota and ifi_xmitquota have beenbrooks2007-05-161-2/+2
| | | | | unused for ages. Rename them to ifi_spare_char1 and ifi_spare_char2 respectively to indicate this face.
* Fix a couple of typos in a comment.yar2007-05-021-2/+2
|
* First step of TSO (TCP segmentation offload) support in our network stack.andre2006-09-061-0/+3
| | | | | | | | | | | | o add IFCAP_TSO[46] for drivers to announce this capability for IPv4 and IPv6 o add CSUM_TSO flag to mbuf pkthdr csum_flags field o add tso_segsz field to mbuf pkthdr o enhance ip_output() packet length check to allow for large TSO packets o extend tcp_maxmtu[46]() with a flag pointer to pass interface capabilities o adjust all callers of tcp_maxmtu[46]() accordingly Discussed on: -current, -net Sponsored by: TCP/IP Optimization Fundraise 2005
* Improve description of if_capabilities, if_capenable and ifi_hwassist.andre2006-09-061-2/+19
| | | | Sponsored by: TCP/IP Optimization Fundraise 2005
* Import interface groups from OpenBSD. This allows to group interfaces inmlaier2006-06-191-0/+31
| | | | | | | | order to - for example - apply firewall rules to a whole group of interfaces. This is required for importing pf from OpenBSD 3.9 Obtained from: OpenBSD (with changes) Discussed on: -net (back in April)
* Remove various bits of conditional Alpha code and fixup a few comments.jhb2006-05-121-3/+0
|
* Implement SIOCGIFCONF for 32bit binaries.ps2006-02-021-0/+9
|
* Merge the //depot/user/yar/vlan branch into CVS. It contains some collectiveglebius2006-01-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | work by yar, thompsa and myself. The checksum offloading part also involves work done by Mihail Balikov. The most important changes: o Instead of global linked list of all vlan softc use a per-trunk hash. The size of hash is dynamically adjusted, depending on number of entries. This changes struct ifnet, replacing counter of vlans with a pointer to trunk structure. This change is an improvement for setups with big number of VLANs, several interfaces and several CPUs. It is a small regression for a setup with a single VLAN interface. An alternative to dynamic hash is a per-trunk static array with 4096 entries, which is a compile time option - VLAN_ARRAY. In my experiments the array is not an improvement, probably because such a big trunk structure doesn't fit into CPU cache. o Introduce an UMA zone for VLAN tags. Since drivers depend on it, the zone is declared in kern_mbuf.c, not in optional vlan(4) driver. This change is a big improvement for any setup utilizing vlan(4). o Use rwlock(9) instead of mutex(9) for locking. We are the first ones to do this! :) o Some drivers can do hardware VLAN tagging + hardware checksum offloading. Add an infrastructure for this. Whenever vlan(4) is attached to a parent or parent configuration is changed, the flags on vlan(4) interface are updated. In collaboration with: yar, thompsa In collaboration with: Mihail Balikov <mihail.balikov interbgc.com>
* Big polling(4) cleanup.glebius2005-10-011-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o Axe poll in trap. o Axe IFF_POLLING flag from if_flags. o Rework revision 1.21 (Giant removal), in such a way that poll_mtx is not dropped during call to polling handler. This fixes problem with idle polling. o Make registration and deregistration from polling in a functional way, insted of next tick/interrupt. o Obsolete kern.polling.enable. Polling is turned on/off with ifconfig. Detailed kern_poll.c changes: - Remove polling handler flags, introduced in 1.21. The are not needed now. - Forget and do not check if_flags, if_capenable and if_drv_flags. - Call all registered polling handlers unconditionally. - Do not drop poll_mtx, when entering polling handlers. - In ether_poll() NET_LOCK_GIANT prior to locking poll_mtx. - In netisr_poll() axe the block, where polling code asks drivers to unregister. - In netisr_poll() and ether_poll() do polling always, if any handlers are present. - In ether_poll_[de]register() remove a lot of error hiding code. Assert that arguments are correct, instead. - In ether_poll_[de]register() use standard return values in case of error or success. - Introduce poll_switch() that is a sysctl handler for kern.polling.enable. poll_switch() goes through interface list and enabled/disables polling. A message that kern.polling.enable is deprecated is printed. Detailed driver changes: - On attach driver announces IFCAP_POLLING in if_capabilities, but not in if_capenable. - On detach driver calls ether_poll_deregister() if polling is enabled. - In polling handler driver obtains its lock and checks IFF_DRV_RUNNING flag. If there is no, then unlocks and returns. - In ioctl handler driver checks for IFCAP_POLLING flag requested to be set or cleared. Driver first calls ether_poll_[de]register(), then obtains driver lock and [dis/en]ables interrupts. - In interrupt handler driver checks IFCAP_POLLING flag in if_capenable. If present, then returns.This is important to protect from spurious interrupts. Reviewed by: ru, sam, jhb
* For each interface flag, indicate whether or not it is owned by therwatson2005-08-091-22/+28
| | | | | | | | | | | device driver, owned by the network stack, or initialized by the device driver before attach and read-only from then on. Not all device drivers and network stack components currently follow these rules, especially with respect to IFF_UP, and a few exceptions with IFF_ALLMULTI. MFC after: 7 days
* Rename IFF_RUNNING to IFF_DRV_RUNNING, IFF_OACTIVE to IFF_DRV_OACTIVE,rwatson2005-08-091-3/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and move both flags from ifnet.if_flags to ifnet.if_drv_flags, making and documenting the locking of these flags the responsibility of the device driver, not the network stack. The flags for these two fields will be mutually exclusive so that they can be exposed to user space as though they were stored in the same variable. Provide #defines to provide the old names #ifndef _KERNEL, so that user applications (such as ifconfig) can use the old flag names. Using the old names in a device driver will result in a compile error in order to help device driver writers adopt the new model. When exposing the interface flags to user space, via interface ioctls or routing sockets, or the two fields together. Since the driver flags cannot currently be set for user space, no new logic is currently required to handle this case. Add some assertions that general purpose network stack routines, such as if_setflags(), are not improperly used on driver-owned flags. With this change, a large number of very minor network stack races are closed, subject to correct device driver locking. Most were likely never triggered. Driver sweep to follow; many thanks to pjd and bz for the line-by-line review they gave this patch. Reviewed by: pjd, bz MFC after: 7 days
* Add hooks into the networking layer to support if_bridge. This changes structthompsa2005-06-051-0/+7
| | | | | | | ifnet so a buildworld is necessary. Approved by: mlaier (mentor) Obtained from: NetBSD
* Change the definition of struct if_data's member ifi_epoch from wallbrooks2005-02-251-1/+1
| | | | | | | | | | | | | | | | | clock time to uptime because wall clock time may go backwards. This is a change in the API which will impact SNMP agents who are using ifi_epoch to set RFC2233's ifCounterDiscontinuityTime. None are know to exist today. This will not impact applications that are using the <index, epoch> tuple to verify interface uniqueness except that it eliminates a race which could lead to a false assumption of uniqueness. Because this is a behavior change, bump __FreeBSD_version. Discussed with: re (jhb, scottl) MFC after: 3 days Pointed out by: pkh (way back at EuroBSDCon) Pointy hat: brooks
* /* -> /*- for license, minor formatting changesimp2005-01-071-1/+1
|
* sync comment on IFF_OACTIVE with reality.. IFF_OACTIVE is set when thejmg2004-11-171-1/+1
| | | | | | | hardware cannot take anymore packets, and so will supress the calling of the device's if_start method... Submitted by: bde
* Re-add ifi_epoch, to struct if_data, this time replacing ifi_unusedbrooks2004-09-081-1/+4
| | | | | | | | | | | | to avoid ABI changes. It is set to the last time the interface counters were zeroed, currently the time if_attach() was called. It is intentended to be a valid value for RFC2233's ifCounterDiscontinuityTime and to make it easier for applications to verify that the interface they find at a given index is the one that was there last time they looked. Due to space constraints ifi_epoch is a time_t rather then a struct timeval. SNMP would prefer higher precision, but this unlikely to be useful in practice.
* Back out ifi_epoch. The ABI breakage is too disruptive this close tobrooks2004-09-021-1/+0
| | | | | 5-STABLE. ifi_epoch will shortly be reintroduced with less precistion using the space currently allocated to ifi_unused.
* Use a spare byte in struct if_data to store the structure size withoutbrooks2004-09-011-0/+1
| | | | | | | | | increasing it. Add code to ifconfig to use this size to find the sockaddr_dl after the struct if_data in the routing message. This allows struct if_data to grow (up to 255 bytes) without breaking ifconfig. Submitted by: peter
* Add a new variable, ifi_epoch, to struct if_data. It is set to the lastbrooks2004-08-301-0/+1
| | | | | | | | | | | | | time the interface counters were zeroed, currently the time if_attach() was called. It is indentended to be a valid value for RFC2233's ifCounterDiscontinuityTime and to make it easier for applications to verify that the interface they find at a given index is the one that was there last time they looked. An if_epoch "compatability" macro has not been created as ifi_epoch has never been a member of struct ifnet. Approved by: andre, bms, wollman
* Add a new network interface flag, IFF_NEEDSGIANT, which will allowrwatson2004-07-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | device drivers to declare that the ifp->if_start() method implemented by the driver requires Giant in order to operate correctly. Add a 'struct task' to 'struct ifnet' that can be used to execute a deferred ifp->if_start() in the event that if_start needs to be called in a Giant-free environment. To do this, introduce if_start(), a wrapper function for ifp->if_start(). If the interface can run MPSAFE, it directly dispatches into the interface start routine. If it can't run MPSAFE, we're running with debug.mpsafenet != 0, and Giant isn't currently held, the task is queued to execute in a swi holding Giant via if_start_deferred(). Modify if_handoff() to use if_start() instead of direct dispatch. Modify 802.11 to use if_start() instead of direct dispatch. This is intended to provide increased compatibility for non-MPSAFE network device drivers in the presence of Giant-free operation via asynchronous dispatch. However, this commit does not mark any network interfaces as IFF_NEEDSGIANT.
* Major overhaul of pseudo-interface cloning. Highlights include:brooks2004-06-221-22/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Split the code out into if_clone.[ch]. - Locked struct if_clone. [1] - Add a per-cloner match function rather then simply matching names of the form <name><unit> and <name>. - Use the match function to allow creation of <interface>.<tag> vlan interfaces. The old way is preserved unchanged! - Also the match function to allow creation of stf(4) interfaces named stf0, stf, or 6to4. This is the only major user visible change in that "ifconfig stf" creates the interface stf rather then stf0 and does not print "stf0" to stdout. - Allow destroy functions to fail so they can refuse to delete interfaces. Currently, we forbid the deletion of interfaces which were created in the init function, particularly lo0, pflog0, and pfsync0. In the case of lo0 this was a panic implementation so it does not count as a user visiable change. :-) - Since most interfaces do not need the new functionality, an family of wrapper functions, ifc_simple_*(), were created to wrap old style cloner functions. - The IF_CLONE_INITIALIZER macro is replaced with a new incompatible IFC_CLONE_INITIALIZER and ifc_simple consumers use IFC_SIMPLE_DECLARE instead. Submitted by: Maurycy Pawlowski-Wieronski <maurycy at fouk.org> [1] Reviewed by: andre, mlaier Discussed on: net
* Link state change notification of ethernet media to the routing socket.andre2004-05-031-0/+8
| | | | | | | | | | | | | | | o Extend the if_data structure with an ifi_link_state field and provide the corresponding defines for the valid states. o The mii_linkchg() callback updates the ifi_link_state field and calls rt_ifmsg() to notify listeners on the routing socket in addition to the kqueue KNOTE. o If vlans are configured on a physical interface notify and update all vlan pseudo devices as well with the vlan_link_state() callback. No objections by: sam, wpaul, ru, bms Brucification by: bde
* Added the new interface capability option for drivers that implementru2004-04-111-0/+1
| | | | | | user-configurable polling(4) support. Make ifconfig(8) aware of it. Suggested by: luigi
* Remove advertising clause from University of California Regent'simp2004-04-071-4/+0
| | | | | | | license, per letter dated July 22, 1999 and email from Peter Wemm, Alan Cox and Robert Watson. Approved by: core, peter, alc, rwatson
* Replace the if_name and if_unit members of struct ifnet with new membersbrooks2003-10-311-1/+1
| | | | | | | | | | | | | 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)
* By popular demand, added the "static ARP" per-interface option.ru2003-10-011-0/+1
|
* o add IF_*bps macros for netbsd compatibilitysam2002-11-141-0/+11
| | | | | | | o add interface capabilities for vlan use and to signal jumbo frame support Reviewed by: many Approved by: re
* style(9):mike2002-10-021-5/+5
| | | | | o Align members of struct if_nameindex. o Align and sort function prototypes.
* Use standards visibility conditionals to conditionalize most of thismike2002-10-021-5/+15
| | | | | | | header (details on how the visibility conditionals work are available in <sys/cdefs.h>). Use standard types instead of BSD specific ones, so that this header compiles in the standards case (specifically this means changing `u_int' to `unsigned int').
* Add the "Monitor" interface flag.phk2002-09-271-0/+1
| | | | | | | | | | Setting this flag on an ethernet interface blocks transmission of packets and discards incoming packets after BPF processing. This is useful if you want to monitor network trafic but not interact with the network in question. Sponsored by: http://www.babeltech.dk
* Add IFF_POLLING into the list of flags which are protected from changing viasobomax2002-08-281-1/+2
| | | | | | ioctl(SIOCSIFFLAGS). MFC after: 1 day
* Implement user-setable promiscuous mode (a new `promisc' flag for ifconfig(8)).sobomax2002-08-191-1/+2
| | | | | | | | | Also, for all interfaces in this mode pass all ethernet frames to upper layer, even those not addressed to our own MAC, which allows packets encapsulated in those frames be processed with packet filters (ipfw(8) et al). Emphatically requested by: Anton Turygin <pa3op@ukr-link.net> Valuable suggestions by: fenner
OpenPOWER on IntegriCloud