Author: yongari
Date: Fri Oct  8 17:58:07 2010
New Revision: 213587
URL: http://svn.freebsd.org/changeset/base/213587

Log:
  Do not blindly UP the interface when interface's MTU is changed. If
  driver is not running there is no need to up the interface. While
  I'm here hold driver lock before modifying MTU as it is referenced
  in RX handler.

Modified:
  head/sys/dev/bge/if_bge.c

Modified: head/sys/dev/bge/if_bge.c
==============================================================================
--- head/sys/dev/bge/if_bge.c   Fri Oct  8 17:46:51 2010        (r213586)
+++ head/sys/dev/bge/if_bge.c   Fri Oct  8 17:58:07 2010        (r213587)
@@ -4631,6 +4631,7 @@ bge_ioctl(struct ifnet *ifp, u_long comm
 
        switch (command) {
        case SIOCSIFMTU:
+               BGE_LOCK(sc);
                if (ifr->ifr_mtu < ETHERMIN ||
                    ((BGE_IS_JUMBO_CAPABLE(sc)) &&
                    ifr->ifr_mtu > BGE_JUMBO_MTU) ||
@@ -4639,9 +4640,12 @@ bge_ioctl(struct ifnet *ifp, u_long comm
                        error = EINVAL;
                else if (ifp->if_mtu != ifr->ifr_mtu) {
                        ifp->if_mtu = ifr->ifr_mtu;
-                       ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
-                       bge_init(sc);
+                       if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
+                               ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
+                               bge_init_locked(sc);
+                       }
                }
+               BGE_UNLOCK(sc);
                break;
        case SIOCSIFFLAGS:
                BGE_LOCK(sc);
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to