sflow / vpp-sflow

sFlow plugin for VPP
Apache License 2.0
6 stars 0 forks source link

When a bond is configured in VPP #13

Open sflow opened 1 month ago

sflow commented 1 month ago

The sFlow data model includes information about which interfaces are combined in a bond/LAG/PortChannel (mostly because the collector may need to know this in order to resolve the end-to-end traffic matrix correctly, which is fundamental). So at some point we should consider how to propagate this information to hsflowd. All we need to do is tell hsflowd that port X is just a component of bond Y, where X and Y are both if_index numbers. Hsflowd will do the rest. That relationship can be sent on the UNIXSOCK netlink channel along with the counter-updates, so it’s just one extra integer per counter-update. The packet samples and counters we send will still be for the individual components only.

But does linux-cp present a whole bond as one Linux tap port, or does it create netdevs representing each of the components and another to represent the bond? I think we can adapt either way and still present a coherent picture, but understanding this is the first step.

If only the aggregated bond has a Linux if_index then the components can appear using the made-up-to-not-clash numbers that we default to if linux-cp is not running.

sflow commented 1 month ago

Actually, to make sure it works for M-LAGs too, we also need to send the MAC address associated with the LAG: the "ActorSystemMacAddress" that the other parties to the M-LAG will see. So it's worth digging around to see where we can find that in the VPP bond code.

pimvanpelt commented 1 month ago

The canonical way to create a bond is in VPP (with Linux-CP):

vppctl create bond mode lacp load-balance l34
vppctl bond add BondEthernet0 TenGigabitEthernet3/0/2
vppctl bond add BondEthernet0 TenGigabitEthernet3/0/3
vppctl set interface state TenGigabitEthernet3/0/2 up
vppctl set interface state TenGigabitEthernet3/0/3 up
vppctl lcp create BondEthernet0 host-if be0

The members do not have a linux-cp pair. The BondEthernet0 device may or may not have a linux-cp pair.

Finding that an interface is a part of a BondEthernet is straight forward in VPP, struct bond_if_t has the MAC address. struct bond_main_t enumerates both the bond interfaces and all members. There are helper functions bond_dump_ifs() and bond_dump_member_ifs() and a bunch of others in vnet/bonding/node.h.