| 2223 | } |
| 2224 | |
| 2225 | int |
| 2226 | bstp_enable(struct bstp_port *bp) |
| 2227 | { |
| 2228 | struct bstp_state *bs = bp->bp_bs; |
| 2229 | struct ifnet *ifp = bp->bp_ifp; |
| 2230 | |
| 2231 | KASSERT(bp->bp_active == 0, ("already a bstp member")); |
| 2232 | |
| 2233 | switch (ifp->if_type) { |
| 2234 | case IFT_ETHER: /* These can do spanning tree. */ |
| 2235 | break; |
| 2236 | default: |
| 2237 | /* Nothing else can. */ |
| 2238 | return (EINVAL); |
| 2239 | } |
| 2240 | |
| 2241 | BSTP_LOCK(bs); |
| 2242 | LIST_INSERT_HEAD(&bs->bs_bplist, bp, bp_next); |
| 2243 | bp->bp_active = 1; |
| 2244 | bp->bp_flags |= BSTP_PORT_NEWINFO; |
| 2245 | bstp_reinit(bs); |
| 2246 | bstp_update_roles(bs, bp); |
| 2247 | BSTP_UNLOCK(bs); |
| 2248 | return (0); |
| 2249 | } |
| 2250 | |
| 2251 | void |
| 2252 | bstp_disable(struct bstp_port *bp) |
no test coverage detected