Browse Source

qcacld-3.0: Replace typedef tSirWifiRate

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 tSirWifiRate 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 rateMcsIdx member to make it compliant.

Change-Id: I719c9c563f5b382b0734be086bee4e5e89fe85aa
CRs-Fixed: 2427172
Jeff Johnson 6 years ago
parent
commit
b67be24d52
3 changed files with 30 additions and 26 deletions
  1. 2 1
      core/hdd/src/wlan_hdd_debugfs_llstat.c
  2. 13 13
      core/hdd/src/wlan_hdd_stats.c
  3. 15 12
      core/mac/inc/sir_api.h

+ 2 - 1
core/hdd/src/wlan_hdd_debugfs_llstat.c

@@ -198,7 +198,8 @@ void hdd_debugfs_process_peer_stats(struct hdd_adapter *adapter, void *data)
 				DEBUGFS_LLSTATS_BUF_SIZE - ll_stats.len,
 				"\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.bw,
+				rate_stat->rate.rate_or_mcs_index,
 				rate_stat->rate.bitrate, rate_stat->tx_mpdu,
 				rate_stat->rx_mpdu, rate_stat->mpdu_lost,
 				rate_stat->retries, rate_stat->retries_short,

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

@@ -207,28 +207,28 @@ static bool put_wifi_rate_stat(struct wifi_rate_stat *stats,
 		       stats->rate.bw) ||
 	    nla_put_u8(vendor_event,
 		       QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_MCS_INDEX,
-		       stats->rate.rateMcsIdx) ||
+		       stats->rate.rate_or_mcs_index) ||
 	    nla_put_u32(vendor_event,
 			QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_BIT_RATE,
 			stats->rate.bitrate) ||
 	    nla_put_u32(vendor_event,
-			   QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_TX_MPDU,
-			   stats->tx_mpdu) ||
+			QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_TX_MPDU,
+			stats->tx_mpdu) ||
 	    nla_put_u32(vendor_event,
-			   QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RX_MPDU,
-			   stats->rx_mpdu) ||
+			QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RX_MPDU,
+			stats->rx_mpdu) ||
 	    nla_put_u32(vendor_event,
-			   QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_MPDU_LOST,
-			   stats->mpdu_lost) ||
+			QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_MPDU_LOST,
+			stats->mpdu_lost) ||
 	    nla_put_u32(vendor_event,
-			   QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES,
-			   stats->retries) ||
+			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->retries_short) ||
+			QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES_SHORT,
+			stats->retries_short) ||
 	    nla_put_u32(vendor_event,
-			   QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES_LONG,
-			   stats->retries_long)) {
+			QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES_LONG,
+			stats->retries_long)) {
 		hdd_err("QCA_WLAN_VENDOR_ATTR put fail");
 		return false;
 	}

+ 15 - 12
core/mac/inc/sir_api.h

@@ -3577,22 +3577,25 @@ struct wifi_channel_info {
 	uint32_t center_freq1;
 };
 
-/* wifi rate info */
-typedef struct {
-	/* 0: OFDM, 1:CCK, 2:HT 3:VHT 4..7 reserved */
+/**
+ * struct wifi_rate_info - wifi rate information
+ * @preamble: 0:OFDM, 1:CCK, 2:HT 3:VHT 4..7 reserved
+ * @nss: 0:1x1, 1:2x2, 3:3x3, 4:4x4
+ * @bw: 0:20MHz, 1:40Mhz, 2:80Mhz, 3:160Mhz
+ * @rate_or_mcs_index:
+ * * OFDM/CCK: rate code per ieee std in units of 0.5mbps
+ * * HT/VHT: mcs index
+ * @reserved: reserved
+ * @bitrate: bitrate units of 100 Kbps
+ */
+struct wifi_rate_info {
 	uint32_t preamble:3;
-	/* 0:1x1, 1:2x2, 3:3x3, 4:4x4 */
 	uint32_t nss:2;
-	/* 0:20MHz, 1:40Mhz, 2:80Mhz, 3:160Mhz */
 	uint32_t bw:3;
-	/* OFDM/CCK rate code would be as per ieee std in units of 0.5mbps */
-	/* HT/VHT it would be mcs index */
-	uint32_t rateMcsIdx:8;
-	/* reserved */
+	uint32_t rate_or_mcs_index:8;
 	uint32_t reserved:16;
-	/* units of 100 Kbps */
 	uint32_t bitrate;
-} tSirWifiRate, *tpSirWifiRate;
+};
 
 /* channel statistics */
 typedef struct {
@@ -3672,7 +3675,7 @@ typedef struct {
  * @retries_long: number of long data pkt retries
  */
 struct wifi_rate_stat {
-	tSirWifiRate rate;
+	struct wifi_rate_info rate;
 	uint32_t tx_mpdu;
 	uint32_t rx_mpdu;
 	uint32_t mpdu_lost;