Repository navigation
Conversation
391de4a to
09e7ace
Compare
Host-to-switch netem/tbf was installed on the node NIC and replaced the DUT's root qdisc. Keep the old TX meaning: node attachment constraints shape that node's outbound via an IFB on the switch veth ingress. Switch-attachment constraints still shape switch outbound. P2P stays on the node; warn instead of inventing a switch. Switch TC tests use a per-test munet so they do not share leftover interfaces with the module munet. Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
6a4d4af to
758b1e0
Compare
liambrady
left a comment
There was a problem hiding this comment.
I like your changes to TC with the usage of IFBs. I think we need to revisit the to/from config syntax before that portion gets merged, though.
| # Both veth ends live inside the nodes. There is no outside | ||
| # device to own the "link" unless we insert a mid-netns. | ||
| if "physical" not in c1 and not node1.is_vm: | ||
| if Munet._tc_constraints(c1): |
There was a problem hiding this comment.
Why does the usage of _tc_constraints() differ in the host-to-host and host-to-switch cases? Is merging required only in host-to-switch case?
There was a problem hiding this comment.
Never mind. I see that the behavior is corrected in the next commit. It is probably worth cleaning this up to ensure the history clean.
| | | | +--rw burst? number64 | ||
| | | +--rw connections* [to] | ||
| | | +--rw to string | ||
| | | +--rw from? string |
There was a problem hiding this comment.
While I like the idea of configuring egress/ingress link metrics from the same network, I don't think that the definition of a new from leaf is the way to go. Specifically, I would like to strictly adhere to standard YANG for new config, however, your usage of to and from as mutually exclusive key values cannot (to my knowledge) be modelled in YANG.
Furthermore, I don't see how the from can be extended to the config of ingress TC metrics for the typical node connections (which would be a suitable follow up feature). The presence of further config (e.g. hostintf, physical, ip, etc.) wouldn't quite make sense in the from context. (e.g. Why would I be configuring node A's interface from the context of node B?).
I think it makes more sense to wrap the TC metrics in new transmit/receive containers, to specify whether the metrics apply to local egress or ingress traffic. That would make both the direction of the rules clear and prevent conflicts with the usage of to as a key. (Note: the usage of the current TC metrics without the transmit/receive container would continue to have to be supported but should be labelled as deprecated under this approach.)
For example, my vision is:
| | +--rw connections* [to]
| | +--rw to string
| | +--rw name? string
| | +--rw remote-name? string
| | +--rw transmit
| | | +--rw delay? uint64
| | | +--rw jitter? uint64
| | | +--rw jitter-correlation? decimal64
| | | +--rw loss? uint64
| | | +--rw loss-correlation? decimal64
| | | +--rw rate
| | | +--rw rate? number64
| | | +--rw limit? number64
| | | +--rw burst? number64
| | +--rw receive
| | +--rw delay? uint64
| | +--rw jitter? uint64
| | +--rw jitter-correlation? decimal64
| | +--rw loss? uint64
| | +--rw loss-correlation? decimal64
| | +--rw rate
| | +--rw rate? number64
| | +--rw limit? number64
| | +--rw burst? number64
Wrap TC constraints in optional "transmit" and "receive" containers, relative to the owner of the config: the network for network config, the node for node connections. Unwrapped constraints are deprecated and keep meaning transmit. Host-to-switch links shape both directions on the switch port so the DUT keeps its root qdisc: network transmit and node receive toward the node (switch egress), network receive and node transmit from the node (IFB). Node values win. For p2p, a node's receive is applied on the peer's egress. Schema is generated from the YANG in README.org. Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
A network connection's transmit can now list peers, giving traffic from a specific sending node toward that connection's node its own delay/rate/loss. This allows different link quality for each ordered pair of nodes on the same network. Each port of a network that uses peers marks arriving packets with a per-node skb mark. The receiving node's port uses a drr qdisc with one class per peer, selected by fw filter on that mark, and a default class for everything else. Classifying by ingress port rather than MAC keeps this working for VMs, MAC changes, and broadcast/multicast. Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
e16b334 to
19bb492
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #101 +/- ##
==========================================
+ Coverage 60.55% 61.02% +0.47%
==========================================
Files 19 19
Lines 5990 6076 +86
==========================================
+ Hits 3627 3708 +81
- Misses 2363 2368 +5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
liambrady
left a comment
There was a problem hiding this comment.
thanks for the update! I've got a couple more questions that have popped up and that make sense to iron out.
| @@ -3392,10 +3420,41 @@ async def add_native_link(self, node1, node2, c1=None, c2=None): | |||
|
|
|||
| if isinstance(node1, ExternalNetwork): | |||
| pass | |||
There was a problem hiding this comment.
For ExternalNetworks, the node2's constraints should continue be set even when the switch's (node1's) constraints cannot. The removal of this behavior would be a regression.
| oip = other.get_intf_addr(oifname).ip | ||
| await r.async_cmd_raises(f"ping -w1 -c1 {oip}") | ||
| o = await r.async_cmd_raises(f"ping -i.1 -c5 {oip}") | ||
| m = re.search(r"min/avg/max/mdev = ([^/]+)/([^/]+)([^/]+)/([^ ]+) ms", o) |
There was a problem hiding this comment.
minor error: you might be missing a "/" in between regex groups. (e.g. should be r"min/avg/max/mdev = ([^/]+)/([^/]+)/([^/]+)/([^ ]+) ms"?
| if "physical" not in c2 and not node2.is_vm: | ||
| tx = Munet._tc_constraints(c2) | ||
| # Each end's egress carries its own transmit and the peer's | ||
| # receive; the sender's transmit wins on overlapping keys. |
There was a problem hiding this comment.
I wonder if instead of the sender's constrains winning, it instead makes more sense for the two constraints to be composed. e.g. 10% loss on transmit and 20% loss on receiver are both individually applied (with an overall loss of ~28%).
I think composing makes sense especially in the case of fixed rates, where the smallest value should win. e.g. I would expect a transmit rate of 15Mbps and a receive rate at 5Mbps to evaluate to 5Mbps. (Note: I don't think the two rates can be directly combined either, since resolving two combinations of rate/burstiness/limit is unclear).
| peers (list): (mark, constraints) pairs. | ||
| """ | ||
| nsifname = self.get_ns_ifname(ifname) | ||
| self.cmd_raises(f"tc qdisc add dev {nsifname} root handle 1: drr") |
There was a problem hiding this comment.
I am a bit concerned about the introduction of a drr scheduler. While I understand that the introduction of a scheduler is needed to set up filtering, the drr scheduler newly introduces the notion of fairness. Furthermore, the ddr manpage explicitly warns that Attaching non-work-conserving qdiscs like tbf to it does not make sense. Munet's fixed rates are implemented under the hood as tbf, so I am worried about an incompatibility there.
I wonder if it instead makes sense to introduce an htb scheduler at the root and attach the normal tbf and netem queues under it. The downside I see here is that the htb would need to be configured with a default rate that doesn't interfere with the other configured fixed rates. I am open to conversation as to what such a default value should be (maybe 10 or 100Gbps?) and/or whether a value like that should be exposed in the config.
Move bridged TC off the node NIC and add directional and per-peer constraints
Host-to-switch delay/rate/loss used to be installed as the node NIC's root qdisc, replacing whatever the DUT configured. The switch now shapes both directions on its port: netem/tbf on egress for traffic toward the node, and an IFB on ingress for traffic from the node. P2P links keep TC on the node interface.
Constraints can be wrapped in transmit and receive containers, relative to the owner of the config. On a network, transmit is traffic toward the node and receive is traffic from it. On a node connection, transmit is what the node sends and receive is what it receives. Unwrapped constraints still work, are deprecated, and mean transmit. Where network and node values overlap, the node's value wins. For P2P links, a node's receive is applied on the peer's egress.
A network connection's transmit can also list peers, giving traffic from a specific sender toward that node its own constraints. Each port marks incoming packets per sender, and the receiving port classifies on that mark into per-peer drr classes, so this works for VMs and broadcast too.
The YANG, README tree and JSON schema are updated, and there are tests for each case.
Example: