Lines Matching full:smc

20 #include "h/smc.h"
37 static void clear_all_rep(struct s_smc *smc);
38 static void clear_reported(struct s_smc *smc);
39 static void smt_send_srf(struct s_smc *smc);
40 static struct s_srf_evc *smt_get_evc(struct s_smc *smc, int code, int index);
42 #define MAX_EVCS ARRAY_SIZE(smc->evcs)
68 void smt_init_evc(struct s_smc *smc) in smt_init_evc() argument
78 memset((char *)smc->evcs,0,sizeof(smc->evcs)) ; in smt_init_evc()
80 evc = smc->evcs ; in smt_init_evc()
97 if ((unsigned int) (evc - smc->evcs) > MAX_EVCS) { in smt_init_evc()
98 SMT_PANIC(smc,SMT_E0127, SMT_E0127_MSG) ; in smt_init_evc()
104 smc->evcs[0].evc_cond_state = &smc->mib.fddiSMTPeerWrapFlag ; in smt_init_evc()
105 smc->evcs[1].evc_cond_state = in smt_init_evc()
106 &smc->mib.m[MAC0].fddiMACDuplicateAddressCond ; in smt_init_evc()
107 smc->evcs[2].evc_cond_state = in smt_init_evc()
108 &smc->mib.m[MAC0].fddiMACFrameErrorFlag ; in smt_init_evc()
109 smc->evcs[3].evc_cond_state = in smt_init_evc()
110 &smc->mib.m[MAC0].fddiMACNotCopiedFlag ; in smt_init_evc()
115 smc->evcs[4].evc_multiple = &smc->mib.m[MAC0].fddiMACMultiple_N ; in smt_init_evc()
116 smc->evcs[5].evc_multiple = &smc->mib.m[MAC0].fddiMACMultiple_P ; in smt_init_evc()
123 smc->evcs[offset + 0*NUMPHYS].evc_cond_state = in smt_init_evc()
124 &smc->mib.p[i].fddiPORTLerFlag ; in smt_init_evc()
125 smc->evcs[offset + 1*NUMPHYS].evc_cond_state = in smt_init_evc()
126 &smc->mib.p[i].fddiPORTEB_Condition ; in smt_init_evc()
131 smc->evcs[offset + 2*NUMPHYS].evc_multiple = in smt_init_evc()
132 &smc->mib.p[i].fddiPORTMultiple_U ; in smt_init_evc()
133 smc->evcs[offset + 3*NUMPHYS].evc_multiple = in smt_init_evc()
134 &smc->mib.p[i].fddiPORTMultiple_P ; in smt_init_evc()
138 for (i = 0, evc = smc->evcs ; i < MAX_EVCS ; i++, evc++) { in smt_init_evc()
141 SMT_PANIC(smc,SMT_E0128, SMT_E0128_MSG) ; in smt_init_evc()
147 SMT_PANIC(smc,SMT_E0129, SMT_E0129_MSG) ; in smt_init_evc()
153 smc->srf.TSR = smt_get_time() ; in smt_init_evc()
154 smc->srf.sr_state = SR0_WAIT ; in smt_init_evc()
157 static struct s_srf_evc *smt_get_evc(struct s_smc *smc, int code, int index) in smt_get_evc() argument
162 for (i = 0, evc = smc->evcs ; i < MAX_EVCS ; i++, evc++) { in smt_get_evc()
181 void smt_srf_event(struct s_smc *smc, int code, int index, int cond) in smt_srf_event() argument
191 RS_SET(smc,RS_DUPADDR) ; in smt_srf_event()
197 if (!(evc = smt_get_evc(smc,code,index))) { in smt_srf_event()
212 smt_set_timestamp(smc,smc->mib.fddiSMTTransitionTimeStamp) ; in smt_srf_event()
218 smc->srf.any_report = TRUE ; in smt_srf_event()
234 smc->srf.any_report = TRUE ; in smt_srf_event()
238 snmp_srf_event(smc,evc) ; in smt_srf_event()
241 tsr = smt_get_time() - smc->srf.TSR ; in smt_srf_event()
243 switch (smc->srf.sr_state) { in smt_srf_event()
247 smc->srf.SRThreshold = THRESHOLD_2 ; in smt_srf_event()
248 smc->srf.sr_state = SR1_HOLDOFF ; in smt_srf_event()
253 smc->srf.sr_state = SR1_HOLDOFF ; in smt_srf_event()
258 smc->srf.sr_state = SR1_HOLDOFF ; in smt_srf_event()
263 smc->srf.SRThreshold = THRESHOLD_2 ; in smt_srf_event()
264 smc->srf.TSR = smt_get_time() ; in smt_srf_event()
265 smt_send_srf(smc) ; in smt_srf_event()
270 smc->srf.TSR = smt_get_time() ; in smt_srf_event()
271 smt_send_srf(smc) ; in smt_srf_event()
276 smc->srf.TSR = smt_get_time() ; in smt_srf_event()
277 smt_send_srf(smc) ; in smt_srf_event()
281 if (smc->srf.any_report && (u_long) tsr >= in smt_srf_event()
282 smc->srf.SRThreshold) { in smt_srf_event()
283 smc->srf.SRThreshold *= 2 ; in smt_srf_event()
284 if (smc->srf.SRThreshold > THRESHOLD_32) in smt_srf_event()
285 smc->srf.SRThreshold = THRESHOLD_32 ; in smt_srf_event()
286 smc->srf.TSR = smt_get_time() ; in smt_srf_event()
287 smt_send_srf(smc) ; in smt_srf_event()
291 if (!smc->mib.fddiSMTStatRptPolicy) { in smt_srf_event()
292 smc->srf.sr_state = SR2_DISABLED ; in smt_srf_event()
299 smc->srf.sr_state = SR0_WAIT ; in smt_srf_event()
300 smc->srf.TSR = smt_get_time() ; in smt_srf_event()
301 smt_send_srf(smc) ; in smt_srf_event()
306 smc->srf.SRThreshold = THRESHOLD_2 ; in smt_srf_event()
312 if (!smc->mib.fddiSMTStatRptPolicy) { in smt_srf_event()
313 smc->srf.sr_state = SR2_DISABLED ; in smt_srf_event()
318 if (smc->mib.fddiSMTStatRptPolicy) { in smt_srf_event()
319 smc->srf.sr_state = SR0_WAIT ; in smt_srf_event()
320 smc->srf.TSR = smt_get_time() ; in smt_srf_event()
321 smc->srf.SRThreshold = THRESHOLD_2 ; in smt_srf_event()
322 clear_all_rep(smc) ; in smt_srf_event()
329 static void clear_all_rep(struct s_smc *smc) in clear_all_rep() argument
334 for (i = 0, evc = smc->evcs ; i < MAX_EVCS ; i++, evc++) { in clear_all_rep()
339 smc->srf.any_report = FALSE ; in clear_all_rep()
342 static void clear_reported(struct s_smc *smc) in clear_reported() argument
347 smc->srf.any_report = FALSE ; in clear_reported()
348 for (i = 0, evc = smc->evcs ; i < MAX_EVCS ; i++, evc++) { in clear_reported()
353 smc->srf.any_report = TRUE ; in clear_reported()
365 static void smt_send_srf(struct s_smc *smc) in smt_send_srf() argument
381 if (!smc->r.sm_ma_avail) in smt_send_srf()
383 if (!(mb = smt_build_frame(smc,SMT_SRF,SMT_ANNOUNCE,0))) in smt_send_srf()
386 RS_SET(smc,RS_SOFTERROR) ; in smt_send_srf()
399 smt_add_para(smc,&pcon,(u_short) SMT_P1033,0,0) ; in smt_send_srf()
400 smt_add_para(smc,&pcon,(u_short) SMT_P1034,0,0) ; in smt_send_srf()
402 for (i = 0, evc = smc->evcs ; i < MAX_EVCS ; i++, evc++) { in smt_send_srf()
404 smt_add_para(smc,&pcon,evc->evc_para, in smt_send_srf()
413 smc->srf.sr_state, smc->srf.SRThreshold / TICKS_PER_SECOND); in smt_send_srf()
415 dump_smt(smc,smt,"SRF Send") ; in smt_send_srf()
417 smt_send_frame(smc,mb,FC_SMT_INFO,0) ; in smt_send_srf()
418 clear_reported(smc) ; in smt_send_srf()