Merged in antmerlino/nuttx/mac802154_fcslen (pull request #983)

ieee802154: Support dynamic FCS length. Adds IEEE802154_ATTR_PHY_FCSLEN.

This change introduces IEEE802154_ATTR_PHY_FCSLEN which the radio layer can support to set/get the FCS length that's added to the end of the frame. One use case, in promiscuous mode, is to add back in the FCS of the received frame by increasing the iob->io_len by the FCS length.

Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
Anthony Merlino
2019-08-10 18:05:07 +00:00
committed by Gregory Nutt
parent e2ac83dff0
commit 6bbc30c5fd
4 changed files with 43 additions and 18 deletions
+13 -7
View File
@@ -450,11 +450,7 @@ static ssize_t mac802154dev_read(FAR struct file *filep, FAR char *buffer,
*/
}
/* Check if the MAC layer is in promiscuous mode. If it is, pass the entire
* frame, including IEEE 802.15.4 header and checksum by assuming the frame
* starts at the beginning of the IOB and goes 2 past the length to account
* for the FCS that the radio driver "removes"
*/
/* Check if the MAC layer is in promiscuous mode. */
req.attr = IEEE802154_ATTR_MAC_PROMISCUOUS_MODE;
@@ -463,8 +459,18 @@ static ssize_t mac802154dev_read(FAR struct file *filep, FAR char *buffer,
if (ret == 0 && req.attrval.mac.promisc_mode)
{
rx->length = ind->frame->io_len + 2;
rx->offset = ind->frame->io_offset;
/* If it is, add the FCS back into the frame by increasing the length
* by the PHY layer's FCS length.
*/
req.attr = IEEE802154_ATTR_PHY_FCS_LEN;
ret = mac802154_ioctl(dev->md_mac, MAC802154IOC_MLME_GET_REQUEST,
(unsigned long)&req);
if (ret == OK)
{
rx->length = ind->frame->io_len + req.attrval.phy.fcslen;
rx->offset = ind->frame->io_offset;
}
/* Copy the entire frame from the IOB to the user supplied struct */