Search Linux Wireless

[PATCH v2 12/12] mac80211_hwsim: support for S1G rate information

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Include S1G rate information in S1G frames.

Signed-off-by: Kieran Frewen<kieran.frewen@xxxxxxxxxxxxxx>
---
 drivers/net/wireless/mac80211_hwsim.c | 38 ++++++++++++++++++++-------
 1 file changed, 29 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index 5ecbc80be338..6742f308ef7a 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -1577,7 +1577,14 @@ static bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw,
 	rx_status.freq = chan->center_freq;
 	rx_status.freq_offset = chan->freq_offset;
 	rx_status.band = chan->band;
-	if (info->control.rates[0].flags & IEEE80211_TX_RC_VHT_MCS) {
+	if (info->control.rates[0].flags & IEEE80211_TX_RC_S1G_MCS &&
+	    rx_status.band == NL80211_BAND_S1GHZ) {
+		rx_status.rate_idx =
+			ieee80211_rate_get_s1g_mcs(&info->control.rates[0]);
+		rx_status.nss =
+			ieee80211_rate_get_s1g_nss(&info->control.rates[0]);
+		rx_status.encoding = RX_ENC_S1G;
+	} else if (info->control.rates[0].flags & IEEE80211_TX_RC_VHT_MCS) {
 		rx_status.rate_idx =
 			ieee80211_rate_get_vht_mcs(&info->control.rates[0]);
 		rx_status.nss =
@@ -1588,14 +1595,27 @@ static bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw,
 		if (info->control.rates[0].flags & IEEE80211_TX_RC_MCS)
 			rx_status.encoding = RX_ENC_HT;
 	}
-	if (info->control.rates[0].flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
-		rx_status.bw = RATE_INFO_BW_40;
-	else if (info->control.rates[0].flags & IEEE80211_TX_RC_80_MHZ_WIDTH)
-		rx_status.bw = RATE_INFO_BW_80;
-	else if (info->control.rates[0].flags & IEEE80211_TX_RC_160_MHZ_WIDTH)
-		rx_status.bw = RATE_INFO_BW_160;
-	else
-		rx_status.bw = RATE_INFO_BW_20;
+	if (rx_status.band == NL80211_BAND_S1GHZ) {
+		if (info->control.rates[0].flags & IEEE80211_TX_RC_2_MHZ_WIDTH)
+			rx_status.bw = RATE_INFO_BW_2;
+		else if (info->control.rates[0].flags & IEEE80211_TX_RC_4_MHZ_WIDTH)
+			rx_status.bw = RATE_INFO_BW_4;
+		else if (info->control.rates[0].flags & IEEE80211_TX_RC_8_MHZ_WIDTH)
+			rx_status.bw = RATE_INFO_BW_8;
+		else if (info->control.rates[0].flags & IEEE80211_TX_RC_16_MHZ_WIDTH)
+			rx_status.bw = RATE_INFO_BW_16;
+		else
+			rx_status.bw = RATE_INFO_BW_1;
+	} else {
+		if (info->control.rates[0].flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
+			rx_status.bw = RATE_INFO_BW_40;
+		else if (info->control.rates[0].flags & IEEE80211_TX_RC_80_MHZ_WIDTH)
+			rx_status.bw = RATE_INFO_BW_80;
+		else if (info->control.rates[0].flags & IEEE80211_TX_RC_160_MHZ_WIDTH)
+			rx_status.bw = RATE_INFO_BW_160;
+		else
+			rx_status.bw = RATE_INFO_BW_20;
+	}
 	if (info->control.rates[0].flags & IEEE80211_TX_RC_SHORT_GI)
 		rx_status.enc_flags |= RX_ENC_FLAG_SHORT_GI;
 	/* TODO: simulate optional packet loss */
-- 
2.25.1




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux