mwifiex: maintain station statistic in uap mode
authorXinming Hu <huxm@marvell.com>
Wed, 3 Jun 2015 11:29:38 +0000 (16:59 +0530)
committerKalle Valo <kvalo@codeaurora.org>
Mon, 8 Jun 2015 08:41:52 +0000 (11:41 +0300)
This patch maintain statistic information for the stations associated
to the mwifiex micro AP, include tx/rx bytes/packets, signal strength,
tx bitrate.

Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/mwifiex/fw.h
drivers/net/wireless/mwifiex/main.h
drivers/net/wireless/mwifiex/txrx.c
drivers/net/wireless/mwifiex/uap_txrx.c
drivers/net/wireless/mwifiex/util.c

index 45822a8..b6bbf9a 100644 (file)
@@ -632,7 +632,12 @@ struct uap_rxpd {
        __le16 rx_pkt_type;
        __le16 seq_num;
        u8 priority;
-       u8 reserved1;
+       u8 rx_rate;
+       s8 snr;
+       s8 nf;
+       u8 ht_info;
+       u8 reserved[3];
+       u8 flags;
 };
 
 struct mwifiex_fw_chan_stats {
index 88d3779..837e610 100644 (file)
@@ -741,6 +741,18 @@ struct mwifiex_tdls_capab {
        struct ieee80211_vht_operation vhtoper;
 };
 
+struct mwifiex_station_stats {
+       u64 last_rx;
+       s8 rssi;
+       u64 rx_bytes;
+       u64 tx_bytes;
+       u32 rx_packets;
+       u32 tx_packets;
+       u32 tx_failed;
+       u8 last_tx_rate;
+       u8 last_tx_htinfo;
+};
+
 /* This is AP/TDLS specific structure which stores information
  * about associated/peer STA
  */
@@ -755,6 +767,7 @@ struct mwifiex_sta_node {
        u16 max_amsdu;
        u8 tdls_status;
        struct mwifiex_tdls_capab tdls_cap;
+       struct mwifiex_station_stats stats;
 };
 
 struct mwifiex_auto_tdls_peer {
index 28dcc84..c4c7d8d 100644 (file)
@@ -88,13 +88,22 @@ int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb,
        struct mwifiex_adapter *adapter = priv->adapter;
        u8 *head_ptr;
        struct txpd *local_tx_pd = NULL;
+       struct mwifiex_sta_node *dest_node;
+       struct ethhdr *hdr = (void *)skb->data;
 
        hroom = (adapter->iface_type == MWIFIEX_USB) ? 0 : INTF_HEADER_LEN;
 
-       if (priv->bss_role == MWIFIEX_BSS_ROLE_UAP)
+       if (priv->bss_role == MWIFIEX_BSS_ROLE_UAP) {
+               dest_node = mwifiex_get_sta_entry(priv, hdr->h_dest);
+               if (dest_node) {
+                       dest_node->stats.tx_bytes += skb->len;
+                       dest_node->stats.tx_packets++;
+               }
+
                head_ptr = mwifiex_process_uap_txpd(priv, skb);
-       else
+       } else {
                head_ptr = mwifiex_process_sta_txpd(priv, skb);
+       }
 
        if ((adapter->data_sent || adapter->tx_lock_flag) && head_ptr) {
                skb_queue_tail(&adapter->tx_data_q, skb);
Simple merge