From: Jack Lange Date: Wed, 8 Jun 2011 20:52:05 +0000 (-0500) Subject: ported packet to extension framework and fixed type in socket interface X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=9cf7a82c32a23118057172b1071388f19face739 ported packet to extension framework and fixed type in socket interface --- diff --git a/linux_module/palacios-dev.c b/linux_module/palacios-dev.c index 829c461..29d047d 100644 --- a/linux_module/palacios-dev.c +++ b/linux_module/palacios-dev.c @@ -23,7 +23,6 @@ #include "palacios-vm.h" #include "palacios-serial.h" #include "palacios-vnet.h" -#include "palacios-packet.h" #include "linux-exts.h" @@ -263,12 +262,6 @@ static int __init v3_init(void) { palacios_init_graphics_console(); #endif - - -#ifdef V3_CONFIG_PACKET - palacios_init_packet(NULL); -#endif - #ifdef V3_CONFIG_VNET palacios_vnet_init(); #endif diff --git a/linux_module/palacios-packet.c b/linux_module/palacios-packet.c index 83404de..fb9c5b7 100644 --- a/linux_module/palacios-packet.c +++ b/linux_module/palacios-packet.c @@ -19,14 +19,14 @@ #include #include + #define __V3VEE__ #include #include #undef __V3VEE__ #include "palacios.h" -#include "palacios-packet.h" - +#include "linux-exts.h" struct palacios_packet_state { struct socket * raw_sock; uint8_t inited; @@ -140,11 +140,6 @@ palacios_packet_send(const char * pkt, unsigned int len, void * private_data) { size = sock_sendmsg(packet_state.raw_sock, &msg, len); set_fs(oldfs); - if(vnet_debug >= 4){ - printk("Palacios Packet: send pkt to NIC (size: %d)\n", len); - print_hex_dump(NULL, "pkt_header: ", 0, 20, 20, pkt, 20, 0); - printk("palacios_packet_send return: %d\n", size); - } return size; } @@ -189,7 +184,7 @@ recv_pkt(char * pkt, int len) { } -void +static void send_raw_packet_to_palacios(char * pkt, int len, struct v3_vm_info * vm) { @@ -218,10 +213,6 @@ static int packet_server(void * arg) { break; } - if(vnet_debug >= 4){ - printk("Palacios Packet: receive pkt from NIC (size: %d)\n",size); - print_hex_dump(NULL, "pkt_header: ", 0, 10, 10, pkt, 20, 0); - } /* if VNET is enabled, send to VNET */ // ... @@ -242,7 +233,9 @@ static int packet_server(void * arg) { } -int palacios_init_packet(const char * eth_dev) { +static int packet_init( void ) { + + const char * eth_dev = NULL; if(packet_state.inited == 0){ packet_state.inited = 1; @@ -259,14 +252,33 @@ int palacios_init_packet(const char * eth_dev) { packet_state.server_thread = kthread_run(packet_server, NULL, "raw-packet-server"); } + + // REGISTER GLOBAL CONTROL to add devices... + return 0; } -void palacios_deinit_packet(const char * eth_dev) { +static int packet_deinit( void ) { + + const char * eth_dev = NULL; kthread_stop(packet_state.server_thread); packet_state.raw_sock->ops->release(packet_state.raw_sock); v3_free_htable(packet_state.mac_vm_cache, 0, 1); packet_state.inited = 0; + + return 0; } + + +static struct linux_ext pkt_ext = { + .name = "PACKET_INTERFACE", + .init = packet_init, + .deinit = packet_deinit, + .guest_init = NULL, + .guest_deinit = NULL +}; + + +register_extension(&pkt_ext); diff --git a/linux_module/palacios-socket.c b/linux_module/palacios-socket.c index 9cf8236..e572ec9 100644 --- a/linux_module/palacios-socket.c +++ b/linux_module/palacios-socket.c @@ -472,11 +472,13 @@ static int socket_deinit( void ) { if (!list_empty(&(global_sockets))) { printk("Error removing module with open sockets\n"); } + + return 0; } static struct linux_ext socket_ext = { - .name "SOCKET_INTERFACE", + .name = "SOCKET_INTERFACE", .init = socket_init, .deinit = socket_deinit, .guest_init = NULL, diff --git a/linux_module/palacios.h b/linux_module/palacios.h index 28207ec..a5a5aeb 100644 --- a/linux_module/palacios.h +++ b/linux_module/palacios.h @@ -45,11 +45,6 @@ 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);