Date: Tue, 1 Aug 2006 17:32:13 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 102956 for review Message-ID: <200608011732.k71HWDTr019786@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=102956 Change 102956 by jhb@jhb_mutex on 2006/08/01 17:31:29 IFC @102951. Affected files ... .. //depot/projects/smpng/sys/amd64/amd64/identcpu.c#20 integrate .. //depot/projects/smpng/sys/ddb/db_ps.c#35 integrate .. //depot/projects/smpng/sys/dev/mxge/if_mxge.c#4 integrate .. //depot/projects/smpng/sys/i386/i386/identcpu.c#47 integrate .. //depot/projects/smpng/sys/kern/kern_fork.c#100 integrate .. //depot/projects/smpng/sys/kern/kern_syscalls.c#6 integrate .. //depot/projects/smpng/sys/kern/uipc_sockbuf.c#2 integrate .. //depot/projects/smpng/sys/kern/uipc_socket.c#89 integrate .. //depot/projects/smpng/sys/kern/uipc_usrreq.c#64 integrate .. //depot/projects/smpng/sys/net/bridgestp.c#9 integrate .. //depot/projects/smpng/sys/net/bridgestp.h#2 integrate .. //depot/projects/smpng/sys/net/if_bridge.c#35 integrate .. //depot/projects/smpng/sys/net/if_bridgevar.h#12 integrate .. //depot/projects/smpng/sys/nfsserver/nfs.h#18 integrate .. //depot/projects/smpng/sys/nfsserver/nfs_srvcache.c#13 integrate .. //depot/projects/smpng/sys/nfsserver/nfs_srvsubs.c#34 integrate .. //depot/projects/smpng/sys/nfsserver/nfs_syscalls.c#28 integrate .. //depot/projects/smpng/sys/sys/kernel.h#34 integrate .. //depot/projects/smpng/sys/sys/socketvar.h#54 integrate .. //depot/projects/smpng/sys/sys/sysent.h#20 integrate Differences ... ==== //depot/projects/smpng/sys/amd64/amd64/identcpu.c#20 (text+ko) ==== @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/amd64/identcpu.c,v 1.147 2006/07/12 06:04:11 jkim Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/identcpu.c,v 1.148 2006/08/01 01:23:39 obrien Exp $"); #include "opt_cpu.h" @@ -296,8 +296,8 @@ "\034RDTSCP" /* RDTSCP */ "\035<b28>" /* Undefined */ "\036LM" /* 64 bit long mode */ - "\0373DNow+" /* AMD 3DNow! Extensions */ - "\0403DNow" /* AMD 3DNow! */ + "\0373DNow!+" /* AMD 3DNow! Extensions */ + "\0403DNow!" /* AMD 3DNow! */ ); } ==== //depot/projects/smpng/sys/ddb/db_ps.c#35 (text+ko) ==== @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/ddb/db_ps.c,v 1.61 2006/07/12 21:22:43 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/ddb/db_ps.c,v 1.62 2006/08/01 15:29:46 jhb Exp $"); #include <sys/param.h> #include <sys/cons.h> @@ -57,10 +57,10 @@ * * 1 2 3 4 5 6 7 * 1234567890123456789012345678901234567890123456789012345678901234567890 - * pid uid ppid pgrp state wmesg wchan cmd - * <pid> <ui> <ppi> <pgi> <stat> < wmesg > < wchan > <name> - * <pid> <ui> <ppi> <pgi> <stat> (threaded) <command> - * <tid > <stat> < wmesg > < wchan > <name> + * pid ppid pgrp uid state wmesg wchan cmd + * <pid> <ppi> <pgi> <uid> <stat> < wmesg > < wchan > <name> + * <pid> <ppi> <pgi> <uid> <stat> (threaded) <command> + * <tid > <stat> < wmesg > < wchan > <name> * * For machines with 64-bit pointers, we expand the wchan field 8 more * characters. @@ -83,9 +83,9 @@ p = &proc0; #ifdef __LP64__ - db_printf(" pid uid ppid pgrp state wmesg wchan cmd\n"); + db_printf(" pid ppid pgrp uid state wmesg wchan cmd\n"); #else - db_printf(" pid uid ppid pgrp state wmesg wchan cmd\n"); + db_printf(" pid ppid pgrp uid state wmesg wchan cmd\n"); #endif while (--np >= 0 && !db_pager_quit) { if (p == NULL) { @@ -98,9 +98,9 @@ cred = p->p_ucred; pgrp = p->p_pgrp; - db_printf("%5d %4d %5d %5d ", p->p_pid, - cred != NULL ? cred->cr_ruid : 0, pp->p_pid, - pgrp != NULL ? pgrp->pg_id : 0); + db_printf("%5d %5d %5d %5d ", p->p_pid, pp->p_pid, + pgrp != NULL ? pgrp->pg_id : 0, + cred != NULL ? cred->cr_ruid : 0); /* Determine our primary process state. */ switch (p->p_state) { @@ -207,7 +207,7 @@ void *wchan; if (all) { - db_printf(" %9d ", td->td_tid); + db_printf("%6d ", td->td_tid); switch (td->td_state) { case TDS_RUNNING: snprintf(state, sizeof(state), "Run"); ==== //depot/projects/smpng/sys/dev/mxge/if_mxge.c#4 (text+ko) ==== @@ -32,7 +32,7 @@ ***************************************************************************/ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/mxge/if_mxge.c,v 1.7 2006/07/17 22:17:05 gallatin Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/mxge/if_mxge.c,v 1.8 2006/08/01 14:02:54 gallatin Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -765,7 +765,6 @@ return ENXIO; } - mxge_dummy_rdma(sc, 1); return 0; } @@ -843,6 +842,8 @@ return ENXIO; } + mxge_dummy_rdma(sc, 1); + /* Now exchange information about interrupts */ bytes = mxge_max_intr_slots * sizeof (*sc->rx_done.entry);\ memset(sc->rx_done.entry, 0, bytes); @@ -1025,6 +1026,10 @@ CTLFLAG_RD, &sc->tx.boundary, 0, "tx_boundary"); SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "write_combine", + CTLFLAG_RD, &sc->wc, + 0, "write combining PIO?"); + SYSCTL_ADD_INT(ctx, children, OID_AUTO, "read_dma_MBs", CTLFLAG_RD, &sc->read_dma, 0, "DMA Read speed in MB/s"); @@ -2544,6 +2549,7 @@ mxge_close(sc); sx_xunlock(&sc->driver_lock); ether_ifdetach(sc->ifp); + mxge_dummy_rdma(sc, 0); bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq_res); sc->rx_done.entry = NULL; mxge_dma_free(&sc->rx_done.dma); ==== //depot/projects/smpng/sys/i386/i386/identcpu.c#47 (text+ko) ==== @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/i386/i386/identcpu.c,v 1.167 2006/07/12 16:52:55 mr Exp $"); +__FBSDID("$FreeBSD: src/sys/i386/i386/identcpu.c,v 1.168 2006/08/01 01:23:39 obrien Exp $"); #include "opt_cpu.h" @@ -815,8 +815,8 @@ "\034RDTSCP" /* RDTSCP */ "\035<b28>" /* Undefined */ "\036LM" /* 64 bit long mode */ - "\0373DNow+" /* AMD 3DNow! Extensions */ - "\0403DNow" /* AMD 3DNow! */ + "\0373DNow!+" /* AMD 3DNow! Extensions */ + "\0403DNow!" /* AMD 3DNow! */ ); } ==== //depot/projects/smpng/sys/kern/kern_fork.c#100 (text+ko) ==== @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_fork.c,v 1.259 2006/06/27 11:28:50 pjd Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_fork.c,v 1.260 2006/08/01 15:30:56 jhb Exp $"); #include "opt_ktrace.h" #include "opt_mac.h" @@ -377,17 +377,14 @@ p2 = LIST_FIRST(&allproc); again: for (; p2 != NULL; p2 = LIST_NEXT(p2, p_list)) { - PROC_LOCK(p2); while (p2->p_pid == trypid || (p2->p_pgrp != NULL && (p2->p_pgrp->pg_id == trypid || (p2->p_session != NULL && p2->p_session->s_sid == trypid)))) { trypid++; - if (trypid >= pidchecked) { - PROC_UNLOCK(p2); + if (trypid >= pidchecked) goto retry; - } } if (p2->p_pid > trypid && pidchecked > p2->p_pid) pidchecked = p2->p_pid; @@ -400,7 +397,6 @@ pidchecked > p2->p_session->s_sid) pidchecked = p2->p_session->s_sid; } - PROC_UNLOCK(p2); } if (!doingzomb) { doingzomb = 1; ==== //depot/projects/smpng/sys/kern/kern_syscalls.c#6 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_syscalls.c,v 1.11 2004/07/15 08:26:05 phk Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_syscalls.c,v 1.12 2006/08/01 16:32:20 jhb Exp $"); #include <sys/param.h> #include <sys/sysproto.h> @@ -97,8 +97,11 @@ case MOD_LOAD : error = syscall_register(data->offset, data->new_sysent, &data->old_sysent); - if (error) + if (error) { + /* Leave a mark so we know to safely unload below. */ + data->offset = NULL; return error; + } ms.intval = *data->offset; MOD_XLOCK; module_setspecific(mod, &ms); @@ -108,6 +111,13 @@ return error; case MOD_UNLOAD : + /* + * MOD_LOAD failed, so just return without calling the + * chained handler since we didn't pass along the MOD_LOAD + * event. + */ + if (data->offset == NULL) + return (0); if (data->chainevh) { error = data->chainevh(mod, what, data->chainarg); if (error) ==== //depot/projects/smpng/sys/kern/uipc_sockbuf.c#2 (text+ko) ==== @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/uipc_sockbuf.c,v 1.162 2006/07/24 16:21:31 rwatson Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/uipc_sockbuf.c,v 1.163 2006/08/01 10:30:26 rwatson Exp $"); #include "opt_param.h" @@ -64,6 +64,10 @@ static u_long sb_efficiency = 8; /* parameter for sbreserve() */ +static void sbdrop_internal(register struct sockbuf *sb, register int len); +static void sbflush_internal(register struct sockbuf *sb); +static void sbrelease_internal(struct sockbuf *sb, struct socket *so); + /* * Socantsendmore indicates that no more data will be sent on the * socket; it would normally be applied to a socket when the user @@ -331,6 +335,18 @@ /* * Free mbufs held by a socket, and reserved mbuf space. */ +static void +sbrelease_internal(sb, so) + struct sockbuf *sb; + struct socket *so; +{ + + sbflush_internal(sb); + (void)chgsbsize(so->so_cred->cr_uidinfo, &sb->sb_hiwat, 0, + RLIM_INFINITY); + sb->sb_mbmax = 0; +} + void sbrelease_locked(sb, so) struct sockbuf *sb; @@ -339,10 +355,7 @@ SOCKBUF_LOCK_ASSERT(sb); - sbflush_locked(sb); - (void)chgsbsize(so->so_cred->cr_uidinfo, &sb->sb_hiwat, 0, - RLIM_INFINITY); - sb->sb_mbmax = 0; + sbrelease_internal(sb, so); } void @@ -355,6 +368,17 @@ sbrelease_locked(sb, so); SOCKBUF_UNLOCK(sb); } + +void +sbdestroy(sb, so) + struct sockbuf *sb; + struct socket *so; +{ + + sbrelease_internal(sb, so); +} + + /* * Routines to add and remove * data from an mbuf queue. @@ -823,13 +847,11 @@ * Free all mbufs in a sockbuf. * Check that all resources are reclaimed. */ -void -sbflush_locked(sb) +static void +sbflush_internal(sb) register struct sockbuf *sb; { - SOCKBUF_LOCK_ASSERT(sb); - if (sb->sb_flags & SB_LOCK) panic("sbflush_locked: locked"); while (sb->sb_mbcnt) { @@ -839,13 +861,22 @@ */ if (!sb->sb_cc && (sb->sb_mb == NULL || sb->sb_mb->m_len)) break; - sbdrop_locked(sb, (int)sb->sb_cc); + sbdrop_internal(sb, (int)sb->sb_cc); } if (sb->sb_cc || sb->sb_mb || sb->sb_mbcnt) panic("sbflush_locked: cc %u || mb %p || mbcnt %u", sb->sb_cc, (void *)sb->sb_mb, sb->sb_mbcnt); } void +sbflush_locked(sb) + register struct sockbuf *sb; +{ + + SOCKBUF_LOCK_ASSERT(sb); + sbflush_internal(sb); +} + +void sbflush(sb) register struct sockbuf *sb; { @@ -858,16 +889,14 @@ /* * Drop data from (the front of) a sockbuf. */ -void -sbdrop_locked(sb, len) +static void +sbdrop_internal(sb, len) register struct sockbuf *sb; register int len; { register struct mbuf *m; struct mbuf *next; - SOCKBUF_LOCK_ASSERT(sb); - next = (m = sb->sb_mb) ? m->m_nextpkt : 0; while (len > 0) { if (m == 0) { @@ -916,6 +945,17 @@ * Drop data from (the front of) a sockbuf. */ void +sbdrop_locked(sb, len) + register struct sockbuf *sb; + register int len; +{ + + SOCKBUF_LOCK_ASSERT(sb); + + sbdrop_internal(sb, len); +} + +void sbdrop(sb, len) register struct sockbuf *sb; register int len; ==== //depot/projects/smpng/sys/kern/uipc_socket.c#89 (text+ko) ==== @@ -94,7 +94,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/uipc_socket.c,v 1.275 2006/07/24 15:20:07 rwatson Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/uipc_socket.c,v 1.276 2006/08/01 10:30:26 rwatson Exp $"); #include "opt_inet.h" #include "opt_mac.h" @@ -555,6 +555,7 @@ sofree(so) struct socket *so; { + struct protosw *pr = so->so_proto; struct socket *head; ACCEPT_LOCK_ASSERT(); @@ -588,24 +589,31 @@ SOCK_UNLOCK(so); ACCEPT_UNLOCK(); - SOCKBUF_LOCK(&so->so_snd); - so->so_snd.sb_flags |= SB_NOINTR; - (void)sblock(&so->so_snd, M_WAITOK); /* - * socantsendmore_locked() drops the socket buffer mutex so that it - * can safely perform wakeups. Re-acquire the mutex before - * continuing. + * From this point on, we assume that no other references to this + * socket exist anywhere else in the stack. Therefore, no locks need + * to be acquired or held. + * + * We used to do a lot of socket buffer and socket locking here, as + * well as invoke sorflush() and perform wakeups. The direct call to + * dom_dispose() and sbrelease_internal() are an inlining of what was + * necessary from sorflush(). + * + * Notice that the socket buffer and kqueue state are torn down + * before calling pru_detach. This means that protocols shold not + * assume they can perform socket wakeups, etc, in their detach + * code. */ - socantsendmore_locked(so); - SOCKBUF_LOCK(&so->so_snd); - sbunlock(&so->so_snd); - sbrelease_locked(&so->so_snd, so); - SOCKBUF_UNLOCK(&so->so_snd); - sorflush(so); + KASSERT((so->so_snd.sb_flags & SB_LOCK) == 0, ("sofree: snd sblock")); + KASSERT((so->so_rcv.sb_flags & SB_LOCK) == 0, ("sofree: rcv sblock")); + sbdestroy(&so->so_snd, so); + if (pr->pr_flags & PR_RIGHTS && pr->pr_domain->dom_dispose != NULL) + (*pr->pr_domain->dom_dispose)(so->so_rcv.sb_mb); + sbdestroy(&so->so_rcv, so); knlist_destroy(&so->so_rcv.sb_sel.si_note); knlist_destroy(&so->so_snd.sb_sel.si_note); - if (so->so_proto->pr_usrreqs->pru_detach != NULL) - (*so->so_proto->pr_usrreqs->pru_detach)(so); + if (pr->pr_usrreqs->pru_detach != NULL) + (*pr->pr_usrreqs->pru_detach)(so); sodealloc(so); } ==== //depot/projects/smpng/sys/kern/uipc_usrreq.c#64 (text+ko) ==== @@ -50,7 +50,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/uipc_usrreq.c,v 1.182 2006/07/26 19:16:34 rwatson Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/uipc_usrreq.c,v 1.183 2006/07/31 23:00:05 rwatson Exp $"); #include "opt_mac.h" @@ -605,7 +605,18 @@ break; } } + /* + * Because connect() and send() are non-atomic in a sendto() + * with a target address, it's possible that the socket will + * have disconnected before the send() can run. In that case + * return the slightly counter-intuitive but otherwise + * correct error that the socket is not connected. + */ unp2 = unp->unp_conn; + if (unp2 == NULL) { + error = ENOTCONN; + break; + } so2 = unp2->unp_socket; if (unp->unp_addr != NULL) from = (struct sockaddr *)unp->unp_addr; @@ -650,9 +661,18 @@ error = EPIPE; break; } + /* + * Because connect() and send() are non-atomic in a sendto() + * with a target address, it's possible that the socket will + * have disconnected before the send() can run. In that case + * return the slightly counter-intuitive but otherwise + * correct error that the socket is not connected. + */ unp2 = unp->unp_conn; - if (unp2 == NULL) - panic("uipc_send connected but no connection?"); + if (unp2 == NULL) { + error = ENOTCONN; + break; + } so2 = unp2->unp_socket; SOCKBUF_LOCK(&so2->so_rcv); if (unp2->unp_flags & UNP_WANTCRED) { ==== //depot/projects/smpng/sys/net/bridgestp.c#9 (text+ko) ==== @@ -40,7 +40,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/net/bridgestp.c,v 1.14 2006/07/26 10:45:38 thompsa Exp $"); +__FBSDID("$FreeBSD: src/sys/net/bridgestp.c,v 1.15 2006/07/31 20:24:46 thompsa Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -112,6 +112,7 @@ static void bstp_make_blocking(struct bstp_state *, struct bstp_port *); static void bstp_set_port_state(struct bstp_port *, uint8_t); +static void bstp_update_forward_transitions(struct bstp_port *); #ifdef notused static void bstp_set_bridge_priority(struct bstp_state *, uint64_t); static void bstp_set_port_priority(struct bstp_state *, @@ -531,6 +532,12 @@ } static void +bstp_update_forward_transitions(struct bstp_port *bp) +{ + bp->bp_forward_transitions++; +} + +static void bstp_topology_change_detection(struct bstp_state *bs) { BSTP_LOCK_ASSERT(bs); @@ -543,6 +550,7 @@ bstp_timer_start(&bs->bs_tcn_timer, 0); } bs->bs_topology_change_detected = 1; + getmicrotime(&bs->bs_last_tc_time); } static void @@ -749,6 +757,7 @@ bstp_timer_start(&bp->bp_forward_delay_timer, 0); } else if (bp->bp_state == BSTP_IFSTATE_LEARNING) { bstp_set_port_state(bp, BSTP_IFSTATE_FORWARDING); + bstp_update_forward_transitions(bp); if (bstp_designated_for_some_port(bs) && bp->bp_change_detection_enabled) bstp_topology_change_detection(bs); @@ -865,6 +874,7 @@ LIST_FOREACH(bp, &bs->bs_bplist, bp_next) bstp_ifupdstatus(bs, bp); + getmicrotime(&bs->bs_last_tc_time); bstp_port_state_selection(bs); bstp_config_bpdu_generation(bs); bstp_timer_start(&bs->bs_hello_timer, 0); ==== //depot/projects/smpng/sys/net/bridgestp.h#2 (text+ko) ==== @@ -67,7 +67,7 @@ * * OpenBSD: if_bridge.h,v 1.14 2001/03/22 03:48:29 jason Exp * - * $FreeBSD: src/sys/net/bridgestp.h,v 1.2 2006/07/26 10:45:38 thompsa Exp $ + * $FreeBSD: src/sys/net/bridgestp.h,v 1.3 2006/07/31 20:24:46 thompsa Exp $ */ /* @@ -201,6 +201,7 @@ uint8_t bp_config_pending; uint8_t bp_change_detection_enabled; uint8_t bp_priority; + uint32_t bp_forward_transitions; }; /* @@ -229,6 +230,7 @@ struct bstp_timer bs_tcn_timer; struct callout bs_bstpcallout; /* STP callout */ struct bstp_timer bs_link_timer; + struct timeval bs_last_tc_time; LIST_HEAD(, bstp_port) bs_bplist; }; ==== //depot/projects/smpng/sys/net/if_bridge.c#35 (text+ko) ==== @@ -80,7 +80,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/net/if_bridge.c,v 1.72 2006/07/27 21:01:47 thompsa Exp $"); +__FBSDID("$FreeBSD: src/sys/net/if_bridge.c,v 1.73 2006/07/31 20:24:46 thompsa Exp $"); #include "opt_inet.h" #include "opt_inet6.h" @@ -212,6 +212,7 @@ uint32_t sc_rthash_key; /* key for hash */ LIST_HEAD(, bridge_iflist) sc_spanlist; /* span ports list */ struct bstp_state sc_stp; /* STP state */ + uint32_t sc_brtexceeded; /* # of cache drops */ }; static struct mtx bridge_list_mtx; @@ -299,6 +300,9 @@ static int bridge_ioctl_sifcost(struct bridge_softc *, void *); static int bridge_ioctl_addspan(struct bridge_softc *, void *); static int bridge_ioctl_delspan(struct bridge_softc *, void *); +static int bridge_ioctl_gbparam(struct bridge_softc *, void *); +static int bridge_ioctl_grte(struct bridge_softc *, void *); +static int bridge_ioctl_gifsstp(struct bridge_softc *, void *); static int bridge_pfil(struct mbuf **, struct ifnet *, struct ifnet *, int); static int bridge_ip_checkbasic(struct mbuf **mp); @@ -397,6 +401,15 @@ BC_F_COPYIN|BC_F_SUSER }, { bridge_ioctl_delspan, sizeof(struct ifbreq), BC_F_COPYIN|BC_F_SUSER }, + + { bridge_ioctl_gbparam, sizeof(struct ifbropreq), + BC_F_COPYOUT }, + + { bridge_ioctl_grte, sizeof(struct ifbrparam), + BC_F_COPYOUT }, + + { bridge_ioctl_gifsstp, sizeof(struct ifbpstpconf), + BC_F_COPYOUT }, }; const int bridge_control_table_size = sizeof(bridge_control_table) / sizeof(bridge_control_table[0]); @@ -510,6 +523,7 @@ sc->sc_brtmax = BRIDGE_RTABLE_MAX; sc->sc_brttimeout = BRIDGE_RTABLE_TIMEOUT; + getmicrotime(&(sc->sc_stp.bs_last_tc_time)); /* Initialize our routing table. */ bridge_rtable_init(sc); @@ -1425,6 +1439,95 @@ return (0); } +static int +bridge_ioctl_gbparam(struct bridge_softc *sc, void *arg) +{ + struct ifbropreq *req = arg; + struct bstp_port *root_port; + + BRIDGE_LOCK_ASSERT(sc); + + req->ifbop_maxage = sc->sc_stp.bs_max_age; + req->ifbop_hellotime = sc->sc_stp.bs_hello_time; + req->ifbop_fwddelay = sc->sc_stp.bs_forward_delay; + + root_port = sc->sc_stp.bs_root_port; + if (root_port == NULL) + req->ifbop_root_port = 0; + else + req->ifbop_root_port = root_port->bp_ifp->if_index; + + req->ifbop_root_path_cost = sc->sc_stp.bs_root_path_cost; + req->ifbop_designated_root = sc->sc_stp.bs_designated_root; + req->ifbop_last_tc_time.tv_sec = sc->sc_stp.bs_last_tc_time.tv_sec; + req->ifbop_last_tc_time.tv_usec = sc->sc_stp.bs_last_tc_time.tv_usec; + + return (0); +} + +static int +bridge_ioctl_grte(struct bridge_softc *sc, void *arg) +{ + struct ifbrparam *param = arg; + + BRIDGE_LOCK_ASSERT(sc); + + param->ifbrp_cexceeded = sc->sc_brtexceeded; + + return (0); +} + +static int +bridge_ioctl_gifsstp(struct bridge_softc *sc, void *arg) +{ + struct ifbpstpconf *bifstp = arg; + struct bridge_iflist *bif; + struct ifbpstpreq bpreq; + int count, len, error = 0; + + BRIDGE_LOCK_ASSERT(sc); + + count = 0; + LIST_FOREACH(bif, &sc->sc_iflist, bif_next) { + if ((bif->bif_flags & IFBIF_STP) != 0) + count++; + } + + if (bifstp->ifbpstp_len == 0) { + bifstp->ifbpstp_len = sizeof(bpreq) * count; + return (0); + } + + count = 0; + len = bifstp->ifbpstp_len; + bzero(&bpreq, sizeof(bpreq)); + LIST_FOREACH(bif, &sc->sc_iflist, bif_next) { + if (len < sizeof(bpreq)) + break; + + if ((bif->bif_flags & IFBIF_STP) == 0) + continue; + + bpreq.ifbp_portno = bif->bif_ifp->if_index & 0xff; + bpreq.ifbp_fwd_trans = bif->bif_stp.bp_forward_transitions; + bpreq.ifbp_design_cost = bif->bif_stp.bp_designated_cost; + bpreq.ifbp_design_port = bif->bif_stp.bp_designated_port; + bpreq.ifbp_design_bridge = bif->bif_stp.bp_designated_bridge; + bpreq.ifbp_design_root = bif->bif_stp.bp_designated_root; + + error = copyout(&bpreq, bifstp->ifbpstp_req + count, + sizeof(bpreq)); + if (error != 0) + break; + + count++; + len -= sizeof(bpreq); + } + + bifstp->ifbpstp_len = sizeof(bpreq) * count; + return (error); +} + /* * bridge_ifdetach: * @@ -2249,8 +2352,10 @@ * update it, otherwise create a new one. */ if ((brt = bridge_rtnode_lookup(sc, dst)) == NULL) { - if (sc->sc_brtcnt >= sc->sc_brtmax) + if (sc->sc_brtcnt >= sc->sc_brtmax) { + sc->sc_brtexceeded++; return (ENOSPC); + } /* * Allocate a new bridge forwarding node, and ==== //depot/projects/smpng/sys/net/if_bridgevar.h#12 (text+ko) ==== @@ -67,7 +67,7 @@ * * OpenBSD: if_bridge.h,v 1.14 2001/03/22 03:48:29 jason Exp * - * $FreeBSD: src/sys/net/if_bridgevar.h,v 1.14 2006/07/27 21:01:47 thompsa Exp $ + * $FreeBSD: src/sys/net/if_bridgevar.h,v 1.15 2006/07/31 20:24:46 thompsa Exp $ */ /* @@ -108,6 +108,10 @@ #define BRDGSIFCOST 22 /* set if path cost (ifbreq) */ #define BRDGADDS 23 /* add bridge span member (ifbreq) */ #define BRDGDELS 24 /* delete bridge span member (ifbreq) */ +#define BRDGPARAM 25 /* get bridge STP params (ifbropreq) */ +#define BRDGGRTE 26 /* get cache drops (ifbrparam) */ +#define BRDGGIFSSTP 27 /* get member STP params list + * (ifbpstpconf) */ /* * Generic bridge control request. @@ -191,6 +195,45 @@ #define ifbrp_hellotime ifbrp_ifbrpu.ifbrpu_int8 /* hello time (sec) */ #define ifbrp_fwddelay ifbrp_ifbrpu.ifbrpu_int8 /* fwd time (sec) */ #define ifbrp_maxage ifbrp_ifbrpu.ifbrpu_int8 /* max age (sec) */ +#define ifbrp_cexceeded ifbrp_ifbrpu.ifbrpu_int32 /* # of cache dropped + * adresses */ +/* + * Bridge current operational parameters structure. + */ +struct ifbropreq { + uint8_t ifbop_maxage; + uint8_t ifbop_hellotime; + uint8_t ifbop_fwddelay; + uint16_t ifbop_root_port; + uint32_t ifbop_root_path_cost; + uint64_t ifbop_designated_root; + struct timeval ifbop_last_tc_time; +}; + +/* + * Bridge member operational STP params structure. + */ +struct ifbpstpreq { + uint8_t ifbp_portno; /* bp STP port number */ + uint32_t ifbp_fwd_trans; /* bp STP fwd transitions */ + uint32_t ifbp_design_cost; /* bp STP designated cost */ + uint32_t ifbp_design_port; /* bp STP designated port */ + uint64_t ifbp_design_bridge; /* bp STP designated bridge */ + uint64_t ifbp_design_root; /* bp STP designated root */ +}; + +/* + * Bridge STP ports list structure. + */ +struct ifbpstpconf { + uint32_t ifbpstp_len; /* buffer size */ + union { + caddr_t ifbpstpu_buf; + struct ifbpstpreq *ifbpstpu_req; + } ifbpstp_ifbpstpu; +#define ifbpstp_buf ifbpstp_ifbpstpu.ifbpstpu_buf +#define ifbpstp_req ifbpstp_ifbpstpu.ifbpstpu_req +}; #ifdef _KERNEL ==== //depot/projects/smpng/sys/nfsserver/nfs.h#18 (text+ko) ==== @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * @(#)nfs.h 8.4 (Berkeley) 5/1/95 - * $FreeBSD: src/sys/nfsserver/nfs.h,v 1.79 2006/01/28 19:24:39 csjp Exp $ + * $FreeBSD: src/sys/nfsserver/nfs.h,v 1.80 2006/08/01 16:27:14 jhb Exp $ */ #ifndef _NFSSERVER_NFS_H_ @@ -337,6 +337,7 @@ void nfsm_adj(struct mbuf *, int, int); int nfsm_mbuftouio(struct mbuf **, struct uio *, int, caddr_t *); void nfsrv_initcache(void); +void nfsrv_destroycache(void); void nfsrv_timer(void *); int nfsrv_dorec(struct nfssvc_sock *, struct nfsd *, struct nfsrv_descript **); ==== //depot/projects/smpng/sys/nfsserver/nfs_srvcache.c#13 (text+ko) ==== @@ -33,7 +33,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/nfsserver/nfs_srvcache.c,v 1.41 2006/06/23 00:42:26 mohans Exp $"); +__FBSDID("$FreeBSD: src/sys/nfsserver/nfs_srvcache.c,v 1.43 2006/08/01 16:27:14 jhb Exp $"); /* * Reference: Chet Juszczak, "Improving the Performance and Correctness @@ -65,6 +65,7 @@ static LIST_HEAD(nfsrvhash, nfsrvcache) *nfsrvhashtbl; static TAILQ_HEAD(nfsrvlru, nfsrvcache) nfsrvlruhead; static u_long nfsrvhash; +static eventhandler_tag nfsrv_nmbclusters_tag; #define TRUE 1 #define FALSE 0 @@ -147,8 +148,19 @@ nfsrvcache_size_change(NULL); nfsrvhashtbl = hashinit(desirednfsrvcache, M_NFSD, &nfsrvhash); TAILQ_INIT(&nfsrvlruhead); - EVENTHANDLER_REGISTER(nmbclusters_change, nfsrvcache_size_change, NULL, - EVENTHANDLER_PRI_FIRST); + nfsrv_nmbclusters_tag = EVENTHANDLER_REGISTER(nmbclusters_change, + nfsrvcache_size_change, NULL, EVENTHANDLER_PRI_FIRST); +} + +/* + * Teardown the server request cache list + */ +void +nfsrv_destroycache(void) +{ + KASSERT(TAILQ_EMPTY(&nfsrvlruhead), ("%s: pending requests", __func__)); + EVENTHANDLER_DEREGISTER(nmbclusters_change, nfsrv_nmbclusters_tag); + hashdestroy(nfsrvhashtbl, M_NFSD, nfsrvhash); } /* @@ -360,8 +372,7 @@ NFSD_LOCK_ASSERT(); - for (rp = TAILQ_FIRST(&nfsrvlruhead); rp != 0; rp = nextrp) { - nextrp = TAILQ_NEXT(rp, rc_lru); + TAILQ_FOREACH_SAFE(rp, &nfsrvlruhead, rc_lru, nextrp) { LIST_REMOVE(rp, rc_hash); TAILQ_REMOVE(&nfsrvlruhead, rp, rc_lru); if (rp->rc_flag & RC_REPMBUF) ==== //depot/projects/smpng/sys/nfsserver/nfs_srvsubs.c#34 (text+ko) ==== @@ -33,7 +33,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/nfsserver/nfs_srvsubs.c,v 1.142 2006/07/28 19:05:28 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/nfsserver/nfs_srvsubs.c,v 1.143 2006/08/01 16:27:14 jhb Exp $"); /* * These functions support the macros and help fiddle mbuf chains for @@ -569,8 +569,9 @@ break; } - callout_stop(&nfsrv_callout); + callout_drain(&nfsrv_callout); syscall_deregister(&nfssvc_offset, &nfssvc_prev_sysent); + nfsrv_destroycache(); /* Free the server request cache */ mtx_destroy(&nfsd_mtx); break; default: ==== //depot/projects/smpng/sys/nfsserver/nfs_syscalls.c#28 (text+ko) ==== @@ -33,7 +33,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/nfsserver/nfs_syscalls.c,v 1.105 2006/01/28 19:24:40 csjp Exp $"); +__FBSDID("$FreeBSD: src/sys/nfsserver/nfs_syscalls.c,v 1.106 2006/08/01 15:32:25 jhb Exp $"); #include "opt_inet6.h" #include "opt_mac.h" @@ -720,9 +720,7 @@ panic("nfsd init"); nfssvc_sockhead_flag |= SLP_INIT; if (terminating) { - for (slp = TAILQ_FIRST(&nfssvc_sockhead); slp != NULL; - slp = nslp) { - nslp = TAILQ_NEXT(slp, ns_chain); + TAILQ_FOREACH_SAFE(slp, &nfssvc_sockhead, ns_chain, nslp) { if (slp->ns_flag & SLP_VALID) nfsrv_zapsock(slp); TAILQ_REMOVE(&nfssvc_sockhead, slp, ns_chain); ==== //depot/projects/smpng/sys/sys/kernel.h#34 (text+ko) ==== @@ -39,7 +39,7 @@ * SUCH DAMAGE. * * @(#)kernel.h 8.3 (Berkeley) 1/21/94 - * $FreeBSD: src/sys/sys/kernel.h,v 1.130 2006/05/26 10:23:05 phk Exp $ + * $FreeBSD: src/sys/sys/kernel.h,v 1.131 2006/08/01 16:32:20 jhb Exp $ */ #ifndef _SYS_KERNEL_H_ @@ -157,6 +157,7 @@ SI_SUB_MOUNT_ROOT = 0xb400000, /* root mount*/ SI_SUB_SWAP = 0xc000000, /* swap */ SI_SUB_INTRINSIC_POST = 0xd000000, /* proc 0 cleanup*/ + SI_SUB_SYSCALLS = 0xd800000, /* register system calls */ SI_SUB_KTHREAD_INIT = 0xe000000, /* init process*/ SI_SUB_KTHREAD_PAGE = 0xe400000, /* pageout daemon*/ SI_SUB_KTHREAD_VM = 0xe800000, /* vm daemon*/ ==== //depot/projects/smpng/sys/sys/socketvar.h#54 (text+ko) ==== @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * @(#)socketvar.h 8.3 (Berkeley) 2/19/95 - * $FreeBSD: src/sys/sys/socketvar.h,v 1.153 2006/07/24 15:20:08 rwatson Exp $ + * $FreeBSD: src/sys/sys/socketvar.h,v 1.154 2006/08/01 10:30:26 rwatson Exp $ */ #ifndef _SYS_SOCKETVAR_H_ @@ -477,6 +477,7 @@ void sbcompress(struct sockbuf *sb, struct mbuf *m, struct mbuf *n); struct mbuf * sbcreatecontrol(caddr_t p, int size, int type, int level); +void sbdestroy(struct sockbuf *sb, struct socket *so); void sbdrop(struct sockbuf *sb, int len); >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200608011732.k71HWDTr019786>