Lines Matching full:smc
19 #include "h/smc.h"
62 static int mac_index(struct s_smc *smc, int mac);
63 static int phy_index(struct s_smc *smc, int phy);
64 static int mac_con_resource_index(struct s_smc *smc, int mac);
65 static int phy_con_resource_index(struct s_smc *smc, int phy);
66 static void smt_send_rdf(struct s_smc *smc, SMbuf *rej, int fc, int reason,
68 static void smt_send_nif(struct s_smc *smc, const struct fddi_addr *dest,
70 static void smt_send_ecf(struct s_smc *smc, struct fddi_addr *dest, int fc,
72 static void smt_echo_test(struct s_smc *smc, int dna);
73 static void smt_send_sif_config(struct s_smc *smc, struct fddi_addr *dest,
75 static void smt_send_sif_operation(struct s_smc *smc, struct fddi_addr *dest,
81 static void smt_fill_una(struct s_smc *smc, struct smt_p_una *una);
82 static void smt_fill_sde(struct s_smc *smc, struct smt_p_sde *sde);
83 static void smt_fill_state(struct s_smc *smc, struct smt_p_state *state);
84 static void smt_fill_timestamp(struct s_smc *smc, struct smt_p_timestamp *ts);
85 static void smt_fill_policy(struct s_smc *smc, struct smt_p_policy *policy);
86 static void smt_fill_latency(struct s_smc *smc, struct smt_p_latency *latency);
87 static void smt_fill_neighbor(struct s_smc *smc, struct smt_p_neighbor *neighbor);
88 static int smt_fill_path(struct s_smc *smc, struct smt_p_path *path);
89 static void smt_fill_mac_status(struct s_smc *smc, struct smt_p_mac_status *st);
90 static void smt_fill_lem(struct s_smc *smc, struct smt_p_lem *lem, int phy);
91 static void smt_fill_version(struct s_smc *smc, struct smt_p_version *vers);
92 static void smt_fill_fsc(struct s_smc *smc, struct smt_p_fsc *fsc);
93 static void smt_fill_mac_counter(struct s_smc *smc, struct smt_p_mac_counter *mc);
94 static void smt_fill_mac_fnc(struct s_smc *smc, struct smt_p_mac_fnc *fnc);
95 static void smt_fill_manufacturer(struct s_smc *smc,
97 static void smt_fill_user(struct s_smc *smc, struct smp_p_user *user);
98 static void smt_fill_setcount(struct s_smc *smc, struct smt_p_setcount *setcount);
99 static void smt_fill_echo(struct s_smc *smc, struct smt_p_echo *echo, u_long seed,
102 static void smt_clear_una_dna(struct s_smc *smc);
103 static void smt_clear_old_una_dna(struct s_smc *smc);
107 static void update_dac(struct s_smc *smc, int report);
110 static void hwm_conv_can(struct s_smc *smc, char *data, int len);
112 #define hwm_conv_can(smc,data,len) argument
116 static inline int is_my_addr(const struct s_smc *smc, in is_my_addr() argument
120 *(short *)(&smc->mib.m[MAC0].fddiMACSMTAddress.a[0]) in is_my_addr()
122 *(short *)(&smc->mib.m[MAC0].fddiMACSMTAddress.a[2]) in is_my_addr()
124 *(short *)(&smc->mib.m[MAC0].fddiMACSMTAddress.a[4])) ; in is_my_addr()
155 void smt_agent_init(struct s_smc *smc) in smt_agent_init() argument
162 smc->mib.m[MAC0].fddiMACSMTAddress = smc->hw.fddi_home_addr ; in smt_agent_init()
167 smc->mib.fddiSMTStationId.sid_oem[0] = 0 ; in smt_agent_init()
168 smc->mib.fddiSMTStationId.sid_oem[1] = 0 ; in smt_agent_init()
169 driver_get_bia(smc,&smc->mib.fddiSMTStationId.sid_node) ; in smt_agent_init()
171 smc->mib.fddiSMTStationId.sid_node.a[i] = in smt_agent_init()
172 bitrev8(smc->mib.fddiSMTStationId.sid_node.a[i]); in smt_agent_init()
174 smc->mib.fddiSMTManufacturerData[0] = in smt_agent_init()
175 smc->mib.fddiSMTStationId.sid_node.a[0] ; in smt_agent_init()
176 smc->mib.fddiSMTManufacturerData[1] = in smt_agent_init()
177 smc->mib.fddiSMTStationId.sid_node.a[1] ; in smt_agent_init()
178 smc->mib.fddiSMTManufacturerData[2] = in smt_agent_init()
179 smc->mib.fddiSMTStationId.sid_node.a[2] ; in smt_agent_init()
180 smc->sm.smt_tid = 0 ; in smt_agent_init()
181 smc->mib.m[MAC0].fddiMACDupAddressTest = DA_NONE ; in smt_agent_init()
182 smc->mib.m[MAC0].fddiMACUNDA_Flag = FALSE ; in smt_agent_init()
184 smt_clear_una_dna(smc) ; in smt_agent_init()
185 smt_clear_old_una_dna(smc) ; in smt_agent_init()
188 smc->sm.pend[i] = 0 ; in smt_agent_init()
189 smc->sm.please_reconnect = 0 ; in smt_agent_init()
190 smc->sm.uniq_ticks = 0 ; in smt_agent_init()
201 void smt_agent_task(struct s_smc *smc) in smt_agent_task() argument
203 smt_timer_start(smc,&smc->sm.smt_timer, (u_long)1000000L, in smt_agent_task()
209 void smt_emulate_token_ct(struct s_smc *smc, int mac_index) in smt_emulate_token_ct() argument
216 count = ((time - smc->sm.last_tok_time[mac_index]) * in smt_emulate_token_ct()
225 if (smc->hw.mac_ring_is_up){ in smt_emulate_token_ct()
226 smc->mib.m[mac_index].fddiMACToken_Ct += count; in smt_emulate_token_ct()
230 smc->sm.last_tok_time[mac_index] = time; in smt_emulate_token_ct()
236 void smt_event(struct s_smc *smc, int event) in smt_event() argument
244 if (smc->sm.please_reconnect) { in smt_event()
245 smc->sm.please_reconnect -- ; in smt_event()
246 if (smc->sm.please_reconnect == 0) { in smt_event()
248 queue_event(smc,EVENT_ECM,EC_CONNECT) ; in smt_event()
261 smt_timer_poll(smc) ; in smt_event()
262 smt_start_watchdog(smc) ; in smt_event()
266 ess_timer_poll(smc) ; in smt_event()
270 sba_timer_poll(smc) ; in smt_event()
273 smt_srf_event(smc,0,0,0) ; in smt_event()
279 if (time - smc->sm.smt_last_lem >= TICKS_PER_SECOND*8) { in smt_event()
293 sm_lem_evaluate(smc) ; in smt_event()
294 smc->sm.smt_last_lem = time ; in smt_event()
300 mac_update_counter(smc) ; in smt_event()
301 mib = smc->mib.m ; in smt_event()
317 smt_srf_event(smc,SMT_COND_MAC_FRAME_ERROR, in smt_event()
335 smt_srf_event(smc,SMT_COND_MAC_NOT_COPIED, in smt_event()
351 phy = &smc->y[port] ; in smt_event()
363 smt_srf_event(smc,SMT_COND_PORT_EB_ERROR, in smt_event()
378 if (time - smc->sm.smt_last_notify >= (u_long) in smt_event()
379 (smc->mib.fddiSMTTT_Notify * TICKS_PER_SECOND) ) { in smt_event()
386 if (!smc->sm.pend[SMT_TID_NIF]) in smt_event()
387 smc->sm.pend[SMT_TID_NIF] = smt_get_tid(smc) ; in smt_event()
388 smt_send_nif(smc,&fddi_broadcast, FC_SMT_NSA, in smt_event()
389 smc->sm.pend[SMT_TID_NIF], SMT_REQUEST,0) ; in smt_event()
390 smc->sm.smt_last_notify = time ; in smt_event()
396 if (smc->sm.smt_tvu && in smt_event()
397 time - smc->sm.smt_tvu > 228*TICKS_PER_SECOND) { in smt_event()
399 smc->sm.smt_tvu = 0 ; in smt_event()
401 if (!is_equal(&smc->mib.m[MAC0].fddiMACUpstreamNbr, in smt_event()
404 smc->mib.m[MAC0].fddiMACOldUpstreamNbr= in smt_event()
405 smc->mib.m[MAC0].fddiMACUpstreamNbr ; in smt_event()
407 smc->mib.m[MAC0].fddiMACUpstreamNbr = SMT_Unknown ; in smt_event()
408 smc->mib.m[MAC0].fddiMACUNDA_Flag = FALSE ; in smt_event()
415 update_dac(smc,0) ; in smt_event()
416 smt_srf_event(smc, SMT_EVENT_MAC_NEIGHBOR_CHANGE, in smt_event()
419 if (smc->sm.smt_tvd && in smt_event()
420 time - smc->sm.smt_tvd > 228*TICKS_PER_SECOND) { in smt_event()
422 smc->sm.smt_tvd = 0 ; in smt_event()
423 if (!is_equal(&smc->mib.m[MAC0].fddiMACDownstreamNbr, in smt_event()
426 smc->mib.m[MAC0].fddiMACOldDownstreamNbr= in smt_event()
427 smc->mib.m[MAC0].fddiMACDownstreamNbr ; in smt_event()
429 smc->mib.m[MAC0].fddiMACDownstreamNbr = SMT_Unknown ; in smt_event()
430 smt_srf_event(smc, SMT_EVENT_MAC_NEIGHBOR_CHANGE, in smt_event()
442 if (time - smc->sm.last_tok_time[i] > 2*TICKS_PER_SECOND ){ in smt_event()
443 smt_emulate_token_ct( smc, i ); in smt_event()
448 smt_timer_start(smc,&smc->sm.smt_timer, (u_long)1000000L, in smt_event()
468 void smt_received_pack(struct s_smc *smc, SMbuf *mb, int fs) in smt_received_pack() argument
483 smt_free_mbuf(smc,mb) ; in smt_received_pack()
487 smc->mib.m[MAC0].fddiMACSMTCopied_Ct++ ; in smt_received_pack()
490 hwm_conv_can(smc,(char *)sm,12) ; in smt_received_pack()
493 if (is_individual(&sm->smt_dest) && !is_my_addr(smc,&sm->smt_dest)) { in smt_received_pack()
494 smt_free_mbuf(smc,mb) ; in smt_received_pack()
499 if (is_my_addr(smc,&sm->smt_source) && !local) { in smt_received_pack()
500 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()
811 smt_free_mbuf(smc,mb) ; in smt_received_pack()
814 static void update_dac(struct s_smc *smc, int report) in update_dac() argument
818 cond = ( smc->mib.m[MAC0].fddiMACUNDA_Flag | in update_dac()
819 smc->mib.m[MAC0].fddiMACDA_Flag) != 0 ; in update_dac()
820 if (report && (cond != smc->mib.m[MAC0].fddiMACDuplicateAddressCond)) in update_dac()
821 smt_srf_event(smc, SMT_COND_MAC_DUP_ADDR,INDEX_MAC,cond) ; in update_dac()
823 smc->mib.m[MAC0].fddiMACDuplicateAddressCond = cond ; in update_dac()
832 void smt_send_frame(struct s_smc *smc, SMbuf *mb, int fc, int local) in smt_send_frame() argument
838 if (!smc->r.sm_ma_avail && !local) { in smt_send_frame()
839 smt_free_mbuf(smc,mb) ; in smt_send_frame()
843 sm->smt_source = smc->mib.m[MAC0].fddiMACSMTAddress ; in smt_send_frame()
844 sm->smt_sid = smc->mib.fddiSMTStationId ; in smt_send_frame()
847 hwm_conv_can(smc,(char *)sm,12) ; /* convert SA and DA */ in smt_send_frame()
848 smc->mib.m[MAC0].fddiMACSMTTransmit_Ct++ ; in smt_send_frame()
849 smt_send_mbuf(smc,mb,local ? FC_SMT_LOC : fc) ; in smt_send_frame()
855 static void smt_send_rdf(struct s_smc *smc, SMbuf *rej, int fc, int reason, in smt_send_rdf() argument
881 if (!(mb=smt_build_frame(smc,SMT_RDF,SMT_REPLY,sizeof(struct smt_rdf)))) in smt_send_rdf()
924 dump_smt(smc,(struct smt_header *)rdf,"RDF") ; in smt_send_rdf()
925 smc->mib.priv.fddiPRIVRDF_Tx++ ; in smt_send_rdf()
926 smt_send_frame(smc,mb,FC_SMT_INFO,local) ; in smt_send_rdf()
932 static void smt_send_nif(struct s_smc *smc, const struct fddi_addr *dest, in smt_send_nif() argument
942 if (!(mb = smt_build_frame(smc,SMT_NIF,type,sizeof(struct smt_nif)))) in smt_send_nif()
945 smt_fill_una(smc,&nif->una) ; /* set UNA */ in smt_send_nif()
946 smt_fill_sde(smc,&nif->sde) ; /* set station descriptor */ in smt_send_nif()
947 smt_fill_state(smc,&nif->state) ; /* set state information */ in smt_send_nif()
949 smt_fill_fsc(smc,&nif->fsc) ; /* set frame status cap. */ in smt_send_nif()
953 dump_smt(smc,(struct smt_header *)nif,"NIF") ; in smt_send_nif()
954 smt_send_frame(smc,mb,fc,local) ; in smt_send_nif()
961 static void smt_send_nif_request(struct s_smc *smc, struct fddi_addr *dest) in smt_send_nif_request() argument
963 smc->sm.pend[SMT_TID_NIF_TEST] = smt_get_tid(smc) ; in smt_send_nif_request()
964 smt_send_nif(smc,dest, FC_SMT_INFO, smc->sm.pend[SMT_TID_NIF_TEST], in smt_send_nif_request()
971 static void smt_send_ecf_request(struct s_smc *smc, struct fddi_addr *dest, in smt_send_ecf_request() argument
974 smc->sm.pend[SMT_TID_ECF] = smt_get_tid(smc) ; in smt_send_ecf_request()
975 smt_send_ecf(smc,dest, FC_SMT_INFO, smc->sm.pend[SMT_TID_ECF], in smt_send_ecf_request()
983 static void smt_echo_test(struct s_smc *smc, int dna) in smt_echo_test() argument
987 smc->sm.pend[dna ? SMT_TID_ECF_DNA : SMT_TID_ECF_UNA] = in smt_echo_test()
988 tid = smt_get_tid(smc) ; in smt_echo_test()
989 smt_send_ecf(smc, dna ? in smt_echo_test()
990 &smc->mib.m[MAC0].fddiMACDownstreamNbr : in smt_echo_test()
991 &smc->mib.m[MAC0].fddiMACUpstreamNbr, in smt_echo_test()
998 static void smt_send_ecf(struct s_smc *smc, struct fddi_addr *dest, int fc, in smt_send_ecf() argument
1009 if (!(mb = smt_build_frame(smc,SMT_ECF,type,SMT_ECF_LEN + len))) in smt_send_ecf()
1013 smt_fill_echo(smc,&ecf->ec_echo,tid,len) ; /* set ECHO */ in smt_send_ecf()
1016 smc->mib.priv.fddiPRIVECF_Req_Tx++ ; in smt_send_ecf()
1017 smt_send_frame(smc,mb,fc,0) ; in smt_send_ecf()
1024 static void smt_send_sif_config(struct s_smc *smc, struct fddi_addr *dest, in smt_send_sif_config() argument
1032 if (!(mb = smt_build_frame(smc,SMT_SIF_CONFIG,SMT_REPLY, in smt_send_sif_config()
1037 smt_fill_timestamp(smc,&sif->ts) ; /* set time stamp */ in smt_send_sif_config()
1038 smt_fill_sde(smc,&sif->sde) ; /* set station descriptor */ in smt_send_sif_config()
1039 smt_fill_version(smc,&sif->version) ; /* set version information */ in smt_send_sif_config()
1040 smt_fill_state(smc,&sif->state) ; /* set state information */ in smt_send_sif_config()
1041 smt_fill_policy(smc,&sif->policy) ; /* set station policy */ in smt_send_sif_config()
1042 smt_fill_latency(smc,&sif->latency); /* set station latency */ in smt_send_sif_config()
1043 smt_fill_neighbor(smc,&sif->neighbor); /* set station neighbor */ in smt_send_sif_config()
1044 smt_fill_setcount(smc,&sif->setcount) ; /* set count */ in smt_send_sif_config()
1045 len = smt_fill_path(smc,&sif->path); /* set station path descriptor*/ in smt_send_sif_config()
1049 dump_smt(smc,(struct smt_header *)sif,"SIF Configuration Reply") ; in smt_send_sif_config()
1050 smt_send_frame(smc,mb,FC_SMT_INFO,local) ; in smt_send_sif_config()
1057 static void smt_send_sif_operation(struct s_smc *smc, struct fddi_addr *dest, in smt_send_sif_operation() argument
1069 if (smc->s.sas == SMT_SAS) in smt_send_sif_operation()
1073 if (!(mb = smt_build_frame(smc,SMT_SIF_OPER,SMT_REPLY, in smt_send_sif_operation()
1077 smt_fill_timestamp(smc,&sif->ts) ; /* set time stamp */ in smt_send_sif_operation()
1078 smt_fill_mac_status(smc,&sif->status) ; /* set mac status */ in smt_send_sif_operation()
1079 smt_fill_mac_counter(smc,&sif->mc) ; /* set mac counter field */ in smt_send_sif_operation()
1080 smt_fill_mac_fnc(smc,&sif->fnc) ; /* set frame not copied counter */ in smt_send_sif_operation()
1081 smt_fill_manufacturer(smc,&sif->man) ; /* set manufacturer field */ in smt_send_sif_operation()
1082 smt_fill_user(smc,&sif->user) ; /* set user field */ in smt_send_sif_operation()
1083 smt_fill_setcount(smc,&sif->setcount) ; /* set count */ in smt_send_sif_operation()
1088 smt_fill_lem(smc,sif->lem,PS) ; in smt_send_sif_operation()
1092 smt_fill_lem(smc,&sif->lem[i],i) ; in smt_send_sif_operation()
1098 dump_smt(smc,(struct smt_header *)sif,"SIF Operation Reply") ; in smt_send_sif_operation()
1099 smt_send_frame(smc,mb,FC_SMT_INFO,local) ; in smt_send_sif_operation()
1105 SMbuf *smt_build_frame(struct s_smc *smc, int class, int type, in smt_build_frame() argument
1112 if (!smc->r.sm_ma_avail) { in smt_build_frame()
1116 if (!(mb = smt_get_mbuf(smc))) in smt_build_frame()
1135 smt->smt_tid = smt_get_tid(smc) ; /* set transaction ID */ in smt_build_frame()
1155 static void smt_fill_una(struct s_smc *smc, struct smt_p_una *una) in smt_fill_una() argument
1159 una->una_node = smc->mib.m[MAC0].fddiMACUpstreamNbr ; in smt_fill_una()
1165 static void smt_fill_sde(struct s_smc *smc, struct smt_p_sde *sde) in smt_fill_sde() argument
1168 sde->sde_non_master = smc->mib.fddiSMTNonMaster_Ct ; in smt_fill_sde()
1169 sde->sde_master = smc->mib.fddiSMTMaster_Ct ; in smt_fill_sde()
1181 static void smt_fill_state(struct s_smc *smc, struct smt_p_state *state) in smt_fill_state() argument
1191 if (smc->mib.fddiSMTPeerWrapFlag) { in smt_fill_state()
1195 if (cfm_status_unattached(smc)) { in smt_fill_state()
1199 if ((twist = pcm_status_twisted(smc)) & 1) { in smt_fill_state()
1208 if (pcm_rooted_station(smc)) in smt_fill_state()
1210 if (smc->mib.a[0].fddiPATHSbaPayload != 0) in smt_fill_state()
1214 ((smc->mib.m[MAC0].fddiMACDA_Flag ? SMT_ST_MY_DUPA : 0 ) | in smt_fill_state()
1215 (smc->mib.m[MAC0].fddiMACUNDA_Flag ? SMT_ST_UNA_DUPA : 0)) ; in smt_fill_state()
1221 static void smt_fill_timestamp(struct s_smc *smc, struct smt_p_timestamp *ts) in smt_fill_timestamp() argument
1225 smt_set_timestamp(smc,ts->ts_time) ; in smt_fill_timestamp()
1228 void smt_set_timestamp(struct s_smc *smc, u_char *p) in smt_set_timestamp() argument
1247 p[6] = (u_char)(smc->sm.uniq_ticks>>8) ; in smt_set_timestamp()
1248 p[7] = (u_char)smc->sm.uniq_ticks ; in smt_set_timestamp()
1252 if (utime != smc->sm.uniq_time) { in smt_set_timestamp()
1253 smc->sm.uniq_ticks = 0 ; in smt_set_timestamp()
1255 smc->sm.uniq_ticks++ ; in smt_set_timestamp()
1256 smc->sm.uniq_time = utime ; in smt_set_timestamp()
1262 static void smt_fill_policy(struct s_smc *smc, struct smt_p_policy *policy) in smt_fill_policy() argument
1279 in = smc->mib.fddiSMTConnectionPolicy ; in smt_fill_policy()
1286 policy->pl_config = smc->mib.fddiSMTConfigPolicy ; in smt_fill_policy()
1293 static void smt_fill_latency(struct s_smc *smc, struct smt_p_latency *latency) in smt_fill_latency() argument
1297 latency->lt_phyout_idx1 = phy_index(smc,0) ; in smt_fill_latency()
1303 if (smc->s.sas == SMT_DAS) { in smt_fill_latency()
1304 latency->lt_phyout_idx2 = phy_index(smc,1) ; in smt_fill_latency()
1316 static void smt_fill_neighbor(struct s_smc *smc, struct smt_p_neighbor *neighbor) in smt_fill_neighbor() argument
1321 neighbor->nb_mac_index = mac_index(smc,1) ; in smt_fill_neighbor()
1322 neighbor->nb_una = smc->mib.m[MAC0].fddiMACUpstreamNbr ; in smt_fill_neighbor()
1323 neighbor->nb_dna = smc->mib.m[MAC0].fddiMACDownstreamNbr ; in smt_fill_neighbor()
1332 #define ALLPHYS ((smc->s.sas == SMT_SAS) ? 1 : 2)
1335 static int smt_fill_path(struct s_smc *smc, struct smt_p_path *path) in smt_fill_path() argument
1357 if (smc->s.sas == SMT_SAS) in smt_fill_path()
1360 pcm_status_state(smc,physp,&type,&state,&remote,&mac) ; in smt_fill_path()
1370 phy->phy_resource_idx = phy_con_resource_index(smc,p) ; in smt_fill_path()
1375 pd_mac->mac_addr = smc->mib.m[MAC0].fddiMACSMTAddress ; in smt_fill_path()
1376 pd_mac->mac_resource_idx = mac_con_resource_index(smc,1) ; in smt_fill_path()
1383 static void smt_fill_mac_status(struct s_smc *smc, struct smt_p_mac_status *st) in smt_fill_mac_status() argument
1388 st->st_mac_index = mac_index(smc,1) ; in smt_fill_mac_status()
1390 mac_update_counter(smc) ; in smt_fill_mac_status()
1395 st->st_t_req = smc->mib.m[MAC0].fddiMACT_Req ; in smt_fill_mac_status()
1396 st->st_t_neg = smc->mib.m[MAC0].fddiMACT_Neg ; in smt_fill_mac_status()
1397 st->st_t_max = smc->mib.m[MAC0].fddiMACT_Max ; in smt_fill_mac_status()
1398 st->st_tvx_value = smc->mib.m[MAC0].fddiMACTvxValue ; in smt_fill_mac_status()
1399 st->st_t_min = smc->mib.m[MAC0].fddiMACT_Min ; in smt_fill_mac_status()
1401 st->st_sba = smc->mib.a[PATH0].fddiPATHSbaPayload ; in smt_fill_mac_status()
1402 st->st_frame_ct = smc->mib.m[MAC0].fddiMACFrame_Ct ; in smt_fill_mac_status()
1403 st->st_error_ct = smc->mib.m[MAC0].fddiMACError_Ct ; in smt_fill_mac_status()
1404 st->st_lost_ct = smc->mib.m[MAC0].fddiMACLost_Ct ; in smt_fill_mac_status()
1410 static void smt_fill_lem(struct s_smc *smc, struct smt_p_lem *lem, int phy) in smt_fill_lem() argument
1414 mib = smc->y[phy].mib ; in smt_fill_lem()
1418 lem->lem_phy_index = phy_index(smc,phy) ; in smt_fill_lem()
1432 static void smt_fill_version(struct s_smc *smc, struct smt_p_version *vers) in smt_fill_version() argument
1434 SK_UNUSED(smc) ; in smt_fill_version()
1451 static void smt_fill_fsc(struct s_smc *smc, struct smt_p_fsc *fsc) in smt_fill_fsc() argument
1453 SK_UNUSED(smc) ; in smt_fill_fsc()
1471 static void smt_fill_mac_counter(struct s_smc *smc, struct smt_p_mac_counter *mc) in smt_fill_mac_counter() argument
1475 mc->mc_index = mac_index(smc,1) ; in smt_fill_mac_counter()
1476 mc->mc_receive_ct = smc->mib.m[MAC0].fddiMACCopied_Ct ; in smt_fill_mac_counter()
1477 mc->mc_transmit_ct = smc->mib.m[MAC0].fddiMACTransmit_Ct ; in smt_fill_mac_counter()
1483 static void smt_fill_mac_fnc(struct s_smc *smc, struct smt_p_mac_fnc *fnc) in smt_fill_mac_fnc() argument
1487 fnc->nc_index = mac_index(smc,1) ; in smt_fill_mac_fnc()
1488 fnc->nc_counter = smc->mib.m[MAC0].fddiMACNotCopied_Ct ; in smt_fill_mac_fnc()
1495 static void smt_fill_manufacturer(struct s_smc *smc, in smt_fill_manufacturer() argument
1500 (char *) smc->mib.fddiSMTManufacturerData, in smt_fill_manufacturer()
1507 static void smt_fill_user(struct s_smc *smc, struct smp_p_user *user) in smt_fill_user() argument
1511 (char *) smc->mib.fddiSMTUserData, in smt_fill_user()
1518 static void smt_fill_setcount(struct s_smc *smc, struct smt_p_setcount *setcount) in smt_fill_setcount() argument
1520 SK_UNUSED(smc) ; in smt_fill_setcount()
1522 setcount->count = smc->mib.fddiSMTSetCount.count ; in smt_fill_setcount()
1524 (char *)smc->mib.fddiSMTSetCount.timestamp,8) ; in smt_fill_setcount()
1530 static void smt_fill_echo(struct s_smc *smc, struct smt_p_echo *echo, u_long seed, in smt_fill_echo() argument
1535 SK_UNUSED(smc) ; in smt_fill_echo()
1548 static void smt_clear_una_dna(struct s_smc *smc) in smt_clear_una_dna() argument
1550 smc->mib.m[MAC0].fddiMACUpstreamNbr = SMT_Unknown ; in smt_clear_una_dna()
1551 smc->mib.m[MAC0].fddiMACDownstreamNbr = SMT_Unknown ; in smt_clear_una_dna()
1554 static void smt_clear_old_una_dna(struct s_smc *smc) in smt_clear_old_una_dna() argument
1556 smc->mib.m[MAC0].fddiMACOldUpstreamNbr = SMT_Unknown ; in smt_clear_old_una_dna()
1557 smc->mib.m[MAC0].fddiMACOldDownstreamNbr = SMT_Unknown ; in smt_clear_old_una_dna()
1560 u_long smt_get_tid(struct s_smc *smc) in smt_get_tid() argument
1563 while ((tid = ++(smc->sm.smt_tid) ^ SMT_TID_MAGIC) == 0) in smt_get_tid()
1649 int smt_check_para(struct s_smc *smc, struct smt_header *sm, in smt_check_para() argument
1654 if (!sm_to_para(smc,sm,(int) *p)) { in smt_check_para()
1663 void *sm_to_para(struct s_smc *smc, struct smt_header *sm, int para) in sm_to_para() argument
1670 SK_UNUSED(smc) ; in sm_to_para()
1698 void fddi_send_antc(struct s_smc *smc, struct fddi_addr *dest)
1700 SK_UNUSED(smc) ;
1716 smt->smt_source = smc->mib.m[MAC0].fddiMACSMTAddress ;
1717 smt_send_mbuf(smc,mb,FC_ASYNC_LLC) ;
1741 static int mac_index(struct s_smc *smc, int mac) in mac_index() argument
1745 SK_UNUSED(smc) ; in mac_index()
1748 return (smc->s.sas == SMT_SAS) ? 2 : 3; in mac_index()
1755 static int phy_index(struct s_smc *smc, int phy) in phy_index() argument
1757 SK_UNUSED(smc) ; in phy_index()
1764 static int mac_con_resource_index(struct s_smc *smc, int mac) in mac_con_resource_index() argument
1767 SK_UNUSED(smc) ; in mac_con_resource_index()
1769 return entity_to_index(smc, cem_get_downstream(smc, ENTITY_MAC)); in mac_con_resource_index()
1772 switch (smc->mib.fddiSMTCF_State) { in mac_con_resource_index()
1781 return smc->s.sas == SMT_SAS ? 2 : 3; in mac_con_resource_index()
1788 static int phy_con_resource_index(struct s_smc *smc, int phy) in phy_con_resource_index() argument
1791 return entity_to_index(smc, cem_get_downstream(smc, ENTITY_PHY(phy))) ; in phy_con_resource_index()
1793 switch (smc->mib.fddiSMTCF_State) { in phy_con_resource_index()
1810 static int entity_to_index(struct s_smc *smc, int e) in entity_to_index() argument
1813 return mac_index(smc, 1); in entity_to_index()
1815 return phy_index(smc, e - ENTITY_PHY(0)); in entity_to_index()
1935 int smt_action(struct s_smc *smc, int class, int code, int index) in smt_action() argument
1944 smc->mib.fddiSMTRemoteDisconnectFlag = FALSE ; in smt_action()
1945 queue_event(smc,EVENT_ECM,EC_CONNECT) ; in smt_action()
1948 queue_event(smc,EVENT_ECM,EC_DISCONNECT) ; in smt_action()
1949 smc->mib.fddiSMTRemoteDisconnectFlag = TRUE ; in smt_action()
1950 RS_SET(smc,RS_DISCONNECT) ; in smt_action()
1951 AIX_EVENT(smc, (u_long) FDDI_RING_STATUS, (u_long) in smt_action()
1953 smt_get_event_word(smc)); in smt_action()
1956 AIX_EVENT(smc, (u_long) FDDI_RING_STATUS, (u_long) in smt_action()
1958 smt_get_event_word(smc)); in smt_action()
1961 AIX_EVENT(smc, (u_long) FDDI_RING_STATUS, (u_long) in smt_action()
1963 smt_get_event_word(smc)); in smt_action()
1966 if (smc->y[PA].pc_mode == PM_PEER) { in smt_action()
1967 RS_SET(smc,RS_EVENT) ; in smt_action()
1968 queue_event(smc,EVENT_PCM+PA,PC_DISABLE) ; in smt_action()
1972 if (smc->y[PB].pc_mode == PM_PEER) { in smt_action()
1973 RS_SET(smc,RS_EVENT) ; in smt_action()
1974 queue_event(smc,EVENT_PCM+PB,PC_DISABLE) ; in smt_action()
1979 if (smc->mib.p[port].fddiPORTMy_Type != TM) in smt_action()
1981 RS_SET(smc,RS_EVENT) ; in smt_action()
1982 queue_event(smc,EVENT_PCM+port,PC_DISABLE) ; in smt_action()
2009 queue_event(smc,EVENT_PCM+index,event) ; in smt_action()
2021 static void hwm_conv_can(struct s_smc *smc, char *data, int len) in hwm_conv_can() argument
2025 SK_UNUSED(smc) ; in hwm_conv_can()