mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 22:41:07 +08:00
netdev/carrier: monitor the driver status
This commit is contained in:
@@ -51,6 +51,7 @@
|
|||||||
#include <nuttx/net/netdev.h>
|
#include <nuttx/net/netdev.h>
|
||||||
|
|
||||||
#include "netdev/netdev.h"
|
#include "netdev/netdev.h"
|
||||||
|
#include "netlink/netlink.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
@@ -76,6 +77,7 @@ int netdev_carrier_on(FAR struct net_driver_s *dev)
|
|||||||
if (dev)
|
if (dev)
|
||||||
{
|
{
|
||||||
dev->d_flags |= IFF_RUNNING;
|
dev->d_flags |= IFF_RUNNING;
|
||||||
|
netlink_device_notify(dev);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,6 +104,7 @@ int netdev_carrier_off(FAR struct net_driver_s *dev)
|
|||||||
if (dev)
|
if (dev)
|
||||||
{
|
{
|
||||||
dev->d_flags &= ~IFF_RUNNING;
|
dev->d_flags &= ~IFF_RUNNING;
|
||||||
|
netlink_device_notify(dev);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -89,6 +89,7 @@
|
|||||||
#include "igmp/igmp.h"
|
#include "igmp/igmp.h"
|
||||||
#include "icmpv6/icmpv6.h"
|
#include "icmpv6/icmpv6.h"
|
||||||
#include "route/route.h"
|
#include "route/route.h"
|
||||||
|
#include "netlink/netlink.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
@@ -1761,6 +1762,10 @@ void netdev_ifup(FAR struct net_driver_s *dev)
|
|||||||
/* Mark the interface as up */
|
/* Mark the interface as up */
|
||||||
|
|
||||||
dev->d_flags |= IFF_UP;
|
dev->d_flags |= IFF_UP;
|
||||||
|
|
||||||
|
/* Update the driver status */
|
||||||
|
|
||||||
|
netlink_device_notify(dev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1783,6 +1788,10 @@ void netdev_ifdown(FAR struct net_driver_s *dev)
|
|||||||
/* Mark the interface as down */
|
/* Mark the interface as down */
|
||||||
|
|
||||||
dev->d_flags &= ~IFF_UP;
|
dev->d_flags &= ~IFF_UP;
|
||||||
|
|
||||||
|
/* Update the driver status */
|
||||||
|
|
||||||
|
netlink_device_notify(dev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user