Lines Matching full:smc
24 #include "h/smc.h"
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);
44 static struct s_srf_evc *smt_get_evc(struct s_smc *smc, int code, int index);
46 #define MAX_EVCS ARRAY_SIZE(smc->evcs)
72 void smt_init_evc(struct s_smc *smc) in smt_init_evc() argument
82 memset((char *)smc->evcs,0,sizeof(smc->evcs)) ; in smt_init_evc()
84 evc = smc->evcs ; in smt_init_evc()
101 if ((unsigned int) (evc - smc->evcs) > MAX_EVCS) { in smt_init_evc()
102 SMT_PANIC(smc,SMT_E0127, SMT_E0127_MSG) ; in smt_init_evc()
108 smc->evcs[0].evc_cond_state = &smc->mib.fddiSMTPeerWrapFlag ; in smt_init_evc()
109 smc->evcs[1].evc_cond_state = in smt_init_evc()
110 &smc->mib.m[MAC0].fddiMACDuplicateAddressCond ; in smt_init_evc()
111 smc->evcs[2].evc_cond_state = in smt_init_evc()
112 &smc->mib.m[MAC0].fddiMACFrameErrorFlag ; in smt_init_evc()
113 smc->evcs[3].evc_cond_state = in smt_init_evc()
114 &smc->mib.m[MAC0].fddiMACNotCopiedFlag ; in smt_init_evc()
119 smc->evcs[4].evc_multiple = &smc->mib.m[MAC0].fddiMACMultiple_N ; in smt_init_evc()
120 smc->evcs[5].evc_multiple = &smc->mib.m[MAC0].fddiMACMultiple_P ; in smt_init_evc()
127 smc->evcs[offset + 0*NUMPHYS].evc_cond_state = in smt_init_evc()
128 &smc->mib.p[i].fddiPORTLerFlag ; in smt_init_evc()
129 smc->evcs[offset + 1*NUMPHYS].evc_cond_state = in smt_init_evc()
130 &smc->mib.p[i].fddiPORTEB_Condition ; in smt_init_evc()
135 smc->evcs[offset + 2*NUMPHYS].evc_multiple = in smt_init_evc()
136 &smc->mib.p[i].fddiPORTMultiple_U ; in smt_init_evc()
137 smc->evcs[offset + 3*NUMPHYS].evc_multiple = in smt_init_evc()
138 &smc->mib.p[i].fddiPORTMultiple_P ; in smt_init_evc()
142 for (i = 0, evc = smc->evcs ; i < MAX_EVCS ; i++, evc++) { in smt_init_evc()
145 SMT_PANIC(smc,SMT_E0128, SMT_E0128_MSG) ; in smt_init_evc()
151 SMT_PANIC(smc,SMT_E0129, SMT_E0129_MSG) ; in smt_init_evc()
157 smc->srf.TSR = smt_get_time() ; in smt_init_evc()
158 smc->srf.sr_state = SR0_WAIT ; in smt_init_evc()
161 static struct s_srf_evc *smt_get_evc(struct s_smc *smc, int code, int index) in smt_get_evc() argument
166 for (i = 0, evc = smc->evcs ; i < MAX_EVCS ; i++, evc++) { in smt_get_evc()
185 void smt_srf_event(struct s_smc *smc, int code, int index, int cond) in smt_srf_event() argument
195 RS_SET(smc,RS_DUPADDR) ; in smt_srf_event()
201 if (!(evc = smt_get_evc(smc,code,index))) { in smt_srf_event()
216 smt_set_timestamp(smc,smc->mib.fddiSMTTransitionTimeStamp) ; in smt_srf_event()
222 smc->srf.any_report = TRUE ; in smt_srf_event()
238 smc->srf.any_report = TRUE ; in smt_srf_event()
242 snmp_srf_event(smc,evc) ; in smt_srf_event()
245 tsr = smt_get_time() - smc->srf.TSR ; in smt_srf_event()
247 switch (smc->srf.sr_state) { in smt_srf_event()
251 smc->srf.SRThreshold = THRESHOLD_2 ; in smt_srf_event()
252 smc->srf.sr_state = SR1_HOLDOFF ; in smt_srf_event()
257 smc->srf.sr_state = SR1_HOLDOFF ; in smt_srf_event()
262 smc->srf.sr_state = SR1_HOLDOFF ; in smt_srf_event()
267 smc->srf.SRThreshold = THRESHOLD_2 ; in smt_srf_event()
268 smc->srf.TSR = smt_get_time() ; in smt_srf_event()
269 smt_send_srf(smc) ; in smt_srf_event()
274 smc->srf.TSR = smt_get_time() ; in smt_srf_event()
275 smt_send_srf(smc) ; in smt_srf_event()
280 smc->srf.TSR = smt_get_time() ; in smt_srf_event()
281 smt_send_srf(smc) ; in smt_srf_event()
285 if (smc->srf.any_report && (u_long) tsr >= in smt_srf_event()
286 smc->srf.SRThreshold) { in smt_srf_event()
287 smc->srf.SRThreshold *= 2 ; in smt_srf_event()
288 if (smc->srf.SRThreshold > THRESHOLD_32) in smt_srf_event()
289 smc->srf.SRThreshold = THRESHOLD_32 ; in smt_srf_event()
290 smc->srf.TSR = smt_get_time() ; in smt_srf_event()
291 smt_send_srf(smc) ; in smt_srf_event()
295 if (!smc->mib.fddiSMTStatRptPolicy) { in smt_srf_event()
296 smc->srf.sr_state = SR2_DISABLED ; in smt_srf_event()
303 smc->srf.sr_state = SR0_WAIT ; in smt_srf_event()
304 smc->srf.TSR = smt_get_time() ; in smt_srf_event()
305 smt_send_srf(smc) ; in smt_srf_event()
310 smc->srf.SRThreshold = THRESHOLD_2 ; in smt_srf_event()
316 if (!smc->mib.fddiSMTStatRptPolicy) { in smt_srf_event()
317 smc->srf.sr_state = SR2_DISABLED ; in smt_srf_event()
322 if (smc->mib.fddiSMTStatRptPolicy) { in smt_srf_event()
323 smc->srf.sr_state = SR0_WAIT ; in smt_srf_event()
324 smc->srf.TSR = smt_get_time() ; in smt_srf_event()
325 smc->srf.SRThreshold = THRESHOLD_2 ; in smt_srf_event()
326 clear_all_rep(smc) ; in smt_srf_event()
333 static void clear_all_rep(struct s_smc *smc) in clear_all_rep() argument
338 for (i = 0, evc = smc->evcs ; i < MAX_EVCS ; i++, evc++) { in clear_all_rep()
343 smc->srf.any_report = FALSE ; in clear_all_rep()
346 static void clear_reported(struct s_smc *smc) in clear_reported() argument
351 smc->srf.any_report = FALSE ; in clear_reported()
352 for (i = 0, evc = smc->evcs ; i < MAX_EVCS ; i++, evc++) { in clear_reported()
357 smc->srf.any_report = TRUE ; in clear_reported()
369 static void smt_send_srf(struct s_smc *smc) in smt_send_srf() argument
385 if (!smc->r.sm_ma_avail) in smt_send_srf()
387 if (!(mb = smt_build_frame(smc,SMT_SRF,SMT_ANNOUNCE,0))) in smt_send_srf()
390 RS_SET(smc,RS_SOFTERROR) ; in smt_send_srf()
403 smt_add_para(smc,&pcon,(u_short) SMT_P1033,0,0) ; in smt_send_srf()
404 smt_add_para(smc,&pcon,(u_short) SMT_P1034,0,0) ; in smt_send_srf()
406 for (i = 0, evc = smc->evcs ; i < MAX_EVCS ; i++, evc++) { in smt_send_srf()
408 smt_add_para(smc,&pcon,evc->evc_para, in smt_send_srf()
417 smc->srf.sr_state, smc->srf.SRThreshold / TICKS_PER_SECOND); in smt_send_srf()
419 dump_smt(smc,smt,"SRF Send") ; in smt_send_srf()
421 smt_send_frame(smc,mb,FC_SMT_INFO,0) ; in smt_send_srf()
422 clear_reported(smc) ; in smt_send_srf()