rtlwifi: Set retry limit depends on vif type.
authorPing-Ke Shih <pkshih@realtek.com>
Tue, 7 Feb 2017 03:29:59 +0000 (21:29 -0600)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 7 Feb 2017 07:25:08 +0000 (09:25 +0200)
We assign different retry limit according to vif type, because
it can boost performance in field.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: shaofu <shaofu@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/realtek/rtlwifi/core.c
drivers/net/wireless/realtek/rtlwifi/pci.c
drivers/net/wireless/realtek/rtlwifi/ps.c

index 179a699cc6acbe417149e7ae785798729e11a1ec..a4f8e326a2bc171cd4c00bed64d24c240b5c3ee7 100644 (file)
@@ -233,6 +233,7 @@ static int rtl_op_add_interface(struct ieee80211_hw *hw,
        struct rtl_priv *rtlpriv = rtl_priv(hw);
        struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
        int err = 0;
+       u8 retry_limit = 0x30;
 
        if (mac->vif) {
                RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
@@ -271,6 +272,7 @@ static int rtl_op_add_interface(struct ieee80211_hw *hw,
                rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_BASIC_RATE,
                                (u8 *)(&mac->basic_rates));
 
+               retry_limit = 0x07;
                break;
        case NL80211_IFTYPE_P2P_GO:
                mac->p2p = P2P_ROLE_GO;
@@ -287,6 +289,8 @@ static int rtl_op_add_interface(struct ieee80211_hw *hw,
                        mac->basic_rates = 0xff0;
                rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_BASIC_RATE,
                                              (u8 *)(&mac->basic_rates));
+
+               retry_limit = 0x07;
                break;
        case NL80211_IFTYPE_MESH_POINT:
                RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD,
@@ -300,6 +304,8 @@ static int rtl_op_add_interface(struct ieee80211_hw *hw,
                        mac->basic_rates = 0xff0;
                rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_BASIC_RATE,
                                (u8 *)(&mac->basic_rates));
+
+               retry_limit = 0x07;
                break;
        default:
                pr_err("operation mode %d is not supported!\n",
@@ -321,6 +327,10 @@ static int rtl_op_add_interface(struct ieee80211_hw *hw,
        memcpy(mac->mac_addr, vif->addr, ETH_ALEN);
        rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_ETHER_ADDR, mac->mac_addr);
 
+       mac->retry_long = retry_limit;
+       mac->retry_short = retry_limit;
+       rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RETRY_LIMIT,
+                       (u8 *)(&retry_limit));
 out:
        mutex_unlock(&rtlpriv->locks.conf_mutex);
        return err;
@@ -645,10 +655,15 @@ static int rtl_op_config(struct ieee80211_hw *hw, u32 changed)
                RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD,
                         "IEEE80211_CONF_CHANGE_RETRY_LIMITS %x\n",
                         hw->conf.long_frame_max_tx_count);
-               mac->retry_long = hw->conf.long_frame_max_tx_count;
-               mac->retry_short = hw->conf.long_frame_max_tx_count;
-               rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RETRY_LIMIT,
+               /* brought up everything changes (changed == ~0) indicates first
+                * open, so use our default value instead of that of wiphy.
+                */
+               if (changed != ~0) {
+                       mac->retry_long = hw->conf.long_frame_max_tx_count;
+                       mac->retry_short = hw->conf.long_frame_max_tx_count;
+                       rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RETRY_LIMIT,
                                (u8 *)(&hw->conf.long_frame_max_tx_count));
+               }
        }
 
        if (changed & IEEE80211_CONF_CHANGE_CHANNEL &&
index b402f438b1af7c091154f69b6e42cf6f32ae7cd4..2e6b888bd417f0aeef5202a231fbbfb9e5ab2652 100644 (file)
@@ -1213,6 +1213,10 @@ static void _rtl_pci_init_struct(struct ieee80211_hw *hw,
        mac->current_ampdu_density = 7;
        mac->current_ampdu_factor = 3;
 
+       /*Retry Limit*/
+       mac->retry_short = 7;
+       mac->retry_long = 7;
+
        /*QOS*/
        rtlpci->acm_method = EACMWAY2_SW;
 
@@ -1813,6 +1817,7 @@ static int rtl_pci_start(struct ieee80211_hw *hw)
        struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
        struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
        struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
+       struct rtl_mac *rtlmac = rtl_mac(rtl_priv(hw));
 
        int err;
 
@@ -1830,6 +1835,8 @@ static int rtl_pci_start(struct ieee80211_hw *hw)
                         "Failed to config hardware!\n");
                return err;
        }
+       rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RETRY_LIMIT,
+                       &rtlmac->retry_long);
 
        rtlpriv->cfg->ops->enable_interrupt(hw);
        RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "enable_interrupt OK\n");
index 4f8327097086627fd751f95d6b1c4918c0cb4269..0d152877d9698e47e222d7509179855f3f43c0d1 100644 (file)
@@ -34,6 +34,7 @@ bool rtl_ps_enable_nic(struct ieee80211_hw *hw)
        struct rtl_priv *rtlpriv = rtl_priv(hw);
        struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
        struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
+       struct rtl_mac *rtlmac = rtl_mac(rtl_priv(hw));
 
        /*<1> reset trx ring */
        if (rtlhal->interface == INTF_PCI)
@@ -46,6 +47,8 @@ bool rtl_ps_enable_nic(struct ieee80211_hw *hw)
        /*<2> Enable Adapter */
        if (rtlpriv->cfg->ops->hw_init(hw))
                return false;
+       rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RETRY_LIMIT,
+                       &rtlmac->retry_long);
        RT_CLEAR_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC);
 
        /*<3> Enable Interrupt */