From: Lei Xia Date: Wed, 6 Apr 2011 19:47:31 +0000 (-0500) Subject: merge VNET Linux backend code into Linux module directory X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=33bc7752b8a9c2b2aa92146dbcb5efbbe29086a5 merge VNET Linux backend code into Linux module directory --- diff --git a/linux_module/palacios-dev.c b/linux_module/palacios-dev.c index a135be9..1dfafc2 100644 --- a/linux_module/palacios-dev.c +++ b/linux_module/palacios-dev.c @@ -24,6 +24,9 @@ #include "palacios-stream.h" #include "palacios-file.h" #include "palacios-serial.h" +#include "palacios-socket.h" +#include "palacios-vnet.h" +#include "palacios-packet.h" MODULE_LICENSE("GPL"); @@ -165,6 +168,37 @@ static long v3_dev_ioctl(struct file * filp, break; } + + case V3_START_NETWORK: { + struct v3_network net; + memset(&net, 0, sizeof(struct v3_network)); + + if(copy_from_user(&net, argp, sizeof(struct v3_network))){ + printk("copy from user error getting network service requests ... \n"); + return -EFAULT; + } + + #ifdef CONFIG_PALACIOS_SOCKET + if(net.socket == 1){ + palacios_socket_init(); + printk("Started Palacios Socket\n"); + } + #endif + #ifdef CONFIG_PALACIOS_PACKET + if(net.packet == 1){ + palacios_init_packet(NULL); + printk("Started Palacios Direct Network Bridge\n"); + } + #endif + #ifdef CONFIG_PALACIOS_VNET + if(net.vnet == 1){ + palacios_init_vnet(); + printk("Started Palacios VNET Service\n"); + } + #endif + + break; + } default: printk("\tUnhandled\n"); return -EINVAL; diff --git a/linux_module/palacios-socket.h b/linux_module/palacios-socket.h new file mode 100644 index 0000000..098b6dd --- /dev/null +++ b/linux_module/palacios-socket.h @@ -0,0 +1,11 @@ +/* + * Palacios VM Raw Packet interface + * (c) Lei Xia, 2010 + */ + +#ifndef __PALACIOS_SOCKET_H__ +#define __PALACIOS_SOCKET_H__ + +int palacios_socket_init(void); + +#endif diff --git a/linux_module/palacios.h b/linux_module/palacios.h index 6c85ad8..9f27187 100644 --- a/linux_module/palacios.h +++ b/linux_module/palacios.h @@ -11,6 +11,7 @@ /* Global Control IOCTLs */ #define V3_START_GUEST 10 #define V3_ADD_MEMORY 50 +#define V3_START_NETWORK 60 /* VM Specific IOCTLs */ #define V3_VM_CONSOLE_CONNECT 20 @@ -28,8 +29,11 @@ struct v3_mem_region { unsigned long long num_pages; }; - - +struct v3_network { + unsigned char socket; + unsigned char packet; + unsigned char vnet; +}; void * trace_malloc(size_t size, gfp_t flags); void trace_free(const void * objp); diff --git a/palacios/src/palacios/vmm_vnet_core.c b/palacios/src/palacios/vmm_vnet_core.c index 4ce9b04..d5b7c35 100644 --- a/palacios/src/palacios/vmm_vnet_core.c +++ b/palacios/src/palacios/vmm_vnet_core.c @@ -206,9 +206,6 @@ static struct vnet_dev * dev_by_mac(uint8_t * mac) { if (!compare_ethaddr(dev->mac_addr, mac)){ return dev; } - - char *dmac = dev->mac_addr; - PrintDebug("device %d: %2x:%2x:%2x:%2x:%2x:%2x\n", dev->dev_id, dmac[0], dmac[1], dmac[2], dmac[3], dmac[4], dmac[5]); } return NULL; @@ -218,8 +215,6 @@ static struct vnet_dev * dev_by_mac(uint8_t * mac) { int v3_vnet_find_dev(uint8_t * mac) { struct vnet_dev * dev = NULL; - PrintDebug("find_dev: %2x:%2x:%2x:%2x:%2x:%2x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); - dev = dev_by_mac(mac); if(dev != NULL) { @@ -237,8 +232,10 @@ int v3_vnet_add_route(struct v3_vnet_route route) { new_route = (struct vnet_route_info *)V3_Malloc(sizeof(struct vnet_route_info)); memset(new_route, 0, sizeof(struct vnet_route_info)); +#ifdef CONFIG_DEBUG_VNET PrintDebug("VNET/P Core: add_route_entry:\n"); print_route(&route); +#endif memcpy(new_route->route_def.src_mac, route.src_mac, ETH_ALEN); memcpy(new_route->route_def.dst_mac, route.dst_mac, ETH_ALEN);