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