PF_IEEE802154: Finishes up sendto() logic

This commit is contained in:
Gregory Nutt
2017-08-19 12:32:56 -06:00
parent cff4ac6845
commit d00a37ee5a
12 changed files with 366 additions and 80 deletions
+21 -1
View File
@@ -53,6 +53,7 @@
#include <nuttx/wqueue.h>
#include <nuttx/net/net.h>
#include <nuttx/net/ip.h>
#include <nuttx/net/ieee802154.h>
#include <nuttx/net/sixlowpan.h>
#include <nuttx/wireless/ieee802154/ieee802154_loopback.h>
@@ -341,7 +342,26 @@ static int lo_loopback(FAR struct net_driver_s *dev)
ninfo("Send frame %p to the network: Offset=%u Length=%u\n",
iob, iob->io_offset, iob->io_len);
ret = sixlowpan_input(&priv->lo_radio, iob, (FAR void *)&ind);
#ifdef CONFIG_NET_IEEE802154
/* Invoke the PF_IEEE802154 tap first. If the frame matches
* with a connected PF_IEEE802145 socket, it will take the
* frame and return success.
*/
ret = ieee802154_input(&priv->lo_radio, iob, (FAR void *)&ind);
#ifdef CONFIG_NET_6LOWPAN
/* If PF_IEEE802154 was not interested in the frame, then
* give it to 6LoWPAN.
*/
if (ret < 0)
#endif
#endif
#ifdef CONFIG_NET_6LOWPAN
{
ret = sixlowpan_input(&priv->lo_radio, iob, (FAR void *)&ind);
}
#endif
/* Increment statistics */
+18 -1
View File
@@ -57,6 +57,7 @@
#include <nuttx/mm/iob.h>
#include <nuttx/net/arp.h>
#include <nuttx/net/netdev.h>
#include <nuttx/net/ieee802154.h>
#include <nuttx/net/sixlowpan.h>
#include <nuttx/wireless/ieee802154/ieee802154_mac.h>
@@ -434,7 +435,23 @@ static int macnet_rxframe(FAR struct mac802154_maccb_s *maccb,
/* Transfer the frame to the network logic */
sixlowpan_input(&priv->md_dev, iob, (FAR void *)ind);
#ifdef CONFIG_NET_IEEE802154
/* Invoke the PF_IEEE802154 tap first. If the frame matches
* with a connected PF_IEEE802145 socket, it will take the
* frame and return success.
*/
#ifndef CONFIG_NET_6LOWPAN
(void)ieee802154_input(&priv->md_dev, iob, (FAR void *)ind);
#else
if (ieee802154_input(&priv->md_dev, iob, (FAR void *)ind) < 0)
#endif
#endif
#ifdef CONFIG_NET_6LOWPAN
{
(void)sixlowpan_input(&priv->md_dev, iob, (FAR void *)ind);
}
#endif
/* sixlowpan_input() will free the IOB, but we must free the struct
* ieee802154_data_ind_s container here.