lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201116164503.7dcedcae@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date:   Mon, 16 Nov 2020 16:45:03 -0800
From:   Jakub Kicinski <kuba@...nel.org>
To:     Antonio Cardace <acardace@...hat.com>
Cc:     netdev@...r.kernel.org, "David S . Miller" <davem@...emloft.net>,
        Michal Kubecek <mkubecek@...e.cz>
Subject: Re: [PATCH net-next v3 4/4] selftests: add ring and coalesce
 selftests

On Sat, 14 Nov 2020 00:16:55 +0100 Antonio Cardace wrote:
> Add scripts to test ring and coalesce settings
> of netdevsim.
> 
> Signed-off-by: Antonio Cardace <acardace@...hat.com>

> @@ -0,0 +1,68 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-2.0-only
> +
> +source ethtool-common.sh
> +
> +function get_value {
> +    local key=$1
> +
> +    echo $(ethtool -c $NSIM_NETDEV | \
> +        awk -F':' -v pattern="$key:" '$0 ~ pattern {gsub(/[ \t]/, "", $2); print $2}')
> +}
> +
> +if ! ethtool -h | grep -q coalesce; then
> +    echo "SKIP: No --coalesce support in ethtool"
> +    exit 4

I think the skip exit code for selftests is 2

> +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"
> +)
> +
> +for key in ${!SETTINGS_MAP[@]}; do
> +    query_key=${SETTINGS_MAP[$key]}
> +    value=$((RANDOM % $((2**32-1))))
> +    ethtool -C $NSIM_NETDEV "$key" "$value"
> +    s=$(get_value "$query_key")

It would be better to validate the entire config, not just the most
recently set key. This way we would catch the cases where setting
attr breaks the value of another.

> +    check $? "$s" "$value"
> +done

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ