Browse Source

qcacld-3.0: Replace typedef tSirWifiRateStat

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 tSirWifiRateStat 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: Iff54772fda084fee932f6669ab937e136ab2cf66
CRs-Fixed: 2427166
Jeff Johnson 6 years ago
parent
commit
d3b3b11104

+ 7 - 9
core/hdd/src/wlan_hdd_debugfs_llstat.c

@@ -156,7 +156,7 @@ void hdd_debugfs_process_peer_stats(struct hdd_adapter *adapter, void *data)
 {
 	tpSirWifiPeerStat peer_stat;
 	tpSirWifiPeerInfo peer_info;
-	tpSirWifiRateStat rate_stat;
+	struct wifi_rate_stat *rate_stat;
 	int i, j, num_rate;
 	ssize_t len = 0;
 	uint8_t *buffer;
@@ -191,9 +191,7 @@ void hdd_debugfs_process_peer_stats(struct hdd_adapter *adapter, void *data)
 
 		num_rate = peer_info->numRate;
 		for (j = 0; j < num_rate; j++) {
-			rate_stat = (tpSirWifiRateStat) ((uint8_t *)
-					peer_info->rateStats + (j *
-					sizeof(tSirWifiRateStat)));
+			rate_stat = &peer_info->rateStats[j];
 			buffer += len;
 			ll_stats.len += len;
 			len = scnprintf(buffer,
@@ -201,15 +199,15 @@ void hdd_debugfs_process_peer_stats(struct hdd_adapter *adapter, void *data)
 				"\npreamble: %0x, nss: %0x, bw: %0x, mcs: %0x, bitrate: %0x, txmpdu: %u, rxmpdu: %u, mpdu_lost: %u, retries: %u, retries_short: %u, retries_long: %u",
 				rate_stat->rate.preamble, rate_stat->rate.nss,
 				rate_stat->rate.bw, rate_stat->rate.rateMcsIdx,
-				rate_stat->rate.bitrate, rate_stat->txMpdu,
-				rate_stat->rxMpdu, rate_stat->mpduLost,
-				rate_stat->retries, rate_stat->retriesShort,
-				rate_stat->retriesLong);
+				rate_stat->rate.bitrate, rate_stat->tx_mpdu,
+				rate_stat->rx_mpdu, rate_stat->mpdu_lost,
+				rate_stat->retries, rate_stat->retries_short,
+				rate_stat->retries_long);
 		}
 		peer_info = (tpSirWifiPeerInfo) ((uint8_t *)
 				peer_stat->peerInfo + (i *
 				sizeof(tSirWifiPeerInfo)) +
-				(num_rate * sizeof(tSirWifiRateStat)));
+				(num_rate * sizeof(struct wifi_rate_stat)));
 	}
 	ll_stats.len += len;
 	mutex_unlock(&llstats_mutex);

+ 13 - 19
core/hdd/src/wlan_hdd_stats.c

@@ -193,7 +193,7 @@ struct hdd_ll_stats_priv {
  *
  * Return: bool
  */
-static bool put_wifi_rate_stat(tpSirWifiRateStat stats,
+static bool put_wifi_rate_stat(struct wifi_rate_stat *stats,
 			       struct sk_buff *vendor_event)
 {
 	if (nla_put_u8(vendor_event,
@@ -213,22 +213,22 @@ static bool put_wifi_rate_stat(tpSirWifiRateStat stats,
 			stats->rate.bitrate) ||
 	    nla_put_u32(vendor_event,
 			   QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_TX_MPDU,
-			   stats->txMpdu) ||
+			   stats->tx_mpdu) ||
 	    nla_put_u32(vendor_event,
 			   QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RX_MPDU,
-			   stats->rxMpdu) ||
+			   stats->rx_mpdu) ||
 	    nla_put_u32(vendor_event,
 			   QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_MPDU_LOST,
-			   stats->mpduLost) ||
+			   stats->mpdu_lost) ||
 	    nla_put_u32(vendor_event,
 			   QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES,
 			   stats->retries) ||
 	    nla_put_u32(vendor_event,
 			   QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES_SHORT,
-			   stats->retriesShort) ||
+			   stats->retries_short) ||
 	    nla_put_u32(vendor_event,
 			   QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES_LONG,
-			   stats->retriesLong)) {
+			   stats->retries_long)) {
 		hdd_err("QCA_WLAN_VENDOR_ATTR put fail");
 		return false;
 	}
@@ -247,7 +247,7 @@ static bool put_wifi_peer_rates(tpSirWifiPeerInfo stats,
 				struct sk_buff *vendor_event)
 {
 	uint32_t i;
-	tpSirWifiRateStat rate_stat;
+	struct wifi_rate_stat *rate_stat;
 	int nest_id;
 	struct nlattr *info;
 	struct nlattr *rates;
@@ -640,10 +640,10 @@ 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 *
-	 * sizeof (tSirWifiRateStat).Each field is put with an
+	 * 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
-	 * the sizeof (tSirWifiRateStat) being 32.
+	 * the sizeof (struct wifi_rate_stat) being 32.
 	 */
 	vendor_event = cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy,
 				LL_STATS_EVENT_BUF_SIZE);
@@ -698,16 +698,10 @@ static void hdd_link_layer_process_peer_stats(struct hdd_adapter *adapter,
 				return;
 			}
 
-			peer_info = (tpSirWifiPeerInfo) ((uint8_t *)
-							     peer_stat->
-							     peerInfo +
-							     (i *
-							      sizeof
-							      (tSirWifiPeerInfo))
-							     +
-							     (numRate *
-							      sizeof
-							      (tSirWifiRateStat)));
+			peer_info = (tpSirWifiPeerInfo)
+				((uint8_t *)peer_stat->peerInfo +
+				 (i * sizeof(tSirWifiPeerInfo)) +
+				 (numRate * sizeof(struct wifi_rate_stat)));
 			nla_nest_end(vendor_event, peers);
 		}
 		nla_nest_end(vendor_event, peerInfo);

+ 18 - 16
core/mac/inc/sir_api.h

@@ -3671,23 +3671,25 @@ typedef struct {
 	tSirWifiChannelStats *channels;
 } tSirWifiRadioStat, *tpSirWifiRadioStat;
 
-/* per rate statistics */
-typedef struct {
-	/* rate information */
+/**
+ * struct wifi_rate_stat - per rate statistics
+ * @rate: rate information
+ * @tx_mpdu: number of successfully transmitted data pkts (ACK rcvd)
+ * @rx_mpdu: number of received data pkts
+ * @mpdu_lost: number of data packet losses (no ACK)
+ * @retries: total number of data pkt retries *
+ * @retries_short: number of short data pkt retries
+ * @retries_long: number of long data pkt retries
+ */
+struct wifi_rate_stat {
 	tSirWifiRate rate;
-	/* number of successfully transmitted data pkts (ACK rcvd) */
-	uint32_t txMpdu;
-	/* number of received data pkts */
-	uint32_t rxMpdu;
-	/* number of data packet losses (no ACK) */
-	uint32_t mpduLost;
-	/* total number of data pkt retries * */
+	uint32_t tx_mpdu;
+	uint32_t rx_mpdu;
+	uint32_t mpdu_lost;
 	uint32_t retries;
-	/* number of short data pkt retries */
-	uint32_t retriesShort;
-	/* number of long data pkt retries */
-	uint32_t retriesLong;
-} tSirWifiRateStat, *tpSirWifiRateStat;
+	uint32_t retries_short;
+	uint32_t retries_long;
+};
 
 /* wifi peer type */
 typedef enum {
@@ -3715,7 +3717,7 @@ typedef struct {
 		uint32_t numRate;
 	};
 	/* per rate statistics, number of entries  = num_rate */
-	tSirWifiRateStat rateStats[0];
+	struct wifi_rate_stat rateStats[0];
 } tSirWifiPeerInfo, *tpSirWifiPeerInfo;
 
 /* Interface statistics - corresponding to 2nd most

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

@@ -1394,7 +1394,7 @@ static int wma_unified_link_peer_stats_event_handler(void *handle,
 
 	peer_stats_size = sizeof(tSirWifiPeerStat);
 	peer_info_size = sizeof(tSirWifiPeerInfo);
-	rate_stats_size = sizeof(tSirWifiRateStat);
+	rate_stats_size = sizeof(struct wifi_rate_stat);
 	link_stats_results_size =
 		sizeof(*link_stats_results) + peer_stats_size +
 		(fixed_param->num_peers * peer_info_size) +