mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-23 15:32:25 +00:00
vfs/lwip: add missing signal handlers
Note, without batching from the Nic server this may slow down the throughput a bit. genodelabs/genode#4427
This commit is contained in:
parent
58e0b24006
commit
70bf0cbe84
@ -95,6 +95,7 @@ class Lwip::Nic_netif
|
|||||||
|
|
||||||
Genode::Io_signal_handler<Nic_netif> _link_state_handler;
|
Genode::Io_signal_handler<Nic_netif> _link_state_handler;
|
||||||
Genode::Io_signal_handler<Nic_netif> _rx_packet_handler;
|
Genode::Io_signal_handler<Nic_netif> _rx_packet_handler;
|
||||||
|
Genode::Io_signal_handler<Nic_netif> _tx_ready_handler;
|
||||||
|
|
||||||
bool _dhcp { false };
|
bool _dhcp { false };
|
||||||
|
|
||||||
@ -167,6 +168,21 @@ class Lwip::Nic_netif
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle tx ack_avail and ready_to_submit signals
|
||||||
|
*/
|
||||||
|
void handle_tx_ready()
|
||||||
|
{
|
||||||
|
auto &tx = *_nic.tx();
|
||||||
|
|
||||||
|
/* flush acknowledgements */
|
||||||
|
while (tx.ack_avail())
|
||||||
|
tx.release_packet(tx.get_acked_packet());
|
||||||
|
|
||||||
|
/* notify subclass to resume pending transmissions */
|
||||||
|
status_callback();
|
||||||
|
}
|
||||||
|
|
||||||
void configure(Genode::Xml_node const &config)
|
void configure(Genode::Xml_node const &config)
|
||||||
{
|
{
|
||||||
_dhcp = config.attribute_value("dhcp", false);
|
_dhcp = config.attribute_value("dhcp", false);
|
||||||
@ -232,7 +248,8 @@ class Lwip::Nic_netif
|
|||||||
BUF_SIZE, BUF_SIZE,
|
BUF_SIZE, BUF_SIZE,
|
||||||
config.attribute_value("label", Genode::String<160>("lwip")).string()),
|
config.attribute_value("label", Genode::String<160>("lwip")).string()),
|
||||||
_link_state_handler(env.ep(), *this, &Nic_netif::handle_link_state),
|
_link_state_handler(env.ep(), *this, &Nic_netif::handle_link_state),
|
||||||
_rx_packet_handler( env.ep(), *this, &Nic_netif::handle_rx_packets)
|
_rx_packet_handler( env.ep(), *this, &Nic_netif::handle_rx_packets),
|
||||||
|
_tx_ready_handler( env.ep(), *this, &Nic_netif::handle_tx_ready)
|
||||||
{
|
{
|
||||||
Genode::memset(&_netif, 0x00, sizeof(_netif));
|
Genode::memset(&_netif, 0x00, sizeof(_netif));
|
||||||
|
|
||||||
@ -307,6 +324,8 @@ class Lwip::Nic_netif
|
|||||||
_nic.link_state_sigh(_link_state_handler);
|
_nic.link_state_sigh(_link_state_handler);
|
||||||
_nic.rx_channel()->sigh_packet_avail(_rx_packet_handler);
|
_nic.rx_channel()->sigh_packet_avail(_rx_packet_handler);
|
||||||
_nic.rx_channel()->sigh_ready_to_ack(_rx_packet_handler);
|
_nic.rx_channel()->sigh_ready_to_ack(_rx_packet_handler);
|
||||||
|
_nic.tx_channel()->sigh_ready_to_submit(_tx_ready_handler);
|
||||||
|
_nic.tx_channel()->sigh_ack_avail (_tx_ready_handler);
|
||||||
|
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
@ -1006,7 +1006,9 @@ class Lwip::Udp_socket_dir final :
|
|||||||
|
|
||||||
err_t err = udp_sendto(_pcb, buf, &_to_addr, _to_port);
|
err_t err = udp_sendto(_pcb, buf, &_to_addr, _to_port);
|
||||||
pbuf_free(buf);
|
pbuf_free(buf);
|
||||||
if (err != ERR_OK)
|
if (err == ERR_WOULDBLOCK)
|
||||||
|
return Write_result::WRITE_ERR_WOULD_BLOCK;
|
||||||
|
else if (err != ERR_OK)
|
||||||
return Write_result::WRITE_ERR_IO;
|
return Write_result::WRITE_ERR_IO;
|
||||||
remain -= buf->tot_len;
|
remain -= buf->tot_len;
|
||||||
src += buf->tot_len;
|
src += buf->tot_len;
|
||||||
@ -1496,7 +1498,13 @@ class Lwip::Tcp_socket_dir final :
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* send queued data */
|
/* send queued data */
|
||||||
if (out > 0) tcp_output(_pcb);
|
if (out > 0) {
|
||||||
|
err_t err = tcp_output(_pcb);
|
||||||
|
if (err == ERR_WOULDBLOCK)
|
||||||
|
return Write_result::WRITE_ERR_WOULD_BLOCK;
|
||||||
|
else if (err != ERR_OK)
|
||||||
|
return Write_result::WRITE_ERR_IO;
|
||||||
|
}
|
||||||
|
|
||||||
out_count = out;
|
out_count = out;
|
||||||
return res;
|
return res;
|
||||||
|
Loading…
Reference in New Issue
Block a user