xref: /linux/tools/testing/selftests/drivers/net/netdevsim/ethtool-features.sh (revision fcc79e1714e8c2b8e216dc3149812edd37884eef)
1#!/bin/bash
2# SPDX-License-Identifier: GPL-2.0-only
3
4source ethtool-common.sh
5
6NSIM_NETDEV=$(make_netdev)
7
8set -o pipefail
9
10FEATS="
11  tx-checksum-ip-generic
12  tx-scatter-gather
13  tx-tcp-segmentation
14  generic-segmentation-offload
15  generic-receive-offload"
16
17for feat in $FEATS ; do
18    s=$(ethtool --json -k $NSIM_NETDEV | jq ".[].\"$feat\".active" 2>/dev/null)
19    check $? "$s" true
20
21    s=$(ethtool --json -k $NSIM_NETDEV | jq ".[].\"$feat\".fixed" 2>/dev/null)
22    check $? "$s" false
23done
24
25if [ $num_errors -eq 0 ]; then
26    echo "PASSED all $((num_passes)) checks"
27    exit 0
28else
29    echo "FAILED $num_errors/$((num_errors+num_passes)) checks"
30    exit 1
31fi
32