Make net80211 drivers supply their device name to the net80211 layer, so

that the latter doesn't need to go through struct ifnet to get their name.

Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
This commit is contained in:
Gleb Smirnoff 2015-05-25 13:51:13 +00:00
parent ef6fa9e26d
commit c8550c0278
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=283527
27 changed files with 28 additions and 0 deletions

View File

@ -592,6 +592,7 @@ ath_attach(u_int16_t devid, struct ath_softc *sc)
goto bad;
}
ic = ifp->if_l2com;
ic->ic_name = device_get_nameunit(sc->sc_dev);
/* set these up early for if_printf use */
if_initname(ifp, device_get_name(sc->sc_dev),

View File

@ -507,6 +507,7 @@ bwi_attach(struct bwi_softc *sc)
ieee80211_init_channels(ic, NULL, &bands);
ic->ic_ifp = ifp;
ic->ic_name = device_get_nameunit(dev);
ic->ic_caps = IEEE80211_C_STA |
IEEE80211_C_SHSLOT |
IEEE80211_C_SHPREAMBLE |

View File

@ -1058,6 +1058,7 @@ bwn_attach_post(struct bwn_softc *sc)
ic = ifp->if_l2com;
ic->ic_ifp = ifp;
ic->ic_name = device_get_nameunit(sc->sc_dev);
/* XXX not right but it's not used anywhere important */
ic->ic_phytype = IEEE80211_T_OFDM;
ic->ic_opmode = IEEE80211_M_STA;

View File

@ -738,6 +738,7 @@ ndis_attach(dev)
ifp->if_ioctl = ndis_ioctl_80211;
ic->ic_ifp = ifp;
ic->ic_name = device_get_nameunit(dev);
ic->ic_opmode = IEEE80211_M_STA;
ic->ic_phytype = IEEE80211_T_DS;
ic->ic_caps = IEEE80211_C_8023ENCAP |

View File

@ -286,6 +286,7 @@ ipw_attach(device_t dev)
IFQ_SET_READY(&ifp->if_snd);
ic->ic_ifp = ifp;
ic->ic_name = device_get_nameunit(dev);
ic->ic_opmode = IEEE80211_M_STA;
ic->ic_phytype = IEEE80211_T_DS;

View File

@ -364,6 +364,7 @@ iwi_attach(device_t dev)
IFQ_SET_READY(&ifp->if_snd);
ic->ic_ifp = ifp;
ic->ic_name = device_get_nameunit(dev);
ic->ic_opmode = IEEE80211_M_STA;
ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */

View File

@ -556,6 +556,7 @@ iwn_attach(device_t dev)
ic = ifp->if_l2com;
ic->ic_ifp = ifp;
ic->ic_name = device_get_nameunit(dev);
ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */
ic->ic_opmode = IEEE80211_M_STA; /* default to BSS mode */

View File

@ -276,6 +276,7 @@ malo_attach(uint16_t devid, struct malo_softc *sc)
IFQ_SET_READY(&ifp->if_snd);
ic->ic_ifp = ifp;
ic->ic_name = device_get_nameunit(sc->malo_dev);
/* XXX not right but it's not used anywhere important */
ic->ic_phytype = IEEE80211_T_OFDM;
ic->ic_opmode = IEEE80211_M_STA;

View File

@ -413,6 +413,7 @@ mwl_attach(uint16_t devid, struct mwl_softc *sc)
IFQ_SET_READY(&ifp->if_snd);
ic->ic_ifp = ifp;
ic->ic_name = device_get_nameunit(sc->sc_dev);
/* XXX not right but it's not used anywhere important */
ic->ic_phytype = IEEE80211_T_OFDM;
ic->ic_opmode = IEEE80211_M_STA;

View File

@ -273,6 +273,7 @@ rt2560_attach(device_t dev, int id)
IFQ_SET_READY(&ifp->if_snd);
ic->ic_ifp = ifp;
ic->ic_name = device_get_nameunit(dev);
ic->ic_opmode = IEEE80211_M_STA;
ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */

View File

@ -274,6 +274,7 @@ rt2661_attach(device_t dev, int id)
IFQ_SET_READY(&ifp->if_snd);
ic->ic_ifp = ifp;
ic->ic_name = device_get_nameunit(dev);
ic->ic_opmode = IEEE80211_M_STA;
ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */

View File

@ -315,6 +315,7 @@ rt2860_attach(device_t dev, int id)
IFQ_SET_READY(&ifp->if_snd);
ic->ic_ifp = ifp;
ic->ic_name = device_get_nameunit(dev);
ic->ic_opmode = IEEE80211_M_STA;
ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */

View File

@ -355,6 +355,7 @@ rsu_attach(device_t self)
ifp->if_hwassist = CSUM_TCP;
ic->ic_ifp = ifp;
ic->ic_name = device_get_nameunit(self);
ic->ic_phytype = IEEE80211_T_OFDM; /* Not only, but not used. */
ic->ic_opmode = IEEE80211_M_STA; /* Default to BSS mode. */

View File

@ -488,6 +488,7 @@ rum_attach(device_t self)
IFQ_SET_READY(&ifp->if_snd);
ic->ic_ifp = ifp;
ic->ic_name = device_get_nameunit(self);
ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */
/* set device capabilities */

View File

@ -776,6 +776,7 @@ run_attach(device_t self)
IFQ_SET_READY(&ifp->if_snd);
ic->ic_ifp = ifp;
ic->ic_name = device_get_nameunit(self);
ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */
ic->ic_opmode = IEEE80211_M_STA; /* default to BSS mode */

View File

@ -442,6 +442,7 @@ uath_attach(device_t dev)
ic = ifp->if_l2com;
ic->ic_ifp = ifp;
ic->ic_name = device_get_nameunit(dev);
ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */
ic->ic_opmode = IEEE80211_M_STA; /* default to BSS mode */

View File

@ -341,6 +341,7 @@ upgt_attach(device_t dev)
ic = ifp->if_l2com;
ic->ic_ifp = ifp;
ic->ic_name = device_get_nameunit(dev);
ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */
ic->ic_opmode = IEEE80211_M_STA;
/* set device capabilities */

View File

@ -473,6 +473,7 @@ ural_attach(device_t self)
IFQ_SET_READY(&ifp->if_snd);
ic->ic_ifp = ifp;
ic->ic_name = device_get_nameunit(self);
ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */
/* set device capabilities */

View File

@ -881,6 +881,7 @@ urtw_attach(device_t dev)
ic = ifp->if_l2com;
ic->ic_ifp = ifp;
ic->ic_name = device_get_nameunit(dev);
ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */
ic->ic_opmode = IEEE80211_M_STA; /* default to BSS mode */

View File

@ -442,6 +442,7 @@ urtwn_attach(device_t self)
IFQ_SET_READY(&ifp->if_snd);
ic->ic_ifp = ifp;
ic->ic_name = device_get_nameunit(self);
ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */
ic->ic_opmode = IEEE80211_M_STA; /* default to BSS mode */

View File

@ -388,6 +388,7 @@ zyd_attach(device_t dev)
ic = ifp->if_l2com;
ic->ic_ifp = ifp;
ic->ic_name = device_get_nameunit(dev);
ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */
ic->ic_opmode = IEEE80211_M_STA;

View File

@ -344,6 +344,7 @@ wi_attach(device_t dev)
IFQ_SET_READY(&ifp->if_snd);
ic->ic_ifp = ifp;
ic->ic_name = device_get_nameunit(dev);
ic->ic_phytype = IEEE80211_T_DS;
ic->ic_opmode = IEEE80211_M_STA;
ic->ic_caps = IEEE80211_C_STA

View File

@ -452,6 +452,7 @@ wpi_attach(device_t dev)
ic = ifp->if_l2com;
ic->ic_ifp = ifp;
ic->ic_name = device_get_nameunit(dev);
ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */
ic->ic_opmode = IEEE80211_M_STA; /* default to BSS mode */

View File

@ -797,6 +797,7 @@ wtap_attach(struct wtap_softc *sc, const uint8_t *macaddr)
IFQ_SET_READY(&ifp->if_snd);
ic->ic_ifp = ifp;
ic->ic_name = sc->name;
ic->ic_phytype = IEEE80211_T_DS;
ic->ic_opmode = IEEE80211_M_MBSS;
ic->ic_caps = IEEE80211_C_MBSS;

View File

@ -130,6 +130,7 @@ struct wtap_vap {
struct taskqueue;
struct wtap_softc {
char name[7]; /* wtapXX\0 */
int32_t id;
int32_t up;
struct ifnet *sc_ifp; /* interface common */

View File

@ -182,6 +182,8 @@ new_wtap(struct wtap_hal *hal, int32_t id)
bzero(hal->hal_devs[id], sizeof(struct wtap_softc));
hal->hal_devs[id]->sc_md = hal->hal_md;
hal->hal_devs[id]->id = id;
snprintf(hal->hal_devs[id]->name, sizeof(hal->hal_devs[id]->name),
"wlan%d", id);
mtx_init(&hal->hal_devs[id]->sc_mtx, "wtap_softc mtx", NULL,
MTX_DEF | MTX_RECURSE);

View File

@ -117,6 +117,7 @@ struct ieee80211_frame;
struct ieee80211com {
struct ifnet *ic_ifp; /* associated device */
const char *ic_name; /* usually device name */
ieee80211_com_lock_t ic_comlock; /* state update lock */
ieee80211_tx_lock_t ic_txlock; /* ic/vap TX lock */
TAILQ_HEAD(, ieee80211vap) ic_vaps; /* list of vap instances */