Lines Matching refs:smc

54 static int mac_index(struct s_smc *smc, int mac);
55 static int phy_index(struct s_smc *smc, int phy);
56 static int mac_con_resource_index(struct s_smc *smc, int mac);
57 static int phy_con_resource_index(struct s_smc *smc, int phy);
58 static void smt_send_rdf(struct s_smc *smc, SMbuf *rej, int fc, int reason,
60 static void smt_send_nif(struct s_smc *smc, const struct fddi_addr *dest,
62 static void smt_send_ecf(struct s_smc *smc, struct fddi_addr *dest, int fc,
64 static void smt_echo_test(struct s_smc *smc, int dna);
65 static void smt_send_sif_config(struct s_smc *smc, struct fddi_addr *dest,
67 static void smt_send_sif_operation(struct s_smc *smc, struct fddi_addr *dest,
73 static void smt_fill_una(struct s_smc *smc, struct smt_p_una *una);
74 static void smt_fill_sde(struct s_smc *smc, struct smt_p_sde *sde);
75 static void smt_fill_state(struct s_smc *smc, struct smt_p_state *state);
76 static void smt_fill_timestamp(struct s_smc *smc, struct smt_p_timestamp *ts);
77 static void smt_fill_policy(struct s_smc *smc, struct smt_p_policy *policy);
78 static void smt_fill_latency(struct s_smc *smc, struct smt_p_latency *latency);
79 static void smt_fill_neighbor(struct s_smc *smc, struct smt_p_neighbor *neighbor);
80 static int smt_fill_path(struct s_smc *smc, struct smt_p_path *path);
81 static void smt_fill_mac_status(struct s_smc *smc, struct smt_p_mac_status *st);
82 static void smt_fill_lem(struct s_smc *smc, struct smt_p_lem *lem, int phy);
83 static void smt_fill_version(struct s_smc *smc, struct smt_p_version *vers);
84 static void smt_fill_fsc(struct s_smc *smc, struct smt_p_fsc *fsc);
85 static void smt_fill_mac_counter(struct s_smc *smc, struct smt_p_mac_counter *mc);
86 static void smt_fill_mac_fnc(struct s_smc *smc, struct smt_p_mac_fnc *fnc);
87 static void smt_fill_manufacturer(struct s_smc *smc,
89 static void smt_fill_user(struct s_smc *smc, struct smp_p_user *user);
90 static void smt_fill_setcount(struct s_smc *smc, struct smt_p_setcount *setcount);
91 static void smt_fill_echo(struct s_smc *smc, struct smt_p_echo *echo, u_long seed,
94 static void smt_clear_una_dna(struct s_smc *smc);
95 static void smt_clear_old_una_dna(struct s_smc *smc);
99 static void update_dac(struct s_smc *smc, int report);
102 static void hwm_conv_can(struct s_smc *smc, char *data, int len);
104 #define hwm_conv_can(smc,data,len) argument
108 static inline int is_my_addr(const struct s_smc *smc, in is_my_addr() argument
112 *(short *)(&smc->mib.m[MAC0].fddiMACSMTAddress.a[0]) in is_my_addr()
114 *(short *)(&smc->mib.m[MAC0].fddiMACSMTAddress.a[2]) in is_my_addr()
116 *(short *)(&smc->mib.m[MAC0].fddiMACSMTAddress.a[4])) ; in is_my_addr()
147 void smt_agent_init(struct s_smc *smc) in smt_agent_init() argument
154 smc->mib.m[MAC0].fddiMACSMTAddress = smc->hw.fddi_home_addr ; in smt_agent_init()
159 smc->mib.fddiSMTStationId.sid_oem[0] = 0 ; in smt_agent_init()
160 smc->mib.fddiSMTStationId.sid_oem[1] = 0 ; in smt_agent_init()
161 driver_get_bia(smc,&smc->mib.fddiSMTStationId.sid_node) ; in smt_agent_init()
163 smc->mib.fddiSMTStationId.sid_node.a[i] = in smt_agent_init()
164 bitrev8(smc->mib.fddiSMTStationId.sid_node.a[i]); in smt_agent_init()
166 smc->mib.fddiSMTManufacturerData[0] = in smt_agent_init()
167 smc->mib.fddiSMTStationId.sid_node.a[0] ; in smt_agent_init()
168 smc->mib.fddiSMTManufacturerData[1] = in smt_agent_init()
169 smc->mib.fddiSMTStationId.sid_node.a[1] ; in smt_agent_init()
170 smc->mib.fddiSMTManufacturerData[2] = in smt_agent_init()
171 smc->mib.fddiSMTStationId.sid_node.a[2] ; in smt_agent_init()
172 smc->sm.smt_tid = 0 ; in smt_agent_init()
173 smc->mib.m[MAC0].fddiMACDupAddressTest = DA_NONE ; in smt_agent_init()
174 smc->mib.m[MAC0].fddiMACUNDA_Flag = FALSE ; in smt_agent_init()
176 smt_clear_una_dna(smc) ; in smt_agent_init()
177 smt_clear_old_una_dna(smc) ; in smt_agent_init()
180 smc->sm.pend[i] = 0 ; in smt_agent_init()
181 smc->sm.please_reconnect = 0 ; in smt_agent_init()
182 smc->sm.uniq_ticks = 0 ; in smt_agent_init()
193 void smt_agent_task(struct s_smc *smc) in smt_agent_task() argument
195 smt_timer_start(smc,&smc->sm.smt_timer, (u_long)1000000L, in smt_agent_task()
201 void smt_emulate_token_ct(struct s_smc *smc, int mac_index) in smt_emulate_token_ct() argument
208 count = ((time - smc->sm.last_tok_time[mac_index]) * in smt_emulate_token_ct()
217 if (smc->hw.mac_ring_is_up){ in smt_emulate_token_ct()
218 smc->mib.m[mac_index].fddiMACToken_Ct += count; in smt_emulate_token_ct()
222 smc->sm.last_tok_time[mac_index] = time; in smt_emulate_token_ct()
228 void smt_event(struct s_smc *smc, int event) in smt_event() argument
236 if (smc->sm.please_reconnect) { in smt_event()
237 smc->sm.please_reconnect -- ; in smt_event()
238 if (smc->sm.please_reconnect == 0) { in smt_event()
240 queue_event(smc,EVENT_ECM,EC_CONNECT) ; in smt_event()
253 smt_timer_poll(smc) ; in smt_event()
254 smt_start_watchdog(smc) ; in smt_event()
258 ess_timer_poll(smc) ; in smt_event()
262 sba_timer_poll(smc) ; in smt_event()
265 smt_srf_event(smc,0,0,0) ; in smt_event()
271 if (time - smc->sm.smt_last_lem >= TICKS_PER_SECOND*8) { in smt_event()
285 sm_lem_evaluate(smc) ; in smt_event()
286 smc->sm.smt_last_lem = time ; in smt_event()
292 mac_update_counter(smc) ; in smt_event()
293 mib = smc->mib.m ; in smt_event()
309 smt_srf_event(smc,SMT_COND_MAC_FRAME_ERROR, in smt_event()
327 smt_srf_event(smc,SMT_COND_MAC_NOT_COPIED, in smt_event()
343 phy = &smc->y[port] ; in smt_event()
355 smt_srf_event(smc,SMT_COND_PORT_EB_ERROR, in smt_event()
370 if (time - smc->sm.smt_last_notify >= (u_long) in smt_event()
371 (smc->mib.fddiSMTTT_Notify * TICKS_PER_SECOND) ) { in smt_event()
378 if (!smc->sm.pend[SMT_TID_NIF]) in smt_event()
379 smc->sm.pend[SMT_TID_NIF] = smt_get_tid(smc) ; in smt_event()
380 smt_send_nif(smc,&fddi_broadcast, FC_SMT_NSA, in smt_event()
381 smc->sm.pend[SMT_TID_NIF], SMT_REQUEST,0) ; in smt_event()
382 smc->sm.smt_last_notify = time ; in smt_event()
388 if (smc->sm.smt_tvu && in smt_event()
389 time - smc->sm.smt_tvu > 228*TICKS_PER_SECOND) { in smt_event()
391 smc->sm.smt_tvu = 0 ; in smt_event()
393 if (!is_equal(&smc->mib.m[MAC0].fddiMACUpstreamNbr, in smt_event()
396 smc->mib.m[MAC0].fddiMACOldUpstreamNbr= in smt_event()
397 smc->mib.m[MAC0].fddiMACUpstreamNbr ; in smt_event()
399 smc->mib.m[MAC0].fddiMACUpstreamNbr = SMT_Unknown ; in smt_event()
400 smc->mib.m[MAC0].fddiMACUNDA_Flag = FALSE ; in smt_event()
407 update_dac(smc,0) ; in smt_event()
408 smt_srf_event(smc, SMT_EVENT_MAC_NEIGHBOR_CHANGE, in smt_event()
411 if (smc->sm.smt_tvd && in smt_event()
412 time - smc->sm.smt_tvd > 228*TICKS_PER_SECOND) { in smt_event()
414 smc->sm.smt_tvd = 0 ; in smt_event()
415 if (!is_equal(&smc->mib.m[MAC0].fddiMACDownstreamNbr, in smt_event()
418 smc->mib.m[MAC0].fddiMACOldDownstreamNbr= in smt_event()
419 smc->mib.m[MAC0].fddiMACDownstreamNbr ; in smt_event()
421 smc->mib.m[MAC0].fddiMACDownstreamNbr = SMT_Unknown ; in smt_event()
422 smt_srf_event(smc, SMT_EVENT_MAC_NEIGHBOR_CHANGE, in smt_event()
434 if (time - smc->sm.last_tok_time[i] > 2*TICKS_PER_SECOND ){ in smt_event()
435 smt_emulate_token_ct( smc, i ); in smt_event()
440 smt_timer_start(smc,&smc->sm.smt_timer, (u_long)1000000L, in smt_event()
460 void smt_received_pack(struct s_smc *smc, SMbuf *mb, int fs) in smt_received_pack() argument
475 smt_free_mbuf(smc,mb) ; in smt_received_pack()
479 smc->mib.m[MAC0].fddiMACSMTCopied_Ct++ ; in smt_received_pack()
482 hwm_conv_can(smc,(char *)sm,12) ; in smt_received_pack()
485 if (is_individual(&sm->smt_dest) && !is_my_addr(smc,&sm->smt_dest)) { in smt_received_pack()
486 smt_free_mbuf(smc,mb) ; in smt_received_pack()
491 if (is_my_addr(smc,&sm->smt_source) && !local) { in smt_received_pack()
492 smt_free_mbuf(smc,mb) ; in smt_received_pack()
510 smc->sba.sm = sm ; in smt_received_pack()
511 sba(smc,NIF) ; in smt_received_pack()
521 smt_free_mbuf(smc,mb) ; in smt_received_pack()
530 smt_free_mbuf(smc,mb) ; in smt_received_pack()
553 smt_send_rdf(smc,mb,m_fc(mb),SMT_RDF_VERSION,local) ; in smt_received_pack()
554 smt_free_mbuf(smc,mb) ; in smt_received_pack()
560 smt_send_rdf(smc,mb,m_fc(mb),SMT_RDF_LENGTH,local) ; in smt_received_pack()
561 smt_free_mbuf(smc,mb) ; in smt_received_pack()
566 if (smt_check_para(smc,sm,plist_nif)) { in smt_received_pack()
579 &smc->mib.m[MAC0].fddiMACUpstreamNbr, in smt_received_pack()
583 if (!is_equal(&smc->mib.m[MAC0]. in smt_received_pack()
586 smc->mib.m[MAC0].fddiMACOldUpstreamNbr= in smt_received_pack()
587 smc->mib.m[MAC0].fddiMACUpstreamNbr ; in smt_received_pack()
590 smc->mib.m[MAC0].fddiMACUpstreamNbr = in smt_received_pack()
592 smt_srf_event(smc, in smt_received_pack()
595 smt_echo_test(smc,0) ; in smt_received_pack()
597 smc->sm.smt_tvu = smt_get_time() ; in smt_received_pack()
599 sm_to_para(smc,sm,SMT_P_STATE) ; in smt_received_pack()
601 smc->mib.m[MAC0].fddiMACUNDA_Flag = in smt_received_pack()
604 update_dac(smc,1) ; in smt_received_pack()
613 smt_send_nif(smc,&sm->smt_source, in smt_received_pack()
623 smc->sm.pend[SMT_TID_NIF] = 0 ; in smt_received_pack()
625 smc->mib.m[MAC0].fddiMACDupAddressTest = in smt_received_pack()
627 smc->r.dup_addr_test = DA_FAILED ; in smt_received_pack()
628 queue_event(smc,EVENT_RMT,RM_DUP_ADDR) ; in smt_received_pack()
629 smc->mib.m[MAC0].fddiMACDA_Flag = TRUE ; in smt_received_pack()
630 update_dac(smc,1) ; in smt_received_pack()
633 if (sm->smt_tid == smc->sm.pend[SMT_TID_NIF]) { in smt_received_pack()
634 smc->sm.pend[SMT_TID_NIF] = 0 ; in smt_received_pack()
637 &smc->mib.m[MAC0].fddiMACDownstreamNbr, in smt_received_pack()
640 if (!is_equal(&smc->mib.m[MAC0]. in smt_received_pack()
643 smc->mib.m[MAC0].fddiMACOldDownstreamNbr = in smt_received_pack()
644 smc->mib.m[MAC0].fddiMACDownstreamNbr ; in smt_received_pack()
647 smc->mib.m[MAC0].fddiMACDownstreamNbr = in smt_received_pack()
649 smt_srf_event(smc, in smt_received_pack()
652 smt_echo_test(smc,1) ; in smt_received_pack()
654 smc->mib.m[MAC0].fddiMACDA_Flag = FALSE ; in smt_received_pack()
655 update_dac(smc,1) ; in smt_received_pack()
656 smc->sm.smt_tvd = smt_get_time() ; in smt_received_pack()
657 smc->mib.m[MAC0].fddiMACDupAddressTest = in smt_received_pack()
659 if (smc->r.dup_addr_test != DA_PASSED) { in smt_received_pack()
660 smc->r.dup_addr_test = DA_PASSED ; in smt_received_pack()
661 queue_event(smc,EVENT_RMT,RM_DUP_ADDR) ; in smt_received_pack()
665 smc->sm.pend[SMT_TID_NIF_TEST]) { in smt_received_pack()
670 smc->sm.pend[SMT_TID_NIF], sm->smt_tid); in smt_received_pack()
683 smt_send_sif_config(smc,&sm->smt_source,sm->smt_tid,local) ; in smt_received_pack()
690 smt_send_sif_operation(smc,&sm->smt_source,sm->smt_tid,local) ; in smt_received_pack()
695 smc->mib.priv.fddiPRIVECF_Reply_Rx++ ; in smt_received_pack()
698 if (sm_to_para(smc,sm,SMT_P_ECHODATA) == NULL) { in smt_received_pack()
702 if (sm->smt_tid == smc->sm.pend[SMT_TID_ECF]) { in smt_received_pack()
705 else if (sm->smt_tid == smc->sm.pend[SMT_TID_ECF_UNA]) { in smt_received_pack()
708 else if (sm->smt_tid == smc->sm.pend[SMT_TID_ECF_DNA]) { in smt_received_pack()
713 smc->sm.pend[SMT_TID_ECF], in smt_received_pack()
718 smc->mib.priv.fddiPRIVECF_Req_Rx++ ; in smt_received_pack()
720 if (sm->smt_len && !sm_to_para(smc,sm,SMT_P_ECHODATA)) { in smt_received_pack()
722 smt_send_rdf(smc,mb,m_fc(mb),SMT_RDF_LENGTH, in smt_received_pack()
732 dump_smt(smc,sm,"ECF REPLY") ; in smt_received_pack()
733 smc->mib.priv.fddiPRIVECF_Reply_Tx++ ; in smt_received_pack()
734 smt_send_frame(smc,mb,FC_SMT_INFO,local) ; in smt_received_pack()
746 fs = ess_raf_received_pack(smc,mb,sm,fs) ; in smt_received_pack()
751 sba_raf_received_pack(smc,sm,fs) ; in smt_received_pack()
755 smc->mib.priv.fddiPRIVRDF_Rx++ ; in smt_received_pack()
760 smt_send_rdf(smc,mb,m_fc(mb),SMT_RDF_CLASS,local) ; in smt_received_pack()
769 smc->mib.priv.fddiPRIVPMF_Get_Rx++ ; in smt_received_pack()
771 smc->mib.priv.fddiPRIVPMF_Set_Rx++ ; in smt_received_pack()
780 smt_pmf_received_pack(smc,mb, local) ; in smt_received_pack()
783 dump_smt(smc,sm,"SRF received") ; in smt_received_pack()
796 smt_send_rdf(smc,mb,m_fc(mb),SMT_RDF_CLASS,local) ; in smt_received_pack()
803 smt_free_mbuf(smc,mb) ; in smt_received_pack()
806 static void update_dac(struct s_smc *smc, int report) in update_dac() argument
810 cond = ( smc->mib.m[MAC0].fddiMACUNDA_Flag | in update_dac()
811 smc->mib.m[MAC0].fddiMACDA_Flag) != 0 ; in update_dac()
812 if (report && (cond != smc->mib.m[MAC0].fddiMACDuplicateAddressCond)) in update_dac()
813 smt_srf_event(smc, SMT_COND_MAC_DUP_ADDR,INDEX_MAC,cond) ; in update_dac()
815 smc->mib.m[MAC0].fddiMACDuplicateAddressCond = cond ; in update_dac()
824 void smt_send_frame(struct s_smc *smc, SMbuf *mb, int fc, int local) in smt_send_frame() argument
830 if (!smc->r.sm_ma_avail && !local) { in smt_send_frame()
831 smt_free_mbuf(smc,mb) ; in smt_send_frame()
835 sm->smt_source = smc->mib.m[MAC0].fddiMACSMTAddress ; in smt_send_frame()
836 sm->smt_sid = smc->mib.fddiSMTStationId ; in smt_send_frame()
839 hwm_conv_can(smc,(char *)sm,12) ; /* convert SA and DA */ in smt_send_frame()
840 smc->mib.m[MAC0].fddiMACSMTTransmit_Ct++ ; in smt_send_frame()
841 smt_send_mbuf(smc,mb,local ? FC_SMT_LOC : fc) ; in smt_send_frame()
847 static void smt_send_rdf(struct s_smc *smc, SMbuf *rej, int fc, int reason, in smt_send_rdf() argument
873 if (!(mb=smt_build_frame(smc,SMT_RDF,SMT_REPLY,sizeof(struct smt_rdf)))) in smt_send_rdf()
916 dump_smt(smc,(struct smt_header *)rdf,"RDF") ; in smt_send_rdf()
917 smc->mib.priv.fddiPRIVRDF_Tx++ ; in smt_send_rdf()
918 smt_send_frame(smc,mb,FC_SMT_INFO,local) ; in smt_send_rdf()
924 static void smt_send_nif(struct s_smc *smc, const struct fddi_addr *dest, in smt_send_nif() argument
934 if (!(mb = smt_build_frame(smc,SMT_NIF,type,sizeof(struct smt_nif)))) in smt_send_nif()
937 smt_fill_una(smc,&nif->una) ; /* set UNA */ in smt_send_nif()
938 smt_fill_sde(smc,&nif->sde) ; /* set station descriptor */ in smt_send_nif()
939 smt_fill_state(smc,&nif->state) ; /* set state information */ in smt_send_nif()
941 smt_fill_fsc(smc,&nif->fsc) ; /* set frame status cap. */ in smt_send_nif()
945 dump_smt(smc,(struct smt_header *)nif,"NIF") ; in smt_send_nif()
946 smt_send_frame(smc,mb,fc,local) ; in smt_send_nif()
953 static void smt_send_nif_request(struct s_smc *smc, struct fddi_addr *dest) in smt_send_nif_request() argument
955 smc->sm.pend[SMT_TID_NIF_TEST] = smt_get_tid(smc) ; in smt_send_nif_request()
956 smt_send_nif(smc,dest, FC_SMT_INFO, smc->sm.pend[SMT_TID_NIF_TEST], in smt_send_nif_request()
963 static void smt_send_ecf_request(struct s_smc *smc, struct fddi_addr *dest, in smt_send_ecf_request() argument
966 smc->sm.pend[SMT_TID_ECF] = smt_get_tid(smc) ; in smt_send_ecf_request()
967 smt_send_ecf(smc,dest, FC_SMT_INFO, smc->sm.pend[SMT_TID_ECF], in smt_send_ecf_request()
975 static void smt_echo_test(struct s_smc *smc, int dna) in smt_echo_test() argument
979 smc->sm.pend[dna ? SMT_TID_ECF_DNA : SMT_TID_ECF_UNA] = in smt_echo_test()
980 tid = smt_get_tid(smc) ; in smt_echo_test()
981 smt_send_ecf(smc, dna ? in smt_echo_test()
982 &smc->mib.m[MAC0].fddiMACDownstreamNbr : in smt_echo_test()
983 &smc->mib.m[MAC0].fddiMACUpstreamNbr, in smt_echo_test()
990 static void smt_send_ecf(struct s_smc *smc, struct fddi_addr *dest, int fc, in smt_send_ecf() argument
1001 if (!(mb = smt_build_frame(smc,SMT_ECF,type,SMT_ECF_LEN + len))) in smt_send_ecf()
1005 smt_fill_echo(smc,&ecf->ec_echo,tid,len) ; /* set ECHO */ in smt_send_ecf()
1008 smc->mib.priv.fddiPRIVECF_Req_Tx++ ; in smt_send_ecf()
1009 smt_send_frame(smc,mb,fc,0) ; in smt_send_ecf()
1016 static void smt_send_sif_config(struct s_smc *smc, struct fddi_addr *dest, in smt_send_sif_config() argument
1024 if (!(mb = smt_build_frame(smc,SMT_SIF_CONFIG,SMT_REPLY, in smt_send_sif_config()
1029 smt_fill_timestamp(smc,&sif->ts) ; /* set time stamp */ in smt_send_sif_config()
1030 smt_fill_sde(smc,&sif->sde) ; /* set station descriptor */ in smt_send_sif_config()
1031 smt_fill_version(smc,&sif->version) ; /* set version information */ in smt_send_sif_config()
1032 smt_fill_state(smc,&sif->state) ; /* set state information */ in smt_send_sif_config()
1033 smt_fill_policy(smc,&sif->policy) ; /* set station policy */ in smt_send_sif_config()
1034 smt_fill_latency(smc,&sif->latency); /* set station latency */ in smt_send_sif_config()
1035 smt_fill_neighbor(smc,&sif->neighbor); /* set station neighbor */ in smt_send_sif_config()
1036 smt_fill_setcount(smc,&sif->setcount) ; /* set count */ in smt_send_sif_config()
1037 len = smt_fill_path(smc,&sif->path); /* set station path descriptor*/ in smt_send_sif_config()
1041 dump_smt(smc,(struct smt_header *)sif,"SIF Configuration Reply") ; in smt_send_sif_config()
1042 smt_send_frame(smc,mb,FC_SMT_INFO,local) ; in smt_send_sif_config()
1049 static void smt_send_sif_operation(struct s_smc *smc, struct fddi_addr *dest, in smt_send_sif_operation() argument
1061 if (smc->s.sas == SMT_SAS) in smt_send_sif_operation()
1065 if (!(mb = smt_build_frame(smc,SMT_SIF_OPER,SMT_REPLY, in smt_send_sif_operation()
1069 smt_fill_timestamp(smc,&sif->ts) ; /* set time stamp */ in smt_send_sif_operation()
1070 smt_fill_mac_status(smc,&sif->status) ; /* set mac status */ in smt_send_sif_operation()
1071 smt_fill_mac_counter(smc,&sif->mc) ; /* set mac counter field */ in smt_send_sif_operation()
1072 smt_fill_mac_fnc(smc,&sif->fnc) ; /* set frame not copied counter */ in smt_send_sif_operation()
1073 smt_fill_manufacturer(smc,&sif->man) ; /* set manufacturer field */ in smt_send_sif_operation()
1074 smt_fill_user(smc,&sif->user) ; /* set user field */ in smt_send_sif_operation()
1075 smt_fill_setcount(smc,&sif->setcount) ; /* set count */ in smt_send_sif_operation()
1080 smt_fill_lem(smc,sif->lem,PS) ; in smt_send_sif_operation()
1084 smt_fill_lem(smc,&sif->lem[i],i) ; in smt_send_sif_operation()
1090 dump_smt(smc,(struct smt_header *)sif,"SIF Operation Reply") ; in smt_send_sif_operation()
1091 smt_send_frame(smc,mb,FC_SMT_INFO,local) ; in smt_send_sif_operation()
1097 SMbuf *smt_build_frame(struct s_smc *smc, int class, int type, in smt_build_frame() argument
1104 if (!smc->r.sm_ma_avail) { in smt_build_frame()
1108 if (!(mb = smt_get_mbuf(smc))) in smt_build_frame()
1127 smt->smt_tid = smt_get_tid(smc) ; /* set transaction ID */ in smt_build_frame()
1147 static void smt_fill_una(struct s_smc *smc, struct smt_p_una *una) in smt_fill_una() argument
1151 una->una_node = smc->mib.m[MAC0].fddiMACUpstreamNbr ; in smt_fill_una()
1157 static void smt_fill_sde(struct s_smc *smc, struct smt_p_sde *sde) in smt_fill_sde() argument
1160 sde->sde_non_master = smc->mib.fddiSMTNonMaster_Ct ; in smt_fill_sde()
1161 sde->sde_master = smc->mib.fddiSMTMaster_Ct ; in smt_fill_sde()
1173 static void smt_fill_state(struct s_smc *smc, struct smt_p_state *state) in smt_fill_state() argument
1183 if (smc->mib.fddiSMTPeerWrapFlag) { in smt_fill_state()
1187 if (cfm_status_unattached(smc)) { in smt_fill_state()
1191 if ((twist = pcm_status_twisted(smc)) & 1) { in smt_fill_state()
1200 if (pcm_rooted_station(smc)) in smt_fill_state()
1202 if (smc->mib.a[0].fddiPATHSbaPayload != 0) in smt_fill_state()
1206 ((smc->mib.m[MAC0].fddiMACDA_Flag ? SMT_ST_MY_DUPA : 0 ) | in smt_fill_state()
1207 (smc->mib.m[MAC0].fddiMACUNDA_Flag ? SMT_ST_UNA_DUPA : 0)) ; in smt_fill_state()
1213 static void smt_fill_timestamp(struct s_smc *smc, struct smt_p_timestamp *ts) in smt_fill_timestamp() argument
1217 smt_set_timestamp(smc,ts->ts_time) ; in smt_fill_timestamp()
1220 void smt_set_timestamp(struct s_smc *smc, u_char *p) in smt_set_timestamp() argument
1239 p[6] = (u_char)(smc->sm.uniq_ticks>>8) ; in smt_set_timestamp()
1240 p[7] = (u_char)smc->sm.uniq_ticks ; in smt_set_timestamp()
1244 if (utime != smc->sm.uniq_time) { in smt_set_timestamp()
1245 smc->sm.uniq_ticks = 0 ; in smt_set_timestamp()
1247 smc->sm.uniq_ticks++ ; in smt_set_timestamp()
1248 smc->sm.uniq_time = utime ; in smt_set_timestamp()
1254 static void smt_fill_policy(struct s_smc *smc, struct smt_p_policy *policy) in smt_fill_policy() argument
1271 in = smc->mib.fddiSMTConnectionPolicy ; in smt_fill_policy()
1278 policy->pl_config = smc->mib.fddiSMTConfigPolicy ; in smt_fill_policy()
1285 static void smt_fill_latency(struct s_smc *smc, struct smt_p_latency *latency) in smt_fill_latency() argument
1289 latency->lt_phyout_idx1 = phy_index(smc,0) ; in smt_fill_latency()
1295 if (smc->s.sas == SMT_DAS) { in smt_fill_latency()
1296 latency->lt_phyout_idx2 = phy_index(smc,1) ; in smt_fill_latency()
1308 static void smt_fill_neighbor(struct s_smc *smc, struct smt_p_neighbor *neighbor) in smt_fill_neighbor() argument
1313 neighbor->nb_mac_index = mac_index(smc,1) ; in smt_fill_neighbor()
1314 neighbor->nb_una = smc->mib.m[MAC0].fddiMACUpstreamNbr ; in smt_fill_neighbor()
1315 neighbor->nb_dna = smc->mib.m[MAC0].fddiMACDownstreamNbr ; in smt_fill_neighbor()
1324 #define ALLPHYS ((smc->s.sas == SMT_SAS) ? 1 : 2)
1327 static int smt_fill_path(struct s_smc *smc, struct smt_p_path *path) in smt_fill_path() argument
1349 if (smc->s.sas == SMT_SAS) in smt_fill_path()
1352 pcm_status_state(smc,physp,&type,&state,&remote,&mac) ; in smt_fill_path()
1362 phy->phy_resource_idx = phy_con_resource_index(smc,p) ; in smt_fill_path()
1367 pd_mac->mac_addr = smc->mib.m[MAC0].fddiMACSMTAddress ; in smt_fill_path()
1368 pd_mac->mac_resource_idx = mac_con_resource_index(smc,1) ; in smt_fill_path()
1375 static void smt_fill_mac_status(struct s_smc *smc, struct smt_p_mac_status *st) in smt_fill_mac_status() argument
1380 st->st_mac_index = mac_index(smc,1) ; in smt_fill_mac_status()
1382 mac_update_counter(smc) ; in smt_fill_mac_status()
1387 st->st_t_req = smc->mib.m[MAC0].fddiMACT_Req ; in smt_fill_mac_status()
1388 st->st_t_neg = smc->mib.m[MAC0].fddiMACT_Neg ; in smt_fill_mac_status()
1389 st->st_t_max = smc->mib.m[MAC0].fddiMACT_Max ; in smt_fill_mac_status()
1390 st->st_tvx_value = smc->mib.m[MAC0].fddiMACTvxValue ; in smt_fill_mac_status()
1391 st->st_t_min = smc->mib.m[MAC0].fddiMACT_Min ; in smt_fill_mac_status()
1393 st->st_sba = smc->mib.a[PATH0].fddiPATHSbaPayload ; in smt_fill_mac_status()
1394 st->st_frame_ct = smc->mib.m[MAC0].fddiMACFrame_Ct ; in smt_fill_mac_status()
1395 st->st_error_ct = smc->mib.m[MAC0].fddiMACError_Ct ; in smt_fill_mac_status()
1396 st->st_lost_ct = smc->mib.m[MAC0].fddiMACLost_Ct ; in smt_fill_mac_status()
1402 static void smt_fill_lem(struct s_smc *smc, struct smt_p_lem *lem, int phy) in smt_fill_lem() argument
1406 mib = smc->y[phy].mib ; in smt_fill_lem()
1410 lem->lem_phy_index = phy_index(smc,phy) ; in smt_fill_lem()
1424 static void smt_fill_version(struct s_smc *smc, struct smt_p_version *vers) in smt_fill_version() argument
1426 SK_UNUSED(smc) ; in smt_fill_version()
1443 static void smt_fill_fsc(struct s_smc *smc, struct smt_p_fsc *fsc) in smt_fill_fsc() argument
1445 SK_UNUSED(smc) ; in smt_fill_fsc()
1463 static void smt_fill_mac_counter(struct s_smc *smc, struct smt_p_mac_counter *mc) in smt_fill_mac_counter() argument
1467 mc->mc_index = mac_index(smc,1) ; in smt_fill_mac_counter()
1468 mc->mc_receive_ct = smc->mib.m[MAC0].fddiMACCopied_Ct ; in smt_fill_mac_counter()
1469 mc->mc_transmit_ct = smc->mib.m[MAC0].fddiMACTransmit_Ct ; in smt_fill_mac_counter()
1475 static void smt_fill_mac_fnc(struct s_smc *smc, struct smt_p_mac_fnc *fnc) in smt_fill_mac_fnc() argument
1479 fnc->nc_index = mac_index(smc,1) ; in smt_fill_mac_fnc()
1480 fnc->nc_counter = smc->mib.m[MAC0].fddiMACNotCopied_Ct ; in smt_fill_mac_fnc()
1487 static void smt_fill_manufacturer(struct s_smc *smc, in smt_fill_manufacturer() argument
1492 (char *) smc->mib.fddiSMTManufacturerData, in smt_fill_manufacturer()
1499 static void smt_fill_user(struct s_smc *smc, struct smp_p_user *user) in smt_fill_user() argument
1503 (char *) smc->mib.fddiSMTUserData, in smt_fill_user()
1510 static void smt_fill_setcount(struct s_smc *smc, struct smt_p_setcount *setcount) in smt_fill_setcount() argument
1512 SK_UNUSED(smc) ; in smt_fill_setcount()
1514 setcount->count = smc->mib.fddiSMTSetCount.count ; in smt_fill_setcount()
1516 (char *)smc->mib.fddiSMTSetCount.timestamp,8) ; in smt_fill_setcount()
1522 static void smt_fill_echo(struct s_smc *smc, struct smt_p_echo *echo, u_long seed, in smt_fill_echo() argument
1527 SK_UNUSED(smc) ; in smt_fill_echo()
1540 static void smt_clear_una_dna(struct s_smc *smc) in smt_clear_una_dna() argument
1542 smc->mib.m[MAC0].fddiMACUpstreamNbr = SMT_Unknown ; in smt_clear_una_dna()
1543 smc->mib.m[MAC0].fddiMACDownstreamNbr = SMT_Unknown ; in smt_clear_una_dna()
1546 static void smt_clear_old_una_dna(struct s_smc *smc) in smt_clear_old_una_dna() argument
1548 smc->mib.m[MAC0].fddiMACOldUpstreamNbr = SMT_Unknown ; in smt_clear_old_una_dna()
1549 smc->mib.m[MAC0].fddiMACOldDownstreamNbr = SMT_Unknown ; in smt_clear_old_una_dna()
1552 u_long smt_get_tid(struct s_smc *smc) in smt_get_tid() argument
1555 while ((tid = ++(smc->sm.smt_tid) ^ SMT_TID_MAGIC) == 0) in smt_get_tid()
1642 int smt_check_para(struct s_smc *smc, struct smt_header *sm, in smt_check_para() argument
1647 if (!sm_to_para(smc,sm,(int) *p)) { in smt_check_para()
1656 void *sm_to_para(struct s_smc *smc, struct smt_header *sm, int para) in sm_to_para() argument
1663 SK_UNUSED(smc) ; in sm_to_para()
1691 void fddi_send_antc(struct s_smc *smc, struct fddi_addr *dest)
1693 SK_UNUSED(smc) ;
1709 smt->smt_source = smc->mib.m[MAC0].fddiMACSMTAddress ;
1710 smt_send_mbuf(smc,mb,FC_ASYNC_LLC) ;
1718 static int mac_index(struct s_smc *smc, int mac) in mac_index() argument
1722 SK_UNUSED(smc) ; in mac_index()
1725 return (smc->s.sas == SMT_SAS) ? 2 : 3; in mac_index()
1732 static int phy_index(struct s_smc *smc, int phy) in phy_index() argument
1734 SK_UNUSED(smc) ; in phy_index()
1741 static int mac_con_resource_index(struct s_smc *smc, int mac) in mac_con_resource_index() argument
1744 SK_UNUSED(smc) ; in mac_con_resource_index()
1746 return entity_to_index(smc, cem_get_downstream(smc, ENTITY_MAC)); in mac_con_resource_index()
1749 switch (smc->mib.fddiSMTCF_State) { in mac_con_resource_index()
1758 return smc->s.sas == SMT_SAS ? 2 : 3; in mac_con_resource_index()
1765 static int phy_con_resource_index(struct s_smc *smc, int phy) in phy_con_resource_index() argument
1768 return entity_to_index(smc, cem_get_downstream(smc, ENTITY_PHY(phy))) ; in phy_con_resource_index()
1770 switch (smc->mib.fddiSMTCF_State) { in phy_con_resource_index()
1787 static int entity_to_index(struct s_smc *smc, int e) in entity_to_index() argument
1790 return mac_index(smc, 1); in entity_to_index()
1792 return phy_index(smc, e - ENTITY_PHY(0)); in entity_to_index()
1912 int smt_action(struct s_smc *smc, int class, int code, int index) in smt_action() argument
1921 smc->mib.fddiSMTRemoteDisconnectFlag = FALSE ; in smt_action()
1922 queue_event(smc,EVENT_ECM,EC_CONNECT) ; in smt_action()
1925 queue_event(smc,EVENT_ECM,EC_DISCONNECT) ; in smt_action()
1926 smc->mib.fddiSMTRemoteDisconnectFlag = TRUE ; in smt_action()
1927 RS_SET(smc,RS_DISCONNECT) ; in smt_action()
1928 AIX_EVENT(smc, (u_long) FDDI_RING_STATUS, (u_long) in smt_action()
1930 smt_get_event_word(smc)); in smt_action()
1933 AIX_EVENT(smc, (u_long) FDDI_RING_STATUS, (u_long) in smt_action()
1935 smt_get_event_word(smc)); in smt_action()
1938 AIX_EVENT(smc, (u_long) FDDI_RING_STATUS, (u_long) in smt_action()
1940 smt_get_event_word(smc)); in smt_action()
1943 if (smc->y[PA].pc_mode == PM_PEER) { in smt_action()
1944 RS_SET(smc,RS_EVENT) ; in smt_action()
1945 queue_event(smc,EVENT_PCM+PA,PC_DISABLE) ; in smt_action()
1949 if (smc->y[PB].pc_mode == PM_PEER) { in smt_action()
1950 RS_SET(smc,RS_EVENT) ; in smt_action()
1951 queue_event(smc,EVENT_PCM+PB,PC_DISABLE) ; in smt_action()
1956 if (smc->mib.p[port].fddiPORTMy_Type != TM) in smt_action()
1958 RS_SET(smc,RS_EVENT) ; in smt_action()
1959 queue_event(smc,EVENT_PCM+port,PC_DISABLE) ; in smt_action()
1986 queue_event(smc,EVENT_PCM+index,event) ; in smt_action()
1998 static void hwm_conv_can(struct s_smc *smc, char *data, int len) in hwm_conv_can() argument
2002 SK_UNUSED(smc) ; in hwm_conv_can()