| 152 | static void bstp_reinit(struct bstp_state *); |
| 153 | |
| 154 | static void |
| 155 | bstp_transmit(struct bstp_state *bs, struct bstp_port *bp) |
| 156 | { |
| 157 | if (bs->bs_running == 0) |
| 158 | return; |
| 159 | |
| 160 | /* |
| 161 | * a PDU can only be sent if we have tx quota left and the |
| 162 | * hello timer is running. |
| 163 | */ |
| 164 | if (bp->bp_hello_timer.active == 0) { |
| 165 | /* Test if it needs to be reset */ |
| 166 | bstp_hello_timer_expiry(bs, bp); |
| 167 | return; |
| 168 | } |
| 169 | if (bp->bp_txcount > bs->bs_txholdcount) |
| 170 | /* Ran out of karma */ |
| 171 | return; |
| 172 | |
| 173 | if (bp->bp_protover == BSTP_PROTO_RSTP) { |
| 174 | bstp_transmit_bpdu(bs, bp); |
| 175 | bp->bp_tc_ack = 0; |
| 176 | } else { /* STP */ |
| 177 | switch (bp->bp_role) { |
| 178 | case BSTP_ROLE_DESIGNATED: |
| 179 | bstp_transmit_bpdu(bs, bp); |
| 180 | bp->bp_tc_ack = 0; |
| 181 | break; |
| 182 | |
| 183 | case BSTP_ROLE_ROOT: |
| 184 | bstp_transmit_tcn(bs, bp); |
| 185 | break; |
| 186 | } |
| 187 | } |
| 188 | bstp_timer_start(&bp->bp_hello_timer, bp->bp_desg_htime); |
| 189 | bp->bp_flags &= ~BSTP_PORT_NEWINFO; |
| 190 | } |
| 191 | |
| 192 | static void |
| 193 | bstp_transmit_bpdu(struct bstp_state *bs, struct bstp_port *bp) |
no test coverage detected