Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/rge/if_rge.c
| Show First 20 Lines • Show All 952 Lines • ▼ Show 20 Lines | case SIOCSIFMTU: | ||||
| if (if_getmtu(ifp) != ifr->ifr_mtu) | if (if_getmtu(ifp) != ifr->ifr_mtu) | ||||
| if_setmtu(ifp, ifr->ifr_mtu); | if_setmtu(ifp, ifr->ifr_mtu); | ||||
| VLAN_CAPABILITIES(ifp); | VLAN_CAPABILITIES(ifp); | ||||
| break; | break; | ||||
| case SIOCSIFFLAGS: | case SIOCSIFFLAGS: | ||||
| RGE_LOCK(sc); | RGE_LOCK(sc); | ||||
| if ((if_getflags(ifp) & IFF_UP) != 0) { | if ((if_getflags(ifp) & IFF_UP) != 0) { | ||||
zlei: I'd recommend to stash `if_getflags(ifp)`. Currently the net stack does not have proper sync of… | |||||
| if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0) { | if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) != 0) { | ||||
| /* | if (((if_getflags(ifp) ^ sc->rge_if_flags) | ||||
| * TODO: handle promisc/iffmulti changing | & (IFF_PROMISC | IFF_ALLMULTI)) != 0) | ||||
| * without reprogramming everything. | rge_iff_locked(sc); | ||||
| */ | } else | ||||
| rge_init_locked(sc); | rge_init_locked(sc); | ||||
| } else { | } else { | ||||
| /* Reinit promisc/multi just in case */ | if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) != 0) | ||||
| rge_iff_locked(sc); | |||||
| } | |||||
| } else { | |||||
| if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) != 0) { | |||||
| rge_stop_locked(sc); | rge_stop_locked(sc); | ||||
| } | } | ||||
| } | sc->rge_if_flags = if_getflags(ifp); | ||||
| RGE_UNLOCK(sc); | RGE_UNLOCK(sc); | ||||
| break; | break; | ||||
| case SIOCADDMULTI: | case SIOCADDMULTI: | ||||
| case SIOCDELMULTI: | case SIOCDELMULTI: | ||||
| RGE_LOCK(sc); | RGE_LOCK(sc); | ||||
| if ((if_getflags(ifp) & IFF_DRV_RUNNING) != 0) { | if ((if_getflags(ifp) & IFF_DRV_RUNNING) != 0) | ||||
| rge_iff_locked(sc); | rge_iff_locked(sc); | ||||
| } | |||||
| RGE_UNLOCK(sc); | RGE_UNLOCK(sc); | ||||
| break; | break; | ||||
| case SIOCGIFMEDIA: | case SIOCGIFMEDIA: | ||||
| case SIOCSIFMEDIA: | case SIOCSIFMEDIA: | ||||
| error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd); | error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd); | ||||
| break; | break; | ||||
| case SIOCSIFCAP: | case SIOCSIFCAP: | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 1,712 Lines • Show Last 20 Lines | |||||
I'd recommend to stash if_getflags(ifp). Currently the net stack does not have proper sync of the ifnet flags. If other threads are modifying it concurrently, then the driver may be in inconsistent state.