xref: /aosp_15_r20/external/ltp/testcases/network/busy_poll/busy_poll_lib.sh (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
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
5TST_SETUP="setup"
6TST_TESTFUNC="test"
7TST_CLEANUP="cleanup"
8TST_MIN_KVER="3.11"
9TST_NEEDS_TMPDIR=1
10TST_NEEDS_ROOT=1
11TST_NEEDS_CMDS="pkill sysctl ethtool"
12# for more stable results set to a single thread
13TST_NETLOAD_CLN_NUMBER=1
14
15busy_poll_check_config()
16{
17	if [ ! -f "/proc/sys/net/core/busy_read" -a \
18	     ! -f "/proc/sys/net/core/busy_poll" ]; then
19		tst_brk TCONF "busy poll not configured, CONFIG_NET_RX_BUSY_POLL"
20	fi
21
22	if tst_kvcmp -lt "4.5"; then
23		ethtool --show-features $(tst_iface) | \
24			grep -q 'busy-poll.*on' || \
25			tst_brk TCONF "busy poll not supported by driver"
26	fi
27}
28
29. tst_net.sh
30