Module: xenomai-3
Branch: next
Commit: aab83672cd4f9e4549af407fd49bc8db1540d4e4
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=aab83672cd4f9e4549af407fd49bc8db1540d4e4

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Sat Oct 31 21:33:18 2015 +0100

drivers/rtnet: refuse to uselessly queue packets

If network interface is not running.

---

 kernel/drivers/net/stack/rtdev.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/kernel/drivers/net/stack/rtdev.c b/kernel/drivers/net/stack/rtdev.c
index 29d79c6..f7e1f41 100644
--- a/kernel/drivers/net/stack/rtdev.c
+++ b/kernel/drivers/net/stack/rtdev.c
@@ -33,6 +33,7 @@
 #include <rtskb.h>
 #include <ethernet/eth.h>
 #include <rtmac/rtmac_disc.h>
+#include <rtnet_port.h>
 
 
 static unsigned int device_rtskbs = DEFAULT_DEVICE_RTSKBS;
@@ -705,6 +706,12 @@ int rtdev_xmit(struct rtskb *rtskb)
 
     rtdev = rtskb->rtdev;
 
+    if (!rtnetif_carrier_ok(rtdev)) {
+       err = -EAGAIN;
+       kfree_rtskb(rtskb);
+       return err;
+    }
+
     if (rtskb_acquire(rtskb, &rtdev->dev_pool) != 0) {
        err = -ENOBUFS;
        kfree_rtskb(rtskb);


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://xenomai.org/mailman/listinfo/xenomai-git

Reply via email to