| 2198 | } |
| 2199 | |
| 2200 | int |
| 2201 | bstp_create(struct bstp_state *bs, struct bstp_port *bp, struct ifnet *ifp) |
| 2202 | { |
| 2203 | bzero(bp, sizeof(struct bstp_port)); |
| 2204 | |
| 2205 | BSTP_LOCK(bs); |
| 2206 | bp->bp_ifp = ifp; |
| 2207 | bp->bp_bs = bs; |
| 2208 | bp->bp_priority = BSTP_DEFAULT_PORT_PRIORITY; |
| 2209 | TASK_INIT(&bp->bp_statetask, 0, bstp_notify_state, bp); |
| 2210 | TASK_INIT(&bp->bp_rtagetask, 0, bstp_notify_rtage, bp); |
| 2211 | TASK_INIT(&bp->bp_mediatask, 0, bstp_ifupdstatus, bp); |
| 2212 | |
| 2213 | /* Init state */ |
| 2214 | bp->bp_infois = BSTP_INFO_DISABLED; |
| 2215 | bp->bp_flags = BSTP_PORT_AUTOEDGE|BSTP_PORT_AUTOPTP; |
| 2216 | bstp_set_port_state(bp, BSTP_IFSTATE_DISCARDING); |
| 2217 | bstp_set_port_proto(bp, bs->bs_protover); |
| 2218 | bstp_set_port_role(bp, BSTP_ROLE_DISABLED); |
| 2219 | bstp_set_port_tc(bp, BSTP_TCSTATE_INACTIVE); |
| 2220 | bp->bp_path_cost = bstp_calc_path_cost(bp); |
| 2221 | BSTP_UNLOCK(bs); |
| 2222 | return (0); |
| 2223 | } |
| 2224 | |
| 2225 | int |
| 2226 | bstp_enable(struct bstp_port *bp) |
no test coverage detected