def __init__(self, latency, limit=1000, loss=0, gap=0, duplicate=0, jitter=0): """Latency is in microseconds [us]""" latency_ticks = nl_us2ticks(latency) jitter_ticks = nl_us2ticks(jitter) data = self.data_format.pack(latency_ticks, limit, loss, gap, duplicate, jitter_ticks) Attr.__init__(self, TCA_OPTIONS, data)
def __init__(self, rate, ceil=0, mtu=1600, quantum=0, prio=0): """ rate, ceil, mtu: bytes """ if not ceil: ceil = rate r = self.tc_ratespec.pack(3, 0, -1, 0, rate) c = self.tc_ratespec.pack(3, 0, -1, 0, ceil) hz = os.sysconf('SC_CLK_TCK') buffer = tc_calc_xmittime(rate, (rate / hz) + mtu) cbuffer = tc_calc_xmittime(ceil, (rate / hz) + mtu) t = self.tc_htb_opt.pack(buffer, cbuffer, quantum, 0, prio) data = r + c + t Attr.__init__(self, TCA_HTB_PARMS, data)
def __init__(self, bands=3, priomap="1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1"): pm = [ int(p) for p in priomap.split() ] data = self.data_format.pack(bands, *pm) Attr.__init__(self, TCA_OPTIONS, data)
def __init__(self, bands=3, priomap="1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1"): pm = [int(p) for p in priomap.split()] data = self.data_format.pack(bands, *pm) Attr.__init__(self, TCA_OPTIONS, data)
def __init__(self, rate, mtu, cell_log=3): rtab = tc_calc_rtable(rate, cell_log, mtu) data = self.data_format.pack(*rtab) Attr.__init__(self, TCA_HTB_CTAB, data)
def __init__(self, defcls, r2q=10): data = self.data_format.pack(0x20018, 3, r2q, defcls, 0, 0) Attr.__init__(self, TCA_OPTIONS, data)