Index: dev/usb/wlan/if_run.c =================================================================== --- dev/usb/wlan/if_run.c +++ dev/usb/wlan/if_run.c @@ -808,6 +812,19 @@ IEEE80211_C_WME | /* WME */ IEEE80211_C_WPA; /* WPA1|WPA2(RSN) */ +#ifdef IF_RUN_11N + /* set device HT capabilities */ + /* HT Capabilities strictly for 11ng (we dont support 11ac yet..) */ + + // hardcoded for now (pcap from rt2x00) + // These can be converted to the actual bitset using IEEE80211_HTC_XXX + uint16_t cap80211 = 0x03fe; + + ic->ic_htcaps = + IEEE80211_HTC_HT | IEEE80211_HTC_AMPDU | IEEE80211_HTC_RXMCS32 | cap80211; + ic->ic_rxstream = 3; + ic->ic_txstream = 3; +#endif ic->ic_cryptocaps = IEEE80211_CRYPTO_WEP | IEEE80211_CRYPTO_AES_CCM | @@ -972,6 +1007,11 @@ vap->iv_update_beacon = run_update_beacon; vap->iv_max_aid = RT2870_WCID_MAX; +#ifdef IF_RUN_11N + vap->iv_ampdu_rxmax = IEEE80211_HTCAP_MAXRXAMPDU_64K; + vap->iv_ampdu_density = IEEE80211_HTCAP_MPDUDENSITY_2; +#endif + /* * To delete the right key from h/w, we need wcid. * Luckily, there is unused space in ieee80211_key{}, wk_pad, @@ -4847,11 +4889,19 @@ { struct run_softc *sc = ic->ic_softc; uint8_t bands[IEEE80211_MODE_BYTES]; + int ht40 = 0; memset(bands, 0, sizeof(bands)); + +#ifdef IF_RUN_11N + setbit(bands, IEEE80211_MODE_11NG); + setbit(bands, IEEE80211_MODE_11G); + ht40 = 1; +#else setbit(bands, IEEE80211_MODE_11B); setbit(bands, IEEE80211_MODE_11G); - ieee80211_add_channels_default_2ghz(chans, maxchans, nchans, bands, 0); +#endif + ieee80211_add_channels_default_2ghz(chans, maxchans, nchans, bands, ht40); if (sc->rf_rev == RT2860_RF_2750 || sc->rf_rev == RT2860_RF_2850 || sc->rf_rev == RT3070_RF_3052 || sc->rf_rev == RT3593_RF_3053 || @@ -4858,7 +4908,7 @@ sc->rf_rev == RT5592_RF_5592) { setbit(bands, IEEE80211_MODE_11A); ieee80211_add_channel_list_5ghz(chans, maxchans, nchans, - run_chan_5ghz, nitems(run_chan_5ghz), bands, 0); + run_chan_5ghz, nitems(run_chan_5ghz), bands, ht40); } } Index: net80211/ieee80211_ht.c =================================================================== --- net80211/ieee80211_ht.c +++ net80211/ieee80211_ht.c @@ -2994,8 +2992,14 @@ txparams |= (ic->ic_txstream - 1) << 2; /* num TX streams */ if (ic->ic_htcaps & IEEE80211_HTC_TXUNEQUAL) txparams |= 0x16; /* TX unequal modulation sup */ - } else - txparams = 0; + } else { + /* lrx337 XXX: This was 0, but changed to 1 in order to mimic rt2x00 behavior. + Shouldn't this if else block take into consideration other htcaps like + IEEE80211_HTC_TXMCS32 for setting txparams = 0x1 and then check if the + num streams are equal for TX RX MCS not equal (is it enough to check the + num rx / tx streams to conclude that MCS sets are unequal?). */ + txparams = 0x1; + } frm[12] = txparams; } Index: net80211/ieee80211_output.c =================================================================== --- net80211/ieee80211_output.c +++ net80211/ieee80211_output.c @@ -2415,6 +2415,18 @@ frm = ieee80211_add_htcap_ch(frm, vap, c); } + if ((vap->iv_opmode == IEEE80211_M_STA) && (vap->iv_flags_ht & IEEE80211_FHT_HT)) { + struct ieee80211_channel *c; + + /* + * Get the HT channel that we should try upgrading to. + * If we can do 40MHz then this'll upgrade it appropriately. + */ + c = ieee80211_ht_adjust_channel(ic, ic->ic_curchan, + vap->iv_flags_ht); + frm = ieee80211_add_htcap_ch(frm, vap, c); + } + /* * XXX TODO: need to figure out what/how to update the * VHT channel. Index: sys/conf/NOTES =================================================================== --- sys/conf/NOTES +++ sys/conf/NOTES @@ -2899,3 +2899,6 @@ # Kernel support for stats(3). options STATS + +# Enable (experimental) 11n support for the run(4) driver +options IF_RUN_11N Index: sys/conf/options =================================================================== --- sys/conf/options +++ sys/conf/options @@ -1035,3 +1035,6 @@ # gcov support GCOV opt_global.h LINDEBUGFS + +# 11n support for run(4) driver +IF_RUN_11N opt_run_11n.h