confd: Avoid needless Ethernet flow-control reconfigurations

Unless some configuration has changed that affects flow-control (only
auto-neg for now, until we allow actual configuration of flow-control
itself), do not issue any commands that might trigger a link down/up
cycle.

Additionally, make sure that we always configure it on boot, as the
driver defaults might not necessarily line up with our defaults.
This commit is contained in:
Tobias Waldekranz
2024-04-29 14:31:40 +02:00
parent 824b911f49
commit 5e2475c742
3 changed files with 16 additions and 5 deletions
+4
View File
@@ -127,6 +127,10 @@ int dagger_should_skip_current(struct dagger *d, const char *ifname)
return fexistf("%s/%d/skip/%s", d->path, d->current, ifname);
}
int dagger_is_bootstrap(struct dagger *d)
{
return d->next == 0;
}
int dagger_claim(struct dagger *d, const char *path)
{
+1
View File
@@ -30,6 +30,7 @@ int dagger_evolve_or_abandon(struct dagger *d);
void dagger_skip_iface(struct dagger *d, const char *ifname);
int dagger_should_skip(struct dagger *d, const char *ifname);
int dagger_should_skip_current(struct dagger *d, const char *ifname);
int dagger_is_bootstrap(struct dagger *d);
int dagger_claim(struct dagger *d, const char *path);
+11 -5
View File
@@ -775,12 +775,18 @@ static int netdag_gen_ethtool(struct dagger *net, struct lyd_node *cif, struct l
if (strcmp(type, "infix-if-type:ethernet"))
return 0;
/* XXX: add configurable flow-control support <<here>> */
err = netdag_gen_ethtool_flow_control(net, cif);
if (err)
return err;
if (!eth)
return 0;
if (lydx_get_descendant(lyd_child(eth), "auto-negotiation", "enable", NULL) ||
if (dagger_is_bootstrap(net) ||
lydx_get_descendant(lyd_child(eth), "auto-negotiation", "enable", NULL)) {
err = netdag_gen_ethtool_flow_control(net, cif);
if (err)
return err;
}
if (dagger_is_bootstrap(net) ||
lydx_get_descendant(lyd_child(eth), "auto-negotiation", "enable", NULL) ||
lydx_get_child(eth, "speed") ||
lydx_get_child(eth, "duplex")) {
err = netdag_gen_ethtool_autoneg(net, cif);