When media is changed with ifconfig, the media change request passes
through the following kernel function call chain:
1 iwm_ioctl()
2 iee80211_ioctl()
3 ifmedia_ioctl()
4 iwm_media_change() via ifm->ifm_change pointer
5 ieee80211_media_change()
If ieee80211_media_change() returns ENETRESET, iwm resets the interface
directly in iwm_media_change(). But iwm_ioctl() handles ENETRESET in the
same way, so we can just pass the error up there and avoid redundant code.
ok?
Index: if_iwm.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_iwm.c,v
retrieving revision 1.210
diff -u -p -r1.210 if_iwm.c
--- if_iwm.c 13 Aug 2017 15:34:54 -0000 1.210
+++ if_iwm.c 13 Aug 2017 17:18:30 -0000
@@ -5908,11 +5908,6 @@ iwm_media_change(struct ifnet *ifp)
sc->sc_fixed_ridx = ridx;
}
- if ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) ==
- (IFF_UP | IFF_RUNNING)) {
- iwm_stop(ifp, 0);
- err = iwm_init(ifp);
- }
return err;
}