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