Skip to content

Add configuration option to prevent configASSERT checks on ipBUFFER_PADDING #1271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 26, 2025

Conversation

blanco-ether
Copy link
Contributor

@blanco-ether blanco-ether commented Jun 23, 2025

Description

Added ipconfigSUPPRESS_BUFFER_PADDING_CHECK to prevent configASSERT checks on ipBUFFER_PADDING in FreeRTOS_IP_Utils.c/vPreCheckConfigs( void )

  • Defaults to ipconfigDISABLE to build with configASSERT checks in place.
  • User settable to ipconfigENABLE to eliminate configASSERT checks.

Test Steps

Observe that when source built while ipconfigSUPPRESS_BUFFER_PADDING_CHECK either not defined in user configuration or defined as ipconfigDISABLE, the configASSERTs to validate optimal settings for ipBUFFER_PADDING are also built as in existing code base. The configASSERTS are not built when the default setting is overridden in a user configuration by defining ipconfigSUPPRESS_BUFFER_PADDING_CHECK as ipconfigENABLE.

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.

Related Issue

Setting ipconfigPACKET_FILLER_SIZE to 0 is necessary when porting to a MAC controller that does not have an option to pad the start of a received packet within a word boundary to optimize access to IP fields. Setting ipconfigPACKET_FILLER_SIZE to 0 causes configASSERT checks related to validating ipBUFFER_PADDING to fail.

Forum discussion: https://forums.freertos.org/t/assert-fail-using-zero-copy-buffers-porting-freertos-plus-tcp-v3-1-0-to-v4-2-2/23254

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

… checks on ipBUFFER_PADDING in FreeRTOS_IP_Utils.c/vPreCheckConfigs( void )

* Defaults to ipconfigDISABLE to build with configASSERT checks in place.
* User settable to ipconfigENABLE to eliminate configASSERT checks.
@blanco-ether blanco-ether requested a review from a team as a code owner June 23, 2025 18:42
@tony-josi-aws
Copy link
Member

tony-josi-aws commented Jun 24, 2025

@blanco-ether
Thanks for your contribution.
Can you apply the formatting patch on the PR, which is available here to fix the CI check?

@devprodest
Copy link
Contributor

I think it would be useful to include alignment settings in the macro. on Platforms with a cache, other values are possible, depending on the size of the cache lines.

@tony-josi-aws
Copy link
Member

@devprodest
Do you mean having platform-specific alignment macros for different supported architectures?

@blanco-ether
Copy link
Contributor Author

blanco-ether commented Jun 25, 2025 via email

@blanco-ether
Copy link
Contributor Author

blanco-ether commented Jun 25, 2025 via email

@tony-josi-aws tony-josi-aws merged commit 07b203f into FreeRTOS:main Jun 26, 2025
10 checks passed
@devprodest
Copy link
Contributor

@devprodest Do you mean having platform-specific alignment macros for different supported architectures?

Yes, unfortunately it is.

@tony-josi-aws
Copy link
Member

@devprodest
Since those are dependent on each HW platform and also design choices of the app developers, I believe it's better to keep the padding information as a config macro (we currently dont have recommended platform-specific macro definitions for any network interfaces; instead, those are in readme/comments/warnings in network interface folders) from a maintenance perspective.

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.

6 participants