ifnet API: Change if_init() to take context argument

Some drivers, like iflib drivers, take a 'context' argument instead of a
ifnet argument, as a single interface may have multiple contexts.
Follow this scheme by passing the context argument down.  Most drivers
will likely pass 'ifp' as the context.

Reviewed by:	glebius
Sponsored by:	Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D38102
This commit is contained in:
Justin Hibbits 2023-01-12 13:33:30 -05:00
parent 2e6a8c1ae3
commit fa25dbfd98
2 changed files with 3 additions and 3 deletions

View File

@ -4622,9 +4622,9 @@ if_vlantrunkinuse(if_t ifp)
}
int
if_init(if_t ifp)
if_init(if_t ifp, void *ctx)
{
(*((struct ifnet *)ifp)->if_init)((struct ifnet *)ifp);
(*((struct ifnet *)ifp)->if_init)(ctx);
return (0);
}

View File

@ -784,7 +784,7 @@ void if_bpfmtap(if_t ifp, struct mbuf *m);
void if_etherbpfmtap(if_t ifp, struct mbuf *m);
void if_vlancap(if_t ifp);
int if_transmit(if_t ifp, struct mbuf *m);
int if_init(if_t ifp);
int if_init(if_t ifp, void *ctx);
/*
* Traversing through interface address lists.