ethernet: Add ethernet interface attached event and devctl notification.
ifnet_arrival_event may not be adequate under certain situation; e.g. when the LLADDR is needed. So the ethernet ifattach event is announced after all necessary bits are setup. MFC after: 3 days Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11617
This commit is contained in:
parent
810490a0e2
commit
8819ad852f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=321406
@ -406,6 +406,12 @@ void ether_vlan_mtap(struct bpf_if *, struct mbuf *,
|
||||
void *, u_int);
|
||||
struct mbuf *ether_vlanencap(struct mbuf *, uint16_t);
|
||||
|
||||
#ifdef _SYS_EVENTHANDLER_H_
|
||||
/* new ethernet interface attached event */
|
||||
typedef void (*ether_ifattach_event_handler_t)(void *, struct ifnet *);
|
||||
EVENTHANDLER_DECLARE(ether_ifattach_event, ether_ifattach_event_handler_t);
|
||||
#endif
|
||||
|
||||
#else /* _KERNEL */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
@ -38,6 +38,8 @@
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/eventhandler.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/malloc.h>
|
||||
@ -931,6 +933,11 @@ ether_ifattach(struct ifnet *ifp, const u_int8_t *lla)
|
||||
if_printf(ifp, "Ethernet address: %6D\n", lla, ":");
|
||||
|
||||
uuid_ether_add(LLADDR(sdl));
|
||||
|
||||
/* Add necessary bits are setup; announce it now. */
|
||||
EVENTHANDLER_INVOKE(ether_ifattach_event, ifp);
|
||||
if (IS_DEFAULT_VNET(curvnet))
|
||||
devctl_notify("ETHERNET", ifp->if_xname, "IFATTACH", NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user