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