diff options
author | brooks <brooks@FreeBSD.org> | 2005-06-10 16:49:24 +0000 |
---|---|---|
committer | brooks <brooks@FreeBSD.org> | 2005-06-10 16:49:24 +0000 |
commit | 567ba9b00a248431e7c1147c4e079fd7a11b9ecf (patch) | |
tree | f65b6d7834b40dfcd48534829a0a1e9529ab87ee /share/man/man9/ifnet.9 | |
parent | 3eaa67c3ad947d85be5350e0e184cd6ee5b93a52 (diff) | |
download | FreeBSD-src-567ba9b00a248431e7c1147c4e079fd7a11b9ecf.zip FreeBSD-src-567ba9b00a248431e7c1147c4e079fd7a11b9ecf.tar.gz |
Stop embedding struct ifnet at the top of driver softcs. Instead the
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
Diffstat (limited to 'share/man/man9/ifnet.9')
-rw-r--r-- | share/man/man9/ifnet.9 | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/share/man/man9/ifnet.9 b/share/man/man9/ifnet.9 index 9365b86..c79d318 100644 --- a/share/man/man9/ifnet.9 +++ b/share/man/man9/ifnet.9 @@ -46,9 +46,17 @@ .In net/if_types.h .\" .Ss "Interface Manipulation Functions" +.Ft "struct ifnet *" +.Fn if_alloc "u_char type" .Ft void .Fn if_attach "struct ifnet *ifp" .Ft void +.Fn if_detach "struct ifnet *ifp" +.Ft void +.Fn if_free "struct ifnet *ifp" +.Ft void +.Fn if_free_type "struct ifnet *ifp" "u_char type" +.Ft void .Fn if_down "struct ifnet *ifp" .Ft int .Fn ifioctl "struct socket *so" "u_long cmd" "caddr_t data" "struct thread *td" @@ -219,6 +227,11 @@ are as follows: .Pq Vt "void *" A pointer to the driver's private state block. (Initialized by driver.) +.It Va if_l2com +.Pq Vt "void *" +A pointer to the common data for the interface's layer 2 protocol. +(Initialized by +.Fn if_alloc . ) .It Va if_link .Pq Fn TAILQ_ENTRY ifnet .Xr queue 3 @@ -270,6 +283,8 @@ This number can be used in a to refer to a particular interface by index (see .Xr link_addr 3 ) . +(Initialized by +.Fn if_alloc . ) .It Va if_timer .Pq Vt short Number of seconds until the watchdog timer @@ -988,6 +1003,14 @@ A reference count of requests for this particular membership. .El .Ss Interface Manipulation Functions .Bl -ohang -offset indent +.It Fn if_alloc +Allocate and initialize an +.Fa ifp . +Initalization includes the allocation of an interface index and may +include the allocation of a +.Fa type +specific structure in +.Va if_l2com . .It Fn if_attach Link the specified interface .Fa ifp @@ -999,6 +1022,29 @@ structure to be the first element in that list. (A pointer to this address structure is saved in the global array .Va ifnet_addrs . ) +The +.Fa ifp +must have been allocted by +.Fn if_alloc . +.It Fn if_detach +Shut down and unlink the specified +.Fa ifp +from the interface list. +.It Fn if_free +Free the given +.Fa ifp +back to the system. +The interface must have been previously detached if it was ever attached. +.It Fn if_free_type +Identical to +.Fn if_free +except that the given +.Fa type +is used to free +.Va if_l2com +instead of the type in +.Va if_type . +This is intended for use with drivers that change their interface type. .It Fn if_down Mark the interface .Fa ifp |