struct v3_packet * recver_state;
struct raw_interface * iface = (struct raw_interface *)arg;
- pkt = (unsigned char *)kmalloc(ETHERNET_PACKET_LEN, GFP_KERNEL);
+ pkt = (unsigned char *)palacios_alloc(ETHERNET_PACKET_LEN);
+
+ if (!pkt) {
+ ERROR("Unable to allocate packet in vnet receive thread\n");
+ return -1;
+ }
INFO("Palacios Raw Packet Bridge: Staring receiving on ethernet device %s\n",
iface->eth_dev);
palacios_free_htable(iface->mac_to_recver, 0, 0);
list_for_each_entry_safe(recver_state, tmp_state, &(iface->brdcast_recvers), node) {
- kfree(recver_state);
+ palacios_free(recver_state);
}
}
struct raw_interface * iface;
unsigned long flags;
- spin_lock_irqsave(&(packet_state.lock), flags);
+ palacios_spinlock_lock_irqsave(&(packet_state.lock), flags);
iface = find_interface(host_nic);
- spin_unlock_irqrestore(&(packet_state.lock),flags);
+ palacios_spinlock_unlock_irqrestore(&(packet_state.lock),flags);
if(iface == NULL){
- iface = (struct raw_interface *)kmalloc(sizeof(struct raw_interface), GFP_KERNEL);
+ iface = (struct raw_interface *)palacios_alloc(sizeof(struct raw_interface));
if (!iface) {
- WARNING("Palacios Packet Interface: Fails to allocate interface\n");
+ ERROR("Palacios Packet Interface: Fails to allocate interface\n");
return -1;
}
if(init_raw_interface(iface, host_nic) != 0) {
- WARNING("Palacios Packet Interface: Fails to initiate an raw interface on device %s\n", host_nic);
- kfree(iface);
+ ERROR("Palacios Packet Interface: Fails to initiate an raw interface on device %s\n", host_nic);
+ palacios_free(iface);
return -1;
}
- spin_lock_irqsave(&(packet_state.lock), flags);
+ palacios_spinlock_lock_irqsave(&(packet_state.lock), flags);
list_add(&(iface->node), &(packet_state.open_interfaces));
- spin_unlock_irqrestore(&(packet_state.lock),flags);
+ palacios_spinlock_unlock_irqrestore(&(packet_state.lock),flags);
}
packet->host_packet_data = iface;
if(iface->inited == 0 ||
iface->raw_sock == NULL){
- WARNING("Palacios Packet Interface: Send fails due to inapproriate interface\n");
-
+ ERROR("Palacios Packet Interface: Send fails due to inapproriate interface\n");
return -1;
}
V3_Init_Packet(&palacios_packet_hooks);
memset(&packet_state, 0, sizeof(struct palacios_packet_state));
- spin_lock_init(&(packet_state.lock));
+ palacios_spinlock_init(&(packet_state.lock));
INIT_LIST_HEAD(&(packet_state.open_interfaces));
// REGISTER GLOBAL CONTROL to add interfaces...
list_for_each_entry_safe(iface, tmp, &(packet_state.open_interfaces), node) {
deinit_raw_interface(iface);
- kfree(iface);
+ palacios_free(iface);
}
+
+ palacios_spinlock_deinit(&(packet_state.lock));
return 0;
}