/opt/imh-python/lib/python3.9/site-packages/pyroute2/netlink/rtnl/tcmsg
NameSizeModeActions
__pycache__/-0755rm
act_bpf.py9790644editdlrm
act_connmark.py12340644editdlrm
act_gact.py7090644editdlrm
act_mirred.py17250644editdlrm
act_police.py18660644editdlrm
act_skbedit.py33370644editdlrm
act_vlan.py14650644editdlrm
cls_basic.py84780644editdlrm
cls_flow.py46130644editdlrm
cls_fw.py14270644editdlrm
cls_matchall.py9860644editdlrm
cls_u32.py80340644editdlrm
common.py107280644editdlrm
common_act.py20630644editdlrm
common_ematch.py31480644editdlrm
em_cmp.py27760644editdlrm
em_ipset.py17410644editdlrm
em_meta.py59330644editdlrm
sched_bpf.py25710644editdlrm
sched_cake.py128330644editdlrm
sched_choke.py34320644editdlrm
sched_clsact.py10110644editdlrm
sched_codel.py16070644editdlrm
sched_drr.py7550644editdlrm
sched_fq_codel.py26580644editdlrm
sched_hfsc.py23530644editdlrm
sched_htb.py57390644editdlrm
sched_ingress.py2140644editdlrm
sched_netem.py51420644editdlrm
sched_pfifo.py1960644editdlrm
sched_pfifo_fast.py2150644editdlrm
sched_plug.py4460644editdlrm
sched_sfq.py27170644editdlrm
sched_tbf.py10870644editdlrm
sched_template.py12500644editdlrm
__init__.py27430644editdlrm
Edit: /opt/imh-python/lib/python3.9/site-packages/pyroute2/netlink/rtnl/tcmsg/sched_sfq.py (2717B)
from pyroute2.netlink import nla from pyroute2.netlink.rtnl import TC_H_ROOT from pyroute2.netlink.rtnl.tcmsg.common import ( get_size, red_eval_ewma, red_eval_P, ) parent = TC_H_ROOT TC_RED_ECN = 1 TC_RED_HARDDROP = 2 TC_RED_ADAPTATIVE = 4 def get_parameters(kwarg): kwarg['quantum'] = get_size(kwarg.get('quantum', 0)) kwarg['perturb_period'] = kwarg.get('perturb', 0) or kwarg.get( 'perturb_period', 0 ) limit = kwarg['limit'] = kwarg.get('limit', 0) or kwarg.get( 'redflowlimit', 0 ) qth_min = kwarg.get('min', 0) qth_max = kwarg.get('max', 0) avpkt = kwarg.get('avpkt', 1000) probability = kwarg.get('probability', 0.02) ecn = kwarg.get('ecn', False) harddrop = kwarg.get('harddrop', False) kwarg['flags'] = kwarg.get('flags', 0) if ecn: kwarg['flags'] |= TC_RED_ECN if harddrop: kwarg['flags'] |= TC_RED_HARDDROP if kwarg.get('redflowlimit'): qth_max = qth_max or limit / 4 qth_min = qth_min or qth_max / 3 kwarg['burst'] = kwarg['burst'] or (2 * qth_min + qth_max) / ( 3 * avpkt ) if limit <= qth_max: raise ValueError('limit must be > qth_max') if qth_max <= qth_min: raise ValueError('qth_max must be > qth_min') kwarg['qth_min'] = qth_min kwarg['qth_max'] = qth_max kwarg['Wlog'] = red_eval_ewma(qth_min, kwarg['burst'], avpkt) kwarg['Plog'] = red_eval_P(qth_min, qth_max, probability) if kwarg['Wlog'] < 0: raise ValueError('Wlog must be > 0') if kwarg['Plog'] < 0: raise ValueError('Plog must be > 0') kwarg['max_P'] = int(probability * pow(2, 23)) return kwarg class options_sfq_v0(nla): fields = ( ('quantum', 'I'), ('perturb_period', 'i'), ('limit', 'I'), ('divisor', 'I'), ('flows', 'I'), ) class options_sfq_v1(nla): fields = ( ('quantum', 'I'), ('perturb_period', 'i'), ('limit_v0', 'I'), ('divisor', 'I'), ('flows', 'I'), ('depth', 'I'), ('headdrop', 'I'), ('limit_v1', 'I'), ('qth_min', 'I'), ('qth_max', 'I'), ('Wlog', 'B'), ('Plog', 'B'), ('Scell_log', 'B'), ('flags', 'B'), ('max_P', 'I'), ('prob_drop', 'I'), ('forced_drop', 'I'), ('prob_mark', 'I'), ('forced_mark', 'I'), ('prob_mark_head', 'I'), ('forced_mark_head', 'I'), ) def options(*argv, **kwarg): if kwarg.get('length', 0) >= options_sfq_v1.get_size(): return options_sfq_v1 else: return options_sfq_v0