Skip to content

Commit 5078a93

Browse files
[mrp] Make sure not all packet buffers are used for retransmissions (#33334)
On constrained devices, the number of available packet buffers can be very low. During stress testing a device that has 8 buffers available, which is the default on many platforms, it was observed that the device would receive a lot of parallel read requests and then it would use all its buffers for responses. The responses would then be stored in the retransmission table, awaiting an ACK, but the ACK would never arrive because of lack of available buffers. Configure the retransmission table size to be less than the number of packet buffers to make sure that not all buffers are held by the retransmission entries, in which case the device is unable to receive an ACK and hence it becomes unavailable until any message times out. Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>
1 parent 7585d71 commit 5078a93

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/messaging/ReliableMessageProtocolConfig.h

+9-2
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,22 @@ namespace chip {
130130
#if CHIP_SYSTEM_CONFIG_USE_LWIP
131131

132132
#if !LWIP_PBUF_FROM_CUSTOM_POOLS && PBUF_POOL_SIZE != 0
133-
#define CHIP_CONFIG_RMP_RETRANS_TABLE_SIZE std::min(PBUF_POOL_SIZE, CHIP_CONFIG_MAX_EXCHANGE_CONTEXTS)
133+
// Configure the table size to be less than the number of packet buffers to make sure
134+
// that not all buffers are held by the retransmission entries, in which case the device
135+
// is unable to receive an ACK and hence becomes unavailable until a message times out.
136+
#define CHIP_CONFIG_RMP_RETRANS_TABLE_SIZE std::min(PBUF_POOL_SIZE - 1, CHIP_CONFIG_MAX_EXCHANGE_CONTEXTS)
134137
#else
135138
#define CHIP_CONFIG_RMP_RETRANS_TABLE_SIZE CHIP_CONFIG_MAX_EXCHANGE_CONTEXTS
136139
#endif // !LWIP_PBUF_FROM_CUSTOM_POOLS && PBUF_POOL_SIZE != 0
137140

138141
#else // CHIP_SYSTEM_CONFIG_USE_LWIP
139142

140143
#if CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE != 0
141-
#define CHIP_CONFIG_RMP_RETRANS_TABLE_SIZE std::min(CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE, CHIP_CONFIG_MAX_EXCHANGE_CONTEXTS)
144+
// Configure the table size to be less than the number of packet buffers to make sure
145+
// that not all buffers are held by the retransmission entries, in which case the device
146+
// is unable to receive an ACK and hence becomes unavailable until a message times out.
147+
#define CHIP_CONFIG_RMP_RETRANS_TABLE_SIZE \
148+
std::min(CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE - 1, CHIP_CONFIG_MAX_EXCHANGE_CONTEXTS)
142149
#else
143150
#define CHIP_CONFIG_RMP_RETRANS_TABLE_SIZE CHIP_CONFIG_MAX_EXCHANGE_CONTEXTS
144151
#endif // CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE != 0

0 commit comments

Comments
 (0)