PERFORCE change 48870 for review

Robert Watson rwatson at FreeBSD.org
Fri Mar 12 22:25:28 PST 2004


http://perforce.freebsd.org/chv.cgi?CH=48870

Change 48870 by rwatson at rwatson_paprika on 2004/03/12 22:24:28

	Integrate netperf_socket from FreeBSD CVS HEAD:
	
	- Someone added punctuation to NOTES.
	- Loop back of comments that poll() and kern_select() exert Giant
	  painfully.
	- bde makes core dumping fast(er).
	- if_withname() removed; no empty ifnet renames.
	- Loop back constify iso88025_broadcastaddr, atmulticastaddr,
	  aarp_org_code.
	- Loop back remove tap_unit, tun_unit.

Affected files ...

.. //depot/projects/netperf_socket/sys/i386/conf/NOTES#8 integrate
.. //depot/projects/netperf_socket/sys/kern/sys_generic.c#3 integrate
.. //depot/projects/netperf_socket/sys/kern/vfs_vnops.c#2 integrate
.. //depot/projects/netperf_socket/sys/net/if.c#3 integrate
.. //depot/projects/netperf_socket/sys/net/if_iso88025subr.c#2 integrate
.. //depot/projects/netperf_socket/sys/net/if_tapvar.h#3 integrate
.. //depot/projects/netperf_socket/sys/net/if_tun.c#4 integrate
.. //depot/projects/netperf_socket/sys/net/if_var.h#3 integrate
.. //depot/projects/netperf_socket/sys/netatalk/aarp.c#2 integrate

Differences ...

==== //depot/projects/netperf_socket/sys/i386/conf/NOTES#8 (text+ko) ====

@@ -4,7 +4,7 @@
 # This file contains machine dependent kernel configuration notes.  For
 # machine independent notes, look in /sys/conf/NOTES.
 #
-# $FreeBSD: src/sys/i386/conf/NOTES,v 1.1134 2004/03/06 06:54:54 scottl Exp $
+# $FreeBSD: src/sys/i386/conf/NOTES,v 1.1136 2004/03/13 00:56:11 bde Exp $
 #
 
 #
@@ -15,7 +15,7 @@
 machine		i386
 
 #
-# We want LINT to cover profiling as well
+# We want LINT to cover profiling as well.
 profile         2
 
 
@@ -95,20 +95,20 @@
 # CPU_DIRECT_MAPPED_CACHE sets L1 cache of Cyrix 486DLC CPU in direct
 # mapped mode.  Default is 2-way set associative mode.
 #
-# CPU_DISABLE_5X86_LSSER disables load store serialize (i.e. enables
+# CPU_DISABLE_5X86_LSSER disables load store serialize (i.e., enables
 # reorder).  This option should not be used if you use memory mapped
 # I/O device(s).
 #
 # CPU_DISABLE_CMPXCHG disables the CMPXCHG instruction on > i386 IA32
 # machines.  VmWare seems to emulate this instruction poorly, causing
-# the guest OS to run very slowly.  Enabling this with a SMP kernel
+# the guest OS to run very slowly.  Enabling this with an SMP kernel
 # will cause the kernel to be unusable.
 #
-# CPU_DISABLE_SSE explicitly prevent I686_CPU from turning on SSE.
+# CPU_DISABLE_SSE explicitly prevents I686_CPU from turning on SSE.
 #
 # CPU_ELAN enables support for AMDs ElanSC520 CPU.
 #    CPU_ELAN_PPS enables precision timestamp code.
-#    CPU_ELAN_XTAL sets the clock crystal frequency in Hz
+#    CPU_ELAN_XTAL sets the clock crystal frequency in Hz.
 #
 # CPU_ENABLE_LONGRUN enables support for Transmeta Crusoe LongRun
 # technology which allows to restrict power consumption of the CPU by
@@ -119,7 +119,7 @@
 #
 # CPU_ENABLE_TCC enables Thermal Control Circuitry (TCC) found in some
 # Pentium(tm) 4 and (possibly) later CPUs.  When enabled and detected,
-# TCC allows to restrict power consumption by using group of hw.p4tcc.*
+# TCC supports restricting power consumption using the hw.p4tcc.*
 # sysctls.  This operates independently of SpeedStep and is useful on
 # systems where other mechanisms such as apm(4) or acpi(4) don't work.
 #
@@ -495,10 +495,11 @@
 # ar:   Arnet SYNC/570i hdlc sync 2/4 port V.35/X.21 serial driver
 #       (requires sppp)
 # ath:  Atheros a/b/g WiFi adapters (requires ath_hal and wlan)
-# ctau:	Cronyx/Tau sync dual port V.35/RS-232/RS-530/RS-449/X.21/G.703/E1 serial
-#	adapter (requires sppp or NETGRAPH, depends on NETGRAPH_CRONYX option)
-# cx:   Cronyx/Sigma multiport sync/async adapter (requires sppp or NETGRAPH;
-#       NETGRAPH support depends on NETGRAPH_CRONYX option) 
+# ctau: Cronyx/Tau sync dual port V.35/RS-232/RS-530/RS-449/X.21/G.703/E1
+#       serial adaptor (requires sppp (default), or NETGRAPH if
+#       NETGRAPH_CRONYX is configured)
+# cx:   Cronyx/Sigma multiport sync/async adapter (requires sppp (default),
+#       or NETGRAPH if NETGRAPH_CRONYX is configured)
 # ed:   Western Digital and SMC 80xx; Novell NE1000 and NE2000; 3Com 3C503
 #       HP PC Lan+, various PC Card devices (refer to etc/defaults/pccard.conf)
 #       (requires miibus)
@@ -637,7 +638,7 @@
 # cy: Cyclades serial driver
 # digi: Digiboard driver
 # gp:  National Instruments AT-GPIB and AT-GPIB/TNT board, PCMCIA-GPIB
-# asc: GI1904-based hand scanners, e.g. the Trust Amiscan Grey
+# asc: GI1904-based hand scanners, e.g., the Trust Amiscan Grey
 # gsc: Genius GS-4500 hand scanner.
 # spic: Sony Programmable I/O controller (VAIO notebooks)
 # stl: Stallion EasyIO and EasyConnection 8/32 (cd1400 based)

==== //depot/projects/netperf_socket/sys/kern/sys_generic.c#3 (text+ko) ====

@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/sys_generic.c,v 1.129 2004/02/27 18:52:43 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/sys_generic.c,v 1.130 2004/03/13 05:58:57 rwatson Exp $");
 
 #include "opt_ktrace.h"
 
@@ -746,6 +746,10 @@
 	if (nd < 0)
 		return (EINVAL);
 	fdp = td->td_proc->p_fd;
+	/*
+	 * XXX: kern_select() currently requires that we acquire Giant
+	 * even if none of the file descriptors we poll requires Giant.
+	 */
 	mtx_lock(&Giant);
 	FILEDESC_LOCK(fdp);
 
@@ -954,6 +958,10 @@
 
 	nfds = uap->nfds;
 
+	/*
+	 * XXX: poll() currently requires that we acquire Giant even if
+	 * none of the file descriptors we poll requires Giant.
+	 */
 	mtx_lock(&Giant);
 	/*
 	 * This is kinda bogus.  We have fd limits, but that is not

==== //depot/projects/netperf_socket/sys/kern/vfs_vnops.c#2 (text+ko) ====

@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/vfs_vnops.c,v 1.196 2003/12/28 09:12:56 bde Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/vfs_vnops.c,v 1.197 2004/03/13 02:56:27 bde Exp $");
 
 #include "opt_mac.h"
 
@@ -476,8 +476,18 @@
 	int error = 0;
 
 	do {
-		int chunk = (len > MAXBSIZE) ? MAXBSIZE : len;
+		int chunk;
+
+		/*
+		 * Force `offset' to a multiple of MAXBSIZE except possibly
+		 * for the first chunk, so that filesystems only need to
+		 * write full blocks except possibly for the first and last
+		 * chunks.
+		 */
+		chunk = MAXBSIZE - (uoff_t)offset % MAXBSIZE;
 
+		if (chunk > len)
+			chunk = len;
 		if (rw != UIO_READ && vp->v_type == VREG)
 			bwillwrite();
 		error = vn_rdwr(rw, vp, base, chunk, offset, segflg,

==== //depot/projects/netperf_socket/sys/net/if.c#3 (text+ko) ====

@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)if.c	8.5 (Berkeley) 1/9/95
- * $FreeBSD: src/sys/net/if.c,v 1.183 2004/02/26 04:27:54 mlaier Exp $
+ * $FreeBSD: src/sys/net/if.c,v 1.185 2004/03/13 02:35:03 brooks Exp $
  */
 
 #include "opt_compat.h"
@@ -1247,32 +1247,6 @@
 }
 
 /*
- * Map interface name in a sockaddr_dl to
- * interface structure pointer.
- */
-struct ifnet *
-if_withname(struct sockaddr *sa)
-{
-	char ifname[IFNAMSIZ+1];
-	struct sockaddr_dl *sdl = (struct sockaddr_dl *)sa;
-
-	if ( (sa->sa_family != AF_LINK) || (sdl->sdl_nlen == 0) ||
-	     (sdl->sdl_nlen > IFNAMSIZ) )
-		return NULL;
-
-	/*
-	 * ifunit wants a NUL-terminated string.  It may not be NUL-terminated
-	 * in the sockaddr, and we don't want to change the caller's sockaddr
-	 * (there might not be room to add the trailing NUL anyway), so we make
-	 * a local copy that we know we can NUL-terminate safely.
-	 */
-
-	bcopy(sdl->sdl_data, ifname, sdl->sdl_nlen);
-	ifname[sdl->sdl_nlen] = '\0';
-	return ifunit(ifname);
-}
-
-/*
  * Hardware specific interface ioctls.
  */
 static int
@@ -1374,11 +1348,13 @@
 
 	case SIOCSIFNAME:
 		error = suser(td);
-		if (error)
+		if (error != 0)
 			return (error);
 		error = copyinstr(ifr->ifr_data, new_name, IFNAMSIZ, NULL);
-		if (error)
+		if (error != 0)
 			return (error);
+		if (new_name[0] == '\0')
+			return (EINVAL);
 		if (ifunit(new_name) != NULL)
 			return (EEXIST);
 		

==== //depot/projects/netperf_socket/sys/net/if_iso88025subr.c#2 (text+ko) ====

@@ -30,7 +30,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/net/if_iso88025subr.c,v 1.58 2003/11/14 21:02:22 andre Exp $
+ * $FreeBSD: src/sys/net/if_iso88025subr.c,v 1.59 2004/03/13 05:46:26 rwatson Exp $
  *
  */
 
@@ -79,7 +79,7 @@
 #include <netipx/ipx_if.h>
 #endif
 
-static u_char iso88025_broadcastaddr[ISO88025_ADDR_LEN] =
+static const u_char iso88025_broadcastaddr[ISO88025_ADDR_LEN] =
 			{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
 
 static int iso88025_resolvemulti (struct ifnet *, struct sockaddr **,
@@ -498,8 +498,8 @@
 	 * Set mbuf flags for bcast/mcast.
 	 */
 	if (th->iso88025_dhost[0] & 1) {
-		if (bcmp((caddr_t)iso88025_broadcastaddr,
-			 (caddr_t)th->iso88025_dhost, ISO88025_ADDR_LEN) == 0)
+		if (bcmp(iso88025_broadcastaddr, th->iso88025_dhost,
+		    ISO88025_ADDR_LEN) == 0)
 			m->m_flags |= M_BCAST;
 		else
 			m->m_flags |= M_MCAST;

==== //depot/projects/netperf_socket/sys/net/if_tapvar.h#3 (text+ko) ====

@@ -34,7 +34,7 @@
  */
 
 /*
- * $FreeBSD: src/sys/net/if_tapvar.h,v 1.5 2004/02/21 20:29:52 phk Exp $
+ * $FreeBSD: src/sys/net/if_tapvar.h,v 1.6 2004/03/13 05:51:06 rwatson Exp $
  * $Id: if_tapvar.h,v 0.6 2000/07/11 02:16:08 max Exp $
  */
 
@@ -44,8 +44,6 @@
 struct tap_softc {
 	struct arpcom	arpcom;			/* ethernet common data      */
 #define tap_if		arpcom.ac_if
-	struct resource	*tap_unit;		/* unit                      */
-
 	u_short		tap_flags;		/* misc flags                */
 #define	TAP_OPEN	(1 << 0)
 #define	TAP_INITED	(1 << 1)

==== //depot/projects/netperf_socket/sys/net/if_tun.c#4 (text+ko) ====

@@ -13,7 +13,7 @@
  * UCL. This driver is based much more on read/write/poll mode of
  * operation though.
  *
- * $FreeBSD: src/sys/net/if_tun.c,v 1.135 2004/03/11 12:58:55 phk Exp $
+ * $FreeBSD: src/sys/net/if_tun.c,v 1.136 2004/03/13 05:51:06 rwatson Exp $
  */
 
 #include "opt_atalk.h"
@@ -57,7 +57,6 @@
 
 struct tun_softc {
 	TAILQ_ENTRY(tun_softc)	tun_list;
-	int			tun_unit;
 	dev_t			tun_dev;
 	u_short	tun_flags;		/* misc flags */
 #define	TUN_OPEN	0x0001

==== //depot/projects/netperf_socket/sys/net/if_var.h#3 (text+ko) ====

@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  *	From: @(#)if.h	8.1 (Berkeley) 6/10/93
- * $FreeBSD: src/sys/net/if_var.h,v 1.64 2004/02/26 04:27:54 mlaier Exp $
+ * $FreeBSD: src/sys/net/if_var.h,v 1.65 2004/03/13 02:31:40 brooks Exp $
  */
 
 #ifndef	_NET_IF_VAR_H_
@@ -477,7 +477,6 @@
 int	ifioctl(struct socket *, u_long, caddr_t, struct thread *);
 int	ifpromisc(struct ifnet *, int);
 struct	ifnet *ifunit(const char *);
-struct	ifnet *if_withname(struct sockaddr *);
 
 int	if_poll_recv_slow(struct ifnet *ifp, int *quotap);
 void	if_poll_xmit_slow(struct ifnet *ifp, int *quotap);

==== //depot/projects/netperf_socket/sys/netatalk/aarp.c#2 (text+ko) ====

@@ -2,7 +2,7 @@
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
  * All Rights Reserved.
  *
- * $FreeBSD: src/sys/netatalk/aarp.c,v 1.24 2003/11/08 22:28:39 sam Exp $
+ * $FreeBSD: src/sys/netatalk/aarp.c,v 1.25 2004/03/13 05:27:17 rwatson Exp $
  */
 
 #include "opt_atalk.h"
@@ -58,14 +58,17 @@
 extern u_char			etherbroadcastaddr[6];
 # endif /* __FreeBSD__ */
 
-static u_char atmulticastaddr[ 6 ] = {
+static const u_char atmulticastaddr[ 6 ] = {
     0x09, 0x00, 0x07, 0xff, 0xff, 0xff,
 };
 
+/*
+ * Not used?
+ */
 u_char	at_org_code[ 3 ] = {
     0x08, 0x00, 0x07,
 };
-u_char	aarp_org_code[ 3 ] = {
+const u_char	aarp_org_code[ 3 ] = {
     0x00, 0x00, 0x00,
 };
 
@@ -163,8 +166,7 @@
     eh = (struct ether_header *)sa.sa_data;
 
     if ( aa->aa_flags & AFA_PHASE2 ) {
-	bcopy((caddr_t)atmulticastaddr, (caddr_t)eh->ether_dhost,
-		sizeof( eh->ether_dhost ));
+	bcopy(atmulticastaddr, eh->ether_dhost, sizeof( eh->ether_dhost ));
 	eh->ether_type = htons(sizeof(struct llc) + sizeof(struct ether_aarp));
 	M_PREPEND( m, sizeof( struct llc ), M_TRYWAIT );
 	if ( m == NULL ) {
@@ -173,7 +175,7 @@
 	llc = mtod( m, struct llc *);
 	llc->llc_dsap = llc->llc_ssap = LLC_SNAP_LSAP;
 	llc->llc_control = LLC_UI;
-	bcopy( aarp_org_code, llc->llc_org_code, sizeof( aarp_org_code ));
+	bcopy(aarp_org_code, llc->llc_org_code, sizeof(aarp_org_code));
 	llc->llc_ether_type = htons( ETHERTYPE_AARP );
 
 	bcopy( &AA_SAT( aa )->sat_addr.s_net, ea->aarp_spnet,
@@ -221,8 +223,7 @@
 	    return( 0 );
 	}
 	if ( aa->aa_flags & AFA_PHASE2 ) {
-	    bcopy( (caddr_t)atmulticastaddr, (caddr_t)desten,
-		    sizeof( atmulticastaddr ));
+	    bcopy(atmulticastaddr, (caddr_t)desten, sizeof(atmulticastaddr));
 	} else {
 	    bcopy( ac->ac_if.if_broadcastaddr, (caddr_t)desten,
 		    sizeof( ac->ac_if.if_addrlen ));
@@ -581,8 +582,7 @@
     eh = (struct ether_header *)sa.sa_data;
 
     if ( aa->aa_flags & AFA_PHASE2 ) {
-	bcopy((caddr_t)atmulticastaddr, (caddr_t)eh->ether_dhost,
-		sizeof( eh->ether_dhost ));
+	bcopy(atmulticastaddr, eh->ether_dhost, sizeof( eh->ether_dhost ));
 	eh->ether_type = htons( sizeof( struct llc ) +
 		sizeof( struct ether_aarp ));
 	M_PREPEND( m, sizeof( struct llc ), M_TRYWAIT );


More information about the p4-projects mailing list