genode/ports/src/vancouver/network.cc
Markus Partheymueller 1c447d98e9 vancouver: Network support
Vancouver is now able to use the Intel 82576 device model from NUL to
give VMs access to the network via the nic_bridge service. In order to
integrate the device model, it had to be renamed to i82576 due to XML
limitations. This is done by a patch applied via the 'make prepare'
mechanism.

Although current network card models in Vancouver panic if they can't
get a MAC address, the OP_GET_MAC hostop now fails gracefully in the
case where no nic_drv or nic_bridge is available.
2013-02-13 15:09:22 +01:00

52 lines
1.3 KiB
C++

/*
* \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
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*
* 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;
Vancouver_network::Vancouver_network(Motherboard &mb, Nic::Session * nic)
: _mb(mb), _nic(nic)
{
start();
}
void Vancouver_network::entry()
{
Logging::printf("Hello, this is the network receiver.\n");
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);
_mb.bus_network.send(msg);
_forward_pkt = 0;
/* acknowledge received packet */
_nic->rx()->acknowledge_packet(rx_packet);
}
}