Lines Matching full:smc

43 #include "h/smc.h"
55 struct s_smc * smc, int type, int index
62 struct s_smc *smc ,
195 static void pcm_fsm(struct s_smc *smc, struct s_phy *phy, int cmd);
196 static void pc_rcode_actions(struct s_smc *smc, int bit, struct s_phy *phy);
197 static void pc_tcode_actions(struct s_smc *smc, const int bit, struct s_phy *phy);
199 static void plc_init(struct s_smc *smc, int p);
200 static void sm_ph_lem_start(struct s_smc *smc, int np, int threshold);
201 static void sm_ph_lem_stop(struct s_smc *smc, int np);
202 static void sm_ph_linestate(struct s_smc *smc, int phy, int ls);
203 static void real_init_plc(struct s_smc *smc);
209 static void start_pcm_timer0(struct s_smc *smc, u_long value, int event, in start_pcm_timer0() argument
213 smt_timer_start(smc,&phy->pcm_timer0,value, in start_pcm_timer0()
220 static void stop_pcm_timer0(struct s_smc *smc, struct s_phy *phy) in stop_pcm_timer0() argument
223 smt_timer_stop(smc,&phy->pcm_timer0) ; in stop_pcm_timer0()
230 void pcm_init(struct s_smc *smc) in pcm_init() argument
237 for (np = 0,phy = smc->y ; np < NUMPHYS ; np++,phy++) { in pcm_init()
242 switch (smc->s.sas) { in pcm_init()
260 smc->y[PA].mib->fddiPORTPCMState = PC0_OFF ; in pcm_init()
262 smc->y[PB].mib->fddiPORTPCMState = PC0_OFF ; in pcm_init()
391 real_init_plc(smc) ; in pcm_init()
394 void init_plc(struct s_smc *smc) in init_plc() argument
396 SK_UNUSED(smc) ; in init_plc()
407 static void real_init_plc(struct s_smc *smc) in real_init_plc() argument
412 plc_init(smc,p) ; in real_init_plc()
415 static void plc_init(struct s_smc *smc, int p) in plc_init() argument
435 if (smc->y[p].pmd_scramble) { in plc_init()
458 plc_clear_irq(smc,p) ; in plc_init()
469 if ((smc->s.sas == SMT_SAS) && (p == PS)) { in plc_init()
478 static void plc_go_state(struct s_smc *smc, int p, int state) in plc_go_state() argument
483 SK_UNUSED(smc) ; in plc_go_state()
494 int sm_pm_get_ls(struct s_smc *smc, int phy) in sm_pm_get_ls() argument
499 if (!plc_is_installed(smc,phy)) in sm_pm_get_ls()
527 static int plc_send_bits(struct s_smc *smc, struct s_phy *phy, int len) in plc_send_bits() argument
533 SK_UNUSED(smc) ; in plc_send_bits()
551 if (smc->debug.d_plc & 0x80) in plc_send_bits()
564 void plc_config_mux(struct s_smc *smc, int mux) in plc_config_mux() argument
566 if (smc->s.sas != SMT_DAS) in plc_config_mux()
588 void pcm(struct s_smc *smc, const int np, int event) in pcm() argument
599 if ((np != PS) && (smc->s.sas == SMT_SAS)) in pcm()
602 phy = &smc->y[np] ; in pcm()
612 pcm_fsm(smc,phy,event) ; in pcm()
632 smt_srf_event(smc,SMT_EVENT_PORT_PATH_CHANGE, in pcm()
645 snmp_fddi_trap (smc, 1, (int) mib->fddiPORTIndex ); in pcm()
648 snmp_fddi_trap (smc, 2, (int) mib->fddiPORTIndex ); in pcm()
652 snmp_fddi_trap (smc, 3, (int) mib->fddiPORTIndex ); in pcm()
655 snmp_fddi_trap (smc, 4, (int) mib->fddiPORTIndex ); in pcm()
660 pcm_state_change(smc,np,state) ; in pcm()
666 static void pcm_fsm(struct s_smc *smc, struct s_phy *phy, int cmd) in pcm_fsm() argument
687 AIX_EVENT(smc, (u_long) FDDI_RING_STATUS, (u_long) in pcm_fsm()
689 smt_get_port_event_word(smc)); in pcm_fsm()
700 AIX_EVENT(smc, (u_long) FDDI_RING_STATUS, (u_long) in pcm_fsm()
702 smt_get_port_event_word(smc)); in pcm_fsm()
706 stop_pcm_timer0(smc,phy) ; in pcm_fsm()
714 stop_pcm_timer0(smc,phy) ; in pcm_fsm()
718 sm_ph_lem_stop(smc,np) ; /* disable LEM */ in pcm_fsm()
721 queue_event(smc,EVENT_CFM,CF_JOIN+np) ; in pcm_fsm()
722 plc_go_state(smc,np,PL_PCM_STOP) ; in pcm_fsm()
735 stop_pcm_timer0(smc,phy) ; in pcm_fsm()
737 plc_go_state(smc,np,0) ; in pcm_fsm()
740 sm_ph_lem_stop(smc,np) ; /* disable LEM */ in pcm_fsm()
746 plc_go_state(smc,np,PL_PCM_STOP) ; in pcm_fsm()
753 plc_go_state(smc,np,PL_PCM_STOP) ; in pcm_fsm()
759 queue_event(smc,EVENT_CFM,CF_JOIN+np) ; in pcm_fsm()
764 pc_tcode_actions(smc,i,phy) ; in pcm_fsm()
786 if (plc_send_bits(smc,phy,3)) { in pcm_fsm()
806 plc_go_state(smc,np,PL_PCM_START) ; in pcm_fsm()
823 (void) plc_send_bits(smc,phy,3) ; in pcm_fsm()
838 plc_go_state(smc,np,PL_PCM_TRACE) ; in pcm_fsm()
857 pc_rcode_actions(smc,i,phy) ; in pcm_fsm()
858 pc_tcode_actions(smc,3,phy) ; in pcm_fsm()
863 if (plc_send_bits(smc,phy,1)) { in pcm_fsm()
868 pc_rcode_actions(smc,3,phy) ; in pcm_fsm()
870 pc_tcode_actions(smc,i,phy) ; in pcm_fsm()
875 if (plc_send_bits(smc,phy,3)) { in pcm_fsm()
881 pc_rcode_actions(smc,i,phy) ; in pcm_fsm()
886 sm_ph_lem_start(smc,np,(int)smc->s.lct_short) ; /* enable LEM */ in pcm_fsm()
894 pc_tcode_actions(smc,7,phy) ; in pcm_fsm()
902 if (plc_send_bits(smc,phy,1)) { in pcm_fsm()
908 pc_rcode_actions(smc,7,phy) ; in pcm_fsm()
910 plc_go_state(smc,np,PL_PCM_STOP) ; in pcm_fsm()
915 pc_tcode_actions(smc,i,phy) ; in pcm_fsm()
920 if (plc_send_bits(smc,phy,2)) { in pcm_fsm()
926 pc_rcode_actions(smc,i,phy) ; in pcm_fsm()
937 if (smc->s.sas == SMT_DAS && np == PB && in pcm_fsm()
938 (smc->y[PA].pc_mode == PM_TREE || in pcm_fsm()
939 smc->y[PB].pc_mode == PM_TREE)) { in pcm_fsm()
956 queue_event(smc,EVENT_CFM,CF_JOIN+np) ; in pcm_fsm()
976 sm_ph_lem_start(smc,(int)phy->np,LCT_LEM_MAX) ; in pcm_fsm()
997 stop_pcm_timer0(smc,phy) ; in pcm_fsm()
1001 sm_ph_lem_stop(smc,np) ; /* disable LEM */ in pcm_fsm()
1004 queue_event(smc,EVENT_CFM,CF_JOIN+np) ; in pcm_fsm()
1005 plc_go_state(smc,np,PL_PCM_STOP) ; in pcm_fsm()
1008 sm_ph_linestate(smc,np,(int) MIB2LS(mib->fddiPORTMaint_LS)) ; in pcm_fsm()
1022 SMT_PANIC(smc,SMT_E0118, SMT_E0118_MSG) ; in pcm_fsm()
1030 static void sm_ph_linestate(struct s_smc *smc, int phy, int ls) in sm_ph_linestate() argument
1034 SK_UNUSED(smc) ; in sm_ph_linestate()
1070 static void lem_evaluate(struct s_smc *smc, struct s_phy *phy) in lem_evaluate() argument
1136 smt_ler_alarm_check(smc,phy,cond) ; in lem_evaluate()
1139 smt_srf_event(smc,SMT_COND_PORT_LER, in lem_evaluate()
1159 smt_port_off_event(smc,phy->np); in lem_evaluate()
1161 queue_event(smc,(int)(EVENT_PCM+phy->np),PC_START) ; in lem_evaluate()
1169 void sm_lem_evaluate(struct s_smc *smc) in sm_lem_evaluate() argument
1174 lem_evaluate(smc,&smc->y[np]) ; in sm_lem_evaluate()
1177 static void lem_check_lct(struct s_smc *smc, struct s_phy *phy) in lem_check_lct() argument
1192 if (lem->lem_errors >= smc->s.lct_short) in lem_check_lct()
1196 if (lem->lem_errors >= smc->s.lct_medium) in lem_check_lct()
1200 if (lem->lem_errors >= smc->s.lct_long) in lem_check_lct()
1204 if (lem->lem_errors >= smc->s.lct_extended) in lem_check_lct()
1221 static void sm_ph_lem_start(struct s_smc *smc, int np, int threshold) in sm_ph_lem_start() argument
1223 struct lem_counter *lem = &smc->y[np].lem ; in sm_ph_lem_start()
1239 static void sm_ph_lem_stop(struct s_smc *smc, int np) in sm_ph_lem_stop() argument
1241 struct lem_counter *lem = &smc->y[np].lem ; in sm_ph_lem_stop()
1256 static void pc_rcode_actions(struct s_smc *smc, int bit, struct s_phy *phy) in pc_rcode_actions() argument
1286 RS_SET(smc,RS_EVENT) ; in pc_rcode_actions()
1297 all_selection_criteria (smc); in pc_rcode_actions()
1305 RS_SET(smc,RS_EVENT) ; in pc_rcode_actions()
1335 phy->t_next[7] = smc->s.pcm_lc_short ; in pc_rcode_actions()
1339 phy->t_next[7] = smc->s.pcm_lc_medium ; in pc_rcode_actions()
1343 phy->t_next[7] = smc->s.pcm_lc_long ; in pc_rcode_actions()
1347 phy->t_next[7] = smc->s.pcm_lc_extended ; in pc_rcode_actions()
1350 if (phy->t_next[7] > smc->s.pcm_lc_medium) { in pc_rcode_actions()
1351 start_pcm_timer0(smc,phy->t_next[7],PC_TIMEOUT_LCT,phy); in pc_rcode_actions()
1354 phy->t_next[9] = smc->s.pcm_t_next_9 ; in pc_rcode_actions()
1367 queue_event(smc,(int)(EVENT_PCM+phy->np),PC_START) ; in pc_rcode_actions()
1393 static void pc_tcode_actions(struct s_smc *smc, const int bit, struct s_phy *phy) in pc_tcode_actions() argument
1423 policy = smc->mib.fddiSMTConnectionPolicy ; in pc_tcode_actions()
1470 smt_srf_event(smc,SMT_EVENT_PORT_CONNECTION, in pc_tcode_actions()
1513 lem_check_lct(smc,phy) ; in pc_tcode_actions()
1527 ((smc->s.sas == SMT_DAS) && (phy->wc_flag))) { in pc_tcode_actions()
1528 queue_event(smc,EVENT_PCM+np,PC_START) ; in pc_tcode_actions()
1532 switch (smc->s.sas) { in pc_tcode_actions()
1539 (smc->y[PB].mib->fddiPORTConnectState != in pc_tcode_actions()
1571 int pcm_status_twisted(struct s_smc *smc) in pcm_status_twisted() argument
1574 if (smc->s.sas != SMT_DAS) in pcm_status_twisted()
1576 if (smc->y[PA].twisted && (smc->y[PA].mib->fddiPORTPCMState == PC8_ACTIVE)) in pcm_status_twisted()
1578 if (smc->y[PB].twisted && (smc->y[PB].mib->fddiPORTPCMState == PC8_ACTIVE)) in pcm_status_twisted()
1590 void pcm_status_state(struct s_smc *smc, int np, int *type, int *state, in pcm_status_state() argument
1593 struct s_phy *phy = &smc->y[np] ; in pcm_status_state()
1614 int pcm_rooted_station(struct s_smc *smc) in pcm_rooted_station() argument
1619 if (smc->y[n].mib->fddiPORTPCMState == PC8_ACTIVE && in pcm_rooted_station()
1620 smc->y[n].mib->fddiPORTNeighborType == TM) in pcm_rooted_station()
1629 void plc_irq(struct s_smc *smc, int np, unsigned int cmd) in plc_irq() argument
1632 struct s_phy *phy = &smc->y[np] ; in plc_irq()
1640 if (np >= smc->s.numphys) { in plc_irq()
1688 queue_event(smc,EVENT_ECM,EC_DISCONNECT) ; in plc_irq()
1693 SMT_ERR_LOG(smc,SMT_E0136, SMT_E0136_MSG) ; in plc_irq()
1698 drv_reset_indication(smc) ; in plc_irq()
1768 DB_PCMN(1, "PLC %d: MDcF = %x", np, smc->e.DisconnectFlag); in plc_irq()
1769 if (smc->e.DisconnectFlag == FALSE) { in plc_irq()
1771 queue_event(smc,EVENT_PCM+np,PC_START) ; in plc_irq()
1783 queue_event(smc,EVENT_PCM+np,PC_SIGNAL) ; in plc_irq()
1791 queue_event(smc,EVENT_PCM+np,PC_JOIN) ; in plc_irq()
1797 np, smc->mib.fddiSMTECMState); in plc_irq()
1799 smc->e.trace_prop |= ENTITY_BIT(ENTITY_PHY(np)) ; in plc_irq()
1800 queue_event(smc,EVENT_ECM,EC_TRACE_PROP) ; in plc_irq()
1809 if (smc->e.path_test == PT_PASSED) { in plc_irq()
1811 get_pcmstate(smc, np), in plc_irq()
1814 smc->e.path_test = PT_PENDING ; in plc_irq()
1815 queue_event(smc,EVENT_ECM,EC_PATH_TEST) ; in plc_irq()
1824 queue_event(smc, EVENT_PCM + np, PC_START); in plc_irq()
1850 void pcm_get_state(struct s_smc *smc, struct smt_state *state) in pcm_get_state() argument
1860 for (i = 0, phy = smc->y, pcs = state->pcm_state ; i < NUMPHYS ; in pcm_get_state()
1870 pcs->pcm_ls_rx = LS2MIB(sm_pm_get_ls(smc,i)) ; in pcm_get_state()
1884 int get_pcm_state(struct s_smc *smc, int np) in get_pcm_state() argument
1888 SK_UNUSED(smc) ; in get_pcm_state()
1906 char *get_linestate(struct s_smc *smc, int np) in get_linestate() argument
1910 SK_UNUSED(smc) ; in get_linestate()
1928 char *get_pcmstate(struct s_smc *smc, int np) in get_pcmstate() argument
1932 SK_UNUSED(smc) ; in get_pcmstate()
1950 void list_phy(struct s_smc *smc) in list_phy() argument
1956 plc = &smc->y[np].plc ; in list_phy()
1961 plc->parity_err,plc->b_tpc,get_linestate(smc,np)) ; in list_phy()
1965 plc->phyinv,plc->b_qls,get_pcmstate(smc,np)) ; in list_phy()
1972 printf("\tLEM_err : %ld\n",smc->y[np].lem.lem_errors) ; in list_phy()
1978 void pcm_lem_dump(struct s_smc *smc) in pcm_lem_dump() argument
1988 for (i = 0,phy = smc->y ; i < NUMPHYS ; i++,phy++) { in pcm_lem_dump()
1989 if (!plc_is_installed(smc,i)) in pcm_lem_dump()
1993 entostring(smc,ENTITY_PHY(i)), in pcm_lem_dump()