Now that no drivers in the tree use if_watchdog and if_timer, this patch just 
removes them completely.  Since if_timer was a short that was adjacent to 
if_index, removing if_timer would have still left a padding hole in the form 
of a short on all of our current architectures.  After discussing this briefly 
with Brooks I changed if_index to be an int rather than leaving the padding 
hole.  Comments?
--- //depot/vendor/freebsd/src/sys/net/if.c     2009/11/12 19:05:14
+++ //depot/user/jhb/cleanup/sys/net/if.c       2009/11/19 22:35:58
@@ -125,10 +125,8 @@
 static void    if_freemulti(struct ifmultiaddr *);
 static void    if_init(void *);
 static void    if_grow(void);
-static void    if_check(void *);
 static void    if_route(struct ifnet *, int flag, int fam);
 static int     if_setflag(struct ifnet *, int, int, int *, int);
-static void    if_slowtimo(void *);
 static int     if_transmit(struct ifnet *ifp, struct mbuf *m);
 static void    if_unroute(struct ifnet *, int flag, int fam);
 static void    link_rtrequest(int, struct rtentry *, struct rt_addrinfo *);
@@ -185,11 +183,6 @@
 static if_com_alloc_t *if_com_alloc[256];
 static if_com_free_t *if_com_free[256];
 
-/*
- * System initialization
- */
-SYSINIT(interface_check, SI_SUB_PROTO_IF, SI_ORDER_FIRST, if_check, NULL);
-
 MALLOC_DEFINE(M_IFNET, "ifnet", "interface internals");
 MALLOC_DEFINE(M_IFADDR, "ifaddr", "interface address");
 MALLOC_DEFINE(M_IFMADDR, "ether_multi", "link-level multicast address");
@@ -375,18 +368,6 @@
        V_ifindex_table = e;
 }
 
-static void
-if_check(void *dummy __unused)
-{
-
-       /*
-        * If at least one interface added during boot uses
-        * if_watchdog then start the timer.
-        */
-       if (slowtimo_started)
-               if_slowtimo(0);
-}
-
 /*
  * Allocate a struct ifnet and an index for an interface.  A layer 2
  * common structure will also be allocated if an allocation routine is
@@ -670,18 +651,6 @@
 
        /* Announce the interface. */
        rt_ifannouncemsg(ifp, IFAN_ARRIVAL);
-
-       if (!vmove && ifp->if_watchdog != NULL) {
-               if_printf(ifp,
-                   "WARNING: using obsoleted if_watchdog interface\n");
-
-               /*
-                * Note that we need if_slowtimo().  If this happens after
-                * boot, then call if_slowtimo() directly.
-                */
-               if (atomic_cmpset_int(&slowtimo_started, 0, 1) && !cold)
-                       if_slowtimo(0);
-       }
 }
 
 static void
@@ -1973,39 +1942,6 @@
 }
 
 /*
- * Handle interface watchdog timer routines.  Called
- * from softclock, we decrement timers (if set) and
- * call the appropriate interface routine on expiration.
- *
- * XXXRW: Note that because timeouts run with Giant, if_watchdog() is called
- * holding Giant.
- */
-static void
-if_slowtimo(void *arg)
-{
-       VNET_ITERATOR_DECL(vnet_iter);
-       struct ifnet *ifp;
-       int s = splimp();
-
-       VNET_LIST_RLOCK_NOSLEEP();
-       IFNET_RLOCK_NOSLEEP();
-       VNET_FOREACH(vnet_iter) {
-               CURVNET_SET(vnet_iter);
-               TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
-                       if (ifp->if_timer == 0 || --ifp->if_timer)
-                               continue;
-                       if (ifp->if_watchdog)
-                               (*ifp->if_watchdog)(ifp);
-               }
-               CURVNET_RESTORE();
-       }
-       IFNET_RUNLOCK_NOSLEEP();
-       VNET_LIST_RUNLOCK_NOSLEEP();
-       splx(s);
-       timeout(if_slowtimo, (void *)0, hz / IFNET_SLOWHZ);
-}
-
-/*
  * Map interface name to interface structure pointer, with or without
  * returning a reference.
  */
--- //depot/vendor/freebsd/src/sys/net/if_dead.c        2009/04/23 11:55:13
+++ //depot/user/jhb/cleanup/sys/net/if_dead.c  2009/11/19 22:35:58
@@ -70,12 +70,6 @@
        return (ENXIO);
 }
 
-static void
-ifdead_watchdog(struct ifnet *ifp)
-{
-
-}
-
 static int
 ifdead_resolvemulti(struct ifnet *ifp, struct sockaddr **llsa,
     struct sockaddr *sa)
@@ -107,7 +101,6 @@
        ifp->if_input = ifdead_input;
        ifp->if_start = ifdead_start;
        ifp->if_ioctl = ifdead_ioctl;
-       ifp->if_watchdog = ifdead_watchdog;
        ifp->if_resolvemulti = ifdead_resolvemulti;
        ifp->if_qflush = ifdead_qflush;
        ifp->if_transmit = ifdead_transmit;
--- //depot/vendor/freebsd/src/sys/net/if_var.h 2009/11/12 19:05:14
+++ //depot/user/jhb/cleanup/sys/net/if_var.h   2009/11/19 22:35:58
@@ -140,8 +140,7 @@
        int     if_pcount;              /* number of promiscuous listeners */
        struct  carp_if *if_carp;       /* carp interface structure */
        struct  bpf_if *if_bpf;         /* packet filter structure */
-       u_short if_index;               /* numeric abbreviation for this if  */
-       short   if_timer;               /* time 'til if_watchdog called */
+       u_int   if_index;               /* numeric abbreviation for this if  */
        struct  ifvlantrunk *if_vlantrunk; /* pointer to 802.1q data */
        int     if_flags;               /* up/down, broadcast, etc. */
        int     if_capabilities;        /* interface features & capabilities */
@@ -161,8 +160,6 @@
                (struct ifnet *);
        int     (*if_ioctl)             /* ioctl routine */
                (struct ifnet *, u_long, caddr_t);
-       void    (*if_watchdog)          /* timer routine */
-               (struct ifnet *);
        void    (*if_init)              /* Init routine */
                (void *);
        int     (*if_resolvemulti)      /* validate/resolve multicast */

-- 
John Baldwin
_______________________________________________
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "freebsd-net-unsubscr...@freebsd.org"

Reply via email to