Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Dec 2008 09:35:15 GMT
From:      Marko Zec <zec@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 154433 for review
Message-ID:  <200812100935.mBA9ZFTw016547@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=154433

Change 154433 by zec@zec_tca51 on 2008/12/10 09:35:04

	IFC @ 154432

Affected files ...

.. //depot/projects/vimage-commit2/src/sys/dev/bge/if_bge.c#6 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/sis/if_sis.c#3 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/sis/if_sisreg.h#2 integrate
.. //depot/projects/vimage-commit2/src/sys/net/if.c#30 integrate
.. //depot/projects/vimage-commit2/src/sys/net/route.c#26 integrate
.. //depot/projects/vimage-commit2/src/sys/net/rtsock.c#16 integrate
.. //depot/projects/vimage-commit2/src/sys/netinet/in_pcb.h#11 integrate
.. //depot/projects/vimage-commit2/src/sys/netinet/ip_fw_nat.c#10 integrate
.. //depot/projects/vimage-commit2/src/sys/netinet/tcp_input.c#30 integrate

Differences ...

==== //depot/projects/vimage-commit2/src/sys/dev/bge/if_bge.c#6 (text+ko) ====

@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.215 2008/10/27 22:10:01 marius Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.216 2008/12/09 21:34:22 marius Exp $");
 
 /*
  * Broadcom BCM570x family gigabit ethernet driver for FreeBSD.
@@ -1370,6 +1370,16 @@
 	    BGE_MODECTL_TX_NO_PHDR_CSUM);
 
 	/*
+	 * BCM5701 B5 have a bug causing data corruption when using
+	 * 64-bit DMA reads, which can be terminated early and then
+	 * completed later as 32-bit accesses, in combination with
+	 * certain bridges.
+	 */
+	if (sc->bge_asicrev == BGE_ASICREV_BCM5701 &&
+	    sc->bge_chipid == BGE_CHIPID_BCM5701_B5)
+		BGE_SETBIT(sc, BGE_MODE_CTL, BGE_MODECTL_FORCE_PCI32);
+
+	/*
 	 * Tell the firmware the driver is running
 	 */
 	if (sc->bge_asf_mode & ASF_STACKUP)
@@ -2462,26 +2472,21 @@
 		 */
 		if (reg != 0)
 			sc->bge_flags |= BGE_FLAG_PCIE;
-	} else if (pci_find_extcap(dev, PCIY_PCIX, &reg) == 0) {
-		if (reg != 0)
-			sc->bge_flags |= BGE_FLAG_PCIX;
-	}
-			
 #else
 	if (BGE_IS_5705_PLUS(sc)) {
 		reg = pci_read_config(dev, BGE_PCIE_CAPID_REG, 4);
 		if ((reg & 0xFF) == BGE_PCIE_CAPID)
 			sc->bge_flags |= BGE_FLAG_PCIE;
+#endif
 	} else {
 		/*
 		 * Check if the device is in PCI-X Mode.
 		 * (This bit is not valid on PCI Express controllers.)
 		 */
-		if ((pci_read_config(sc->bge_dev, BGE_PCI_PCISTATE, 4) &
+		if ((pci_read_config(dev, BGE_PCI_PCISTATE, 4) &
 		    BGE_PCISTATE_PCI_BUSMODE) == 0)
 			sc->bge_flags |= BGE_FLAG_PCIX;
 	}
-#endif
 
 #if __FreeBSD_version > 602105
 	{

==== //depot/projects/vimage-commit2/src/sys/dev/sis/if_sis.c#3 (text+ko) ====

@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/sis/if_sis.c,v 1.4 2008/08/23 15:34:31 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/sis/if_sis.c,v 1.5 2008/12/09 04:30:47 yongari Exp $");
 
 /*
  * SiS 900/SiS 7016 fast ethernet PCI NIC driver. Datasheets are
@@ -1432,7 +1432,11 @@
 		 * it should simply get re-used next time this descriptor
 	 	 * comes up in the ring.
 		 */
-		if (!(rxstat & SIS_CMDSTS_PKT_OK)) {
+		if ((ifp->if_capenable & IFCAP_VLAN_MTU) != 0 &&
+		    total_len <= (ETHER_MAX_LEN + ETHER_VLAN_ENCAP_LEN -
+		    ETHER_CRC_LEN))
+			rxstat &= ~SIS_RXSTAT_GIANT;
+		if (SIS_RXSTAT_ERROR(rxstat) != 0) {
 			ifp->if_ierrors++;
 			if (rxstat & SIS_RXSTAT_COLL)
 				ifp->if_collisions++;

==== //depot/projects/vimage-commit2/src/sys/dev/sis/if_sisreg.h#2 (text+ko) ====

@@ -29,7 +29,7 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  * THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/sis/if_sisreg.h,v 1.1 2008/08/10 10:00:14 imp Exp $
+ * $FreeBSD: src/sys/dev/sis/if_sisreg.h,v 1.2 2008/12/09 04:30:47 yongari Exp $
  */
 
 /*
@@ -348,6 +348,11 @@
 #define SIS_RXSTAT_OVERRUN	0x02000000
 #define SIS_RXSTAT_RX_ABORT	0x04000000
 
+#define	SIS_RXSTAT_ERROR(x)						\
+	((x) & (SIS_RXSTAT_RX_ABORT | SIS_RXSTAT_OVERRUN |		\
+	SIS_RXSTAT_GIANT | SIS_RXSTAT_SYMBOLERR | SIS_RXSTAT_RUNT |	\
+	SIS_RXSTAT_CRCERR | SIS_RXSTAT_ALIGNERR))
+
 #define SIS_DSTCLASS_REJECT	0x00000000
 #define SIS_DSTCLASS_UNICAST	0x00800000
 #define SIS_DSTCLASS_MULTICAST	0x01000000

==== //depot/projects/vimage-commit2/src/sys/net/if.c#30 (text+ko) ====

@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)if.c	8.5 (Berkeley) 1/9/95
- * $FreeBSD: src/sys/net/if.c,v 1.296 2008/12/02 21:37:28 bz Exp $
+ * $FreeBSD: src/sys/net/if.c,v 1.298 2008/12/09 21:09:05 bz Exp $
  */
 
 #include "opt_compat.h"
@@ -50,6 +50,8 @@
 #include <sys/socketvar.h>
 #include <sys/protosw.h>
 #include <sys/kernel.h>
+#include <sys/lock.h>
+#include <sys/rwlock.h>
 #include <sys/sockio.h>
 #include <sys/syslog.h>
 #include <sys/sysctl.h>
@@ -1364,8 +1366,6 @@
 	return (ifa);
 }
 
-#include <net/route.h>
-
 /*
  * Default action when installing a route with a Link Level gateway.
  * Lookup an appropriate real ifa to point to.

==== //depot/projects/vimage-commit2/src/sys/net/route.c#26 (text+ko) ====

@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)route.c	8.3.1.1 (Berkeley) 2/23/95
- * $FreeBSD: src/sys/net/route.c,v 1.145 2008/12/08 20:21:57 kmacy Exp $
+ * $FreeBSD: src/sys/net/route.c,v 1.147 2008/12/10 09:21:52 kmacy Exp $
  */
 /************************************************************************
  * Note: In this file a 'fib' is a "forwarding information base"	*
@@ -513,7 +513,7 @@
 	struct rt_addrinfo info;
 	struct ifaddr *ifa;
 	struct radix_node_head *rnh =
-	    V_rt_tables[rt->rt_fibnum][dst->sa_family];
+	    V_rt_tables[fibnum][dst->sa_family];
 
 	/* verify the gateway is directly reachable */
 	if ((ifa = ifa_ifwithnet(gateway)) == NULL) {
@@ -680,7 +680,7 @@
 	if (ifa == NULL)
 		ifa = ifa_ifwithnet(gateway);
 	if (ifa == NULL) {
-		struct rtentry *rt = rtalloc1_fib(gateway, 0, 0UL, fibnum);
+		struct rtentry *rt = rtalloc1_fib(gateway, 0, RTF_RNH_LOCKED, fibnum);
 		if (rt == NULL)
 			return (NULL);
 		/*
@@ -1161,7 +1161,7 @@
 			 * then we just blow it away and retry the insertion
 			 * of the new one.
 			 */
-			rt2 = rtalloc1_fib(dst, 0, 0, fibnum);
+			rt2 = rtalloc1_fib(dst, 0, RTF_RNH_LOCKED, fibnum);
 			if (rt2 && rt2->rt_parent) {
 				rtexpunge(rt2);
 				RT_UNLOCK(rt2);

==== //depot/projects/vimage-commit2/src/sys/net/rtsock.c#16 (text+ko) ====

@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)rtsock.c	8.7 (Berkeley) 10/12/95
- * $FreeBSD: src/sys/net/rtsock.c,v 1.155 2008/12/08 00:28:21 imp Exp $
+ * $FreeBSD: src/sys/net/rtsock.c,v 1.156 2008/12/10 09:21:52 kmacy Exp $
  */
 #include "opt_sctp.h"
 #include "opt_mpath.h"
@@ -672,9 +672,11 @@
 			     !sa_equal(info.rti_info[RTAX_IFA],
 				       rt->rt_ifa->ifa_addr))) {
 				RT_UNLOCK(rt);
+				RADIX_NODE_HEAD_LOCK(rnh);
 				if ((error = rt_getifa_fib(&info,
 				    rt->rt_fibnum)) != 0)
 					senderr(error);
+				RADIX_NODE_HEAD_UNLOCK(rnh);
 				RT_LOCK(rt);
 			}
 			if (info.rti_ifa != NULL &&
@@ -686,8 +688,14 @@
 				IFAFREE(rt->rt_ifa);
 			}
 			if (info.rti_info[RTAX_GATEWAY] != NULL) {
-				if ((error = rt_setgate(rt, rt_key(rt),
-					info.rti_info[RTAX_GATEWAY])) != 0) {
+				RT_UNLOCK(rt);
+				RADIX_NODE_HEAD_LOCK(rnh);
+				RT_LOCK(rt);
+				
+				error = rt_setgate(rt, rt_key(rt),
+				    info.rti_info[RTAX_GATEWAY]);
+				RADIX_NODE_HEAD_UNLOCK(rnh);
+				if (error != 0) {
 					RT_UNLOCK(rt);
 					senderr(error);
 				}

==== //depot/projects/vimage-commit2/src/sys/netinet/in_pcb.h#11 (text+ko) ====

@@ -1,6 +1,7 @@
 /*-
  * Copyright (c) 1982, 1986, 1990, 1993
- *	The Regents of the University of California.  All rights reserved.
+ *	The Regents of the University of California.
+ * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -27,7 +28,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)in_pcb.h	8.1 (Berkeley) 6/10/93
- * $FreeBSD: src/sys/netinet/in_pcb.h,v 1.119 2008/12/08 20:18:50 rwatson Exp $
+ * $FreeBSD: src/sys/netinet/in_pcb.h,v 1.121 2008/12/09 23:57:09 rwatson Exp $
  */
 
 #ifndef _NETINET_IN_PCB_H_
@@ -88,11 +89,11 @@
 		struct	in_addr_4in6 ie46_local;
 		struct	in6_addr ie6_local;
 	} ie_dependladdr;
+};
 #define	ie_faddr	ie_dependfaddr.ie46_foreign.ia46_addr4
 #define	ie_laddr	ie_dependladdr.ie46_local.ia46_addr4
 #define	ie6_faddr	ie_dependfaddr.ie6_foreign
 #define	ie6_laddr	ie_dependladdr.ie6_local
-};
 
 /*
  * XXX The defines for inc_* are hacks and should be changed to direct
@@ -152,20 +153,11 @@
 	LIST_ENTRY(inpcb) inp_list;	/* (i/p) list for all PCBs for proto */
 	void	*inp_ppcb;		/* (i) pointer to per-protocol pcb */
 	struct	inpcbinfo *inp_pcbinfo;	/* (c) PCB list info */
-	struct	socket *inp_socket;	/* (i)  back pointer to socket */
+	struct	socket *inp_socket;	/* (i) back pointer to socket */
 	struct	ucred	*inp_cred;	/* (c) cache of socket cred */
-
-	u_int32_t	inp_flow;	/* (i) IPv6 flow information */
+	u_int32_t inp_flow;		/* (i) IPv6 flow information */
 	int	inp_flags;		/* (i) generic IP/datagram flags */
-
 	u_char	inp_vflag;		/* (i) IP version flag (v4/v6) */
-#define	INP_IPV4	0x1
-#define	INP_IPV6	0x2
-#define	INP_IPV6PROTO	0x4		/* opened under IPv6 protocol */
-#define	INP_TIMEWAIT	0x8		/* .. probably doesn't go here */
-#define	INP_ONESBCAST	0x10		/* send all-ones broadcast */
-#define	INP_DROPPED	0x20		/* protocol drop flag */
-#define	INP_SOCKREF	0x40		/* strong socket reference */
 	u_char	inp_ip_ttl;		/* (i) time to live proto */
 	u_char	inp_ip_p;		/* (c) protocol proto */
 	u_char	inp_ip_minttl;		/* (i) minimum TTL or drop */
@@ -174,9 +166,9 @@
 	void	*inp_pspare[2];		/* (x) rtentry / general use */
 
 	/* Local and foreign ports, local and foreign addr. */
-	struct	in_conninfo inp_inc;
+	struct	in_conninfo inp_inc;	/* (i/p) list for PCB's local port */
 
-					/* (i/p) list for PCB's local port */
+	/* MAC and IPSEC policy information. */
 	struct	label *inp_label;	/* (i) MAC label */
 	struct	inpcbpolicy *inp_sp;    /* (s) for IPSEC */
 
@@ -184,15 +176,8 @@
 	struct {
 		u_char	inp4_ip_tos;		/* (i) type of service proto */
 		struct	mbuf *inp4_options;	/* (i) IP options */
-		struct	ip_moptions *inp4_moptions; /* (i) IP multicast options */
+		struct	ip_moptions *inp4_moptions; /* (i) IP mcast options */
 	} inp_depend4;
-#define	inp_fport	inp_inc.inc_fport
-#define	inp_lport	inp_inc.inc_lport
-#define	inp_faddr	inp_inc.inc_faddr
-#define	inp_laddr	inp_inc.inc_laddr
-#define	inp_ip_tos	inp_depend4.inp4_ip_tos
-#define	inp_options	inp_depend4.inp4_options
-#define	inp_moptions	inp_depend4.inp4_moptions
 	struct {
 		/* (i) IP options */
 		struct	mbuf *inp6_options;
@@ -209,8 +194,16 @@
 	LIST_ENTRY(inpcb) inp_portlist;	/* (i/p) */
 	struct	inpcbport *inp_phd;	/* (i/p) head of this list */
 #define inp_zero_size offsetof(struct inpcb, inp_gencnt)
-	inp_gen_t	inp_gencnt;	/* (c) generation count of this instance */
+	inp_gen_t	inp_gencnt;	/* (c) generation count */
 	struct rwlock	inp_lock;
+};
+#define	inp_fport	inp_inc.inc_fport
+#define	inp_lport	inp_inc.inc_lport
+#define	inp_faddr	inp_inc.inc_faddr
+#define	inp_laddr	inp_inc.inc_laddr
+#define	inp_ip_tos	inp_depend4.inp4_ip_tos
+#define	inp_options	inp_depend4.inp4_options
+#define	inp_moptions	inp_depend4.inp4_moptions
 
 #define	in6p_faddr	inp_inc.inc6_faddr
 #define	in6p_laddr	inp_inc.inc6_laddr
@@ -228,7 +221,7 @@
 #define	in6p_lport	inp_lport  /* for KAME src sync over BSD*'s */
 #define	in6p_fport	inp_fport  /* for KAME src sync over BSD*'s */
 #define	in6p_ppcb	inp_ppcb  /* for KAME src sync over BSD*'s */
-};
+
 /*
  * The range of the generation count, as used in this implementation, is 9e19.
  * We would have to create 300 billion connections per second for this number
@@ -384,7 +377,22 @@
 #define INP_PCBPORTHASH(lport, mask) \
 	(ntohs((lport)) & (mask))
 
-/* flags in inp_flags: */
+/*
+ * Flags for inp_vflags -- historically version flags only, but now quite a
+ * bit more due to an overflow of inp_flag, leading to some locking ambiguity
+ * as some bits are stable from initial allocation, and others may change.
+ */
+#define	INP_IPV4	0x1
+#define	INP_IPV6	0x2
+#define	INP_IPV6PROTO	0x4		/* opened under IPv6 protocol */
+#define	INP_TIMEWAIT	0x8		/* inpcb in TIMEWAIT, ppcb is tcptw */
+#define	INP_ONESBCAST	0x10		/* send all-ones broadcast */
+#define	INP_DROPPED	0x20		/* protocol drop flag */
+#define	INP_SOCKREF	0x40		/* strong socket reference */
+
+/*
+ * Flags for inp_flag.
+ */
 #define	INP_RECVOPTS		0x01	/* receive incoming IP options */
 #define	INP_RECVRETOPTS		0x02	/* receive IP options for reply */
 #define	INP_RECVDSTADDR		0x04	/* receive IP dst address */

==== //depot/projects/vimage-commit2/src/sys/netinet/ip_fw_nat.c#10 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet/ip_fw_nat.c,v 1.5 2008/10/02 15:37:58 zec Exp $");
+__FBSDID("$FreeBSD: src/sys/netinet/ip_fw_nat.c,v 1.7 2008/12/10 08:23:47 kmacy Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -93,7 +93,7 @@
 	LIST_FOREACH(ptr, &V_layer3_chain.nat, _next) {
 		/* ...using nic 'ifp->if_xname' as dynamic alias address. */
 		if (strncmp(ptr->if_name, ifp->if_xname, IF_NAMESIZE) == 0) {
-			mtx_lock(&ifp->if_addr_mtx);
+			IF_ADDR_LOCK(ifp);
 			TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) {
 				if (ifa->ifa_addr == NULL)
 					continue;
@@ -103,7 +103,7 @@
 				    (ifa->ifa_addr))->sin_addr;
 				LibAliasSetAddress(ptr->lib, ptr->ip);
 			}
-			mtx_unlock(&ifp->if_addr_mtx);
+			IF_ADDR_UNLOCK(ifp);
 		}
 	}
 	IPFW_WUNLOCK(&V_layer3_chain);	

==== //depot/projects/vimage-commit2/src/sys/netinet/tcp_input.c#30 (text+ko) ====

@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet/tcp_input.c,v 1.394 2008/12/08 20:27:00 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/netinet/tcp_input.c,v 1.395 2008/12/09 15:49:02 rwatson Exp $");
 
 #include "opt_ipfw.h"		/* for ipfw_fwd	*/
 #include "opt_inet.h"
@@ -480,11 +480,11 @@
 
 	/*
 	 * Locate pcb for segment, which requires a lock on tcbinfo.
-	 * Optimisticaly acquire a global read lock unless header flags
-	 * necessarily imply a state change.  There are two cases where we
-	 * might discover later we need a write lock despite the flags: ACKs
-	 * moving a connection out of the syncache, and ACK relating to a
-	 * connection in TIMEWAIT.
+	 * Optimisticaly acquire a global read lock rather than a write lock
+	 * unless header flags necessarily imply a state change.  There are
+	 * two cases where we might discover later we need a write lock
+	 * despite the flags: ACKs moving a connection out of the syncache,
+	 * and ACKs for a connection in TIMEWAIT.
 	 */
 	if ((thflags & (TH_SYN | TH_FIN | TH_RST)) != 0 ||
 	    tcp_read_locking == 0) {
@@ -1087,7 +1087,7 @@
 	 * allow either a read lock or a write lock, as we may have acquired
 	 * a write lock due to a race.
 	 *
-	 * Require a global write lock for SYN/SIN/RST segments or
+	 * Require a global write lock for SYN/FIN/RST segments or
 	 * non-established connections; otherwise accept either a read or
 	 * write lock, as we may have conservatively acquired a write lock in
 	 * certain cases in tcp_input() (is this still true?).  Currently we



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812100935.mBA9ZFTw016547>