Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Apr 2009 23:05:10 +0000 (UTC)
From:      Kip Macy <kmacy@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r191161 - head/sys/net
Message-ID:  <200904162305.n3GN5ADI094894@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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() */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200904162305.n3GN5ADI094894>