mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 08:38:38 +08:00
Merged in antmerlino/nuttx/wirelessnetdev (pull request #984)
wireless network devices: Attach radio to d_buf before registering device to handle forwarding case. When CONFIG_NET_IPFORWARD is enabled, and CONFIG_NET_6LOWPAN is being used, a packet that attempts to get forwarded on the 6LoWPAN interface will require that the radio's buffer be attached to d_buf. Otherwise the below exception will be hit. ~line 542 of sixlowpan_framelist.c ``` /* Recover the reassembly buffer from the driver d_buf. */ reass = (FAR struct sixlowpan_reassbuf_s *)radio->r_dev.d_buf; DEBUGASSERT(reass != NULL); ``` The underlying "radio" in this case is the mac802154_netdev. This behavior has probably not been observed because the buffer is normally attached in the periodic txpoll worker. However, in my case, the 6LoWPAN interace was not UP yet, and therefore the worker hadn't run yet. Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
parent
6bbc30c5fd
commit
535db0140a
6 changed files with 54 additions and 0 deletions
|
@ -1433,6 +1433,15 @@ int xbee_netdev_register(XBEEHANDLE xbee)
|
|||
|
||||
xbeenet_ifdown(dev);
|
||||
|
||||
#ifdef CONFIG_NET_6LOWPAN
|
||||
/* Make sure the our single packet buffer is attached. We must do this before
|
||||
* registering the device since, once the device is registered, a packet may
|
||||
* be attempted to be forwarded and require the buffer.
|
||||
*/
|
||||
|
||||
priv->xd_dev.r_dev.d_buf = g_iobuffer.rb_buf;
|
||||
#endif
|
||||
|
||||
/* Register the device with the OS so that socket IOCTLs can be performed */
|
||||
|
||||
(void)netdev_register(&priv->xd_dev.r_dev, NET_LL_IEEE802154);
|
||||
|
|
|
@ -2857,6 +2857,15 @@ int spirit_netdev_initialize(FAR struct spi_dev_s *spi,
|
|||
goto errout_with_attach;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NET_6LOWPAN
|
||||
/* Make sure the our single packet buffer is attached. We must do this before
|
||||
* registering the device since, once the device is registered, a packet may
|
||||
* be attempted to be forwarded and require the buffer.
|
||||
*/
|
||||
|
||||
priv->radio.r_dev.d_buf = g_iobuffer.rb_buf;
|
||||
#endif
|
||||
|
||||
/* Register the device with the OS so that socket IOCTLs can be performed. */
|
||||
|
||||
ret = netdev_register(dev, NET_LL_PKTRADIO);
|
||||
|
|
|
@ -1110,6 +1110,15 @@ int bt_netdev_register(FAR const struct bt_driver_s *btdev)
|
|||
|
||||
btnet_ifdown(netdev);
|
||||
|
||||
#ifdef CONFIG_NET_6LOWPAN
|
||||
/* Make sure the our single packet buffer is attached. We must do this before
|
||||
* registering the device since, once the device is registered, a packet may
|
||||
* be attempted to be forwarded and require the buffer.
|
||||
*/
|
||||
|
||||
priv->bd_dev.r_dev.d_buf = g_iobuffer.rb_buf;
|
||||
#endif
|
||||
|
||||
/* Register the network device with the OS so that socket IOCTLs can be
|
||||
* performed
|
||||
*/
|
||||
|
|
|
@ -1104,6 +1104,15 @@ int ieee8021514_loopback(void)
|
|||
|
||||
priv->lo_polldog = wd_create(); /* Create periodic poll timer */
|
||||
|
||||
#ifdef CONFIG_NET_6LOWPAN
|
||||
/* Make sure the our single packet buffer is attached. We must do this before
|
||||
* registering the device since, once the device is registered, a packet may
|
||||
* be attempted to be forwarded and require the buffer.
|
||||
*/
|
||||
|
||||
priv->lo_radio.r_dev.d_buf = g_iobuffer.rb_buf;
|
||||
#endif
|
||||
|
||||
/* Register the loopabck device with the OS so that socket IOCTLs can be
|
||||
* performed.
|
||||
*/
|
||||
|
|
|
@ -1429,6 +1429,15 @@ int mac802154netdev_register(MACHANDLE mac)
|
|||
goto errout;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NET_6LOWPAN
|
||||
/* Make sure the our single packet buffer is attached. We must do this before
|
||||
* registering the device since, once the device is registered, a packet may
|
||||
* be attempted to be forwarded and require the buffer.
|
||||
*/
|
||||
|
||||
priv->md_dev.r_dev.d_buf = priv->md_iobuffer.rb_buf;
|
||||
#endif
|
||||
|
||||
/* Register the device with the OS so that socket IOCTLs can be performed */
|
||||
|
||||
(void)netdev_register(&priv->md_dev.r_dev, NET_LL_IEEE802154);
|
||||
|
|
|
@ -1048,6 +1048,15 @@ int pktradio_loopback(void)
|
|||
|
||||
priv->lo_polldog = wd_create(); /* Create periodic poll timer */
|
||||
|
||||
#ifdef CONFIG_NET_6LOWPAN
|
||||
/* Make sure the our single packet buffer is attached. We must do this before
|
||||
* registering the device since, once the device is registered, a packet may
|
||||
* be attempted to be forwarded and require the buffer.
|
||||
*/
|
||||
|
||||
priv->lo_radio.r_dev.d_buf = g_iobuffer.rb_buf;
|
||||
#endif
|
||||
|
||||
/* Register the loopabck device with the OS so that socket IOCTLs can be
|
||||
* performed.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue