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

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

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/net/forwarding/sch_red.sh
Extension
.sh
Size
11285 bytes
Lines
461
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 one stream of traffic from H1 through a TBF shaper, to a RED
# within TBF shaper on $swp3. The two shapers have the same configuration, and
# thus the resulting stream should fill all available bandwidth on the latter
# shaper. A second stream is sent from H2 also via $swp3, and used to inject
# additional traffic. Since all available bandwidth is taken, this traffic has
# to go to backlog.
#
# +--------------------------+                     +--------------------------+
# | H1                       |                     | H2                       |
# |     + $h1                |                     |     + $h2                |
# |     | 192.0.2.1/28       |                     |     | 192.0.2.2/28       |
# |     | TBF 10Mbps         |                     |     |                    |
# +-----|--------------------+                     +-----|--------------------+
#       |                                                |
# +-----|------------------------------------------------|--------------------+
# | SW  |                                                |                    |
# |  +--|------------------------------------------------|----------------+   |
# |  |  + $swp1                                          + $swp2          |   |
# |  |                               BR                                   |   |
# |  |                                                                    |   |
# |  |                                + $swp3                             |   |
# |  |                                | TBF 10Mbps / RED                  |   |
# |  +--------------------------------|-----------------------------------+   |
# |                                   |                                       |
# +-----------------------------------|---------------------------------------+
#                                     |
#                               +-----|--------------------+
#			        | H3  |                    |
#			        |     + $h1                |
#			        |       192.0.2.3/28       |
#			        |                          |
#			        +--------------------------+

ALL_TESTS="
	ping_ipv4
	ecn_test
	ecn_nodrop_test
	red_test
	red_qevent_test
	ecn_qevent_test
"

NUM_NETIFS=6
CHECK_TC="yes"
source lib.sh

BACKLOG=30000
PKTSZ=1400

h1_create()
{
	adf_simple_if_init $h1 192.0.2.1/28

	mtu_set $h1 10000
	defer mtu_restore $h1

	tc qdisc replace dev $h1 root handle 1: tbf \
	   rate 10Mbit burst 10K limit 1M
	defer tc qdisc del dev $h1 root
}

h2_create()
{
	adf_simple_if_init $h2 192.0.2.2/28

	mtu_set $h2 10000
	defer mtu_restore $h2

Annotation

Implementation Notes