diff options
author | sam <sam@FreeBSD.org> | 2003-04-28 16:35:51 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2003-04-28 16:35:51 +0000 |
commit | a37db6668700646e20198e8605d477205a472821 (patch) | |
tree | ee60e8af0c39e6d55f0fa65c34ffc70d6ae4b8ed /sys/net | |
parent | 867a1b8a0abf379df1d34ac66dece97af674d6ab (diff) | |
download | FreeBSD-src-a37db6668700646e20198e8605d477205a472821.zip FreeBSD-src-a37db6668700646e20198e8605d477205a472821.tar.gz |
o add support for multi-mode devices like 802.11 wireless cards that support
11a/b/g by adding an optional 3-bit mode field
o correct the spelling of OFDM (was ODFM)
o add an 802.11 subtype option for turbo mode: the phy is clocked at 2x the
normal clock rate; note this can be applied to both OFDM in 11a and OFDM
in 11g mode (and possibly DS11 in 11b for certain phy's)
o add 802.11 CCK aliases for 11b/11g rates--the more common terminology
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if_ieee80211subr.c | 16 | ||||
-rw-r--r-- | sys/net/if_media.c | 24 | ||||
-rw-r--r-- | sys/net/if_media.h | 80 |
3 files changed, 80 insertions, 40 deletions
diff --git a/sys/net/if_ieee80211subr.c b/sys/net/if_ieee80211subr.c index 236137b..9f2ec0a 100644 --- a/sys/net/if_ieee80211subr.c +++ b/sys/net/if_ieee80211subr.c @@ -2721,28 +2721,28 @@ ieee80211_rate2media(int rate, enum ieee80211_phytype phytype) mword = IFM_AUTO; break; case 12: - mword = IFM_IEEE80211_ODFM6; + mword = IFM_IEEE80211_OFDM6; break; case 18: - mword = IFM_IEEE80211_ODFM9; + mword = IFM_IEEE80211_OFDM9; break; case 24: - mword = IFM_IEEE80211_ODFM12; + mword = IFM_IEEE80211_OFDM12; break; case 36: - mword = IFM_IEEE80211_ODFM18; + mword = IFM_IEEE80211_OFDM18; break; case 48: - mword = IFM_IEEE80211_ODFM24; + mword = IFM_IEEE80211_OFDM24; break; case 72: - mword = IFM_IEEE80211_ODFM36; + mword = IFM_IEEE80211_OFDM36; break; case 108: - mword = IFM_IEEE80211_ODFM54; + mword = IFM_IEEE80211_OFDM54; break; case 144: - mword = IFM_IEEE80211_ODFM72; + mword = IFM_IEEE80211_OFDM72; break; default: mword = IFM_NONE; diff --git a/sys/net/if_media.c b/sys/net/if_media.c index 34bb902..2201c97 100644 --- a/sys/net/if_media.c +++ b/sys/net/if_media.c @@ -409,6 +409,9 @@ struct ifmedia_description ifm_subtype_ieee80211_descriptions[] = struct ifmedia_description ifm_subtype_ieee80211_option_descriptions[] = IFM_SUBTYPE_IEEE80211_OPTION_DESCRIPTIONS; +struct ifmedia_description ifm_subtype_ieee80211_mode_descriptions[] = + IFM_SUBTYPE_IEEE80211_MODE_DESCRIPTIONS; + struct ifmedia_description ifm_subtype_shared_descriptions[] = IFM_SUBTYPE_SHARED_DESCRIPTIONS; @@ -418,25 +421,30 @@ struct ifmedia_description ifm_shared_option_descriptions[] = struct ifmedia_type_to_subtype { struct ifmedia_description *subtypes; struct ifmedia_description *options; + struct ifmedia_description *modes; }; /* must be in the same order as IFM_TYPE_DESCRIPTIONS */ struct ifmedia_type_to_subtype ifmedia_types_to_subtypes[] = { { &ifm_subtype_ethernet_descriptions[0], - &ifm_subtype_ethernet_option_descriptions[0] + &ifm_subtype_ethernet_option_descriptions[0], + NULL, }, { &ifm_subtype_tokenring_descriptions[0], - &ifm_subtype_tokenring_option_descriptions[0] + &ifm_subtype_tokenring_option_descriptions[0], + NULL, }, { &ifm_subtype_fddi_descriptions[0], - &ifm_subtype_fddi_option_descriptions[0] + &ifm_subtype_fddi_option_descriptions[0], + NULL, }, { &ifm_subtype_ieee80211_descriptions[0], - &ifm_subtype_ieee80211_option_descriptions[0] + &ifm_subtype_ieee80211_option_descriptions[0], + &ifm_subtype_ieee80211_mode_descriptions[0] }, }; @@ -462,6 +470,14 @@ ifmedia_printword(ifmw) } printf(desc->ifmt_string); + /* Any mode. */ + for (desc = ttos->modes; desc && desc->ifmt_string != NULL; desc++) + if (IFM_MODE(ifmw) == desc->ifmt_word) { + if (desc->ifmt_string != NULL) + printf(" mode %s", desc->ifmt_string); + break; + } + /* * Check for the shared subtype descriptions first, then the * type-specific ones. diff --git a/sys/net/if_media.h b/sys/net/if_media.h index 26cf30e..b48f594 100644 --- a/sys/net/if_media.h +++ b/sys/net/if_media.h @@ -113,7 +113,8 @@ int ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr, * 0-4 Media variant * 5-7 Media type * 8-15 Type specific options - * 16-19 RFU + * 16-18 Mode (for multi-mode devices) + * 19 RFU * 20-27 Shared (global) options * 28-31 Instance */ @@ -171,6 +172,7 @@ int ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr, * IEEE 802.11 Wireless */ #define IFM_IEEE80211 0x00000080 +/* NB: 0,1,2 are auto, manual, none defined below */ #define IFM_IEEE80211_FH1 3 /* Frequency Hopping 1Mbps */ #define IFM_IEEE80211_FH2 4 /* Frequency Hopping 2Mbps */ #define IFM_IEEE80211_DS1 5 /* Direct Sequence 1Mbps */ @@ -178,19 +180,24 @@ int ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr, #define IFM_IEEE80211_DS5 7 /* Direct Sequence 5.5Mbps */ #define IFM_IEEE80211_DS11 8 /* Direct Sequence 11Mbps */ #define IFM_IEEE80211_DS22 9 /* Direct Sequence 22Mbps */ -#define IFM_IEEE80211_ODFM6 10 /* ODFM 6Mbps */ -#define IFM_IEEE80211_ODFM9 11 /* ODFM 9Mbps */ -#define IFM_IEEE80211_ODFM12 12 /* ODFM 12Mbps */ -#define IFM_IEEE80211_ODFM18 13 /* ODFM 18Mbps */ -#define IFM_IEEE80211_ODFM24 14 /* ODFM 24Mbps */ -#define IFM_IEEE80211_ODFM36 15 /* ODFM 36Mbps */ -#define IFM_IEEE80211_ODFM48 16 /* ODFM 48Mbps */ -#define IFM_IEEE80211_ODFM54 17 /* ODFM 54Mbps */ -#define IFM_IEEE80211_ODFM72 18 /* ODFM 72Mbps */ +#define IFM_IEEE80211_OFDM6 10 /* OFDM 6Mbps */ +#define IFM_IEEE80211_OFDM9 11 /* OFDM 9Mbps */ +#define IFM_IEEE80211_OFDM12 12 /* OFDM 12Mbps */ +#define IFM_IEEE80211_OFDM18 13 /* OFDM 18Mbps */ +#define IFM_IEEE80211_OFDM24 14 /* OFDM 24Mbps */ +#define IFM_IEEE80211_OFDM36 15 /* OFDM 36Mbps */ +#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 */ +/* 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 */ /* * Shared media sub-types @@ -217,6 +224,8 @@ int ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr, #define IFM_IMASK 0xf0000000 /* Instance */ #define IFM_ISHIFT 28 /* Instance shift */ #define IFM_OMASK 0x0000ff00 /* Type specific options */ +#define IFM_MMASK 0x00070000 /* Mode */ +#define IFM_MSHIFT 16 /* Mode shift */ #define IFM_GMASK 0x0ff00000 /* Global options */ /* @@ -233,6 +242,7 @@ int ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr, #define IFM_TYPE_OPTIONS(x) ((x) & IFM_OMASK) #define IFM_INST(x) (((x) & IFM_IMASK) >> IFM_ISHIFT) #define IFM_OPTIONS(x) ((x) & (IFM_OMASK|IFM_GMASK)) +#define IFM_MODE(x) (((x) & IFM_MMASK) >> IFM_MSHIFT) #define IFM_INST_MAX IFM_INST(IFM_IMASK) @@ -241,6 +251,8 @@ int ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr, */ #define IFM_MAKEWORD(type, subtype, options, instance) \ ((type) | (subtype) | (options) | ((instance) << IFM_ISHIFT)) +#define IFM_MAKEMODE(mode) \ + (((mode) << IFM_MSHIFT) & IFM_MMASK) /* * NetBSD extension not defined in the BSDI API. This is used in various @@ -364,15 +376,15 @@ struct ifmedia_description { { IFM_IEEE80211_DS5, "DS/5.5Mbps" }, \ { IFM_IEEE80211_DS11, "DS/11Mbps" }, \ { IFM_IEEE80211_DS22, "DS/22Mbps" }, \ - { IFM_IEEE80211_ODFM6, "ODFM/6Mbps" }, \ - { IFM_IEEE80211_ODFM9, "ODFM/9Mbps" }, \ - { IFM_IEEE80211_ODFM12, "ODFM/12Mbps" }, \ - { IFM_IEEE80211_ODFM18, "ODFM/18Mbps" }, \ - { IFM_IEEE80211_ODFM24, "ODFM/24Mbps" }, \ - { IFM_IEEE80211_ODFM36, "ODFM/36Mbps" }, \ - { IFM_IEEE80211_ODFM48, "ODFM/48Mbps" }, \ - { IFM_IEEE80211_ODFM54, "ODFM/54Mbps" }, \ - { IFM_IEEE80211_ODFM72, "ODFM/72Mbps" }, \ + { IFM_IEEE80211_OFDM6, "OFDM/6Mbps" }, \ + { IFM_IEEE80211_OFDM9, "OFDM/9Mbps" }, \ + { IFM_IEEE80211_OFDM12, "OFDM/12Mbps" }, \ + { IFM_IEEE80211_OFDM18, "OFDM/18Mbps" }, \ + { IFM_IEEE80211_OFDM24, "OFDM/24Mbps" }, \ + { IFM_IEEE80211_OFDM36, "OFDM/36Mbps" }, \ + { IFM_IEEE80211_OFDM48, "OFDM/48Mbps" }, \ + { IFM_IEEE80211_OFDM54, "OFDM/54Mbps" }, \ + { IFM_IEEE80211_OFDM72, "OFDM/72Mbps" }, \ { 0, NULL }, \ } @@ -391,15 +403,19 @@ struct ifmedia_description { { IFM_IEEE80211_DS5, "DirectSequence/5.5Mbps" }, \ { IFM_IEEE80211_DS11, "DirectSequence/11Mbps" }, \ { IFM_IEEE80211_DS22, "DirectSequence/22Mbps" }, \ - { IFM_IEEE80211_ODFM6, "ODFM6" }, \ - { IFM_IEEE80211_ODFM9, "ODFM9" }, \ - { IFM_IEEE80211_ODFM12, "ODFM12" }, \ - { IFM_IEEE80211_ODFM18, "ODFM18" }, \ - { IFM_IEEE80211_ODFM24, "ODFM24" }, \ - { IFM_IEEE80211_ODFM36, "ODFM36" }, \ - { IFM_IEEE80211_ODFM48, "ODFM48" }, \ - { IFM_IEEE80211_ODFM54, "ODFM54" }, \ - { IFM_IEEE80211_ODFM72, "ODFM72" }, \ + { IFM_IEEE80211_OFDM6, "OFDM6" }, \ + { IFM_IEEE80211_OFDM9, "OFDM9" }, \ + { IFM_IEEE80211_OFDM12, "OFDM12" }, \ + { IFM_IEEE80211_OFDM18, "OFDM18" }, \ + { IFM_IEEE80211_OFDM24, "OFDM24" }, \ + { IFM_IEEE80211_OFDM36, "OFDM36" }, \ + { IFM_IEEE80211_OFDM48, "OFDM48" }, \ + { IFM_IEEE80211_OFDM54, "OFDM54" }, \ + { IFM_IEEE80211_OFDM72, "OFDM72" }, \ + { IFM_IEEE80211_DS1, "CCK1" }, \ + { IFM_IEEE80211_DS2, "CCK2" }, \ + { IFM_IEEE80211_DS5, "CCK5.5" }, \ + { IFM_IEEE80211_DS11, "CCK11" }, \ { 0, NULL }, \ } @@ -408,6 +424,14 @@ struct ifmedia_description { { IFM_IEEE80211_HOSTAP, "hostap" }, \ { IFM_IEEE80211_IBSS, "ibss" }, \ { IFM_IEEE80211_IBSSMASTER, "ibss-master" }, \ + { IFM_IEEE80211_TURBO, "turbo" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_IEEE80211_MODE_DESCRIPTIONS { \ + { IFM_IEEE80211_11A, "11a" }, \ + { IFM_IEEE80211_11B, "11b" }, \ + { IFM_IEEE80211_11G, "11g" }, \ { 0, NULL }, \ } |