X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fdevices%2Fnic_bridge.c;h=518fa750d61f1dc9ae641adba50d6f56d5083374;hb=d6c39d69e162e32b158d7014f902f281cd7753f5;hp=60f606f7a583f4f66ec0d4e163fbd21e3815f6bd;hpb=6d6988cc9c8bac21d96afd800076afe0915cf2cd;p=palacios-OLD.git diff --git a/palacios/src/devices/nic_bridge.c b/palacios/src/devices/nic_bridge.c index 60f606f..518fa75 100644 --- a/palacios/src/devices/nic_bridge.c +++ b/palacios/src/devices/nic_bridge.c @@ -23,9 +23,9 @@ #include #include #include -#include +#include -#ifndef CONFIG_DEBUG_NIC_BRIDGE +#ifndef V3_CONFIG_DEBUG_NIC_BRIDGE #undef PrintDebug #define PrintDebug(fmt, args...) #endif @@ -36,13 +36,13 @@ struct nic_bridge_state { }; static int bridge_send(uint8_t * buf, uint32_t len, + int synchronize, void * private_data) { - //struct nic_bridge_state *bridge = (struct nic_bridge_state *)private_data; -#ifdef CONFIG_DEBUG_NIC_BRIDGE +#ifdef V3_CONFIG_DEBUG_NIC_BRIDGE { PrintDebug("NIC Bridge: send pkt size: %d\n", len); - //v3_hexdump(buf, len, NULL, 0); + v3_hexdump(buf, len, NULL, 0); } #endif @@ -54,7 +54,12 @@ static int packet_input(struct v3_vm_info * vm, void * private_data) { struct nic_bridge_state * bridge = (struct nic_bridge_state *)private_data; - PrintDebug("NIC_BRIDGE: Incoming packet size: %d\n", evt->size); +#ifdef V3_CONFIG_DEBUG_NIC_BRIDGE + { + PrintDebug("NIC Bridge: recv pkt size: %d\n", evt->size); + v3_hexdump(evt->pkt, evt->size, NULL, 0); + } +#endif return bridge->net_ops.recv(evt->pkt, evt->size, @@ -62,7 +67,7 @@ static int packet_input(struct v3_vm_info * vm, } -static int vnet_nic_free(struct nic_bridge_state * bridge) { +static int nic_bridge_free(struct nic_bridge_state * bridge) { /*detach from front device */ @@ -72,11 +77,11 @@ static int vnet_nic_free(struct nic_bridge_state * bridge) { } static struct v3_device_ops dev_ops = { - .free = (int (*)(void *))vnet_nic_free, + .free = (int (*)(void *))nic_bridge_free, }; -static int vnet_nic_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) { +static int nic_bridge_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) { struct nic_bridge_state * bridge = NULL; char * dev_id = v3_cfg_val(cfg, "ID"); @@ -107,9 +112,11 @@ static int vnet_nic_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) { PrintDebug("NIC-Bridge: Connect %s to frontend %s\n", dev_id, v3_cfg_val(frontend_cfg, "tag")); + + V3_packet_add_recver(bridge->net_ops.fnt_mac, vm); v3_hook_host_event(vm, HOST_PACKET_EVT, V3_HOST_EVENT_HANDLER(packet_input), bridge); return 0; } -device_register("NIC_BRIDGE", vnet_nic_init) +device_register("NIC_BRIDGE", nic_bridge_init)