diff --git a/CHANGES.md b/CHANGES.md index 481b3cbb5..b7796cf6a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -24,7 +24,8 @@ Changes from ns-3.39 to ns-3-dev * (energy) Support for battery presets and cell packs. * (energy) Documentation was updated and reformatted. * (lr-wpan) Removed unnecessary bcst filter from `LrWpanMac::PdDataIndication` which also blocked the correct reception of beacon request commands. -* (lr-wpan) Add the functions to set or get the capability field via bitmap (a 8 bit int). +* (lr-wpan) Added the functions to set or get the capability field via bitmap (a 8 bit int). +* (lr-wpan) Added the possibility to obtain the LQI from a received `MlmeAssociateIndicationParams`. ### Changes to build system diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 239ccf26e..7e9586cc8 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -32,6 +32,7 @@ requirements (Note: not all ns-3 features are available on all systems): - (wifi) Added support for 802.11be TID-to-Link Mapping - (energy) - !1329 - Extensions to battery discharge module - (lr-wpan) - !1604 - Add CapabilityField bitmap functions +- (lr-wpan) - !1645 - Add LQI to MlmeAssociateIndicationParams ### Bugs fixed diff --git a/src/lr-wpan/model/lr-wpan-mac.cc b/src/lr-wpan/model/lr-wpan-mac.cc index 439a7abc7..e7ac24e7b 100644 --- a/src/lr-wpan/model/lr-wpan-mac.cc +++ b/src/lr-wpan/model/lr-wpan-mac.cc @@ -183,6 +183,7 @@ LrWpanMac::LrWpanMac() m_numCsmacaRetry = 0; m_txPkt = nullptr; m_rxPkt = nullptr; + m_lastRxFrameLqi = 0; m_ifs = 0; m_macLIFSPeriod = 40; @@ -2093,9 +2094,10 @@ LrWpanMac::PdDataIndication(uint32_t psduLength, Ptr p, uint8_t lqi) m_setMacState.Cancel(); ChangeMacState(MAC_IDLE); - // save received packet to process the appropriate indication/response after - // sending ACK (PD-DATA.confirm) + // save received packet and LQI to process the appropriate indication/response + // after sending ACK (PD-DATA.confirm) m_rxPkt = originalPkt->Copy(); + m_lastRxFrameLqi = lqi; // LOG Commands with ACK required. CommandPayloadHeader receivedMacPayload; @@ -3176,9 +3178,13 @@ LrWpanMac::PdDataConfirm(LrWpanPhyEnumeration status) { if (!m_mlmeAssociateIndicationCallback.IsNull()) { + // NOTE: The LQI parameter is not part of the standard but found + // in some implementations as is required for higher layers (See Zboss + // implementation). MlmeAssociateIndicationParams associateParams; associateParams.capabilityInfo = receivedMacPayload.GetCapabilityField(); associateParams.m_extDevAddr = receivedMacHdr.GetExtSrcAddr(); + associateParams.lqi = m_lastRxFrameLqi; m_mlmeAssociateIndicationCallback(associateParams); } diff --git a/src/lr-wpan/model/lr-wpan-mac.h b/src/lr-wpan/model/lr-wpan-mac.h index 7e4d3a90b..0f0b11152 100644 --- a/src/lr-wpan/model/lr-wpan-mac.h +++ b/src/lr-wpan/model/lr-wpan-mac.h @@ -447,9 +447,11 @@ struct McpsDataIndicationParams */ struct MlmeAssociateIndicationParams { - Mac64Address m_extDevAddr; //!< The extended address of the device requesting association - CapabilityField - capabilityInfo; //!< The operational capabilities of the device requesting association. + Mac64Address m_extDevAddr; //!< The extended address of the device requesting association + CapabilityField capabilityInfo; //!< The operational capabilities of + //!< the device requesting association. + u_int8_t lqi{0}; //!< The link quality indicator of the received associate request command + //!< (Not officially supported in the standard but found in implementations) }; /** @@ -2218,6 +2220,11 @@ class LrWpanMac : public Object */ uint8_t m_numCsmacaRetry; + /** + * Keep track of the last received frame Link Quality Indicator + */ + uint8_t m_lastRxFrameLqi; + /** * Scheduler event for the ACK timeout of the currently transmitted data * packet.