Lines Matching full:smc

43 #include "h/smc.h"
51 struct s_smc * smc, int type, int index
58 struct s_smc *smc ,
191 static void pcm_fsm(struct s_smc *smc, struct s_phy *phy, int cmd);
192 static void pc_rcode_actions(struct s_smc *smc, int bit, struct s_phy *phy);
193 static void pc_tcode_actions(struct s_smc *smc, const int bit, struct s_phy *phy);
195 static void plc_init(struct s_smc *smc, int p);
196 static void sm_ph_lem_start(struct s_smc *smc, int np, int threshold);
197 static void sm_ph_lem_stop(struct s_smc *smc, int np);
198 static void sm_ph_linestate(struct s_smc *smc, int phy, int ls);
199 static void real_init_plc(struct s_smc *smc);
205 static void start_pcm_timer0(struct s_smc *smc, u_long value, int event, in start_pcm_timer0() argument
209 smt_timer_start(smc,&phy->pcm_timer0,value, in start_pcm_timer0()
216 static void stop_pcm_timer0(struct s_smc *smc, struct s_phy *phy) in stop_pcm_timer0() argument
219 smt_timer_stop(smc,&phy->pcm_timer0) ; in stop_pcm_timer0()
226 void pcm_init(struct s_smc *smc) in pcm_init() argument
233 for (np = 0,phy = smc->y ; np < NUMPHYS ; np++,phy++) { in pcm_init()
238 switch (smc->s.sas) { 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()
387 real_init_plc(smc) ; in pcm_init()
390 void init_plc(struct s_smc *smc) in init_plc() argument
392 SK_UNUSED(smc) ; in init_plc()
403 static void real_init_plc(struct s_smc *smc) in real_init_plc() argument
408 plc_init(smc,p) ; in real_init_plc()
411 static void plc_init(struct s_smc *smc, int p) in plc_init() argument
431 if (smc->y[p].pmd_scramble) { in plc_init()
454 plc_clear_irq(smc,p) ; in plc_init()
465 if ((smc->s.sas == SMT_SAS) && (p == PS)) { in plc_init()
474 static void plc_go_state(struct s_smc *smc, int p, int state) in plc_go_state() argument
479 SK_UNUSED(smc) ; in plc_go_state()
490 int sm_pm_get_ls(struct s_smc *smc, int phy) in sm_pm_get_ls() argument
495 if (!plc_is_installed(smc,phy)) in sm_pm_get_ls()
523 static int plc_send_bits(struct s_smc *smc, struct s_phy *phy, int len) in plc_send_bits() argument
529 SK_UNUSED(smc) ; in plc_send_bits()
547 if (smc->debug.d_plc & 0x80) in plc_send_bits()
560 void plc_config_mux(struct s_smc *smc, int mux) in plc_config_mux() argument
562 if (smc->s.sas != SMT_DAS) in plc_config_mux()
584 void pcm(struct s_smc *smc, const int np, int event) in pcm() argument
595 if ((np != PS) && (smc->s.sas == SMT_SAS)) in pcm()
598 phy = &smc->y[np] ; in pcm()
608 pcm_fsm(smc,phy,event) ; in pcm()
628 smt_srf_event(smc,SMT_EVENT_PORT_PATH_CHANGE, in pcm()
641 snmp_fddi_trap (smc, 1, (int) mib->fddiPORTIndex ); in pcm()
644 snmp_fddi_trap (smc, 2, (int) mib->fddiPORTIndex ); in pcm()
648 snmp_fddi_trap (smc, 3, (int) mib->fddiPORTIndex ); in pcm()
651 snmp_fddi_trap (smc, 4, (int) mib->fddiPORTIndex ); in pcm()
656 pcm_state_change(smc,np,state) ; in pcm()
662 static void pcm_fsm(struct s_smc *smc, struct s_phy *phy, int cmd) in pcm_fsm() argument
683 AIX_EVENT(smc, (u_long) FDDI_RING_STATUS, (u_long) in pcm_fsm()
685 smt_get_port_event_word(smc)); in pcm_fsm()
696 AIX_EVENT(smc, (u_long) FDDI_RING_STATUS, (u_long) in pcm_fsm()
698 smt_get_port_event_word(smc)); in pcm_fsm()
702 stop_pcm_timer0(smc,phy) ; in pcm_fsm()
710 stop_pcm_timer0(smc,phy) ; in pcm_fsm()
714 sm_ph_lem_stop(smc,np) ; /* disable LEM */ in pcm_fsm()
717 queue_event(smc,EVENT_CFM,CF_JOIN+np) ; in pcm_fsm()
718 plc_go_state(smc,np,PL_PCM_STOP) ; in pcm_fsm()
731 stop_pcm_timer0(smc,phy) ; in pcm_fsm()
733 plc_go_state(smc,np,0) ; in pcm_fsm()
736 sm_ph_lem_stop(smc,np) ; /* disable LEM */ in pcm_fsm()
742 plc_go_state(smc,np,PL_PCM_STOP) ; in pcm_fsm()
749 plc_go_state(smc,np,PL_PCM_STOP) ; in pcm_fsm()
755 queue_event(smc,EVENT_CFM,CF_JOIN+np) ; in pcm_fsm()
760 pc_tcode_actions(smc,i,phy) ; in pcm_fsm()
782 if (plc_send_bits(smc,phy,3)) { in pcm_fsm()
802 plc_go_state(smc,np,PL_PCM_START) ; in pcm_fsm()
819 (void) plc_send_bits(smc,phy,3) ; in pcm_fsm()
834 plc_go_state(smc,np,PL_PCM_TRACE) ; in pcm_fsm()
853 pc_rcode_actions(smc,i,phy) ; in pcm_fsm()
854 pc_tcode_actions(smc,3,phy) ; in pcm_fsm()
859 if (plc_send_bits(smc,phy,1)) { in pcm_fsm()
864 pc_rcode_actions(smc,3,phy) ; in pcm_fsm()
866 pc_tcode_actions(smc,i,phy) ; in pcm_fsm()
871 if (plc_send_bits(smc,phy,3)) { in pcm_fsm()
877 pc_rcode_actions(smc,i,phy) ; in pcm_fsm()
882 sm_ph_lem_start(smc,np,(int)smc->s.lct_short) ; /* enable LEM */ in pcm_fsm()
890 pc_tcode_actions(smc,7,phy) ; in pcm_fsm()
898 if (plc_send_bits(smc,phy,1)) { in pcm_fsm()
904 pc_rcode_actions(smc,7,phy) ; in pcm_fsm()
906 plc_go_state(smc,np,PL_PCM_STOP) ; in pcm_fsm()
911 pc_tcode_actions(smc,i,phy) ; in pcm_fsm()
916 if (plc_send_bits(smc,phy,2)) { in pcm_fsm()
922 pc_rcode_actions(smc,i,phy) ; 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()
952 queue_event(smc,EVENT_CFM,CF_JOIN+np) ; in pcm_fsm()
972 sm_ph_lem_start(smc,(int)phy->np,LCT_LEM_MAX) ; in pcm_fsm()
993 stop_pcm_timer0(smc,phy) ; in pcm_fsm()
997 sm_ph_lem_stop(smc,np) ; /* disable LEM */ in pcm_fsm()
1000 queue_event(smc,EVENT_CFM,CF_JOIN+np) ; in pcm_fsm()
1001 plc_go_state(smc,np,PL_PCM_STOP) ; in pcm_fsm()
1004 sm_ph_linestate(smc,np,(int) MIB2LS(mib->fddiPORTMaint_LS)) ; in pcm_fsm()
1018 SMT_PANIC(smc,SMT_E0118, SMT_E0118_MSG) ; in pcm_fsm()
1026 static void sm_ph_linestate(struct s_smc *smc, int phy, int ls) in sm_ph_linestate() argument
1030 SK_UNUSED(smc) ; in sm_ph_linestate()
1066 static void lem_evaluate(struct s_smc *smc, struct s_phy *phy) in lem_evaluate() argument
1132 smt_ler_alarm_check(smc,phy,cond) ; in lem_evaluate()
1135 smt_srf_event(smc,SMT_COND_PORT_LER, 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()
1165 void sm_lem_evaluate(struct s_smc *smc) in sm_lem_evaluate() argument
1170 lem_evaluate(smc,&smc->y[np]) ; in sm_lem_evaluate()
1173 static void lem_check_lct(struct s_smc *smc, struct s_phy *phy) in lem_check_lct() argument
1188 if (lem->lem_errors >= smc->s.lct_short) in lem_check_lct()
1192 if (lem->lem_errors >= smc->s.lct_medium) in lem_check_lct()
1196 if (lem->lem_errors >= smc->s.lct_long) in lem_check_lct()
1200 if (lem->lem_errors >= smc->s.lct_extended) in lem_check_lct()
1217 static void sm_ph_lem_start(struct s_smc *smc, int np, int threshold) in sm_ph_lem_start() argument
1219 struct lem_counter *lem = &smc->y[np].lem ; in sm_ph_lem_start()
1235 static void sm_ph_lem_stop(struct s_smc *smc, int np) in sm_ph_lem_stop() argument
1237 struct lem_counter *lem = &smc->y[np].lem ; in sm_ph_lem_stop()
1252 static void pc_rcode_actions(struct s_smc *smc, int bit, struct s_phy *phy) in pc_rcode_actions() argument
1282 RS_SET(smc,RS_EVENT) ; in pc_rcode_actions()
1293 all_selection_criteria (smc); in pc_rcode_actions()
1301 RS_SET(smc,RS_EVENT) ; in pc_rcode_actions()
1331 phy->t_next[7] = smc->s.pcm_lc_short ; in pc_rcode_actions()
1335 phy->t_next[7] = smc->s.pcm_lc_medium ; in pc_rcode_actions()
1339 phy->t_next[7] = smc->s.pcm_lc_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()
1350 phy->t_next[9] = smc->s.pcm_t_next_9 ; in pc_rcode_actions()
1363 queue_event(smc,(int)(EVENT_PCM+phy->np),PC_START) ; in pc_rcode_actions()
1389 static void pc_tcode_actions(struct s_smc *smc, const int bit, struct s_phy *phy) in pc_tcode_actions() argument
1419 policy = smc->mib.fddiSMTConnectionPolicy ; in pc_tcode_actions()
1466 smt_srf_event(smc,SMT_EVENT_PORT_CONNECTION, in pc_tcode_actions()
1509 lem_check_lct(smc,phy) ; in pc_tcode_actions()
1523 ((smc->s.sas == SMT_DAS) && (phy->wc_flag))) { in pc_tcode_actions()
1524 queue_event(smc,EVENT_PCM+np,PC_START) ; in pc_tcode_actions()
1528 switch (smc->s.sas) { in pc_tcode_actions()
1535 (smc->y[PB].mib->fddiPORTConnectState != in pc_tcode_actions()
1567 int pcm_status_twisted(struct s_smc *smc) in pcm_status_twisted() argument
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()
1586 void pcm_status_state(struct s_smc *smc, int np, int *type, int *state, in pcm_status_state() argument
1589 struct s_phy *phy = &smc->y[np] ; in pcm_status_state()
1610 int pcm_rooted_station(struct s_smc *smc) in pcm_rooted_station() argument
1615 if (smc->y[n].mib->fddiPORTPCMState == PC8_ACTIVE && in pcm_rooted_station()
1616 smc->y[n].mib->fddiPORTNeighborType == TM) in pcm_rooted_station()
1625 void plc_irq(struct s_smc *smc, int np, unsigned int cmd) in plc_irq() argument
1628 struct s_phy *phy = &smc->y[np] ; in plc_irq()
1636 if (np >= smc->s.numphys) { in plc_irq()
1684 queue_event(smc,EVENT_ECM,EC_DISCONNECT) ; in plc_irq()
1689 SMT_ERR_LOG(smc,SMT_E0136, SMT_E0136_MSG) ; in plc_irq()
1694 drv_reset_indication(smc) ; 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()
1767 queue_event(smc,EVENT_PCM+np,PC_START) ; in plc_irq()
1779 queue_event(smc,EVENT_PCM+np,PC_SIGNAL) ; in plc_irq()
1787 queue_event(smc,EVENT_PCM+np,PC_JOIN) ; in plc_irq()
1793 np, smc->mib.fddiSMTECMState); in plc_irq()
1795 smc->e.trace_prop |= ENTITY_BIT(ENTITY_PHY(np)) ; in plc_irq()
1796 queue_event(smc,EVENT_ECM,EC_TRACE_PROP) ; in plc_irq()
1805 if (smc->e.path_test == PT_PASSED) { in plc_irq()
1807 get_pcmstate(smc, np), in plc_irq()
1810 smc->e.path_test = PT_PENDING ; in plc_irq()
1811 queue_event(smc,EVENT_ECM,EC_PATH_TEST) ; in plc_irq()
1820 queue_event(smc, EVENT_PCM + np, PC_START); in plc_irq()
1846 void pcm_get_state(struct s_smc *smc, struct smt_state *state) in pcm_get_state() argument
1856 for (i = 0, phy = smc->y, pcs = state->pcm_state ; i < NUMPHYS ; in pcm_get_state()
1866 pcs->pcm_ls_rx = LS2MIB(sm_pm_get_ls(smc,i)) ; in pcm_get_state()
1880 int get_pcm_state(struct s_smc *smc, int np) in get_pcm_state() argument
1884 SK_UNUSED(smc) ; in get_pcm_state()
1902 char *get_linestate(struct s_smc *smc, int np) in get_linestate() argument
1906 SK_UNUSED(smc) ; in get_linestate()
1924 char *get_pcmstate(struct s_smc *smc, int np) in get_pcmstate() argument
1928 SK_UNUSED(smc) ; in get_pcmstate()
1946 void list_phy(struct s_smc *smc) in list_phy() argument
1952 plc = &smc->y[np].plc ; in list_phy()
1957 plc->parity_err,plc->b_tpc,get_linestate(smc,np)) ; in list_phy()
1961 plc->phyinv,plc->b_qls,get_pcmstate(smc,np)) ; in list_phy()
1968 printf("\tLEM_err : %ld\n",smc->y[np].lem.lem_errors) ; in list_phy()
1974 void pcm_lem_dump(struct s_smc *smc) in pcm_lem_dump() argument
1984 for (i = 0,phy = smc->y ; i < NUMPHYS ; i++,phy++) { in pcm_lem_dump()
1985 if (!plc_is_installed(smc,i)) in pcm_lem_dump()
1989 entostring(smc,ENTITY_PHY(i)), in pcm_lem_dump()