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
This commit is contained in:
parent
ab25fa3558
commit
7cc5b47fb3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=191161
18
sys/net/if.c
18
sys/net/if.c
@ -128,7 +128,6 @@ static void if_freemulti(struct ifmultiaddr *);
|
||||
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, int fam)
|
||||
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;
|
||||
|
@ -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() */
|
||||
|
Loading…
Reference in New Issue
Block a user