wificond: support 60GHz band

Add 60G channels list to BandInfo.
Add getAvailable60gChannels for retrieving the 60g channels.

Bug: 147522434
Test: system/connectivity/wificond/runtests.sh
Change-Id: Ice1abf3d4345b80560cbbc2b3207889ca4fb6f8f
This commit is contained in:
Jimmy Chen 2020-08-14 14:32:52 +08:00
parent c7c1d7b6c6
commit eed3ad38ca
5 changed files with 44 additions and 0 deletions

View File

@ -67,6 +67,10 @@ interface IWificond {
// Returrns null on failure.
@nullable int[] getAvailable6gChannels();
// Returns an array of available frequencies for 60GHz channels.
// Returrns null on failure.
@nullable int[] getAvailable60gChannels();
// Register a callback to receive interface status updates.
//
// Multiple callbacks can be registered simultaneously.

View File

@ -58,6 +58,9 @@ uint32_t k5GHzFrequencyUpperBound = 5865;
uint32_t k6GHzFrequencyLowerBound = 5925;
uint32_t k6GHzFrequencyUpperBound = 7125;
uint32_t k60GHzFrequencyLowerBound = 58320;
uint32_t k60GHzFrequencyUpperBound = 70200;
constexpr uint8_t kHtMcsSetNumByte = 16;
constexpr uint8_t kVhtMcsSetNumByte = 8;
constexpr uint8_t kHeMcsSetNumByteMin = 4;
@ -524,6 +527,9 @@ void NetlinkUtils::handleBandFreqAttributes(const NL80211NestedAttr& freqs_attr,
} else if (frequency_value > k6GHzFrequencyLowerBound &&
frequency_value < k6GHzFrequencyUpperBound) {
out_band_info->band_6g.push_back(frequency_value);
} else if (frequency_value >= k60GHzFrequencyLowerBound &&
frequency_value < k60GHzFrequencyUpperBound) {
out_band_info->band_60g.push_back(frequency_value);
}
}
}

View File

@ -66,6 +66,8 @@ struct BandInfo {
std::vector<uint32_t> band_dfs;
// Frequencies for 6 GHz band.
std::vector<uint32_t> band_6g;
// Frequencies for 60 GHz band.
std::vector<uint32_t> band_60g;
// support for 802.11n
bool is_80211n_supported;
// support for 802.11ac

View File

@ -342,6 +342,24 @@ Status Server::getAvailable6gChannels(
return Status::ok();
}
Status Server::getAvailable60gChannels(
std::optional<vector<int32_t>>* out_frequencies) {
int wiphy_index = GetWiphyIndexFromBand(NL80211_BAND_60GHZ);
BandInfo band_info;
if (!GetBandInfo(wiphy_index, &band_info)) {
out_frequencies->reset();
return Status::ok();
}
if (band_info.band_60g.size() == 0)
out_frequencies->reset();
else
out_frequencies->emplace(
band_info.band_60g.begin(), band_info.band_60g.end());
return Status::ok();
}
Status Server::getDeviceWiphyCapabilities(
const std::string& iface_name,
std::optional<DeviceWiphyCapabilities>* capabilities) {
@ -452,6 +470,11 @@ void Server::LogSupportedBands(uint32_t wiphy_index) {
}
LOG(INFO) << "6Ghz frequencies:"<< ss.str();
ss.str("");
for (unsigned int i = 0; i < band_info.band_60g.size(); i++) {
ss << " " << band_info.band_60g[i];
}
LOG(INFO) << "60Ghz frequencies:"<< ss.str();
}
void Server::BroadcastClientInterfaceReady(
@ -549,6 +572,12 @@ void Server::UpdateBandWiphyIndexMap(int wiphy_index) {
LOG(INFO) << "add channel type " << NL80211_BAND_6GHZ
<< " support at wiphy index: " << wiphy_index;
}
if (band_info.band_60g.size() != 0
&& band_to_wiphy_index_map_.find(NL80211_BAND_60GHZ) == band_to_wiphy_index_map_.end()) {
band_to_wiphy_index_map_[NL80211_BAND_60GHZ] = wiphy_index;
LOG(INFO) << "add channel type " << NL80211_BAND_60GHZ
<< " support at wiphy index: " << wiphy_index;
}
}
void Server::EraseBandWiphyIndexMap(int wiphy_index) {

View File

@ -66,6 +66,9 @@ class Server : public android::net::wifi::nl80211::BnWificond {
// Returns a vector of available frequencies for 6GHz channels.
android::binder::Status getAvailable6gChannels(
::std::optional<::std::vector<int32_t>>* out_frequencies) override;
// Returns a vector of available frequencies for 60GHz channels.
android::binder::Status getAvailable60gChannels(
::std::optional<::std::vector<int32_t>>* out_frequencies) override;
android::binder::Status createApInterface(
const std::string& iface_name,