Date: Mon, 7 Sep 2020 15:35:40 +0000 (UTC) From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r365419 - in head/sys/dev: ath bwi iwm iwn mwl otus usb/wlan wtap Message-ID: <202009071535.087FZeXD070791@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bz Date: Mon Sep 7 15:35:40 2020 New Revision: 365419 URL: https://svnweb.freebsd.org/changeset/base/365419 Log: WiFi: fix ieee80211_media_change() callers In r178354 with the introduction of multi-bss ("vap") support factoring out started and with r193340 ieee80211_media_change() no longer returned ENETRESET but only 0 or error. As ieee80211(9) tells the ieee80211_media_change() function should not be called directly but is registered with ieee80211_vap_attach() instead. Some drivers have not been fully converted. After fixing the return checking some of these functions were simply wrappers between ieee80211_vap_attach() and ieee80211_media_change(), so remove the extra function, where possible as well. PR: 248955 Submitted by: Tong Zhang (ztong0001 gmail.com) (original) MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/ath/if_ath.c head/sys/dev/bwi/if_bwi.c head/sys/dev/iwm/if_iwm.c head/sys/dev/iwn/if_iwn.c head/sys/dev/mwl/if_mwl.c head/sys/dev/otus/if_otus.c head/sys/dev/usb/wlan/if_run.c head/sys/dev/wtap/if_wtap.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Mon Sep 7 14:40:33 2020 (r365418) +++ head/sys/dev/ath/if_ath.c Mon Sep 7 15:35:40 2020 (r365419) @@ -160,7 +160,6 @@ static int ath_init(struct ath_softc *); static void ath_stop(struct ath_softc *); static int ath_reset_vap(struct ieee80211vap *, u_long); static int ath_transmit(struct ieee80211com *, struct mbuf *); -static int ath_media_change(struct ifnet *); static void ath_watchdog(void *); static void ath_parent(struct ieee80211com *); static void ath_fatal_proc(void *, int); @@ -1766,8 +1765,8 @@ ath_vap_create(struct ieee80211com *ic, const char nam ATH_UNLOCK(sc); /* complete setup */ - ieee80211_vap_attach(vap, ath_media_change, ieee80211_media_status, - mac); + ieee80211_vap_attach(vap, ieee80211_media_change, + ieee80211_media_status, mac); return vap; bad2: reclaim_address(sc, mac); @@ -3541,14 +3540,6 @@ finish: ATH_KTR(sc, ATH_KTR_TX, 0, "ath_transmit: finished"); return (retval); -} - -static int -ath_media_change(struct ifnet *ifp) -{ - int error = ieee80211_media_change(ifp); - /* NB: only the fixed rate can change and that doesn't need a reset */ - return (error == ENETRESET ? 0 : error); } /* Modified: head/sys/dev/bwi/if_bwi.c ============================================================================== --- head/sys/dev/bwi/if_bwi.c Mon Sep 7 14:40:33 2020 (r365418) +++ head/sys/dev/bwi/if_bwi.c Mon Sep 7 15:35:40 2020 (r365419) @@ -118,7 +118,6 @@ static void bwi_set_channel(struct ieee80211com *); static void bwi_scan_end(struct ieee80211com *); static int bwi_newstate(struct ieee80211vap *, enum ieee80211_state, int); static void bwi_updateslot(struct ieee80211com *); -static int bwi_media_change(struct ifnet *); static void bwi_calibrate(void *); @@ -607,8 +606,8 @@ bwi_vap_create(struct ieee80211com *ic, const char nam ieee80211_ratectl_init(vap); /* complete setup */ - ieee80211_vap_attach(vap, bwi_media_change, ieee80211_media_status, - mac); + ieee80211_vap_attach(vap, ieee80211_media_change, + ieee80211_media_status, mac); ic->ic_opmode = opmode; return vap; } @@ -1807,14 +1806,6 @@ back: BWI_UNLOCK(sc); return error; -} - -static int -bwi_media_change(struct ifnet *ifp) -{ - int error = ieee80211_media_change(ifp); - /* NB: only the fixed rate can change and that doesn't need a reset */ - return (error == ENETRESET ? 0 : error); } static int Modified: head/sys/dev/iwm/if_iwm.c ============================================================================== --- head/sys/dev/iwm/if_iwm.c Mon Sep 7 14:40:33 2020 (r365418) +++ head/sys/dev/iwm/if_iwm.c Mon Sep 7 15:35:40 2020 (r365419) @@ -4426,8 +4426,8 @@ iwm_media_change(struct ifnet *ifp) int error; error = ieee80211_media_change(ifp); - if (error != ENETRESET) - return error; + if (error != 0) + return (error); IWM_LOCK(sc); if (ic->ic_nrunning > 0) { @@ -4435,7 +4435,7 @@ iwm_media_change(struct ifnet *ifp) iwm_init(sc); } IWM_UNLOCK(sc); - return error; + return (0); } static void Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Mon Sep 7 14:40:33 2020 (r365418) +++ head/sys/dev/iwn/if_iwn.c Mon Sep 7 15:35:40 2020 (r365419) @@ -194,7 +194,6 @@ static void iwn_read_eeprom_enhinfo(struct iwn_softc * static struct ieee80211_node *iwn_node_alloc(struct ieee80211vap *, const uint8_t mac[IEEE80211_ADDR_LEN]); static void iwn_newassoc(struct ieee80211_node *, int); -static int iwn_media_change(struct ifnet *); static int iwn_newstate(struct ieee80211vap *, enum ieee80211_state, int); static void iwn_calib_timeout(void *); static void iwn_rx_phy(struct iwn_softc *, struct iwn_rx_desc *); @@ -1356,8 +1355,8 @@ iwn_vap_create(struct ieee80211com *ic, const char nam ieee80211_ratectl_init(vap); /* Complete setup. */ - ieee80211_vap_attach(vap, iwn_media_change, ieee80211_media_status, - mac); + ieee80211_vap_attach(vap, ieee80211_media_change, + ieee80211_media_status, mac); ic->ic_opmode = opmode; return vap; } @@ -2881,16 +2880,6 @@ static void iwn_newassoc(struct ieee80211_node *ni, int isnew) { /* Doesn't do anything at the moment */ -} - -static int -iwn_media_change(struct ifnet *ifp) -{ - int error; - - error = ieee80211_media_change(ifp); - /* NB: only the fixed rate can change and that doesn't need a reset */ - return (error == ENETRESET ? 0 : error); } static int Modified: head/sys/dev/mwl/if_mwl.c ============================================================================== --- head/sys/dev/mwl/if_mwl.c Mon Sep 7 14:40:33 2020 (r365418) +++ head/sys/dev/mwl/if_mwl.c Mon Sep 7 15:35:40 2020 (r365419) @@ -1471,16 +1471,17 @@ mwl_raw_xmit(struct ieee80211_node *ni, struct mbuf *m static int mwl_media_change(struct ifnet *ifp) { - struct ieee80211vap *vap = ifp->if_softc; + struct ieee80211vap *vap; int error; - error = ieee80211_media_change(ifp); /* NB: only the fixed rate can change and that doesn't need a reset */ - if (error == ENETRESET) { - mwl_setrates(vap); - error = 0; - } - return error; + error = ieee80211_media_change(ifp); + if (error != 0) + return (error); + + vap = ifp->if_softc; + mwl_setrates(vap); + return (0); } #ifdef MWL_DEBUG Modified: head/sys/dev/otus/if_otus.c ============================================================================== --- head/sys/dev/otus/if_otus.c Mon Sep 7 14:40:33 2020 (r365418) +++ head/sys/dev/otus/if_otus.c Mon Sep 7 15:35:40 2020 (r365419) @@ -166,7 +166,6 @@ void otus_write(struct otus_softc *, uint32_t, uint32 int otus_write_barrier(struct otus_softc *); static struct ieee80211_node *otus_node_alloc(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN]); -int otus_media_change(struct ifnet *); int otus_read_eeprom(struct otus_softc *); void otus_newassoc(struct ieee80211_node *, int); void otus_cmd_rxeof(struct otus_softc *, uint8_t *, int); @@ -1337,35 +1336,6 @@ otus_node_alloc(struct ieee80211vap *vap, const uint8_ return malloc(sizeof (struct otus_node), M_80211_NODE, M_NOWAIT | M_ZERO); } - -#if 0 -int -otus_media_change(struct ifnet *ifp) -{ - struct otus_softc *sc = ifp->if_softc; - struct ieee80211com *ic = &sc->sc_ic; - uint8_t rate, ridx; - int error; - - error = ieee80211_media_change(ifp); - if (error != ENETRESET) - return error; - - if (ic->ic_fixed_rate != -1) { - rate = ic->ic_sup_rates[ic->ic_curmode]. - rs_rates[ic->ic_fixed_rate] & IEEE80211_RATE_VAL; - for (ridx = 0; ridx <= OTUS_RIDX_MAX; ridx++) - if (otus_rates[ridx].rate == rate) - break; - sc->fixed_ridx = ridx; - } - - if ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) == (IFF_UP | IFF_RUNNING)) - error = otus_init(sc); - - return error; -} -#endif int otus_read_eeprom(struct otus_softc *sc) Modified: head/sys/dev/usb/wlan/if_run.c ============================================================================== --- head/sys/dev/usb/wlan/if_run.c Mon Sep 7 14:40:33 2020 (r365418) +++ head/sys/dev/usb/wlan/if_run.c Mon Sep 7 15:35:40 2020 (r365419) @@ -2126,7 +2126,7 @@ run_media_change(struct ifnet *ifp) RUN_LOCK(sc); error = ieee80211_media_change(ifp); - if (error != ENETRESET) { + if (error != 0) { RUN_UNLOCK(sc); return (error); } Modified: head/sys/dev/wtap/if_wtap.c ============================================================================== --- head/sys/dev/wtap/if_wtap.c Mon Sep 7 14:40:33 2020 (r365418) +++ head/sys/dev/wtap/if_wtap.c Mon Sep 7 15:35:40 2020 (r365419) @@ -150,16 +150,6 @@ wtap_medium_enqueue(struct wtap_vap *avp, struct mbuf return medium_transmit(avp->av_md, avp->id, m); } -static int -wtap_media_change(struct ifnet *ifp) -{ - - DWTAP_PRINTF("%s\n", __func__); - int error = ieee80211_media_change(ifp); - /* NB: only the fixed rate can change and that doesn't need a reset */ - return (error == ENETRESET ? 0 : error); -} - /* * Intercept management frames to collect beacon rssi data * and to do ibss merges. @@ -352,8 +342,8 @@ wtap_vap_create(struct ieee80211com *ic, const char na vap->iv_bmiss = wtap_bmiss; /* complete setup */ - ieee80211_vap_attach(vap, wtap_media_change, ieee80211_media_status, - mac); + ieee80211_vap_attach(vap, ieee80211_media_change, + ieee80211_media_status, mac); avp->av_dev = make_dev(&wtap_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "%s", (const char *)sc->name);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202009071535.087FZeXD070791>