Lines Matching refs:smc

52 #define GO_STATE(x)	(smc->mib.m[MAC0].fddiMACRMTState = (x)|AFLAG)
53 #define ACTIONS_DONE() (smc->mib.m[MAC0].fddiMACRMTState &= ~AFLAG)
95 static void rmt_fsm(struct s_smc *smc, int cmd);
96 static void start_rmt_timer0(struct s_smc *smc, u_long value, int event);
97 static void start_rmt_timer1(struct s_smc *smc, u_long value, int event);
98 static void start_rmt_timer2(struct s_smc *smc, u_long value, int event);
99 static void stop_rmt_timer0(struct s_smc *smc);
100 static void stop_rmt_timer1(struct s_smc *smc);
101 static void stop_rmt_timer2(struct s_smc *smc);
102 static void rmt_dup_actions(struct s_smc *smc);
103 static void rmt_reinsert_actions(struct s_smc *smc);
104 static void rmt_leave_actions(struct s_smc *smc);
105 static void rmt_new_dup_actions(struct s_smc *smc);
115 void rmt_init(struct s_smc *smc) in rmt_init() argument
117 smc->mib.m[MAC0].fddiMACRMTState = ACTIONS(RM0_ISOLATED) ; in rmt_init()
118 smc->r.dup_addr_test = DA_NONE ; in rmt_init()
119 smc->r.da_flag = 0 ; in rmt_init()
120 smc->mib.m[MAC0].fddiMACMA_UnitdataAvailable = FALSE ; in rmt_init()
121 smc->r.sm_ma_avail = FALSE ; in rmt_init()
122 smc->r.loop_avail = 0 ; in rmt_init()
123 smc->r.bn_flag = 0 ; in rmt_init()
124 smc->r.jm_flag = 0 ; in rmt_init()
125 smc->r.no_flag = TRUE ; in rmt_init()
137 void rmt(struct s_smc *smc, int event) in rmt() argument
143 smc->mib.m[MAC0].fddiMACRMTState & AFLAG ? "ACTIONS " : "", in rmt()
144 rmt_states[smc->mib.m[MAC0].fddiMACRMTState & ~AFLAG], in rmt()
146 state = smc->mib.m[MAC0].fddiMACRMTState ; in rmt()
147 rmt_fsm(smc,event) ; in rmt()
149 } while (state != smc->mib.m[MAC0].fddiMACRMTState) ; in rmt()
150 rmt_state_change(smc,(int)smc->mib.m[MAC0].fddiMACRMTState) ; in rmt()
156 static void rmt_fsm(struct s_smc *smc, int cmd) in rmt_fsm() argument
161 if (!smc->r.rm_join && !smc->r.rm_loop && in rmt_fsm()
162 smc->mib.m[MAC0].fddiMACRMTState != ACTIONS(RM0_ISOLATED) && in rmt_fsm()
163 smc->mib.m[MAC0].fddiMACRMTState != RM0_ISOLATED) { in rmt_fsm()
164 RS_SET(smc,RS_NORINGOP) ; in rmt_fsm()
165 rmt_indication(smc,0) ; in rmt_fsm()
170 switch(smc->mib.m[MAC0].fddiMACRMTState) { in rmt_fsm()
172 stop_rmt_timer0(smc) ; in rmt_fsm()
173 stop_rmt_timer1(smc) ; in rmt_fsm()
174 stop_rmt_timer2(smc) ; in rmt_fsm()
179 sm_ma_control(smc,MA_OFFLINE) ; in rmt_fsm()
180 smc->mib.m[MAC0].fddiMACMA_UnitdataAvailable = FALSE ; in rmt_fsm()
181 smc->r.loop_avail = FALSE ; in rmt_fsm()
182 smc->r.sm_ma_avail = FALSE ; in rmt_fsm()
183 smc->r.no_flag = TRUE ; in rmt_fsm()
189 if (smc->r.rm_join || smc->r.rm_loop) { in rmt_fsm()
196 sm_ma_control(smc,MA_RESET) ; in rmt_fsm()
202 start_rmt_timer0(smc,smc->s.rmt_t_non_op,RM_TIMEOUT_NON_OP) ; in rmt_fsm()
203 stop_rmt_timer1(smc) ; in rmt_fsm()
204 stop_rmt_timer2(smc) ; in rmt_fsm()
205 sm_ma_control(smc,MA_BEACON) ; in rmt_fsm()
207 RS_SET(smc,RS_NORINGOP) ; in rmt_fsm()
208 smc->r.sm_ma_avail = FALSE ; in rmt_fsm()
209 rmt_indication(smc,0) ; in rmt_fsm()
215 RS_SET(smc,RS_RINGOPCHANGE) ; in rmt_fsm()
221 smc->r.bn_flag = FALSE ; in rmt_fsm()
222 smc->r.no_flag = TRUE ; in rmt_fsm()
228 stop_rmt_timer0(smc) ; in rmt_fsm()
229 stop_rmt_timer1(smc) ; in rmt_fsm()
230 stop_rmt_timer2(smc) ; in rmt_fsm()
231 smc->r.no_flag = FALSE ; in rmt_fsm()
232 if (smc->r.rm_loop) in rmt_fsm()
233 smc->r.loop_avail = TRUE ; in rmt_fsm()
234 if (smc->r.rm_join) { in rmt_fsm()
235 smc->r.sm_ma_avail = TRUE ; in rmt_fsm()
236 if (smc->mib.m[MAC0].fddiMACMA_UnitdataEnable) in rmt_fsm()
237 smc->mib.m[MAC0].fddiMACMA_UnitdataAvailable = TRUE ; in rmt_fsm()
239 smc->mib.m[MAC0].fddiMACMA_UnitdataAvailable = FALSE ; in rmt_fsm()
242 RS_CLEAR(smc,RS_NORINGOP) ; in rmt_fsm()
243 RS_SET(smc,RS_RINGOPCHANGE) ; in rmt_fsm()
244 rmt_indication(smc,1) ; in rmt_fsm()
245 smt_stat_counter(smc,0) ; in rmt_fsm()
251 smc->mib.m[MAC0].fddiMACMA_UnitdataAvailable = FALSE ; in rmt_fsm()
252 smc->r.loop_avail = FALSE ; in rmt_fsm()
253 RS_SET(smc,RS_RINGOPCHANGE) ; in rmt_fsm()
259 if (smc->mib.m[MAC0].fddiMACMA_UnitdataEnable) in rmt_fsm()
260 smc->mib.m[MAC0].fddiMACMA_UnitdataAvailable = TRUE ; in rmt_fsm()
262 smc->mib.m[MAC0].fddiMACMA_UnitdataAvailable = FALSE ; in rmt_fsm()
265 else if (smc->r.dup_addr_test == DA_FAILED) { in rmt_fsm()
266 smc->mib.m[MAC0].fddiMACMA_UnitdataAvailable = FALSE ; in rmt_fsm()
267 smc->r.loop_avail = FALSE ; in rmt_fsm()
268 smc->r.da_flag = TRUE ; in rmt_fsm()
274 start_rmt_timer0(smc,smc->s.mac_d_max*2,RM_TIMEOUT_D_MAX) ; in rmt_fsm()
275 start_rmt_timer1(smc,smc->s.rmt_t_stuck,RM_TIMEOUT_T_STUCK) ; in rmt_fsm()
276 start_rmt_timer2(smc,smc->s.rmt_t_poll,RM_TIMEOUT_POLL) ; in rmt_fsm()
277 sm_mac_check_beacon_claim(smc) ; in rmt_fsm()
283 start_rmt_timer2(smc,smc->s.rmt_t_poll,RM_TIMEOUT_POLL); in rmt_fsm()
284 sm_mac_check_beacon_claim(smc) ; in rmt_fsm()
288 smc->r.timer0_exp = TRUE ; in rmt_fsm()
297 start_rmt_timer0(smc, in rmt_fsm()
298 smc->s.mac_d_max*2, in rmt_fsm()
308 && smc->r.bn_flag) { in rmt_fsm()
309 smc->r.bn_flag = FALSE ; in rmt_fsm()
312 else if (cmd == RM_TRT_EXP && !smc->r.bn_flag) { in rmt_fsm()
319 if ((tx = sm_mac_get_tx_state(smc)) == 4 || tx == 5) { in rmt_fsm()
321 smc->r.bn_flag = TRUE ; in rmt_fsm()
328 start_rmt_timer1(smc,smc->s.rmt_t_stuck, in rmt_fsm()
338 tx, smc->r.bn_flag); in rmt_fsm()
341 else if (cmd == RM_MY_CLAIM && smc->r.timer0_exp) { in rmt_fsm()
342 rmt_new_dup_actions(smc) ; in rmt_fsm()
347 else if (cmd == RM_MY_BEACON && smc->r.timer0_exp) { in rmt_fsm()
348 rmt_new_dup_actions(smc) ; in rmt_fsm()
354 rmt_new_dup_actions(smc) ; in rmt_fsm()
360 smc->r.rm_join && smc->r.bn_flag) { in rmt_fsm()
366 start_rmt_timer0(smc,smc->s.rmt_t_announce,RM_TIMEOUT_ANNOUNCE); in rmt_fsm()
367 start_rmt_timer1(smc,smc->s.rmt_t_stuck,RM_TIMEOUT_T_STUCK) ; in rmt_fsm()
368 start_rmt_timer2(smc,smc->s.rmt_t_poll,RM_TIMEOUT_POLL) ; in rmt_fsm()
369 sm_mac_check_beacon_claim(smc) ; in rmt_fsm()
375 start_rmt_timer2(smc,smc->s.rmt_t_poll,RM_TIMEOUT_POLL); in rmt_fsm()
376 sm_mac_check_beacon_claim(smc) ; in rmt_fsm()
380 if (!smc->r.da_flag) { in rmt_fsm()
386 smc->r.bn_flag) { in rmt_fsm()
387 smc->r.bn_flag = FALSE ; in rmt_fsm()
390 else if (cmd == RM_TRT_EXP && !smc->r.bn_flag) { in rmt_fsm()
397 if ((tx = sm_mac_get_tx_state(smc)) == 4 || tx == 5) { in rmt_fsm()
399 smc->r.bn_flag = TRUE ; in rmt_fsm()
406 start_rmt_timer1(smc,smc->s.rmt_t_stuck, in rmt_fsm()
416 tx, smc->r.bn_flag); in rmt_fsm()
419 else if (cmd == RM_TIMEOUT_ANNOUNCE && !smc->r.bn_flag) { in rmt_fsm()
420 rmt_dup_actions(smc) ; in rmt_fsm()
424 smc->r.no_flag = FALSE ; in rmt_fsm()
430 smc->r.rm_join && smc->r.bn_flag) { in rmt_fsm()
436 stop_rmt_timer0(smc) ; in rmt_fsm()
437 stop_rmt_timer1(smc) ; in rmt_fsm()
438 stop_rmt_timer2(smc) ; in rmt_fsm()
444 if (smc->r.dup_addr_test == DA_PASSED) { in rmt_fsm()
445 smc->r.da_flag = FALSE ; in rmt_fsm()
451 smc->r.jm_flag = FALSE ; in rmt_fsm()
452 smc->r.bn_flag = FALSE ; in rmt_fsm()
458 start_rmt_timer0(smc,smc->s.rmt_t_direct,RM_TIMEOUT_T_DIRECT) ; in rmt_fsm()
459 stop_rmt_timer1(smc) ; in rmt_fsm()
460 start_rmt_timer2(smc,smc->s.rmt_t_poll,RM_TIMEOUT_POLL) ; in rmt_fsm()
461 sm_ma_control(smc,MA_DIRECTED) ; in rmt_fsm()
462 RS_SET(smc,RS_BEACON) ; in rmt_fsm()
469 start_rmt_timer2(smc,smc->s.rmt_t_poll,RM_TIMEOUT_POLL); in rmt_fsm()
470 sm_mac_check_beacon_claim(smc) ; in rmt_fsm()
477 restart_trt_for_dbcn(smc) ; in rmt_fsm()
482 !smc->r.da_flag) { in rmt_fsm()
483 smc->r.bn_flag = FALSE ; in rmt_fsm()
489 smc->r.da_flag) { in rmt_fsm()
490 smc->r.bn_flag = FALSE ; in rmt_fsm()
501 stop_rmt_timer0(smc) ; in rmt_fsm()
502 stop_rmt_timer1(smc) ; in rmt_fsm()
503 stop_rmt_timer2(smc) ; in rmt_fsm()
504 smc->e.trace_prop |= ENTITY_BIT(ENTITY_MAC) ; in rmt_fsm()
505 queue_event(smc,EVENT_ECM,EC_TRACE_PROP) ; in rmt_fsm()
512 SMT_PANIC(smc,SMT_E0122, SMT_E0122_MSG) ; in rmt_fsm()
521 static void rmt_dup_actions(struct s_smc *smc) in rmt_dup_actions() argument
523 if (smc->r.jm_flag) { in rmt_dup_actions()
526 if (smc->s.rmt_dup_mac_behavior) { in rmt_dup_actions()
527 SMT_ERR_LOG(smc,SMT_E0138, SMT_E0138_MSG) ; in rmt_dup_actions()
528 rmt_reinsert_actions(smc) ; in rmt_dup_actions()
531 SMT_ERR_LOG(smc,SMT_E0135, SMT_E0135_MSG) ; in rmt_dup_actions()
532 rmt_leave_actions(smc) ; in rmt_dup_actions()
540 static void rmt_reinsert_actions(struct s_smc *smc) in rmt_reinsert_actions() argument
542 queue_event(smc,EVENT_ECM,EC_DISCONNECT) ; in rmt_reinsert_actions()
543 queue_event(smc,EVENT_ECM,EC_CONNECT) ; in rmt_reinsert_actions()
549 static void rmt_new_dup_actions(struct s_smc *smc) in rmt_new_dup_actions() argument
551 smc->r.da_flag = TRUE ; in rmt_new_dup_actions()
552 smc->r.bn_flag = FALSE ; in rmt_new_dup_actions()
553 smc->r.jm_flag = FALSE ; in rmt_new_dup_actions()
560 if (smc->s.rmt_dup_mac_behavior) { in rmt_new_dup_actions()
561 SMT_ERR_LOG(smc,SMT_E0138, SMT_E0138_MSG) ; in rmt_new_dup_actions()
562 rmt_reinsert_actions(smc) ; in rmt_new_dup_actions()
565 SMT_ERR_LOG(smc,SMT_E0135, SMT_E0135_MSG) ; in rmt_new_dup_actions()
566 rmt_leave_actions(smc) ; in rmt_new_dup_actions()
574 static void rmt_leave_actions(struct s_smc *smc) in rmt_leave_actions() argument
576 queue_event(smc,EVENT_ECM,EC_DISCONNECT) ; in rmt_leave_actions()
587 static void start_rmt_timer0(struct s_smc *smc, u_long value, int event) in start_rmt_timer0() argument
589 smc->r.timer0_exp = FALSE ; /* clear timer event flag */ in start_rmt_timer0()
590 smt_timer_start(smc,&smc->r.rmt_timer0,value,EV_TOKEN(EVENT_RMT,event)); in start_rmt_timer0()
597 static void start_rmt_timer1(struct s_smc *smc, u_long value, int event) in start_rmt_timer1() argument
599 smc->r.timer1_exp = FALSE ; /* clear timer event flag */ in start_rmt_timer1()
600 smt_timer_start(smc,&smc->r.rmt_timer1,value,EV_TOKEN(EVENT_RMT,event)); in start_rmt_timer1()
607 static void start_rmt_timer2(struct s_smc *smc, u_long value, int event) in start_rmt_timer2() argument
609 smc->r.timer2_exp = FALSE ; /* clear timer event flag */ in start_rmt_timer2()
610 smt_timer_start(smc,&smc->r.rmt_timer2,value,EV_TOKEN(EVENT_RMT,event)); in start_rmt_timer2()
617 static void stop_rmt_timer0(struct s_smc *smc) in stop_rmt_timer0() argument
619 if (smc->r.rmt_timer0.tm_active) in stop_rmt_timer0()
620 smt_timer_stop(smc,&smc->r.rmt_timer0) ; in stop_rmt_timer0()
627 static void stop_rmt_timer1(struct s_smc *smc) in stop_rmt_timer1() argument
629 if (smc->r.rmt_timer1.tm_active) in stop_rmt_timer1()
630 smt_timer_stop(smc,&smc->r.rmt_timer1) ; in stop_rmt_timer1()
637 static void stop_rmt_timer2(struct s_smc *smc) in stop_rmt_timer2() argument
639 if (smc->r.rmt_timer2.tm_active) in stop_rmt_timer2()
640 smt_timer_stop(smc,&smc->r.rmt_timer2) ; in stop_rmt_timer2()