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