Date: Fri, 29 Jun 2012 15:21:35 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r237787 - head/sys/net Message-ID: <201206291521.q5TFLZe8053266@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206291521.q5TFLZe8053266>