mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-31 21:13:00 +02:00
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:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user