Browse Source

qcacld-3.0: Replace typedef tSirWifiRadioStat

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 tSirWifiRadioStat 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.

Also remove the obsolete tx_time_per_tpc array since it is unused.

Change-Id: I40aa287e01dc8d12ba803858cc54e79a6fccb8c9
CRs-Fixed: 2427174
Jeff Johnson 6 years ago
parent
commit
e4bba7c043
4 changed files with 93 additions and 111 deletions
  1. 10 10
      core/hdd/src/wlan_hdd_debugfs_llstat.c
  2. 32 31
      core/hdd/src/wlan_hdd_stats.c
  3. 33 52
      core/mac/inc/sir_api.h
  4. 18 18
      core/wma/src/wma_utils.c

+ 10 - 10
core/hdd/src/wlan_hdd_debugfs_llstat.c

@@ -222,7 +222,7 @@ void hdd_debugfs_process_radio_stats(struct hdd_adapter *adapter,
 	int i, j;
 	ssize_t len = 0;
 	uint8_t *buffer;
-	tSirWifiRadioStat *radio_stat = (tpSirWifiRadioStat) data;
+	struct wifi_radio_stats *radio_stat = (struct wifi_radio_stats *) data;
 	struct wifi_channel_stats *chan_stat;
 
 	hdd_enter();
@@ -246,13 +246,13 @@ void hdd_debugfs_process_radio_stats(struct hdd_adapter *adapter,
 		len = scnprintf(buffer,
 			DEBUGFS_LLSTATS_BUF_SIZE - ll_stats.len,
 			"\nRadio: %u on_time: %u, tx_time: %u, rx_time: %u, on_time_scan: %u, on_time_nbd: %u, on_time_gscan: %u, on_time_roam_scan: %u, on_time_pno_scan: %u  on_time_hs20: %u, on_time_host_scan: %u, on_time_lpi_scan: %u\ntotal_num_tx_pwr_levels: %u\n",
-			radio_stat->radio, radio_stat->onTime,
-			radio_stat->txTime, radio_stat->rxTime,
-			radio_stat->onTimeScan, radio_stat->onTimeNbd,
-			radio_stat->onTimeGscan,
-			radio_stat->onTimeRoamScan,
-			radio_stat->onTimePnoScan,
-			radio_stat->onTimeHs20,
+			radio_stat->radio, radio_stat->on_time,
+			radio_stat->tx_time, radio_stat->rx_time,
+			radio_stat->on_time_scan, radio_stat->on_time_nbd,
+			radio_stat->on_time_gscan,
+			radio_stat->on_time_roam_scan,
+			radio_stat->on_time_pno_scan,
+			radio_stat->on_time_hs20,
 			radio_stat->on_time_host_scan,
 			radio_stat->on_time_lpi_scan,
 			radio_stat->total_num_tx_power_levels);
@@ -269,9 +269,9 @@ void hdd_debugfs_process_radio_stats(struct hdd_adapter *adapter,
 		ll_stats.len += len;
 		len = scnprintf(buffer,
 			DEBUGFS_LLSTATS_BUF_SIZE - ll_stats.len,
-			"\nNum channels: %d", radio_stat->numChannels);
+			"\nNum channels: %d", radio_stat->num_channels);
 
-		for (j = 0; j < radio_stat->numChannels; j++) {
+		for (j = 0; j < radio_stat->num_channels; j++) {
 			chan_stat = (struct wifi_channel_stats *)
 					((uint8_t *)radio_stat->channels +
 					  (j * sizeof(struct wifi_channel_stats)));

+ 32 - 31
core/hdd/src/wlan_hdd_stats.c

@@ -782,7 +782,7 @@ static void hdd_link_layer_process_iface_stats(struct hdd_adapter *adapter,
  * Return: 0 on success; errno on failure
  */
 static int hdd_llstats_radio_fill_channels(struct hdd_adapter *adapter,
-					   tSirWifiRadioStat *radiostat,
+					   struct wifi_radio_stats *radiostat,
 					   struct sk_buff *vendor_event)
 {
 	struct wifi_channel_stats *channel_stats;
@@ -797,7 +797,7 @@ static int hdd_llstats_radio_fill_channels(struct hdd_adapter *adapter,
 		return -EINVAL;
 	}
 
-	for (i = 0; i < radiostat->numChannels; i++) {
+	for (i = 0; i < radiostat->num_channels; i++) {
 		channel_stats = (struct wifi_channel_stats *) ((uint8_t *)
 				     radiostat->channels +
 				     (i * sizeof(struct wifi_channel_stats)));
@@ -847,7 +847,7 @@ static int hdd_llstats_radio_fill_channels(struct hdd_adapter *adapter,
  */
 static int hdd_llstats_post_radio_stats(struct hdd_adapter *adapter,
 					u32 more_data,
-					tSirWifiRadioStat *radiostat,
+					struct wifi_radio_stats *radiostat,
 					u32 num_radio)
 {
 	struct sk_buff *vendor_event;
@@ -856,7 +856,7 @@ static int hdd_llstats_post_radio_stats(struct hdd_adapter *adapter,
 
 	/*
 	 * Allocate a size of 4096 for the Radio stats comprising
-	 * sizeof (tSirWifiRadioStat) + numChannels * sizeof
+	 * sizeof (struct wifi_radio_stats) + num_channels * sizeof
 	 * (struct wifi_channel_stats).Each channel data is put with an
 	 * NL attribute.The size of 4096 is considered assuming that
 	 * number of channels shall not exceed beyond  60 with the
@@ -886,37 +886,37 @@ static int hdd_llstats_post_radio_stats(struct hdd_adapter *adapter,
 			radiostat->radio) ||
 	    nla_put_u32(vendor_event,
 			QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME,
-			radiostat->onTime) ||
+			radiostat->on_time) ||
 	    nla_put_u32(vendor_event,
 			QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_TX_TIME,
-			radiostat->txTime) ||
+			radiostat->tx_time) ||
 	    nla_put_u32(vendor_event,
 			QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_RX_TIME,
-			radiostat->rxTime) ||
+			radiostat->rx_time) ||
 	    nla_put_u32(vendor_event,
 			QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_SCAN,
-			radiostat->onTimeScan) ||
+			radiostat->on_time_scan) ||
 	    nla_put_u32(vendor_event,
 			QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_NBD,
-			radiostat->onTimeNbd) ||
+			radiostat->on_time_nbd) ||
 	    nla_put_u32(vendor_event,
 			QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_GSCAN,
-			radiostat->onTimeGscan) ||
+			radiostat->on_time_gscan) ||
 	    nla_put_u32(vendor_event,
 			QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_ROAM_SCAN,
-			radiostat->onTimeRoamScan) ||
+			radiostat->on_time_roam_scan) ||
 	    nla_put_u32(vendor_event,
 			QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_PNO_SCAN,
-			radiostat->onTimePnoScan) ||
+			radiostat->on_time_pno_scan) ||
 	    nla_put_u32(vendor_event,
 			QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_HS20,
-			radiostat->onTimeHs20) ||
+			radiostat->on_time_hs20) ||
 	    nla_put_u32(vendor_event,
 			QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_NUM_TX_LEVELS,
 			radiostat->total_num_tx_power_levels)    ||
 	    nla_put_u32(vendor_event,
 			QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_NUM_CHANNELS,
-			radiostat->numChannels)) {
+			radiostat->num_channels)) {
 		hdd_err("QCA_WLAN_VENDOR_ATTR put fail");
 		goto failure;
 	}
@@ -932,7 +932,7 @@ static int hdd_llstats_post_radio_stats(struct hdd_adapter *adapter,
 		}
 	}
 
-	if (radiostat->numChannels) {
+	if (radiostat->num_channels) {
 		ret = hdd_llstats_radio_fill_channels(adapter, radiostat,
 						      vendor_event);
 		if (ret)
@@ -962,11 +962,11 @@ failure:
  */
 static void hdd_link_layer_process_radio_stats(struct hdd_adapter *adapter,
 					       u32 more_data,
-					       tpSirWifiRadioStat pData,
+					       struct wifi_radio_stats *pData,
 					       u32 num_radio)
 {
 	int status, i, nr, ret;
-	tSirWifiRadioStat *pWifiRadioStat = pData;
+	struct wifi_radio_stats *pWifiRadioStat = pData;
 	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 
 	hdd_enter();
@@ -979,19 +979,20 @@ static void hdd_link_layer_process_radio_stats(struct hdd_adapter *adapter,
 
 	for (i = 0; i < num_radio; i++) {
 		hdd_debug("LL_STATS_RADIO"
-		       " radio: %u onTime: %u txTime: %u rxTime: %u"
-		       " onTimeScan: %u onTimeNbd: %u"
-		       " onTimeGscan: %u onTimeRoamScan: %u"
-		       " onTimePnoScan: %u  onTimeHs20: %u"
-		       " numChannels: %u total_num_tx_pwr_levels: %u"
+		       " radio: %u on_time: %u tx_time: %u rx_time: %u"
+		       " on_time_scan: %u on_time_nbd: %u"
+		       " on_time_gscan: %u on_time_roam_scan: %u"
+		       " on_time_pno_scan: %u  on_time_hs20: %u"
+		       " num_channels: %u total_num_tx_pwr_levels: %u"
 		       " on_time_host_scan: %u, on_time_lpi_scan: %u",
-		       pWifiRadioStat->radio, pWifiRadioStat->onTime,
-		       pWifiRadioStat->txTime, pWifiRadioStat->rxTime,
-		       pWifiRadioStat->onTimeScan, pWifiRadioStat->onTimeNbd,
-		       pWifiRadioStat->onTimeGscan,
-		       pWifiRadioStat->onTimeRoamScan,
-		       pWifiRadioStat->onTimePnoScan,
-		       pWifiRadioStat->onTimeHs20, pWifiRadioStat->numChannels,
+		       pWifiRadioStat->radio, pWifiRadioStat->on_time,
+		       pWifiRadioStat->tx_time, pWifiRadioStat->rx_time,
+		       pWifiRadioStat->on_time_scan, pWifiRadioStat->on_time_nbd,
+		       pWifiRadioStat->on_time_gscan,
+		       pWifiRadioStat->on_time_roam_scan,
+		       pWifiRadioStat->on_time_pno_scan,
+		       pWifiRadioStat->on_time_hs20,
+		       pWifiRadioStat->num_channels,
 		       pWifiRadioStat->total_num_tx_power_levels,
 		       pWifiRadioStat->on_time_host_scan,
 		       pWifiRadioStat->on_time_lpi_scan);
@@ -1030,10 +1031,10 @@ static void hdd_ll_process_radio_stats(struct hdd_adapter *adapter,
 {
 	if (DEBUGFS_LLSTATS_REQID == resp_id)
 		hdd_debugfs_process_radio_stats(adapter, more_data,
-			(tpSirWifiRadioStat)data, num_radio);
+			(struct wifi_radio_stats *)data, num_radio);
 	else
 		hdd_link_layer_process_radio_stats(adapter, more_data,
-			(tpSirWifiRadioStat)data, num_radio);
+			(struct wifi_radio_stats *)data, num_radio);
 }
 
 /**

+ 33 - 52
core/mac/inc/sir_api.h

@@ -3609,62 +3609,43 @@ struct wifi_channel_stats {
 	uint32_t cca_busy_time;
 };
 
-#define MAX_TPC_LEVELS 64
-/* radio statistics */
-typedef struct {
-	/* wifi radio (if multiple radio supported) */
+/**
+ * struct wifi_radio_stats - per-radio statistics
+ * @radio: wifi radio for which the stats are applicable
+ * @on_time: msecs the radio is awake
+ * @tx_time: msecs the radio is transmitting
+ * @rx_time: msecs the radio is in active receive
+ * @on_time_scan: msecs the radio is awake due to all scan
+ * @on_time_nbd: msecs the radio is awake due to NAN
+ * @on_time_gscan: msecs the radio is awake due to Gscan
+ * @on_time_roam_scan: msecs the radio is awake due to roam scan
+ * @on_time_pno_scan: msecs the radio is awake due to PNO scan
+ * @on_time_hs20: msecs the radio is awake due to HS2.0 scans and GAS exchange
+ * @on_time_host_scan: msecs the radio is awake due to Host initiated scan
+ * @on_time_lpi_scan: msecs the radio is awake due to LPI scan
+ * @total_num_tx_power_levels: @tx_time_per_power_level record count
+ * @tx_time_per_power_level:  tx time (in milliseconds) per TPC level (0.5 dBm)
+ * @num_channels: @channels record count
+ * @channels: per-channel statistics
+ */
+struct wifi_radio_stats {
 	tSirWifiRadio radio;
-	/* msecs the radio is awake (32 bits number accruing over time) */
-	uint32_t onTime;
-	/* msecs the radio is transmitting
-	 * (32 bits number accruing over time)
-	 */
-	uint32_t txTime;
-	/* msecs the radio is in active receive
-	   *(32 bits number accruing over time)
-	 */
-	uint32_t rxTime;
-	/* msecs the radio is awake due to all scan
-	 * (32 bits number accruing over time)
-	 */
-	uint32_t onTimeScan;
-	/* msecs the radio is awake due to NAN
-	 * (32 bits number accruing over time)
-	 */
-	uint32_t onTimeNbd;
-	/* msecs the radio is awake due to Gscan
-	 * (32 bits number accruing over time)
-	 */
-	uint32_t onTimeGscan;
-	/* msecs the radio is awake due to roam?scan
-	 * (32 bits number accruing over time)
-	 */
-	uint32_t onTimeRoamScan;
-	/* msecs the radio is awake due to PNO scan
-	 * (32 bits number accruing over time)
-	 */
-	uint32_t onTimePnoScan;
-	/* msecs the radio is awake due to HS2.0 scans and GAS exchange
-	 * (32 bits number accruing over time)
-	 */
-	uint32_t onTimeHs20;
-
-	/* tx time (in milliseconds) per TPC level (0.5 dBm) */
-	uint32_t total_num_tx_power_levels;
-	uint32_t *tx_time_per_power_level;
-
-	/* number of channels */
-	uint32_t numChannels;
-
-	/* tx time (in milliseconds) per TPC level (0.5 dBm) */
-	uint32_t tx_time_per_tpc[MAX_TPC_LEVELS];
-
+	uint32_t on_time;
+	uint32_t tx_time;
+	uint32_t rx_time;
+	uint32_t on_time_scan;
+	uint32_t on_time_nbd;
+	uint32_t on_time_gscan;
+	uint32_t on_time_roam_scan;
+	uint32_t on_time_pno_scan;
+	uint32_t on_time_hs20;
 	uint32_t on_time_host_scan;
 	uint32_t on_time_lpi_scan;
-
-	/* channel statistics struct wifi_channel_stats */
+	uint32_t total_num_tx_power_levels;
+	uint32_t *tx_time_per_power_level;
+	uint32_t num_channels;
 	struct wifi_channel_stats *channels;
-} tSirWifiRadioStat, *tpSirWifiRadioStat;
+};
 
 /**
  * struct wifi_rate_stat - per rate statistics

+ 18 - 18
core/wma/src/wma_utils.c

@@ -1463,13 +1463,13 @@ static int wma_unified_link_peer_stats_event_handler(void *handle,
 int wma_unified_radio_tx_mem_free(void *handle)
 {
 	tp_wma_handle wma_handle = (tp_wma_handle) handle;
-	tSirWifiRadioStat *rs_results;
+	struct wifi_radio_stats *rs_results;
 	uint32_t i = 0;
 
 	if (!wma_handle->link_stats_results)
 		return 0;
 
-	rs_results = (tSirWifiRadioStat *)
+	rs_results = (struct wifi_radio_stats *)
 				&wma_handle->link_stats_results->results[0];
 	for (i = 0; i < wma_handle->link_stats_results->num_radio; i++) {
 		if (rs_results->tx_time_per_power_level) {
@@ -1509,7 +1509,7 @@ static int wma_unified_radio_tx_power_level_stats_event_handler(void *handle,
 	wmi_tx_power_level_stats_evt_fixed_param *fixed_param;
 	uint8_t *tx_power_level_values;
 	tSirLLStatsResults *link_stats_results;
-	tSirWifiRadioStat *rs_results;
+	struct wifi_radio_stats *rs_results;
 	uint32_t max_total_num_tx_power_levels = MAX_TPC_LEVELS * NUM_OF_BANDS *
 						MAX_SPATIAL_STREAM_ANY_V3;
 
@@ -1575,7 +1575,7 @@ static int wma_unified_radio_tx_power_level_stats_event_handler(void *handle,
 		return -EINVAL;
 	}
 
-	rs_results = (tSirWifiRadioStat *) &link_stats_results->results[0] +
+	rs_results = (struct wifi_radio_stats *) &link_stats_results->results[0] +
 							 fixed_param->radio_id;
 	tx_power_level_values = (uint8_t *) param_tlvs->tx_time_per_power_level;
 
@@ -1680,7 +1680,7 @@ static int wma_unified_link_radio_stats_event_handler(void *handle,
 	uint32_t next_chan_offset, count;
 	size_t radio_stats_size, chan_stats_size;
 	size_t link_stats_results_size;
-	tSirWifiRadioStat *rs_results;
+	struct wifi_radio_stats *rs_results;
 	struct wifi_channel_stats *chn_results;
 
 	struct mac_context *mac = cds_get_context(QDF_MODULE_ID_PE);
@@ -1724,7 +1724,7 @@ static int wma_unified_link_radio_stats_event_handler(void *handle,
 		return -EINVAL;
 	}
 
-	radio_stats_size = sizeof(tSirWifiRadioStat);
+	radio_stats_size = sizeof(struct wifi_radio_stats);
 	chan_stats_size = sizeof(struct wifi_channel_stats);
 	if (fixed_param->num_radio >
 		(UINT_MAX - sizeof(*link_stats_results))/radio_stats_size) {
@@ -1799,17 +1799,17 @@ static int wma_unified_link_radio_stats_event_handler(void *handle,
 	t_radio_stats = (uint8_t *) radio_stats;
 	t_channel_stats = (uint8_t *) channel_stats;
 
-	rs_results = (tSirWifiRadioStat *) &results[0] + radio_stats->radio_id;
+	rs_results = (struct wifi_radio_stats *) &results[0] + radio_stats->radio_id;
 	rs_results->radio = radio_stats->radio_id;
-	rs_results->onTime = radio_stats->on_time;
-	rs_results->txTime = radio_stats->tx_time;
-	rs_results->rxTime = radio_stats->rx_time;
-	rs_results->onTimeScan = radio_stats->on_time_scan;
-	rs_results->onTimeNbd = radio_stats->on_time_nbd;
-	rs_results->onTimeGscan = radio_stats->on_time_gscan;
-	rs_results->onTimeRoamScan = radio_stats->on_time_roam_scan;
-	rs_results->onTimePnoScan = radio_stats->on_time_pno_scan;
-	rs_results->onTimeHs20 = radio_stats->on_time_hs20;
+	rs_results->on_time = radio_stats->on_time;
+	rs_results->tx_time = radio_stats->tx_time;
+	rs_results->rx_time = radio_stats->rx_time;
+	rs_results->on_time_scan = radio_stats->on_time_scan;
+	rs_results->on_time_nbd = radio_stats->on_time_nbd;
+	rs_results->on_time_gscan = radio_stats->on_time_gscan;
+	rs_results->on_time_roam_scan = radio_stats->on_time_roam_scan;
+	rs_results->on_time_pno_scan = radio_stats->on_time_pno_scan;
+	rs_results->on_time_hs20 = radio_stats->on_time_hs20;
 	rs_results->total_num_tx_power_levels = 0;
 	if (rs_results->tx_time_per_power_level) {
 		qdf_mem_free(rs_results->tx_time_per_power_level);
@@ -1819,10 +1819,10 @@ static int wma_unified_link_radio_stats_event_handler(void *handle,
 		qdf_mem_free(rs_results->channels);
 		rs_results->channels = NULL;
 	}
-	rs_results->numChannels = radio_stats->num_channels;
+	rs_results->num_channels = radio_stats->num_channels;
 	rs_results->on_time_host_scan = radio_stats->on_time_host_scan;
 	rs_results->on_time_lpi_scan = radio_stats->on_time_lpi_scan;
-	if (rs_results->numChannels) {
+	if (rs_results->num_channels) {
 		rs_results->channels = qdf_mem_malloc(
 					radio_stats->num_channels *
 					chan_stats_size);