nic_dump: link state and mac address
The NIC dump component didn't support forwarding of link states and link-state signals until now. Furthermore, it now prints MAC address and link state on session creation and on every link state change. Ref #2490
This commit is contained in:
parent
84ad50b527
commit
b531a862bb
|
@ -70,7 +70,7 @@ Net::Session_component::Session_component(Allocator &alloc,
|
||||||
timer, curr_time, config.attribute_value("time", false),
|
timer, curr_time, config.attribute_value("time", false),
|
||||||
_guarded_alloc),
|
_guarded_alloc),
|
||||||
_uplink(env, config, timer, curr_time, alloc),
|
_uplink(env, config, timer, curr_time, alloc),
|
||||||
_mac(_uplink.mac_address())
|
_link_state_handler(env.ep(), *this, &Session_component::_handle_link_state)
|
||||||
{
|
{
|
||||||
_tx.sigh_ready_to_ack(_sink_ack);
|
_tx.sigh_ready_to_ack(_sink_ack);
|
||||||
_tx.sigh_packet_avail(_sink_submit);
|
_tx.sigh_packet_avail(_sink_submit);
|
||||||
|
@ -78,19 +78,26 @@ Net::Session_component::Session_component(Allocator &alloc,
|
||||||
_rx.sigh_ready_to_submit(_source_submit);
|
_rx.sigh_ready_to_submit(_source_submit);
|
||||||
Interface::remote(_uplink);
|
Interface::remote(_uplink);
|
||||||
_uplink.Interface::remote(*this);
|
_uplink.Interface::remote(*this);
|
||||||
|
_uplink.link_state_sigh(_link_state_handler);
|
||||||
|
_print_state();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Session_component::link_state()
|
void Session_component::_print_state()
|
||||||
{
|
{
|
||||||
warning("Session_component::link_state not implemented");
|
log("\033[33m(new state)\033[0m \033[32mMAC address\033[0m ", mac_address(),
|
||||||
return false;
|
" \033[32mlink state\033[0m ", link_state());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Session_component::link_state_sigh(Signal_context_capability sigh)
|
void Session_component::_handle_link_state()
|
||||||
{
|
{
|
||||||
warning("Session_component::link_state_sigh not implemented");
|
_print_state();
|
||||||
|
if (!_link_state_sigh.valid()) {
|
||||||
|
warning("failed to forward signal");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Signal_transmitter(_link_state_sigh).submit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -73,8 +73,12 @@ class Net::Session_component : public Session_component_base,
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Uplink _uplink;
|
Uplink _uplink;
|
||||||
Mac_address _mac;
|
Genode::Signal_context_capability _link_state_sigh;
|
||||||
|
Genode::Signal_handler<Session_component> _link_state_handler;
|
||||||
|
|
||||||
|
void _handle_link_state();
|
||||||
|
void _print_state();
|
||||||
|
|
||||||
|
|
||||||
/********************
|
/********************
|
||||||
|
@ -100,9 +104,9 @@ class Net::Session_component : public Session_component_base,
|
||||||
** Nic::Session **
|
** Nic::Session **
|
||||||
******************/
|
******************/
|
||||||
|
|
||||||
Mac_address mac_address() { return _mac; }
|
Mac_address mac_address() { return _uplink.mac_address(); }
|
||||||
bool link_state();
|
bool link_state() { return _uplink.link_state(); }
|
||||||
void link_state_sigh(Genode::Signal_context_capability sigh);
|
void link_state_sigh(Genode::Signal_context_capability sigh) { _link_state_sigh = sigh; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user