busy_poll_lib.sh 926 B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/sh
  2. # SPDX-License-Identifier: GPL-2.0-or-later
  3. # Copyright (c) 2016-2018 Oracle and/or its affiliates. All Rights Reserved.
  4. TST_SETUP="setup"
  5. TST_TESTFUNC="test"
  6. TST_CLEANUP="cleanup"
  7. TST_MIN_KVER="3.11"
  8. TST_NEEDS_TMPDIR=1
  9. TST_NEEDS_ROOT=1
  10. TST_NEEDS_CMDS="pkill sysctl ethtool"
  11. # for more stable results set to a single thread
  12. TST_NETLOAD_CLN_NUMBER=1
  13. . tst_net.sh
  14. busy_poll_check_config()
  15. {
  16. if [ ! -f "/proc/sys/net/core/busy_read" -a \
  17. ! -f "/proc/sys/net/core/busy_poll" ]; then
  18. tst_brk TCONF "busy poll not configured, CONFIG_NET_RX_BUSY_POLL"
  19. fi
  20. if tst_kvcmp -lt "4.5"; then
  21. ethtool --show-features $(tst_iface) | \
  22. grep -q 'busy-poll.*on' || \
  23. tst_brk TCONF "busy poll not supported by driver"
  24. else
  25. drvs="bnx2x|bnxt|cxgb4|enic|benet|ixgbe|ixgbevf|mlx4|mlx5|myri10ge|sfc|virtio"
  26. ethtool -i $(tst_iface) | grep -qE "driver: ($drvs)" || \
  27. tst_brk TCONF "busy poll not supported"
  28. fi
  29. }