ifnet: introduce event handlers for ifup/ifdown events
Hyper-V's NIC SR-IOV implementation needs a Hyper-V synthetic NIC and a VF NIC to work together, mainly to support seamless live migration. When the VF device becomes UP (or DOWN), the synthetic NIC driver needs to switch the data path from the synthetic NIC to the VF (or the opposite). So the synthetic NIC driver needs to know when a VF device is becoming UP or DOWN and hence the patch is made. Reviewed by: sephe Approved by: sephe (mentor) MFC after: 2 weeks Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8963
This commit is contained in:
parent
c927d68136
commit
92a6859b91
@ -59,6 +59,7 @@
|
||||
#include <sys/domain.h>
|
||||
#include <sys/jail.h>
|
||||
#include <sys/priv.h>
|
||||
#include <sys/eventhandler.h>
|
||||
|
||||
#include <machine/stdarg.h>
|
||||
#include <vm/uma.h>
|
||||
@ -2218,6 +2219,7 @@ void
|
||||
if_down(struct ifnet *ifp)
|
||||
{
|
||||
|
||||
EVENTHANDLER_INVOKE(ifnet_event, ifp, IFNET_EVENT_DOWN);
|
||||
if_unroute(ifp, IFF_UP, AF_UNSPEC);
|
||||
}
|
||||
|
||||
@ -2230,6 +2232,7 @@ if_up(struct ifnet *ifp)
|
||||
{
|
||||
|
||||
if_route(ifp, IFF_UP, AF_UNSPEC);
|
||||
EVENTHANDLER_INVOKE(ifnet_event, ifp, IFNET_EVENT_UP);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -284,4 +284,11 @@ typedef void (*swapoff_fn)(void *, struct swdevt *);
|
||||
EVENTHANDLER_DECLARE(swapon, swapon_fn);
|
||||
EVENTHANDLER_DECLARE(swapoff, swapoff_fn);
|
||||
|
||||
/* ifup/ifdown events */
|
||||
#define IFNET_EVENT_UP 0
|
||||
#define IFNET_EVENT_DOWN 1
|
||||
struct ifnet;
|
||||
typedef void (*ifnet_event_fn)(void *, struct ifnet *ifp, int event);
|
||||
EVENTHANDLER_DECLARE(ifnet_event, ifnet_event_fn);
|
||||
|
||||
#endif /* _SYS_EVENTHANDLER_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user