From 3d4ce55ebd4eec29ac53fc68873318581f87b05a Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 24 Oct 2016 15:25:40 -0600 Subject: [PATCH] Oops.. a couple of hunks failed in the last patch. Hope I got them fixed correctly. --- arch/xtensa/src/esp32/esp32_clockconfig.c | 4 ++- drivers/net/tun.c | 40 ++++++++++++++--------- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/arch/xtensa/src/esp32/esp32_clockconfig.c b/arch/xtensa/src/esp32/esp32_clockconfig.c index 73abcac8e29..2da4e0b4dec 100644 --- a/arch/xtensa/src/esp32/esp32_clockconfig.c +++ b/arch/xtensa/src/esp32/esp32_clockconfig.c @@ -72,7 +72,9 @@ enum xtal_freq_e void esp32_clockconfig(void) { -#ifndef CONFIG_SUPPRESS_CLOCK_CONFIG +#ifdef CONFIG_SUPPRESS_CLOCK_CONFIG +# warning WARNING: Clock coniguration disabled +#else uint32_t freq_mhz = CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ; enum xtal_freq_e freq; diff --git a/drivers/net/tun.c b/drivers/net/tun.c index fc1425a768f..a8b76290c4a 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -429,24 +429,34 @@ static void tun_net_receive(FAR struct tun_device_s *priv) #if defined(CONFIG_NET_IPv4) ninfo("IPv4 frame\n"); NETDEV_RXIPV4(&priv->dev); +################################################################################# +@@ -429,20 +431,27 @@ static void tun_receive(FAR struct tun_device_s *priv) - /* Give the IPv4 packet to the network layer */ + /* Give the IPv4 packet to the network layer */ - ipv4_input(&priv->dev); + ret = ipv4_input(&priv->dev); - /* If the above function invocation resulted in data that should be - * sent out on the network, the field d_len will set to a value > 0. - */ + if (ret == OK) + { + /* If the above function invocation resulted in data that should be + * sent out on the network, the field d_len will set to a value > 0. + */ - if (priv->dev.d_len > 0) - { - priv->write_d_len = priv->dev.d_len; - tun_transmit(priv); - } - else - { - priv->write_d_len = 0; - tun_pollnotify(priv, POLLOUT); + if (priv->dev.d_len > 0) + { + priv->write_d_len = priv->dev.d_len; + tun_fd_transmit(priv); + } + else + { + tun_pollnotify(priv, POLLOUT); + } + } + else + { + priv->dev.d_len = 0; + tun_pollnotify(priv, POLLOUT); + } } #elif defined(CONFIG_NET_IPv6) @@ -464,7 +474,7 @@ static void tun_net_receive(FAR struct tun_device_s *priv) if (priv->dev.d_len > 0) { priv->write_d_len = priv->dev.d_len; - tun_transmit(priv); + tun_fd_transmit(priv); } else {