Skip to content

Commit

Permalink
net: tc: Add a skip for rx-queues
Browse files Browse the repository at this point in the history
Add a configuration option to skip the rx-queues for high priority packets
analogously to the tx-side.

Signed-off-by: Cla Mattia Galliard <[email protected]>
  • Loading branch information
clamattia committed Jan 27, 2025
1 parent f857f72 commit 8cc6d69
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
7 changes: 7 additions & 0 deletions subsys/net/ip/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,13 @@ config NET_TC_SKIP_FOR_HIGH_PRIO
be pushed directly to network driver and will skip the traffic class
queues. This is currently not enabled by default.

config NET_TC_RX_SKIP_FOR_HIGH_PRIO
bool "Push high priority packets directly to application"
help
If this is set, then high priority (>= NET_PRIORITY_CA) net_pkt will
be pushed directly to the application and will skip the traffic class
queues. This is currently not enabled by default.

choice NET_TC_THREAD_TYPE
prompt "How the network RX/TX threads should work"
help
Expand Down
3 changes: 2 additions & 1 deletion subsys/net/ip/net_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,8 @@ static void net_queue_rx(struct net_if *iface, struct net_pkt *pkt)

net_pkt_set_rx_stats_tick(pkt, k_cycle_get_32());

if (NET_TC_RX_COUNT == 0) {
if ((IS_ENABLED(CONFIG_NET_TC_RX_SKIP_FOR_HIGH_PRIO) &&
prio >= NET_PRIORITY_CA) || NET_TC_RX_COUNT == 0) {
net_process_rx_packet(pkt);
} else {
if (net_tc_submit_to_rx_queue(tc, pkt) != NET_OK) {
Expand Down
6 changes: 4 additions & 2 deletions subsys/net/ip/net_tc.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ LOG_MODULE_REGISTER(net_tc, CONFIG_NET_TC_LOG_LEVEL);
#include "net_stats.h"
#include "net_tc_mapping.h"

#define TC_RX_PSEUDO_QUEUE (COND_CODE_1(CONFIG_NET_TC_SKIP_FOR_HIGH_PRIO, (1), (0)))
#define NET_TC_RX_EFFECTIVE_COUNT (NET_TC_RX_COUNT + TC_RX_PSEUDO_QUEUE)

#if NET_TC_RX_COUNT > 0
#define NET_TC_RX_SLOTS (CONFIG_NET_PKT_RX_COUNT / NET_TC_RX_COUNT)
#if NET_TC_RX_EFFECTIVE_COUNT > 0
#define NET_TC_RX_SLOTS (CONFIG_NET_PKT_RX_COUNT / NET_TC_RX_EFFECTIVE_COUNT)
#else
#define NET_TC_RX_SLOTS (CONFIG_NET_PKT_RX_COUNT)
#endif
Expand Down

0 comments on commit 8cc6d69

Please sign in to comment.