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
This commit is contained in:
parent
3171b6c1e1
commit
064da6773d
@ -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 name[IFNAMSIZ], int unit,
|
||||
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);
|
||||
@ -3543,14 +3542,6 @@ ath_transmit(struct ieee80211com *ic, struct mbuf *m)
|
||||
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);
|
||||
}
|
||||
|
||||
/*
|
||||
* Block/unblock tx+rx processing while a key change is done.
|
||||
* We assume the caller serializes key management operations
|
||||
|
@ -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 name[IFNAMSIZ], int unit,
|
||||
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;
|
||||
}
|
||||
@ -1809,14 +1808,6 @@ bwi_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
|
||||
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
|
||||
bwi_dma_alloc(struct bwi_softc *sc)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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 name[IFNAMSIZ], int unit,
|
||||
|
||||
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;
|
||||
}
|
||||
@ -2883,16 +2882,6 @@ 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
|
||||
iwn_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -166,7 +166,6 @@ void otus_write(struct otus_softc *, uint32_t, uint32_t);
|
||||
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);
|
||||
@ -1338,35 +1337,6 @@ otus_node_alloc(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN])
|
||||
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)
|
||||
{
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -150,16 +150,6 @@ wtap_medium_enqueue(struct wtap_vap *avp, struct mbuf *m)
|
||||
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 name[IFNAMSIZ],
|
||||
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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user