commit 78b9328db6e5277cff5f5166db46662e6191904a
parent f902c7019dba518648bd8b5bf4e45ac78fdc26e5
Author: Denis Kenzior <denkenz@gmail.com>
Date: Wed, 28 Jul 2021 09:53:21 -0500
scan: Quiet down warning
Under certain conditions, access points with very low signal could be
detected. This signal is too low to estimate a data rate and causes
this L_WARN to fire. Fix this by returning a -ENETUNREACH error code in
case the signal is too low for any of the supported rates.
Diffstat:
3 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/src/band.c b/src/band.c
@@ -115,7 +115,7 @@ int band_estimate_nonht_rate(const struct band *band,
}
if (!max_rate)
- return -EINVAL;
+ return -ENETUNREACH;
*out_data_rate = max_rate * 500000;
return 0;
@@ -306,7 +306,7 @@ int band_estimate_ht_rx_rate(const struct band *band,
rssi, sgi, out_data_rate))
return 0;
- return -EINVAL;
+ return -ENETUNREACH;
}
static bool find_best_mcs_vht(uint8_t max_index, enum ofdm_channel_width width,
@@ -463,5 +463,5 @@ try_vht80:
rssi, nss, sgi, out_data_rate))
return 0;
- return -EINVAL;
+ return -ENETUNREACH;
}
diff --git a/src/scan.c b/src/scan.c
@@ -1235,11 +1235,15 @@ static struct scan_bss *scan_parse_attr_bss(struct l_genl_attr *attr,
bss->data_rate = 2000000;
if (ies) {
+ int ret;
+
if (!scan_parse_bss_information_elements(bss, ies, ies_len))
goto fail;
- L_WARN_ON(wiphy_estimate_data_rate(wiphy, ies, ies_len, bss,
- &bss->data_rate) < 0);
+ ret = wiphy_estimate_data_rate(wiphy, ies, ies_len, bss,
+ &bss->data_rate);
+ if (ret < 0 && ret != -ENETUNREACH)
+ l_warn("wiphy_estimate_data_rate() failed");
}
return bss;
diff --git a/src/wiphy.c b/src/wiphy.c
@@ -771,13 +771,10 @@ int wiphy_estimate_data_rate(struct wiphy *wiphy,
out_data_rate))
return 0;
- if (!band_estimate_nonht_rate(bandp, supported_rates,
+ return band_estimate_nonht_rate(bandp, supported_rates,
ext_supported_rates,
bss->signal_strength / 100,
- out_data_rate))
- return 0;
-
- return -ENOTSUP;
+ out_data_rate);
}
uint32_t wiphy_state_watch_add(struct wiphy *wiphy,