[wlan][sme] Log HT/VHT cap into Inspect
Bug: 52811
Test: Logging change only
Change-Id: I45f54a3f33fa92871629bad314e2efeb7178fad2
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/402576
Commit-Queue: Kiet Tran <kiettran@google.com>
Reviewed-by: Charles Celerier <chcl@google.com>
Testability-Review: Charles Celerier <chcl@google.com>
diff --git a/src/connectivity/wlan/lib/sme/src/client/bss.rs b/src/connectivity/wlan/lib/sme/src/client/bss.rs
index c5f88cb..33f0cff 100644
--- a/src/connectivity/wlan/lib/sme/src/client/bss.rs
+++ b/src/connectivity/wlan/lib/sme/src/client/bss.rs
@@ -4,7 +4,7 @@
use {
crate::{Config, Ssid},
- fidl_fuchsia_wlan_mlme::BssDescription,
+ fidl_fuchsia_wlan_mlme::{self as fidl_mlme, BssDescription},
std::{cmp::Ordering, collections::HashSet},
wlan_common::{
bss::{BssDescriptionExt, Protection},
@@ -51,6 +51,8 @@
channel: bss.chan.primary,
protection: bss.get_protection(),
compatible: self.is_bss_compatible(bss),
+ ht_cap: bss.ht_cap.as_ref().map(|cap| **cap),
+ vht_cap: bss.vht_cap.as_ref().map(|cap| **cap),
probe_resp_wsc,
wmm_param,
}
@@ -118,6 +120,8 @@
pub channel: u8,
pub protection: Protection,
pub compatible: bool,
+ pub ht_cap: Option<fidl_mlme::HtCapabilities>,
+ pub vht_cap: Option<fidl_mlme::VhtCapabilities>,
pub probe_resp_wsc: Option<wsc::ProbeRespWsc>,
pub wmm_param: Option<ie::WmmParam>,
}
@@ -145,8 +149,9 @@
super::*,
crate::client::test_utils::{fake_bss_with_bssid, fake_wmm_param},
fidl_fuchsia_wlan_common as fidl_common, fidl_fuchsia_wlan_mlme as fidl_mlme,
- std::cmp::Ordering,
+ std::{cmp::Ordering, convert::TryInto},
wlan_common::ie,
+ zerocopy::AsBytes,
};
enum ProtectionCfg {
@@ -284,6 +289,12 @@
channel: 1,
protection: Protection::Wpa2Personal,
compatible: true,
+ ht_cap: Some(fidl_mlme::HtCapabilities {
+ bytes: ie::fake_ht_capabilities().as_bytes().try_into().unwrap()
+ }),
+ vht_cap: Some(fidl_mlme::VhtCapabilities {
+ bytes: ie::fake_vht_capabilities().as_bytes().try_into().unwrap()
+ }),
probe_resp_wsc: None,
wmm_param: None,
}
@@ -301,6 +312,12 @@
channel: 1,
protection: Protection::Wpa2Personal,
compatible: true,
+ ht_cap: Some(fidl_mlme::HtCapabilities {
+ bytes: ie::fake_ht_capabilities().as_bytes().try_into().unwrap()
+ }),
+ vht_cap: Some(fidl_mlme::VhtCapabilities {
+ bytes: ie::fake_vht_capabilities().as_bytes().try_into().unwrap()
+ }),
probe_resp_wsc: None,
wmm_param: Some(wmm_param),
}
@@ -316,6 +333,12 @@
channel: 1,
protection: Protection::Wep,
compatible: false,
+ ht_cap: Some(fidl_mlme::HtCapabilities {
+ bytes: ie::fake_ht_capabilities().as_bytes().try_into().unwrap()
+ }),
+ vht_cap: Some(fidl_mlme::VhtCapabilities {
+ bytes: ie::fake_vht_capabilities().as_bytes().try_into().unwrap()
+ }),
probe_resp_wsc: None,
wmm_param: None,
}
@@ -332,6 +355,12 @@
channel: 1,
protection: Protection::Wep,
compatible: true,
+ ht_cap: Some(fidl_mlme::HtCapabilities {
+ bytes: ie::fake_ht_capabilities().as_bytes().try_into().unwrap()
+ }),
+ vht_cap: Some(fidl_mlme::VhtCapabilities {
+ bytes: ie::fake_vht_capabilities().as_bytes().try_into().unwrap()
+ }),
probe_resp_wsc: None,
wmm_param: None,
}
@@ -405,11 +434,14 @@
rcpi_dbmh: _rcpi_dbmh,
rsni_dbh: 0,
- ht_cap: None,
+ ht_cap: Some(Box::new(fidl_mlme::HtCapabilities {
+ bytes: ie::fake_ht_capabilities().as_bytes().try_into().unwrap(),
+ })),
ht_op: None,
- vht_cap: None,
+ vht_cap: Some(Box::new(fidl_mlme::VhtCapabilities {
+ bytes: ie::fake_vht_capabilities().as_bytes().try_into().unwrap(),
+ })),
vht_op: None,
-
chan: fidl_common::WlanChan {
primary: 1,
secondary80: 0,
diff --git a/src/connectivity/wlan/lib/sme/src/client/inspect.rs b/src/connectivity/wlan/lib/sme/src/client/inspect.rs
index e4425b4..40d0796 100644
--- a/src/connectivity/wlan/lib/sme/src/client/inspect.rs
+++ b/src/connectivity/wlan/lib/sme/src/client/inspect.rs
@@ -4,7 +4,9 @@
use {
crate::client::{bss::BssInfo, Status as SmeStatus},
- fuchsia_inspect::{BoolProperty, IntProperty, Node, Property, StringProperty, UintProperty},
+ fuchsia_inspect::{
+ BoolProperty, BytesProperty, IntProperty, Node, Property, StringProperty, UintProperty,
+ },
fuchsia_inspect_contrib::nodes::{BoundedListNode, NodeExt, TimeProperty},
fuchsia_zircon as zx,
parking_lot::Mutex,
@@ -226,6 +228,8 @@
protection: StringProperty,
_is_wmm_assoc: BoolProperty,
_wmm_param: Option<BssWmmParamNode>,
+ ht_cap: Option<BytesProperty>,
+ vht_cap: Option<BytesProperty>,
wsc: Option<BssWscNode>,
}
@@ -244,6 +248,8 @@
.wmm_param
.as_ref()
.map(|p| BssWmmParamNode::new(node.create_child("wmm_param"), &p));
+ let ht_cap = bss_info.ht_cap.map(|cap| node.create_bytes("ht_cap", cap.bytes));
+ let vht_cap = bss_info.vht_cap.map(|cap| node.create_bytes("vht_cap", cap.bytes));
let mut this = Self {
node,
@@ -257,6 +263,8 @@
protection,
_is_wmm_assoc: is_wmm_assoc,
_wmm_param: wmm_param,
+ ht_cap,
+ vht_cap,
wsc: None,
};
this.update_wsc_node(bss_info);
@@ -272,6 +280,24 @@
self.snr_db.set(bss_info.snr_db as i64);
self.channel.set(bss_info.channel as u64);
self.protection.set(&format!("{}", bss_info.protection));
+ match &bss_info.ht_cap {
+ Some(ht_cap) => match self.ht_cap.as_mut() {
+ Some(ht_cap_prop) => ht_cap_prop.set(&ht_cap.bytes),
+ None => self.ht_cap = Some(self.node.create_bytes("ht_cap", ht_cap.bytes)),
+ },
+ None => {
+ self.ht_cap.take();
+ }
+ }
+ match &bss_info.vht_cap {
+ Some(vht_cap) => match self.vht_cap.as_mut() {
+ Some(vht_cap_prop) => vht_cap_prop.set(&vht_cap.bytes),
+ None => self.vht_cap = Some(self.node.create_bytes("vht_cap", vht_cap.bytes)),
+ },
+ None => {
+ self.vht_cap.take();
+ }
+ }
self.update_wsc_node(bss_info);
}
diff --git a/src/connectivity/wlan/lib/sme/src/client/test_utils.rs b/src/connectivity/wlan/lib/sme/src/client/test_utils.rs
index 46613ec..4744b41 100644
--- a/src/connectivity/wlan/lib/sme/src/client/test_utils.rs
+++ b/src/connectivity/wlan/lib/sme/src/client/test_utils.rs
@@ -135,6 +135,12 @@
channel: 1,
protection: Protection::Wpa2Personal,
compatible: true,
+ ht_cap: Some(fidl_mlme::HtCapabilities {
+ bytes: fake_ht_capabilities().as_bytes().try_into().unwrap(),
+ }),
+ vht_cap: Some(fidl_mlme::VhtCapabilities {
+ bytes: fake_vht_capabilities().as_bytes().try_into().unwrap(),
+ }),
probe_resp_wsc: None,
wmm_param: None,
}