Lines Matching +full:elastic +full:- +full:limit
1 // SPDX-License-Identifier: GPL-2.0-or-later
67 #define GO_STATE(x) (mib->fddiPORTPCMState = (x)|AFLAG)
68 #define ACTIONS_DONE() (mib->fddiPORTPCMState &= ~AFLAG)
109 * PCL-S control register
110 * this register in the PLC-S controls the scrambling parameters
121 * PCL-S control register
122 * this register in the PLC-S controls the scrambling parameters
152 #define PLC_MS(m) ((int)((0x10000L-(m*100000L/2048))))
208 phy->timer0_exp = FALSE ; /* clear timer event flag */ in start_pcm_timer0()
209 smt_timer_start(smc,&phy->pcm_timer0,value, in start_pcm_timer0()
210 EV_TOKEN(EVENT_PCM+phy->np,event)) ; in start_pcm_timer0()
218 if (phy->pcm_timer0.tm_active) in stop_pcm_timer0()
219 smt_timer_stop(smc,&phy->pcm_timer0) ; in stop_pcm_timer0()
233 for (np = 0,phy = smc->y ; np < NUMPHYS ; np++,phy++) { in pcm_init()
235 mib = phy->mib ; in pcm_init()
236 mib->fddiPORTPCMState = ACTIONS(PC0_OFF) ; in pcm_init()
237 phy->np = np ; in pcm_init()
238 switch (smc->s.sas) { in pcm_init()
241 mib->fddiPORTMy_Type = (np == PS) ? TS : TM ; in pcm_init()
244 mib->fddiPORTMy_Type = (np == PA) ? TA : in pcm_init()
248 mib->fddiPORTMy_Type = TM ; in pcm_init()
252 mib->fddiPORTMy_Type = (np == PS) ? TS : TNONE ; in pcm_init()
253 mib->fddiPORTHardwarePresent = (np == PS) ? TRUE : in pcm_init()
256 smc->y[PA].mib->fddiPORTPCMState = PC0_OFF ; in pcm_init()
258 smc->y[PB].mib->fddiPORTPCMState = PC0_OFF ; in pcm_init()
262 mib->fddiPORTMy_Type = (np == PB) ? TB : TA ; in pcm_init()
267 * set PMD-type in pcm_init()
269 phy->pmd_scramble = 0 ; in pcm_init()
270 switch (phy->pmd_type[PMD_SK_PMD]) { in pcm_init()
272 mib->fddiPORTPMDClass = MIB_PMDCLASS_MULTI ; in pcm_init()
275 mib->fddiPORTPMDClass = MIB_PMDCLASS_LCF ; in pcm_init()
278 mib->fddiPORTPMDClass = MIB_PMDCLASS_TP ; in pcm_init()
281 mib->fddiPORTPMDClass = MIB_PMDCLASS_TP ; in pcm_init()
282 phy->pmd_scramble = TRUE ; in pcm_init()
285 mib->fddiPORTPMDClass = MIB_PMDCLASS_TP ; in pcm_init()
286 phy->pmd_scramble = TRUE ; in pcm_init()
289 mib->fddiPORTPMDClass = MIB_PMDCLASS_SINGLE1 ; in pcm_init()
292 mib->fddiPORTPMDClass = MIB_PMDCLASS_SINGLE2 ; in pcm_init()
295 mib->fddiPORTPMDClass = MIB_PMDCLASS_SINGLE2 ; in pcm_init()
298 mib->fddiPORTPMDClass = MIB_PMDCLASS_SINGLE1 ; in pcm_init()
301 mib->fddiPORTPMDClass = MIB_PMDCLASS_UNKNOWN ; in pcm_init()
304 mib->fddiPORTPMDClass = MIB_PMDCLASS_TP ; in pcm_init()
307 mib->fddiPORTPMDClass = MIB_PMDCLASS_TP ; in pcm_init()
310 mib->fddiPORTPMDClass = MIB_PMDCLASS_UNKNOWN ; in pcm_init()
316 switch (mib->fddiPORTMy_Type) { in pcm_init()
318 mib->fddiPORTAvailablePaths |= MIB_PATH_S ; in pcm_init()
319 mib->fddiPORTRequestedPaths[1] = MIB_P_PATH_LOCAL ; in pcm_init()
320 mib->fddiPORTRequestedPaths[2] = in pcm_init()
324 mib->fddiPORTRequestedPaths[3] = in pcm_init()
331 mib->fddiPORTAvailablePaths |= MIB_PATH_S ; in pcm_init()
332 mib->fddiPORTRequestedPaths[1] = MIB_P_PATH_LOCAL ; in pcm_init()
333 mib->fddiPORTRequestedPaths[2] = in pcm_init()
336 mib->fddiPORTRequestedPaths[3] = in pcm_init()
343 mib->fddiPORTAvailablePaths |= MIB_PATH_S ; in pcm_init()
344 mib->fddiPORTRequestedPaths[1] = MIB_P_PATH_LOCAL ; in pcm_init()
345 mib->fddiPORTRequestedPaths[2] = in pcm_init()
349 mib->fddiPORTRequestedPaths[3] = in pcm_init()
355 mib->fddiPORTRequestedPaths[1] = MIB_P_PATH_LOCAL ; in pcm_init()
356 mib->fddiPORTRequestedPaths[2] = in pcm_init()
360 mib->fddiPORTRequestedPaths[3] = 0 ; in pcm_init()
364 phy->pc_lem_fail = FALSE ; in pcm_init()
365 mib->fddiPORTPCMStateX = mib->fddiPORTPCMState ; in pcm_init()
366 mib->fddiPORTLCTFail_Ct = 0 ; in pcm_init()
367 mib->fddiPORTBS_Flag = 0 ; in pcm_init()
368 mib->fddiPORTCurrentPath = MIB_PATH_ISOLATED ; in pcm_init()
369 mib->fddiPORTNeighborType = TNONE ; in pcm_init()
370 phy->ls_flag = 0 ; in pcm_init()
371 phy->rc_flag = 0 ; in pcm_init()
372 phy->tc_flag = 0 ; in pcm_init()
373 phy->td_flag = 0 ; in pcm_init()
375 phy->phy_name = '0' + np - PM ; in pcm_init()
377 phy->phy_name = 'A' + np ; in pcm_init()
378 phy->wc_flag = FALSE ; /* set by SMT */ in pcm_init()
379 memset((char *)&phy->lem,0,sizeof(struct lem_counter)) ; in pcm_init()
381 memset((char *)&phy->plc,0,sizeof(struct s_plc)) ; in pcm_init()
382 phy->plc.p_state = PS_OFF ; in pcm_init()
384 phy->t_next[i] = 0 ; in pcm_init()
415 int rev ; /* Revision of PLC-x */ in plc_init()
424 * if PLC-S then set control register C in plc_init()
431 if (smc->y[p].pmd_scramble) { in plc_init()
459 * REMOVE state if offline (page 3-36;) in plc_init()
465 if ((smc->s.sas == SMT_SAS) && (p == PS)) { in plc_init()
525 int np = phy->np ; /* PHY index */ in plc_send_bits()
532 for (i = len-1,n = 0 ; i >= 0 ; i--) { in plc_send_bits()
533 n = (n<<1) | phy->t_val[phy->bitn+i] ; in plc_send_bits()
542 outpw(PLC(np,PL_VECTOR_LEN),len-1) ; /* len=nr-1 */ in plc_send_bits()
547 if (smc->debug.d_plc & 0x80) in plc_send_bits()
551 printf("SIGNALING bit %d .. %d\n",phy->bitn,phy->bitn+len-1) ; in plc_send_bits()
562 if (smc->s.sas != SMT_DAS) in plc_config_mux()
595 if ((np != PS) && (smc->s.sas == SMT_SAS)) in pcm()
598 phy = &smc->y[np] ; in pcm()
599 mib = phy->mib ; in pcm()
600 oldstate = mib->fddiPORTPCMState ; in pcm()
603 phy->phy_name, in pcm()
604 mib->fddiPORTPCMState & AFLAG ? "ACTIONS " : "", in pcm()
605 pcm_states[mib->fddiPORTPCMState & ~AFLAG], in pcm()
607 state = mib->fddiPORTPCMState ; in pcm()
610 } while (state != mib->fddiPORTPCMState) ; in pcm()
618 mib->fddiPORTPCMStateX = PC3_CONNECT ; in pcm()
620 mib->fddiPORTPCMStateX = state ; in pcm()
626 if ( mib->fddiPORTPCMState != oldstate && in pcm()
627 ((oldstate == PC8_ACTIVE) || (mib->fddiPORTPCMState == PC8_ACTIVE))) { in pcm()
629 (int) (INDEX_PORT+ phy->np),0) ; in pcm()
634 /* check whether a snmp-trap has to be sent */ in pcm()
636 if ( mib->fddiPORTPCMState != oldstate ) { in pcm()
638 DB_SNMP ("PCM from %d to %d\n", oldstate, mib->fddiPORTPCMState); in pcm()
639 if ( mib->fddiPORTPCMState == PC0_OFF ) { in pcm()
641 snmp_fddi_trap (smc, 1, (int) mib->fddiPORTIndex ); in pcm()
644 snmp_fddi_trap (smc, 2, (int) mib->fddiPORTIndex ); in pcm()
645 } else if ( mib->fddiPORTPCMState != PC2_TRACE && in pcm()
648 snmp_fddi_trap (smc, 3, (int) mib->fddiPORTIndex ); in pcm()
649 } else if ( mib->fddiPORTPCMState == PC8_ACTIVE ) { in pcm()
651 snmp_fddi_trap (smc, 4, (int) mib->fddiPORTIndex ); in pcm()
665 int np = phy->np ; /* PHY index */ in pcm_fsm()
672 plc = &phy->plc ; in pcm_fsm()
673 mib = phy->mib ; in pcm_fsm()
680 /*PC00-PC80*/ in pcm_fsm()
681 if (mib->fddiPORTPCMState != PC9_MAINT) { in pcm_fsm()
689 /*PC01-PC81*/ in pcm_fsm()
690 if (mib->fddiPORTPCMState != PC9_MAINT) in pcm_fsm()
694 /* PC09-PC99 */ in pcm_fsm()
708 switch(mib->fddiPORTPCMState) { in pcm_fsm()
715 phy->cf_loop = FALSE ; in pcm_fsm()
716 phy->cf_join = FALSE ; in pcm_fsm()
719 mib->fddiPORTConnectState = PCM_DISABLED ; in pcm_fsm()
751 if (mib->fddiPORTPC_Withhold == PC_WH_NONE) in pcm_fsm()
752 mib->fddiPORTConnectState = PCM_CONNECTING ; in pcm_fsm()
753 phy->cf_loop = FALSE ; in pcm_fsm()
754 phy->cf_join = FALSE ; in pcm_fsm()
756 phy->ls_flag = FALSE ; in pcm_fsm()
757 phy->pc_mode = PM_NONE ; /* needed by CFM */ in pcm_fsm()
758 phy->bitn = 0 ; /* bit signaling start bit */ in pcm_fsm()
762 /* Set the non-active interrupt mask register */ in pcm_fsm()
789 * - The start command shall be done before setting the bits in pcm_fsm()
790 * to be signaled. (In PLC-S description and PLCS in SN3. in pcm_fsm()
791 * - The start command shall be issued AFTER setting the in pcm_fsm()
805 * workaround for PLC-S eng. sample errata in pcm_fsm()
826 plc->p_state = PS_BIT3 ; in pcm_fsm()
827 plc->p_bits = 3 ; in pcm_fsm()
828 plc->p_start = 0 ; in pcm_fsm()
850 switch (plc->p_state) { in pcm_fsm()
855 plc->p_state = PS_BIT4 ; in pcm_fsm()
856 plc->p_bits = 1 ; in pcm_fsm()
857 plc->p_start = 3 ; in pcm_fsm()
858 phy->bitn = 3 ; in pcm_fsm()
867 plc->p_state = PS_BIT7 ; in pcm_fsm()
868 plc->p_bits = 3 ; in pcm_fsm()
869 plc->p_start = 4 ; in pcm_fsm()
870 phy->bitn = 4 ; in pcm_fsm()
878 plc->p_state = PS_LCT ; in pcm_fsm()
879 plc->p_bits = 0 ; in pcm_fsm()
880 plc->p_start = 7 ; in pcm_fsm()
881 phy->bitn = 7 ; in pcm_fsm()
882 sm_ph_lem_start(smc,np,(int)smc->s.lct_short) ; /* enable LEM */ in pcm_fsm()
894 plc->p_state = PS_BIT8 ; in pcm_fsm()
895 plc->p_bits = 1 ; in pcm_fsm()
896 plc->p_start = 7 ; in pcm_fsm()
897 phy->bitn = 7 ; in pcm_fsm()
905 if (phy->t_val[7] || phy->r_val[7]) { in pcm_fsm()
912 plc->p_state = PS_JOIN ; in pcm_fsm()
913 plc->p_bits = 2 ; in pcm_fsm()
914 plc->p_start = 8 ; in pcm_fsm()
915 phy->bitn = 8 ; in pcm_fsm()
923 plc->p_state = PS_ACTIVE ; in pcm_fsm()
933 if (smc->s.sas == SMT_DAS && np == PB && in pcm_fsm()
934 (smc->y[PA].pc_mode == PM_TREE || in pcm_fsm()
935 smc->y[PB].pc_mode == PM_TREE)) { in pcm_fsm()
947 switch (plc->p_state) { in pcm_fsm()
950 if (!phy->cf_join) { in pcm_fsm()
951 phy->cf_join = TRUE ; in pcm_fsm()
972 sm_ph_lem_start(smc,(int)phy->np,LCT_LEM_MAX) ; in pcm_fsm()
974 phy->tr_flag = FALSE ; in pcm_fsm()
975 mib->fddiPORTConnectState = PCM_ACTIVE ; in pcm_fsm()
998 phy->cf_loop = FALSE ; in pcm_fsm()
999 phy->cf_join = FALSE ; in pcm_fsm()
1002 mib->fddiPORTConnectState = PCM_DISABLED ; in pcm_fsm()
1004 sm_ph_linestate(smc,np,(int) MIB2LS(mib->fddiPORTMaint_LS)) ; in pcm_fsm()
1009 DB_PCMN(1, "PCM %c : MAINT", phy->phy_name); in pcm_fsm()
1057 struct lem_counter *lem = &phy->lem ; in reset_lem_struct()
1059 phy->mib->fddiPORTLer_Estimate = 15 ; in reset_lem_struct()
1060 lem->lem_float_ber = 15 * 100 ; in reset_lem_struct()
1070 struct lem_counter *lem = &phy->lem ; in lem_evaluate()
1074 mib = phy->mib ; in lem_evaluate()
1076 if (!lem->lem_on) in lem_evaluate()
1079 errors = inpw(PLC(((int) phy->np),PL_LINK_ERR_CTR)) ; in lem_evaluate()
1080 lem->lem_errors += errors ; in lem_evaluate()
1081 mib->fddiPORTLem_Ct += errors ; in lem_evaluate()
1083 errors = lem->lem_errors ; in lem_evaluate()
1086 * -> this means, that one error in 8 sec. is one of 8*125*10E6 in lem_evaluate()
1087 * the same as BER = 10E-9 in lem_evaluate()
1089 * -> 9 errors in 8 seconds mean: in lem_evaluate()
1090 * BER = 9 * 10E-9 and this is in lem_evaluate()
1091 * < 10E-8, so the limit of 10E-8 is not reached! in lem_evaluate()
1110 lem->lem_float_ber = lem->lem_float_ber * 7 + ber * 3 ; in lem_evaluate()
1111 lem->lem_float_ber /= 10 ; in lem_evaluate()
1112 mib->fddiPORTLer_Estimate = lem->lem_float_ber / 100 ; in lem_evaluate()
1113 if (mib->fddiPORTLer_Estimate < 4) { in lem_evaluate()
1114 mib->fddiPORTLer_Estimate = 4 ; in lem_evaluate()
1117 if (lem->lem_errors) { in lem_evaluate()
1118 DB_PCMN(1, "LEM %c :", phy->np == PB ? 'B' : 'A'); in lem_evaluate()
1119 DB_PCMN(1, "errors : %ld", lem->lem_errors); in lem_evaluate()
1120 DB_PCMN(1, "sum_errors : %ld", mib->fddiPORTLem_Ct); in lem_evaluate()
1121 DB_PCMN(1, "current BER : 10E-%d", ber / 100); in lem_evaluate()
1122 DB_PCMN(1, "float BER : 10E-(%d/100)", lem->lem_float_ber); in lem_evaluate()
1123 DB_PCMN(1, "avg. BER : 10E-%d", mib->fddiPORTLer_Estimate); in lem_evaluate()
1126 lem->lem_errors = 0L ; in lem_evaluate()
1129 cond = (mib->fddiPORTLer_Estimate <= mib->fddiPORTLer_Alarm) ? in lem_evaluate()
1134 if (cond != mib->fddiPORTLerFlag) { in lem_evaluate()
1136 (int) (INDEX_PORT+ phy->np) ,cond) ; in lem_evaluate()
1140 if ( mib->fddiPORTLer_Estimate <= mib->fddiPORTLer_Cutoff) { in lem_evaluate()
1141 phy->pc_lem_fail = TRUE ; /* flag */ in lem_evaluate()
1142 mib->fddiPORTLem_Reject_Ct++ ; in lem_evaluate()
1144 * "forgive 10e-2" if we cutoff so we can come in lem_evaluate()
1147 lem->lem_float_ber += 2*100 ; in lem_evaluate()
1152 phy->np, mib->fddiPORTLer_Cutoff); in lem_evaluate()
1155 smt_port_off_event(smc,phy->np); in lem_evaluate()
1157 queue_event(smc,(int)(EVENT_PCM+phy->np),PC_START) ; in lem_evaluate()
1170 lem_evaluate(smc,&smc->y[np]) ; in sm_lem_evaluate()
1175 struct lem_counter *lem = &phy->lem ; in lem_check_lct()
1179 mib = phy->mib ; in lem_check_lct()
1181 phy->pc_lem_fail = FALSE ; /* flag */ in lem_check_lct()
1182 errors = inpw(PLC(((int)phy->np),PL_LINK_ERR_CTR)) ; in lem_check_lct()
1183 lem->lem_errors += errors ; in lem_check_lct()
1184 mib->fddiPORTLem_Ct += errors ; in lem_check_lct()
1185 if (lem->lem_errors) { in lem_check_lct()
1186 switch(phy->lc_test) { in lem_check_lct()
1188 if (lem->lem_errors >= smc->s.lct_short) in lem_check_lct()
1189 phy->pc_lem_fail = TRUE ; in lem_check_lct()
1192 if (lem->lem_errors >= smc->s.lct_medium) in lem_check_lct()
1193 phy->pc_lem_fail = TRUE ; in lem_check_lct()
1196 if (lem->lem_errors >= smc->s.lct_long) in lem_check_lct()
1197 phy->pc_lem_fail = TRUE ; in lem_check_lct()
1200 if (lem->lem_errors >= smc->s.lct_extended) in lem_check_lct()
1201 phy->pc_lem_fail = TRUE ; in lem_check_lct()
1204 DB_PCMN(1, " >>errors : %lu", lem->lem_errors); in lem_check_lct()
1206 if (phy->pc_lem_fail) { in lem_check_lct()
1207 mib->fddiPORTLCTFail_Ct++ ; in lem_check_lct()
1208 mib->fddiPORTLem_Reject_Ct++ ; in lem_check_lct()
1211 mib->fddiPORTLCTFail_Ct = 0 ; in lem_check_lct()
1219 struct lem_counter *lem = &smc->y[np].lem ; in sm_ph_lem_start()
1221 lem->lem_on = 1 ; in sm_ph_lem_start()
1222 lem->lem_errors = 0L ; in sm_ph_lem_start()
1224 /* Do NOT reset mib->fddiPORTLer_Estimate here. It is called too in sm_ph_lem_start()
1237 struct lem_counter *lem = &smc->y[np].lem ; in sm_ph_lem_stop()
1239 lem->lem_on = 0 ; in sm_ph_lem_stop()
1256 mib = phy->mib ; in pc_rcode_actions()
1258 DB_PCMN(1, "SIG rec %x %x:", bit, phy->r_val[bit]); in pc_rcode_actions()
1267 if (phy->r_val[1] == 0 && phy->r_val[2] == 0) in pc_rcode_actions()
1268 mib->fddiPORTNeighborType = TA ; in pc_rcode_actions()
1269 else if (phy->r_val[1] == 0 && phy->r_val[2] == 1) in pc_rcode_actions()
1270 mib->fddiPORTNeighborType = TB ; in pc_rcode_actions()
1271 else if (phy->r_val[1] == 1 && phy->r_val[2] == 0) in pc_rcode_actions()
1272 mib->fddiPORTNeighborType = TS ; in pc_rcode_actions()
1273 else if (phy->r_val[1] == 1 && phy->r_val[2] == 1) in pc_rcode_actions()
1274 mib->fddiPORTNeighborType = TM ; in pc_rcode_actions()
1277 if (mib->fddiPORTMy_Type == TM && in pc_rcode_actions()
1278 mib->fddiPORTNeighborType == TM) { in pc_rcode_actions()
1279 DB_PCMN(1, "PCM %c : E100 withhold M-M", in pc_rcode_actions()
1280 phy->phy_name); in pc_rcode_actions()
1281 mib->fddiPORTPC_Withhold = PC_WH_M_M ; in pc_rcode_actions()
1284 else if (phy->t_val[3] || phy->r_val[3]) { in pc_rcode_actions()
1285 mib->fddiPORTPC_Withhold = PC_WH_NONE ; in pc_rcode_actions()
1286 if (mib->fddiPORTMy_Type == TM || in pc_rcode_actions()
1287 mib->fddiPORTNeighborType == TM) in pc_rcode_actions()
1288 phy->pc_mode = PM_TREE ; in pc_rcode_actions()
1290 phy->pc_mode = PM_PEER ; in pc_rcode_actions()
1295 if (phy->wc_flag) { in pc_rcode_actions()
1296 mib->fddiPORTPC_Withhold = PC_WH_PATH ; in pc_rcode_actions()
1300 mib->fddiPORTPC_Withhold = PC_WH_OTHER ; in pc_rcode_actions()
1303 phy->phy_name); in pc_rcode_actions()
1305 phy->twisted = ((mib->fddiPORTMy_Type != TS) && in pc_rcode_actions()
1306 (mib->fddiPORTMy_Type != TM) && in pc_rcode_actions()
1307 (mib->fddiPORTNeighborType == in pc_rcode_actions()
1308 mib->fddiPORTMy_Type)) ; in pc_rcode_actions()
1309 if (phy->twisted) { in pc_rcode_actions()
1311 phy->phy_name); in pc_rcode_actions()
1317 if (phy->t_val[4] || phy->r_val[4]) { in pc_rcode_actions()
1318 if ((phy->t_val[4] && phy->t_val[5]) || in pc_rcode_actions()
1319 (phy->r_val[4] && phy->r_val[5]) ) in pc_rcode_actions()
1320 phy->lc_test = LC_EXTENDED ; in pc_rcode_actions()
1322 phy->lc_test = LC_LONG ; in pc_rcode_actions()
1324 else if (phy->t_val[5] || phy->r_val[5]) in pc_rcode_actions()
1325 phy->lc_test = LC_MEDIUM ; in pc_rcode_actions()
1327 phy->lc_test = LC_SHORT ; in pc_rcode_actions()
1328 switch (phy->lc_test) { in pc_rcode_actions()
1330 outpw(PLC((int)phy->np,PL_LC_LENGTH), TP_LC_LENGTH ) ; in pc_rcode_actions()
1331 phy->t_next[7] = smc->s.pcm_lc_short ; in pc_rcode_actions()
1334 outpw(PLC((int)phy->np,PL_LC_LENGTH), TP_LC_LONGLN ) ; in pc_rcode_actions()
1335 phy->t_next[7] = smc->s.pcm_lc_medium ; in pc_rcode_actions()
1338 SETMASK(PLC((int)phy->np,PL_CNTRL_B),PL_LONG,PL_LONG) ; in pc_rcode_actions()
1339 phy->t_next[7] = smc->s.pcm_lc_long ; in pc_rcode_actions()
1342 SETMASK(PLC((int)phy->np,PL_CNTRL_B),PL_LONG,PL_LONG) ; in pc_rcode_actions()
1343 phy->t_next[7] = smc->s.pcm_lc_extended ; in pc_rcode_actions()
1346 if (phy->t_next[7] > smc->s.pcm_lc_medium) { in pc_rcode_actions()
1347 start_pcm_timer0(smc,phy->t_next[7],PC_TIMEOUT_LCT,phy); in pc_rcode_actions()
1349 DB_PCMN(1, "LCT timer = %ld us", phy->t_next[7]); in pc_rcode_actions()
1350 phy->t_next[9] = smc->s.pcm_t_next_9 ; in pc_rcode_actions()
1353 if (phy->t_val[6]) { in pc_rcode_actions()
1354 phy->cf_loop = TRUE ; in pc_rcode_actions()
1356 phy->td_flag = TRUE ; in pc_rcode_actions()
1359 if (phy->t_val[7] || phy->r_val[7]) { in pc_rcode_actions()
1361 phy->phy_name, in pc_rcode_actions()
1362 phy->t_val[7] ? "local" : "remote"); in pc_rcode_actions()
1363 queue_event(smc,(int)(EVENT_PCM+phy->np),PC_START) ; in pc_rcode_actions()
1367 if (phy->t_val[8] || phy->r_val[8]) { in pc_rcode_actions()
1368 if (phy->t_val[8]) in pc_rcode_actions()
1369 phy->cf_loop = TRUE ; in pc_rcode_actions()
1370 phy->td_flag = TRUE ; in pc_rcode_actions()
1374 if (phy->r_val[9]) { in pc_rcode_actions()
1376 mib->fddiPORTMacIndicated.R_val = TRUE ; in pc_rcode_actions()
1380 mib->fddiPORTMacIndicated.R_val = FALSE ; in pc_rcode_actions()
1391 int np = phy->np ; in pc_tcode_actions()
1394 mib = phy->mib ; in pc_tcode_actions()
1398 phy->t_val[0] = 0 ; /* no escape used */ in pc_tcode_actions()
1401 if (mib->fddiPORTMy_Type == TS || mib->fddiPORTMy_Type == TM) in pc_tcode_actions()
1402 phy->t_val[1] = 1 ; in pc_tcode_actions()
1404 phy->t_val[1] = 0 ; in pc_tcode_actions()
1407 if (mib->fddiPORTMy_Type == TB || mib->fddiPORTMy_Type == TM) in pc_tcode_actions()
1408 phy->t_val[2] = 1 ; in pc_tcode_actions()
1410 phy->t_val[2] = 0 ; in pc_tcode_actions()
1417 type = mib->fddiPORTMy_Type ; in pc_tcode_actions()
1418 ne = mib->fddiPORTNeighborType ; in pc_tcode_actions()
1419 policy = smc->mib.fddiSMTConnectionPolicy ; in pc_tcode_actions()
1421 phy->t_val[3] = 1 ; /* Accept connection */ in pc_tcode_actions()
1429 phy->t_val[3] = 0 ; /* Reject */ in pc_tcode_actions()
1437 phy->t_val[3] = 0 ; /* Reject */ in pc_tcode_actions()
1445 phy->t_val[3] = 0 ; /* Reject */ in pc_tcode_actions()
1453 phy->t_val[3] = 0 ; /* Reject */ in pc_tcode_actions()
1467 (int) (INDEX_PORT+ phy->np) ,0) ; in pc_tcode_actions()
1473 if (mib->fddiPORTPC_Withhold == PC_WH_NONE) { in pc_tcode_actions()
1474 if (phy->pc_lem_fail) { in pc_tcode_actions()
1475 phy->t_val[4] = 1 ; /* long */ in pc_tcode_actions()
1476 phy->t_val[5] = 0 ; in pc_tcode_actions()
1479 phy->t_val[4] = 0 ; in pc_tcode_actions()
1480 if (mib->fddiPORTLCTFail_Ct > 0) in pc_tcode_actions()
1481 phy->t_val[5] = 1 ; /* medium */ in pc_tcode_actions()
1483 phy->t_val[5] = 0 ; /* short */ in pc_tcode_actions()
1490 if (phy->wc_flag) in pc_tcode_actions()
1491 phy->t_val[5] = 1 ; /* medium */ in pc_tcode_actions()
1493 mib->fddiPORTConnectState = PCM_CONNECTING ; in pc_tcode_actions()
1496 mib->fddiPORTConnectState = PCM_STANDBY ; in pc_tcode_actions()
1497 phy->t_val[4] = 1 ; /* extended */ in pc_tcode_actions()
1498 phy->t_val[5] = 1 ; in pc_tcode_actions()
1505 phy->t_val[6] = 0 ; in pc_tcode_actions()
1508 phy->cf_loop = FALSE ; in pc_tcode_actions()
1510 if (phy->pc_lem_fail) { in pc_tcode_actions()
1511 DB_PCMN(1, "PCM %c : E104 LCT failed", phy->phy_name); in pc_tcode_actions()
1512 phy->t_val[7] = 1 ; in pc_tcode_actions()
1515 phy->t_val[7] = 0 ; in pc_tcode_actions()
1518 phy->t_val[8] = 0 ; /* Don't request MAC loopback */ in pc_tcode_actions()
1521 phy->cf_loop = 0 ; in pc_tcode_actions()
1522 if ((mib->fddiPORTPC_Withhold != PC_WH_NONE) || in pc_tcode_actions()
1523 ((smc->s.sas == SMT_DAS) && (phy->wc_flag))) { in pc_tcode_actions()
1527 phy->t_val[9] = FALSE ; in pc_tcode_actions()
1528 switch (smc->s.sas) { in pc_tcode_actions()
1533 if (phy->pc_mode == PM_TREE) { in pc_tcode_actions()
1535 (smc->y[PB].mib->fddiPORTConnectState != in pc_tcode_actions()
1537 phy->t_val[9] = TRUE ; in pc_tcode_actions()
1541 phy->t_val[9] = TRUE ; in pc_tcode_actions()
1546 phy->t_val[9] = TRUE ; in pc_tcode_actions()
1554 phy->t_val[9] = TRUE ; in pc_tcode_actions()
1558 mib->fddiPORTMacIndicated.T_val = phy->t_val[9] ; in pc_tcode_actions()
1561 DB_PCMN(1, "SIG snd %x %x:", bit, phy->t_val[bit]); in pc_tcode_actions()
1570 if (smc->s.sas != SMT_DAS) in pcm_status_twisted()
1572 if (smc->y[PA].twisted && (smc->y[PA].mib->fddiPORTPCMState == PC8_ACTIVE)) in pcm_status_twisted()
1574 if (smc->y[PB].twisted && (smc->y[PB].mib->fddiPORTPCMState == PC8_ACTIVE)) in pcm_status_twisted()
1589 struct s_phy *phy = &smc->y[np] ; in pcm_status_state()
1592 mib = phy->mib ; in pcm_status_state()
1594 /* remote PHY type and MAC - set only if active */ in pcm_status_state()
1596 *type = mib->fddiPORTMy_Type ; /* our PHY type */ in pcm_status_state()
1597 *state = mib->fddiPORTConnectState ; in pcm_status_state()
1598 *remote = mib->fddiPORTNeighborType ; in pcm_status_state()
1600 switch(mib->fddiPORTPCMState) { in pcm_status_state()
1602 *mac = mib->fddiPORTMacIndicated.R_val ; in pcm_status_state()
1615 if (smc->y[n].mib->fddiPORTPCMState == PC8_ACTIVE && in pcm_rooted_station()
1616 smc->y[n].mib->fddiPORTNeighborType == TM) in pcm_rooted_station()
1628 struct s_phy *phy = &smc->y[np] ; in plc_irq()
1629 struct s_plc *plc = &phy->plc ; in plc_irq()
1636 if (np >= smc->s.numphys) { in plc_irq()
1637 plc->soft_err++ ; in plc_irq()
1640 if (cmd & PL_EBUF_ERR) { /* elastic buff. det. over-|underflow*/ in plc_irq()
1644 if (!plc->ebuf_cont && phy->mib->fddiPORTPCMState == PC8_ACTIVE){ in plc_irq()
1651 phy->mib->fddiPORTEBError_Ct ++ ; in plc_irq()
1655 plc->ebuf_err++ ; in plc_irq()
1656 if (plc->ebuf_cont <= 1000) { in plc_irq()
1661 plc->ebuf_cont++ ; /* Ebuf continuous error */ in plc_irq()
1665 if (plc->ebuf_cont == 1000 && in plc_irq()
1699 plc->ebuf_cont = 0 ; /* reset Ebuf continuous error */ in plc_irq()
1702 plc->phyinv++ ; in plc_irq()
1705 plc->vsym_ctr++ ; in plc_irq()
1708 plc->mini_ctr++ ; in plc_irq()
1724 if (phy->lem.lem_on) { in plc_irq()
1728 phy->lem.lem_errors += i ; in plc_irq()
1729 phy->mib->fddiPORTLem_Ct += i ; in plc_irq()
1733 if (plc->p_state == PS_LCT) { in plc_irq()
1739 plc->tpc_exp++ ; in plc_irq()
1743 case PL_I_IDLE : phy->curr_ls = PC_ILS ; break ; in plc_irq()
1744 case PL_I_HALT : phy->curr_ls = PC_HLS ; break ; in plc_irq()
1745 case PL_I_MASTR : phy->curr_ls = PC_MLS ; break ; in plc_irq()
1746 case PL_I_QUIET : phy->curr_ls = PC_QLS ; break ; in plc_irq()
1755 case PL_B_PCS : plc->b_pcs++ ; break ; in plc_irq()
1756 case PL_B_TPC : plc->b_tpc++ ; break ; in plc_irq()
1757 case PL_B_TNE : plc->b_tne++ ; break ; in plc_irq()
1758 case PL_B_QLS : plc->b_qls++ ; break ; in plc_irq()
1759 case PL_B_ILS : plc->b_ils++ ; break ; in plc_irq()
1760 case PL_B_HLS : plc->b_hls++ ; break ; in plc_irq()
1763 /*jd 05-Aug-1999 changed: Bug #10419 */ in plc_irq()
1764 DB_PCMN(1, "PLC %d: MDcF = %x", np, smc->e.DisconnectFlag); in plc_irq()
1765 if (smc->e.DisconnectFlag == FALSE) { in plc_irq()
1778 if (cmd & PL_PCM_CODE) { /* receive last sign.-bit | LCT complete */ in plc_irq()
1781 for (i = 0 ; i < plc->p_bits ; i++) { in plc_irq()
1782 phy->r_val[plc->p_start+i] = n & 1 ; in plc_irq()
1791 if (!phy->tr_flag) { in plc_irq()
1793 np, smc->mib.fddiSMTECMState); in plc_irq()
1794 phy->tr_flag = TRUE ; in plc_irq()
1795 smc->e.trace_prop |= ENTITY_BIT(ENTITY_PHY(np)) ; in plc_irq()
1803 if ((cmd & PL_SELF_TEST) && (phy->mib->fddiPORTPCMState == PC2_TRACE)) { in plc_irq()
1805 if (smc->e.path_test == PT_PASSED) { in plc_irq()
1808 phy->mib->fddiPORTPCMState); in plc_irq()
1810 smc->e.path_test = PT_PENDING ; in plc_irq()
1816 if (phy->mib->fddiPORTPCMState == PC8_ACTIVE) { in plc_irq()
1817 if (!phy->tr_flag) { in plc_irq()
1819 phy->phy_name, "NSE"); in plc_irq()
1830 plc->np_err++ ; in plc_irq()
1833 if (cmd & PL_PARITY_ERR) { /* p. error dedected on TX9-0 inp */ in plc_irq()
1834 plc->parity_err++ ; in plc_irq()
1856 for (i = 0, phy = smc->y, pcs = state->pcm_state ; i < NUMPHYS ; in pcm_get_state()
1858 mib = phy->mib ; in pcm_get_state()
1859 pcs->pcm_type = (u_char) mib->fddiPORTMy_Type ; in pcm_get_state()
1860 pcs->pcm_state = (u_char) mib->fddiPORTPCMState ; in pcm_get_state()
1861 pcs->pcm_mode = phy->pc_mode ; in pcm_get_state()
1862 pcs->pcm_neighbor = (u_char) mib->fddiPORTNeighborType ; in pcm_get_state()
1863 pcs->pcm_bsf = mib->fddiPORTBS_Flag ; in pcm_get_state()
1864 pcs->pcm_lsf = phy->ls_flag ; in pcm_get_state()
1865 pcs->pcm_lct_fail = (u_char) mib->fddiPORTLCTFail_Ct ; in pcm_get_state()
1866 pcs->pcm_ls_rx = LS2MIB(sm_pm_get_ls(smc,i)) ; in pcm_get_state()
1870 if (phy->r_val[NUMBITS-1-ii]) in pcm_get_state()
1872 if (phy->t_val[NUMBITS-1-ii]) in pcm_get_state()
1875 pcs->pcm_r_val = rbits ; in pcm_get_state()
1876 pcs->pcm_t_val = tbits ; in pcm_get_state()
1952 plc = &smc->y[np].plc ; in list_phy()
1955 plc->soft_err,plc->b_pcs); in list_phy()
1957 plc->parity_err,plc->b_tpc,get_linestate(smc,np)) ; in list_phy()
1959 plc->ebuf_err,plc->b_tne) ; in list_phy()
1961 plc->phyinv,plc->b_qls,get_pcmstate(smc,np)) ; in list_phy()
1963 plc->vsym_ctr,plc->b_ils) ; in list_phy()
1965 plc->mini_ctr,plc->b_hls) ; in list_phy()
1966 printf("\tnodepr_err: %ld\n",plc->np_err) ; in list_phy()
1967 printf("\tTPC_exp : %ld\n",plc->tpc_exp) ; in list_phy()
1968 printf("\tLEM_err : %ld\n",smc->y[np].lem.lem_errors) ; in list_phy()
1983 printf("----------------------\n") ; in pcm_lem_dump()
1984 for (i = 0,phy = smc->y ; i < NUMPHYS ; i++,phy++) { in pcm_lem_dump()
1987 mib = phy->mib ; in pcm_lem_dump()
1988 printf("%s\t%ld\t10E-%d\n", in pcm_lem_dump()
1990 mib->fddiPORTLem_Ct, in pcm_lem_dump()
1991 mib->fddiPORTLer_Estimate) ; in pcm_lem_dump()