iwlwifi: mvm: fix statistics variables type
authorSara Sharon <sara.sharon@intel.com>
Thu, 20 Aug 2015 11:12:58 +0000 (14:12 +0300)
committerLuciano Coelho <luciano.coelho@intel.com>
Fri, 28 Aug 2015 10:26:32 +0000 (13:26 +0300)
When receiving statistics notification there is a field of average energy.
This is defines as signed 8 bit, while FW refers to it as unsigned.
when the energy is higher than 127 this causes in iwl_mvm_stat_iterator
a wrong computation of the signal
     int sig = -stats->general.beacon_filter_average_energy;
resulting in incorrect CQM event (change from low to high).

While at it - update the rest of the fields to the correct type.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
drivers/net/wireless/iwlwifi/mvm/fw-api-stats.h
drivers/net/wireless/iwlwifi/mvm/mvm.h
drivers/net/wireless/iwlwifi/mvm/rx.c

index 709e28d8b1b09634aa1e427a2544ae0ea669df59..4ca4bceb95a43ed0bd3c8f023a11bb925eb268ad 100644 (file)
@@ -237,10 +237,10 @@ struct mvm_statistics_general_v5 {
        __le32 num_of_sos_states;
        __le32 beacon_filtered;
        __le32 missed_beacons;
-       __s8 beacon_filter_average_energy;
-       __s8 beacon_filter_reason;
-       __s8 beacon_filter_current_energy;
-       __s8 beacon_filter_reserved;
+       u8 beacon_filter_average_energy;
+       u8 beacon_filter_reason;
+       u8 beacon_filter_current_energy;
+       u8 beacon_filter_reserved;
        __le32 beacon_filter_delta_time;
        struct mvm_statistics_bt_activity bt_activity;
 } __packed; /* STATISTICS_GENERAL_API_S_VER_5 */
@@ -263,10 +263,10 @@ struct mvm_statistics_general_v8 {
        __le32 num_of_sos_states;
        __le32 beacon_filtered;
        __le32 missed_beacons;
-       __s8 beacon_filter_average_energy;
-       __s8 beacon_filter_reason;
-       __s8 beacon_filter_current_energy;
-       __s8 beacon_filter_reserved;
+       u8 beacon_filter_average_energy;
+       u8 beacon_filter_reason;
+       u8 beacon_filter_current_energy;
+       u8 beacon_filter_reserved;
        __le32 beacon_filter_delta_time;
        struct mvm_statistics_bt_activity bt_activity;
        __le64 rx_time;
index b95a07ec9e362bf031f960dee35dc52c97221ed0..72cd67eab06ff78833eb96577d779b18eeb9c9b2 100644 (file)
@@ -323,11 +323,11 @@ enum iwl_bt_force_ant_mode {
 struct iwl_mvm_vif_bf_data {
        bool bf_enabled;
        bool ba_enabled;
-       s8 ave_beacon_signal;
-       s8 last_cqm_event;
-       s8 bt_coex_min_thold;
-       s8 bt_coex_max_thold;
-       s8 last_bt_coex_event;
+       int ave_beacon_signal;
+       int last_cqm_event;
+       int bt_coex_min_thold;
+       int bt_coex_max_thold;
+       int last_bt_coex_event;
 };
 
 /**
index c37c10a423ce16b985ce620d2162d58c9c736fad..2ad814df0b3cf45127be781ca7a39148ba32cca3 100644 (file)
@@ -459,7 +459,7 @@ static void iwl_mvm_update_rx_statistics(struct iwl_mvm *mvm,
 struct iwl_mvm_stat_data {
        struct iwl_mvm *mvm;
        __le32 mac_id;
-       __s8 beacon_filter_average_energy;
+       u8 beacon_filter_average_energy;
        struct mvm_statistics_general_v8 *general;
 };