Minor cleanup of vap create work:
o add IEEE80211_C_STA capability to indicate sta mode is supported (was previously assumed) and mark drivers as capable o add ieee80211_opcap array to map an opmode to the equivalent capability bit o move IEEE80211_C_OPMODE definition to where capabilities are defined so it's clear it should be kept in sync (on future additions) o check device capabilities in clone create before trying to create a vap; this makes driver checks unneeded o make error codes return on failed clone request unique o temporarily add console printfs on clone request failures to aid in debugging; these will move under DIAGNOSTIC or similar before release
This commit is contained in:
@@ -515,7 +515,8 @@ ath_attach(u_int16_t devid, struct ath_softc *sc)
|
||||
ic->ic_phytype = IEEE80211_T_OFDM;
|
||||
ic->ic_opmode = IEEE80211_M_STA;
|
||||
ic->ic_caps =
|
||||
IEEE80211_C_IBSS /* ibss, nee adhoc, mode */
|
||||
IEEE80211_C_STA /* station mode */
|
||||
| IEEE80211_C_IBSS /* ibss, nee adhoc, mode */
|
||||
| IEEE80211_C_HOSTAP /* hostap mode */
|
||||
| IEEE80211_C_MONITOR /* monitor mode */
|
||||
| IEEE80211_C_AHDEMO /* adhoc demo mode */
|
||||
|
||||
@@ -724,7 +724,7 @@ ndis_attach(dev)
|
||||
ic->ic_ifp = ifp;
|
||||
ic->ic_opmode = IEEE80211_M_STA;
|
||||
ic->ic_phytype = IEEE80211_T_DS;
|
||||
ic->ic_caps = IEEE80211_C_IBSS;
|
||||
ic->ic_caps = IEEE80211_C_STA | IEEE80211_C_IBSS;
|
||||
setbit(ic->ic_modecaps, IEEE80211_MODE_AUTO);
|
||||
len = 0;
|
||||
r = ndis_get_info(sc, OID_802_11_NETWORK_TYPES_SUPPORTED,
|
||||
|
||||
@@ -305,7 +305,9 @@ ipw_attach(device_t dev)
|
||||
ic->ic_phytype = IEEE80211_T_DS;
|
||||
|
||||
/* set device capabilities */
|
||||
ic->ic_caps = IEEE80211_C_IBSS /* IBSS mode supported */
|
||||
ic->ic_caps =
|
||||
IEEE80211_C_STA /* station mode supported */
|
||||
| IEEE80211_C_IBSS /* IBSS mode supported */
|
||||
| IEEE80211_C_MONITOR /* monitor mode supported */
|
||||
| IEEE80211_C_PMGT /* power save supported */
|
||||
| IEEE80211_C_SHPREAMBLE /* short preamble supported */
|
||||
|
||||
@@ -388,7 +388,8 @@ iwi_attach(device_t dev)
|
||||
|
||||
/* set device capabilities */
|
||||
ic->ic_caps =
|
||||
IEEE80211_C_IBSS /* IBSS mode supported */
|
||||
IEEE80211_C_STA /* station mode supported */
|
||||
| IEEE80211_C_IBSS /* IBSS mode supported */
|
||||
| IEEE80211_C_MONITOR /* monitor mode supported */
|
||||
| IEEE80211_C_PMGT /* power save supported */
|
||||
| IEEE80211_C_SHPREAMBLE /* short preamble supported */
|
||||
|
||||
@@ -377,7 +377,8 @@ iwn_attach(device_t dev)
|
||||
|
||||
/* set device capabilities */
|
||||
ic->ic_caps =
|
||||
IEEE80211_C_MONITOR /* monitor mode supported */
|
||||
IEEE80211_C_STA /* station mode supported */
|
||||
| IEEE80211_C_MONITOR /* monitor mode supported */
|
||||
| IEEE80211_C_TXPMGT /* tx power management */
|
||||
| IEEE80211_C_SHSLOT /* short slot time supported */
|
||||
| IEEE80211_C_WPA
|
||||
|
||||
@@ -301,7 +301,8 @@ malo_attach(uint16_t devid, struct malo_softc *sc)
|
||||
ic->ic_phytype = IEEE80211_T_OFDM;
|
||||
ic->ic_opmode = IEEE80211_M_STA;
|
||||
ic->ic_caps =
|
||||
IEEE80211_C_BGSCAN /* capable of bg scanning */
|
||||
IEEE80211_C_STA /* station mode supported */
|
||||
| IEEE80211_C_BGSCAN /* capable of bg scanning */
|
||||
| IEEE80211_C_MONITOR /* monitor mode */
|
||||
| IEEE80211_C_SHPREAMBLE /* short preamble supported */
|
||||
| IEEE80211_C_SHSLOT /* short slot time supported */
|
||||
|
||||
@@ -278,7 +278,8 @@ rt2560_attach(device_t dev, int id)
|
||||
|
||||
/* set device capabilities */
|
||||
ic->ic_caps =
|
||||
IEEE80211_C_IBSS /* ibss, nee adhoc, mode */
|
||||
IEEE80211_C_STA /* station mode */
|
||||
| IEEE80211_C_IBSS /* ibss, nee adhoc, mode */
|
||||
| IEEE80211_C_HOSTAP /* hostap mode */
|
||||
| IEEE80211_C_MONITOR /* monitor mode */
|
||||
| IEEE80211_C_AHDEMO /* adhoc demo mode */
|
||||
|
||||
@@ -280,7 +280,8 @@ rt2661_attach(device_t dev, int id)
|
||||
|
||||
/* set device capabilities */
|
||||
ic->ic_caps =
|
||||
IEEE80211_C_IBSS /* ibss, nee adhoc, mode */
|
||||
IEEE80211_C_STA /* station mode */
|
||||
| IEEE80211_C_IBSS /* ibss, nee adhoc, mode */
|
||||
| IEEE80211_C_HOSTAP /* hostap mode */
|
||||
| IEEE80211_C_MONITOR /* monitor mode */
|
||||
| IEEE80211_C_AHDEMO /* adhoc demo mode */
|
||||
|
||||
@@ -490,7 +490,8 @@ rum_attach(device_t self)
|
||||
|
||||
/* set device capabilities */
|
||||
ic->ic_caps =
|
||||
IEEE80211_C_IBSS /* IBSS mode supported */
|
||||
IEEE80211_C_STA /* station mode supported */
|
||||
| IEEE80211_C_IBSS /* IBSS mode supported */
|
||||
| IEEE80211_C_MONITOR /* monitor mode supported */
|
||||
| IEEE80211_C_HOSTAP /* HostAp mode supported */
|
||||
| IEEE80211_C_TXPMGT /* tx power management */
|
||||
|
||||
@@ -479,7 +479,8 @@ ural_attach(device_t self)
|
||||
|
||||
/* set device capabilities */
|
||||
ic->ic_caps =
|
||||
IEEE80211_C_IBSS /* IBSS mode supported */
|
||||
IEEE80211_C_STA /* station mode supported */
|
||||
| IEEE80211_C_IBSS /* IBSS mode supported */
|
||||
| IEEE80211_C_MONITOR /* monitor mode supported */
|
||||
| IEEE80211_C_HOSTAP /* HostAp mode supported */
|
||||
| IEEE80211_C_TXPMGT /* tx power management */
|
||||
|
||||
@@ -390,7 +390,8 @@ zyd_complete_attach(struct zyd_softc *sc)
|
||||
|
||||
/* set device capabilities */
|
||||
ic->ic_caps =
|
||||
IEEE80211_C_MONITOR /* monitor mode */
|
||||
IEEE80211_C_STA /* station mode */
|
||||
| IEEE80211_C_MONITOR /* monitor mode */
|
||||
| IEEE80211_C_SHPREAMBLE /* short preamble supported */
|
||||
| IEEE80211_C_SHSLOT /* short slot time supported */
|
||||
| IEEE80211_C_BGSCAN /* capable of bg scanning */
|
||||
|
||||
+2
-1
@@ -331,7 +331,8 @@ wi_attach(device_t dev)
|
||||
ic->ic_ifp = ifp;
|
||||
ic->ic_phytype = IEEE80211_T_DS;
|
||||
ic->ic_opmode = IEEE80211_M_STA;
|
||||
ic->ic_caps = IEEE80211_C_PMGT
|
||||
ic->ic_caps = IEEE80211_C_STA
|
||||
| IEEE80211_C_PMGT
|
||||
| IEEE80211_C_MONITOR
|
||||
;
|
||||
|
||||
|
||||
@@ -623,7 +623,8 @@ wpi_attach(device_t dev)
|
||||
|
||||
/* set device capabilities */
|
||||
ic->ic_caps =
|
||||
IEEE80211_C_MONITOR /* monitor mode supported */
|
||||
IEEE80211_C_STA /* station mode supported */
|
||||
| IEEE80211_C_MONITOR /* monitor mode supported */
|
||||
| IEEE80211_C_TXPMGT /* tx power management */
|
||||
| IEEE80211_C_SHSLOT /* short slot time supported */
|
||||
| IEEE80211_C_SHPREAMBLE /* short preamble supported */
|
||||
|
||||
+12
-18
@@ -61,6 +61,16 @@ const char *ieee80211_phymode_name[IEEE80211_MODE_MAX] = {
|
||||
[IEEE80211_MODE_11NA] = "11na",
|
||||
[IEEE80211_MODE_11NG] = "11ng",
|
||||
};
|
||||
/* map ieee80211_opmode to the corresponding capability bit */
|
||||
const int ieee80211_opcap[IEEE80211_OPMODE_MAX] = {
|
||||
[IEEE80211_M_IBSS] = IEEE80211_C_IBSS,
|
||||
[IEEE80211_M_WDS] = IEEE80211_C_WDS,
|
||||
[IEEE80211_M_STA] = IEEE80211_C_STA,
|
||||
[IEEE80211_M_AHDEMO] = IEEE80211_C_AHDEMO,
|
||||
[IEEE80211_M_HOSTAP] = IEEE80211_C_HOSTAP,
|
||||
[IEEE80211_M_MONITOR] = IEEE80211_C_MONITOR,
|
||||
};
|
||||
|
||||
static const uint8_t ieee80211broadcastaddr[IEEE80211_ADDR_LEN] =
|
||||
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
||||
|
||||
@@ -310,9 +320,6 @@ ieee80211_vap_setup(struct ieee80211com *ic, struct ieee80211vap *vap,
|
||||
const uint8_t bssid[IEEE80211_ADDR_LEN],
|
||||
const uint8_t macaddr[IEEE80211_ADDR_LEN])
|
||||
{
|
||||
#define IEEE80211_C_OPMODE \
|
||||
(IEEE80211_C_IBSS | IEEE80211_C_HOSTAP | IEEE80211_C_AHDEMO | \
|
||||
IEEE80211_C_MONITOR | IEEE80211_C_WDS)
|
||||
struct ifnet *ifp;
|
||||
|
||||
ifp = if_alloc(IFT_ETHER);
|
||||
@@ -341,26 +348,14 @@ ieee80211_vap_setup(struct ieee80211com *ic, struct ieee80211vap *vap,
|
||||
vap->iv_caps = ic->ic_caps &~ IEEE80211_C_OPMODE;
|
||||
vap->iv_htcaps = ic->ic_htcaps;
|
||||
vap->iv_opmode = opmode;
|
||||
vap->iv_caps |= ieee80211_opcap[opmode];
|
||||
switch (opmode) {
|
||||
case IEEE80211_M_STA:
|
||||
/* auto-enable s/w beacon miss support */
|
||||
if (flags & IEEE80211_CLONE_NOBEACONS)
|
||||
vap->iv_flags_ext |= IEEE80211_FEXT_SWBMISS;
|
||||
break;
|
||||
case IEEE80211_M_IBSS:
|
||||
vap->iv_caps |= IEEE80211_C_IBSS;
|
||||
break;
|
||||
case IEEE80211_M_AHDEMO:
|
||||
vap->iv_caps |= IEEE80211_C_AHDEMO;
|
||||
break;
|
||||
case IEEE80211_M_HOSTAP:
|
||||
vap->iv_caps |= IEEE80211_C_HOSTAP;
|
||||
break;
|
||||
case IEEE80211_M_MONITOR:
|
||||
vap->iv_caps |= IEEE80211_C_MONITOR;
|
||||
break;
|
||||
case IEEE80211_M_WDS:
|
||||
vap->iv_caps |= IEEE80211_C_WDS;
|
||||
/*
|
||||
* WDS links must specify the bssid of the far end.
|
||||
* For legacy operation this is a static relationship.
|
||||
@@ -391,7 +386,7 @@ ieee80211_vap_setup(struct ieee80211com *ic, struct ieee80211vap *vap,
|
||||
if (vap->iv_opmode == IEEE80211_M_STA &&
|
||||
(vap->iv_caps & IEEE80211_C_BGSCAN))
|
||||
vap->iv_flags |= IEEE80211_F_BGSCAN;
|
||||
vap->iv_flags |= IEEE80211_F_DOTH; /* XXX out of caps, just ena */
|
||||
vap->iv_flags |= IEEE80211_F_DOTH; /* XXX no cap, just ena */
|
||||
/* NB: DFS support only makes sense for ap mode right now */
|
||||
if (vap->iv_opmode == IEEE80211_M_HOSTAP &&
|
||||
(vap->iv_caps & IEEE80211_C_DFS))
|
||||
@@ -418,7 +413,6 @@ ieee80211_vap_setup(struct ieee80211com *ic, struct ieee80211vap *vap,
|
||||
ieee80211_regdomain_vattach(vap);
|
||||
|
||||
return 0;
|
||||
#undef IEEE80211_C_OPMODE
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -71,7 +71,7 @@ __FBSDID("$FreeBSD$");
|
||||
#define IEEE80211_FVEN_BITS "\20"
|
||||
|
||||
#define IEEE80211_C_BITS \
|
||||
"\20\7FF\10TURBOP\11IBSS\12PMGT" \
|
||||
"\20\1STA\7FF\10TURBOP\11IBSS\12PMGT" \
|
||||
"\13HOSTAP\14AHDEMO\15SWRETRY\16TXPMGT\17SHSLOT\20SHPREAMBLE" \
|
||||
"\21MONITOR\22DFS\30WPA1\31WPA2\32BURST\33WME\34WDS\36BGSCAN" \
|
||||
"\37TXFRAG"
|
||||
|
||||
@@ -108,11 +108,22 @@ wlan_clone_create(struct if_clone *ifc, int unit, caddr_t params)
|
||||
ifp = ifunit(cp.icp_parent);
|
||||
if (ifp == NULL)
|
||||
return ENXIO;
|
||||
/* XXX move printfs to DIAGNOSTIC before release */
|
||||
if (ifp->if_type != IFT_IEEE80211) {
|
||||
if_printf(ifp, "%s: reject, not an 802.11 device\n", __func__);
|
||||
return ENXIO;
|
||||
}
|
||||
if (cp.icp_opmode >= IEEE80211_OPMODE_MAX) {
|
||||
if_printf(ifp, "%s: invalid opmode %d\n",
|
||||
__func__, cp.icp_opmode);
|
||||
return EINVAL;
|
||||
}
|
||||
ic = ifp->if_l2com;
|
||||
if ((ic->ic_caps & ieee80211_opcap[cp.icp_opmode]) == 0) {
|
||||
if_printf(ifp, "%s mode not supported\n",
|
||||
ieee80211_opmode_name[cp.icp_opmode]);
|
||||
return EOPNOTSUPP;
|
||||
}
|
||||
vap = ic->ic_vap_create(ic, ifc->ifc_name, unit,
|
||||
cp.icp_opmode, cp.icp_flags, cp.icp_bssid,
|
||||
cp.icp_flags & IEEE80211_CLONE_MACADDR ?
|
||||
|
||||
@@ -49,6 +49,7 @@ enum ieee80211_state {
|
||||
|
||||
extern const char *ieee80211_mgt_subtype_name[];
|
||||
extern const char *ieee80211_phymode_name[];
|
||||
extern const int ieee80211_opcap[IEEE80211_OPMODE_MAX];
|
||||
|
||||
void ieee80211_proto_attach(struct ieee80211com *);
|
||||
void ieee80211_proto_detach(struct ieee80211com *);
|
||||
|
||||
@@ -493,6 +493,7 @@ MALLOC_DECLARE(M_80211_VAP);
|
||||
|
||||
/* ic_caps/iv_caps: device driver capabilities */
|
||||
/* 0x2f available */
|
||||
#define IEEE80211_C_STA 0x00000001 /* CAPABILITY: STA available */
|
||||
#define IEEE80211_C_FF 0x00000040 /* CAPABILITY: ATH FF avail */
|
||||
#define IEEE80211_C_TURBOP 0x00000080 /* CAPABILITY: ATH Turbo avail*/
|
||||
#define IEEE80211_C_IBSS 0x00000100 /* CAPABILITY: IBSS available */
|
||||
@@ -505,7 +506,7 @@ MALLOC_DECLARE(M_80211_VAP);
|
||||
#define IEEE80211_C_SHPREAMBLE 0x00008000 /* CAPABILITY: short preamble */
|
||||
#define IEEE80211_C_MONITOR 0x00010000 /* CAPABILITY: monitor mode */
|
||||
#define IEEE80211_C_DFS 0x00020000 /* CAPABILITY: DFS/radar avail*/
|
||||
/* 0x20000 available */
|
||||
/* 0x7c0000 available */
|
||||
#define IEEE80211_C_WPA1 0x00800000 /* CAPABILITY: WPA1 avail */
|
||||
#define IEEE80211_C_WPA2 0x01000000 /* CAPABILITY: WPA2 avail */
|
||||
#define IEEE80211_C_WPA 0x01800000 /* CAPABILITY: WPA1+WPA2 avail*/
|
||||
@@ -517,6 +518,10 @@ MALLOC_DECLARE(M_80211_VAP);
|
||||
#define IEEE80211_C_TXFRAG 0x40000000 /* CAPABILITY: tx fragments */
|
||||
/* XXX protection/barker? */
|
||||
|
||||
#define IEEE80211_C_OPMODE \
|
||||
(IEEE80211_C_STA | IEEE80211_C_IBSS | IEEE80211_C_HOSTAP | \
|
||||
IEEE80211_C_AHDEMO | IEEE80211_C_MONITOR | IEEE80211_C_WDS)
|
||||
|
||||
/*
|
||||
* ic_htcaps/iv_htcaps: HT-specific device/driver capabilities
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user