diff mbox series

[v2,2/2] wiphy: use HE element for data rate estimation

Message ID 20220719233924.559329-2-prestwoj@gmail.com (mailing list archive)
State Not Applicable, archived
Headers show
Series [v2,1/2] band: add band_estimate_he_rx_rate | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-ci-gitlint success GitLint

Commit Message

James Prestwood July 19, 2022, 11:39 p.m. UTC
If an HE element is found, prefer using this for the rate estimation
since it will likely yield the fastest rate.
---
 src/wiphy.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

v2:
 * Increased length check by 2 which includes the first MCS set.
diff mbox series

Patch

diff --git a/src/wiphy.c b/src/wiphy.c
index 696064c0..9bcbea77 100644
--- a/src/wiphy.c
+++ b/src/wiphy.c
@@ -788,6 +788,7 @@  int wiphy_estimate_data_rate(struct wiphy *wiphy,
 	const void *vht_operation = NULL;
 	const void *ht_capabilities = NULL;
 	const void *ht_operation = NULL;
+	const void *he_capabilities = NULL;
 	const struct band *bandp;
 	enum band_freq band;
 
@@ -847,11 +848,22 @@  int wiphy_estimate_data_rate(struct wiphy *wiphy,
 
 			vht_operation = iter.data - 2;
 			break;
+		case IE_TYPE_HE_CAPABILITIES:
+			if (iter.len < 23)
+				return -EBADMSG;
+
+			he_capabilities = iter.data - 2;
+			break;
 		default:
 			break;
 		}
 	}
 
+	if (!band_estimate_he_rx_rate(bandp, he_capabilities,
+					bss->signal_strength / 100,
+					out_data_rate))
+		return 0;
+
 	if (!band_estimate_vht_rx_rate(bandp, vht_capabilities, vht_operation,
 					ht_capabilities, ht_operation,
 					bss->signal_strength / 100,