The attached patch prevents the driver from reinitializing card when it's
already running.. basically useful when adding multiple interface aliases,
because it takes much less time :-)
Obtained from OpenBSD.

-- 
Michal Belczyk
Index: if_sk.c
===================================================================
RCS file: /home/dcvs/src/sys/dev/netif/sk/if_sk.c,v
retrieving revision 1.41.2.1
diff -u -r1.41.2.1 if_sk.c
--- if_sk.c     1 Jan 2006 00:59:05 -0000       1.41.2.1
+++ if_sk.c     13 Mar 2006 18:11:17 -0000
@@ -1025,6 +1025,7 @@
                        error = EINVAL;
                else {
                        ifp->if_mtu = ifr->ifr_mtu;
+                       ifp->if_flags &= ~IFF_RUNNING;
                        sk_init(sc_if);
                }
                break;
@@ -1672,6 +1673,7 @@
        sc_if = ifp->if_softc;
 
        printf("sk%d: watchdog timeout\n", sc_if->sk_unit);
+       ifp->if_flags &= ~IFF_RUNNING;
        sk_init(sc_if);
 
        if (!ifq_is_empty(&ifp->if_snd))
@@ -2274,6 +2276,11 @@
 
        crit_enter();
 
+       if (ifp->if_flags & IFF_RUNNING) {
+               crit_exit();
+               return;
+       }
+
        /* Cancel pending I/O and free all RX/TX buffers. */
        sk_stop(sc_if);
 

Reply via email to