Date: Thu, 27 Nov 2008 13:19:42 +0000 (UTC) From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r185371 - head/sys/netinet Message-ID: <200811271319.mARDJgem088085@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bz Date: Thu Nov 27 13:19:42 2008 New Revision: 185371 URL: http://svn.freebsd.org/changeset/base/185371 Log: Replace most INP_CHECK_SOCKAF() uses checking if it is an IPv6 socket by comparing a constant inp vflag. This is expected to help to reduce extra locking. Suggested by: rwatson Reviewed by: rwatson MFC after: 6 weeks Modified: head/sys/netinet/in_pcb.c head/sys/netinet/tcp_output.c head/sys/netinet/tcp_usrreq.c Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Thu Nov 27 12:04:35 2008 (r185370) +++ head/sys/netinet/in_pcb.c Thu Nov 27 13:19:42 2008 (r185371) @@ -1254,8 +1254,7 @@ in_pcblookup_hash(struct inpcbinfo *pcbi return (inp); else if (inp->inp_laddr.s_addr == INADDR_ANY) { #ifdef INET6 - if (INP_CHECK_SOCKAF(inp->inp_socket, - AF_INET6)) + if (inp->inp_vflag & INP_IPV6PROTO) local_wild_mapped = inp; else #endif Modified: head/sys/netinet/tcp_output.c ============================================================================== --- head/sys/netinet/tcp_output.c Thu Nov 27 12:04:35 2008 (r185370) +++ head/sys/netinet/tcp_output.c Thu Nov 27 13:19:42 2008 (r185371) @@ -1172,7 +1172,7 @@ timer: { ip->ip_len = m->m_pkthdr.len; #ifdef INET6 - if (INP_CHECK_SOCKAF(so, AF_INET6)) + if (tp->t_inpcb->inp_vflag & INP_IPV6PROTO) ip->ip_ttl = in6_selecthlim(tp->t_inpcb, NULL); #endif /* INET6 */ /* Modified: head/sys/netinet/tcp_usrreq.c ============================================================================== --- head/sys/netinet/tcp_usrreq.c Thu Nov 27 12:04:35 2008 (r185370) +++ head/sys/netinet/tcp_usrreq.c Thu Nov 27 13:19:42 2008 (r185371) @@ -1256,7 +1256,7 @@ tcp_ctloutput(struct socket *so, struct INP_WLOCK(inp); if (sopt->sopt_level != IPPROTO_TCP) { #ifdef INET6 - if (INP_CHECK_SOCKAF(so, AF_INET6)) { + if (inp->inp_vflag & INP_IPV6PROTO) { INP_WUNLOCK(inp); error = ip6_ctloutput(so, sopt); } else { @@ -1436,9 +1436,6 @@ tcp_attach(struct socket *so) struct tcpcb *tp; struct inpcb *inp; int error; -#ifdef INET6 - int isipv6 = INP_CHECK_SOCKAF(so, AF_INET6) != 0; -#endif if (so->so_snd.sb_hiwat == 0 || so->so_rcv.sb_hiwat == 0) { error = soreserve(so, tcp_sendspace, tcp_recvspace); @@ -1455,7 +1452,7 @@ tcp_attach(struct socket *so) } inp = sotoinpcb(so); #ifdef INET6 - if (isipv6) { + if (inp->inp_vflag & INP_IPV6PROTO) { inp->inp_vflag |= INP_IPV6; inp->in6p_hops = -1; /* use kernel default */ }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811271319.mARDJgem088085>