-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Description
Is your enhancement proposal related to a problem? Please describe.
The Zephyr IEEE 802.15.4 stack (L2 - MAC) implementation don't transport all information defined by the IEEE 802.15.4 PSDU (PHY Service Data Unit) packet. As identified and discussed on #49311 the missing fields obligate majority (if not all) drivers to do special treatment on RX/TX operations. This intents to collect and discuss requirements to solve in a proper way this issue.
Describe the solution you'd like
Add two characteristics: 1 - add capability to transport bigger buffers between IEEE 802.15.4 drivers and L2 - MAC layer; 2 - add a valid IEEE 802.15.4 MAC frame size. The buffer must be capable to accommodate the IEEE 802.15.4 PPDU (PHY Protocol Data Unit) plus any additional octet required by the driver. This provide a way to tune the driver buffers allowing best performance. The driver should expose a mechanism to inform where the PHY PSDU octet starts and what is the aMaxPhyPacketSize value (PSDU max length). All this information should be defined by each driver instance. With that, any above layer should be capable to adjust itself inside PSDU size with best data positioning. These consults between driver and the above layer are required to enable multiple drivers instances which supports different PHY standards. A mechanism could be implemented to use constant values for optimal performance on L2 and/or driver only if when using one driver instance or the instances share the same PSDU length.
This means that a new API is necessary to expose, but not limited to:
- phy_max_buf_size
It is PPDU size plus padding. The default number of octets is 128 represented by SHR(0) + PHR(1) + PSDU(127) + padding(0). - phy_psdu_position
1 octet SHR(0) + PHR(1). - phy_max_psdu_size
It is the PSDU size itself, 127 octets PSDU(127).
The PSDU is 2047 for the following PHYs: SUN, TVWS, RCC, LECIM FSK, and MSK with a 2000 kb/s data rate. For LECIM DSSS
PHY, this is not a constant; refer to phyLecimDsssPsduSize [which are 16, 24, 32]. 127 for all other PHYs.
The driver is responsible to pass correct value to upper layer once all variables may differ their values. This means that depending on the combination of PHY x Channel x Page the SHR, PHR, PSDU, FCS and padding may be different and the MAC should operate independent of those values. See the different SHR sizes based on the tables at additional content for more details.
Pros
- Remove drivers workarounds on received frames since OpenThread and Zigbee expects MFR and Zephyr 802.15.4 not
- Remove drivers workaround on transmission since majority expects PHR with value of MAC frame including MFR
- Easy to manipulate SHR, PHR or any other driver frame requirement
- Allow introduce padding to easy use DMA
- Easy to integrate with a custom upper layers
- Help to introduce IEEE 802.15.4-2015 PHYs like SUN
Cons
- Introduce new API
- May increase RAM usage depending on driver needs.
Additional context
The below IEEE 802.15.4 tables may help to understand and visualize the IEEE 802.15.4 generic frame and how data is positioned inside it.
IEEE 802.15.4-2020 PSDU format

IEEE 802.15.4-2020 PPDU format

IEEE 802.15.4-2006 SHR Sizes (Preamble + SFD)

Reference