1: eb93ea524cc7 ! 1: 96c920b08ab4 wifi: rt2x00: start the link tuner when an interface is added @@ Commit message interface, so rt2x00link_start_tuner(), called from rt2x00lib_enable_radio(), finds no station or AP interface and returns.  - Start the link tuner again when an interface is added. + Start the link tuner again when the first interface is added, and stop + it when the last interface is removed.  Fixes: d96324703ffa ("rt2x00: merge agc and vco works with link tuner") Signed-off-by: Ho Jie Feng  @@ drivers/net/wireless/ralink/rt2x00/rt2x00mac.c: int rt2x00mac_add_interface(stru  + * Start the link tuner again if the radio is enabled before the  + * first interface is added.  + */ -+ rt2x00link_start_tuner(rt2x00dev); ++ if (rt2x00dev->intf_ap_count + rt2x00dev->intf_sta_count == 1) ++ rt2x00link_start_tuner(rt2x00dev);  + return 0; } EXPORT_SYMBOL_GPL(rt2x00mac_add_interface); +@@ drivers/net/wireless/ralink/rt2x00/rt2x00mac.c: void rt2x00mac_remove_interface(struct ieee80211_hw *hw, + else + rt2x00dev->intf_sta_count--; +  ++ /* ++ * Stop the link tuner when the last interface is removed. ++ */ ++ if (!rt2x00dev->intf_ap_count && !rt2x00dev->intf_sta_count) ++ rt2x00link_stop_tuner(rt2x00dev); ++ + /* + * Release beacon entry so it is available for + * new interfaces again. 2: 4a4a9f35698b = 2: 5503e17f1d45 wifi: rt2800: calibrate the crystal of RT3593 with the beacons 3: 72a37b7be9e4 < -: ------------ wifi: rt2800: use the 3SS fallback table of RT3883 on RT3593 4: 5642771f928d ! 3: 15a25ec7a91c wifi: rt2800: report the MCS16 to MCS8 fallback of RT3593 in TX status @@ Metadata Author: Ho Jie Feng   ## Commit message ## - wifi: rt2800: report the MCS16 to MCS8 fallback of RT3593 in TX status + wifi: rt2800: make MCS 16 fall back to MCS 8 on devices with 3 TX chains  - The RT3593 retry chain is now MCS 16 to MCS 8, skipping 7 MCS - rates in between. Reflect that in the retry calculation code. + MCS 15 has worse reliability than MCS 16, since 16 and above + are 3 stream rates, and 15 is the top of the 2 stream rates. + Falling back from MCS 16 to MCS 15 does not make sense, so + make the fallback to MCS 8 on all devices with 3 TX chains, + like the Ralink driver does. + + The retry chain is now MCS 16 to MCS 8, skipping 7 MCS rates + in between. Reflect that in the retry calculation code. This + also fixes the retry count on RT3883, which already used this + fallback.  Test results: before after - TX 27.0 29.4 - RX 70.0 70.0 + TX 28.2 29.1 + RX 70.4 70.2  Signed-off-by: Ho Jie Feng   @@ drivers/net/wireless/ralink/rt2x00/rt2800lib.c: void rt2800_txdone_entry(struct txdesc.retry = ((mcs > real_mcs) ? mcs - real_mcs : 0);  +  + /* -+ * On RT3593 MCS16 falls back to MCS8, so a frame that was -+ * sent below MCS16 after a three stream rate skipped MCS9 -+ * to MCS15. ++ * On devices with 3 TX chains MCS16 falls back to MCS8, so a ++ * frame that was sent below MCS16 after a three stream rate ++ * skipped MCS9 to MCS15.  + */ -+ if (rt2x00_rt(rt2x00dev, RT3593) && mcs >= 16 && real_mcs < 16) ++ if (rt2x00_is_3t(rt2x00dev) && mcs >= 16 && real_mcs < 16)  + txdesc.retry -= 7; } else { /* * Transmission failed. The number of retries is +@@ drivers/net/wireless/ralink/rt2x00/rt2800lib.c: static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) + reg = rt2x00_rt(rt2x00dev, RT5592) ? 0x00000082 : 0x00000002; + rt2800_register_write(rt2x00dev, TXOP_HLDR_ET, reg); +  +- if (rt2x00_rt(rt2x00dev, RT3883)) { ++ if (rt2x00_is_3t(rt2x00dev)) { + rt2800_register_write(rt2x00dev, TX_FBK_CFG_3S_0, 0x12111008); + rt2800_register_write(rt2x00dev, TX_FBK_CFG_3S_1, 0x16151413); + } + + ## drivers/net/wireless/ralink/rt2x00/rt2x00.h ## +@@ drivers/net/wireless/ralink/rt2x00/rt2x00.h: static inline bool rt2x00_is_soc(struct rt2x00_dev *rt2x00dev) + return rt2x00_intf(rt2x00dev, RT2X00_CHIP_INTF_SOC); + } +  ++static inline bool rt2x00_is_3t(struct rt2x00_dev *rt2x00dev) ++{ ++ return rt2x00dev->default_ant.tx_chain_num == 3; ++} ++ + /* Helpers for capability flags */ +  + static inline bool  ## drivers/net/wireless/ralink/rt2x00/rt2x00dev.c ##  @@ drivers/net/wireless/ralink/rt2x00/rt2x00dev.c: static void rt2x00lib_fill_tx_status(struct rt2x00_dev *rt2x00dev, @@ drivers/net/wireless/ralink/rt2x00/rt2x00dev.c: static void rt2x00lib_fill_tx_st  + } else if (rate_idx == 16) {  + /*  + * TX_FBK_CFG_3S_0 makes MCS16 fall back to MCS8 on -+ * RT3593, the decrement below shifts it back to 8. ++ * devices with 3 TX chains, the decrement below shifts ++ * it back to 8.  + */ -+ if (rt2x00_rt(rt2x00dev, RT3593) && ++ if (rt2x00_is_3t(rt2x00dev) &&  + (rate_flags & IEEE80211_TX_RC_MCS))  + rate_idx = 9; } 5: db9e2c6eeabc = 4: a849dbe14ded wifi: rt2800: don't report an A-MPDU length to minstrel_ht 6: 13ef41c7a854 ! 5: 0c4eebe3772c wifi: rt2800: set the mac80211 fast-xmit and aggregation flags @@ Metadata Author: Ho Jie Feng   ## Commit message ## - wifi: rt2800: set the mac80211 fast-xmit and aggregation flags + wifi: rt2800: support A-MSDU in A-MPDU  - Enable AMSDU TX/RX support for this driver, which can increase - throughput. + Set SUPPORTS_AMSDU_IN_AMPDU, which can increase throughput.  Signed-off-by: Ho Jie Feng   @@ drivers/net/wireless/ralink/rt2x00/rt2800lib.c: static int rt2800_probe_hw_mode( ieee80211_hw_set(rt2x00dev->hw, SIGNAL_DBM); ieee80211_hw_set(rt2x00dev->hw, SUPPORTS_PS); ieee80211_hw_set(rt2x00dev->hw, TX_STATUS_NO_AMPDU_LEN); -+ ieee80211_hw_set(rt2x00dev->hw, SUPPORT_FAST_XMIT); -+ ieee80211_hw_set(rt2x00dev->hw, TX_AMSDU);  + ieee80211_hw_set(rt2x00dev->hw, SUPPORTS_AMSDU_IN_AMPDU);  /* 7: 0659c52ac9be = 6: 85c8faf9d4b0 wifi: rt2800usb: enable RX bulk aggregation 8: c1872dcde2aa = 7: c37126e5aa78 wifi: rt2x00usb: use a threaded NAPI with GRO for RX