| 1 | --- if_dc.c.orig 2008-08-05 09:35:03.410151380 +0800
|
| 2 | +++ if_dc.c 2008-08-05 09:37:56.030761686 +0800
|
| 3 | @@ -1261,6 +1261,9 @@ dc_setfilt_xircom(struct dc_softc *sc)
|
| 4 | int i;
|
| 5 |
|
| 6 | ifp = &sc->arpcom.ac_if;
|
| 7 | + KASSERT(ifp->if_flags & IFF_RUNNING,
|
| 8 | + ("%s is not running yet\n", ifp->if_xname));
|
| 9 | +
|
| 10 | DC_CLRBIT(sc, DC_NETCFG, (DC_NETCFG_TX_ON|DC_NETCFG_RX_ON));
|
| 11 |
|
| 12 | i = sc->dc_cdata.dc_tx_prod;
|
| 13 | @@ -1307,7 +1310,6 @@ dc_setfilt_xircom(struct dc_softc *sc)
|
| 14 |
|
| 15 | DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_TX_ON);
|
| 16 | DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_RX_ON);
|
| 17 | - ifp->if_flags |= IFF_RUNNING;
|
| 18 | sframe->dc_status = DC_TXSTAT_OWN;
|
| 19 | CSR_WRITE_4(sc, DC_TXSTART, 0xFFFFFFFF);
|
| 20 |
|
| 21 | @@ -2912,7 +2914,7 @@ dc_intr(void *arg)
|
| 22 | return ;
|
| 23 |
|
| 24 | /* Suppress unwanted interrupts */
|
| 25 | - if (!(ifp->if_flags & IFF_UP)) {
|
| 26 | + if ((ifp->if_flags & IFF_RUNNING) == 0) {
|
| 27 | if (CSR_READ_4(sc, DC_ISR) & DC_INTRS)
|
| 28 | dc_stop(sc);
|
| 29 | return;
|
| 30 | @@ -3288,6 +3290,13 @@ dc_init(void *xsc)
|
| 31 | }
|
| 32 |
|
| 33 | /*
|
| 34 | + * Set IFF_RUNNING here to keep the assertion in dc_setfilt()
|
| 35 | + * working.
|
| 36 | + */
|
| 37 | + ifp->if_flags |= IFF_RUNNING;
|
| 38 | + ifp->if_flags &= ~IFF_OACTIVE;
|
| 39 | +
|
| 40 | + /*
|
| 41 | * Load the RX/multicast filter. We do this sort of late
|
| 42 | * because the filter programming scheme on the 21143 and
|
| 43 | * some clones requires DMAing a setup frame via the TX
|
| 44 | @@ -3302,9 +3311,6 @@ dc_init(void *xsc)
|
| 45 | mii_mediachg(mii);
|
| 46 | dc_setcfg(sc, sc->dc_if_media);
|
| 47 |
|
| 48 | - ifp->if_flags |= IFF_RUNNING;
|
| 49 | - ifp->if_flags &= ~IFF_OACTIVE;
|
| 50 | -
|
| 51 | /* Don't start the ticker if this is a homePNA link. */
|
| 52 | if (IFM_SUBTYPE(mii->mii_media.ifm_media) == IFM_HPNA_1)
|
| 53 | sc->dc_link = 1;
|
| 54 | @@ -3314,8 +3320,6 @@ dc_init(void *xsc)
|
| 55 | else
|
| 56 | callout_reset(&sc->dc_stat_timer, hz, dc_tick, sc);
|
| 57 | }
|
| 58 | -
|
| 59 | - return;
|
| 60 | }
|
| 61 |
|
| 62 | /*
|
| 63 | @@ -3394,12 +3398,11 @@ dc_ioctl(struct ifnet *ifp, u_long comma
|
| 64 | dc_stop(sc);
|
| 65 | }
|
| 66 | sc->dc_if_flags = ifp->if_flags;
|
| 67 | - error = 0;
|
| 68 | break;
|
| 69 | case SIOCADDMULTI:
|
| 70 | case SIOCDELMULTI:
|
| 71 | - dc_setfilt(sc);
|
| 72 | - error = 0;
|
| 73 | + if (ifp->if_flags & IFF_RUNNING)
|
| 74 | + dc_setfilt(sc);
|
| 75 | break;
|
| 76 | case SIOCGIFMEDIA:
|
| 77 | case SIOCSIFMEDIA:
|