Skip to content

Commit 0bb25d2

Browse files
nordic-krchnashif
authored andcommitted
lib: os: spsc_pbuf: Clarify using cache management in the module
Packet buffer can be used for sharing data between cores. In that case when any core has data cache then data cache handling must be enabled in the module. However, it shall never be enabled when the packet buffer is used on a single core. Adding that information to the documentation. Signed-off-by: Krzysztof Chruściński <[email protected]>
1 parent b737598 commit 0bb25d2

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

include/zephyr/sys/spsc_pbuf.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ extern "C" {
2525
* @{
2626
*/
2727

28-
/** @brief Flag indicating that cache shall be handled. */
28+
/** @brief Flag indicating that cache shall be handled.
29+
*
30+
* It shall be used only when packet buffer is shared between two cores as on a single
31+
* core cache shall not be handled manually because it results in data corruption.
32+
*/
2933
#define SPSC_PBUF_CACHE BIT(0)
3034

3135
/** @brief Size of the field which stores maximum utilization. */

lib/os/Kconfig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ config SPSC_PBUF_CACHE_ALWAYS
6060
bool "Always handle cache"
6161
help
6262
Handle cache writeback and invalidation for all instances. Option used
63-
to avoid runtime check and thus reduce memory footprint.
63+
to avoid runtime check and thus reduce memory footprint. Beware! It shall
64+
be used only if all packet buffer instances are used for data sharing
65+
between cores.
6466

6567
config SPSC_PBUF_CACHE_NEVER
6668
bool "Never handle cache"

0 commit comments

Comments
 (0)