Files
android_kernel_samsung_sm86…/dp/inc/dp_rate_stats_pub.h
Amir Patel c87166665a qca-wifi: Fix zero rate index issue in peer rate stats
Rate index zero (representing 11 Mbps in ratetable) was ignored in current
stats implementation. Added code changes to include zero rate index

Some formatting is done in peerstats app to avoid exceeding 80 chars

CRs-Fixed: 2424176
Change-Id: I9d6938cc840ee3db3639b3608b429a97832c3168
2019-04-15 05:07:45 -07:00

127 lines
3.5 KiB
C

/*
* Copyright (c) 2019 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* @file: dp_rate_stats_pub.h
* @breief: Define peer rate statistics related objects and APIs
* accessed required for user space tools
*/
#ifndef _DP_RATE_STATS_UAPI_
#define _DP_RATE_STATS_UAPI_
#define WLANSTATS_CACHE_SIZE 10
#define MAX_RSSI_ANT 4
#define MAX_RSSI_HT 4
#define WLAN_DATA_TID_MAX 8
#define WLAN_MAC_ADDR_LEN 6
#define WLANSTATS_RSSI_OFFSET 8
#define WLANSTATS_RSSI_MASK 0xff
#define WLANSTATS_RSSI_MAX 0x80
#define INVALID_CACHE_IDX (-1)
#ifndef __KERNEL__
#define qdf_ewma_tx_lag unsigned long
#define qdf_ewma_rx_rssi unsigned long
#else
#include <cdp_txrx_cmn_struct.h>
QDF_DECLARE_EWMA(rx_rssi, 1024, 8)
#endif
/**
* enum cdp_peer_rate_stats_cmd -
* used by app to get specific stats
*/
enum wlan_peer_rate_stats_cmd {
DP_PEER_RX_RATE_STATS,
DP_PEER_TX_RATE_STATS,
DP_PEER_SOJOURN_STATS,
};
/** struct wlan_tx_rate_stats - Tx packet rate info
* @rix: Rate index derived from nss, mcs, preamble, ht, sgi
* @rate: Data rate in kbps
* @mpdu_success: success mpdus count
* @mpdu_attempts: attempt mpdus count
* @num_ppdus: ppdu count
*/
struct wlan_tx_rate_stats {
uint32_t rix;
uint32_t rate;
uint32_t mpdu_success;
uint32_t mpdu_attempts;
uint32_t num_ppdus;
};
/** struct wlan_rx_rate_stats - Rx rate packet info
* @rix: Rate index derived from nss, mcs, preamble, ht, sgi
* @rate: Data rate in kbps
* @num_bytes: num of bytes
* @num_msdus: num of msdus
* @num_mpdus: num of mpdus
* @num_ppdus: num of ppdus
* @num_retries: num of retries
* @num_sgi: num of short guard interval
*/
struct wlan_rx_rate_stats {
uint32_t rix;
uint32_t rate;
uint32_t num_bytes;
uint32_t num_msdus;
uint32_t num_mpdus;
uint32_t num_ppdus;
uint32_t num_retries;
uint32_t num_sgi;
qdf_ewma_rx_rssi avg_rssi;
qdf_ewma_rx_rssi avg_rssi_ant[MAX_RSSI_ANT][MAX_RSSI_HT];
};
/*
* struct wlan_tx_sojourn_stats - Tx sojourn stats
* @ppdu_seq_id: ppdu_seq_id from tx completion
* @avg_sojourn_msdu: average sojourn msdu time
* @sum_sojourn_msdu: sum sojourn msdu time
* @num_msdu: number of msdus per ppdu
* @cookie: cookie to be used by upper layer
*/
struct wlan_tx_sojourn_stats {
uint32_t ppdu_seq_id;
uint32_t sum_sojourn_msdu[WLAN_DATA_TID_MAX];
uint32_t num_msdus[WLAN_DATA_TID_MAX];
void *cookie;
qdf_ewma_tx_lag avg_sojourn_msdu[WLAN_DATA_TID_MAX];
};
/**
* struct wlan_peer_rate_stats_intf - Interface structure to
* flush stats to user spave entity
* @stats: statistics buffer
* @buf_len: buffer len
* @peer_mac: peer mac address
* @stats_type: statistics type
* @cookie: peer cookie
*/
struct wlan_peer_rate_stats_intf {
void *stats;
uint32_t buf_len;
uint8_t peer_mac[WLAN_MAC_ADDR_LEN];
uint8_t stats_type;
uint64_t cookie;
};
#endif /* _DP_RATE_STATS_UAPI_ */