Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Jan 2005 13:18:21 GMT
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 68136 for review
Message-ID:  <200501021318.j02DILts013488@repoman.freebsd.org>

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

Change 68136 by rwatson@rwatson_zoo on 2005/01/02 13:18:00

	Integrate netperf_socket from FreeBSD CVS HEAD:
	
	- 802.11 adhoc fix for if_wi
	- fxp fix
	- ia64 unaligned access fixes
	- random port allocation logic tweaked 
	
	Loop back towards rwatson_netperf:
	
	- IPX header __packed fix.
	- Use rtalloc_ign() in preference to rtalloc() throughout IPX.
	- Move ipxpcb_lport_cache to ipx_pcb.c from ipx_input.c.
	- Use RTFREE() rather than rtfree() throughout IPX.
	- Style improvements to IPX.

Affected files ...

.. //depot/projects/netperf_socket/sys/dev/ata/ata-chipset.c#23 integrate
.. //depot/projects/netperf_socket/sys/dev/bktr/bktr_card.c#4 integrate
.. //depot/projects/netperf_socket/sys/dev/bktr/bktr_card.h#4 integrate
.. //depot/projects/netperf_socket/sys/dev/em/if_em.c#15 integrate
.. //depot/projects/netperf_socket/sys/dev/re/if_re.c#15 integrate
.. //depot/projects/netperf_socket/sys/dev/sym/sym_hipd.c#4 integrate
.. //depot/projects/netperf_socket/sys/dev/wi/if_wi.c#8 integrate
.. //depot/projects/netperf_socket/sys/ia64/ia64/support.S#4 integrate
.. //depot/projects/netperf_socket/sys/ia64/ia64/unaligned.c#3 integrate
.. //depot/projects/netperf_socket/sys/ia64/include/md_var.h#7 integrate
.. //depot/projects/netperf_socket/sys/net80211/ieee80211_node.c#6 integrate
.. //depot/projects/netperf_socket/sys/netinet/in_pcb.c#18 integrate
.. //depot/projects/netperf_socket/sys/netinet/in_pcb.h#10 integrate
.. //depot/projects/netperf_socket/sys/netinet/ip_input.c#27 integrate
.. //depot/projects/netperf_socket/sys/netinet/ip_var.h#12 integrate
.. //depot/projects/netperf_socket/sys/netipx/ipx.h#3 integrate
.. //depot/projects/netperf_socket/sys/netipx/ipx_input.c#3 integrate
.. //depot/projects/netperf_socket/sys/netipx/ipx_ip.c#2 integrate
.. //depot/projects/netperf_socket/sys/netipx/ipx_outputfl.c#2 integrate
.. //depot/projects/netperf_socket/sys/netipx/ipx_pcb.c#7 integrate
.. //depot/projects/netperf_socket/sys/pc98/conf/GENERIC#19 integrate
.. //depot/projects/netperf_socket/sys/sys/msgbuf.h#4 integrate

Differences ...

==== //depot/projects/netperf_socket/sys/dev/ata/ata-chipset.c#23 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ata/ata-chipset.c,v 1.97 2004/12/24 13:36:04 sos Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ata/ata-chipset.c,v 1.98 2005/01/01 19:24:25 sos Exp $");
 
 #include "opt_ata.h"
 #include <sys/param.h>
@@ -1367,6 +1367,11 @@
 	return ENXIO;
     }
 
+    if (ctlr->chip->max_dma >= ATA_SA150)
+	ctlr->setmode = ata_sata_setmode;
+    else
+	ctlr->setmode = ata_promise_setmode;
+
     switch  (ctlr->chip->cfg1) {
     case PRNEW:
 	/* setup clocks */
@@ -1413,22 +1418,33 @@
 	ctlr->dmainit = ata_promise_mio_dmainit;
 	ctlr->allocate = ata_promise_mio_allocate;
 
-	if (ctlr->chip->cfg2 & PRPATA) {
-	    ctlr->channels = ((ATA_INL(ctlr->r_res2, 0x48) & 0x01) > 0) +
-			     ((ATA_INL(ctlr->r_res2, 0x48) & 0x02) > 0) + 2;
-	}
-	else if (ctlr->chip->cfg2 & PRCMBO) {
-	    ATA_OUTL(ctlr->r_res2, 0x06c, 0x000000ff);
-	    ctlr->channels = ((ATA_INL(ctlr->r_res2, 0x48) & 0x02) > 0) + 3;
-	}
-	else if (ctlr->chip->cfg2 & PRCMBO2) {
-	    ATA_OUTL(ctlr->r_res2, 0x060, 0x000000ff);
-	    ctlr->channels = 3;
-	}
-	else
-	    ctlr->channels = 4;
+	switch (ctlr->chip->cfg2) {
+	case PRPATA:
+            ctlr->channels = ((ATA_INL(ctlr->r_res2, 0x48) & 0x01) > 0) +
+                             ((ATA_INL(ctlr->r_res2, 0x48) & 0x02) > 0) + 2;
+	    break;
+
+	case PRCMBO:
+            ATA_OUTL(ctlr->r_res2, 0x06c, 0x000000ff);
+            ctlr->channels = ((ATA_INL(ctlr->r_res2, 0x48) & 0x02) > 0) + 3;
+	    break;
+
+	case PRSATA:
+            ATA_OUTL(ctlr->r_res2, 0x06c, 0x000000ff);
+            ctlr->channels = 4;
+	    break;
+
+	case PRCMBO2:
+            ATA_OUTL(ctlr->r_res2, 0x060, 0x000000ff);
+            ctlr->channels = 3;
+	    break;
+
+	case PRSATA2:
+            ATA_OUTL(ctlr->r_res2, 0x060, 0x000000ff);
+            ctlr->channels = 4;
+	    break;
 
-	if (ctlr->chip->cfg2 & PRSX4X) {
+	case PRSX4X: {
 	    struct ata_promise_sx4 *hpkt;
 	    u_int32_t dimm = ATA_INL(ctlr->r_res2, 0x000c0080);
 
@@ -1448,26 +1464,25 @@
 	    mtx_init(&hpkt->mtx, "ATA promise HPKT lock", NULL, MTX_DEF);
 	    hpkt->busy = hpkt->head = hpkt->tail = 0;
 
+            ctlr->channels = 4;
+
 	    if ((bus_setup_intr(dev, ctlr->r_irq, ATA_INTR_FLAGS,
 				ata_promise_sx4_intr, ctlr, &ctlr->handle))) {
 		device_printf(dev, "unable to setup interrupt\n");
 		return ENXIO;
 	    }
+	    return 0;
+	    }
 	}
-	else {
-	    if ((bus_setup_intr(dev, ctlr->r_irq, ATA_INTR_FLAGS,
-				ata_promise_mio_intr, ctlr, &ctlr->handle))) {
-		device_printf(dev, "unable to setup interrupt\n");
-		return ENXIO;
-	    }
+
+	if ((bus_setup_intr(dev, ctlr->r_irq, ATA_INTR_FLAGS,
+			    ata_promise_mio_intr, ctlr, &ctlr->handle))) {
+	    device_printf(dev, "unable to setup interrupt\n");
+	    return ENXIO;
 	}
-	break;
+	return 0;
     }
-    if (ctlr->chip->max_dma >= ATA_SA150)
-	ctlr->setmode = ata_sata_setmode;
-    else
-	ctlr->setmode = ata_promise_setmode;
-    return 0;
+    return ENXIO;
 }
 
 static int
@@ -1587,13 +1602,13 @@
     struct ata_pci_controller *ctlr = 
 	device_get_softc(device_get_parent(ch->dev));
 
-    if (ctlr->chip->cfg2 & PRSX4X) {
+    switch (ctlr->chip->cfg2) {
+    case PRSX4X: {
 	struct ata_promise_sx4 *hpktp = ctlr->driver;
 
-	/* softreset channels ATA module */
+	/* softreset channel ATA module */
 	ATA_OUTL(ctlr->r_res2, 0xc0260 + (ch->unit << 7), ch->unit + 1);
 	DELAY(1000);
-
 	ATA_OUTL(ctlr->r_res2, 0xc0260 + (ch->unit << 7),
 		 (ATA_INL(ctlr->r_res2, 0xc0260 + (ch->unit << 7)) &
 		  ~0x00003f9f) | (ch->unit + 1));
@@ -1606,8 +1621,20 @@
 	ATA_OUTL(ctlr->r_res2, 0xc012c,
 		 (ATA_INL(ctlr->r_res2, 0xc012c) & ~0x00000f9f));
 	mtx_unlock(&hpktp->mtx);
-    }
-    else if (ctlr->chip->cfg2 & PRSATA) {
+        }
+        break;
+
+    case PRCMBO:
+    case PRCMBO2:
+	/* softreset channel ATA module */
+	ATA_OUTL(ctlr->r_res2, 0x0260 + (ch->unit << 7), (1 << 11));
+	ata_udelay(10000);
+	ATA_OUTL(ctlr->r_res2, 0x0260 + (ch->unit << 7),
+		 (ATA_INL(ctlr->r_res2, 0x0260 + (ch->unit << 7)) &
+		  ~0x00003f9f) | (ch->unit + 1));
+	break;
+
+    case PRSATA: {
 	u_int32_t status = 0;
 	int timeout;
 
@@ -1633,14 +1660,16 @@
 	if (timeout >= 1000000)
 	    device_printf(ch->dev, "connect status=%08x\n", status);
 
-	/* enable plug/unplug intr */
+	/* reset and enable plug/unplug intr */
 	ATA_OUTL(ctlr->r_res2, 0x06c, (0x00000011 << ch->unit));
-    }
-    else if (ctlr->chip->cfg2 & PRSATA2) {
+        }
+	break;
+
+    case PRSATA2: {
 	u_int32_t status = 0;
 	int timeout;
 
-	/* set PM port */
+	/* set portmultiplier port */
 	ATA_OUTL(ctlr->r_res2, 0x4e8 + (ch->unit << 8), 0x0f);
 
 	/* mask plug/unplug intr */
@@ -1670,11 +1699,13 @@
 	if (timeout >= 1000000)
 	    device_printf(ch->dev, "connect status=%08x\n", status);
 
-	/* enable plug/unplug intr */
+	/* reset and enable plug/unplug intr */
 	ATA_OUTL(ctlr->r_res2, 0x060, (0x00000011 << ch->unit));
 
-	/* set PM port */
-	ATA_OUTL(ctlr->r_res2, 0x4e8 + (ch->unit * 0x100), 0x00);
+	/* set portmultiplier port */
+	ATA_OUTL(ctlr->r_res2, 0x4e8 + (ch->unit << 8), 0x00);
+	}
+	break;
     }
 }
 

==== //depot/projects/netperf_socket/sys/dev/bktr/bktr_card.c#4 (text+ko) ====

@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/bktr/bktr_card.c,v 1.26 2004/12/17 00:57:48 julian Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/bktr/bktr_card.c,v 1.27 2005/01/02 04:47:36 julian Exp $");
 
 /*
  * This is part of the Driver for Video Capture Cards (Frame grabbers)
@@ -380,6 +380,18 @@
 	   { 0x02, 0x01, 0x00, 0x0a, 1 },	/* audio MUX values */
 	   0x03000F },				/* GPIO mask */
 
+        {  CARD_PIXELVIEW_PLAYTV_PAK,       /* the card id */
+           "PixelView PlayTV Pak",              /* the 'name' */
+            NULL,                               /* the tuner */
+            0,                                  /* the tuner i2c address */
+            0,                                  /* dbx is optional */
+            0,
+            0,
+            PFC8582_WADDR,                      /* EEProm type */
+            (u_char)(256 / EEPROMBLOCKSIZE),    /* 256 bytes */
+            { 0x20000, 0x80000, 0, 0xa8000, 1 },        /* audio MUX values */
+            0xAA0000 },                         /* GPIO mask */
+
 };
 
 struct bt848_card_sig bt848_card_signature[1]= {

==== //depot/projects/netperf_socket/sys/dev/bktr/bktr_card.h#4 (text+ko) ====

@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/dev/bktr/bktr_card.h,v 1.9 2004/12/17 00:57:48 julian Exp $ */
+/* $FreeBSD: src/sys/dev/bktr/bktr_card.h,v 1.10 2005/01/02 04:47:36 julian Exp $ */
 
 /*
  * This is part of the Driver for Video Capture Cards (Frame grabbers)
@@ -79,7 +79,8 @@
 #define	CARD_IO_BCTV3		17
 #define	CARD_AOPEN_VA1000	18
 #define CARD_PINNACLE_PCTV_RAVE	19
-#define Bt848_MAX_CARD		20
+#define CARD_PIXELVIEW_PLAYTV_PAK	20
+#define Bt848_MAX_CARD		21
 
 #define CARD_IO_GV		CARD_IO_BCTV2
 

==== //depot/projects/netperf_socket/sys/dev/em/if_em.c#15 (text+ko) ====

@@ -31,7 +31,7 @@
 
 ***************************************************************************/
 
-/*$FreeBSD: src/sys/dev/em/if_em.c,v 1.54 2004/11/14 20:20:28 rwatson Exp $*/
+/*$FreeBSD: src/sys/dev/em/if_em.c,v 1.56 2005/01/01 19:57:23 tackerman Exp $*/
 
 #include <dev/em/if_em.h>
 
@@ -80,6 +80,7 @@
         { 0x8086, 0x1011, PCI_ANY_ID, PCI_ANY_ID, 0},
         { 0x8086, 0x1012, PCI_ANY_ID, PCI_ANY_ID, 0},
         { 0x8086, 0x1013, PCI_ANY_ID, PCI_ANY_ID, 0},
+        { 0x8086, 0x1014, PCI_ANY_ID, PCI_ANY_ID, 0},
         { 0x8086, 0x1015, PCI_ANY_ID, PCI_ANY_ID, 0},
         { 0x8086, 0x1016, PCI_ANY_ID, PCI_ANY_ID, 0},
         { 0x8086, 0x1017, PCI_ANY_ID, PCI_ANY_ID, 0},
@@ -99,6 +100,7 @@
         { 0x8086, 0x107A, PCI_ANY_ID, PCI_ANY_ID, 0},
         { 0x8086, 0x107B, PCI_ANY_ID, PCI_ANY_ID, 0},
         { 0x8086, 0x107C, PCI_ANY_ID, PCI_ANY_ID, 0},
+        { 0x8086, 0x108A, PCI_ANY_ID, PCI_ANY_ID, 0},
         /* required last entry */
         { 0, 0, 0, 0, 0}
 };
@@ -3003,8 +3005,20 @@
 static void
 em_disable_intr(struct adapter *adapter)
 {
-	E1000_WRITE_REG(&adapter->hw, IMC, 
-			(0xffffffff & ~E1000_IMC_RXSEQ));
+	/*
+	 * The first version of 82542 had an errata where when link was forced it
+	 * would stay up even up even if the cable was disconnected.  Sequence errors
+	 * were used to detect the disconnect and then the driver would unforce the link.
+	 * This code in the in the ISR.  For this to work correctly the Sequence error 
+	 * interrupt had to be enabled all the time.
+	 */
+
+	if (adapter->hw.mac_type == em_82542_rev2_0)
+	    E1000_WRITE_REG(&adapter->hw, IMC,
+	        (0xffffffff & ~E1000_IMC_RXSEQ));
+	else
+	    E1000_WRITE_REG(&adapter->hw, IMC,
+	        0xffffffff);
 	return;
 }
 

==== //depot/projects/netperf_socket/sys/dev/re/if_re.c#15 (text+ko) ====

@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/re/if_re.c,v 1.35 2004/09/28 18:22:24 jmg Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/re/if_re.c,v 1.36 2005/01/02 01:37:21 cognet Exp $");
 
 /*
  * RealTek 8139C+/8169/8169S/8110S PCI NIC driver
@@ -1284,7 +1284,6 @@
 		 * anymore.
 		 */
 		ifp->if_flags &= ~IFF_UP;
-		ether_ifdetach(ifp);
 	}
 	if (sc->rl_miibus)
 		device_delete_child(dev, sc->rl_miibus);

==== //depot/projects/netperf_socket/sys/dev/sym/sym_hipd.c#4 (text+ko) ====

@@ -56,7 +56,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/sym/sym_hipd.c,v 1.50 2004/09/10 18:39:02 mjacob Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/sym/sym_hipd.c,v 1.51 2005/01/01 19:05:46 se Exp $");
 
 #define SYM_DRIVER_NAME	"sym-1.6.5-20000902"
 
@@ -431,7 +431,11 @@
  */
 
 #define MEMO_SHIFT	4	/* 16 bytes minimum memory chunk */
+#ifndef __amd64__
 #define MEMO_PAGE_ORDER	0	/* 1 PAGE  maximum */
+#else
+#define MEMO_PAGE_ORDER	1	/* 2 PAGEs maximum on amd64 */
+#endif
 #if 0
 #define MEMO_FREE_UNUSED	/* Free unused pages immediately */
 #endif
@@ -440,8 +444,14 @@
 #define MEMO_CLUSTER_SIZE	(1UL << MEMO_CLUSTER_SHIFT)
 #define MEMO_CLUSTER_MASK	(MEMO_CLUSTER_SIZE-1)
 
+#ifndef __amd64__
 #define get_pages()		malloc(MEMO_CLUSTER_SIZE, M_DEVBUF, M_NOWAIT)
 #define free_pages(p)		free((p), M_DEVBUF)
+#else
+#define get_pages()		contigmalloc(MEMO_CLUSTER_SIZE, M_DEVBUF, \
+				    0, 0, 1LL << 32, PAGE_SIZE, 1LL << 32)
+#define free_pages(p)		contigfree((p), MEMO_CLUSTER_SIZE, M_DEVBUF)
+#endif
 
 typedef u_long m_addr_t;	/* Enough bits to bit-hack addresses */
 

==== //depot/projects/netperf_socket/sys/dev/wi/if_wi.c#8 (text+ko) ====

@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/wi/if_wi.c,v 1.173 2004/12/17 20:48:13 mdodd Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/wi/if_wi.c,v 1.174 2005/01/01 17:45:11 sam Exp $");
 
 #define WI_HERMES_AUTOINC_WAR	/* Work around data write autoinc bug. */
 #define WI_HERMES_STATS_WAR	/* Work around stats counter bug. */
@@ -783,9 +783,10 @@
 	ifp->if_flags |= IFF_RUNNING;
 	ifp->if_flags &= ~IFF_OACTIVE;
 	if (ic->ic_opmode == IEEE80211_M_AHDEMO ||
+	    ic->ic_opmode == IEEE80211_M_IBSS ||
 	    ic->ic_opmode == IEEE80211_M_MONITOR ||
 	    ic->ic_opmode == IEEE80211_M_HOSTAP)
-		ieee80211_new_state(ic, IEEE80211_S_RUN, -1);
+		ieee80211_create_ibss(ic, ic->ic_ibss_chan);
 
 	/* Enable interrupts */
 	CSR_WRITE_2(sc, WI_INT_EN, WI_INTRS);
@@ -1314,7 +1315,15 @@
 	                 WI_MAX_FALSE_SYNS))
 		return;
 
-	ieee80211_new_state(ic, IEEE80211_S_RUN, -1);
+	sc->sc_false_syns = MAX(0, sc->sc_false_syns - 1);
+	/*
+	 * XXX hack; we should create a new node with the new bssid
+	 * and replace the existing ic_bss with it but since we don't
+	 * process management frames to collect state we cheat by
+	 * reusing the existing node as we know wi_newstate will be
+	 * called and it will overwrite the node state.
+	 */
+	ieee80211_sta_join(ic, ieee80211_ref_node(ni));
 }
 
 static void
@@ -2674,7 +2683,7 @@
 {
 	struct ifnet *ifp = ic->ic_ifp;
 	struct wi_softc *sc = ifp->if_softc;
-	struct ieee80211_node *ni = ic->ic_bss;
+	struct ieee80211_node *ni;
 	int buflen;
 	u_int16_t val;
 	struct wi_ssid ssid;
@@ -2684,9 +2693,14 @@
 		ieee80211_state_name[ic->ic_state],
 		ieee80211_state_name[nstate]));
 
+	/*
+	 * Internal to the driver the INIT and RUN states are used
+	 * so bypass the net80211 state machine for other states.
+	 * Beware however that this requires use to net80211 state
+	 * management that otherwise would be handled for us.
+	 */
 	switch (nstate) {
 	case IEEE80211_S_INIT:
-		ic->ic_flags &= ~IEEE80211_F_SIBSS;
 		sc->sc_flags &= ~WI_FLAGS_OUTRANGE;
 		return (*sc->sc_newstate)(ic, nstate, arg);
 
@@ -2697,6 +2711,7 @@
 		break;
 
 	case IEEE80211_S_RUN:
+		ni = ic->ic_bss;
 		sc->sc_flags &= ~WI_FLAGS_OUTRANGE;
 		buflen = IEEE80211_ADDR_LEN;
 		IEEE80211_ADDR_COPY(old_bssid, ni->ni_bssid);
@@ -2713,20 +2728,7 @@
 		sc->sc_tx_th.wt_chan_flags = sc->sc_rx_th.wr_chan_flags =
 			htole16(ni->ni_chan->ic_flags);
 #endif
-
-		/* If not equal, then discount a false synchronization. */
-		if (!IEEE80211_ADDR_EQ(old_bssid, ni->ni_bssid))
-			sc->sc_false_syns = MAX(0, sc->sc_false_syns - 1);
-
-		if (ic->ic_opmode == IEEE80211_M_HOSTAP) {
-			ni->ni_esslen = ic->ic_des_esslen;
-			memcpy(ni->ni_essid, ic->ic_des_essid, ni->ni_esslen);
-			ni->ni_rates = ic->ic_sup_rates[IEEE80211_MODE_11B];
-			ni->ni_intval = ic->ic_lintval;
-			ni->ni_capinfo = IEEE80211_CAPINFO_ESS;
-			if (ic->ic_flags & IEEE80211_F_PRIVACY)
-				ni->ni_capinfo |= IEEE80211_CAPINFO_PRIVACY;
-		} else {
+		if (ic->ic_opmode != IEEE80211_M_HOSTAP) {
 			/*
 			 * XXX hack; unceremoniously clear 
 			 * IEEE80211_F_DROPUNENC when operating with

==== //depot/projects/netperf_socket/sys/ia64/ia64/support.S#4 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/ia64/ia64/support.S,v 1.23 2004/08/30 01:32:28 marcel Exp $
+ * $FreeBSD: src/sys/ia64/ia64/support.S,v 1.24 2005/01/02 00:20:53 marcel Exp $
  */
 /*
  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -891,16 +891,6 @@
 	br.ret.sptk.few rp
 END(copyerr)
 
-/*
- * Support functions for handling of unaligned memory accesses.
- */
-ENTRY(spillfd, 2)
-	ldfd		f6 = [r32]
-	;;
-	stf.spill	[r33] = f6
-	br.ret.sptk	rp
-END(spillfd)
-
 #if defined(GPROF)
 /*
  * Important registers:

==== //depot/projects/netperf_socket/sys/ia64/ia64/unaligned.c#3 (text+ko) ====

@@ -24,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/ia64/ia64/unaligned.c,v 1.9 2004/08/16 22:09:58 arun Exp $
+ * $FreeBSD: src/sys/ia64/ia64/unaligned.c,v 1.10 2005/01/02 00:20:54 marcel Exp $
  */
 
 #include <sys/param.h>
@@ -38,14 +38,13 @@
 #include <machine/md_var.h>
 #include <ia64/disasm/disasm.h>
 
-static int ia64_unaligned_print = 1;	/* warn about unaligned accesses. */
-static int ia64_unaligned_sigbus = 0;	/* SIGBUS on all unaligned accesses. */
-
-SYSCTL_INT(_machdep, OID_AUTO, unaligned_print, CTLFLAG_RW,
+static int ia64_unaligned_print = 0;
+SYSCTL_INT(_debug, OID_AUTO, unaligned_print, CTLFLAG_RW,
     &ia64_unaligned_print, 0, "warn about unaligned accesses");
 
-SYSCTL_INT(_machdep, OID_AUTO, unaligned_sigbus, CTLFLAG_RW,
-    &ia64_unaligned_sigbus, 0, "do not SIGBUS on fixed-up accesses");
+static int ia64_unaligned_test = 0;
+SYSCTL_INT(_debug, OID_AUTO, unaligned_test, CTLFLAG_RW,
+    &ia64_unaligned_test, 0, "test emulation when PSR.ac is set");
 
 static void *
 fpreg_ptr(mcontext_t *mc, int fr)
@@ -129,7 +128,9 @@
 {
 	union {
 		double d;
+		long double e;
 		uint64_t i;
+		float s;
 	} buf;
 	void *reg;
 	uint64_t postinc;
@@ -157,11 +158,28 @@
 		wrreg(reg, buf.i);
 		break;
 	case ASM_OP_LDFD:
-		copyin((void*)va, (void*)&buf.d, 8);
+		copyin((void*)va, (void*)&buf.d, sizeof(buf.d));
+		reg = fpreg_ptr(mc, (int)i->i_oper[1].o_value);
+		if (reg == NULL)
+			return (EINVAL);
+		__asm("ldfd f6=%1;; stf.spill %0=f6" : "=m"(*(double *)reg) :
+		    "m"(buf.d) : "f6");
+		break;
+	case ASM_OP_LDFE:
+		copyin((void*)va, (void*)&buf.e, sizeof(buf.e));
+		reg = fpreg_ptr(mc, (int)i->i_oper[1].o_value);
+		if (reg == NULL)
+			return (EINVAL);
+		__asm("ldfe f6=%1;; stf.spill %0=f6" :
+		    "=m"(*(long double *)reg) : "m"(buf.e) : "f6");
+		break;
+	case ASM_OP_LDFS:
+		copyin((void*)va, (void*)&buf.s, sizeof(buf.s));
 		reg = fpreg_ptr(mc, (int)i->i_oper[1].o_value);
 		if (reg == NULL)
 			return (EINVAL);
-		spillfd((void*)&buf.d, reg);
+		__asm("ldfs f6=%1;; stf.spill %0=f6" : "=m"(*(float *)reg) :
+		    "m"(buf.s) : "f6");
 		break;
 	case ASM_OP_ST2:
 		reg = greg_ptr(mc, (int)i->i_oper[2].o_value);
@@ -184,6 +202,30 @@
 		buf.i = rdreg(reg);
 		copyout((void*)&buf.i, (void*)va, 8);
 		break;
+	case ASM_OP_STFD:
+		reg = fpreg_ptr(mc, (int)i->i_oper[2].o_value);
+		if (reg == NULL)
+			return (EINVAL);
+		__asm("ldf.fill f6=%1;; stfd %0=f6" : "=m"(buf.d) :
+		    "m"(*(double *)reg) : "f6");
+		copyout((void*)&buf.d, (void*)va, sizeof(buf.d));
+		break;
+	case ASM_OP_STFE:
+		reg = fpreg_ptr(mc, (int)i->i_oper[2].o_value);
+		if (reg == NULL)
+			return (EINVAL);
+		__asm("ldf.fill f6=%1;; stfe %0=f6" : "=m"(buf.e) :
+		    "m"(*(long double *)reg) : "f6");
+		copyout((void*)&buf.e, (void*)va, sizeof(buf.e));
+		break;
+	case ASM_OP_STFS:
+		reg = fpreg_ptr(mc, (int)i->i_oper[2].o_value);
+		if (reg == NULL)
+			return (EINVAL);
+		__asm("ldf.fill f6=%1;; stfs %0=f6" : "=m"(buf.s) :
+		    "m"(*(float *)reg) : "f6");
+		copyout((void*)&buf.s, (void*)va, sizeof(buf.s));
+		break;
 	default:
 		return (ENOENT);
 	}
@@ -224,11 +266,16 @@
 	}
 
 	/*
-	 * If PSR.ac is set, then the process wants to know about misaligned
-	 * loads and stores. Send it a SIGBUS so that it can deal with them.
-	 * We also send a SIGBUS if configured to do so.
+	 * If PSR.ac is set, the process wants to be signalled about mis-
+	 * aligned loads and stores. Send it a SIGBUS. In order for us to
+	 * test the emulation of misaligned loads and stores, we have a
+	 * sysctl that tells us that we must emulate the load or store,
+	 * instead of sending the signal. We need the sysctl because if
+	 * PSR.ac is not set, the CPU may (and likely will) deal with the
+	 * misaligned load or store itself. As such, we won't get the
+	 * exception.
 	 */
-	if ((tf->tf_special.psr & IA64_PSR_AC) || ia64_unaligned_sigbus)
+	if ((tf->tf_special.psr & IA64_PSR_AC) && !ia64_unaligned_test)
 		return (SIGBUS);
 
 	if (!asm_decode(tf->tf_special.iip, &bundle))

==== //depot/projects/netperf_socket/sys/ia64/include/md_var.h#7 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/ia64/include/md_var.h,v 1.20 2004/12/08 05:46:54 marcel Exp $
+ * $FreeBSD: src/sys/ia64/include/md_var.h,v 1.21 2005/01/02 00:20:54 marcel Exp $
  */
 
 #ifndef _MACHINE_MD_VAR_H_
@@ -88,7 +88,6 @@
 void	map_pal_code(void);
 void	os_boot_rendez(void);
 void	os_mca(void);
-void	spillfd(void *src, void *dst);
 int	syscall(struct trapframe *);
 void	trap(int, struct trapframe *);
 void	trap_panic(int, struct trapframe *);

==== //depot/projects/netperf_socket/sys/net80211/ieee80211_node.c#6 (text+ko) ====

@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_node.c,v 1.30 2004/12/31 22:42:38 sam Exp $");
+__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_node.c,v 1.31 2005/01/01 17:48:27 sam Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h> 
@@ -547,23 +547,23 @@
 	    (b->ni_capinfo & IEEE80211_CAPINFO_PRIVACY))
 		return -1;
 
-	/* best/max rate preferred if signal level close enough XXX */
-	maxa = maxrate(a);
-	maxb = maxrate(b);
 	rssia = ic->ic_node_getrssi(a);
 	rssib = ic->ic_node_getrssi(b);
-	if (maxa != maxb && abs(rssib - rssia) < 5)
-		return maxa - maxb;
-
-	/* XXX use freq for channel preference */
-	/* for now just prefer 5Ghz band to all other bands */
-	if (IEEE80211_IS_CHAN_5GHZ(a->ni_chan) &&
-	   !IEEE80211_IS_CHAN_5GHZ(b->ni_chan))
-		return 1;
-	if (!IEEE80211_IS_CHAN_5GHZ(a->ni_chan) &&
-	     IEEE80211_IS_CHAN_5GHZ(b->ni_chan))
-		return -1;
-
+	if (abs(rssib - rssia) < 5) {
+		/* best/max rate preferred if signal level close enough XXX */
+		maxa = maxrate(a);
+		maxb = maxrate(b);
+		if (maxa != maxb)
+			return maxa - maxb;
+		/* XXX use freq for channel preference */
+		/* for now just prefer 5Ghz band to all other bands */
+		if (IEEE80211_IS_CHAN_5GHZ(a->ni_chan) &&
+		   !IEEE80211_IS_CHAN_5GHZ(b->ni_chan))
+			return 1;
+		if (!IEEE80211_IS_CHAN_5GHZ(a->ni_chan) &&
+		     IEEE80211_IS_CHAN_5GHZ(b->ni_chan))
+			return -1;
+	}
 	/* all things being equal, use signal level */
 	return rssia - rssib;
 }

==== //depot/projects/netperf_socket/sys/netinet/in_pcb.c#18 (text+ko) ====

@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)in_pcb.c	8.4 (Berkeley) 5/24/95
- * $FreeBSD: src/sys/netinet/in_pcb.c,v 1.156 2004/10/18 22:19:43 rwatson Exp $
+ * $FreeBSD: src/sys/netinet/in_pcb.c,v 1.157 2005/01/02 01:50:57 silby Exp $
  */
 
 #include "opt_ipsec.h"
@@ -59,6 +59,8 @@
 #include <netinet/in_var.h>
 #include <netinet/ip_var.h>
 #include <netinet/tcp_var.h>
+#include <netinet/udp.h>
+#include <netinet/udp_var.h>
 #ifdef INET6
 #include <netinet/ip6.h>
 #include <netinet6/ip6_var.h>
@@ -97,8 +99,13 @@
 int	ipport_reservedhigh = IPPORT_RESERVED - 1;	/* 1023 */
 int	ipport_reservedlow = 0;
 
-/* Shall we allocate ephemeral ports in random order? */
-int	ipport_randomized = 1;
+/* Variables dealing with random ephemeral port allocation. */
+int	ipport_randomized = 1;	/* user controlled via sysctl */
+int	ipport_randomcps = 10;	/* user controlled via sysctl */
+int	ipport_randomtime = 45;	/* user controlled via sysctl */
+int	ipport_stoprandom = 0;	/* toggled by ipport_tick */
+int	ipport_tcpallocs;
+int	ipport_tcplastcount;
 
 #define RANGECHK(var, min, max) \
 	if ((var) < (min)) { (var) = (min); } \
@@ -143,6 +150,10 @@
 	   CTLFLAG_RW|CTLFLAG_SECURE, &ipport_reservedlow, 0, "");
 SYSCTL_INT(_net_inet_ip_portrange, OID_AUTO, randomized,
 	   CTLFLAG_RW, &ipport_randomized, 0, "");
+SYSCTL_INT(_net_inet_ip_portrange, OID_AUTO, randomcps,
+	   CTLFLAG_RW, &ipport_randomcps, 0, "");
+SYSCTL_INT(_net_inet_ip_portrange, OID_AUTO, randomtime,
+	   CTLFLAG_RW, &ipport_randomtime, 0, "");
 
 /*
  * in_pcb.c: manage the Protocol Control Blocks.
@@ -266,6 +277,7 @@
 	u_short lport = 0;
 	int wild = 0, reuseport = (so->so_options & SO_REUSEPORT);
 	int error, prison = 0;
+	int dorandom;
 
 	INP_INFO_WLOCK_ASSERT(pcbinfo);
 	INP_LOCK_ASSERT(inp);
@@ -394,6 +406,20 @@
 			lastport = &pcbinfo->lastport;
 		}
 		/*
+		 * For UDP, use random port allocation as long as the user
+		 * allows it.  For TCP (and as of yet unknown) connections,
+		 * use random port allocation only if the user allows it AND
+		 * ipport_tick allows it.
+		 */
+		if (ipport_randomized &&
+			(!ipport_stoprandom || pcbinfo == &udbinfo))
+			dorandom = 1;
+		else
+			dorandom = 0;
+		/* Make sure to not include UDP packets in the count. */
+		if (pcbinfo != &udbinfo)
+			ipport_tcpallocs++;
+		/*
 		 * Simple check to ensure all ports are not used up causing
 		 * a deadlock here.
 		 *
@@ -404,7 +430,7 @@
 			/*
 			 * counting down
 			 */
-			if (ipport_randomized)
+			if (dorandom)
 				*lastport = first -
 					    (arc4random() % (first - last));
 			count = first - last;
@@ -422,7 +448,7 @@
 			/*
 			 * counting up
 			 */
-			if (ipport_randomized)
+			if (dorandom)
 				*lastport = first +
 					    (arc4random() % (last - first));
 			count = last - first;
@@ -1181,3 +1207,25 @@
 	INP_UNLOCK(inp);
 #endif
 }
+
+/*
+ * ipport_tick runs once per second, determining if random port
+ * allocation should be continued.  If more than ipport_randomcps
+ * ports have been allocated in the last second, then we return to
+ * sequential port allocation. We return to random allocation only
+ * once we drop below ipport_randomcps for at least 5 seconds.
+ */
+
+void
+ipport_tick(xtp)
+	void *xtp;
+{
+	if (ipport_tcpallocs > ipport_tcplastcount + ipport_randomcps) {
+		ipport_stoprandom = ipport_randomtime;
+	} else {
+		if (ipport_stoprandom > 0)
+			ipport_stoprandom--;
+	}
+	ipport_tcplastcount = ipport_tcpallocs;
+	callout_reset(&ipport_tick_callout, hz, ipport_tick, NULL);
+}

==== //depot/projects/netperf_socket/sys/netinet/in_pcb.h#10 (text+ko) ====

@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)in_pcb.h	8.1 (Berkeley) 6/10/93
- * $FreeBSD: src/sys/netinet/in_pcb.h,v 1.78 2004/12/05 22:07:14 rwatson Exp $
+ * $FreeBSD: src/sys/netinet/in_pcb.h,v 1.79 2005/01/02 01:50:57 silby Exp $
  */
 
 #ifndef _NETINET_IN_PCB_H_
@@ -333,6 +333,7 @@
 extern int	ipport_lastauto;
 extern int	ipport_hifirstauto;
 extern int	ipport_hilastauto;
+extern struct callout ipport_tick_callout;
 
 void	in_pcbpurgeif0(struct inpcbinfo *, struct ifnet *);
 int	in_pcballoc(struct socket *, struct inpcbinfo *, const char *);
@@ -362,6 +363,7 @@
 	in_sockaddr(in_port_t port, struct in_addr *addr);
 void	in_pcbsosetlabel(struct socket *so);
 void	in_pcbremlists(struct inpcb *inp);
+void	ipport_tick(void *xtp);
 #endif /* _KERNEL */
 
 #endif /* !_NETINET_IN_PCB_H_ */

==== //depot/projects/netperf_socket/sys/netinet/ip_input.c#27 (text+ko) ====

@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)ip_input.c	8.2 (Berkeley) 1/4/94
- * $FreeBSD: src/sys/netinet/ip_input.c,v 1.292 2004/10/19 15:45:57 andre Exp $
+ * $FreeBSD: src/sys/netinet/ip_input.c,v 1.293 2005/01/02 01:50:57 silby Exp $
  */
 
 #include "opt_bootp.h"
@@ -38,6 +38,7 @@
 
 #include <sys/param.h>
 #include <sys/systm.h>
+#include <sys/callout.h>
 #include <sys/mac.h>
 #include <sys/mbuf.h>
 #include <sys/malloc.h>
@@ -186,6 +187,7 @@
 
 static TAILQ_HEAD(ipqhead, ipq) ipq[IPREASS_NHASH];
 struct mtx ipqlock;
+struct callout ipport_tick_callout;
 
 #define	IPQ_LOCK()	mtx_lock(&ipqlock)
 #define	IPQ_UNLOCK()	mtx_unlock(&ipqlock)
@@ -279,6 +281,12 @@
 	maxnipq = nmbclusters / 32;
 	maxfragsperpacket = 16;
 
+	/* Start ipport_tick. */
+	callout_init(&ipport_tick_callout, CALLOUT_MPSAFE);
+	ipport_tick(NULL);
+	EVENTHANDLER_REGISTER(shutdown_pre_sync, ip_fini, NULL,
+		SHUTDOWN_PRI_DEFAULT);
+
 	/* Initialize various other remaining things. */
 	ip_id = time_second & 0xffff;
 	ipintrq.ifq_maxlen = ipqmaxlen;
@@ -286,6 +294,12 @@
 	netisr_register(NETISR_IP, ip_input, &ipintrq, NETISR_MPSAFE);
 }
 
+void ip_fini(xtp)
+	void *xtp;
+{
+	callout_stop(&ipport_tick_callout);
+}
+
 /*
  * Ip input routine.  Checksum and byte swap header.  If fragmented
  * try to reassemble.  Process options.  Pass to next level.

==== //depot/projects/netperf_socket/sys/netinet/ip_var.h#12 (text+ko) ====

@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)ip_var.h	8.2 (Berkeley) 1/9/95
- * $FreeBSD: src/sys/netinet/ip_var.h,v 1.92 2004/10/19 15:45:57 andre Exp $
+ * $FreeBSD: src/sys/netinet/ip_var.h,v 1.93 2005/01/02 01:50:57 silby Exp $
  */
 
 #ifndef _NETINET_IP_VAR_H_
@@ -159,6 +159,7 @@
 
 int	 ip_ctloutput(struct socket *, struct sockopt *sopt);
 void	 ip_drain(void);
+void	 ip_fini(void *xtp);
 int	 ip_fragment(struct ip *ip, struct mbuf **m_frag, int mtu,
 	    u_long if_hwassist_flags, int sw_csum);
 void	 ip_freemoptions(struct ip_moptions *);

==== //depot/projects/netperf_socket/sys/netipx/ipx.h#3 (text+ko) ====

@@ -33,7 +33,7 @@
  *
  *	@(#)ipx.h
  *
- * $FreeBSD: src/sys/netipx/ipx.h,v 1.18 2004/06/22 21:46:49 bms Exp $
+ * $FreeBSD: src/sys/netipx/ipx.h,v 1.19 2005/01/02 02:30:27 rwatson Exp $
  */
 
 #ifndef _NETIPX_IPX_H_
@@ -145,7 +145,7 @@
 	u_char	ipx_pt;		/* Packet Type (i.e. level 2 protocol) */
 	struct ipx_addr	ipx_dna;	/* Destination Network Address */
 	struct ipx_addr	ipx_sna;	/* Source Network Address */
-};
+} __packed;
 
 #define ipx_neteqnn(a,b) \
 	(((a).s_net[0] == (b).s_net[0]) && ((a).s_net[1] == (b).s_net[1]))

==== //depot/projects/netperf_socket/sys/netipx/ipx_input.c#3 (text+ko) ====

@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netipx/ipx_input.c,v 1.38 2004/12/31 17:05:37 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/netipx/ipx_input.c,v 1.40 2005/01/02 01:39:37 rwatson Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -88,7 +88,6 @@
 /*
  * IPX protocol control block (pcb) lists.
  */
-u_short			ipxpcb_lport_cache;
 struct ipxpcbhead	ipxpcb_list;
 struct ipxpcbhead	ipxrawpcb_list;
 
@@ -443,7 +442,7 @@
 	dst->sipx_family = AF_IPX;
 	dst->sipx_addr = *src;
 	dst->sipx_addr.x_port = 0;
-	rtalloc(ro);
+	rtalloc_ign(ro, 0);
 	if (ro->ro_rt == NULL || ro->ro_rt->rt_ifp == NULL) {
 		return (0);
 	}

==== //depot/projects/netperf_socket/sys/netipx/ipx_ip.c#2 (text+ko) ====

@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netipx/ipx_ip.c,v 1.36 2003/10/31 18:32:12 brooks Exp $");
+__FBSDID("$FreeBSD: src/sys/netipx/ipx_ip.c,v 1.37 2005/01/02 01:39:38 rwatson Exp $");
 
 /*
  * Software interface driver for encapsulating IPX in IP.
@@ -333,7 +333,7 @@
 	 */

>>> TRUNCATED FOR MAIL (1000 lines) <<<



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