You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/04/16 17:47:06 UTC

[incubator-nuttx] 03/04: netdev/carrier: monitor the driver status

This is an automated email from the ASF dual-hosted git repository.

gnutt pushed a commit to branch pr807
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit f6cbda424a32254f847cb6b9ee87415b8f9cb8a6
Author: chao.an <an...@xiaomi.com>
AuthorDate: Mon Apr 13 21:36:14 2020 +0800

    netdev/carrier: monitor the driver status
    
    Change-Id: Ieae06eae724ad4d5894e725c56a5bd493d2849fe
    Signed-off-by: chao.an <an...@xiaomi.com>
---
 net/netdev/netdev_carrier.c | 3 +++
 net/netdev/netdev_ioctl.c   | 9 +++++++++
 2 files changed, 12 insertions(+)

diff --git a/net/netdev/netdev_carrier.c b/net/netdev/netdev_carrier.c
index ffccd8a..1c882f5 100644
--- a/net/netdev/netdev_carrier.c
+++ b/net/netdev/netdev_carrier.c
@@ -51,6 +51,7 @@
 #include <nuttx/net/netdev.h>
 
 #include "netdev/netdev.h"
+#include "netlink/netlink.h"
 
 /****************************************************************************
  * Public Functions
@@ -76,6 +77,7 @@ int netdev_carrier_on(FAR struct net_driver_s *dev)
   if (dev)
     {
       dev->d_flags |= IFF_RUNNING;
+      netlink_device_notify(dev);
       return OK;
     }
 
@@ -102,6 +104,7 @@ int netdev_carrier_off(FAR struct net_driver_s *dev)
   if (dev)
     {
       dev->d_flags &= ~IFF_RUNNING;
+      netlink_device_notify(dev);
       return OK;
     }
 
diff --git a/net/netdev/netdev_ioctl.c b/net/netdev/netdev_ioctl.c
index f18980c..bf1ea5e 100644
--- a/net/netdev/netdev_ioctl.c
+++ b/net/netdev/netdev_ioctl.c
@@ -89,6 +89,7 @@
 #include "igmp/igmp.h"
 #include "icmpv6/icmpv6.h"
 #include "route/route.h"
+#include "netlink/netlink.h"
 
 /****************************************************************************
  * Pre-processor Definitions
@@ -1761,6 +1762,10 @@ void netdev_ifup(FAR struct net_driver_s *dev)
               /* Mark the interface as 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 */
 
               dev->d_flags &= ~IFF_UP;
+
+              /* Update the driver status */
+
+              netlink_device_notify(dev);
             }
         }