From 0664442648a8fd3627fc3d72c3bb33155612aadf Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Mon, 19 Sep 2022 18:02:33 +0200 Subject: Add support for txqueuelen --- mknet | 8 +++++--- net.py | 3 +++ topo/1mbps.yml | 1 + topo/with-vdsl.yml | 3 +++ 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/mknet b/mknet index 60f7f74..cc0ad33 100755 --- a/mknet +++ b/mknet @@ -87,21 +87,23 @@ class Bandwidth: class LinkInfo: - def __init__(self, bandwidth, latency, jitter = None, offset = None, limit = None, **kwargs): + def __init__(self, bandwidth, latency, jitter = None, offset = None, limit = None, txqueuelen = None, **kwargs): self.bandwidth = Bandwidth(bandwidth) self.latency = Latency(latency, offset) self.jitter = Latency(jitter or 0) self.limit = limit + self.txqueuelen = txqueuelen def __eq__(self, o): return (isinstance(o, LinkInfo) and o.bandwidth == self.bandwidth and o.latency == self.latency and o.jitter == self.jitter and - o.limit == self.limit) + o.limit == self.limit and + o.txqueuelen == self.txqueuelen) def __str__(self): - return f'LinkInfo{{bw: {self.bandwidth}, latency: {self.latency}, jitter: {self.jitter}, limit: {self.limit}}}' + return f'LinkInfo{{bw: {self.bandwidth}, latency: {self.latency}, jitter: {self.jitter}, limit: {self.limit}, txqueuelen: {self.txqueuelen}}}' class Server: def __init__(self, name, link): diff --git a/net.py b/net.py index f78f7a6..d1fe8e3 100644 --- a/net.py +++ b/net.py @@ -56,6 +56,9 @@ def create_veth(name1, ns1, name2, ns2, ip = None, subnet=0, link=None): run_netns("exec", ns2, "ip", "link", "set", "dev", name2, "up") if link: + if link.txqueuelen: + run_netns("exec", ns1, "ip", "link", "set", "dev", name1, "txqueuelen", str(link.txqueuelen)) + run_netns("exec", ns2, "ip", "link", "set", "dev", name2, "txqueuelen", str(link.txqueuelen)) tc(ns1, name1, link) tc(ns2, name2, link, True) diff --git a/topo/1mbps.yml b/topo/1mbps.yml index 75fdfc2..0508a18 100644 --- a/topo/1mbps.yml +++ b/topo/1mbps.yml @@ -2,6 +2,7 @@ links: - &slow bandwidth: 1M latency: 500us + txqueuelen: 10 - &1000 bandwidth: 1000M latency: 100us diff --git a/topo/with-vdsl.yml b/topo/with-vdsl.yml index 87d167b..a676675 100644 --- a/topo/with-vdsl.yml +++ b/topo/with-vdsl.yml @@ -5,16 +5,19 @@ links: - &1000 bandwidth: 1000M latency: 100us + txqueuelen: 10000 - &vdsl bandwidth: up: 3M down: 55M latency: 50ms jitter: 10ms + txqueuelen: 100 - &fiber bandwidth: 400M latency: 10ms jitter: 3ms + txqueuelen: 1000 zones: - &dc1 -- cgit v1.2.3