help
Select this if you want to forward a guest console interface to some host OS service
-
config SOCKET
- bool "Host support for Network Sockets"
- default y
+ bool "Host support for Network Sockets"
+ default y
+ help
+ Select this if you host OS implements a socket API that is available to Palacios. This is required
+ to support the internal networking features of Palacios.
+
+
+config PACKET
+ bool "Host support for Raw Packet Transmision"
+ depends on EXPERIMENTAL
+ default n
help
- Select this if you host OS implements a socket API that is available to Palacios. This is required
+ Select this if you host OS implements a raw packet network API that is available to Palacios. This is required
to support the internal networking features of Palacios.
endmenu
#ifdef __V3VEE__
-#define V3_send_Raw(pkt, size, data) ({ \
- extern struct v3_packet_hooks * packet_hooks; \
- int ret; \
- if ((packet_hooks) && (packet_hooks)->send) { \
- ret = (packet_hooks)->send(pkt,size,data); \
- } \
- ret; \
- })
+int V3_send_raw(const char * pkt, const int len);
#endif
-
struct v3_packet_hooks {
int (*send)(const char * pkt, const int size, void * private_data);
};
-
extern void V3_Init_Packet(struct v3_packet_hooks * hooks);
#endif
static int virtio_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
struct vm_device * pci_bus = v3_find_dev(vm, v3_cfg_val(cfg, "bus"));
struct virtio_dev_state * virtio_state = NULL;
- char * name = v3_cfg_val(cfg, "name");
+ char * dev_id = v3_cfg_val(cfg, "ID");
- PrintDebug("Virtio NIC: Initializing VIRTIO Network device: %s\n", name);
+ PrintDebug("Virtio NIC: Initializing VIRTIO Network device: %s\n", dev_id);
if (pci_bus == NULL) {
PrintError("Virtio NIC: VirtIO devices require a PCI Bus");
virtio_state->pci_bus = pci_bus;
virtio_state->vm = vm;
- struct vm_device * dev = v3_allocate_device(name, &dev_ops, virtio_state);
+ struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, virtio_state);
if (v3_attach_device(vm, dev) == -1) {
- PrintError("Virtio NIC: Could not attach device %s\n", name);
+ PrintError("Virtio NIC: Could not attach device %s\n", dev_id);
return -1;
}
- if (v3_dev_add_net_frontend(vm, name, connect_fn, (void *)virtio_state) == -1) {
- PrintError("Virtio NIC: Could not register %s as net frontend\n", name);
+ if (v3_dev_add_net_frontend(vm, dev_id, connect_fn, (void *)virtio_state) == -1) {
+ PrintError("Virtio NIC: Could not register %s as net frontend\n", dev_id);
return -1;
}
static int vnet_nic_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
struct vnet_nic_state * vnetnic = NULL;
- char * name = v3_cfg_val(cfg, "name");
+ char * dev_id = v3_cfg_val(cfg, "ID");
char * macstr = NULL;
char mac[6];
int vnet_dev_id;
vnetnic = (struct vnet_nic_state *)V3_Malloc(sizeof(struct vnet_nic_state));
memset(vnetnic, 0, sizeof(struct vnet_nic_state));
- struct vm_device * dev = v3_allocate_device(name, &dev_ops, vnetnic);
+ struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, vnetnic);
if (v3_attach_device(vm, dev) == -1) {
- PrintError("Could not attach device %s\n", name);
+ PrintError("Could not attach device %s\n", dev_id);
return -1;
}
if (v3_dev_connect_net(vm, v3_cfg_val(frontend_cfg, "tag"),
&(vnetnic->net_ops), frontend_cfg, vnetnic) == -1) {
PrintError("Could not connect %s to frontend %s\n",
- name, v3_cfg_val(frontend_cfg, "tag"));
+ dev_id, v3_cfg_val(frontend_cfg, "tag"));
return -1;
}
PrintDebug("Vnet-nic: Connect %s to frontend %s\n",
- name, v3_cfg_val(frontend_cfg, "tag"));
+ dev_id, v3_cfg_val(frontend_cfg, "tag"));
- if ((vnet_dev_id = register_to_vnet(vm, vnetnic, name, vnetnic->mac)) == -1) {
- PrintError("Vnet-nic device %s (mac: %s) fails to registered to VNET\n", name, macstr);
+ if ((vnet_dev_id = register_to_vnet(vm, vnetnic, dev_id, vnetnic->mac)) == -1) {
+ PrintError("Vnet-nic device %s (mac: %s) fails to registered to VNET\n", dev_id, macstr);
}
vnetnic->vnet_dev_id = vnet_dev_id;
PrintDebug("Vnet-nic device %s (mac: %s, %ld) registered to VNET\n",
- name, macstr, *((ulong_t *)vnetnic->mac));
+ dev_id, macstr, *((ulong_t *)vnetnic->mac));
//for temporary hack for vnet bridge test
{
uchar_t zeromac[6] = {0,0,0,0,0,0};
- if(!strcmp(name, "vnet_nic")){
+ if(!strcmp(dev_id, "vnet_nic")){
struct v3_vnet_route route;
route.dst_id = vnet_dev_id;
static int vnet_nic_dom0 = -1;
uchar_t zeromac[6] = {0,0,0,0,0,0};
- if(!strcmp(name, "vnet_nic")){ //domu
+ if(!strcmp(dev_id, "vnet_nic")){ //domu
vnet_nic_guestid = vnet_dev_id;
}
- if (!strcmp(name, "vnet_nic_dom0")){
+ if (!strcmp(dev_id, "vnet_nic_dom0")){
vnet_nic_dom0 = vnet_dev_id;
}
obj-$(CONFIG_INSTRUMENT_VMM) += vmm_instrument.o
obj-$(CONFIG_TELEMETRY) += vmm_telemetry.o
obj-$(CONFIG_SOCKET) += vmm_socket.o
+obj-$(CONFIG_PACKET) += vmm_packet.o
obj-$(CONFIG_VNET) += vmm_vnet_core.o
obj-$(CONFIG_FILE) += vmm_file.o
obj-$(CONFIG_CONSOLE) += vmm_console.o vmm_stream.o
--- /dev/null
+/*
+ * This file is part of the Palacios Virtual Machine Monitor developed
+ * by the V3VEE Project with funding from the United States National
+ * Science Foundation and the Department of Energy.
+ *
+ * The V3VEE Project is a joint project between Northwestern University
+ * and the University of New Mexico. You can find out more at
+ * http://www.v3vee.org
+ *
+ * Copyright (c) 2010, Lei Xia <lxia@cs.northwestern.edu>
+ * Copyright (c) 2010, The V3VEE Project <http://www.v3vee.org>
+ * All rights reserved.
+ *
+ * Author: Lei Xia <lxia@cs.northwestern.edu>
+ *
+ * This is free software. You are permitted to use,
+ * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
+ */
+#include <palacios/vmm.h>
+#include <palacios/vmm_debug.h>
+#include <palacios/vmm_types.h>
+#include <palacios/vm_guest.h>
+#include <palacios/vmm_packet.h>
+
+static struct v3_packet_hooks * packet_hooks = 0;
+
+int V3_send_raw(const char * pkt, const int len) {
+ V3_ASSERT(packet_hooks);
+ V3_ASSERT(packet_hooks->send);
+
+ return packet_hooks->send(pkt, len, NULL);
+}
+
+
+void V3_Init_Packet(struct v3_packet_hooks * hooks) {
+ packet_hooks = hooks;
+ PrintDebug("V3 raw packet interface inited\n");
+
+ return;
+}