KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache
System : Linux cs317.bluehost.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : andertr9 ( 1047)
PHP Version : 8.2.18
Disable Function : NONE
Directory :  /usr/lib/python2.7/site-packages/tuned/plugins/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyo
�
��\c@s�ddlmZddlTddlZddlmZddlmZddl	Z	ddl
Z
ejj�Z
dZdejfd	��YZdS(
i(tbase(t*i����N(tethcard(tcommandstpumbagsdtNetTuningPlugincBs�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	e
d��Ze
d	��Ze
d
��Z
e
d��Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Ze
d��Zedde�d��Zed�ed��Zed�d��Zed�d��Zd�Zd�Z d�Z!d�Z"d�Z#d*d �Z%d!�Z&e'd"de�d#��Z(e'd$de�d%��Z)e'd&de�d'��Z*e'd(de�d)��Z+RS(+s,
	Plugin for ethernet card options tuning.
	cOs;tt|�j||�d|_d|_t�|_dS(Ng�������?i(tsuperRt__init__t_load_smallestt_level_stepsRt_cmd(tselftargstkwargs((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyRs		cCs�t|_t�|_t�|_tjd�}xB|jjd�D].}|j	|j
�rC|jj|j�qCqCWt
jdt|j��dS(Ns(?!.*/virtual/.*)tnetsdevices: %s(tTruet_devices_supportedtsett
_free_devicest_assigned_devicestretcompilet_hardware_inventorytget_devicestmatchtdevice_pathtaddtsys_nametlogtdebugtstr(Rtre_not_virtualtdevice((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyt
_init_devicess	cCs&g|D]}|jjd|�^qS(NR(Rt
get_device(Rtdevicestx((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyt_get_device_objects$scCs�t|_|j|jd�rXt|_|jjd|j�|_i|_	i|_
n$t|_d|_d|_	d|_
dS(NtdynamicR(
Rt_has_static_tuningt_option_booltoptionst_has_dynamic_tuningt_monitors_repositorytcreatetassigned_devicest
_load_monitort_idlet_statstFalsetNone(Rtinstance((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyt_instance_init's						cCs2|jdk	r.|jj|j�d|_ndS(N(R.R2R+tdelete(RR3((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyt_instance_cleanup4scCs|j||�dS(N(t_instance_update_dynamic(RR3R ((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyt_instance_apply_dynamic9scCs�g|jj|�D]}t|�^q}|dkr;dS||jkr]|j||�n|j|||�|j||�|j|}|j|}|ddkr|d|j	kr|d|j	krd|d<t
jd|�t|�j
d�n^|ddkr_|ddks1|ddkr_d|d<t
jd|�t|�j�nt
jd	||d|df�t
jd
||d|d|df�dS(Ntlevelitreadtwriteis%s: setting 100Mbpsids%s: setting max speeds %s load: read %0.2f, write %0.2fs$%s idle: read %d, write %d, level %d(R.tget_device_loadtintR2R0t_init_stats_and_idlet
_update_statst_update_idleR/R	RtinfoRt	set_speedt
set_max_speedR(RR3R tvaluetloadtstatstidle((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyR7<s&+

6
0
"cCs�idd6dd6dd6dd6dd6dd6dd6dd6dd	6dd
6dd6dd6dd
6dd6dd6dd6dd6dd6dd6dd6dd6dd6S(Nsadaptive-rxsadaptive-txsrx-usecss	rx-framessrx-usecs-irqs
rx-frames-irqstx-usecss	tx-framesstx-usecs-irqs
tx-frames-irqsstats-block-usecsspkt-rate-lowsrx-usecs-lows
rx-frames-lowstx-usecs-lows
tx-frames-lows
pkt-rate-highs
rx-usecs-highsrx-frames-highs
tx-usecs-highstx-frames-highssample-interval(R2(tcls((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyt_get_config_options_coalesceUs.cCsidd6dd6dd6S(Ntautonegtrxttx(R2(RH((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyt_get_config_options_pauseps
cCs idd6dd6dd6dd6S(NRKsrx-minisrx-jumboRL(R2(RH((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyt_get_config_options_ringvs
cCs5itd6dd6dd6dd6dd6dd6dd6S(NR&twake_on_lantnf_conntrack_hashsizetfeaturestcoalescetpausetring(RR2(RH((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyt_get_config_options}scCsm|jt|�j��}iddgd6d|dgd6|j|<idd6dd6dd	6|j|<dS(
NiitnewiitmaxR9R:R;(t_calc_speedRt
get_max_speedR0R/(RR3R t	max_speed((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyR>�s,c
Cs|j|d|j|d<}||j|d<gt||�D]}|d|d^qA}||j|d<|j|d}gt||�D]}t|�^q�}	|	|j|d<t|d�t|	d�|j|d<t|d�t|	d�|j|d	<dS(
NRVtoldiitdiffRWR:iR;(R0tzipRWtfloat(
RR3R tnew_loadtold_loadtnew_oldR\told_max_loadtpairtmax_load((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyR?�s .()cCs`xYddgD]K}|j|||jkrG|j||cd7<q
d|j||<q
WdS(NR:R;ii(R0RR/(RR3R t	operation((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyR@�scCs_||jkr[|j|ddkr[d|j|d<tjd|�t|�j�ndS(NR9is%s: setting max speed(R/RRARRC(RR3R ((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyt_instance_unapply_dynamic�s&cCstd|d�S(Ng333333�?iig333333�@g333333#A(R=(Rtspeed((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyRX�scCs�ttjdd|��j�}t|�}|ddkr^tjd|t|�f�dS|dkrqt�Stt	t
|ddd�|ddd����S(Ns (:\s*)|(\s+)|(\s*;\s*)|(\s*,\s*)t iisinvalid %s parameter: '%s'i(RRtsubtsplittlenRterrorR2tdicttlistR](RRDtcontexttvtlv((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyt_parse_config_parameters�s!cCsT|jjidd6dd6dd6dd6d	d
6dd6d
d6dd6dd6dd6dd6dd6dd6dd6dd6dd 6d!d"6d#d$6|�}g|jd%�D]=}tt|��d&kr�tjd't|��r�|^q�}t|�d(kr�dStgg|d)D]}tjd*t|��^q
D]}t|�d(kr/|^q/�S(+Nsadaptive-rx:sAdaptive RX:s

adaptive-tx:s\s+TX:srx-frames-low:s
rx-frame-low:srx-frames-high:srx-frame-high:stx-frames-low:s
tx-frame-low:stx-frames-high:stx-frame-high:slro:slarge-receive-offload:srx:srx-checksumming:stx:stx-checksumming:ssg:sscatter-gather:stso:stcp-segmentation-offload:sufo:sudp-fragmentation-offload:sgso:sgeneric-segmentation-offload:sgro:sgeneric-receive-offload:srxvlan:srx-vlan-offload:stxvlan:stx-vlan-offload:sntuple:sntuple-filters:srxhash:sreceive-hashing:s
is
\[fixed\]$iis:\s*(	R
tmultiple_re_replaceRjRkRRtsearchR2Rm(RRDRptvltu((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyt_parse_device_parameters�s0	ScCsdS(Ns,/sys/module/nf_conntrack/parameters/hashsize((R((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyt_nf_conntrack_hashsize_path�sROt
per_devicecCs�|dkrdStjddt|��}tjdtd|�sVtjd�dS|s~|jj	dd|d|g�n|S(	Nt0tds^[s]+$sIncorrect 'wake_on_lan' value.tethtools-stwol(
R2RRiRRt
WOL_VALUESRtwarnR
texecute(RRDR tsim((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyt_set_wake_on_lan�s
"cCspd}yRtjdtd|jjd|g�dtj�}|rW|jd�}nWntk
rknX|S(Ns.*Wake-on:\s*([s]+).*R|i(	R2RRR~R
R�tStgrouptIOError(RR tignore_missingRDtm((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyt_get_wake_on_lan�s6
RPcCsV|dkrdSt|�}|dkrN|sJ|jj|j�|�n|SdSdS(Ni(R2R=R
t
write_to_fileRx(RRDR�thashsize((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyt_set_nf_conntrack_hashsizescCs8|jj|j��}t|�dkr4t|�SdS(Ni(R
t	read_fileRxRkR=R2(RRD((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyt_get_nf_conntrack_hashsizes
cCs�|dkrtSt|j��}i|jd6|jd6|jd6}t||�j��}|j|�s�tjd|t	||�f�t
StS(NRQRRRSRTsunknown %s parameter(s): %s(RRtkeysRIRMRNtissubsetRRlRR1(RRoR{tparamstsupported_gettert	supported((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyt_check_parameterss


!cCs�|jjidd6dd6dd6|�}|jd�d}g|D]+}|d	krDtjd
|�rD|^qD}tgg|D]}tjd|�^q�D]}t|�dkr�|^q��S(
NRJt
AutonegotiateRKtRXRLtTXs
its	\[fixed\]s:\s*i(R
RsRjRRtRmRk(RtstlR$((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyt_parse_pause_parameters%s	
8cCs�tjd|dtj�}|d}|jjidd6dd6dd	6d
d6|�}|jd�}g|D]}|d
krl|^ql}gg|D]}tjd|�^q�D]}t|�dkr�|^q�}t|�S(Ns^Current hardware settings:$tflagsiRKR�srx-minisRX Minisrx-jumbosRX JumboRLR�s
R�s:\s*i(RRjt	MULTILINER
RsRkRm(RR�taR�R$((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyt_parse_ring_parameters/s
	
%Jc	Csmt|j��}t|j��}||}x8|D]0}tjd|||f�|j|d�q5WdS(sFilter unsupported parameters and log warnings about it

		Positional parameters:
		context -- context of change
		parameters -- parameters to change
		device -- name of device on which should be parameters set
		dev_params -- dictionary of currently known parameters of device
		s-%s parameter %s is not supported by device %sN(RR�RtwarningtpopR2(	RRot
parametersR t
dev_paramstsupported_parameterstparameters_to_changetunsupported_parameterstparam((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyt_check_device_support<s	
	c
Cs�idd6dd6dd6dd6}||}|jjd	||g�\}}|d
kskt|�d
krodSi|jd6|jd6|jd6|jd6}||}||�}	|dkr�|j||	�r�dS|	S(Ns-cRRs-kRQs-aRSs-gRTR|i(R
R�RkR2RwR�R�R�(
RRoR tcontext2opttopttretRDtcontext2parsertparserR{((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyt_get_device_parametersSs"
!




c	Cs|dkst|�dkr"dS|j||�}|dksS|j||�rWiS|rv|j||||�n|r
t|�dkr
tjd|t|�f�idd6dd6dd6d	d
6}||}|jj	d||g|jj
|�dd
g�n|S(Nissetting %s: %ss-CRRs-KRQs-ARSs-GRTR|t	no_errorsiP(R2RkRrR�R�RRRR
R�t	dict2list(	RRoRDR R�R�R{R�R�((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyt_set_device_parameterscs"
5c
CsH|jd|d|�}|r|j||�}|j||||d|�}t|�dkrdtSg|j�D]$\}	}|	|krq|	|f^qq}
t|
�}
|r�|jj|�|jj|
�k}|j	||||
d|�|S|j
j|dj|jj|
���n(|j
j
|�}|j|||t�dS(Ntcommand_nametdevice_nameR�iR Rh(t_storage_keyR�R�RkR1titemsRmR
R�t_log_verification_resultt_storageRtjointgetR2(
RRotstartRDR tverifytstorage_keytparams_currentt
params_setR�trelevant_params_currenttrestoriginal_value((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyt_custom_parametersvs8						RQcCs|jd||||�S(NRQ(R�(RR�RDR R�R�((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyt	_features�sRRcCs|jd||||�S(NRR(R�(RR�RDR R�R�((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyt	_coalesce�sRScCs|jd||||�S(NRS(R�(RR�RDR R�R�((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyt_pause�sRTcCs|jd||||�S(NRT(R�(RR�RDR R�R�((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyt_ring�sN(,t__name__t
__module__t__doc__RR!R%R4R6R8R7tclassmethodRIRMRNRUR>R?R@RfRXRrRwRxtcommand_setRR�tcommand_getR1R�R�R�R�R�R�R�R�R2R�R�tcommand_customR�R�R�R�(((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyR
sH				
										
	 	

		
	
			$(R�Rt
decoratorst
tuned.logsttunedttuned.utils.nettoolRttuned.utils.commandsRtosRtlogsR�RR~tPluginR(((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_net.pyt<module>s


Anon7 - 2021