Date: Sun, 29 Apr 2012 08:51:06 +0000 (UTC) From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r234781 - stable/8/sys/netinet Message-ID: <201204290851.q3T8p6Of005708@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bz Date: Sun Apr 29 08:51:06 2012 New Revision: 234781 URL: http://svn.freebsd.org/changeset/base/234781 Log: MFC r233554: Export the udp_cksum sysctl for upcoming SCTP work. Rather than always, SCTP will only do IPv4 UDP checksum calculation as defined by the host policy. When tunneling SCTP always calculates the inner checksum already so not doing the outer UDP can save cycles. While here virtualize the variable. Requested by: tuexen Modified: stable/8/sys/netinet/udp_usrreq.c stable/8/sys/netinet/udp_var.h Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netinet/udp_usrreq.c ============================================================================== --- stable/8/sys/netinet/udp_usrreq.c Sun Apr 29 08:50:50 2012 (r234780) +++ stable/8/sys/netinet/udp_usrreq.c Sun Apr 29 08:51:06 2012 (r234781) @@ -100,9 +100,9 @@ __FBSDID("$FreeBSD$"); * packets that would otherwise be discarded due to bad checksums, and may * cause problems (especially for NFS data blocks). */ -static int udp_cksum = 1; -SYSCTL_INT(_net_inet_udp, UDPCTL_CHECKSUM, checksum, CTLFLAG_RW, &udp_cksum, - 0, "compute udp checksum"); +VNET_DEFINE(int, udp_cksum) = 1; +SYSCTL_VNET_INT(_net_inet_udp, UDPCTL_CHECKSUM, checksum, CTLFLAG_RW, + &VNET_NAME(udp_cksum), 0, "compute udp checksum"); int udp_log_in_vain = 0; SYSCTL_INT(_net_inet_udp, OID_AUTO, log_in_vain, CTLFLAG_RW, @@ -1228,7 +1228,7 @@ udp_output(struct inpcb *inp, struct mbu /* * Set up checksum and output datagram. */ - if (udp_cksum) { + if (V_udp_cksum) { if (inp->inp_flags & INP_ONESBCAST) faddr.s_addr = INADDR_BROADCAST; ui->ui_sum = in_pseudo(ui->ui_src.s_addr, faddr.s_addr, Modified: stable/8/sys/netinet/udp_var.h ============================================================================== --- stable/8/sys/netinet/udp_var.h Sun Apr 29 08:50:50 2012 (r234780) +++ stable/8/sys/netinet/udp_var.h Sun Apr 29 08:51:06 2012 (r234781) @@ -136,8 +136,10 @@ VNET_DECLARE(struct inpcbinfo, udbinfo); extern u_long udp_sendspace; extern u_long udp_recvspace; +VNET_DECLARE(int, udp_cksum); VNET_DECLARE(struct udpstat, udpstat); VNET_DECLARE(int, udp_blackhole); +#define V_udp_cksum VNET(udp_cksum) #define V_udpstat VNET(udpstat) #define V_udp_blackhole VNET(udp_blackhole) extern int udp_log_in_vain;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204290851.q3T8p6Of005708>