| 1604 | } |
| 1605 | |
| 1606 | int |
| 1607 | bstp_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 | |
| 1632 | int |
| 1633 | bstp_set_edge(struct bstp_port *bp, int set) |
no test coverage detected