PERFORCE change 59018 for review
Robert Watson
rwatson at FreeBSD.org
Fri Aug 6 13:40:46 PDT 2004
http://perforce.freebsd.org/chv.cgi?CH=59018
Change 59018 by rwatson at rwatson_paprika on 2004/08/06 20:40:30
Integrate netperf_socket from rwatson_netperf:
More /dev/mem fixage.
ACPI PCI interrupt routing foo.
Loop back of entropy harvesting KTR additions to ithread_schedule().
Colin's modifications to callouts so that callout reset doesn't
recurse the callout mutex.
Loop back of in6_pcbnotify() inpcb/pcbinfo locking fixes from
rwatson_netperf.
Affected files ...
.. //depot/projects/netperf_socket/sys/amd64/amd64/machdep.c#13 integrate
.. //depot/projects/netperf_socket/sys/amd64/amd64/mp_machdep.c#8 integrate
.. //depot/projects/netperf_socket/sys/boot/common/help.common#4 integrate
.. //depot/projects/netperf_socket/sys/boot/forth/loader.conf#11 integrate
.. //depot/projects/netperf_socket/sys/dev/acpica/acpi_pci_link.c#7 integrate
.. //depot/projects/netperf_socket/sys/dev/fb/splash_bmp.c#1 branch
.. //depot/projects/netperf_socket/sys/dev/fb/splash_pcx.c#1 branch
.. //depot/projects/netperf_socket/sys/dev/uart/uart_dev_ns8250.c#6 integrate
.. //depot/projects/netperf_socket/sys/geom/stripe/g_stripe.c#6 integrate
.. //depot/projects/netperf_socket/sys/kern/kern_intr.c#8 integrate
.. //depot/projects/netperf_socket/sys/kern/kern_switch.c#8 integrate
.. //depot/projects/netperf_socket/sys/kern/kern_timeout.c#6 integrate
.. //depot/projects/netperf_socket/sys/net/if.c#15 integrate
.. //depot/projects/netperf_socket/sys/netinet/tcp_subr.c#15 integrate
.. //depot/projects/netperf_socket/sys/netinet/udp_usrreq.c#10 integrate
.. //depot/projects/netperf_socket/sys/netinet6/in6_pcb.c#8 integrate
.. //depot/projects/netperf_socket/sys/netinet6/in6_pcb.h#5 integrate
.. //depot/projects/netperf_socket/sys/netinet6/raw_ip6.c#6 integrate
.. //depot/projects/netperf_socket/sys/netinet6/udp6_usrreq.c#7 integrate
.. //depot/projects/netperf_socket/sys/pci/if_xl.c#11 integrate
Differences ...
==== //depot/projects/netperf_socket/sys/amd64/amd64/machdep.c#13 (text+ko) ====
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/machdep.c,v 1.615 2004/07/31 14:02:29 davidxu Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/machdep.c,v 1.616 2004/08/06 07:20:32 markm Exp $");
#include "opt_atalk.h"
#include "opt_atpic.h"
@@ -65,6 +65,7 @@
#include <sys/linker.h>
#include <sys/lock.h>
#include <sys/malloc.h>
+#include <sys/memrange.h>
#include <sys/mutex.h>
#include <sys/pcpu.h>
#include <sys/proc.h>
@@ -164,6 +165,8 @@
struct mtx icu_lock;
+struct mem_range_softc mem_range_softc;
+
static void
cpu_startup(dummy)
void *dummy;
==== //depot/projects/netperf_socket/sys/amd64/amd64/mp_machdep.c#8 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/mp_machdep.c,v 1.240 2004/08/04 18:30:31 markm Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/mp_machdep.c,v 1.241 2004/08/06 07:22:36 markm Exp $");
#include "opt_cpu.h"
#include "opt_kstack_pages.h"
@@ -142,8 +142,6 @@
static struct sysctl_ctx_list logical_cpu_clist;
static u_int bootMP_size;
-struct mem_range_softc mem_range_softc;
-
static void
mem_range_AP_init(void)
{
==== //depot/projects/netperf_socket/sys/boot/common/help.common#4 (text+ko) ====
@@ -205,7 +205,8 @@
Sets the list of directories which will be searched in for modules
named in a load command or implicitly required by a dependency. The
- default module_path is "/boot/kernel;/boot/modules".
+ default module_path is "/boot/modules" with the kernel directory
+ prepended.
################################################################################
# Tset Sprompt DSet the command prompt
==== //depot/projects/netperf_socket/sys/boot/forth/loader.conf#11 (text+ko) ====
@@ -6,7 +6,7 @@
#
# All arguments must be in double quotes.
#
-# $FreeBSD: src/sys/boot/forth/loader.conf,v 1.84 2004/07/29 20:08:40 ceri Exp $
+# $FreeBSD: src/sys/boot/forth/loader.conf,v 1.85 2004/08/06 15:06:06 jmg Exp $
##############################################################
### Basic configuration options ############################
@@ -49,7 +49,7 @@
#beastie_disable="NO" # Turn the beastie boot menu on and off
#console="vidconsole" # Set the current console
#currdev="disk1s1a" # Set the current device
-module_path="/boot/kernel;/boot/modules" # Set the module search path
+module_path="/boot/modules" # Set the module search path
#prompt="\\${interpret}" # Set the command prompt
#root_disk_unit="0" # Force the root disk unit number
#rootdev="disk1s1a" # Set the root filesystem
==== //depot/projects/netperf_socket/sys/dev/acpica/acpi_pci_link.c#7 (text+ko) ====
@@ -28,7 +28,7 @@
/* #define ACPI_OLD_PCI_LINK 1 */
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_pci_link.c,v 1.17 2004/08/05 06:54:16 njl Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_pci_link.c,v 1.18 2004/08/06 04:50:56 njl Exp $");
#include "opt_acpi.h"
#include <sys/param.h>
@@ -76,13 +76,6 @@
static int irq_penalty[MAX_ACPI_INTERRUPTS];
-#ifdef ACPI_OLD_PCI_LINK
-#define ACPI_STA_PRESENT 0x00000001
-#define ACPI_STA_ENABLE 0x00000002
-#define ACPI_STA_SHOWINUI 0x00000004
-#define ACPI_STA_FUNCTIONAL 0x00000008
-#endif /* ACPI_OLD_PCI_LINK */
-
/*
* PCI link object management
*/
@@ -176,7 +169,6 @@
(int)entry->prt.Pin);
}
-#ifdef ACPI_OLD_PCI_LINK
static ACPI_STATUS
acpi_pci_link_get_object_status(ACPI_HANDLE handle, UINT32 *sta)
{
@@ -221,7 +213,6 @@
AcpiOsFree(buf.Pointer);
return_ACPI_STATUS (AE_OK);
}
-#endif /* ACPI_OLD_PCI_LINK */
static ACPI_STATUS
acpi_pci_link_get_irq_resources(ACPI_RESOURCE *resources,
@@ -446,9 +437,7 @@
{
ACPI_HANDLE handle;
ACPI_STATUS error;
-#ifdef ACPI_OLD_PCI_LINK
UINT32 sta;
-#endif
struct acpi_prt_entry *entry;
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
@@ -466,11 +455,6 @@
return_ACPI_STATUS (error);
}
- /*
- * PCI link status (_STA) is unreliable. Many systems return
- * erroneous values so we ignore it.
- */
-#ifdef ACPI_OLD_PCI_LINK
error = acpi_pci_link_get_object_status(handle, &sta);
if (ACPI_FAILURE(error)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
@@ -479,13 +463,21 @@
return_ACPI_STATUS (error);
}
+ /*
+ * PCI link status (_STA) is unreliable. Many systems return
+ * erroneous values so we ignore it.
+ */
if ((sta & (ACPI_STA_PRESENT | ACPI_STA_FUNCTIONAL)) == 0) {
+#ifndef ACPI_OLD_PCI_LINK
+ device_printf(pcidev, "acpi PRT ignoring status for %s\n",
+ acpi_name(handle));
+#else
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"interrupt link is not functional - %s\n",
acpi_name(handle)));
return_ACPI_STATUS (AE_ERROR);
+#endif /* !ACPI_OLD_PCI_LINK */
}
-#endif /* ACPI_OLD_PCI_LINK */
TAILQ_FOREACH(entry, &acpi_prt_entries, links) {
if (entry->busno == busno &&
@@ -534,18 +526,31 @@
UINT8 i;
if (irq == 0)
- return (0);
+ return (FALSE);
+#ifndef ACPI_OLD_PCI_LINK
+ /*
+ * Look up the given interrupt in the list of possible settings for
+ * this link. We don't special-case the initial link setting. Some
+ * systems return current settings that are outside the list of valid
+ * settings so only allow choices explicitly specified in _PRS.
+ */
+#endif
for (i = 0; i < link->number_of_interrupts; i++) {
if (link->interrupts[i] == irq)
- return (1);
+ return (TRUE);
}
/* allow initial IRQ as valid one. */
if (link->initial_irq == irq)
- return (1);
+#ifndef ACPI_OLD_PCI_LINK
+ printf("acpi link check: %d initial irq, %d irq to route\n",
+ link->initial_irq, irq);
+#else
+ return (TRUE);
+#endif
- return (0);
+ return (FALSE);
}
static ACPI_STATUS
@@ -554,9 +559,7 @@
ACPI_STATUS error;
ACPI_RESOURCE resbuf;
ACPI_BUFFER crsbuf;
-#ifdef ACPI_OLD_PCI_LINK
UINT32 sta;
-#endif
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
@@ -637,7 +640,6 @@
* PCI link status (_STA) is unreliable. Many systems return
* erroneous values so we ignore it.
*/
-#ifdef ACPI_OLD_PCI_LINK
error = acpi_pci_link_get_object_status(link->handle, &sta);
if (ACPI_FAILURE(error)) {
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
@@ -646,20 +648,23 @@
return_ACPI_STATUS (error);
}
- if ((sta & ACPI_STA_ENABLE) == 0) {
+ if ((sta & ACPI_STA_ENABLED) == 0) {
+#ifndef ACPI_OLD_PCI_LINK
+ printf("acpi link set: ignoring status for %s\n",
+ acpi_name(link->handle));
+#else
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
"interrupt link %s is disabled\n",
acpi_name(link->handle)));
return_ACPI_STATUS (AE_ERROR);
+#endif /* !ACPI_OLD_PCI_LINK */
}
-#endif /* ACPI_OLD_PCI_LINK */
/*
* Many systems always return invalid values for current settings
* (_CRS). Since we can't trust the value returned, we have to
* assume we were successful.
*/
-#ifdef ACPI_OLD_PCI_LINK
error = acpi_pci_link_get_current_irq(link, &link->current_irq);
if (ACPI_FAILURE(error)) {
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
@@ -671,13 +676,19 @@
if (link->current_irq == irq) {
error = AE_OK;
} else {
+#ifndef ACPI_OLD_PCI_LINK
+ printf("acpi link set: curr irq %d != %d for %s (ignoring)\n",
+ link->current_irq, irq, acpi_name(link->handle));
+ link->current_irq = irq;
+ error = AE_OK;
+#else
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
"couldn't set IRQ %d to PCI interrupt link %d - %s\n",
irq, link->current_irq, acpi_name(link->handle)));
link->current_irq = 0;
error = AE_ERROR;
+#endif /* !ACPI_OLD_PCI_LINK */
}
-#endif /* ACPI_OLD_PCI_LINK */
return_ACPI_STATUS (error);
}
==== //depot/projects/netperf_socket/sys/dev/uart/uart_dev_ns8250.c#6 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/uart/uart_dev_ns8250.c,v 1.9 2004/07/26 03:54:40 marcel Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/uart/uart_dev_ns8250.c,v 1.10 2004/08/06 15:51:31 marcel Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -700,11 +700,19 @@
*/
sc->sc_txfifosz = 16;
+#if 0
+ /*
+ * XXX there are some issues related to hardware flow control and
+ * it's likely that uart(4) is the cause. This basicly needs more
+ * investigation, but we avoid using for hardware flow control
+ * until then.
+ */
/* 16650s or higher have automatic flow control. */
if (sc->sc_rxfifosz > 16) {
sc->sc_hwiflow = 1;
sc->sc_hwoflow = 1;
}
+#endif
return (0);
}
==== //depot/projects/netperf_socket/sys/geom/stripe/g_stripe.c#6 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/geom/stripe/g_stripe.c,v 1.8 2004/07/26 17:14:47 pjd Exp $");
+__FBSDID("$FreeBSD: src/sys/geom/stripe/g_stripe.c,v 1.11 2004/08/06 10:19:34 pjd Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -89,6 +89,9 @@
TUNABLE_INT("kern.geom.stripe.maxmem", &g_stripe_maxmem);
SYSCTL_UINT(_kern_geom_stripe, OID_AUTO, maxmem, CTLFLAG_RD, &g_stripe_maxmem,
0, "Maximum memory that can be allocated in \"fast\" mode (in bytes)");
+static u_int g_stripe_fast_failed = 0;
+SYSCTL_UINT(_kern_geom_stripe, OID_AUTO, fast_failed, CTLFLAG_RD,
+ &g_stripe_fast_failed, 0, "How many times \"fast\" mode failed");
/*
* Greatest Common Divisor.
@@ -287,17 +290,17 @@
if (pbp->bio_error == 0)
pbp->bio_error = bp->bio_error;
pbp->bio_completed += bp->bio_completed;
- if (bp->bio_cmd == BIO_READ && bp->bio_driver1 != NULL) {
- g_stripe_copy(sc, bp->bio_data, bp->bio_driver1, bp->bio_offset,
+ if (bp->bio_cmd == BIO_READ && bp->bio_caller1 != NULL) {
+ g_stripe_copy(sc, bp->bio_data, bp->bio_caller1, bp->bio_offset,
bp->bio_length, 1);
- bp->bio_data = bp->bio_driver1;
- bp->bio_driver1 = NULL;
+ bp->bio_data = bp->bio_caller1;
+ bp->bio_caller1 = NULL;
}
g_destroy_bio(bp);
pbp->bio_inbed++;
if (pbp->bio_children == pbp->bio_inbed) {
- if (pbp->bio_caller1 != NULL)
- uma_zfree(g_stripe_zone, pbp->bio_caller1);
+ if (pbp->bio_driver1 != NULL)
+ uma_zfree(g_stripe_zone, pbp->bio_driver1);
g_io_deliver(pbp, pbp->bio_error);
}
}
@@ -330,9 +333,9 @@
cbp->bio_done = g_stripe_done;
cbp->bio_offset = offset;
cbp->bio_data = addr;
- cbp->bio_driver1 = NULL;
+ cbp->bio_caller1 = NULL;
cbp->bio_length = length;
- cbp->bio_driver2 = sc->sc_disks[no];
+ cbp->bio_caller2 = sc->sc_disks[no];
/* offset -= offset % stripesize; */
offset -= offset & (stripesize - 1);
@@ -356,8 +359,8 @@
* (bp->bio_length % sc->sc_stripesize) != 0.
*/
cbp->bio_length += MIN(stripesize, length);
- if (cbp->bio_driver1 == NULL) {
- cbp->bio_driver1 = cbp->bio_data;
+ if (cbp->bio_caller1 == NULL) {
+ cbp->bio_caller1 = cbp->bio_data;
cbp->bio_data = NULL;
if (data == NULL) {
data = uma_zalloc(g_stripe_zone,
@@ -382,13 +385,13 @@
cbp->bio_done = g_stripe_done;
cbp->bio_offset = offset;
cbp->bio_data = addr;
- cbp->bio_driver1 = NULL;
+ cbp->bio_caller1 = NULL;
/*
* MIN() is in case when
* (bp->bio_length % sc->sc_stripesize) != 0.
*/
cbp->bio_length = MIN(stripesize, length);
- cbp->bio_driver2 = sc->sc_disks[no];
+ cbp->bio_caller2 = sc->sc_disks[no];
}
}
if (data != NULL)
@@ -400,13 +403,13 @@
struct g_consumer *cp;
TAILQ_REMOVE(&queue, cbp, bio_queue);
- cp = cbp->bio_driver2;
- cbp->bio_driver2 = NULL;
+ cp = cbp->bio_caller2;
+ cbp->bio_caller2 = NULL;
cbp->bio_to = cp->provider;
- if (cbp->bio_driver1 != NULL) {
+ if (cbp->bio_caller1 != NULL) {
cbp->bio_data = data;
if (bp->bio_cmd == BIO_WRITE) {
- g_stripe_copy(sc, cbp->bio_driver1, data,
+ g_stripe_copy(sc, cbp->bio_caller1, data,
cbp->bio_offset, cbp->bio_length, 0);
}
data += cbp->bio_length;
@@ -420,10 +423,11 @@
uma_zfree(g_stripe_zone, data);
while ((cbp = TAILQ_FIRST(&queue)) != NULL) {
TAILQ_REMOVE(&queue, cbp, bio_queue);
- if (cbp->bio_driver1 != NULL) {
- cbp->bio_data = cbp->bio_driver1;
- cbp->bio_driver1 = NULL;
+ if (cbp->bio_caller1 != NULL) {
+ cbp->bio_data = cbp->bio_caller1;
+ cbp->bio_caller1 = NULL;
}
+ bp->bio_children--;
g_destroy_bio(cbp);
}
return (error);
@@ -457,7 +461,7 @@
cbp->bio_offset = offset;
cbp->bio_data = addr;
cbp->bio_length = length;
- cbp->bio_driver2 = sc->sc_disks[no];
+ cbp->bio_caller2 = sc->sc_disks[no];
/* offset -= offset % stripesize; */
offset -= offset & (stripesize - 1);
@@ -487,7 +491,7 @@
*/
cbp->bio_length = MIN(stripesize, length);
- cbp->bio_driver2 = sc->sc_disks[no];
+ cbp->bio_caller2 = sc->sc_disks[no];
}
/*
* Fire off all allocated requests!
@@ -496,8 +500,8 @@
struct g_consumer *cp;
TAILQ_REMOVE(&queue, cbp, bio_queue);
- cp = cbp->bio_driver2;
- cbp->bio_driver2 = NULL;
+ cp = cbp->bio_caller2;
+ cbp->bio_caller2 = NULL;
cbp->bio_to = cp->provider;
G_STRIPE_LOGREQ(cbp, "Sending request.");
g_io_request(cbp, cp);
@@ -506,6 +510,7 @@
failure:
while ((cbp = TAILQ_FIRST(&queue)) != NULL) {
TAILQ_REMOVE(&queue, cbp, bio_queue);
+ bp->bio_children--;
g_destroy_bio(cbp);
}
return (error);
@@ -581,8 +586,11 @@
fast = 1;
}
error = 0;
- if (fast)
+ if (fast) {
error = g_stripe_start_fast(bp, no, offset, length);
+ if (error != 0)
+ g_stripe_fast_failed++;
+ }
/*
* Do use "economic" when:
* 1. "Economic" mode is ON.
==== //depot/projects/netperf_socket/sys/kern/kern_intr.c#8 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_intr.c,v 1.111 2004/07/02 20:21:43 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_intr.c,v 1.112 2004/08/06 03:39:28 rwatson Exp $");
#include "opt_ddb.h"
@@ -379,19 +379,21 @@
return (EINVAL);
ctd = curthread;
+ td = ithread->it_td;
+ p = td->td_proc;
/*
* If any of the handlers for this ithread claim to be good
* sources of entropy, then gather some.
*/
if (harvest.interrupt && ithread->it_flags & IT_ENTROPY) {
+ CTR3(KTR_INTR, "%s: pid %d (%s) gathering entropy", __func__,
+ p->p_pid, p->p_comm);
entropy.vector = ithread->it_vector;
entropy.proc = ctd->td_proc;
random_harvest(&entropy, sizeof(entropy), 2, 0,
RANDOM_INTERRUPT);
}
- td = ithread->it_td;
- p = td->td_proc;
KASSERT(p != NULL, ("ithread %s has no process", ithread->it_name));
CTR4(KTR_INTR, "%s: pid %d: (%s) need = %d",
__func__, p->p_pid, p->p_comm, ithread->it_need);
==== //depot/projects/netperf_socket/sys/kern/kern_switch.c#8 (text+ko) ====
@@ -86,7 +86,7 @@
***/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_switch.c,v 1.74 2004/07/27 16:41:01 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_switch.c,v 1.75 2004/08/06 15:49:44 jhb Exp $");
#include "opt_full_preemption.h"
@@ -537,6 +537,7 @@
#endif
}
+#if 0
#ifndef PREEMPTION
/* XXX: There should be a non-static version of this. */
static void
@@ -549,6 +550,7 @@
SYSINIT(preempt_warning, SI_SUB_COPYRIGHT, SI_ORDER_ANY, printf_caddr_t,
preempt_warning)
#endif
+#endif
/************************************************************************
* SYSTEM RUN QUEUE manipulations and tests *
==== //depot/projects/netperf_socket/sys/kern/kern_timeout.c#6 (text+ko) ====
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_timeout.c,v 1.89 2004/04/25 04:10:17 hmp Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_timeout.c,v 1.90 2004/08/06 02:44:58 cperciva Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -401,8 +401,22 @@
mtx_unlock_spin(&callout_lock);
return;
}
- if (c->c_flags & CALLOUT_PENDING)
- callout_stop(c);
+ if (c->c_flags & CALLOUT_PENDING) {
+ if (nextsoftcheck == c) {
+ nextsoftcheck = TAILQ_NEXT(c, c_links.tqe);
+ }
+ TAILQ_REMOVE(&callwheel[c->c_time & callwheelmask], c,
+ c_links.tqe);
+
+ /*
+ * Part of the normal "stop a pending callout" process
+ * is to clear the CALLOUT_ACTIVE and CALLOUT_PENDING
+ * flags. We're not going to bother doing that here,
+ * because we're going to be setting those flags ten lines
+ * after this point, and we're holding callout_lock
+ * between now and then.
+ */
+ }
/*
* We could unlock callout_lock here and lock it again before the
==== //depot/projects/netperf_socket/sys/net/if.c#15 (text+ko) ====
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*
* @(#)if.c 8.5 (Berkeley) 1/9/95
- * $FreeBSD: src/sys/net/if.c,v 1.197 2004/07/27 23:20:44 rwatson Exp $
+ * $FreeBSD: src/sys/net/if.c,v 1.198 2004/08/06 09:08:33 roam Exp $
*/
#include "opt_compat.h"
@@ -518,6 +518,8 @@
int s;
int i;
struct domain *dp;
+ struct ifnet *iter;
+ int found;
EVENTHANDLER_INVOKE(ifnet_departure_event, ifp);
/*
@@ -584,9 +586,11 @@
/* We can now free link ifaddr. */
- ifa = TAILQ_FIRST(&ifp->if_addrhead);
- TAILQ_REMOVE(&ifp->if_addrhead, ifa, ifa_link);
- IFAFREE(ifa);
+ if (!TAILQ_EMPTY(&ifp->if_addrhead)) {
+ ifa = TAILQ_FIRST(&ifp->if_addrhead);
+ TAILQ_REMOVE(&ifp->if_addrhead, ifa, ifa_link);
+ IFAFREE(ifa);
+ }
/*
* Delete all remaining routes using this interface
@@ -618,7 +622,14 @@
#endif /* MAC */
KNOTE(&ifp->if_klist, NOTE_EXIT);
IFNET_WLOCK();
- TAILQ_REMOVE(&ifnet, ifp, if_link);
+ found = 0;
+ TAILQ_FOREACH(iter, &ifnet, if_link)
+ if (iter == ifp) {
+ found = 1;
+ break;
+ }
+ if (found)
+ TAILQ_REMOVE(&ifnet, ifp, if_link);
IFNET_WUNLOCK();
mtx_destroy(&ifp->if_snd.ifq_mtx);
IF_AFDATA_DESTROY(ifp);
==== //depot/projects/netperf_socket/sys/netinet/tcp_subr.c#15 (text+ko) ====
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*
* @(#)tcp_subr.c 8.2 (Berkeley) 5/24/95
- * $FreeBSD: src/sys/netinet/tcp_subr.c,v 1.196 2004/08/03 13:54:11 andre Exp $
+ * $FreeBSD: src/sys/netinet/tcp_subr.c,v 1.197 2004/08/06 03:45:45 rwatson Exp $
*/
#include "opt_compat.h"
@@ -1236,7 +1236,7 @@
bzero(&th, sizeof(th));
m_copydata(m, off, sizeof(*thp), (caddr_t)&th);
- in6_pcbnotify(&tcb, sa, th.th_dport,
+ in6_pcbnotify(&tcbinfo, sa, th.th_dport,
(struct sockaddr *)ip6cp->ip6c_src,
th.th_sport, cmd, NULL, notify);
@@ -1247,7 +1247,7 @@
inc.inc_isipv6 = 1;
syncache_unreach(&inc, &th);
} else
- in6_pcbnotify(&tcb, sa, 0, (const struct sockaddr *)sa6_src,
+ in6_pcbnotify(&tcbinfo, sa, 0, (const struct sockaddr *)sa6_src,
0, cmd, NULL, notify);
}
#endif /* INET6 */
==== //depot/projects/netperf_socket/sys/netinet/udp_usrreq.c#10 (text+ko) ====
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*
* @(#)udp_usrreq.c 8.6 (Berkeley) 5/23/95
- * $FreeBSD: src/sys/netinet/udp_usrreq.c,v 1.157 2004/07/26 07:24:03 cperciva Exp $
+ * $FreeBSD: src/sys/netinet/udp_usrreq.c,v 1.158 2004/08/06 02:08:31 rwatson Exp $
*/
#include "opt_ipsec.h"
@@ -287,26 +287,23 @@
*/
last = NULL;
LIST_FOREACH(inp, &udb, inp_list) {
- INP_LOCK(inp);
- if (inp->inp_lport != uh->uh_dport) {
- docontinue:
- INP_UNLOCK(inp);
+ if (inp->inp_lport != uh->uh_dport)
continue;
- }
#ifdef INET6
if ((inp->inp_vflag & INP_IPV4) == 0)
- goto docontinue;
+ continue;
#endif
if (inp->inp_laddr.s_addr != INADDR_ANY) {
if (inp->inp_laddr.s_addr != ip->ip_dst.s_addr)
- goto docontinue;
+ continue;
}
if (inp->inp_faddr.s_addr != INADDR_ANY) {
if (inp->inp_faddr.s_addr !=
ip->ip_src.s_addr ||
inp->inp_fport != uh->uh_sport)
- goto docontinue;
+ continue;
}
+ INP_LOCK(inp);
/*
* Check multicast packets to make sure they are only
@@ -327,8 +324,10 @@
break;
}
}
- if (foundmship == 0)
- goto docontinue;
+ if (foundmship == 0) {
+ INP_UNLOCK(inp);
+ continue;
+ }
}
#undef NMSHIPS
#undef MSHIP
==== //depot/projects/netperf_socket/sys/netinet6/in6_pcb.c#8 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/netinet6/in6_pcb.c,v 1.57 2004/07/28 13:03:07 yar Exp $ */
+/* $FreeBSD: src/sys/netinet6/in6_pcb.c,v 1.58 2004/08/06 03:45:45 rwatson Exp $ */
/* $KAME: in6_pcb.c,v 1.31 2001/05/21 05:45:10 jinmei Exp $ */
/*
@@ -610,8 +610,8 @@
* Must be called at splnet.
*/
void
-in6_pcbnotify(head, dst, fport_arg, src, lport_arg, cmd, cmdarg, notify)
- struct inpcbhead *head;
+in6_pcbnotify(pcbinfo, dst, fport_arg, src, lport_arg, cmd, cmdarg, notify)
+ struct inpcbinfo *pcbinfo;
struct sockaddr *dst;
const struct sockaddr *src;
u_int fport_arg, lport_arg;
@@ -619,6 +619,7 @@
void *cmdarg;
struct inpcb *(*notify) __P((struct inpcb *, int));
{
+ struct inpcbhead *head;
struct inpcb *inp, *ninp;
struct sockaddr_in6 sa6_src, *sa6_dst;
u_short fport = fport_arg, lport = lport_arg;
@@ -656,11 +657,16 @@
}
errno = inet6ctlerrmap[cmd];
s = splnet();
+ head = pcbinfo->listhead;
+ INP_INFO_WLOCK(pcbinfo);
for (inp = LIST_FIRST(head); inp != NULL; inp = ninp) {
+ INP_LOCK(inp);
ninp = LIST_NEXT(inp, inp_list);
- if ((inp->inp_vflag & INP_IPV6) == 0)
+ if ((inp->inp_vflag & INP_IPV6) == 0) {
+ INP_UNLOCK(inp);
continue;
+ }
/*
* If the error designates a new path MTU for a destination
@@ -698,13 +704,17 @@
(!IN6_IS_ADDR_UNSPECIFIED(&sa6_src.sin6_addr) &&
!IN6_ARE_ADDR_EQUAL(&inp->in6p_laddr,
&sa6_src.sin6_addr)) ||
- (fport && inp->inp_fport != fport))
+ (fport && inp->inp_fport != fport)) {
+ INP_UNLOCK(inp);
continue;
+ }
do_notify:
if (notify)
(*notify)(inp, errno);
+ INP_UNLOCK(inp);
}
+ INP_INFO_WUNLOCK(pcbinfo);
splx(s);
}
==== //depot/projects/netperf_socket/sys/netinet6/in6_pcb.h#5 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/netinet6/in6_pcb.h,v 1.14 2004/04/07 20:46:15 imp Exp $ */
+/* $FreeBSD: src/sys/netinet6/in6_pcb.h,v 1.15 2004/08/06 03:45:45 rwatson Exp $ */
/* $KAME: in6_pcb.h,v 1.13 2001/02/06 09:16:53 itojun Exp $ */
/*
@@ -85,7 +85,7 @@
in6_pcblookup_hash __P((struct inpcbinfo *,
struct in6_addr *, u_int, struct in6_addr *,
u_int, int, struct ifnet *));
-void in6_pcbnotify __P((struct inpcbhead *, struct sockaddr *,
+void in6_pcbnotify __P((struct inpcbinfo *, struct sockaddr *,
u_int, const struct sockaddr *, u_int, int, void *,
struct inpcb *(*)(struct inpcb *, int)));
struct inpcb *
==== //depot/projects/netperf_socket/sys/netinet6/raw_ip6.c#6 (text+ko) ====
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/netinet6/raw_ip6.c,v 1.43 2004/07/27 23:45:19 rwatson Exp $
+ * $FreeBSD: src/sys/netinet6/raw_ip6.c,v 1.44 2004/08/06 03:45:45 rwatson Exp $
*/
/*
@@ -298,7 +298,8 @@
sa6_src = &sa6_any;
}
- (void) in6_pcbnotify(&ripcb, sa, 0, (const struct sockaddr *)sa6_src,
+ (void) in6_pcbnotify(&ripcbinfo, sa, 0,
+ (const struct sockaddr *)sa6_src,
0, cmd, cmdarg, notify);
}
==== //depot/projects/netperf_socket/sys/netinet6/udp6_usrreq.c#7 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/netinet6/udp6_usrreq.c,v 1.50 2004/07/27 23:45:19 rwatson Exp $ */
+/* $FreeBSD: src/sys/netinet6/udp6_usrreq.c,v 1.51 2004/08/06 03:45:45 rwatson Exp $ */
/* $KAME: udp6_usrreq.c,v 1.27 2001/05/21 05:45:10 jinmei Exp $ */
/*
@@ -444,11 +444,11 @@
bzero(&uh, sizeof(uh));
m_copydata(m, off, sizeof(*uhp), (caddr_t)&uh);
- (void) in6_pcbnotify(&udb, sa, uh.uh_dport,
+ (void) in6_pcbnotify(&udbinfo, sa, uh.uh_dport,
(struct sockaddr *)ip6cp->ip6c_src,
uh.uh_sport, cmd, cmdarg, notify);
} else
- (void) in6_pcbnotify(&udb, sa, 0,
+ (void) in6_pcbnotify(&udbinfo, sa, 0,
(const struct sockaddr *)sa6_src,
0, cmd, cmdarg, notify);
}
==== //depot/projects/netperf_socket/sys/pci/if_xl.c#11 (text+ko) ====
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/pci/if_xl.c,v 1.178 2004/07/09 02:28:23 bms Exp $");
+__FBSDID("$FreeBSD: src/sys/pci/if_xl.c,v 1.179 2004/08/06 09:08:33 roam Exp $");
/*
* 3Com 3c90x Etherlink XL PCI NIC driver
@@ -3169,7 +3169,8 @@
sc->xl_cdata.xl_rx_chain[i].xl_mbuf = NULL;
}
}
- bzero(sc->xl_ldata.xl_rx_list, XL_RX_LIST_SZ);
+ if (sc->xl_ldata.xl_rx_list != NULL)
+ bzero(sc->xl_ldata.xl_rx_list, XL_RX_LIST_SZ);
/*
* Free the TX list buffers.
*/
@@ -3183,7 +3184,8 @@
sc->xl_cdata.xl_tx_chain[i].xl_mbuf = NULL;
}
}
- bzero(sc->xl_ldata.xl_tx_list, XL_TX_LIST_SZ);
+ if (sc->xl_ldata.xl_tx_list != NULL)
+ bzero(sc->xl_ldata.xl_tx_list, XL_TX_LIST_SZ);
ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
}
More information about the p4-projects
mailing list