.mutex_free = palacios_mutex_free,
.mutex_lock = palacios_mutex_lock,
.mutex_unlock = palacios_mutex_unlock,
+ .mutex_lock_irqsave = palacios_mutex_lock_irqsave,
+ .mutex_unlock_irqrestore = palacios_mutex_unlock_irqrestore,
.print = palacios_print,
.allocate_pages = palacios_allocate_pages,
};
typedef unsigned long vnet_lock_t;
-
+typedef void *vnet_intr_flags_t;
struct vnet_host_hooks {
void (*mutex_free)(void * mutex);
void (*mutex_lock)(void * mutex, int must_spin);
void (*mutex_unlock)(void * mutex);
+ vnet_intr_flags_t (*mutex_lock_irqsave)(void * mutex, int must_spin);
+ void (*mutex_unlock_irqrestore)(void * mutex, vnet_intr_flags_t flags);
};
static inline void vnet_lock(vnet_lock_t lock) {
if (host_hooks && (host_hooks->mutex_lock)) {
- host_hooks->mutex_lock((void *)lock, 0);
+ host_hooks->mutex_lock((void *)lock,0);
}
}
}
}
-static inline unsigned long vnet_lock_irqsave(vnet_lock_t lock) {
- if (host_hooks && host_hooks->mutex_lock) {
- host_hooks->mutex_lock((void *)lock, 1);
- return 0;
+static inline vnet_intr_flags_t vnet_lock_irqsave(vnet_lock_t lock)
+{
+ if (host_hooks && host_hooks->mutex_lock_irqsave) {
+ return (host_hooks->mutex_lock_irqsave((void *)lock, 1));
} else {
- return -1;
+ return NULL;
}
}
-static inline void vnet_unlock_irqrestore(vnet_lock_t lock, addr_t irq_state) {
- if (host_hooks && (host_hooks->mutex_unlock)) {
- host_hooks->mutex_unlock((void *)lock);
+static inline void vnet_unlock_irqrestore(vnet_lock_t lock, vnet_intr_flags_t irq_state)
+{
+ if (host_hooks && (host_hooks->mutex_unlock_irqrestore)) {
+ host_hooks->mutex_unlock_irqrestore((void *)lock,irq_state);
}
}
-
#endif
int v3_vnet_add_route(struct v3_vnet_route route) {
struct vnet_route_info * new_route = NULL;
- unsigned long flags;
+ vnet_intr_flags_t flags;
new_route = (struct vnet_route_info *)Vnet_Malloc(sizeof(struct vnet_route_info));
void v3_vnet_del_route(uint32_t route_idx){
struct vnet_route_info * route = NULL;
- unsigned long flags;
+ vnet_intr_flags_t flags;
flags = vnet_lock_irqsave(vnet_state.lock);
/* delete all route entries with specfied src or dst device id */
static void inline del_routes_by_dev(int dev_id){
struct vnet_route_info * route, *tmp_route;
- unsigned long flags;
+ vnet_intr_flags_t flags;
flags = vnet_lock_irqsave(vnet_state.lock);
int v3_vnet_send_pkt(struct v3_vnet_pkt * pkt, void * private_data) {
struct route_list * matched_routes = NULL;
- unsigned long flags;
+ vnet_intr_flags_t flags;
int i;
int cpu = V3_Get_CPU();
struct v3_vnet_dev_ops * ops, int quote, int poll_state,
void * priv_data){
struct vnet_dev * new_dev = NULL;
- unsigned long flags;
+ vnet_intr_flags_t flags;
new_dev = (struct vnet_dev *)Vnet_Malloc(sizeof(struct vnet_dev));
int v3_vnet_del_dev(int dev_id){
struct vnet_dev * dev = NULL;
- unsigned long flags;
+ vnet_intr_flags_t flags;
flags = vnet_lock_irqsave(vnet_state.lock);
struct v3_vnet_bridge_ops * ops,
uint8_t type,
void * priv_data) {
- unsigned long flags;
+ vnet_intr_flags_t flags;
int bridge_free = 0;
struct vnet_brg_dev * tmp_bridge = NULL;
void v3_vnet_del_bridge(uint8_t type) {
- unsigned long flags;
+ vnet_intr_flags_t flags;
struct vnet_brg_dev * tmp_bridge = NULL;
flags = vnet_lock_irqsave(vnet_state.lock);