49 static const char ID_sccs[] =
"@(#)ecm.c 2.7 99/08/05 (C) SK " ;
56 #define GO_STATE(x) (smc->mib.fddiSMTECMState = (x)|AFLAG)
57 #define ACTIONS_DONE() (smc->mib.fddiSMTECMState &= ~AFLAG)
58 #define ACTIONS(x) (x|AFLAG)
64 #define EC4_PATH_TEST 4
67 #define EC7_DEINSERT 7
73 static const char *
const ecm_states[] = {
74 "EC0_OUT",
"EC1_IN",
"EC2_TRACE",
"EC3_LEAVE",
"EC4_PATH_TEST",
75 "EC5_INSERT",
"EC6_CHECK",
"EC7_DEINSERT"
81 static const char *
const ecm_events[] = {
82 "NONE",
"EC_CONNECT",
"EC_DISCONNECT",
"EC_TRACE_PROP",
"EC_PATH_TEST",
83 "EC_TIMEOUT_TD",
"EC_TIMEOUT_TMAX",
84 "EC_TIMEOUT_IMAX",
"EC_TIMEOUT_INMAX",
"EC_TEST_DONE"
99 static void stop_ecm_timer(
struct s_smc *
smc);
100 static void prop_actions(
struct s_smc *
smc);
109 smc->
e.trace_prop = 0 ;
112 smc->
e.ecm_line_state =
FALSE ;
129 DB_ECM(
"ECM : state %s%s",
130 (smc->
mib.fddiSMTECMState &
AFLAG) ?
"ACTIONS " :
"",
131 ecm_states[smc->
mib.fddiSMTECMState & ~
AFLAG]) ;
132 DB_ECM(
" event %s\n",ecm_events[event],0) ;
133 state = smc->
mib.fddiSMTECMState ;
136 }
while (state != smc->
mib.fddiSMTECMState) ;
152 smc->
mib.fddiSMTRemoteDisconnectFlag =
FALSE ;
157 smc->
mib.fddiSMTRemoteDisconnectFlag ==
TRUE)
159 FDDI_REMOTE_DISCONNECT, smt_get_event_word(smc),
160 smt_get_error_word(smc) );
164 smc->
e.DisconnectFlag =
FALSE ;
167 smc->
e.DisconnectFlag =
TRUE ;
170 switch(smc->
mib.fddiSMTECMState) {
176 smc->
e.ecm_line_state =
FALSE ;
177 stop_ecm_timer(smc) ;
189 smc->
mib.fddiSMTBypassPresent &&
196 stop_ecm_timer(smc) ;
197 smc->
e.trace_prop = 0 ;
199 for (p = 0 ; p <
NUMPHYS ; p++)
200 if (smc->
mib.p[p].fddiPORTHardwarePresent)
218 start_ecm_timer(smc,
MIB2US(smc->mib.fddiSMTTrace_MaxExpiration),
246 FDDI_TRACE_MAX, smt_get_error_word(smc));
254 for (p = 0 ; p <
NUMPHYS ; p++)
286 smc->
mib.fddiSMTBypassPresent &&
293 stop_ecm_timer(smc) ;
309 !smc->
mib.fddiSMTBypassPresent) {
315 !smc->
mib.fddiSMTBypassPresent) {
326 smc->
mib.fddiSMTBypassPresent) {
332 smc->
mib.fddiSMTBypassPresent) {
359 start_ecm_timer(smc,smc->
s.ecm_check_poll,0) ;
360 smc->
e.ecm_line_state =
TRUE ;
373 smc->
e.ecm_line_state =
FALSE ;
378 else if (!smc->
e.sb_flag &&
381 smc->
e.sb_flag =
TRUE ;
382 DB_ECMN(1,
"ECM : EC6_CHECK - stuck bypass\n",0,0) ;
384 FDDI_SMT_ERROR, (
u_long) FDDI_BYPASS_STUCK,
385 smt_get_error_word(smc));
389 smc->
e.ecm_line_state =
FALSE ;
397 start_ecm_timer(smc,smc->
s.ecm_check_poll,0) ;
427 static void prop_actions(
struct s_smc *smc)
433 switch (smc->
s.sas) {
446 DB_ECM(
"ECM : prop_actions - trace_prop %d\n", smc->
e.trace_prop,0) ;
447 DB_ECM(
"ECM : prop_actions - in %d out %d\n", port_in,port_out) ;
451 DB_ECM(
"ECM : initiate TRACE on PHY %c\n",
'A'+port_in-
PA,0) ;
457 DB_ECM(
"ECM : propagate TRACE on PHY B\n",0,0) ;
463 DB_ECM(
"ECM : propagate TRACE on PHY A\n",0,0) ;
468 DB_ECM(
"ECM : TRACE terminated\n",0,0) ;
471 smc->
e.trace_prop = 0 ;
477 static void prop_actions(
struct s_smc *smc)
484 while (smc->
e.trace_prop) {
485 DB_ECM(
"ECM : prop_actions - trace_prop %d\n",
486 smc->
e.trace_prop,0) ;
491 DB_ECM(
"ECM: MAC initiates trace\n",0,0) ;
494 for (p = NUMPHYS-1 ; p >= 0 ; p--) {
495 if (smc->
e.trace_prop &
502 upstream = cem_get_upstream(smc,initiator) ;
506 DB_ECM(
"ECM : TRACE terminated\n",0,0) ;
511 DB_ECM(
"ECM : propagate TRACE on PHY %d\n",upstream,0) ;
532 static void stop_ecm_timer(
struct s_smc *smc)
534 if (smc->
e.ecm_timer.tm_active)