From owner-svn-src-user@FreeBSD.ORG Mon Nov 12 08:47:14 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B1A45DDC; Mon, 12 Nov 2012 08:47:14 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 85EA78FC08; Mon, 12 Nov 2012 08:47:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAC8lEZG086336; Mon, 12 Nov 2012 08:47:14 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAC8lEAM086331; Mon, 12 Nov 2012 08:47:14 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201211120847.qAC8lEAM086331@svn.freebsd.org> From: Andre Oppermann Date: Mon, 12 Nov 2012 08:47:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r242910 - in user/andre/tcp_workqueue/sys: kern sys X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Nov 2012 08:47:15 -0000 Author: andre Date: Mon Nov 12 08:47:13 2012 New Revision: 242910 URL: http://svnweb.freebsd.org/changeset/base/242910 Log: Base the mbuf related limits on the available physical memory or kernel memory, whichever is lower. Set maxfiles to a memory derived value at with a floor based on maxusers. Tidy up ordering in init_param2() and check up on some users of those values calculated here. Modified: user/andre/tcp_workqueue/sys/kern/kern_mbuf.c user/andre/tcp_workqueue/sys/kern/subr_param.c user/andre/tcp_workqueue/sys/kern/uipc_socket.c user/andre/tcp_workqueue/sys/sys/eventhandler.h user/andre/tcp_workqueue/sys/sys/mbuf.h Modified: user/andre/tcp_workqueue/sys/kern/kern_mbuf.c ============================================================================== --- user/andre/tcp_workqueue/sys/kern/kern_mbuf.c Mon Nov 12 07:47:19 2012 (r242909) +++ user/andre/tcp_workqueue/sys/kern/kern_mbuf.c Mon Nov 12 08:47:13 2012 (r242910) @@ -96,6 +96,7 @@ __FBSDID("$FreeBSD$"); * */ +int nmbufs; /* limits number of mbufs */ int nmbclusters; /* limits number of mbuf clusters */ int nmbjumbop; /* limits number of page size jumbo clusters */ int nmbjumbo9; /* limits number of 9k jumbo clusters */ @@ -106,27 +107,38 @@ struct mbstat mbstat; * tunable_mbinit() has to be run before init_maxsockets() thus * the SYSINIT order below is SI_ORDER_MIDDLE while init_maxsockets() * runs at SI_ORDER_ANY. + * + * NB: This has to be done before VM init. */ static void tunable_mbinit(void *dummy) { - /* This has to be done before VM init. */ TUNABLE_INT_FETCH("kern.ipc.nmbclusters", &nmbclusters); if (nmbclusters == 0) - nmbclusters = 1024 + maxusers * 64; + nmbclusters = maxmbufmem / MCLBYTES / 4; TUNABLE_INT_FETCH("kern.ipc.nmbjumbop", &nmbjumbop); if (nmbjumbop == 0) - nmbjumbop = nmbclusters / 2; + nmbjumbop = maxmbufmem / MJUMPAGESIZE / 4; TUNABLE_INT_FETCH("kern.ipc.nmbjumbo9", &nmbjumbo9); if (nmbjumbo9 == 0) - nmbjumbo9 = nmbclusters / 4; + nmbjumbo9 = maxmbufmem / MJUM9BYTES / 6; TUNABLE_INT_FETCH("kern.ipc.nmbjumbo16", &nmbjumbo16); if (nmbjumbo16 == 0) - nmbjumbo16 = nmbclusters / 8; + nmbjumbo16 = maxmbufmem / MJUM16BYTES / 6; + + /* + * We need at least as many mbufs as we have clusters of + * the various types added together. + */ + TUNABLE_INT_FETCH("kern.ipc.nmbufs", &nmbufs); + if (nmbufs < nmbclusters + nmbjumbop + nmbjumbo9 + nmbjumbo16) + nmbufs = lmax(maxmbufmem / MSIZE / 5, + nmbclusters + nmbjumbop + nmbjumbo9 + nmbjumbo16); + } SYSINIT(tunable_mbinit, SI_SUB_TUNABLES, SI_ORDER_MIDDLE, tunable_mbinit, NULL); @@ -138,9 +150,11 @@ sysctl_nmbclusters(SYSCTL_HANDLER_ARGS) newnmbclusters = nmbclusters; error = sysctl_handle_int(oidp, &newnmbclusters, 0, req); if (error == 0 && req->newptr) { - if (newnmbclusters > nmbclusters) { + if (newnmbclusters > nmbclusters && + nmbufs >= nmbclusters + nmbjumbop + nmbjumbo9 + nmbjumbo16) { nmbclusters = newnmbclusters; uma_zone_set_max(zone_clust, nmbclusters); + nmbclusters = uma_zone_get_max(zone_clust); EVENTHANDLER_INVOKE(nmbclusters_change); } else error = EINVAL; @@ -159,9 +173,11 @@ sysctl_nmbjumbop(SYSCTL_HANDLER_ARGS) newnmbjumbop = nmbjumbop; error = sysctl_handle_int(oidp, &newnmbjumbop, 0, req); if (error == 0 && req->newptr) { - if (newnmbjumbop> nmbjumbop) { + if (newnmbjumbop > nmbjumbop && + nmbufs >= nmbclusters + nmbjumbop + nmbjumbo9 + nmbjumbo16) { nmbjumbop = newnmbjumbop; uma_zone_set_max(zone_jumbop, nmbjumbop); + nmbjumbop = uma_zone_get_max(zone_jumbop); } else error = EINVAL; } @@ -180,9 +196,11 @@ sysctl_nmbjumbo9(SYSCTL_HANDLER_ARGS) newnmbjumbo9 = nmbjumbo9; error = sysctl_handle_int(oidp, &newnmbjumbo9, 0, req); if (error == 0 && req->newptr) { - if (newnmbjumbo9> nmbjumbo9) { + if (newnmbjumbo9 > nmbjumbo9&& + nmbufs >= nmbclusters + nmbjumbop + nmbjumbo9 + nmbjumbo16) { nmbjumbo9 = newnmbjumbo9; uma_zone_set_max(zone_jumbo9, nmbjumbo9); + nmbjumbo9 = uma_zone_get_max(zone_jumbo9); } else error = EINVAL; } @@ -200,9 +218,11 @@ sysctl_nmbjumbo16(SYSCTL_HANDLER_ARGS) newnmbjumbo16 = nmbjumbo16; error = sysctl_handle_int(oidp, &newnmbjumbo16, 0, req); if (error == 0 && req->newptr) { - if (newnmbjumbo16> nmbjumbo16) { + if (newnmbjumbo16 > nmbjumbo16 && + nmbufs >= nmbclusters + nmbjumbop + nmbjumbo9 + nmbjumbo16) { nmbjumbo16 = newnmbjumbo16; uma_zone_set_max(zone_jumbo16, nmbjumbo16); + nmbjumbo16 = uma_zone_get_max(zone_jumbo16); } else error = EINVAL; } @@ -212,6 +232,27 @@ SYSCTL_PROC(_kern_ipc, OID_AUTO, nmbjumb &nmbjumbo16, 0, sysctl_nmbjumbo16, "IU", "Maximum number of mbuf 16k jumbo clusters allowed"); +static int +sysctl_nmbufs(SYSCTL_HANDLER_ARGS) +{ + int error, newnmbufs; + + newnmbufs = nmbufs; + error = sysctl_handle_int(oidp, &newnmbufs, 0, req); + if (error == 0 && req->newptr) { + if (newnmbufs > nmbufs) { + nmbufs = newnmbufs; + uma_zone_set_max(zone_mbuf, nmbufs); + nmbclusters = uma_zone_get_max(zone_mbuf); + EVENTHANDLER_INVOKE(nmbufs_change); + } else + error = EINVAL; + } + return (error); +} +SYSCTL_PROC(_kern_ipc, OID_AUTO, nmbuf, CTLTYPE_INT|CTLFLAG_RW, +&nmbufs, 0, sysctl_nmbufs, "IU", + "Maximum number of mbufs allowed"); SYSCTL_STRUCT(_kern_ipc, OID_AUTO, mbstat, CTLFLAG_RD, &mbstat, mbstat, @@ -266,6 +307,10 @@ mbuf_init(void *dummy) NULL, NULL, #endif MSIZE - 1, UMA_ZONE_MAXBUCKET); + if (nmbufs > 0) { + uma_zone_set_max(zone_mbuf, nmbufs); + nmbufs = uma_zone_get_max(zone_mbuf); + } zone_clust = uma_zcreate(MBUF_CLUSTER_MEM_NAME, MCLBYTES, mb_ctor_clust, mb_dtor_clust, @@ -275,8 +320,10 @@ mbuf_init(void *dummy) NULL, NULL, #endif UMA_ALIGN_PTR, UMA_ZONE_REFCNT); - if (nmbclusters > 0) + if (nmbclusters > 0) { uma_zone_set_max(zone_clust, nmbclusters); + nmbclusters = uma_zone_get_max(zone_clust); + } zone_pack = uma_zsecond_create(MBUF_PACKET_MEM_NAME, mb_ctor_pack, mb_dtor_pack, mb_zinit_pack, mb_zfini_pack, zone_mbuf); @@ -290,8 +337,10 @@ mbuf_init(void *dummy) NULL, NULL, #endif UMA_ALIGN_PTR, UMA_ZONE_REFCNT); - if (nmbjumbop > 0) + if (nmbjumbop > 0) { uma_zone_set_max(zone_jumbop, nmbjumbop); + nmbjumbop = uma_zone_get_max(zone_jumbop); + } zone_jumbo9 = uma_zcreate(MBUF_JUMBO9_MEM_NAME, MJUM9BYTES, mb_ctor_clust, mb_dtor_clust, @@ -301,9 +350,11 @@ mbuf_init(void *dummy) NULL, NULL, #endif UMA_ALIGN_PTR, UMA_ZONE_REFCNT); - if (nmbjumbo9 > 0) - uma_zone_set_max(zone_jumbo9, nmbjumbo9); uma_zone_set_allocf(zone_jumbo9, mbuf_jumbo_alloc); + if (nmbjumbo9 > 0) { + uma_zone_set_max(zone_jumbo9, nmbjumbo9); + nmbjumbo9 = uma_zone_get_max(zone_jumbo9); + } zone_jumbo16 = uma_zcreate(MBUF_JUMBO16_MEM_NAME, MJUM16BYTES, mb_ctor_clust, mb_dtor_clust, @@ -313,9 +364,11 @@ mbuf_init(void *dummy) NULL, NULL, #endif UMA_ALIGN_PTR, UMA_ZONE_REFCNT); - if (nmbjumbo16 > 0) - uma_zone_set_max(zone_jumbo16, nmbjumbo16); uma_zone_set_allocf(zone_jumbo16, mbuf_jumbo_alloc); + if (nmbjumbo16 > 0) { + uma_zone_set_max(zone_jumbo16, nmbjumbo16); + nmbjumbo16 = uma_zone_get_max(zone_jumbo16); + } zone_ext_refcnt = uma_zcreate(MBUF_EXTREFCNT_MEM_NAME, sizeof(u_int), NULL, NULL, Modified: user/andre/tcp_workqueue/sys/kern/subr_param.c ============================================================================== --- user/andre/tcp_workqueue/sys/kern/subr_param.c Mon Nov 12 07:47:19 2012 (r242909) +++ user/andre/tcp_workqueue/sys/kern/subr_param.c Mon Nov 12 08:47:13 2012 (r242910) @@ -93,6 +93,7 @@ int ncallout; /* maximum # of timer ev int nbuf; int ngroups_max; /* max # groups per process */ int nswbuf; +long maxmbufmem; /* max mbuf memory */ pid_t pid_max = PID_MAX; long maxswzone; /* max swmeta KVA storage */ long maxbcache; /* max buffer cache KVA storage */ @@ -270,6 +271,7 @@ init_param1(void) void init_param2(long physpages) { + long realmem; /* Base parameters */ maxusers = MAXUSERS; @@ -293,18 +295,24 @@ init_param2(long physpages) /* * The following can be overridden after boot via sysctl. Note: * unless overriden, these macros are ultimately based on maxusers. - */ - maxproc = NPROC; - TUNABLE_INT_FETCH("kern.maxproc", &maxproc); - /* * Limit maxproc so that kmap entries cannot be exhausted by * processes. */ + maxproc = NPROC; + TUNABLE_INT_FETCH("kern.maxproc", &maxproc); if (maxproc > (physpages / 12)) maxproc = physpages / 12; - maxfiles = MAXFILES; - TUNABLE_INT_FETCH("kern.maxfiles", &maxfiles); maxprocperuid = (maxproc * 9) / 10; + + /* + * The default limit for maxfiles is 1/12 of the number of + * physical page but not less than 16 times maxusers. + * At most it can be 1/6 the number of physical pages. + */ + maxfiles = imax(MAXFILES, physpages / 12); + TUNABLE_INT_FETCH("kern.maxfiles", &maxfiles); + if (maxfiles > (physpages / 6)) + maxfiles = physpages / 6; maxfilesperproc = (maxfiles * 9) / 10; /* @@ -313,20 +321,36 @@ init_param2(long physpages) nbuf = NBUF; TUNABLE_INT_FETCH("kern.nbuf", &nbuf); + /* + * XXXAO: This can really large, does the callout wheel have + * to be so big? + */ ncallout = 16 + maxproc + maxfiles; TUNABLE_INT_FETCH("kern.ncallout", &ncallout); /* + * The default limit for all mbuf related memory is 1/2 of all + * available kernel memory (physical or kmem). + * At most it can be 3/4 of available kernel memory. + */ + realmem = lmin(physpages * PAGE_SIZE, + VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS); + maxmbufmem = realmem / 2; + TUNABLE_LONG_FETCH("kern.maxmbufmem", &maxmbufmem); + if (maxmbufmem > realmem / 4 * 3) + maxmbufmem = realmem / 4 * 3; + + /* * The default for maxpipekva is min(1/64 of the kernel address space, * max(1/64 of main memory, 512KB)). See sys_pipe.c for more details. */ maxpipekva = (physpages / 64) * PAGE_SIZE; + TUNABLE_LONG_FETCH("kern.ipc.maxpipekva", &maxpipekva); if (maxpipekva < 512 * 1024) maxpipekva = 512 * 1024; if (maxpipekva > (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / 64) maxpipekva = (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / 64; - TUNABLE_LONG_FETCH("kern.ipc.maxpipekva", &maxpipekva); } /* Modified: user/andre/tcp_workqueue/sys/kern/uipc_socket.c ============================================================================== --- user/andre/tcp_workqueue/sys/kern/uipc_socket.c Mon Nov 12 07:47:19 2012 (r242909) +++ user/andre/tcp_workqueue/sys/kern/uipc_socket.c Mon Nov 12 08:47:13 2012 (r242910) @@ -290,7 +290,7 @@ init_maxsockets(void *ignored) { TUNABLE_INT_FETCH("kern.ipc.maxsockets", &maxsockets); - maxsockets = imax(maxsockets, imax(maxfiles, nmbclusters)); + maxsockets = imax(maxsockets, maxfiles); } SYSINIT(param, SI_SUB_TUNABLES, SI_ORDER_ANY, init_maxsockets, NULL); @@ -308,10 +308,6 @@ sysctl_maxsockets(SYSCTL_HANDLER_ARGS) if (error == 0 && req->newptr) { if (newmaxsockets > maxsockets) { maxsockets = newmaxsockets; - if (maxsockets > ((maxfiles / 4) * 3)) { - maxfiles = (maxsockets * 5) / 4; - maxfilesperproc = (maxfiles * 9) / 10; - } EVENTHANDLER_INVOKE(maxsockets_change); } else error = EINVAL; Modified: user/andre/tcp_workqueue/sys/sys/eventhandler.h ============================================================================== --- user/andre/tcp_workqueue/sys/sys/eventhandler.h Mon Nov 12 07:47:19 2012 (r242909) +++ user/andre/tcp_workqueue/sys/sys/eventhandler.h Mon Nov 12 08:47:13 2012 (r242910) @@ -253,6 +253,7 @@ EVENTHANDLER_DECLARE(thread_fini, thread typedef void (*uma_zone_chfn)(void *); EVENTHANDLER_DECLARE(nmbclusters_change, uma_zone_chfn); +EVENTHANDLER_DECLARE(nmbufs_change, uma_zone_chfn); EVENTHANDLER_DECLARE(maxsockets_change, uma_zone_chfn); #endif /* SYS_EVENTHANDLER_H */ Modified: user/andre/tcp_workqueue/sys/sys/mbuf.h ============================================================================== --- user/andre/tcp_workqueue/sys/sys/mbuf.h Mon Nov 12 07:47:19 2012 (r242909) +++ user/andre/tcp_workqueue/sys/sys/mbuf.h Mon Nov 12 08:47:13 2012 (r242910) @@ -396,7 +396,7 @@ struct mbstat { * * The rest of it is defined in kern/kern_mbuf.c */ - +extern long maxmbufmem; extern uma_zone_t zone_mbuf; extern uma_zone_t zone_clust; extern uma_zone_t zone_pack; From owner-svn-src-user@FreeBSD.ORG Mon Nov 12 09:50:27 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 76FBA9C4; Mon, 12 Nov 2012 09:50:27 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5B83F8FC14; Mon, 12 Nov 2012 09:50:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAC9oRjJ093880; Mon, 12 Nov 2012 09:50:27 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAC9oRSE093879; Mon, 12 Nov 2012 09:50:27 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201211120950.qAC9oRSE093879@svn.freebsd.org> From: Andre Oppermann Date: Mon, 12 Nov 2012 09:50:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r242911 - user/andre/tcp_workqueue/sys/dev/bge X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Nov 2012 09:50:27 -0000 Author: andre Date: Mon Nov 12 09:50:26 2012 New Revision: 242911 URL: http://svnweb.freebsd.org/changeset/base/242911 Log: Continue conversion of bge(4) into a hybrid interrupt/polling model including live-lock prevention. Simplify bge_setup_tso() based on stack guarantees on minimal packet layout. Rename bge_rxeof() to bge_rx() to better describe its purpose. Merge bge_ithr_msix() and bge_ithr() together as bge_ithr(). Change the order of DMA ring processing. First do the tx completion ring to free up space and allow sending to go on. Then dequeue all packets from the rx ring, drop the lock and send them up the stack. Do a maybe_yield() to observe the available quantum and let other threads run in between. Remove bge_poll() as unnecessary. Work in progress. Modified: user/andre/tcp_workqueue/sys/dev/bge/if_bge.c Modified: user/andre/tcp_workqueue/sys/dev/bge/if_bge.c ============================================================================== --- user/andre/tcp_workqueue/sys/dev/bge/if_bge.c Mon Nov 12 08:47:13 2012 (r242910) +++ user/andre/tcp_workqueue/sys/dev/bge/if_bge.c Mon Nov 12 09:50:26 2012 (r242911) @@ -390,7 +390,7 @@ static int bge_get_eaddr_eeprom(struct b static int bge_get_eaddr(struct bge_softc *, uint8_t[]); static void bge_txeof(struct bge_softc *, uint16_t); -static int bge_rxeof(struct bge_softc *, uint16_t); +static void bge_rx(struct bge_softc *, uint16_t); static void bge_asf_driver_up (struct bge_softc *); static void bge_tick(void *); @@ -398,12 +398,11 @@ static void bge_stats_clear_regs(struct static void bge_stats_update(struct bge_softc *); static void bge_stats_update_regs(struct bge_softc *); static struct mbuf *bge_check_short_dma(struct mbuf *); -static struct mbuf *bge_setup_tso(struct bge_softc *, struct mbuf *, - uint16_t *, uint16_t *); +static void bge_setup_tso(struct bge_softc *, struct mbuf *, uint16_t *, + uint16_t *); static int bge_encap(struct bge_softc *, struct mbuf **, uint32_t *); static int bge_intr_filter(void *); -static void bge_ithr_msix(void *); static void bge_ithr(void *); static void bge_start_locked(struct ifnet *); static void bge_start(struct ifnet *); @@ -3835,13 +3834,10 @@ again: /* Take advantage of single-shot MSI. */ CSR_WRITE_4(sc, BGE_MSI_MODE, CSR_READ_4(sc, BGE_MSI_MODE) & ~BGE_MSIMODE_ONE_SHOT_DISABLE); - error = bus_setup_intr(dev, sc->bge_irq, - INTR_TYPE_NET | INTR_MPSAFE, bge_intr_filter, - bge_ithr_msix, sc, &sc->bge_intrhand); - } else - error = bus_setup_intr(dev, sc->bge_irq, - INTR_TYPE_NET | INTR_MPSAFE, bge_intr_filter, - bge_ithr, sc, &sc->bge_intrhand); + } + error = bus_setup_intr(dev, sc->bge_irq, + INTR_TYPE_NET | INTR_MPSAFE, bge_intr_filter, + bge_ithr, sc, &sc->bge_intrhand); if (error) { ether_ifdetach(ifp); @@ -4273,39 +4269,33 @@ bge_rx_packet(struct bge_softc *sc, stru m->m_data += ETHER_ALIGN; } #endif - ifp->if_ipackets++; return (m); } /* * Frame reception handling. This is called if there's a frame * on the receive return list. - * - * Note: we have to be able to handle two possibilities here: - * 1) the frame is from the jumbo receive ring - * 2) the frame is from the standard receive ring */ -static int -bge_rxeof(struct bge_softc *sc, uint16_t rx_prod) +static void +bge_rx(struct bge_softc *sc, uint16_t rx_prod) { struct ifnet *ifp; - int rx_npkts = 0, stdcnt = 0, jumbocnt = 0; - int pkts = 0; + int rx_npkts = 0; uint16_t rx_cons; - struct mbuf *m = NULL, *n = NULL; + struct mbuf *m = NULL, *m0, *n = NULL; rx_cons = sc->bge_rx_saved_considx; - - /* Nothing to do. */ if (rx_cons == rx_prod) - return (rx_npkts); + return; ifp = sc->bge_ifp; bus_dmamap_sync(sc->bge_cdata.bge_rx_return_ring_tag, sc->bge_cdata.bge_rx_return_ring_map, BUS_DMASYNC_POSTREAD); + bus_dmamap_sync(sc->bge_cdata.bge_rx_std_ring_tag, sc->bge_cdata.bge_rx_std_ring_map, BUS_DMASYNC_POSTWRITE); + if (BGE_IS_JUMBO_CAPABLE(sc) && ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN + ETHER_VLAN_ENCAP_LEN > (MCLBYTES - ETHER_ALIGN)) @@ -4315,39 +4305,40 @@ bge_rxeof(struct bge_softc *sc, uint16_t while (rx_cons != rx_prod) { struct bge_rx_bd *cur_rx; uint32_t rxidx; - struct mbuf *mm; cur_rx = &sc->bge_ldata.bge_rx_return_ring[rx_cons]; rxidx = cur_rx->bge_idx; BGE_INC(rx_cons, sc->bge_return_ring_cnt); - mm = bge_rx_packet(sc, cur_rx, rxidx, ifp); - if (mm != NULL) { - if (n != NULL) - n->m_nextpkt = mm; - else - m = n = mm; - } else + m0 = bge_rx_packet(sc, cur_rx, rxidx, ifp); + if (m0 == NULL) continue; - pkts++; - } - bus_dmamap_sync(sc->bge_cdata.bge_rx_return_ring_tag, - sc->bge_cdata.bge_rx_return_ring_map, BUS_DMASYNC_PREREAD); - if (stdcnt > 0) { - bus_dmamap_sync(sc->bge_cdata.bge_rx_std_ring_tag, - sc->bge_cdata.bge_rx_std_ring_map, BUS_DMASYNC_PREWRITE); - bge_writembx(sc, BGE_MBX_RX_STD_PROD_LO, (sc->bge_std + - BGE_STD_RX_RING_CNT - 1) % BGE_STD_RX_RING_CNT); + if (n != NULL) { + n->m_nextpkt = m0; + n = m0; + } else + m = n = m0; + + rx_npkts++; } - if (jumbocnt > 0) { + sc->bge_rx_saved_considx = rx_cons; + + bus_dmamap_sync(sc->bge_cdata.bge_rx_std_ring_tag, + sc->bge_cdata.bge_rx_std_ring_map, BUS_DMASYNC_PREWRITE); + bge_writembx(sc, BGE_MBX_RX_STD_PROD_LO, (sc->bge_std + + BGE_STD_RX_RING_CNT - 1) % BGE_STD_RX_RING_CNT); + + if (BGE_IS_JUMBO_CAPABLE(sc)) { bus_dmamap_sync(sc->bge_cdata.bge_rx_jumbo_ring_tag, sc->bge_cdata.bge_rx_jumbo_ring_map, BUS_DMASYNC_PREWRITE); bge_writembx(sc, BGE_MBX_RX_JUMBO_PROD_LO, (sc->bge_jumbo + BGE_JUMBO_RX_RING_CNT - 1) % BGE_JUMBO_RX_RING_CNT); } - sc->bge_rx_saved_considx = rx_cons; + + bus_dmamap_sync(sc->bge_cdata.bge_rx_return_ring_tag, + sc->bge_cdata.bge_rx_return_ring_map, BUS_DMASYNC_PREREAD); bge_writembx(sc, BGE_MBX_RX_CONS0_LO, sc->bge_rx_saved_considx); #if 0 @@ -4359,18 +4350,18 @@ bge_rxeof(struct bge_softc *sc, uint16_t ifp->if_ierrors += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS); #endif - BGE_UNLOCK(sc); - while (m != NULL) { - /* n = SLIST_REMOVE_HEAD(m, nxtpkt); */ - n = m; - m = n->m_nextpkt; - n->m_nextpkt = NULL; - (*ifp->if_input)(ifp, n); - } - maybe_yield(); - BGE_LOCK(sc); + BGE_UNLOCK(sc); + while ((n = m) != NULL) { + /* n = SLIST_REMOVE_HEAD(m, nxtpkt); */ + m = n->m_nextpkt; + n->m_nextpkt = NULL; + (*ifp->if_input)(ifp, n); + ifp->if_ipackets++; + maybe_yield(); + } + BGE_LOCK(sc); - return (rx_npkts); + return; } static void @@ -4418,67 +4409,20 @@ bge_txeof(struct bge_softc *sc, uint16_t sc->bge_timer = 0; } -#ifdef DEVICE_POLLING -static int -bge_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) -{ - struct bge_softc *sc = ifp->if_softc; - uint16_t rx_prod, tx_cons; - uint32_t statusword; - int rx_npkts = 0; - - BGE_LOCK(sc); - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { - BGE_UNLOCK(sc); - return (rx_npkts); - } - - bus_dmamap_sync(sc->bge_cdata.bge_status_tag, - sc->bge_cdata.bge_status_map, - BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); - /* Fetch updates from the status block. */ - rx_prod = sc->bge_ldata.bge_status_block->bge_idx[0].bge_rx_prod_idx; - tx_cons = sc->bge_ldata.bge_status_block->bge_idx[0].bge_tx_cons_idx; - - statusword = sc->bge_ldata.bge_status_block->bge_status; - /* Clear the status so the next pass only sees the changes. */ - sc->bge_ldata.bge_status_block->bge_status = 0; - - bus_dmamap_sync(sc->bge_cdata.bge_status_tag, - sc->bge_cdata.bge_status_map, - BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - - /* Note link event. It will be processed by POLL_AND_CHECK_STATUS. */ - if (statusword & BGE_STATFLAG_LINKSTATE_CHANGED) - sc->bge_link_evt++; - - if (cmd == POLL_AND_CHECK_STATUS) - if ((sc->bge_asicrev == BGE_ASICREV_BCM5700 && - sc->bge_chipid != BGE_CHIPID_BCM5700_B2) || - sc->bge_link_evt || (sc->bge_flags & BGE_FLAG_TBI)) - bge_link_upd(sc); - - sc->rxcycles = count; - rx_npkts = bge_rxeof(sc, rx_prod); - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { - BGE_UNLOCK(sc); - return (rx_npkts); - } - bge_txeof(sc, tx_cons); - if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) - bge_start_locked(ifp); - - BGE_UNLOCK(sc); - return (rx_npkts); -} -#endif /* DEVICE_POLLING */ - static int bge_intr_filter(void *arg) { struct bge_softc *sc; + uint32_t status; sc = (struct bge_softc *)arg; + + /* Do the mandatory PCI flush as well as get the link status. */ + if (!(sc->bge_flags & BGE_FLAG_MSI)) { + status = CSR_READ_4(sc, BGE_MAC_STS); + if (!status) + return (FILTER_STRAY); + } /* * This interrupt is not shared and controller already * disabled further interrupt. @@ -4487,12 +4431,13 @@ bge_intr_filter(void *arg) } static void -bge_ithr_msix(void *arg) +bge_ithr(void *arg) { struct bge_softc *sc; struct ifnet *ifp; - uint32_t status, status_tag; + uint32_t statusword, status_tag; uint16_t rx_prod, tx_cons; + int work = 1; sc = (struct bge_softc *)arg; ifp = sc->bge_ifp; @@ -4503,123 +4448,53 @@ bge_ithr_msix(void *arg) return; } - /* Get updated status block. */ - bus_dmamap_sync(sc->bge_cdata.bge_status_tag, - sc->bge_cdata.bge_status_map, - BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); - - /* Save producer/consumer indices. */ - rx_prod = sc->bge_ldata.bge_status_block->bge_idx[0].bge_rx_prod_idx; - tx_cons = sc->bge_ldata.bge_status_block->bge_idx[0].bge_tx_cons_idx; - status = sc->bge_ldata.bge_status_block->bge_status; - status_tag = sc->bge_ldata.bge_status_block->bge_status_tag << 24; - /* Dirty the status flag. */ - sc->bge_ldata.bge_status_block->bge_status = 0; - bus_dmamap_sync(sc->bge_cdata.bge_status_tag, - sc->bge_cdata.bge_status_map, - BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - if ((sc->bge_flags & BGE_FLAG_TAGGED_STATUS) == 0) - status_tag = 0; - - if ((status & BGE_STATFLAG_LINKSTATE_CHANGED) != 0) - bge_link_upd(sc); - - /* Let controller work. */ - bge_writembx(sc, BGE_MBX_IRQ0_LO, status_tag); - - if (ifp->if_drv_flags & IFF_DRV_RUNNING && - sc->bge_rx_saved_considx != rx_prod) { - /* Check RX return ring producer/consumer. */ - BGE_UNLOCK(sc); - bge_rxeof(sc, rx_prod); - BGE_LOCK(sc); - } - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - /* Check TX ring producer/consumer. */ - bge_txeof(sc, tx_cons); - if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) - bge_start_locked(ifp); - } - BGE_UNLOCK(sc); -} - -static void -bge_ithr(void *xsc) -{ - struct bge_softc *sc; - struct ifnet *ifp; - uint32_t statusword; - uint16_t rx_prod, tx_cons; - - sc = xsc; + do { - BGE_LOCK(sc); + /* Do the mandatory PCI flush as well as get the link status. */ + if (!(sc->bge_flags & BGE_FLAG_MSI)) + statusword = CSR_READ_4(sc, BGE_MAC_STS) & BGE_MACSTAT_LINK_CHANGED; - ifp = sc->bge_ifp; + /* Get updated status block. */ + bus_dmamap_sync(sc->bge_cdata.bge_status_tag, + sc->bge_cdata.bge_status_map, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); -#ifdef DEVICE_POLLING - if (ifp->if_capenable & IFCAP_POLLING) { - BGE_UNLOCK(sc); - return; - } -#endif + /* Save producer/consumer indices. */ + rx_prod = sc->bge_ldata.bge_status_block->bge_idx[0].bge_rx_prod_idx; + tx_cons = sc->bge_ldata.bge_status_block->bge_idx[0].bge_tx_cons_idx; + + statusword = sc->bge_ldata.bge_status_block->bge_status; + status_tag = sc->bge_ldata.bge_status_block->bge_status_tag << 24; + sc->bge_ldata.bge_status_block->bge_status = 0; - /* - * Ack the interrupt by writing something to BGE_MBX_IRQ0_LO. Don't - * disable interrupts by writing nonzero like we used to, since with - * our current organization this just gives complications and - * pessimizations for re-enabling interrupts. We used to have races - * instead of the necessary complications. Disabling interrupts - * would just reduce the chance of a status update while we are - * running (by switching to the interrupt-mode coalescence - * parameters), but this chance is already very low so it is more - * efficient to get another interrupt than prevent it. - * - * We do the ack first to ensure another interrupt if there is a - * status update after the ack. We don't check for the status - * changing later because it is more efficient to get another - * interrupt than prevent it, not quite as above (not checking is - * a smaller optimization than not toggling the interrupt enable, - * since checking doesn't involve PCI accesses and toggling require - * the status check). So toggling would probably be a pessimization - * even with MSI. It would only be needed for using a task queue. - */ - bge_writembx(sc, BGE_MBX_IRQ0_LO, 0); + /* Clear the status so the next pass only sees the changes. */ + bus_dmamap_sync(sc->bge_cdata.bge_status_tag, + sc->bge_cdata.bge_status_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - /* - * Do the mandatory PCI flush as well as get the link status. - */ - statusword = CSR_READ_4(sc, BGE_MAC_STS) & BGE_MACSTAT_LINK_CHANGED; + if ((sc->bge_flags & BGE_FLAG_TAGGED_STATUS) == 0) + status_tag = 0; - /* Make sure the descriptor ring indexes are coherent. */ - bus_dmamap_sync(sc->bge_cdata.bge_status_tag, - sc->bge_cdata.bge_status_map, - BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); - rx_prod = sc->bge_ldata.bge_status_block->bge_idx[0].bge_rx_prod_idx; - tx_cons = sc->bge_ldata.bge_status_block->bge_idx[0].bge_tx_cons_idx; - sc->bge_ldata.bge_status_block->bge_status = 0; - bus_dmamap_sync(sc->bge_cdata.bge_status_tag, - sc->bge_cdata.bge_status_map, - BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + if ((sc->bge_asicrev == BGE_ASICREV_BCM5700 && + sc->bge_chipid != BGE_CHIPID_BCM5700_B2) || + statusword & BGE_STATFLAG_LINKSTATE_CHANGED || + sc->bge_link_evt || (sc->bge_flags & BGE_FLAG_TBI)) + bge_link_upd(sc); - if ((sc->bge_asicrev == BGE_ASICREV_BCM5700 && - sc->bge_chipid != BGE_CHIPID_BCM5700_B2) || - statusword || sc->bge_link_evt) - bge_link_upd(sc); + /* Check TX ring producer/consumer. */ + bge_txeof(sc, tx_cons); - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { /* Check RX return ring producer/consumer. */ - bge_rxeof(sc, rx_prod); - } + bge_rx(sc, rx_prod); - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - /* Check TX ring producer/consumer. */ - bge_txeof(sc, tx_cons); - } + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + bge_start_locked(ifp); - if (ifp->if_drv_flags & IFF_DRV_RUNNING && - !IFQ_DRV_IS_EMPTY(&ifp->if_snd)) - bge_start_locked(ifp); + maybe_yield(); + } while (work); + + /* Let controller work. */ + bge_writembx(sc, BGE_MBX_IRQ0_LO, status_tag); BGE_UNLOCK(sc); } @@ -4962,46 +4837,25 @@ bge_check_short_dma(struct mbuf *m) return (n); } -static struct mbuf * +static void bge_setup_tso(struct bge_softc *sc, struct mbuf *m, uint16_t *mss, uint16_t *flags) { struct ip *ip; struct tcphdr *tcp; - struct mbuf *n; uint16_t hlen; - uint32_t poff; - if (M_WRITABLE(m) == 0) { - /* Get a writable copy. */ - n = m_dup(m, M_DONTWAIT); - m_freem(m); - if (n == NULL) - return (NULL); - m = n; - } - m = m_pullup(m, sizeof(struct ether_header) + sizeof(struct ip)); - if (m == NULL) - return (NULL); - ip = (struct ip *)(mtod(m, char *) + sizeof(struct ether_header)); - poff = sizeof(struct ether_header) + (ip->ip_hl << 2); - m = m_pullup(m, poff + sizeof(struct tcphdr)); - if (m == NULL) - return (NULL); - tcp = (struct tcphdr *)(mtod(m, char *) + poff); - m = m_pullup(m, poff + (tcp->th_off << 2)); - if (m == NULL) - return (NULL); + ip = mtod(m + sizeof(struct ether_header), struct ip *); + tcp = mtod(m + sizeof(struct ether_header) + (ip->ip_hl << 2), struct tcphdr *); + /* * It seems controller doesn't modify IP length and TCP pseudo * checksum. These checksum computed by upper stack should be 0. */ *mss = m->m_pkthdr.tso_segsz; - ip = (struct ip *)(mtod(m, char *) + sizeof(struct ether_header)); ip->ip_sum = 0; ip->ip_len = htons(*mss + (ip->ip_hl << 2) + (tcp->th_off << 2)); /* Clear pseudo checksum computed by TCP stack. */ - tcp = (struct tcphdr *)(mtod(m, char *) + poff); tcp->th_sum = 0; /* * Broadcom controllers uses different descriptor format for @@ -5031,7 +4885,6 @@ bge_setup_tso(struct bge_softc *sc, stru */ *mss |= (hlen << 11); } - return (m); } /* @@ -5052,17 +4905,15 @@ bge_encap(struct bge_softc *sc, struct m csum_flags = 0; mss = 0; vlan_tag = 0; - if ((sc->bge_flags & BGE_FLAG_SHORT_DMA_BUG) != 0 && + if ((sc->bge_flags & BGE_FLAG_SHORT_DMA_BUG) && m->m_next != NULL) { *m_head = bge_check_short_dma(m); if (*m_head == NULL) return (ENOBUFS); m = *m_head; } - if ((m->m_pkthdr.csum_flags & CSUM_TSO) != 0) { - *m_head = m = bge_setup_tso(sc, m, &mss, &csum_flags); - if (*m_head == NULL) - return (ENOBUFS); + if (m->m_pkthdr.csum_flags & CSUM_TSO) { + bge_setup_tso(sc, m, &mss, &csum_flags); csum_flags |= BGE_TXBDFLAG_CPU_PRE_DMA | BGE_TXBDFLAG_CPU_POST_DMA; } else if ((m->m_pkthdr.csum_flags & sc->bge_csum_features) != 0) { @@ -5079,12 +4930,12 @@ bge_encap(struct bge_softc *sc, struct m } } - if ((m->m_pkthdr.csum_flags & CSUM_TSO) == 0) { + if (!(m->m_pkthdr.csum_flags & CSUM_TSO)) { if (sc->bge_flags & BGE_FLAG_JUMBO_FRAME && m->m_pkthdr.len > ETHER_MAX_LEN) csum_flags |= BGE_TXBDFLAG_JUMBO_FRAME; if (sc->bge_forced_collapse > 0 && - (sc->bge_flags & BGE_FLAG_PCIE) != 0 && m->m_next != NULL) { + (sc->bge_flags & BGE_FLAG_PCIE) && m->m_next != NULL) { /* * Forcedly collapse mbuf chains to overcome hardware * limitation which only support a single outstanding @@ -5119,7 +4970,7 @@ bge_encap(struct bge_softc *sc, struct m *m_head = NULL; return (error); } - } else if (error != 0) + } else if (error) return (error); /* Check if we have enough free send BDs. */ From owner-svn-src-user@FreeBSD.ORG Mon Nov 12 10:49:08 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D56EF48F for ; Mon, 12 Nov 2012 10:49:08 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id 2B69B8FC15 for ; Mon, 12 Nov 2012 10:49:07 +0000 (UTC) Received: (qmail 95102 invoked from network); 12 Nov 2012 12:23:30 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 12 Nov 2012 12:23:30 -0000 Message-ID: <50A0D420.4030106@freebsd.org> Date: Mon, 12 Nov 2012 11:49:04 +0100 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 MIME-Version: 1.0 To: Andre Oppermann Subject: Re: svn commit: r242910 - in user/andre/tcp_workqueue/sys: kern sys References: <201211120847.qAC8lEAM086331@svn.freebsd.org> In-Reply-To: <201211120847.qAC8lEAM086331@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: src-committers@freebsd.org, svn-src-user@freebsd.org X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Nov 2012 10:49:09 -0000 On 12.11.2012 09:47, Andre Oppermann wrote: > Author: andre > Date: Mon Nov 12 08:47:13 2012 > New Revision: 242910 > URL: http://svnweb.freebsd.org/changeset/base/242910 > > Log: > Base the mbuf related limits on the available physical memory or > kernel memory, whichever is lower. The commit message is a bit terse so I'm going to explain in more detail: The overall mbuf related memory limit must be set so that mbufs (and clusters of various sizes) can't exhaust physical RAM or KVM. I've chosen a limit of half the physical RAM or KVM (whichever is lower) as the baseline. In any normal scenario we want to leave at least half of the physmem/kvm for other kernel functions and userspace to prevent it from swapping like hell. Via a tunable it can be upped to at most 3/4 of physmem/kvm. Out of the overall mbuf memory limit I've chosen 2K clusters, 4K (page size) clusters to get 1/4 each because these are the most heavily used mbuf sizes. 2K clusters are used for MTU 1500 ethernet inbound packets. 4K clusters are used whenever possible for sends on sockets and thus outbound packets. The larger cluster sizes of 9K and 16K are limited to 1/6 of the overall mbuf memory limit. Again, when jumbo MTU's are used these large clusters will end up only on the inbound path. They are not used on outbound, there it's still 4K. Yes, that will stay that way because otherwise we run into lots of complications in the stack. And it really isn't a problem, so don't make a scene. Previously the normal mbufs (256B) weren't limited at all. This is wrong as there are certain places in the kernel that on allocation failure of clusters try to piece together their packet from smaller mbufs. The mbuf limit is the number of all other mbuf sizes together plus some more to allow for standalone mbufs (ACK for example) and to send off a copy of a cluster. FYI: Every cluster eventually also has an mbuf associated with it. Unfortunately there isn't a way to set an overall limit for all mbuf memory together as UMA doesn't support such a limiting. Lets work out a few examples on sizing: 1GB KVM: 512MB limit for mbufs 419,430 mbufs 65,536 2K mbuf clusters 32,768 4K mbuf clusters 9,709 9K mbuf clusters 5,461 16K mbuf clusters 16GB RAM: 8GB limit for mbufs 33,554,432 mbufs 1,048,576 2K mbuf clusters 524,288 4K mbuf clusters 155,344 9K mbuf clusters 87,381 16K mbuf clusters These defaults should be sufficient for event the most demanding network loads. If you do run into these limits you probably know exactly what you are doing and you are expected to tune those values for your particular purpose. There is a side-issue with maxfiles as it relates to the maximum number of sockets that can be opened at the same time. With web servers and proxy caches of these days there may be some 100K or more sockets open. Hence I've divorced maxfiles from maxusers as well. There is a relationship of maxfiles with the callout callwheel though which has to be investigated some more to prevent ridiculous values from being chosen. -- Andre From owner-svn-src-user@FreeBSD.ORG Mon Nov 12 12:24:37 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 89BCB6D6; Mon, 12 Nov 2012 12:24:37 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6C6188FC08; Mon, 12 Nov 2012 12:24:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qACCOb2A013107; Mon, 12 Nov 2012 12:24:37 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qACCOaPf013085; Mon, 12 Nov 2012 12:24:36 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201211121224.qACCOaPf013085@svn.freebsd.org> From: Andre Oppermann Date: Mon, 12 Nov 2012 12:24:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r242912 - in user/andre/tcp_workqueue/sys: boot/pc98 boot/pc98/boot2 boot/pc98/btx/btx boot/pc98/libpc98 cddl/contrib/opensolaris/uts/common/fs/zfs cddl/contrib/opensolaris/uts/common/f... X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Nov 2012 12:24:37 -0000 Author: andre Date: Mon Nov 12 12:24:36 2012 New Revision: 242912 URL: http://svnweb.freebsd.org/changeset/base/242912 Log: Integrate from HEAD @242911. Modified: user/andre/tcp_workqueue/sys/boot/pc98/Makefile.inc user/andre/tcp_workqueue/sys/boot/pc98/boot2/boot2.c user/andre/tcp_workqueue/sys/boot/pc98/btx/btx/btx.S user/andre/tcp_workqueue/sys/boot/pc98/libpc98/comconsole.c user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c user/andre/tcp_workqueue/sys/conf/Makefile.pc98 user/andre/tcp_workqueue/sys/conf/files user/andre/tcp_workqueue/sys/conf/kern.pre.mk user/andre/tcp_workqueue/sys/dev/ath/if_ath.c user/andre/tcp_workqueue/sys/dev/ath/if_ath_sysctl.c user/andre/tcp_workqueue/sys/dev/ath/if_ath_tx_edma.c user/andre/tcp_workqueue/sys/dev/ath/if_athvar.h user/andre/tcp_workqueue/sys/dev/ct/bshw_machdep.c user/andre/tcp_workqueue/sys/dev/ct/ct.c user/andre/tcp_workqueue/sys/dev/ct/ct_isa.c user/andre/tcp_workqueue/sys/dev/ct/ct_machdep.h user/andre/tcp_workqueue/sys/dev/nve/if_nve.c user/andre/tcp_workqueue/sys/dev/snc/dp83932.c user/andre/tcp_workqueue/sys/dev/snc/dp83932subr.c user/andre/tcp_workqueue/sys/dev/snc/if_snc.c user/andre/tcp_workqueue/sys/dev/snc/if_snc_cbus.c user/andre/tcp_workqueue/sys/dev/usb/serial/u3g.c user/andre/tcp_workqueue/sys/dev/usb/usbdevs user/andre/tcp_workqueue/sys/dev/xen/netback/netback_unit_tests.c user/andre/tcp_workqueue/sys/fs/cd9660/cd9660_vfsops.c user/andre/tcp_workqueue/sys/fs/devfs/devfs_vfsops.c user/andre/tcp_workqueue/sys/fs/ext2fs/ext2_vfsops.c user/andre/tcp_workqueue/sys/fs/fdescfs/fdesc_vfsops.c user/andre/tcp_workqueue/sys/fs/fuse/fuse_vfsops.c user/andre/tcp_workqueue/sys/fs/msdosfs/msdosfs_vfsops.c user/andre/tcp_workqueue/sys/fs/nandfs/nandfs_vfsops.c user/andre/tcp_workqueue/sys/fs/nfsclient/nfs_clvfsops.c user/andre/tcp_workqueue/sys/fs/nullfs/null_vfsops.c user/andre/tcp_workqueue/sys/fs/pseudofs/pseudofs.c user/andre/tcp_workqueue/sys/fs/tmpfs/tmpfs_vfsops.c user/andre/tcp_workqueue/sys/fs/udf/udf_vfsops.c user/andre/tcp_workqueue/sys/fs/unionfs/union_vfsops.c user/andre/tcp_workqueue/sys/fs/unionfs/union_vnops.c user/andre/tcp_workqueue/sys/gnu/fs/reiserfs/reiserfs_vfsops.c user/andre/tcp_workqueue/sys/i386/include/vmparam.h user/andre/tcp_workqueue/sys/kern/kern_mbuf.c user/andre/tcp_workqueue/sys/kern/sched_ule.c user/andre/tcp_workqueue/sys/kern/subr_param.c user/andre/tcp_workqueue/sys/kern/uipc_mqueue.c user/andre/tcp_workqueue/sys/kern/vfs_subr.c user/andre/tcp_workqueue/sys/modules/mthca/Makefile user/andre/tcp_workqueue/sys/netinet/tcp_timewait.c user/andre/tcp_workqueue/sys/netpfil/ipfw/ip_fw_dynamic.c user/andre/tcp_workqueue/sys/nfsclient/nfs_vfsops.c user/andre/tcp_workqueue/sys/ofed/include/linux/cdev.h user/andre/tcp_workqueue/sys/pc98/include/bus.h user/andre/tcp_workqueue/sys/pc98/pc98/machdep.c user/andre/tcp_workqueue/sys/powerpc/include/bat.h user/andre/tcp_workqueue/sys/sys/_mutex.h user/andre/tcp_workqueue/sys/sys/_rwlock.h user/andre/tcp_workqueue/sys/sys/mount.h user/andre/tcp_workqueue/sys/ufs/ffs/ffs_vfsops.c user/andre/tcp_workqueue/sys/vm/vm_map.c Directory Properties: user/andre/tcp_workqueue/sys/ (props changed) user/andre/tcp_workqueue/sys/boot/ (props changed) user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/ (props changed) user/andre/tcp_workqueue/sys/conf/ (props changed) Modified: user/andre/tcp_workqueue/sys/boot/pc98/Makefile.inc ============================================================================== --- user/andre/tcp_workqueue/sys/boot/pc98/Makefile.inc Mon Nov 12 09:50:26 2012 (r242911) +++ user/andre/tcp_workqueue/sys/boot/pc98/Makefile.inc Mon Nov 12 12:24:36 2012 (r242912) @@ -5,9 +5,9 @@ BINDIR?= /boot LOADER_ADDRESS?=0x200000 -CFLAGS+= -ffreestanding -mpreferred-stack-boundary=2 \ - -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float \ - -Os -DPC98 +CFLAGS+= -march=i386 -ffreestanding -mpreferred-stack-boundary=2 \ + -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float +CFLAGS+= -Os -DPC98 LDFLAGS+= -nostdlib # BTX components Modified: user/andre/tcp_workqueue/sys/boot/pc98/boot2/boot2.c ============================================================================== --- user/andre/tcp_workqueue/sys/boot/pc98/boot2/boot2.c Mon Nov 12 09:50:26 2012 (r242911) +++ user/andre/tcp_workqueue/sys/boot/pc98/boot2/boot2.c Mon Nov 12 12:24:36 2012 (r242912) @@ -554,8 +554,10 @@ parse() } ioctrl = OPT_CHECK(RBX_DUAL) ? (IO_SERIAL|IO_KEYBOARD) : OPT_CHECK(RBX_SERIAL) ? IO_SERIAL : IO_KEYBOARD; - if (ioctrl & IO_SERIAL) - sio_init(115200 / comspeed); + if (ioctrl & IO_SERIAL) { + if (sio_init(115200 / comspeed) != 0) + ioctrl &= ~IO_SERIAL; + } } else { for (q = arg--; *q && *q != '('; q++); if (*q) { Modified: user/andre/tcp_workqueue/sys/boot/pc98/btx/btx/btx.S ============================================================================== --- user/andre/tcp_workqueue/sys/boot/pc98/btx/btx/btx.S Mon Nov 12 09:50:26 2012 (r242911) +++ user/andre/tcp_workqueue/sys/boot/pc98/btx/btx/btx.S Mon Nov 12 12:24:36 2012 (r242912) @@ -840,7 +840,7 @@ putstr: lodsb # Load char .set SIO_DIV,(115200/SIOSPD) # 115200 / SPD /* - * void sio_init(void) + * int sio_init(void) */ sio_init: movw $SIO_PRT+0x3,%dx # Data format reg movb $SIO_FMT|0x80,%al # Set format @@ -856,14 +856,19 @@ sio_init: movw $SIO_PRT+0x3,%dx # Data movb $0x3,%al # Set RTS, outb %al,(%dx) # DTR incl %edx # Line status reg + call sio_getc.1 # Get character /* - * void sio_flush(void) + * int sio_flush(void) */ -sio_flush.0: call sio_getc.1 # Get character -sio_flush: call sio_ischar # Check for character - jnz sio_flush.0 # Till none - ret # To caller +sio_flush: xorl %eax,%eax # Return value + xorl %ecx,%ecx # Timeout + movb $0x80,%ch # counter +sio_flush.1: call sio_ischar # Check for character + jz sio_flush.2 # Till none + loop sio_flush.1 # or counter is zero + movb $1, %al # Exhausted all tries +sio_flush.2: ret # To caller /* * void sio_putc(int c) Modified: user/andre/tcp_workqueue/sys/boot/pc98/libpc98/comconsole.c ============================================================================== --- user/andre/tcp_workqueue/sys/boot/pc98/libpc98/comconsole.c Mon Nov 12 09:50:26 2012 (r242911) +++ user/andre/tcp_workqueue/sys/boot/pc98/libpc98/comconsole.c Mon Nov 12 12:24:36 2012 (r242912) @@ -63,7 +63,6 @@ static void comc_setup(int speed, int po static int comc_speed_set(struct env_var *ev, int flags, const void *value); -static int comc_started; static int comc_curspeed; static int comc_port = COMPORT; static uint32_t comc_locator; @@ -87,9 +86,6 @@ comc_probe(struct console *cp) int speed, port; uint32_t locator; - /* XXX check the BIOS equipment list? */ - cp->c_flags |= (C_PRESENTIN | C_PRESENTOUT); - if (comc_curspeed == 0) { comc_curspeed = COMSPEED; /* @@ -137,18 +133,19 @@ comc_probe(struct console *cp) env_setenv("comconsole_pcidev", EV_VOLATILE, env, comc_pcidev_set, env_nounset); } + comc_setup(comc_curspeed, comc_port); } static int comc_init(int arg) { - if (comc_started && arg == 0) - return 0; - comc_started = 1; comc_setup(comc_curspeed, comc_port); - return(0); + if ((comconsole.c_flags & (C_PRESENTIN | C_PRESENTOUT)) == + (C_PRESENTIN | C_PRESENTOUT)) + return (CMD_OK); + return (CMD_ERROR); } static void @@ -166,13 +163,13 @@ comc_putchar(int c) static int comc_getchar(void) { - return(comc_ischar() ? inb(comc_port + com_data) : -1); + return (comc_ischar() ? inb(comc_port + com_data) : -1); } static int comc_ischar(void) { - return(inb(comc_port + com_lsr) & LSR_RXRDY); + return (inb(comc_port + com_lsr) & LSR_RXRDY); } static int @@ -185,7 +182,8 @@ comc_speed_set(struct env_var *ev, int f return (CMD_ERROR); } - if (comc_started && comc_curspeed != speed) + if ((comconsole.c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) != 0 && + comc_curspeed != speed) comc_setup(speed, comc_port); env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); @@ -203,7 +201,8 @@ comc_port_set(struct env_var *ev, int fl return (CMD_ERROR); } - if (comc_started && comc_port != port) { + if ((comconsole.c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) != 0 && + comc_port != port) { comc_setup(comc_curspeed, port); set_hw_console_hint(); } @@ -305,7 +304,8 @@ comc_pcidev_set(struct env_var *ev, int printf("Invalid pcidev\n"); return (CMD_ERROR); } - if (comc_started && comc_locator != locator) { + if ((comconsole.c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) != 0 && + comc_locator != locator) { error = comc_pcidev_handle(locator); if (error != CMD_OK) return (error); @@ -317,6 +317,8 @@ comc_pcidev_set(struct env_var *ev, int static void comc_setup(int speed, int port) { + static int TRY_COUNT = 1000000; + int tries; comc_curspeed = speed; comc_port = port; @@ -327,9 +329,15 @@ comc_setup(int speed, int port) outb(comc_port + com_cfcr, COMC_FMT); outb(comc_port + com_mcr, MCR_RTS | MCR_DTR); + tries = 0; do inb(comc_port + com_data); - while (inb(comc_port + com_lsr) & LSR_RXRDY); + while (inb(comc_port + com_lsr) & LSR_RXRDY && ++tries < TRY_COUNT); + + if (tries < TRY_COUNT) + comconsole.c_flags |= (C_PRESENTIN | C_PRESENTOUT); + else + comconsole.c_flags &= ~(C_PRESENTIN | C_PRESENTOUT); } static int Modified: user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Mon Nov 12 09:50:26 2012 (r242911) +++ user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Mon Nov 12 12:24:36 2012 (r242912) @@ -191,6 +191,7 @@ uint64_t zfs_arc_meta_limit = 0; int zfs_arc_grow_retry = 0; int zfs_arc_shrink_shift = 0; int zfs_arc_p_min_shift = 0; +int zfs_disable_dup_eviction = 0; TUNABLE_QUAD("vfs.zfs.arc_max", &zfs_arc_max); TUNABLE_QUAD("vfs.zfs.arc_min", &zfs_arc_min); @@ -321,7 +322,6 @@ typedef struct arc_stats { kstat_named_t arcstat_l2_io_error; kstat_named_t arcstat_l2_size; kstat_named_t arcstat_l2_hdr_size; - kstat_named_t arcstat_memory_throttle_count; kstat_named_t arcstat_l2_write_trylock_fail; kstat_named_t arcstat_l2_write_passed_headroom; kstat_named_t arcstat_l2_write_spa_mismatch; @@ -334,6 +334,10 @@ typedef struct arc_stats { kstat_named_t arcstat_l2_write_buffer_bytes_scanned; kstat_named_t arcstat_l2_write_buffer_list_iter; kstat_named_t arcstat_l2_write_buffer_list_null_iter; + kstat_named_t arcstat_memory_throttle_count; + kstat_named_t arcstat_duplicate_buffers; + kstat_named_t arcstat_duplicate_buffers_size; + kstat_named_t arcstat_duplicate_reads; } arc_stats_t; static arc_stats_t arc_stats = { @@ -391,7 +395,6 @@ static arc_stats_t arc_stats = { { "l2_io_error", KSTAT_DATA_UINT64 }, { "l2_size", KSTAT_DATA_UINT64 }, { "l2_hdr_size", KSTAT_DATA_UINT64 }, - { "memory_throttle_count", KSTAT_DATA_UINT64 }, { "l2_write_trylock_fail", KSTAT_DATA_UINT64 }, { "l2_write_passed_headroom", KSTAT_DATA_UINT64 }, { "l2_write_spa_mismatch", KSTAT_DATA_UINT64 }, @@ -403,7 +406,11 @@ static arc_stats_t arc_stats = { { "l2_write_pios", KSTAT_DATA_UINT64 }, { "l2_write_buffer_bytes_scanned", KSTAT_DATA_UINT64 }, { "l2_write_buffer_list_iter", KSTAT_DATA_UINT64 }, - { "l2_write_buffer_list_null_iter", KSTAT_DATA_UINT64 } + { "l2_write_buffer_list_null_iter", KSTAT_DATA_UINT64 }, + { "memory_throttle_count", KSTAT_DATA_UINT64 }, + { "duplicate_buffers", KSTAT_DATA_UINT64 }, + { "duplicate_buffers_size", KSTAT_DATA_UINT64 }, + { "duplicate_reads", KSTAT_DATA_UINT64 } }; #define ARCSTAT(stat) (arc_stats.stat.value.ui64) @@ -1518,6 +1525,17 @@ arc_buf_clone(arc_buf_t *from) hdr->b_buf = buf; arc_get_data_buf(buf); bcopy(from->b_data, buf->b_data, size); + + /* + * This buffer already exists in the arc so create a duplicate + * copy for the caller. If the buffer is associated with user data + * then track the size and number of duplicates. These stats will be + * updated as duplicate buffers are created and destroyed. + */ + if (hdr->b_type == ARC_BUFC_DATA) { + ARCSTAT_BUMP(arcstat_duplicate_buffers); + ARCSTAT_INCR(arcstat_duplicate_buffers_size, size); + } hdr->b_datacnt += 1; return (buf); } @@ -1618,6 +1636,16 @@ arc_buf_destroy(arc_buf_t *buf, boolean_ ASSERT3U(state->arcs_size, >=, size); atomic_add_64(&state->arcs_size, -size); buf->b_data = NULL; + + /* + * If we're destroying a duplicate buffer make sure + * that the appropriate statistics are updated. + */ + if (buf->b_hdr->b_datacnt > 1 && + buf->b_hdr->b_type == ARC_BUFC_DATA) { + ARCSTAT_BUMPDOWN(arcstat_duplicate_buffers); + ARCSTAT_INCR(arcstat_duplicate_buffers_size, -size); + } ASSERT(buf->b_hdr->b_datacnt > 0); buf->b_hdr->b_datacnt -= 1; } @@ -1802,6 +1830,48 @@ arc_buf_size(arc_buf_t *buf) } /* + * Called from the DMU to determine if the current buffer should be + * evicted. In order to ensure proper locking, the eviction must be initiated + * from the DMU. Return true if the buffer is associated with user data and + * duplicate buffers still exist. + */ +boolean_t +arc_buf_eviction_needed(arc_buf_t *buf) +{ + arc_buf_hdr_t *hdr; + boolean_t evict_needed = B_FALSE; + + if (zfs_disable_dup_eviction) + return (B_FALSE); + + mutex_enter(&buf->b_evict_lock); + hdr = buf->b_hdr; + if (hdr == NULL) { + /* + * We are in arc_do_user_evicts(); let that function + * perform the eviction. + */ + ASSERT(buf->b_data == NULL); + mutex_exit(&buf->b_evict_lock); + return (B_FALSE); + } else if (buf->b_data == NULL) { + /* + * We have already been added to the arc eviction list; + * recommend eviction. + */ + ASSERT3P(hdr, ==, &arc_eviction_hdr); + mutex_exit(&buf->b_evict_lock); + return (B_TRUE); + } + + if (hdr->b_datacnt > 1 && hdr->b_type == ARC_BUFC_DATA) + evict_needed = B_TRUE; + + mutex_exit(&buf->b_evict_lock); + return (evict_needed); +} + +/* * Evict buffers from list until we've removed the specified number of * bytes. Move the removed buffers to the appropriate evict state. * If the recycle flag is set, then attempt to "recycle" a buffer: @@ -2887,8 +2957,10 @@ arc_read_done(zio_t *zio) abuf = buf; for (acb = callback_list; acb; acb = acb->acb_next) { if (acb->acb_done) { - if (abuf == NULL) + if (abuf == NULL) { + ARCSTAT_BUMP(arcstat_duplicate_reads); abuf = arc_buf_clone(buf); + } acb->acb_buf = abuf; abuf = NULL; } @@ -3434,6 +3506,16 @@ arc_release(arc_buf_t *buf, void *tag) ASSERT3U(*size, >=, hdr->b_size); atomic_add_64(size, -hdr->b_size); } + + /* + * We're releasing a duplicate user data buffer, update + * our statistics accordingly. + */ + if (hdr->b_type == ARC_BUFC_DATA) { + ARCSTAT_BUMPDOWN(arcstat_duplicate_buffers); + ARCSTAT_INCR(arcstat_duplicate_buffers_size, + -hdr->b_size); + } hdr->b_datacnt -= 1; arc_cksum_verify(buf); #ifdef illumos Modified: user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Mon Nov 12 09:50:26 2012 (r242911) +++ user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Mon Nov 12 12:24:36 2012 (r242912) @@ -2089,7 +2089,24 @@ dbuf_rele_and_unlock(dmu_buf_impl_t *db, dbuf_evict(db); } else { VERIFY(arc_buf_remove_ref(db->db_buf, db) == 0); - if (!DBUF_IS_CACHEABLE(db)) + + /* + * A dbuf will be eligible for eviction if either the + * 'primarycache' property is set or a duplicate + * copy of this buffer is already cached in the arc. + * + * In the case of the 'primarycache' a buffer + * is considered for eviction if it matches the + * criteria set in the property. + * + * To decide if our buffer is considered a + * duplicate, we must call into the arc to determine + * if multiple buffers are referencing the same + * block on-disk. If so, then we simply evict + * ourselves. + */ + if (!DBUF_IS_CACHEABLE(db) || + arc_buf_eviction_needed(db->db_buf)) dbuf_clear(db); else mutex_exit(&db->db_mtx); Modified: user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h ============================================================================== --- user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Mon Nov 12 09:50:26 2012 (r242911) +++ user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Mon Nov 12 12:24:36 2012 (r242912) @@ -99,6 +99,7 @@ int arc_released(arc_buf_t *buf); int arc_has_callback(arc_buf_t *buf); void arc_buf_freeze(arc_buf_t *buf); void arc_buf_thaw(arc_buf_t *buf); +boolean_t arc_buf_eviction_needed(arc_buf_t *buf); #ifdef ZFS_DEBUG int arc_referenced(arc_buf_t *buf); #endif Modified: user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Mon Nov 12 09:50:26 2012 (r242911) +++ user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Mon Nov 12 12:24:36 2012 (r242912) @@ -3245,6 +3245,7 @@ zfs_ioc_destroy_snaps_nvl(zfs_cmd_t *zc) } (void) zfs_unmount_snap(name, NULL); + (void) zvol_remove_minor(name); } err = dmu_snapshots_destroy_nvl(nvl, zc->zc_defer_destroy, Modified: user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Mon Nov 12 09:50:26 2012 (r242911) +++ user/andre/tcp_workqueue/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Mon Nov 12 12:24:36 2012 (r242912) @@ -1132,7 +1132,6 @@ zfs_domount(vfs_t *vfsp, char *osname) vfsp->vfs_data = zfsvfs; vfsp->mnt_flag |= MNT_LOCAL; - vfsp->mnt_kern_flag |= MNTK_MPSAFE; vfsp->mnt_kern_flag |= MNTK_LOOKUP_SHARED; vfsp->mnt_kern_flag |= MNTK_SHARED_WRITES; vfsp->mnt_kern_flag |= MNTK_EXTENDED_SHARED; Modified: user/andre/tcp_workqueue/sys/conf/Makefile.pc98 ============================================================================== --- user/andre/tcp_workqueue/sys/conf/Makefile.pc98 Mon Nov 12 09:50:26 2012 (r242911) +++ user/andre/tcp_workqueue/sys/conf/Makefile.pc98 Mon Nov 12 12:24:36 2012 (r242912) @@ -34,6 +34,10 @@ MACHINE=pc98 MKMODULESENV+= MACHINE=${MACHINE} +# XXX: clang integrated-as doesn't grok .codeNN directives yet +ASM_CFLAGS.mpboot.s= ${CLANG_NO_IAS} +ASM_CFLAGS+= ${ASM_CFLAGS.${.IMPSRC:T}} + %BEFORE_DEPEND %OBJS Modified: user/andre/tcp_workqueue/sys/conf/files ============================================================================== --- user/andre/tcp_workqueue/sys/conf/files Mon Nov 12 09:50:26 2012 (r242911) +++ user/andre/tcp_workqueue/sys/conf/files Mon Nov 12 12:24:36 2012 (r242912) @@ -1163,15 +1163,14 @@ dev/drm/mach64_state.c optional mach64d dev/drm/mga_dma.c optional mgadrm dev/drm/mga_drv.c optional mgadrm dev/drm/mga_irq.c optional mgadrm -dev/drm/mga_state.c optional mgadrm \ - compile-with "${NORMAL_C} -finline-limit=13500" +dev/drm/mga_state.c optional mgadrm dev/drm/mga_warp.c optional mgadrm dev/drm/r128_cce.c optional r128drm \ compile-with "${NORMAL_C} ${NO_WUNUSED_VALUE} ${NO_WCONSTANT_CONVERSION}" dev/drm/r128_drv.c optional r128drm dev/drm/r128_irq.c optional r128drm dev/drm/r128_state.c optional r128drm \ - compile-with "${NORMAL_C} ${NO_WUNUSED_VALUE} -finline-limit=13500" + compile-with "${NORMAL_C} ${NO_WUNUSED_VALUE}" dev/drm/r300_cmdbuf.c optional radeondrm dev/drm/r600_blit.c optional radeondrm dev/drm/r600_cp.c optional radeondrm \ Modified: user/andre/tcp_workqueue/sys/conf/kern.pre.mk ============================================================================== --- user/andre/tcp_workqueue/sys/conf/kern.pre.mk Mon Nov 12 09:50:26 2012 (r242911) +++ user/andre/tcp_workqueue/sys/conf/kern.pre.mk Mon Nov 12 12:24:36 2012 (r242912) @@ -156,7 +156,7 @@ NORMAL_LINT= ${LINT} ${LINTFLAGS} ${CFLA # Infiniband C flags. Correct include paths and omit errors that linux # does not honor. OFEDINCLUDES= -I$S/ofed/include/ -OFEDNOERR= -Wno-cast-qual -Wno-pointer-arith -fms-extensions +OFEDNOERR= -Wno-cast-qual -Wno-pointer-arith -fms-extensions -Wno-switch -Wno-sometimes-uninitialized -Wno-conversion -Wno-initializer-overrides OFEDCFLAGS= ${CFLAGS:N-I*} ${OFEDINCLUDES} ${CFLAGS:M-I*} ${OFEDNOERR} OFED_C_NOIMP= ${CC} -c -o ${.TARGET} ${OFEDCFLAGS} ${WERROR} ${PROF} OFED_C= ${OFED_C_NOIMP} ${.IMPSRC} Modified: user/andre/tcp_workqueue/sys/dev/ath/if_ath.c ============================================================================== --- user/andre/tcp_workqueue/sys/dev/ath/if_ath.c Mon Nov 12 09:50:26 2012 (r242911) +++ user/andre/tcp_workqueue/sys/dev/ath/if_ath.c Mon Nov 12 12:24:36 2012 (r242912) @@ -5598,6 +5598,13 @@ ath_node_set_tim(struct ieee80211_node * #else struct ath_vap *avp = ATH_VAP(ni->ni_vap); + /* + * Some operating omdes don't set av_set_tim(), so don't + * update it here. + */ + if (avp->av_set_tim == NULL) + return (0); + return (avp->av_set_tim(ni, enable)); #endif /* ATH_SW_PSQ */ } Modified: user/andre/tcp_workqueue/sys/dev/ath/if_ath_sysctl.c ============================================================================== --- user/andre/tcp_workqueue/sys/dev/ath/if_ath_sysctl.c Mon Nov 12 09:50:26 2012 (r242911) +++ user/andre/tcp_workqueue/sys/dev/ath/if_ath_sysctl.c Mon Nov 12 12:24:36 2012 (r242912) @@ -711,7 +711,7 @@ ath_sysctlattach(struct ath_softc *sc) } #endif -#ifdef ATH_DEBUG +#ifdef ATH_DEBUG_ALQ ath_sysctl_alq_attach(sc); #endif } Modified: user/andre/tcp_workqueue/sys/dev/ath/if_ath_tx_edma.c ============================================================================== --- user/andre/tcp_workqueue/sys/dev/ath/if_ath_tx_edma.c Mon Nov 12 09:50:26 2012 (r242911) +++ user/andre/tcp_workqueue/sys/dev/ath/if_ath_tx_edma.c Mon Nov 12 12:24:36 2012 (r242912) @@ -594,13 +594,26 @@ ath_edma_tx_processq(struct ath_softc *s * in the TX descriptor. However the TX completion * FIFO doesn't have this information. So here we * do a separate HAL call to populate that information. + * + * The same problem exists with ts_longretry. + * The FreeBSD HAL corrects ts_longretry in the HAL layer; + * the AR9380 HAL currently doesn't. So until the HAL + * is imported and this can be added, we correct for it + * here. */ - /* XXX TODO */ /* XXX faked for now. Ew. */ if (ts.ts_finaltsi < 4) { ts.ts_rate = bf->bf_state.bfs_rc[ts.ts_finaltsi].ratecode; + switch (ts.ts_finaltsi) { + case 3: ts.ts_longretry += + bf->bf_state.bfs_rc[2].tries; + case 2: ts.ts_longretry += + bf->bf_state.bfs_rc[1].tries; + case 1: ts.ts_longretry += + bf->bf_state.bfs_rc[0].tries; + } } else { device_printf(sc->sc_dev, "%s: finaltsi=%d\n", __func__, Modified: user/andre/tcp_workqueue/sys/dev/ath/if_athvar.h ============================================================================== --- user/andre/tcp_workqueue/sys/dev/ath/if_athvar.h Mon Nov 12 09:50:26 2012 (r242911) +++ user/andre/tcp_workqueue/sys/dev/ath/if_athvar.h Mon Nov 12 12:24:36 2012 (r242912) @@ -774,7 +774,7 @@ struct ath_softc { struct task sc_dfstask; /* DFS processing task */ /* ALQ */ -#ifdef ATH_DEBUG +#ifdef ATH_DEBUG_ALQ struct if_ath_alq sc_alq; #endif Modified: user/andre/tcp_workqueue/sys/dev/ct/bshw_machdep.c ============================================================================== --- user/andre/tcp_workqueue/sys/dev/ct/bshw_machdep.c Mon Nov 12 09:50:26 2012 (r242911) +++ user/andre/tcp_workqueue/sys/dev/ct/bshw_machdep.c Mon Nov 12 12:24:36 2012 (r242912) @@ -78,9 +78,7 @@ typedef unsigned long vaddr_t; * GENERIC MACHDEP FUNCTIONS *********************************************************/ void -bshw_synch_setup(ct, ti) - struct ct_softc *ct; - struct targ_info *ti; +bshw_synch_setup(struct ct_softc *ct, struct targ_info *ti) { struct ct_bus_access_handle *chp = &ct->sc_ch; struct ct_targ_info *cti = (void *) ti; @@ -99,8 +97,7 @@ bshw_synch_setup(ct, ti) } void -bshw_bus_reset(ct) - struct ct_softc *ct; +bshw_bus_reset(struct ct_softc *ct) { struct scsi_low_softc *slp = &ct->sc_sclow; struct ct_bus_access_handle *chp = &ct->sc_ch; @@ -149,9 +146,7 @@ bshw_bus_reset(ct) /* probe */ int -bshw_read_settings(chp, bs) - struct ct_bus_access_handle *chp; - struct bshw_softc *bs; +bshw_read_settings(struct ct_bus_access_handle *chp, struct bshw_softc *bs) { static int irq_tbl[] = { 3, 5, 6, 9, 12, 13 }; @@ -183,8 +178,7 @@ static __inline void bshw_lc_smit_stop(s static int bshw_lc_smit_fstat(struct ct_softc *, int, int); static __inline void -bshw_lc_smit_stop(ct) - struct ct_softc *ct; +bshw_lc_smit_stop(struct ct_softc *ct) { struct ct_bus_access_handle *chp = &ct->sc_ch; @@ -193,10 +187,7 @@ bshw_lc_smit_stop(ct) } static __inline void -bshw_lc_smit_start(ct, count, direction) - struct ct_softc *ct; - int count; - u_int direction; +bshw_lc_smit_start(struct ct_softc *ct, int count, u_int direction) { struct ct_bus_access_handle *chp = &ct->sc_ch; u_int8_t pval, val; @@ -212,9 +203,7 @@ bshw_lc_smit_start(ct, count, direction) } static int -bshw_lc_smit_fstat(ct, wc, read) - struct ct_softc *ct; - int wc, read; +bshw_lc_smit_fstat(struct ct_softc *ct, int wc, int read) { struct ct_bus_access_handle *chp = &ct->sc_ch; u_int8_t stat; @@ -244,8 +233,7 @@ bshw_lc_smit_fstat(ct, wc, read) } void -bshw_smit_xfer_stop(ct) - struct ct_softc *ct; +bshw_smit_xfer_stop(struct ct_softc *ct) { struct scsi_low_softc *slp = &ct->sc_sclow; struct bshw_softc *bs = ct->ct_hw; @@ -292,8 +280,7 @@ bad: } int -bshw_smit_xfer_start(ct) - struct ct_softc *ct; +bshw_smit_xfer_start(struct ct_softc *ct) { struct scsi_low_softc *slp = &ct->sc_sclow; struct ct_bus_access_handle *chp = &ct->sc_ch; @@ -396,8 +383,7 @@ static void bshw_dmastart(struct ct_soft static void bshw_dmadone(struct ct_softc *); int -bshw_dma_xfer_start(ct) - struct ct_softc *ct; +bshw_dma_xfer_start(struct ct_softc *ct) { struct scsi_low_softc *slp = &ct->sc_sclow; struct sc_p *sp = &slp->sl_scp; @@ -458,8 +444,7 @@ bshw_dma_xfer_start(ct) } void -bshw_dma_xfer_stop(ct) - struct ct_softc *ct; +bshw_dma_xfer_stop(struct ct_softc *ct) { struct scsi_low_softc *slp = &ct->sc_sclow; struct sc_p *sp = &slp->sl_scp; @@ -523,10 +508,8 @@ bshw_dma_xfer_stop(ct) static bus_addr_t dmapageport[4] = { 0x27, 0x21, 0x23, 0x25 }; static __inline void -bshw_dma_write_1(chp, port, val) - struct ct_bus_access_handle *chp; - bus_addr_t port; - u_int8_t val; +bshw_dma_write_1(struct ct_bus_access_handle *chp, bus_addr_t port, + u_int8_t val) { CT_BUS_WEIGHT(chp); @@ -534,8 +517,7 @@ bshw_dma_write_1(chp, port, val) } static void -bshw_dmastart(ct) - struct ct_softc *ct; +bshw_dmastart(struct ct_softc *ct) { struct scsi_low_softc *slp = &ct->sc_sclow; struct bshw_softc *bs = ct->ct_hw; @@ -581,8 +563,7 @@ bshw_dmastart(ct) } static void -bshw_dmadone(ct) - struct ct_softc *ct; +bshw_dmadone(struct ct_softc *ct) { struct bshw_softc *bs = ct->ct_hw; struct ct_bus_access_handle *chp = &ct->sc_ch; @@ -609,8 +590,7 @@ static void bshw_dma_start_elecom(struct static void bshw_dma_stop_elecom(struct ct_softc *); static int -bshw_dma_init_texa(ct) - struct ct_softc *ct; +bshw_dma_init_texa(struct ct_softc *ct) { struct ct_bus_access_handle *chp = &ct->sc_ch; u_int8_t regval; @@ -625,8 +605,7 @@ bshw_dma_init_texa(ct) } static int -bshw_dma_init_sc98(ct) - struct ct_softc *ct; +bshw_dma_init_sc98(struct ct_softc *ct) { struct ct_bus_access_handle *chp = &ct->sc_ch; @@ -652,8 +631,7 @@ bshw_dma_init_sc98(ct) } static void -bshw_dma_start_sc98(ct) - struct ct_softc *ct; +bshw_dma_start_sc98(struct ct_softc *ct) { struct ct_bus_access_handle *chp = &ct->sc_ch; @@ -662,8 +640,7 @@ bshw_dma_start_sc98(ct) } static void -bshw_dma_stop_sc98(ct) - struct ct_softc *ct; +bshw_dma_stop_sc98(struct ct_softc *ct) { struct ct_bus_access_handle *chp = &ct->sc_ch; @@ -672,8 +649,7 @@ bshw_dma_stop_sc98(ct) } static void -bshw_dma_start_elecom(ct) - struct ct_softc *ct; +bshw_dma_start_elecom(struct ct_softc *ct) { struct ct_bus_access_handle *chp = &ct->sc_ch; u_int8_t tmp = ct_cr_read_1(chp, 0x4c); @@ -682,8 +658,7 @@ bshw_dma_start_elecom(ct) } static void -bshw_dma_stop_elecom(ct) - struct ct_softc *ct; +bshw_dma_stop_elecom(struct ct_softc *ct) { struct ct_bus_access_handle *chp = &ct->sc_ch; u_int8_t tmp = ct_cr_read_1(chp, 0x4c); Modified: user/andre/tcp_workqueue/sys/dev/ct/ct.c ============================================================================== --- user/andre/tcp_workqueue/sys/dev/ct/ct.c Mon Nov 12 09:50:26 2012 (r242911) +++ user/andre/tcp_workqueue/sys/dev/ct/ct.c Mon Nov 12 12:24:36 2012 (r242912) @@ -164,9 +164,7 @@ struct scsi_low_funcs ct_funcs = { * HW functions **************************************************/ static __inline void -cthw_phase_bypass(ct, ph) - struct ct_softc *ct; - u_int8_t ph; +cthw_phase_bypass(struct ct_softc *ct, u_int8_t ph) { struct ct_bus_access_handle *chp = &ct->sc_ch; @@ -175,8 +173,7 @@ cthw_phase_bypass(ct, ph) } static void -cthw_bus_reset(ct) - struct ct_softc *ct; +cthw_bus_reset(struct ct_softc *ct) { /* @@ -187,10 +184,8 @@ cthw_bus_reset(ct) } static int -cthw_chip_reset(chp, chiprevp, chipclk, hostid) - struct ct_bus_access_handle *chp; - int *chiprevp; - int chipclk, hostid; +cthw_chip_reset(struct ct_bus_access_handle *chp, int *chiprevp, int chipclk, + int hostid) { #define CT_SELTIMEOUT_20MHz_REGV (0x80) u_int8_t aux, regv; @@ -285,8 +280,7 @@ out: } static struct ct_synch_data * -ct_make_synch_table(ct) - struct ct_softc *ct; +ct_make_synch_table(struct ct_softc *ct) { struct ct_synch_data *sdtp, *sdp; u_int base, i, period; @@ -329,11 +323,8 @@ ct_make_synch_table(ct) * Attach & Probe **************************************************/ int -ctprobesubr(chp, dvcfg, hsid, chipclk, chiprevp) - struct ct_bus_access_handle *chp; - u_int dvcfg, chipclk; - int hsid; - int *chiprevp; +ctprobesubr(struct ct_bus_access_handle *chp, u_int dvcfg, int hsid, + u_int chipclk, int *chiprevp) { #if 0 @@ -346,8 +337,7 @@ ctprobesubr(chp, dvcfg, hsid, chipclk, c } void -ctattachsubr(ct) - struct ct_softc *ct; +ctattachsubr(struct ct_softc *ct) { struct scsi_low_softc *slp = &ct->sc_sclow; @@ -362,8 +352,7 @@ ctattachsubr(ct) * SCSI LOW interface functions **************************************************/ static void -cthw_attention(ct) - struct ct_softc *ct; +cthw_attention(struct ct_softc *ct) { struct ct_bus_access_handle *chp = &ct->sc_ch; @@ -380,8 +369,7 @@ cthw_attention(ct) } static void -ct_attention(ct) - struct ct_softc *ct; +ct_attention(struct ct_softc *ct) { struct scsi_low_softc *slp = &ct->sc_sclow; @@ -398,10 +386,7 @@ ct_attention(ct) } static int -ct_targ_init(ct, ti, action) - struct ct_softc *ct; - struct targ_info *ti; - int action; +ct_targ_init(struct ct_softc *ct, struct targ_info *ti, int action) { struct ct_targ_info *cti = (void *) ti; @@ -438,9 +423,7 @@ ct_targ_init(ct, ti, action) } static int -ct_world_start(ct, fdone) - struct ct_softc *ct; - int fdone; +ct_world_start(struct ct_softc *ct, int fdone) { struct scsi_low_softc *slp = &ct->sc_sclow; struct ct_bus_access_handle *chp = &ct->sc_ch; @@ -470,9 +453,7 @@ ct_world_start(ct, fdone) } static int -ct_start_selection(ct, cb) - struct ct_softc *ct; - struct slccb *cb; +ct_start_selection(struct ct_softc *ct, struct slccb *cb) { struct scsi_low_softc *slp = &ct->sc_sclow; struct ct_bus_access_handle *chp = &ct->sc_ch; @@ -544,10 +525,7 @@ ct_start_selection(ct, cb) } static int -ct_msg(ct, ti, msg) - struct ct_softc *ct; - struct targ_info *ti; - u_int msg; +ct_msg(struct ct_softc *ct, struct targ_info *ti, u_int msg) { struct ct_bus_access_handle *chp = &ct->sc_ch; struct ct_targ_info *cti = (void *) ti; @@ -599,11 +577,8 @@ ct_msg(ct, ti, msg) * *************************************************/ static int -ct_xfer(ct, data, len, direction, statp) - struct ct_softc *ct; - u_int8_t *data; - int len, direction; - u_int *statp; +ct_xfer(struct ct_softc *ct, u_int8_t *data, int len, int direction, + u_int *statp) { struct ct_bus_access_handle *chp = &ct->sc_ch; int wc; @@ -663,8 +638,7 @@ ct_xfer(ct, data, len, direction, statp) #define CT_PADDING_BUF_SIZE 32 static void -ct_io_xfer(ct) - struct ct_softc *ct; +ct_io_xfer(struct ct_softc *ct) { struct scsi_low_softc *slp = &ct->sc_sclow; struct ct_bus_access_handle *chp = &ct->sc_ch; @@ -716,9 +690,7 @@ struct ct_err ct_cmderr[] = { }; static void -ct_phase_error(ct, scsi_status) - struct ct_softc *ct; - u_int8_t scsi_status; +ct_phase_error(struct ct_softc *ct, u_int8_t scsi_status) { struct scsi_low_softc *slp = &ct->sc_sclow; struct targ_info *ti = slp->sl_Tnexus; @@ -764,9 +736,7 @@ ct_phase_error(ct, scsi_status) * ### SCSI PHASE SEQUENCER ### **************************************************/ static int -ct_reselected(ct, scsi_status) - struct ct_softc *ct; - u_int8_t scsi_status; +ct_reselected(struct ct_softc *ct, u_int8_t scsi_status) { struct scsi_low_softc *slp = &ct->sc_sclow; struct ct_bus_access_handle *chp = &ct->sc_ch; @@ -809,9 +779,7 @@ ct_reselected(ct, scsi_status) } static int -ct_target_nexus_establish(ct, lun, dir) - struct ct_softc *ct; - int lun, dir; +ct_target_nexus_establish(struct ct_softc *ct, int lun, int dir) { struct scsi_low_softc *slp = &ct->sc_sclow; struct ct_bus_access_handle *chp = &ct->sc_ch; @@ -831,8 +799,7 @@ ct_target_nexus_establish(ct, lun, dir) } static int -ct_lun_nexus_establish(ct) - struct ct_softc *ct; +ct_lun_nexus_establish(struct ct_softc *ct) { struct scsi_low_softc *slp = &ct->sc_sclow; struct ct_bus_access_handle *chp = &ct->sc_ch; @@ -843,8 +810,7 @@ ct_lun_nexus_establish(ct) } static int -ct_ccb_nexus_establish(ct) - struct ct_softc *ct; +ct_ccb_nexus_establish(struct ct_softc *ct) { struct scsi_low_softc *slp = &ct->sc_sclow; struct ct_bus_access_handle *chp = &ct->sc_ch; @@ -870,8 +836,7 @@ ct_ccb_nexus_establish(ct) } static int -ct_unbusy(ct) - struct ct_softc *ct; +ct_unbusy(struct ct_softc *ct) { struct scsi_low_softc *slp = &ct->sc_sclow; struct ct_bus_access_handle *chp = &ct->sc_ch; @@ -894,8 +859,7 @@ ct_unbusy(ct) } static int -ct_catch_intr(ct) - struct ct_softc *ct; +ct_catch_intr(struct ct_softc *ct) { struct ct_bus_access_handle *chp = &ct->sc_ch; int wc; @@ -913,8 +877,7 @@ ct_catch_intr(ct) } int -ctintr(arg) - void *arg; +ctintr(void *arg) { struct ct_softc *ct = arg; struct scsi_low_softc *slp = &ct->sc_sclow; Modified: user/andre/tcp_workqueue/sys/dev/ct/ct_isa.c ============================================================================== --- user/andre/tcp_workqueue/sys/dev/ct/ct_isa.c Mon Nov 12 09:50:26 2012 (r242911) +++ user/andre/tcp_workqueue/sys/dev/ct/ct_isa.c Mon Nov 12 12:24:36 2012 (r242912) @@ -367,16 +367,14 @@ ct_dmamap(void *arg, bus_dma_segment_t * } static void -ct_isa_bus_access_weight(chp) - struct ct_bus_access_handle *chp; +ct_isa_bus_access_weight(struct ct_bus_access_handle *chp) { outb(0x5f, 0); } static void -ct_isa_dmasync_before(ct) - struct ct_softc *ct; +ct_isa_dmasync_before(struct ct_softc *ct) { if (need_pre_dma_flush) @@ -384,8 +382,7 @@ ct_isa_dmasync_before(ct) } static void -ct_isa_dmasync_after(ct) - struct ct_softc *ct; +ct_isa_dmasync_after(struct ct_softc *ct) { if (need_post_dma_flush) Modified: user/andre/tcp_workqueue/sys/dev/ct/ct_machdep.h ============================================================================== --- user/andre/tcp_workqueue/sys/dev/ct/ct_machdep.h Mon Nov 12 09:50:26 2012 (r242911) +++ user/andre/tcp_workqueue/sys/dev/ct/ct_machdep.h Mon Nov 12 12:24:36 2012 (r242912) @@ -90,8 +90,7 @@ static __inline void cthw_set_count (struct ct_bus_access_handle *, u_int); static __inline u_int8_t -ct_stat_read_1(chp) - struct ct_bus_access_handle *chp; +ct_stat_read_1(struct ct_bus_access_handle *chp) { u_int8_t regv; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Mon Nov 12 15:52:58 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9E6B9E72; Mon, 12 Nov 2012 15:52:58 +0000 (UTC) (envelope-from bright@mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 73BF18FC17; Mon, 12 Nov 2012 15:52:57 +0000 (UTC) Received: from [10.0.1.17] (c-67-180-208-218.hsd1.ca.comcast.net [67.180.208.218]) by elvis.mu.org (Postfix) with ESMTPSA id F1A0D1A3CE6; Mon, 12 Nov 2012 07:52:50 -0800 (PST) References: <201211120847.qAC8lEAM086331@svn.freebsd.org> <50A0D420.4030106@freebsd.org> In-Reply-To: <50A0D420.4030106@freebsd.org> Mime-Version: 1.0 (1.0) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Message-Id: <0039CD42-C909-41D0-B0A7-7DFBC5B8D839@mu.org> X-Mailer: iPhone Mail (9B206) From: Alfred Perlstein Subject: Re: svn commit: r242910 - in user/andre/tcp_workqueue/sys: kern sys Date: Mon, 12 Nov 2012 07:52:48 -0800 To: Andre Oppermann Cc: "src-committers@freebsd.org" , "svn-src-user@freebsd.org" X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Nov 2012 15:52:58 -0000 If maxusers is set (loader.conf/config(8)) can you please revert to maxusers= based limits? Sent from my iPhone On Nov 12, 2012, at 2:49 AM, Andre Oppermann wrote: > On 12.11.2012 09:47, Andre Oppermann wrote: >> Author: andre >> Date: Mon Nov 12 08:47:13 2012 >> New Revision: 242910 >> URL: http://svnweb.freebsd.org/changeset/base/242910 >>=20 >> Log: >> Base the mbuf related limits on the available physical memory or >> kernel memory, whichever is lower. >=20 > The commit message is a bit terse so I'm going to explain in more > detail: >=20 > The overall mbuf related memory limit must be set so that mbufs > (and clusters of various sizes) can't exhaust physical RAM or KVM. >=20 > I've chosen a limit of half the physical RAM or KVM (whichever is > lower) as the baseline. In any normal scenario we want to leave > at least half of the physmem/kvm for other kernel functions and > userspace to prevent it from swapping like hell. Via a tunable > it can be upped to at most 3/4 of physmem/kvm. >=20 > Out of the overall mbuf memory limit I've chosen 2K clusters, 4K > (page size) clusters to get 1/4 each because these are the most > heavily used mbuf sizes. 2K clusters are used for MTU 1500 ethernet > inbound packets. 4K clusters are used whenever possible for sends > on sockets and thus outbound packets. >=20 > The larger cluster sizes of 9K and 16K are limited to 1/6 of the > overall mbuf memory limit. Again, when jumbo MTU's are used these > large clusters will end up only on the inbound path. They are not > used on outbound, there it's still 4K. Yes, that will stay that > way because otherwise we run into lots of complications in the > stack. And it really isn't a problem, so don't make a scene. >=20 > Previously the normal mbufs (256B) weren't limited at all. This > is wrong as there are certain places in the kernel that on allocation > failure of clusters try to piece together their packet from smaller > mbufs. The mbuf limit is the number of all other mbuf sizes together > plus some more to allow for standalone mbufs (ACK for example) and > to send off a copy of a cluster. FYI: Every cluster eventually also > has an mbuf associated with it. >=20 > Unfortunately there isn't a way to set an overall limit for all > mbuf memory together as UMA doesn't support such a limiting. >=20 > Lets work out a few examples on sizing: >=20 > 1GB KVM: > 512MB limit for mbufs > 419,430 mbufs > 65,536 2K mbuf clusters > 32,768 4K mbuf clusters > 9,709 9K mbuf clusters > 5,461 16K mbuf clusters >=20 > 16GB RAM: > 8GB limit for mbufs > 33,554,432 mbufs > 1,048,576 2K mbuf clusters > 524,288 4K mbuf clusters > 155,344 9K mbuf clusters > 87,381 16K mbuf clusters >=20 > These defaults should be sufficient for event the most demanding > network loads. If you do run into these limits you probably know > exactly what you are doing and you are expected to tune those > values for your particular purpose. >=20 > There is a side-issue with maxfiles as it relates to the maximum > number of sockets that can be opened at the same time. With web > servers and proxy caches of these days there may be some 100K or > more sockets open. Hence I've divorced maxfiles from maxusers as > well. There is a relationship of maxfiles with the callout callwheel > though which has to be investigated some more to prevent ridiculous > values from being chosen. >=20 > --=20 > Andre >=20 From owner-svn-src-user@FreeBSD.ORG Mon Nov 12 16:14:41 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0D46A498 for ; Mon, 12 Nov 2012 16:14:41 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id 621618FC0C for ; Mon, 12 Nov 2012 16:14:39 +0000 (UTC) Received: (qmail 11823 invoked from network); 12 Nov 2012 17:49:00 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 12 Nov 2012 17:49:00 -0000 Message-ID: <50A1206B.1000200@freebsd.org> Date: Mon, 12 Nov 2012 17:14:35 +0100 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 MIME-Version: 1.0 To: Alfred Perlstein Subject: Re: svn commit: r242910 - in user/andre/tcp_workqueue/sys: kern sys References: <201211120847.qAC8lEAM086331@svn.freebsd.org> <50A0D420.4030106@freebsd.org> <0039CD42-C909-41D0-B0A7-7DFBC5B8D839@mu.org> In-Reply-To: <0039CD42-C909-41D0-B0A7-7DFBC5B8D839@mu.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: "src-committers@freebsd.org" , "svn-src-user@freebsd.org" X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Nov 2012 16:14:41 -0000 On 12.11.2012 16:52, Alfred Perlstein wrote: > If maxusers is set (loader.conf/config(8)) can you please revert to maxusers based limits? No. That's way to complicated. -- Andre > Sent from my iPhone > > On Nov 12, 2012, at 2:49 AM, Andre Oppermann wrote: > >> On 12.11.2012 09:47, Andre Oppermann wrote: >>> Author: andre >>> Date: Mon Nov 12 08:47:13 2012 >>> New Revision: 242910 >>> URL: http://svnweb.freebsd.org/changeset/base/242910 >>> >>> Log: >>> Base the mbuf related limits on the available physical memory or >>> kernel memory, whichever is lower. >> >> The commit message is a bit terse so I'm going to explain in more >> detail: >> >> The overall mbuf related memory limit must be set so that mbufs >> (and clusters of various sizes) can't exhaust physical RAM or KVM. >> >> I've chosen a limit of half the physical RAM or KVM (whichever is >> lower) as the baseline. In any normal scenario we want to leave >> at least half of the physmem/kvm for other kernel functions and >> userspace to prevent it from swapping like hell. Via a tunable >> it can be upped to at most 3/4 of physmem/kvm. >> >> Out of the overall mbuf memory limit I've chosen 2K clusters, 4K >> (page size) clusters to get 1/4 each because these are the most >> heavily used mbuf sizes. 2K clusters are used for MTU 1500 ethernet >> inbound packets. 4K clusters are used whenever possible for sends >> on sockets and thus outbound packets. >> >> The larger cluster sizes of 9K and 16K are limited to 1/6 of the >> overall mbuf memory limit. Again, when jumbo MTU's are used these >> large clusters will end up only on the inbound path. They are not >> used on outbound, there it's still 4K. Yes, that will stay that >> way because otherwise we run into lots of complications in the >> stack. And it really isn't a problem, so don't make a scene. >> >> Previously the normal mbufs (256B) weren't limited at all. This >> is wrong as there are certain places in the kernel that on allocation >> failure of clusters try to piece together their packet from smaller >> mbufs. The mbuf limit is the number of all other mbuf sizes together >> plus some more to allow for standalone mbufs (ACK for example) and >> to send off a copy of a cluster. FYI: Every cluster eventually also >> has an mbuf associated with it. >> >> Unfortunately there isn't a way to set an overall limit for all >> mbuf memory together as UMA doesn't support such a limiting. >> >> Lets work out a few examples on sizing: >> >> 1GB KVM: >> 512MB limit for mbufs >> 419,430 mbufs >> 65,536 2K mbuf clusters >> 32,768 4K mbuf clusters >> 9,709 9K mbuf clusters >> 5,461 16K mbuf clusters >> >> 16GB RAM: >> 8GB limit for mbufs >> 33,554,432 mbufs >> 1,048,576 2K mbuf clusters >> 524,288 4K mbuf clusters >> 155,344 9K mbuf clusters >> 87,381 16K mbuf clusters >> >> These defaults should be sufficient for event the most demanding >> network loads. If you do run into these limits you probably know >> exactly what you are doing and you are expected to tune those >> values for your particular purpose. >> >> There is a side-issue with maxfiles as it relates to the maximum >> number of sockets that can be opened at the same time. With web >> servers and proxy caches of these days there may be some 100K or >> more sockets open. Hence I've divorced maxfiles from maxusers as >> well. There is a relationship of maxfiles with the callout callwheel >> though which has to be investigated some more to prevent ridiculous >> values from being chosen. >> >> -- >> Andre >> > > From owner-svn-src-user@FreeBSD.ORG Mon Nov 12 17:01:40 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9CDA4DBD; Mon, 12 Nov 2012 17:01:40 +0000 (UTC) (envelope-from bright@mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 6FDF38FC13; Mon, 12 Nov 2012 17:01:40 +0000 (UTC) Received: from [10.0.1.17] (c-67-180-208-218.hsd1.ca.comcast.net [67.180.208.218]) by elvis.mu.org (Postfix) with ESMTPSA id 86F711A3CEB; Mon, 12 Nov 2012 09:01:39 -0800 (PST) References: <201211120847.qAC8lEAM086331@svn.freebsd.org> <50A0D420.4030106@freebsd.org> <0039CD42-C909-41D0-B0A7-7DFBC5B8D839@mu.org> <50A1206B.1000200@freebsd.org> In-Reply-To: <50A1206B.1000200@freebsd.org> Mime-Version: 1.0 (1.0) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Message-Id: <3D373186-09E2-48BC-8451-E4439F99B29D@mu.org> X-Mailer: iPhone Mail (9B206) From: Alfred Perlstein Subject: Re: svn commit: r242910 - in user/andre/tcp_workqueue/sys: kern sys Date: Mon, 12 Nov 2012 09:01:37 -0800 To: Andre Oppermann Cc: "src-committers@freebsd.org" , "svn-src-user@freebsd.org" X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Nov 2012 17:01:40 -0000 I will take care of it then. Thank you.=20 Sent from my iPhone On Nov 12, 2012, at 8:14 AM, Andre Oppermann wrote: > On 12.11.2012 16:52, Alfred Perlstein wrote: >> If maxusers is set (loader.conf/config(8)) can you please revert to maxus= ers based limits? >=20 > No. That's way to complicated. >=20 > --=20 > Andre >=20 >> Sent from my iPhone >>=20 >> On Nov 12, 2012, at 2:49 AM, Andre Oppermann wrote: >>=20 >>> On 12.11.2012 09:47, Andre Oppermann wrote: >>>> Author: andre >>>> Date: Mon Nov 12 08:47:13 2012 >>>> New Revision: 242910 >>>> URL: http://svnweb.freebsd.org/changeset/base/242910 >>>>=20 >>>> Log: >>>> Base the mbuf related limits on the available physical memory or >>>> kernel memory, whichever is lower. >>>=20 >>> The commit message is a bit terse so I'm going to explain in more >>> detail: >>>=20 >>> The overall mbuf related memory limit must be set so that mbufs >>> (and clusters of various sizes) can't exhaust physical RAM or KVM. >>>=20 >>> I've chosen a limit of half the physical RAM or KVM (whichever is >>> lower) as the baseline. In any normal scenario we want to leave >>> at least half of the physmem/kvm for other kernel functions and >>> userspace to prevent it from swapping like hell. Via a tunable >>> it can be upped to at most 3/4 of physmem/kvm. >>>=20 >>> Out of the overall mbuf memory limit I've chosen 2K clusters, 4K >>> (page size) clusters to get 1/4 each because these are the most >>> heavily used mbuf sizes. 2K clusters are used for MTU 1500 ethernet >>> inbound packets. 4K clusters are used whenever possible for sends >>> on sockets and thus outbound packets. >>>=20 >>> The larger cluster sizes of 9K and 16K are limited to 1/6 of the >>> overall mbuf memory limit. Again, when jumbo MTU's are used these >>> large clusters will end up only on the inbound path. They are not >>> used on outbound, there it's still 4K. Yes, that will stay that >>> way because otherwise we run into lots of complications in the >>> stack. And it really isn't a problem, so don't make a scene. >>>=20 >>> Previously the normal mbufs (256B) weren't limited at all. This >>> is wrong as there are certain places in the kernel that on allocation >>> failure of clusters try to piece together their packet from smaller >>> mbufs. The mbuf limit is the number of all other mbuf sizes together >>> plus some more to allow for standalone mbufs (ACK for example) and >>> to send off a copy of a cluster. FYI: Every cluster eventually also >>> has an mbuf associated with it. >>>=20 >>> Unfortunately there isn't a way to set an overall limit for all >>> mbuf memory together as UMA doesn't support such a limiting. >>>=20 >>> Lets work out a few examples on sizing: >>>=20 >>> 1GB KVM: >>> 512MB limit for mbufs >>> 419,430 mbufs >>> 65,536 2K mbuf clusters >>> 32,768 4K mbuf clusters >>> 9,709 9K mbuf clusters >>> 5,461 16K mbuf clusters >>>=20 >>> 16GB RAM: >>> 8GB limit for mbufs >>> 33,554,432 mbufs >>> 1,048,576 2K mbuf clusters >>> 524,288 4K mbuf clusters >>> 155,344 9K mbuf clusters >>> 87,381 16K mbuf clusters >>>=20 >>> These defaults should be sufficient for event the most demanding >>> network loads. If you do run into these limits you probably know >>> exactly what you are doing and you are expected to tune those >>> values for your particular purpose. >>>=20 >>> There is a side-issue with maxfiles as it relates to the maximum >>> number of sockets that can be opened at the same time. With web >>> servers and proxy caches of these days there may be some 100K or >>> more sockets open. Hence I've divorced maxfiles from maxusers as >>> well. There is a relationship of maxfiles with the callout callwheel >>> though which has to be investigated some more to prevent ridiculous >>> values from being chosen. >>>=20 >>> -- >>> Andre >>>=20 >>=20 >>=20 >=20 From owner-svn-src-user@FreeBSD.ORG Tue Nov 13 01:46:56 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A77142D7; Tue, 13 Nov 2012 01:46:56 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8CFF18FC13; Tue, 13 Nov 2012 01:46:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAD1kuGr056174; Tue, 13 Nov 2012 01:46:56 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAD1kupM056173; Tue, 13 Nov 2012 01:46:56 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201211130146.qAD1kupM056173@svn.freebsd.org> From: Eitan Adler Date: Tue, 13 Nov 2012 01:46:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r242937 - user/crees/rclint X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Nov 2012 01:46:56 -0000 Author: eadler Date: Tue Nov 13 01:46:56 2012 New Revision: 242937 URL: http://svnweb.freebsd.org/changeset/base/242937 Log: Make rclint work with python Modified: user/crees/rclint/rclint.py Modified: user/crees/rclint/rclint.py ============================================================================== --- user/crees/rclint/rclint.py Tue Nov 13 01:21:17 2012 (r242936) +++ user/crees/rclint/rclint.py Tue Nov 13 01:46:56 2012 (r242937) @@ -66,9 +66,9 @@ class Db: err = self.error(key) if err: if level == 'error': - logging.error('[%d]: %s ' % (num+1, err)) + logging.error('[%s:%d]: %s ' % ("error", num+1, err)) if level == 'warn': - logging.warn('[%d]: %s ' % (num+1, err)) + logging.warn('[%s:%d]: %s ' % ("warning", num+1, err)) if verbosity > 0: print((textwrap.fill(self.explanation(key), initial_indent='==> ', From owner-svn-src-user@FreeBSD.ORG Tue Nov 13 08:35:26 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 36493841; Tue, 13 Nov 2012 08:35:26 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 031C98FC13; Tue, 13 Nov 2012 08:35:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAD8ZPG2016172; Tue, 13 Nov 2012 08:35:25 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAD8ZP7C016169; Tue, 13 Nov 2012 08:35:25 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201211130835.qAD8ZP7C016169@svn.freebsd.org> From: Andre Oppermann Date: Tue, 13 Nov 2012 08:35:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r242956 - user/andre/tcp_workqueue/sys/netinet X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Nov 2012 08:35:26 -0000 Author: andre Date: Tue Nov 13 08:35:25 2012 New Revision: 242956 URL: http://svnweb.freebsd.org/changeset/base/242956 Log: Remove IN_ZERONET macro and test from icmp_reflect() that was added with r120958 to drop such packets. It was only applied to ICMP while the normal ip_input() path continues to allow it leading to inconsistent behavior between ICMP and TCP/UDP. Due to the global IPv4 address shortage it may be helpful to have 0.0.0.0/8, with the exception of 0.0.0.0/32, available as another private IP range. A close reading of RFC5735 and RFC1122 is not entirely conclusive. While usage in a local ("this") scope may be allowed, forwarding may be prohibited. A survey on how other OS's handle 0.0.0.0/8 should be conducted. Reported by: Sean Chittenden Modified: user/andre/tcp_workqueue/sys/netinet/in.h user/andre/tcp_workqueue/sys/netinet/ip_icmp.c Modified: user/andre/tcp_workqueue/sys/netinet/in.h ============================================================================== --- user/andre/tcp_workqueue/sys/netinet/in.h Tue Nov 13 07:39:49 2012 (r242955) +++ user/andre/tcp_workqueue/sys/netinet/in.h Tue Nov 13 08:35:25 2012 (r242956) @@ -367,7 +367,6 @@ __END_DECLS #define IN_LINKLOCAL(i) (((u_int32_t)(i) & 0xffff0000) == 0xa9fe0000) #define IN_LOOPBACK(i) (((u_int32_t)(i) & 0xff000000) == 0x7f000000) -#define IN_ZERONET(i) (((u_int32_t)(i) & 0xff000000) == 0) #define IN_PRIVATE(i) ((((u_int32_t)(i) & 0xff000000) == 0x0a000000) || \ (((u_int32_t)(i) & 0xfff00000) == 0xac100000) || \ Modified: user/andre/tcp_workqueue/sys/netinet/ip_icmp.c ============================================================================== --- user/andre/tcp_workqueue/sys/netinet/ip_icmp.c Tue Nov 13 07:39:49 2012 (r242955) +++ user/andre/tcp_workqueue/sys/netinet/ip_icmp.c Tue Nov 13 08:35:25 2012 (r242956) @@ -694,8 +694,7 @@ icmp_reflect(struct mbuf *m) int optlen = (ip->ip_hl << 2) - sizeof(struct ip); if (IN_MULTICAST(ntohl(ip->ip_src.s_addr)) || - IN_EXPERIMENTAL(ntohl(ip->ip_src.s_addr)) || - IN_ZERONET(ntohl(ip->ip_src.s_addr)) ) { + IN_EXPERIMENTAL(ntohl(ip->ip_src.s_addr)) ) { m_freem(m); /* Bad return address */ ICMPSTAT_INC(icps_badaddr); goto done; /* Ip_output() will check for broadcast */ From owner-svn-src-user@FreeBSD.ORG Tue Nov 13 16:35:44 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C15902C3; Tue, 13 Nov 2012 16:35:44 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A539B8FC0C; Tue, 13 Nov 2012 16:35:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qADGZiFl080707; Tue, 13 Nov 2012 16:35:44 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qADGZiI0080706; Tue, 13 Nov 2012 16:35:44 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201211131635.qADGZiI0080706@svn.freebsd.org> From: Andre Oppermann Date: Tue, 13 Nov 2012 16:35:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r242980 - user/andre/tcp_workqueue/sys/dev/fxp X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Nov 2012 16:35:45 -0000 Author: andre Date: Tue Nov 13 16:35:44 2012 New Revision: 242980 URL: http://svnweb.freebsd.org/changeset/base/242980 Log: Convert fxp(4) to hybrid interrupt and polling mode with life-lock prevention. fxp_intr() only tests whether the irq was really for us and then disabled interrupts until further notice. fxp_intr_body() is converted into fxp_ithread() and loops around fxp_rx() is added to handle pulling packets from the RX DMA ring. fxp_encap() simplifies TSO setup haggling. The pseudo csum is normally already set by the stack. Have to double-check. Use ETHER_ALIGN instead of RFA_ALIGNMENT_FUDGE. Work in progress. Modified: user/andre/tcp_workqueue/sys/dev/fxp/if_fxp.c Modified: user/andre/tcp_workqueue/sys/dev/fxp/if_fxp.c ============================================================================== --- user/andre/tcp_workqueue/sys/dev/fxp/if_fxp.c Tue Nov 13 15:35:15 2012 (r242979) +++ user/andre/tcp_workqueue/sys/dev/fxp/if_fxp.c Tue Nov 13 16:35:44 2012 (r242980) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -218,11 +219,11 @@ static int fxp_suspend(device_t dev); static int fxp_resume(device_t dev); static const struct fxp_ident *fxp_find_ident(device_t dev); -static void fxp_intr(void *xsc); static void fxp_rxcsum(struct fxp_softc *sc, struct ifnet *ifp, struct mbuf *m, uint16_t status, int pos); -static int fxp_intr_body(struct fxp_softc *sc, struct ifnet *ifp, - uint8_t statack, int count); +static struct mbuf * fxp_rx(struct fxp_softc *sc, struct ifnet *ifp); +static int fxp_intr(void *xsc); +static void fxp_ithread(void *xsc); static void fxp_init(void *xsc); static void fxp_init_body(struct fxp_softc *sc, int); static void fxp_tick(void *xsc); @@ -898,7 +899,7 @@ fxp_attach(device_t dev) * Hook our interrupt after all initialization is complete. */ error = bus_setup_intr(dev, sc->fxp_res[1], INTR_TYPE_NET | INTR_MPSAFE, - NULL, fxp_intr, sc, &sc->ih); + fxp_intr, fxp_ithread, sc, &sc->ih); if (error) { device_printf(dev, "could not setup irq\n"); ether_ifdetach(sc->ifp); @@ -1445,50 +1446,15 @@ fxp_encap(struct fxp_softc *sc, struct m struct ip *ip; uint32_t ip_off, poff; - if (M_WRITABLE(*m_head) == 0) { - /* Get a writable copy. */ - m = m_dup(*m_head, M_DONTWAIT); - m_freem(*m_head); - if (m == NULL) { - *m_head = NULL; - return (ENOBUFS); - } - *m_head = m; - } ip_off = sizeof(struct ether_header); - m = m_pullup(*m_head, ip_off); - if (m == NULL) { - *m_head = NULL; - return (ENOBUFS); - } eh = mtod(m, struct ether_header *); /* Check the existence of VLAN tag. */ if (eh->ether_type == htons(ETHERTYPE_VLAN)) { ip_off = sizeof(struct ether_vlan_header); - m = m_pullup(m, ip_off); - if (m == NULL) { - *m_head = NULL; - return (ENOBUFS); - } - } - m = m_pullup(m, ip_off + sizeof(struct ip)); - if (m == NULL) { - *m_head = NULL; - return (ENOBUFS); } ip = (struct ip *)(mtod(m, char *) + ip_off); poff = ip_off + (ip->ip_hl << 2); - m = m_pullup(m, poff + sizeof(struct tcphdr)); - if (m == NULL) { - *m_head = NULL; - return (ENOBUFS); - } tcp = (struct tcphdr *)(mtod(m, char *) + poff); - m = m_pullup(m, poff + (tcp->th_off << 2)); - if (m == NULL) { - *m_head = NULL; - return (ENOBUFS); - } /* * Since 82550/82551 doesn't modify IP length and pseudo @@ -1707,45 +1673,31 @@ fxp_poll(struct ifnet *ifp, enum poll_cm /* * Process interface interrupts. */ -static void +static int fxp_intr(void *xsc) { struct fxp_softc *sc = xsc; - struct ifnet *ifp = sc->ifp; + int ret; uint8_t statack; - FXP_LOCK(sc); - if (sc->suspended) { - FXP_UNLOCK(sc); - return; - } - -#ifdef DEVICE_POLLING - if (ifp->if_capenable & IFCAP_POLLING) { - FXP_UNLOCK(sc); - return; - } -#endif - while ((statack = CSR_READ_1(sc, FXP_CSR_SCB_STATACK)) != 0) { - /* - * It should not be possible to have all bits set; the - * FXP_SCB_INTR_SWI bit always returns 0 on a read. If - * all bits are set, this may indicate that the card has - * been physically ejected, so ignore it. - */ - if (statack == 0xff) { - FXP_UNLOCK(sc); - return; - } - - /* - * First ACK all the interrupts in this pass. - */ - CSR_WRITE_1(sc, FXP_CSR_SCB_STATACK, statack); - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) - fxp_intr_body(sc, ifp, statack, -1); + statack = CSR_READ_1(sc, FXP_CSR_SCB_STATACK); + /* + * It should not be possible to have all bits set; the + * FXP_SCB_INTR_SWI bit always returns 0 on a read. If + * all bits are set, this may indicate that the card has + * been physically ejected, so ignore it. + */ + switch (statack) { + case 0x00: /* Not our interrupt. */ + case 0xff: /* Card ejected. */ + ret = FILTER_STRAY; + break; + default: + CSR_WRITE_1(sc, FXP_CSR_SCB_INTRCNTL, FXP_SCB_INTR_DISABLE); + ret = FILTER_SCHEDULE_THREAD; + break; } - FXP_UNLOCK(sc); + return (ret); } static void @@ -1857,173 +1809,199 @@ fxp_rxcsum(struct fxp_softc *sc, struct m->m_pkthdr.csum_data = csum; } -static int -fxp_intr_body(struct fxp_softc *sc, struct ifnet *ifp, uint8_t statack, - int count) +/* + * Process receiver interrupts. If a no-resource (RNR) + * condition exists, get whatever packets we can and + * re-start the receiver. + * + * When using polling, we do not process the list to completion, + * so when we get an RNR interrupt we must defer the restart + * until we hit the last buffer with the C bit set. + * If we run out of cycles and rfa_headm has the C bit set, + * record the pending RNR in the FXP_FLAG_DEFERRED_RNR flag so + * that the info will be used in the subsequent polling cycle. + */ +static struct mbuf * +fxp_rx(struct fxp_softc *sc, struct ifnet *ifp) { - struct mbuf *m; struct fxp_rx *rxp; struct fxp_rfa *rfa; - int rnr = (statack & FXP_SCB_STATACK_RNR) ? 1 : 0; - int rx_npkts; + struct mbuf *m, *n, *m0; + int len, rnr = 0; uint16_t status; - rx_npkts = 0; - FXP_LOCK_ASSERT(sc, MA_OWNED); - - if (rnr) - sc->rnr++; -#ifdef DEVICE_POLLING - /* Pick up a deferred RNR condition if `count' ran out last time. */ - if (sc->flags & FXP_FLAG_DEFERRED_RNR) { - sc->flags &= ~FXP_FLAG_DEFERRED_RNR; - rnr = 1; - } -#endif - - /* - * Free any finished transmit mbuf chains. - * - * Handle the CNA event likt a CXTNO event. It used to - * be that this event (control unit not ready) was not - * encountered, but it is now with the SMPng modifications. - * The exact sequence of events that occur when the interface - * is brought up are different now, and if this event - * goes unhandled, the configuration/rxfilter setup sequence - * can stall for several seconds. The result is that no - * packets go out onto the wire for about 5 to 10 seconds - * after the interface is ifconfig'ed for the first time. - */ - if (statack & (FXP_SCB_STATACK_CXTNO | FXP_SCB_STATACK_CNA)) - fxp_txeof(sc); - - /* - * Try to start more packets transmitting. - */ - if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) - fxp_start_body(ifp); - - /* - * Just return if nothing happened on the receive side. - */ - if (!rnr && (statack & FXP_SCB_STATACK_FR) == 0) - return (rx_npkts); - - /* - * Process receiver interrupts. If a no-resource (RNR) - * condition exists, get whatever packets we can and - * re-start the receiver. - * - * When using polling, we do not process the list to completion, - * so when we get an RNR interrupt we must defer the restart - * until we hit the last buffer with the C bit set. - * If we run out of cycles and rfa_headm has the C bit set, - * record the pending RNR in the FXP_FLAG_DEFERRED_RNR flag so - * that the info will be used in the subsequent polling cycle. - */ for (;;) { rxp = sc->fxp_desc.rx_head; - m = rxp->rx_mbuf; - rfa = (struct fxp_rfa *)(m->m_ext.ext_buf + - RFA_ALIGNMENT_FUDGE); + m0 = rxp->rx_mbuf; + rfa = (struct fxp_rfa *)(m0->m_ext.ext_buf + ETHER_ALIGN); + bus_dmamap_sync(sc->fxp_rxmtag, rxp->rx_map, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); -#ifdef DEVICE_POLLING /* loop at most count times if count >=0 */ - if (count >= 0 && count-- == 0) { - if (rnr) { - /* Defer RNR processing until the next time. */ - sc->flags |= FXP_FLAG_DEFERRED_RNR; - rnr = 0; - } - break; - } -#endif /* DEVICE_POLLING */ - status = le16toh(rfa->rfa_status); - if ((status & FXP_RFA_STATUS_C) == 0) + if (!(status & FXP_RFA_STATUS_C)) break; - - if ((status & FXP_RFA_STATUS_RNR) != 0) + if (status & FXP_RFA_STATUS_RNR) rnr++; - /* - * Advance head forward. - */ + + /* Advance head forward. */ sc->fxp_desc.rx_head = rxp->rx_next; /* - * Add a new buffer to the receive chain. - * If this fails, the old buffer is recycled - * instead. + * Fetch packet length (the top 2 bits of + * actual_size are flags set by the controller + * upon completion), and drop the packet in case + * of bogus length or CRC errors. + * Adjust for appended checksum bytes. */ - if (fxp_new_rfabuf(sc, rxp) == 0) { - int total_len; - - /* - * Fetch packet length (the top 2 bits of - * actual_size are flags set by the controller - * upon completion), and drop the packet in case - * of bogus length or CRC errors. - */ - total_len = le16toh(rfa->actual_size) & 0x3fff; - if ((sc->flags & FXP_FLAG_82559_RXCSUM) != 0 && - (ifp->if_capenable & IFCAP_RXCSUM) != 0) { - /* Adjust for appended checksum bytes. */ - total_len -= 2; - } - if (total_len < (int)sizeof(struct ether_header) || - total_len > (MCLBYTES - RFA_ALIGNMENT_FUDGE - - sc->rfa_size) || - status & (FXP_RFA_STATUS_CRC | - FXP_RFA_STATUS_ALIGN | FXP_RFA_STATUS_OVERRUN)) { - m_freem(m); - fxp_add_rfabuf(sc, rxp); - continue; - } - - m->m_pkthdr.len = m->m_len = total_len; - m->m_pkthdr.rcvif = ifp; - - /* Do IP checksum checking. */ - if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) - fxp_rxcsum(sc, ifp, m, status, total_len); - if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0 && - (status & FXP_RFA_STATUS_VLAN) != 0) { - m->m_pkthdr.ether_vtag = - ntohs(rfa->rfax_vlan_id); - m->m_flags |= M_VLANTAG; - } + len = le16toh(rfa->actual_size) & 0x3fff; + if ((sc->flags & FXP_FLAG_82559_RXCSUM) && + (ifp->if_capenable & IFCAP_RXCSUM)) + len -= ETHER_CRC_LEN; + + if (len < (int)sizeof(struct ether_header) || + len > (MCLBYTES - ETHER_ALIGN - sc->rfa_size) || + (status & (FXP_RFA_STATUS_CRC | FXP_RFA_STATUS_ALIGN | + FXP_RFA_STATUS_OVERRUN))) { + fxp_discard_rfabuf(sc, rxp); + fxp_add_rfabuf(sc, rxp); + continue; + } + if (1 == 0 && len <= MHLEN - ETHER_ALIGN && + (m0 = m_get(M_NOWAIT, MT_DATA)) != NULL) { + /* Copy stuff over. */ + m_adj(m0, ETHER_ALIGN); + (void)m_append(m0, len, + (caddr_t)(&rxp->rx_mbuf->m_ext.ext_buf)); + fxp_discard_rfabuf(sc, rxp); + } else if (fxp_new_rfabuf(sc, rxp) > 0) { /* - * Drop locks before calling if_input() since it - * may re-enter fxp_start() in the netisr case. - * This would result in a lock reversal. Better - * performance might be obtained by chaining all - * packets received, dropping the lock, and then - * calling if_input() on each one. + * Adding a new buffer to the receive chain failed, + * the old buffer is recycled instead. + * Reuse RFA and loaded DMA map. */ - FXP_UNLOCK(sc); - (*ifp->if_input)(ifp, m); - FXP_LOCK(sc); - rx_npkts++; - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) - return (rx_npkts); - } else { - /* Reuse RFA and loaded DMA map. */ - ifp->if_iqdrops++; fxp_discard_rfabuf(sc, rxp); + fxp_add_rfabuf(sc, rxp); + ifp->if_iqdrops++; + continue; } fxp_add_rfabuf(sc, rxp); + + m0->m_pkthdr.len = m0->m_len = len; + m0->m_pkthdr.rcvif = ifp; + + /* Do IP checksum checking. */ + if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) + fxp_rxcsum(sc, ifp, m0, status, len); + + if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0 && + (status & FXP_RFA_STATUS_VLAN) != 0) { + m0->m_pkthdr.ether_vtag = + ntohs(rfa->rfax_vlan_id); + m0->m_flags |= M_VLANTAG; + } + + /* Append mbuf. */ + if (m != NULL) { + n->m_nextpkt = m0; + n = m0; + } else + m = n = m0; } + + /* Restart rx microengine after out of rx buffer event. */ if (rnr) { fxp_scb_wait(sc); CSR_WRITE_4(sc, FXP_CSR_SCB_GENERAL, sc->fxp_desc.rx_head->rx_addr); fxp_scb_cmd(sc, FXP_SCB_COMMAND_RU_START); } - return (rx_npkts); + + return (m); } static void +fxp_ithread(void *xsc) +{ + struct fxp_softc *sc = xsc; + struct ifnet *ifp = sc->ifp; + struct mbuf *m, *n; + uint8_t statack; + + FXP_LOCK(sc); + + while ((statack = CSR_READ_1(sc, FXP_CSR_SCB_STATACK)) != 0x00) { + /* + * Read and acknowledge all interrupt sources. + * Further interrupts are already disabled. + */ + if (statack == 0xff) { + FXP_UNLOCK(sc); + return; + } + CSR_WRITE_1(sc, FXP_CSR_SCB_STATACK, statack); + + /* + * Free any finished transmit mbuf chains. + * + * Handle the CNA event like a CXTNO event. It used to + * be that this event (control unit not ready) was not + * encountered, but it is now with the SMPng modifications. + * The exact sequence of events that occur when the interface + * is brought up are different now, and if this event + * goes unhandled, the configuration/rxfilter setup sequence + * can stall for several seconds. The result is that no + * packets go out onto the wire for about 5 to 10 seconds + * after the interface is ifconfig'ed for the first time. + */ + if (statack & (FXP_SCB_STATACK_CXTNO | FXP_SCB_STATACK_CNA)) + fxp_txeof(sc); + + /* Try to start more packets transmitting. */ + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + fxp_start_body(ifp); + + /* Just return if nothing happened on the receive side. */ + if ((statack & (FXP_SCB_STATACK_FR | FXP_SCB_STATACK_RNR)) == 0) + break; + + /* Pull packets from rx DMA ring and refill the ring. */ + m = fxp_rx(sc, ifp); + + /* + * Push rx packets up into the stack. + * Drop locks before calling if_input() since it + * may re-enter fxp_start() in the netisr case. + * This would result in a lock reversal. + */ + FXP_UNLOCK(sc); + while (m != NULL) { + n = m; + m = n->m_nextpkt; + n->m_nextpkt = NULL; + (*ifp->if_input)(ifp, n); + maybe_yield(); + } + FXP_LOCK(sc); + } + + FXP_UNLOCK(sc); + /* Re-enable interrupts. */ + CSR_WRITE_1(sc, FXP_CSR_SCB_INTRCNTL, 0); +} + +/* + * Update packet in/out/collision statistics. The i82557 doesn't + * allow you to access these counters without doing a fairly + * expensive DMA to get _all_ of the statistics it maintains, so + * we do this operation here only once per second. The statistics + * counters in the kernel are updated from the previous dump-stats + * DMA and then a new dump-stats DMA is started. The on-chip + * counters are zeroed when the DMA completes. If we can't start + * the DMA immediately, we don't wait - we just prepare to read + * them again next time. + */ +static void fxp_update_stats(struct fxp_softc *sc) { struct ifnet *ifp = sc->ifp; @@ -2098,17 +2076,6 @@ fxp_update_stats(struct fxp_softc *sc) } } -/* - * Update packet in/out/collision statistics. The i82557 doesn't - * allow you to access these counters without doing a fairly - * expensive DMA to get _all_ of the statistics it maintains, so - * we do this operation here only once per second. The statistics - * counters in the kernel are updated from the previous dump-stats - * DMA and then a new dump-stats DMA is started. The on-chip - * counters are zeroed when the DMA completes. If we can't start - * the DMA immediately, we don't wait - we just prepare to read - * them again next time. - */ static void fxp_tick(void *xsc) { @@ -2636,7 +2603,7 @@ fxp_new_rfabuf(struct fxp_softc *sc, str * Move the data pointer up so that the incoming data packet * will be 32-bit aligned. */ - m->m_data += RFA_ALIGNMENT_FUDGE; + m->m_data += ETHER_ALIGN; /* * Get a pointer to the base of the mbuf cluster and move @@ -2644,12 +2611,12 @@ fxp_new_rfabuf(struct fxp_softc *sc, str */ rfa = mtod(m, struct fxp_rfa *); m->m_data += sc->rfa_size; - rfa->size = htole16(MCLBYTES - sc->rfa_size - RFA_ALIGNMENT_FUDGE); + rfa->size = htole16(MCLBYTES - sc->rfa_size - ETHER_ALIGN); rfa->rfa_status = 0; rfa->rfa_control = htole16(FXP_RFA_CONTROL_EL); rfa->actual_size = 0; - m->m_len = m->m_pkthdr.len = MCLBYTES - RFA_ALIGNMENT_FUDGE - + m->m_len = m->m_pkthdr.len = MCLBYTES - ETHER_ALIGN - sc->rfa_size; /* @@ -2663,7 +2630,7 @@ fxp_new_rfabuf(struct fxp_softc *sc, str /* Map the RFA into DMA memory. */ error = bus_dmamap_load(sc->fxp_rxmtag, sc->spare_map, rfa, - MCLBYTES - RFA_ALIGNMENT_FUDGE, fxp_dma_map_addr, + MCLBYTES - ETHER_ALIGN, fxp_dma_map_addr, &rxp->rx_addr, BUS_DMA_NOWAIT); if (error) { m_freem(m); @@ -2695,7 +2662,7 @@ fxp_add_rfabuf(struct fxp_softc *sc, str if (sc->fxp_desc.rx_head != NULL) { p_rx = sc->fxp_desc.rx_tail; p_rfa = (struct fxp_rfa *) - (p_rx->rx_mbuf->m_ext.ext_buf + RFA_ALIGNMENT_FUDGE); + (p_rx->rx_mbuf->m_ext.ext_buf + ETHER_ALIGN); p_rx->rx_next = rxp; le32enc(&p_rfa->link_addr, rxp->rx_addr); p_rfa->rfa_control = 0; @@ -2720,7 +2687,7 @@ fxp_discard_rfabuf(struct fxp_softc *sc, * Move the data pointer up so that the incoming data packet * will be 32-bit aligned. */ - m->m_data += RFA_ALIGNMENT_FUDGE; + m->m_data += ETHER_ALIGN; /* * Get a pointer to the base of the mbuf cluster and move @@ -2728,7 +2695,7 @@ fxp_discard_rfabuf(struct fxp_softc *sc, */ rfa = mtod(m, struct fxp_rfa *); m->m_data += sc->rfa_size; - rfa->size = htole16(MCLBYTES - sc->rfa_size - RFA_ALIGNMENT_FUDGE); + rfa->size = htole16(MCLBYTES - sc->rfa_size - ETHER_ALIGN); rfa->rfa_status = 0; rfa->rfa_control = htole16(FXP_RFA_CONTROL_EL); From owner-svn-src-user@FreeBSD.ORG Tue Nov 13 16:37:24 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id ABAB1407; Tue, 13 Nov 2012 16:37:24 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8CD658FC15; Tue, 13 Nov 2012 16:37:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qADGbO4T080929; Tue, 13 Nov 2012 16:37:24 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qADGbOYn080928; Tue, 13 Nov 2012 16:37:24 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201211131637.qADGbOYn080928@svn.freebsd.org> From: Andre Oppermann Date: Tue, 13 Nov 2012 16:37:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r242981 - user/andre/tcp_workqueue/sys/kern X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Nov 2012 16:37:24 -0000 Author: andre Date: Tue Nov 13 16:37:24 2012 New Revision: 242981 URL: http://svnweb.freebsd.org/changeset/base/242981 Log: Scaling maxfiles to physpages / 8 seems more appropriate. Modified: user/andre/tcp_workqueue/sys/kern/subr_param.c Modified: user/andre/tcp_workqueue/sys/kern/subr_param.c ============================================================================== --- user/andre/tcp_workqueue/sys/kern/subr_param.c Tue Nov 13 16:35:44 2012 (r242980) +++ user/andre/tcp_workqueue/sys/kern/subr_param.c Tue Nov 13 16:37:24 2012 (r242981) @@ -309,11 +309,11 @@ init_param2(long physpages) * physical page but not less than 16 times maxusers. * At most it can be 1/6 the number of physical pages. */ - maxfiles = imax(MAXFILES, physpages / 12); + maxfiles = imax(MAXFILES, physpages / 8); TUNABLE_INT_FETCH("kern.maxfiles", &maxfiles); - if (maxfiles > (physpages / 6)) - maxfiles = physpages / 6; - maxfilesperproc = (maxfiles * 9) / 10; + if (maxfiles > (physpages / 4)) + maxfiles = physpages / 4; + maxfilesperproc = (maxfiles / 10) * 9; /* * Cannot be changed after boot. @@ -337,8 +337,8 @@ init_param2(long physpages) VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS); maxmbufmem = realmem / 2; TUNABLE_LONG_FETCH("kern.maxmbufmem", &maxmbufmem); - if (maxmbufmem > realmem / 4 * 3) - maxmbufmem = realmem / 4 * 3; + if (maxmbufmem > (realmem / 4) * 3) + maxmbufmem = (realmem / 4) * 3; /* * The default for maxpipekva is min(1/64 of the kernel address space, From owner-svn-src-user@FreeBSD.ORG Tue Nov 13 16:48:52 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A8A9274C; Tue, 13 Nov 2012 16:48:52 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 706D98FC12; Tue, 13 Nov 2012 16:48:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qADGmq8v082289; Tue, 13 Nov 2012 16:48:52 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qADGmqMZ082288; Tue, 13 Nov 2012 16:48:52 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201211131648.qADGmqMZ082288@svn.freebsd.org> From: Andre Oppermann Date: Tue, 13 Nov 2012 16:48:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r242982 - user/andre/tcp_workqueue/sys/netinet X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Nov 2012 16:48:52 -0000 Author: andre Date: Tue Nov 13 16:48:52 2012 New Revision: 242982 URL: http://svnweb.freebsd.org/changeset/base/242982 Log: Automatically scale the TCP control block hash that is used for INPCB lookup of incoming TCP packets to about 1/8 of maxsockets. Rename TCBHASHSIZE to TCBMINHASHSIZE to reflect its new purpose. Add TCBPORTHASHSIZE defaulting to 512 for INADDR_ANY listen ports. It is independent of maxsockets. Submitted by: alfred (previous version) Modified: user/andre/tcp_workqueue/sys/netinet/tcp_subr.c Modified: user/andre/tcp_workqueue/sys/netinet/tcp_subr.c ============================================================================== --- user/andre/tcp_workqueue/sys/netinet/tcp_subr.c Tue Nov 13 16:37:24 2012 (r242981) +++ user/andre/tcp_workqueue/sys/netinet/tcp_subr.c Tue Nov 13 16:48:52 2012 (r242982) @@ -229,13 +229,16 @@ static char * tcp_log_addr(struct in_con void *ip4hdr, const void *ip6hdr); /* - * Target size of TCP PCB hash tables. Must be a power of two. + * Minimal size of TCP PCB hash tables. Must be a power of two. * * Note that this can be overridden by the kernel environment * variable net.inet.tcp.tcbhashsize */ -#ifndef TCBHASHSIZE -#define TCBHASHSIZE 512 +#ifndef TCBMINHASHSIZE +#define TCBMINHASHSIZE 512 +#endif +#ifndef TCBPORTHASHSIZE +#define TCBPORTHASHSIZE 512 #endif /* @@ -285,7 +288,6 @@ tcp_inpcb_init(void *mem, int size, int void tcp_init(void) { - int hashsize; if (hhook_head_register(HHOOK_TYPE_TCP, HHOOK_TCP_EST_IN, &V_tcp_hhh[HHOOK_TCP_EST_IN], HHOOK_NOWAIT|HHOOK_HEADISINVNET) != 0) @@ -294,15 +296,17 @@ tcp_init(void) &V_tcp_hhh[HHOOK_TCP_EST_OUT], HHOOK_NOWAIT|HHOOK_HEADISINVNET) != 0) printf("%s: WARNING: unable to register helper hook\n", __func__); - hashsize = TCBHASHSIZE; - TUNABLE_INT_FETCH("net.inet.tcp.tcbhashsize", &hashsize); - if (!powerof2(hashsize)) { - printf("WARNING: TCB hash size not a power of 2\n"); - hashsize = 512; /* safe default */ - } - in_pcbinfo_init(&V_tcbinfo, "tcp", &V_tcb, hashsize, hashsize, - "tcp_inpcb", tcp_inpcb_init, NULL, UMA_ZONE_NOFREE, - IPI_HASHFIELDS_4TUPLE); + tcp_tcbhashsize = 0x1 << fls((maxsockets / 8) - 1); + TUNABLE_INT_FETCH("net.inet.tcp.tcbhashsize", &tcp_tcbhashsize); + if (!powerof2(tcp_tcbhashsize) || + tcp_tcbhashsize < TCBMINHASHSIZE) { + printf("WARNING: TCB hash size not a power of 2 or too small\n"); + tcp_tcbhashsize = TCBMINHASHSIZE; + } + + in_pcbinfo_init(&V_tcbinfo, "tcp", &V_tcb, tcp_tcbhashsize, + TCBPORTHASHSIZE, "tcp_inpcb", tcp_inpcb_init, NULL, + UMA_ZONE_NOFREE, IPI_HASHFIELDS_4TUPLE); /* * These have to be type stable for the benefit of the timers. @@ -336,7 +340,6 @@ tcp_init(void) tcp_rexmit_min = 1; tcp_rexmit_slop = TCPTV_CPU_VAR; tcp_finwait2_timeout = TCPTV_FINWAIT2_TIMEOUT; - tcp_tcbhashsize = hashsize; TUNABLE_INT_FETCH("net.inet.tcp.soreceive_stream", &tcp_soreceive_stream); if (tcp_soreceive_stream) { From owner-svn-src-user@FreeBSD.ORG Tue Nov 13 19:48:51 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D670240A; Tue, 13 Nov 2012 19:48:51 +0000 (UTC) (envelope-from crees@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B8B738FC0C; Tue, 13 Nov 2012 19:48:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qADJmpDZ009103; Tue, 13 Nov 2012 19:48:51 GMT (envelope-from crees@svn.freebsd.org) Received: (from crees@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qADJmpHg009102; Tue, 13 Nov 2012 19:48:51 GMT (envelope-from crees@svn.freebsd.org) Message-Id: <201211131948.qADJmpHg009102@svn.freebsd.org> From: Chris Rees Date: Tue, 13 Nov 2012 19:48:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r242994 - user/crees/rclint X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Nov 2012 19:48:52 -0000 Author: crees (ports committer) Date: Tue Nov 13 19:48:51 2012 New Revision: 242994 URL: http://svnweb.freebsd.org/changeset/base/242994 Log: Don't choke if some variables are quoted. Example file: ports/devel/git/files/git_daemon.in Add hint about -k option. Revert r242937 (was apparently a WIP) Modified: user/crees/rclint/rclint.py Modified: user/crees/rclint/rclint.py ============================================================================== --- user/crees/rclint/rclint.py Tue Nov 13 19:45:13 2012 (r242993) +++ user/crees/rclint/rclint.py Tue Nov 13 19:48:51 2012 (r242994) @@ -66,9 +66,9 @@ class Db: err = self.error(key) if err: if level == 'error': - logging.error('[%s:%d]: %s ' % ("error", num+1, err)) + logging.error('[%d]: %s ' % (num+1, err)) if level == 'warn': - logging.warn('[%s:%d]: %s ' % ("warning", num+1, err)) + logging.warn('[%d]: %s ' % (num+1, err)) if verbosity > 0: print((textwrap.fill(self.explanation(key), initial_indent='==> ', @@ -78,7 +78,7 @@ class Db: self.count += 1 if self.count > 10 and beaucoup_errors == False: hint = ' Try rerunning with -v option for extra details.' if verbosity == 0 else '' - logging.error('Error threshold reached-- further errors are unlikely to be helpful. Fix the errors and rerun.' + hint) + logging.error('Error threshold reached-- further errors are unlikely to be helpful. Fix the errors and rerun. The -k option will cause rclint to continue for as many errors as it finds.' + hint) exit() def warn(self, key, num=-1, level='warn'): @@ -114,6 +114,12 @@ class Statement: return False return True + def get_value(self): + if self.quoted(): + return self.value[1:-1] + else: + return self.value + class Variable(Statement): def __init__(self, lines, number): line = lines[number] @@ -396,7 +402,7 @@ def do_rclint(filename): logging.debug('Checking for rcvar set correctly') for var in lineobj['Variable']: if var.name == 'name': - progname = var.value + progname = var.get_value() elif var.name == 'rcvar': try: if progname + '_enable' not in var.value: @@ -422,7 +428,7 @@ def do_rclint(filename): logging.debug('Checking $name agrees with PROVIDE and filename') fn = filename[:-3] if filename[-3:] == '.in' else filename fn = fn.split('/')[-1].replace('-', '_') - n = get(lineobj['Variable'], 'name').value + n = get(lineobj['Variable'], 'name').get_value() rcordervars = [] for r in lineobj['Rcorder']: if r.type != 'PROVIDE': From owner-svn-src-user@FreeBSD.ORG Tue Nov 13 22:35:31 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8672D990; Tue, 13 Nov 2012 22:35:31 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6674D8FC12; Tue, 13 Nov 2012 22:35:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qADMZVwW035692; Tue, 13 Nov 2012 22:35:31 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qADMZVV5035691; Tue, 13 Nov 2012 22:35:31 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201211132235.qADMZVV5035691@svn.freebsd.org> From: Andre Oppermann Date: Tue, 13 Nov 2012 22:35:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r243008 - user/andre/tcp_workqueue/sys/dev/fxp X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Nov 2012 22:35:31 -0000 Author: andre Date: Tue Nov 13 22:35:31 2012 New Revision: 243008 URL: http://svnweb.freebsd.org/changeset/base/243008 Log: Simplify checksum offload test based on chip revision. Comment out RX checksum code for really lame 82559 chip. It's probably better to have stack handle that, rather than faking it by manually. Fix and enable small packet copy to mbuf. Packets smaller than MHLEN (eg. TCP ACK) are copied into a new mbuf. The cluster can stay in the RX DMA ring and get reused instead of wasted on a very small packet. Tested on 82559 (A0) and 82550 (C) though it does sometime wedge in a very weird way. A up/down cycles clears it again. Modified: user/andre/tcp_workqueue/sys/dev/fxp/if_fxp.c Modified: user/andre/tcp_workqueue/sys/dev/fxp/if_fxp.c ============================================================================== --- user/andre/tcp_workqueue/sys/dev/fxp/if_fxp.c Tue Nov 13 22:01:25 2012 (r243007) +++ user/andre/tcp_workqueue/sys/dev/fxp/if_fxp.c Tue Nov 13 22:35:31 2012 (r243008) @@ -637,9 +637,7 @@ fxp_attach(device_t dev) * too, but that's already enabled by the code above. * Be careful to do this only on the right devices. */ - if (sc->revision == FXP_REV_82550 || sc->revision == FXP_REV_82550_C || - sc->revision == FXP_REV_82551_E || sc->revision == FXP_REV_82551_F - || sc->revision == FXP_REV_82551_10) { + if (sc->revision >= FXP_REV_82550) { sc->rfa_size = sizeof (struct fxp_rfa); sc->tx_cmd = FXP_CB_COMMAND_IPCBXMIT; sc->flags |= FXP_FLAG_EXT_RFA; @@ -1471,7 +1469,6 @@ fxp_encap(struct fxp_softc *sc, struct m /* Compute total TCP payload. */ tcp_payload = m->m_pkthdr.len - ip_off - (ip->ip_hl << 2); tcp_payload -= tcp->th_off << 2; - *m_head = m; } else if (m->m_pkthdr.csum_flags & FXP_CSUM_FEATURES) { /* * Deal with TCP/IP checksum offload. Note that @@ -1735,14 +1732,15 @@ static void fxp_rxcsum(struct fxp_softc *sc, struct ifnet *ifp, struct mbuf *m, uint16_t status, int pos) { +#if 0 struct ether_header *eh; struct ip *ip; struct udphdr *uh; int32_t hlen, len, pktlen, temp32; uint16_t csum, *opts; - - if ((sc->flags & FXP_FLAG_82559_RXCSUM) == 0) { - if ((status & FXP_RFA_STATUS_PARSE) != 0) { +#endif + if (!(sc->flags & FXP_FLAG_82559_RXCSUM)) { + if (status & FXP_RFA_STATUS_PARSE) { if (status & FXP_RFDX_CS_IP_CSUM_BIT_VALID) m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; if (status & FXP_RFDX_CS_IP_CSUM_VALID) @@ -1757,6 +1755,11 @@ fxp_rxcsum(struct fxp_softc *sc, struct return; } + /* + * XXXAO: Does it really make sense to touch the packet + * when the checksum feature on 559 is so lame? + */ +#if 0 pktlen = m->m_pkthdr.len; if (pktlen < sizeof(struct ether_header) + sizeof(struct ip)) return; @@ -1805,8 +1808,10 @@ fxp_rxcsum(struct fxp_softc *sc, struct csum = temp32 & 65535; } } + /* XXXAO: Missing subtraction of ip_hdr checksum? */ m->m_pkthdr.csum_flags |= CSUM_DATA_VALID; m->m_pkthdr.csum_data = csum; +#endif } /* @@ -1827,8 +1832,10 @@ fxp_rx(struct fxp_softc *sc, struct ifne struct fxp_rx *rxp; struct fxp_rfa *rfa; struct mbuf *m, *n, *m0; - int len, rnr = 0; - uint16_t status; + int rnr = 0; + uint16_t len, status, vlan; + + m = n = NULL; /* gcc */ for (;;) { rxp = sc->fxp_desc.rx_head; @@ -1852,12 +1859,13 @@ fxp_rx(struct fxp_softc *sc, struct ifne * actual_size are flags set by the controller * upon completion), and drop the packet in case * of bogus length or CRC errors. - * Adjust for appended checksum bytes. + * Adjust for appended checksum word for 559 + * checksum offload 'feature'. */ len = le16toh(rfa->actual_size) & 0x3fff; if ((sc->flags & FXP_FLAG_82559_RXCSUM) && (ifp->if_capenable & IFCAP_RXCSUM)) - len -= ETHER_CRC_LEN; + len -= 2; if (len < (int)sizeof(struct ether_header) || len > (MCLBYTES - ETHER_ALIGN - sc->rfa_size) || @@ -1867,12 +1875,14 @@ fxp_rx(struct fxp_softc *sc, struct ifne fxp_add_rfabuf(sc, rxp); continue; } - if (1 == 0 && len <= MHLEN - ETHER_ALIGN && - (m0 = m_get(M_NOWAIT, MT_DATA)) != NULL) { + vlan = ntohs(rfa->rfax_vlan_id); + + if (len <= MHLEN - ETHER_ALIGN && + (m0 = m_gethdr(M_NOWAIT, MT_DATA)) != NULL) { /* Copy stuff over. */ - m_adj(m0, ETHER_ALIGN); - (void)m_append(m0, len, - (caddr_t)(&rxp->rx_mbuf->m_ext.ext_buf)); + m0->m_data += ETHER_ALIGN; + (void)m_append(m0, len, mtod(rxp->rx_mbuf, caddr_t)); + rfa = NULL; fxp_discard_rfabuf(sc, rxp); } else if (fxp_new_rfabuf(sc, rxp) > 0) { /* @@ -1896,8 +1906,7 @@ fxp_rx(struct fxp_softc *sc, struct ifne if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0 && (status & FXP_RFA_STATUS_VLAN) != 0) { - m0->m_pkthdr.ether_vtag = - ntohs(rfa->rfax_vlan_id); + m0->m_pkthdr.ether_vtag = vlan; m0->m_flags |= M_VLANTAG; } From owner-svn-src-user@FreeBSD.ORG Thu Nov 15 16:01:50 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1D26DAB6; Thu, 15 Nov 2012 16:01:50 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 03AED8FC17; Thu, 15 Nov 2012 16:01:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAFG1nku012719; Thu, 15 Nov 2012 16:01:49 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAFG1nOW012716; Thu, 15 Nov 2012 16:01:49 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201211151601.qAFG1nOW012716@svn.freebsd.org> From: Andre Oppermann Date: Thu, 15 Nov 2012 16:01:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r243089 - user/andre/tcp_workqueue/sys/dev/fxp X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Nov 2012 16:01:50 -0000 Author: andre Date: Thu Nov 15 16:01:49 2012 New Revision: 243089 URL: http://svnweb.freebsd.org/changeset/base/243089 Log: Fix wedge issue by correctly accounting for out-of-rx-descriptors (RNR) condition and adjust the packet acceptance tests. Rename a few bit definitions in the rx descriptor to better match their purpose. Reduce the locking scope in fxp_ithread(). Add and update more comments. Work in progress. Modified: user/andre/tcp_workqueue/sys/dev/fxp/if_fxp.c user/andre/tcp_workqueue/sys/dev/fxp/if_fxpreg.h Modified: user/andre/tcp_workqueue/sys/dev/fxp/if_fxp.c ============================================================================== --- user/andre/tcp_workqueue/sys/dev/fxp/if_fxp.c Thu Nov 15 15:55:49 2012 (r243088) +++ user/andre/tcp_workqueue/sys/dev/fxp/if_fxp.c Thu Nov 15 16:01:49 2012 (r243089) @@ -221,7 +221,7 @@ static int fxp_resume(device_t dev); static const struct fxp_ident *fxp_find_ident(device_t dev); static void fxp_rxcsum(struct fxp_softc *sc, struct ifnet *ifp, struct mbuf *m, uint16_t status, int pos); -static struct mbuf * fxp_rx(struct fxp_softc *sc, struct ifnet *ifp); +static struct mbuf * fxp_rx(struct fxp_softc *sc, struct ifnet *ifp, int rnr); static int fxp_intr(void *xsc); static void fxp_ithread(void *xsc); static void fxp_init(void *xsc); @@ -903,6 +903,7 @@ fxp_attach(device_t dev) ether_ifdetach(sc->ifp); goto fail; } + bus_describe_intr(dev, sc->fxp_res[1], sc->ih, "rx/tx ithread"); /* * Configure hardware to reject magic frames otherwise @@ -1690,6 +1691,10 @@ fxp_intr(void *xsc) ret = FILTER_STRAY; break; default: + /* + * Disable further interrupts until the ithread + * is done with TXeof/RX and link state handling. + */ CSR_WRITE_1(sc, FXP_CSR_SCB_INTRCNTL, FXP_SCB_INTR_DISABLE); ret = FILTER_SCHEDULE_THREAD; break; @@ -1815,25 +1820,17 @@ fxp_rxcsum(struct fxp_softc *sc, struct } /* - * Process receiver interrupts. If a no-resource (RNR) - * condition exists, get whatever packets we can and - * re-start the receiver. - * - * When using polling, we do not process the list to completion, - * so when we get an RNR interrupt we must defer the restart - * until we hit the last buffer with the C bit set. - * If we run out of cycles and rfa_headm has the C bit set, - * record the pending RNR in the FXP_FLAG_DEFERRED_RNR flag so - * that the info will be used in the subsequent polling cycle. + * Process frames on the receive DMA ring. + * If a no-resource (RNR) condition exists, + * restart the receiver. */ static struct mbuf * -fxp_rx(struct fxp_softc *sc, struct ifnet *ifp) +fxp_rx(struct fxp_softc *sc, struct ifnet *ifp, int rnr) { struct fxp_rx *rxp; struct fxp_rfa *rfa; struct mbuf *m, *n, *m0; - int rnr = 0; - uint16_t len, status, vlan; + uint16_t len, status, asize, vlan; m = n = NULL; /* gcc */ @@ -1846,40 +1843,56 @@ fxp_rx(struct fxp_softc *sc, struct ifne BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); status = le16toh(rfa->rfa_status); - if (!(status & FXP_RFA_STATUS_C)) + asize = le16toh(rfa->actual_size); + + /* + * Stop if we hit the head of the RX queue + * or the controller isn't yet done with + * DMA'ing the packet. + */ + if (!(status & FXP_RFA_STATUS_C) || + !(asize & FXP_PFA_ASIZE_EOF)) break; - if (status & FXP_RFA_STATUS_RNR) - rnr++; /* Advance head forward. */ sc->fxp_desc.rx_head = rxp->rx_next; /* + * Drop packet and reuse mbuf when errors + * during reception were encountered. + */ + if (!(status & FXP_RFA_STATUS_OK)) { + fxp_discard_rfabuf(sc, rxp); + fxp_add_rfabuf(sc, rxp); + continue; + } + + /* * Fetch packet length (the top 2 bits of * actual_size are flags set by the controller - * upon completion), and drop the packet in case - * of bogus length or CRC errors. - * Adjust for appended checksum word for 559 + * upon completion). + * Adjust for appended checksum word for 82559 * checksum offload 'feature'. */ - len = le16toh(rfa->actual_size) & 0x3fff; + len = (asize & 0x3fff); if ((sc->flags & FXP_FLAG_82559_RXCSUM) && (ifp->if_capenable & IFCAP_RXCSUM)) len -= 2; - if (len < (int)sizeof(struct ether_header) || - len > (MCLBYTES - ETHER_ALIGN - sc->rfa_size) || - (status & (FXP_RFA_STATUS_CRC | FXP_RFA_STATUS_ALIGN | - FXP_RFA_STATUS_OVERRUN))) { - fxp_discard_rfabuf(sc, rxp); - fxp_add_rfabuf(sc, rxp); - continue; - } + /* + * Save vlan information before losing access + * to receive descriptor. + */ vlan = ntohs(rfa->rfax_vlan_id); + /* + * If the packet fits an mbuf then allocate + * one and copy it over. The mbuf cluster + * can remain in the RX DMA ring and gets + * recycled for another packet. + */ if (len <= MHLEN - ETHER_ALIGN && (m0 = m_gethdr(M_NOWAIT, MT_DATA)) != NULL) { - /* Copy stuff over. */ m0->m_data += ETHER_ALIGN; (void)m_append(m0, len, mtod(rxp->rx_mbuf, caddr_t)); rfa = NULL; @@ -1896,7 +1909,7 @@ fxp_rx(struct fxp_softc *sc, struct ifne continue; } fxp_add_rfabuf(sc, rxp); - + m0->m_pkthdr.len = m0->m_len = len; m0->m_pkthdr.rcvif = ifp; @@ -1937,12 +1950,15 @@ fxp_ithread(void *xsc) struct mbuf *m, *n; uint8_t statack; - FXP_LOCK(sc); - + /* + * Loop while the chip indicates work. + * The control status register is contiguously updated, + * even when raising interrupts is disabled. + */ while ((statack = CSR_READ_1(sc, FXP_CSR_SCB_STATACK)) != 0x00) { /* - * Read and acknowledge all interrupt sources. - * Further interrupts are already disabled. + * Read and acknowledge all interrupt sources + * unless we have an eject event. */ if (statack == 0xff) { FXP_UNLOCK(sc); @@ -1950,6 +1966,8 @@ fxp_ithread(void *xsc) } CSR_WRITE_1(sc, FXP_CSR_SCB_STATACK, statack); + FXP_LOCK(sc); + /* * Free any finished transmit mbuf chains. * @@ -1966,7 +1984,7 @@ fxp_ithread(void *xsc) if (statack & (FXP_SCB_STATACK_CXTNO | FXP_SCB_STATACK_CNA)) fxp_txeof(sc); - /* Try to start more packets transmitting. */ + /* Add more packets to the tx DMA ring. */ if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) fxp_start_body(ifp); @@ -1975,7 +1993,7 @@ fxp_ithread(void *xsc) break; /* Pull packets from rx DMA ring and refill the ring. */ - m = fxp_rx(sc, ifp); + m = fxp_rx(sc, ifp, (statack & FXP_SCB_STATACK_RNR)); /* * Push rx packets up into the stack. @@ -1991,11 +2009,11 @@ fxp_ithread(void *xsc) (*ifp->if_input)(ifp, n); maybe_yield(); } - FXP_LOCK(sc); } - FXP_UNLOCK(sc); - /* Re-enable interrupts. */ + /* + * Enable interrupts again. + */ CSR_WRITE_1(sc, FXP_CSR_SCB_INTRCNTL, 0); } @@ -2674,7 +2692,7 @@ fxp_add_rfabuf(struct fxp_softc *sc, str (p_rx->rx_mbuf->m_ext.ext_buf + ETHER_ALIGN); p_rx->rx_next = rxp; le32enc(&p_rfa->link_addr, rxp->rx_addr); - p_rfa->rfa_control = 0; + p_rfa->rfa_control = 0; /* No longer EL. */ bus_dmamap_sync(sc->fxp_rxmtag, p_rx->rx_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); } else { Modified: user/andre/tcp_workqueue/sys/dev/fxp/if_fxpreg.h ============================================================================== --- user/andre/tcp_workqueue/sys/dev/fxp/if_fxpreg.h Thu Nov 15 15:55:49 2012 (r243088) +++ user/andre/tcp_workqueue/sys/dev/fxp/if_fxpreg.h Thu Nov 15 16:01:49 2012 (r243089) @@ -375,8 +375,8 @@ struct fxp_rfa { #define FXP_RFA_STATUS_TL 0x0020 /* type/length */ #define FXP_RFA_STATUS_FTS 0x0080 /* frame too short */ #define FXP_RFA_STATUS_OVERRUN 0x0100 /* DMA overrun */ -#define FXP_RFA_STATUS_RNR 0x0200 /* no resources */ -#define FXP_RFA_STATUS_ALIGN 0x0400 /* alignment error */ +#define FXP_RFA_STATUS_RBS 0x0200 /* ran out of buffer space */ +#define FXP_RFA_STATUS_CRCALIGN 0x0400 /* alignment error */ #define FXP_RFA_STATUS_CRC 0x0800 /* CRC error */ #define FXP_RFA_STATUS_VLAN 0x1000 /* VLAN tagged frame */ #define FXP_RFA_STATUS_OK 0x2000 /* packet received okay */ @@ -385,6 +385,8 @@ struct fxp_rfa { #define FXP_RFA_CONTROL_H 0x10 /* header RFD */ #define FXP_RFA_CONTROL_S 0x4000 /* suspend after reception */ #define FXP_RFA_CONTROL_EL 0x8000 /* end of list */ +#define FXP_PFA_ASIZE_EOF 0x8000 /* completed placing data */ +#define FXP_PFA_ASIZE_F 0x4000 /* updated count field */ /* Bits in the 'csum_sts' byte */ #define FXP_RFDX_CS_TCPUDP_CSUM_BIT_VALID 0x10 From owner-svn-src-user@FreeBSD.ORG Thu Nov 15 16:42:13 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 78662DC9; Thu, 15 Nov 2012 16:42:13 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5EEF88FC0C; Thu, 15 Nov 2012 16:42:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAFGgDM5019149; Thu, 15 Nov 2012 16:42:13 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAFGgDZx019148; Thu, 15 Nov 2012 16:42:13 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201211151642.qAFGgDZx019148@svn.freebsd.org> From: Andre Oppermann Date: Thu, 15 Nov 2012 16:42:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r243090 - user/andre/tcp_workqueue/sys/dev/fxp X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Nov 2012 16:42:13 -0000 Author: andre Date: Thu Nov 15 16:42:12 2012 New Revision: 243090 URL: http://svnweb.freebsd.org/changeset/base/243090 Log: Remove traditional polling code. Modified: user/andre/tcp_workqueue/sys/dev/fxp/if_fxp.c Modified: user/andre/tcp_workqueue/sys/dev/fxp/if_fxp.c ============================================================================== --- user/andre/tcp_workqueue/sys/dev/fxp/if_fxp.c Thu Nov 15 16:01:49 2012 (r243089) +++ user/andre/tcp_workqueue/sys/dev/fxp/if_fxp.c Thu Nov 15 16:42:12 2012 (r243090) @@ -33,11 +33,6 @@ __FBSDID("$FreeBSD$"); /* * Intel EtherExpress Pro/100B PCI Fast Ethernet driver */ - -#ifdef HAVE_KERNEL_OPTION_HEADERS -#include "opt_device_polling.h" -#endif - #include #include #include @@ -860,11 +855,6 @@ fxp_attach(device_t dev) ifp->if_capenable |= IFCAP_WOL_MAGIC; } -#ifdef DEVICE_POLLING - /* Inform the world we support polling. */ - ifp->if_capabilities |= IFCAP_POLLING; -#endif - /* * Attach the interface. */ @@ -1003,11 +993,6 @@ fxp_detach(device_t dev) { struct fxp_softc *sc = device_get_softc(dev); -#ifdef DEVICE_POLLING - if (sc->ifp->if_capenable & IFCAP_POLLING) - ether_poll_deregister(sc->ifp); -#endif - FXP_LOCK(sc); /* * Stop DMA and drop transmit queue, but disable interrupts first. @@ -1630,44 +1615,6 @@ fxp_encap(struct fxp_softc *sc, struct m return (0); } -#ifdef DEVICE_POLLING -static poll_handler_t fxp_poll; - -static int -fxp_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) -{ - struct fxp_softc *sc = ifp->if_softc; - uint8_t statack; - int rx_npkts = 0; - - FXP_LOCK(sc); - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { - FXP_UNLOCK(sc); - return (rx_npkts); - } - - statack = FXP_SCB_STATACK_CXTNO | FXP_SCB_STATACK_CNA | - FXP_SCB_STATACK_FR; - if (cmd == POLL_AND_CHECK_STATUS) { - uint8_t tmp; - - tmp = CSR_READ_1(sc, FXP_CSR_SCB_STATACK); - if (tmp == 0xff || tmp == 0) { - FXP_UNLOCK(sc); - return (rx_npkts); /* nothing to do */ - } - tmp &= ~statack; - /* ack what we can */ - if (tmp != 0) - CSR_WRITE_1(sc, FXP_CSR_SCB_STATACK, tmp); - statack |= tmp; - } - rx_npkts = fxp_intr_body(sc, ifp, statack, count); - FXP_UNLOCK(sc); - return (rx_npkts); -} -#endif /* DEVICE_POLLING */ - /* * Process interface interrupts. */ @@ -2540,15 +2487,6 @@ fxp_init_body(struct fxp_softc *sc, int /* * Enable interrupts. */ -#ifdef DEVICE_POLLING - /* - * ... but only do that if we are not polling. And because (presumably) - * the default is interrupts on, we need to disable them explicitly! - */ - if (ifp->if_capenable & IFCAP_POLLING ) - CSR_WRITE_1(sc, FXP_CSR_SCB_INTRCNTL, FXP_SCB_INTR_DISABLE); - else -#endif /* DEVICE_POLLING */ CSR_WRITE_1(sc, FXP_CSR_SCB_INTRCNTL, 0); /* @@ -2864,27 +2802,6 @@ fxp_ioctl(struct ifnet *ifp, u_long comm case SIOCSIFCAP: reinit = 0; mask = ifp->if_capenable ^ ifr->ifr_reqcap; -#ifdef DEVICE_POLLING - if (mask & IFCAP_POLLING) { - if (ifr->ifr_reqcap & IFCAP_POLLING) { - error = ether_poll_register(fxp_poll, ifp); - if (error) - return(error); - FXP_LOCK(sc); - CSR_WRITE_1(sc, FXP_CSR_SCB_INTRCNTL, - FXP_SCB_INTR_DISABLE); - ifp->if_capenable |= IFCAP_POLLING; - FXP_UNLOCK(sc); - } else { - error = ether_poll_deregister(ifp); - /* Enable interrupts in any case */ - FXP_LOCK(sc); - CSR_WRITE_1(sc, FXP_CSR_SCB_INTRCNTL, 0); - ifp->if_capenable &= ~IFCAP_POLLING; - FXP_UNLOCK(sc); - } - } -#endif FXP_LOCK(sc); if ((mask & IFCAP_TXCSUM) != 0 && (ifp->if_capabilities & IFCAP_TXCSUM) != 0) { From owner-svn-src-user@FreeBSD.ORG Fri Nov 16 00:23:23 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CD5165CB; Fri, 16 Nov 2012 00:23:23 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B349E8FC12; Fri, 16 Nov 2012 00:23:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAG0NNR1083731; Fri, 16 Nov 2012 00:23:23 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAG0NN5H083729; Fri, 16 Nov 2012 00:23:23 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201211160023.qAG0NN5H083729@svn.freebsd.org> From: Navdeep Parhar Date: Fri, 16 Nov 2012 00:23:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r243111 - user/np/stable_9_toe/sys/dev/cxgbe/tom X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Nov 2012 00:23:23 -0000 Author: np Date: Fri Nov 16 00:23:23 2012 New Revision: 243111 URL: http://svnweb.freebsd.org/changeset/base/243111 Log: Pull in mbuf leak fix from head (r243110). Modified: user/np/stable_9_toe/sys/dev/cxgbe/tom/t4_listen.c Directory Properties: user/np/stable_9_toe/sys/ (props changed) user/np/stable_9_toe/sys/dev/ (props changed) Modified: user/np/stable_9_toe/sys/dev/cxgbe/tom/t4_listen.c ============================================================================== --- user/np/stable_9_toe/sys/dev/cxgbe/tom/t4_listen.c Fri Nov 16 00:21:54 2012 (r243110) +++ user/np/stable_9_toe/sys/dev/cxgbe/tom/t4_listen.c Fri Nov 16 00:23:23 2012 (r243111) @@ -559,8 +559,10 @@ t4_syncache_respond(struct toedev *tod, struct tcphdr *th = (void *)(ip + 1); wr = (struct wrqe *)atomic_readandclear_ptr(&synqe->wr); - if (wr == NULL) + if (wr == NULL) { + m_freem(m); return (EALREADY); + } bzero(&to, sizeof(to)); tcp_dooptions(&to, (void *)(th + 1), (th->th_off << 2) - sizeof(*th), From owner-svn-src-user@FreeBSD.ORG Fri Nov 16 07:30:38 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 98FA2461; Fri, 16 Nov 2012 07:30:38 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 73D3B8FC16; Fri, 16 Nov 2012 07:30:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAG7UcBh040622; Fri, 16 Nov 2012 07:30:38 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAG7Ucix040619; Fri, 16 Nov 2012 07:30:38 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201211160730.qAG7Ucix040619@svn.freebsd.org> From: Peter Holm Date: Fri, 16 Nov 2012 07:30:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r243141 - user/pho/stress2/misc X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Nov 2012 07:30:38 -0000 Author: pho Date: Fri Nov 16 07:30:38 2012 New Revision: 243141 URL: http://svnweb.freebsd.org/changeset/base/243141 Log: Added two GEOM test scenarios. Added: user/pho/stress2/misc/gbde.sh (contents, props changed) user/pho/stress2/misc/graid3.sh (contents, props changed) Added: user/pho/stress2/misc/gbde.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/gbde.sh Fri Nov 16 07:30:38 2012 (r243141) @@ -0,0 +1,57 @@ +#!/bin/sh + +# +# Copyright (c) 2012 Peter Holm +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +# "panic: bio_driver1 used by the consumer (geom ffs.md5.bde)" seen +# http://people.freebsd.org/~pho/stress/log/gbde.txt + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +. ../default.cfg + +mdconfig -l | grep -q $mdstart && mdconfig -d -u $mdstart +mdconfig -a -t swap -s 1g -u $mdstart + +gbde init /dev/md$mdstart -P pass-phrase || exit +gbde attach md$mdstart -p pass-phrase || exit + +newfs -U /dev/md$mdstart.bde > /dev/null +mount /dev/md$mdstart.bde $mntpoint +chmod 777 $mntpoint + +export runRUNTIME=20m +export RUNDIR=$mntpoint/stressX + +su $testuser -c 'cd ..; ./run.sh marcus.cfg' + +while mount | grep $mntpoint | grep -q bde; do + umount $mntpoint || sleep 1 +done +gbde detach md$mdstart +mdconfig -d -u $mdstart Added: user/pho/stress2/misc/graid3.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/graid3.sh Fri Nov 16 07:30:38 2012 (r243141) @@ -0,0 +1,67 @@ +#!/bin/sh + +# +# Copyright (c) 2012 Peter Holm +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +# Probably unrelated mkfifo() problem seen: +# http://people.freebsd.org/~pho/stress/log/graid3.txt + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +. ../default.cfg + +md1=$mdstart +md2=$((mdstart + 1)) +md3=$((mdstart + 2)) + +for u in $md1 $md2 $md3; do + mdconfig -l | grep -q md$u && mdconfig -d -u $u + mdconfig -a -t swap -s 1g -u $u +done + +graid3 load || exit +graid3 label -v -r data md$md1 md$md2 md$md3 > /dev/null || exit +newfs -U /dev/raid3/data > /dev/null +mount /dev/raid3/data $mntpoint +chmod 777 $mntpoint + +export runRUNTIME=20m +export RUNDIR=$mntpoint/stressX + +su $testuser -c 'cd ..; ./run.sh marcus.cfg' + +while mount | grep $mntpoint | grep -q raid3; do + umount $mntpoint || sleep 1 +done + +graid3 stop data +graid3 unload + +for u in $md3 $md2 $md1; do + mdconfig -d -u $u +done From owner-svn-src-user@FreeBSD.ORG Fri Nov 16 13:35:54 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A30E458E; Fri, 16 Nov 2012 13:35:54 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 685688FC12; Fri, 16 Nov 2012 13:35:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAGDZswD095365; Fri, 16 Nov 2012 13:35:54 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAGDZsev095363; Fri, 16 Nov 2012 13:35:54 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201211161335.qAGDZsev095363@svn.freebsd.org> From: Andre Oppermann Date: Fri, 16 Nov 2012 13:35:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r243150 - user/andre/tcp_workqueue/sys/dev/fxp X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Nov 2012 13:35:54 -0000 Author: andre Date: Fri Nov 16 13:35:53 2012 New Revision: 243150 URL: http://svnweb.freebsd.org/changeset/base/243150 Log: Expand the scope of FXP_LOCK() again in fxp_ithread() to be on the safe side. Remove a call to fxp_txeof() from fxp_start_body(). Remove duplicate struct ip and tcp assignments from fxp_encap(). Modified: user/andre/tcp_workqueue/sys/dev/fxp/if_fxp.c Modified: user/andre/tcp_workqueue/sys/dev/fxp/if_fxp.c ============================================================================== --- user/andre/tcp_workqueue/sys/dev/fxp/if_fxp.c Fri Nov 16 12:31:43 2012 (r243149) +++ user/andre/tcp_workqueue/sys/dev/fxp/if_fxp.c Fri Nov 16 13:35:53 2012 (r243150) @@ -1333,8 +1333,6 @@ fxp_start_body(struct ifnet *ifp) IFF_DRV_RUNNING) return; - if (sc->tx_queued > FXP_NTXCB_HIWAT) - fxp_txeof(sc); /* * We're finished if there is nothing more to add to the list or if * we're all filled up with buffers to transmit. @@ -1444,8 +1442,6 @@ fxp_encap(struct fxp_softc *sc, struct m * Since 82550/82551 doesn't modify IP length and pseudo * checksum in the first frame driver should compute it. */ - ip = (struct ip *)(mtod(m, char *) + ip_off); - tcp = (struct tcphdr *)(mtod(m, char *) + poff); ip->ip_sum = 0; ip->ip_len = htons(m->m_pkthdr.tso_segsz + (ip->ip_hl << 2) + (tcp->th_off << 2)); @@ -1897,6 +1893,8 @@ fxp_ithread(void *xsc) struct mbuf *m, *n; uint8_t statack; + FXP_LOCK(sc); + /* * Loop while the chip indicates work. * The control status register is contiguously updated, @@ -1913,8 +1911,6 @@ fxp_ithread(void *xsc) } CSR_WRITE_1(sc, FXP_CSR_SCB_STATACK, statack); - FXP_LOCK(sc); - /* * Free any finished transmit mbuf chains. * @@ -1956,7 +1952,9 @@ fxp_ithread(void *xsc) (*ifp->if_input)(ifp, n); maybe_yield(); } + FXP_LOCK(sc); } + FXP_UNLOCK(sc); /* * Enable interrupts again.