UPSTREAM: mac80211: reject/clear user rate mask if not usable

If the user rate mask results in no (basic) rates being usable,
clear it. Also, if we're already operating when it's set, reject
it instead.

Technically, selecting basic rates as the criterion is a bit too
restrictive, but calculating the usable rates over all stations
(e.g. in AP mode) is harder, and all stations must support the
basic rates. Similarly, in client mode, the basic rates will be
used anyway for control frames.

This fixes the "no supported rates (...) in rate_mask ..." warning
that occurs on TX when you've selected a rate mask that's not
compatible with the connection (e.g. an AP that enables only the
rates 36, 48, 54 and you've selected only 6, 9, 12.)

Reported-by: Kirtika Ruchandani <kirtika@google.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
(cherry picked from commit e8e4f5280ddd0a7b43a795f90a0758e3c99df6a6)

BUG=b:35585377
TEST=(TBD) Build,boot, connect to GoogleGuest on Reef,
     followed by `suspend_stress_test -c 10`, make sure
     dmesg has no warnings about "no supported rates".

Change-Id: Icab86b71ed450ccceb664638e249ce0750caeae1
Reviewed-on: https://chromium-review.googlesource.com/506055
Commit-Ready: Kirtika Ruchandani <kirtika@chromium.org>
Tested-by: Kirtika Ruchandani <kirtika@chromium.org>
Reviewed-by: Eric Caruso <ejcaruso@chromium.org>
4 files changed