3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-21 11:52:34 +01:00

ap: Simplify ap_common_rates

If we've checked that the STA has included our Basic Rate we've already
found one common rate, no need for further checks.
This commit is contained in:
Andrew Zaborowski 2017-09-30 04:28:11 +02:00 committed by Denis Kenzior
parent f011b81b19
commit a26ca0fb66

View File

@ -795,19 +795,11 @@ static void ap_disassociate_sta(struct ap_state *ap, struct sta_state *sta)
static bool ap_common_rates(struct l_uintset *ap_rates, static bool ap_common_rates(struct l_uintset *ap_rates,
struct l_uintset *sta_rates) struct l_uintset *sta_rates)
{ {
uint32_t r, minr, maxr; uint32_t minr = l_uintset_find_min(ap_rates);
minr = l_uintset_find_min(ap_rates);
maxr = l_uintset_find_max(ap_rates);
/* Our lowest rate is a Basic Rate so must be supported */ /* Our lowest rate is a Basic Rate so must be supported */
if (!l_uintset_contains(sta_rates, minr)) if (l_uintset_contains(sta_rates, minr))
return false; return true;
for (r = minr + 1; r <= maxr; r++)
if (l_uintset_contains(ap_rates, r) &&
l_uintset_contains(sta_rates, r))
return true;
return false; return false;
} }