Lines Matching refs:smc

63 static int mac_index(struct s_smc *smc, int mac);
64 static int phy_index(struct s_smc *smc, int phy);
65 static int mac_con_resource_index(struct s_smc *smc, int mac);
66 static int phy_con_resource_index(struct s_smc *smc, int phy);
67 static void smt_send_rdf(struct s_smc *smc, SMbuf *rej, int fc, int reason,
69 static void smt_send_nif(struct s_smc *smc, const struct fddi_addr *dest,
71 static void smt_send_ecf(struct s_smc *smc, struct fddi_addr *dest, int fc,
73 static void smt_echo_test(struct s_smc *smc, int dna);
74 static void smt_send_sif_config(struct s_smc *smc, struct fddi_addr *dest,
76 static void smt_send_sif_operation(struct s_smc *smc, struct fddi_addr *dest,
82 static void smt_fill_una(struct s_smc *smc, struct smt_p_una *una);
83 static void smt_fill_sde(struct s_smc *smc, struct smt_p_sde *sde);
84 static void smt_fill_state(struct s_smc *smc, struct smt_p_state *state);
85 static void smt_fill_timestamp(struct s_smc *smc, struct smt_p_timestamp *ts);
86 static void smt_fill_policy(struct s_smc *smc, struct smt_p_policy *policy);
87 static void smt_fill_latency(struct s_smc *smc, struct smt_p_latency *latency);
88 static void smt_fill_neighbor(struct s_smc *smc, struct smt_p_neighbor *neighbor);
89 static int smt_fill_path(struct s_smc *smc, struct smt_p_path *path);
90 static void smt_fill_mac_status(struct s_smc *smc, struct smt_p_mac_status *st);
91 static void smt_fill_lem(struct s_smc *smc, struct smt_p_lem *lem, int phy);
92 static void smt_fill_version(struct s_smc *smc, struct smt_p_version *vers);
93 static void smt_fill_fsc(struct s_smc *smc, struct smt_p_fsc *fsc);
94 static void smt_fill_mac_counter(struct s_smc *smc, struct smt_p_mac_counter *mc);
95 static void smt_fill_mac_fnc(struct s_smc *smc, struct smt_p_mac_fnc *fnc);
96 static void smt_fill_manufacturer(struct s_smc *smc,
98 static void smt_fill_user(struct s_smc *smc, struct smp_p_user *user);
99 static void smt_fill_setcount(struct s_smc *smc, struct smt_p_setcount *setcount);
100 static void smt_fill_echo(struct s_smc *smc, struct smt_p_echo *echo, u_long seed,
103 static void smt_clear_una_dna(struct s_smc *smc);
104 static void smt_clear_old_una_dna(struct s_smc *smc);
108 static void update_dac(struct s_smc *smc, int report);
111 static void hwm_conv_can(struct s_smc *smc, char *data, int len);
113 #define hwm_conv_can(smc,data,len) argument
117 static inline int is_my_addr(const struct s_smc *smc, in is_my_addr() argument
121 *(short *)(&smc->mib.m[MAC0].fddiMACSMTAddress.a[0]) in is_my_addr()
123 *(short *)(&smc->mib.m[MAC0].fddiMACSMTAddress.a[2]) in is_my_addr()
125 *(short *)(&smc->mib.m[MAC0].fddiMACSMTAddress.a[4])) ; in is_my_addr()
156 void smt_agent_init(struct s_smc *smc) in smt_agent_init() argument
163 smc->mib.m[MAC0].fddiMACSMTAddress = smc->hw.fddi_home_addr ; in smt_agent_init()
168 smc->mib.fddiSMTStationId.sid_oem[0] = 0 ; in smt_agent_init()
169 smc->mib.fddiSMTStationId.sid_oem[1] = 0 ; in smt_agent_init()
170 driver_get_bia(smc,&smc->mib.fddiSMTStationId.sid_node) ; in smt_agent_init()
172 smc->mib.fddiSMTStationId.sid_node.a[i] = in smt_agent_init()
173 bitrev8(smc->mib.fddiSMTStationId.sid_node.a[i]); in smt_agent_init()
175 smc->mib.fddiSMTManufacturerData[0] = in smt_agent_init()
176 smc->mib.fddiSMTStationId.sid_node.a[0] ; in smt_agent_init()
177 smc->mib.fddiSMTManufacturerData[1] = in smt_agent_init()
178 smc->mib.fddiSMTStationId.sid_node.a[1] ; in smt_agent_init()
179 smc->mib.fddiSMTManufacturerData[2] = in smt_agent_init()
180 smc->mib.fddiSMTStationId.sid_node.a[2] ; in smt_agent_init()
181 smc->sm.smt_tid = 0 ; in smt_agent_init()
182 smc->mib.m[MAC0].fddiMACDupAddressTest = DA_NONE ; in smt_agent_init()
183 smc->mib.m[MAC0].fddiMACUNDA_Flag = FALSE ; in smt_agent_init()
185 smt_clear_una_dna(smc) ; in smt_agent_init()
186 smt_clear_old_una_dna(smc) ; in smt_agent_init()
189 smc->sm.pend[i] = 0 ; in smt_agent_init()
190 smc->sm.please_reconnect = 0 ; in smt_agent_init()
191 smc->sm.uniq_ticks = 0 ; in smt_agent_init()
202 void smt_agent_task(struct s_smc *smc) in smt_agent_task() argument
204 smt_timer_start(smc,&smc->sm.smt_timer, (u_long)1000000L, in smt_agent_task()
210 void smt_emulate_token_ct(struct s_smc *smc, int mac_index) in smt_emulate_token_ct() argument
217 count = ((time - smc->sm.last_tok_time[mac_index]) * in smt_emulate_token_ct()
226 if (smc->hw.mac_ring_is_up){ in smt_emulate_token_ct()
227 smc->mib.m[mac_index].fddiMACToken_Ct += count; in smt_emulate_token_ct()
231 smc->sm.last_tok_time[mac_index] = time; in smt_emulate_token_ct()
237 void smt_event(struct s_smc *smc, int event) in smt_event() argument
245 if (smc->sm.please_reconnect) { in smt_event()
246 smc->sm.please_reconnect -- ; in smt_event()
247 if (smc->sm.please_reconnect == 0) { in smt_event()
249 queue_event(smc,EVENT_ECM,EC_CONNECT) ; in smt_event()
262 smt_timer_poll(smc) ; in smt_event()
263 smt_start_watchdog(smc) ; in smt_event()
267 ess_timer_poll(smc) ; in smt_event()
271 sba_timer_poll(smc) ; in smt_event()
274 smt_srf_event(smc,0,0,0) ; in smt_event()
280 if (time - smc->sm.smt_last_lem >= TICKS_PER_SECOND*8) { in smt_event()
294 sm_lem_evaluate(smc) ; in smt_event()
295 smc->sm.smt_last_lem = time ; in smt_event()
301 mac_update_counter(smc) ; in smt_event()
302 mib = smc->mib.m ; in smt_event()
318 smt_srf_event(smc,SMT_COND_MAC_FRAME_ERROR, in smt_event()
336 smt_srf_event(smc,SMT_COND_MAC_NOT_COPIED, in smt_event()
352 phy = &smc->y[port] ; in smt_event()
364 smt_srf_event(smc,SMT_COND_PORT_EB_ERROR, in smt_event()
379 if (time - smc->sm.smt_last_notify >= (u_long) in smt_event()
380 (smc->mib.fddiSMTTT_Notify * TICKS_PER_SECOND) ) { in smt_event()
387 if (!smc->sm.pend[SMT_TID_NIF]) in smt_event()
388 smc->sm.pend[SMT_TID_NIF] = smt_get_tid(smc) ; in smt_event()
389 smt_send_nif(smc,&fddi_broadcast, FC_SMT_NSA, in smt_event()
390 smc->sm.pend[SMT_TID_NIF], SMT_REQUEST,0) ; in smt_event()
391 smc->sm.smt_last_notify = time ; in smt_event()
397 if (smc->sm.smt_tvu && in smt_event()
398 time - smc->sm.smt_tvu > 228*TICKS_PER_SECOND) { in smt_event()
400 smc->sm.smt_tvu = 0 ; in smt_event()
402 if (!is_equal(&smc->mib.m[MAC0].fddiMACUpstreamNbr, in smt_event()
405 smc->mib.m[MAC0].fddiMACOldUpstreamNbr= in smt_event()
406 smc->mib.m[MAC0].fddiMACUpstreamNbr ; in smt_event()
408 smc->mib.m[MAC0].fddiMACUpstreamNbr = SMT_Unknown ; in smt_event()
409 smc->mib.m[MAC0].fddiMACUNDA_Flag = FALSE ; in smt_event()
416 update_dac(smc,0) ; in smt_event()
417 smt_srf_event(smc, SMT_EVENT_MAC_NEIGHBOR_CHANGE, in smt_event()
420 if (smc->sm.smt_tvd && in smt_event()
421 time - smc->sm.smt_tvd > 228*TICKS_PER_SECOND) { in smt_event()
423 smc->sm.smt_tvd = 0 ; in smt_event()
424 if (!is_equal(&smc->mib.m[MAC0].fddiMACDownstreamNbr, in smt_event()
427 smc->mib.m[MAC0].fddiMACOldDownstreamNbr= in smt_event()
428 smc->mib.m[MAC0].fddiMACDownstreamNbr ; in smt_event()
430 smc->mib.m[MAC0].fddiMACDownstreamNbr = SMT_Unknown ; in smt_event()
431 smt_srf_event(smc, SMT_EVENT_MAC_NEIGHBOR_CHANGE, in smt_event()
443 if (time - smc->sm.last_tok_time[i] > 2*TICKS_PER_SECOND ){ in smt_event()
444 smt_emulate_token_ct( smc, i ); in smt_event()
449 smt_timer_start(smc,&smc->sm.smt_timer, (u_long)1000000L, in smt_event()
469 void smt_received_pack(struct s_smc *smc, SMbuf *mb, int fs) in smt_received_pack() argument
484 smt_free_mbuf(smc,mb) ; in smt_received_pack()
488 smc->mib.m[MAC0].fddiMACSMTCopied_Ct++ ; in smt_received_pack()
491 hwm_conv_can(smc,(char *)sm,12) ; in smt_received_pack()
494 if (is_individual(&sm->smt_dest) && !is_my_addr(smc,&sm->smt_dest)) { in smt_received_pack()
495 smt_free_mbuf(smc,mb) ; in smt_received_pack()
500 if (is_my_addr(smc,&sm->smt_source) && !local) { in smt_received_pack()
501 smt_free_mbuf(smc,mb) ; in smt_received_pack()
518 smc->sba.sm = sm ; in smt_received_pack()
519 sba(smc,NIF) ; in smt_received_pack()
529 smt_free_mbuf(smc,mb) ; in smt_received_pack()
538 smt_free_mbuf(smc,mb) ; in smt_received_pack()
561 smt_send_rdf(smc,mb,m_fc(mb),SMT_RDF_VERSION,local) ; in smt_received_pack()
562 smt_free_mbuf(smc,mb) ; in smt_received_pack()
568 smt_send_rdf(smc,mb,m_fc(mb),SMT_RDF_LENGTH,local) ; in smt_received_pack()
569 smt_free_mbuf(smc,mb) ; in smt_received_pack()
574 if (smt_check_para(smc,sm,plist_nif)) { in smt_received_pack()
587 &smc->mib.m[MAC0].fddiMACUpstreamNbr, in smt_received_pack()
591 if (!is_equal(&smc->mib.m[MAC0]. in smt_received_pack()
594 smc->mib.m[MAC0].fddiMACOldUpstreamNbr= in smt_received_pack()
595 smc->mib.m[MAC0].fddiMACUpstreamNbr ; in smt_received_pack()
598 smc->mib.m[MAC0].fddiMACUpstreamNbr = in smt_received_pack()
600 smt_srf_event(smc, in smt_received_pack()
603 smt_echo_test(smc,0) ; in smt_received_pack()
605 smc->sm.smt_tvu = smt_get_time() ; in smt_received_pack()
607 sm_to_para(smc,sm,SMT_P_STATE) ; in smt_received_pack()
609 smc->mib.m[MAC0].fddiMACUNDA_Flag = in smt_received_pack()
612 update_dac(smc,1) ; in smt_received_pack()
621 smt_send_nif(smc,&sm->smt_source, in smt_received_pack()
631 smc->sm.pend[SMT_TID_NIF] = 0 ; in smt_received_pack()
633 smc->mib.m[MAC0].fddiMACDupAddressTest = in smt_received_pack()
635 smc->r.dup_addr_test = DA_FAILED ; in smt_received_pack()
636 queue_event(smc,EVENT_RMT,RM_DUP_ADDR) ; in smt_received_pack()
637 smc->mib.m[MAC0].fddiMACDA_Flag = TRUE ; in smt_received_pack()
638 update_dac(smc,1) ; in smt_received_pack()
641 if (sm->smt_tid == smc->sm.pend[SMT_TID_NIF]) { in smt_received_pack()
642 smc->sm.pend[SMT_TID_NIF] = 0 ; in smt_received_pack()
645 &smc->mib.m[MAC0].fddiMACDownstreamNbr, in smt_received_pack()
648 if (!is_equal(&smc->mib.m[MAC0]. in smt_received_pack()
651 smc->mib.m[MAC0].fddiMACOldDownstreamNbr = in smt_received_pack()
652 smc->mib.m[MAC0].fddiMACDownstreamNbr ; in smt_received_pack()
655 smc->mib.m[MAC0].fddiMACDownstreamNbr = in smt_received_pack()
657 smt_srf_event(smc, in smt_received_pack()
660 smt_echo_test(smc,1) ; in smt_received_pack()
662 smc->mib.m[MAC0].fddiMACDA_Flag = FALSE ; in smt_received_pack()
663 update_dac(smc,1) ; in smt_received_pack()
664 smc->sm.smt_tvd = smt_get_time() ; in smt_received_pack()
665 smc->mib.m[MAC0].fddiMACDupAddressTest = in smt_received_pack()
667 if (smc->r.dup_addr_test != DA_PASSED) { in smt_received_pack()
668 smc->r.dup_addr_test = DA_PASSED ; in smt_received_pack()
669 queue_event(smc,EVENT_RMT,RM_DUP_ADDR) ; in smt_received_pack()
673 smc->sm.pend[SMT_TID_NIF_TEST]) { in smt_received_pack()
678 smc->sm.pend[SMT_TID_NIF],sm->smt_tid) ; in smt_received_pack()
691 smt_send_sif_config(smc,&sm->smt_source,sm->smt_tid,local) ; in smt_received_pack()
698 smt_send_sif_operation(smc,&sm->smt_source,sm->smt_tid,local) ; in smt_received_pack()
703 smc->mib.priv.fddiPRIVECF_Reply_Rx++ ; in smt_received_pack()
706 if (sm_to_para(smc,sm,SMT_P_ECHODATA) == NULL) { in smt_received_pack()
710 if (sm->smt_tid == smc->sm.pend[SMT_TID_ECF]) { in smt_received_pack()
713 else if (sm->smt_tid == smc->sm.pend[SMT_TID_ECF_UNA]) { in smt_received_pack()
716 else if (sm->smt_tid == smc->sm.pend[SMT_TID_ECF_DNA]) { in smt_received_pack()
721 smc->sm.pend[SMT_TID_ECF], in smt_received_pack()
726 smc->mib.priv.fddiPRIVECF_Req_Rx++ ; in smt_received_pack()
728 if (sm->smt_len && !sm_to_para(smc,sm,SMT_P_ECHODATA)) { in smt_received_pack()
730 smt_send_rdf(smc,mb,m_fc(mb),SMT_RDF_LENGTH, in smt_received_pack()
740 dump_smt(smc,sm,"ECF REPLY") ; in smt_received_pack()
741 smc->mib.priv.fddiPRIVECF_Reply_Tx++ ; in smt_received_pack()
742 smt_send_frame(smc,mb,FC_SMT_INFO,local) ; in smt_received_pack()
754 fs = ess_raf_received_pack(smc,mb,sm,fs) ; in smt_received_pack()
759 sba_raf_received_pack(smc,sm,fs) ; in smt_received_pack()
763 smc->mib.priv.fddiPRIVRDF_Rx++ ; in smt_received_pack()
768 smt_send_rdf(smc,mb,m_fc(mb),SMT_RDF_CLASS,local) ; in smt_received_pack()
777 smc->mib.priv.fddiPRIVPMF_Get_Rx++ ; in smt_received_pack()
779 smc->mib.priv.fddiPRIVPMF_Set_Rx++ ; in smt_received_pack()
788 smt_pmf_received_pack(smc,mb, local) ; in smt_received_pack()
791 dump_smt(smc,sm,"SRF received") ; in smt_received_pack()
804 smt_send_rdf(smc,mb,m_fc(mb),SMT_RDF_CLASS,local) ; in smt_received_pack()
812 smt_free_mbuf(smc,mb) ; in smt_received_pack()
815 static void update_dac(struct s_smc *smc, int report) in update_dac() argument
819 cond = ( smc->mib.m[MAC0].fddiMACUNDA_Flag | in update_dac()
820 smc->mib.m[MAC0].fddiMACDA_Flag) != 0 ; in update_dac()
821 if (report && (cond != smc->mib.m[MAC0].fddiMACDuplicateAddressCond)) in update_dac()
822 smt_srf_event(smc, SMT_COND_MAC_DUP_ADDR,INDEX_MAC,cond) ; in update_dac()
824 smc->mib.m[MAC0].fddiMACDuplicateAddressCond = cond ; in update_dac()
833 void smt_send_frame(struct s_smc *smc, SMbuf *mb, int fc, int local) in smt_send_frame() argument
839 if (!smc->r.sm_ma_avail && !local) { in smt_send_frame()
840 smt_free_mbuf(smc,mb) ; in smt_send_frame()
844 sm->smt_source = smc->mib.m[MAC0].fddiMACSMTAddress ; in smt_send_frame()
845 sm->smt_sid = smc->mib.fddiSMTStationId ; in smt_send_frame()
848 hwm_conv_can(smc,(char *)sm,12) ; /* convert SA and DA */ in smt_send_frame()
849 smc->mib.m[MAC0].fddiMACSMTTransmit_Ct++ ; in smt_send_frame()
850 smt_send_mbuf(smc,mb,local ? FC_SMT_LOC : fc) ; in smt_send_frame()
856 static void smt_send_rdf(struct s_smc *smc, SMbuf *rej, int fc, int reason, in smt_send_rdf() argument
882 if (!(mb=smt_build_frame(smc,SMT_RDF,SMT_REPLY,sizeof(struct smt_rdf)))) in smt_send_rdf()
925 dump_smt(smc,(struct smt_header *)rdf,"RDF") ; in smt_send_rdf()
926 smc->mib.priv.fddiPRIVRDF_Tx++ ; in smt_send_rdf()
927 smt_send_frame(smc,mb,FC_SMT_INFO,local) ; in smt_send_rdf()
933 static void smt_send_nif(struct s_smc *smc, const struct fddi_addr *dest, in smt_send_nif() argument
943 if (!(mb = smt_build_frame(smc,SMT_NIF,type,sizeof(struct smt_nif)))) in smt_send_nif()
946 smt_fill_una(smc,&nif->una) ; /* set UNA */ in smt_send_nif()
947 smt_fill_sde(smc,&nif->sde) ; /* set station descriptor */ in smt_send_nif()
948 smt_fill_state(smc,&nif->state) ; /* set state information */ in smt_send_nif()
950 smt_fill_fsc(smc,&nif->fsc) ; /* set frame status cap. */ in smt_send_nif()
954 dump_smt(smc,(struct smt_header *)nif,"NIF") ; in smt_send_nif()
955 smt_send_frame(smc,mb,fc,local) ; in smt_send_nif()
962 static void smt_send_nif_request(struct s_smc *smc, struct fddi_addr *dest) in smt_send_nif_request() argument
964 smc->sm.pend[SMT_TID_NIF_TEST] = smt_get_tid(smc) ; in smt_send_nif_request()
965 smt_send_nif(smc,dest, FC_SMT_INFO, smc->sm.pend[SMT_TID_NIF_TEST], in smt_send_nif_request()
972 static void smt_send_ecf_request(struct s_smc *smc, struct fddi_addr *dest, in smt_send_ecf_request() argument
975 smc->sm.pend[SMT_TID_ECF] = smt_get_tid(smc) ; in smt_send_ecf_request()
976 smt_send_ecf(smc,dest, FC_SMT_INFO, smc->sm.pend[SMT_TID_ECF], in smt_send_ecf_request()
984 static void smt_echo_test(struct s_smc *smc, int dna) in smt_echo_test() argument
988 smc->sm.pend[dna ? SMT_TID_ECF_DNA : SMT_TID_ECF_UNA] = in smt_echo_test()
989 tid = smt_get_tid(smc) ; in smt_echo_test()
990 smt_send_ecf(smc, dna ? in smt_echo_test()
991 &smc->mib.m[MAC0].fddiMACDownstreamNbr : in smt_echo_test()
992 &smc->mib.m[MAC0].fddiMACUpstreamNbr, in smt_echo_test()
999 static void smt_send_ecf(struct s_smc *smc, struct fddi_addr *dest, int fc, in smt_send_ecf() argument
1010 if (!(mb = smt_build_frame(smc,SMT_ECF,type,SMT_ECF_LEN + len))) in smt_send_ecf()
1014 smt_fill_echo(smc,&ecf->ec_echo,tid,len) ; /* set ECHO */ in smt_send_ecf()
1017 smc->mib.priv.fddiPRIVECF_Req_Tx++ ; in smt_send_ecf()
1018 smt_send_frame(smc,mb,fc,0) ; in smt_send_ecf()
1025 static void smt_send_sif_config(struct s_smc *smc, struct fddi_addr *dest, in smt_send_sif_config() argument
1033 if (!(mb = smt_build_frame(smc,SMT_SIF_CONFIG,SMT_REPLY, in smt_send_sif_config()
1038 smt_fill_timestamp(smc,&sif->ts) ; /* set time stamp */ in smt_send_sif_config()
1039 smt_fill_sde(smc,&sif->sde) ; /* set station descriptor */ in smt_send_sif_config()
1040 smt_fill_version(smc,&sif->version) ; /* set version information */ in smt_send_sif_config()
1041 smt_fill_state(smc,&sif->state) ; /* set state information */ in smt_send_sif_config()
1042 smt_fill_policy(smc,&sif->policy) ; /* set station policy */ in smt_send_sif_config()
1043 smt_fill_latency(smc,&sif->latency); /* set station latency */ in smt_send_sif_config()
1044 smt_fill_neighbor(smc,&sif->neighbor); /* set station neighbor */ in smt_send_sif_config()
1045 smt_fill_setcount(smc,&sif->setcount) ; /* set count */ in smt_send_sif_config()
1046 len = smt_fill_path(smc,&sif->path); /* set station path descriptor*/ in smt_send_sif_config()
1050 dump_smt(smc,(struct smt_header *)sif,"SIF Configuration Reply") ; in smt_send_sif_config()
1051 smt_send_frame(smc,mb,FC_SMT_INFO,local) ; in smt_send_sif_config()
1058 static void smt_send_sif_operation(struct s_smc *smc, struct fddi_addr *dest, in smt_send_sif_operation() argument
1070 if (smc->s.sas == SMT_SAS) in smt_send_sif_operation()
1074 if (!(mb = smt_build_frame(smc,SMT_SIF_OPER,SMT_REPLY, in smt_send_sif_operation()
1078 smt_fill_timestamp(smc,&sif->ts) ; /* set time stamp */ in smt_send_sif_operation()
1079 smt_fill_mac_status(smc,&sif->status) ; /* set mac status */ in smt_send_sif_operation()
1080 smt_fill_mac_counter(smc,&sif->mc) ; /* set mac counter field */ in smt_send_sif_operation()
1081 smt_fill_mac_fnc(smc,&sif->fnc) ; /* set frame not copied counter */ in smt_send_sif_operation()
1082 smt_fill_manufacturer(smc,&sif->man) ; /* set manufacturer field */ in smt_send_sif_operation()
1083 smt_fill_user(smc,&sif->user) ; /* set user field */ in smt_send_sif_operation()
1084 smt_fill_setcount(smc,&sif->setcount) ; /* set count */ in smt_send_sif_operation()
1089 smt_fill_lem(smc,sif->lem,PS) ; in smt_send_sif_operation()
1093 smt_fill_lem(smc,&sif->lem[i],i) ; in smt_send_sif_operation()
1099 dump_smt(smc,(struct smt_header *)sif,"SIF Operation Reply") ; in smt_send_sif_operation()
1100 smt_send_frame(smc,mb,FC_SMT_INFO,local) ; in smt_send_sif_operation()
1106 SMbuf *smt_build_frame(struct s_smc *smc, int class, int type, in smt_build_frame() argument
1113 if (!smc->r.sm_ma_avail) { in smt_build_frame()
1117 if (!(mb = smt_get_mbuf(smc))) in smt_build_frame()
1136 smt->smt_tid = smt_get_tid(smc) ; /* set transaction ID */ in smt_build_frame()
1156 static void smt_fill_una(struct s_smc *smc, struct smt_p_una *una) in smt_fill_una() argument
1160 una->una_node = smc->mib.m[MAC0].fddiMACUpstreamNbr ; in smt_fill_una()
1166 static void smt_fill_sde(struct s_smc *smc, struct smt_p_sde *sde) in smt_fill_sde() argument
1169 sde->sde_non_master = smc->mib.fddiSMTNonMaster_Ct ; in smt_fill_sde()
1170 sde->sde_master = smc->mib.fddiSMTMaster_Ct ; in smt_fill_sde()
1182 static void smt_fill_state(struct s_smc *smc, struct smt_p_state *state) in smt_fill_state() argument
1192 if (smc->mib.fddiSMTPeerWrapFlag) { in smt_fill_state()
1196 if (cfm_status_unattached(smc)) { in smt_fill_state()
1200 if ((twist = pcm_status_twisted(smc)) & 1) { in smt_fill_state()
1209 if (pcm_rooted_station(smc)) in smt_fill_state()
1211 if (smc->mib.a[0].fddiPATHSbaPayload != 0) in smt_fill_state()
1215 ((smc->mib.m[MAC0].fddiMACDA_Flag ? SMT_ST_MY_DUPA : 0 ) | in smt_fill_state()
1216 (smc->mib.m[MAC0].fddiMACUNDA_Flag ? SMT_ST_UNA_DUPA : 0)) ; in smt_fill_state()
1222 static void smt_fill_timestamp(struct s_smc *smc, struct smt_p_timestamp *ts) in smt_fill_timestamp() argument
1226 smt_set_timestamp(smc,ts->ts_time) ; in smt_fill_timestamp()
1229 void smt_set_timestamp(struct s_smc *smc, u_char *p) in smt_set_timestamp() argument
1248 p[6] = (u_char)(smc->sm.uniq_ticks>>8) ; in smt_set_timestamp()
1249 p[7] = (u_char)smc->sm.uniq_ticks ; in smt_set_timestamp()
1253 if (utime != smc->sm.uniq_time) { in smt_set_timestamp()
1254 smc->sm.uniq_ticks = 0 ; in smt_set_timestamp()
1256 smc->sm.uniq_ticks++ ; in smt_set_timestamp()
1257 smc->sm.uniq_time = utime ; in smt_set_timestamp()
1263 static void smt_fill_policy(struct s_smc *smc, struct smt_p_policy *policy) in smt_fill_policy() argument
1280 in = smc->mib.fddiSMTConnectionPolicy ; in smt_fill_policy()
1287 policy->pl_config = smc->mib.fddiSMTConfigPolicy ; in smt_fill_policy()
1294 static void smt_fill_latency(struct s_smc *smc, struct smt_p_latency *latency) in smt_fill_latency() argument
1298 latency->lt_phyout_idx1 = phy_index(smc,0) ; in smt_fill_latency()
1304 if (smc->s.sas == SMT_DAS) { in smt_fill_latency()
1305 latency->lt_phyout_idx2 = phy_index(smc,1) ; in smt_fill_latency()
1317 static void smt_fill_neighbor(struct s_smc *smc, struct smt_p_neighbor *neighbor) in smt_fill_neighbor() argument
1322 neighbor->nb_mac_index = mac_index(smc,1) ; in smt_fill_neighbor()
1323 neighbor->nb_una = smc->mib.m[MAC0].fddiMACUpstreamNbr ; in smt_fill_neighbor()
1324 neighbor->nb_dna = smc->mib.m[MAC0].fddiMACDownstreamNbr ; in smt_fill_neighbor()
1333 #define ALLPHYS ((smc->s.sas == SMT_SAS) ? 1 : 2)
1336 static int smt_fill_path(struct s_smc *smc, struct smt_p_path *path) in smt_fill_path() argument
1358 if (smc->s.sas == SMT_SAS) in smt_fill_path()
1361 pcm_status_state(smc,physp,&type,&state,&remote,&mac) ; in smt_fill_path()
1371 phy->phy_resource_idx = phy_con_resource_index(smc,p) ; in smt_fill_path()
1376 pd_mac->mac_addr = smc->mib.m[MAC0].fddiMACSMTAddress ; in smt_fill_path()
1377 pd_mac->mac_resource_idx = mac_con_resource_index(smc,1) ; in smt_fill_path()
1384 static void smt_fill_mac_status(struct s_smc *smc, struct smt_p_mac_status *st) in smt_fill_mac_status() argument
1389 st->st_mac_index = mac_index(smc,1) ; in smt_fill_mac_status()
1391 mac_update_counter(smc) ; in smt_fill_mac_status()
1396 st->st_t_req = smc->mib.m[MAC0].fddiMACT_Req ; in smt_fill_mac_status()
1397 st->st_t_neg = smc->mib.m[MAC0].fddiMACT_Neg ; in smt_fill_mac_status()
1398 st->st_t_max = smc->mib.m[MAC0].fddiMACT_Max ; in smt_fill_mac_status()
1399 st->st_tvx_value = smc->mib.m[MAC0].fddiMACTvxValue ; in smt_fill_mac_status()
1400 st->st_t_min = smc->mib.m[MAC0].fddiMACT_Min ; in smt_fill_mac_status()
1402 st->st_sba = smc->mib.a[PATH0].fddiPATHSbaPayload ; in smt_fill_mac_status()
1403 st->st_frame_ct = smc->mib.m[MAC0].fddiMACFrame_Ct ; in smt_fill_mac_status()
1404 st->st_error_ct = smc->mib.m[MAC0].fddiMACError_Ct ; in smt_fill_mac_status()
1405 st->st_lost_ct = smc->mib.m[MAC0].fddiMACLost_Ct ; in smt_fill_mac_status()
1411 static void smt_fill_lem(struct s_smc *smc, struct smt_p_lem *lem, int phy) in smt_fill_lem() argument
1415 mib = smc->y[phy].mib ; in smt_fill_lem()
1419 lem->lem_phy_index = phy_index(smc,phy) ; in smt_fill_lem()
1433 static void smt_fill_version(struct s_smc *smc, struct smt_p_version *vers) in smt_fill_version() argument
1435 SK_UNUSED(smc) ; in smt_fill_version()
1452 static void smt_fill_fsc(struct s_smc *smc, struct smt_p_fsc *fsc) in smt_fill_fsc() argument
1454 SK_UNUSED(smc) ; in smt_fill_fsc()
1472 static void smt_fill_mac_counter(struct s_smc *smc, struct smt_p_mac_counter *mc) in smt_fill_mac_counter() argument
1476 mc->mc_index = mac_index(smc,1) ; in smt_fill_mac_counter()
1477 mc->mc_receive_ct = smc->mib.m[MAC0].fddiMACCopied_Ct ; in smt_fill_mac_counter()
1478 mc->mc_transmit_ct = smc->mib.m[MAC0].fddiMACTransmit_Ct ; in smt_fill_mac_counter()
1484 static void smt_fill_mac_fnc(struct s_smc *smc, struct smt_p_mac_fnc *fnc) in smt_fill_mac_fnc() argument
1488 fnc->nc_index = mac_index(smc,1) ; in smt_fill_mac_fnc()
1489 fnc->nc_counter = smc->mib.m[MAC0].fddiMACNotCopied_Ct ; in smt_fill_mac_fnc()
1496 static void smt_fill_manufacturer(struct s_smc *smc, in smt_fill_manufacturer() argument
1501 (char *) smc->mib.fddiSMTManufacturerData, in smt_fill_manufacturer()
1508 static void smt_fill_user(struct s_smc *smc, struct smp_p_user *user) in smt_fill_user() argument
1512 (char *) smc->mib.fddiSMTUserData, in smt_fill_user()
1519 static void smt_fill_setcount(struct s_smc *smc, struct smt_p_setcount *setcount) in smt_fill_setcount() argument
1521 SK_UNUSED(smc) ; in smt_fill_setcount()
1523 setcount->count = smc->mib.fddiSMTSetCount.count ; in smt_fill_setcount()
1525 (char *)smc->mib.fddiSMTSetCount.timestamp,8) ; in smt_fill_setcount()
1531 static void smt_fill_echo(struct s_smc *smc, struct smt_p_echo *echo, u_long seed, in smt_fill_echo() argument
1536 SK_UNUSED(smc) ; in smt_fill_echo()
1549 static void smt_clear_una_dna(struct s_smc *smc) in smt_clear_una_dna() argument
1551 smc->mib.m[MAC0].fddiMACUpstreamNbr = SMT_Unknown ; in smt_clear_una_dna()
1552 smc->mib.m[MAC0].fddiMACDownstreamNbr = SMT_Unknown ; in smt_clear_una_dna()
1555 static void smt_clear_old_una_dna(struct s_smc *smc) in smt_clear_old_una_dna() argument
1557 smc->mib.m[MAC0].fddiMACOldUpstreamNbr = SMT_Unknown ; in smt_clear_old_una_dna()
1558 smc->mib.m[MAC0].fddiMACOldDownstreamNbr = SMT_Unknown ; in smt_clear_old_una_dna()
1561 u_long smt_get_tid(struct s_smc *smc) in smt_get_tid() argument
1564 while ((tid = ++(smc->sm.smt_tid) ^ SMT_TID_MAGIC) == 0) in smt_get_tid()
1650 int smt_check_para(struct s_smc *smc, struct smt_header *sm, in smt_check_para() argument
1655 if (!sm_to_para(smc,sm,(int) *p)) { in smt_check_para()
1664 void *sm_to_para(struct s_smc *smc, struct smt_header *sm, int para) in sm_to_para() argument
1671 SK_UNUSED(smc) ; in sm_to_para()
1699 void fddi_send_antc(struct s_smc *smc, struct fddi_addr *dest)
1701 SK_UNUSED(smc) ;
1717 smt->smt_source = smc->mib.m[MAC0].fddiMACSMTAddress ;
1718 smt_send_mbuf(smc,mb,FC_ASYNC_LLC) ;
1742 static int mac_index(struct s_smc *smc, int mac) in mac_index() argument
1746 SK_UNUSED(smc) ; in mac_index()
1749 return (smc->s.sas == SMT_SAS) ? 2 : 3; in mac_index()
1756 static int phy_index(struct s_smc *smc, int phy) in phy_index() argument
1758 SK_UNUSED(smc) ; in phy_index()
1765 static int mac_con_resource_index(struct s_smc *smc, int mac) in mac_con_resource_index() argument
1768 SK_UNUSED(smc) ; in mac_con_resource_index()
1770 return entity_to_index(smc, cem_get_downstream(smc, ENTITY_MAC)); in mac_con_resource_index()
1773 switch (smc->mib.fddiSMTCF_State) { in mac_con_resource_index()
1782 return smc->s.sas == SMT_SAS ? 2 : 3; in mac_con_resource_index()
1789 static int phy_con_resource_index(struct s_smc *smc, int phy) in phy_con_resource_index() argument
1792 return entity_to_index(smc, cem_get_downstream(smc, ENTITY_PHY(phy))) ; in phy_con_resource_index()
1794 switch (smc->mib.fddiSMTCF_State) { in phy_con_resource_index()
1811 static int entity_to_index(struct s_smc *smc, int e) in entity_to_index() argument
1814 return mac_index(smc, 1); in entity_to_index()
1816 return phy_index(smc, e - ENTITY_PHY(0)); in entity_to_index()
1936 int smt_action(struct s_smc *smc, int class, int code, int index) in smt_action() argument
1945 smc->mib.fddiSMTRemoteDisconnectFlag = FALSE ; in smt_action()
1946 queue_event(smc,EVENT_ECM,EC_CONNECT) ; in smt_action()
1949 queue_event(smc,EVENT_ECM,EC_DISCONNECT) ; in smt_action()
1950 smc->mib.fddiSMTRemoteDisconnectFlag = TRUE ; in smt_action()
1951 RS_SET(smc,RS_DISCONNECT) ; in smt_action()
1952 AIX_EVENT(smc, (u_long) FDDI_RING_STATUS, (u_long) in smt_action()
1954 smt_get_event_word(smc)); in smt_action()
1957 AIX_EVENT(smc, (u_long) FDDI_RING_STATUS, (u_long) in smt_action()
1959 smt_get_event_word(smc)); in smt_action()
1962 AIX_EVENT(smc, (u_long) FDDI_RING_STATUS, (u_long) in smt_action()
1964 smt_get_event_word(smc)); in smt_action()
1967 if (smc->y[PA].pc_mode == PM_PEER) { in smt_action()
1968 RS_SET(smc,RS_EVENT) ; in smt_action()
1969 queue_event(smc,EVENT_PCM+PA,PC_DISABLE) ; in smt_action()
1973 if (smc->y[PB].pc_mode == PM_PEER) { in smt_action()
1974 RS_SET(smc,RS_EVENT) ; in smt_action()
1975 queue_event(smc,EVENT_PCM+PB,PC_DISABLE) ; in smt_action()
1980 if (smc->mib.p[port].fddiPORTMy_Type != TM) in smt_action()
1982 RS_SET(smc,RS_EVENT) ; in smt_action()
1983 queue_event(smc,EVENT_PCM+port,PC_DISABLE) ; in smt_action()
2010 queue_event(smc,EVENT_PCM+index,event) ; in smt_action()
2022 static void hwm_conv_can(struct s_smc *smc, char *data, int len) in hwm_conv_can() argument
2026 SK_UNUSED(smc) ; in hwm_conv_can()