From owner-freebsd-current@FreeBSD.ORG Wed Nov 3 18:34:04 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 46B4E16A4CE for ; Wed, 3 Nov 2004 18:34:04 +0000 (GMT) Received: from a80-126-165-168.adsl.xs4all.nl (a80-126-165-168.adsl.xs4all.nl [80.126.165.168]) by mx1.FreeBSD.org (Postfix) with ESMTP id 434BB43D3F for ; Wed, 3 Nov 2004 18:34:03 +0000 (GMT) (envelope-from devet@devet.org) Received: from adv.devet.org (adv.devet.org [192.168.1.2]) by a80-126-165-168.adsl.xs4all.nl (Postfix) with ESMTP id B60EFA942; Wed, 3 Nov 2004 19:34:01 +0100 (CET) Received: by adv.devet.org (Postfix, from userid 100) id 65093253EA; Wed, 3 Nov 2004 19:28:06 +0100 (CET) Date: Wed, 3 Nov 2004 19:28:06 +0100 To: peadar.edwards@gmail.com Message-ID: <20041103182806.GA1040@adv.devet.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <34cb7c8404110209563fc01498@mail.gmail.com> X-Newsgroups: list.freebsd.current Organization: Eindhoven, the Netherlands User-Agent: Mutt/1.5.6i From: devet@devet.org (Arjan de Vet) cc: current@freebsd.org Subject: Re: if_sk patch to get more info from people with problems X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Nov 2004 18:34:04 -0000 In article <34cb7c8404110209563fc01498@mail.gmail.com> you write: >Ok, I don't have this hardware, but dumb question: > >A (very) quick look at the source reveals that buffers are allocated >via sk_rxeof()->sk_newbuf()->sk_jalloc() in the interrupt receive >function, with the softc lock held in sk_rxeof(). > >They're freed by the mbuf system via a call to sk_jfree(), but that >doesn't hold the SK_LOCK. Is this possibly the source of the >corruption problems? What am I missing? >This compiles, anyway :-) > >--- /tmp/if_sk.c Tue Nov 2 17:49:26 2004 >+++ if_sk.c Tue Nov 2 17:52:20 2004 >@@ -1115,12 +1115,14 @@ > if ((i < 0) || (i >= SK_JSLOTS)) > panic("sk_jfree: asked to free buffer that we don't manage!"); > >+ SK_LOCK(sc_if->sk_softc); > entry = SLIST_FIRST(&sc_if->sk_jinuse_listhead); > if (entry == NULL) > panic("sk_jfree: buffer not in use!"); > entry->slot = i; > SLIST_REMOVE_HEAD(&sc_if->sk_jinuse_listhead, jpool_entries); > SLIST_INSERT_HEAD(&sc_if->sk_jfree_listhead, entry, jpool_entries); >+ SK_UNLOCK(sc_if->sk_softc); > > return; > } Thank you very much! This patch seems to fix the network corruption problems I have reported in kern/73038. I'll do some more testing, because sometimes the problems only appear after some time. But for now, I can use if_sk.c without debug.mpsafenet="0" on 5.3-RC2. Arjan -- Arjan de Vet, Eindhoven, The Netherlands URL : http://www.devet.org/ Work: http://www.madison-gurkha.com/ (Security, Open Source, Education)