From owner-svn-src-all@FreeBSD.ORG Thu Apr 16 23:05:10 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A1559106564A; Thu, 16 Apr 2009 23:05: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 7539C8FC16; Thu, 16 Apr 2009 23:05: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 n3GN5A9n094896; Thu, 16 Apr 2009 23:05:10 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3GN5ADI094894; Thu, 16 Apr 2009 23:05:10 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200904162305.n3GN5ADI094894@svn.freebsd.org> From: Kip Macy Date: Thu, 16 Apr 2009 23:05:10 +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: r191161 - 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: Thu, 16 Apr 2009 23:05:11 -0000 Author: kmacy Date: Thu Apr 16 23:05:10 2009 New Revision: 191161 URL: http://svn.freebsd.org/changeset/base/191161 Log: export if_qflush for use by driver if_qflush routines only set ifp->if_{transmit, qflush} if not already set KASSERT that neither or both are set Modified: head/sys/net/if.c head/sys/net/if_var.h Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Thu Apr 16 23:02:56 2009 (r191160) +++ head/sys/net/if.c Thu Apr 16 23:05:10 2009 (r191161) @@ -128,7 +128,6 @@ static void if_freemulti(struct ifmultia static void if_grow(void); static void if_init(void *); static void if_check(void *); -static void if_qflush(struct ifnet *); static void if_route(struct ifnet *, int flag, int fam); static int if_setflag(struct ifnet *, int, int, int *, int); static void if_slowtimo(void *); @@ -613,8 +612,15 @@ if_attach(struct ifnet *ifp) getmicrotime(&ifp->if_lastchange); ifp->if_data.ifi_epoch = time_uptime; ifp->if_data.ifi_datalen = sizeof(struct if_data); - ifp->if_transmit = if_transmit; - ifp->if_qflush = if_qflush; + KASSERT((ifp->if_transmit == NULL && ifp->if_qflush == NULL) || + (ifp->if_transmit != NULL && ifp->if_qflush != NULL), + ("transmit and qflush must both either be set or both be NULL")); + + if (ifp->if_transmit == NULL) { + ifp->if_transmit = if_transmit; + ifp->if_qflush = if_qflush; + } + #ifdef MAC mac_ifnet_init(ifp); mac_ifnet_create(ifp); @@ -1510,9 +1516,7 @@ if_unroute(struct ifnet *ifp, int flag, if (fam == PF_UNSPEC || (fam == ifa->ifa_addr->sa_family)) pfctlinput(PRC_IFDOWN, ifa->ifa_addr); ifp->if_qflush(ifp); - if (ifp->if_snd.ifq_head != NULL) - if_qflush(ifp); - + #ifdef DEV_CARP if (ifp->if_carp) carp_carpdev_state(ifp->if_carp); @@ -1641,7 +1645,7 @@ if_up(struct ifnet *ifp) /* * Flush an interface queue. */ -static void +void if_qflush(struct ifnet *ifp) { struct mbuf *m, *n; Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Thu Apr 16 23:02:56 2009 (r191160) +++ head/sys/net/if_var.h Thu Apr 16 23:05:10 2009 (r191161) @@ -757,6 +757,7 @@ void if_free_type(struct ifnet *, u_char void if_initname(struct ifnet *, const char *, int); void if_link_state_change(struct ifnet *, int); int if_printf(struct ifnet *, const char *, ...) __printflike(2, 3); +void if_qflush(struct ifnet *); int if_setlladdr(struct ifnet *, const u_char *, int); void if_up(struct ifnet *); /*void ifinit(void);*/ /* declared in systm.h for main() */