Skip to content

Commit abeba09

Browse files
committed
[nrfconnect] Optimize packet buffer size
Matter requires that regular Matter messages fit in IPv6 MTU of 1280 bytes so the default packet buffer size of 1583 bytes seems excessively large for some configurations. Especially that the buffers only hold the UDP payload in the case of non-LWIP transports. There are two exceptions to the above though: 1. Minimal mDNS uses the same packet buffer pool and mDNS message size is not limited to 1280 bytes, so shrinking the buffer size below MTU might have a negative impact on the mDNS behavior. 2. Matter allows definining so called large messages that can be bigger than 1280 bytes and sent over TCP, but that is not implemented yet and will likely require a different allocation mechanism. Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>
1 parent 03bf252 commit abeba09

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/platform/nrfconnect/SystemPlatformConfig.h

+14
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,18 @@ struct ChipDeviceEvent;
5151
#define CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE 8
5252
#endif
5353

54+
#ifndef CHIP_SYSTEM_CONFIG_PACKETBUFFER_CAPACITY_MAX
55+
#ifdef CONFIG_WIFI_NRF700X
56+
// Minimal mDNS uses Matter packet buffers, so as long as minimal mDNS is used
57+
// in Nordic's Wi-Fi solution, the packet buffers must be a bit bigger than what
58+
// is required by Matter.
59+
#define CHIP_SYSTEM_CONFIG_PACKETBUFFER_CAPACITY_MAX CONFIG_NRF_WIFI_IFACE_MTU
60+
#else
61+
// Matter specification requires that Matter messages fit in IPV6 MTU of 1280B
62+
// unless for large messages that can be sent over BTP or TCP. But those will
63+
// likely require a separate buffer pool or employ chained buffers.
64+
#define CHIP_SYSTEM_CONFIG_PACKETBUFFER_CAPACITY_MAX 1280
65+
#endif // CONFIG_WIFI_NRF700X
66+
#endif // CHIP_SYSTEM_CONFIG_PACKETBUFFER_CAPACITY_MAX
67+
5468
// ========== Platform-specific Configuration Overrides =========

0 commit comments

Comments
 (0)