From owner-freebsd-stable@FreeBSD.ORG Wed Jan 5 20:32:56 2005 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8666816A4CE for ; Wed, 5 Jan 2005 20:32:56 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.196]) by mx1.FreeBSD.org (Postfix) with ESMTP id 125A743D48 for ; Wed, 5 Jan 2005 20:32:56 +0000 (GMT) (envelope-from jsimola@gmail.com) Received: by wproxy.gmail.com with SMTP id 58so198027wri for ; Wed, 05 Jan 2005 12:32:55 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding; b=NZneoabFFjTnuybj4wLI3oI8+8lOLe7T9Lyf+j9QUFikxYIfKt7kh8P8YGn3j8q4pPc7gl5aDhRchoaMXIjrQVzlIO0/DlSfGojrikj5vpcYReQAKUv1IdTaMYi4MhD/jP61Mu5/EgD/mWNgiATevKzJ/3diP47CVFAaDQbI8qY= Received: by 10.54.53.9 with SMTP id b9mr5908wra; Wed, 05 Jan 2005 12:32:55 -0800 (PST) Received: by 10.54.39.34 with HTTP; Wed, 5 Jan 2005 12:32:55 -0800 (PST) Message-ID: <8eea040805010512321bf5b953@mail.gmail.com> Date: Wed, 5 Jan 2005 12:32:55 -0800 From: Jon Simola To: freebsd-stable@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: ALTQ patch for if_vlan.c X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: jon@abccomm.com List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jan 2005 20:32:56 -0000 I just whipped up this against 5.3-STABLE #1: Wed Dec 22 17:11:02 PST 2004 Would someone who knows a bit more about this than myself give it a quick lookover and see if it appears sane? I'm mostly wondering about the splimp() and splx() and whether it's required or excessive due to the mtx_lock/unlock in the VLAN_LOCK/UNLOCK macros. Due to a lack of equipment it's difficult for me to run a seperate test environment, so any sort of review would be appreciated. --- sys/net/if_vlan.c.orig Wed Jan 5 12:25:19 2005 +++ sys/net/if_vlan.c Wed Jan 5 12:53:45 2005 @@ -379,7 +379,10 @@ ifp->if_init = vlan_ifinit; ifp->if_start = vlan_start; ifp->if_ioctl = vlan_ioctl; - ifp->if_snd.ifq_maxlen = ifqmaxlen; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = 0; + IFQ_SET_READY(&ifp->if_snd); + ether_ifattach(ifp, ifv->ifv_ac.ac_enaddr); /* Now undo some of the damage... */ ifp->if_baudrate = 0; @@ -423,11 +426,15 @@ { int unit; struct ifvlan *ifv = ifp->if_softc; + int s; unit = ifp->if_dunit; VLAN_LOCK(); LIST_REMOVE(ifv, ifv_list); + s = splimp(); + IFQ_PURGE(&ifp->if_snd); + splx(s); vlan_unconfig(ifp); VLAN_UNLOCK(); @@ -458,12 +465,22 @@ struct mbuf *m; int error; + if (ALTQ_IS_ENABLED(&ifp->if_snd)) { + IFQ_LOCK(&ifp->if_snd); + IFQ_POLL_NOLOCK(&ifp->if_snd, m); + if (m == NULL ) { + IFQ_UNLOCK(&ifp->if_snd); + return; + } + IFQ_UNLOCK(&ifp->if_snd); + } + ifv = ifp->if_softc; p = ifv->ifv_p; ifp->if_flags |= IFF_OACTIVE; for (;;) { - IF_DEQUEUE(&ifp->if_snd, m); + IFQ_DEQUEUE(&ifp->if_snd, m); if (m == 0) break; BPF_MTAP(ifp, m);