Lines Matching +full:m +full:- +full:phy

1 // SPDX-License-Identifier: GPL-2.0-or-later
26 #define m_fc(mb) ((mb)->sm_data[0])
55 static int phy_index(struct s_smc *smc, int phy);
57 static int phy_con_resource_index(struct s_smc *smc, int phy);
82 static void smt_fill_lem(struct s_smc *smc, struct smt_p_lem *lem, int phy);
111 return(*(short *)(&addr->a[0]) == in is_my_addr()
112 *(short *)(&smc->mib.m[MAC0].fddiMACSMTAddress.a[0]) in is_my_addr()
113 && *(short *)(&addr->a[2]) == in is_my_addr()
114 *(short *)(&smc->mib.m[MAC0].fddiMACSMTAddress.a[2]) in is_my_addr()
115 && *(short *)(&addr->a[4]) == in is_my_addr()
116 *(short *)(&smc->mib.m[MAC0].fddiMACSMTAddress.a[4])) ; in is_my_addr()
121 return *(u_short *)(&addr->a[0]) == 0xffff && in is_broadcast()
122 *(u_short *)(&addr->a[2]) == 0xffff && in is_broadcast()
123 *(u_short *)(&addr->a[4]) == 0xffff; in is_broadcast()
128 return !(addr->a[0] & GROUP_ADDR); in is_individual()
134 return *(u_short *)(&addr1->a[0]) == *(u_short *)(&addr2->a[0]) && in is_equal()
135 *(u_short *)(&addr1->a[2]) == *(u_short *)(&addr2->a[2]) && in is_equal()
136 *(u_short *)(&addr1->a[4]) == *(u_short *)(&addr2->a[4]); in is_equal()
154 smc->mib.m[MAC0].fddiMACSMTAddress = smc->hw.fddi_home_addr ; in smt_agent_init()
157 * get OUI address from driver (bia == built-in-address) 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()
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()
195 smt_timer_start(smc,&smc->sm.smt_timer, (u_long)1000000L, in smt_agent_task()
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()
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()
271 if (time - smc->sm.smt_last_lem >= TICKS_PER_SECOND*8) { in smt_event()
281 struct s_phy *phy ; in smt_event() local
286 smc->sm.smt_last_lem = time ; in smt_event()
293 mib = smc->mib.m ; in smt_event()
295 (mib->fddiMACLost_Ct - mib->fddiMACOld_Lost_Ct) + in smt_event()
296 (mib->fddiMACError_Ct - mib->fddiMACOld_Error_Ct) ; in smt_event()
298 (mib->fddiMACFrame_Ct - mib->fddiMACOld_Frame_Ct) + in smt_event()
299 (mib->fddiMACLost_Ct - mib->fddiMACOld_Lost_Ct) ; in smt_event()
300 mib->fddiMACFrameErrorRatio = div_ratio(upper,lower) ; in smt_event()
303 ((!mib->fddiMACFrameErrorThreshold && in smt_event()
304 mib->fddiMACError_Ct != mib->fddiMACOld_Error_Ct) || in smt_event()
305 (mib->fddiMACFrameErrorRatio > in smt_event()
306 mib->fddiMACFrameErrorThreshold)) ; in smt_event()
308 if (cond != mib->fddiMACFrameErrorFlag) in smt_event()
313 (mib->fddiMACNotCopied_Ct - mib->fddiMACOld_NotCopied_Ct) ; in smt_event()
316 (mib->fddiMACCopied_Ct - mib->fddiMACOld_Copied_Ct) ; in smt_event()
317 mib->fddiMACNotCopiedRatio = div_ratio(upper,lower) ; in smt_event()
320 ((!mib->fddiMACNotCopiedThreshold && in smt_event()
321 mib->fddiMACNotCopied_Ct != in smt_event()
322 mib->fddiMACOld_NotCopied_Ct)|| in smt_event()
323 (mib->fddiMACNotCopiedRatio > in smt_event()
324 mib->fddiMACNotCopiedThreshold)) ; in smt_event()
326 if (cond != mib->fddiMACNotCopiedFlag) in smt_event()
333 mib->fddiMACOld_Frame_Ct = mib->fddiMACFrame_Ct ; in smt_event()
334 mib->fddiMACOld_Copied_Ct = mib->fddiMACCopied_Ct ; in smt_event()
335 mib->fddiMACOld_Error_Ct = mib->fddiMACError_Ct ; in smt_event()
336 mib->fddiMACOld_Lost_Ct = mib->fddiMACLost_Ct ; in smt_event()
337 mib->fddiMACOld_NotCopied_Ct = mib->fddiMACNotCopied_Ct ; in smt_event()
343 phy = &smc->y[port] ; in smt_event()
345 if (!phy->mib->fddiPORTHardwarePresent) { in smt_event()
349 cond = (phy->mib->fddiPORTEBError_Ct - in smt_event()
350 phy->mib->fddiPORTOldEBError_Ct > 5) ; in smt_event()
356 (int) (INDEX_PORT+ phy->np) ,cond) ; in smt_event()
361 phy->mib->fddiPORTOldEBError_Ct = in smt_event()
362 phy->mib->fddiPORTEBError_Ct ; 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()
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()
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()
434 if (time - smc->sm.last_tok_time[i] > 2*TICKS_PER_SECOND ){ in smt_event()
440 smt_timer_start(smc,&smc->sm.smt_timer, (u_long)1000000L, in smt_event()
479 smc->mib.m[MAC0].fddiMACSMTCopied_Ct++ ; in smt_received_pack()
485 if (is_individual(&sm->smt_dest) && !is_my_addr(smc,&sm->smt_dest)) { in smt_received_pack()
491 if (is_my_addr(smc,&sm->smt_source) && !local) { in smt_received_pack()
497 smt_swap_para(sm,(int) mb->sm_len,1) ; in smt_received_pack()
501 sm->smt_version, in smt_received_pack()
502 smt_class_name[sm->smt_class > LAST_CLASS ? 0 : sm->smt_class]); in smt_received_pack()
508 if (m_fc(mb) == FC_SMT_NSA && sm->smt_class == SMT_NIF && in smt_received_pack()
509 (sm->smt_type == SMT_ANNOUNCE || sm->smt_type == SMT_REQUEST)) { in smt_received_pack()
510 smc->sba.sm = sm ; in smt_received_pack()
516 * ignore any packet with NSA and A-indicator set in smt_received_pack()
519 DB_SMT("SMT : ignoring NSA with A-indicator set from %pM", in smt_received_pack()
520 &sm->smt_source); in smt_received_pack()
528 if (((sm->smt_class == SMT_ECF) && (sm->smt_len > SMT_MAX_ECHO_LEN)) || in smt_received_pack()
529 ((sm->smt_class != SMT_ECF) && (sm->smt_len > SMT_MAX_INFO_LEN))) { in smt_received_pack()
537 switch (sm->smt_class) { in smt_received_pack()
542 if (sm->smt_version != SMT_VID) in smt_received_pack()
546 if (sm->smt_version != SMT_VID_2) in smt_received_pack()
552 sm->smt_version, &sm->smt_source); in smt_received_pack()
557 if ((sm->smt_len > mb->sm_len - sizeof(struct smt_header)) || in smt_received_pack()
558 ((sm->smt_len & 3) && (sm->smt_class != SMT_ECF))) { in smt_received_pack()
559 DB_SMT("SMT: info length error, len = %d", sm->smt_len); in smt_received_pack()
564 switch (sm->smt_class) { in smt_received_pack()
570 switch (sm->smt_type) { in smt_received_pack()
574 && is_broadcast(&sm->smt_dest)) { in smt_received_pack()
579 &smc->mib.m[MAC0].fddiMACUpstreamNbr, in smt_received_pack()
580 &sm->smt_source)) { in smt_received_pack()
582 &sm->smt_source); 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()
591 sm->smt_source ; in smt_received_pack()
597 smc->sm.smt_tvu = smt_get_time() ; in smt_received_pack()
601 smc->mib.m[MAC0].fddiMACUNDA_Flag = in smt_received_pack()
602 (st->st_dupl_addr & SMT_ST_MY_DUPA) ? in smt_received_pack()
607 if ((sm->smt_type == SMT_REQUEST) && in smt_received_pack()
608 is_individual(&sm->smt_source) && in smt_received_pack()
612 &sm->smt_source); in smt_received_pack()
613 smt_send_nif(smc,&sm->smt_source, in smt_received_pack()
615 sm->smt_tid, in smt_received_pack()
621 &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()
629 smc->mib.m[MAC0].fddiMACDA_Flag = TRUE ; 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()
638 &sm->smt_source)) { 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()
648 sm->smt_source ; in smt_received_pack()
654 smc->mib.m[MAC0].fddiMACDA_Flag = FALSE ; 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()
664 else if (sm->smt_tid == 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()
679 if (sm->smt_type != SMT_REQUEST) in smt_received_pack()
682 &sm->smt_source); in smt_received_pack()
683 smt_send_sif_config(smc,&sm->smt_source,sm->smt_tid,local) ; in smt_received_pack()
686 if (sm->smt_type != SMT_REQUEST) in smt_received_pack()
689 &sm->smt_source); in smt_received_pack()
690 smt_send_sif_operation(smc,&sm->smt_source,sm->smt_tid,local) ; in smt_received_pack()
693 switch (sm->smt_type) { in smt_received_pack()
695 smc->mib.priv.fddiPRIVECF_Reply_Rx++ ; in smt_received_pack()
697 &sm->smt_source); 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()
714 sm->smt_tid); 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()
726 DB_SMT("SMT - sending ECF reply to %pM", in smt_received_pack()
727 &sm->smt_source); in smt_received_pack()
730 sm->smt_dest = sm->smt_source ; in smt_received_pack()
731 sm->smt_type = SMT_REPLY ; in smt_received_pack()
733 smc->mib.priv.fddiPRIVECF_Reply_Tx++ ; in smt_received_pack()
755 smc->mib.priv.fddiPRIVRDF_Rx++ ; in smt_received_pack()
757 case SMT_ESF : /* extended service - not supported */ in smt_received_pack()
758 if (sm->smt_type == SMT_REQUEST) { in smt_received_pack()
759 DB_SMT("SMT - received ESF, sending RDF"); in smt_received_pack()
765 if (sm->smt_type != SMT_REQUEST) in smt_received_pack()
768 if (sm->smt_class == SMT_PMF_GET) 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()
775 if ((sm->smt_class == SMT_PMF_SET) && in smt_received_pack()
776 !is_individual(&sm->smt_dest)) { in smt_received_pack()
777 DB_SMT("SMT: ignoring PMF-SET with I/G set"); in smt_received_pack()
786 if (sm->smt_type != SMT_REQUEST) in smt_received_pack()
794 sm->smt_class, &sm->smt_source); in smt_received_pack()
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()
815 smc->mib.m[MAC0].fddiMACDuplicateAddressCond = cond ; in update_dac()
830 if (!smc->r.sm_ma_avail && !local) { 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()
838 smt_swap_para(sm,(int) mb->sm_len,0) ; /* swap para & header */ in smt_send_frame()
840 smc->mib.m[MAC0].fddiMACSMTTransmit_Ct++ ; in smt_send_frame()
860 if (sm->smt_type != SMT_REQUEST) in smt_send_rdf()
864 &sm->smt_source, reason); in smt_send_rdf()
871 frame_len = rej->sm_len ; in smt_send_rdf()
876 rdf->smt.smt_tid = sm->smt_tid ; /* use TID from sm */ in smt_send_rdf()
877 rdf->smt.smt_dest = sm->smt_source ; /* set dest = source */ in smt_send_rdf()
880 rdf->reason.para.p_type = SMT_P_REASON ; in smt_send_rdf()
881 rdf->reason.para.p_len = sizeof(struct smt_p_reason) - PARA_LEN ; in smt_send_rdf()
882 rdf->reason.rdf_reason = reason ; in smt_send_rdf()
885 rdf->version.para.p_type = SMT_P_VERSION ; in smt_send_rdf()
886 rdf->version.para.p_len = sizeof(struct smt_p_version) - PARA_LEN ; in smt_send_rdf()
887 rdf->version.v_pad = 0 ; in smt_send_rdf()
888 rdf->version.v_n = 1 ; in smt_send_rdf()
889 rdf->version.v_index = 1 ; in smt_send_rdf()
890 rdf->version.v_version[0] = SMT_VID_2 ; in smt_send_rdf()
891 rdf->version.v_pad2 = 0 ; in smt_send_rdf()
894 if ((unsigned int) frame_len <= SMT_MAX_INFO_LEN - sizeof(*rdf) + in smt_send_rdf()
898 len = SMT_MAX_INFO_LEN - sizeof(*rdf) + in smt_send_rdf()
902 rdf->refused.para.p_type = SMT_P_REFUSED ; in smt_send_rdf()
904 rdf->refused.para.p_len = len + 4 ; in smt_send_rdf()
905 rdf->refused.ref_fc = fc ; in smt_send_rdf()
910 memcpy((char *) &rdf->refused.ref_header,(char *) sm,len) ; in smt_send_rdf()
912 len -= sizeof(struct smt_header) ; in smt_send_rdf()
913 mb->sm_len += len ; in smt_send_rdf()
914 rdf->smt.smt_len += len ; in smt_send_rdf()
917 smc->mib.priv.fddiPRIVRDF_Tx++ ; in smt_send_rdf()
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()
943 nif->smt.smt_dest = *dest ; /* destination address */ in smt_send_nif()
944 nif->smt.smt_tid = tid ; /* transaction ID */ in smt_send_nif()
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()
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()
979 smc->sm.pend[dna ? SMT_TID_ECF_DNA : SMT_TID_ECF_UNA] = in smt_echo_test()
982 &smc->mib.m[MAC0].fddiMACDownstreamNbr : in smt_echo_test()
983 &smc->mib.m[MAC0].fddiMACUpstreamNbr, in smt_echo_test()
984 FC_SMT_INFO,tid, SMT_REQUEST, (SMT_TEST_ECHO_LEN & ~3)-8) ; in smt_echo_test()
1005 smt_fill_echo(smc,&ecf->ec_echo,tid,len) ; /* set ECHO */ in smt_send_ecf()
1006 ecf->smt.smt_dest = *dest ; /* destination address */ in smt_send_ecf()
1007 ecf->smt.smt_tid = tid ; /* transaction ID */ in smt_send_ecf()
1008 smc->mib.priv.fddiPRIVECF_Req_Tx++ ; in smt_send_ecf()
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()
1038 sif->smt.smt_dest = *dest ; /* destination address */ in smt_send_sif_config()
1039 sif->smt.smt_tid = tid ; /* transaction ID */ in smt_send_sif_config()
1061 if (smc->s.sas == SMT_SAS) 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()
1088 sif->smt.smt_dest = *dest ; /* destination address */ in smt_send_sif_operation()
1089 sif->smt.smt_tid = tid ; /* transaction ID */ in smt_send_sif_operation()
1104 if (!smc->r.sm_ma_avail) { in smt_build_frame()
1111 mb->sm_len = length ; in smt_build_frame()
1113 smt->smt_dest = fddi_broadcast ; /* set dest = broadcast */ in smt_build_frame()
1114 smt->smt_class = class ; in smt_build_frame()
1115 smt->smt_type = type ; in smt_build_frame()
1121 smt->smt_version = SMT_VID ; in smt_build_frame()
1124 smt->smt_version = SMT_VID_2 ; in smt_build_frame()
1127 smt->smt_tid = smt_get_tid(smc) ; /* set transaction ID */ in smt_build_frame()
1128 smt->smt_pad = 0 ; in smt_build_frame()
1129 smt->smt_len = length - sizeof(struct smt_header) ; in smt_build_frame()
1138 smt->smt_len += len ; in smt_add_frame_len()
1139 mb->sm_len += len ; in smt_add_frame_len()
1150 una->una_pad = 0 ; in smt_fill_una()
1151 una->una_node = smc->mib.m[MAC0].fddiMACUpstreamNbr ; in smt_fill_una()
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()
1162 sde->sde_mac_count = NUMMACS ; /* only 1 MAC */ in smt_fill_sde()
1164 sde->sde_type = SMT_SDE_CONCENTRATOR ; in smt_fill_sde()
1166 sde->sde_type = SMT_SDE_STATION ; in smt_fill_sde()
1179 state->st_pad = 0 ; in smt_fill_state()
1183 if (smc->mib.fddiSMTPeerWrapFlag) { in smt_fill_state()
1202 if (smc->mib.a[0].fddiPATHSbaPayload != 0) in smt_fill_state()
1204 state->st_topology = top ; in smt_fill_state()
1205 state->st_dupl_addr = 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()
1217 smt_set_timestamp(smc,ts->ts_time) ; in smt_fill_timestamp()
1234 p[1] = (u_char)((time>>(8+8+8+8-1)) & 1) ; in smt_set_timestamp()
1235 p[2] = (u_char)(time>>(8+8+8-1)) ; in smt_set_timestamp()
1236 p[3] = (u_char)(time>>(8+8-1)) ; in smt_set_timestamp()
1237 p[4] = (u_char)(time>>(8-1)) ; in smt_set_timestamp()
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()
1271 in = smc->mib.fddiSMTConnectionPolicy ; in smt_fill_policy()
1278 policy->pl_config = smc->mib.fddiSMTConfigPolicy ; in smt_fill_policy()
1279 policy->pl_connect = out ; in smt_fill_policy()
1289 latency->lt_phyout_idx1 = phy_index(smc,0) ; in smt_fill_latency()
1290 latency->lt_latency1 = 10 ; /* in octets (byte clock) */ in smt_fill_latency()
1292 * note: latency has two phy entries by definition 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()
1297 latency->lt_latency2 = 10 ; /* in octets (byte clock) */ in smt_fill_latency()
1300 latency->lt_phyout_idx2 = 0 ; in smt_fill_latency()
1301 latency->lt_latency2 = 0 ; in smt_fill_latency()
1312 neighbor->nb_mib_index = INDEX_MAC ; in smt_fill_neighbor()
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)
1336 struct smt_phy_rec *phy ; in smt_fill_path() local
1342 path->para.p_type = SMT_P_PATH ; in smt_fill_path()
1343 path->para.p_len = len - PARA_LEN ; in smt_fill_path()
1346 for (p = 0,phy = path->pd_phy ; p < ALLPHYS ; p++, phy++) { in smt_fill_path()
1349 if (smc->s.sas == SMT_SAS) in smt_fill_path()
1354 phy->phy_mib_index = smt_swap_short((u_short)p+INDEX_PORT) ; in smt_fill_path()
1356 phy->phy_mib_index = p+INDEX_PORT ; in smt_fill_path()
1358 phy->phy_type = type ; in smt_fill_path()
1359 phy->phy_connect_state = state ; in smt_fill_path()
1360 phy->phy_remote_type = remote ; in smt_fill_path()
1361 phy->phy_remote_mac = mac ; in smt_fill_path()
1362 phy->phy_resource_idx = phy_con_resource_index(smc,p) ; in smt_fill_path()
1366 pd_mac = (struct smt_mac_rec *) phy ; 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()
1379 st->st_mib_index = INDEX_MAC ; in smt_fill_mac_status()
1380 st->st_mac_index = mac_index(smc,1) ; 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()
1409 lem->lem_mib_index = phy+INDEX_PORT ; in smt_fill_lem()
1410 lem->lem_phy_index = phy_index(smc,phy) ; in smt_fill_lem()
1411 lem->lem_pad2 = 0 ; in smt_fill_lem()
1412 lem->lem_cutoff = mib->fddiPORTLer_Cutoff ; in smt_fill_lem()
1413 lem->lem_alarm = mib->fddiPORTLer_Alarm ; in smt_fill_lem()
1415 lem->lem_estimate = mib->fddiPORTLer_Estimate ; in smt_fill_lem()
1417 lem->lem_reject_ct = mib->fddiPORTLem_Reject_Ct ; in smt_fill_lem()
1418 lem->lem_ct = mib->fddiPORTLem_Ct ; /* total number of errors */ in smt_fill_lem()
1428 vers->v_pad = 0 ; in smt_fill_version()
1429 vers->v_n = 1 ; /* one version is enough .. */ in smt_fill_version()
1430 vers->v_index = 1 ; in smt_fill_version()
1431 vers->v_version[0] = SMT_VID_2 ; in smt_fill_version()
1432 vers->v_pad2 = 0 ; in smt_fill_version()
1447 fsc->fsc_pad0 = 0 ; in smt_fill_fsc()
1448 fsc->fsc_mac_index = INDEX_MAC ; /* this is MIB ; MIB is NOT in smt_fill_fsc()
1451 fsc->fsc_pad1 = 0 ; in smt_fill_fsc()
1452 fsc->fsc_value = FSC_TYPE0 ; /* "normal" node */ in smt_fill_fsc()
1454 fsc->fsc_mac_index = smt_swap_short(INDEX_MAC) ; in smt_fill_fsc()
1455 fsc->fsc_value = smt_swap_short(FSC_TYPE0) ; in smt_fill_fsc()
1466 mc->mc_mib_index = INDEX_MAC ; in smt_fill_mac_counter()
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()
1478 fnc->nc_mib_index = INDEX_MAC ; in smt_fill_mac_fnc()
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()
1491 memcpy((char *) man->mf_data, in smt_fill_manufacturer()
1492 (char *) smc->mib.fddiSMTManufacturerData, in smt_fill_manufacturer()
1493 sizeof(man->mf_data)) ; in smt_fill_manufacturer()
1502 memcpy((char *) user->us_data, in smt_fill_user()
1503 (char *) smc->mib.fddiSMTUserData, in smt_fill_user()
1504 sizeof(user->us_data)) ; in smt_fill_user()
1514 setcount->count = smc->mib.fddiSMTSetCount.count ; in smt_fill_setcount()
1515 memcpy((char *)setcount->timestamp, in smt_fill_setcount()
1516 (char *)smc->mib.fddiSMTSetCount.timestamp,8) ; in smt_fill_setcount()
1529 echo->para.p_len = len ; in smt_fill_echo()
1530 for (p = echo->ec_data ; len ; len--) { in smt_fill_echo()
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()
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()
1555 while ((tid = ++(smc->sm.smt_tid) ^ SMT_TID_MAGIC) == 0) in smt_get_tid()
1648 DB_SMT("SMT: smt_check_para - missing para %hx", *p); in smt_check_para()
1649 return -1; in smt_check_para()
1665 len = sm->smt_len ; in sm_to_para()
1668 if (((struct smt_para *)p)->p_type == para) in sm_to_para()
1670 plen = ((struct smt_para *)p)->p_len + PARA_LEN ; in sm_to_para()
1672 len -= plen ; in sm_to_para()
1674 DB_SMT("SMT : sm_to_para - length error %d", plen); in sm_to_para()
1678 DB_SMT("SMT : sm_to_para - odd length %d", plen); in sm_to_para()
1702 mb->sm_len = 3000+12 ;
1708 smt->smt_dest = *dest ;
1709 smt->smt_source = smc->mib.m[MAC0].fddiMACSMTAddress ;
1725 return (smc->s.sas == SMT_SAS) ? 2 : 3; in mac_index()
1730 * return static phy index
1732 static int phy_index(struct s_smc *smc, int phy) in phy_index() argument
1735 return phy + 1; in phy_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()
1763 * return dynamic phy connection 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()
1772 return phy == PA ? 3 : 2; in phy_con_resource_index()
1774 return phy == PA ? 1 : 3; in phy_con_resource_index()
1776 return phy == PA ? 3 : 1; in phy_con_resource_index()
1778 return phy == PA ? 2 : 3; in phy_con_resource_index()
1782 return phy; in phy_con_resource_index()
1792 return phy_index(smc, e - ENTITY_PHY(0)); in entity_to_index()
1818 len -= sizeof(struct smt_header) ; in smt_swap_para()
1823 plen = pa->p_len ; in smt_swap_para()
1824 type = pa->p_type ; in smt_swap_para()
1825 pa->p_type = smt_swap_short(pa->p_type) ; in smt_swap_para()
1826 pa->p_len = smt_swap_short(pa->p_len) ; in smt_swap_para()
1828 plen = pa->p_len ; in smt_swap_para()
1829 type = pa->p_type ; in smt_swap_para()
1837 for (i = N_SMT_PLEN, pd = smt_pdef; i ; i--,pd++) { in smt_swap_para()
1838 if (pd->ptype == type) in smt_swap_para()
1841 if (i && pd->pswap) { in smt_swap_para()
1842 smt_string_swap(p+PARA_LEN,pd->pswap,len) ; in smt_swap_para()
1844 len -= plen ; in smt_swap_para()
1871 data += *format - '0' ; in smt_string_swap()
1872 len -= *format - '0' ; in smt_string_swap()
1876 len-- ; in smt_string_swap()
1881 len -= 2 ; in smt_string_swap()
1887 len -= 4 ; in smt_string_swap()
1915 smc->mib.fddiSMTRemoteDisconnectFlag = FALSE ; in smt_action()
1920 smc->mib.fddiSMTRemoteDisconnectFlag = TRUE ; in smt_action()
1937 if (smc->y[PA].pc_mode == PM_PEER) { in smt_action()
1943 if (smc->y[PB].pc_mode == PM_PEER) { in smt_action()
1950 if (smc->mib.p[port].fddiPORTMy_Type != TM) in smt_action()
1998 for (i = len; i ; i--, data++) in hwm_conv_can()