From 57c0b5bfc39c8effaa21bd4b70f83b42859467e0 Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Sat, 25 Jul 2015 01:55:22 +0200 Subject: device: use general lock for port lists * device/if_hdr.h (struct ifnet): Turn the port list locks into general locks. (port_list_{lock_init,lock,unlock): New macros. * device/net_io.c (net_filter, net_set_filter): Use new macros. * device/subrs.c (if_init_queues): Likewise. --- device/net_io.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'device/net_io.c') diff --git a/device/net_io.c b/device/net_io.c index 47ef2ea..12a1e9c 100644 --- a/device/net_io.c +++ b/device/net_io.c @@ -722,8 +722,8 @@ net_filter(kmsg, send_list) * Both locks are hold in case a filter is removed from both * queues. */ - simple_lock(&ifp->if_rcv_port_list_lock); - simple_lock(&ifp->if_snd_port_list_lock); + port_list_lock(&ifp->if_rcv_port_list_lock); + port_list_lock(&ifp->if_snd_port_list_lock); FILTER_ITERATE(if_port_list, infp, nextfp, net_kmsg(kmsg)->sent ? &infp->output : &infp->input) { @@ -853,8 +853,8 @@ net_filter(kmsg, send_list) } } FILTER_ITERATE_END - simple_unlock(&ifp->if_snd_port_list_lock); - simple_unlock(&ifp->if_rcv_port_list_lock); + port_list_unlock(&ifp->if_snd_port_list_lock); + port_list_unlock(&ifp->if_rcv_port_list_lock); /* * Deallocate dead filters. @@ -1255,8 +1255,8 @@ net_set_filter( in = (filter[0] & NETF_IN) != 0; out = (filter[0] & NETF_OUT) != 0; - simple_lock(&ifp->if_rcv_port_list_lock); - simple_lock(&ifp->if_snd_port_list_lock); + port_list_lock(&ifp->if_rcv_port_list_lock); + port_list_lock(&ifp->if_snd_port_list_lock); if (in) check_filter_list(&ifp->if_rcv_port_list); @@ -1272,8 +1272,8 @@ net_set_filter( } if (i == N_NET_HASH) { simple_unlock(&net_hash_header_lock); - simple_unlock(&ifp->if_snd_port_list_lock); - simple_unlock(&ifp->if_rcv_port_list_lock); + port_list_unlock(&ifp->if_snd_port_list_lock); + port_list_unlock(&ifp->if_rcv_port_list_lock); ipc_port_release_send(rcv_port); if (match != 0) @@ -1352,8 +1352,8 @@ net_set_filter( hash_entp->rcv_qlimit = net_add_q_info(rcv_port); } - simple_unlock(&ifp->if_snd_port_list_lock); - simple_unlock(&ifp->if_rcv_port_list_lock); + port_list_unlock(&ifp->if_snd_port_list_lock); + port_list_unlock(&ifp->if_rcv_port_list_lock); clean_and_return: /* No locks are held at this point. */ -- cgit v1.2.3