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:
parent
e2ac83dff0
commit
6bbc30c5fd
@ -564,6 +564,13 @@ int mrf24j40_getattr(FAR struct ieee802154_radio_s *radio,
|
||||
}
|
||||
break;
|
||||
|
||||
case IEEE802154_ATTR_PHY_FCS_LEN:
|
||||
{
|
||||
attrval->phy.fcslen = 2;
|
||||
ret = IEEE802154_STATUS_SUCCESS;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
ret = IEEE802154_STATUS_UNSUPPORTED_ATTRIBUTE;
|
||||
}
|
||||
|
@ -468,7 +468,14 @@ int xbee_req_get(XBEEHANDLE xbee, enum ieee802154_attr_e attr,
|
||||
}
|
||||
break;
|
||||
|
||||
case IEEE802154_ATTR_RADIO_REGDUMP:
|
||||
case IEEE802154_ATTR_PHY_FCS_LEN:
|
||||
{
|
||||
attrval->phy.fcslen = 2;
|
||||
ret = IEEE802154_STATUS_SUCCESS;
|
||||
}
|
||||
break
|
||||
|
||||
case IEEE802154_ATTR_PHY_REGDUMP:
|
||||
{
|
||||
xbee_regdump(priv);
|
||||
}
|
||||
|
@ -358,7 +358,7 @@ enum ieee802154_attr_e
|
||||
{
|
||||
/* PHY PIB Attributes */
|
||||
|
||||
IEEE802154_ATTR_PHY_CHAN = 0x00,
|
||||
IEEE802154_ATTR_PHY_CHAN,
|
||||
IEEE802154_ATTR_PHY_CHANNELS_SUPPORTED,
|
||||
IEEE802154_ATTR_PHY_TX_POWER_TOLERANCE,
|
||||
IEEE802154_ATTR_PHY_TX_POWER,
|
||||
@ -394,11 +394,16 @@ enum ieee802154_attr_e
|
||||
IEEE802154_ATTR_PHY_UWB_RX_RMARKER,
|
||||
IEEE802154_ATTR_PHY_RFRAME_PROC_TIME,
|
||||
IEEE802154_ATTR_PHY_CCA_DURATION,
|
||||
IEEE802154_ATTR_PHY_SYMBOL_DURATION, /* Non-standard attribute */
|
||||
|
||||
/* Non-standard PHY attributes */
|
||||
|
||||
IEEE802154_ATTR_PHY_SYMBOL_DURATION,
|
||||
IEEE802154_ATTR_PHY_FCS_LEN,
|
||||
IEEE802154_ATTR_PHY_REGDUMP,
|
||||
|
||||
/* MAC PIB Attributes */
|
||||
|
||||
IEEE802154_ATTR_MAC_EADDR = 0x40,
|
||||
IEEE802154_ATTR_MAC_EADDR,
|
||||
IEEE802154_ATTR_MAC_ACK_WAIT_DUR,
|
||||
IEEE802154_ATTR_MAC_ASSOCIATED_PANCOORD,
|
||||
IEEE802154_ATTR_MAC_ASSOCIATION_PERMIT,
|
||||
@ -435,11 +440,10 @@ enum ieee802154_attr_e
|
||||
IEEE802154_ATTR_MAC_TX_CTRL_ACTIVE_DUR,
|
||||
IEEE802154_ATTR_MAC_TX_CTRL_PAUSE_DUR,
|
||||
IEEE802154_ATTR_MAC_TX_TOTAL_DUR,
|
||||
IEEE802154_ATTR_MAC_DEVMODE, /* Non-standard */
|
||||
|
||||
/* MAC Security Attributes */
|
||||
|
||||
IEEE802154_ATTR_MAC_KEY_TABLE = 0x70,
|
||||
IEEE802154_ATTR_MAC_KEY_TABLE,
|
||||
IEEE802154_ATTR_MAC_DEV_TABLE,
|
||||
IEEE802154_ATTR_MAC_SEC_LVL_TABLE,
|
||||
IEEE802154_ATTR_MAC_FRAME_COUNTER,
|
||||
@ -451,9 +455,9 @@ enum ieee802154_attr_e
|
||||
IEEE802154_ATTR_MAC_PANCOORD_EXT_ADDR,
|
||||
IEEE802154_ATTR_MAC_PANCOORD_SHORT_ADDR,
|
||||
|
||||
/* Special Attributes */
|
||||
/* Non-standard MAC Atrributes*/
|
||||
|
||||
IEEE802154_ATTR_RADIO_REGDUMP = 0xF0,
|
||||
IEEE802154_ATTR_MAC_DEVMODE,
|
||||
};
|
||||
|
||||
/* Frame Type */
|
||||
@ -671,9 +675,10 @@ union ieee802154_macattr_u
|
||||
|
||||
union ieee802154_phyattr_u
|
||||
{
|
||||
uint8_t chan;
|
||||
int32_t txpwr;
|
||||
uint32_t symdur_picosec;
|
||||
uint8_t chan;
|
||||
int32_t txpwr;
|
||||
uint32_t symdur_picosec;
|
||||
uint8_t fcslen;
|
||||
/* TODO: Fill this out as we implement supported get/set commands */
|
||||
};
|
||||
|
||||
|
@ -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 */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user