From owner-svn-src-user@FreeBSD.ORG Sun May 31 04:21:04 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DEC491065673; Sun, 31 May 2009 04:21:04 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CD1FD8FC16; Sun, 31 May 2009 04:21:04 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4V4L41p029027; Sun, 31 May 2009 04:21:04 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4V4L4Tf029026; Sun, 31 May 2009 04:21:04 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905310421.n4V4L4Tf029026@svn.freebsd.org> From: Kip Macy Date: Sun, 31 May 2009 04:21:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193146 - user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Sun, 31 May 2009 04:21:05 -0000 Author: kmacy Date: Sun May 31 04:21:04 2009 New Revision: 193146 URL: http://svn.freebsd.org/changeset/base/193146 Log: put metadata first Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Sun May 31 02:03:40 2009 (r193145) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Sun May 31 04:21:04 2009 (r193146) @@ -55,8 +55,8 @@ struct arc_buf { }; typedef enum arc_buf_contents { - ARC_BUFC_DATA, /* buffer contains data */ ARC_BUFC_METADATA, /* buffer contains metadata */ + ARC_BUFC_DATA, /* buffer contains data */ ARC_BUFC_NUMTYPES } arc_buf_contents_t; /* From owner-svn-src-user@FreeBSD.ORG Sun May 31 05:37:16 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 688C2106566C; Sun, 31 May 2009 05:37:16 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 57A068FC16; Sun, 31 May 2009 05:37:16 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4V5bG1A030578; Sun, 31 May 2009 05:37:16 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4V5bGxS030577; Sun, 31 May 2009 05:37:16 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200905310537.n4V5bGxS030577@svn.freebsd.org> From: Kip Macy Date: Sun, 31 May 2009 05:37:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193148 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Sun, 31 May 2009 05:37:16 -0000 Author: kmacy Date: Sun May 31 05:37:15 2009 New Revision: 193148 URL: http://svn.freebsd.org/changeset/base/193148 Log: drop lock before calling drain Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Sun May 31 05:20:54 2009 (r193147) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Sun May 31 05:37:15 2009 (r193148) @@ -1782,19 +1782,19 @@ cxgb_down_locked(struct adapter *sc) callout_stop(&sc->cxgb_tick_ch); callout_stop(&sc->sge_timer_ch); + ADAPTER_UNLOCK(sc); + callout_drain(&sc->cxgb_tick_ch); callout_drain(&sc->sge_timer_ch); if (sc->tq != NULL) { printf("draining slow intr\n"); - taskqueue_drain(sc->tq, &sc->slow_intr_task); printf("draining ext intr\n"); taskqueue_drain(sc->tq, &sc->ext_intr_task); printf("draining tick task\n"); taskqueue_drain(sc->tq, &sc->tick_task); } - ADAPTER_UNLOCK(sc); } static int From owner-svn-src-user@FreeBSD.ORG Mon Jun 1 01:42:56 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F34B106566B; Mon, 1 Jun 2009 01:42:56 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5E3D08FC13; Mon, 1 Jun 2009 01:42:56 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n511gu5x060348; Mon, 1 Jun 2009 01:42:56 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n511guxx060347; Mon, 1 Jun 2009 01:42:56 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906010142.n511guxx060347@svn.freebsd.org> From: Kip Macy Date: Mon, 1 Jun 2009 01:42:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193193 - user/kmacy/releng_7_2_fcs/sys/sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 01 Jun 2009 01:42:56 -0000 Author: kmacy Date: Mon Jun 1 01:42:56 2009 New Revision: 193193 URL: http://svn.freebsd.org/changeset/base/193193 Log: remove gratuitous memory barriers Modified: user/kmacy/releng_7_2_fcs/sys/sys/buf_ring.h Modified: user/kmacy/releng_7_2_fcs/sys/sys/buf_ring.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/sys/buf_ring.h Mon Jun 1 01:02:30 2009 (r193192) +++ user/kmacy/releng_7_2_fcs/sys/sys/buf_ring.h Mon Jun 1 01:42:56 2009 (r193193) @@ -117,7 +117,6 @@ buf_ring_enqueue(struct buf_ring *br, vo while (br->br_prod_tail != prod_head) cpu_spinwait(); br->br_prod_tail = prod_next; - mb(); critical_exit(); return (0); } @@ -154,7 +153,7 @@ buf_ring_dequeue_mc(struct buf_ring *br) #ifdef DEBUG_BUFRING br->br_ring[cons_head] = NULL; #endif - mb(); + rmb(); /* * If there are other dequeues in progress @@ -165,7 +164,6 @@ buf_ring_dequeue_mc(struct buf_ring *br) cpu_spinwait(); br->br_cons_tail = cons_next; - mb(); critical_exit(); return (buf); @@ -196,7 +194,6 @@ buf_ring_dequeue_sc(struct buf_ring *br) br->br_cons_head = cons_next; buf = br->br_ring[cons_head]; - mb(); #ifdef DEBUG_BUFRING br->br_ring[cons_head] = NULL; @@ -207,7 +204,6 @@ buf_ring_dequeue_sc(struct buf_ring *br) br->br_cons_tail, cons_head); #endif br->br_cons_tail = cons_next; - mb(); critical_exit(); return (buf); } @@ -225,7 +221,7 @@ buf_ring_peek(struct buf_ring *br) if ((br->br_lock != NULL) && !mtx_owned(br->br_lock)) panic("lock not held on single consumer dequeue"); #endif - mb(); + wmb(); if (br->br_cons_head == br->br_prod_tail) return (NULL); From owner-svn-src-user@FreeBSD.ORG Mon Jun 1 14:26:19 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB0031065672; Mon, 1 Jun 2009 14:26:19 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id ADB548FC2A; Mon, 1 Jun 2009 14:26:19 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 64A1146B23; Mon, 1 Jun 2009 10:26:19 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 3D2238A02B; Mon, 1 Jun 2009 10:26:18 -0400 (EDT) From: John Baldwin To: Kip Macy Date: Mon, 1 Jun 2009 08:15:49 -0400 User-Agent: KMail/1.9.7 References: <200905300105.n4U15VAF092086@svn.freebsd.org> In-Reply-To: <200905300105.n4U15VAF092086@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200906010815.49692.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Mon, 01 Jun 2009 10:26:18 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r193078 - in user/kmacy/releng_7_2_fcs/sys: amd64/amd64 vm X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 01 Jun 2009 14:26:20 -0000 On Friday 29 May 2009 9:05:31 pm Kip Macy wrote: > - --m->wire_count; > + atomic_subtract_int(&m->wire_count, 1); > if (m->wire_count == 0) > return _pmap_unwire_pte_hold(pmap, va, m, free); This is not safe. Use atomic_fetchadd() instead to do this atomically the way refcount_* do. -- John Baldwin From owner-svn-src-user@FreeBSD.ORG Tue Jun 2 00:21:47 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 917F3106567E; Tue, 2 Jun 2009 00:21:47 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7792E8FC5E; Tue, 2 Jun 2009 00:21:47 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n520Llu6097078; Tue, 2 Jun 2009 00:21:47 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n520LlYP097075; Tue, 2 Jun 2009 00:21:47 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906020021.n520LlYP097075@svn.freebsd.org> From: Kip Macy Date: Tue, 2 Jun 2009 00:21:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193290 - in user/kmacy/releng_7_2_xen/sys/i386: include xen X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 02 Jun 2009 00:21:52 -0000 Author: kmacy Date: Tue Jun 2 00:21:47 2009 New Revision: 193290 URL: http://svn.freebsd.org/changeset/base/193290 Log: fix pmap compile & link post integrate Modified: user/kmacy/releng_7_2_xen/sys/i386/include/pmap.h user/kmacy/releng_7_2_xen/sys/i386/xen/mp_machdep.c user/kmacy/releng_7_2_xen/sys/i386/xen/pmap.c Modified: user/kmacy/releng_7_2_xen/sys/i386/include/pmap.h ============================================================================== --- user/kmacy/releng_7_2_xen/sys/i386/include/pmap.h Tue Jun 2 00:21:30 2009 (r193289) +++ user/kmacy/releng_7_2_xen/sys/i386/include/pmap.h Tue Jun 2 00:21:47 2009 (r193290) @@ -185,9 +185,7 @@ extern pd_entry_t PTDpde[]; extern pdpt_entry_t *IdlePDPT; #endif extern pd_entry_t *IdlePTD; /* physical address of "Idle" state directory */ -#endif -#ifdef _KERNEL /* * virtual address to page table entry and * to physical address. @@ -283,7 +281,10 @@ pmap_kextract(vm_offset_t va) return pa; } -#ifdef PAE +#define PT_UPDATES_FLUSH() +#endif + +#if defined(PAE) && !defined(XEN) #define pde_cmpset(pdep, old, new) \ atomic_cmpset_64((pdep), (old), (new)) Modified: user/kmacy/releng_7_2_xen/sys/i386/xen/mp_machdep.c ============================================================================== --- user/kmacy/releng_7_2_xen/sys/i386/xen/mp_machdep.c Tue Jun 2 00:21:30 2009 (r193289) +++ user/kmacy/releng_7_2_xen/sys/i386/xen/mp_machdep.c Tue Jun 2 00:21:47 2009 (r193290) @@ -535,7 +535,7 @@ init_secondary(void) invlpg(addr); /* set up FPU state on the AP */ - npxinit(__INITIAL_NPXCW__); + npxinit(); #if 0 /* set up SSE registers */ Modified: user/kmacy/releng_7_2_xen/sys/i386/xen/pmap.c ============================================================================== --- user/kmacy/releng_7_2_xen/sys/i386/xen/pmap.c Tue Jun 2 00:21:30 2009 (r193289) +++ user/kmacy/releng_7_2_xen/sys/i386/xen/pmap.c Tue Jun 2 00:21:47 2009 (r193290) @@ -2630,7 +2630,7 @@ retry: * insert this page into the given map NOW. */ void -pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, +pmap_enter(pmap_t pmap, vm_offset_t va, vm_prot_t access, vm_page_t m, vm_prot_t prot, boolean_t wired) { vm_paddr_t pa; @@ -2796,7 +2796,9 @@ validate: * to update the pte. */ if ((origpte & ~(PG_M|PG_A)) != newpte) { - if (origpte) { + if ((access & VM_PROT_WRITE) != 0) + newpte |= PG_M; + if (origpte & PG_V) { invlva = FALSE; origpte = *pte; PT_SET_VA(pte, newpte | PG_A, FALSE); @@ -3434,6 +3436,25 @@ pmap_page_exists_quick(pmap_t pmap, vm_p } /* + * Returns TRUE if the given page is mapped individually or as part of + * a 4mpage. Otherwise, returns FALSE. + */ +boolean_t +pmap_page_is_mapped(vm_page_t m) +{ + struct md_page *pvh; + + if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0) + return (FALSE); + mtx_assert(&vm_page_queue_mtx, MA_OWNED); + if (TAILQ_EMPTY(&m->md.pv_list)) { + pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); + return (!TAILQ_EMPTY(&pvh->pv_list)); + } else + return (TRUE); +} + +/* * Remove all pages from specified address space * this aids process exit speeds. Also, this code * is special cased for current process only, but @@ -4041,6 +4062,30 @@ pmap_addr_hint(vm_object_t obj, vm_offse return addr; } +/* + * Increase the starting virtual address of the given mapping if a + * different alignment might result in more superpage mappings. + */ +void +pmap_align_superpage(vm_object_t object, vm_ooffset_t offset, + vm_offset_t *addr, vm_size_t size) +{ + vm_offset_t superpage_offset; + + if (size < NBPDR) + return; + if (object != NULL && (object->flags & OBJ_COLORED) != 0) + offset += ptoa(object->pg_color); + superpage_offset = offset & PDRMASK; + if (size - ((NBPDR - superpage_offset) & PDRMASK) < NBPDR || + (*addr & PDRMASK) == superpage_offset) + return; + if ((*addr & PDRMASK) < superpage_offset) + *addr = (*addr & ~PDRMASK) + superpage_offset; + else + *addr = ((*addr + PDRMASK) & ~PDRMASK) + superpage_offset; +} + #if defined(PMAP_DEBUG) pmap_pid_dump(int pid) { From owner-svn-src-user@FreeBSD.ORG Tue Jun 2 17:36:43 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 332631065676; Tue, 2 Jun 2009 17:36:43 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 08A288FC0A; Tue, 2 Jun 2009 17:36:43 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n52HagBw022531; Tue, 2 Jun 2009 17:36:42 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n52HaghF022530; Tue, 2 Jun 2009 17:36:42 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200906021736.n52HaghF022530@svn.freebsd.org> From: Ed Schouten Date: Tue, 2 Jun 2009 17:36:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193319 - user/ed X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 02 Jun 2009 17:36:43 -0000 Author: ed Date: Tue Jun 2 17:36:42 2009 New Revision: 193319 URL: http://svn.freebsd.org/changeset/base/193319 Log: Add my very own user directory! Added: user/ed/ From owner-svn-src-user@FreeBSD.ORG Wed Jun 3 00:59:07 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 62C3A106564A; Wed, 3 Jun 2009 00:59:07 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4F6AF8FC16; Wed, 3 Jun 2009 00:59:07 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n530x6QO033744; Wed, 3 Jun 2009 00:59:06 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n530x6Gm033740; Wed, 3 Jun 2009 00:59:06 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906030059.n530x6Gm033740@svn.freebsd.org> From: Kip Macy Date: Wed, 3 Jun 2009 00:59:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193359 - in user/kmacy/releng_7_2_fcs/sys: dev/cxgb dev/cxgb/common dev/cxgb/sys modules/cxgb/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 03 Jun 2009 00:59:07 -0000 Author: kmacy Date: Wed Jun 3 00:59:06 2009 New Revision: 193359 URL: http://svn.freebsd.org/changeset/base/193359 Log: checkpoint cxgb cleanup: - remove cxgb_multiq.c - remove cxgb_support.c currently disabled / broken: - TOE - tx coalescing Deleted: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_multiq.c user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/cxgb_support.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/common/cxgb_t3_cpl.h user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/mvec.h user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/uipc_mvec.c user/kmacy/releng_7_2_fcs/sys/modules/cxgb/cxgb/Makefile Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/common/cxgb_t3_cpl.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/common/cxgb_t3_cpl.h Tue Jun 2 23:30:02 2009 (r193358) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/common/cxgb_t3_cpl.h Wed Jun 3 00:59:06 2009 (r193359) @@ -237,10 +237,21 @@ struct rss_header { #ifndef CHELSIO_FW struct work_request_hdr { - __be32 wr_hi; - __be32 wr_lo; + union { + struct { + __be32 wr_hi; + __be32 wr_lo; + } ilp32; + struct { + __be64 wr_hilo; + } lp64; + } u; }; +#define wrh_hi u.ilp32.wr_hi +#define wrh_lo u.ilp32.wr_lo +#define wrh_hilo u.lp64.wr_hilo + /* wr_hi fields */ #define S_WR_SGE_CREDITS 0 #define M_WR_SGE_CREDITS 0xFF @@ -817,8 +828,7 @@ struct cpl_peer_close { }; struct tx_data_wr { - __be32 wr_hi; - __be32 wr_lo; + WR_HDR; __be32 len; __be32 flags; __be32 sndseq; @@ -936,8 +946,7 @@ struct cpl_rdma_ec_status { }; struct mngt_pktsched_wr { - __be32 wr_hi; - __be32 wr_lo; + WR_HDR; __u8 mngt_opcode; __u8 rsvd[7]; __u8 sched; Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Tue Jun 2 23:30:02 2009 (r193358) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Wed Jun 3 00:59:06 2009 (r193359) @@ -122,6 +122,7 @@ struct port_info { uint8_t first_qset; uint32_t nqsets; int link_fault; + int watchdog_timer; uint8_t hw_addr[ETHER_ADDR_LEN]; struct task timer_reclaim_task; @@ -202,10 +203,6 @@ struct sge_rspq { uint32_t rspq_dump_count; }; -#ifndef DISABLE_MBUF_IOVEC -#define rspq_mbuf rspq_mh.mh_head -#endif - struct rx_desc; struct rx_sw_desc; @@ -258,14 +255,8 @@ struct sge_txq { bus_dmamap_t desc_map; bus_dma_tag_t entry_tag; struct mbuf_head sendq; - /* - * cleanq should really be an buf_ring to avoid extra - * mbuf touches - */ - struct mbuf_head cleanq; struct buf_ring *txq_mr; struct ifaltq *txq_ifq; - struct mbuf *immpkt; uint32_t txq_drops; uint32_t txq_skipped; @@ -306,7 +297,6 @@ struct sge_qset { uint64_t port_stats[SGE_PSTAT_MAX]; struct port_info *port; int idx; /* qset # */ - int qs_cpuid; int qs_flags; struct cv qs_cv; struct mtx qs_mtx; @@ -611,11 +601,7 @@ static inline int offload_running(adapte return isset(&adapter->open_device_map, OFFLOAD_DEVMAP_BIT); } -int cxgb_pcpu_enqueue_packet(struct ifnet *ifp, struct mbuf *m); -int cxgb_pcpu_transmit(struct ifnet *ifp, struct mbuf *m); -void cxgb_pcpu_shutdown_threads(struct adapter *sc); -void cxgb_pcpu_startup_threads(struct adapter *sc); - +int cxgb_transmit(struct ifnet *ifp, struct mbuf *m); int process_responses(adapter_t *adap, struct sge_qset *qs, int budget); void t3_free_qset(adapter_t *sc, struct sge_qset *q); void cxgb_start(struct ifnet *ifp); Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Tue Jun 2 23:30:02 2009 (r193358) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Wed Jun 3 00:59:06 2009 (r193359) @@ -655,7 +655,6 @@ cxgb_free(struct adapter *sc) ADAPTER_LOCK(sc); sc->flags |= CXGB_SHUTDOWN; ADAPTER_UNLOCK(sc); - cxgb_pcpu_shutdown_threads(sc); ADAPTER_LOCK(sc); /* @@ -957,9 +956,10 @@ cxgb_port_attach(device_t dev) } ether_ifattach(ifp, p->hw_addr); -#ifdef IFNET_MULTIQUEUE - ifp->if_transmit = cxgb_pcpu_transmit; -#endif +#ifdef IFNET_BUF_RING + ifp->if_transmit = cxgb_transmit; + ifp->if_qflush = cxgb_qflush; +#endif /* * Only default to jumbo frames on 10GigE */ @@ -1271,13 +1271,13 @@ t3_os_ext_intr_handler(adapter_t *sc) * interrupts in the meantime and let the task reenable them when * it's done. */ - ADAPTER_LOCK(sc); if (sc->slow_intr_mask) { + ADAPTER_LOCK(sc); sc->slow_intr_mask &= ~F_T3DBG; t3_write_reg(sc, A_PL_INT_ENABLE0, sc->slow_intr_mask); taskqueue_enqueue(sc->tq, &sc->ext_intr_task); + ADAPTER_UNLOCK(sc); } - ADAPTER_UNLOCK(sc); } static void @@ -1555,7 +1555,6 @@ bind_qsets(adapter_t *sc) { int i, j; - cxgb_pcpu_startup_threads(sc); for (i = 0; i < (sc)->params.nports; ++i) { const struct port_info *pi = adap2pinfo(sc, i); Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Tue Jun 2 23:30:02 2009 (r193358) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Wed Jun 3 00:59:06 2009 (r193359) @@ -51,6 +51,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include #include #include @@ -67,13 +69,20 @@ __FBSDID("$FreeBSD$"); #include #include -int txq_fills = 0; +int txq_fills = 0; +int multiq_tx_enable = 1; + +extern struct sysctl_oid_list sysctl__hw_cxgb_children; +int cxgb_txq_buf_ring_size = TX_ETH_Q_SIZE; +TUNABLE_INT("hw.cxgb.txq_mr_size", &cxgb_txq_buf_ring_size); +SYSCTL_UINT(_hw_cxgb, OID_AUTO, txq_mr_size, CTLFLAG_RDTUN, &cxgb_txq_buf_ring_size, 0, + "size of per-queue mbuf ring"); + /* * XXX don't re-enable this until TOE stops assuming * we have an m_ext */ static int recycle_enable = 0; -extern int cxgb_txq_buf_ring_size; int cxgb_cached_allocations; int cxgb_cached; int cxgb_ext_freed = 0; @@ -86,9 +95,8 @@ extern int cxgb_pcpu_cache_enable; extern int nmbjumbo4; extern int nmbjumbo9; extern int nmbjumbo16; -extern int multiq_tx_enable; -extern int coalesce_tx_enable; -extern int wakeup_tx_thread; + +static int coalesce_tx_enable; #define USE_GTS 0 @@ -140,22 +148,22 @@ struct rsp_desc { /* respo #define RSPQ_SOP_EOP G_RSPD_SOP_EOP(F_RSPD_SOP|F_RSPD_EOP) struct tx_sw_desc { /* SW state per Tx descriptor */ - struct mbuf_iovec mi; + struct mbuf *m; bus_dmamap_t map; int flags; }; struct rx_sw_desc { /* SW state per Rx descriptor */ - caddr_t rxsd_cl; - caddr_t data; - bus_dmamap_t map; - int flags; + caddr_t rxsd_cl; + struct mbuf *m; + bus_dmamap_t map; + int flags; }; struct txq_state { - unsigned int compl; - unsigned int gen; - unsigned int pidx; + unsigned int compl; + unsigned int gen; + unsigned int pidx; }; struct refill_fl_cb_arg { @@ -164,6 +172,7 @@ struct refill_fl_cb_arg { int nseg; }; + /* * Maps a number of flits to the number of Tx descriptors that can hold them. * The formula is @@ -189,6 +198,13 @@ static uint8_t flit_desc_map[] = { #endif }; +#define TXQ_LOCK_ASSERT(qs) mtx_assert(&(qs)->txq[TXQ_ETH].lock, MA_OWNED) +#define TXQ_TRYLOCK(qs) mtx_trylock(&(qs)->txq[TXQ_ETH].lock) +#define TXQ_LOCK(qs) mtx_lock(&(qs)->txq[TXQ_ETH].lock) +#define TXQ_UNLOCK(qs) mtx_unlock(&(qs)->txq[TXQ_ETH].lock) +#define TXQ_RING_EMPTY(qs) drbr_empty((qs)->port->ifp, (qs)->txq[TXQ_ETH].txq_mr) +#define TXQ_RING_DEQUEUE(qs) drbr_dequeue((qs)->port->ifp, (qs)->txq[TXQ_ETH].txq_mr) +#define CXGB_TX_TIMEOUT 5 int cxgb_debug = 0; @@ -516,19 +532,26 @@ refill_fl(adapter_t *sc, struct sge_fl * struct rx_desc *d = &q->desc[q->pidx]; struct refill_fl_cb_arg cb_arg; caddr_t cl; + struct mbuf *m; int err, count = 0; - int header_size = sizeof(struct mbuf) + sizeof(uint32_t); cb_arg.error = 0; while (n--) { /* * We only allocate a cluster, mbuf allocation happens after rx */ - if ((cl = cxgb_cache_get(q->zone)) == NULL) { - log(LOG_WARNING, "Failed to allocate cluster\n"); - goto done; + if (q->zone == zone_pack) { + if ((m = m_getcl(M_NOWAIT, MT_NOINIT, M_PKTHDR)) == NULL) + break; + cl = m->m_ext.ext_buf; + } else { + if ((cl = m_cljget(NULL, M_NOWAIT, q->buf_size)) == NULL) + break; + if ((m = m_gethdr(M_NOWAIT, MT_NOINIT)) == NULL) { + uma_zfree(q->zone, cl); + break; + } } - if ((sd->flags & RX_SW_DESC_MAP_CREATED) == 0) { if ((err = bus_dmamap_create(q->entry_tag, 0, &sd->map))) { log(LOG_WARNING, "bus_dmamap_create failed %d\n", err); @@ -539,22 +562,19 @@ refill_fl(adapter_t *sc, struct sge_fl * } #if !defined(__i386__) && !defined(__amd64__) err = bus_dmamap_load(q->entry_tag, sd->map, - cl + header_size, q->buf_size, - refill_fl_cb, &cb_arg, 0); + cl, q->buf_size, refill_fl_cb, &cb_arg, 0); if (err != 0 || cb_arg.error) { - log(LOG_WARNING, "failure in refill_fl %d\n", cb_arg.error); - /* - * XXX free cluster - */ - return; + if (q->zone = zone_pack) + uma_zfree(q->zone, cl); + m_free(m); } #else - cb_arg.seg.ds_addr = pmap_kextract((vm_offset_t)(cl + header_size)); + cb_arg.seg.ds_addr = pmap_kextract((vm_offset_t)cl); #endif sd->flags |= RX_SW_DESC_INUSE; sd->rxsd_cl = cl; - sd->data = cl + header_size; + sd->m = m; d->addr_lo = htobe32(cb_arg.seg.ds_addr & 0xffffffff); d->addr_hi = htobe32(((uint64_t)cb_arg.seg.ds_addr >>32) & 0xffffffff); d->len_gen = htobe32(V_FLD_GEN1(q->gen)); @@ -598,9 +618,16 @@ free_rx_bufs(adapter_t *sc, struct sge_f if (d->flags & RX_SW_DESC_INUSE) { bus_dmamap_unload(q->entry_tag, d->map); bus_dmamap_destroy(q->entry_tag, d->map); - uma_zfree(q->zone, d->rxsd_cl); + if (q->zone == zone_pack) + m_free_fast(zone_pack, d->m); + else { + uma_zfree(q->zone, d->rxsd_cl); + m_free_fast(zone_mbuf, d->m); + } } + d->rxsd_cl = NULL; + d->m = NULL; if (++cidx == q->size) cidx = 0; } @@ -800,8 +827,6 @@ t3_sge_init_adapter(adapter_t *sc) callout_init(&sc->sge_timer_ch, CALLOUT_MPSAFE); callout_reset(&sc->sge_timer_ch, TX_RECLAIM_PERIOD, sge_timer_cb, sc); TASK_INIT(&sc->slow_intr_task, 0, sge_slow_intr_handler, sc); - mi_init(); - cxgb_cache_init(); return (0); } @@ -822,8 +847,7 @@ t3_sge_init_port(struct port_info *pi) void t3_sge_deinit_sw(adapter_t *sc) { - - mi_deinit(); + ; } /** @@ -1146,10 +1170,10 @@ write_wr_hdr_sgl(unsigned int ndesc, str struct tx_sw_desc *txsd = &txq->sdesc[txqs->pidx]; if (__predict_true(ndesc == 1)) { - wrp->wr_hi = htonl(F_WR_SOP | F_WR_EOP | V_WR_DATATYPE(1) | + wrp->wrh_hi = htonl(F_WR_SOP | F_WR_EOP | V_WR_DATATYPE(1) | V_WR_SGLSFLT(flits)) | wr_hi; wmb(); - wrp->wr_lo = htonl(V_WR_LEN(flits + sgl_flits) | + wrp->wrh_lo = htonl(V_WR_LEN(flits + sgl_flits) | V_WR_GEN(txqs->gen)) | wr_lo; /* XXX gen? */ wr_gen2(txd, txqs->gen); @@ -1159,7 +1183,7 @@ write_wr_hdr_sgl(unsigned int ndesc, str const uint64_t *fp = (const uint64_t *)sgl; struct work_request_hdr *wp = wrp; - wrp->wr_hi = htonl(F_WR_SOP | V_WR_DATATYPE(1) | + wrp->wrh_hi = htonl(F_WR_SOP | V_WR_DATATYPE(1) | V_WR_SGLSFLT(flits)) | wr_hi; while (sgl_flits) { @@ -1188,20 +1212,18 @@ write_wr_hdr_sgl(unsigned int ndesc, str * is freed all clusters will be freed * with it */ - KASSERT(txsd->mi.mi_base == NULL, - ("overwriting valid entry mi_base==%p", txsd->mi.mi_base)); wrp = (struct work_request_hdr *)txd; - wrp->wr_hi = htonl(V_WR_DATATYPE(1) | + wrp->wrh_hi = htonl(V_WR_DATATYPE(1) | V_WR_SGLSFLT(1)) | wr_hi; - wrp->wr_lo = htonl(V_WR_LEN(min(WR_FLITS, + wrp->wrh_lo = htonl(V_WR_LEN(min(WR_FLITS, sgl_flits + 1)) | V_WR_GEN(txqs->gen)) | wr_lo; wr_gen2(txd, txqs->gen); flits = 1; } - wrp->wr_hi |= htonl(F_WR_EOP); + wrp->wrh_hi |= htonl(F_WR_EOP); wmb(); - wp->wr_lo = htonl(V_WR_LEN(WR_FLITS) | V_WR_GEN(ogen)) | wr_lo; + wp->wrh_lo = htonl(V_WR_LEN(WR_FLITS) | V_WR_GEN(ogen)) | wr_lo; wr_gen2((struct tx_desc *)wp, ogen); } } @@ -1216,14 +1238,8 @@ do { \ cntrl |= F_TXPKT_VLAN_VLD | V_TXPKT_VLAN((m)->m_pkthdr.ether_vtag); \ } while (0) -#define GET_VTAG_MI(cntrl, mi) \ -do { \ - if ((mi)->mi_flags & M_VLANTAG) \ - cntrl |= F_TXPKT_VLAN_VLD | V_TXPKT_VLAN((mi)->mi_ether_vtag); \ -} while (0) #else #define GET_VTAG(cntrl, m) -#define GET_VTAG_MI(cntrl, m) #endif int @@ -1244,12 +1260,9 @@ t3_encap(struct sge_qset *qs, struct mbu bus_dma_segment_t segs[TX_MAX_SEGS]; struct tx_desc *txd; - struct mbuf_vec *mv; - struct mbuf_iovec *mi; DPRINTF("t3_encap cpu=%d ", curcpu); - mi = NULL; pi = qs->port; sc = pi->adapter; txq = &qs->txq[TXQ_ETH]; @@ -1260,8 +1273,6 @@ t3_encap(struct sge_qset *qs, struct mbu DPRINTF("t3_encap port_id=%d qsidx=%d ", pi->port_id, pi->first_qset); DPRINTF("mlen=%d txpkt_intf=%d tx_chan=%d\n", m[0]->m_pkthdr.len, pi->txpkt_intf, pi->tx_chan); - if (cxgb_debug) - printf("mi_base=%p cidx=%d pidx=%d\n\n", txsd->mi.mi_base, txq->cidx, txq->pidx); mtx_assert(&txq->lock, MA_OWNED); cntrl = V_TXPKT_INTF(pi->txpkt_intf); @@ -1272,10 +1283,8 @@ t3_encap(struct sge_qset *qs, struct mbu if (m0->m_pkthdr.csum_flags & (CSUM_TSO)) tso_info = V_LSO_MSS(m0->m_pkthdr.tso_segsz); #endif - KASSERT(txsd->mi.mi_base == NULL, - ("overwriting valid entry mi_base==%p", txsd->mi.mi_base)); if (count > 1) { - if ((err = busdma_map_sg_vec(m, &m0, segs, count))) + if ((err = busdma_map_sg_vec(m, segs, count))) return (err); nsegs = count; } else if ((err = busdma_map_sg_collapse(&m0, segs, &nsegs))) { @@ -1285,43 +1294,37 @@ t3_encap(struct sge_qset *qs, struct mbu } KASSERT(m0->m_pkthdr.len, ("empty packet nsegs=%d count=%d", nsegs, count)); - if ((m0->m_pkthdr.len > PIO_LEN) || (count > 1)) { - mi_collapse_mbuf(&txsd->mi, m0); - mi = &txsd->mi; - } + if ((m0->m_pkthdr.len > PIO_LEN) || (count > 1)) + txsd->m = m0; + if (count > 1) { struct cpl_tx_pkt_batch *cpl_batch = (struct cpl_tx_pkt_batch *)txd; int i, fidx; - struct mbuf_iovec *batchmi; - mv = mtomv(m0); - batchmi = mv->mv_vec; - wrp = (struct work_request_hdr *)txd; - flits = count*2 + 1; txq_prod(txq, 1, &txqs); - for (fidx = 1, i = 0; i < count; i++, batchmi++, fidx += 2) { + for (fidx = 1, i = 0; i < count; i++, fidx += 2) { struct cpl_tx_pkt_batch_entry *cbe = &cpl_batch->pkt_entry[i]; cntrl = V_TXPKT_INTF(pi->txpkt_intf); - GET_VTAG_MI(cntrl, batchmi); + GET_VTAG(cntrl, m0); cntrl |= V_TXPKT_OPCODE(CPL_TX_PKT); if (__predict_false(!(m0->m_pkthdr.csum_flags & CSUM_IP))) cntrl |= F_TXPKT_IPCSUM_DIS; if (__predict_false(!(m0->m_pkthdr.csum_flags & (CSUM_TCP | CSUM_UDP)))) cntrl |= F_TXPKT_L4CSUM_DIS; cbe->cntrl = htonl(cntrl); - cbe->len = htonl(batchmi->mi_len | 0x80000000); + cbe->len = htonl(segs[i].ds_len | 0x80000000); cbe->addr = htobe64(segs[i].ds_addr); txd->flit[fidx] |= htobe64(1 << 24); } - wrp->wr_hi = htonl(F_WR_SOP | F_WR_EOP | V_WR_DATATYPE(1) | + wrp->wrh_hi = htonl(F_WR_SOP | F_WR_EOP | V_WR_DATATYPE(1) | V_WR_SGLSFLT(flits)) | htonl(V_WR_OP(FW_WROPCODE_TUNNEL_TX_PKT) | txqs.compl); wmb(); - wrp->wr_lo = htonl(V_WR_LEN(flits) | + wrp->wrh_lo = htonl(V_WR_LEN(flits) | V_WR_GEN(txqs.gen)) | htonl(V_WR_TID(txq->token)); /* XXX gen? */ wr_gen2(txd, txqs.gen); @@ -1390,14 +1393,12 @@ t3_encap(struct sge_qset *qs, struct mbu m0, mlen, m0->m_pkthdr.tso_segsz, m0->m_pkthdr.csum_flags, m0->m_flags); txq_prod(txq, 1, &txqs); m_copydata(m0, 0, mlen, (caddr_t)&txd->flit[3]); - m_freem(m0); - m0 = NULL; flits = (mlen + 7) / 8 + 3; - hdr->wr.wr_hi = htonl(V_WR_BCNTLFLT(mlen & 7) | + hdr->wr.wrh_hi = htonl(V_WR_BCNTLFLT(mlen & 7) | V_WR_OP(FW_WROPCODE_TUNNEL_TX_PKT) | F_WR_SOP | F_WR_EOP | txqs.compl); wmb(); - hdr->wr.wr_lo = htonl(V_WR_LEN(flits) | + hdr->wr.wrh_lo = htonl(V_WR_LEN(flits) | V_WR_GEN(txqs.gen) | V_WR_TID(txq->token)); wr_gen2(txd, txqs.gen); @@ -1407,7 +1408,7 @@ t3_encap(struct sge_qset *qs, struct mbu flits = 3; } else { struct cpl_tx_pkt *cpl = (struct cpl_tx_pkt *)txd; - + GET_VTAG(cntrl, m0); cntrl |= V_TXPKT_OPCODE(CPL_TX_PKT); if (__predict_false(!(m0->m_pkthdr.csum_flags & CSUM_IP))) @@ -1421,14 +1422,12 @@ t3_encap(struct sge_qset *qs, struct mbu if (mlen <= PIO_LEN) { txq_prod(txq, 1, &txqs); m_copydata(m0, 0, mlen, (caddr_t)&txd->flit[2]); - m_freem(m0); - m0 = NULL; flits = (mlen + 7) / 8 + 2; - cpl->wr.wr_hi = htonl(V_WR_BCNTLFLT(mlen & 7) | + cpl->wr.wrh_hi = htonl(V_WR_BCNTLFLT(mlen & 7) | V_WR_OP(FW_WROPCODE_TUNNEL_TX_PKT) | F_WR_SOP | F_WR_EOP | txqs.compl); wmb(); - cpl->wr.wr_lo = htonl(V_WR_LEN(flits) | + cpl->wr.wrh_lo = htonl(V_WR_LEN(flits) | V_WR_GEN(txqs.gen) | V_WR_TID(txq->token)); wr_gen2(txd, txqs.gen); @@ -1441,15 +1440,6 @@ t3_encap(struct sge_qset *qs, struct mbu } wrp = (struct work_request_hdr *)txd; -#ifdef nomore - /* - * XXX need to move into one of the helper routines above - * - */ - if ((err = busdma_map_mbufs(m, txq, txsd, segs, &nsegs)) != 0) - return (err); - m0 = *m; -#endif ndesc = calc_tx_descs(m0, nsegs); sgp = (ndesc == 1) ? (struct sg_ent *)&txd->flit[flits] : sgl; @@ -1464,17 +1454,137 @@ t3_encap(struct sge_qset *qs, struct mbu write_wr_hdr_sgl(ndesc, txd, &txqs, txq, sgl, flits, sgl_flits, wr_hi, wr_lo); check_ring_tx_db(pi->adapter, txq); - if ((m0->m_type == MT_DATA) && - ((m0->m_flags & (M_EXT|M_NOFREE)) == M_EXT) && - (m0->m_ext.ext_type != EXT_PACKET)) { - m0->m_flags &= ~M_EXT ; - cxgb_mbufs_outstanding--; - m_free(m0); + return (0); +} + +static void +cxgb_start_locked(struct sge_qset *qs) +{ + struct mbuf *m_head = NULL; + int txmax = TX_START_MAX_DESC; + struct sge_txq *txq = &qs->txq[TXQ_ETH]; + int in_use_init = txq->in_use; + struct port_info *pi = qs->port; + struct ifnet *ifp = pi->ifp; + int count = 1; + + TXQ_LOCK_ASSERT(qs); + while ((txq->in_use - in_use_init < txmax) && + (!TXQ_RING_EMPTY(qs))) { + + m_head = TXQ_RING_DEQUEUE(qs); + if (m_head == NULL) + break; + /* + * Encapsulation can modify our pointer, and or make it + * NULL on failure. In that event, we can't requeue. + */ + if (t3_encap(qs, &m_head, count)) + break; + + /* Send a copy of the frame to the BPF listener */ + ETHER_BPF_MTAP(ifp, m_head); + + /* + * We sent via PIO, no longer need a copy + */ + if (count == 1 && m_head->m_pkthdr.len <= PIO_LEN) + m_freem(m_head); + + m_head = NULL; + /* Set timeout in case hardware has problems transmitting. */ + pi->watchdog_timer = CXGB_TX_TIMEOUT; } + + if (m_head != NULL) + m_freem(m_head); +} + +static int +cxgb_transmit_locked(struct ifnet *ifp, struct sge_qset *qs, struct mbuf *m) +{ + struct port_info *pi = qs->port; + struct adapter *sc = pi->adapter; + struct buf_ring *br = qs->txq[TXQ_ETH].txq_mr; + int error, count = 1; + + TXQ_LOCK_ASSERT(qs); + /* + * XXX FIX ME + * + */ + if (((ifp->if_drv_flags & (IFF_DRV_RUNNING|IFF_DRV_OACTIVE)) != + IFF_DRV_RUNNING) + || (!pi->link_config.link_ok)) { + error = drbr_enqueue(ifp, br, m); + return (error); + } else if (TXQ_RING_EMPTY(qs) && sc->tunq_coalesce == 0) { + if (t3_encap(qs, &m, 1)) { + if (m != NULL && + (error = drbr_enqueue(ifp, br, m)) != 0) + return (error); + } else { + /* + * We've bypassed the buf ring so we need to update + * ifp directly + */ + drbr_stats_update(ifp, m->m_pkthdr.len, m->m_flags); + /* + ** Send a copy of the frame to the BPF + ** listener and set the watchdog on. + */ + ETHER_BPF_MTAP(ifp, m); + /* + * We sent via PIO, no longer need a copy + */ + if (count == 1 && m->m_pkthdr.len <= PIO_LEN) + m_freem(m); + + } + } else if ((error = drbr_enqueue(ifp, br, m)) != 0) + return (error); + if (!TXQ_RING_EMPTY(qs)) + cxgb_start_locked(qs); + return (0); } +int +cxgb_transmit(struct ifnet *ifp, struct mbuf *m) +{ + struct sge_qset *qs; + struct port_info *pi = ifp->if_softc; + int error, qidx = pi->first_qset; + + if (m->m_flags & M_FLOWID) + qidx = (m->m_pkthdr.flowid % pi->nqsets) + pi->first_qset; + + qs = &pi->adapter->sge.qs[qidx]; + + if (TXQ_TRYLOCK(qs)) { + /* XXX running */ + error = cxgb_transmit_locked(ifp, qs, m); + TXQ_UNLOCK(qs); + } else + error = drbr_enqueue(ifp, qs->txq[TXQ_ETH].txq_mr, m); + + return (error); +} +void +cxgb_start(struct ifnet *ifp) +{ + struct port_info *pi = ifp->if_softc; + struct sge_qset *qs = &pi->adapter->sge.qs[pi->first_qset]; + + if (!pi->link_config.link_ok) + return; + + TXQ_LOCK(qs); + cxgb_start_locked(qs); + TXQ_UNLOCK(qs); +} + /** * write_imm - write a packet into a Tx descriptor as immediate data @@ -1501,10 +1611,10 @@ write_imm(struct tx_desc *d, struct mbuf panic("len too small %d", len); memcpy(&to[1], &from[1], len - sizeof(*from)); - to->wr_hi = from->wr_hi | htonl(F_WR_SOP | F_WR_EOP | + to->wrh_hi = from->wrh_hi | htonl(F_WR_SOP | F_WR_EOP | V_WR_BCNTLFLT(len & 7)); wmb(); - to->wr_lo = from->wr_lo | htonl(V_WR_GEN(gen) | + to->wrh_lo = from->wrh_lo | htonl(V_WR_GEN(gen) | V_WR_LEN((len + 7) / 8)); wr_gen2(d, gen); @@ -1615,8 +1725,8 @@ ctrl_xmit(adapter_t *adap, struct sge_tx return 0; } - wrp->wr_hi |= htonl(F_WR_SOP | F_WR_EOP); - wrp->wr_lo = htonl(V_WR_TID(q->token)); + wrp->wrh_hi |= htonl(F_WR_SOP | F_WR_EOP); + wrp->wrh_lo = htonl(V_WR_TID(q->token)); mtx_lock(&q->lock); again: reclaim_completed_tx_imm(q); @@ -1882,16 +1992,13 @@ t3_free_tx_desc(struct sge_txq *q, int r mtx_assert(&q->lock, MA_OWNED); while (reclaimable--) { DPRINTF("cidx=%d d=%p\n", cidx, txsd); - if (txsd->mi.mi_base != NULL) { + if (txsd->m != NULL) { if (txsd->flags & TX_SW_DESC_MAPPED) { bus_dmamap_unload(q->entry_tag, txsd->map); txsd->flags &= ~TX_SW_DESC_MAPPED; } - m_freem_iovec(&txsd->mi); -#if 0 - buf_ring_scan(&q->txq_mr, txsd->mi.mi_base, __FILE__, __LINE__); -#endif - txsd->mi.mi_base = NULL; + m_freem_list(txsd->m); + txsd->m = NULL; } else q->txq_skipped++; @@ -1913,13 +2020,13 @@ t3_free_tx_desc_all(struct sge_txq *q) for (i = 0; i < q->size; i++) { txsd = &q->sdesc[i]; - if (txsd->mi.mi_base != NULL) { + if (txsd->m != NULL) { if (txsd->flags & TX_SW_DESC_MAPPED) { bus_dmamap_unload(q->entry_tag, txsd->map); txsd->flags &= ~TX_SW_DESC_MAPPED; } - m_freem_iovec(&txsd->mi); - bzero(&txsd->mi, sizeof(txsd->mi)); + m_freem_list(txsd->m); + txsd->m = NULL; } } } @@ -1992,7 +2099,7 @@ write_ofld_wr(adapter_t *adap, struct mb txqs.compl = 0; write_wr_hdr_sgl(ndesc, d, &txqs, q, sgl, flits, sgl_flits, - from->wr_hi, from->wr_lo); + from->wrh_hi, from->wrh_lo); } /** @@ -2011,9 +2118,11 @@ calc_tx_descs_ofld(struct mbuf *m, unsig if (m->m_len <= WR_LEN && nsegs == 0) return (1); /* packet fits as immediate data */ +#if 0 if (m->m_flags & M_IOVEC) cnt = mtomv(m)->mv_count; else +#endif cnt = nsegs; /* headers */ @@ -2506,9 +2615,6 @@ t3_rx_eth(struct adapter *adap, struct s m->m_pkthdr.rcvif = ifp; m->m_pkthdr.header = mtod(m, uint8_t *) + sizeof(*cpl) + ethpad; -#ifndef DISABLE_MBUF_IOVEC - m_explode(m); -#endif /* * adjust after conversion to mbuf chain */ @@ -2517,38 +2623,6 @@ t3_rx_eth(struct adapter *adap, struct s m->m_data += (sizeof(*cpl) + ethpad); } -static void -ext_free_handler(void *arg1, void * arg2) -{ - uintptr_t type = (uintptr_t)arg2; - uma_zone_t zone; - struct mbuf *m; - - m = arg1; - zone = m_getzonefromtype(type); - m->m_ext.ext_type = (int)type; - cxgb_ext_freed++; - cxgb_cache_put(zone, m); -} - -static void -init_cluster_mbuf(caddr_t cl, int flags, int type, uma_zone_t zone) -{ - struct mbuf *m; - int header_size; - - header_size = sizeof(struct mbuf); - bzero(cl, header_size); - m = (struct mbuf *)cl; - - cxgb_ext_inited++; - SLIST_INIT(&m->m_pkthdr.tags); - m_extadd(m, cl + header_size, - m_getsizefromtype(type), ext_free_handler, cl, NULL, - flags | M_NOFREE | M_EXT, EXT_NET_DRV); -} - - /** * get_packet - return the next ingress packet buffer from a free list * @adap: the adapter that received the packet @@ -2565,8 +2639,6 @@ init_cluster_mbuf(caddr_t cl, int flags, * threshold and the packet is too big to copy, or (b) the packet should * be copied but there is no memory for the copy. */ -#ifdef DISABLE_MBUF_IOVEC - static int get_packet(adapter_t *adap, unsigned int drop_thres, struct sge_qset *qs, struct t3_mbuf_hdr *mh, struct rsp_desc *r) @@ -2587,11 +2659,12 @@ get_packet(adapter_t *adap, unsigned int fl->credits--; bus_dmamap_sync(fl->entry_tag, sd->map, BUS_DMASYNC_POSTREAD); - if (recycle_enable && len <= SGE_RX_COPY_THRES && sopeop == RSPQ_SOP_EOP) { + if (recycle_enable && len <= SGE_RX_COPY_THRES && + sopeop == RSPQ_SOP_EOP) { if ((m0 = m_gethdr(M_DONTWAIT, MT_DATA)) == NULL) goto skip_recycle; cl = mtod(m0, void *); - memcpy(cl, sd->data, len); + memcpy(cl, sd->rxsd_cl, len); recycle_rx_buf(adap, fl, fl->cidx); m = m0; m0->m_len = len; @@ -2605,8 +2678,8 @@ get_packet(adapter_t *adap, unsigned int if ((sopeop == RSPQ_SOP_EOP) || (sopeop == RSPQ_SOP)) flags = M_PKTHDR; - init_cluster_mbuf(cl, flags, fl->type, fl->zone); - m0->m_len = len; + m_cljset(m0, cl, fl->type); + m0->m_pkthdr.len = m0->m_len = len; } switch(sopeop) { case RSPQ_SOP_EOP: @@ -2647,83 +2720,6 @@ get_packet(adapter_t *adap, unsigned int return (ret); } -#else - -static int -get_packet(adapter_t *adap, unsigned int drop_thres, struct sge_qset *qs, - struct mbuf **m, struct rsp_desc *r) -{ - - unsigned int len_cq = ntohl(r->len_cq); - struct sge_fl *fl = (len_cq & F_RSPD_FLQ) ? &qs->fl[1] : &qs->fl[0]; - struct rx_sw_desc *sd = &fl->sdesc[fl->cidx]; - uint32_t len = G_RSPD_LEN(len_cq); - uint32_t flags = ntohl(r->flags); - uint8_t sopeop = G_RSPD_SOP_EOP(flags); - void *cl; - int ret = 0; - struct mbuf *m0; -#if 0 - if ((sd + 1 )->rxsd_cl) - prefetch((sd + 1)->rxsd_cl); - if ((sd + 2)->rxsd_cl) - prefetch((sd + 2)->rxsd_cl); -#endif - DPRINTF("rx cpu=%d\n", curcpu); - fl->credits--; - bus_dmamap_sync(fl->entry_tag, sd->map, BUS_DMASYNC_POSTREAD); - - if (recycle_enable && len <= SGE_RX_COPY_THRES && sopeop == RSPQ_SOP_EOP) { - if ((m0 = m_gethdr(M_DONTWAIT, MT_DATA)) == NULL) - goto skip_recycle; - cl = mtod(m0, void *); - memcpy(cl, sd->data, len); - recycle_rx_buf(adap, fl, fl->cidx); - *m = m0; - } else { - skip_recycle: - bus_dmamap_unload(fl->entry_tag, sd->map); - cl = sd->rxsd_cl; - *m = m0 = (struct mbuf *)cl; - } - - switch(sopeop) { - case RSPQ_SOP_EOP: - DBG(DBG_RX, ("get_packet: SOP-EOP m %p\n", m)); - if (cl == sd->rxsd_cl) - init_cluster_mbuf(cl, M_PKTHDR, fl->type, fl->zone); - m0->m_len = m0->m_pkthdr.len = len; - ret = 1; - goto done; - break; - case RSPQ_NSOP_NEOP: - DBG(DBG_RX, ("get_packet: NO_SOP-NO_EOP m %p\n", m)); - panic("chaining unsupported"); - ret = 0; - break; - case RSPQ_SOP: - DBG(DBG_RX, ("get_packet: SOP m %p\n", m)); - panic("chaining unsupported"); - m_iovinit(m0); - ret = 0; - break; - case RSPQ_EOP: - DBG(DBG_RX, ("get_packet: EOP m %p\n", m)); - panic("chaining unsupported"); - ret = 1; - break; - } - panic("append not supported"); -#if 0 - m_iovappend(m0, cl, fl->buf_size, len, sizeof(uint32_t), sd->rxsd_ref); -#endif -done: - if (++fl->cidx == fl->size) - fl->cidx = 0; - - return (ret); -} -#endif /** * handle_rsp_cntrl_info - handles control information in a response * @qs: the queue set corresponding to the response @@ -2860,15 +2856,9 @@ process_responses(adapter_t *adap, struc } else if (r->len_cq) { int drop_thresh = eth ? SGE_RX_DROP_THRES : 0; -#ifdef DISABLE_MBUF_IOVEC eop = get_packet(adap, drop_thresh, qs, &rspq->rspq_mh, r); -#else - eop = get_packet(adap, drop_thresh, qs, &rspq->rspq_mbuf, r); -#endif -#ifdef IFNET_MULTIQUEUE rspq->rspq_mh.mh_head->m_flags |= M_FLOWID; rspq->rspq_mh.mh_head->m_pkthdr.flowid = rss_hash; -#endif ethpad = 2; } else { DPRINTF("pure response\n"); @@ -3348,10 +3338,6 @@ t3_add_attach_sysctls(adapter_t *sc) CTLFLAG_RD, &txq_fills, 0, "#times txq overrun"); SYSCTL_ADD_INT(ctx, children, OID_AUTO, - "pcpu_cache_enable", - CTLFLAG_RW, &cxgb_pcpu_cache_enable, - 0, "#enable driver local pcpu caches"); - SYSCTL_ADD_INT(ctx, children, OID_AUTO, "multiq_tx_enable", CTLFLAG_RW, &multiq_tx_enable, 0, "enable transmit by multiple tx queues"); @@ -3359,34 +3345,6 @@ t3_add_attach_sysctls(adapter_t *sc) "coalesce_tx_enable", CTLFLAG_RW, &coalesce_tx_enable, 0, "coalesce small packets in work requests - WARNING ALPHA"); - SYSCTL_ADD_INT(ctx, children, OID_AUTO, - "wakeup_tx_thread", - CTLFLAG_RW, &wakeup_tx_thread, - 0, "wakeup tx thread if no transmitter running"); - SYSCTL_ADD_INT(ctx, children, OID_AUTO, - "cache_alloc", - CTLFLAG_RD, &cxgb_cached_allocations, - 0, "#times a cluster was allocated from cache"); - SYSCTL_ADD_INT(ctx, children, OID_AUTO, - "cached", - CTLFLAG_RD, &cxgb_cached, - 0, "#times a cluster was cached"); - SYSCTL_ADD_INT(ctx, children, OID_AUTO, - "ext_freed", - CTLFLAG_RD, &cxgb_ext_freed, - 0, "#times a cluster was freed through ext_free"); - SYSCTL_ADD_INT(ctx, children, OID_AUTO, - "ext_inited", - CTLFLAG_RD, &cxgb_ext_inited, - 0, "#times a cluster was initialized for ext_free"); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Wed Jun 3 01:06:21 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C8115106564A; Wed, 3 Jun 2009 01:06:21 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9C4148FC1A; Wed, 3 Jun 2009 01:06:21 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5316L0n033936; Wed, 3 Jun 2009 01:06:21 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5316L76033935; Wed, 3 Jun 2009 01:06:21 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906030106.n5316L76033935@svn.freebsd.org> From: Kip Macy Date: Wed, 3 Jun 2009 01:06:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193360 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 03 Jun 2009 01:06:22 -0000 Author: kmacy Date: Wed Jun 3 01:06:21 2009 New Revision: 193360 URL: http://svn.freebsd.org/changeset/base/193360 Log: fix WR_HDR usage Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Wed Jun 3 00:59:06 2009 (r193359) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Wed Jun 3 01:06:21 2009 (r193360) @@ -1377,7 +1377,7 @@ init_tp_parity(struct adapter *adap) req = mtod(m, struct cpl_smt_write_req *); m->m_len = m->m_pkthdr.len = sizeof(*req); memset(req, 0, sizeof(*req)); - req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); + req->wr.wrh_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SMT_WRITE_REQ, i)); req->iff = i; t3_mgmt_tx(adap, m); @@ -1390,7 +1390,7 @@ init_tp_parity(struct adapter *adap) req = mtod(m, struct cpl_l2t_write_req *); m->m_len = m->m_pkthdr.len = sizeof(*req); memset(req, 0, sizeof(*req)); - req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); + req->wr.wrh_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_L2T_WRITE_REQ, i)); req->params = htonl(V_L2T_W_IDX(i)); t3_mgmt_tx(adap, m); @@ -1403,7 +1403,7 @@ init_tp_parity(struct adapter *adap) req = mtod(m, struct cpl_rte_write_req *); m->m_len = m->m_pkthdr.len = sizeof(*req); memset(req, 0, sizeof(*req)); - req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); + req->wr.wrh_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_RTE_WRITE_REQ, i)); req->l2t_idx = htonl(V_L2T_W_IDX(i)); t3_mgmt_tx(adap, m); @@ -1413,7 +1413,7 @@ init_tp_parity(struct adapter *adap) greq = mtod(m, struct cpl_set_tcb_field *); m->m_len = m->m_pkthdr.len = sizeof(*greq); memset(greq, 0, sizeof(*greq)); - greq->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); + greq->wr.wrh_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); OPCODE_TID(greq) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, 0)); greq->mask = htobe64(1); t3_mgmt_tx(adap, m); @@ -1494,7 +1494,7 @@ write_smt_entry(struct adapter *adapter, req = mtod(m, struct cpl_smt_write_req *); m->m_pkthdr.len = m->m_len = sizeof(struct cpl_smt_write_req); - req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); + req->wr.wrh_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SMT_WRITE_REQ, idx)); req->mtu_idx = NMTUS - 1; /* should be 0 but there's a T3 bug */ req->iff = idx; @@ -1538,7 +1538,7 @@ send_pktsched_cmd(struct adapter *adap, m = m_gethdr(M_DONTWAIT, MT_DATA); if (m) { req = mtod(m, struct mngt_pktsched_wr *); - req->wr_hi = htonl(V_WR_OP(FW_WROPCODE_MNGT)); + req->wr.wrh_hi = htonl(V_WR_OP(FW_WROPCODE_MNGT)); req->mngt_opcode = FW_MNGTOPCODE_PKTSCHED_SET; req->sched = sched; req->idx = qidx; From owner-svn-src-user@FreeBSD.ORG Wed Jun 3 01:13:12 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D80AB106566B; Wed, 3 Jun 2009 01:13:12 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C686D8FC17; Wed, 3 Jun 2009 01:13:12 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n531DCdZ034105; Wed, 3 Jun 2009 01:13:12 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n531DCU6034104; Wed, 3 Jun 2009 01:13:12 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906030113.n531DCU6034104@svn.freebsd.org> From: Kip Macy Date: Wed, 3 Jun 2009 01:13:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193361 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 03 Jun 2009 01:13:13 -0000 Author: kmacy Date: Wed Jun 3 01:13:12 2009 New Revision: 193361 URL: http://svn.freebsd.org/changeset/base/193361 Log: eliminate header_size deduction from mbuf Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Wed Jun 3 01:06:21 2009 (r193360) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Wed Jun 3 01:13:12 2009 (r193361) @@ -2385,7 +2385,7 @@ t3_sge_alloc_qset(adapter_t *sc, u_int i const struct qset_params *p, int ntxq, struct port_info *pi) { struct sge_qset *q = &sc->sge.qs[id]; - int i, header_size, ret = 0; + int i, ret = 0; for (i = 0; i < SGE_TXQ_PER_SET; i++) { @@ -2470,26 +2470,24 @@ t3_sge_alloc_qset(adapter_t *sc, u_int i q->rspq.cidx = 0; q->rspq.size = p->rspq_size; - - header_size = sizeof(struct mbuf) + sizeof(uint32_t); q->txq[TXQ_ETH].stop_thres = nports * flits_to_desc(sgl_len(TX_MAX_SEGS + 1) + 3); - q->fl[0].buf_size = (MCLBYTES - header_size); + q->fl[0].buf_size = MCLBYTES; q->fl[0].zone = zone_clust; q->fl[0].type = EXT_CLUSTER; #if __FreeBSD_version > 800000 if (cxgb_use_16k_clusters) { - q->fl[1].buf_size = MJUM16BYTES - header_size; + q->fl[1].buf_size = MJUM16BYTES; q->fl[1].zone = zone_jumbo16; q->fl[1].type = EXT_JUMBO16; } else { - q->fl[1].buf_size = MJUM9BYTES - header_size; + q->fl[1].buf_size = MJUM9BYTES; q->fl[1].zone = zone_jumbo9; q->fl[1].type = EXT_JUMBO9; } #else - q->fl[1].buf_size = MJUMPAGESIZE - header_size; + q->fl[1].buf_size = MJUMPAGESIZE; q->fl[1].zone = zone_jumbop; q->fl[1].type = EXT_JUMBOP; #endif From owner-svn-src-user@FreeBSD.ORG Wed Jun 3 01:59:42 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 714DF106566B; Wed, 3 Jun 2009 01:59:42 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 602CC8FC13; Wed, 3 Jun 2009 01:59:42 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n531xg5C035013; Wed, 3 Jun 2009 01:59:42 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n531xg89035012; Wed, 3 Jun 2009 01:59:42 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906030159.n531xg89035012@svn.freebsd.org> From: Kip Macy Date: Wed, 3 Jun 2009 01:59:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193362 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 03 Jun 2009 01:59:42 -0000 Author: kmacy Date: Wed Jun 3 01:59:42 2009 New Revision: 193362 URL: http://svn.freebsd.org/changeset/base/193362 Log: retrieve mbuf from software descriptor allocate 2k clusters from zone_pack Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Wed Jun 3 01:13:12 2009 (r193361) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Wed Jun 3 01:59:42 2009 (r193362) @@ -2474,8 +2474,8 @@ t3_sge_alloc_qset(adapter_t *sc, u_int i flits_to_desc(sgl_len(TX_MAX_SEGS + 1) + 3); q->fl[0].buf_size = MCLBYTES; - q->fl[0].zone = zone_clust; - q->fl[0].type = EXT_CLUSTER; + q->fl[0].zone = zone_pack; + q->fl[0].type = EXT_PACKET; #if __FreeBSD_version > 800000 if (cxgb_use_16k_clusters) { q->fl[1].buf_size = MJUM16BYTES; @@ -2671,12 +2671,13 @@ get_packet(adapter_t *adap, unsigned int bus_dmamap_unload(fl->entry_tag, sd->map); cl = sd->rxsd_cl; - m = m0 = (struct mbuf *)cl; + m = m0 = sd->m; if ((sopeop == RSPQ_SOP_EOP) || (sopeop == RSPQ_SOP)) flags = M_PKTHDR; - m_cljset(m0, cl, fl->type); + if (fl->zone != zone_pack) + m_cljset(m0, cl, fl->type); m0->m_pkthdr.len = m0->m_len = len; } switch(sopeop) { From owner-svn-src-user@FreeBSD.ORG Wed Jun 3 02:06:50 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 013F0106566B; Wed, 3 Jun 2009 02:06:50 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E45108FC0A; Wed, 3 Jun 2009 02:06:49 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5326nsg035217; Wed, 3 Jun 2009 02:06:49 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5326nlY035216; Wed, 3 Jun 2009 02:06:49 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906030206.n5326nlY035216@svn.freebsd.org> From: Kip Macy Date: Wed, 3 Jun 2009 02:06:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193363 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 03 Jun 2009 02:06:50 -0000 Author: kmacy Date: Wed Jun 3 02:06:49 2009 New Revision: 193363 URL: http://svn.freebsd.org/changeset/base/193363 Log: clear next pointers and set M_PKTHDR when needed Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Wed Jun 3 01:59:42 2009 (r193362) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Wed Jun 3 02:06:49 2009 (r193363) @@ -2678,6 +2678,8 @@ get_packet(adapter_t *adap, unsigned int flags = M_PKTHDR; if (fl->zone != zone_pack) m_cljset(m0, cl, fl->type); + m0->m_flags |= flags; + m0->m_next = m0->m_nextpkt = NULL; m0->m_pkthdr.len = m0->m_len = len; } switch(sopeop) { From owner-svn-src-user@FreeBSD.ORG Wed Jun 3 03:14:31 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4BFC4106566B; Wed, 3 Jun 2009 03:14:31 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 208D58FC14; Wed, 3 Jun 2009 03:14:31 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n533EVTB036764; Wed, 3 Jun 2009 03:14:31 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n533EUbY036761; Wed, 3 Jun 2009 03:14:30 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906030314.n533EUbY036761@svn.freebsd.org> From: Kip Macy Date: Wed, 3 Jun 2009 03:14:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193364 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 03 Jun 2009 03:14:31 -0000 Author: kmacy Date: Wed Jun 3 03:14:30 2009 New Revision: 193364 URL: http://svn.freebsd.org/changeset/base/193364 Log: enable cxgb_transmit, remove OACTIVE flag check Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Wed Jun 3 02:06:49 2009 (r193363) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Wed Jun 3 03:14:30 2009 (r193364) @@ -602,6 +602,7 @@ static inline int offload_running(adapte } int cxgb_transmit(struct ifnet *ifp, struct mbuf *m); +void cxgb_qflush(struct ifnet *ifp); int process_responses(adapter_t *adap, struct sge_qset *qs, int budget); void t3_free_qset(adapter_t *sc, struct sge_qset *q); void cxgb_start(struct ifnet *ifp); Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Wed Jun 3 02:06:49 2009 (r193363) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Wed Jun 3 03:14:30 2009 (r193364) @@ -956,10 +956,8 @@ cxgb_port_attach(device_t dev) } ether_ifattach(ifp, p->hw_addr); -#ifdef IFNET_BUF_RING ifp->if_transmit = cxgb_transmit; ifp->if_qflush = cxgb_qflush; -#endif /* * Only default to jumbo frames on 10GigE */ Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Wed Jun 3 02:06:49 2009 (r193363) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Wed Jun 3 03:14:30 2009 (r193364) @@ -1509,13 +1509,7 @@ cxgb_transmit_locked(struct ifnet *ifp, int error, count = 1; TXQ_LOCK_ASSERT(qs); - /* - * XXX FIX ME - * - */ - if (((ifp->if_drv_flags & (IFF_DRV_RUNNING|IFF_DRV_OACTIVE)) != - IFF_DRV_RUNNING) - || (!pi->link_config.link_ok)) { + if ((!pi->link_config.link_ok) /* check others */) { error = drbr_enqueue(ifp, br, m); return (error); } else if (TXQ_RING_EMPTY(qs) && sc->tunq_coalesce == 0) { @@ -1585,6 +1579,16 @@ cxgb_start(struct ifnet *ifp) TXQ_UNLOCK(qs); } +void +cxgb_qflush(struct ifnet *ifp) +{ + /* + * flush any enqueued mbufs in the buf_rings + * and in the transmit queues + * no-op for now + */ + return; +} /** * write_imm - write a packet into a Tx descriptor as immediate data From owner-svn-src-user@FreeBSD.ORG Wed Jun 3 03:42:01 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 99929106564A; Wed, 3 Jun 2009 03:42:01 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 88CF78FC22; Wed, 3 Jun 2009 03:42:01 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n533g1rT037287; Wed, 3 Jun 2009 03:42:01 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n533g1Ft037286; Wed, 3 Jun 2009 03:42:01 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906030342.n533g1Ft037286@svn.freebsd.org> From: Kip Macy Date: Wed, 3 Jun 2009 03:42:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193365 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 03 Jun 2009 03:42:01 -0000 Author: kmacy Date: Wed Jun 3 03:42:00 2009 New Revision: 193365 URL: http://svn.freebsd.org/changeset/base/193365 Log: stop using sx for port locks - this bit of cleverness causes more trouble than it is worth Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Wed Jun 3 03:14:30 2009 (r193364) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Wed Jun 3 03:42:00 2009 (r193365) @@ -65,8 +65,6 @@ $FreeBSD$ #include #endif -#define USE_SX - struct adapter; struct sge_qset; extern int cxgb_debug; From owner-svn-src-user@FreeBSD.ORG Wed Jun 3 07:31:00 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 639D41065670; Wed, 3 Jun 2009 07:31:00 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 3F0E18FC1D; Wed, 3 Jun 2009 07:31:00 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 3C73846B23; Wed, 3 Jun 2009 03:30:59 -0400 (EDT) Date: Wed, 3 Jun 2009 08:30:59 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Kip Macy In-Reply-To: <200906030206.n5326nlY035216@svn.freebsd.org> Message-ID: References: <200906030206.n5326nlY035216@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r193363 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 03 Jun 2009 07:31:00 -0000 On Wed, 3 Jun 2009, Kip Macy wrote: > clear next pointers and set M_PKTHDR when needed Without looking at the context in detail, in general, you need to allocate mbufs intended to be headers as that from inception, or use M_MOVE_PKTHDR(). MAC, for example, allocates an mbuf tag with each PKTHDR mbuf so that there's always storage for the MAC label on a packet, and if you hand assign the M_PKTHDR flag to mbufs, that alloation will be missed. This is only a problem if you later inject that header into the stack, but that's usually the point of adding headers so I'm guessing that can happen here? :-) Robert N M Watson Computer Laboratory University of Cambridge > > Modified: > user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c > > Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c > ============================================================================== > --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Wed Jun 3 01:59:42 2009 (r193362) > +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Wed Jun 3 02:06:49 2009 (r193363) > @@ -2678,6 +2678,8 @@ get_packet(adapter_t *adap, unsigned int > flags = M_PKTHDR; > if (fl->zone != zone_pack) > m_cljset(m0, cl, fl->type); > + m0->m_flags |= flags; > + m0->m_next = m0->m_nextpkt = NULL; > m0->m_pkthdr.len = m0->m_len = len; > } > switch(sopeop) { > From owner-svn-src-user@FreeBSD.ORG Wed Jun 3 16:04:28 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F0451065782; Wed, 3 Jun 2009 16:04:28 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0F6A28FC1E; Wed, 3 Jun 2009 16:04:28 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n53G4RWc059295; Wed, 3 Jun 2009 16:04:27 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n53G4RBO059294; Wed, 3 Jun 2009 16:04:27 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200906031604.n53G4RBO059294@svn.freebsd.org> From: Luigi Rizzo Date: Wed, 3 Jun 2009 16:04:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193384 - user/luigi/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 03 Jun 2009 16:04:29 -0000 Author: luigi Date: Wed Jun 3 16:04:27 2009 New Revision: 193384 URL: http://svn.freebsd.org/changeset/base/193384 Log: remove branch, useful parts already merged in Deleted: user/luigi/ipfw/ From owner-svn-src-user@FreeBSD.ORG Wed Jun 3 16:10:09 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 22D0D10656DE; Wed, 3 Jun 2009 16:10:09 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EC1338FC1D; Wed, 3 Jun 2009 16:10:08 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n53GA8X8059464; Wed, 3 Jun 2009 16:10:08 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n53GA82j059463; Wed, 3 Jun 2009 16:10:08 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200906031610.n53GA82j059463@svn.freebsd.org> From: Luigi Rizzo Date: Wed, 3 Jun 2009 16:10:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193385 - user/luigi/ipfw_80 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 03 Jun 2009 16:10:09 -0000 Author: luigi Date: Wed Jun 3 16:10:08 2009 New Revision: 193385 URL: http://svn.freebsd.org/changeset/base/193385 Log: create a branch for ipfw cleanup work in preparation for 8.0R Added: user/luigi/ipfw_80/ (props changed) - copied from r193384, head/ From owner-svn-src-user@FreeBSD.ORG Wed Jun 3 20:21:18 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 031901065672; Wed, 3 Jun 2009 20:21:18 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DAE548FC29; Wed, 3 Jun 2009 20:21:17 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n53KLHhi065277; Wed, 3 Jun 2009 20:21:17 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n53KLHqm065276; Wed, 3 Jun 2009 20:21:17 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906032021.n53KLHqm065276@svn.freebsd.org> From: Kip Macy Date: Wed, 3 Jun 2009 20:21:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193394 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 03 Jun 2009 20:21:18 -0000 Author: kmacy Date: Wed Jun 3 20:21:17 2009 New Revision: 193394 URL: http://svn.freebsd.org/changeset/base/193394 Log: remove reference to sx locking Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Wed Jun 3 19:41:12 2009 (r193393) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Wed Jun 3 20:21:17 2009 (r193394) @@ -37,7 +37,6 @@ $FreeBSD$ #include #include -#include #include #include #include @@ -82,17 +81,6 @@ extern int cxgb_debug; mtx_destroy((lock)); \ } while (0) -#define SX_INIT(lock, lockname) \ - do { \ - printf("initializing %s at %s:%d\n", lockname, __FILE__, __LINE__); \ - sx_init((lock), lockname); \ - } while (0) - -#define SX_DESTROY(lock) \ - do { \ - printf("destroying %s at %s:%d\n", (lock)->lock_object.lo_name, __FILE__, __LINE__); \ - sx_destroy((lock)); \ - } while (0) #else #define MTX_INIT mtx_init #define MTX_DESTROY mtx_destroy @@ -109,11 +97,7 @@ struct port_info { struct cmac mac; struct link_config link_config; struct ifmedia media; -#ifdef USE_SX - struct sx lock; -#else struct mtx lock; -#endif uint8_t port_id; uint8_t tx_chan; uint8_t txpkt_intf; @@ -385,11 +369,7 @@ struct adapter { char fw_version[64]; uint32_t open_device_map; uint32_t registered_device_map; -#ifdef USE_SX - struct sx lock; -#else struct mtx lock; -#endif driver_intr_t *cxgb_intr; int msi_count; @@ -413,19 +393,6 @@ struct t3_rx_mode { #define ELMR_UNLOCK(adapter) mtx_unlock(&(adapter)->elmer_lock) -#ifdef USE_SX -#define PORT_LOCK(port) sx_xlock(&(port)->lock); -#define PORT_UNLOCK(port) sx_xunlock(&(port)->lock); -#define PORT_LOCK_INIT(port, name) SX_INIT(&(port)->lock, name) -#define PORT_LOCK_DEINIT(port) SX_DESTROY(&(port)->lock) -#define PORT_LOCK_ASSERT_OWNED(port) sx_assert(&(port)->lock, SA_LOCKED) - -#define ADAPTER_LOCK(adap) sx_xlock(&(adap)->lock); -#define ADAPTER_UNLOCK(adap) sx_xunlock(&(adap)->lock); -#define ADAPTER_LOCK_INIT(adap, name) SX_INIT(&(adap)->lock, name) -#define ADAPTER_LOCK_DEINIT(adap) SX_DESTROY(&(adap)->lock) -#define ADAPTER_LOCK_ASSERT_NOTOWNED(adap) sx_assert(&(adap)->lock, SA_UNLOCKED) -#else #define PORT_LOCK(port) mtx_lock(&(port)->lock); #define PORT_UNLOCK(port) mtx_unlock(&(port)->lock); #define PORT_LOCK_INIT(port, name) mtx_init(&(port)->lock, name, 0, MTX_DEF) @@ -437,7 +404,6 @@ struct t3_rx_mode { #define ADAPTER_LOCK_INIT(adap, name) mtx_init(&(adap)->lock, name, 0, MTX_DEF) #define ADAPTER_LOCK_DEINIT(adap) mtx_destroy(&(adap)->lock) #define ADAPTER_LOCK_ASSERT_NOTOWNED(adap) mtx_assert(&(adap)->lock, MO_NOTOWNED) -#endif static __inline uint32_t From owner-svn-src-user@FreeBSD.ORG Wed Jun 3 20:49:25 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82F5610656CD; Wed, 3 Jun 2009 20:49:25 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 71B658FC2B; Wed, 3 Jun 2009 20:49:25 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n53KnP3c065959; Wed, 3 Jun 2009 20:49:25 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n53KnPFS065958; Wed, 3 Jun 2009 20:49:25 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906032049.n53KnPFS065958@svn.freebsd.org> From: Kip Macy Date: Wed, 3 Jun 2009 20:49:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193397 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 03 Jun 2009 20:49:25 -0000 Author: kmacy Date: Wed Jun 3 20:49:25 2009 New Revision: 193397 URL: http://svn.freebsd.org/changeset/base/193397 Log: move qset allocation out from underneat the port and adapter locks Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Wed Jun 3 20:25:13 2009 (r193396) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Wed Jun 3 20:49:25 2009 (r193397) @@ -1676,30 +1676,6 @@ cxgb_up(struct adapter *sc) { int err = 0; - if ((sc->flags & FULL_INIT_DONE) == 0) { - - if ((sc->flags & FW_UPTODATE) == 0) - if ((err = upgrade_fw(sc))) - goto out; - if ((sc->flags & TPS_UPTODATE) == 0) - if ((err = update_tpsram(sc))) - goto out; - err = t3_init_hw(sc, 0); - if (err) - goto out; - - t3_set_reg_field(sc, A_TP_PARA_REG5, 0, F_RXDDPOFFINIT); - t3_write_reg(sc, A_ULPRX_TDDP_PSZ, V_HPZ0(PAGE_SHIFT - 12)); - - err = setup_sge_qsets(sc); - if (err) - goto out; - - setup_rss(sc); - t3_add_configured_sysctls(sc); - sc->flags |= FULL_INIT_DONE; - } - t3_intr_clear(sc); /* If it's MSI or INTx, allocate a single interrupt for everything */ @@ -1863,12 +1839,47 @@ offload_close(struct t3cdev *tdev) return (0); } +static int +cxgb_first_init(struct adapter *sc) +{ + int err = 0; + + if ((sc->flags & FW_UPTODATE) == 0) + if ((err = upgrade_fw(sc))) + goto out; + if ((sc->flags & TPS_UPTODATE) == 0) + if ((err = update_tpsram(sc))) + goto out; + err = t3_init_hw(sc, 0); + if (err) + goto out; + + t3_set_reg_field(sc, A_TP_PARA_REG5, 0, F_RXDDPOFFINIT); + t3_write_reg(sc, A_ULPRX_TDDP_PSZ, V_HPZ0(PAGE_SHIFT - 12)); + + err = setup_sge_qsets(sc); + if (err) + goto out; + + ADAPTER_LOCK(sc); + setup_rss(sc); + t3_add_configured_sysctls(sc); + sc->flags |= FULL_INIT_DONE; + ADAPTER_UNLOCK(sc); +out: + return (err); +} static void cxgb_init(void *arg) { struct port_info *p = arg; - + struct adapter *sc = p->adapter; + + if (((sc->flags & FULL_INIT_DONE) == 0) && + (cxgb_first_init(sc))) + return; + PORT_LOCK(p); cxgb_init_locked(p); PORT_UNLOCK(p); From owner-svn-src-user@FreeBSD.ORG Wed Jun 3 21:02:14 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE747106564A; Wed, 3 Jun 2009 21:02:14 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BD63A8FC17; Wed, 3 Jun 2009 21:02:14 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n53L2E9K066299; Wed, 3 Jun 2009 21:02:14 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n53L2Epj066297; Wed, 3 Jun 2009 21:02:14 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906032102.n53L2Epj066297@svn.freebsd.org> From: Kip Macy Date: Wed, 3 Jun 2009 21:02:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193398 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 03 Jun 2009 21:02:15 -0000 Author: kmacy Date: Wed Jun 3 21:02:14 2009 New Revision: 193398 URL: http://svn.freebsd.org/changeset/base/193398 Log: serialize initialization with added flag Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Wed Jun 3 20:49:25 2009 (r193397) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Wed Jun 3 21:02:14 2009 (r193398) @@ -127,6 +127,7 @@ enum { /* adapter flags */ CXGB_SHUTDOWN = (1 << 6), CXGB_OFLD_INIT = (1 << 7), TP_PARITY_INIT = (1 << 8), + INIT_IN_PROGRESS = (1 << 9), }; #define FL_Q_SIZE 4096 Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Wed Jun 3 20:49:25 2009 (r193397) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Wed Jun 3 21:02:14 2009 (r193398) @@ -1844,6 +1844,14 @@ cxgb_first_init(struct adapter *sc) { int err = 0; + ADAPTER_LOCK(sc); + if (sc->flags & INIT_IN_PROGRESS) { + ADAPTER_UNLOCK(sc); + return (EINPROGRESS); + } + sc->flags |= INIT_IN_PROGRESS; + ADAPTER_UNLOCK(sc); + if ((sc->flags & FW_UPTODATE) == 0) if ((err = upgrade_fw(sc))) goto out; @@ -1861,9 +1869,10 @@ cxgb_first_init(struct adapter *sc) if (err) goto out; - ADAPTER_LOCK(sc); setup_rss(sc); t3_add_configured_sysctls(sc); + ADAPTER_LOCK(sc); + sc->flags &= ~INIT_IN_PROGRESS; sc->flags |= FULL_INIT_DONE; ADAPTER_UNLOCK(sc); out: From owner-svn-src-user@FreeBSD.ORG Wed Jun 3 21:18:27 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 663C91065693; Wed, 3 Jun 2009 21:18:27 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 54EDC8FC17; Wed, 3 Jun 2009 21:18:27 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n53LIRTP067205; Wed, 3 Jun 2009 21:18:27 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n53LIR6f067203; Wed, 3 Jun 2009 21:18:27 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906032118.n53LIR6f067203@svn.freebsd.org> From: Kip Macy Date: Wed, 3 Jun 2009 21:18:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193403 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 03 Jun 2009 21:18:27 -0000 Author: kmacy Date: Wed Jun 3 21:18:27 2009 New Revision: 193403 URL: http://svn.freebsd.org/changeset/base/193403 Log: move interrupt initialization out from under adapter and port locks Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Wed Jun 3 21:11:51 2009 (r193402) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Wed Jun 3 21:18:27 2009 (r193403) @@ -128,6 +128,7 @@ enum { /* adapter flags */ CXGB_OFLD_INIT = (1 << 7), TP_PARITY_INIT = (1 << 8), INIT_IN_PROGRESS = (1 << 9), + INTR_INIT_DONE = (1 << 10), }; #define FL_Q_SIZE 4096 Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Wed Jun 3 21:11:51 2009 (r193402) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Wed Jun 3 21:18:27 2009 (r193403) @@ -1676,32 +1676,6 @@ cxgb_up(struct adapter *sc) { int err = 0; - t3_intr_clear(sc); - - /* If it's MSI or INTx, allocate a single interrupt for everything */ - if ((sc->flags & USING_MSIX) == 0) { - if ((sc->irq_res = bus_alloc_resource_any(sc->dev, SYS_RES_IRQ, - &sc->irq_rid, RF_SHAREABLE | RF_ACTIVE)) == NULL) { - device_printf(sc->dev, "Cannot allocate interrupt rid=%d\n", - sc->irq_rid); - err = EINVAL; - goto out; - } - device_printf(sc->dev, "allocated irq_res=%p\n", sc->irq_res); - - if (bus_setup_intr(sc->dev, sc->irq_res, INTR_MPSAFE|INTR_TYPE_NET, -#ifdef INTR_FILTERS - NULL, -#endif - sc->cxgb_intr, sc, &sc->intr_tag)) { - device_printf(sc->dev, "Cannot set up interrupt\n"); - err = EINVAL; - goto irq_err; - } - } else { - cxgb_setup_msix(sc, sc->msi_count); - } - t3_sge_start(sc); t3_intr_enable(sc); @@ -1714,17 +1688,13 @@ cxgb_up(struct adapter *sc) F_CMCACHEPERR | F_ARPLUTPERR); t3_write_reg(sc, A_TP_INT_ENABLE, 0x7fbfffff); } - if (!(sc->flags & QUEUES_BOUND)) { bind_qsets(sc); sc->flags |= QUEUES_BOUND; } -out: + return (err); -irq_err: - CH_ERR(sc, "request_irq failed, err %d\n", err); - goto out; } @@ -1879,6 +1849,51 @@ out: return (err); } +static int +cxgb_intr_init(struct adapter *sc) +{ + int err = 0; + + ADAPTER_LOCK(sc); + sc->flags |= INIT_IN_PROGRESS; + ADAPTER_UNLOCK(sc); + + t3_intr_clear(sc); + + /* If it's MSI or INTx, allocate a single interrupt for everything */ + if ((sc->flags & USING_MSIX) == 0) { + if ((sc->irq_res = bus_alloc_resource_any(sc->dev, SYS_RES_IRQ, + &sc->irq_rid, RF_SHAREABLE | RF_ACTIVE)) == NULL) { + device_printf(sc->dev, "Cannot allocate interrupt rid=%d\n", + sc->irq_rid); + err = EINVAL; + goto out; + } + device_printf(sc->dev, "allocated irq_res=%p\n", sc->irq_res); + + if (bus_setup_intr(sc->dev, sc->irq_res, INTR_MPSAFE|INTR_TYPE_NET, +#ifdef INTR_FILTERS + NULL, +#endif + sc->cxgb_intr, sc, &sc->intr_tag)) { + device_printf(sc->dev, "Cannot set up interrupt\n"); + err = EINVAL; + CH_ERR(sc, "request_irq failed, err %d\n", err); + goto out; + } + } else { + cxgb_setup_msix(sc, sc->msi_count); + } + + ADAPTER_LOCK(sc); + sc->flags &= ~INIT_IN_PROGRESS; + sc->flags |= INTR_INIT_DONE; + ADAPTER_UNLOCK(sc); +out: + return (err); +} + + static void cxgb_init(void *arg) { @@ -1888,7 +1903,11 @@ cxgb_init(void *arg) if (((sc->flags & FULL_INIT_DONE) == 0) && (cxgb_first_init(sc))) return; - + + if (((sc->flags & INTR_INIT_DONE) == 0) && + (cxgb_intr_init(sc))) + return; + PORT_LOCK(p); cxgb_init_locked(p); PORT_UNLOCK(p); From owner-svn-src-user@FreeBSD.ORG Wed Jun 3 21:26:37 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CFDD1106566C; Wed, 3 Jun 2009 21:26:37 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BEDB98FC12; Wed, 3 Jun 2009 21:26:37 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n53LQb9p067443; Wed, 3 Jun 2009 21:26:37 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n53LQbLQ067442; Wed, 3 Jun 2009 21:26:37 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906032126.n53LQbLQ067442@svn.freebsd.org> From: Kip Macy Date: Wed, 3 Jun 2009 21:26:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193404 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 03 Jun 2009 21:26:38 -0000 Author: kmacy Date: Wed Jun 3 21:26:37 2009 New Revision: 193404 URL: http://svn.freebsd.org/changeset/base/193404 Log: don't proceed with device enabling if setup is not complete Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Wed Jun 3 21:18:27 2009 (r193403) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Wed Jun 3 21:26:37 2009 (r193404) @@ -1923,6 +1923,10 @@ cxgb_init_locked(struct port_info *p) PORT_LOCK_ASSERT_OWNED(p); ifp = p->ifp; + if ((sc->flags & (FULL_INIT_DONE|INTR_INIT_DONE)) == + (FULL_INIT_DONE|INTR_INIT_DONE)) + return; + ADAPTER_LOCK(p->adapter); if ((sc->open_device_map == 0) && (err = cxgb_up(sc))) { ADAPTER_UNLOCK(p->adapter); From owner-svn-src-user@FreeBSD.ORG Wed Jun 3 21:29:51 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5FD37106566C; Wed, 3 Jun 2009 21:29:51 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 45E358FC12; Wed, 3 Jun 2009 21:29:51 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n53LTp9f067530; Wed, 3 Jun 2009 21:29:51 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n53LTpHa067529; Wed, 3 Jun 2009 21:29:51 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906032129.n53LTpHa067529@svn.freebsd.org> From: Kip Macy Date: Wed, 3 Jun 2009 21:29:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193405 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 03 Jun 2009 21:29:51 -0000 Author: kmacy Date: Wed Jun 3 21:29:50 2009 New Revision: 193405 URL: http://svn.freebsd.org/changeset/base/193405 Log: fix sanity check Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Wed Jun 3 21:26:37 2009 (r193404) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Wed Jun 3 21:29:50 2009 (r193405) @@ -1923,7 +1923,7 @@ cxgb_init_locked(struct port_info *p) PORT_LOCK_ASSERT_OWNED(p); ifp = p->ifp; - if ((sc->flags & (FULL_INIT_DONE|INTR_INIT_DONE)) == + if ((sc->flags & (FULL_INIT_DONE|INTR_INIT_DONE)) != (FULL_INIT_DONE|INTR_INIT_DONE)) return; From owner-svn-src-user@FreeBSD.ORG Wed Jun 3 21:56:30 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 227D610656A6; Wed, 3 Jun 2009 21:56:30 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 113DA8FC0A; Wed, 3 Jun 2009 21:56:30 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n53LuTlp068247; Wed, 3 Jun 2009 21:56:29 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n53LuTMb068245; Wed, 3 Jun 2009 21:56:29 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906032156.n53LuTMb068245@svn.freebsd.org> From: Kip Macy Date: Wed, 3 Jun 2009 21:56:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193408 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 03 Jun 2009 21:56:30 -0000 Author: kmacy Date: Wed Jun 3 21:56:29 2009 New Revision: 193408 URL: http://svn.freebsd.org/changeset/base/193408 Log: release interrupt resources without lock held - try to avoid races with initialization Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Wed Jun 3 21:50:26 2009 (r193407) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Wed Jun 3 21:56:29 2009 (r193408) @@ -129,6 +129,7 @@ enum { /* adapter flags */ TP_PARITY_INIT = (1 << 8), INIT_IN_PROGRESS = (1 << 9), INTR_INIT_DONE = (1 << 10), + TEARDOWN_IN_PROGRESS = (1 << 11), }; #define FL_Q_SIZE 4096 Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Wed Jun 3 21:50:26 2009 (r193407) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Wed Jun 3 21:56:29 2009 (r193408) @@ -99,6 +99,7 @@ static void cxgb_tick_handler(void *, in static void cxgb_down_locked(struct adapter *sc); static void cxgb_tick(void *); static void setup_rss(adapter_t *sc); +static void cxgb_release(struct adapter *sc); /* Attachment glue for the PCI controller end of the device. Each port of * the device is attached separately, as defined later. @@ -661,6 +662,7 @@ cxgb_free(struct adapter *sc) * drops the lock */ cxgb_down_locked(sc); + cxgb_release(sc); #ifdef MSI_SUPPORTED if (sc->flags & (USING_MSI | USING_MSIX)) { @@ -1038,7 +1040,7 @@ cxgb_port_detach(device_t dev) if (p->ifp->if_drv_flags & IFF_DRV_RUNNING) cxgb_stop_locked(p); PORT_UNLOCK(p); - + ether_ifdetach(p->ifp); printf("waiting for callout to stop ..."); DELAY(1000000); @@ -1697,17 +1699,17 @@ cxgb_up(struct adapter *sc) return (err); } - -/* - * Release resources when all the ports and offloading have been stopped. - */ static void -cxgb_down_locked(struct adapter *sc) +cxgb_release(struct adapter *sc) { + ADAPTER_LOCK(sc); + if (sc->flags & TEARDOWN_IN_PROGRESS) { + ADAPTER_UNLOCK(sc); + return; + } + sc->flags |= TEARDOWN_IN_PROGRESS; + ADAPTER_UNLOCK(sc); - t3_sge_stop(sc); - t3_intr_disable(sc); - if (sc->intr_tag != NULL) { bus_teardown_intr(sc->dev, sc->irq_res, sc->intr_tag); sc->intr_tag = NULL; @@ -1722,14 +1724,7 @@ cxgb_down_locked(struct adapter *sc) if (sc->flags & USING_MSIX) cxgb_teardown_msix(sc); - - callout_stop(&sc->cxgb_tick_ch); - callout_stop(&sc->sge_timer_ch); - ADAPTER_UNLOCK(sc); - callout_drain(&sc->cxgb_tick_ch); - callout_drain(&sc->sge_timer_ch); - if (sc->tq != NULL) { printf("draining slow intr\n"); taskqueue_drain(sc->tq, &sc->slow_intr_task); @@ -1738,6 +1733,26 @@ cxgb_down_locked(struct adapter *sc) printf("draining tick task\n"); taskqueue_drain(sc->tq, &sc->tick_task); } + + ADAPTER_LOCK(sc); + sc->flags &= ~(TEARDOWN_IN_PROGRESS|INTR_INIT_DONE); + ADAPTER_UNLOCK(sc); +} + +/* + * Release resources when all the ports and offloading have been stopped. + */ +static void +cxgb_down_locked(struct adapter *sc) +{ + + t3_sge_stop(sc); + t3_intr_disable(sc); + + callout_stop(&sc->cxgb_tick_ch); + callout_stop(&sc->sge_timer_ch); + ADAPTER_UNLOCK(sc); + } static int @@ -1855,6 +1870,10 @@ cxgb_intr_init(struct adapter *sc) int err = 0; ADAPTER_LOCK(sc); + if (sc->flags & (INIT_IN_PROGRESS|TEARDOWN_IN_PROGRESS)) { + ADAPTER_UNLOCK(sc); + return (EINPROGRESS); + } sc->flags |= INIT_IN_PROGRESS; ADAPTER_UNLOCK(sc); @@ -2100,10 +2119,12 @@ cxgb_ioctl(struct ifnet *ifp, unsigned l } else cxgb_init_locked(p); p->if_flags = ifp->if_flags; - } else if (ifp->if_drv_flags & IFF_DRV_RUNNING) + PORT_UNLOCK(p); + } else if (ifp->if_drv_flags & IFF_DRV_RUNNING) { cxgb_stop_locked(p); - - PORT_UNLOCK(p); + PORT_UNLOCK(p); + cxgb_release(p->adapter); + } break; case SIOCADDMULTI: case SIOCDELMULTI: From owner-svn-src-user@FreeBSD.ORG Wed Jun 3 23:27:34 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6109F106564A; Wed, 3 Jun 2009 23:27:34 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4FB388FC0A; Wed, 3 Jun 2009 23:27:34 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n53NRY8w070283; Wed, 3 Jun 2009 23:27:34 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n53NRY5t070281; Wed, 3 Jun 2009 23:27:34 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906032327.n53NRY5t070281@svn.freebsd.org> From: Kip Macy Date: Wed, 3 Jun 2009 23:27:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193411 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 03 Jun 2009 23:27:34 -0000 Author: kmacy Date: Wed Jun 3 23:27:34 2009 New Revision: 193411 URL: http://svn.freebsd.org/changeset/base/193411 Log: busdmap_map_sg_vec can't fail - change to void Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/mvec.h user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/uipc_mvec.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/mvec.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/mvec.h Wed Jun 3 23:01:13 2009 (r193410) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/mvec.h Wed Jun 3 23:27:34 2009 (r193411) @@ -50,7 +50,7 @@ busdma_map_mbuf_fast(struct mbuf *m, bus } int busdma_map_sg_collapse(struct mbuf **m, bus_dma_segment_t *segs, int *nsegs); -int busdma_map_sg_vec(struct mbuf **m, bus_dma_segment_t *segs, int count); +void busdma_map_sg_vec(struct mbuf **m, bus_dma_segment_t *segs, int count); static __inline int busdma_map_sgl(bus_dma_segment_t *vsegs, bus_dma_segment_t *segs, int count) { Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/uipc_mvec.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/uipc_mvec.c Wed Jun 3 23:01:13 2009 (r193410) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/uipc_mvec.c Wed Jun 3 23:27:34 2009 (r193411) @@ -63,7 +63,6 @@ int busdma_map_sg_collapse(struct mbuf **m, bus_dma_segment_t *segs, int *nsegs) { struct mbuf *n = *m; - struct mbuf *marray[TX_MAX_SEGS]; int seg_count, defragged = 0, err = 0; bus_dma_segment_t *psegs; @@ -117,7 +116,7 @@ err_out: return (err); } -int +void busdma_map_sg_vec(struct mbuf **m, bus_dma_segment_t *segs, int pkt_count) { struct mbuf *m0; @@ -126,6 +125,5 @@ busdma_map_sg_vec(struct mbuf **m, bus_d for (m0 = *m, i = 0; i < pkt_count; segs++, i++, m0 = m0->m_nextpkt) busdma_map_mbuf_fast(m0, segs); - return (0); } From owner-svn-src-user@FreeBSD.ORG Wed Jun 3 23:28:23 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 12F9E1065672; Wed, 3 Jun 2009 23:28:23 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0076E8FC1D; Wed, 3 Jun 2009 23:28:23 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n53NSMn2070336; Wed, 3 Jun 2009 23:28:22 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n53NSMMp070333; Wed, 3 Jun 2009 23:28:22 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906032328.n53NSMMp070333@svn.freebsd.org> From: Kip Macy Date: Wed, 3 Jun 2009 23:28:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193412 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 03 Jun 2009 23:28:23 -0000 Author: kmacy Date: Wed Jun 3 23:28:22 2009 New Revision: 193412 URL: http://svn.freebsd.org/changeset/base/193412 Log: - reclaim in transmit path - remove txq lock in faver qset lock Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Wed Jun 3 23:27:34 2009 (r193411) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Wed Jun 3 23:28:22 2009 (r193412) @@ -232,7 +232,6 @@ struct sge_txq { bus_addr_t phys_addr; struct task qresume_task; struct task qreclaim_task; - struct port_info *port; uint32_t cntxt_id; uint64_t stops; uint64_t restarts; @@ -250,10 +249,7 @@ struct sge_txq { uint32_t txq_dump_start; uint32_t txq_dump_count; unsigned long txq_frees; - struct mtx lock; struct sg_ent txq_sgl[TX_MAX_SEGS / 2 + 1]; - #define TXQ_NAME_LEN 32 - char lockbuf[TXQ_NAME_LEN]; }; @@ -284,7 +280,7 @@ struct sge_qset { int idx; /* qset # */ int qs_flags; struct cv qs_cv; - struct mtx qs_mtx; + struct mtx lock; #define QS_NAME_LEN 32 char namebuf[QS_NAME_LEN]; }; Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Wed Jun 3 23:27:34 2009 (r193411) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Wed Jun 3 23:28:22 2009 (r193412) @@ -677,11 +677,12 @@ cxgb_free(struct adapter *sc) sc->msix_regs_res); } + t3_free_sge_resources(sc); t3_sge_deinit_sw(sc); + /* * Wait for last callout */ - DELAY(hz*100); for (i = 0; i < (sc)->params.nports; ++i) { Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Wed Jun 3 23:27:34 2009 (r193411) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Wed Jun 3 23:28:22 2009 (r193412) @@ -198,10 +198,10 @@ static uint8_t flit_desc_map[] = { #endif }; -#define TXQ_LOCK_ASSERT(qs) mtx_assert(&(qs)->txq[TXQ_ETH].lock, MA_OWNED) -#define TXQ_TRYLOCK(qs) mtx_trylock(&(qs)->txq[TXQ_ETH].lock) -#define TXQ_LOCK(qs) mtx_lock(&(qs)->txq[TXQ_ETH].lock) -#define TXQ_UNLOCK(qs) mtx_unlock(&(qs)->txq[TXQ_ETH].lock) +#define TXQ_LOCK_ASSERT(qs) mtx_assert(&(qs)->lock, MA_OWNED) +#define TXQ_TRYLOCK(qs) mtx_trylock(&(qs)->lock) +#define TXQ_LOCK(qs) mtx_lock(&(qs)->lock) +#define TXQ_UNLOCK(qs) mtx_unlock(&(qs)->lock) #define TXQ_RING_EMPTY(qs) drbr_empty((qs)->port->ifp, (qs)->txq[TXQ_ETH].txq_mr) #define TXQ_RING_DEQUEUE(qs) drbr_dequeue((qs)->port->ifp, (qs)->txq[TXQ_ETH].txq_mr) #define CXGB_TX_TIMEOUT 5 @@ -222,19 +222,24 @@ static void sge_txq_reclaim_handler(void * queue's lock held. */ static __inline int -reclaim_completed_tx_(struct sge_txq *q, int reclaim_min) +reclaim_completed_tx(struct sge_qset *qs, int reclaim_min, int queue) { + struct sge_txq *q = &qs->txq[queue]; + int reclaim = desc_reclaimable(q); if (reclaim < reclaim_min) return (0); - mtx_assert(&q->lock, MA_OWNED); + mtx_assert(&qs->lock, MA_OWNED); if (reclaim > 0) { t3_free_tx_desc(q, reclaim); q->cleaned += reclaim; q->in_use -= reclaim; - } + } + if (isset(&qs->txq_stopped, TXQ_ETH)) + clrbit(&qs->txq_stopped, TXQ_ETH); + return (reclaim); } @@ -872,13 +877,7 @@ static __inline void sge_txq_reclaim_(struct sge_txq *txq, int force) { - if (desc_reclaimable(txq) < 16) - return; - if (mtx_trylock(&txq->lock) == 0) - return; - reclaim_completed_tx_(txq, 16); - mtx_unlock(&txq->lock); - + panic("unimplemented"); } static void @@ -1284,8 +1283,7 @@ t3_encap(struct sge_qset *qs, struct mbu tso_info = V_LSO_MSS(m0->m_pkthdr.tso_segsz); #endif if (count > 1) { - if ((err = busdma_map_sg_vec(m, segs, count))) - return (err); + busdma_map_sg_vec(m, segs, count); nsegs = count; } else if ((err = busdma_map_sg_collapse(&m0, segs, &nsegs))) { if (cxgb_debug) @@ -1509,6 +1507,8 @@ cxgb_transmit_locked(struct ifnet *ifp, int error, count = 1; TXQ_LOCK_ASSERT(qs); + reclaim_completed_tx(qs, (TX_ETH_Q_SIZE>>3), TXQ_ETH); + if ((!pi->link_config.link_ok) /* check others */) { error = drbr_enqueue(ifp, br, m); return (error); @@ -1719,11 +1719,12 @@ immediate(const struct mbuf *m) * descriptor and have no page fragments. */ static int -ctrl_xmit(adapter_t *adap, struct sge_txq *q, struct mbuf *m) +ctrl_xmit(adapter_t *adap, struct sge_qset *qs, struct mbuf *m) { int ret; struct work_request_hdr *wrp = mtod(m, struct work_request_hdr *); - + struct sge_txq *q = &qs->txq[TXQ_CTRL]; + if (__predict_false(!immediate(m))) { m_freem(m); return 0; @@ -1732,13 +1733,13 @@ ctrl_xmit(adapter_t *adap, struct sge_tx wrp->wrh_hi |= htonl(F_WR_SOP | F_WR_EOP); wrp->wrh_lo = htonl(V_WR_TID(q->token)); - mtx_lock(&q->lock); + TXQ_LOCK(qs); again: reclaim_completed_tx_imm(q); ret = check_desc_avail(adap, q, m, 1, TXQ_CTRL); if (__predict_false(ret)) { if (ret == 1) { - mtx_unlock(&q->lock); + TXQ_UNLOCK(qs); log(LOG_ERR, "no desc available\n"); return (ENOSPC); } @@ -1751,8 +1752,7 @@ again: reclaim_completed_tx_imm(q); q->pidx = 0; q->gen ^= 1; } - mtx_unlock(&q->lock); - wmb(); + TXQ_UNLOCK(qs); t3_write_reg(adap, A_SG_KDOORBELL, F_SELEGRCNTX | V_EGRCNTX(q->cntxt_id)); return (0); @@ -1775,7 +1775,7 @@ restart_ctrlq(void *data, int npending) log(LOG_WARNING, "Restart_ctrlq in_use=%d\n", q->in_use); - mtx_lock(&q->lock); + TXQ_LOCK(qs); again: reclaim_completed_tx_imm(q); while (q->in_use < q->size && @@ -1791,15 +1791,13 @@ again: reclaim_completed_tx_imm(q); } if (!mbufq_empty(&q->sendq)) { setbit(&qs->txq_stopped, TXQ_CTRL); - smp_mb(); if (should_restart_tx(q) && test_and_clear_bit(TXQ_CTRL, &qs->txq_stopped)) goto again; q->stops++; } - mtx_unlock(&q->lock); - wmb(); + TXQ_UNLOCK(qs); t3_write_reg(adap, A_SG_KDOORBELL, F_SELEGRCNTX | V_EGRCNTX(q->cntxt_id)); } @@ -1811,7 +1809,7 @@ again: reclaim_completed_tx_imm(q); int t3_mgmt_tx(struct adapter *adap, struct mbuf *m) { - return ctrl_xmit(adap, &adap->sge.qs[0].txq[TXQ_CTRL], m); + return ctrl_xmit(adap, &adap->sge.qs[0], m); } @@ -1857,6 +1855,7 @@ t3_free_qset(adapter_t *sc, struct sge_q } } + MTX_DESTROY(&q->lock); for (i = 0; i < SGE_TXQ_PER_SET; i++) { if (q->txq[i].desc) { mtx_lock_spin(&sc->sge.reg_lock); @@ -1868,7 +1867,6 @@ t3_free_qset(adapter_t *sc, struct sge_q q->txq[i].desc_map); bus_dma_tag_destroy(q->txq[i].desc_tag); bus_dma_tag_destroy(q->txq[i].entry_tag); - MTX_DESTROY(&q->txq[i].lock); } if (q->txq[i].sdesc) { free(q->txq[i].sdesc, M_DEVBUF); @@ -1905,9 +1903,6 @@ t3_free_sge_resources(adapter_t *sc) { int i, nqsets; -#ifdef IFNET_MULTIQUEUE - panic("%s should not be called when IFNET_MULTIQUEUE is defined", __FUNCTION__); -#endif for (nqsets = i = 0; i < (sc)->params.nports; i++) nqsets += sc->port[i].nqsets; @@ -2146,11 +2141,12 @@ calc_tx_descs_ofld(struct mbuf *m, unsig * Send an offload packet through an SGE offload queue. */ static int -ofld_xmit(adapter_t *adap, struct sge_txq *q, struct mbuf *m) +ofld_xmit(adapter_t *adap, struct sge_qset *qs, struct mbuf *m) { int ret, nsegs; unsigned int ndesc; unsigned int pidx, gen; + struct sge_txq *q = &qs->txq[TXQ_OFLD]; bus_dma_segment_t segs[TX_MAX_SEGS], *vsegs; struct tx_sw_desc *stx; @@ -2162,15 +2158,15 @@ ofld_xmit(adapter_t *adap, struct sge_tx stx = &q->sdesc[q->pidx]; KASSERT(stx->mi.mi_base == NULL, ("mi_base set")); - mtx_lock(&q->lock); -again: reclaim_completed_tx_(q, 16); + TXQ_LOCK(qs); +again: reclaim_completed_tx(qs, 16, TXQ_OFLD); ret = check_desc_avail(adap, q, m, ndesc, TXQ_OFLD); if (__predict_false(ret)) { if (ret == 1) { printf("no ofld desc avail\n"); m_set_priority(m, ndesc); /* save for restart */ - mtx_unlock(&q->lock); + TXQ_UNLOCK(qs); return (EINTR); } goto again; @@ -2190,7 +2186,7 @@ again: reclaim_completed_tx_(q, 16); ndesc, pidx, skb->len, skb->len - skb->data_len, skb_shinfo(skb)->nr_frags); #endif - mtx_unlock(&q->lock); + TXQ_UNLOCK(qs); write_ofld_wr(adap, m, q, pidx, gen, ndesc, segs, nsegs); check_ring_tx_db(adap, q); @@ -2214,8 +2210,8 @@ restart_offloadq(void *data, int npendin struct tx_sw_desc *stx = &q->sdesc[q->pidx]; int nsegs, cleaned; - mtx_lock(&q->lock); -again: cleaned = reclaim_completed_tx_(q, 16); + TXQ_LOCK(qs); +again: cleaned = reclaim_completed_tx(qs, 16, TXQ_OFLD); while ((m = mbufq_peek(&q->sendq)) != NULL) { unsigned int gen, pidx; @@ -2243,16 +2239,15 @@ again: cleaned = reclaim_completed_tx_(q (void)mbufq_dequeue(&q->sendq); busdma_map_mbufs(&m, q, stx, segs, &nsegs); - mtx_unlock(&q->lock); + TXQ_UNLOCK(qs); write_ofld_wr(adap, m, q, pidx, gen, ndesc, segs, nsegs); - mtx_lock(&q->lock); + TXQ_LOCK(qs); } - mtx_unlock(&q->lock); - #if USE_GTS set_bit(TXQ_RUNNING, &q->flags); set_bit(TXQ_LAST_PKT_DB, &q->flags); #endif + TXQ_UNLOCK(qs); wmb(); t3_write_reg(adap, A_SG_KDOORBELL, F_SELEGRCNTX | V_EGRCNTX(q->cntxt_id)); @@ -2300,9 +2295,9 @@ t3_offload_tx(struct t3cdev *tdev, struc struct sge_qset *qs = &adap->sge.qs[queue_set(m)]; if (__predict_false(is_ctrl_pkt(m))) - return ctrl_xmit(adap, &qs->txq[TXQ_CTRL], m); + return ctrl_xmit(adap, qs, m); - return ofld_xmit(adap, &qs->txq[TXQ_OFLD], m); + return ofld_xmit(adap, qs, m); } /** @@ -2394,7 +2389,7 @@ t3_sge_alloc_qset(adapter_t *sc, u_int i for (i = 0; i < SGE_TXQ_PER_SET; i++) { if ((q->txq[i].txq_mr = buf_ring_alloc(cxgb_txq_buf_ring_size, - M_DEVBUF, M_WAITOK, &q->txq[i].lock)) == NULL) { + M_DEVBUF, M_WAITOK, &q->lock)) == NULL) { device_printf(sc->dev, "failed to allocate mbuf ring\n"); goto err; } @@ -2454,12 +2449,9 @@ t3_sge_alloc_qset(adapter_t *sc, u_int i mbufq_init(&q->txq[i].sendq); q->txq[i].gen = 1; q->txq[i].size = p->txq_size[i]; - snprintf(q->txq[i].lockbuf, TXQ_NAME_LEN, "t3 txq lock %d:%d:%d", - device_get_unit(sc->dev), irq_vec_idx, i); - MTX_INIT(&q->txq[i].lock, q->txq[i].lockbuf, NULL, MTX_DEF); } - - q->txq[TXQ_ETH].port = pi; + MTX_INIT(&q->lock, q->namebuf, NULL, MTX_DEF); + q->port = pi; TASK_INIT(&q->txq[TXQ_OFLD].qresume_task, 0, restart_offloadq, q); TASK_INIT(&q->txq[TXQ_CTRL].qresume_task, 0, restart_ctrlq, q); @@ -3050,11 +3042,8 @@ t3_intr_msix(void *data) struct sge_qset *qs = data; adapter_t *adap = qs->port->adapter; struct sge_rspq *rspq = &qs->rspq; -#ifndef IFNET_MULTIQUEUE + mtx_lock(&rspq->lock); -#else - if (mtx_trylock(&rspq->lock)) -#endif { if (process_responses_gts(adap, rspq) == 0) From owner-svn-src-user@FreeBSD.ORG Wed Jun 3 23:47:44 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 255FF1065679; Wed, 3 Jun 2009 23:47:44 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ED62C8FC25; Wed, 3 Jun 2009 23:47:43 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n53Nlh7W070812; Wed, 3 Jun 2009 23:47:43 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n53NlhVT070811; Wed, 3 Jun 2009 23:47:43 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906032347.n53NlhVT070811@svn.freebsd.org> From: Kip Macy Date: Wed, 3 Jun 2009 23:47:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193415 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 03 Jun 2009 23:47:44 -0000 Author: kmacy Date: Wed Jun 3 23:47:43 2009 New Revision: 193415 URL: http://svn.freebsd.org/changeset/base/193415 Log: cleanup delayed reclaim handler Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Wed Jun 3 23:33:09 2009 (r193414) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Wed Jun 3 23:47:43 2009 (r193415) @@ -873,23 +873,16 @@ refill_rspq(adapter_t *sc, const struct V_RSPQ(q->cntxt_id) | V_CREDITS(credits)); } -static __inline void -sge_txq_reclaim_(struct sge_txq *txq, int force) -{ - - panic("unimplemented"); -} - static void sge_txq_reclaim_handler(void *arg, int ncount) { - struct sge_txq *q = arg; + struct sge_qset *qs = arg; + int i; - sge_txq_reclaim_(q, TRUE); + for (i = 0; i < 3; i++) + reclaim_completed_tx(qs, 16, i); } - - static void sge_timer_reclaim(void *arg, int ncount) { @@ -897,7 +890,6 @@ sge_timer_reclaim(void *arg, int ncount) int i, nqsets = pi->nqsets; adapter_t *sc = pi->adapter; struct sge_qset *qs; - struct sge_txq *txq; struct mtx *lock; #ifdef IFNET_MULTIQUEUE @@ -906,9 +898,7 @@ sge_timer_reclaim(void *arg, int ncount) for (i = 0; i < nqsets; i++) { qs = &sc->sge.qs[pi->first_qset + i]; - txq = &qs->txq[TXQ_OFLD]; - sge_txq_reclaim_(txq, FALSE); - + reclaim_completed_tx(qs, 16, TXQ_OFLD); lock = (sc->flags & USING_MSIX) ? &qs->rspq.lock : &sc->sge.qs[0].rspq.lock; @@ -2455,8 +2445,8 @@ t3_sge_alloc_qset(adapter_t *sc, u_int i TASK_INIT(&q->txq[TXQ_OFLD].qresume_task, 0, restart_offloadq, q); TASK_INIT(&q->txq[TXQ_CTRL].qresume_task, 0, restart_ctrlq, q); - TASK_INIT(&q->txq[TXQ_ETH].qreclaim_task, 0, sge_txq_reclaim_handler, &q->txq[TXQ_ETH]); - TASK_INIT(&q->txq[TXQ_OFLD].qreclaim_task, 0, sge_txq_reclaim_handler, &q->txq[TXQ_OFLD]); + TASK_INIT(&q->txq[TXQ_ETH].qreclaim_task, 0, sge_txq_reclaim_handler, q); + TASK_INIT(&q->txq[TXQ_OFLD].qreclaim_task, 0, sge_txq_reclaim_handler, q); q->fl[0].gen = q->fl[1].gen = 1; q->fl[0].size = p->fl_size; From owner-svn-src-user@FreeBSD.ORG Wed Jun 3 23:58:25 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 486B4106568B; Wed, 3 Jun 2009 23:58:25 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 371CC8FC18; Wed, 3 Jun 2009 23:58:25 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n53NwP5u071030; Wed, 3 Jun 2009 23:58:25 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n53NwPEO071029; Wed, 3 Jun 2009 23:58:25 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906032358.n53NwPEO071029@svn.freebsd.org> From: Kip Macy Date: Wed, 3 Jun 2009 23:58:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193416 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 03 Jun 2009 23:58:25 -0000 Author: kmacy Date: Wed Jun 3 23:58:24 2009 New Revision: 193416 URL: http://svn.freebsd.org/changeset/base/193416 Log: don't do teardown if initialization never happened Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Wed Jun 3 23:47:43 2009 (r193415) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Wed Jun 3 23:58:24 2009 (r193416) @@ -677,7 +677,8 @@ cxgb_free(struct adapter *sc) sc->msix_regs_res); } - t3_free_sge_resources(sc); + if (sc->flags & FULL_INIT_DONE) + t3_free_sge_resources(sc); t3_sge_deinit_sw(sc); /* @@ -1858,10 +1859,12 @@ cxgb_first_init(struct adapter *sc) setup_rss(sc); t3_add_configured_sysctls(sc); ADAPTER_LOCK(sc); - sc->flags &= ~INIT_IN_PROGRESS; sc->flags |= FULL_INIT_DONE; ADAPTER_UNLOCK(sc); out: + ADAPTER_LOCK(sc); + sc->flags &= ~INIT_IN_PROGRESS; + ADAPTER_UNLOCK(sc); return (err); } @@ -1906,10 +1909,12 @@ cxgb_intr_init(struct adapter *sc) } ADAPTER_LOCK(sc); - sc->flags &= ~INIT_IN_PROGRESS; sc->flags |= INTR_INIT_DONE; ADAPTER_UNLOCK(sc); out: + ADAPTER_LOCK(sc); + sc->flags &= ~INIT_IN_PROGRESS; + ADAPTER_UNLOCK(sc); return (err); } From owner-svn-src-user@FreeBSD.ORG Thu Jun 4 00:28:18 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 71455106566C; Thu, 4 Jun 2009 00:28:18 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 604DE8FC0A; Thu, 4 Jun 2009 00:28:18 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n540SIm6071667; Thu, 4 Jun 2009 00:28:18 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n540SIfg071666; Thu, 4 Jun 2009 00:28:18 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906040028.n540SIfg071666@svn.freebsd.org> From: Kip Macy Date: Thu, 4 Jun 2009 00:28:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193417 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 04 Jun 2009 00:28:18 -0000 Author: kmacy Date: Thu Jun 4 00:28:18 2009 New Revision: 193417 URL: http://svn.freebsd.org/changeset/base/193417 Log: don't release interrupt resources when taking an interface down Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Wed Jun 3 23:58:24 2009 (r193416) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Thu Jun 4 00:28:18 2009 (r193417) @@ -2129,7 +2129,6 @@ cxgb_ioctl(struct ifnet *ifp, unsigned l } else if (ifp->if_drv_flags & IFF_DRV_RUNNING) { cxgb_stop_locked(p); PORT_UNLOCK(p); - cxgb_release(p->adapter); } break; case SIOCADDMULTI: From owner-svn-src-user@FreeBSD.ORG Thu Jun 4 01:12:18 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 981B4106564A; Thu, 4 Jun 2009 01:12:18 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.240]) by mx1.freebsd.org (Postfix) with ESMTP id 278188FC17; Thu, 4 Jun 2009 01:12:18 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: by an-out-0708.google.com with SMTP id c3so209122ana.13 for ; Wed, 03 Jun 2009 18:12:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=OeNwXWkFNJRZljzO3LSEn+7Xgh2wy5UkOZDWLy97UbU=; b=cO8rM954kcwbynt1cxbTOfrLAeG4V5cbCB535Lwy2LJo9OR3YOHDIyGyym39RobYUD ck68z9NmPXBAmz5uhzzctFmOHAzOn4NRhsINkZc8MlatXSyPTULuPiiBc9Z5AmQhtR2L CEcYzGjIqbFE5OuqE7rKac8ndkLkk++XMVm2c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=BnrR1lw7tJ6JRry9bqkvlc+1rgzd+87SYM5krGRhhA3XsrfbGKTOb+Nbn3SC1/5K+W tKP0QeHIC27BUrJTXtGI9j/WsMzDkPuBfujagClWPsQl9X0aCNOX0eAHVGbAuN32Iaz0 YHLf8PM4qvLT1OrJPJzhz0WHG6nw8//iIx9JA= MIME-Version: 1.0 Sender: mat.macy@gmail.com Received: by 10.100.126.15 with SMTP id y15mr1906792anc.71.1244077937489; Wed, 03 Jun 2009 18:12:17 -0700 (PDT) In-Reply-To: References: <200906030206.n5326nlY035216@svn.freebsd.org> Date: Wed, 3 Jun 2009 18:12:17 -0700 X-Google-Sender-Auth: 6c138ab3dd3c3db0 Message-ID: <3c1674c90906031812r3d5940ffybc1144257359b18d@mail.gmail.com> From: Kip Macy To: Robert Watson Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r193363 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 04 Jun 2009 01:12:18 -0000 On Wed, Jun 3, 2009 at 12:30 AM, Robert Watson wrote: > On Wed, 3 Jun 2009, Kip Macy wrote: > >> =A0clear next pointers and set M_PKTHDR when needed > > Without looking at the context in detail, in general, you need to allocat= e > mbufs intended to be headers as that from inception, or use M_MOVE_PKTHDR= (). > MAC, for example, allocates an mbuf tag with each PKTHDR mbuf so that > there's always storage for the MAC label on a packet, and if you hand ass= ign > the M_PKTHDR flag to mbufs, that alloation will be missed. =A0This is onl= y a > problem if you later inject that header into the stack, but that's usuall= y > the point of adding headers so I'm guessing that can happen here? :-) The problem is that by doing that I end up taking cache misses on the mbuf twice. How does MAC support deferred initialization? I can just defer the actual mbuf allocation if need be. -Kip -Kip > > Robert N M Watson > Computer Laboratory > University of Cambridge > >> >> Modified: >> =A0user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c >> >> Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c >> >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c =A0 Wed Jun =A03 >> 01:59:42 2009 =A0 =A0 =A0 =A0(r193362) >> +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c =A0 Wed Jun =A03 >> 02:06:49 2009 =A0 =A0 =A0 =A0(r193363) >> @@ -2678,6 +2678,8 @@ get_packet(adapter_t *adap, unsigned int >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0flags =3D M_PKTHDR; >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (fl->zone !=3D zone_pack) >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0m_cljset(m0, cl, fl->type= ); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 m0->m_flags |=3D flags; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 m0->m_next =3D m0->m_nextpkt =3D NULL; >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0m0->m_pkthdr.len =3D m0->m_len =3D len; >> =A0 =A0 =A0 =A0} >> =A0 =A0 =A0 =A0switch(sopeop) { >> > --=20 When bad men combine, the good must associate; else they will fall one by one, an unpitied sacrifice in a contemptible struggle. Edmund Burke From owner-svn-src-user@FreeBSD.ORG Thu Jun 4 01:45:41 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 10887106566C; Thu, 4 Jun 2009 01:45:41 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F34818FC0A; Thu, 4 Jun 2009 01:45:40 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n541je6Z073163; Thu, 4 Jun 2009 01:45:40 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n541jeYr073162; Thu, 4 Jun 2009 01:45:40 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906040145.n541jeYr073162@svn.freebsd.org> From: Kip Macy Date: Thu, 4 Jun 2009 01:45:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193418 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 04 Jun 2009 01:45:41 -0000 Author: kmacy Date: Thu Jun 4 01:45:40 2009 New Revision: 193418 URL: http://svn.freebsd.org/changeset/base/193418 Log: always drop PORT_LOCK Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Thu Jun 4 00:28:18 2009 (r193417) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Thu Jun 4 01:45:40 2009 (r193418) @@ -2125,11 +2125,9 @@ cxgb_ioctl(struct ifnet *ifp, unsigned l } else cxgb_init_locked(p); p->if_flags = ifp->if_flags; - PORT_UNLOCK(p); - } else if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + } else if (ifp->if_drv_flags & IFF_DRV_RUNNING) cxgb_stop_locked(p); - PORT_UNLOCK(p); - } + PORT_UNLOCK(p); break; case SIOCADDMULTI: case SIOCDELMULTI: From owner-svn-src-user@FreeBSD.ORG Thu Jun 4 03:19:00 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9CA50106564A; Thu, 4 Jun 2009 03:19:00 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7061A8FC14; Thu, 4 Jun 2009 03:19:00 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n543J02C075645; Thu, 4 Jun 2009 03:19:00 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n543J05o075643; Thu, 4 Jun 2009 03:19:00 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906040319.n543J05o075643@svn.freebsd.org> From: Kip Macy Date: Thu, 4 Jun 2009 03:19:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193421 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 04 Jun 2009 03:19:00 -0000 Author: kmacy Date: Thu Jun 4 03:18:59 2009 New Revision: 193421 URL: http://svn.freebsd.org/changeset/base/193421 Log: remove #ifdef INET call cxgb_init instead of cxgb_init_locked Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_osdep.h Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Thu Jun 4 02:49:50 2009 (r193420) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Thu Jun 4 03:18:59 2009 (r193421) @@ -2086,9 +2086,7 @@ static int cxgb_ioctl(struct ifnet *ifp, unsigned long command, caddr_t data) { struct port_info *p = ifp->if_softc; -#ifdef INET struct ifaddr *ifa = (struct ifaddr *)data; -#endif struct ifreq *ifr = (struct ifreq *)data; int flags, error = 0, reinit = 0; uint32_t mask; @@ -2101,17 +2099,13 @@ cxgb_ioctl(struct ifnet *ifp, unsigned l error = cxgb_set_mtu(p, ifr->ifr_mtu); break; case SIOCSIFADDR: -#ifdef INET if (ifa->ifa_addr->sa_family == AF_INET) { ifp->if_flags |= IFF_UP; if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { - PORT_LOCK(p); - cxgb_init_locked(p); - PORT_UNLOCK(p); + cxgb_init(p); } arp_ifinit(ifp, ifa); } else -#endif error = ether_ioctl(ifp, command, data); break; case SIOCSIFFLAGS: @@ -2122,8 +2116,11 @@ cxgb_ioctl(struct ifnet *ifp, unsigned l if (((ifp->if_flags ^ flags) & IFF_PROMISC) || ((ifp->if_flags ^ flags) & IFF_ALLMULTI)) cxgb_set_rxmode(p); - } else + } else { + PORT_UNLOCK(p); cxgb_init_locked(p); + PORT_LOCK(p); + } p->if_flags = ifp->if_flags; } else if (ifp->if_drv_flags & IFF_DRV_RUNNING) cxgb_stop_locked(p); Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_osdep.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_osdep.h Thu Jun 4 02:49:50 2009 (r193420) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_osdep.h Thu Jun 4 03:18:59 2009 (r193421) @@ -116,7 +116,7 @@ struct t3_mbuf_hdr { #if __FreeBSD_version >= 701000 #include "opt_inet.h" -#ifdef INET +#ifdef notyet #define LRO_SUPPORTED #endif #define TOE_SUPPORTED From owner-svn-src-user@FreeBSD.ORG Thu Jun 4 04:00:30 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0025C1065670; Thu, 4 Jun 2009 04:00:29 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D70248FC0A; Thu, 4 Jun 2009 04:00:29 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5440T9s076524; Thu, 4 Jun 2009 04:00:29 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5440TV3076520; Thu, 4 Jun 2009 04:00:29 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906040400.n5440TV3076520@svn.freebsd.org> From: Kip Macy Date: Thu, 4 Jun 2009 04:00:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193423 - in user/kmacy/releng_7_2_fcs/sys: net netinet netinet6 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 04 Jun 2009 04:00:30 -0000 Author: kmacy Date: Thu Jun 4 04:00:29 2009 New Revision: 193423 URL: http://svn.freebsd.org/changeset/base/193423 Log: MFC L2 prefix cleanup and dhcp fixes Modified: user/kmacy/releng_7_2_fcs/sys/net/if_llatbl.c user/kmacy/releng_7_2_fcs/sys/net/if_llatbl.h user/kmacy/releng_7_2_fcs/sys/netinet/in.c user/kmacy/releng_7_2_fcs/sys/netinet6/in6.c Modified: user/kmacy/releng_7_2_fcs/sys/net/if_llatbl.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/net/if_llatbl.c Thu Jun 4 03:59:20 2009 (r193422) +++ user/kmacy/releng_7_2_fcs/sys/net/if_llatbl.c Thu Jun 4 04:00:29 2009 (r193423) @@ -195,6 +195,23 @@ lltable_drain(int af) IFNET_RUNLOCK(); } +void +lltable_prefix_free(int af, struct sockaddr *prefix, struct sockaddr *mask) +{ + struct lltable *llt; + + IFNET_RLOCK(); + SLIST_FOREACH(llt, &lltables, llt_link) { + if (llt->llt_af != af) + continue; + + llt->llt_prefix_free(llt, prefix, mask); + } + IFNET_RUNLOCK(); +} + + + /* * Create a new lltable. */ Modified: user/kmacy/releng_7_2_fcs/sys/net/if_llatbl.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/net/if_llatbl.h Thu Jun 4 03:59:20 2009 (r193422) +++ user/kmacy/releng_7_2_fcs/sys/net/if_llatbl.h Thu Jun 4 04:00:29 2009 (r193423) @@ -147,6 +147,9 @@ struct lltable { struct llentry * (*llt_new)(const struct sockaddr *, u_int); void (*llt_free)(struct lltable *, struct llentry *); + void (*llt_prefix_free)(struct lltable *, + const struct sockaddr *prefix, + const struct sockaddr *mask); struct llentry * (*llt_lookup)(struct lltable *, u_int flags, const struct sockaddr *l3addr); int (*llt_rtcheck)(struct ifnet *, @@ -174,6 +177,8 @@ MALLOC_DECLARE(M_LLTABLE); struct lltable *lltable_init(struct ifnet *, int); void lltable_free(struct lltable *); +void lltable_prefix_free(int, struct sockaddr *, + struct sockaddr *); void lltable_drain(int); int lltable_sysctl_dumparp(int, struct sysctl_req *); Modified: user/kmacy/releng_7_2_fcs/sys/netinet/in.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/netinet/in.c Thu Jun 4 03:59:20 2009 (r193422) +++ user/kmacy/releng_7_2_fcs/sys/netinet/in.c Thu Jun 4 04:00:29 2009 (r193423) @@ -927,6 +927,7 @@ in_scrubprefix(struct in_ifaddr *target) struct in_ifaddr *ia; struct in_addr prefix, mask, p; int error; + struct sockaddr_in prefix0, mask0; struct rt_addrinfo info; struct sockaddr_dl null_sdl; @@ -996,6 +997,20 @@ in_scrubprefix(struct in_ifaddr *target) } /* + * remove all L2 entries on the given prefix + */ + bzero(&prefix0, sizeof(prefix0)); + prefix0.sin_len = sizeof(prefix0); + prefix0.sin_family = AF_INET; + prefix0.sin_addr.s_addr = target->ia_subnet; + bzero(&mask0, sizeof(mask0)); + mask0.sin_len = sizeof(mask0); + mask0.sin_family = AF_INET; + mask0.sin_addr.s_addr = target->ia_subnetmask; + lltable_prefix_free(AF_INET, (struct sockaddr *)&prefix0, + (struct sockaddr *)&mask0); + + /* * As no-one seem to have this prefix, we can remove the route. */ rtinit(&(target->ia_ifa), (int)RTM_DELETE, rtinitflags(target)); @@ -1121,6 +1136,34 @@ in_lltable_free(struct lltable *llt, str free(lle, M_LLTABLE); } + +#define IN_ARE_MASKED_ADDR_EQUAL(d, a, m) ( \ + (((ntohl((d)->sin_addr.s_addr) ^ (a)->sin_addr.s_addr) & (m)->sin_addr.s_addr)) == 0 ) + +static void +in_lltable_prefix_free(struct lltable *llt, + const struct sockaddr *prefix, + const struct sockaddr *mask) +{ + const struct sockaddr_in *pfx = (const struct sockaddr_in *)prefix; + const struct sockaddr_in *msk = (const struct sockaddr_in *)mask; + struct llentry *lle, *next; + register int i; + + for (i=0; i < LLTBL_HASHTBL_SIZE; i++) { + LIST_FOREACH_SAFE(lle, &llt->lle_head[i], lle_next, next) { + + if (IN_ARE_MASKED_ADDR_EQUAL((struct sockaddr_in *)L3_ADDR(lle), + pfx, msk)) { + callout_drain(&lle->la_timer); + LLE_WLOCK(lle); + llentry_free(lle); + } + } + } +} + + static int in_lltable_rtcheck(struct ifnet *ifp, const struct sockaddr *l3addr) { @@ -1307,6 +1350,7 @@ in_domifattach(struct ifnet *ifp) if (llt != NULL) { llt->llt_new = in_lltable_new; llt->llt_free = in_lltable_free; + llt->llt_prefix_free = in_lltable_prefix_free; llt->llt_rtcheck = in_lltable_rtcheck; llt->llt_lookup = in_lltable_lookup; llt->llt_dump = in_lltable_dump; Modified: user/kmacy/releng_7_2_fcs/sys/netinet6/in6.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/netinet6/in6.c Thu Jun 4 03:59:20 2009 (r193422) +++ user/kmacy/releng_7_2_fcs/sys/netinet6/in6.c Thu Jun 4 04:00:29 2009 (r193423) @@ -2297,6 +2297,30 @@ in6_lltable_free(struct lltable *llt, st free(lle, M_LLTABLE); } +static void +in6_lltable_prefix_free(struct lltable *llt, + const struct sockaddr *prefix, + const struct sockaddr *mask) +{ + const struct sockaddr_in6 *pfx = (const struct sockaddr_in6 *)prefix; + const struct sockaddr_in6 *msk = (const struct sockaddr_in6 *)mask; + struct llentry *lle, *next; + register int i; + + for (i=0; i < LLTBL_HASHTBL_SIZE; i++) { + LIST_FOREACH_SAFE(lle, &llt->lle_head[i], lle_next, next) { + if (IN6_ARE_MASKED_ADDR_EQUAL( + &((struct sockaddr_in6 *)L3_ADDR(lle))->sin6_addr, + &pfx->sin6_addr, + &msk->sin6_addr)) { + callout_drain(&lle->la_timer); + LLE_WLOCK(lle); + llentry_free(lle); + } + } + } +} + static int in6_lltable_rtcheck(struct ifnet *ifp, const struct sockaddr *l3addr) { @@ -2503,6 +2527,7 @@ in6_domifattach(struct ifnet *ifp) if (ext->lltable != NULL) { ext->lltable->llt_new = in6_lltable_new; ext->lltable->llt_free = in6_lltable_free; + ext->lltable->llt_prefix_free = in6_lltable_prefix_free; ext->lltable->llt_rtcheck = in6_lltable_rtcheck; ext->lltable->llt_lookup = in6_lltable_lookup; ext->lltable->llt_dump = in6_lltable_dump; From owner-svn-src-user@FreeBSD.ORG Thu Jun 4 04:11:27 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A42D1106566C; Thu, 4 Jun 2009 04:11:27 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 924388FC12; Thu, 4 Jun 2009 04:11:27 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n544BRKK076815; Thu, 4 Jun 2009 04:11:27 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n544BRw5076813; Thu, 4 Jun 2009 04:11:27 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906040411.n544BRw5076813@svn.freebsd.org> From: Kip Macy Date: Thu, 4 Jun 2009 04:11:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193424 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 04 Jun 2009 04:11:27 -0000 Author: kmacy Date: Thu Jun 4 04:11:27 2009 New Revision: 193424 URL: http://svn.freebsd.org/changeset/base/193424 Log: fix INVARIANTS compile Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Thu Jun 4 04:00:29 2009 (r193423) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Thu Jun 4 04:11:27 2009 (r193424) @@ -402,7 +402,7 @@ struct t3_rx_mode { #define ADAPTER_UNLOCK(adap) mtx_unlock(&(adap)->lock); #define ADAPTER_LOCK_INIT(adap, name) mtx_init(&(adap)->lock, name, 0, MTX_DEF) #define ADAPTER_LOCK_DEINIT(adap) mtx_destroy(&(adap)->lock) -#define ADAPTER_LOCK_ASSERT_NOTOWNED(adap) mtx_assert(&(adap)->lock, MO_NOTOWNED) +#define ADAPTER_LOCK_ASSERT_NOTOWNED(adap) mtx_assert(&(adap)->lock, MA_NOTOWNED) static __inline uint32_t @@ -510,7 +510,7 @@ int t3_sge_init_adapter(adapter_t *); int t3_sge_reset_adapter(adapter_t *); int t3_sge_init_port(struct port_info *); void t3_sge_deinit_sw(adapter_t *); -void t3_free_tx_desc(struct sge_txq *q, int n); +void t3_free_tx_desc(struct sge_qset *qs, int n, int qid); void t3_free_tx_desc_all(struct sge_txq *q); void t3_rx_eth(struct adapter *adap, struct sge_rspq *rq, struct mbuf *m, int ethpad); Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Thu Jun 4 04:00:29 2009 (r193423) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Thu Jun 4 04:11:27 2009 (r193424) @@ -233,7 +233,7 @@ reclaim_completed_tx(struct sge_qset *qs mtx_assert(&qs->lock, MA_OWNED); if (reclaim > 0) { - t3_free_tx_desc(q, reclaim); + t3_free_tx_desc(qs, reclaim, queue); q->cleaned += reclaim; q->in_use -= reclaim; } @@ -1263,7 +1263,7 @@ t3_encap(struct sge_qset *qs, struct mbu DPRINTF("t3_encap port_id=%d qsidx=%d ", pi->port_id, pi->first_qset); DPRINTF("mlen=%d txpkt_intf=%d tx_chan=%d\n", m[0]->m_pkthdr.len, pi->txpkt_intf, pi->tx_chan); - mtx_assert(&txq->lock, MA_OWNED); + mtx_assert(&qs->lock, MA_OWNED); cntrl = V_TXPKT_INTF(pi->txpkt_intf); /* * XXX need to add VLAN support for 6.x @@ -1686,8 +1686,6 @@ reclaim_completed_tx_imm(struct sge_txq { unsigned int reclaim = q->processed - q->cleaned; - mtx_assert(&q->lock, MA_OWNED); - q->in_use -= reclaim; q->cleaned += reclaim; } @@ -1966,10 +1964,11 @@ t3_sge_stop(adapter_t *sc) * Returns number of buffers of reclaimed */ void -t3_free_tx_desc(struct sge_txq *q, int reclaimable) +t3_free_tx_desc(struct sge_qset *qs, int reclaimable, int queue) { struct tx_sw_desc *txsd; unsigned int cidx; + struct sge_txq *q = &qs->txq[queue]; #ifdef T3_TRACE T3_TRACE2(sc->tb[q->cntxt_id & 7], @@ -1978,7 +1977,7 @@ t3_free_tx_desc(struct sge_txq *q, int r cidx = q->cidx; txsd = &q->sdesc[cidx]; DPRINTF("reclaiming %d WR\n", reclaimable); - mtx_assert(&q->lock, MA_OWNED); + mtx_assert(&qs->lock, MA_OWNED); while (reclaimable--) { DPRINTF("cidx=%d d=%p\n", cidx, txsd); if (txsd->m != NULL) { @@ -2146,7 +2145,6 @@ ofld_xmit(adapter_t *adap, struct sge_qs busdma_map_sgl(vsegs, segs, nsegs); stx = &q->sdesc[q->pidx]; - KASSERT(stx->mi.mi_base == NULL, ("mi_base set")); TXQ_LOCK(qs); again: reclaim_completed_tx(qs, 16, TXQ_OFLD); From owner-svn-src-user@FreeBSD.ORG Thu Jun 4 04:29:15 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D832F106566B; Thu, 4 Jun 2009 04:29:15 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C662E8FC16; Thu, 4 Jun 2009 04:29:15 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n544TFxb077163; Thu, 4 Jun 2009 04:29:15 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n544TFYg077162; Thu, 4 Jun 2009 04:29:15 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906040429.n544TFYg077162@svn.freebsd.org> From: Kip Macy Date: Thu, 4 Jun 2009 04:29:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193425 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 04 Jun 2009 04:29:16 -0000 Author: kmacy Date: Thu Jun 4 04:29:15 2009 New Revision: 193425 URL: http://svn.freebsd.org/changeset/base/193425 Log: don't use flags from descriptor Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Thu Jun 4 04:11:27 2009 (r193424) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Thu Jun 4 04:29:15 2009 (r193425) @@ -2630,8 +2630,8 @@ get_packet(adapter_t *adap, unsigned int struct sge_fl *fl = (len_cq & F_RSPD_FLQ) ? &qs->fl[1] : &qs->fl[0]; struct rx_sw_desc *sd = &fl->sdesc[fl->cidx]; uint32_t len = G_RSPD_LEN(len_cq); - uint32_t flags = ntohl(r->flags); - uint8_t sopeop = G_RSPD_SOP_EOP(flags); + uint32_t flags = M_EXT; + uint8_t sopeop = G_RSPD_SOP_EOP(ntohl(r->flags)); caddr_t cl; struct mbuf *m, *m0; int ret = 0; @@ -2650,6 +2650,7 @@ get_packet(adapter_t *adap, unsigned int recycle_rx_buf(adap, fl, fl->cidx); m = m0; m0->m_len = len; + m0->m_flags = 0; } else { skip_recycle: @@ -2662,7 +2663,7 @@ get_packet(adapter_t *adap, unsigned int flags = M_PKTHDR; if (fl->zone != zone_pack) m_cljset(m0, cl, fl->type); - m0->m_flags |= flags; + m0->m_flags = flags; m0->m_next = m0->m_nextpkt = NULL; m0->m_pkthdr.len = m0->m_len = len; } From owner-svn-src-user@FreeBSD.ORG Thu Jun 4 04:32:47 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 669E5106566C; Thu, 4 Jun 2009 04:32:47 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5534E8FC12; Thu, 4 Jun 2009 04:32:47 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n544WlDX077271; Thu, 4 Jun 2009 04:32:47 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n544WlY5077270; Thu, 4 Jun 2009 04:32:47 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906040432.n544WlY5077270@svn.freebsd.org> From: Kip Macy Date: Thu, 4 Jun 2009 04:32:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193426 - user/kmacy/releng_7_2_fcs/sys/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 04 Jun 2009 04:32:47 -0000 Author: kmacy Date: Thu Jun 4 04:32:46 2009 New Revision: 193426 URL: http://svn.freebsd.org/changeset/base/193426 Log: don't lookup mbuf tag if ipfw not enabled Modified: user/kmacy/releng_7_2_fcs/sys/net/if_ethersubr.c Modified: user/kmacy/releng_7_2_fcs/sys/net/if_ethersubr.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/net/if_ethersubr.c Thu Jun 4 04:29:15 2009 (r193425) +++ user/kmacy/releng_7_2_fcs/sys/net/if_ethersubr.c Thu Jun 4 04:32:46 2009 (r193426) @@ -430,9 +430,10 @@ ether_output_frame(struct ifnet *ifp, st { #if defined(INET) || defined(INET6) INIT_VNET_NET(ifp->if_vnet); - struct ip_fw *rule = ip_dn_claim_rule(m); + struct ip_fw *rule; if (IPFW_LOADED && V_ether_ipfw != 0) { + rule = ip_dn_claim_rule(m); if (ether_ipfw_chk(&m, ifp, &rule, 0) == 0) { if (m) { m_freem(m); From owner-svn-src-user@FreeBSD.ORG Thu Jun 4 04:43:07 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BDBA1106564A; Thu, 4 Jun 2009 04:43:07 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AC2578FC17; Thu, 4 Jun 2009 04:43:07 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n544h7Te077536; Thu, 4 Jun 2009 04:43:07 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n544h7J6077535; Thu, 4 Jun 2009 04:43:07 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906040443.n544h7J6077535@svn.freebsd.org> From: Kip Macy Date: Thu, 4 Jun 2009 04:43:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193427 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 04 Jun 2009 04:43:08 -0000 Author: kmacy Date: Thu Jun 4 04:43:07 2009 New Revision: 193427 URL: http://svn.freebsd.org/changeset/base/193427 Log: don't overwrite M_EXT Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Thu Jun 4 04:32:46 2009 (r193426) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Thu Jun 4 04:43:07 2009 (r193427) @@ -2660,7 +2660,7 @@ get_packet(adapter_t *adap, unsigned int if ((sopeop == RSPQ_SOP_EOP) || (sopeop == RSPQ_SOP)) - flags = M_PKTHDR; + flags |= M_PKTHDR; if (fl->zone != zone_pack) m_cljset(m0, cl, fl->type); m0->m_flags = flags; From owner-svn-src-user@FreeBSD.ORG Thu Jun 4 05:20:46 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E48C5106566B; Thu, 4 Jun 2009 05:20:46 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B87478FC0A; Thu, 4 Jun 2009 05:20:46 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n545KkqT078329; Thu, 4 Jun 2009 05:20:46 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n545KkvB078328; Thu, 4 Jun 2009 05:20:46 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906040520.n545KkvB078328@svn.freebsd.org> From: Kip Macy Date: Thu, 4 Jun 2009 05:20:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193428 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 04 Jun 2009 05:20:47 -0000 Author: kmacy Date: Thu Jun 4 05:20:46 2009 New Revision: 193428 URL: http://svn.freebsd.org/changeset/base/193428 Log: simplify packet initialization in get_packet Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Thu Jun 4 04:43:07 2009 (r193427) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Thu Jun 4 05:20:46 2009 (r193428) @@ -2633,7 +2633,7 @@ get_packet(adapter_t *adap, unsigned int uint32_t flags = M_EXT; uint8_t sopeop = G_RSPD_SOP_EOP(ntohl(r->flags)); caddr_t cl; - struct mbuf *m, *m0; + struct mbuf *m; int ret = 0; prefetch(sd->rxsd_cl); @@ -2643,29 +2643,37 @@ get_packet(adapter_t *adap, unsigned int if (recycle_enable && len <= SGE_RX_COPY_THRES && sopeop == RSPQ_SOP_EOP) { - if ((m0 = m_gethdr(M_DONTWAIT, MT_DATA)) == NULL) + if ((m = m_gethdr(M_DONTWAIT, MT_DATA)) == NULL) goto skip_recycle; - cl = mtod(m0, void *); + cl = mtod(m, void *); memcpy(cl, sd->rxsd_cl, len); recycle_rx_buf(adap, fl, fl->cidx); - m = m0; - m0->m_len = len; - m0->m_flags = 0; + m->m_pkthdr.len = m->m_len = len; + m->m_flags = 0; + mh->mh_head = mh->mh_tail = m; + ret = 1; + goto done; } else { skip_recycle: - bus_dmamap_unload(fl->entry_tag, sd->map); cl = sd->rxsd_cl; - m = m0 = sd->m; + m = sd->m; if ((sopeop == RSPQ_SOP_EOP) || (sopeop == RSPQ_SOP)) flags |= M_PKTHDR; - if (fl->zone != zone_pack) - m_cljset(m0, cl, fl->type); - m0->m_flags = flags; - m0->m_next = m0->m_nextpkt = NULL; - m0->m_pkthdr.len = m0->m_len = len; + if (fl->zone == zone_pack) { + m_init(m, zone_pack, MCLBYTES, M_NOWAIT, MT_DATA, flags); + /* + * restore clobbered data pointer + */ + m->m_data = m->m_ext.ext_buf; + } else { + m_cljset(m, cl, fl->type); + m->m_flags = flags; + m->m_next = m->m_nextpkt = NULL; + } + m->m_len = len; } switch(sopeop) { case RSPQ_SOP_EOP: @@ -2700,6 +2708,9 @@ get_packet(adapter_t *adap, unsigned int ret = 1; break; } + if (cxgb_debug) + printf("len=%d pktlen=%d\n", m->m_len, m->m_pkthdr.len); +done: if (++fl->cidx == fl->size) fl->cidx = 0; @@ -2843,8 +2854,11 @@ process_responses(adapter_t *adap, struc int drop_thresh = eth ? SGE_RX_DROP_THRES : 0; eop = get_packet(adap, drop_thresh, qs, &rspq->rspq_mh, r); - rspq->rspq_mh.mh_head->m_flags |= M_FLOWID; - rspq->rspq_mh.mh_head->m_pkthdr.flowid = rss_hash; + if (eop) { + rspq->rspq_mh.mh_head->m_flags |= M_FLOWID; + rspq->rspq_mh.mh_head->m_pkthdr.flowid = rss_hash; + } + ethpad = 2; } else { DPRINTF("pure response\n"); From owner-svn-src-user@FreeBSD.ORG Thu Jun 4 16:20:20 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EBFFB1065675; Thu, 4 Jun 2009 16:20:20 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D6E8C8FC08; Thu, 4 Jun 2009 16:20:20 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n54GKK3X097103; Thu, 4 Jun 2009 16:20:20 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n54GKKp1097083; Thu, 4 Jun 2009 16:20:20 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200906041620.n54GKKp1097083@svn.freebsd.org> From: Luigi Rizzo Date: Thu, 4 Jun 2009 16:20:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193441 - in user/luigi/ipfw_80: sbin/ipfw sys/conf sys/modules/dummynet sys/modules/ipfw sys/modules/ipfw_nat sys/net sys/netgraph sys/netinet sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 04 Jun 2009 16:20:21 -0000 Author: luigi Date: Thu Jun 4 16:20:19 2009 New Revision: 193441 URL: http://svn.freebsd.org/changeset/base/193441 Log: Prepare to move ipfw and dummynet in a private subdir, and split headers to separate kernel and userland stuff. Submitted by: Marta Carbone (partly, for her gsoc project) Added: user/luigi/ipfw_80/sys/netinet/ipfw/ user/luigi/ipfw_80/sys/netinet/ipfw/ip_dummynet.c (contents, props changed) - copied, changed from r193385, user/luigi/ipfw_80/sys/netinet/ip_dummynet.c user/luigi/ipfw_80/sys/netinet/ipfw/ip_dummynet_var.h user/luigi/ipfw_80/sys/netinet/ipfw/ip_fw2.c (contents, props changed) - copied, changed from r193385, user/luigi/ipfw_80/sys/netinet/ip_fw2.c user/luigi/ipfw_80/sys/netinet/ipfw/ip_fw_nat.c (contents, props changed) - copied, changed from r193385, user/luigi/ipfw_80/sys/netinet/ip_fw_nat.c user/luigi/ipfw_80/sys/netinet/ipfw/ip_fw_pfil.c (contents, props changed) - copied, changed from r193385, user/luigi/ipfw_80/sys/netinet/ip_fw_pfil.c user/luigi/ipfw_80/sys/netinet/ipfw/ip_fw_var.h Deleted: user/luigi/ipfw_80/sys/netinet/ip_dummynet.c user/luigi/ipfw_80/sys/netinet/ip_fw2.c user/luigi/ipfw_80/sys/netinet/ip_fw_nat.c user/luigi/ipfw_80/sys/netinet/ip_fw_pfil.c Modified: user/luigi/ipfw_80/sbin/ipfw/dummynet.c user/luigi/ipfw_80/sys/conf/files user/luigi/ipfw_80/sys/modules/dummynet/Makefile user/luigi/ipfw_80/sys/modules/ipfw/Makefile user/luigi/ipfw_80/sys/modules/ipfw_nat/Makefile user/luigi/ipfw_80/sys/net/if_bridge.c user/luigi/ipfw_80/sys/net/if_ethersubr.c user/luigi/ipfw_80/sys/netgraph/ng_ipfw.c user/luigi/ipfw_80/sys/netinet/ip_divert.c user/luigi/ipfw_80/sys/netinet/ip_dummynet.h user/luigi/ipfw_80/sys/netinet/ip_fw.h user/luigi/ipfw_80/sys/netinet/ip_input.c user/luigi/ipfw_80/sys/netinet/ip_var.h user/luigi/ipfw_80/sys/netinet/raw_ip.c Modified: user/luigi/ipfw_80/sbin/ipfw/dummynet.c ============================================================================== --- user/luigi/ipfw_80/sbin/ipfw/dummynet.c Thu Jun 4 16:18:07 2009 (r193440) +++ user/luigi/ipfw_80/sbin/ipfw/dummynet.c Thu Jun 4 16:20:19 2009 (r193441) @@ -314,8 +314,10 @@ ipfw_list_pipes(void *data, uint nbytes, print_extra_delay_parms(p, prefix); print_flowset_parms(&(p->fs), prefix); +#if 0 if (co.verbose) printf(" V %20llu\n", align_uint64(&p->V) >> MY_M); +#endif q = (struct dn_flow_queue *)(p+1); list_queues(&(p->fs), q); Modified: user/luigi/ipfw_80/sys/conf/files ============================================================================== --- user/luigi/ipfw_80/sys/conf/files Thu Jun 4 16:18:07 2009 (r193440) +++ user/luigi/ipfw_80/sys/conf/files Thu Jun 4 16:20:19 2009 (r193441) @@ -2332,14 +2332,14 @@ netinet/in_proto.c optional inet \ compile-with "${NORMAL_C} -I$S/contrib/pf" netinet/in_rmx.c optional inet netinet/ip_divert.c optional ipdivert -netinet/ip_dummynet.c optional dummynet +netinet/ipfw/ip_dummynet.c optional dummynet netinet/ip_ecn.c optional inet | inet6 netinet/ip_encap.c optional inet | inet6 netinet/ip_fastfwd.c optional inet -netinet/ip_fw2.c optional ipfirewall \ +netinet/ipfw/ip_fw2.c optional ipfirewall \ compile-with "${NORMAL_C} -I$S/contrib/pf" -netinet/ip_fw_pfil.c optional ipfirewall -netinet/ip_fw_nat.c optional ipfirewall_nat +netinet/ipfw/ip_fw_pfil.c optional ipfirewall +netinet/ipfw/ip_fw_nat.c optional ipfirewall_nat netinet/ip_icmp.c optional inet netinet/ip_input.c optional inet netinet/ip_ipsec.c optional ipsec Modified: user/luigi/ipfw_80/sys/modules/dummynet/Makefile ============================================================================== --- user/luigi/ipfw_80/sys/modules/dummynet/Makefile Thu Jun 4 16:18:07 2009 (r193440) +++ user/luigi/ipfw_80/sys/modules/dummynet/Makefile Thu Jun 4 16:20:19 2009 (r193441) @@ -2,7 +2,7 @@ .include -.PATH: ${.CURDIR}/../../netinet +.PATH: ${.CURDIR}/../../netinet/ipfw KMOD= dummynet SRCS= ip_dummynet.c SRCS+= opt_inet6.h Modified: user/luigi/ipfw_80/sys/modules/ipfw/Makefile ============================================================================== --- user/luigi/ipfw_80/sys/modules/ipfw/Makefile Thu Jun 4 16:18:07 2009 (r193440) +++ user/luigi/ipfw_80/sys/modules/ipfw/Makefile Thu Jun 4 16:20:19 2009 (r193441) @@ -2,7 +2,7 @@ .include -.PATH: ${.CURDIR}/../../netinet +.PATH: ${.CURDIR}/../../netinet/ipfw KMOD= ipfw SRCS= ip_fw2.c ip_fw_pfil.c Modified: user/luigi/ipfw_80/sys/modules/ipfw_nat/Makefile ============================================================================== --- user/luigi/ipfw_80/sys/modules/ipfw_nat/Makefile Thu Jun 4 16:18:07 2009 (r193440) +++ user/luigi/ipfw_80/sys/modules/ipfw_nat/Makefile Thu Jun 4 16:20:19 2009 (r193441) @@ -1,6 +1,6 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/../../netinet +.PATH: ${.CURDIR}/../../netinet/ipfw KMOD= ipfw_nat SRCS= ip_fw_nat.c Modified: user/luigi/ipfw_80/sys/net/if_bridge.c ============================================================================== --- user/luigi/ipfw_80/sys/net/if_bridge.c Thu Jun 4 16:18:07 2009 (r193440) +++ user/luigi/ipfw_80/sys/net/if_bridge.c Thu Jun 4 16:20:19 2009 (r193441) @@ -134,7 +134,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include +#include /* * Size of the route hash table. Must be a power of two. Modified: user/luigi/ipfw_80/sys/net/if_ethersubr.c ============================================================================== --- user/luigi/ipfw_80/sys/net/if_ethersubr.c Thu Jun 4 16:18:07 2009 (r193440) +++ user/luigi/ipfw_80/sys/net/if_ethersubr.c Thu Jun 4 16:20:19 2009 (r193441) @@ -74,7 +74,9 @@ #include #include #include +#include #include +#include #include #endif #ifdef INET6 @@ -108,6 +110,8 @@ extern u_char aarp_org_code[3]; #include + + #ifdef CTASSERT CTASSERT(sizeof (struct ether_header) == ETHER_ADDR_LEN * 2 + 2); CTASSERT(sizeof (struct ether_addr) == ETHER_ADDR_LEN); Modified: user/luigi/ipfw_80/sys/netgraph/ng_ipfw.c ============================================================================== --- user/luigi/ipfw_80/sys/netgraph/ng_ipfw.c Thu Jun 4 16:18:07 2009 (r193440) +++ user/luigi/ipfw_80/sys/netgraph/ng_ipfw.c Thu Jun 4 16:20:19 2009 (r193441) @@ -44,6 +44,7 @@ #include #include #include +#include #include #include Modified: user/luigi/ipfw_80/sys/netinet/ip_divert.c ============================================================================== --- user/luigi/ipfw_80/sys/netinet/ip_divert.c Thu Jun 4 16:18:07 2009 (r193440) +++ user/luigi/ipfw_80/sys/netinet/ip_divert.c Thu Jun 4 16:20:19 2009 (r193441) @@ -76,6 +76,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #ifdef SCTP #include Modified: user/luigi/ipfw_80/sys/netinet/ip_dummynet.h ============================================================================== --- user/luigi/ipfw_80/sys/netinet/ip_dummynet.h Thu Jun 4 16:18:07 2009 (r193440) +++ user/luigi/ipfw_80/sys/netinet/ip_dummynet.h Thu Jun 4 16:20:19 2009 (r193441) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1998-2002 Luigi Rizzo, Universita` di Pisa + * Copyright (c) 1998-2009 Luigi Rizzo, Universita` di Pisa * Portions Copyright (c) 2000 Akamba Corp. * All rights reserved * @@ -37,40 +37,7 @@ * use here is pretty simple anyways. */ -/* - * We start with a heap, which is used in the scheduler to decide when - * to transmit packets etc. - * - * The key for the heap is used for two different values: - * - * 1. timer ticks- max 10K/second, so 32 bits are enough; - * - * 2. virtual times. These increase in steps of len/x, where len is the - * packet length, and x is either the weight of the flow, or the - * sum of all weights. - * If we limit to max 1000 flows and a max weight of 100, then - * x needs 17 bits. The packet size is 16 bits, so we can easily - * overflow if we do not allow errors. - * So we use a key "dn_key" which is 64 bits. Some macros are used to - * compare key values and handle wraparounds. - * MAX64 returns the largest of two key values. - * MY_M is used as a shift count when doing fixed point arithmetic - * (a better name would be useful...). - */ typedef u_int64_t dn_key ; /* sorting key */ -#define DN_KEY_LT(a,b) ((int64_t)((a)-(b)) < 0) -#define DN_KEY_LEQ(a,b) ((int64_t)((a)-(b)) <= 0) -#define DN_KEY_GT(a,b) ((int64_t)((a)-(b)) > 0) -#define DN_KEY_GEQ(a,b) ((int64_t)((a)-(b)) >= 0) -#define MAX64(x,y) (( (int64_t) ( (y)-(x) )) > 0 ) ? (y) : (x) -#define MY_M 16 /* number of left shift to obtain a larger precision */ - -/* - * XXX With this scaling, max 1000 flows, max weight 100, 1Gbit/s, the - * virtual time wraps every 15 days. - */ - - /* * The maximum hash table size for queues. This value must be a power * of 2. @@ -104,31 +71,6 @@ struct dn_heap { struct dn_heap_entry *p ; /* really an array of "size" entries */ } ; -#ifdef _KERNEL -/* - * Packets processed by dummynet have an mbuf tag associated with - * them that carries their dummynet state. This is used within - * the dummynet code as well as outside when checking for special - * processing requirements. - */ -struct dn_pkt_tag { - struct ip_fw *rule; /* matching rule */ - int dn_dir; /* action when packet comes out. */ -#define DN_TO_IP_OUT 1 -#define DN_TO_IP_IN 2 -/* Obsolete: #define DN_TO_BDG_FWD 3 */ -#define DN_TO_ETH_DEMUX 4 -#define DN_TO_ETH_OUT 5 -#define DN_TO_IP6_IN 6 -#define DN_TO_IP6_OUT 7 -#define DN_TO_IFB_FWD 8 - - dn_key output_time; /* when the pkt is due for delivery */ - struct ifnet *ifp; /* interface, for ip_output */ - struct _ip6dn_args ip6opt; /* XXX ipv6 options */ -}; -#endif /* _KERNEL */ - /* * Overall structure of dummynet (with WF2Q+): @@ -214,9 +156,9 @@ struct dn_flow_queue { * With large bandwidth and large delays, extra_bits (and also numbytes) * can become very large, so better play safe and use 64 bit */ - dn_key numbytes ; /* credit for transmission (dynamic queues) */ - dn_key extra_bits; /* extra bits simulating unavailable channel */ - + uint64_t numbytes ; /* credit for transmission (dynamic queues) */ + int64_t extra_bits; /* extra bits simulating unavailable channel */ + u_int64_t tot_pkts ; /* statistics counters */ u_int64_t tot_bytes ; u_int32_t drops ; @@ -338,7 +280,7 @@ struct dn_pipe { /* a pipe */ int sum; /* sum of weights of all active sessions */ /* Same as in dn_flow_queue, numbytes can become large */ - dn_key numbytes; /* bits I can transmit (more or less). */ + int64_t numbytes; /* bits I can transmit (more or less). */ dn_key sched_time ; /* time pipe was scheduled in ready_heap */ @@ -370,30 +312,4 @@ struct dn_pipe_max { int samples[ED_MAX_SAMPLES_NO]; }; -SLIST_HEAD(dn_pipe_head, dn_pipe); - -#ifdef _KERNEL -typedef int ip_dn_ctl_t(struct sockopt *); /* raw_ip.c */ -typedef void ip_dn_ruledel_t(void *); /* ip_fw.c */ -typedef int ip_dn_io_t(struct mbuf **m, int dir, struct ip_fw_args *fwa); -extern ip_dn_ctl_t *ip_dn_ctl_ptr; -extern ip_dn_ruledel_t *ip_dn_ruledel_ptr; -extern ip_dn_io_t *ip_dn_io_ptr; -#define DUMMYNET_LOADED (ip_dn_io_ptr != NULL) - -/* - * Return the IPFW rule associated with the dummynet tag; if any. - * Make sure that the dummynet tag is not reused by lower layers. - */ -static __inline struct ip_fw * -ip_dn_claim_rule(struct mbuf *m) -{ - struct m_tag *mtag = m_tag_find(m, PACKET_TAG_DUMMYNET, NULL); - if (mtag != NULL) { - mtag->m_tag_id = PACKET_TAG_NONE; - return (((struct dn_pkt_tag *)(mtag+1))->rule); - } else - return (NULL); -} -#endif #endif /* _IP_DUMMYNET_H */ Modified: user/luigi/ipfw_80/sys/netinet/ip_fw.h ============================================================================== --- user/luigi/ipfw_80/sys/netinet/ip_fw.h Thu Jun 4 16:18:07 2009 (r193440) +++ user/luigi/ipfw_80/sys/netinet/ip_fw.h Thu Jun 4 16:20:19 2009 (r193441) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2002 Luigi Rizzo, Universita` di Pisa + * Copyright (c) 2002-2009 Luigi Rizzo, Universita` di Pisa * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,6 +29,10 @@ #define _IPFW2_H /* + * User visible definitions related to ipfw, including instruction opcodes. + */ + +/* * The default rule number. By the design of ip_fw, the default rule * is the last one, so its number can also serve as the highest number * allowed for a rule. The ip_fw code relies on both meanings of this @@ -560,207 +564,4 @@ typedef struct _ipfw_table { #define IP_FW_TABLEARG 65535 -/* - * Main firewall chains definitions and global var's definitions. - */ -#ifdef _KERNEL - -/* Return values from ipfw_chk() */ -enum { - IP_FW_PASS = 0, - IP_FW_DENY, - IP_FW_DIVERT, - IP_FW_TEE, - IP_FW_DUMMYNET, - IP_FW_NETGRAPH, - IP_FW_NGTEE, - IP_FW_NAT, - IP_FW_REASS, -}; - -/* flags for divert mtag */ -#define IP_FW_DIVERT_LOOPBACK_FLAG 0x00080000 -#define IP_FW_DIVERT_OUTPUT_FLAG 0x00100000 - -/* - * Structure for collecting parameters to dummynet for ip6_output forwarding - */ -struct _ip6dn_args { - struct ip6_pktopts *opt_or; - struct route_in6 ro_or; - int flags_or; - struct ip6_moptions *im6o_or; - struct ifnet *origifp_or; - struct ifnet *ifp_or; - struct sockaddr_in6 dst_or; - u_long mtu_or; - struct route_in6 ro_pmtu_or; -}; - -/* - * Arguments for calling ipfw_chk() and dummynet_io(). We put them - * all into a structure because this way it is easier and more - * efficient to pass variables around and extend the interface. - */ -struct ip_fw_args { - struct mbuf *m; /* the mbuf chain */ - struct ifnet *oif; /* output interface */ - struct sockaddr_in *next_hop; /* forward address */ - struct ip_fw *rule; /* matching rule */ - struct ether_header *eh; /* for bridged packets */ - - struct ipfw_flow_id f_id; /* grabbed from IP header */ - u_int32_t cookie; /* a cookie depending on rule action */ - struct inpcb *inp; - - struct _ip6dn_args dummypar; /* dummynet->ip6_output */ - struct sockaddr_in hopstore; /* store here if cannot use a pointer */ -}; - -/* - * Function definitions. - */ - -/* Firewall hooks */ -struct sockopt; -struct dn_flow_set; - -int ipfw_check_in(void *, struct mbuf **, struct ifnet *, int, struct inpcb *inp); -int ipfw_check_out(void *, struct mbuf **, struct ifnet *, int, struct inpcb *inp); - -int ipfw_chk(struct ip_fw_args *); - -int ipfw_init(void); -void ipfw_destroy(void); -#ifdef NOTYET -void ipfw_nat_destroy(void); -#endif - -typedef int ip_fw_ctl_t(struct sockopt *); -extern ip_fw_ctl_t *ip_fw_ctl_ptr; - -#ifdef VIMAGE_GLOBALS -extern int fw_one_pass; -extern int fw_enable; -#ifdef INET6 -extern int fw6_enable; -#endif -#endif - -/* For kernel ipfw_ether and ipfw_bridge. */ -typedef int ip_fw_chk_t(struct ip_fw_args *args); -extern ip_fw_chk_t *ip_fw_chk_ptr; -#define IPFW_LOADED (ip_fw_chk_ptr != NULL) - -struct ip_fw_chain { - struct ip_fw *rules; /* list of rules */ - struct ip_fw *reap; /* list of rules to reap */ - LIST_HEAD(, cfg_nat) nat; /* list of nat entries */ - struct radix_node_head *tables[IPFW_TABLES_MAX]; - struct rwlock rwmtx; -}; - -#ifdef IPFW_INTERNAL - -#define IPFW_LOCK_INIT(_chain) \ - rw_init(&(_chain)->rwmtx, "IPFW static rules") -#define IPFW_LOCK_DESTROY(_chain) rw_destroy(&(_chain)->rwmtx) -#define IPFW_WLOCK_ASSERT(_chain) rw_assert(&(_chain)->rwmtx, RA_WLOCKED) - -#define IPFW_RLOCK(p) rw_rlock(&(p)->rwmtx) -#define IPFW_RUNLOCK(p) rw_runlock(&(p)->rwmtx) -#define IPFW_WLOCK(p) rw_wlock(&(p)->rwmtx) -#define IPFW_WUNLOCK(p) rw_wunlock(&(p)->rwmtx) - -#define LOOKUP_NAT(l, i, p) do { \ - LIST_FOREACH((p), &(l.nat), _next) { \ - if ((p)->id == (i)) { \ - break; \ - } \ - } \ - } while (0) - -typedef int ipfw_nat_t(struct ip_fw_args *, struct cfg_nat *, struct mbuf *); -typedef int ipfw_nat_cfg_t(struct sockopt *); -#endif - -struct eventhandler_entry; -/* - * Stack virtualization support. - */ -struct vnet_ipfw { - int _fw_enable; - int _fw6_enable; - u_int32_t _set_disable; - int _fw_deny_unknown_exthdrs; - int _fw_verbose; - int _verbose_limit; - int _autoinc_step; - ipfw_dyn_rule ** _ipfw_dyn_v; - uma_zone_t _ipfw_dyn_rule_zone; - struct ip_fw_chain _layer3_chain; - u_int32_t _dyn_buckets; - u_int32_t _curr_dyn_buckets; - u_int32_t _dyn_ack_lifetime; - u_int32_t _dyn_syn_lifetime; - u_int32_t _dyn_fin_lifetime; - u_int32_t _dyn_rst_lifetime; - u_int32_t _dyn_udp_lifetime; - u_int32_t _dyn_short_lifetime; - u_int32_t _dyn_keepalive_interval; - u_int32_t _dyn_keepalive_period; - u_int32_t _dyn_keepalive; - u_int32_t _static_count; - u_int32_t _static_len; - u_int32_t _dyn_count; - u_int32_t _dyn_max; - u_int64_t _norule_counter; - struct callout _ipfw_timeout; - struct eventhandler_entry *_ifaddr_event_tag; -}; - -#ifndef VIMAGE -#ifndef VIMAGE_GLOBALS -extern struct vnet_ipfw vnet_ipfw_0; -#endif -#endif - -/* - * Symbol translation macros - */ -#define INIT_VNET_IPFW(vnet) \ - INIT_FROM_VNET(vnet, VNET_MOD_IPFW, struct vnet_ipfw, vnet_ipfw) - -#define VNET_IPFW(sym) VSYM(vnet_ipfw, sym) - -#define V_fw_enable VNET_IPFW(fw_enable) -#define V_fw6_enable VNET_IPFW(fw6_enable) -#define V_set_disable VNET_IPFW(set_disable) -#define V_fw_deny_unknown_exthdrs VNET_IPFW(fw_deny_unknown_exthdrs) -#define V_fw_verbose VNET_IPFW(fw_verbose) -#define V_verbose_limit VNET_IPFW(verbose_limit) -#define V_autoinc_step VNET_IPFW(autoinc_step) -#define V_ipfw_dyn_v VNET_IPFW(ipfw_dyn_v) -#define V_ipfw_dyn_rule_zone VNET_IPFW(ipfw_dyn_rule_zone) -#define V_layer3_chain VNET_IPFW(layer3_chain) -#define V_dyn_buckets VNET_IPFW(dyn_buckets) -#define V_curr_dyn_buckets VNET_IPFW(curr_dyn_buckets) -#define V_dyn_ack_lifetime VNET_IPFW(dyn_ack_lifetime) -#define V_dyn_syn_lifetime VNET_IPFW(dyn_syn_lifetime) -#define V_dyn_fin_lifetime VNET_IPFW(dyn_fin_lifetime) -#define V_dyn_rst_lifetime VNET_IPFW(dyn_rst_lifetime) -#define V_dyn_udp_lifetime VNET_IPFW(dyn_udp_lifetime) -#define V_dyn_short_lifetime VNET_IPFW(dyn_short_lifetime) -#define V_dyn_keepalive_interval VNET_IPFW(dyn_keepalive_interval) -#define V_dyn_keepalive_period VNET_IPFW(dyn_keepalive_period) -#define V_dyn_keepalive VNET_IPFW(dyn_keepalive) -#define V_static_count VNET_IPFW(static_count) -#define V_static_len VNET_IPFW(static_len) -#define V_dyn_count VNET_IPFW(dyn_count) -#define V_dyn_max VNET_IPFW(dyn_max) -#define V_norule_counter VNET_IPFW(norule_counter) -#define V_ipfw_timeout VNET_IPFW(ipfw_timeout) -#define V_ifaddr_event_tag VNET_IPFW(ifaddr_event_tag) - -#endif /* _KERNEL */ #endif /* _IPFW2_H */ Modified: user/luigi/ipfw_80/sys/netinet/ip_input.c ============================================================================== --- user/luigi/ipfw_80/sys/netinet/ip_input.c Thu Jun 4 16:18:07 2009 (r193440) +++ user/luigi/ipfw_80/sys/netinet/ip_input.c Thu Jun 4 16:20:19 2009 (r193441) @@ -85,10 +85,6 @@ __FBSDID("$FreeBSD$"); #include -/* XXX: Temporary until ipfw_ether and ipfw_bridge are converted. */ -#include -#include - #include #ifdef CTASSERT Modified: user/luigi/ipfw_80/sys/netinet/ip_var.h ============================================================================== --- user/luigi/ipfw_80/sys/netinet/ip_var.h Thu Jun 4 16:18:07 2009 (r193440) +++ user/luigi/ipfw_80/sys/netinet/ip_var.h Thu Jun 4 16:20:19 2009 (r193441) @@ -173,7 +173,8 @@ extern int ipstealth; /* stealth forwar extern int rsvp_on; extern struct socket *ip_rsvpd; /* reservation protocol daemon */ extern struct socket *ip_mrouter; /* multicast routing daemon */ -#endif +#endif /* VIMAGE_GLOBALS */ + extern u_char ip_protox[]; extern int (*legal_vif_num)(int); extern u_long (*ip_mcast_src)(int); @@ -223,6 +224,24 @@ extern struct pfil_head inet_pfil_hook; void in_delayed_cksum(struct mbuf *m); +/* Prototypes for ipfw and dummynet hooks */ +typedef int ip_fw_ctl_t(struct sockopt *); +extern ip_fw_ctl_t *ip_fw_ctl_ptr; +/* For kernel ipfw_ether and ipfw_bridge. */ +struct ip_fw_args; +typedef int ip_fw_chk_t(struct ip_fw_args *args); +extern ip_fw_chk_t *ip_fw_chk_ptr; +#define IPFW_LOADED (ip_fw_chk_ptr != NULL) + +typedef int ip_dn_ctl_t(struct sockopt *); /* raw_ip.c */ +typedef void ip_dn_ruledel_t(void *); /* ip_fw.c */ +typedef int ip_dn_io_t(struct mbuf **m, int dir, struct ip_fw_args *fwa); +extern ip_dn_ctl_t *ip_dn_ctl_ptr; +extern ip_dn_ruledel_t *ip_dn_ruledel_ptr; +extern ip_dn_io_t *ip_dn_io_ptr; +#define DUMMYNET_LOADED (ip_dn_io_ptr != NULL) + + #endif /* _KERNEL */ #endif /* !_NETINET_IP_VAR_H_ */ Copied and modified: user/luigi/ipfw_80/sys/netinet/ipfw/ip_dummynet.c (from r193385, user/luigi/ipfw_80/sys/netinet/ip_dummynet.c) ============================================================================== --- user/luigi/ipfw_80/sys/netinet/ip_dummynet.c Wed Jun 3 16:10:08 2009 (r193385, copy source) +++ user/luigi/ipfw_80/sys/netinet/ipfw/ip_dummynet.c Thu Jun 4 16:20:19 2009 (r193441) @@ -77,7 +77,9 @@ __FBSDID("$FreeBSD$"); #include #include /* ip_len, ip_off */ #include +#include #include +#include #include /* ip_output(), IP_FORWARDING */ #include /* various ether_* routines */ Added: user/luigi/ipfw_80/sys/netinet/ipfw/ip_dummynet_var.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/luigi/ipfw_80/sys/netinet/ipfw/ip_dummynet_var.h Thu Jun 4 16:20:19 2009 (r193441) @@ -0,0 +1,322 @@ +/*- + * Copyright (c) 1998-2009 Luigi Rizzo, Universita` di Pisa + * Portions Copyright (c) 2000 Akamba Corp. + * 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: head/sys/netinet/ip_dummynet.h 193435 2009-06-04 12:27:57Z luigi $ + */ + +#ifndef _IP_DUMMYNET_VAR_H +#define _IP_DUMMYNET_VAR_H + +/* + * Kernel-visible parts of dummynet data structures. + * Users of this file will often also need netinet/ip_dummynet.h. + * Definition of dummynet data structures. In the structures, I decided + * not to use the macros in in the hope of making the code + * easier to port to other architectures. The type of lists and queue we + * use here is pretty simple anyways. + */ + +/* + * We start with a heap, which is used in the scheduler to decide when + * to transmit packets etc. + * + * The key for the heap is used for two different values: + * + * 1. timer ticks- max 10K/second, so 32 bits are enough; + * + * 2. virtual times. These increase in steps of len/x, where len is the + * packet length, and x is either the weight of the flow, or the + * sum of all weights. + * If we limit to max 1000 flows and a max weight of 100, then + * x needs 17 bits. The packet size is 16 bits, so we can easily + * overflow if we do not allow errors. + * So we use a key "dn_key" which is 64 bits. Some macros are used to + * compare key values and handle wraparounds. + * MAX64 returns the largest of two key values. + * MY_M is used as a shift count when doing fixed point arithmetic + * (a better name would be useful...). + */ +#define DN_KEY_LT(a,b) ((int64_t)((a)-(b)) < 0) +#define DN_KEY_LEQ(a,b) ((int64_t)((a)-(b)) <= 0) +#define DN_KEY_GT(a,b) ((int64_t)((a)-(b)) > 0) +#define DN_KEY_GEQ(a,b) ((int64_t)((a)-(b)) >= 0) +#define MAX64(x,y) (( (int64_t) ( (y)-(x) )) > 0 ) ? (y) : (x) +#define MY_M 16 /* number of left shift to obtain a larger precision */ + +/* + * XXX With this scaling, max 1000 flows, max weight 100, 1Gbit/s, the + * virtual time wraps every 15 days. + */ + + +/* + * The maximum hash table size for queues. This value must be a power + * of 2. + */ +#define DN_MAX_HASH_SIZE 65536 + +/* + * Packets processed by dummynet have an mbuf tag associated with + * them that carries their dummynet state. This is used within + * the dummynet code as well as outside when checking for special + * processing requirements. + */ +struct dn_pkt_tag { + struct ip_fw *rule; /* matching rule */ + int dn_dir; /* action when packet comes out. */ +#define DN_TO_IP_OUT 1 +#define DN_TO_IP_IN 2 +/* Obsolete: #define DN_TO_BDG_FWD 3 */ +#define DN_TO_ETH_DEMUX 4 +#define DN_TO_ETH_OUT 5 +#define DN_TO_IP6_IN 6 +#define DN_TO_IP6_OUT 7 +#define DN_TO_IFB_FWD 8 + + dn_key output_time; /* when the pkt is due for delivery */ + struct ifnet *ifp; /* interface, for ip_output */ + struct _ip6dn_args ip6opt; /* XXX ipv6 options */ +}; + +#if 0 +/* + * Stuff already defined in the userland visible part. + * We keep it here because when the userland representation changes, + * the in-kernel representation might remain the same. + */ + + +/* + * per flow queue. This contains the flow identifier, the queue + * of packets, counters, and parameters used to support both RED and + * WF2Q+. + * + * A dn_flow_queue is created and initialized whenever a packet for + * a new flow arrives. + */ +struct dn_flow_queue { + struct dn_flow_queue *next ; + struct ipfw_flow_id id ; + + struct mbuf *head, *tail ; /* queue of packets */ + u_int len ; + u_int len_bytes ; + + /* + * When we emulate MAC overheads, or channel unavailability due + * to other traffic on a shared medium, we augment the packet at + * the head of the queue with an 'extra_bits' field representsing + * the additional delay the packet will be subject to: + * extra_bits = bw*unavailable_time. + * With large bandwidth and large delays, extra_bits (and also numbytes) + * can become very large, so better play safe and use 64 bit + */ + uint64_t numbytes ; /* credit for transmission (dynamic queues) */ + int64_t extra_bits; /* extra bits simulating unavailable channel */ + + u_int64_t tot_pkts ; /* statistics counters */ + u_int64_t tot_bytes ; + u_int32_t drops ; + + int hash_slot ; /* debugging/diagnostic */ + + /* RED parameters */ + int avg ; /* average queue length est. (scaled) */ + int count ; /* arrivals since last RED drop */ + int random ; /* random value (scaled) */ + dn_key q_time; /* start of queue idle time */ + + /* WF2Q+ support */ + struct dn_flow_set *fs ; /* parent flow set */ + int heap_pos ; /* position (index) of struct in heap */ + dn_key sched_time ; /* current time when queue enters ready_heap */ + + dn_key S,F ; /* start time, finish time */ + /* + * Setting F < S means the timestamp is invalid. We only need + * to test this when the queue is empty. + */ +} ; + +/* + * flow_set descriptor. Contains the "template" parameters for the + * queue configuration, and pointers to the hash table of dn_flow_queue's. + * + * The hash table is an array of lists -- we identify the slot by + * hashing the flow-id, then scan the list looking for a match. + * The size of the hash table (buckets) is configurable on a per-queue + * basis. + * + * A dn_flow_set is created whenever a new queue or pipe is created (in the + * latter case, the structure is located inside the struct dn_pipe). + */ +struct dn_flow_set { + SLIST_ENTRY(dn_flow_set) next; /* linked list in a hash slot */ + + u_short fs_nr ; /* flow_set number */ + u_short flags_fs; +#define DN_HAVE_FLOW_MASK 0x0001 +#define DN_IS_RED 0x0002 +#define DN_IS_GENTLE_RED 0x0004 +#define DN_QSIZE_IS_BYTES 0x0008 /* queue size is measured in bytes */ +#define DN_NOERROR 0x0010 /* do not report ENOBUFS on drops */ +#define DN_HAS_PROFILE 0x0020 /* the pipe has a delay profile. */ +#define DN_IS_PIPE 0x4000 +#define DN_IS_QUEUE 0x8000 + + struct dn_pipe *pipe ; /* pointer to parent pipe */ + u_short parent_nr ; /* parent pipe#, 0 if local to a pipe */ + + int weight ; /* WFQ queue weight */ + int qsize ; /* queue size in slots or bytes */ + int plr ; /* pkt loss rate (2^31-1 means 100%) */ + + struct ipfw_flow_id flow_mask ; + + /* hash table of queues onto this flow_set */ + int rq_size ; /* number of slots */ + int rq_elements ; /* active elements */ + struct dn_flow_queue **rq; /* array of rq_size entries */ + + u_int32_t last_expired ; /* do not expire too frequently */ + int backlogged ; /* #active queues for this flowset */ + + /* RED parameters */ +#define SCALE_RED 16 +#define SCALE(x) ( (x) << SCALE_RED ) +#define SCALE_VAL(x) ( (x) >> SCALE_RED ) +#define SCALE_MUL(x,y) ( ( (x) * (y) ) >> SCALE_RED ) + int w_q ; /* queue weight (scaled) */ + int max_th ; /* maximum threshold for queue (scaled) */ + int min_th ; /* minimum threshold for queue (scaled) */ + int max_p ; /* maximum value for p_b (scaled) */ + u_int c_1 ; /* max_p/(max_th-min_th) (scaled) */ + u_int c_2 ; /* max_p*min_th/(max_th-min_th) (scaled) */ + u_int c_3 ; /* for GRED, (1-max_p)/max_th (scaled) */ + u_int c_4 ; /* for GRED, 1 - 2*max_p (scaled) */ + u_int * w_q_lookup ; /* lookup table for computing (1-w_q)^t */ + u_int lookup_depth ; /* depth of lookup table */ + int lookup_step ; /* granularity inside the lookup table */ + int lookup_weight ; /* equal to (1-w_q)^t / (1-w_q)^(t+1) */ + int avg_pkt_size ; /* medium packet size */ + int max_pkt_size ; /* max packet size */ +}; +SLIST_HEAD(dn_flow_set_head, dn_flow_set); + +/* + * Pipe descriptor. Contains global parameters, delay-line queue, + * and the flow_set used for fixed-rate queues. + * + * For WF2Q+ support it also has 3 heaps holding dn_flow_queue: + * not_eligible_heap, for queues whose start time is higher + * than the virtual time. Sorted by start time. + * scheduler_heap, for queues eligible for scheduling. Sorted by + * finish time. + * idle_heap, all flows that are idle and can be removed. We + * do that on each tick so we do not slow down too much + * operations during forwarding. + * + */ +struct dn_pipe { /* a pipe */ + SLIST_ENTRY(dn_pipe) next; /* linked list in a hash slot */ + + int pipe_nr ; /* number */ + int bandwidth; /* really, bytes/tick. */ + int delay ; /* really, ticks */ + + struct mbuf *head, *tail ; /* packets in delay line */ + + /* WF2Q+ */ + struct dn_heap scheduler_heap ; /* top extract - key Finish time*/ + struct dn_heap not_eligible_heap; /* top extract- key Start time */ + struct dn_heap idle_heap ; /* random extract - key Start=Finish time */ + + dn_key V ; /* virtual time */ + int sum; /* sum of weights of all active sessions */ + + /* Same as in dn_flow_queue, numbytes can become large */ + int64_t numbytes; /* bits I can transmit (more or less). */ + + dn_key sched_time ; /* time pipe was scheduled in ready_heap */ + + /* + * When the tx clock come from an interface (if_name[0] != '\0'), its name + * is stored below, whereas the ifp is filled when the rule is configured. + */ + char if_name[IFNAMSIZ]; + struct ifnet *ifp ; + int ready ; /* set if ifp != NULL and we got a signal from it */ + + struct dn_flow_set fs ; /* used with fixed-rate flows */ + + /* fields to simulate a delay profile */ + +#define ED_MAX_NAME_LEN 32 + char name[ED_MAX_NAME_LEN]; + int loss_level; + int samples_no; + int *samples; +}; + +/* dn_pipe_max is used to pass pipe configuration from userland onto + * kernel space and back + */ +#define ED_MAX_SAMPLES_NO 1024 +struct dn_pipe_max { + struct dn_pipe pipe; + int samples[ED_MAX_SAMPLES_NO]; +}; +#endif /* kernel version of pipes/queues, already defined in userland */ + +SLIST_HEAD(dn_pipe_head, dn_pipe); + +#if 0 +typedef int ip_dn_ctl_t(struct sockopt *); /* raw_ip.c */ +typedef void ip_dn_ruledel_t(void *); /* ip_fw.c */ +typedef int ip_dn_io_t(struct mbuf **m, int dir, struct ip_fw_args *fwa); +extern ip_dn_ctl_t *ip_dn_ctl_ptr; +extern ip_dn_ruledel_t *ip_dn_ruledel_ptr; +extern ip_dn_io_t *ip_dn_io_ptr; +#define DUMMYNET_LOADED (ip_dn_io_ptr != NULL) +#endif + +#ifdef _KERNEL +/* + * Return the IPFW rule associated with the dummynet tag; if any. + * Make sure that the dummynet tag is not reused by lower layers. + */ +static __inline struct ip_fw * +ip_dn_claim_rule(struct mbuf *m) +{ + struct m_tag *mtag = m_tag_find(m, PACKET_TAG_DUMMYNET, NULL); + if (mtag != NULL) { + mtag->m_tag_id = PACKET_TAG_NONE; + return (((struct dn_pkt_tag *)(mtag+1))->rule); + } else + return (NULL); +} +#endif +#endif /* _IP_DUMMYNET_VAR_H */ Copied and modified: user/luigi/ipfw_80/sys/netinet/ipfw/ip_fw2.c (from r193385, user/luigi/ipfw_80/sys/netinet/ip_fw2.c) ============================================================================== --- user/luigi/ipfw_80/sys/netinet/ip_fw2.c Wed Jun 3 16:10:08 2009 (r193385, copy source) +++ user/luigi/ipfw_80/sys/netinet/ipfw/ip_fw2.c Thu Jun 4 16:20:19 2009 (r193441) @@ -82,8 +82,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include #include #include Copied and modified: user/luigi/ipfw_80/sys/netinet/ipfw/ip_fw_nat.c (from r193385, user/luigi/ipfw_80/sys/netinet/ip_fw_nat.c) ============================================================================== --- user/luigi/ipfw_80/sys/netinet/ip_fw_nat.c Wed Jun 3 16:10:08 2009 (r193385, copy source) +++ user/luigi/ipfw_80/sys/netinet/ipfw/ip_fw_nat.c Thu Jun 4 16:20:19 2009 (r193441) @@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include Copied and modified: user/luigi/ipfw_80/sys/netinet/ipfw/ip_fw_pfil.c (from r193385, user/luigi/ipfw_80/sys/netinet/ip_fw_pfil.c) ============================================================================== --- user/luigi/ipfw_80/sys/netinet/ip_fw_pfil.c Wed Jun 3 16:10:08 2009 (r193385, copy source) +++ user/luigi/ipfw_80/sys/netinet/ipfw/ip_fw_pfil.c Thu Jun 4 16:20:19 2009 (r193441) @@ -60,8 +60,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include #include Added: user/luigi/ipfw_80/sys/netinet/ipfw/ip_fw_var.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/luigi/ipfw_80/sys/netinet/ipfw/ip_fw_var.h Thu Jun 4 16:20:19 2009 (r193441) @@ -0,0 +1,252 @@ +/*- + * Copyright (c) 2002-2009 Luigi Rizzo, Universita` di Pisa + * + * 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: user/luigi/ipfw_80/sys/netinet/ip_fw.h 191738 2009-05-02 08:16:26Z zec $ + */ + +#ifndef _IPFW2_VAR_H +#define _IPFW2_VAR_H + +/* + * Kernel side of ipfw data structures. + */ +/* + * The default rule number. By the design of ip_fw, the default rule + * is the last one, so its number can also serve as the highest number + * allowed for a rule. The ip_fw code relies on both meanings of this + * constant. + */ +#define IPFW_DEFAULT_RULE 65535 + +/* + * The number of ipfw tables. The maximum allowed table number is the + * (IPFW_TABLES_MAX - 1). + */ +#define IPFW_TABLES_MAX 128 + + +#define MTAG_IPFW 1148380143 /* IPFW-tagged cookie */ + +/* Apply ipv6 mask on ipv6 addr */ +#define APPLY_MASK(addr,mask) \ + (addr)->__u6_addr.__u6_addr32[0] &= (mask)->__u6_addr.__u6_addr32[0]; \ + (addr)->__u6_addr.__u6_addr32[1] &= (mask)->__u6_addr.__u6_addr32[1]; \ + (addr)->__u6_addr.__u6_addr32[2] &= (mask)->__u6_addr.__u6_addr32[2]; \ + (addr)->__u6_addr.__u6_addr32[3] &= (mask)->__u6_addr.__u6_addr32[3]; + + +/* + * Main firewall chains definitions and global var's definitions. + */ + +/* Return values from ipfw_chk() */ +enum { + IP_FW_PASS = 0, + IP_FW_DENY, + IP_FW_DIVERT, + IP_FW_TEE, + IP_FW_DUMMYNET, + IP_FW_NETGRAPH, + IP_FW_NGTEE, + IP_FW_NAT, + IP_FW_REASS, +}; + +/* flags for divert mtag */ +#define IP_FW_DIVERT_LOOPBACK_FLAG 0x00080000 +#define IP_FW_DIVERT_OUTPUT_FLAG 0x00100000 + +/* + * Structure for collecting parameters to dummynet for ip6_output forwarding + */ +struct _ip6dn_args { + struct ip6_pktopts *opt_or; + struct route_in6 ro_or; + int flags_or; + struct ip6_moptions *im6o_or; + struct ifnet *origifp_or; + struct ifnet *ifp_or; + struct sockaddr_in6 dst_or; + u_long mtu_or; + struct route_in6 ro_pmtu_or; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Thu Jun 4 21:40:36 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B6FF91065676; Thu, 4 Jun 2009 21:40:36 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A4BEC8FC1D; Thu, 4 Jun 2009 21:40:36 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n54Leab7004916; Thu, 4 Jun 2009 21:40:36 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n54Leai2004915; Thu, 4 Jun 2009 21:40:36 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906042140.n54Leai2004915@svn.freebsd.org> From: Kip Macy Date: Thu, 4 Jun 2009 21:40:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193460 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 04 Jun 2009 21:40:37 -0000 Author: kmacy Date: Thu Jun 4 21:40:36 2009 New Revision: 193460 URL: http://svn.freebsd.org/changeset/base/193460 Log: reduce memory barrier usage Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Thu Jun 4 21:31:03 2009 (r193459) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Thu Jun 4 21:40:36 2009 (r193460) @@ -212,6 +212,24 @@ static void sge_timer_cb(void *arg); static void sge_timer_reclaim(void *arg, int ncount); static void sge_txq_reclaim_handler(void *arg, int ncount); +#ifdef __LP64__ +static void +set_wr_hdr(struct work_request_hdr *wrp, uint64_t wr_hi, uint64_t wr_lo) +{ + + wrp->wrh_hilo = (wr_hi<<32)|wr_lo; +} +#else +static void +set_wr_hdr(struct work_request_hdr *wrp, uint32_t wr_hi, uint32_t wr_lo) +{ + + wrp->wrh_hi = wr_hi; + wmb(); + wrp->wrh_lo = wr_lo; +} +#endif + /** * reclaim_completed_tx - reclaims completed Tx descriptors * @adapter: the adapter @@ -675,7 +693,7 @@ recycle_rx_buf(adapter_t *adap, struct s q->sdesc[q->pidx] = q->sdesc[idx]; to->addr_lo = from->addr_lo; // already big endian to->addr_hi = from->addr_hi; // likewise - wmb(); + wmb(); /* necessary ? */ to->len_gen = htobe32(V_FLD_GEN1(q->gen)); to->gen2 = htobe32(V_FLD_GEN2(q->gen)); q->credits++; @@ -1096,7 +1114,7 @@ make_sgl(struct sg_ent *sgp, bus_dma_seg * @adap: the adapter * @q: the Tx queue * - * Ring the doorbel if a Tx queue is asleep. There is a natural race, + * Ring the doorbell if a Tx queue is asleep. There is a natural race, * where the HW is going to sleep just after we checked, however, * then the interrupt handler will detect the outstanding TX packet * and ring the doorbell for us. @@ -1159,11 +1177,10 @@ write_wr_hdr_sgl(unsigned int ndesc, str struct tx_sw_desc *txsd = &txq->sdesc[txqs->pidx]; if (__predict_true(ndesc == 1)) { - wrp->wrh_hi = htonl(F_WR_SOP | F_WR_EOP | V_WR_DATATYPE(1) | - V_WR_SGLSFLT(flits)) | wr_hi; - wmb(); - wrp->wrh_lo = htonl(V_WR_LEN(flits + sgl_flits) | - V_WR_GEN(txqs->gen)) | wr_lo; + set_wr_hdr(wrp, htonl(F_WR_SOP | F_WR_EOP | V_WR_DATATYPE(1) | + V_WR_SGLSFLT(flits)) | wr_hi, + wrp->wrh_lo = htonl(V_WR_LEN(flits + sgl_flits) | + V_WR_GEN(txqs->gen)) | wr_lo); /* XXX gen? */ wr_gen2(txd, txqs->gen); @@ -1210,9 +1227,8 @@ write_wr_hdr_sgl(unsigned int ndesc, str wr_gen2(txd, txqs->gen); flits = 1; } - wrp->wrh_hi |= htonl(F_WR_EOP); - wmb(); - wp->wrh_lo = htonl(V_WR_LEN(WR_FLITS) | V_WR_GEN(ogen)) | wr_lo; + set_wr_hdr(wrp, wrp->wrh_hi |= htonl(F_WR_EOP), + htonl(V_WR_LEN(WR_FLITS) | V_WR_GEN(ogen)) | wr_lo); wr_gen2((struct tx_desc *)wp, ogen); } } @@ -1250,8 +1266,6 @@ t3_encap(struct sge_qset *qs, struct mbu struct tx_desc *txd; - DPRINTF("t3_encap cpu=%d ", curcpu); - pi = qs->port; sc = pi->adapter; txq = &qs->txq[TXQ_ETH]; @@ -1309,11 +1323,12 @@ t3_encap(struct sge_qset *qs, struct mbu txd->flit[fidx] |= htobe64(1 << 24); } - wrp->wrh_hi = htonl(F_WR_SOP | F_WR_EOP | V_WR_DATATYPE(1) | + + wr_hi = htonl(F_WR_SOP | F_WR_EOP | V_WR_DATATYPE(1) | V_WR_SGLSFLT(flits)) | htonl(V_WR_OP(FW_WROPCODE_TUNNEL_TX_PKT) | txqs.compl); - wmb(); - wrp->wrh_lo = htonl(V_WR_LEN(flits) | + wr_lo = htonl(V_WR_LEN(flits) | V_WR_GEN(txqs.gen)) | htonl(V_WR_TID(txq->token)); + set_wr_hdr(wrp, wr_hi, wr_lo); /* XXX gen? */ wr_gen2(txd, txqs.gen); check_ring_tx_db(sc, txq); @@ -1382,13 +1397,12 @@ t3_encap(struct sge_qset *qs, struct mbu txq_prod(txq, 1, &txqs); m_copydata(m0, 0, mlen, (caddr_t)&txd->flit[3]); flits = (mlen + 7) / 8 + 3; - hdr->wr.wrh_hi = htonl(V_WR_BCNTLFLT(mlen & 7) | + wr_hi = htonl(V_WR_BCNTLFLT(mlen & 7) | V_WR_OP(FW_WROPCODE_TUNNEL_TX_PKT) | F_WR_SOP | F_WR_EOP | txqs.compl); - wmb(); - hdr->wr.wrh_lo = htonl(V_WR_LEN(flits) | + wr_lo = htonl(V_WR_LEN(flits) | V_WR_GEN(txqs.gen) | V_WR_TID(txq->token)); - + set_wr_hdr(&hdr->wr, wr_hi, wr_lo); wr_gen2(txd, txqs.gen); check_ring_tx_db(sc, txq); return (0); @@ -1411,19 +1425,17 @@ t3_encap(struct sge_qset *qs, struct mbu txq_prod(txq, 1, &txqs); m_copydata(m0, 0, mlen, (caddr_t)&txd->flit[2]); flits = (mlen + 7) / 8 + 2; - cpl->wr.wrh_hi = htonl(V_WR_BCNTLFLT(mlen & 7) | - V_WR_OP(FW_WROPCODE_TUNNEL_TX_PKT) | + + wr_hi = htonl(V_WR_BCNTLFLT(mlen & 7) | + V_WR_OP(FW_WROPCODE_TUNNEL_TX_PKT) | F_WR_SOP | F_WR_EOP | txqs.compl); - wmb(); - cpl->wr.wrh_lo = htonl(V_WR_LEN(flits) | + wr_lo = htonl(V_WR_LEN(flits) | V_WR_GEN(txqs.gen) | V_WR_TID(txq->token)); - + set_wr_hdr(&cpl->wr, wr_hi, wr_lo); wr_gen2(txd, txqs.gen); check_ring_tx_db(sc, txq); - DPRINTF("pio buf\n"); return (0); } - DPRINTF("regular buf\n"); flits = 2; } wrp = (struct work_request_hdr *)txd; @@ -1435,7 +1447,6 @@ t3_encap(struct sge_qset *qs, struct mbu sgl_flits = sgl_len(nsegs); - DPRINTF("make_sgl success nsegs==%d ndesc==%d\n", nsegs, ndesc); txq_prod(txq, ndesc, &txqs); wr_hi = htonl(V_WR_OP(FW_WROPCODE_TUNNEL_TX_PKT) | txqs.compl); wr_lo = htonl(V_WR_TID(txq->token)); @@ -1598,6 +1609,7 @@ write_imm(struct tx_desc *d, struct mbuf { struct work_request_hdr *from = mtod(m, struct work_request_hdr *); struct work_request_hdr *to = (struct work_request_hdr *)d; + uint32_t wr_hi, wr_lo; if (len > WR_LEN) panic("len too big %d\n", len); @@ -1605,11 +1617,11 @@ write_imm(struct tx_desc *d, struct mbuf panic("len too small %d", len); memcpy(&to[1], &from[1], len - sizeof(*from)); - to->wrh_hi = from->wrh_hi | htonl(F_WR_SOP | F_WR_EOP | + wr_hi = from->wrh_hi | htonl(F_WR_SOP | F_WR_EOP | V_WR_BCNTLFLT(len & 7)); - wmb(); - to->wrh_lo = from->wrh_lo | htonl(V_WR_GEN(gen) | + wr_lo = from->wrh_lo | htonl(V_WR_GEN(gen) | V_WR_LEN((len + 7) / 8)); + set_wr_hdr(to, wr_hi, wr_lo); wr_gen2(d, gen); /* @@ -1657,11 +1669,7 @@ addq_exit: mbufq_tail(&q->sendq, m); struct sge_qset *qs = txq_to_qset(q, qid); - printf("stopping q\n"); - setbit(&qs->txq_stopped, qid); - smp_mb(); - if (should_restart_tx(q) && test_and_clear_bit(qid, &qs->txq_stopped)) return 2; @@ -2207,8 +2215,6 @@ again: cleaned = reclaim_completed_tx(qs if (__predict_false(q->size - q->in_use < ndesc)) { setbit(&qs->txq_stopped, TXQ_OFLD); - smp_mb(); - if (should_restart_tx(q) && test_and_clear_bit(TXQ_OFLD, &qs->txq_stopped)) goto again; @@ -2418,11 +2424,6 @@ t3_sge_alloc_qset(adapter_t *sc, u_int i } for (i = 0; i < ntxq; ++i) { - /* - * The control queue always uses immediate data so does not - * need to keep track of any mbufs. - * XXX Placeholder for future TOE support. - */ size_t sz = i == TXQ_CTRL ? 0 : sizeof(struct tx_sw_desc); if ((ret = alloc_ring(sc, p->txq_size[i], @@ -2861,7 +2862,6 @@ process_responses(adapter_t *adap, struc ethpad = 2; } else { - DPRINTF("pure response\n"); rspq->pure_rsps++; } skip: @@ -2881,8 +2881,6 @@ process_responses(adapter_t *adap, struc refill_rspq(adap, rspq, rspq->credits); rspq->credits = 0; } - DPRINTF("eth=%d eop=%d flags=0x%x\n", eth, eop, flags); - if (!eth && eop) { rspq->rspq_mh.mh_head->m_pkthdr.csum_data = rss_csum; /* @@ -2928,7 +2926,6 @@ process_responses(adapter_t *adap, struc struct ifnet *ifp = m->m_pkthdr.rcvif; (*ifp->if_input)(ifp, m); } - DPRINTF("received tunnel packet\n"); rspq->rspq_mh.mh_head = NULL; } From owner-svn-src-user@FreeBSD.ORG Thu Jun 4 21:48:17 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B9F3110657A8; Thu, 4 Jun 2009 21:48:17 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A4FBC8FC13; Thu, 4 Jun 2009 21:48:17 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n54LmHIt005206; Thu, 4 Jun 2009 21:48:17 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n54LmHF5005205; Thu, 4 Jun 2009 21:48:17 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906042148.n54LmHF5005205@svn.freebsd.org> From: Kip Macy Date: Thu, 4 Jun 2009 21:48:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193463 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 04 Jun 2009 21:48:18 -0000 Author: kmacy Date: Thu Jun 4 21:48:17 2009 New Revision: 193463 URL: http://svn.freebsd.org/changeset/base/193463 Log: don't use m_free functions for uninitialized mbufs Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Thu Jun 4 21:48:04 2009 (r193462) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Thu Jun 4 21:48:17 2009 (r193463) @@ -642,10 +642,10 @@ free_rx_bufs(adapter_t *sc, struct sge_f bus_dmamap_unload(q->entry_tag, d->map); bus_dmamap_destroy(q->entry_tag, d->map); if (q->zone == zone_pack) - m_free_fast(zone_pack, d->m); + uma_zfree(zone_pack, d->m); else { uma_zfree(q->zone, d->rxsd_cl); - m_free_fast(zone_mbuf, d->m); + uma_zfree(zone_mbuf, d->m); } } From owner-svn-src-user@FreeBSD.ORG Thu Jun 4 22:14:37 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F755106568F; Thu, 4 Jun 2009 22:14:37 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F1CDE8FC2A; Thu, 4 Jun 2009 22:14:36 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n54MEauG005961; Thu, 4 Jun 2009 22:14:36 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n54MEaNl005960; Thu, 4 Jun 2009 22:14:36 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906042214.n54MEaNl005960@svn.freebsd.org> From: Kip Macy Date: Thu, 4 Jun 2009 22:14:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193468 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 04 Jun 2009 22:14:37 -0000 Author: kmacy Date: Thu Jun 4 22:14:36 2009 New Revision: 193468 URL: http://svn.freebsd.org/changeset/base/193468 Log: fix 64-bit LE flit updates Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Thu Jun 4 22:01:50 2009 (r193467) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Thu Jun 4 22:14:36 2009 (r193468) @@ -214,10 +214,13 @@ static void sge_txq_reclaim_handler(void #ifdef __LP64__ static void -set_wr_hdr(struct work_request_hdr *wrp, uint64_t wr_hi, uint64_t wr_lo) +set_wr_hdr(struct work_request_hdr *wrp, uint32_t wr_hi, uint32_t wr_lo) { + uint64_t wr_hilo; - wrp->wrh_hilo = (wr_hi<<32)|wr_lo; + wr_hilo = wr_lo; + wr_hilo |= (((uint64_t)wr_hi)<<32) ; + wrp->wrh_hilo = wr_hilo; } #else static void From owner-svn-src-user@FreeBSD.ORG Thu Jun 4 22:23:45 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 423E21065670; Thu, 4 Jun 2009 22:23:45 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 30DF08FC1E; Thu, 4 Jun 2009 22:23:45 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n54MNi8E006196; Thu, 4 Jun 2009 22:23:44 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n54MNiED006194; Thu, 4 Jun 2009 22:23:44 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906042223.n54MNiED006194@svn.freebsd.org> From: Kip Macy Date: Thu, 4 Jun 2009 22:23:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193469 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 04 Jun 2009 22:23:45 -0000 Author: kmacy Date: Thu Jun 4 22:23:44 2009 New Revision: 193469 URL: http://svn.freebsd.org/changeset/base/193469 Log: remove gratuitous INET specific bits from cxgb_ioctl Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_osdep.h Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Thu Jun 4 22:14:36 2009 (r193468) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Thu Jun 4 22:23:44 2009 (r193469) @@ -2098,16 +2098,6 @@ cxgb_ioctl(struct ifnet *ifp, unsigned l case SIOCSIFMTU: error = cxgb_set_mtu(p, ifr->ifr_mtu); break; - case SIOCSIFADDR: - if (ifa->ifa_addr->sa_family == AF_INET) { - ifp->if_flags |= IFF_UP; - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { - cxgb_init(p); - } - arp_ifinit(ifp, ifa); - } else - error = ether_ioctl(ifp, command, data); - break; case SIOCSIFFLAGS: PORT_LOCK(p); if (ifp->if_flags & IFF_UP) { Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_osdep.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_osdep.h Thu Jun 4 22:14:36 2009 (r193468) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_osdep.h Thu Jun 4 22:23:44 2009 (r193469) @@ -116,11 +116,11 @@ struct t3_mbuf_hdr { #if __FreeBSD_version >= 701000 #include "opt_inet.h" -#ifdef notyet +#ifdef INET #define LRO_SUPPORTED -#endif #define TOE_SUPPORTED #endif +#endif #if __FreeBSD_version < 800054 #if defined (__GNUC__) From owner-svn-src-user@FreeBSD.ORG Thu Jun 4 22:41:37 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 049D3106579F; Thu, 4 Jun 2009 22:41:37 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E791E8FC0C; Thu, 4 Jun 2009 22:41:36 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n54Mfavd006684; Thu, 4 Jun 2009 22:41:36 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n54Mfawg006683; Thu, 4 Jun 2009 22:41:36 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906042241.n54Mfawg006683@svn.freebsd.org> From: Kip Macy Date: Thu, 4 Jun 2009 22:41:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193472 - user/kmacy/releng_7_2_fcs/sys/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 04 Jun 2009 22:41:37 -0000 Author: kmacy Date: Thu Jun 4 22:41:36 2009 New Revision: 193472 URL: http://svn.freebsd.org/changeset/base/193472 Log: add routine to conditionally dequeue from the buf_ring Modified: user/kmacy/releng_7_2_fcs/sys/net/if_var.h Modified: user/kmacy/releng_7_2_fcs/sys/net/if_var.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/net/if_var.h Thu Jun 4 22:34:37 2009 (r193471) +++ user/kmacy/releng_7_2_fcs/sys/net/if_var.h Thu Jun 4 22:41:36 2009 (r193472) @@ -613,6 +613,27 @@ drbr_dequeue(struct ifnet *ifp, struct b return (buf_ring_dequeue_sc(br)); } +static __inline struct mbuf * +drbr_dequeue_cond(struct ifnet *ifp, struct buf_ring *br, + int (*func) (struct mbuf *, void *), void *arg) +{ + struct mbuf *m; +#ifdef ALTQ + /* + * XXX need to evaluate / requeue + */ + if (ALTQ_IS_ENABLED(&ifp->if_snd)) { + IFQ_DRV_DEQUEUE(&ifp->if_snd, m); + return (m); + } +#endif + m = buf_ring_peek(br); + if (m == NULL || func(m, arg) == 0) + return (NULL); + + return (buf_ring_dequeue_sc(br)); +} + static __inline int drbr_empty(struct ifnet *ifp, struct buf_ring *br) { From owner-svn-src-user@FreeBSD.ORG Fri Jun 5 00:05:26 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13AFB106566C; Fri, 5 Jun 2009 00:05:26 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 021558FC1F; Fri, 5 Jun 2009 00:05:26 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5505Pbh008679; Fri, 5 Jun 2009 00:05:25 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5505PqP008677; Fri, 5 Jun 2009 00:05:25 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906050005.n5505PqP008677@svn.freebsd.org> From: Kip Macy Date: Fri, 5 Jun 2009 00:05:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193476 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 05 Jun 2009 00:05:26 -0000 Author: kmacy Date: Fri Jun 5 00:05:25 2009 New Revision: 193476 URL: http://svn.freebsd.org/changeset/base/193476 Log: - remove inet specific bits along with extra locking - add packet coalescing when the transmit ring starts to fill up Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Thu Jun 4 23:43:08 2009 (r193475) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Fri Jun 5 00:05:25 2009 (r193476) @@ -2086,7 +2086,6 @@ static int cxgb_ioctl(struct ifnet *ifp, unsigned long command, caddr_t data) { struct port_info *p = ifp->if_softc; - struct ifaddr *ifa = (struct ifaddr *)data; struct ifreq *ifr = (struct ifreq *)data; int flags, error = 0, reinit = 0; uint32_t mask; @@ -2099,7 +2098,6 @@ cxgb_ioctl(struct ifnet *ifp, unsigned l error = cxgb_set_mtu(p, ifr->ifr_mtu); break; case SIOCSIFFLAGS: - PORT_LOCK(p); if (ifp->if_flags & IFF_UP) { if (ifp->if_drv_flags & IFF_DRV_RUNNING) { flags = p->if_flags; @@ -2107,14 +2105,15 @@ cxgb_ioctl(struct ifnet *ifp, unsigned l ((ifp->if_flags ^ flags) & IFF_ALLMULTI)) cxgb_set_rxmode(p); } else { - PORT_UNLOCK(p); - cxgb_init_locked(p); - PORT_LOCK(p); + cxgb_init(p); } p->if_flags = ifp->if_flags; - } else if (ifp->if_drv_flags & IFF_DRV_RUNNING) + } else if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + PORT_LOCK(p); cxgb_stop_locked(p); - PORT_UNLOCK(p); + PORT_UNLOCK(p); + } + break; case SIOCADDMULTI: case SIOCDELMULTI: Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Thu Jun 4 23:43:08 2009 (r193475) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Fri Jun 5 00:05:25 2009 (r193476) @@ -203,7 +203,10 @@ static uint8_t flit_desc_map[] = { #define TXQ_LOCK(qs) mtx_lock(&(qs)->lock) #define TXQ_UNLOCK(qs) mtx_unlock(&(qs)->lock) #define TXQ_RING_EMPTY(qs) drbr_empty((qs)->port->ifp, (qs)->txq[TXQ_ETH].txq_mr) -#define TXQ_RING_DEQUEUE(qs) drbr_dequeue((qs)->port->ifp, (qs)->txq[TXQ_ETH].txq_mr) +#define TXQ_RING_DEQUEUE_COND(qs, func, arg) \ + drbr_dequeue_cond((qs)->port->ifp, (qs)->txq[TXQ_ETH].txq_mr, func, arg) +#define TXQ_RING_DEQUEUE(qs) \ + drbr_dequeue((qs)->port->ifp, (qs)->txq[TXQ_ETH].txq_mr) #define CXGB_TX_TIMEOUT 5 int cxgb_debug = 0; @@ -212,6 +215,22 @@ static void sge_timer_cb(void *arg); static void sge_timer_reclaim(void *arg, int ncount); static void sge_txq_reclaim_handler(void *arg, int ncount); + +static __inline void +check_pkt_coalesce(struct sge_qset *qs) +{ + struct adapter *sc; + struct sge_txq *txq; + + txq = &qs->txq[TXQ_ETH]; + sc = qs->port->adapter; + + if (sc->tunq_fill[qs->idx] && (txq->in_use < (txq->size - (txq->size>>2)))) + sc->tunq_fill[qs->idx] = 0; + else if (!sc->tunq_fill[qs->idx] && (txq->in_use > (txq->size - (txq->size>>2)))) + sc->tunq_fill[qs->idx] = 1; +} + #ifdef __LP64__ static void set_wr_hdr(struct work_request_hdr *wrp, uint32_t wr_hi, uint32_t wr_lo) @@ -1459,22 +1478,57 @@ t3_encap(struct sge_qset *qs, struct mbu return (0); } +static int +coalesce_check(struct mbuf *m, void *arg) +{ + uintptr_t *nbytes = (uintptr_t *)arg; + + if (*nbytes == 0) + return (1); + else if (m->m_next != NULL) + return (0); + else if (*nbytes + m->m_len <= 10500) { + *nbytes += m->m_len; + return (1); + } + + return (0); +} + static void cxgb_start_locked(struct sge_qset *qs) { - struct mbuf *m_head = NULL; + struct mbuf *m, *m_tail, *m_head = NULL; int txmax = TX_START_MAX_DESC; struct sge_txq *txq = &qs->txq[TXQ_ETH]; int in_use_init = txq->in_use; struct port_info *pi = qs->port; + struct adapter *sc = pi->adapter; struct ifnet *ifp = pi->ifp; - int count = 1; + int count, nbytes; TXQ_LOCK_ASSERT(qs); while ((txq->in_use - in_use_init < txmax) && (!TXQ_RING_EMPTY(qs))) { + m_head = m_tail = NULL; + check_pkt_coalesce(qs); + count = 1; + + if (sc->tunq_coalesce) { + nbytes = 0; + do { + m = TXQ_RING_DEQUEUE_COND(qs, coalesce_check, &nbytes); + if (m_head == NULL) { + m_tail = m_head = m; + } else if (m != NULL) { + count++; + m_tail->m_nextpkt = m; + m_tail = m; + } + } while (m != NULL); + } else + m_head = TXQ_RING_DEQUEUE(qs); - m_head = TXQ_RING_DEQUEUE(qs); if (m_head == NULL) break; /* @@ -1511,12 +1565,10 @@ cxgb_transmit_locked(struct ifnet *ifp, int error, count = 1; TXQ_LOCK_ASSERT(qs); - reclaim_completed_tx(qs, (TX_ETH_Q_SIZE>>3), TXQ_ETH); + reclaim_completed_tx(qs, (TX_ETH_Q_SIZE>>4), TXQ_ETH); - if ((!pi->link_config.link_ok) /* check others */) { - error = drbr_enqueue(ifp, br, m); - return (error); - } else if (TXQ_RING_EMPTY(qs) && sc->tunq_coalesce == 0) { + if (sc->tunq_coalesce == 0 && pi->link_config.link_ok && + TXQ_RING_EMPTY(qs)) { if (t3_encap(qs, &m, 1)) { if (m != NULL && (error = drbr_enqueue(ifp, br, m)) != 0) @@ -1542,7 +1594,7 @@ cxgb_transmit_locked(struct ifnet *ifp, } else if ((error = drbr_enqueue(ifp, br, m)) != 0) return (error); - if (!TXQ_RING_EMPTY(qs)) + if (!TXQ_RING_EMPTY(qs) && pi->link_config.link_ok) cxgb_start_locked(qs); return (0); From owner-svn-src-user@FreeBSD.ORG Fri Jun 5 00:30:28 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F0E31106564A; Fri, 5 Jun 2009 00:30:28 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DFEE78FC19; Fri, 5 Jun 2009 00:30:28 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n550USFM009307; Fri, 5 Jun 2009 00:30:28 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n550USiV009306; Fri, 5 Jun 2009 00:30:28 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906050030.n550USiV009306@svn.freebsd.org> From: Kip Macy Date: Fri, 5 Jun 2009 00:30:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193477 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 05 Jun 2009 00:30:29 -0000 Author: kmacy Date: Fri Jun 5 00:30:28 2009 New Revision: 193477 URL: http://svn.freebsd.org/changeset/base/193477 Log: correct for endianness Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Fri Jun 5 00:05:25 2009 (r193476) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Fri Jun 5 00:30:28 2009 (r193477) @@ -237,8 +237,8 @@ set_wr_hdr(struct work_request_hdr *wrp, { uint64_t wr_hilo; - wr_hilo = wr_lo; - wr_hilo |= (((uint64_t)wr_hi)<<32) ; + wr_hilo = wr_hi; + wr_hilo |= (((uint64_t)wr_lo)<<32) ; wrp->wrh_hilo = wr_hilo; } #else From owner-svn-src-user@FreeBSD.ORG Fri Jun 5 01:00:29 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2184E106564A; Fri, 5 Jun 2009 01:00:29 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 104E98FC15; Fri, 5 Jun 2009 01:00:29 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5510Sxx009914; Fri, 5 Jun 2009 01:00:28 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5510S8T009912; Fri, 5 Jun 2009 01:00:28 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906050100.n5510S8T009912@svn.freebsd.org> From: Kip Macy Date: Fri, 5 Jun 2009 01:00:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193478 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 05 Jun 2009 01:00:29 -0000 Author: kmacy Date: Fri Jun 5 01:00:28 2009 New Revision: 193478 URL: http://svn.freebsd.org/changeset/base/193478 Log: - remove dead intr_bind call - be a bit more careful about ensuring that callouts get drained in a timely fashion when unloading Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Fri Jun 5 00:30:28 2009 (r193477) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Fri Jun 5 01:00:28 2009 (r193478) @@ -839,16 +839,6 @@ cxgb_setup_msix(adapter_t *sc, int msix_ return (EINVAL); } -#if 0 -#ifdef IFNET_MULTIQUEUE - if (multiq) { - int vector = rman_get_start(sc->msix_irq_res[k]); - if (bootverbose) - device_printf(sc->dev, "binding vector=%d to cpu=%d\n", vector, k % mp_ncpus); - intr_bind(vector, k % mp_ncpus); - } -#endif -#endif } } @@ -1727,6 +1717,9 @@ cxgb_release(struct adapter *sc) if (sc->flags & USING_MSIX) cxgb_teardown_msix(sc); + callout_drain(&sc->cxgb_tick_ch); + callout_drain(&sc->sge_timer_ch); + if (sc->tq != NULL) { printf("draining slow intr\n"); taskqueue_drain(sc->tq, &sc->slow_intr_task); @@ -2384,7 +2377,7 @@ cxgb_tick(void *arg) { adapter_t *sc = (adapter_t *)arg; - if(sc->flags & CXGB_SHUTDOWN) + if ((sc->flags & CXGB_SHUTDOWN) || (sc->open_device_map == 0) return; taskqueue_enqueue(sc->tq, &sc->tick_task); Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Fri Jun 5 00:30:28 2009 (r193477) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Fri Jun 5 01:00:28 2009 (r193478) @@ -831,6 +831,9 @@ sge_timer_cb(void *arg) int i, j; int reclaim_ofl, refill_rx; + if (sc->open_device_map == 0) + return; + for (i = 0; i < sc->params.nports; i++) { pi = &sc->port[i]; for (j = 0; j < pi->nqsets; j++) { From owner-svn-src-user@FreeBSD.ORG Fri Jun 5 01:18:13 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26B7D1065670; Fri, 5 Jun 2009 01:18:13 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 14AD58FC13; Fri, 5 Jun 2009 01:18:13 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n551IC4m010283; Fri, 5 Jun 2009 01:18:12 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n551ICKG010281; Fri, 5 Jun 2009 01:18:12 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906050118.n551ICKG010281@svn.freebsd.org> From: Kip Macy Date: Fri, 5 Jun 2009 01:18:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193479 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 05 Jun 2009 01:18:13 -0000 Author: kmacy Date: Fri Jun 5 01:18:12 2009 New Revision: 193479 URL: http://svn.freebsd.org/changeset/base/193479 Log: - fix callout check - remove dead assert - check for msix in timer (no rspq locking) - don't lock queue in msix interrupt Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Fri Jun 5 01:00:28 2009 (r193478) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Fri Jun 5 01:18:12 2009 (r193479) @@ -2377,7 +2377,7 @@ cxgb_tick(void *arg) { adapter_t *sc = (adapter_t *)arg; - if ((sc->flags & CXGB_SHUTDOWN) || (sc->open_device_map == 0) + if ((sc->flags & CXGB_SHUTDOWN) || (sc->open_device_map == 0)) return; taskqueue_enqueue(sc->tq, &sc->tick_task); Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Fri Jun 5 01:00:28 2009 (r193478) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Fri Jun 5 01:18:12 2009 (r193479) @@ -824,31 +824,33 @@ static void sge_timer_cb(void *arg) { adapter_t *sc = arg; -#ifndef IFNET_MULTIQUEUE - struct port_info *pi; - struct sge_qset *qs; - struct sge_txq *txq; - int i, j; - int reclaim_ofl, refill_rx; - - if (sc->open_device_map == 0) - return; - - for (i = 0; i < sc->params.nports; i++) { - pi = &sc->port[i]; - for (j = 0; j < pi->nqsets; j++) { - qs = &sc->sge.qs[pi->first_qset + j]; - txq = &qs->txq[0]; - reclaim_ofl = txq[TXQ_OFLD].processed - txq[TXQ_OFLD].cleaned; - refill_rx = ((qs->fl[0].credits < qs->fl[0].size) || - (qs->fl[1].credits < qs->fl[1].size)); - if (reclaim_ofl || refill_rx) { - taskqueue_enqueue(sc->tq, &pi->timer_reclaim_task); - break; + if ((sc->flags & USING_MSIX) == 0) { + + struct port_info *pi; + struct sge_qset *qs; + struct sge_txq *txq; + int i, j; + int reclaim_ofl, refill_rx; + + if (sc->open_device_map == 0) + return; + + for (i = 0; i < sc->params.nports; i++) { + pi = &sc->port[i]; + for (j = 0; j < pi->nqsets; j++) { + qs = &sc->sge.qs[pi->first_qset + j]; + txq = &qs->txq[0]; + reclaim_ofl = txq[TXQ_OFLD].processed - txq[TXQ_OFLD].cleaned; + refill_rx = ((qs->fl[0].credits < qs->fl[0].size) || + (qs->fl[1].credits < qs->fl[1].size)); + if (reclaim_ofl || refill_rx) { + taskqueue_enqueue(sc->tq, &pi->timer_reclaim_task); + break; + } } } } -#endif + if (sc->params.nports > 2) { int i; @@ -934,10 +936,9 @@ sge_timer_reclaim(void *arg, int ncount) adapter_t *sc = pi->adapter; struct sge_qset *qs; struct mtx *lock; - -#ifdef IFNET_MULTIQUEUE - panic("%s should not be called with multiqueue support\n", __FUNCTION__); -#endif + + KASSERT((sc->flags & USING_MSIX) == 0, + ("can't call timer reclaim for msi-x")); for (i = 0; i < nqsets; i++) { qs = &sc->sge.qs[pi->first_qset + i]; @@ -3101,13 +3102,8 @@ t3_intr_msix(void *data) adapter_t *adap = qs->port->adapter; struct sge_rspq *rspq = &qs->rspq; - mtx_lock(&rspq->lock); - { - - if (process_responses_gts(adap, rspq) == 0) - rspq->unhandled_irqs++; - mtx_unlock(&rspq->lock); - } + if (process_responses_gts(adap, rspq) == 0) + rspq->unhandled_irqs++; } #define QDUMP_SBUF_SIZE 32 * 400 From owner-svn-src-user@FreeBSD.ORG Fri Jun 5 04:20:14 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E782A1065670; Fri, 5 Jun 2009 04:20:14 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BBC978FC14; Fri, 5 Jun 2009 04:20:14 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n554KEmo014115; Fri, 5 Jun 2009 04:20:14 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n554KEqT014114; Fri, 5 Jun 2009 04:20:14 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906050420.n554KEqT014114@svn.freebsd.org> From: Kip Macy Date: Fri, 5 Jun 2009 04:20:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193481 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 05 Jun 2009 04:20:15 -0000 Author: kmacy Date: Fri Jun 5 04:20:14 2009 New Revision: 193481 URL: http://svn.freebsd.org/changeset/base/193481 Log: fix prefetching in tx clean and get packet Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Fri Jun 5 03:06:24 2009 (r193480) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Fri Jun 5 04:20:14 2009 (r193481) @@ -2034,19 +2034,22 @@ void t3_free_tx_desc(struct sge_qset *qs, int reclaimable, int queue) { struct tx_sw_desc *txsd; - unsigned int cidx; + unsigned int cidx, mask; struct sge_txq *q = &qs->txq[queue]; - + #ifdef T3_TRACE T3_TRACE2(sc->tb[q->cntxt_id & 7], "reclaiming %u Tx descriptors at cidx %u", reclaimable, cidx); #endif cidx = q->cidx; + mask = q->size - 1; txsd = &q->sdesc[cidx]; - DPRINTF("reclaiming %d WR\n", reclaimable); + mtx_assert(&qs->lock, MA_OWNED); while (reclaimable--) { - DPRINTF("cidx=%d d=%p\n", cidx, txsd); + prefetch(q->sdesc[(cidx + 1) & mask].m); + prefetch(q->sdesc[(cidx + 2) & mask].m); + if (txsd->m != NULL) { if (txsd->flags & TX_SW_DESC_MAPPED) { bus_dmamap_unload(q->entry_tag, txsd->map); @@ -2688,15 +2691,20 @@ get_packet(adapter_t *adap, unsigned int unsigned int len_cq = ntohl(r->len_cq); struct sge_fl *fl = (len_cq & F_RSPD_FLQ) ? &qs->fl[1] : &qs->fl[0]; - struct rx_sw_desc *sd = &fl->sdesc[fl->cidx]; + int mask, cidx = fl->cidx; + struct rx_sw_desc *sd = &fl->sdesc[cidx]; uint32_t len = G_RSPD_LEN(len_cq); uint32_t flags = M_EXT; uint8_t sopeop = G_RSPD_SOP_EOP(ntohl(r->flags)); caddr_t cl; struct mbuf *m; int ret = 0; - - prefetch(sd->rxsd_cl); + + mask = fl->size - 1; + prefetch(fl->sdesc[(cidx + 1) & mask].m); + prefetch(fl->sdesc[(cidx + 2) & mask].m); + prefetch(fl->sdesc[(cidx + 1) & mask].rxsd_cl); + prefetch(fl->sdesc[(cidx + 2) & mask].rxsd_cl); fl->credits--; bus_dmamap_sync(fl->entry_tag, sd->map, BUS_DMASYNC_POSTREAD); @@ -2935,7 +2943,7 @@ process_responses(adapter_t *adap, struc rspq->gen ^= 1; r = rspq->desc; } - prefetch(r); + if (++rspq->credits >= (rspq->size / 4)) { refill_rspq(adap, rspq, rspq->credits); rspq->credits = 0; @@ -2955,8 +2963,6 @@ process_responses(adapter_t *adap, struc } else if (eth && eop) { struct mbuf *m = rspq->rspq_mh.mh_head; - prefetch(mtod(m, uint8_t *)); - prefetch(mtod(m, uint8_t *) + L1_CACHE_BYTES); t3_rx_eth(adap, rspq, m, ethpad); From owner-svn-src-user@FreeBSD.ORG Fri Jun 5 05:12:34 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A4D3106566C; Fri, 5 Jun 2009 05:12:34 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 095BE8FC18; Fri, 5 Jun 2009 05:12:34 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n555CXCi015174; Fri, 5 Jun 2009 05:12:33 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n555CXpe015173; Fri, 5 Jun 2009 05:12:33 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906050512.n555CXpe015173@svn.freebsd.org> From: Kip Macy Date: Fri, 5 Jun 2009 05:12:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193482 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 05 Jun 2009 05:12:34 -0000 Author: kmacy Date: Fri Jun 5 05:12:33 2009 New Revision: 193482 URL: http://svn.freebsd.org/changeset/base/193482 Log: - check that we don't try to produce packets faster than the card consume them by checking in_use vs. size - check for coalescing in direct transmit path Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Fri Jun 5 04:20:14 2009 (r193481) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Fri Jun 5 05:12:33 2009 (r193482) @@ -1503,8 +1503,8 @@ static void cxgb_start_locked(struct sge_qset *qs) { struct mbuf *m, *m_tail, *m_head = NULL; - int txmax = TX_START_MAX_DESC; struct sge_txq *txq = &qs->txq[TXQ_ETH]; + int txmax = min(TX_START_MAX_DESC, txq->size - txq->in_use); int in_use_init = txq->in_use; struct port_info *pi = qs->port; struct adapter *sc = pi->adapter; @@ -1565,19 +1565,21 @@ cxgb_transmit_locked(struct ifnet *ifp, { struct port_info *pi = qs->port; struct adapter *sc = pi->adapter; - struct buf_ring *br = qs->txq[TXQ_ETH].txq_mr; + struct sge_txq *txq = &qs->txq[TXQ_ETH]; + struct buf_ring *br = txq->txq_mr; int error, count = 1; TXQ_LOCK_ASSERT(qs); reclaim_completed_tx(qs, (TX_ETH_Q_SIZE>>4), TXQ_ETH); if (sc->tunq_coalesce == 0 && pi->link_config.link_ok && - TXQ_RING_EMPTY(qs)) { + TXQ_RING_EMPTY(qs) && (txq->size - txq->in_use) >= 4) { if (t3_encap(qs, &m, 1)) { if (m != NULL && (error = drbr_enqueue(ifp, br, m)) != 0) return (error); } else { + check_pkt_coalesce(qs); /* * We've bypassed the buf ring so we need to update * ifp directly From owner-svn-src-user@FreeBSD.ORG Fri Jun 5 05:42:20 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 667CC106564A; Fri, 5 Jun 2009 05:42:20 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 553028FC12; Fri, 5 Jun 2009 05:42:20 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n555gI9Z015765; Fri, 5 Jun 2009 05:42:18 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n555gIbM015764; Fri, 5 Jun 2009 05:42:18 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906050542.n555gIbM015764@svn.freebsd.org> From: Kip Macy Date: Fri, 5 Jun 2009 05:42:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193483 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 05 Jun 2009 05:42:20 -0000 Author: kmacy Date: Fri Jun 5 05:42:18 2009 New Revision: 193483 URL: http://svn.freebsd.org/changeset/base/193483 Log: - improve ring boundary checks - simplify coalesce check function and add comment - add comment explaining direct transmit conditions - break out multi-packet dequeue in to separate function Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Fri Jun 5 05:12:33 2009 (r193482) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Fri Jun 5 05:42:18 2009 (r193483) @@ -215,20 +215,25 @@ static void sge_timer_cb(void *arg); static void sge_timer_reclaim(void *arg, int ncount); static void sge_txq_reclaim_handler(void *arg, int ncount); - static __inline void check_pkt_coalesce(struct sge_qset *qs) { struct adapter *sc; struct sge_txq *txq; - + uint8_t *fill; + txq = &qs->txq[TXQ_ETH]; sc = qs->port->adapter; - - if (sc->tunq_fill[qs->idx] && (txq->in_use < (txq->size - (txq->size>>2)))) - sc->tunq_fill[qs->idx] = 0; - else if (!sc->tunq_fill[qs->idx] && (txq->in_use > (txq->size - (txq->size>>2)))) - sc->tunq_fill[qs->idx] = 1; + fill = &sc->tunq_fill[qs->idx]; + + /* + * if the hardware transmit queue is more than 3/4 full + * we mark it as coalescing + */ + if (*fill != 0 && (txq->in_use < (txq->size - (txq->size>>2)))) + *fill = 0; + else if (*fill == 0 && (txq->in_use >= (txq->size - (txq->size>>2)))) + *fill = 1; } #ifdef __LP64__ @@ -1499,38 +1504,52 @@ coalesce_check(struct mbuf *m, void *arg return (0); } +static struct mbuf * +cxgb_dequeue_chain(struct sge_qset *qs, int *count) +{ + int nbytes = 0; + struct mbuf *m, *m_head, *m_tail; + + m_head = m_tail = NULL; + do { + m = TXQ_RING_DEQUEUE_COND(qs, coalesce_check, &nbytes); + if (m_head == NULL) { + m_tail = m_head = m; + } else if (m != NULL) { + *count += 1; + m_tail->m_nextpkt = m; + m_tail = m; + } + } while (m != NULL); + + return (m_head); +} + static void cxgb_start_locked(struct sge_qset *qs) { - struct mbuf *m, *m_tail, *m_head = NULL; + struct mbuf *m_head = NULL; struct sge_txq *txq = &qs->txq[TXQ_ETH]; - int txmax = min(TX_START_MAX_DESC, txq->size - txq->in_use); + int txmax; int in_use_init = txq->in_use; struct port_info *pi = qs->port; struct adapter *sc = pi->adapter; struct ifnet *ifp = pi->ifp; - int count, nbytes; - + int count, avail; + + avail = txq->size - txq->in_use - 4; + txmax = min(TX_START_MAX_DESC, avail); + TXQ_LOCK_ASSERT(qs); while ((txq->in_use - in_use_init < txmax) && (!TXQ_RING_EMPTY(qs))) { - m_head = m_tail = NULL; + reclaim_completed_tx(qs, (TX_ETH_Q_SIZE>>4), TXQ_ETH); check_pkt_coalesce(qs); count = 1; - if (sc->tunq_coalesce) { - nbytes = 0; - do { - m = TXQ_RING_DEQUEUE_COND(qs, coalesce_check, &nbytes); - if (m_head == NULL) { - m_tail = m_head = m; - } else if (m != NULL) { - count++; - m_tail->m_nextpkt = m; - m_tail = m; - } - } while (m != NULL); - } else + if (sc->tunq_coalesce) + m_head = cxgb_dequeue_chain(qs, &count); + else m_head = TXQ_RING_DEQUEUE(qs); if (m_head == NULL) @@ -1567,13 +1586,21 @@ cxgb_transmit_locked(struct ifnet *ifp, struct adapter *sc = pi->adapter; struct sge_txq *txq = &qs->txq[TXQ_ETH]; struct buf_ring *br = txq->txq_mr; - int error, count = 1; + int error, avail; + avail = txq->size - txq->in_use; TXQ_LOCK_ASSERT(qs); reclaim_completed_tx(qs, (TX_ETH_Q_SIZE>>4), TXQ_ETH); + /* + * We can only do a direct transmit if the following are true: + * - we aren't coalescing (ring < 3/4 full) + * - the link is up + * - there are no packets enqueued already + * - there is space in hardware transmit queue + */ if (sc->tunq_coalesce == 0 && pi->link_config.link_ok && - TXQ_RING_EMPTY(qs) && (txq->size - txq->in_use) >= 4) { + TXQ_RING_EMPTY(qs) && avail > 4) { if (t3_encap(qs, &m, 1)) { if (m != NULL && (error = drbr_enqueue(ifp, br, m)) != 0) @@ -1593,7 +1620,7 @@ cxgb_transmit_locked(struct ifnet *ifp, /* * We sent via PIO, no longer need a copy */ - if (count == 1 && m->m_pkthdr.len <= PIO_LEN) + if (m->m_pkthdr.len <= PIO_LEN) m_freem(m); } From owner-svn-src-user@FreeBSD.ORG Fri Jun 5 06:06:36 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D7088106567E; Fri, 5 Jun 2009 06:06:36 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C52638FC19; Fri, 5 Jun 2009 06:06:36 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5566alF016265; Fri, 5 Jun 2009 06:06:36 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5566amZ016264; Fri, 5 Jun 2009 06:06:36 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906050606.n5566amZ016264@svn.freebsd.org> From: Kip Macy Date: Fri, 5 Jun 2009 06:06:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193484 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 05 Jun 2009 06:06:37 -0000 Author: kmacy Date: Fri Jun 5 06:06:36 2009 New Revision: 193484 URL: http://svn.freebsd.org/changeset/base/193484 Log: - remove multiq and coalesce sysctls - don't try to transmit if we're shutting down Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Fri Jun 5 05:42:18 2009 (r193483) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Fri Jun 5 06:06:36 2009 (r193484) @@ -1542,7 +1542,7 @@ cxgb_start_locked(struct sge_qset *qs) TXQ_LOCK_ASSERT(qs); while ((txq->in_use - in_use_init < txmax) && - (!TXQ_RING_EMPTY(qs))) { + (!TXQ_RING_EMPTY(qs)) && (sc->flags & CXGB_SHUTDOWN) == 0) { reclaim_completed_tx(qs, (TX_ETH_Q_SIZE>>4), TXQ_ETH); check_pkt_coalesce(qs); count = 1; @@ -1639,6 +1639,11 @@ cxgb_transmit(struct ifnet *ifp, struct struct sge_qset *qs; struct port_info *pi = ifp->if_softc; int error, qidx = pi->first_qset; + + if (pi->adapter->flags & CXGB_SHUTDOWN) { + m_freem(m); + return (0); + } if (m->m_flags & M_FLOWID) qidx = (m->m_pkthdr.flowid % pi->nqsets) + pi->first_qset; @@ -3420,14 +3425,6 @@ t3_add_attach_sysctls(adapter_t *sc) "txq_overrun", CTLFLAG_RD, &txq_fills, 0, "#times txq overrun"); - SYSCTL_ADD_INT(ctx, children, OID_AUTO, - "multiq_tx_enable", - CTLFLAG_RW, &multiq_tx_enable, - 0, "enable transmit by multiple tx queues"); - SYSCTL_ADD_INT(ctx, children, OID_AUTO, - "coalesce_tx_enable", - CTLFLAG_RW, &coalesce_tx_enable, - 0, "coalesce small packets in work requests - WARNING ALPHA"); } From owner-svn-src-user@FreeBSD.ORG Fri Jun 5 06:09:56 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F32B4106566B; Fri, 5 Jun 2009 06:09:55 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E24428FC1C; Fri, 5 Jun 2009 06:09:55 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5569tNT016356; Fri, 5 Jun 2009 06:09:55 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5569tvu016355; Fri, 5 Jun 2009 06:09:55 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906050609.n5569tvu016355@svn.freebsd.org> From: Kip Macy Date: Fri, 5 Jun 2009 06:09:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193485 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 05 Jun 2009 06:09:56 -0000 Author: kmacy Date: Fri Jun 5 06:09:55 2009 New Revision: 193485 URL: http://svn.freebsd.org/changeset/base/193485 Log: - check against running flag - remove unused variable Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Fri Jun 5 06:06:36 2009 (r193484) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Fri Jun 5 06:09:55 2009 (r193485) @@ -96,8 +96,6 @@ extern int nmbjumbo4; extern int nmbjumbo9; extern int nmbjumbo16; -static int coalesce_tx_enable; - #define USE_GTS 0 #define SGE_RX_SM_BUF_SIZE 1536 @@ -1542,7 +1540,7 @@ cxgb_start_locked(struct sge_qset *qs) TXQ_LOCK_ASSERT(qs); while ((txq->in_use - in_use_init < txmax) && - (!TXQ_RING_EMPTY(qs)) && (sc->flags & CXGB_SHUTDOWN) == 0) { + (!TXQ_RING_EMPTY(qs)) && (ifp->if_drv_flags & IFF_DRV_RUNNING)) { reclaim_completed_tx(qs, (TX_ETH_Q_SIZE>>4), TXQ_ETH); check_pkt_coalesce(qs); count = 1; @@ -1640,7 +1638,7 @@ cxgb_transmit(struct ifnet *ifp, struct struct port_info *pi = ifp->if_softc; int error, qidx = pi->first_qset; - if (pi->adapter->flags & CXGB_SHUTDOWN) { + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { m_freem(m); return (0); } From owner-svn-src-user@FreeBSD.ORG Fri Jun 5 12:35:57 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A3BAB106566C; Fri, 5 Jun 2009 12:35:57 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9173F8FC18; Fri, 5 Jun 2009 12:35:57 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n55CZvcF025554; Fri, 5 Jun 2009 12:35:57 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n55CZvD4025545; Fri, 5 Jun 2009 12:35:57 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200906051235.n55CZvD4025545@svn.freebsd.org> From: Luigi Rizzo Date: Fri, 5 Jun 2009 12:35:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193496 - in user/luigi/ipfw_80/sys: net netinet netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 05 Jun 2009 12:35:57 -0000 Author: luigi Date: Fri Jun 5 12:35:56 2009 New Revision: 193496 URL: http://svn.freebsd.org/changeset/base/193496 Log: another batch of small changes to move ipfw-related stuff into its own directory, and reduce header dependencies. Modified: user/luigi/ipfw_80/sys/net/if_bridge.c user/luigi/ipfw_80/sys/net/if_ethersubr.c user/luigi/ipfw_80/sys/netinet/ip_divert.c user/luigi/ipfw_80/sys/netinet/ip_input.c user/luigi/ipfw_80/sys/netinet/ip_var.h user/luigi/ipfw_80/sys/netinet/ipfw/ip_dummynet.c user/luigi/ipfw_80/sys/netinet/ipfw/ip_fw2.c user/luigi/ipfw_80/sys/netinet/ipfw/ip_fw_pfil.c user/luigi/ipfw_80/sys/netinet/raw_ip.c Modified: user/luigi/ipfw_80/sys/net/if_bridge.c ============================================================================== --- user/luigi/ipfw_80/sys/net/if_bridge.c Fri Jun 5 12:14:43 2009 (r193495) +++ user/luigi/ipfw_80/sys/net/if_bridge.c Fri Jun 5 12:35:56 2009 (r193496) @@ -3060,7 +3060,7 @@ bridge_pfil(struct mbuf **mp, struct ifn if (*mp == NULL) return (error); - if (DUMMYNET_LOADED && (i == IP_FW_DUMMYNET)) { + if (ip_dn_io_ptr && (i == IP_FW_DUMMYNET)) { /* put the Ethernet header back on */ M_PREPEND(*mp, ETHER_HDR_LEN, M_DONTWAIT); Modified: user/luigi/ipfw_80/sys/net/if_ethersubr.c ============================================================================== --- user/luigi/ipfw_80/sys/net/if_ethersubr.c Fri Jun 5 12:14:43 2009 (r193495) +++ user/luigi/ipfw_80/sys/net/if_ethersubr.c Fri Jun 5 12:35:56 2009 (r193496) @@ -524,7 +524,7 @@ ether_ipfw_chk(struct mbuf **m0, struct if (i == IP_FW_PASS) /* a PASS rule. */ return 1; - if (DUMMYNET_LOADED && (i == IP_FW_DUMMYNET)) { + if (ip_dn_io_ptr && (i == IP_FW_DUMMYNET)) { /* * Pass the pkt to dummynet, which consumes it. * If shared, make a copy and keep the original. Modified: user/luigi/ipfw_80/sys/netinet/ip_divert.c ============================================================================== --- user/luigi/ipfw_80/sys/netinet/ip_divert.c Fri Jun 5 12:14:43 2009 (r193495) +++ user/luigi/ipfw_80/sys/netinet/ip_divert.c Fri Jun 5 12:35:56 2009 (r193496) @@ -76,7 +76,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include /* IP_FW_DIVERT_*_FLAG */ #include #ifdef SCTP #include Modified: user/luigi/ipfw_80/sys/netinet/ip_input.c ============================================================================== --- user/luigi/ipfw_80/sys/netinet/ip_input.c Fri Jun 5 12:14:43 2009 (r193495) +++ user/luigi/ipfw_80/sys/netinet/ip_input.c Fri Jun 5 12:35:56 2009 (r193496) @@ -213,12 +213,6 @@ SYSCTL_V_INT(V_NET, vnet_inet, _net_inet CTLFLAG_RDTUN, ip_output_flowtable_size, 2048, "number of entries in the per-cpu output flow caches"); -/* - * ipfw_ether and ipfw_bridge hooks. - * XXX: Temporary until those are converted to pfil_hooks as well. - */ -ip_fw_chk_t *ip_fw_chk_ptr = NULL; -ip_dn_io_t *ip_dn_io_ptr = NULL; #ifdef VIMAGE_GLOBALS int fw_one_pass; #endif Modified: user/luigi/ipfw_80/sys/netinet/ip_var.h ============================================================================== --- user/luigi/ipfw_80/sys/netinet/ip_var.h Fri Jun 5 12:14:43 2009 (r193495) +++ user/luigi/ipfw_80/sys/netinet/ip_var.h Fri Jun 5 12:35:56 2009 (r193496) @@ -224,24 +224,16 @@ extern struct pfil_head inet_pfil_hook; void in_delayed_cksum(struct mbuf *m); -/* Prototypes for ipfw and dummynet hooks */ -typedef int ip_fw_ctl_t(struct sockopt *); -extern ip_fw_ctl_t *ip_fw_ctl_ptr; -/* For kernel ipfw_ether and ipfw_bridge. */ +/* ipfw and dummynet hooks */ +extern int (*ip_fw_ctl_ptr)(struct sockopt *); struct ip_fw_args; -typedef int ip_fw_chk_t(struct ip_fw_args *args); -extern ip_fw_chk_t *ip_fw_chk_ptr; +extern int (*ip_fw_chk_ptr)(struct ip_fw_args *args); #define IPFW_LOADED (ip_fw_chk_ptr != NULL) -typedef int ip_dn_ctl_t(struct sockopt *); /* raw_ip.c */ -typedef void ip_dn_ruledel_t(void *); /* ip_fw.c */ -typedef int ip_dn_io_t(struct mbuf **m, int dir, struct ip_fw_args *fwa); -extern ip_dn_ctl_t *ip_dn_ctl_ptr; -extern ip_dn_ruledel_t *ip_dn_ruledel_ptr; -extern ip_dn_io_t *ip_dn_io_ptr; -#define DUMMYNET_LOADED (ip_dn_io_ptr != NULL) - - +extern int (*ip_dn_ctl_ptr)(struct sockopt *); /* raw_ip.c */ +extern int (*ip_dn_io_ptr)(struct mbuf **m, int dir, struct ip_fw_args *fwa); +//typedef void ip_dn_ruledel_t(void *); /* ip_fw_pfil.c */ +extern void (*ip_dn_ruledel_ptr)(void *); /* ip_fw_pfil.c */ #endif /* _KERNEL */ #endif /* !_NETINET_IP_VAR_H_ */ Modified: user/luigi/ipfw_80/sys/netinet/ipfw/ip_dummynet.c ============================================================================== --- user/luigi/ipfw_80/sys/netinet/ipfw/ip_dummynet.c Fri Jun 5 12:14:43 2009 (r193495) +++ user/luigi/ipfw_80/sys/netinet/ipfw/ip_dummynet.c Fri Jun 5 12:35:56 2009 (r193496) @@ -244,7 +244,7 @@ static void dummynet(void *); static void dummynet_flush(void); static void dummynet_send(struct mbuf *); void dummynet_drain(void); -static ip_dn_io_t dummynet_io; +static int dummynet_io(struct mbuf **, int , struct ip_fw_args *); static void dn_rule_delete(void *); /* @@ -1640,8 +1640,9 @@ dn_rule_delete_fs(struct dn_flow_set *fs pkt->rule = ip_fw_default_rule ; } } + /* - * when a firewall rule is deleted, scan all queues and remove the flow-id + * when a firewall rule is deleted, scan all queues and remove the rule-id * from packets matching this rule. */ void @@ -2339,7 +2340,7 @@ dummynet_modevent(module_t mod, int type switch (type) { case MOD_LOAD: - if (DUMMYNET_LOADED) { + if (ip_dn_io_ptr) { printf("DUMMYNET already loaded\n"); return EEXIST ; } Modified: user/luigi/ipfw_80/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- user/luigi/ipfw_80/sys/netinet/ipfw/ip_fw2.c Fri Jun 5 12:14:43 2009 (r193495) +++ user/luigi/ipfw_80/sys/netinet/ipfw/ip_fw2.c Fri Jun 5 12:35:56 2009 (r193496) @@ -3605,6 +3605,12 @@ remove_rule(struct ip_fw_chain *chain, s return n; } +/* + * Hook for rule delete. + * Set/cleared when dummynet module is loaded. + */ +void (*ip_dn_ruledel_ptr)(void *) = NULL; + /** * Reclaim storage associated with a list of rules. This is * typically the list created using remove_rule. @@ -3616,7 +3622,7 @@ reap_rules(struct ip_fw *head) while ((rule = head) != NULL) { head = head->next; - if (DUMMYNET_LOADED) + if (ip_dn_ruledel_ptr) ip_dn_ruledel_ptr(rule); free(rule, M_IPFW); } Modified: user/luigi/ipfw_80/sys/netinet/ipfw/ip_fw_pfil.c ============================================================================== --- user/luigi/ipfw_80/sys/netinet/ipfw/ip_fw_pfil.c Fri Jun 5 12:14:43 2009 (r193495) +++ user/luigi/ipfw_80/sys/netinet/ipfw/ip_fw_pfil.c Fri Jun 5 12:35:56 2009 (r193496) @@ -79,9 +79,6 @@ int fw6_enable = 1; int ipfw_chg_hook(SYSCTL_HANDLER_ARGS); -/* Dummynet hooks. */ -ip_dn_ruledel_t *ip_dn_ruledel_ptr = NULL; - /* Divert hooks. */ ip_divert_packet_t *ip_divert_ptr = NULL; @@ -169,7 +166,7 @@ again: break; /* not reached */ case IP_FW_DUMMYNET: - if (!DUMMYNET_LOADED) + if (ip_dn_io_ptr == NULL) goto drop; if (mtod(*m0, struct ip *)->ip_v == 4) ip_dn_io_ptr(m0, DN_TO_IP_IN, &args); @@ -304,7 +301,7 @@ again: break; /* not reached */ case IP_FW_DUMMYNET: - if (!DUMMYNET_LOADED) + if (ip_dn_io_ptr == NULL) break; if (mtod(*m0, struct ip *)->ip_v == 4) ip_dn_io_ptr(m0, DN_TO_IP_OUT, &args); Modified: user/luigi/ipfw_80/sys/netinet/raw_ip.c ============================================================================== --- user/luigi/ipfw_80/sys/netinet/raw_ip.c Fri Jun 5 12:14:43 2009 (r193495) +++ user/luigi/ipfw_80/sys/netinet/raw_ip.c Fri Jun 5 12:35:56 2009 (r193496) @@ -83,9 +83,15 @@ struct inpcbhead ripcb; struct inpcbinfo ripcbinfo; #endif -/* control hooks for ipfw and dummynet */ -ip_fw_ctl_t *ip_fw_ctl_ptr = NULL; -ip_dn_ctl_t *ip_dn_ctl_ptr = NULL; +/* + * Control and data hooks for ipfw and dummynet. + * The data hooks are not used here but it is convenient + * to keep them all in one place. + */ +int (*ip_fw_ctl_ptr)(struct sockopt *) = NULL; +int (*ip_dn_ctl_ptr)(struct sockopt *) = NULL; +int (*ip_fw_chk_ptr)(struct ip_fw_args *args) = NULL; +int (*ip_dn_io_ptr)(struct mbuf **m, int dir, struct ip_fw_args *fwa) = NULL; /* * Hooks for multicast routing. They all default to NULL, so leave them not From owner-svn-src-user@FreeBSD.ORG Fri Jun 5 13:07:36 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C5CCA1065670; Fri, 5 Jun 2009 13:07:36 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B49A28FC1F; Fri, 5 Jun 2009 13:07:36 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n55D7awN026366; Fri, 5 Jun 2009 13:07:36 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n55D7acj026364; Fri, 5 Jun 2009 13:07:36 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200906051307.n55D7acj026364@svn.freebsd.org> From: Luigi Rizzo Date: Fri, 5 Jun 2009 13:07:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193499 - user/luigi/ipfw_80/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 05 Jun 2009 13:07:37 -0000 Author: luigi Date: Fri Jun 5 13:07:36 2009 New Revision: 193499 URL: http://svn.freebsd.org/changeset/base/193499 Log: fix some comments Modified: user/luigi/ipfw_80/sys/netinet/ipfw/ip_dummynet.c user/luigi/ipfw_80/sys/netinet/ipfw/ip_fw2.c Modified: user/luigi/ipfw_80/sys/netinet/ipfw/ip_dummynet.c ============================================================================== --- user/luigi/ipfw_80/sys/netinet/ipfw/ip_dummynet.c Fri Jun 5 13:05:14 2009 (r193498) +++ user/luigi/ipfw_80/sys/netinet/ipfw/ip_dummynet.c Fri Jun 5 13:07:36 2009 (r193499) @@ -1642,8 +1642,9 @@ dn_rule_delete_fs(struct dn_flow_set *fs } /* - * when a firewall rule is deleted, scan all queues and remove the rule-id - * from packets matching this rule. + * When a firewall rule is deleted, scan all queues and remove the pointer + * to the rule from matching packets, making them point to the default rule. + * The pointer is used to reinject packets in case one_pass = 0. */ void dn_rule_delete(void *r) Modified: user/luigi/ipfw_80/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- user/luigi/ipfw_80/sys/netinet/ipfw/ip_fw2.c Fri Jun 5 13:05:14 2009 (r193498) +++ user/luigi/ipfw_80/sys/netinet/ipfw/ip_fw2.c Fri Jun 5 13:07:36 2009 (r193499) @@ -3606,8 +3606,8 @@ remove_rule(struct ip_fw_chain *chain, s } /* - * Hook for rule delete. - * Set/cleared when dummynet module is loaded. + * Hook for cleaning up dummynet when an ipfw rule is deleted. + * Set/cleared when dummynet module is loaded/unloaded. */ void (*ip_dn_ruledel_ptr)(void *) = NULL; From owner-svn-src-user@FreeBSD.ORG Fri Jun 5 13:50:19 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CFAC91065676; Fri, 5 Jun 2009 13:50:19 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BEA498FC1D; Fri, 5 Jun 2009 13:50:19 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n55DoJML027401; Fri, 5 Jun 2009 13:50:19 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n55DoJUh027400; Fri, 5 Jun 2009 13:50:19 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200906051350.n55DoJUh027400@svn.freebsd.org> From: Luigi Rizzo Date: Fri, 5 Jun 2009 13:50:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193503 - user/luigi/ipfw_80/sbin/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 05 Jun 2009 13:50:20 -0000 Author: luigi Date: Fri Jun 5 13:50:19 2009 New Revision: 193503 URL: http://svn.freebsd.org/changeset/base/193503 Log: sync with head Modified: user/luigi/ipfw_80/sbin/ipfw/dummynet.c Modified: user/luigi/ipfw_80/sbin/ipfw/dummynet.c ============================================================================== --- user/luigi/ipfw_80/sbin/ipfw/dummynet.c Fri Jun 5 13:44:30 2009 (r193502) +++ user/luigi/ipfw_80/sbin/ipfw/dummynet.c Fri Jun 5 13:50:19 2009 (r193503) @@ -314,10 +314,6 @@ ipfw_list_pipes(void *data, uint nbytes, print_extra_delay_parms(p, prefix); print_flowset_parms(&(p->fs), prefix); -#if 0 - if (co.verbose) - printf(" V %20llu\n", align_uint64(&p->V) >> MY_M); -#endif q = (struct dn_flow_queue *)(p+1); list_queues(&(p->fs), q); From owner-svn-src-user@FreeBSD.ORG Fri Jun 5 14:04:37 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F1A510656FD; Fri, 5 Jun 2009 14:04:37 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0D9D38FC0C; Fri, 5 Jun 2009 14:04:37 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n55E4ap8027782; Fri, 5 Jun 2009 14:04:36 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n55E4acl027779; Fri, 5 Jun 2009 14:04:36 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200906051404.n55E4acl027779@svn.freebsd.org> From: Luigi Rizzo Date: Fri, 5 Jun 2009 14:04:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193505 - in user/luigi/ipfw_80/sys: net netinet X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 05 Jun 2009 14:04:37 -0000 Author: luigi Date: Fri Jun 5 14:04:36 2009 New Revision: 193505 URL: http://svn.freebsd.org/changeset/base/193505 Log: sync ipfw-related changes with head Modified: user/luigi/ipfw_80/sys/net/if_bridge.c user/luigi/ipfw_80/sys/net/if_ethersubr.c user/luigi/ipfw_80/sys/netinet/ip_var.h Modified: user/luigi/ipfw_80/sys/net/if_bridge.c ============================================================================== --- user/luigi/ipfw_80/sys/net/if_bridge.c Fri Jun 5 13:55:33 2009 (r193504) +++ user/luigi/ipfw_80/sys/net/if_bridge.c Fri Jun 5 14:04:36 2009 (r193505) @@ -3041,7 +3041,7 @@ bridge_pfil(struct mbuf **mp, struct ifn goto bad; } - if (IPFW_LOADED && pfil_ipfw != 0 && dir == PFIL_OUT && ifp != NULL) { + if (ip_fw_chk_ptr && pfil_ipfw != 0 && dir == PFIL_OUT && ifp != NULL) { INIT_VNET_INET(curvnet); error = -1; Modified: user/luigi/ipfw_80/sys/net/if_ethersubr.c ============================================================================== --- user/luigi/ipfw_80/sys/net/if_ethersubr.c Fri Jun 5 13:55:33 2009 (r193504) +++ user/luigi/ipfw_80/sys/net/if_ethersubr.c Fri Jun 5 14:04:36 2009 (r193505) @@ -436,7 +436,7 @@ ether_output_frame(struct ifnet *ifp, st INIT_VNET_NET(ifp->if_vnet); struct ip_fw *rule = ip_dn_claim_rule(m); - if (IPFW_LOADED && V_ether_ipfw != 0) { + if (ip_fw_chk_ptr && V_ether_ipfw != 0) { if (ether_ipfw_chk(&m, ifp, &rule, 0) == 0) { if (m) { m_freem(m); @@ -770,7 +770,7 @@ ether_demux(struct ifnet *ifp, struct mb * Allow dummynet and/or ipfw to claim the frame. * Do not do this for PROMISC frames in case we are re-entered. */ - if (IPFW_LOADED && V_ether_ipfw != 0 && !(m->m_flags & M_PROMISC)) { + if (ip_fw_chk_ptr && V_ether_ipfw != 0 && !(m->m_flags & M_PROMISC)) { struct ip_fw *rule = ip_dn_claim_rule(m); if (ether_ipfw_chk(&m, NULL, &rule, 0) == 0) { Modified: user/luigi/ipfw_80/sys/netinet/ip_var.h ============================================================================== --- user/luigi/ipfw_80/sys/netinet/ip_var.h Fri Jun 5 13:55:33 2009 (r193504) +++ user/luigi/ipfw_80/sys/netinet/ip_var.h Fri Jun 5 14:04:36 2009 (r193505) @@ -224,16 +224,13 @@ extern struct pfil_head inet_pfil_hook; void in_delayed_cksum(struct mbuf *m); -/* ipfw and dummynet hooks */ -extern int (*ip_fw_ctl_ptr)(struct sockopt *); +/* ipfw and dummynet hooks. Most are declared in raw_ip.c */ struct ip_fw_args; -extern int (*ip_fw_chk_ptr)(struct ip_fw_args *args); -#define IPFW_LOADED (ip_fw_chk_ptr != NULL) - -extern int (*ip_dn_ctl_ptr)(struct sockopt *); /* raw_ip.c */ -extern int (*ip_dn_io_ptr)(struct mbuf **m, int dir, struct ip_fw_args *fwa); -//typedef void ip_dn_ruledel_t(void *); /* ip_fw_pfil.c */ -extern void (*ip_dn_ruledel_ptr)(void *); /* ip_fw_pfil.c */ +extern int (*ip_fw_chk_ptr)(struct ip_fw_args *args); +extern int (*ip_fw_ctl_ptr)(struct sockopt *); +extern int (*ip_dn_ctl_ptr)(struct sockopt *); +extern int (*ip_dn_io_ptr)(struct mbuf **m, int dir, struct ip_fw_args *fwa); +extern void (*ip_dn_ruledel_ptr)(void *); /* in ip_fw2.c */ #endif /* _KERNEL */ #endif /* !_NETINET_IP_VAR_H_ */ From owner-svn-src-user@FreeBSD.ORG Fri Jun 5 18:14:51 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B51B3106566C; Fri, 5 Jun 2009 18:14:51 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 890F68FC16; Fri, 5 Jun 2009 18:14:51 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n55IEpuq034061; Fri, 5 Jun 2009 18:14:51 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n55IEpTu034059; Fri, 5 Jun 2009 18:14:51 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200906051814.n55IEpTu034059@svn.freebsd.org> From: Luigi Rizzo Date: Fri, 5 Jun 2009 18:14:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193528 - in user/luigi/ipfw_80: sbin/ipfw sys/netinet X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 05 Jun 2009 18:14:52 -0000 Author: luigi Date: Fri Jun 5 18:14:51 2009 New Revision: 193528 URL: http://svn.freebsd.org/changeset/base/193528 Log: sync with head Modified: user/luigi/ipfw_80/sbin/ipfw/ipfw2.c user/luigi/ipfw_80/sys/netinet/ip_fw.h Modified: user/luigi/ipfw_80/sbin/ipfw/ipfw2.c ============================================================================== --- user/luigi/ipfw_80/sbin/ipfw/ipfw2.c Fri Jun 5 17:44:43 2009 (r193527) +++ user/luigi/ipfw_80/sbin/ipfw/ipfw2.c Fri Jun 5 18:14:51 2009 (r193528) @@ -2859,7 +2859,7 @@ chkarg: if (have_tag) errx(EX_USAGE, "tag and untag cannot be " "specified more than once"); - GET_UINT_ARG(tag, 1, IPFW_DEFAULT_RULE - 1, i, + GET_UINT_ARG(tag, IPFW_ARG_MIN, IPFW_ARG_MAX, i, rule_action_params); have_tag = cmd; fill_cmd(cmd, O_TAG, (i == TOK_TAG) ? 0: F_NOT, tag); @@ -3336,7 +3336,7 @@ read_options: if (c->limit_mask == 0) errx(EX_USAGE, "limit: missing limit mask"); - GET_UINT_ARG(c->conn_limit, 1, IPFW_DEFAULT_RULE - 1, + GET_UINT_ARG(c->conn_limit, IPFW_ARG_MIN, IPFW_ARG_MAX, TOK_LIMIT, rule_options); ac--; av++; @@ -3464,7 +3464,7 @@ read_options: else { uint16_t tag; - GET_UINT_ARG(tag, 1, IPFW_DEFAULT_RULE - 1, + GET_UINT_ARG(tag, IPFW_ARG_MIN, IPFW_ARG_MAX, TOK_TAGGED, rule_options); fill_cmd(cmd, O_TAGGED, 0, tag); } Modified: user/luigi/ipfw_80/sys/netinet/ip_fw.h ============================================================================== --- user/luigi/ipfw_80/sys/netinet/ip_fw.h Fri Jun 5 17:44:43 2009 (r193527) +++ user/luigi/ipfw_80/sys/netinet/ip_fw.h Fri Jun 5 18:14:51 2009 (r193528) @@ -47,6 +47,20 @@ #define IPFW_TABLES_MAX 128 /* + * Most commands (queue, pipe, tag, untag, limit...) can have a 16-bit + * argument between 1 and 65534. The value 0 is unused, the value + * 65535 (IP_FW_TABLEARG) is used to represent 'tablearg', i.e. the + * can be 1..65534, or 65535 to indicate the use of a 'tablearg' + * result of the most recent table() lookup. + * Note that 16bit is only a historical limit, resulting from + * the use of a 16-bit fields for that value. In reality, we can have + * 2^32 pipes, queues, tag values and so on, and use 0 as a tablearg. + */ +#define IPFW_ARG_MIN 1 +#define IPFW_ARG_MAX 65534 +#define IP_FW_TABLEARG 65535 /* XXX should use 0 */ + +/* * The kernel representation of ipfw rules is made of a list of * 'instructions' (for all practical purposes equivalent to BPF * instructions), which specify which fields of the packet @@ -243,8 +257,6 @@ typedef struct _ipfw_insn { /* template */ #define F_INSN_SIZE(t) ((sizeof (t))/sizeof(u_int32_t)) -#define MTAG_IPFW 1148380143 /* IPFW-tagged cookie */ - /* * This is used to store an array of 16-bit entries (ports etc.) */ @@ -562,6 +574,4 @@ typedef struct _ipfw_table { ipfw_table_entry ent[0]; /* entries */ } ipfw_table; -#define IP_FW_TABLEARG 65535 - #endif /* _IPFW2_H */ From owner-svn-src-user@FreeBSD.ORG Fri Jun 5 22:21:11 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E97261065672; Fri, 5 Jun 2009 22:21:10 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D7F558FC0A; Fri, 5 Jun 2009 22:21:10 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n55MLAdQ039802; Fri, 5 Jun 2009 22:21:10 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n55MLADB039801; Fri, 5 Jun 2009 22:21:10 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906052221.n55MLADB039801@svn.freebsd.org> From: Kip Macy Date: Fri, 5 Jun 2009 22:21:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193538 - user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 05 Jun 2009 22:21:12 -0000 Author: kmacy Date: Fri Jun 5 22:21:10 2009 New Revision: 193538 URL: http://svn.freebsd.org/changeset/base/193538 Log: we're only reading from the dnode, treat the dn_mtx as a shared rwlock Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Modified: user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Fri Jun 5 21:00:21 2009 (r193537) +++ user/kmacy/releng_7_2_fcs/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Fri Jun 5 22:21:10 2009 (r193538) @@ -1086,7 +1086,7 @@ void dmu_object_info_from_dnode(dnode_t *dn, dmu_object_info_t *doi) { rw_enter(&dn->dn_struct_rwlock, RW_READER); - mutex_enter(&dn->dn_mtx); + rw_enter(&dn->dn_mtx, RW_READER); doi->doi_data_block_size = dn->dn_datablksz; doi->doi_metadata_block_size = dn->dn_indblkshift ? @@ -1101,7 +1101,7 @@ dmu_object_info_from_dnode(dnode_t *dn, doi->doi_bonus_size = dn->dn_bonuslen; doi->doi_bonus_type = dn->dn_bonustype; - mutex_exit(&dn->dn_mtx); + rw_exit(&dn->dn_mtx); rw_exit(&dn->dn_struct_rwlock); } From owner-svn-src-user@FreeBSD.ORG Fri Jun 5 22:36:17 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B34121065686; Fri, 5 Jun 2009 22:36:17 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A1BD68FC22; Fri, 5 Jun 2009 22:36:17 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n55MaHKU040168; Fri, 5 Jun 2009 22:36:17 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n55MaHAA040167; Fri, 5 Jun 2009 22:36:17 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906052236.n55MaHAA040167@svn.freebsd.org> From: Kip Macy Date: Fri, 5 Jun 2009 22:36:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193540 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 05 Jun 2009 22:36:18 -0000 Author: kmacy Date: Fri Jun 5 22:36:17 2009 New Revision: 193540 URL: http://svn.freebsd.org/changeset/base/193540 Log: - assert that we're given a packet header - tso_info can only apply to a packet chain when count is 1 Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Fri Jun 5 22:23:33 2009 (r193539) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Fri Jun 5 22:36:17 2009 (r193540) @@ -1308,11 +1308,11 @@ t3_encap(struct sge_qset *qs, struct mbu mtx_assert(&qs->lock, MA_OWNED); cntrl = V_TXPKT_INTF(pi->txpkt_intf); -/* - * XXX need to add VLAN support for 6.x - */ + KASSERT(m0->m_flags & M_PKTHDR, ("not packet header\n")); + #ifdef VLAN_SUPPORTED - if (m0->m_pkthdr.csum_flags & (CSUM_TSO)) + if (count == 1 && m0->m_next != NULL && + m0->m_pkthdr.csum_flags & (CSUM_TSO)) tso_info = V_LSO_MSS(m0->m_pkthdr.tso_segsz); #endif if (count > 1) { From owner-svn-src-user@FreeBSD.ORG Fri Jun 5 23:22:16 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 249E310656C2; Fri, 5 Jun 2009 23:22:16 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ED17F8FC0A; Fri, 5 Jun 2009 23:22:15 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n55NMFpT041193; Fri, 5 Jun 2009 23:22:15 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n55NMF1o041192; Fri, 5 Jun 2009 23:22:15 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906052322.n55NMF1o041192@svn.freebsd.org> From: Kip Macy Date: Fri, 5 Jun 2009 23:22:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193544 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 05 Jun 2009 23:22:16 -0000 Author: kmacy Date: Fri Jun 5 23:22:15 2009 New Revision: 193544 URL: http://svn.freebsd.org/changeset/base/193544 Log: - ensure that we don't try to chain more than 7 packets - defer call to start if we're coalescing and there are fewer than 7 packets in the sw queue Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Fri Jun 5 23:21:29 2009 (r193543) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Fri Jun 5 23:22:15 2009 (r193544) @@ -1485,16 +1485,26 @@ t3_encap(struct sge_qset *qs, struct mbu return (0); } +struct coalesce_info { + int count; + int nbytes; +}; + + static int coalesce_check(struct mbuf *m, void *arg) { - uintptr_t *nbytes = (uintptr_t *)arg; + struct coalesce_info *ci = arg; + int *count = &ci->count; + int *nbytes = &ci->nbytes; - if (*nbytes == 0) + if (*nbytes == 0) { + *count = 1; return (1); - else if (m->m_next != NULL) + } else if ((m->m_next != NULL) && (*count > 6)) return (0); else if (*nbytes + m->m_len <= 10500) { + *count += 1; *nbytes += m->m_len; return (1); } @@ -1503,18 +1513,17 @@ coalesce_check(struct mbuf *m, void *arg } static struct mbuf * -cxgb_dequeue_chain(struct sge_qset *qs, int *count) +cxgb_dequeue_chain(struct sge_qset *qs, struct coalesce_info *ci) { - int nbytes = 0; struct mbuf *m, *m_head, *m_tail; m_head = m_tail = NULL; + ci->nbytes = 0; do { - m = TXQ_RING_DEQUEUE_COND(qs, coalesce_check, &nbytes); + m = TXQ_RING_DEQUEUE_COND(qs, coalesce_check, &ci); if (m_head == NULL) { m_tail = m_head = m; } else if (m != NULL) { - *count += 1; m_tail->m_nextpkt = m; m_tail = m; } @@ -1534,6 +1543,7 @@ cxgb_start_locked(struct sge_qset *qs) struct adapter *sc = pi->adapter; struct ifnet *ifp = pi->ifp; int count, avail; + struct coalesce_info ci; avail = txq->size - txq->in_use - 4; txmax = min(TX_START_MAX_DESC, avail); @@ -1546,7 +1556,7 @@ cxgb_start_locked(struct sge_qset *qs) count = 1; if (sc->tunq_coalesce) - m_head = cxgb_dequeue_chain(qs, &count); + m_head = cxgb_dequeue_chain(qs, &ci); else m_head = TXQ_RING_DEQUEUE(qs); @@ -1556,7 +1566,7 @@ cxgb_start_locked(struct sge_qset *qs) * Encapsulation can modify our pointer, and or make it * NULL on failure. In that event, we can't requeue. */ - if (t3_encap(qs, &m_head, count)) + if (t3_encap(qs, &m_head, ci.count)) break; /* Send a copy of the frame to the BPF listener */ @@ -1625,7 +1635,8 @@ cxgb_transmit_locked(struct ifnet *ifp, } else if ((error = drbr_enqueue(ifp, br, m)) != 0) return (error); - if (!TXQ_RING_EMPTY(qs) && pi->link_config.link_ok) + if (!TXQ_RING_EMPTY(qs) && pi->link_config.link_ok && + (!sc->tunq_coalesce || (drbr_inuse(ifp, br) >= 7))) cxgb_start_locked(qs); return (0); From owner-svn-src-user@FreeBSD.ORG Fri Jun 5 23:23:24 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 926A210656AB; Fri, 5 Jun 2009 23:23:24 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8115C8FC2C; Fri, 5 Jun 2009 23:23:24 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n55NNOUc041256; Fri, 5 Jun 2009 23:23:24 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n55NNOUZ041255; Fri, 5 Jun 2009 23:23:24 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906052323.n55NNOUZ041255@svn.freebsd.org> From: Kip Macy Date: Fri, 5 Jun 2009 23:23:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193545 - user/kmacy/releng_7_2_fcs/sys/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 05 Jun 2009 23:23:25 -0000 Author: kmacy Date: Fri Jun 5 23:23:24 2009 New Revision: 193545 URL: http://svn.freebsd.org/changeset/base/193545 Log: add function to return number of queued packets Modified: user/kmacy/releng_7_2_fcs/sys/net/if_var.h Modified: user/kmacy/releng_7_2_fcs/sys/net/if_var.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/net/if_var.h Fri Jun 5 23:22:15 2009 (r193544) +++ user/kmacy/releng_7_2_fcs/sys/net/if_var.h Fri Jun 5 23:23:24 2009 (r193545) @@ -643,6 +643,16 @@ drbr_empty(struct ifnet *ifp, struct buf #endif return (buf_ring_empty(br)); } + +static __inline int +drbr_inuse(struct ifnet *ifp, struct buf_ring *br) +{ +#ifdef ALTQ + if (ALTQ_IS_ENABLED(&ifp->if_snd)) + return (ifp->if_snd.ifq_len); +#endif + return (buf_ring_count(br)); +} #endif /* * 72 was chosen below because it is the size of a TCP/IP From owner-svn-src-user@FreeBSD.ORG Fri Jun 5 23:27:27 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED849106566B; Fri, 5 Jun 2009 23:27:27 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DC2A18FC0C; Fri, 5 Jun 2009 23:27:27 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n55NRREY041385; Fri, 5 Jun 2009 23:27:27 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n55NRRq4041384; Fri, 5 Jun 2009 23:27:27 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906052327.n55NRRq4041384@svn.freebsd.org> From: Kip Macy Date: Fri, 5 Jun 2009 23:27:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193546 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 05 Jun 2009 23:27:28 -0000 Author: kmacy Date: Fri Jun 5 23:27:27 2009 New Revision: 193546 URL: http://svn.freebsd.org/changeset/base/193546 Log: only pass ci.count if we're doing a a batch transmit Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Fri Jun 5 23:23:24 2009 (r193545) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Fri Jun 5 23:27:27 2009 (r193546) @@ -1555,9 +1555,10 @@ cxgb_start_locked(struct sge_qset *qs) check_pkt_coalesce(qs); count = 1; - if (sc->tunq_coalesce) + if (sc->tunq_coalesce) { m_head = cxgb_dequeue_chain(qs, &ci); - else + count = ci.count; + } else m_head = TXQ_RING_DEQUEUE(qs); if (m_head == NULL) @@ -1566,7 +1567,7 @@ cxgb_start_locked(struct sge_qset *qs) * Encapsulation can modify our pointer, and or make it * NULL on failure. In that event, we can't requeue. */ - if (t3_encap(qs, &m_head, ci.count)) + if (t3_encap(qs, &m_head, count)) break; /* Send a copy of the frame to the BPF listener */ From owner-svn-src-user@FreeBSD.ORG Fri Jun 5 23:59:22 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4AD8A106564A; Fri, 5 Jun 2009 23:59:22 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3877C8FC13; Fri, 5 Jun 2009 23:59:22 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n55NxLgM042155; Fri, 5 Jun 2009 23:59:21 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n55NxLCq042151; Fri, 5 Jun 2009 23:59:21 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906052359.n55NxLCq042151@svn.freebsd.org> From: Kip Macy Date: Fri, 5 Jun 2009 23:59:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193551 - in user/kmacy/releng_7_2_fcs/sys/dev/cxgb: . sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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, 05 Jun 2009 23:59:22 -0000 Author: kmacy Date: Fri Jun 5 23:59:21 2009 New Revision: 193551 URL: http://svn.freebsd.org/changeset/base/193551 Log: - remove count from t3_encap interface - simplify busdma_map_sg_vec Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/mvec.h user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/uipc_mvec.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Fri Jun 5 23:53:17 2009 (r193550) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Fri Jun 5 23:59:21 2009 (r193551) @@ -504,7 +504,6 @@ void t3_sge_stop(adapter_t *); void t3b_intr(void *data); void t3_intr_msi(void *data); void t3_intr_msix(void *data); -int t3_encap(struct sge_qset *, struct mbuf **, int); int t3_sge_init_adapter(adapter_t *); int t3_sge_reset_adapter(adapter_t *); Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Fri Jun 5 23:53:17 2009 (r193550) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Fri Jun 5 23:59:21 2009 (r193551) @@ -1276,8 +1276,8 @@ do { \ #define GET_VTAG(cntrl, m) #endif -int -t3_encap(struct sge_qset *qs, struct mbuf **m, int count) +static int +t3_encap(struct sge_qset *qs, struct mbuf **m) { adapter_t *sc; struct mbuf *m0; @@ -1311,32 +1311,34 @@ t3_encap(struct sge_qset *qs, struct mbu KASSERT(m0->m_flags & M_PKTHDR, ("not packet header\n")); #ifdef VLAN_SUPPORTED - if (count == 1 && m0->m_next != NULL && + if (m0->m_nextpkt == NULL && m0->m_next != NULL && m0->m_pkthdr.csum_flags & (CSUM_TSO)) tso_info = V_LSO_MSS(m0->m_pkthdr.tso_segsz); #endif - if (count > 1) { - busdma_map_sg_vec(m, segs, count); - nsegs = count; + if (m0->m_nextpkt != NULL) { + busdma_map_sg_vec(m0, segs, &nsegs); } else if ((err = busdma_map_sg_collapse(&m0, segs, &nsegs))) { if (cxgb_debug) printf("failed ... err=%d\n", err); return (err); } - KASSERT(m0->m_pkthdr.len, ("empty packet nsegs=%d count=%d", nsegs, count)); + KASSERT(m0->m_pkthdr.len, ("empty packet nsegs=%d", nsegs)); - if ((m0->m_pkthdr.len > PIO_LEN) || (count > 1)) + if ((m0->m_pkthdr.len > PIO_LEN) || (nsegs > 1)) txsd->m = m0; - if (count > 1) { + if (m0->m_nextpkt != NULL) { struct cpl_tx_pkt_batch *cpl_batch = (struct cpl_tx_pkt_batch *)txd; int i, fidx; + if (nsegs > 7) + panic("trying to coalesce %d packets in to one WR", nsegs); + wrp = (struct work_request_hdr *)txd; - flits = count*2 + 1; + flits = nsegs*2 + 1; txq_prod(txq, 1, &txqs); - for (fidx = 1, i = 0; i < count; i++, fidx += 2) { + for (fidx = 1, i = 0; i < nsegs; i++, fidx += 2) { struct cpl_tx_pkt_batch_entry *cbe = &cpl_batch->pkt_entry[i]; cntrl = V_TXPKT_INTF(pi->txpkt_intf); @@ -1537,12 +1539,11 @@ cxgb_start_locked(struct sge_qset *qs) { struct mbuf *m_head = NULL; struct sge_txq *txq = &qs->txq[TXQ_ETH]; - int txmax; + int avail, txmax; int in_use_init = txq->in_use; struct port_info *pi = qs->port; struct adapter *sc = pi->adapter; struct ifnet *ifp = pi->ifp; - int count, avail; struct coalesce_info ci; avail = txq->size - txq->in_use - 4; @@ -1553,11 +1554,9 @@ cxgb_start_locked(struct sge_qset *qs) (!TXQ_RING_EMPTY(qs)) && (ifp->if_drv_flags & IFF_DRV_RUNNING)) { reclaim_completed_tx(qs, (TX_ETH_Q_SIZE>>4), TXQ_ETH); check_pkt_coalesce(qs); - count = 1; if (sc->tunq_coalesce) { m_head = cxgb_dequeue_chain(qs, &ci); - count = ci.count; } else m_head = TXQ_RING_DEQUEUE(qs); @@ -1567,7 +1566,7 @@ cxgb_start_locked(struct sge_qset *qs) * Encapsulation can modify our pointer, and or make it * NULL on failure. In that event, we can't requeue. */ - if (t3_encap(qs, &m_head, count)) + if (t3_encap(qs, &m_head)) break; /* Send a copy of the frame to the BPF listener */ @@ -1576,7 +1575,7 @@ cxgb_start_locked(struct sge_qset *qs) /* * We sent via PIO, no longer need a copy */ - if (count == 1 && m_head->m_pkthdr.len <= PIO_LEN) + if (m_head->m_pkthdr.len <= PIO_LEN) m_freem(m_head); m_head = NULL; @@ -1610,7 +1609,7 @@ cxgb_transmit_locked(struct ifnet *ifp, */ if (sc->tunq_coalesce == 0 && pi->link_config.link_ok && TXQ_RING_EMPTY(qs) && avail > 4) { - if (t3_encap(qs, &m, 1)) { + if (t3_encap(qs, &m)) { if (m != NULL && (error = drbr_enqueue(ifp, br, m)) != 0) return (error); Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/mvec.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/mvec.h Fri Jun 5 23:53:17 2009 (r193550) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/mvec.h Fri Jun 5 23:59:21 2009 (r193551) @@ -50,7 +50,7 @@ busdma_map_mbuf_fast(struct mbuf *m, bus } int busdma_map_sg_collapse(struct mbuf **m, bus_dma_segment_t *segs, int *nsegs); -void busdma_map_sg_vec(struct mbuf **m, bus_dma_segment_t *segs, int count); +void busdma_map_sg_vec(struct mbuf *m, bus_dma_segment_t *segs, int *nsegs); static __inline int busdma_map_sgl(bus_dma_segment_t *vsegs, bus_dma_segment_t *segs, int count) { Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/uipc_mvec.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/uipc_mvec.c Fri Jun 5 23:53:17 2009 (r193550) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/uipc_mvec.c Fri Jun 5 23:59:21 2009 (r193551) @@ -117,13 +117,10 @@ err_out: } void -busdma_map_sg_vec(struct mbuf **m, bus_dma_segment_t *segs, int pkt_count) +busdma_map_sg_vec(struct mbuf *m, bus_dma_segment_t *segs, int *nsegs) { - struct mbuf *m0; - int i; - - for (m0 = *m, i = 0; i < pkt_count; segs++, i++, m0 = m0->m_nextpkt) - busdma_map_mbuf_fast(m0, segs); + for (; m != NULL ; segs++, *nsegs += 1, m = m->m_nextpkt) + busdma_map_mbuf_fast(m, segs); } From owner-svn-src-user@FreeBSD.ORG Sat Jun 6 00:08:20 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0235F106564A; Sat, 6 Jun 2009 00:08:20 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E4E488FC0C; Sat, 6 Jun 2009 00:08:19 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5608JO2042366; Sat, 6 Jun 2009 00:08:19 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5608JZd042365; Sat, 6 Jun 2009 00:08:19 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906060008.n5608JZd042365@svn.freebsd.org> From: Kip Macy Date: Sat, 6 Jun 2009 00:08:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193552 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 06 Jun 2009 00:08:20 -0000 Author: kmacy Date: Sat Jun 6 00:08:19 2009 New Revision: 193552 URL: http://svn.freebsd.org/changeset/base/193552 Log: fix list dequeue stop condition Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Fri Jun 5 23:59:21 2009 (r193551) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sat Jun 6 00:08:19 2009 (r193552) @@ -1503,7 +1503,7 @@ coalesce_check(struct mbuf *m, void *arg if (*nbytes == 0) { *count = 1; return (1); - } else if ((m->m_next != NULL) && (*count > 6)) + } else if ((m->m_next != NULL) || (*count > 6)) return (0); else if (*nbytes + m->m_len <= 10500) { *count += 1; From owner-svn-src-user@FreeBSD.ORG Sat Jun 6 00:26:50 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F9C7106564A; Sat, 6 Jun 2009 00:26:50 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3DBFB8FC0A; Sat, 6 Jun 2009 00:26:50 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n560Qnka042800; Sat, 6 Jun 2009 00:26:49 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n560Qnfx042799; Sat, 6 Jun 2009 00:26:49 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906060026.n560Qnfx042799@svn.freebsd.org> From: Kip Macy Date: Sat, 6 Jun 2009 00:26:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193553 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 06 Jun 2009 00:26:50 -0000 Author: kmacy Date: Sat Jun 6 00:26:49 2009 New Revision: 193553 URL: http://svn.freebsd.org/changeset/base/193553 Log: further simplify coalesce_check Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sat Jun 6 00:08:19 2009 (r193552) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sat Jun 6 00:26:49 2009 (r193553) @@ -1492,7 +1492,6 @@ struct coalesce_info { int nbytes; }; - static int coalesce_check(struct mbuf *m, void *arg) { @@ -1500,17 +1499,12 @@ coalesce_check(struct mbuf *m, void *arg int *count = &ci->count; int *nbytes = &ci->nbytes; - if (*nbytes == 0) { - *count = 1; - return (1); - } else if ((m->m_next != NULL) || (*count > 6)) - return (0); - else if (*nbytes + m->m_len <= 10500) { + if ((*nbytes + m->m_len <= 10500) && (*count < 7) && + (m->m_next == NULL)){ *count += 1; *nbytes += m->m_len; return (1); } - return (0); } @@ -1520,7 +1514,7 @@ cxgb_dequeue_chain(struct sge_qset *qs, struct mbuf *m, *m_head, *m_tail; m_head = m_tail = NULL; - ci->nbytes = 0; + ci->count = ci->nbytes = 0; do { m = TXQ_RING_DEQUEUE_COND(qs, coalesce_check, &ci); if (m_head == NULL) { From owner-svn-src-user@FreeBSD.ORG Sat Jun 6 00:38:15 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF3371065677; Sat, 6 Jun 2009 00:38:15 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DD63A8FC08; Sat, 6 Jun 2009 00:38:15 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n560cFw5043081; Sat, 6 Jun 2009 00:38:15 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n560cFlD043080; Sat, 6 Jun 2009 00:38:15 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906060038.n560cFlD043080@svn.freebsd.org> From: Kip Macy Date: Sat, 6 Jun 2009 00:38:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193555 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 06 Jun 2009 00:38:16 -0000 Author: kmacy Date: Sat Jun 6 00:38:15 2009 New Revision: 193555 URL: http://svn.freebsd.org/changeset/base/193555 Log: initialize nsegs to 0 Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/uipc_mvec.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/uipc_mvec.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/uipc_mvec.c Sat Jun 6 00:32:15 2009 (r193554) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/uipc_mvec.c Sat Jun 6 00:38:15 2009 (r193555) @@ -120,7 +120,7 @@ void busdma_map_sg_vec(struct mbuf *m, bus_dma_segment_t *segs, int *nsegs) { - for (; m != NULL ; segs++, *nsegs += 1, m = m->m_nextpkt) + for (*nsegs = 0; m != NULL ; segs++, *nsegs += 1, m = m->m_nextpkt) busdma_map_mbuf_fast(m, segs); } From owner-svn-src-user@FreeBSD.ORG Sat Jun 6 00:52:26 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 231081065670; Sat, 6 Jun 2009 00:52:26 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 113458FC13; Sat, 6 Jun 2009 00:52:26 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n560qPAO043463; Sat, 6 Jun 2009 00:52:25 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n560qPPB043462; Sat, 6 Jun 2009 00:52:25 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906060052.n560qPPB043462@svn.freebsd.org> From: Kip Macy Date: Sat, 6 Jun 2009 00:52:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193558 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 06 Jun 2009 00:52:26 -0000 Author: kmacy Date: Sat Jun 6 00:52:25 2009 New Revision: 193558 URL: http://svn.freebsd.org/changeset/base/193558 Log: - simplify cxgb_dequeue_chain - add sanity check Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sat Jun 6 00:49:49 2009 (r193557) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sat Jun 6 00:52:25 2009 (r193558) @@ -1509,12 +1509,13 @@ coalesce_check(struct mbuf *m, void *arg } static struct mbuf * -cxgb_dequeue_chain(struct sge_qset *qs, struct coalesce_info *ci) +cxgb_dequeue_chain(struct sge_qset *qs) { struct mbuf *m, *m_head, *m_tail; + struct coalesce_info ci; m_head = m_tail = NULL; - ci->count = ci->nbytes = 0; + ci.count = ci.nbytes = 0; do { m = TXQ_RING_DEQUEUE_COND(qs, coalesce_check, &ci); if (m_head == NULL) { @@ -1524,7 +1525,8 @@ cxgb_dequeue_chain(struct sge_qset *qs, m_tail = m; } } while (m != NULL); - + if (ci.count > 7) + panic("trying to coalesce %d packets in to one WR", ci.count); return (m_head); } @@ -1538,7 +1540,6 @@ cxgb_start_locked(struct sge_qset *qs) struct port_info *pi = qs->port; struct adapter *sc = pi->adapter; struct ifnet *ifp = pi->ifp; - struct coalesce_info ci; avail = txq->size - txq->in_use - 4; txmax = min(TX_START_MAX_DESC, avail); @@ -1550,7 +1551,7 @@ cxgb_start_locked(struct sge_qset *qs) check_pkt_coalesce(qs); if (sc->tunq_coalesce) { - m_head = cxgb_dequeue_chain(qs, &ci); + m_head = cxgb_dequeue_chain(qs); } else m_head = TXQ_RING_DEQUEUE(qs); From owner-svn-src-user@FreeBSD.ORG Sat Jun 6 01:27:42 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EC019106566C; Sat, 6 Jun 2009 01:27:42 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D9DB28FC0C; Sat, 6 Jun 2009 01:27:42 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n561RgeM044230; Sat, 6 Jun 2009 01:27:42 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n561Rg0u044228; Sat, 6 Jun 2009 01:27:42 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906060127.n561Rg0u044228@svn.freebsd.org> From: Kip Macy Date: Sat, 6 Jun 2009 01:27:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193559 - in user/kmacy/releng_7_2_fcs/sys/dev/cxgb: . sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 06 Jun 2009 01:27:43 -0000 Author: kmacy Date: Sat Jun 6 01:27:42 2009 New Revision: 193559 URL: http://svn.freebsd.org/changeset/base/193559 Log: - clear nextpkt on free - simplify coalesce check Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/mvec.h Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sat Jun 6 00:52:25 2009 (r193558) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sat Jun 6 01:27:42 2009 (r193559) @@ -1540,7 +1540,7 @@ cxgb_start_locked(struct sge_qset *qs) struct port_info *pi = qs->port; struct adapter *sc = pi->adapter; struct ifnet *ifp = pi->ifp; - + uint64_t *coal = &sc->tunq_coalesce; avail = txq->size - txq->in_use - 4; txmax = min(TX_START_MAX_DESC, avail); @@ -1550,11 +1550,8 @@ cxgb_start_locked(struct sge_qset *qs) reclaim_completed_tx(qs, (TX_ETH_Q_SIZE>>4), TXQ_ETH); check_pkt_coalesce(qs); - if (sc->tunq_coalesce) { - m_head = cxgb_dequeue_chain(qs); - } else - m_head = TXQ_RING_DEQUEUE(qs); - + m_head = (*coal) ? cxgb_dequeue_chain(qs) : TXQ_RING_DEQUEUE(qs); + if (m_head == NULL) break; /* Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/mvec.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/mvec.h Sat Jun 6 00:52:25 2009 (r193558) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/mvec.h Sat Jun 6 01:27:42 2009 (r193559) @@ -72,6 +72,7 @@ m_freem_list(struct mbuf *m) n = m->m_nextpkt; if (n != NULL) prefetch(n); + m->m_nextpkt = NULL; m_freem(m); m = n; } From owner-svn-src-user@FreeBSD.ORG Sat Jun 6 03:22:43 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A4DD5106564A; Sat, 6 Jun 2009 03:22:43 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 92B9A8FC08; Sat, 6 Jun 2009 03:22:43 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n563Mht9046895; Sat, 6 Jun 2009 03:22:43 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n563MhZB046894; Sat, 6 Jun 2009 03:22:43 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906060322.n563MhZB046894@svn.freebsd.org> From: Kip Macy Date: Sat, 6 Jun 2009 03:22:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193563 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 06 Jun 2009 03:22:43 -0000 Author: kmacy Date: Sat Jun 6 03:22:43 2009 New Revision: 193563 URL: http://svn.freebsd.org/changeset/base/193563 Log: consolidate dequeue functionality and sanity check nextpkt Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sat Jun 6 02:26:23 2009 (r193562) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sat Jun 6 03:22:43 2009 (r193563) @@ -1514,6 +1514,12 @@ cxgb_dequeue_chain(struct sge_qset *qs) struct mbuf *m, *m_head, *m_tail; struct coalesce_info ci; + if (qs->port->adapter->tunq_coalesce) { + m = TXQ_RING_DEQUEUE(qs); + if (m != NULL && m->m_nextpkt != NULL) + panic("dequeued regular packet with nextpkt set!"); + } + m_head = m_tail = NULL; ci.count = ci.nbytes = 0; do { @@ -1523,6 +1529,7 @@ cxgb_dequeue_chain(struct sge_qset *qs) } else if (m != NULL) { m_tail->m_nextpkt = m; m_tail = m; + m->m_nextpkt = NULL; } } while (m != NULL); if (ci.count > 7) @@ -1540,7 +1547,6 @@ cxgb_start_locked(struct sge_qset *qs) struct port_info *pi = qs->port; struct adapter *sc = pi->adapter; struct ifnet *ifp = pi->ifp; - uint64_t *coal = &sc->tunq_coalesce; avail = txq->size - txq->in_use - 4; txmax = min(TX_START_MAX_DESC, avail); @@ -1550,9 +1556,7 @@ cxgb_start_locked(struct sge_qset *qs) reclaim_completed_tx(qs, (TX_ETH_Q_SIZE>>4), TXQ_ETH); check_pkt_coalesce(qs); - m_head = (*coal) ? cxgb_dequeue_chain(qs) : TXQ_RING_DEQUEUE(qs); - - if (m_head == NULL) + if ((m_head = cxgb_dequeue(qs)) == NULL) break; /* * Encapsulation can modify our pointer, and or make it From owner-svn-src-user@FreeBSD.ORG Sat Jun 6 05:16:04 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 976F31065670; Sat, 6 Jun 2009 05:16:04 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7B07F8FC0C; Sat, 6 Jun 2009 05:16:04 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n565G4Gq049168; Sat, 6 Jun 2009 05:16:04 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n565G4tM049166; Sat, 6 Jun 2009 05:16:04 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906060516.n565G4tM049166@svn.freebsd.org> From: Kip Macy Date: Sat, 6 Jun 2009 05:16:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193564 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 06 Jun 2009 05:16:05 -0000 Author: kmacy Date: Sat Jun 6 05:16:04 2009 New Revision: 193564 URL: http://svn.freebsd.org/changeset/base/193564 Log: - add sysctl to force enable tx coalescing - add timeout to handle batching Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Sat Jun 6 03:22:43 2009 (r193563) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Sat Jun 6 05:16:04 2009 (r193564) @@ -239,9 +239,10 @@ struct sge_txq { bus_dmamap_t desc_map; bus_dma_tag_t entry_tag; struct mbuf_head sendq; + struct buf_ring *txq_mr; struct ifaltq *txq_ifq; - + struct callout txq_timer; uint32_t txq_drops; uint32_t txq_skipped; uint32_t txq_coalesced; Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sat Jun 6 03:22:43 2009 (r193563) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sat Jun 6 05:16:04 2009 (r193564) @@ -78,6 +78,12 @@ TUNABLE_INT("hw.cxgb.txq_mr_size", &cxgb SYSCTL_UINT(_hw_cxgb, OID_AUTO, txq_mr_size, CTLFLAG_RDTUN, &cxgb_txq_buf_ring_size, 0, "size of per-queue mbuf ring"); +static int cxgb_pcpu_tx_coalesce_force = 0; +TUNABLE_INT("hw.cxgb.tx_coalesce_force", &cxgb_pcpu_tx_coalesce_force); +SYSCTL_UINT(_hw_cxgb, OID_AUTO, tx_coalesce, CTLFLAG_RW, + &cxgb_pcpu_tx_coalesce_force, 0, + "coalesce small packets into a single work request regardless of ring state"); + /* * XXX don't re-enable this until TOE stops assuming * we have an m_ext @@ -212,6 +218,7 @@ int cxgb_debug = 0; static void sge_timer_cb(void *arg); static void sge_timer_reclaim(void *arg, int ncount); static void sge_txq_reclaim_handler(void *arg, int ncount); +static void cxgb_start_locked(struct sge_qset *qs); static __inline void check_pkt_coalesce(struct sge_qset *qs) @@ -219,11 +226,13 @@ check_pkt_coalesce(struct sge_qset *qs) struct adapter *sc; struct sge_txq *txq; uint8_t *fill; - + txq = &qs->txq[TXQ_ETH]; sc = qs->port->adapter; fill = &sc->tunq_fill[qs->idx]; - + + if (cxgb_pcpu_tx_coalesce_force && (*fill == 0)) + *fill = 1; /* * if the hardware transmit queue is more than 3/4 full * we mark it as coalescing @@ -268,12 +277,11 @@ static __inline int reclaim_completed_tx(struct sge_qset *qs, int reclaim_min, int queue) { struct sge_txq *q = &qs->txq[queue]; - int reclaim = desc_reclaimable(q); if (reclaim < reclaim_min) return (0); - + mtx_assert(&qs->lock, MA_OWNED); if (reclaim > 0) { t3_free_tx_desc(qs, reclaim, queue); @@ -1481,12 +1489,24 @@ t3_encap(struct sge_qset *qs, struct mbu txq_prod(txq, ndesc, &txqs); wr_hi = htonl(V_WR_OP(FW_WROPCODE_TUNNEL_TX_PKT) | txqs.compl); wr_lo = htonl(V_WR_TID(txq->token)); - write_wr_hdr_sgl(ndesc, txd, &txqs, txq, sgl, flits, sgl_flits, wr_hi, wr_lo); + write_wr_hdr_sgl(ndesc, txd, &txqs, txq, sgl, flits, + sgl_flits, wr_hi, wr_lo); check_ring_tx_db(pi->adapter, txq); return (0); } +static void +cxgb_tx_timeout(void *arg) +{ + struct sge_qset *qs = arg; + + if (TXQ_TRYLOCK(qs)) { + cxgb_start_locked(qs); + TXQ_UNLOCK(qs); + } +} + struct coalesce_info { int count; int nbytes; @@ -1509,7 +1529,7 @@ coalesce_check(struct mbuf *m, void *arg } static struct mbuf * -cxgb_dequeue_chain(struct sge_qset *qs) +cxgb_dequeue(struct sge_qset *qs) { struct mbuf *m, *m_head, *m_tail; struct coalesce_info ci; @@ -1545,14 +1565,15 @@ cxgb_start_locked(struct sge_qset *qs) int avail, txmax; int in_use_init = txq->in_use; struct port_info *pi = qs->port; - struct adapter *sc = pi->adapter; struct ifnet *ifp = pi->ifp; avail = txq->size - txq->in_use - 4; txmax = min(TX_START_MAX_DESC, avail); TXQ_LOCK_ASSERT(qs); while ((txq->in_use - in_use_init < txmax) && - (!TXQ_RING_EMPTY(qs)) && (ifp->if_drv_flags & IFF_DRV_RUNNING)) { + (!TXQ_RING_EMPTY(qs)) && + (ifp->if_drv_flags & IFF_DRV_RUNNING) && + pi->link_config.link_ok) { reclaim_completed_tx(qs, (TX_ETH_Q_SIZE>>4), TXQ_ETH); check_pkt_coalesce(qs); @@ -1634,7 +1655,9 @@ cxgb_transmit_locked(struct ifnet *ifp, if (!TXQ_RING_EMPTY(qs) && pi->link_config.link_ok && (!sc->tunq_coalesce || (drbr_inuse(ifp, br) >= 7))) cxgb_start_locked(qs); - + else if (!TXQ_RING_EMPTY(qs) && sc->tunq_coalesce) + callout_reset_on(&txq->txq_timer, 1, cxgb_tx_timeout, + qs, txq->txq_timer.c_cpu); return (0); } @@ -2495,6 +2518,8 @@ t3_sge_alloc_qset(adapter_t *sc, u_int i goto err; } ifq_attach(q->txq[i].txq_ifq, pi->ifp); + callout_init(&q->txq[i].txq_timer, 1); + q->txq[i].txq_timer.c_cpu = id % mp_ncpus; } init_qset_cntxt(q, id); q->idx = id; From owner-svn-src-user@FreeBSD.ORG Sat Jun 6 05:30:35 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3A255106564A; Sat, 6 Jun 2009 05:30:35 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 28A958FC13; Sat, 6 Jun 2009 05:30:35 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n565UZpt049459; Sat, 6 Jun 2009 05:30:35 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n565UZqJ049458; Sat, 6 Jun 2009 05:30:35 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906060530.n565UZqJ049458@svn.freebsd.org> From: Kip Macy Date: Sat, 6 Jun 2009 05:30:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193565 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 06 Jun 2009 05:30:35 -0000 Author: kmacy Date: Sat Jun 6 05:30:34 2009 New Revision: 193565 URL: http://svn.freebsd.org/changeset/base/193565 Log: don't enqueue callout if already pending Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sat Jun 6 05:16:04 2009 (r193564) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sat Jun 6 05:30:34 2009 (r193565) @@ -1655,7 +1655,8 @@ cxgb_transmit_locked(struct ifnet *ifp, if (!TXQ_RING_EMPTY(qs) && pi->link_config.link_ok && (!sc->tunq_coalesce || (drbr_inuse(ifp, br) >= 7))) cxgb_start_locked(qs); - else if (!TXQ_RING_EMPTY(qs) && sc->tunq_coalesce) + else if (!TXQ_RING_EMPTY(qs) && sc->tunq_coalesce && + callout_pending(&txq->txq_timer) == 0) callout_reset_on(&txq->txq_timer, 1, cxgb_tx_timeout, qs, txq->txq_timer.c_cpu); return (0); From owner-svn-src-user@FreeBSD.ORG Sat Jun 6 05:50:28 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 42CC5106566C; Sat, 6 Jun 2009 05:50:28 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3012E8FC08; Sat, 6 Jun 2009 05:50:28 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n565oSVr049875; Sat, 6 Jun 2009 05:50:28 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n565oSII049874; Sat, 6 Jun 2009 05:50:28 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906060550.n565oSII049874@svn.freebsd.org> From: Kip Macy Date: Sat, 6 Jun 2009 05:50:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193566 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 06 Jun 2009 05:50:28 -0000 Author: kmacy Date: Sat Jun 6 05:50:27 2009 New Revision: 193566 URL: http://svn.freebsd.org/changeset/base/193566 Log: move up check coalesce Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sat Jun 6 05:30:34 2009 (r193565) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sat Jun 6 05:50:27 2009 (r193566) @@ -1616,6 +1616,7 @@ cxgb_transmit_locked(struct ifnet *ifp, avail = txq->size - txq->in_use; TXQ_LOCK_ASSERT(qs); reclaim_completed_tx(qs, (TX_ETH_Q_SIZE>>4), TXQ_ETH); + check_pkt_coalesce(qs); /* * We can only do a direct transmit if the following are true: @@ -1631,7 +1632,6 @@ cxgb_transmit_locked(struct ifnet *ifp, (error = drbr_enqueue(ifp, br, m)) != 0) return (error); } else { - check_pkt_coalesce(qs); /* * We've bypassed the buf ring so we need to update * ifp directly From owner-svn-src-user@FreeBSD.ORG Sat Jun 6 06:03:46 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BAF6C106566C; Sat, 6 Jun 2009 06:03:46 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8F1988FC08; Sat, 6 Jun 2009 06:03:46 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5663kd7050174; Sat, 6 Jun 2009 06:03:46 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5663k1V050172; Sat, 6 Jun 2009 06:03:46 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906060603.n5663k1V050172@svn.freebsd.org> From: Kip Macy Date: Sat, 6 Jun 2009 06:03:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193567 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 06 Jun 2009 06:03:47 -0000 Author: kmacy Date: Sat Jun 6 06:03:45 2009 New Revision: 193567 URL: http://svn.freebsd.org/changeset/base/193567 Log: ensure that no tx is in progress Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Sat Jun 6 05:50:27 2009 (r193566) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Sat Jun 6 06:03:45 2009 (r193567) @@ -567,7 +567,6 @@ static inline int offload_running(adapte int cxgb_transmit(struct ifnet *ifp, struct mbuf *m); void cxgb_qflush(struct ifnet *ifp); int process_responses(adapter_t *adap, struct sge_qset *qs, int budget); -void t3_free_qset(adapter_t *sc, struct sge_qset *q); void cxgb_start(struct ifnet *ifp); void refill_fl_service(adapter_t *adap, struct sge_fl *fl); #endif Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sat Jun 6 05:50:27 2009 (r193566) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sat Jun 6 06:03:45 2009 (r193567) @@ -1940,7 +1940,7 @@ t3_mgmt_tx(struct adapter *adap, struct * as HW contexts, packet buffers, and descriptor rings. Traffic to the * queue set must be quiesced prior to calling this. */ -void +static void t3_free_qset(adapter_t *sc, struct sge_qset *q) { int i; @@ -1973,6 +1973,7 @@ t3_free_qset(adapter_t *sc, struct sge_q } } + mtx_unlock(&q->lock); MTX_DESTROY(&q->lock); for (i = 0; i < SGE_TXQ_PER_SET; i++) { if (q->txq[i].desc) { @@ -2024,8 +2025,11 @@ t3_free_sge_resources(adapter_t *sc) for (nqsets = i = 0; i < (sc)->params.nports; i++) nqsets += sc->port[i].nqsets; - for (i = 0; i < nqsets; ++i) + for (i = 0; i < nqsets; ++i) { + TXQ_LOCK(&sc->sge.qs[i]); t3_free_qset(sc, &sc->sge.qs[i]); + } + } /** @@ -2505,6 +2509,9 @@ t3_sge_alloc_qset(adapter_t *sc, u_int i struct sge_qset *q = &sc->sge.qs[id]; int i, ret = 0; + MTX_INIT(&q->lock, q->namebuf, NULL, MTX_DEF); + q->port = pi; + for (i = 0; i < SGE_TXQ_PER_SET; i++) { if ((q->txq[i].txq_mr = buf_ring_alloc(cxgb_txq_buf_ring_size, @@ -2566,8 +2573,6 @@ t3_sge_alloc_qset(adapter_t *sc, u_int i q->txq[i].gen = 1; q->txq[i].size = p->txq_size[i]; } - MTX_INIT(&q->lock, q->namebuf, NULL, MTX_DEF); - q->port = pi; TASK_INIT(&q->txq[TXQ_OFLD].qresume_task, 0, restart_offloadq, q); TASK_INIT(&q->txq[TXQ_CTRL].qresume_task, 0, restart_ctrlq, q); @@ -2687,6 +2692,7 @@ t3_sge_alloc_qset(adapter_t *sc, u_int i err_unlock: mtx_unlock_spin(&sc->sge.reg_lock); err: + TXQ_LOCK(q); t3_free_qset(sc, q); return (ret); From owner-svn-src-user@FreeBSD.ORG Sat Jun 6 06:11:26 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 361C5106566B; Sat, 6 Jun 2009 06:11:26 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 24B188FC18; Sat, 6 Jun 2009 06:11:26 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n566BQwI050354; Sat, 6 Jun 2009 06:11:26 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n566BQvJ050353; Sat, 6 Jun 2009 06:11:26 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906060611.n566BQvJ050353@svn.freebsd.org> From: Kip Macy Date: Sat, 6 Jun 2009 06:11:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193568 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 06 Jun 2009 06:11:26 -0000 Author: kmacy Date: Sat Jun 6 06:11:25 2009 New Revision: 193568 URL: http://svn.freebsd.org/changeset/base/193568 Log: return immediately if forcing coalesce Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sat Jun 6 06:03:45 2009 (r193567) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sat Jun 6 06:11:25 2009 (r193568) @@ -231,8 +231,10 @@ check_pkt_coalesce(struct sge_qset *qs) sc = qs->port->adapter; fill = &sc->tunq_fill[qs->idx]; - if (cxgb_pcpu_tx_coalesce_force && (*fill == 0)) + if (cxgb_pcpu_tx_coalesce_force && (*fill == 0)) { *fill = 1; + return; + } /* * if the hardware transmit queue is more than 3/4 full * we mark it as coalescing From owner-svn-src-user@FreeBSD.ORG Sat Jun 6 06:29:16 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 566C3106566B; Sat, 6 Jun 2009 06:29:16 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 39A4D8FC15; Sat, 6 Jun 2009 06:29:16 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n566TGgX050737; Sat, 6 Jun 2009 06:29:16 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n566TGaO050734; Sat, 6 Jun 2009 06:29:16 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906060629.n566TGaO050734@svn.freebsd.org> From: Kip Macy Date: Sat, 6 Jun 2009 06:29:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193569 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 06 Jun 2009 06:29:16 -0000 Author: kmacy Date: Sat Jun 6 06:29:15 2009 New Revision: 193569 URL: http://svn.freebsd.org/changeset/base/193569 Log: - simplify teardown - remove dead code Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Sat Jun 6 06:11:25 2009 (r193568) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_adapter.h Sat Jun 6 06:29:15 2009 (r193569) @@ -509,9 +509,7 @@ void t3_intr_msix(void *data); int t3_sge_init_adapter(adapter_t *); int t3_sge_reset_adapter(adapter_t *); int t3_sge_init_port(struct port_info *); -void t3_sge_deinit_sw(adapter_t *); void t3_free_tx_desc(struct sge_qset *qs, int n, int qid); -void t3_free_tx_desc_all(struct sge_txq *q); void t3_rx_eth(struct adapter *adap, struct sge_rspq *rq, struct mbuf *m, int ethpad); Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Sat Jun 6 06:11:25 2009 (r193568) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_main.c Sat Jun 6 06:29:15 2009 (r193569) @@ -677,14 +677,14 @@ cxgb_free(struct adapter *sc) sc->msix_regs_res); } - if (sc->flags & FULL_INIT_DONE) + if (sc->flags & FULL_INIT_DONE) { t3_free_sge_resources(sc); - t3_sge_deinit_sw(sc); - + sc->flags &= ~FULL_INIT_DONE; + } /* * Wait for last callout */ - DELAY(hz*100); + DELAY(hz*10000); for (i = 0; i < (sc)->params.nports; ++i) { if (sc->portdev[i] != NULL) Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sat Jun 6 06:11:25 2009 (r193568) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sat Jun 6 06:29:15 2009 (r193569) @@ -907,12 +907,6 @@ t3_sge_init_port(struct port_info *pi) return (0); } -void -t3_sge_deinit_sw(adapter_t *sc) -{ - ; -} - /** * refill_rspq - replenish an SGE response queue * @adapter: the adapter @@ -1932,7 +1926,6 @@ t3_mgmt_tx(struct adapter *adap, struct return ctrl_xmit(adap, &adap->sge.qs[0], m); } - /** * free_qset - free the resources of an SGE queue set * @sc: the controller owning the queue set @@ -1947,8 +1940,7 @@ t3_free_qset(adapter_t *sc, struct sge_q { int i; - t3_free_tx_desc_all(&q->txq[TXQ_ETH]); - + reclaim_completed_tx(q, 0, TXQ_ETH); for (i = 0; i < SGE_TXQ_PER_SET; i++) { if (q->txq[i].txq_mr != NULL) buf_ring_free(q->txq[i].txq_mr, M_DEVBUF); @@ -2139,25 +2131,6 @@ t3_free_tx_desc(struct sge_qset *qs, int } -void -t3_free_tx_desc_all(struct sge_txq *q) -{ - int i; - struct tx_sw_desc *txsd; - - for (i = 0; i < q->size; i++) { - txsd = &q->sdesc[i]; - if (txsd->m != NULL) { - if (txsd->flags & TX_SW_DESC_MAPPED) { - bus_dmamap_unload(q->entry_tag, txsd->map); - txsd->flags &= ~TX_SW_DESC_MAPPED; - } - m_freem_list(txsd->m); - txsd->m = NULL; - } - } -} - /** * is_new_response - check if a response is newly written * @r: the response descriptor From owner-svn-src-user@FreeBSD.ORG Sat Jun 6 06:44:13 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED3061065673; Sat, 6 Jun 2009 06:44:13 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C1A8E8FC1A; Sat, 6 Jun 2009 06:44:13 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n566iDYq051114; Sat, 6 Jun 2009 06:44:13 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n566iDkd051113; Sat, 6 Jun 2009 06:44:13 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906060644.n566iDkd051113@svn.freebsd.org> From: Kip Macy Date: Sat, 6 Jun 2009 06:44:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193570 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 06 Jun 2009 06:44:14 -0000 Author: kmacy Date: Sat Jun 6 06:44:13 2009 New Revision: 193570 URL: http://svn.freebsd.org/changeset/base/193570 Log: - set software descriptor unconditionally and clear as needed - tunq_coalesce is a quad Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sat Jun 6 06:29:15 2009 (r193569) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/cxgb_sge.c Sat Jun 6 06:44:13 2009 (r193570) @@ -1327,9 +1327,7 @@ t3_encap(struct sge_qset *qs, struct mbu return (err); } KASSERT(m0->m_pkthdr.len, ("empty packet nsegs=%d", nsegs)); - - if ((m0->m_pkthdr.len > PIO_LEN) || (nsegs > 1)) - txsd->m = m0; + txsd->m = m0; if (m0->m_nextpkt != NULL) { struct cpl_tx_pkt_batch *cpl_batch = (struct cpl_tx_pkt_batch *)txd; @@ -1337,7 +1335,6 @@ t3_encap(struct sge_qset *qs, struct mbu if (nsegs > 7) panic("trying to coalesce %d packets in to one WR", nsegs); - wrp = (struct work_request_hdr *)txd; flits = nsegs*2 + 1; txq_prod(txq, 1, &txqs); @@ -1429,6 +1426,7 @@ t3_encap(struct sge_qset *qs, struct mbu */ DPRINTF("**5592 Fix** mbuf=%p,len=%d,tso_segsz=%d,csum_flags=%#x,flags=%#x", m0, mlen, m0->m_pkthdr.tso_segsz, m0->m_pkthdr.csum_flags, m0->m_flags); + txsd->m = NULL; txq_prod(txq, 1, &txqs); m_copydata(m0, 0, mlen, (caddr_t)&txd->flit[3]); flits = (mlen + 7) / 8 + 3; @@ -1457,6 +1455,7 @@ t3_encap(struct sge_qset *qs, struct mbu cpl->len = htonl(mlen | 0x80000000); if (mlen <= PIO_LEN) { + txsd->m = NULL; txq_prod(txq, 1, &txqs); m_copydata(m0, 0, mlen, (caddr_t)&txd->flit[2]); flits = (mlen + 7) / 8 + 2; @@ -3430,7 +3429,7 @@ t3_add_attach_sysctls(adapter_t *sc) "enable_debug", CTLFLAG_RW, &cxgb_debug, 0, "enable verbose debugging output"); - SYSCTL_ADD_ULONG(ctx, children, OID_AUTO, "tunq_coalesce", + SYSCTL_ADD_QUAD(ctx, children, OID_AUTO, "tunq_coalesce", CTLFLAG_RD, &sc->tunq_coalesce, "#tunneled packets freed"); SYSCTL_ADD_INT(ctx, children, OID_AUTO, From owner-svn-src-user@FreeBSD.ORG Sat Jun 6 07:29:19 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 98AB0106564A; Sat, 6 Jun 2009 07:29:19 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 875BE8FC16; Sat, 6 Jun 2009 07:29:19 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n567TJfZ052081; Sat, 6 Jun 2009 07:29:19 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n567TJdw052080; Sat, 6 Jun 2009 07:29:19 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906060729.n567TJdw052080@svn.freebsd.org> From: Kip Macy Date: Sat, 6 Jun 2009 07:29:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193573 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 06 Jun 2009 07:29:19 -0000 Author: kmacy Date: Sat Jun 6 07:29:19 2009 New Revision: 193573 URL: http://svn.freebsd.org/changeset/base/193573 Log: sanity check mbufs on free Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/mvec.h Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/mvec.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/mvec.h Sat Jun 6 07:19:49 2009 (r193572) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/mvec.h Sat Jun 6 07:29:19 2009 (r193573) @@ -67,8 +67,16 @@ static __inline void m_freem_list(struct mbuf *m) { struct mbuf *n; +#ifdef INVARIANTS + int i = 0; +#endif while (m != NULL) { +#ifdef INVARIANTS + if (m == (struct mbuf *)0xDEADBEEF) + panic("freed mbuf %d in mbuf list", i); + i++; +#endif n = m->m_nextpkt; if (n != NULL) prefetch(n); From owner-svn-src-user@FreeBSD.ORG Sat Jun 6 22:06:38 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7D349106566B; Sat, 6 Jun 2009 22:06:38 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6BCDA8FC08; Sat, 6 Jun 2009 22:06:38 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n56M6cVm073029; Sat, 6 Jun 2009 22:06:38 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n56M6ciV073026; Sat, 6 Jun 2009 22:06:38 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906062206.n56M6ciV073026@svn.freebsd.org> From: Kip Macy Date: Sat, 6 Jun 2009 22:06:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193595 - user/kmacy/releng_7_2_fcs/sys/net X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 06 Jun 2009 22:06:38 -0000 Author: kmacy Date: Sat Jun 6 22:06:37 2009 New Revision: 193595 URL: http://svn.freebsd.org/changeset/base/193595 Log: ensure that all stale references to the interface are freed before the memory is deallocated Modified: user/kmacy/releng_7_2_fcs/sys/net/flowtable.c user/kmacy/releng_7_2_fcs/sys/net/flowtable.h user/kmacy/releng_7_2_fcs/sys/net/if.c Modified: user/kmacy/releng_7_2_fcs/sys/net/flowtable.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/net/flowtable.c Sat Jun 6 21:23:29 2009 (r193594) +++ user/kmacy/releng_7_2_fcs/sys/net/flowtable.c Sat Jun 6 22:06:37 2009 (r193595) @@ -36,7 +36,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include #include @@ -170,6 +172,10 @@ static uint32_t hashjitter; static uma_zone_t ipv4_zone; static uma_zone_t ipv6_zone; +static struct cv flowclean_cv; +static struct mtx flowclean_lock; +static uint64_t flowclean_cycles; + /* * TODO: * - Make flowtable stats per-cpu, aggregated at sysctl call time, @@ -774,6 +780,8 @@ flowtable_setup(void *arg) NULL, NULL, NULL, 64, UMA_ZONE_MAXBUCKET); uma_zone_set_max(ipv4_zone, nmbflows); uma_zone_set_max(ipv6_zone, nmbflows); + cv_init(&flowclean_cv, "flowcleanwait"); + mtx_init(&flowclean_lock, "flowclean lock", NULL, MTX_DEF); } SYSINIT(flowtable_setup, SI_SUB_KTHREAD_INIT, SI_ORDER_ANY, flowtable_setup, NULL); @@ -915,12 +923,30 @@ flowtable_cleaner(void) } ft = ft->ft_next; } + flowclean_cycles++; /* * The 20 second interval between cleaning checks * is arbitrary */ - pause("flowcleanwait", 20*hz); + mtx_lock(&flowclean_lock); + cv_broadcast(&flowclean_cv); + cv_timedwait(&flowclean_cv, &flowclean_lock, 10*hz); + mtx_unlock(&flowclean_lock); + } +} + +void +flowtable_flush(void) +{ + uint64_t start; + + mtx_lock(&flowclean_lock); + start = flowclean_cycles; + while (start == flowclean_cycles) { + cv_broadcast(&flowclean_cv); + cv_wait(&flowclean_cv, &flowclean_lock); } + mtx_unlock(&flowclean_lock); } static struct kproc_desc flow_kp = { Modified: user/kmacy/releng_7_2_fcs/sys/net/flowtable.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/net/flowtable.h Sat Jun 6 21:23:29 2009 (r193594) +++ user/kmacy/releng_7_2_fcs/sys/net/flowtable.h Sat Jun 6 22:06:37 2009 (r193595) @@ -56,6 +56,8 @@ struct flowtable *flowtable_alloc(int ne int flowtable_lookup(struct flowtable *ft, struct mbuf *m, struct route *ro); +void flowtable_flush(void); + #else static __inline struct flowtable * flowtable_alloc(int nentry, int flags) @@ -71,6 +73,13 @@ flowtable_lookup(struct flowtable *ft, s return (ENOTSUP); } + +static __inlnie void +flowtable_flush(void) +{ + ; +} + #endif #endif Modified: user/kmacy/releng_7_2_fcs/sys/net/if.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/net/if.c Sat Jun 6 21:23:29 2009 (r193594) +++ user/kmacy/releng_7_2_fcs/sys/net/if.c Sat Jun 6 22:06:37 2009 (r193595) @@ -71,6 +71,7 @@ #include #include #include +#include #include #if defined(INET) || defined(INET6) @@ -499,7 +500,7 @@ if_alloc(u_char type) void if_free(struct ifnet *ifp) { - + flowtable_flush(); if_free_type(ifp, ifp->if_type); } From owner-svn-src-user@FreeBSD.ORG Sat Jun 6 22:20:42 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41CEF1065686; Sat, 6 Jun 2009 22:20:42 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2FF5C8FC1F; Sat, 6 Jun 2009 22:20:42 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n56MKgp5073359; Sat, 6 Jun 2009 22:20:42 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n56MKgP8073358; Sat, 6 Jun 2009 22:20:42 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906062220.n56MKgP8073358@svn.freebsd.org> From: Kip Macy Date: Sat, 6 Jun 2009 22:20:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193597 - user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 06 Jun 2009 22:20:42 -0000 Author: kmacy Date: Sat Jun 6 22:20:41 2009 New Revision: 193597 URL: http://svn.freebsd.org/changeset/base/193597 Log: fix assert check Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/mvec.h Modified: user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/mvec.h ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/mvec.h Sat Jun 6 22:15:15 2009 (r193596) +++ user/kmacy/releng_7_2_fcs/sys/dev/cxgb/sys/mvec.h Sat Jun 6 22:20:41 2009 (r193597) @@ -73,7 +73,8 @@ m_freem_list(struct mbuf *m) while (m != NULL) { #ifdef INVARIANTS - if (m == (struct mbuf *)0xDEADBEEF) + if ((m == (struct mbuf *)0xDEADCODE) || + m == (struct mbuf *)0xdeadc0dedeadc0de) panic("freed mbuf %d in mbuf list", i); i++; #endif