sta_info.c (6f7a8d26e2668e00de524d3da0122a4411047dd2) sta_info.c (2b9a7e1bac24df8ddb0713ad1e5807a7243bcab0)
1/*
2 * Copyright 2002-2005, Instant802 Networks, Inc.
3 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
4 * Copyright 2013-2014 Intel Mobile Communications GmbH
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.

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

1741}
1742
1743void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
1744{
1745 struct ieee80211_sub_if_data *sdata = sta->sdata;
1746 struct ieee80211_local *local = sdata->local;
1747 struct rate_control_ref *ref = NULL;
1748 struct timespec uptime;
1/*
2 * Copyright 2002-2005, Instant802 Networks, Inc.
3 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
4 * Copyright 2013-2014 Intel Mobile Communications GmbH
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.

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

1741}
1742
1743void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
1744{
1745 struct ieee80211_sub_if_data *sdata = sta->sdata;
1746 struct ieee80211_local *local = sdata->local;
1747 struct rate_control_ref *ref = NULL;
1748 struct timespec uptime;
1749 u64 packets = 0;
1750 u32 thr = 0;
1751 int i, ac;
1752
1753 if (test_sta_flag(sta, WLAN_STA_RATE_CONTROL))
1754 ref = local->rate_ctrl;
1755
1756 sinfo->generation = sdata->local->sta_generation;
1757
1749 u32 thr = 0;
1750 int i, ac;
1751
1752 if (test_sta_flag(sta, WLAN_STA_RATE_CONTROL))
1753 ref = local->rate_ctrl;
1754
1755 sinfo->generation = sdata->local->sta_generation;
1756
1758 sinfo->filled = STATION_INFO_INACTIVE_TIME |
1759 STATION_INFO_RX_BYTES64 |
1760 STATION_INFO_TX_BYTES64 |
1761 STATION_INFO_RX_PACKETS |
1762 STATION_INFO_TX_PACKETS |
1763 STATION_INFO_TX_RETRIES |
1764 STATION_INFO_TX_FAILED |
1765 STATION_INFO_TX_BITRATE |
1766 STATION_INFO_RX_BITRATE |
1767 STATION_INFO_RX_DROP_MISC |
1768 STATION_INFO_BSS_PARAM |
1769 STATION_INFO_CONNECTED_TIME |
1770 STATION_INFO_STA_FLAGS |
1771 STATION_INFO_BEACON_LOSS_COUNT;
1757 drv_sta_statistics(local, sdata, &sta->sta, sinfo);
1772
1758
1759 sinfo->filled |= STATION_INFO_INACTIVE_TIME |
1760 STATION_INFO_STA_FLAGS |
1761 STATION_INFO_BSS_PARAM |
1762 STATION_INFO_CONNECTED_TIME |
1763 STATION_INFO_RX_DROP_MISC |
1764 STATION_INFO_BEACON_LOSS_COUNT;
1765
1773 ktime_get_ts(&uptime);
1774 sinfo->connected_time = uptime.tv_sec - sta->last_connected;
1766 ktime_get_ts(&uptime);
1767 sinfo->connected_time = uptime.tv_sec - sta->last_connected;
1775
1776 sinfo->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx);
1768 sinfo->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx);
1777 sinfo->tx_bytes = 0;
1778 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
1779 sinfo->tx_bytes += sta->tx_bytes[ac];
1780 packets += sta->tx_packets[ac];
1769
1770 if (!(sinfo->filled & (STATION_INFO_TX_BYTES64 |
1771 STATION_INFO_TX_BYTES))) {
1772 sinfo->tx_bytes = 0;
1773 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++)
1774 sinfo->tx_bytes += sta->tx_bytes[ac];
1775 sinfo->filled |= STATION_INFO_TX_BYTES64;
1781 }
1776 }
1782 sinfo->tx_packets = packets;
1783 sinfo->rx_bytes = sta->rx_bytes;
1784 sinfo->rx_packets = sta->rx_packets;
1785 sinfo->tx_retries = sta->tx_retry_count;
1786 sinfo->tx_failed = sta->tx_retry_failed;
1777
1778 if (!(sinfo->filled & STATION_INFO_TX_PACKETS)) {
1779 sinfo->tx_packets = 0;
1780 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++)
1781 sinfo->tx_packets += sta->tx_packets[ac];
1782 sinfo->filled |= STATION_INFO_TX_PACKETS;
1783 }
1784
1785 if (!(sinfo->filled & (STATION_INFO_RX_BYTES64 |
1786 STATION_INFO_RX_BYTES))) {
1787 sinfo->rx_bytes = sta->rx_bytes;
1788 sinfo->filled |= STATION_INFO_RX_BYTES64;
1789 }
1790
1791 if (!(sinfo->filled & STATION_INFO_RX_PACKETS)) {
1792 sinfo->rx_packets = sta->rx_packets;
1793 sinfo->filled |= STATION_INFO_RX_PACKETS;
1794 }
1795
1796 if (!(sinfo->filled & STATION_INFO_TX_RETRIES)) {
1797 sinfo->tx_retries = sta->tx_retry_count;
1798 sinfo->filled |= STATION_INFO_TX_RETRIES;
1799 }
1800
1801 if (!(sinfo->filled & STATION_INFO_TX_FAILED)) {
1802 sinfo->tx_failed = sta->tx_retry_failed;
1803 sinfo->filled |= STATION_INFO_TX_FAILED;
1804 }
1805
1787 sinfo->rx_dropped_misc = sta->rx_dropped;
1788 sinfo->beacon_loss_count = sta->beacon_loss_count;
1789
1790 if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) ||
1791 (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) {
1806 sinfo->rx_dropped_misc = sta->rx_dropped;
1807 sinfo->beacon_loss_count = sta->beacon_loss_count;
1808
1809 if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) ||
1810 (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) {
1792 sinfo->filled |= STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG;
1793 if (!local->ops->get_rssi ||
1794 drv_get_rssi(local, sdata, &sta->sta, &sinfo->signal))
1811 if (!(sinfo->filled & STATION_INFO_SIGNAL)) {
1795 sinfo->signal = (s8)sta->last_signal;
1812 sinfo->signal = (s8)sta->last_signal;
1796 sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal);
1813 sinfo->filled |= STATION_INFO_SIGNAL;
1814 }
1815
1816 if (!(sinfo->filled & STATION_INFO_SIGNAL_AVG)) {
1817 sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal);
1818 sinfo->filled |= STATION_INFO_SIGNAL_AVG;
1819 }
1797 }
1820 }
1798 if (sta->chains) {
1821
1822 if (sta->chains &&
1823 !(sinfo->filled & (STATION_INFO_CHAIN_SIGNAL |
1824 STATION_INFO_CHAIN_SIGNAL_AVG))) {
1799 sinfo->filled |= STATION_INFO_CHAIN_SIGNAL |
1800 STATION_INFO_CHAIN_SIGNAL_AVG;
1801
1802 sinfo->chains = sta->chains;
1803 for (i = 0; i < ARRAY_SIZE(sinfo->chain_signal); i++) {
1804 sinfo->chain_signal[i] = sta->chain_signal_last[i];
1805 sinfo->chain_signal_avg[i] =
1806 (s8) -ewma_read(&sta->chain_signal_avg[i]);
1807 }
1808 }
1809
1825 sinfo->filled |= STATION_INFO_CHAIN_SIGNAL |
1826 STATION_INFO_CHAIN_SIGNAL_AVG;
1827
1828 sinfo->chains = sta->chains;
1829 for (i = 0; i < ARRAY_SIZE(sinfo->chain_signal); i++) {
1830 sinfo->chain_signal[i] = sta->chain_signal_last[i];
1831 sinfo->chain_signal_avg[i] =
1832 (s8) -ewma_read(&sta->chain_signal_avg[i]);
1833 }
1834 }
1835
1810 sta_set_rate_info_tx(sta, &sta->last_tx_rate, &sinfo->txrate);
1811 sta_set_rate_info_rx(sta, &sinfo->rxrate);
1836 if (!(sinfo->filled & STATION_INFO_TX_BITRATE)) {
1837 sta_set_rate_info_tx(sta, &sta->last_tx_rate, &sinfo->txrate);
1838 sinfo->filled |= STATION_INFO_TX_BITRATE;
1839 }
1812
1840
1841 if (!(sinfo->filled & STATION_INFO_RX_BITRATE)) {
1842 sta_set_rate_info_rx(sta, &sinfo->rxrate);
1843 sinfo->filled |= STATION_INFO_RX_BITRATE;
1844 }
1845
1813 if (ieee80211_vif_is_mesh(&sdata->vif)) {
1814#ifdef CONFIG_MAC80211_MESH
1815 sinfo->filled |= STATION_INFO_LLID |
1816 STATION_INFO_PLID |
1817 STATION_INFO_PLINK_STATE |
1818 STATION_INFO_LOCAL_PM |
1819 STATION_INFO_PEER_PM |
1820 STATION_INFO_NONPEER_PM;

--- 58 unchanged lines hidden ---
1846 if (ieee80211_vif_is_mesh(&sdata->vif)) {
1847#ifdef CONFIG_MAC80211_MESH
1848 sinfo->filled |= STATION_INFO_LLID |
1849 STATION_INFO_PLID |
1850 STATION_INFO_PLINK_STATE |
1851 STATION_INFO_LOCAL_PM |
1852 STATION_INFO_PEER_PM |
1853 STATION_INFO_NONPEER_PM;

--- 58 unchanged lines hidden ---