sflow / vpp-sflow

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

sFlow inserted twice on same graph arc? #2

Closed sflow closed 2 months ago

sflow commented 2 months ago

We need to make sure that enabling sFlow on an interface twice does not insert the sampling node into the graph twice.

pimvanpelt commented 2 months ago

I can confirm this does happen. If we:

sflow enable-disable TenGigabitEthernet130/0/0
sflow enable-disable TenGigabitEthernet130/0/0
sflow enable-disable TenGigabitEthernet130/0/0
sflow enable-disable TenGigabitEthernet130/0/0

We will receive 4x the samples on the PSAMPLE netlink channel.

One way to detect this is to mark an interface as enabled (see #3 for more on this) and if it's enabled, refused to add the feature again on https://github.com/sflow/vpp-sflow/blame/main/sflow/sflow.c#L322

sflow commented 2 months ago

I believe this issue is addressed by the latest commit, which introduces per-interface data in sflow-main and uses it to gate the enable_disable config changes. https://github.com/sflow/vpp-sflow/commit/26840826dd6320316bd2f6e500892f6b2c28ef25

pimvanpelt commented 2 months ago

Confirmed - we only call vnet_feature_enable_disable() at most once now per interface.