mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-30 16:14:13 +00:00
ipxe nic_drv: do not leak packets on link down/up
On link down toggle the netdev off/on to drain the TX DMA. As long as the link stays down, do not write packets to TX DMA.
This commit is contained in:
parent
a3905fcf87
commit
136b23cb5e
@ -65,8 +65,10 @@ class Ipxe_session_component : public Nic::Session_component
|
||||
return true;
|
||||
}
|
||||
|
||||
if (link_state()) {
|
||||
if (dde_ipxe_nic_tx(1, _tx.sink()->packet_content(packet), packet.size()))
|
||||
Genode::warning("Sending packet failed!");
|
||||
}
|
||||
|
||||
_tx.sink()->acknowledge_packet(packet);
|
||||
return true;
|
||||
|
@ -199,10 +199,20 @@ static void irq_handler(void *p)
|
||||
|
||||
dde_lock_leave();
|
||||
|
||||
if (link_ok != netdev_link_ok(net_dev))
|
||||
int const new_link_ok = netdev_link_ok(net_dev);
|
||||
if (link_ok != new_link_ok) {
|
||||
|
||||
/* report link-state changes */
|
||||
if (link_callback)
|
||||
link_callback();
|
||||
|
||||
/* on link down, drain TX DMA to not leak packets on next link up */
|
||||
if (!new_link_ok) {
|
||||
netdev_close(net_dev);
|
||||
netdev_open(net_dev);
|
||||
netdev_irq(net_dev, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user