Skip to content

Add a hook function called on buffer release#1340

Open
fxrb wants to merge 1 commit into
FreeRTOS:mainfrom
fxrb:add-buffer-release-hook
Open

Add a hook function called on buffer release#1340
fxrb wants to merge 1 commit into
FreeRTOS:mainfrom
fxrb:add-buffer-release-hook

Conversation

@fxrb
Copy link
Copy Markdown
Contributor

@fxrb fxrb commented May 8, 2026

Description

This patch adds a hook function to FreeRTOS-Plus-TCP to notify the network driver whenever a buffer is released.
One could use iptraceNETWORK_BUFFER_RELEASED (what I did at first) but this is not what it was designed for.
A network driver allocates a buffer to store incoming frames from the network. Once a frame has been received the buffer is passed to FreeRTOS-Plus-TCP which will consume it and then probably release it or not. For a zero-copy network driver using BufferAllocation_1.c it is helpful or even necessary to get a notification once FreeRTOS-Plus-TCP releases a buffer. The notification can be used for memory management, for instance to re-allocate a new buffer to receive further frames.

Checklist

  • I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

This patch adds a hook function to FreeRTOS-Plus-TCP to notify the
network driver whenever a buffer is released.
One could use iptraceNETWORK_BUFFER_RELEASED (what I did at first) but
this is not what it was designed for.
A network driver allocates a buffer to store incoming frames from the
network. Once a frame has been received the buffer is passed to
FreeRTOS-Plus-TCP which will consume it and then probably release it or
not. For a zero-copy network driver using BufferAllocation_1.c it is
helpful or even necessary to get a notification once FreeRTOS-Plus-TCP
releases a buffer. The notification can be used for memory management,
for instance to re-allocate a new buffer to receive further frames.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant