svn commit: r283527 - in head/sys: dev/ath dev/bwi dev/bwn dev/if_ndis dev/ipw dev/iwi dev/iwn dev/malo dev/mwl dev/ral dev/usb/wlan dev/wi dev/wpi dev/wtap dev/wtap/wtap_hal net80211

Gleb Smirnoff glebius at FreeBSD.org
Mon May 25 13:51:22 UTC 2015


Author: glebius
Date: Mon May 25 13:51:13 2015
New Revision: 283527
URL: https://svnweb.freebsd.org/changeset/base/283527

Log:
  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.

Modified:
  head/sys/dev/ath/if_ath.c
  head/sys/dev/bwi/if_bwi.c
  head/sys/dev/bwn/if_bwn.c
  head/sys/dev/if_ndis/if_ndis.c
  head/sys/dev/ipw/if_ipw.c
  head/sys/dev/iwi/if_iwi.c
  head/sys/dev/iwn/if_iwn.c
  head/sys/dev/malo/if_malo.c
  head/sys/dev/mwl/if_mwl.c
  head/sys/dev/ral/rt2560.c
  head/sys/dev/ral/rt2661.c
  head/sys/dev/ral/rt2860.c
  head/sys/dev/usb/wlan/if_rsu.c
  head/sys/dev/usb/wlan/if_rum.c
  head/sys/dev/usb/wlan/if_run.c
  head/sys/dev/usb/wlan/if_uath.c
  head/sys/dev/usb/wlan/if_upgt.c
  head/sys/dev/usb/wlan/if_ural.c
  head/sys/dev/usb/wlan/if_urtw.c
  head/sys/dev/usb/wlan/if_urtwn.c
  head/sys/dev/usb/wlan/if_zyd.c
  head/sys/dev/wi/if_wi.c
  head/sys/dev/wpi/if_wpi.c
  head/sys/dev/wtap/if_wtap.c
  head/sys/dev/wtap/if_wtapvar.h
  head/sys/dev/wtap/wtap_hal/hal.c
  head/sys/net80211/ieee80211_var.h

Modified: head/sys/dev/ath/if_ath.c
==============================================================================
--- head/sys/dev/ath/if_ath.c	Mon May 25 13:43:03 2015	(r283526)
+++ head/sys/dev/ath/if_ath.c	Mon May 25 13:51:13 2015	(r283527)
@@ -592,6 +592,7 @@ ath_attach(u_int16_t devid, struct ath_s
 		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),

Modified: head/sys/dev/bwi/if_bwi.c
==============================================================================
--- head/sys/dev/bwi/if_bwi.c	Mon May 25 13:43:03 2015	(r283526)
+++ head/sys/dev/bwi/if_bwi.c	Mon May 25 13:51:13 2015	(r283527)
@@ -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 |

Modified: head/sys/dev/bwn/if_bwn.c
==============================================================================
--- head/sys/dev/bwn/if_bwn.c	Mon May 25 13:43:03 2015	(r283526)
+++ head/sys/dev/bwn/if_bwn.c	Mon May 25 13:51:13 2015	(r283527)
@@ -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;

Modified: head/sys/dev/if_ndis/if_ndis.c
==============================================================================
--- head/sys/dev/if_ndis/if_ndis.c	Mon May 25 13:43:03 2015	(r283526)
+++ head/sys/dev/if_ndis/if_ndis.c	Mon May 25 13:51:13 2015	(r283527)
@@ -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 |

Modified: head/sys/dev/ipw/if_ipw.c
==============================================================================
--- head/sys/dev/ipw/if_ipw.c	Mon May 25 13:43:03 2015	(r283526)
+++ head/sys/dev/ipw/if_ipw.c	Mon May 25 13:51:13 2015	(r283527)
@@ -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;
 

Modified: head/sys/dev/iwi/if_iwi.c
==============================================================================
--- head/sys/dev/iwi/if_iwi.c	Mon May 25 13:43:03 2015	(r283526)
+++ head/sys/dev/iwi/if_iwi.c	Mon May 25 13:51:13 2015	(r283527)
@@ -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 */
 

Modified: head/sys/dev/iwn/if_iwn.c
==============================================================================
--- head/sys/dev/iwn/if_iwn.c	Mon May 25 13:43:03 2015	(r283526)
+++ head/sys/dev/iwn/if_iwn.c	Mon May 25 13:51:13 2015	(r283527)
@@ -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 */
 

Modified: head/sys/dev/malo/if_malo.c
==============================================================================
--- head/sys/dev/malo/if_malo.c	Mon May 25 13:43:03 2015	(r283526)
+++ head/sys/dev/malo/if_malo.c	Mon May 25 13:51:13 2015	(r283527)
@@ -276,6 +276,7 @@ malo_attach(uint16_t devid, struct malo_
 	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;

Modified: head/sys/dev/mwl/if_mwl.c
==============================================================================
--- head/sys/dev/mwl/if_mwl.c	Mon May 25 13:43:03 2015	(r283526)
+++ head/sys/dev/mwl/if_mwl.c	Mon May 25 13:51:13 2015	(r283527)
@@ -413,6 +413,7 @@ mwl_attach(uint16_t devid, struct mwl_so
 	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;

Modified: head/sys/dev/ral/rt2560.c
==============================================================================
--- head/sys/dev/ral/rt2560.c	Mon May 25 13:43:03 2015	(r283526)
+++ head/sys/dev/ral/rt2560.c	Mon May 25 13:51:13 2015	(r283527)
@@ -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 */
 

Modified: head/sys/dev/ral/rt2661.c
==============================================================================
--- head/sys/dev/ral/rt2661.c	Mon May 25 13:43:03 2015	(r283526)
+++ head/sys/dev/ral/rt2661.c	Mon May 25 13:51:13 2015	(r283527)
@@ -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 */
 

Modified: head/sys/dev/ral/rt2860.c
==============================================================================
--- head/sys/dev/ral/rt2860.c	Mon May 25 13:43:03 2015	(r283526)
+++ head/sys/dev/ral/rt2860.c	Mon May 25 13:51:13 2015	(r283527)
@@ -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 */
 

Modified: head/sys/dev/usb/wlan/if_rsu.c
==============================================================================
--- head/sys/dev/usb/wlan/if_rsu.c	Mon May 25 13:43:03 2015	(r283526)
+++ head/sys/dev/usb/wlan/if_rsu.c	Mon May 25 13:51:13 2015	(r283527)
@@ -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. */
 

Modified: head/sys/dev/usb/wlan/if_rum.c
==============================================================================
--- head/sys/dev/usb/wlan/if_rum.c	Mon May 25 13:43:03 2015	(r283526)
+++ head/sys/dev/usb/wlan/if_rum.c	Mon May 25 13:51:13 2015	(r283527)
@@ -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 */

Modified: head/sys/dev/usb/wlan/if_run.c
==============================================================================
--- head/sys/dev/usb/wlan/if_run.c	Mon May 25 13:43:03 2015	(r283526)
+++ head/sys/dev/usb/wlan/if_run.c	Mon May 25 13:51:13 2015	(r283527)
@@ -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 */
 

Modified: head/sys/dev/usb/wlan/if_uath.c
==============================================================================
--- head/sys/dev/usb/wlan/if_uath.c	Mon May 25 13:43:03 2015	(r283526)
+++ head/sys/dev/usb/wlan/if_uath.c	Mon May 25 13:51:13 2015	(r283527)
@@ -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 */
 

Modified: head/sys/dev/usb/wlan/if_upgt.c
==============================================================================
--- head/sys/dev/usb/wlan/if_upgt.c	Mon May 25 13:43:03 2015	(r283526)
+++ head/sys/dev/usb/wlan/if_upgt.c	Mon May 25 13:51:13 2015	(r283527)
@@ -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 */

Modified: head/sys/dev/usb/wlan/if_ural.c
==============================================================================
--- head/sys/dev/usb/wlan/if_ural.c	Mon May 25 13:43:03 2015	(r283526)
+++ head/sys/dev/usb/wlan/if_ural.c	Mon May 25 13:51:13 2015	(r283527)
@@ -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 */

Modified: head/sys/dev/usb/wlan/if_urtw.c
==============================================================================
--- head/sys/dev/usb/wlan/if_urtw.c	Mon May 25 13:43:03 2015	(r283526)
+++ head/sys/dev/usb/wlan/if_urtw.c	Mon May 25 13:51:13 2015	(r283527)
@@ -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 */
 

Modified: head/sys/dev/usb/wlan/if_urtwn.c
==============================================================================
--- head/sys/dev/usb/wlan/if_urtwn.c	Mon May 25 13:43:03 2015	(r283526)
+++ head/sys/dev/usb/wlan/if_urtwn.c	Mon May 25 13:51:13 2015	(r283527)
@@ -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 */
 

Modified: head/sys/dev/usb/wlan/if_zyd.c
==============================================================================
--- head/sys/dev/usb/wlan/if_zyd.c	Mon May 25 13:43:03 2015	(r283526)
+++ head/sys/dev/usb/wlan/if_zyd.c	Mon May 25 13:51:13 2015	(r283527)
@@ -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;
 

Modified: head/sys/dev/wi/if_wi.c
==============================================================================
--- head/sys/dev/wi/if_wi.c	Mon May 25 13:43:03 2015	(r283526)
+++ head/sys/dev/wi/if_wi.c	Mon May 25 13:51:13 2015	(r283527)
@@ -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

Modified: head/sys/dev/wpi/if_wpi.c
==============================================================================
--- head/sys/dev/wpi/if_wpi.c	Mon May 25 13:43:03 2015	(r283526)
+++ head/sys/dev/wpi/if_wpi.c	Mon May 25 13:51:13 2015	(r283527)
@@ -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 */
 

Modified: head/sys/dev/wtap/if_wtap.c
==============================================================================
--- head/sys/dev/wtap/if_wtap.c	Mon May 25 13:43:03 2015	(r283526)
+++ head/sys/dev/wtap/if_wtap.c	Mon May 25 13:51:13 2015	(r283527)
@@ -797,6 +797,7 @@ wtap_attach(struct wtap_softc *sc, const
 	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;

Modified: head/sys/dev/wtap/if_wtapvar.h
==============================================================================
--- head/sys/dev/wtap/if_wtapvar.h	Mon May 25 13:43:03 2015	(r283526)
+++ head/sys/dev/wtap/if_wtapvar.h	Mon May 25 13:51:13 2015	(r283527)
@@ -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 */

Modified: head/sys/dev/wtap/wtap_hal/hal.c
==============================================================================
--- head/sys/dev/wtap/wtap_hal/hal.c	Mon May 25 13:43:03 2015	(r283526)
+++ head/sys/dev/wtap/wtap_hal/hal.c	Mon May 25 13:51:13 2015	(r283527)
@@ -182,6 +182,8 @@ new_wtap(struct wtap_hal *hal, int32_t i
 	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);
 

Modified: head/sys/net80211/ieee80211_var.h
==============================================================================
--- head/sys/net80211/ieee80211_var.h	Mon May 25 13:43:03 2015	(r283526)
+++ head/sys/net80211/ieee80211_var.h	Mon May 25 13:51:13 2015	(r283527)
@@ -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 */


More information about the svn-src-all mailing list