Skip to content

Commit

Permalink
[spinel] define a new spinel-specific configuration value for source …
Browse files Browse the repository at this point in the history
…match table size

Avoids any confusion with `OPENTHREAD_CONFIG_MLE_MAX_CHILDREN`:

* `OPENTHREAD_SPINEL_CONFIG_MAX_SRC_MATCH_ENTRIES` in `openthread-spinel-config.h` defines size of the local source match table used by RadioSpinel when `OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT` is used.
* For OpenThread, the default value of this config is `OPENTHREAD_CONFIG_MLE_MAX_CHILDREN`.
* Other protocols (in case of MultiPAN with spinel) can define whatever value they want for the size of the table using this config.
  • Loading branch information
suveshpratapa committed Oct 3, 2024
1 parent f0cb5a3 commit 4dc838c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/lib/spinel/openthread-spinel-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,16 @@
#define OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT 0
#endif

/**
* @def OPENTHREAD_SPINEL_CONFIG_MAX_SRC_MATCH_ENTRIES
*
* Defines size of the local source match table used by RadioSpinel
* when OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT is used.
*/
#ifndef OPENTHREAD_SPINEL_CONFIG_MAX_SRC_MATCH_ENTRIES
#define OPENTHREAD_SPINEL_CONFIG_MAX_SRC_MATCH_ENTRIES OPENTHREAD_CONFIG_MLE_MAX_CHILDREN
#endif

/**
* @def OPENTHREAD_SPINEL_CONFIG_ABORT_ON_UNEXPECTED_RCP_RESET_ENABLE
*
Expand Down
4 changes: 2 additions & 2 deletions src/lib/spinel/radio_spinel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@ otError RadioSpinel::AddSrcMatchShortEntry(uint16_t aShortAddress)
EXPECT_NO_ERROR(error = Insert(SPINEL_PROP_MAC_SRC_MATCH_SHORT_ADDRESSES, SPINEL_DATATYPE_UINT16_S, aShortAddress));

#if OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT > 0
assert(mSrcMatchShortEntryCount < OPENTHREAD_CONFIG_MLE_MAX_CHILDREN);
assert(mSrcMatchShortEntryCount < OPENTHREAD_SPINEL_CONFIG_MAX_SRC_MATCH_ENTRIES);

for (int i = 0; i < mSrcMatchShortEntryCount; ++i)
{
Expand All @@ -1009,7 +1009,7 @@ otError RadioSpinel::AddSrcMatchExtEntry(const otExtAddress &aExtAddress)
Insert(SPINEL_PROP_MAC_SRC_MATCH_EXTENDED_ADDRESSES, SPINEL_DATATYPE_EUI64_S, aExtAddress.m8));

#if OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT > 0
assert(mSrcMatchExtEntryCount < OPENTHREAD_CONFIG_MLE_MAX_CHILDREN);
assert(mSrcMatchExtEntryCount < OPENTHREAD_SPINEL_CONFIG_MAX_SRC_MATCH_ENTRIES);

for (int i = 0; i < mSrcMatchExtEntryCount; ++i)
{
Expand Down

0 comments on commit 4dc838c

Please sign in to comment.