MCPcopy Create free account
hub / github.com/F-Stack/f-stack / bstp_set_path_cost

Function bstp_set_path_cost

freebsd/net/bridgestp.c:1606–1630  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1604}
1605
1606int
1607bstp_set_path_cost(struct bstp_port *bp, uint32_t path_cost)
1608{
1609 struct bstp_state *bs = bp->bp_bs;
1610
1611 if (path_cost > BSTP_MAX_PATH_COST)
1612 return (EINVAL);
1613
1614 /* STP compat mode only uses 16 bits of the 32 */
1615 if (bp->bp_protover == BSTP_PROTO_STP && path_cost > 65535)
1616 path_cost = 65535;
1617
1618 BSTP_LOCK(bs);
1619
1620 if (path_cost == 0) { /* use auto */
1621 bp->bp_flags &= ~BSTP_PORT_ADMCOST;
1622 bp->bp_path_cost = bstp_calc_path_cost(bp);
1623 } else {
1624 bp->bp_path_cost = path_cost;
1625 bp->bp_flags |= BSTP_PORT_ADMCOST;
1626 }
1627 bstp_reinit(bs);
1628 BSTP_UNLOCK(bs);
1629 return (0);
1630}
1631
1632int
1633bstp_set_edge(struct bstp_port *bp, int set)

Callers 1

bridge_ioctl_sifcostFunction · 0.85

Calls 2

bstp_calc_path_costFunction · 0.85
bstp_reinitFunction · 0.85

Tested by

no test coverage detected