Skip to contentSkip to conversation

wiphy: include MAC of BSS with invalid HE capabilities

PATCH In review James Prestwood 2 participants 5 messages Apr 15, 2024

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/4 wiphy: include MAC of BSS with invalid HE capabilities

The prior print was not very descriptive, and now will log the MAC of the offending BSS.

---
 src/wiphy.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
src/wiphy.c +2 -1
index 712d20cf..8f5e46bf 100644
@@ -1039,7 +1039,8 @@ int wiphy_estimate_data_rate(struct wiphy *wiphy,
 			break;
 		case IE_TYPE_HE_CAPABILITIES:
 			if (!ie_validate_he_capabilities(iter.data, iter.len)) {
-				l_warn("invalid HE capabilities");
+				l_warn("invalid HE capabilities for "MAC,
+					MAC_STR(bss->addr));
 				continue;
 			}
 
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 2/4 wiphy: handle -ENETUNREACH for rate estimation

If the RSSI is too low or the local capabilities were not compatible to estimate the rate don't warn but instead treat this the same as -ENOTSUP and drop down to the next capability set.

---
 src/wiphy.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

v2:
* Check for -ENETUNREACH

src/wiphy.c +4 -4
index 8f5e46bf..fb36ebb2 100644
@@ -1056,7 +1056,7 @@ int wiphy_estimate_data_rate(struct wiphy *wiphy,
 					out_data_rate);
 	if (!ret)
 		return 0;
-	else if (ret != -ENOTSUP)
+	else if (ret != -ENOTSUP && ret != -ENETUNREACH)
 		l_warn("error parsing HE capabilities");
 
 	ret = band_estimate_vht_rx_rate(bandp, vht_capabilities, vht_operation,
@@ -1065,7 +1065,7 @@ int wiphy_estimate_data_rate(struct wiphy *wiphy,
 					out_data_rate);
 	if (!ret)
 		return 0;
-	else if (ret != -ENOTSUP)
+	else if (ret != -ENOTSUP && ret != -ENETUNREACH)
 		l_warn("error parsing VHT capabilities");
 
 	ret = band_estimate_ht_rx_rate(bandp, ht_capabilities, ht_operation,
@@ -1073,14 +1073,14 @@ int wiphy_estimate_data_rate(struct wiphy *wiphy,
 					out_data_rate);
 	if (!ret)
 		return 0;
-	else if (ret != -ENOTSUP)
+	else if (ret != -ENOTSUP && ret != -ENETUNREACH)
 		l_warn("error parsing HT capabilities");
 
 	ret = band_estimate_nonht_rate(bandp, supported_rates,
 						ext_supported_rates,
 						bss->signal_strength / 100,
 						out_data_rate);
-	if (ret != 0 && ret != -ENOTSUP)
+	if (ret != 0 && ret != -ENOTSUP && ret != -ENETUNREACH)
 		l_warn("error parsing non-HT rates");
 
 	return ret;
Signature · 1 line
2.34.1
#2 lore raw

PATCH v2 3/4 band: return -ENETUNREACH for HE rate estimation

In reply to James Prestwood

This was overlooked in a prior patch and causes warnings to be printed when the RSSI is too low to estimate an HE data rate or due to incompatible local capabilities (e.g. MCS support).

Similar to the other estimations, return -ENETUNREACH if the IE was valid but incompatible.

---
 src/band.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

v2:
* Remove the -ENOTSUP return and keep -ENETUNREACH

src/band.c +1 -1
index 11cd965e..906d6197 100644
@@ -678,7 +678,7 @@ int band_estimate_he_rx_rate(const struct band *band, const uint8_t *hec,
 	}
 
 	if (!rate)
-		return -EBADMSG;
+		return -ENETUNREACH;
 
 	*out_data_rate = rate;
 
Signature · 1 line
2.34.1
#3 lore raw

PATCH v2 4/4 unit: fix test-band with new rate estimation returns

In reply to James Prestwood

-ENETUNREACH is the correct return to check as this indicates either the RSSI was too low or the local capabilities were not compatible.

---
 unit/test-band.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
unit/test-band.c +1 -1
index 8140b272..855fb67f 100644
@@ -444,7 +444,7 @@ const struct he_test_data he_all_mcs_unsupported = {
 	.freq = BAND_FREQ_5_GHZ,
 	.rssi = -20,
 	.expected_rate = 1201000000ULL * 8ULL,
-	.expected_return = -EBADMSG,
+	.expected_return = -ENETUNREACH,
 	.capabilities = {
 		.he_mcs_set = { MCS_UNSUP, MCS_UNSUP,
 				MCS_UNSUP, MCS_UNSUP,
Signature · 1 line
2.34.1
#4 lore raw
In reply to James Prestwood

Hi James,

Quoted 6 lines · James Prestwood

The prior print was not very descriptive, and now will log the MAC of the offending BSS.

---
  src/wiphy.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

All applied, thanks.

Regards,
-Denis