From b87fac776f0a8b515a5b1cdbaed0a082f16b1b6f Mon Sep 17 00:00:00 2001 From: Anthony Merlino Date: Fri, 5 May 2017 12:44:29 -0400 Subject: [PATCH] wireless/ieee802154: Removes msdu_length from meta-data since it is intrinsically in the IOB --- include/nuttx/wireless/ieee802154/ieee802154_ioctl.h | 1 + include/nuttx/wireless/ieee802154/ieee802154_mac.h | 9 --------- wireless/ieee802154/mac802154.c | 2 +- wireless/ieee802154/mac802154_device.c | 4 ++-- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/include/nuttx/wireless/ieee802154/ieee802154_ioctl.h b/include/nuttx/wireless/ieee802154/ieee802154_ioctl.h index cd5550057c..6171d0e3a3 100644 --- a/include/nuttx/wireless/ieee802154/ieee802154_ioctl.h +++ b/include/nuttx/wireless/ieee802154/ieee802154_ioctl.h @@ -78,6 +78,7 @@ struct mac802154dev_txframe_s { struct ieee802154_frame_meta_s meta; FAR uint8_t *payload; + uint16_t length; }; #endif /* CONFIG_WIRELESS_IEEE802154 */ diff --git a/include/nuttx/wireless/ieee802154/ieee802154_mac.h b/include/nuttx/wireless/ieee802154/ieee802154_mac.h index d4046bccb2..8f8e0c22d5 100644 --- a/include/nuttx/wireless/ieee802154/ieee802154_mac.h +++ b/include/nuttx/wireless/ieee802154/ieee802154_mac.h @@ -585,15 +585,6 @@ struct ieee802154_frame_meta_s uint8_t msdu_handle; /* Handle assoc. with MSDU */ - /* Number of bytes contained in the MAC Service Data Unit (MSDU) - * to be transmitted by the MAC sublayer entity - * Note: This could be a uint8_t but if anyone ever wants to use - * non-standard frame lengths, they may want a length larger than - * a uint8_t. - */ - - uint16_t msdu_length; - struct { uint8_t ack_tx : 1; /* Acknowledge TX? */ diff --git a/wireless/ieee802154/mac802154.c b/wireless/ieee802154/mac802154.c index 0f548841c2..23ed9db872 100644 --- a/wireless/ieee802154/mac802154.c +++ b/wireless/ieee802154/mac802154.c @@ -1078,7 +1078,7 @@ int mac802154_req_data(MACHANDLE mac, * sublayer will set the Frame Version to one. [1] pg. 118. */ - if (meta->msdu_length > IEEE802154_MAX_SAFE_MAC_PAYLOAD_SIZE) + if ((frame->io_len - frame->io_offset) > IEEE802154_MAX_SAFE_MAC_PAYLOAD_SIZE) { *frame_ctrl |= IEEE802154_FRAMECTRL_VERSION; } diff --git a/wireless/ieee802154/mac802154_device.c b/wireless/ieee802154/mac802154_device.c index d78e7acfdc..6ea212ae53 100644 --- a/wireless/ieee802154/mac802154_device.c +++ b/wireless/ieee802154/mac802154_device.c @@ -449,9 +449,9 @@ static ssize_t mac802154dev_write(FAR struct file *filep, iob->io_offset = ret; iob->io_len = iob->io_offset; - memcpy(&iob->io_data[iob->io_offset], tx->payload, tx->meta.msdu_length); + memcpy(&iob->io_data[iob->io_offset], tx->payload, tx->length); - iob->io_len += tx->meta.msdu_length; + iob->io_len += tx->length; /* If this is a blocking operation, we need to setup a wait struct so we * can unblock when the packet transmission has finished. If this is a