summaryrefslogtreecommitdiffstats
path: root/sys/net
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1999-04-16 21:22:55 +0000
committerpeter <peter@FreeBSD.org>1999-04-16 21:22:55 +0000
commit087d4857e56f150a8f549600150404f273efb895 (patch)
treecf4e27432c59d956f4e5784207180115ee8fef9d /sys/net
parentc5fe612b8411a32a8e6e426fc1a70cba0cca3d31 (diff)
downloadFreeBSD-src-087d4857e56f150a8f549600150404f273efb895.zip
FreeBSD-src-087d4857e56f150a8f549600150404f273efb895.tar.gz
Bring the 'new-bus' to the i386. This extensively changes the way the
i386 platform boots, it is no longer ISA-centric, and is fully dynamic. Most old drivers compile and run without modification via 'compatability shims' to enable a smoother transition. eisa, isapnp and pccard* are not yet using the new resource manager. Once fully converted, all drivers will be loadable, including PCI and ISA. (Some other changes appear to have snuck in, including a port of Soren's ATA driver to the Alpha. Soren, back this out if you need to.) This is a checkpoint of work-in-progress, but is quite functional. The bulk of the work was done over the last few years by Doug Rabson and Garrett Wollman. Approved by: core
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if.c35
-rw-r--r--sys/net/if_media.c15
-rw-r--r--sys/net/if_media.h5
-rw-r--r--sys/net/if_var.h3
4 files changed, 54 insertions, 4 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 680bbd4..635be7d 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)if.c 8.3 (Berkeley) 1/4/94
- * $Id: if.c,v 1.65 1999/02/01 20:03:27 phk Exp $
+ * $Id: if.c,v 1.66 1999/02/19 13:41:35 phk Exp $
*/
#include "opt_compat.h"
@@ -178,6 +178,39 @@ if_attach(ifp)
TAILQ_INSERT_HEAD(&ifp->if_addrhead, ifa, ifa_link);
}
}
+
+/*
+ * Detach an interface, removing it from the
+ * list of "active" interfaces.
+ */
+void
+if_detach(ifp)
+ struct ifnet *ifp;
+{
+ struct ifaddr *ifa;
+
+ /*
+ * Remove routes and flush queues.
+ */
+ if_down(ifp);
+
+ /*
+ * Remove address from ifnet_addrs[] and maybe decrement if_index.
+ * Clean up all addresses.
+ */
+ ifnet_addrs[ifp->if_index] = 0;
+ while (ifnet_addrs[if_index] == 0)
+ if_index--;
+
+ for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa;
+ ifa = TAILQ_FIRST(&ifp->if_addrhead)) {
+ TAILQ_REMOVE(&ifp->if_addrhead, ifa, ifa_link);
+ IFAFREE(ifa);
+ }
+
+ TAILQ_REMOVE(&ifnet, ifp, if_link);
+}
+
/*
* Locate an interface based on a complete address.
*/
diff --git a/sys/net/if_media.c b/sys/net/if_media.c
index ee12880..553af92 100644
--- a/sys/net/if_media.c
+++ b/sys/net/if_media.c
@@ -1,5 +1,5 @@
/* $NetBSD: if_media.c,v 1.1 1997/03/17 02:55:15 thorpej Exp $ */
-/* $Id: if_media.c,v 1.5 1998/02/06 12:13:48 eivind Exp $ */
+/* $Id: if_media.c,v 1.6 1998/02/09 06:09:54 eivind Exp $ */
/*
* Copyright (c) 1997
@@ -89,6 +89,19 @@ ifmedia_init(ifm, dontcare_mask, change_callback, status_callback)
ifm->ifm_status = status_callback;
}
+void
+ifmedia_removeall(ifm)
+ struct ifmedia *ifm;
+{
+ struct ifmedia_entry *entry;
+
+ for (entry = LIST_FIRST(&ifm->ifm_list); entry;
+ entry = LIST_FIRST(&ifm->ifm_list)) {
+ LIST_REMOVE(entry, ifm_list);
+ free(entry, M_IFADDR);
+ }
+}
+
/*
* Add a media configuration to the list of supported media
* for a specific interface instance.
diff --git a/sys/net/if_media.h b/sys/net/if_media.h
index c66fd9e..e363485 100644
--- a/sys/net/if_media.h
+++ b/sys/net/if_media.h
@@ -1,5 +1,5 @@
/* $NetBSD: if_media.h,v 1.3 1997/03/26 01:19:27 thorpej Exp $ */
-/* $Id: if_media.h,v 1.3 1999/02/20 11:17:59 julian Exp $ */
+/* $Id: if_media.h,v 1.5 1999/03/07 04:39:25 wpaul Exp $ */
/*
* Copyright (c) 1997
@@ -87,6 +87,9 @@ struct ifmedia {
void ifmedia_init __P((struct ifmedia *ifm, int dontcare_mask,
ifm_change_cb_t change_callback, ifm_stat_cb_t status_callback));
+/* Remove all mediums from a struct ifmedia. */
+void ifmedia_removeall __P(( struct ifmedia *ifm));
+
/* Add one supported medium to a struct ifmedia. */
void ifmedia_add __P((struct ifmedia *ifm, int mword, int data, void *aux));
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
index 31ce8f6..d66aeb7 100644
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* From: @(#)if.h 8.1 (Berkeley) 6/10/93
- * $Id: if_var.h,v 1.9 1998/06/12 03:48:09 julian Exp $
+ * $Id: if_var.h,v 1.10 1998/12/16 18:30:43 phk Exp $
*/
#ifndef _NET_IF_VAR_H_
@@ -299,6 +299,7 @@ int if_addmulti __P((struct ifnet *, struct sockaddr *,
int if_allmulti __P((struct ifnet *, int));
void if_attach __P((struct ifnet *));
int if_delmulti __P((struct ifnet *, struct sockaddr *));
+void if_detach __P((struct ifnet *));
void if_down __P((struct ifnet *));
void if_route __P((struct ifnet *, int flag, int fam));
void if_unroute __P((struct ifnet *, int flag, int fam));
OpenPOWER on IntegriCloud