uplink_client_base: add handlers for zynq_nic_drv

The zynq_nic_drv follows a zero-copy approach and thus uses the packet
buffers as DMA memory. In order to know when the RX DMA memory can be used
for another packet, a custom ack_avail_handler is needed.
Similarly, packets received from the Uplink session are not copied to a
DMA buffer but to directly passed on as DMA memory. For this purpose,
a a custom packet_avail handler is needed.

genodelabs/genode#4384
This commit is contained in:
Johannes Schlatow 2022-01-26 16:44:40 +01:00 committed by Norman Feske
parent ac691eb229
commit 7aa9cf9b37

View File

@ -62,6 +62,12 @@ class Genode::Uplink_client_base : Noncopyable
if (!_conn.constructed()) {
return;
}
if (_custom_conn_tx_ack_avail_handler()) {
_custom_conn_tx_handle_ack_avail();
return;
}
while (_conn->tx()->ack_avail()) {
_conn->tx()->release_packet(_conn->tx()->get_acked_packet());
@ -73,6 +79,12 @@ class Genode::Uplink_client_base : Noncopyable
if (!_conn.constructed()) {
return;
}
if (_custom_conn_rx_packet_avail_handler()) {
_custom_conn_rx_handle_packet_avail();
return;
}
bool drv_ready_to_transmit_pkt { _drv_link_state };
bool pkts_transmitted { false };
@ -230,6 +242,22 @@ class Genode::Uplink_client_base : Noncopyable
_drv_transmit_pkt(const char *conn_rx_pkt_base,
size_t conn_rx_pkt_size) = 0;
virtual void _custom_conn_rx_handle_packet_avail()
{
class Unexpected_call { };
throw Unexpected_call { };
}
virtual void _custom_conn_tx_handle_ack_avail()
{
class Unexpected_call { };
throw Unexpected_call { };
}
virtual bool _custom_conn_rx_packet_avail_handler() { return false; }
virtual bool _custom_conn_tx_ack_avail_handler() { return false; }
public:
Uplink_client_base(Env &env,