[TG3]: Set minimal hw interrupt mitigation.
[linux-2.6/verdex.git] / drivers / net / skfp / lnkstat.c
blob00a248044f8683d104d55918fe5d003a3261fa41
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
21 #include "h/types.h"
22 #include "h/fddi.h"
23 #include "h/smc.h"
24 #include "h/lnkstat.h"
26 #ifndef lint
27 static const char ID_sccs[] = "@(#)lnkstat.c 1.8 97/04/11 (C) SK " ;
28 #endif
30 #ifdef sun
31 #define _far
32 #endif
34 #define EL_IS_OK(x,l) ((((int)&(((struct s_error_log *)0)->x)) + \
35 sizeof(er->x)) <= l)
38 BEGIN_MANUAL_ENTRY(if,func;others;11)
40 u_long smt_get_error_word(smc)
41 struct s_smc *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
53 END_MANUAL_ENTRY()
55 u_long smt_get_error_word(struct s_smc *smc)
57 u_long st;
60 * smt error word low
62 st = 0 ;
63 if (smc->s.sas == SMT_SAS) {
64 if (smc->mib.p[PS].fddiPORTLerFlag)
65 st |= SMT_ERL_ALC ;
67 else {
68 if (smc->mib.p[PA].fddiPORTLerFlag)
69 st |= SMT_ERL_ALC ;
70 if (smc->mib.p[PB].fddiPORTLerFlag)
71 st |= SMT_ERL_BLC ;
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 */
78 return st;
82 BEGIN_MANUAL_ENTRY(if,func;others;11)
84 u_long smt_get_event_word(smc)
85 struct s_smc *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
92 END_MANUAL_ENTRY()
94 u_long smt_get_event_word(struct s_smc *smc)
96 return (u_long) 0;
100 BEGIN_MANUAL_ENTRY(if,func;others;11)
102 u_long smt_get_port_event_word(smc)
103 struct s_smc *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
110 END_MANUAL_ENTRY()
112 u_long smt_get_port_event_word(struct s_smc *smc)
114 return (u_long) 0;
118 BEGIN_MANUAL_ENTRY(if,func;others;11)
120 u_long smt_read_errorlog(smc,p,len)
121 struct s_smc *smc ;
122 char _far *p ;
123 int 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
133 END_MANUAL_ENTRY()
135 int smt_read_errorlog(struct s_smc *smc, char _far *p, int len)
137 int i ;
138 int st ;
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++)
145 *p++ = 0 ;
147 * set count
149 if (EL_IS_OK(set_count_high,len)) {
150 er->set_count_low = (u_short)smc->mib.fddiSMTSetCount.count ;
151 er->set_count_high =
152 (u_short)(smc->mib.fddiSMTSetCount.count >> 16L) ;
155 * aci
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 ;
166 else
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 ;
181 else {
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 ;
202 return(len) ;