rx.c (3c09ec59cdea5b132212d97154d625fd34e436dd) rx.c (c6bae216907119a39e204a5011bd22e6c816cedb)
1/******************************************************************************
2 *
3 * This file is provided under a dual BSD/GPLv2 license. When using or
4 * redistributing this file, you may do so under either license.
5 *
6 * GPL LICENSE SUMMARY
7 *
8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.

--- 675 unchanged lines hidden (view full) ---

684 return;
685
686 if (le32_to_cpup((__le32 *) (pkt->data + trig_offset)) < trig_thold)
687 return;
688
689 iwl_fw_dbg_collect_trig(&mvm->fwrt, trig, NULL);
690}
691
1/******************************************************************************
2 *
3 * This file is provided under a dual BSD/GPLv2 license. When using or
4 * redistributing this file, you may do so under either license.
5 *
6 * GPL LICENSE SUMMARY
7 *
8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.

--- 675 unchanged lines hidden (view full) ---

684 return;
685
686 if (le32_to_cpup((__le32 *) (pkt->data + trig_offset)) < trig_thold)
687 return;
688
689 iwl_fw_dbg_collect_trig(&mvm->fwrt, trig, NULL);
690}
691
692static void iwl_mvm_update_avg_energy(struct iwl_mvm *mvm,
693 u8 energy[IWL_MVM_STATION_COUNT_MAX])
692static void iwl_mvm_stats_energy_iter(void *_data,
693 struct ieee80211_sta *sta)
694{
694{
695 int i;
695 struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
696 u8 *energy = _data;
697 u32 sta_id = mvmsta->sta_id;
696
698
697 if (WARN_ONCE(mvm->fw->ucode_capa.num_stations >
698 IWL_MVM_STATION_COUNT_MAX,
699 "Driver and FW station count mismatch %d\n",
700 mvm->fw->ucode_capa.num_stations))
699 if (WARN_ONCE(sta_id >= IWL_MVM_STATION_COUNT_MAX, "sta_id %d >= %d",
700 sta_id, IWL_MVM_STATION_COUNT_MAX))
701 return;
702
701 return;
702
703 rcu_read_lock();
704 for (i = 0; i < mvm->fw->ucode_capa.num_stations; i++) {
705 struct iwl_mvm_sta *sta;
703 if (energy[sta_id])
704 mvmsta->avg_energy = energy[sta_id];
706
705
707 if (!energy[i])
708 continue;
709
710 sta = iwl_mvm_sta_from_staid_rcu(mvm, i);
711 if (!sta)
712 continue;
713 sta->avg_energy = energy[i];
714 }
715 rcu_read_unlock();
716}
717
718static void
719iwl_mvm_update_tcm_from_stats(struct iwl_mvm *mvm, __le32 *air_time_le,
720 __le32 *rx_bytes_le)
721{
722 int i;
723

--- 64 unchanged lines hidden (view full) ---

788
789 ieee80211_iterate_active_interfaces(mvm->hw,
790 IEEE80211_IFACE_ITER_NORMAL,
791 iwl_mvm_stat_iterator,
792 &data);
793
794 for (i = 0; i < ARRAY_SIZE(average_energy); i++)
795 average_energy[i] = le32_to_cpu(stats->average_energy[i]);
706}
707
708static void
709iwl_mvm_update_tcm_from_stats(struct iwl_mvm *mvm, __le32 *air_time_le,
710 __le32 *rx_bytes_le)
711{
712 int i;
713

--- 64 unchanged lines hidden (view full) ---

778
779 ieee80211_iterate_active_interfaces(mvm->hw,
780 IEEE80211_IFACE_ITER_NORMAL,
781 iwl_mvm_stat_iterator,
782 &data);
783
784 for (i = 0; i < ARRAY_SIZE(average_energy); i++)
785 average_energy[i] = le32_to_cpu(stats->average_energy[i]);
796 iwl_mvm_update_avg_energy(mvm, average_energy);
797
786 ieee80211_iterate_stations_atomic(mvm->hw, iwl_mvm_stats_energy_iter,
787 average_energy);
798 /*
799 * Don't update in case the statistics are not cleared, since
800 * we will end up counting twice the same airtime, once in TCM
801 * request and once in statistics notification.
802 */
803 if (le32_to_cpu(flags) & IWL_STATISTICS_REPLY_FLG_CLEAR)
804 iwl_mvm_update_tcm_from_stats(mvm, stats->air_time,
805 stats->rx_bytes);

--- 93 unchanged lines hidden (view full) ---

899 air_time = (void *)&v11->load_stats.air_time;
900 } else {
901 struct iwl_notif_statistics *stats = (void *)&pkt->data;
902
903 energy = (void *)&stats->load_stats.avg_energy;
904 bytes = (void *)&stats->load_stats.byte_count;
905 air_time = (void *)&stats->load_stats.air_time;
906 }
788 /*
789 * Don't update in case the statistics are not cleared, since
790 * we will end up counting twice the same airtime, once in TCM
791 * request and once in statistics notification.
792 */
793 if (le32_to_cpu(flags) & IWL_STATISTICS_REPLY_FLG_CLEAR)
794 iwl_mvm_update_tcm_from_stats(mvm, stats->air_time,
795 stats->rx_bytes);

--- 93 unchanged lines hidden (view full) ---

889 air_time = (void *)&v11->load_stats.air_time;
890 } else {
891 struct iwl_notif_statistics *stats = (void *)&pkt->data;
892
893 energy = (void *)&stats->load_stats.avg_energy;
894 bytes = (void *)&stats->load_stats.byte_count;
895 air_time = (void *)&stats->load_stats.air_time;
896 }
897 ieee80211_iterate_stations_atomic(mvm->hw, iwl_mvm_stats_energy_iter,
898 energy);
907
899
908 iwl_mvm_update_avg_energy(mvm, energy);
909
910 /*
911 * Don't update in case the statistics are not cleared, since
912 * we will end up counting twice the same airtime, once in TCM
913 * request and once in statistics notification.
914 */
915 if (le32_to_cpu(flags) & IWL_STATISTICS_REPLY_FLG_CLEAR)
916 iwl_mvm_update_tcm_from_stats(mvm, air_time, bytes);
917

--- 54 unchanged lines hidden ---
900 /*
901 * Don't update in case the statistics are not cleared, since
902 * we will end up counting twice the same airtime, once in TCM
903 * request and once in statistics notification.
904 */
905 if (le32_to_cpu(flags) & IWL_STATISTICS_REPLY_FLG_CLEAR)
906 iwl_mvm_update_tcm_from_stats(mvm, air_time, bytes);
907

--- 54 unchanged lines hidden ---