summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormelifaro <melifaro@FreeBSD.org>2014-10-01 14:39:06 +0000
committermelifaro <melifaro@FreeBSD.org>2014-10-01 14:39:06 +0000
commitd8b683d70fe7f6a71bb4e0d897ac65ca2ca80fad (patch)
tree24031f4983dce11f40ab7bc96fd391c9443ad7c2
parentb61070b3844820f5f4b8cefb3411be21f9663caa (diff)
downloadFreeBSD-src-d8b683d70fe7f6a71bb4e0d897ac65ca2ca80fad.zip
FreeBSD-src-d8b683d70fe7f6a71bb4e0d897ac65ca2ca80fad.tar.gz
Remove lock init from radix.c.
Radix has never managed its locking itself. The only consumer using radix with embeded rwlock is system routing table. Move per-AF lock inits there.
-rw-r--r--sys/net/radix.c3
-rw-r--r--sys/netinet/in_rmx.c4
-rw-r--r--sys/netinet6/in6_rmx.c4
-rw-r--r--sys/netpfil/pf/pf_table.c8
4 files changed, 8 insertions, 11 deletions
diff --git a/sys/net/radix.c b/sys/net/radix.c
index 62f57f8..98a1800 100644
--- a/sys/net/radix.c
+++ b/sys/net/radix.c
@@ -1122,9 +1122,6 @@ rn_inithead_internal(void **head, int off)
R_Zalloc(rnh, struct radix_node_head *, sizeof (*rnh));
if (rnh == 0)
return (0);
-#ifdef _KERNEL
- RADIX_NODE_HEAD_LOCK_INIT(rnh);
-#endif
*head = rnh;
t = rn_newpair(rn_zeros, off, rnh->rnh_nodes);
ttt = rnh->rnh_nodes + 2;
diff --git a/sys/netinet/in_rmx.c b/sys/netinet/in_rmx.c
index bd5835e..09669e6 100644
--- a/sys/netinet/in_rmx.c
+++ b/sys/netinet/in_rmx.c
@@ -352,10 +352,12 @@ in_inithead(void **head, int off)
if (!rn_inithead(head, 32))
return 0;
+ rnh = *head;
+ RADIX_NODE_HEAD_LOCK_INIT(rnh);
+
if (off == 0) /* XXX MRT see above */
return 1; /* only do the rest for a real routing table */
- rnh = *head;
rnh->rnh_addaddr = in_addroute;
in_setmatchfunc(rnh, V_drop_redirect);
rnh->rnh_close = in_clsroute;
diff --git a/sys/netinet6/in6_rmx.c b/sys/netinet6/in6_rmx.c
index 10e833a..c1caf2c 100644
--- a/sys/netinet6/in6_rmx.c
+++ b/sys/netinet6/in6_rmx.c
@@ -270,10 +270,12 @@ in6_inithead(void **head, int off)
if (!rn_inithead(head, offsetof(struct sockaddr_in6, sin6_addr) << 3))
return 0; /* See above */
+ rnh = *head;
+ RADIX_NODE_HEAD_LOCK_INIT(rnh);
+
if (off == 0) /* See above */
return 1; /* only do the rest for the real thing */
- rnh = *head;
rnh->rnh_addaddr = in6_addroute;
if (V__in6_rt_was_here == 0) {
diff --git a/sys/netpfil/pf/pf_table.c b/sys/netpfil/pf/pf_table.c
index 9c5ee32..b9f13b9 100644
--- a/sys/netpfil/pf/pf_table.c
+++ b/sys/netpfil/pf/pf_table.c
@@ -1853,14 +1853,10 @@ pfr_destroy_ktable(struct pfr_ktable *kt, int flushaddr)
pfr_clean_node_mask(kt, &addrq);
pfr_destroy_kentries(&addrq);
}
- if (kt->pfrkt_ip4 != NULL) {
- RADIX_NODE_HEAD_DESTROY(kt->pfrkt_ip4);
+ if (kt->pfrkt_ip4 != NULL)
rn_detachhead((void **)&kt->pfrkt_ip4);
- }
- if (kt->pfrkt_ip6 != NULL) {
- RADIX_NODE_HEAD_DESTROY(kt->pfrkt_ip6);
+ if (kt->pfrkt_ip6 != NULL)
rn_detachhead((void **)&kt->pfrkt_ip6);
- }
if (kt->pfrkt_shadow != NULL)
pfr_destroy_ktable(kt->pfrkt_shadow, flushaddr);
if (kt->pfrkt_rs != NULL) {
OpenPOWER on IntegriCloud