• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0-or-later
3# Copyright (c) 2016-2020 Oracle and/or its affiliates. All Rights Reserved.
4#
5# Author: Alexey Kodanev <alexey.kodanev@oracle.com>
6
7TST_TEST_DATA="udp udp_lite"
8
9cleanup()
10{
11	[ -n "$busy_poll_old" ] && \
12		sysctl -q -w net.core.busy_poll=$busy_poll_old
13	[ -n "$rbusy_poll_old" ] && \
14		tst_rhost_run -c "sysctl -q -w net.core.busy_poll=$rbusy_poll_old"
15}
16
17set_busy_poll()
18{
19	local value=${1:-"0"}
20	tst_set_sysctl net.core.busy_poll $value safe
21}
22
23setup()
24{
25	busy_poll_check_config
26
27	busy_poll_old="$(sysctl -n net.core.busy_poll)"
28	rbusy_poll_old=$(tst_rhost_run -c 'sysctl -ne net.core.busy_poll')
29}
30
31test()
32{
33	for x in 50 0; do
34		tst_res TINFO "set low latency busy poll to $x per $2 socket"
35		set_busy_poll $x
36		tst_netload -H $(tst_ipaddr rhost) -n 10 -N 10 -d res_$x \
37			    -b $x -T $2
38	done
39
40	tst_netload_compare $(cat res_0) $(cat res_50) 1
41}
42
43. busy_poll_lib.sh
44tst_run
45