diff --git a/aidl/android/net/wifi/nl80211/IWificond.aidl b/aidl/android/net/wifi/nl80211/IWificond.aidl index 65560fd..34e71c3 100644 --- a/aidl/android/net/wifi/nl80211/IWificond.aidl +++ b/aidl/android/net/wifi/nl80211/IWificond.aidl @@ -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. diff --git a/net/netlink_utils.cpp b/net/netlink_utils.cpp index c31249d..c60f143 100644 --- a/net/netlink_utils.cpp +++ b/net/netlink_utils.cpp @@ -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); } } } diff --git a/net/netlink_utils.h b/net/netlink_utils.h index df92e7d..88ee7db 100644 --- a/net/netlink_utils.h +++ b/net/netlink_utils.h @@ -66,6 +66,8 @@ struct BandInfo { std::vector band_dfs; // Frequencies for 6 GHz band. std::vector band_6g; + // Frequencies for 60 GHz band. + std::vector band_60g; // support for 802.11n bool is_80211n_supported; // support for 802.11ac diff --git a/server.cpp b/server.cpp index 41ea4de..e2f2c29 100644 --- a/server.cpp +++ b/server.cpp @@ -342,6 +342,24 @@ Status Server::getAvailable6gChannels( return Status::ok(); } +Status Server::getAvailable60gChannels( + std::optional>* 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* 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) { diff --git a/server.h b/server.h index e8c5fe9..158b70e 100644 --- a/server.h +++ b/server.h @@ -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>* out_frequencies) override; + // Returns a vector of available frequencies for 60GHz channels. + android::binder::Status getAvailable60gChannels( + ::std::optional<::std::vector>* out_frequencies) override; android::binder::Status createApInterface( const std::string& iface_name,