statd: Add rx/tx bitrate to WiFi station operational data

Extend the WiFi station mode with rx-speed and tx-speed leaves,
mirroring what already exists for AP mode connected stations.
Display bitrates in 'show interface <wifi>' detailed view.

Also standardize speed units to kbps/Mbps across the YANG model.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2026-01-24 19:17:48 +01:00
parent 496eda7eb2
commit 87a754eab1
3 changed files with 51 additions and 11 deletions
+7 -1
View File
@@ -1295,7 +1295,7 @@ class Iface:
rx_bytes = station.get("rx-bytes", 0)
tx_bytes = station.get("tx-bytes", 0)
# Speed in 100 kbit/s units, convert to Mbps for display
# Speed in 100 kbps units, convert to Mbps for display
rx_speed = station.get("rx-speed", 0)
tx_speed = station.get("tx-speed", 0)
rx_speed_str = f"{rx_speed / 10:.1f}" if rx_speed else "-"
@@ -1640,6 +1640,12 @@ class Iface:
if rssi is not None:
signal_status = rssi_to_status(rssi)
print(f"{'signal':<{20}}: {rssi} dBm ({signal_status})")
rx_speed = station.get('rx-speed')
tx_speed = station.get('tx-speed')
if rx_speed is not None:
print(f"{'rx bitrate':<{20}}: {rx_speed / 10:.1f} Mbps")
if tx_speed is not None:
print(f"{'tx bitrate':<{20}}: {tx_speed / 10:.1f} Mbps")
if "scan-results" in station:
self.pr_wifi_ssids()
@@ -70,6 +70,10 @@ def wifi_station(ifname):
station_data['ssid'] = link['ssid']
if link.get('rssi') is not None:
station_data['rssi'] = link['rssi']
if link.get('rx-speed') is not None:
station_data['rx-speed'] = link['rx-speed']
if link.get('tx-speed') is not None:
station_data['tx-speed'] = link['tx-speed']
# Get scan results from wpa_supplicant (better scan support)
try: