3
À<×eÔZ ã @ sp d dl Z ddlmZ ddlT d dlZd dlmZ d dlm Z d dl
Z
d dlZejj
ƒ ZdZG dd „ d ejƒZdS )
é Né )Úhotplug)Ú*)Úethcard)ÚcommandsZpumbagsdc s. e Zd ZdZ‡ fdd„Zdd„ Zdd„ Zdd „ Zd
d„ Zdd
„ Z dd„ Z
edd„ ƒZedd„ ƒZ
edd„ ƒZedd„ ƒZedd„ ƒZdd„ Zdd„ Zdd„ Zd d!„ Zd"d#„ Zd$d%„ Zd&d'„ Zed(d)„ ƒZed*d+d,�d-d.„ ƒZed*ƒdid0d1„ƒZed2ƒd3d4„ ƒZed2ƒd5d6„ ƒZg fd7d8„Zdjd:d;„Z ed„ ƒZ!d?d@„ Z"ed<ƒdkdAdB„ƒZ#edCd+d,�dDdE„ ƒZ$edCƒdldFdG„ƒZ%dHdI„ Z&dJdK„ Z'dLdM„ Z(dNdO„ Z)dPdQ„ Z*dRdS„ Z+dTdU„ Z,dmdVdW„Z-dXdY„ Z.e/dZd+d,�d[d\„ ƒZ0e/d]d+d,�d^d_„ ƒZ1e/d`d+d,�dadb„ ƒZ2e/dcd+d,�ddde„ ƒZ3e/dfd+d,�dgdh„ ƒZ4‡ Z5S )nÚNetTuningPluginaç
`net`::
Configures network driver, hardware and Netfilter settings.
Dynamic change of the interface speed according to the interface
utilization is also supported. The dynamic tuning is controlled by
the [option]`dynamic` and the global [option]`dynamic_tuning`
option in `tuned-main.conf`.
+
The [option]`wake_on_lan` option sets wake-on-lan to the specified
value as when using the `ethtool` utility.
+
.Set Wake-on-LAN for device eth0 on MagicPacket(TM)
====
----
[net]
devices=eth0
wake_on_lan=g
----
====
+
The [option]`coalesce` option allows changing coalescing settings
for the specified network devices. The syntax is:
+
[subs="+quotes,+macros"]
----
coalesce=__param1__ __value1__ __param2__ __value2__ ... __paramN__ __valueN__
----
Note that not all the coalescing parameters are supported by all
network cards. For the list of coalescing parameters of your network
device, use `ethtool -c device`.
+
.Setting coalescing parameters rx/tx-usecs for all network devices
====
----
[net]
coalesce=rx-usecs 3 tx-usecs 16
----
====
+
The [option]`features` option allows changing
the offload parameters and other features for the specified
network devices. To query the features of your network device,
use `ethtool -k device`. The syntax of the option is the same as
the [option]`coalesce` option.
+
.Turn off TX checksumming, generic segmentation and receive offload
====
----
[net]
features=tx off gso off gro off
----
====
The [option]`pause` option allows changing the pause parameters for
the specified network devices. To query the pause parameters of your
network device, use `ethtool -a device`. The syntax of the option
is the same as the [option]`coalesce` option.
+
.Disable autonegotiation
====
----
[net]
pause=autoneg off
----
====
+
The [option]`ring` option allows changing the rx/tx ring parameters
for the specified network devices. To query the ring parameters of your
network device, use `ethtool -g device`. The syntax of the option
is the same as the [option]`coalesce` option.
+
.Change the number of ring entries for the Rx/Tx rings to 1024/512 respectively
=====
-----
[net]
ring=rx 1024 tx 512
-----
=====
+
The [option]`channels` option allows changing the numbers of channels
for the specified network device. A channel is an IRQ and the set
of queues that can trigger that IRQ. To query the channels parameters of your
network device, use `ethtool -l device`. The syntax of the option
is the same as the [option]`coalesce` option.
+
.Set the number of multi-purpose channels to 16
=====
-----
[net]
channels=combined 16
-----
=====
+
A network device either supports rx/tx or combined queue
mode. The [option]`channels` option automatically adjusts the
parameters based on the mode supported by the device as long as a
valid configuration is requested.
+
The [option]`nf_conntrack_hashsize` option sets the size of the hash
table which stores lists of conntrack entries by writing to
`/sys/module/nf_conntrack/parameters/hashsize`.
+
.Adjust the size of the conntrack hash table
====
----
[net]
nf_conntrack_hashsize=131072
----
====
+
The [option]`txqueuelen` option allows changing txqueuelen (the length
of the transmit queue). It uses `ip` utility that is in package iproute
recommended for TuneD, so the package needs to be installed for its correct
functionality. To query the txqueuelen parameters of your network device
use `ip link show` and the current value is shown after the qlen column.
+
.Adjust the length of the transmit queue
====
----
[net]
txqueuelen=5000
----
====
+
The [option]`mtu` option allows changing MTU (Maximum Transmission Unit).
It uses `ip` utility that is in package iproute recommended for TuneD, so
the package needs to be installed for its correct functionality. To query
the MTU parameters of your network device use `ip link show` and the
current value is shown after the MTU column.
+
.Adjust the size of the MTU
====
----
[net]
mtu=9000
----
====
c s6 t t| ƒj||Ž d| _d| _tƒ | _i | _d| _d S )Ngš™™™™™©?é T) Úsuperr Ú__init__Ú_load_smallestÚ_level_stepsr Ú_cmdÚ_re_ip_link_showÚ_use_ip)ÚselfÚargsÚkwargs)Ú __class__© ú /usr/lib/python3.6/plugin_net.pyr
š s zNetTuningPlugin.__init__c C sh d| _ tƒ | _tƒ | _tjdƒ}x.| jjdƒD ]}|j|j ƒr.| jj
|jƒ q.W tj
dt| jƒ ƒ d S )NTz(?!.*/virtual/.*)Únetzdevices: %s)Z_devices_supportedÚsetZ
_free_devicesZ_assigned_devicesÚreÚcompileÚ_hardware_inventoryZget_devicesÚmatchZdevice_pathÚaddZsys_nameÚlogÚdebugÚstr)r Zre_not_virtualÚdevicer r r Ú
_init_devices¢ s
zNetTuningPlugin._init_devicesc s ‡ fdd„|D ƒS )Nc s g | ]}ˆ j jd |ƒ‘qS )r )r Z
get_device)Ú.0Úx)r r r ú
¯ s z7NetTuningPlugin._get_device_objects..r )r Zdevicesr )r r Ú_get_device_objects® s z#NetTuningPlugin._get_device_objectsc C sX d|_ | j|jd ƒr