summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAhmed ElArabawy <arabawy@google.com>2022-03-24 20:10:27 -0700
committerAhmed ElArabawy <arabawy@google.com>2022-03-24 20:10:27 -0700
commitbbc68975fe438ba355a32285edb8bcaa6283eacf (patch)
treeea39f37fd48c6d3d2a0032b8244b6bdc8de0ce0b
parent81f997b7e455295aa383f31cc1a8878dbc94b660 (diff)
downloadwificond-bbc68975fe438ba355a32285edb8bcaa6283eacf.tar.gz
WiFi: Parse 11be 80211nl attributes
Bug: 216212018 Bug: 225145745 Test: Build Successful Change-Id: I827d8fb733cb662c9e56a6209091f2b6314bddda
-rw-r--r--net/netlink_manager.cpp5
-rw-r--r--net/netlink_utils.cpp28
-rw-r--r--net/netlink_utils.h4
3 files changed, 28 insertions, 9 deletions
diff --git a/net/netlink_manager.cpp b/net/netlink_manager.cpp
index bc15a07..22154a7 100644
--- a/net/netlink_manager.cpp
+++ b/net/netlink_manager.cpp
@@ -71,9 +71,8 @@ ChannelBandwidth getBandwidthType(uint32_t bandwidth) {
return BW_80P80;
case NL80211_CHAN_WIDTH_160:
return BW_160;
-//TODO: To be added after the nl80211.h file is updated with 11be changes
-// case NL80211_CHAN_WIDTH_320:
-// return BW_320;
+ case NL80211_CHAN_WIDTH_320:
+ return BW_320;
}
LOG(ERROR) << "Unknown bandwidth type: " << bandwidth;
return BW_INVALID;
diff --git a/net/netlink_utils.cpp b/net/netlink_utils.cpp
index 4d006d6..73901ca 100644
--- a/net/netlink_utils.cpp
+++ b/net/netlink_utils.cpp
@@ -71,7 +71,8 @@ constexpr uint8_t kHeCapPhyNumByte = 9; // Should be 11
constexpr uint8_t kHe160MhzBitMask = 0x8;
constexpr uint8_t kHe80p80MhzBitMask = 0x10;
-//TODO(b/216212018) Add constants for EHT, and 320MHz
+constexpr uint8_t kEhtCapPhyNumByte = 8;
+constexpr uint8_t kEht320MhzBitMask = 0x2;
bool IsExtFeatureFlagSet(
const std::vector<uint8_t>& ext_feature_flags_bytes,
@@ -459,7 +460,6 @@ bool NetlinkUtils::ParseBandInfo(const NL80211Packet* const packet,
ParseIfTypeDataAttributes(iftype_data_attr, out_band_info);
}
ParseHtVhtPhyCapabilities(band, out_band_info);
- //TODO(b/216212018) parse for HE/EHT
}
return true;
@@ -473,7 +473,6 @@ void NetlinkUtils::ParseIfTypeDataAttributes(
LOG(ERROR) << "Failed to get the list of attributes under iftype_data_attr";
return;
}
- //TODO(b/216212018) Parse attributes for 11be/EHT
NL80211NestedAttr attr = attrs[0];
if (attr.HasAttribute(NL80211_BAND_IFTYPE_ATTR_HE_CAP_PHY)) {
@@ -483,6 +482,10 @@ void NetlinkUtils::ParseIfTypeDataAttributes(
if (attr.HasAttribute(NL80211_BAND_IFTYPE_ATTR_HE_CAP_MCS_SET)) {
ParseHeMcsSetAttribute(attr, out_band_info);
}
+ if (attr.HasAttribute(NL80211_BAND_IFTYPE_ATTR_EHT_CAP_PHY)) {
+ out_band_info->is_80211be_supported = true;
+ ParseEhtCapPhyAttribute(attr, out_band_info);
+ }
return;
}
@@ -683,6 +686,25 @@ void NetlinkUtils::ParseHeCapPhyAttribute(const NL80211NestedAttr& attribute,
}
}
+void NetlinkUtils::ParseEhtCapPhyAttribute(const NL80211NestedAttr& attribute,
+ BandInfo* out_band_info) {
+ vector<uint8_t> eht_cap_phy;
+ if (!attribute.GetAttributeValue(
+ NL80211_BAND_IFTYPE_ATTR_EHT_CAP_PHY,
+ &eht_cap_phy)) {
+ LOG(ERROR) << " EHT CAP PHY is not found";
+ return;
+ }
+
+ if (eht_cap_phy.size() < kEhtCapPhyNumByte) {
+ LOG(ERROR) << "EHT Cap PHY size is incorrect";
+ return;
+ }
+ if (eht_cap_phy[0] & kEht320MhzBitMask) {
+ out_band_info->is_320_mhz_supported = true;
+ }
+}
+
bool NetlinkUtils::GetStationInfo(uint32_t interface_index,
const array<uint8_t, ETH_ALEN>& mac_address,
StationInfo* out_station_info) {
diff --git a/net/netlink_utils.h b/net/netlink_utils.h
index d07ffbf..3b334d9 100644
--- a/net/netlink_utils.h
+++ b/net/netlink_utils.h
@@ -319,8 +319,6 @@ class NetlinkUtils {
BandInfo* out_band_info);
void ParseHeMcsSetAttribute(const NL80211NestedAttr& attribute,
BandInfo* out_band_info);
- void ParseEhtMcsSetAttribute(const NL80211NestedAttr& attribute,
- BandInfo* out_band_info);//TODO Implementation missing
std::pair<uint32_t, uint32_t> ParseHtMcsSet(
const std::vector<uint8_t>& ht_mcs_set);
uint32_t ParseMcsMap(uint16_t mcs_map);
@@ -329,7 +327,7 @@ class NetlinkUtils {
void ParseHeCapPhyAttribute(const NL80211NestedAttr& attribute,
BandInfo* out_band_info);
void ParseEhtCapPhyAttribute(const NL80211NestedAttr& attribute,
- BandInfo* out_band_info);//TODO: implementation missing
+ BandInfo* out_band_info);
bool ParseScanCapabilities(const NL80211Packet* const packet,
ScanCapabilities* out_scan_capabilities);