Skip to content

Conversation

@mike919192
Copy link
Contributor

@mike919192 mike919192 commented Sep 12, 2025

Add ipconfigIP_TASK_AFFINITY

Description

I have been testing using the TCP library with SMP freertos kernel. Unfortunately, the TCP library and / or the zync port that I am using do not function properly without some restrictions on concurrent code execution.

This page has good information on freertos SMP https://freertos.org/Documentation/02-Kernel/02-Kernel-features/13-Symmetric-multiprocessing-introduction

The first restriction that I used was the kernel option configRUN_MULTIPLE_PRIORITIES set to 0. I have tested that for several weeks now and seems to be working well.

The next step of testing that I am doing to prevent concurrent execution is to set configRUN_MULTIPLE_PRIORITIES set to 1 and use the task affinity of all the tasks that use tcp functions to only allow them to run on one core. For my project, I am setting all these tasks:

  • User task which creates sockets (pinned to core 0)
  • IP Task (pinned to core 0)
  • Zynq port GEM task (pinned to core 0)
  • User task for reading from socket (pinned to core 0)
  • User task for writing to socket (pinned to core 0)

So it was necessary for me to modify the tcp library and the zynq port to allow setting the task affinity. This PR is adding the configuration option ipconfigIP_TASK_AFFINITY.

Test Steps

I have hardware set up for continuous network testing for a week now. My network testing has been continuously sending and checking echo data mixed with other application specific messages.

I don't think the unit tests can cover the new function calls because xTaskCreateAffinitySet and xTaskCreateStaticAffinitySet require SMP kernel, which I don't believe is possible with the linux or windows ports yet.

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

#1287

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

@ActoryOu ActoryOu merged commit f7f7b9d into FreeRTOS:main Sep 16, 2025
10 checks passed
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.

4 participants