summaryrefslogtreecommitdiffstats
path: root/sys/net/if_var.h
Commit message (Collapse)AuthorAgeFilesLines
* Fix a copy-and-paste-o in IFQ_DRV_PREPEND - all pointyhats to me.mlaier2004-07-141-5/+5
| | | | | | | While here also fix a (not less stupid) braino in IFQ_DRV_PURGE. Reported-by: clement Tested-by: clement (_PREPEND in sis(4))
* Major overhaul of pseudo-interface cloning. Highlights include:brooks2004-06-221-9/+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
* Do the dreaded s/dev_t/struct cdev */phk2004-06-161-1/+1
| | | | Bump __FreeBSD_version accordingly.
* Fix a typeo in IFQ_HANDOFF.mlaier2004-06-151-1/+1
|
* Transform tbr_dequeue into a function pointer in order to build drivers withmlaier2004-06-151-3/+3
| | | | | | ALTQ enabled versions of IFQ_* macros by default, as requested by serveral others. This is a follow-up to the quick fix I committed yesterday which turned off the ALTQ checks for non-ALTQ kernels.
* Unbreak non-ALTQ kernel linking. I forgot about tbr_dequeue.mlaier2004-06-141-1/+1
| | | | | | | | | In the end drivers should be building with ALTQ checks by default, but for now build them with the old macros for non-ALTQ kernels. Note: Check new features w/ LINT *and* w/ LINT minus the new feature. Found-by: rwatson
* Link ALTQ to the build and break with ABI for struct ifnet. Please recompilemlaier2004-06-131-5/+202
| | | | | | | | | | | | your (network) modules as well as any userland that might make sense of sizeof(struct ifnet). This does not change the queueing yet. These changes will follow in a seperate commit. Same with the driver changes, which need case by case evaluation. __FreeBSD_version bump will follow. Tested-by: (i386)LINT
* Link state change notification of ethernet media to the routing socket.andre2004-05-031-0/+1
| | | | | | | | | | | | | | | 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
* Make if_(un)route static in if.c as they are called from if_up/if_down only.mlaier2004-04-181-2/+0
| | | | | | | This is also cleanup to make locking easier. Reviewed by: luigi Approved by: bms(mentor)
* + rename and document an unused field in struct arpcom (field is stillluigi2004-04-181-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | there so there are no ABI changes); + replace 5 redefinitions of the IPF2AC macro with one in if_arp.h Eventually (but before freezing the ABI) we need to get rid of struct arpcom (initially with the help of some smart #defines to avoid having to touch each and every driver, see below). Apart from the struct ifnet, struct arpcom now only stores a copy of the MAC address (ac_enaddr, but we already have another copy in the struct ifnet -- if_addrhead), and a netgraph-specific field which is _always_ accessed through the ifp, so it might well go into the struct ifnet too (where, besides, there is already an entry for AF_NETGRAPH data...) Too bad ac_enaddr is widely referenced by all drivers. But this can be fixed as follows: #define ac_enaddr ac_if.the_original_ac_enaddr_in_struct_ifnet (note that the right hand side would likely be a pointer rather than the base address of an array.)
* Documented the intended usage of if_addrhead and ifaddr_byindex()luigi2004-04-161-3/+11
| | | | This commit only changes comments. Nothing to recompile.
* Document the way if_addrhead and struct ifaddr are used.luigi2004-04-151-3/+11
| | | | | | | Remove a member from 'struct ifaddr' which has been in an #ifdef notdef block since rev 1.1 No ABI changes -- no need to recompile anything.
* Count outgoing link-level broadcast packets in if_omcasts.ru2004-04-121-1/+1
| | | | | | | | I'm not sure this is completely correct but at least this is consistent with the accounting of incoming broadcasts. PR: kern/65273 Submitted by: David J Duchscher <daved@tamu.edu>
* In 4.x, if_ipending is used to track network interrupt state. In 5.x,rwatson2004-04-111-7/+0
| | | | it is no longer used, so GC the ifnet.if_ipending field.
* 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
* + arpresolve(): remove an unused argumentluigi2004-04-041-19/+5
| | | | | | | | | + struct ifnet: remove unused fields, move ipv6-related field close to each other, add a pointer to l3<->l2 translation tables (arp,nd6, etc.) for future use. + struct route: remove an unused field, move close to each other some fields that might likely go away in the future
* Remove if_withname. It came in with the KAME import, but never gotbrooks2004-03-131-1/+0
| | | | | | | | used. Should someone need its functionality, it's a really expensive implementation of: ifnet_byindex(sdl->sdl_index) Reviewed by: bde, ume
* Bring eventhandler callbacks for pf.mlaier2004-02-261-0/+14
| | | | | | | | This enables pf to track dynamic address changes on interfaces (dailup) with the "on (<ifname>)"-syntax. This also brings hooks in anticipation of tracking cloned interfaces, which will be in future versions of pf. Approved by: bms(mentor)
* Make the if_broadcastaddr const. All the drivers in the tree whichimp2003-12-071-1/+1
| | | | | | violated the constness were corrected before the freeze. This was suggested by mdodd@, I think, and sam@ and others have signed off on this if I recall my conversations with them correctly.
* Modify the MAC Framework so that instead of embedding a (struct label)rwatson2003-11-121-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in various kernel objects to represent security data, we embed a (struct label *) pointer, which now references labels allocated using a UMA zone (mac_label.c). This allows the size and shape of struct label to be varied without changing the size and shape of these kernel objects, which become part of the frozen ABI with 5-STABLE. This opens the door for boot-time selection of the number of label slots, and hence changes to the bound on the number of simultaneous labeled policies at boot-time instead of compile-time. This also makes it easier to embed label references in new objects as required for locking/caching with fine-grained network stack locking, such as inpcb structures. This change also moves us further in the direction of hiding the structure of kernel objects from MAC policy modules, not to mention dramatically reducing the number of '&' symbols appearing in both the MAC Framework and MAC policy modules, and improving readability. While this results in minimal performance change with MAC enabled, it will observably shrink the size of a number of critical kernel data structures for the !MAC case, and should have a small (but measurable) performance benefit (i.e., struct vnode, struct socket) do to memory conservation and reduced cost of zeroing memory. NOTE: Users of MAC must recompile their kernel and all MAC modules as a result of this change. Because this is an API change, third party MAC modules will also need to be updated to make less use of the '&' symbol. Suggestions from: bmilekic Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
* Replace the if_name and if_unit members of struct ifnet with new membersbrooks2003-10-311-2/+6
| | | | | | | | | | | | | 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)
* Since dp->dom_ifattach calls malloc() with M_WAITOK, we cannotume2003-10-241-0/+9
| | | | | | use mutex lock directly here. Protect ifp->if_afdata instead. Reported by: grehan
* - add dom_if{attach,detach} framework.ume2003-10-171-0/+2
| | | | | | - transition to use ifp->if_afdata. Obtained from: KAME
* Correct typos, mostly s/ a / an / where appropriate. Some whitespace cleanup,schweikh2003-01-011-2/+2
| | | | especially in troff files.
* Fix typos, mostly s/ an / a / where appropriate and a few s/an/and/schweikh2002-12-301-1/+1
| | | | Add FreeBSD Id tag where missing.
* Long chain of calls starting with bridge_on(), going through IPv6, andhsu2002-12-271-1/+2
| | | | | ending up at ifa_ifwithdstaddr() could lead to a recursive lock of the ifnet list mutex.
* SMP locking for ifnet list.hsu2002-12-221-0/+7
|
* Switch to the conventional reference counting scheme.hsu2002-12-181-15/+15
|
* Lock up ifaddr reference counts.hsu2002-12-181-8/+24
|
* o add if_nvlans member to track the number of vlans active on an interfacesam2002-11-141-9/+3
| | | | | | | | o add if_input member for interface drivers to call through to pass packets "up" o remove ethernet-specific function decls (moved to ethernet.h) Reviewed by: many Approved by: re
* Fixed some of the namespace pollution in rev.1.33. <sys/systm.h> wasbde2002-09-291-1/+0
| | | | | included here because it was once a prerequisite of <sys/mutex.h> although that bug was fixed long ago.
* Add a new helper function if_printf() modeled on device_printf(). Thebrooks2002-09-241-0/+1
| | | | | | | | function takes a struct ifnet pointer followed by the usual printf arguments and prints "<interfacename>: " before the results of printf. Since this is the primary form of printf calls in network device drivers and accounts for most uses of the ifnet menber if_unit, this significantly simplifies many printf()s.
* Increase size of ifnet.if_flags from 16 bits (short) to 32 bits (int). To avoidsobomax2002-08-181-1/+1
| | | | | | | breaking application ABI use unused ifreq.ifru_flags[1] for upper 16 bits in SIOCSIFFLAGS and SIOCGIFFLAGS ioctl's. Reviewed by: -hackers, -net
* Move to nested include of _label.h instead of mac.h, reducing namespacerwatson2002-08-141-1/+1
| | | | | | | | pollution. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs Suggested by: bde
* Introduce support for Mandatory Access Control and extensiblerwatson2002-07-301-0/+2
| | | | | | | | | | | | | kernel access control. Label network interface structures, permitting security features to be maintained on those objects. if_label will be used to authorize data flow using the network interface. if_label will be protected using the same synchronization primitives as other mutable entries in struct ifnet. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
* Minor style nitimp2002-05-071-1/+1
|
* Remove __P.alfred2002-03-191-69/+65
|
* whitespace fixes.jlemon2001-12-141-1/+1
|
* Device Polling code for -current.luigi2001-12-141-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Non-SMP, i386-only, no polling in the idle loop at the moment. To use this code you must compile a kernel with options DEVICE_POLLING and at runtime enable polling with sysctl kern.polling.enable=1 The percentage of CPU reserved to userland can be set with sysctl kern.polling.user_frac=NN (default is 50) while the remainder is used by polling device drivers and netisr's. These are the only two variables that you should need to touch. There are a few more parameters in kern.polling but the default values are adequate for all purposes. See the code in kern_poll.c for more details on them. Polling in the idle loop will be implemented shortly by introducing a kernel thread which does the job. Until then, the amount of CPU dedicated to polling will never exceed (100-user_frac). The equivalent (actually, better) code for -stable is at http://info.iet.unipi.it/~luigi/polling/ and also supports polling in the idle loop. NOTE to Alpha developers: There is really nothing in this code that is i386-specific. If you move the 2 lines supporting the new option from sys/conf/{files,options}.i386 to sys/conf/{files,options} I am pretty sure that this should work on the Alpha as well, just that I do not have a suitable test box to try it. If someone feels like trying it, I would appreciate it. NOTE to other developers: sure some things could be done better, and as always I am open to constructive criticism, which a few of you have already given and I greatly appreciated. However, before proposing radical architectural changes, please take some time to possibly try out this code, or at the very least read the comments in kern_poll.c, especially re. the reason why I am using a soft netisr and cannot (I believe) replace it with a simple timeout. Quick description of files touched by this commit: sys/conf/files.i386 new file kern/kern_poll.c sys/conf/options.i386 new option sys/i386/i386/trap.c poll in trap (disabled by default) sys/kern/kern_clock.c initialization and hardclock hooks. sys/kern/kern_intr.c minor swi_net changes sys/kern/kern_poll.c the bulk of the code. sys/net/if.h new flag sys/net/if_var.h declaration for functions used in device drivers. sys/net/netisr.h NETISR_POLL sys/dev/fxp/if_fxp.c sys/dev/fxp/if_fxpvar.h sys/pci/if_dc.c sys/pci/if_dcreg.h sys/pci/if_sis.c sys/pci/if_sisreg.h device driver modifications
* Expand the comment on the layout of softc, arpcom and ifnet structures,luigi2001-11-221-0/+15
| | | | and list the places where the assumption is used.
* Remove ifnet.if_mpsafe for now. If this is needed, it won't be neededjhb2001-11-141-9/+1
| | | | | | until much later when the network stack locking is farther along. Approved by: jlemon
* Pull post-4.4BSD change to sys/net/route.c from BSD/OS 4.2.ru2001-10-171-1/+2
| | | | | | | | | | | | | | | | | | | | Have sys/net/route.c:rtrequest1(), which takes ``rt_addrinfo *'' as the argument. Pass rt_addrinfo all the way down to rtrequest1 and ifa->ifa_rtrequest. 3rd argument of ifa->ifa_rtrequest is now ``rt_addrinfo *'' instead of ``sockaddr *'' (almost noone is using it anyways). Benefit: the following command now works. Previously we needed two route(8) invocations, "add" then "change". # route add -inet6 default ::1 -ifp gif0 Remove unsafe typecast in rtrequest(), from ``rtentry *'' to ``sockaddr *''. It was introduced by 4.3BSD-Reno and never corrected. Obtained from: BSD/OS, NetBSD MFC after: 1 month PR: kern/28360
* bring in ARP support for variable length link level addressesfjoe2001-10-141-0/+4
| | | | | | | Reviewed by: jdp Approved by: jdp Obtained from: NetBSD MFC after: 6 weeks
* Documentation comment: note that the each NIC's softc is assumed to startmjacob2001-10-021-0/+5
| | | | | | with an ifnet structure. MFC after: 1 week
* Add two fields to the ifnet structure indicating what extra capabilitiesjlemon2001-09-181-0/+2
| | | | a network device has, and which ones are enabled.
* KSE Milestone 2julian2001-09-121-2/+2
| | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha
* Wrap array accesses in macros, which also happen to be lvalues:jlemon2001-09-061-3/+14
| | | | | | | ifnet_addrs[i - 1] -> ifaddr_byindex(i) ifindex2ifnet[i] -> ifnet_byindex(i) This is intended to ease the conversion to SMPng.
* Add kernel infrastructure for network device cloning.brooks2001-07-021-1/+7
| | | | | | Reviewed by: ru, ume Obtained from: NetBSD MFC after: 1 week
* Catch up to header include changes:jhb2001-03-281-1/+3
| | | | | - <sys/mutex.h> now requires <sys/systm.h> - <sys/mutex.h> and <sys/sx.h> now require <sys/lock.h>
* Change and clean the mutex lock interface.bmilekic2001-02-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mtx_enter(lock, type) becomes: mtx_lock(lock) for sleep locks (MTX_DEF-initialized locks) mtx_lock_spin(lock) for spin locks (MTX_SPIN-initialized) similarily, for releasing a lock, we now have: mtx_unlock(lock) for MTX_DEF and mtx_unlock_spin(lock) for MTX_SPIN. We change the caller interface for the two different types of locks because the semantics are entirely different for each case, and this makes it explicitly clear and, at the same time, it rids us of the extra `type' argument. The enter->lock and exit->unlock change has been made with the idea that we're "locking data" and not "entering locked code" in mind. Further, remove all additional "flags" previously passed to the lock acquire/release routines with the exception of two: MTX_QUIET and MTX_NOSWITCH The functionality of these flags is preserved and they can be passed to the lock/unlock routines by calling the corresponding wrappers: mtx_{lock, unlock}_flags(lock, flag(s)) and mtx_{lock, unlock}_spin_flags(lock, flag(s)) for MTX_DEF and MTX_SPIN locks, respectively. Re-inline some lock acq/rel code; in the sleep lock case, we only inline the _obtain_lock()s in order to ensure that the inlined code fits into a cache line. In the spin lock case, we inline recursion and actually only perform a function call if we need to spin. This change has been made with the idea that we generally tend to avoid spin locks and that also the spin locks that we do have and are heavily used (i.e. sched_lock) do recurse, and therefore in an effort to reduce function call overhead for some architectures (such as alpha), we inline recursion for this case. Create a new malloc type for the witness code and retire from using the M_DEV type. The new type is called M_WITNESS and is only declared if WITNESS is enabled. Begin cleaning up some machdep/mutex.h code - specifically updated the "optimized" inlined code in alpha/mutex.h and wrote MTX_LOCK_SPIN and MTX_UNLOCK_SPIN asm macros for the i386/mutex.h as we presently need those. Finally, caught up to the interface changes in all sys code. Contributors: jake, jhb, jasone (in no particular order)
OpenPOWER on IntegriCloud