diff options
author | Stefan Sperling <stsp@cvs.openbsd.org> | 2015-11-15 01:05:26 +0000 |
---|---|---|
committer | Stefan Sperling <stsp@cvs.openbsd.org> | 2015-11-15 01:05:26 +0000 |
commit | bf9aa827619116f5a14fcc7b5f17b0eee6a64877 (patch) | |
tree | 3eca6305378dd113ced41c7f817def8adb55f847 | |
parent | f6f9bce8b4d484ea3037c01d32b827f81e5e758e (diff) |
Declare 802.11n mode and channel flags. Tweak 11n related fields in struct
ieee80211com and move them inside #ifndef IEEE80211_NO_HT without breaking
the build in rsu(4) for RAMDISK_CD.
Also declare 11n protection modes and MCS count.
ok deraadt mpi kettenis guenther
-rw-r--r-- | sys/dev/usb/if_rsu.c | 9 | ||||
-rw-r--r-- | sys/net80211/ieee80211.c | 6 | ||||
-rw-r--r-- | sys/net80211/ieee80211.h | 19 | ||||
-rw-r--r-- | sys/net80211/ieee80211_ioctl.h | 3 | ||||
-rw-r--r-- | sys/net80211/ieee80211_output.c | 12 | ||||
-rw-r--r-- | sys/net80211/ieee80211_radiotap.h | 3 | ||||
-rw-r--r-- | sys/net80211/ieee80211_var.h | 17 |
7 files changed, 55 insertions, 14 deletions
diff --git a/sys/dev/usb/if_rsu.c b/sys/dev/usb/if_rsu.c index 16128ccb67c..1383fb142f3 100644 --- a/sys/dev/usb/if_rsu.c +++ b/sys/dev/usb/if_rsu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rsu.c,v 1.28 2015/10/25 12:11:56 mpi Exp $ */ +/* $OpenBSD: if_rsu.c,v 1.29 2015/11/15 01:05:25 stsp Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> @@ -1982,7 +1982,9 @@ rsu_fw_loadsection(struct rsu_softc *sc, uint8_t *buf, int len) int rsu_load_firmware(struct rsu_softc *sc) { +#ifndef IEEE80211_NO_HT struct ieee80211com *ic = &sc->sc_ic; +#endif struct r92s_fw_hdr *hdr; struct r92s_fw_priv *dmem; uint8_t *imem, *emem; @@ -2113,7 +2115,9 @@ rsu_load_firmware(struct rsu_softc *sc) dmem->rf_config = 0x12; /* 1T2R */ dmem->vcs_type = R92S_VCS_TYPE_AUTO; dmem->vcs_mode = R92S_VCS_MODE_RTS_CTS; +#ifndef IEEE80211_NO_HT dmem->bw40_en = (ic->ic_htcaps & IEEE80211_HTCAP_CBW20_40) != 0; +#endif dmem->turbo_mode = 1; /* Load DMEM section. */ error = rsu_fw_loadsection(sc, (uint8_t *)dmem, sizeof(*dmem)); @@ -2254,6 +2258,7 @@ rsu_init(struct ifnet *ifp) goto fail; } +#ifndef IEEE80211_NO_HT if (ic->ic_htcaps & IEEE80211_HTCAP_CBW20_40) { /* Enable 40MHz mode. */ error = rsu_fw_iocmd(sc, @@ -2266,7 +2271,7 @@ rsu_init(struct ifnet *ifp) goto fail; } } - +#endif /* Set default channel. */ ic->ic_bss->ni_chan = ic->ic_ibss_chan; diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c index 51b68cb4b3a..c85dae8e870 100644 --- a/sys/net80211/ieee80211.c +++ b/sys/net80211/ieee80211.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211.c,v 1.47 2015/10/17 21:30:29 stsp Exp $ */ +/* $OpenBSD: ieee80211.c,v 1.48 2015/11/15 01:05:25 stsp Exp $ */ /* $NetBSD: ieee80211.c,v 1.19 2004/06/06 05:45:29 dyoung Exp $ */ /*- @@ -878,6 +878,10 @@ ieee80211_rate2media(struct ieee80211com *ic, int rate, case IEEE80211_MODE_11G: mask |= IFM_IEEE80211_11G; break; + case IEEE80211_MODE_11N: + /* 11n uses MCS, not rates. */ + panic("unexpected mode %d", mode); + break; } for (i = 0; i < nitems(rates); i++) if (rates[i].m == mask) diff --git a/sys/net80211/ieee80211.h b/sys/net80211/ieee80211.h index 2961eacab3f..7157a40fc21 100644 --- a/sys/net80211/ieee80211.h +++ b/sys/net80211/ieee80211.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211.h,v 1.53 2015/10/10 07:51:47 stsp Exp $ */ +/* $OpenBSD: ieee80211.h,v 1.54 2015/11/15 01:05:25 stsp Exp $ */ /* $NetBSD: ieee80211.h,v 1.6 2004/04/30 23:51:53 dyoung Exp $ */ /*- @@ -504,6 +504,8 @@ enum { #define IEEE80211_RATE_SIZE 8 /* 802.11 standard */ #define IEEE80211_RATE_MAXSIZE 15 /* max rates we'll handle */ +#define IEEE80211_HT_NUM_MCS 77 + /* * BlockAck/BlockAckReq Control field (see 802.11-2012 8.3.1.9 Figure 8-25). */ @@ -576,11 +578,13 @@ enum { */ #define IEEE80211_AMPDU_PARAM_LE 0x03 #define IEEE80211_AMPDU_PARAM_SS 0x1c +/* bits 5-7 reserved */ /* * HT Supported MCS Set (see 802.11-2012 8.4.2.58.4). * This field is 16 bytes in size. Bitmasks given below - * operate on 8 or 16 bit integer subsets of this field. + * operate on 8 or 16 bit integer subsets of this field + * for use with ieee80211com and ieee80211_node. */ /* Bits 0-76: Supported Rx MCS bitmask */ /* Bits 77-79: Reserved */ @@ -661,6 +665,7 @@ enum { /* * HT Operation element (see 802.11-2012 8.4.2.59). */ +/* Byte 0 contains primary channel number. */ /* Byte 1. */ #define IEEE80211_HTOP0_SCO_MASK 0x03 #define IEEE80211_HTOP0_SCO_SHIFT 0 @@ -989,4 +994,14 @@ enum { IEEE80211_KDE_IGTK = 9 /* 11w */ }; +/* + * HT protection modes (see 802.11-2012 8.4.2.59) + */ +enum ieee80211_htprot { + IEEE80211_HTPROT_NONE = 0, + IEEE80211_HTPROT_NONMEMBER, + IEEE80211_HTPROT_20MHZ, + IEEE80211_HTPROT_NONHT_MIXED, +}; + #endif /* _NET80211_IEEE80211_H_ */ diff --git a/sys/net80211/ieee80211_ioctl.h b/sys/net80211/ieee80211_ioctl.h index 1779c2455ee..24ec1c581b7 100644 --- a/sys/net80211/ieee80211_ioctl.h +++ b/sys/net80211/ieee80211_ioctl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_ioctl.h,v 1.21 2015/01/09 20:34:21 sthen Exp $ */ +/* $OpenBSD: ieee80211_ioctl.h,v 1.22 2015/11/15 01:05:25 stsp Exp $ */ /* $NetBSD: ieee80211_ioctl.h,v 1.7 2004/04/30 22:51:04 dyoung Exp $ */ /*- @@ -175,6 +175,7 @@ struct ieee80211_channel { #define IEEE80211_CHAN_PASSIVE 0x0200 /* Only passive scan allowed */ #define IEEE80211_CHAN_DYN 0x0400 /* Dynamic CCK-OFDM channel */ #define IEEE80211_CHAN_XR 0x1000 /* Extended range OFDM channel */ +#define IEEE80211_CHAN_HT 0x2000 /* 11n/HT channel */ #endif /* !_KERNEL */ struct ieee80211_chanreq_all { diff --git a/sys/net80211/ieee80211_output.c b/sys/net80211/ieee80211_output.c index 91a107fc10b..a5a4ea8b68a 100644 --- a/sys/net80211/ieee80211_output.c +++ b/sys/net80211/ieee80211_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_output.c,v 1.99 2015/11/08 18:48:07 stsp Exp $ */ +/* $OpenBSD: ieee80211_output.c,v 1.100 2015/11/15 01:05:25 stsp Exp $ */ /* $NetBSD: ieee80211_output.c,v 1.13 2004/05/31 11:02:55 dyoung Exp $ */ /*- @@ -1009,8 +1009,14 @@ ieee80211_add_htcaps(u_int8_t *frm, struct ieee80211com *ic) *frm++ = IEEE80211_ELEMID_HTCAPS; *frm++ = 26; LE_WRITE_2(frm, ic->ic_htcaps); frm += 2; - *frm++ = 0; - memcpy(frm, ic->ic_sup_mcs, 16); frm += 16; + *frm++ = 0; /* XXX A-MPDU params */ + memcpy(frm, ic->ic_sup_mcs, 10); frm += 10; + LE_WRITE_2(frm, (ic->ic_max_rxrate & IEEE80211_MCS_RX_RATE_HIGH)); + frm += 2; + *frm++ = ic->ic_tx_mcs_set; + *frm++ = 0; /* reserved */ + *frm++ = 0; /* reserved */ + *frm++ = 0; /* reserved */ LE_WRITE_2(frm, ic->ic_htxcaps); frm += 2; LE_WRITE_4(frm, ic->ic_txbfcaps); frm += 4; *frm++ = ic->ic_aselcaps; diff --git a/sys/net80211/ieee80211_radiotap.h b/sys/net80211/ieee80211_radiotap.h index d14945e4809..826d8602a2c 100644 --- a/sys/net80211/ieee80211_radiotap.h +++ b/sys/net80211/ieee80211_radiotap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_radiotap.h,v 1.11 2010/07/17 16:25:09 damien Exp $ */ +/* $OpenBSD: ieee80211_radiotap.h,v 1.12 2015/11/15 01:05:25 stsp Exp $ */ /* $FreeBSD: src/sys/net80211/ieee80211_radiotap.h,v 1.3 2004/04/05 22:13:21 sam Exp $ */ /* $NetBSD: ieee80211_radiotap.h,v 1.9 2004/06/06 04:13:28 dyoung Exp $ */ @@ -196,6 +196,7 @@ enum ieee80211_radiotap_type { #define IEEE80211_CHAN_DYN 0x0400 /* Dynamic CCK-OFDM channel */ #define IEEE80211_CHAN_GFSK 0x0800 /* GFSK channel (FHSS PHY) */ #define IEEE80211_CHAN_XR 0x1000 /* Extended range OFDM channel */ +#define IEEE80211_CHAN_HT 0x2000 /* 11n/HT channel */ #endif /* !_KERNEL */ /* For IEEE80211_RADIOTAP_FLAGS */ diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h index ca95b105da8..eceffc80841 100644 --- a/sys/net80211/ieee80211_var.h +++ b/sys/net80211/ieee80211_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_var.h,v 1.65 2015/11/04 12:12:00 dlg Exp $ */ +/* $OpenBSD: ieee80211_var.h,v 1.66 2015/11/15 01:05:25 stsp Exp $ */ /* $NetBSD: ieee80211_var.h,v 1.7 2004/05/06 03:07:10 dyoung Exp $ */ /*- @@ -72,9 +72,10 @@ 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_TURBO = 4, /* 5GHz, OFDM, 2x clock */ + IEEE80211_MODE_11N = 5, /* 11n, 2GHz/5GHz */ }; -#define IEEE80211_MODE_MAX (IEEE80211_MODE_TURBO+1) +#define IEEE80211_MODE_MAX (IEEE80211_MODE_11N+1) enum ieee80211_opmode { IEEE80211_M_STA = 1, /* infrastructure station */ @@ -114,6 +115,7 @@ struct ieee80211_channel { #define IEEE80211_CHAN_PASSIVE 0x0200 /* Only passive scan allowed */ #define IEEE80211_CHAN_DYN 0x0400 /* Dynamic CCK-OFDM channel */ #define IEEE80211_CHAN_XR 0x1000 /* Extended range OFDM channel */ +#define IEEE80211_CHAN_HT 0x2000 /* 11n/HT channel */ /* * Useful combinations of channel characteristics. @@ -143,6 +145,8 @@ struct ieee80211_channel { (((_c)->ic_flags & IEEE80211_CHAN_T) == IEEE80211_CHAN_T) #define IEEE80211_IS_CHAN_TG(_c) \ (((_c)->ic_flags & IEEE80211_CHAN_TG) == IEEE80211_CHAN_TG) +#define IEEE80211_IS_CHAN_N(_c) \ + (((_c)->ic_flags & IEEE80211_CHAN_HT) == IEEE80211_CHAN_HT) #define IEEE80211_IS_CHAN_2GHZ(_c) \ (((_c)->ic_flags & IEEE80211_CHAN_2GHZ) != 0) @@ -313,12 +317,17 @@ struct ieee80211com { u_int ic_dtim_period; u_int ic_dtim_count; +#ifndef IEEE80211_NO_HT u_int32_t ic_txbfcaps; u_int16_t ic_htcaps; + u_int8_t ic_sup_mcs[howmany(80, NBBY)]; + u_int16_t ic_max_rxrate; /* in Mb/s, 0 <= rate <= 1023 */ + u_int8_t ic_tx_mcs_set; u_int16_t ic_htxcaps; u_int8_t ic_aselcaps; - u_int8_t ic_sup_mcs[16]; u_int8_t ic_dialog_token; + int ic_fixed_mcs; +#endif LIST_HEAD(, ieee80211_vap) ic_vaps; }; |