From owner-svn-src-all@FreeBSD.ORG Fri Jun 29 15:21:35 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A28A41065670; Fri, 29 Jun 2012 15:21:35 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 74F108FC0A; Fri, 29 Jun 2012 15:21:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5TFLZRv053269; Fri, 29 Jun 2012 15:21:35 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5TFLZe8053266; Fri, 29 Jun 2012 15:21:35 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201206291521.q5TFLZe8053266@svn.freebsd.org> From: John Baldwin Date: Fri, 29 Jun 2012 15:21:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237787 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 15:21:35 -0000 Author: jhb Date: Fri Jun 29 15:21:34 2012 New Revision: 237787 URL: http://svn.freebsd.org/changeset/base/237787 Log: Hold GIF_LOCK() for almost all of gif_start(). It is required to be held across in_gif_output() and in6_gif_output() anyway, and once it is held across those it might as well be held for the entire loop. This simplifies the code and removes the need for the custom IFF_GIF_WANTED flag (which belonged in the softc and not as an IFF_* flag anyway). Tested by: Vincent Hoffman vince unsane co uk Modified: head/sys/net/if.h head/sys/net/if_gif.c Modified: head/sys/net/if.h ============================================================================== --- head/sys/net/if.h Fri Jun 29 15:10:54 2012 (r237786) +++ head/sys/net/if.h Fri Jun 29 15:21:34 2012 (r237787) @@ -153,7 +153,6 @@ struct if_data { #define IFF_STATICARP 0x80000 /* (n) static ARP */ #define IFF_DYING 0x200000 /* (n) interface is winding down */ #define IFF_RENAMING 0x400000 /* (n) interface is being renamed */ -#define IFF_GIF_WANTED 0x1000000 /* (n) The gif tunnel is wanted */ /* * Old names for driver flags so that user space tools can continue to use * the old (portable) names. Modified: head/sys/net/if_gif.c ============================================================================== --- head/sys/net/if_gif.c Fri Jun 29 15:10:54 2012 (r237786) +++ head/sys/net/if_gif.c Fri Jun 29 15:21:34 2012 (r237787) @@ -359,15 +359,7 @@ gif_start(struct ifnet *ifp) sc = ifp->if_softc; GIF_LOCK(sc); - if (ifp->if_drv_flags & IFF_DRV_OACTIVE) { - /* Already active */ - ifp->if_drv_flags |= IFF_GIF_WANTED; - GIF_UNLOCK(sc); - return; - } ifp->if_drv_flags |= IFF_DRV_OACTIVE; - GIF_UNLOCK(sc); -keep_going: while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { IFQ_DRV_DEQUEUE(&ifp->if_snd, m); @@ -424,16 +416,6 @@ keep_going: ifp->if_oerrors++; } - GIF_LOCK(sc); - if (ifp->if_drv_flags & IFF_GIF_WANTED) { - /* Someone did a start while - * we were unlocked and processing - * lets clear the flag and try again. - */ - ifp->if_drv_flags &= ~IFF_GIF_WANTED; - GIF_UNLOCK(sc); - goto keep_going; - } ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; GIF_UNLOCK(sc); return;