Lines Matching refs:smc

43 #define GO_STATE(x)	(smc->mib.fddiSMTCF_State = (x)|AFLAG)
44 #define ACTIONS_DONE() (smc->mib.fddiSMTCF_State &= ~AFLAG)
89 static void cfm_fsm(struct s_smc *smc, int cmd);
95 void cfm_init(struct s_smc *smc) in cfm_init() argument
97 smc->mib.fddiSMTCF_State = ACTIONS(SC0_ISOLATED) ; in cfm_init()
98 smc->r.rm_join = 0 ; in cfm_init()
99 smc->r.rm_loop = 0 ; in cfm_init()
100 smc->y[PA].scrub = 0 ; in cfm_init()
101 smc->y[PB].scrub = 0 ; in cfm_init()
102 smc->y[PA].cem_pst = CEM_PST_DOWN ; in cfm_init()
103 smc->y[PB].cem_pst = CEM_PST_DOWN ; in cfm_init()
107 #define THRU_ENABLED(smc) (smc->y[PA].pc_mode != PM_TREE && \ argument
108 smc->y[PB].pc_mode != PM_TREE)
110 static void selection_criteria (struct s_smc *smc, struct s_phy *phy) in selection_criteria() argument
115 if ( !THRU_ENABLED(smc) && smc->y[PB].cf_join ) { in selection_criteria()
136 void all_selection_criteria(struct s_smc *smc) in all_selection_criteria() argument
141 for ( p = 0,phy = smc->y ; p < NUMPHYS; p++, phy++ ) { in all_selection_criteria()
143 selection_criteria (smc,phy); in all_selection_criteria()
147 static void cem_priv_state(struct s_smc *smc, int event) in cem_priv_state() argument
154 if (smc->s.sas != SMT_DAS ) in cem_priv_state()
163 if (smc->y[np].cf_join) { in cem_priv_state()
164 smc->y[np].cem_pst = CEM_PST_UP ; in cem_priv_state()
165 } else if (!smc->y[np].wc_flag) { in cem_priv_state()
167 smc->y[np].cem_pst = CEM_PST_DOWN ; in cem_priv_state()
175 if ( smc->y[i].cem_pst == CEM_PST_HOLD && !smc->y[i].wc_flag ) { in cem_priv_state()
176 smc->y[i].cem_pst = CEM_PST_DOWN; in cem_priv_state()
177 queue_event(smc,(int)(EVENT_PCM+i),PC_START) ; in cem_priv_state()
179 if ( smc->y[i].cem_pst == CEM_PST_UP && smc->y[i].wc_flag ) { in cem_priv_state()
180 smc->y[i].cem_pst = CEM_PST_HOLD; in cem_priv_state()
181 queue_event(smc,(int)(EVENT_PCM+i),PC_START) ; in cem_priv_state()
183 if ( smc->y[i].cem_pst == CEM_PST_DOWN && smc->y[i].wc_flag ) { in cem_priv_state()
188 smc->y[i].cem_pst = CEM_PST_HOLD; in cem_priv_state()
203 void cfm(struct s_smc *smc, int event) in cfm() argument
214 all_selection_criteria (smc); in cfm()
218 cem_priv_state (smc, event); in cfm()
222 smc->mib.fddiSMTCF_State & AFLAG ? "ACTIONS " : "", in cfm()
223 cfm_states[smc->mib.fddiSMTCF_State & ~AFLAG], in cfm()
225 state = smc->mib.fddiSMTCF_State ; in cfm()
226 cfm_fsm(smc,event) ; in cfm()
228 } while (state != smc->mib.fddiSMTCF_State) ; in cfm()
235 if ( (smc->mib.fddiSMTCF_State == SC9_C_WRAP_A && in cfm()
236 smc->y[PA].pc_mode == PM_PEER) || in cfm()
237 (smc->mib.fddiSMTCF_State == SC10_C_WRAP_B && in cfm()
238 smc->y[PB].pc_mode == PM_PEER) || in cfm()
239 (smc->mib.fddiSMTCF_State == SC11_C_WRAP_S && in cfm()
240 smc->y[PS].pc_mode == PM_PEER && in cfm()
241 smc->y[PS].mib->fddiPORTNeighborType != TS ) ) { in cfm()
244 if (cond != smc->mib.fddiSMTPeerWrapFlag) in cfm()
245 smt_srf_event(smc,SMT_COND_SMT_PEER_WRAP,0,cond) ; in cfm()
257 smc->mib.m[MAC0].fddiMACDownstreamPORTType = in cfm()
258 cf_to_ptype[smc->mib.fddiSMTCF_State] ; in cfm()
259 cfm_state_change(smc,(int)smc->mib.fddiSMTCF_State) ; in cfm()
266 static void cfm_fsm(struct s_smc *smc, int cmd) in cfm_fsm() argument
268 switch(smc->mib.fddiSMTCF_State) { in cfm_fsm()
270 smc->mib.p[PA].fddiPORTCurrentPath = MIB_PATH_ISOLATED ; in cfm_fsm()
271 smc->mib.p[PB].fddiPORTCurrentPath = MIB_PATH_ISOLATED ; in cfm_fsm()
272 smc->mib.p[PA].fddiPORTMACPlacement = 0 ; in cfm_fsm()
273 smc->mib.p[PB].fddiPORTMACPlacement = 0 ; in cfm_fsm()
274 smc->mib.fddiSMTStationStatus = MIB_SMT_STASTA_SEPA ; in cfm_fsm()
275 config_mux(smc,MUX_ISOLATE) ; /* configure PHY Mux */ in cfm_fsm()
276 smc->r.rm_loop = FALSE ; in cfm_fsm()
277 smc->r.rm_join = FALSE ; in cfm_fsm()
278 queue_event(smc,EVENT_RMT,RM_JOIN) ;/* signal RMT */ in cfm_fsm()
281 DB_CFMN(1, "CFM : %s", cfm_states[smc->mib.fddiSMTCF_State]); in cfm_fsm()
286 if (smc->s.sas && (smc->y[PA].cf_join || smc->y[PA].cf_loop || in cfm_fsm()
287 smc->y[PB].cf_join || smc->y[PB].cf_loop)) { in cfm_fsm()
292 if ((smc->y[PA].cem_pst == CEM_PST_UP && smc->y[PA].cf_join && in cfm_fsm()
293 !smc->y[PA].wc_flag) || smc->y[PA].cf_loop) { in cfm_fsm()
298 if ((smc->y[PB].cem_pst == CEM_PST_UP && smc->y[PB].cf_join && in cfm_fsm()
299 !smc->y[PB].wc_flag) || smc->y[PB].cf_loop) { in cfm_fsm()
305 smc->mib.p[PA].fddiPORTCurrentPath = MIB_PATH_CONCATENATED ; in cfm_fsm()
306 smc->mib.p[PB].fddiPORTCurrentPath = MIB_PATH_ISOLATED ; in cfm_fsm()
307 smc->mib.p[PA].fddiPORTMACPlacement = INDEX_MAC ; in cfm_fsm()
308 smc->mib.p[PB].fddiPORTMACPlacement = 0 ; in cfm_fsm()
309 smc->mib.fddiSMTStationStatus = MIB_SMT_STASTA_CON ; in cfm_fsm()
310 config_mux(smc,MUX_WRAPA) ; /* configure PHY mux */ in cfm_fsm()
311 if (smc->y[PA].cf_loop) { in cfm_fsm()
312 smc->r.rm_join = FALSE ; in cfm_fsm()
313 smc->r.rm_loop = TRUE ; in cfm_fsm()
314 queue_event(smc,EVENT_RMT,RM_LOOP) ;/* signal RMT */ in cfm_fsm()
316 if (smc->y[PA].cf_join) { in cfm_fsm()
317 smc->r.rm_loop = FALSE ; in cfm_fsm()
318 smc->r.rm_join = TRUE ; in cfm_fsm()
319 queue_event(smc,EVENT_RMT,RM_JOIN) ;/* signal RMT */ in cfm_fsm()
322 DB_CFMN(1, "CFM : %s", cfm_states[smc->mib.fddiSMTCF_State]); in cfm_fsm()
326 if ( (smc->y[PA].wc_flag || !smc->y[PA].cf_join) && in cfm_fsm()
327 !smc->y[PA].cf_loop ) { in cfm_fsm()
332 else if ( (smc->y[PB].cf_loop && smc->y[PA].cf_join && in cfm_fsm()
333 smc->y[PA].cem_pst == CEM_PST_UP) || in cfm_fsm()
334 ((smc->y[PB].cf_loop || in cfm_fsm()
335 (smc->y[PB].cf_join && in cfm_fsm()
336 smc->y[PB].cem_pst == CEM_PST_UP)) && in cfm_fsm()
337 (smc->y[PA].pc_mode == PM_TREE || in cfm_fsm()
338 smc->y[PB].pc_mode == PM_TREE))) { in cfm_fsm()
339 smc->y[PA].scrub = TRUE ; in cfm_fsm()
344 else if (!smc->s.attach_s && in cfm_fsm()
345 smc->y[PA].cf_join && in cfm_fsm()
346 smc->y[PA].cem_pst == CEM_PST_UP && in cfm_fsm()
347 smc->y[PA].pc_mode == PM_PEER && smc->y[PB].cf_join && in cfm_fsm()
348 smc->y[PB].cem_pst == CEM_PST_UP && in cfm_fsm()
349 smc->y[PB].pc_mode == PM_PEER) { in cfm_fsm()
350 smc->y[PA].scrub = TRUE ; in cfm_fsm()
351 smc->y[PB].scrub = TRUE ; in cfm_fsm()
356 else if ( smc->s.attach_s && in cfm_fsm()
357 smc->y[PA].cf_join && in cfm_fsm()
358 smc->y[PA].cem_pst == CEM_PST_UP && in cfm_fsm()
359 smc->y[PA].pc_mode == PM_PEER && in cfm_fsm()
360 smc->y[PB].cf_join && in cfm_fsm()
361 smc->y[PB].cem_pst == CEM_PST_UP && in cfm_fsm()
362 smc->y[PB].pc_mode == PM_PEER) { in cfm_fsm()
363 smc->y[PA].scrub = TRUE ; in cfm_fsm()
364 smc->y[PB].scrub = TRUE ; in cfm_fsm()
370 smc->mib.p[PA].fddiPORTCurrentPath = MIB_PATH_ISOLATED ; in cfm_fsm()
371 smc->mib.p[PB].fddiPORTCurrentPath = MIB_PATH_CONCATENATED ; in cfm_fsm()
372 smc->mib.p[PA].fddiPORTMACPlacement = 0 ; in cfm_fsm()
373 smc->mib.p[PB].fddiPORTMACPlacement = INDEX_MAC ; in cfm_fsm()
374 smc->mib.fddiSMTStationStatus = MIB_SMT_STASTA_CON ; in cfm_fsm()
375 config_mux(smc,MUX_WRAPB) ; /* configure PHY mux */ in cfm_fsm()
376 if (smc->y[PB].cf_loop) { in cfm_fsm()
377 smc->r.rm_join = FALSE ; in cfm_fsm()
378 smc->r.rm_loop = TRUE ; in cfm_fsm()
379 queue_event(smc,EVENT_RMT,RM_LOOP) ;/* signal RMT */ in cfm_fsm()
381 if (smc->y[PB].cf_join) { in cfm_fsm()
382 smc->r.rm_loop = FALSE ; in cfm_fsm()
383 smc->r.rm_join = TRUE ; in cfm_fsm()
384 queue_event(smc,EVENT_RMT,RM_JOIN) ;/* signal RMT */ in cfm_fsm()
387 DB_CFMN(1, "CFM : %s", cfm_states[smc->mib.fddiSMTCF_State]); in cfm_fsm()
391 if ( !smc->y[PB].cf_join && !smc->y[PB].cf_loop ) { in cfm_fsm()
396 else if ( smc->y[PA].cf_loop && smc->y[PA].pc_mode == PM_PEER && in cfm_fsm()
397 smc->y[PB].cf_join && smc->y[PB].pc_mode == PM_PEER) { in cfm_fsm()
398 smc->y[PB].scrub = TRUE ; in cfm_fsm()
403 else if (!smc->s.attach_s && in cfm_fsm()
404 smc->y[PA].cf_join && smc->y[PA].pc_mode == PM_PEER && in cfm_fsm()
405 smc->y[PB].cf_join && smc->y[PB].pc_mode == PM_PEER) { in cfm_fsm()
406 smc->y[PA].scrub = TRUE ; in cfm_fsm()
407 smc->y[PB].scrub = TRUE ; in cfm_fsm()
412 else if ( smc->s.attach_s && in cfm_fsm()
413 smc->y[PA].cf_join && smc->y[PA].pc_mode == PM_PEER && in cfm_fsm()
414 smc->y[PB].cf_join && smc->y[PB].pc_mode == PM_PEER) { in cfm_fsm()
415 smc->y[PA].scrub = TRUE ; in cfm_fsm()
416 smc->y[PB].scrub = TRUE ; in cfm_fsm()
422 smc->mib.p[PA].fddiPORTCurrentPath = MIB_PATH_THRU ; in cfm_fsm()
423 smc->mib.p[PB].fddiPORTCurrentPath = MIB_PATH_THRU ; in cfm_fsm()
424 smc->mib.p[PA].fddiPORTMACPlacement = 0 ; in cfm_fsm()
425 smc->mib.p[PB].fddiPORTMACPlacement = INDEX_MAC ; in cfm_fsm()
426 smc->mib.fddiSMTStationStatus = MIB_SMT_STASTA_THRU ; in cfm_fsm()
427 config_mux(smc,MUX_THRUA) ; /* configure PHY mux */ in cfm_fsm()
428 smc->r.rm_loop = FALSE ; in cfm_fsm()
429 smc->r.rm_join = TRUE ; in cfm_fsm()
430 queue_event(smc,EVENT_RMT,RM_JOIN) ;/* signal RMT */ in cfm_fsm()
432 DB_CFMN(1, "CFM : %s", cfm_states[smc->mib.fddiSMTCF_State]); in cfm_fsm()
436 if (smc->y[PB].wc_flag || !smc->y[PB].cf_join) { in cfm_fsm()
437 smc->y[PA].scrub = TRUE ; in cfm_fsm()
442 else if (!smc->y[PA].cf_join || smc->y[PA].wc_flag) { in cfm_fsm()
443 smc->y[PB].scrub = TRUE ; in cfm_fsm()
448 else if (smc->s.attach_s) { in cfm_fsm()
449 smc->y[PB].scrub = TRUE ; in cfm_fsm()
455 smc->mib.p[PA].fddiPORTCurrentPath = MIB_PATH_THRU ; in cfm_fsm()
456 smc->mib.p[PB].fddiPORTCurrentPath = MIB_PATH_THRU ; in cfm_fsm()
457 smc->mib.p[PA].fddiPORTMACPlacement = INDEX_MAC ; in cfm_fsm()
458 smc->mib.p[PB].fddiPORTMACPlacement = 0 ; in cfm_fsm()
459 smc->mib.fddiSMTStationStatus = MIB_SMT_STASTA_THRU ; in cfm_fsm()
460 config_mux(smc,MUX_THRUB) ; /* configure PHY mux */ in cfm_fsm()
461 smc->r.rm_loop = FALSE ; in cfm_fsm()
462 smc->r.rm_join = TRUE ; in cfm_fsm()
463 queue_event(smc,EVENT_RMT,RM_JOIN) ;/* signal RMT */ in cfm_fsm()
465 DB_CFMN(1, "CFM : %s", cfm_states[smc->mib.fddiSMTCF_State]); in cfm_fsm()
469 if (!smc->y[PB].cf_join || smc->y[PB].wc_flag) { in cfm_fsm()
470 smc->y[PA].scrub = TRUE ; in cfm_fsm()
475 else if (!smc->y[PA].cf_join || smc->y[PA].wc_flag) { in cfm_fsm()
476 smc->y[PB].scrub = TRUE ; in cfm_fsm()
481 else if (!smc->s.attach_s) { in cfm_fsm()
482 smc->y[PA].scrub = TRUE ; in cfm_fsm()
488 smc->mib.p[PS].fddiPORTCurrentPath = MIB_PATH_CONCATENATED ; in cfm_fsm()
489 smc->mib.p[PS].fddiPORTMACPlacement = INDEX_MAC ; in cfm_fsm()
490 smc->mib.fddiSMTStationStatus = MIB_SMT_STASTA_CON ; in cfm_fsm()
491 config_mux(smc,MUX_WRAPS) ; /* configure PHY mux */ in cfm_fsm()
492 if (smc->y[PA].cf_loop || smc->y[PB].cf_loop) { in cfm_fsm()
493 smc->r.rm_join = FALSE ; in cfm_fsm()
494 smc->r.rm_loop = TRUE ; in cfm_fsm()
495 queue_event(smc,EVENT_RMT,RM_LOOP) ;/* signal RMT */ in cfm_fsm()
497 if (smc->y[PA].cf_join || smc->y[PB].cf_join) { in cfm_fsm()
498 smc->r.rm_loop = FALSE ; in cfm_fsm()
499 smc->r.rm_join = TRUE ; in cfm_fsm()
500 queue_event(smc,EVENT_RMT,RM_JOIN) ;/* signal RMT */ in cfm_fsm()
503 DB_CFMN(1, "CFM : %s", cfm_states[smc->mib.fddiSMTCF_State]); in cfm_fsm()
507 if ( !smc->y[PA].cf_join && !smc->y[PA].cf_loop && in cfm_fsm()
508 !smc->y[PB].cf_join && !smc->y[PB].cf_loop) { in cfm_fsm()
514 SMT_PANIC(smc,SMT_E0106, SMT_E0106_MSG) ; in cfm_fsm()
524 int cfm_get_mac_input(struct s_smc *smc) in cfm_get_mac_input() argument
526 return (smc->mib.fddiSMTCF_State == SC10_C_WRAP_B || in cfm_get_mac_input()
527 smc->mib.fddiSMTCF_State == SC5_THRU_B) ? PB : PA; in cfm_get_mac_input()
535 int cfm_get_mac_output(struct s_smc *smc) in cfm_get_mac_output() argument
537 return (smc->mib.fddiSMTCF_State == SC10_C_WRAP_B || in cfm_get_mac_output()
538 smc->mib.fddiSMTCF_State == SC4_THRU_A) ? PB : PA; in cfm_get_mac_output()
575 int cem_build_path(struct s_smc *smc, char *to, int path_index) in cem_build_path() argument
580 switch (smc->mib.fddiSMTCF_State) { in cem_build_path()
583 path = smc->s.sas ? path_iso_s : path_iso ; in cem_build_path()
584 len = smc->s.sas ? sizeof(path_iso_s) : sizeof(path_iso) ; in cem_build_path()