34 static const char ID_sccs[] =
"@(#)srf.c 1.18 97/08/04 (C) SK " ;
41 static void clear_all_rep(
struct s_smc *
smc);
42 static void clear_reported(
struct s_smc *
smc);
43 static void smt_send_srf(
struct s_smc *
smc);
46 #define MAX_EVCS ARRAY_SIZE(smc->evcs)
55 static const struct evc_init evc_inits[] = {
70 #define MAX_INIT_EVC ARRAY_SIZE(evc_inits)
88 for (index = 0 ; index < init->
n ; index++) {
108 smc->
evcs[0].evc_cond_state = &smc->
mib.fddiSMTPeerWrapFlag ;
109 smc->
evcs[1].evc_cond_state =
110 &smc->
mib.m[
MAC0].fddiMACDuplicateAddressCond ;
111 smc->
evcs[2].evc_cond_state =
112 &smc->
mib.m[
MAC0].fddiMACFrameErrorFlag ;
113 smc->
evcs[3].evc_cond_state =
114 &smc->
mib.m[
MAC0].fddiMACNotCopiedFlag ;
119 smc->
evcs[4].evc_multiple = &smc->
mib.m[
MAC0].fddiMACMultiple_N ;
120 smc->
evcs[5].evc_multiple = &smc->
mib.m[
MAC0].fddiMACMultiple_P ;
123 for (i = 0 ; i <
NUMPHYS ; i++) {
128 &smc->
mib.p[
i].fddiPORTLerFlag ;
130 &smc->
mib.p[
i].fddiPORTEB_Condition ;
136 &smc->
mib.p[
i].fddiPORTMultiple_U ;
138 &smc->
mib.p[
i].fddiPORTMultiple_P ;
142 for (i = 0, evc = smc->
evcs ; (
unsigned) i <
MAX_EVCS ; i++, evc++) {
166 for (i = 0, evc = smc->
evcs ; (
unsigned) i <
MAX_EVCS ; i++, evc++) {
173 #define THRESHOLD_2 (2*TICKS_PER_SECOND)
174 #define THRESHOLD_32 (32*TICKS_PER_SECOND)
177 static const char *
const srf_names[] = {
178 "None",
"MACPathChangeEvent",
"MACNeighborChangeEvent",
179 "PORTPathChangeEvent",
"PORTUndesiredConnectionAttemptEvent",
180 "SMTPeerWrapCondition",
"SMTHoldCondition",
181 "MACFrameErrorCondition",
"MACDuplicateAddressCondition",
182 "MACNotCopiedCondition",
"PORTEBErrorCondition",
190 int cond_asserted = 0 ;
191 int cond_deasserted = 0 ;
192 int event_occurred = 0 ;
201 DB_SMT(
"SRF: %s index %d\n",srf_names[code],index) ;
203 if (!(evc = smt_get_evc(smc,code,index))) {
204 DB_SMT(
"SRF : smt_get_evc() failed\n",0,0) ;
220 DB_SMT(
"SRF: condition is %s\n",cond ?
"ON":
"OFF",0) ;
225 cond_asserted =
TRUE ;
229 cond_deasserted =
TRUE ;
241 event_occurred =
TRUE ;
244 snmp_srf_event(smc,evc) ;
249 switch (smc->
srf.sr_state) {
252 if (cond_asserted && tsr < T_Limit) {
258 if (cond_deasserted && tsr < T_Limit) {
263 if (event_occurred && tsr < T_Limit) {
268 if (cond_asserted && tsr >= T_Limit) {
275 if (cond_deasserted && tsr >= T_Limit) {
281 if (event_occurred && tsr >= T_Limit) {
287 if (smc->
srf.any_report && (
u_long) tsr >=
288 smc->
srf.SRThreshold) {
289 smc->
srf.SRThreshold *= 2 ;
297 if (!smc->
mib.fddiSMTStatRptPolicy) {
304 if (tsr >= T_Limit) {
318 if (!smc->
mib.fddiSMTStatRptPolicy) {
324 if (smc->
mib.fddiSMTStatRptPolicy) {
335 static void clear_all_rep(
struct s_smc *smc)
340 for (i = 0, evc = smc->
evcs ; (
unsigned) i <
MAX_EVCS ; i++, evc++) {
348 static void clear_reported(
struct s_smc *smc)
354 for (i = 0, evc = smc->
evcs ; (
unsigned) i <
MAX_EVCS ; i++, evc++) {
371 static void smt_send_srf(
struct s_smc *smc)
380 static const struct fddi_addr SMT_SRF_DA = {
381 { 0x80, 0x01, 0x43, 0x00, 0x80, 0x08 }
387 if (!smc->
r.sm_ma_avail)
403 pcon.pc_p = (
void *) (smt + 1) ;
408 for (i = 0, evc = smc->
evcs ; (
unsigned) i <
MAX_EVCS ; i++, evc++) {
417 DB_SMT(
"SRF: sending SRF at %x, len %d\n",smt,mb->
sm_len) ;
418 DB_SMT(
"SRF: state SR%d Threshold %d\n",
424 clear_reported(smc) ;