wifi_drv: optionally report MAC address

Issue #4133
This commit is contained in:
Christian Helmuth 2021-05-26 17:14:35 +02:00
parent aab6f52325
commit f0b9549376
3 changed files with 38 additions and 0 deletions

View File

@ -285,6 +285,13 @@ On certain cards, e.g. Intel Wireless 6200 ABG, it may be necessary to disable
the 11n mode. This can be achieved by setting the 'use_11n' attribute in
the 'wifi_config' node to 'no'.
The driver optionally reports the following information under the
label "devices" if requested in the config as depicted.
! <config> <report mac_address="true"/> </config>
! <devices> <nic mac_address="02:00:00:00:00:01"/> </devices>
lx_kit
######

View File

@ -195,9 +195,17 @@ append config {
</config>
</start>
<start name="devices_report_rom">
<binary name="report_rom"/>
<resource name="RAM" quantum="1200K"/>
<provides> <service name="Report"/> <service name="ROM"/> </provides>
<config verbose="yes"/>
</start>
<start name="wifi_drv" caps="220">
<resource name="RAM" quantum="28M"/>
<config ld_verbose="yes">
<report mac_address="true"/>
<libc stdout="/dev/null" stderr="/dev/null" rtc="/dev/rtc"/>
<vfs>
<dir name="dev"> <log/> <null/> <rtc/>
@ -211,6 +219,7 @@ append config {
<service name="Rtc"> <any-child/> </service>
<service name="Report" label="accesspoints"> <child name="accesspoints_report_rom"/> </service>
<service name="Report" label="state"> <child name="state_report_rom"/> </service>
<service name="Report" label="devices"> <child name="devices_report_rom"/> </service>
<service name="ROM" label="wifi_config"> <child name="config_rom"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>

View File

@ -18,6 +18,7 @@
#include <base/snprintf.h>
#include <base/tslab.h>
#include <base/registry.h>
#include <os/reporter.h>
#include <util/xml_node.h>
#include <uplink_session/connection.h>
@ -111,6 +112,8 @@ class Genode::Wifi_uplink
net_device *_device { nullptr };
Constructible<Reporter> _reporter { };
static Wifi_uplink *_instance;
class Uplink_client : public Uplink_client_base
@ -175,6 +178,8 @@ class Genode::Wifi_uplink
!(_ndev.state & 1UL << __LINK_STATE_NOCARRIER));
}
Net::Mac_address mac_address() const { return _drv_mac_addr; }
void handle_driver_link_state(bool state)
{
_drv_handle_link_state(state);
@ -241,6 +246,23 @@ class Genode::Wifi_uplink
void activate()
{
_client.construct(_env, _alloc, device());
Lx_kit::env().config_rom().xml().with_sub_node("report", [&] (Xml_node const &xml) {
bool const report_mac_address =
xml.attribute_value("mac_address", false);
if (!report_mac_address)
return;
_reporter.construct(_env, "devices");
_reporter->enabled(true);
Reporter::Xml_generator report(*_reporter, [&] () {
report.node("nic", [&] () {
report.attribute("mac_address", String<32>(_client->mac_address()));
});
});
});
}
void handle_driver_rx_packet(struct sk_buff *skb)