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(struct s_smc
*smc
)
63 if (smc
->s
.sas
== SMT_SAS
) {
64 if (smc
->mib
.p
[PS
].fddiPORTLerFlag
)
68 if (smc
->mib
.p
[PA
].fddiPORTLerFlag
)
70 if (smc
->mib
.p
[PB
].fddiPORTLerFlag
)
73 if (smc
->mib
.m
[MAC0
].fddiMACNotCopiedFlag
)
74 st
|= SMT_ERL_NCC
; /* not copied condition */
75 if (smc
->mib
.m
[MAC0
].fddiMACFrameErrorFlag
)
76 st
|= SMT_ERL_FEC
; /* frame error condition */
82 BEGIN_MANUAL_ENTRY(if,func;others;11)
84 u_long smt_get_event_word(smc)
87 Function DOWNCALL (SMT, lnkstat.c)
88 This functions returns the SMT event work for AIX events.
90 Return smt_event_word always 0
94 u_long
smt_get_event_word(struct s_smc
*smc
)
100 BEGIN_MANUAL_ENTRY(if,func;others;11)
102 u_long smt_get_port_event_word(smc)
105 Function DOWNCALL (SMT, lnkstat.c)
106 This functions returns the SMT port event work for AIX events.
108 Return smt_port_event_word always 0
112 u_long
smt_get_port_event_word(struct s_smc
*smc
)
118 BEGIN_MANUAL_ENTRY(if,func;others;11)
120 u_long smt_read_errorlog(smc,p,len)
125 Function DOWNCALL (SMT, lnkstat.c)
126 This functions returns the SMT error log field for AIX events.
128 Para p pointer to the error log field
129 len len of the error log field
131 Return len used len of the error log field
135 int smt_read_errorlog(struct s_smc
*smc
, char _far
*p
, int len
)
139 struct s_error_log _far
*er
;
141 er
= (struct s_error_log _far
*) p
;
142 if (len
> sizeof(struct s_error_log
))
143 len
= sizeof(struct s_error_log
) ;
144 for (i
= 0 ; i
< len
; i
++)
149 if (EL_IS_OK(set_count_high
,len
)) {
150 er
->set_count_low
= (u_short
)smc
->mib
.fddiSMTSetCount
.count
;
152 (u_short
)(smc
->mib
.fddiSMTSetCount
.count
>> 16L) ;
157 if (EL_IS_OK(aci_id_code
,len
)) {
158 er
->aci_id_code
= 0 ;
161 * purge counter is missed frames; 16 bits only
163 if (EL_IS_OK(purge_frame_counter
,len
)) {
164 if (smc
->mib
.m
[MAC0
].fddiMACCopied_Ct
> 0xffff)
165 er
->purge_frame_counter
= 0xffff ;
167 er
->purge_frame_counter
=
168 (u_short
)smc
->mib
.m
[MAC0
].fddiMACCopied_Ct
;
171 * CMT and RMT state machines
173 if (EL_IS_OK(ecm_state
,len
))
174 er
->ecm_state
= smc
->mib
.fddiSMTECMState
;
176 if (EL_IS_OK(pcm_b_state
,len
)) {
177 if (smc
->s
.sas
== SMT_SAS
) {
178 er
->pcm_a_state
= smc
->y
[PS
].mib
->fddiPORTPCMState
;
179 er
->pcm_b_state
= 0 ;
182 er
->pcm_a_state
= smc
->y
[PA
].mib
->fddiPORTPCMState
;
183 er
->pcm_b_state
= smc
->y
[PB
].mib
->fddiPORTPCMState
;
186 if (EL_IS_OK(cfm_state
,len
))
187 er
->cfm_state
= smc
->mib
.fddiSMTCF_State
;
188 if (EL_IS_OK(rmt_state
,len
))
189 er
->rmt_state
= smc
->mib
.m
[MAC0
].fddiMACRMTState
;
192 * smt error word low (we only need the low order 16 bits.)
195 st
= smt_get_error_word(smc
) & 0xffff ;
197 if (EL_IS_OK(smt_error_low
,len
))
198 er
->smt_error_low
= st
;
200 if (EL_IS_OK(ucode_version_level
,len
))
201 er
->ucode_version_level
= 0x0101 ;