2012-10-11 14:41:29 +02:00
|
|
|
/*
|
|
|
|
* \brief Network receive handler per MAC address
|
|
|
|
* \author Markus Partheymueller
|
|
|
|
* \date 2012-07-31
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2012 Intel Corporation
|
|
|
|
* Copyright (C) 2013 Genode Labs GmbH
|
|
|
|
*
|
2014-01-10 22:58:28 +01:00
|
|
|
* This file is distributed under the terms of the GNU General Public License
|
|
|
|
* version 2.
|
2012-10-11 14:41:29 +02:00
|
|
|
*
|
|
|
|
* The code is partially based on the Vancouver VMM, which is distributed
|
|
|
|
* under the terms of the GNU General Public License version 2.
|
|
|
|
*
|
|
|
|
* Modifications by Intel Corporation are contributed under the terms and
|
|
|
|
* conditions of the GNU General Public License version 2.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* local includes */
|
|
|
|
#include <network.h>
|
|
|
|
|
|
|
|
extern const void * _forward_pkt;
|
|
|
|
|
|
|
|
|
2013-05-16 23:32:27 +02:00
|
|
|
Vancouver_network::Vancouver_network(Synced_motherboard &mb, Nic::Session *nic)
|
2013-10-10 17:00:03 +02:00
|
|
|
: Thread("vmm_network"), _motherboard(mb), _nic(nic)
|
2012-10-11 14:41:29 +02:00
|
|
|
{
|
|
|
|
start();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Vancouver_network::entry()
|
|
|
|
{
|
|
|
|
while (true) {
|
|
|
|
Packet_descriptor rx_packet = _nic->rx()->get_packet();
|
|
|
|
|
|
|
|
/* send it to the network bus */
|
|
|
|
char * rx_content = _nic->rx()->packet_content(rx_packet);
|
|
|
|
_forward_pkt = rx_content;
|
|
|
|
MessageNetwork msg((unsigned char *)rx_content, rx_packet.size(), 0);
|
2013-05-16 23:32:27 +02:00
|
|
|
_motherboard()->bus_network.send(msg);
|
2012-10-11 14:41:29 +02:00
|
|
|
_forward_pkt = 0;
|
|
|
|
|
|
|
|
/* acknowledge received packet */
|
|
|
|
_nic->rx()->acknowledge_packet(rx_packet);
|
|
|
|
}
|
|
|
|
}
|