-
Notifications
You must be signed in to change notification settings - Fork 202
/
setup-nic
executable file
·73 lines (59 loc) · 1.56 KB
/
setup-nic
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/sh -e
# - dev
# - flow_control
# - int_coalescence
# - rx_usec
# - rx_framesz
# - tx_usec
# - tx_framesz
# - rx_backlog
# - rx_ringbuf
# - tx_ringbuf
# - tx_tso
# - maxconn
. $LKP_SRC/lib/env.sh
. $LKP_SRC/lib/reproduce-log.sh
. $LKP_SRC/lib/common.sh
. $LKP_SRC/lib/unit.sh
. $LKP_SRC/lib/debug.sh
#default:
#rx_usec=16
#rx_framesz=44
#tx_usec=16
#tx_framesz=44
#rx_backlog=1000
#rx_ringbuf=8192
#tx_ringbuf=8192
#maxconn=128
[ -n "$dev" ] || exit 0
if [ -n "$int_coalescence" ]; then
# Some NICs(X710 series) require to disable the
# adaptive rx/tx before changing any values.
ethtool -C $dev adaptive-rx off
ethtool -C $dev adaptive-tx off
fi
[ -n "$rx_usec" -a "$rx_usec" != 0 ] && ethtool -C $dev rx-usecs $rx_usec
[ -n "$tx_usec" -a "$tx_usec" != 0 ] && ethtool -C $dev tx-usecs $tx_usec
[ -n "$rx_framesz" -a "$rx_framesz" != 0 ] && ethtool -C $dev rx-framesz $rx_framesz
[ -n "$tx_framesz" -a "$tx_framesz" != 0 ] && ethtool -C $dev tx-framesz $tx_framesz
if [ -n "$int_coalescence" ]; then
ethtool -C $dev adaptive-rx on
ethtool -C $dev adaptive-tx on
fi
if [ -n "$flow_control" ]; then
ethtool -A $dev rx on
ethtool -A $dev tx on
fi
if [ -n "$rx_backlog" -a "$rx_backlog" != 0 ]; then
echo $rx_backlog > /proc/sys/net/core/netdev_max_backlog
fi
if [ -n "$rx_ringbuf" -a "$rx_ringbuf" != 0 ] &&
[ -n "$tx_ringbuf" -a "$tx_ringbuf" != 0 ]; then
ethtool -G $dev rx $rx_ringbuf tx $tx_ringbuf
fi
if [ -n "$tso" ]; then
ethtool -K $dev tso on
fi
if [ -n "$maxconn" -a "$maxconn" != 0 ]; then
echo $maxconn > /proc/sys/net/core/somaxconn
fi