tools/testing/selftests/drivers/net/hw/hw_stats_l3_gre.sh

Source file repositories/reference/linux-study-clean/tools/testing/selftests/drivers/net/hw/hw_stats_l3_gre.sh

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/drivers/net/hw/hw_stats_l3_gre.sh
Extension
.sh
Size
1869 bytes
Lines
112
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

# Test L3 stats on IP-in-IP GRE tunnel without key.

# This test uses flat topology for IP tunneling tests. See ipip_lib.sh for more
# details.

ALL_TESTS="
	ping_ipv4
	test_stats_rx
	test_stats_tx
"
NUM_NETIFS=6
lib_dir=$(dirname "$0")
source "$lib_dir"/../../../net/forwarding/lib.sh
source "$lib_dir"/../../../net/forwarding/ipip_lib.sh
source "$lib_dir"/../../../net/forwarding/tc_common.sh

setup_prepare()
{
	h1=${NETIFS[p1]}
	ol1=${NETIFS[p2]}

	ul1=${NETIFS[p3]}
	ul2=${NETIFS[p4]}

	ol2=${NETIFS[p5]}
	h2=${NETIFS[p6]}

	ol1mac=$(mac_get $ol1)

	forwarding_enable
	vrf_prepare
	h1_create
	h2_create
	sw1_flat_create gre $ol1 $ul1
	sw2_flat_create gre $ol2 $ul2
	ip stats set dev g1a l3_stats on
	ip stats set dev g2a l3_stats on
}

cleanup()
{
	pre_cleanup

	ip stats set dev g1a l3_stats off
	ip stats set dev g2a l3_stats off

	sw2_flat_destroy $ol2 $ul2
	sw1_flat_destroy $ol1 $ul1
	h2_destroy
	h1_destroy

	vrf_cleanup
	forwarding_restore
}

ping_ipv4()
{
	RET=0

	ping_test $h1 192.0.2.18 " gre flat"
}

send_packets_ipv4()
{
	# Send 21 packets instead of 20, because the first one might trap and go
	# through the SW datapath, which might not bump the HW counter.
	$MZ $h1 -c 21 -d 20msec -p 100 \

Annotation

Implementation Notes