Add support for FH phy, which will be used by awi driver.
Also some if_media constants to indicate operational mode are changed to bitmasks to reduce diffs from NetBSD.
This commit is contained in:
parent
f8735aa3bd
commit
4844aa7d12
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=124543
@ -189,16 +189,19 @@ int ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr,
|
||||
#define IFM_IEEE80211_OFDM48 16 /* OFDM 48Mbps */
|
||||
#define IFM_IEEE80211_OFDM54 17 /* OFDM 54Mbps */
|
||||
#define IFM_IEEE80211_OFDM72 18 /* OFDM 72Mbps */
|
||||
|
||||
#define IFM_IEEE80211_ADHOC 0x00000100 /* Operate in Adhoc mode */
|
||||
#define IFM_IEEE80211_HOSTAP 0x00000200 /* Operate in Host AP mode */
|
||||
#define IFM_IEEE80211_IBSS 0x00000400 /* Operate in IBSS mode */
|
||||
#define IFM_IEEE80211_IBSSMASTER 0x00000800 /* Operate as an IBSS master */
|
||||
#define IFM_IEEE80211_TURBO 0x00001000 /* Operate in turbo mode */
|
||||
#define IFM_IEEE80211_MONITOR 0x00002000 /* Operate in monitor mode */
|
||||
|
||||
/* operating mode for multi-mode devices */
|
||||
#define IFM_IEEE80211_11A 1 /* 5Ghz, OFDM mode */
|
||||
#define IFM_IEEE80211_11B 2 /* Direct Sequence mode */
|
||||
#define IFM_IEEE80211_11G 3 /* 2Ghz, CCK mode */
|
||||
#define IFM_IEEE80211_11A 0x00010000 /* 5Ghz, OFDM mode */
|
||||
#define IFM_IEEE80211_11B 0x00020000 /* Direct Sequence mode */
|
||||
#define IFM_IEEE80211_11G 0x00030000 /* 2Ghz, CCK mode */
|
||||
#define IFM_IEEE80211_FH 0x00040000 /* 2Ghz, GFSK mode */
|
||||
|
||||
/*
|
||||
* ATM
|
||||
@ -453,6 +456,7 @@ struct ifmedia_description {
|
||||
{ IFM_IEEE80211_11A, "11a" }, \
|
||||
{ IFM_IEEE80211_11B, "11b" }, \
|
||||
{ IFM_IEEE80211_11G, "11g" }, \
|
||||
{ IFM_IEEE80211_FH, "fh" }, \
|
||||
{ 0, NULL }, \
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,8 @@ static const char *ieee80211_phymode_name[] = {
|
||||
"11a", /* IEEE80211_MODE_11A */
|
||||
"11b", /* IEEE80211_MODE_11B */
|
||||
"11g", /* IEEE80211_MODE_11G */
|
||||
"turbo", /* IEEE80211_MODE_TURBO */
|
||||
"FH", /* IEEE80211_MODE_FH */
|
||||
"turbo", /* IEEE80211_MODE_TURBO */
|
||||
};
|
||||
|
||||
void
|
||||
@ -129,6 +130,8 @@ ieee80211_ifattach(struct ifnet *ifp)
|
||||
ic->ic_modecaps |= 1<<IEEE80211_MODE_11B;
|
||||
if (IEEE80211_IS_CHAN_PUREG(c))
|
||||
ic->ic_modecaps |= 1<<IEEE80211_MODE_11G;
|
||||
if (IEEE80211_IS_CHAN_FHSS(c))
|
||||
ic->ic_modecaps |= 1<<IEEE80211_MODE_FH;
|
||||
if (IEEE80211_IS_CHAN_T(c))
|
||||
ic->ic_modecaps |= 1<<IEEE80211_MODE_TURBO;
|
||||
}
|
||||
@ -266,10 +269,11 @@ ieee80211_media_init(struct ifnet *ifp,
|
||||
for (mode = IEEE80211_MODE_AUTO; mode < IEEE80211_MODE_MAX; mode++) {
|
||||
static const u_int mopts[] = {
|
||||
IFM_AUTO,
|
||||
IFM_MAKEMODE(IFM_IEEE80211_11A),
|
||||
IFM_MAKEMODE(IFM_IEEE80211_11B),
|
||||
IFM_MAKEMODE(IFM_IEEE80211_11G),
|
||||
IFM_MAKEMODE(IFM_IEEE80211_11A) | IFM_IEEE80211_TURBO,
|
||||
IFM_IEEE80211_11A,
|
||||
IFM_IEEE80211_11B,
|
||||
IFM_IEEE80211_11G,
|
||||
IFM_IEEE80211_FH,
|
||||
IFM_IEEE80211_11A | IFM_IEEE80211_TURBO,
|
||||
};
|
||||
if ((ic->ic_modecaps & (1<<mode)) == 0)
|
||||
continue;
|
||||
@ -385,6 +389,9 @@ ieee80211_media_change(struct ifnet *ifp)
|
||||
case IFM_IEEE80211_11G:
|
||||
newphymode = IEEE80211_MODE_11G;
|
||||
break;
|
||||
case IFM_IEEE80211_FH:
|
||||
newphymode = IEEE80211_MODE_FH;
|
||||
break;
|
||||
case IFM_AUTO:
|
||||
newphymode = IEEE80211_MODE_AUTO;
|
||||
break;
|
||||
@ -555,16 +562,19 @@ ieee80211_media_status(struct ifnet *ifp, struct ifmediareq *imr)
|
||||
}
|
||||
switch (ic->ic_curmode) {
|
||||
case IEEE80211_MODE_11A:
|
||||
imr->ifm_active |= IFM_MAKEMODE(IFM_IEEE80211_11A);
|
||||
imr->ifm_active |= IFM_IEEE80211_11A;
|
||||
break;
|
||||
case IEEE80211_MODE_11B:
|
||||
imr->ifm_active |= IFM_MAKEMODE(IFM_IEEE80211_11B);
|
||||
imr->ifm_active |= IFM_IEEE80211_11B;
|
||||
break;
|
||||
case IEEE80211_MODE_11G:
|
||||
imr->ifm_active |= IFM_MAKEMODE(IFM_IEEE80211_11G);
|
||||
imr->ifm_active |= IFM_IEEE80211_11G;
|
||||
break;
|
||||
case IEEE80211_MODE_FH:
|
||||
imr->ifm_active |= IFM_IEEE80211_FH;
|
||||
break;
|
||||
case IEEE80211_MODE_TURBO:
|
||||
imr->ifm_active |= IFM_MAKEMODE(IFM_IEEE80211_11A)
|
||||
imr->ifm_active |= IFM_IEEE80211_11A
|
||||
| IFM_IEEE80211_TURBO;
|
||||
break;
|
||||
}
|
||||
@ -598,6 +608,7 @@ ieee80211_set11gbasicrates(struct ieee80211_rateset *rs, enum ieee80211_phymode
|
||||
{ 3, { 12, 24, 48 } }, /* IEEE80211_MODE_11A */
|
||||
{ 4, { 2, 4, 11, 22 } }, /* IEEE80211_MODE_11B */
|
||||
{ 7, { 2, 4, 11, 22, 12, 24, 48 } },/* IEEE80211_MODE_11G */
|
||||
{ 0 }, /* IEEE80211_MODE_FH */
|
||||
{ 0 }, /* IEEE80211_MODE_TURBO */
|
||||
};
|
||||
int i, j;
|
||||
@ -627,6 +638,7 @@ ieee80211_setmode(struct ieee80211com *ic, enum ieee80211_phymode mode)
|
||||
IEEE80211_CHAN_A, /* IEEE80211_MODE_11A */
|
||||
IEEE80211_CHAN_B, /* IEEE80211_MODE_11B */
|
||||
IEEE80211_CHAN_PUREG, /* IEEE80211_MODE_11G */
|
||||
IEEE80211_CHAN_FHSS, /* IEEE80211_MODE_FH */
|
||||
IEEE80211_CHAN_T, /* IEEE80211_MODE_TURBO */
|
||||
};
|
||||
struct ieee80211_channel *c;
|
||||
@ -736,6 +748,8 @@ ieee80211_chan2mode(struct ieee80211com *ic, struct ieee80211_channel *chan)
|
||||
*/
|
||||
if (IEEE80211_IS_CHAN_5GHZ(chan))
|
||||
return IEEE80211_MODE_11A;
|
||||
else if (IEEE80211_IS_CHAN_FHSS(chan))
|
||||
return IEEE80211_MODE_FH;
|
||||
else if (chan->ic_flags & (IEEE80211_CHAN_OFDM|IEEE80211_CHAN_DYN))
|
||||
return IEEE80211_MODE_11G;
|
||||
else
|
||||
@ -754,31 +768,33 @@ ieee80211_rate2media(struct ieee80211com *ic, int rate, enum ieee80211_phymode m
|
||||
u_int m; /* rate + mode */
|
||||
u_int r; /* if_media rate */
|
||||
} rates[] = {
|
||||
{ 2 | IFM_MAKEMODE(IFM_IEEE80211_11B), IFM_IEEE80211_DS1 },
|
||||
{ 4 | IFM_MAKEMODE(IFM_IEEE80211_11B), IFM_IEEE80211_DS2 },
|
||||
{ 11 | IFM_MAKEMODE(IFM_IEEE80211_11B), IFM_IEEE80211_DS5 },
|
||||
{ 22 | IFM_MAKEMODE(IFM_IEEE80211_11B), IFM_IEEE80211_DS11 },
|
||||
{ 44 | IFM_MAKEMODE(IFM_IEEE80211_11B), IFM_IEEE80211_DS22 },
|
||||
{ 12 | IFM_MAKEMODE(IFM_IEEE80211_11A), IFM_IEEE80211_OFDM6 },
|
||||
{ 18 | IFM_MAKEMODE(IFM_IEEE80211_11A), IFM_IEEE80211_OFDM9 },
|
||||
{ 24 | IFM_MAKEMODE(IFM_IEEE80211_11A), IFM_IEEE80211_OFDM12 },
|
||||
{ 36 | IFM_MAKEMODE(IFM_IEEE80211_11A), IFM_IEEE80211_OFDM18 },
|
||||
{ 48 | IFM_MAKEMODE(IFM_IEEE80211_11A), IFM_IEEE80211_OFDM24 },
|
||||
{ 72 | IFM_MAKEMODE(IFM_IEEE80211_11A), IFM_IEEE80211_OFDM36 },
|
||||
{ 96 | IFM_MAKEMODE(IFM_IEEE80211_11A), IFM_IEEE80211_OFDM48 },
|
||||
{ 108 | IFM_MAKEMODE(IFM_IEEE80211_11A), IFM_IEEE80211_OFDM54 },
|
||||
{ 2 | IFM_MAKEMODE(IFM_IEEE80211_11G), IFM_IEEE80211_DS1 },
|
||||
{ 4 | IFM_MAKEMODE(IFM_IEEE80211_11G), IFM_IEEE80211_DS2 },
|
||||
{ 11 | IFM_MAKEMODE(IFM_IEEE80211_11G), IFM_IEEE80211_DS5 },
|
||||
{ 22 | IFM_MAKEMODE(IFM_IEEE80211_11G), IFM_IEEE80211_DS11 },
|
||||
{ 12 | IFM_MAKEMODE(IFM_IEEE80211_11G), IFM_IEEE80211_OFDM6 },
|
||||
{ 18 | IFM_MAKEMODE(IFM_IEEE80211_11G), IFM_IEEE80211_OFDM9 },
|
||||
{ 24 | IFM_MAKEMODE(IFM_IEEE80211_11G), IFM_IEEE80211_OFDM12 },
|
||||
{ 36 | IFM_MAKEMODE(IFM_IEEE80211_11G), IFM_IEEE80211_OFDM18 },
|
||||
{ 48 | IFM_MAKEMODE(IFM_IEEE80211_11G), IFM_IEEE80211_OFDM24 },
|
||||
{ 72 | IFM_MAKEMODE(IFM_IEEE80211_11G), IFM_IEEE80211_OFDM36 },
|
||||
{ 96 | IFM_MAKEMODE(IFM_IEEE80211_11G), IFM_IEEE80211_OFDM48 },
|
||||
{ 108 | IFM_MAKEMODE(IFM_IEEE80211_11G), IFM_IEEE80211_OFDM54 },
|
||||
{ 2 | IFM_IEEE80211_FH, IFM_IEEE80211_FH1 },
|
||||
{ 4 | IFM_IEEE80211_FH, IFM_IEEE80211_FH2 },
|
||||
{ 2 | IFM_IEEE80211_11B, IFM_IEEE80211_DS1 },
|
||||
{ 4 | IFM_IEEE80211_11B, IFM_IEEE80211_DS2 },
|
||||
{ 11 | IFM_IEEE80211_11B, IFM_IEEE80211_DS5 },
|
||||
{ 22 | IFM_IEEE80211_11B, IFM_IEEE80211_DS11 },
|
||||
{ 44 | IFM_IEEE80211_11B, IFM_IEEE80211_DS22 },
|
||||
{ 12 | IFM_IEEE80211_11A, IFM_IEEE80211_OFDM6 },
|
||||
{ 18 | IFM_IEEE80211_11A, IFM_IEEE80211_OFDM9 },
|
||||
{ 24 | IFM_IEEE80211_11A, IFM_IEEE80211_OFDM12 },
|
||||
{ 36 | IFM_IEEE80211_11A, IFM_IEEE80211_OFDM18 },
|
||||
{ 48 | IFM_IEEE80211_11A, IFM_IEEE80211_OFDM24 },
|
||||
{ 72 | IFM_IEEE80211_11A, IFM_IEEE80211_OFDM36 },
|
||||
{ 96 | IFM_IEEE80211_11A, IFM_IEEE80211_OFDM48 },
|
||||
{ 108 | IFM_IEEE80211_11A, IFM_IEEE80211_OFDM54 },
|
||||
{ 2 | IFM_IEEE80211_11G, IFM_IEEE80211_DS1 },
|
||||
{ 4 | IFM_IEEE80211_11G, IFM_IEEE80211_DS2 },
|
||||
{ 11 | IFM_IEEE80211_11G, IFM_IEEE80211_DS5 },
|
||||
{ 22 | IFM_IEEE80211_11G, IFM_IEEE80211_DS11 },
|
||||
{ 12 | IFM_IEEE80211_11G, IFM_IEEE80211_OFDM6 },
|
||||
{ 18 | IFM_IEEE80211_11G, IFM_IEEE80211_OFDM9 },
|
||||
{ 24 | IFM_IEEE80211_11G, IFM_IEEE80211_OFDM12 },
|
||||
{ 36 | IFM_IEEE80211_11G, IFM_IEEE80211_OFDM18 },
|
||||
{ 48 | IFM_IEEE80211_11G, IFM_IEEE80211_OFDM24 },
|
||||
{ 72 | IFM_IEEE80211_11G, IFM_IEEE80211_OFDM36 },
|
||||
{ 96 | IFM_IEEE80211_11G, IFM_IEEE80211_OFDM48 },
|
||||
{ 108 | IFM_IEEE80211_11G, IFM_IEEE80211_OFDM54 },
|
||||
/* NB: OFDM72 doesn't realy exist so we don't handle it */
|
||||
};
|
||||
u_int mask, i;
|
||||
@ -787,25 +803,24 @@ ieee80211_rate2media(struct ieee80211com *ic, int rate, enum ieee80211_phymode m
|
||||
switch (mode) {
|
||||
case IEEE80211_MODE_11A:
|
||||
case IEEE80211_MODE_TURBO:
|
||||
mask |= IFM_MAKEMODE(IFM_IEEE80211_11A);
|
||||
mask |= IFM_IEEE80211_11A;
|
||||
break;
|
||||
case IEEE80211_MODE_11B:
|
||||
mask |= IFM_MAKEMODE(IFM_IEEE80211_11B);
|
||||
mask |= IFM_IEEE80211_11B;
|
||||
break;
|
||||
case IEEE80211_MODE_FH:
|
||||
mask |= IFM_IEEE80211_FH;
|
||||
break;
|
||||
case IEEE80211_MODE_AUTO:
|
||||
/* NB: ic may be NULL for some drivers */
|
||||
if (ic && ic->ic_phytype == IEEE80211_T_FH) {
|
||||
/* must handle these specially */
|
||||
switch (mask) {
|
||||
case 2: return IFM_IEEE80211_FH1;
|
||||
case 4: return IFM_IEEE80211_FH2;
|
||||
}
|
||||
return IFM_AUTO;
|
||||
mask |= IFM_IEEE80211_FH;
|
||||
break;
|
||||
}
|
||||
/* NB: hack, 11g matches both 11b+11a rates */
|
||||
/* fall thru... */
|
||||
case IEEE80211_MODE_11G:
|
||||
mask |= IFM_MAKEMODE(IFM_IEEE80211_11G);
|
||||
mask |= IFM_IEEE80211_11G;
|
||||
break;
|
||||
}
|
||||
for (i = 0; i < N(rates); i++)
|
||||
|
@ -657,13 +657,16 @@ ieee80211_recv_mgmt(struct ieee80211com *ic, struct mbuf *m0,
|
||||
ic->ic_stats.is_rx_badchan++;
|
||||
return;
|
||||
}
|
||||
if (chan != bchan) {
|
||||
if (chan != bchan && ic->ic_phytype != IEEE80211_T_FH) {
|
||||
/*
|
||||
* Frame was received on a channel different from the
|
||||
* one indicated in the DS/FH params element id;
|
||||
* one indicated in the DS params element id;
|
||||
* silently discard it.
|
||||
*
|
||||
* NB: this can happen due to signal leakage.
|
||||
* But we should take it for FH phy because
|
||||
* the rssi value should be correct even for
|
||||
* different hop pattern in FH.
|
||||
*/
|
||||
IEEE80211_DPRINTF(("%s: ignore %s on channel %u marked "
|
||||
"for channel %u\n", __func__,
|
||||
|
@ -63,7 +63,8 @@ enum ieee80211_phymode {
|
||||
IEEE80211_MODE_11A = 1, /* 5GHz, OFDM */
|
||||
IEEE80211_MODE_11B = 2, /* 2GHz, CCK */
|
||||
IEEE80211_MODE_11G = 3, /* 2GHz, OFDM */
|
||||
IEEE80211_MODE_TURBO = 4, /* 5GHz, OFDM, 2x clock */
|
||||
IEEE80211_MODE_FH = 4, /* 2GHz, GFSK */
|
||||
IEEE80211_MODE_TURBO = 5, /* 5GHz, OFDM, 2x clock */
|
||||
};
|
||||
#define IEEE80211_MODE_MAX (IEEE80211_MODE_TURBO+1)
|
||||
|
||||
@ -92,10 +93,13 @@ struct ieee80211_channel {
|
||||
#define IEEE80211_CHAN_5GHZ 0x0100 /* 5 GHz spectrum channel */
|
||||
#define IEEE80211_CHAN_PASSIVE 0x0200 /* Only passive scan allowed */
|
||||
#define IEEE80211_CHAN_DYN 0x0400 /* Dynamic CCK-OFDM channel */
|
||||
#define IEEE80211_CHAN_GFSK 0x0800 /* GFSK channel (FHSS PHY) */
|
||||
|
||||
/*
|
||||
* Useful combinations of channel characteristics.
|
||||
*/
|
||||
#define IEEE80211_CHAN_FHSS \
|
||||
(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_GFSK)
|
||||
#define IEEE80211_CHAN_A \
|
||||
(IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM)
|
||||
#define IEEE80211_CHAN_B \
|
||||
@ -107,6 +111,8 @@ struct ieee80211_channel {
|
||||
#define IEEE80211_CHAN_T \
|
||||
(IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_TURBO)
|
||||
|
||||
#define IEEE80211_IS_CHAN_FHSS(_c) \
|
||||
(((_c)->ic_flags & IEEE80211_CHAN_FHSS) == IEEE80211_CHAN_FHSS)
|
||||
#define IEEE80211_IS_CHAN_A(_c) \
|
||||
(((_c)->ic_flags & IEEE80211_CHAN_A) == IEEE80211_CHAN_A)
|
||||
#define IEEE80211_IS_CHAN_B(_c) \
|
||||
@ -126,6 +132,8 @@ struct ieee80211_channel {
|
||||
(((_c)->ic_flags & IEEE80211_CHAN_OFDM) != 0)
|
||||
#define IEEE80211_IS_CHAN_CCK(_c) \
|
||||
(((_c)->ic_flags & IEEE80211_CHAN_CCK) != 0)
|
||||
#define IEEE80211_IS_CHAN_GFSK(_c) \
|
||||
(((_c)->ic_flags & IEEE80211_CHAN_GFSK) != 0)
|
||||
|
||||
/* ni_chan encoding for FH phy */
|
||||
#define IEEE80211_FH_CHANMOD 80
|
||||
|
Loading…
Reference in New Issue
Block a user