tools/testing/selftests/drivers/net/netdevsim/ethtool-coalesce.sh

Source file repositories/reference/linux-study-clean/tools/testing/selftests/drivers/net/netdevsim/ethtool-coalesce.sh

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/drivers/net/netdevsim/ethtool-coalesce.sh
Extension
.sh
Size
3267 bytes
Lines
133
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-only

source ethtool-common.sh

function get_value {
    local query="${SETTINGS_MAP[$1]}"

    echo $(ethtool -c $NSIM_NETDEV | \
        awk -F':' -v pattern="$query:" '$0 ~ pattern {gsub(/[ \t]/, "", $2); print $2}')
}

function update_current_settings {
    for key in ${!SETTINGS_MAP[@]}; do
        CURRENT_SETTINGS[$key]=$(get_value $key)
    done
    echo ${CURRENT_SETTINGS[@]}
}

if ! ethtool -h | grep -q coalesce; then
    echo "SKIP: No --coalesce support in ethtool"
    exit 4
fi

NSIM_NETDEV=$(make_netdev)

set -o pipefail

declare -A SETTINGS_MAP=(
    ["rx-frames-low"]="rx-frame-low"
    ["tx-frames-low"]="tx-frame-low"
    ["rx-frames-high"]="rx-frame-high"
    ["tx-frames-high"]="tx-frame-high"
    ["rx-usecs"]="rx-usecs"
    ["rx-frames"]="rx-frames"
    ["rx-usecs-irq"]="rx-usecs-irq"
    ["rx-frames-irq"]="rx-frames-irq"
    ["tx-usecs"]="tx-usecs"
    ["tx-frames"]="tx-frames"
    ["tx-usecs-irq"]="tx-usecs-irq"
    ["tx-frames-irq"]="tx-frames-irq"
    ["stats-block-usecs"]="stats-block-usecs"
    ["pkt-rate-low"]="pkt-rate-low"
    ["rx-usecs-low"]="rx-usecs-low"
    ["tx-usecs-low"]="tx-usecs-low"
    ["pkt-rate-high"]="pkt-rate-high"
    ["rx-usecs-high"]="rx-usecs-high"
    ["tx-usecs-high"]="tx-usecs-high"
    ["sample-interval"]="sample-interval"
)

declare -A CURRENT_SETTINGS=(
    ["rx-frames-low"]=""
    ["tx-frames-low"]=""
    ["rx-frames-high"]=""
    ["tx-frames-high"]=""
    ["rx-usecs"]=""
    ["rx-frames"]=""
    ["rx-usecs-irq"]=""
    ["rx-frames-irq"]=""
    ["tx-usecs"]=""
    ["tx-frames"]=""
    ["tx-usecs-irq"]=""
    ["tx-frames-irq"]=""
    ["stats-block-usecs"]=""
    ["pkt-rate-low"]=""
    ["rx-usecs-low"]=""
    ["tx-usecs-low"]=""
    ["pkt-rate-high"]=""
    ["rx-usecs-high"]=""

Annotation

Implementation Notes