mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-15 01:01:56 -04:00
qcacld-3.0: Replace typedef tSirWifiPeerInfo
The Linux Coding Style enumerates a few special cases where typedefs are useful, but stresses "NEVER EVER use a typedef unless you can clearly match one of those rules." The tSirWifiPeerInfo typedef does not meet any of those criteria, so replace it (and the "tp" variant) with a properly named struct. In addition the Linux Coding Style frowns upon mixed-case names so rename the members which are currently not compliant. Change-Id: I1b4c872efc895e048184ea3e589dfd8ad3efab15 CRs-Fixed: 2427167
This commit is contained in:
parent
d3b3b11104
commit
1049503cbf
4 changed files with 46 additions and 44 deletions
|
|
@ -155,7 +155,7 @@ void hdd_debugfs_process_iface_stats(struct hdd_adapter *adapter,
|
|||
void hdd_debugfs_process_peer_stats(struct hdd_adapter *adapter, void *data)
|
||||
{
|
||||
tpSirWifiPeerStat peer_stat;
|
||||
tpSirWifiPeerInfo peer_info;
|
||||
struct wifi_peer_info *peer_info;
|
||||
struct wifi_rate_stat *rate_stat;
|
||||
int i, j, num_rate;
|
||||
ssize_t len = 0;
|
||||
|
|
@ -178,7 +178,7 @@ void hdd_debugfs_process_peer_stats(struct hdd_adapter *adapter, void *data)
|
|||
"\n\n===LL_STATS_PEER_ALL : num_peers %u===",
|
||||
peer_stat->numPeers);
|
||||
|
||||
peer_info = (tpSirWifiPeerInfo) ((uint8_t *) peer_stat->peerInfo);
|
||||
peer_info = (struct wifi_peer_info *) ((uint8_t *) peer_stat->peerInfo);
|
||||
for (i = 1; i <= peer_stat->numPeers; i++) {
|
||||
buffer += len;
|
||||
ll_stats.len += len;
|
||||
|
|
@ -186,12 +186,12 @@ void hdd_debugfs_process_peer_stats(struct hdd_adapter *adapter, void *data)
|
|||
DEBUGFS_LLSTATS_BUF_SIZE - ll_stats.len,
|
||||
"\nType: %d, peer_mac: %pM, capabilities: %u\nnum_rates: %d",
|
||||
wmi_to_sir_peer_type(peer_info->type),
|
||||
&peer_info->peerMacAddress.bytes[0],
|
||||
peer_info->capabilities, peer_info->numRate);
|
||||
&peer_info->peer_macaddr.bytes[0],
|
||||
peer_info->capabilities, peer_info->num_rate);
|
||||
|
||||
num_rate = peer_info->numRate;
|
||||
num_rate = peer_info->num_rate;
|
||||
for (j = 0; j < num_rate; j++) {
|
||||
rate_stat = &peer_info->rateStats[j];
|
||||
rate_stat = &peer_info->rate_stats[j];
|
||||
buffer += len;
|
||||
ll_stats.len += len;
|
||||
len = scnprintf(buffer,
|
||||
|
|
@ -204,9 +204,9 @@ void hdd_debugfs_process_peer_stats(struct hdd_adapter *adapter, void *data)
|
|||
rate_stat->retries, rate_stat->retries_short,
|
||||
rate_stat->retries_long);
|
||||
}
|
||||
peer_info = (tpSirWifiPeerInfo) ((uint8_t *)
|
||||
peer_info = (struct wifi_peer_info *) ((uint8_t *)
|
||||
peer_stat->peerInfo + (i *
|
||||
sizeof(tSirWifiPeerInfo)) +
|
||||
sizeof(struct wifi_peer_info)) +
|
||||
(num_rate * sizeof(struct wifi_rate_stat)));
|
||||
}
|
||||
ll_stats.len += len;
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ static bool put_wifi_rate_stat(struct wifi_rate_stat *stats,
|
|||
*
|
||||
* Return: bool
|
||||
*/
|
||||
static bool put_wifi_peer_rates(tpSirWifiPeerInfo stats,
|
||||
static bool put_wifi_peer_rates(struct wifi_peer_info *stats,
|
||||
struct sk_buff *vendor_event)
|
||||
{
|
||||
uint32_t i;
|
||||
|
|
@ -253,7 +253,7 @@ static bool put_wifi_peer_rates(tpSirWifiPeerInfo stats,
|
|||
struct nlattr *rates;
|
||||
|
||||
/* no rates is ok */
|
||||
if (!stats->numRate)
|
||||
if (!stats->num_rate)
|
||||
return true;
|
||||
|
||||
nest_id = QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_RATE_INFO;
|
||||
|
|
@ -261,11 +261,11 @@ static bool put_wifi_peer_rates(tpSirWifiPeerInfo stats,
|
|||
if (!info)
|
||||
return false;
|
||||
|
||||
for (i = 0; i < stats->numRate; i++) {
|
||||
for (i = 0; i < stats->num_rate; i++) {
|
||||
rates = nla_nest_start(vendor_event, i);
|
||||
if (!rates)
|
||||
return false;
|
||||
rate_stat = &stats->rateStats[i];
|
||||
rate_stat = &stats->rate_stats[i];
|
||||
if (!put_wifi_rate_stat(rate_stat, vendor_event)) {
|
||||
hdd_err("QCA_WLAN_VENDOR_ATTR put fail");
|
||||
return false;
|
||||
|
|
@ -284,7 +284,7 @@ static bool put_wifi_peer_rates(tpSirWifiPeerInfo stats,
|
|||
*
|
||||
* Return: bool
|
||||
*/
|
||||
static bool put_wifi_peer_info(tpSirWifiPeerInfo stats,
|
||||
static bool put_wifi_peer_info(struct wifi_peer_info *stats,
|
||||
struct sk_buff *vendor_event)
|
||||
{
|
||||
if (nla_put_u32(vendor_event,
|
||||
|
|
@ -292,13 +292,13 @@ static bool put_wifi_peer_info(tpSirWifiPeerInfo stats,
|
|||
wmi_to_sir_peer_type(stats->type)) ||
|
||||
nla_put(vendor_event,
|
||||
QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_MAC_ADDRESS,
|
||||
QDF_MAC_ADDR_SIZE, &stats->peerMacAddress.bytes[0]) ||
|
||||
QDF_MAC_ADDR_SIZE, &stats->peer_macaddr.bytes[0]) ||
|
||||
nla_put_u32(vendor_event,
|
||||
QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_CAPABILITIES,
|
||||
stats->capabilities) ||
|
||||
nla_put_u32(vendor_event,
|
||||
QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_NUM_RATES,
|
||||
stats->numRate)) {
|
||||
stats->num_rate)) {
|
||||
hdd_err("QCA_WLAN_VENDOR_ATTR put fail");
|
||||
return false;
|
||||
}
|
||||
|
|
@ -620,11 +620,11 @@ static void hdd_link_layer_process_peer_stats(struct hdd_adapter *adapter,
|
|||
{
|
||||
struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
|
||||
tpSirWifiPeerStat peer_stat;
|
||||
tpSirWifiPeerInfo peer_info;
|
||||
struct wifi_peer_info *peer_info;
|
||||
struct sk_buff *vendor_event;
|
||||
int status, i;
|
||||
struct nlattr *peers;
|
||||
int numRate;
|
||||
int num_rate;
|
||||
|
||||
hdd_enter();
|
||||
|
||||
|
|
@ -639,7 +639,7 @@ static void hdd_link_layer_process_peer_stats(struct hdd_adapter *adapter,
|
|||
|
||||
/*
|
||||
* Allocate a size of 4096 for the peer stats comprising
|
||||
* each of size = sizeof (tSirWifiPeerInfo) + numRate *
|
||||
* each of size = sizeof (struct wifi_peer_info) + num_rate *
|
||||
* sizeof (struct wifi_rate_stat).Each field is put with an
|
||||
* NL attribute.The size of 4096 is considered assuming
|
||||
* that number of rates shall not exceed beyond 50 with
|
||||
|
|
@ -668,7 +668,7 @@ static void hdd_link_layer_process_peer_stats(struct hdd_adapter *adapter,
|
|||
return;
|
||||
}
|
||||
|
||||
peer_info = (tpSirWifiPeerInfo) ((uint8_t *)
|
||||
peer_info = (struct wifi_peer_info *) ((uint8_t *)
|
||||
peer_stat->peerInfo);
|
||||
|
||||
if (peer_stat->numPeers) {
|
||||
|
|
@ -690,7 +690,7 @@ static void hdd_link_layer_process_peer_stats(struct hdd_adapter *adapter,
|
|||
return;
|
||||
}
|
||||
|
||||
numRate = peer_info->numRate;
|
||||
num_rate = peer_info->num_rate;
|
||||
|
||||
if (!put_wifi_peer_info(peer_info, vendor_event)) {
|
||||
hdd_err("put_wifi_peer_info fail");
|
||||
|
|
@ -698,10 +698,10 @@ static void hdd_link_layer_process_peer_stats(struct hdd_adapter *adapter,
|
|||
return;
|
||||
}
|
||||
|
||||
peer_info = (tpSirWifiPeerInfo)
|
||||
peer_info = (struct wifi_peer_info *)
|
||||
((uint8_t *)peer_stat->peerInfo +
|
||||
(i * sizeof(tSirWifiPeerInfo)) +
|
||||
(numRate * sizeof(struct wifi_rate_stat)));
|
||||
(i * sizeof(struct wifi_peer_info)) +
|
||||
(num_rate * sizeof(struct wifi_rate_stat)));
|
||||
nla_nest_end(vendor_event, peers);
|
||||
}
|
||||
nla_nest_end(vendor_event, peerInfo);
|
||||
|
|
@ -1753,7 +1753,7 @@ void wlan_hdd_clear_link_layer_stats(struct hdd_adapter *adapter)
|
|||
* Return: 0 success
|
||||
*/
|
||||
static inline int
|
||||
hdd_populate_per_peer_ps_info(tSirWifiPeerInfo *wifi_peer_info,
|
||||
hdd_populate_per_peer_ps_info(struct wifi_peer_info *wifi_peer_info,
|
||||
struct sk_buff *vendor_event)
|
||||
{
|
||||
if (!wifi_peer_info) {
|
||||
|
|
@ -1766,7 +1766,7 @@ hdd_populate_per_peer_ps_info(tSirWifiPeerInfo *wifi_peer_info,
|
|||
wifi_peer_info->power_saving) ||
|
||||
nla_put(vendor_event,
|
||||
QCA_WLAN_VENDOR_ATTR_LL_STATS_EXT_PEER_MAC_ADDRESS,
|
||||
QDF_MAC_ADDR_SIZE, &wifi_peer_info->peerMacAddress)) {
|
||||
QDF_MAC_ADDR_SIZE, &wifi_peer_info->peer_macaddr)) {
|
||||
hdd_err("QCA_WLAN_VENDOR_ATTR put fail.");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
@ -1784,7 +1784,7 @@ static int hdd_populate_wifi_peer_ps_info(tSirWifiPeerStat *data,
|
|||
struct sk_buff *vendor_event)
|
||||
{
|
||||
uint32_t peer_num, i;
|
||||
tSirWifiPeerInfo *wifi_peer_info;
|
||||
struct wifi_peer_info *wifi_peer_info;
|
||||
struct nlattr *peer_info, *peers;
|
||||
|
||||
if (!data) {
|
||||
|
|
|
|||
|
|
@ -3702,23 +3702,25 @@ typedef enum {
|
|||
WIFI_PEER_INVALID,
|
||||
} tSirWifiPeerType;
|
||||
|
||||
/* per peer statistics */
|
||||
typedef struct {
|
||||
/* peer type (AP, TDLS, GO etc.) */
|
||||
/**
|
||||
* struct wifi_peer_info - per peer information
|
||||
* @type: peer type (AP, TDLS, GO etc.)
|
||||
* @peer_macaddr: mac address
|
||||
* @capabilities: peer WIFI_CAPABILITY_XXX
|
||||
* @power_saving: peer power saving mode
|
||||
* @num_rate: number of rates
|
||||
* @rate_stats: per rate statistics, number of entries = @num_rate
|
||||
*/
|
||||
struct wifi_peer_info {
|
||||
enum wmi_peer_type type;
|
||||
/* mac address */
|
||||
struct qdf_mac_addr peerMacAddress;
|
||||
/* peer WIFI_CAPABILITY_XXX */
|
||||
struct qdf_mac_addr peer_macaddr;
|
||||
uint32_t capabilities;
|
||||
union {
|
||||
/* peer power saving mode */
|
||||
uint32_t power_saving;
|
||||
/* number of rates */
|
||||
uint32_t numRate;
|
||||
uint32_t num_rate;
|
||||
};
|
||||
/* per rate statistics, number of entries = num_rate */
|
||||
struct wifi_rate_stat rateStats[0];
|
||||
} tSirWifiPeerInfo, *tpSirWifiPeerInfo;
|
||||
struct wifi_rate_stat rate_stats[0];
|
||||
};
|
||||
|
||||
/* Interface statistics - corresponding to 2nd most
|
||||
* LSB in wifi statistics bitmap for getting statistics
|
||||
|
|
@ -3749,7 +3751,7 @@ typedef struct {
|
|||
/* number of peers */
|
||||
uint32_t numPeers;
|
||||
/* per peer statistics */
|
||||
tSirWifiPeerInfo peerInfo[0];
|
||||
struct wifi_peer_info peerInfo[0];
|
||||
} tSirWifiPeerStat, *tpSirWifiPeerStat;
|
||||
|
||||
/* wifi statistics bitmap for getting statistics */
|
||||
|
|
|
|||
|
|
@ -1393,7 +1393,7 @@ static int wma_unified_link_peer_stats_event_handler(void *handle,
|
|||
}
|
||||
|
||||
peer_stats_size = sizeof(tSirWifiPeerStat);
|
||||
peer_info_size = sizeof(tSirWifiPeerInfo);
|
||||
peer_info_size = sizeof(struct wifi_peer_info);
|
||||
rate_stats_size = sizeof(struct wifi_rate_stat);
|
||||
link_stats_results_size =
|
||||
sizeof(*link_stats_results) + peer_stats_size +
|
||||
|
|
@ -1892,7 +1892,7 @@ static int wma_peer_ps_evt_handler(void *handle, u_int8_t *event,
|
|||
WMI_PEER_STA_PS_STATECHG_EVENTID_param_tlvs *param_buf;
|
||||
wmi_peer_sta_ps_statechange_event_fixed_param *fixed_param;
|
||||
tSirWifiPeerStat *peer_stat;
|
||||
tSirWifiPeerInfo *peer_info;
|
||||
struct wifi_peer_info *peer_info;
|
||||
tSirLLStatsResults *link_stats_results;
|
||||
tSirMacAddr mac_address;
|
||||
uint32_t result_len;
|
||||
|
|
@ -1918,7 +1918,7 @@ static int wma_peer_ps_evt_handler(void *handle, u_int8_t *event,
|
|||
|
||||
result_len = sizeof(tSirLLStatsResults) +
|
||||
sizeof(tSirWifiPeerStat) +
|
||||
sizeof(tSirWifiPeerInfo);
|
||||
sizeof(struct wifi_peer_info);
|
||||
link_stats_results = qdf_mem_malloc(result_len);
|
||||
if (!link_stats_results)
|
||||
return -EINVAL;
|
||||
|
|
@ -1938,8 +1938,8 @@ static int wma_peer_ps_evt_handler(void *handle, u_int8_t *event,
|
|||
|
||||
peer_stat = (tSirWifiPeerStat *)link_stats_results->results;
|
||||
peer_stat->numPeers = 1;
|
||||
peer_info = (tSirWifiPeerInfo *)peer_stat->peerInfo;
|
||||
qdf_mem_copy(&peer_info->peerMacAddress,
|
||||
peer_info = (struct wifi_peer_info *)peer_stat->peerInfo;
|
||||
qdf_mem_copy(&peer_info->peer_macaddr,
|
||||
&mac_address,
|
||||
sizeof(tSirMacAddr));
|
||||
peer_info->power_saving = fixed_param->peer_ps_state;
|
||||
|
|
|
|||
Loading…
Reference in a new issue