From owner-svn-src-head@FreeBSD.ORG Thu Nov 27 13:19:43 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 158CE106564A; Thu, 27 Nov 2008 13:19:42 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C3CBB8FC1E; Thu, 27 Nov 2008 13:19:42 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mARDJgMg088089; Thu, 27 Nov 2008 13:19:42 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mARDJgem088085; Thu, 27 Nov 2008 13:19:42 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200811271319.mARDJgem088085@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Thu, 27 Nov 2008 13:19:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185371 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 13:19:43 -0000 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 */ }