On Mon, Jun 22, 2009 at 11:02:57PM -0400, Brad wrote:
> Here is a diff for sparc's copy of the hme(4) driver to rewrite the ioctl
> handling code.
> 
> Please test with hme(4) on sparc. Send a dmesg.

Looks like I forgot to re-diff after 1.59 was commited.

This is exactly the same but should now be able to apply against 1.59.


Index: hme.c
===================================================================
RCS file: /cvs/src/sys/arch/sparc/dev/hme.c,v
retrieving revision 1.59
diff -u -p -r1.59 hme.c
--- hme.c       20 Jun 2009 09:40:29 -0000      1.59
+++ hme.c       20 Jun 2009 10:26:54 -0000
@@ -248,7 +248,6 @@ hmeattach(parent, self, aux)
        ifp->if_watchdog = hmewatchdog;
        ifp->if_flags =
                IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS | IFF_MULTICAST;
-       sc->sc_if_flags = ifp->if_flags;
        ifp->if_capabilities = IFCAP_VLAN_MTU;
        IFQ_SET_MAXLEN(&ifp->if_snd, HME_TX_RING_SIZE);
        IFQ_SET_READY(&ifp->if_snd);
@@ -394,55 +393,24 @@ hmeioctl(ifp, cmd, data)
 
        switch (cmd) {
        case SIOCSIFADDR:
-               switch (ifa->ifa_addr->sa_family) {
+               ifp->if_flags |= IFF_UP;
+               if (!(ifp->if_flags & IFF_RUNNING))
+                       hmeinit(sc);
 #ifdef INET
-               case AF_INET:
-                       if (ifp->if_flags & IFF_UP)
-                               hme_mcreset(sc);
-                       else {
-                               ifp->if_flags |= IFF_UP;
-                               hmeinit(sc);
-                       }
+               if (ifa->ifa_addr->sa_family == AF_INET)
                        arp_ifinit(&sc->sc_arpcom, ifa);
-                       break;
-#endif /* INET */
-               default:
-                       ifp->if_flags |= IFF_UP;
-                       hmeinit(sc);
-                       break;
-               }
+#endif
                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.
-                        */
-                       hmestop(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.
-                        */
-                       hmeinit(sc);
-               } else {
-                       /*
-                        * If setting debug or promiscuous mode, do not reset
-                        * the chip; for everything else, call hmeinit()
-                        * which will trigger a reset.
-                        */
-#define RESETIGN (IFF_CANTCHANGE | IFF_DEBUG)
-                       if (ifp->if_flags == sc->sc_if_flags)
-                               break;
-                       if ((ifp->if_flags & (~RESETIGN))
-                           == (sc->sc_if_flags & (~RESETIGN)))
-                               hme_mcreset(sc);
+               if (ifp->if_flags & IFF_UP) {
+                       if (ifp->if_flags & IFF_RUNNING)
+                               error = ENETRESET;
                        else
                                hmeinit(sc);
-#undef RESETIGN
+               } else {
+                       if (ifp->if_flags & IFF_RUNNING)
+                               hmestop(sc);
                }
                break;
 
@@ -461,7 +429,6 @@ hmeioctl(ifp, cmd, data)
                error = 0;
        }
 
-       sc->sc_if_flags = ifp->if_flags;
        splx(s);
        return (error);
 }
@@ -605,7 +572,6 @@ hmeinit(sc)
 
        ifp->if_flags |= IFF_RUNNING;
        ifp->if_flags &= ~IFF_OACTIVE;
-       sc->sc_if_flags = ifp->if_flags;
 }
 
 void
@@ -1230,5 +1196,4 @@ hme_mii_statchg(self)
                cr->tx_cfg &= ~CR_TXCFG_FULLDPLX;
                sc->sc_arpcom.ac_if.if_flags &= ~IFF_SIMPLEX;
        }
-       sc->sc_if_flags = sc->sc_arpcom.ac_if.if_flags;
 }
Index: hmevar.h
===================================================================
RCS file: /cvs/src/sys/arch/sparc/dev/hmevar.h,v
retrieving revision 1.12
diff -u -p -r1.12 hmevar.h
--- hmevar.h    2 Jun 2006 20:00:54 -0000       1.12
+++ hmevar.h    20 Jun 2009 10:13:54 -0000
@@ -49,8 +49,6 @@ struct hme_softc {
 
        u_int32_t       sc_flags;       /* status flags */
 
-       short           sc_if_flags;
-
        /*
         * RX/TX ring buffers, descriptors, and counters
         */

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Reply via email to