rtlwifi: Add missing code to PWDB statics routine
authorLarry Finger <Larry.Finger@lwfinger.net>
Mon, 18 Nov 2013 17:11:35 +0000 (11:11 -0600)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 5 Dec 2013 19:55:20 +0000 (14:55 -0500)
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Stable <stable@vger.kernel.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rtlwifi/stats.c

index 8ed3174..4f083fc 100644 (file)
@@ -176,6 +176,7 @@ static void rtl_process_pwdb(struct ieee80211_hw *hw, struct rtl_stats *pstatus)
        struct rtl_sta_info *drv_priv = NULL;
        struct ieee80211_sta *sta = NULL;
        long undec_sm_pwdb;
+       long undec_sm_cck;
 
        rcu_read_lock();
        if (rtlpriv->mac80211.opmode != NL80211_IFTYPE_STATION)
@@ -185,12 +186,16 @@ static void rtl_process_pwdb(struct ieee80211_hw *hw, struct rtl_stats *pstatus)
        if (sta) {
                drv_priv = (struct rtl_sta_info *) sta->drv_priv;
                undec_sm_pwdb = drv_priv->rssi_stat.undec_sm_pwdb;
+               undec_sm_cck = drv_priv->rssi_stat.undec_sm_cck;
        } else {
                undec_sm_pwdb = rtlpriv->dm.undec_sm_pwdb;
+               undec_sm_cck = rtlpriv->dm.undec_sm_cck;
        }
 
        if (undec_sm_pwdb < 0)
                undec_sm_pwdb = pstatus->rx_pwdb_all;
+       if (undec_sm_cck < 0)
+               undec_sm_cck = pstatus->rx_pwdb_all;
        if (pstatus->rx_pwdb_all > (u32) undec_sm_pwdb) {
                undec_sm_pwdb = (((undec_sm_pwdb) *
                      (RX_SMOOTH_FACTOR - 1)) +
@@ -200,6 +205,15 @@ static void rtl_process_pwdb(struct ieee80211_hw *hw, struct rtl_stats *pstatus)
                undec_sm_pwdb = (((undec_sm_pwdb) * (RX_SMOOTH_FACTOR - 1)) +
                     (pstatus->rx_pwdb_all)) / (RX_SMOOTH_FACTOR);
        }
+       if (pstatus->rx_pwdb_all > (u32) undec_sm_cck) {
+               undec_sm_cck = (((undec_sm_pwdb) *
+                     (RX_SMOOTH_FACTOR - 1)) +
+                    (pstatus->rx_pwdb_all)) / (RX_SMOOTH_FACTOR);
+               undec_sm_cck = undec_sm_cck + 1;
+       } else {
+               undec_sm_pwdb = (((undec_sm_cck) * (RX_SMOOTH_FACTOR - 1)) +
+                    (pstatus->rx_pwdb_all)) / (RX_SMOOTH_FACTOR);
+       }
 
        if (sta) {
                drv_priv->rssi_stat.undec_sm_pwdb = undec_sm_pwdb;