tools/testing/selftests/net/forwarding/skbedit_priority.sh

Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/forwarding/skbedit_priority.sh

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/net/forwarding/skbedit_priority.sh
Extension
.sh
Size
3960 bytes
Lines
173
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: tools
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

#!/bin/bash
# SPDX-License-Identifier: GPL-2.0

# This test sends traffic from H1 to H2. Either on ingress of $swp1, or on
# egress of $swp2, the traffic is acted upon by an action skbedit priority. The
# new priority should be taken into account when classifying traffic on the PRIO
# qdisc at $swp2. The test verifies that for different priority values, the
# traffic ends up in expected PRIO band.
#
# +----------------------+                             +----------------------+
# | H1                   |                             |                   H2 |
# |    + $h1             |                             |            $h2 +     |
# |    | 192.0.2.1/28    |                             |   192.0.2.2/28 |     |
# +----|-----------------+                             +----------------|-----+
#      |                                                                |
# +----|----------------------------------------------------------------|-----+
# | SW |                                                                |     |
# |  +-|----------------------------------------------------------------|-+   |
# |  | + $swp1                       BR                           $swp2 + |   |
# |  |                                                             PRIO   |   |
# |  +--------------------------------------------------------------------+   |
# +---------------------------------------------------------------------------+

ALL_TESTS="
	ping_ipv4
	test_ingress
	test_egress
"

NUM_NETIFS=4
source lib.sh

: ${HIT_TIMEOUT:=2000} # ms

h1_create()
{
	simple_if_init $h1 192.0.2.1/28
}

h1_destroy()
{
	simple_if_fini $h1 192.0.2.1/28
}

h2_create()
{
	simple_if_init $h2 192.0.2.2/28
}

h2_destroy()
{
	simple_if_fini $h2 192.0.2.2/28
}

switch_create()
{
	ip link add name br1 type bridge vlan_filtering 1
	ip link set dev br1 addrgenmode none
	ip link set dev br1 up
	ip link set dev $swp1 master br1
	ip link set dev $swp1 up
	ip link set dev $swp2 master br1
	ip link set dev $swp2 up

	tc qdisc add dev $swp1 clsact
	tc qdisc add dev $swp2 clsact
	tc qdisc add dev $swp2 root handle 10: \
	   prio bands 8 priomap 7 6 5 4 3 2 1 0
}

Annotation

Implementation Notes