arch/sim: calling txdone callback after devif_loopback in netdriver
When devif_loopback handles a packet (like a ping targeting at this dev), it does not call the txdone callback, breaking the tx pipeline and may left some packets unhandled, delayed until next transmit on the network interface.
#include "up_internal.h"
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+static void netdriver_txdone_interrupt(void *priv);
+
/****************************************************************************
* Private Data
****************************************************************************/
@@ -290,6 +296,17 @@ static int netdriver_txpoll(struct net_driver_s *dev)
netdev_send(devidx, dev->d_buf, dev->d_len);
NETDEV_TXDONE(dev);
}
+ else
+ {
+ /* Calling txdone callback after loopback. NETDEV_TXDONE macro is
+ * already called in devif_loopback.
+ *
+ * TODO: Maybe a unified interface with txdone callback registered
+ * is needed, then we can let devif_loopback call this callback.
+ */
+
+ netdriver_txdone_interrupt(dev);
+ }
}
/* If zero is returned, the polling will continue until all connections
