Skip to content

Commit 565a489

Browse files
rlubosfabiobaltieri
authored andcommitted
net: tc: Ensure TC queueing works from ISR
Queueing packets should be possible from the ISR context, recent changes prevented that. Therefore add extra checks in net_tc_submit_to_tx/rx_queue() to make them ISR friendly again. Signed-off-by: Robert Lubos <[email protected]>
1 parent e7be6d0 commit 565a489

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

subsys/net/ip/net_tc.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ enum net_verdict net_tc_submit_to_tx_queue(uint8_t tc, struct net_pkt *pkt)
7171
net_pkt_set_tx_stats_tick(pkt, k_cycle_get_32());
7272

7373
#if NET_TC_TX_EFFECTIVE_COUNT > 1
74-
if (k_sem_take(&tx_classes[tc].fifo_slot, K_FOREVER) != 0) {
74+
k_timeout_t timeout = k_is_in_isr() ? K_NO_WAIT : K_FOREVER;
75+
76+
if (k_sem_take(&tx_classes[tc].fifo_slot, timeout) != 0) {
7577
return NET_DROP;
7678
}
7779
#endif
@@ -95,7 +97,7 @@ enum net_verdict net_tc_submit_to_rx_queue(uint8_t tc, struct net_pkt *pkt)
9597

9698
#if NET_TC_RX_EFFECTIVE_COUNT > 1
9799
while (k_sem_take(&rx_classes[tc].fifo_slot, K_NO_WAIT) != 0) {
98-
if (retry_cnt == 0) {
100+
if (k_is_in_isr() || retry_cnt == 0) {
99101
return NET_DROP;
100102
}
101103

0 commit comments

Comments
 (0)