Пример #1
0
		void _tx_ack(bool block = false)
		{
			/* check for acknowledgements */
			while (_nic.tx()->ack_avail() || block) {
				Nic::Packet_descriptor acked_packet = _nic.tx()->get_acked_packet();
				_nic.tx()->release_packet(acked_packet);
				block = false;
			}
		}
Пример #2
0
		int send_packet(void *packet, uint32_t packet_len)
		{
			Nic::Packet_descriptor tx_packet = _alloc_tx_packet(packet_len);

			char *tx_content = _nic.tx()->packet_content(tx_packet);
			Genode::memcpy(tx_content, packet, packet_len);

			_nic.tx()->submit_packet(tx_packet);
			_tx_ack();

			return VINF_SUCCESS;
		}
Пример #3
0
		Nic::Packet_descriptor _alloc_tx_packet(Genode::size_t len)
		{
			while (true) {
				try {
					Nic::Packet_descriptor packet = _nic.tx()->alloc_packet(len);
					return packet;
				} catch (Nic::Session::Tx::Source::Packet_alloc_failed) {
					_tx_ack(true);
				}
			}
		}