Skip to content

Conversation

ClaCodes
Copy link
Contributor

@ClaCodes ClaCodes commented Oct 19, 2025

Based on #93341

Adjust the way the SKIP option worked. Before this patch, a constant
priority offset was considered "high priority" this had the effect, that
the threads assigned to work on the priority were effectively usesless.
To fix it, consider this immediate handling as a pseudo-queue and compute
the tc-thead-mapping based on the effective count (+1 if skipping is
enabled). This makes it so that all threads are usefull and the
high-priority skip-path is considered as a pseudo tc-thread.

Running net filter on this sample (adjusted to 7 queues with skip enabled) after:

uart:~$ net filter                                                                                                                                                                                                                                 
Rule  Type        Verdict   Pkt-Prio  Queue  Thread-Prio  Tests                                                                                                                                                                                    
[ 1]  recv        CONTINUE         1      0           15  1    eth type[0x007b]                                                                                                                                                                    
[ 2]  recv        CONTINUE         0      1           13  1    eth type[0x007c]                                                                                                                                                                    
[ 3]  recv        CONTINUE         2      2           11  1    eth type[0x007d]                                                                                                                                                                    
[ 4]  recv        CONTINUE         3      3            9  1    eth type[0x007e]                                                                                                                                                                    
[ 5]  recv        CONTINUE         4      4            7  1    eth type[0x007f]                                                                                                                                                                    
[ 6]  recv        CONTINUE         5      5            5  1    eth type[0x0080]                                                                                                                                                                    
[ 7]  recv        CONTINUE         6      6            3  1    eth type[0x0081]                                                                                                                                                                    
[ 8]  recv        CONTINUE         7      7         SKIP  1    eth type[0x0082]                                                                                                                                                                    
[ 9]  recv        OK             N/A    N/A          N/A  0    

vs before

uart:~$ net filter
Rule  Type        Verdict   Pkt-Prio  Queue  Thread-Prio  Tests
[ 1]  recv        CONTINUE         1      0           15  1    eth type[0x007b]
[ 2]  recv        CONTINUE         0      1           13  1    eth type[0x007c]
[ 3]  recv        CONTINUE         2      2           11  1    eth type[0x007d]
[ 4]  recv        CONTINUE         3      3         SKIP  1    eth type[0x007e]
[ 5]  recv        CONTINUE         4      4         SKIP  1    eth type[0x007f]
[ 6]  recv        CONTINUE         5      4         SKIP  1    eth type[0x0080]
[ 7]  recv        CONTINUE         6      5         SKIP  1    eth type[0x0081]
[ 8]  recv        CONTINUE         7      6         SKIP  1    eth type[0x0082]
[ 9]  recv        OK             N/A    N/A          N/A  0    
uart:~$ 

Without this patch, several tc-queue-threads are present but idling.

For applications with the following config, it would have no effect:

CONFIG_NET_TC_MAPPING_STRICT=y
CONFIG_NET_TC_RX_COUNT=1
CONFIG_NET_TC_RX_SKIP_FOR_HIGH_PRIO=y

due to

#define PRIORITY2TC_2 {0, 0, 0, 0, 1, 1, 1, 1}

@ClaCodes ClaCodes requested a review from jukkar October 19, 2025 19:23
@zephyrbot zephyrbot added the area: Samples Samples label Oct 19, 2025
@ClaCodes ClaCodes changed the title net: tc-mapping: Fix SKIP_FOR_HIGH_PRIO DRAFT: net: tc-mapping: Fix SKIP_FOR_HIGH_PRIO Oct 20, 2025
@ClaCodes ClaCodes force-pushed the better_tc branch 2 times, most recently from ff2876f to 2c91d34 Compare October 21, 2025 20:16
Avoid token pasting and use preprocessor more for additional flexibility.

Signed-off-by: Cla Mattia Galliard <[email protected]>
Adjust the way the SKIP option worked. Before this patch, a constant
priority offset was considered "high priority" this had the effect, that
the threads assigned to work on the priority were effectively usesless.
To fix it, consider this immediate handling as a pseudo-queue and compute
the tc-thead-mapping based on the effective count (+1 if skipping is
enabled). This makes it so that all threads are usefull and the
high-priority skip-path is considered as a pseudo tc-thread.

Signed-off-by: Cla Mattia Galliard <[email protected]>
@ClaCodes ClaCodes changed the title DRAFT: net: tc-mapping: Fix SKIP_FOR_HIGH_PRIO net: tc-mapping: Fix SKIP_FOR_HIGH_PRIO Oct 21, 2025
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants