From 580187839a3e8248d033a4669406d16bcbdb9b6a Mon Sep 17 00:00:00 2001 From: is Date: Sun, 25 May 1997 15:54:22 +0000 Subject: [PATCH] Documentation of Ethernet and FDDI driver support functions and macros. --- share/man/man9/Makefile | 9 +- share/man/man9/ethersubr.9 | 185 +++++++++++++++++++++++++++++++++++++ 2 files changed, 192 insertions(+), 2 deletions(-) create mode 100644 share/man/man9/ethersubr.9 diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index eebafbfbfeb4..bb99a71f8d12 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -1,9 +1,9 @@ -# $NetBSD: Makefile,v 1.22 1997/05/22 03:46:33 jeremy Exp $ +# $NetBSD: Makefile,v 1.23 1997/05/25 15:54:22 is Exp $ # Makefile for section 9 (kernel function and variable) manual pages. MAN= access.9 arp.9 copy.9 cpu_reboot.9 ctxsw.9 \ - disk.9 disklabel.9 doshutdownhooks.9 \ + disk.9 disklabel.9 doshutdownhooks.9 ethersubr.9\ extent.9 fetch.9 inittodr.9 intro.9 log.9 malloc.9 panic.9 pfil.9 \ physio.9 psignal.9 resettodr.9 shutdownhook_establish.9 sleep.9 spl.9 \ store.9 time.9 timeout.9 vslock.9 @@ -17,6 +17,11 @@ MLINKS+=disk.9 disk_init.9 disk.9 disk_attach.9 disk.9 disk_detatch.9 \ disk.9 disk_resetstat.9 MLINKS+=disklabel.9 readdisklabel.9 disklabel.9 writedisklabel.9 \ disklabel.9 setdisklabel.9 disklabel.9 bounds_check_with_label.9 +MLINKS+=ethersubr.9 ether_ifattach.9 ethersubr.9 ether_addmulti.9 \ + ethersubr.9 ether_delmulti.9 ethersubr.9 ETHER_IS_MULTICAST.9 \ + ethersubr.9 ETHER_FIRST_MULTI.9 ethersubr.9 ETHER_NEXT_MULTI.9 \ + ethersubr.9 fddi_ifattach.9 \ + ethersubr.9 fddi_addmulti.9 ethersubr.9 fddi_delmulti.9 MLINKS+=extent.9 extent_create.9 extent.9 extent_destroy.9 \ extent.9 extent_alloc.9 extent.9 extent_alloc_subregion.9 \ extent.9 extent_alloc_region.9 extent.9 extent_free.9 \ diff --git a/share/man/man9/ethersubr.9 b/share/man/man9/ethersubr.9 new file mode 100644 index 000000000000..0d53e0d9a4d4 --- /dev/null +++ b/share/man/man9/ethersubr.9 @@ -0,0 +1,185 @@ +.\" $NetBSD: ethersubr.9,v 1.1 1997/05/25 15:54:25 is Exp $ +.\" +.\" Copyright (c) 1997 Ignatios Souvatzis. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed for the NetBSD Project +.\" by Ignatios Souvatzis +.\" 4. The name of the author may not be used to endorse or promote products +.\" derived from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" + +.Dd Mar 3, 1997 +.Dt ETHERSUBR 9 +.Os NetBSD +.Sh NAME +.Nm ETHERSUBR +.Nd Ethernet and FDDI driver support functions and macros +.Sh SYNOPSIS +.Fd #include +.Ft void +.Fn ether_ifattach "struct ifnet *ifp" "u_int8_t *lla" +.Ft int +.Fn ether_addmulti "struct ifrequest *ifr" "struct ethercom *ec" +.Ft int +.Fn ether_delmulti "struct ifrequest *ifr" "struct ethercom *ec" +.Ft void +.Fn ETHER_FIRST_MULTI "struct ether_multistep step" "struct ethercom *ec" "struct ether_multi *enm" +.Ft void +.Fn ETHER_NEXT_MULTI "struct ether_multistep step" "struct ether_multi *enm" +.Ft int +.Fn ETHER_IS_MULTICAST "u_int8_t *addr" + +.Fd #include +.Ft void +.Fn fddi_ifattach "struct ifnet *ifp" "u_int8_t *lla" +.Ft int +.Fn fddi_addmulti "struct ifrequest *ifr" "struct ethercom *ec" +.Ft int +.Fn fddi_delmulti "struct ifrequest *ifr" "struct ethercom *ec" + +.Sh DESCRIPTION +The +.Nm +functions provide the interface between the +.Nm +module and the network drivers which need Ethernet support. Such +drivers must request the "ether" attribute in their "files" declaration +and call the appropriate functions as specified below. + +FDDI drivers must request the "fddi" attribute in their "files" +declaration and call the functions tagged with "fddi_" or "FDDI_" +instead, where different. Some macros are shared. + +Note that you also need the +.Xr ARP 9 +stuff to support IPv4 on your hardware. + +.Bl -tag -width compact + +.It Fn ether_ifattach + +Perform the device independent, but Ethernet specific initialization of +the interface pointed to by +.Fa ifp . + +Among other duties, this function creates a record for the link level +address in the interfaces' address list and records the link level address +pointed to by +.Fa lla +there. + +You must call this function from the drivers' attach function. + +.It Fn fddi_ifattach + +corresponding function for FDDI devices. + +.It Fn ether_addmulti +.It Fn ether_delmulti + +Add ( +.Fn ether_addmulti ) +or delete ( +.Fn ether_delmulti ) +the address described by the +.Fa ifr +pointer to the Ethernet multicast list belonging to +.Fa ec . + +These functions must be called from the drivers' ioctl function to +handle SIOCADDMULTI and SIOCDELMULTI requests. If they return +ENETRESET, the hardware multicast filter must be reinitialized. + +These functions accept AF_UNSPEC addresses, which are interpreted as +Ethernet addresses, or AF_INET addresses. In the latter case, +INADDR_ANY is mapped to a range describing all the Ethernet address +space reserved for IPv4 multicast addresses. + +.Fn ether_addmulti + +returns EAFNOSUPPORT if an unsupportedd address family is specified, +or EINVAL, if a non-multicast address is specified, or ENETRESET, if +the multicast list really changed and the driver should synchronize +its hardware filter with it. + +.Fn ether_delmulti + +returns, in addition to the above errors, ENXIO, if the specified address +can't be found in the list of multicast addresses. + +.It Fn ETHER_NEXT_MULTI +is a macro to step through all of the ether_multi records, one at a time. +The current position is remembered in +.Fa step , +which the caller must provide. +.It Fn ETHER_FIRST_MULTI +must be called to initialize +.Fa step +and get the first record. Both macros return a NULL +.Fa enm +when there are no remaining records. + +.It Fn fddi_addmulti +.It Fn fddi_delmulti +corresponding functions for FDDI devices. + +.It Fn ETHER_IS_MULTICAST + +returns 1, if +.Fa addr +points to an Ethernet/FDDI multicast (or broadcast) address. +Implemented as a macro. + +.El + + +.\" .Sh ERRORS + +.Sh SEE ALSO +.Xr arp 9 . + +.Sh AUTHORS +UCB CSRG (original implementation) +.br +Ignatios Souvatzis (support for new ARP system) + +.\" .Sh BUGS + +.\" .Sh STANDARDS + +.Sh FILES + +Ethernet support functions are declared in /usr/src/sys/net/if_ether.h +and defined (if not implemented as macro) in +/usr/src/sys/net/if_ethersubr.c. + +FDDI support functions are declared in /usr/src/sys/net/if_fddi.h and +defined (if not implemented as macro) in /usr/src/sys/net/if_fddisubr.c. + + +.Sh HISTORY +Rewritten to attach to the new ARP system in +.Nx 1.2d .