diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2024-07-12 19:50:36 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2024-07-12 19:50:36 +0000 |
commit | 23a17cb20f1c2260cc43692fb5adc867d6042c6e (patch) | |
tree | 7deb1d3015b44a0ce22e08ad7b1ce4be5a77cce7 /sys/netinet6 | |
parent | 28d93e83f3cdda369bf69a27386e0adc54ee1267 (diff) |
Remove internet PCB mutex.
All incpb locking has been converted to socket receive buffer mutex.
Per PCB mutex inp_mtx is not needed anymore. Also delete PRU related
locking functions. A flag PR_MPSOCKET indicates whether protocol
functions support parallel access with per socket rw-lock.
TCP is the only protocol that is not MP capable from the socket
layer and needs exclusive netlock.
OK mvs@
Diffstat (limited to 'sys/netinet6')
-rw-r--r-- | sys/netinet6/in6_proto.c | 30 | ||||
-rw-r--r-- | sys/netinet6/ip6_divert.c | 5 | ||||
-rw-r--r-- | sys/netinet6/ip6_var.h | 5 | ||||
-rw-r--r-- | sys/netinet6/raw_ip6.c | 31 |
4 files changed, 18 insertions, 53 deletions
diff --git a/sys/netinet6/in6_proto.c b/sys/netinet6/in6_proto.c index f73e00b4d2c..a737e995c84 100644 --- a/sys/netinet6/in6_proto.c +++ b/sys/netinet6/in6_proto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_proto.c,v 1.114 2024/04/16 12:40:40 bluhm Exp $ */ +/* $OpenBSD: in6_proto.c,v 1.115 2024/07/12 19:50:35 bluhm Exp $ */ /* $KAME: in6_proto.c,v 1.66 2000/10/10 15:35:47 itojun Exp $ */ /* @@ -136,7 +136,7 @@ const struct protosw inet6sw[] = { .pr_type = SOCK_DGRAM, .pr_domain = &inet6domain, .pr_protocol = IPPROTO_UDP, - .pr_flags = PR_ATOMIC|PR_ADDR|PR_SPLICE, + .pr_flags = PR_ATOMIC|PR_ADDR|PR_SPLICE|PR_MPSOCKET, .pr_input = udp_input, .pr_ctlinput = udp6_ctlinput, .pr_ctloutput = ip6_ctloutput, @@ -158,7 +158,7 @@ const struct protosw inet6sw[] = { .pr_type = SOCK_RAW, .pr_domain = &inet6domain, .pr_protocol = IPPROTO_RAW, - .pr_flags = PR_ATOMIC|PR_ADDR|PR_MPINPUT, + .pr_flags = PR_ATOMIC|PR_ADDR|PR_MPINPUT|PR_MPSOCKET, .pr_input = rip6_input, .pr_ctlinput = rip6_ctlinput, .pr_ctloutput = rip6_ctloutput, @@ -169,7 +169,7 @@ const struct protosw inet6sw[] = { .pr_type = SOCK_RAW, .pr_domain = &inet6domain, .pr_protocol = IPPROTO_ICMPV6, - .pr_flags = PR_ATOMIC|PR_ADDR, + .pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET, .pr_input = icmp6_input, .pr_ctlinput = rip6_ctlinput, .pr_ctloutput = rip6_ctloutput, @@ -204,7 +204,7 @@ const struct protosw inet6sw[] = { .pr_type = SOCK_RAW, .pr_domain = &inet6domain, .pr_protocol = IPPROTO_AH, - .pr_flags = PR_ATOMIC|PR_ADDR, + .pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET, .pr_input = ah46_input, .pr_ctloutput = rip6_ctloutput, .pr_usrreqs = &rip6_usrreqs, @@ -214,7 +214,7 @@ const struct protosw inet6sw[] = { .pr_type = SOCK_RAW, .pr_domain = &inet6domain, .pr_protocol = IPPROTO_ESP, - .pr_flags = PR_ATOMIC|PR_ADDR, + .pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET, .pr_input = esp46_input, .pr_ctloutput = rip6_ctloutput, .pr_usrreqs = &rip6_usrreqs, @@ -224,7 +224,7 @@ const struct protosw inet6sw[] = { .pr_type = SOCK_RAW, .pr_domain = &inet6domain, .pr_protocol = IPPROTO_IPCOMP, - .pr_flags = PR_ATOMIC|PR_ADDR, + .pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET, .pr_input = ipcomp46_input, .pr_ctloutput = rip6_ctloutput, .pr_usrreqs = &rip6_usrreqs, @@ -235,7 +235,7 @@ const struct protosw inet6sw[] = { .pr_type = SOCK_RAW, .pr_domain = &inet6domain, .pr_protocol = IPPROTO_IPV4, - .pr_flags = PR_ATOMIC|PR_ADDR, + .pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET, #if NGIF > 0 .pr_input = in6_gif_input, #else @@ -248,7 +248,7 @@ const struct protosw inet6sw[] = { .pr_type = SOCK_RAW, .pr_domain = &inet6domain, .pr_protocol = IPPROTO_IPV6, - .pr_flags = PR_ATOMIC|PR_ADDR, + .pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET, #if NGIF > 0 .pr_input = in6_gif_input, #else @@ -262,7 +262,7 @@ const struct protosw inet6sw[] = { .pr_type = SOCK_RAW, .pr_domain = &inet6domain, .pr_protocol = IPPROTO_MPLS, - .pr_flags = PR_ATOMIC|PR_ADDR, + .pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET, #if NGIF > 0 .pr_input = in6_gif_input, #else @@ -277,7 +277,7 @@ const struct protosw inet6sw[] = { .pr_type = SOCK_RAW, .pr_domain = &inet6domain, .pr_protocol = IPPROTO_CARP, - .pr_flags = PR_ATOMIC|PR_ADDR, + .pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET, .pr_input = carp6_proto_input, .pr_ctloutput = rip6_ctloutput, .pr_usrreqs = &rip6_usrreqs, @@ -289,7 +289,7 @@ const struct protosw inet6sw[] = { .pr_type = SOCK_RAW, .pr_domain = &inet6domain, .pr_protocol = IPPROTO_DIVERT, - .pr_flags = PR_ATOMIC|PR_ADDR, + .pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET, .pr_ctloutput = rip6_ctloutput, .pr_usrreqs = &divert6_usrreqs, .pr_init = divert6_init, @@ -301,7 +301,7 @@ const struct protosw inet6sw[] = { .pr_type = SOCK_RAW, .pr_domain = &inet6domain, .pr_protocol = IPPROTO_ETHERIP, - .pr_flags = PR_ATOMIC|PR_ADDR, + .pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET, .pr_input = ip6_etherip_input, .pr_ctloutput = rip6_ctloutput, .pr_usrreqs = &rip6_usrreqs, @@ -312,7 +312,7 @@ const struct protosw inet6sw[] = { .pr_type = SOCK_RAW, .pr_domain = &inet6domain, .pr_protocol = IPPROTO_GRE, - .pr_flags = PR_ATOMIC|PR_ADDR, + .pr_flags = PR_ATOMIC|PR_ADDR|PR_MPSOCKET, .pr_input = gre_input6, .pr_ctloutput = rip6_ctloutput, .pr_usrreqs = &rip6_usrreqs, @@ -322,7 +322,7 @@ const struct protosw inet6sw[] = { /* raw wildcard */ .pr_type = SOCK_RAW, .pr_domain = &inet6domain, - .pr_flags = PR_ATOMIC|PR_ADDR|PR_MPINPUT, + .pr_flags = PR_ATOMIC|PR_ADDR|PR_MPINPUT|PR_MPSOCKET, .pr_input = rip6_input, .pr_ctloutput = rip6_ctloutput, .pr_usrreqs = &rip6_usrreqs, diff --git a/sys/netinet6/ip6_divert.c b/sys/netinet6/ip6_divert.c index 0bd114ba390..06111f6d3c8 100644 --- a/sys/netinet6/ip6_divert.c +++ b/sys/netinet6/ip6_divert.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_divert.c,v 1.95 2024/02/13 12:22:09 bluhm Exp $ */ +/* $OpenBSD: ip6_divert.c,v 1.96 2024/07/12 19:50:35 bluhm Exp $ */ /* * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> @@ -68,9 +68,6 @@ const struct sysctl_bounded_args divert6ctl_vars[] = { const struct pr_usrreqs divert6_usrreqs = { .pru_attach = divert6_attach, .pru_detach = divert_detach, - .pru_lock = divert_lock, - .pru_unlock = divert_unlock, - .pru_locked = divert_locked, .pru_bind = divert_bind, .pru_shutdown = divert_shutdown, .pru_send = divert6_send, diff --git a/sys/netinet6/ip6_var.h b/sys/netinet6/ip6_var.h index bbe59c744ac..1ddbb4b1c0c 100644 --- a/sys/netinet6/ip6_var.h +++ b/sys/netinet6/ip6_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_var.h,v 1.119 2024/07/04 12:50:08 bluhm Exp $ */ +/* $OpenBSD: ip6_var.h,v 1.120 2024/07/12 19:50:35 bluhm Exp $ */ /* $KAME: ip6_var.h,v 1.33 2000/06/11 14:59:20 jinmei Exp $ */ /* @@ -354,9 +354,6 @@ int rip6_output(struct mbuf *, struct socket *, struct sockaddr *, struct mbuf *); int rip6_attach(struct socket *, int, int); int rip6_detach(struct socket *); -void rip6_lock(struct socket *); -void rip6_unlock(struct socket *); -int rip6_locked(struct socket *); int rip6_bind(struct socket *, struct mbuf *, struct proc *); int rip6_connect(struct socket *, struct mbuf *); int rip6_disconnect(struct socket *); diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index c16c69d53b5..7efbddfdd92 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: raw_ip6.c,v 1.184 2024/04/17 20:48:51 bluhm Exp $ */ +/* $OpenBSD: raw_ip6.c,v 1.185 2024/07/12 19:50:35 bluhm Exp $ */ /* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */ /* @@ -108,9 +108,6 @@ struct cpumem *rip6counters; const struct pr_usrreqs rip6_usrreqs = { .pru_attach = rip6_attach, .pru_detach = rip6_detach, - .pru_lock = rip6_lock, - .pru_unlock = rip6_unlock, - .pru_locked = rip6_locked, .pru_bind = rip6_bind, .pru_connect = rip6_connect, .pru_disconnect = rip6_disconnect, @@ -644,32 +641,6 @@ rip6_detach(struct socket *so) return (0); } -void -rip6_lock(struct socket *so) -{ - struct inpcb *inp = sotoinpcb(so); - - NET_ASSERT_LOCKED(); - mtx_enter(&inp->inp_mtx); -} - -void -rip6_unlock(struct socket *so) -{ - struct inpcb *inp = sotoinpcb(so); - - NET_ASSERT_LOCKED(); - mtx_leave(&inp->inp_mtx); -} - -int -rip6_locked(struct socket *so) -{ - struct inpcb *inp = sotoinpcb(so); - - return mtx_owned(&inp->inp_mtx); -} - int rip6_bind(struct socket *so, struct mbuf *nam, struct proc *p) { |