Skip to content

Commit 869cfb8

Browse files
jukkarnashif
authored andcommitted
samples: net: pkt_filter: Disabling packet priorities by default
The packet priority support is disabled by default so that the application can work "normally" as a sample for trying network packet filtering. Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
1 parent 47941a6 commit 869cfb8

File tree

5 files changed

+37
-17
lines changed

5 files changed

+37
-17
lines changed

samples/net/pkt_filter/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,13 @@
33
# Copyright (c) 2025 Nordic Semiconductor ASA
44
# SPDX-License-Identifier: Apache-2.0
55

6+
mainmenu "Networking pkt_filter sample application"
7+
8+
config NET_SAMPLE_USE_PACKET_PRIORITIES
9+
bool "Use network packet priorities"
10+
help
11+
Create multiple traffic class queues in order to test
12+
network packet priorities.
13+
614
source "samples/net/common/Kconfig"
715
source "Kconfig.zephyr"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Enable network packet priority support in the sample
2+
CONFIG_NET_SAMPLE_USE_PACKET_PRIORITIES=y
3+
CONFIG_NET_TC_RX_COUNT=2
4+
CONFIG_NET_TC_RX_SKIP_FOR_HIGH_PRIO=y

samples/net/pkt_filter/prj.conf

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,4 @@ CONFIG_NET_IF_MAX_IPV6_COUNT=3
6262

6363
# Network traffic class queues
6464
CONFIG_NET_TC_THREAD_PREEMPTIVE=y
65-
CONFIG_NET_TC_RX_COUNT=2
66-
CONFIG_NET_TC_RX_SKIP_FOR_HIGH_PRIO=y
65+
CONFIG_NET_TC_RX_COUNT=1

samples/net/pkt_filter/sample.yaml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
sample:
22
description: Network packet filtering functionality
33
name: Network packet filter sample app
4+
common:
5+
harness: net
6+
min_ram: 64
7+
tags:
8+
- net
9+
- statistics
10+
- net_pkt_filter
11+
depends_on: netif
12+
integration_platforms:
13+
- native_sim
414
tests:
5-
sample.net.pkt_filter:
6-
harness: net
7-
min_ram: 64
8-
tags:
9-
- net
10-
- statistics
11-
- net_pkt_filter
12-
depends_on: netif
13-
integration_platforms:
14-
- native_sim
15+
sample.net.pkt_filter: {}
16+
sample.net.pkt_filter_priorities:
17+
extra_args: EXTRA_CONF_FILE="overlay-priority.conf"

samples/net/pkt_filter/src/main.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,17 @@ static void init_app(void)
148148
* First append the priority rules, so that they get evaluated before
149149
* deciding on the final verdict for the packet.
150150
*/
151-
npf_append_recv_rule(&eth_priority_default);
152-
npf_append_recv_rule(&eth_priority_ptp);
153-
npf_append_recv_rule(&eth_priority_vlan);
154-
npf_append_recv_rule(&arp_priority_vlan1);
155-
npf_append_recv_rule(&arp_priority_vlan2);
151+
if (IS_ENABLED(CONFIG_NET_SAMPLE_USE_PACKET_PRIORITIES)) {
152+
LOG_INF("Using packet priorities");
153+
154+
npf_append_recv_rule(&eth_priority_default);
155+
npf_append_recv_rule(&eth_priority_ptp);
156+
npf_append_recv_rule(&eth_priority_vlan);
157+
npf_append_recv_rule(&arp_priority_vlan1);
158+
npf_append_recv_rule(&arp_priority_vlan2);
159+
} else {
160+
LOG_INF("Packet priorities are disabled");
161+
}
156162

157163
/* We allow small IPv4 packets to the VLAN interface 1 */
158164
npf_append_recv_rule(&small_ipv4_pkt);

0 commit comments

Comments
 (0)