44 static const char ID_sccs[] =
"@(#)cfm.c 2.18 98/10/06 (C) SK " ;
51 #define GO_STATE(x) (smc->mib.fddiSMTCF_State = (x)|AFLAG)
52 #define ACTIONS_DONE() (smc->mib.fddiSMTCF_State &= ~AFLAG)
53 #define ACTIONS(x) (x|AFLAG)
59 static const char *
const cfm_states[] = {
60 "SC0_ISOLATED",
"CF1",
"CF2",
"CF3",
"CF4",
61 "SC1_WRAP_A",
"SC2_WRAP_B",
"SC5_TRHU_B",
"SC7_WRAP_S",
62 "SC9_C_WRAP_A",
"SC10_C_WRAP_B",
"SC11_C_WRAP_S",
"SC4_THRU_A"
68 static const char *
const cfm_events[] = {
69 "NONE",
"CF_LOOP_A",
"CF_LOOP_B",
"CF_JOIN_A",
"CF_JOIN_B"
76 static const unsigned char cf_to_ptype[] = {
85 #define CEM_PST_DOWN 0
87 #define CEM_PST_HOLD 2
110 smc->
y[
PA].scrub = 0 ;
111 smc->
y[
PB].scrub = 0 ;
117 #define THRU_ENABLED(smc) (smc->y[PA].pc_mode != PM_TREE && \
118 smc->y[PB].pc_mode != PM_TREE)
123 switch (phy->
mib->fddiPORTMy_Type) {
151 for ( p = 0,phy = smc->
y ; p <
NUMPHYS; p++, phy++ ) {
153 selection_criteria (smc,phy);
169 if (np !=
PA && np !=
PB) {
173 if (smc->
y[np].cf_join) {
175 }
else if (!smc->
y[np].wc_flag) {
183 for (i = 0 ; i < 2 ; i ++ ) {
189 if ( smc->
y[i].cem_pst ==
CEM_PST_UP && smc->
y[i].wc_flag ) {
229 cem_priv_state (smc, event);
231 oldstate = smc->
mib.fddiSMTCF_State ;
233 DB_CFM(
"CFM : state %s%s",
234 (smc->
mib.fddiSMTCF_State &
AFLAG) ?
"ACTIONS " :
"",
235 cfm_states[smc->
mib.fddiSMTCF_State & ~
AFLAG]) ;
236 DB_CFM(
" event %s\n",cfm_events[event],0) ;
237 state = smc->
mib.fddiSMTCF_State ;
240 }
while (state != smc->
mib.fddiSMTCF_State) ;
253 smc->
y[
PS].mib->fddiPORTNeighborType !=
TS ) ) {
256 if (cond != smc->
mib.fddiSMTPeerWrapFlag)
267 if (smc->
mib.fddiSMTCF_State != oldstate) {
276 smc->
mib.m[
MAC0].fddiMACDownstreamPORTType =
277 cf_to_ptype[smc->
mib.fddiSMTCF_State] ;
285 static void cfm_fsm(
struct s_smc *smc,
int cmd)
287 switch(smc->
mib.fddiSMTCF_State) {
291 smc->
mib.p[
PA].fddiPORTMACPlacement = 0 ;
292 smc->
mib.p[
PB].fddiPORTMACPlacement = 0 ;
300 DB_CFMN(1,
"CFM : %s\n",cfm_states[smc->
mib.fddiSMTCF_State],0) ;
305 if (smc->
s.sas && (smc->
y[
PA].cf_join || smc->
y[
PA].cf_loop ||
306 smc->
y[
PB].cf_join || smc->
y[
PB].cf_loop)) {
312 !smc->
y[
PA].wc_flag) || smc->
y[
PA].cf_loop) {
318 !smc->
y[
PB].wc_flag) || smc->
y[
PB].cf_loop) {
327 smc->
mib.p[
PB].fddiPORTMACPlacement = 0 ;
330 if (smc->
y[
PA].cf_loop) {
332 smc->
r.rm_loop =
TRUE ;
335 if (smc->
y[
PA].cf_join) {
337 smc->
r.rm_join =
TRUE ;
341 DB_CFMN(1,
"CFM : %s\n",cfm_states[smc->
mib.fddiSMTCF_State],0) ;
345 if ( (smc->
y[
PA].wc_flag || !smc->
y[
PA].cf_join) &&
346 !smc->
y[
PA].cf_loop ) {
351 else if ( (smc->
y[
PB].cf_loop && smc->
y[
PA].cf_join &&
353 ((smc->
y[
PB].cf_loop ||
354 (smc->
y[
PB].cf_join &&
363 else if (!smc->
s.attach_s &&
364 smc->
y[
PA].cf_join &&
375 else if ( smc->
s.attach_s &&
376 smc->
y[
PA].cf_join &&
379 smc->
y[
PB].cf_join &&
391 smc->
mib.p[
PA].fddiPORTMACPlacement = 0 ;
395 if (smc->
y[
PB].cf_loop) {
397 smc->
r.rm_loop =
TRUE ;
400 if (smc->
y[
PB].cf_join) {
402 smc->
r.rm_join =
TRUE ;
406 DB_CFMN(1,
"CFM : %s\n",cfm_states[smc->
mib.fddiSMTCF_State],0) ;
410 if ( !smc->
y[
PB].cf_join && !smc->
y[
PB].cf_loop ) {
415 else if ( smc->
y[
PA].cf_loop && smc->
y[
PA].pc_mode ==
PM_PEER &&
422 else if (!smc->
s.attach_s &&
431 else if ( smc->
s.attach_s &&
443 smc->
mib.p[
PA].fddiPORTMACPlacement = 0 ;
448 smc->
r.rm_join =
TRUE ;
451 DB_CFMN(1,
"CFM : %s\n",cfm_states[smc->
mib.fddiSMTCF_State],0) ;
455 if (smc->
y[
PB].wc_flag || !smc->
y[
PB].cf_join) {
461 else if (!smc->
y[
PA].cf_join || smc->
y[
PA].wc_flag) {
467 else if (smc->
s.attach_s) {
477 smc->
mib.p[
PB].fddiPORTMACPlacement = 0 ;
481 smc->
r.rm_join =
TRUE ;
484 DB_CFMN(1,
"CFM : %s\n",cfm_states[smc->
mib.fddiSMTCF_State],0) ;
488 if (!smc->
y[
PB].cf_join || smc->
y[
PB].wc_flag) {
494 else if (!smc->
y[
PA].cf_join || smc->
y[
PA].wc_flag) {
500 else if (!smc->
s.attach_s) {
511 if (smc->
y[
PA].cf_loop || smc->
y[
PB].cf_loop) {
513 smc->
r.rm_loop =
TRUE ;
516 if (smc->
y[
PA].cf_join || smc->
y[
PB].cf_join) {
518 smc->
r.rm_join =
TRUE ;
522 DB_CFMN(1,
"CFM : %s\n",cfm_states[smc->
mib.fddiSMTCF_State],0) ;
526 if ( !smc->
y[
PA].cf_join && !smc->
y[
PA].cf_loop &&
527 !smc->
y[
PB].cf_join && !smc->
y[
PB].cf_loop) {
560 static char path_iso[] = {
566 static char path_wrap_a[] = {
572 static char path_wrap_b[] = {
578 static char path_thru[] = {
584 static char path_wrap_s[] = {
589 static char path_iso_s[] = {
599 switch (smc->
mib.fddiSMTCF_State) {
602 path = smc->
s.sas ? path_iso_s : path_iso ;
603 len = smc->
s.sas ?
sizeof(path_iso_s) :
sizeof(path_iso) ;
607 len =
sizeof(path_wrap_a) ;
611 len =
sizeof(path_wrap_b) ;
615 len =
sizeof(path_thru) ;
619 len =
sizeof(path_wrap_s) ;