From: Peter Dinda Date: Fri, 17 Aug 2012 21:50:05 +0000 (-0500) Subject: Cleaner handling of tx kick threads in vnet core X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=commitdiff_plain;h=2191332220bb4d912f4ba2d2dd9898d68f7a0abd;p=palacios.git Cleaner handling of tx kick threads in vnet core --- diff --git a/palacios/src/vnet/vnet_core.c b/palacios/src/vnet/vnet_core.c index 03f412d..dd29034 100644 --- a/palacios/src/vnet/vnet_core.c +++ b/palacios/src/vnet/vnet_core.c @@ -242,6 +242,10 @@ static struct vnet_dev * dev_by_mac(uint8_t * mac) { } +static int start_vnet_kick_threads(void); +static int stop_vnet_kick_threads(void); + + int v3_vnet_find_dev(uint8_t * mac) { struct vnet_dev * dev = NULL; @@ -799,6 +803,8 @@ int v3_vnet_add_dev(struct v3_vm_info * vm, uint8_t * mac, new_dev->quote = quotepoll = poll_state; + stop_vnet_kick_threads(); + flags = vnet_lock_irqsave(vnet_state.lock); if (dev_by_mac(mac) == NULL) { @@ -815,6 +821,8 @@ int v3_vnet_add_dev(struct v3_vm_info * vm, uint8_t * mac, vnet_unlock_irqrestore(vnet_state.lock, flags); + start_vnet_kick_threads(); + /* if the device was found previosly the id should still be 0 */ if (new_dev->dev_id == 0) { Vnet_Print(0, "VNET/P Core: Device Already exists\n"); @@ -831,6 +839,8 @@ int v3_vnet_del_dev(int dev_id){ struct vnet_dev * dev = NULL; vnet_intr_flags_t flags; + stop_vnet_kick_threads(); + flags = vnet_lock_irqsave(vnet_state.lock); dev = dev_by_id(dev_id); @@ -842,6 +852,8 @@ int v3_vnet_del_dev(int dev_id){ vnet_unlock_irqrestore(vnet_state.lock, flags); + start_vnet_kick_threads(); + Vnet_Free(dev); PrintDebug("VNET/P Core: Removed Device: dev_id %d\n", dev_id); @@ -1018,10 +1030,30 @@ static int vnet_tx_flush(void * args){ return 0; } -int v3_init_vnet() +static int start_vnet_kick_threads() { int i; + for (i=0; i