1 /******************************************************************************
3 * (C)Copyright 1998,1999 SysKonnect,
4 * a business unit of Schneider & Koch & Co. Datensysteme GmbH.
6 * See the file "skfddi.c" for further information.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * The information in this file is provided "AS IS" without warranty.
15 ******************************************************************************/
18 IBM FDDI read error log function
24 #include "h/lnkstat.h"
27 static const char ID_sccs[] = "@(#)lnkstat.c 1.8 97/04/11 (C) SK " ;
34 #define EL_IS_OK(x,l) ((((int)&(((struct s_error_log *)0)->x)) + \
38 BEGIN_MANUAL_ENTRY(if,func;others;11)
40 u_long smt_get_error_word(smc)
43 Function DOWNCALL (SMT, lnkstat.c)
44 This functions returns the SMT error work for AIX events.
46 Return smt_error_word These bits are supported:
48 SMT_ERL_ALC == [PS/PA].fddiPORTLerFlag
49 SMT_ERL_BLC == [PB].fddiPORTLerFlag
50 SMT_ERL_NCC == fddiMACNotCopiedFlag
51 SMT_ERL_FEC == fddiMACFrameErrorFlag
55 u_long smt_get_error_word(smc)
64 if (smc->s.sas == SMT_SAS) {
65 if (smc->mib.p[PS].fddiPORTLerFlag)
69 if (smc->mib.p[PA].fddiPORTLerFlag)
71 if (smc->mib.p[PB].fddiPORTLerFlag)
74 if (smc->mib.m[MAC0].fddiMACNotCopiedFlag)
75 st |= SMT_ERL_NCC ; /* not copied condition */
76 if (smc->mib.m[MAC0].fddiMACFrameErrorFlag)
77 st |= SMT_ERL_FEC ; /* frame error condition */
83 BEGIN_MANUAL_ENTRY(if,func;others;11)
85 u_long smt_get_event_word(smc)
88 Function DOWNCALL (SMT, lnkstat.c)
89 This functions returns the SMT event work for AIX events.
91 Return smt_event_word always 0
95 u_long smt_get_event_word(smc)
102 BEGIN_MANUAL_ENTRY(if,func;others;11)
104 u_long smt_get_port_event_word(smc)
107 Function DOWNCALL (SMT, lnkstat.c)
108 This functions returns the SMT port event work for AIX events.
110 Return smt_port_event_word always 0
114 u_long smt_get_port_event_word(smc)
121 BEGIN_MANUAL_ENTRY(if,func;others;11)
123 u_long smt_read_errorlog(smc,p,len)
128 Function DOWNCALL (SMT, lnkstat.c)
129 This functions returns the SMT error log field for AIX events.
131 Para p pointer to the error log field
132 len len of the error log field
134 Return len used len of the error log field
138 int smt_read_errorlog(smc,p,len)
145 struct s_error_log _far *er ;
147 er = (struct s_error_log _far *) p ;
148 if (len > sizeof(struct s_error_log))
149 len = sizeof(struct s_error_log) ;
150 for (i = 0 ; i < len ; i++)
155 if (EL_IS_OK(set_count_high,len)) {
156 er->set_count_low = (u_short)smc->mib.fddiSMTSetCount.count ;
158 (u_short)(smc->mib.fddiSMTSetCount.count >> 16L) ;
163 if (EL_IS_OK(aci_id_code,len)) {
164 er->aci_id_code = 0 ;
167 * purge counter is missed frames; 16 bits only
169 if (EL_IS_OK(purge_frame_counter,len)) {
170 if (smc->mib.m[MAC0].fddiMACCopied_Ct > 0xffff)
171 er->purge_frame_counter = 0xffff ;
173 er->purge_frame_counter =
174 (u_short)smc->mib.m[MAC0].fddiMACCopied_Ct ;
177 * CMT and RMT state machines
179 if (EL_IS_OK(ecm_state,len))
180 er->ecm_state = smc->mib.fddiSMTECMState ;
182 if (EL_IS_OK(pcm_b_state,len)) {
183 if (smc->s.sas == SMT_SAS) {
184 er->pcm_a_state = smc->y[PS].mib->fddiPORTPCMState ;
185 er->pcm_b_state = 0 ;
188 er->pcm_a_state = smc->y[PA].mib->fddiPORTPCMState ;
189 er->pcm_b_state = smc->y[PB].mib->fddiPORTPCMState ;
192 if (EL_IS_OK(cfm_state,len))
193 er->cfm_state = smc->mib.fddiSMTCF_State ;
194 if (EL_IS_OK(rmt_state,len))
195 er->rmt_state = smc->mib.m[MAC0].fddiMACRMTState ;
198 * smt error word low (we only need the low order 16 bits.)
201 st = smt_get_error_word(smc) & 0xffff ;
203 if (EL_IS_OK(smt_error_low,len))
204 er->smt_error_low = st ;
206 if (EL_IS_OK(ucode_version_level,len))
207 er->ucode_version_level = 0x0101 ;