And this diff... did you test it yourself before mailing it out?

Can I see your dmesg please?


> A diff for the ne(4) NE2000 driver to clean up the ioctl handler code
> a bit and eliminate unnecessary resets when reconfiguring IP addresses.
> 
> Please test and provide a dmesg.
> 
> 
> Index: dp8390.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/ic/dp8390.c,v
> retrieving revision 1.41
> diff -u -p -r1.41 dp8390.c
> --- dp8390.c  28 Nov 2008 02:44:17 -0000      1.41
> +++ dp8390.c  13 Dec 2009 18:36:10 -0000
> @@ -807,9 +807,6 @@ dp8390_intr(void *arg)
>       }
>  }
>  
> -/*
> - * Process an ioctl request.  This code needs some work - it looks pretty 
> ugly.
> - */
>  int
>  dp8390_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
>  {
> @@ -825,46 +822,29 @@ dp8390_ioctl(struct ifnet *ifp, u_long c
>               if ((error = dp8390_enable(sc)) != 0)
>                       break;
>               ifp->if_flags |= IFF_UP;
> -
> -             switch (ifa->ifa_addr->sa_family) {
> -#ifdef INET
> -             case AF_INET:
> +             if (!(ifp->if_flags & IFF_RUNNING))
>                       dp8390_init(sc);
> +#ifdef INET
> +             if (ifa->ifa_addr->sa_family == AF_INET)
>                       arp_ifinit(&sc->sc_arpcom, ifa);
> -                     break;
>  #endif
> -             default:
> -                     dp8390_init(sc);
> -                     break;
> -             }
>               break;
>  
>       case SIOCSIFFLAGS:
> -             if ((ifp->if_flags & IFF_UP) == 0 &&
> -                 (ifp->if_flags & IFF_RUNNING) != 0) {
> -                     /*
> -                      * If interface is marked down and it is running, then
> -                      * stop it.
> -                      */
> -                     dp8390_stop(sc);
> -                     ifp->if_flags &= ~IFF_RUNNING;
> -                     dp8390_disable(sc);
> -             } else if ((ifp->if_flags & IFF_UP) != 0 &&
> -                 (ifp->if_flags & IFF_RUNNING) == 0) {
> -                     /*
> -                      * If interface is marked up and it is stopped, then
> -                      * start it.
> -                      */
> -                     if ((error = dp8390_enable(sc)) != 0)
> -                             break;
> -                     dp8390_init(sc);
> -             } else if ((ifp->if_flags & IFF_UP) != 0) {
> -                     /*
> -                      * Reset the interface to pick up changes in any other
> -                      * flags that affect hardware registers.
> -                      */
> -                     dp8390_stop(sc);
> -                     dp8390_init(sc);
> +             if (ifp->if_flags & IFF_UP) {
> +                     if (ifp->if_flags & IFF_RUNNING)
> +                             error = ENETRESET;
> +                     else {
> +                             if ((error = dp8390_enable(sc)) != 0)
> +                                     break;
> +                             dp8390_init(sc);
> +                     }
> +             } else {
> +                     if (ifp->if_flags & IFF_RUNNING) {
> +                             dp8390_stop(sc);
> +                             ifp->if_flags &= ~IFF_RUNNING;
> +                             dp8390_disable(sc);
> +                     }
>               }
>               break;
>  
> 
> -- 
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.

Reply via email to