⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 skgepnmi.c

📁 linux和2410结合开发 用他可以生成2410所需的zImage文件
💻 C
📖 第 1 页 / 共 5 页
字号:
/***************************************************************************** * * Name:	skgepnmi.c * Project:	GEnesis, PCI Gigabit Ethernet Adapter * Version:	$Revision: 1.87 $ * Date:	$Date: 2001/04/06 13:35:09 $ * Purpose:	Private Network Management Interface * ****************************************************************************//****************************************************************************** * *	(C)Copyright 1998-2001 SysKonnect GmbH. * *	This program is free software; you can redistribute it and/or modify *	it under the terms of the GNU General Public License as published by *	the Free Software Foundation; either version 2 of the License, or *	(at your option) any later version. * *	The information in this file is provided "AS IS" without warranty. * ******************************************************************************//***************************************************************************** * * History: * *	$Log: skgepnmi.c,v $ *	Revision 1.87  2001/04/06 13:35:09  mkunz *	-Bugs fixed in handling of OID_SKGE_MTU and the VPD OID's *	 *	Revision 1.86  2001/03/09 09:18:03  mkunz *	Changes in SK_DBG_MSG *	 *	Revision 1.85  2001/03/08 09:37:31  mkunz *	Bugfix in ResetCounter for Pnmi.Port structure *	 *	Revision 1.84  2001/03/06 09:04:55  mkunz *	Made some changes in instance calculation *	C	^VS: *	 *	Revision 1.83  2001/02/15 09:15:32  mkunz *	Necessary changes for dual net mode added *	 *	Revision 1.82  2001/02/07 08:24:19  mkunz *	-Made changes in handling of OID_SKGE_MTU *	 *	Revision 1.81  2001/02/06 09:58:00  mkunz *	-Vpd bug fixed *	-OID_SKGE_MTU added *	-pnmi support for dual net mode. Interface function and macros extended *	 *	Revision 1.80  2001/01/22 13:41:35  rassmann *	Supporting two nets on dual-port adapters. *	 *	Revision 1.79  2000/12/05 14:57:40  cgoos *	SetStruct failed before first Link Up (link mode of virtual *	port "INDETERMINATED"). *	 *	Revision 1.78  2000/09/12 10:44:58  cgoos *	Fixed SK_PNMI_STORE_U32 calls with typecasted argument. *	 *	Revision 1.77  2000/09/07 08:10:19  rwahl *	- Modified algorithm for 64bit NDIS statistic counters; *	  returns 64bit or 32bit value depending on passed buffer *	  size. Indicate capability for 64bit NDIS counter, if passed *	  buffer size is zero. OID_GEN_XMIT_ERROR, OID_GEN_RCV_ERROR, *	  and OID_GEN_RCV_NO_BUFFER handled as 64bit counter, too. *	- corrected OID_SKGE_RLMT_PORT_PREFERRED. *	 *	Revision 1.76  2000/08/03 15:23:39  rwahl *	- Correction for FrameTooLong counter has to be moved to OID handling *	  routines (instead of statistic counter routine). *	- Fix in XMAC Reset Event handling: Only offset counter for hardware *	  statistic registers are updated. *	 *	Revision 1.75  2000/08/01 16:46:05  rwahl *	- Added StatRxLongFrames counter and correction of FrameTooLong counter. *	- Added directive to control width (default = 32bit) of NDIS statistic *	  counters (SK_NDIS_64BIT_CTR). *	 *	Revision 1.74  2000/07/04 11:41:53  rwahl *	- Added volition connector type. *	 *	Revision 1.73  2000/03/15 16:33:10  rwahl *	Fixed bug 10510; wrong reset of virtual port statistic counters. *	 *	Revision 1.72  1999/12/06 16:15:53  rwahl *	Fixed problem of instance range for current and factory MAC address. *	 *	Revision 1.71  1999/12/06 10:14:20  rwahl *	Fixed bug 10476; set operation for PHY_OPERATION_MODE. *	 *	Revision 1.70  1999/11/22 13:33:34  cgoos *	Changed license header to GPL. *	 *	Revision 1.69  1999/10/18 11:42:15  rwahl *	Added typecasts for checking event dependent param (debug only). *	 *	Revision 1.68  1999/10/06 09:35:59  cgoos *	Added state check to PHY_READ call (hanged if called during startup). *	 *	Revision 1.67  1999/09/22 09:53:20  rwahl *	- Read Broadcom register for updating fcs error counter (1000Base-T). * *	Revision 1.66  1999/08/26 13:47:56  rwahl *	Added SK_DRIVER_SENDEVENT when queueing RLMT_CHANGE_THRES trap. *	 *	Revision 1.65  1999/07/26 07:49:35  cgoos *	Added two typecasts to avoid compiler warnings. *	 *	Revision 1.64  1999/05/20 09:24:12  cgoos *	Changes for 1000Base-T (sensors, Master/Slave). * *	Revision 1.63  1999/04/13 15:11:58  mhaveman *	Moved include of rlmt.h to header skgepnmi.h because some macros *	are needed there. *	 *	Revision 1.62  1999/04/13 15:08:07  mhaveman *	Replaced again SK_RLMT_CHECK_LINK with SK_PNMI_RLMT_MODE_CHK_LINK *	to grant unified interface by only using the PNMI header file. *	SK_PNMI_RLMT_MODE_CHK_LINK is defined the same as SK_RLMT_CHECK_LINK. *	 *	Revision 1.61  1999/04/13 15:02:48  mhaveman *	Changes caused by review: *	-Changed some comments *	-Removed redundant check for OID_SKGE_PHYS_FAC_ADDR *	-Optimized PRESET check. *	-Meaning of error SK_ADDR_DUPLICATE_ADDRESS changed. Set of same *	 address will now not cause this error. Removed corresponding check. *	 *	Revision 1.60  1999/03/23 10:41:23  mhaveman *	Added comments. *	 *	Revision 1.59  1999/02/19 08:01:28  mhaveman *	Fixed bug 10372 that after counter reset all ports were displayed *	as inactive. *	 *	Revision 1.58  1999/02/16 18:04:47  mhaveman *	Fixed problem of twisted OIDs SENSOR_WAR_TIME and SENSOR_ERR_TIME. *	 *	Revision 1.56  1999/01/27 12:29:11  mhaveman *	SkTimerStart was called with time value in milli seconds but needs *	micro seconds. *	 *	Revision 1.55  1999/01/25 15:00:38  mhaveman *	Added support to allow multiple ports to be active. If this feature in *	future will be used, the Management Data Base variables PORT_ACTIVE *	and PORT_PREFERED should be moved to the port specific part of RLMT. *	Currently they return the values of the first active physical port *	found. A set to the virtual port will actually change all active *	physical ports. A get returns the melted values of all active physical *	ports. If the port values differ a return value INDETERMINATED will *	be returned. This effects especially the CONF group. *	 *	Revision 1.54  1999/01/19 10:10:22  mhaveman *	-Fixed bug 10354: Counter values of virtual port were wrong after port *	 switches *	-Added check if a switch to the same port is notified. *	 *	Revision 1.53  1999/01/07 09:25:21  mhaveman *	Forgot to initialize a variable. *	 *	Revision 1.52  1999/01/05 10:34:33  mhaveman *	Fixed little error in RlmtChangeEstimate calculation. *	 *	Revision 1.51  1999/01/05 09:59:07  mhaveman *	-Moved timer start to init level 2 *	-Redesigned port switch average calculation to avoid 64bit *	 arithmetic. *	 *	Revision 1.50  1998/12/10 15:13:59  mhaveman *	-Fixed: PHYS_CUR_ADDR returned wrong addresses *	-Fixed: RLMT_PORT_PREFERED and RLMT_CHANGE_THRES preset returned *	        always BAD_VALUE. *	-Fixed: TRAP buffer seemed to sometimes suddenly empty *	 *	Revision 1.49  1998/12/09 16:17:07  mhaveman *	Fixed: Couldnot delete VPD keys on UNIX. *	 *	Revision 1.48  1998/12/09 14:11:10  mhaveman *	-Add: Debugmessage for XMAC_RESET supressed to minimize output. *	-Fixed: RlmtChangeThreshold will now be initialized. *	-Fixed: VPD_ENTRIES_LIST extended value with unnecessary space char. *	-Fixed: On VPD key creation an invalid key name could be created *	        (e.g. A5) *	-Some minor changes in comments and code. *	 *	Revision 1.47  1998/12/08 16:00:31  mhaveman *	-Fixed: For RLMT_PORT_ACTIVE will now be returned a 0 if no port *		is active. *	-Fixed: For the RLMT statistics group only the last value was *		returned and the rest of the buffer was filled with 0xff *	-Fixed: Mysteriously the preset on RLMT_MODE still returned *		BAD_VALUE. *	Revision 1.46  1998/12/08 10:04:56  mhaveman *	-Fixed: Preset on RLMT_MODE returned always BAD_VALUE error. *	-Fixed: Alignment error in GetStruct *	-Fixed: If for Get/Preset/SetStruct the buffer size is equal or *	        larger than SK_PNMI_MIN_STRUCT_SIZE the return value is stored *		to the buffer. In this case the caller should always return *	        ok to its upper routines. Only if the buffer size is less *	        than SK_PNMI_MIN_STRUCT_SIZE and the return value is unequal *	        to 0, an error should be returned by the caller. *	-Fixed: Wrong number of instances with RLMT statistic. *	-Fixed: Return now SK_LMODE_STAT_UNKNOWN if the LinkModeStatus is 0. *	 *	Revision 1.45  1998/12/03 17:17:24  mhaveman *	-Removed for VPD create action the buffer size limitation to 4 bytes. *	-Pass now physical/active physical port to ADDR for CUR_ADDR set *	 *	Revision 1.44  1998/12/03 15:14:35  mhaveman *	Another change to Vpd instance evaluation. * *	Revision 1.43  1998/12/03 14:18:10  mhaveman *	-Fixed problem in PnmiSetStruct. It was impossible to set any value. *	-Removed VPD key evaluation for VPD_FREE_BYTES and VPD_ACTION. * *	Revision 1.42  1998/12/03 11:31:47  mhaveman *	Inserted cast to satisfy lint. *	 *	Revision 1.41  1998/12/03 11:28:16  mhaveman *	Removed SK_PNMI_CHECKPTR *	 *	Revision 1.40  1998/12/03 11:19:07  mhaveman *	Fixed problems *	-A set to virtual port will now be ignored. A set with broadcast *	 address to any port will be ignored. *	-GetStruct function made VPD instance calculation wrong. *	-Prefered port returned -1 instead of 0. *	 *	Revision 1.39  1998/11/26 15:30:29  mhaveman *	Added sense mode to link mode. *	 *	Revision 1.38  1998/11/23 15:34:00  mhaveman *	-Fixed bug for RX counters. On an RX overflow interrupt the high *	 words of all RX counters were incremented. *	-SET operations on FLOWCTRL_MODE and LINK_MODE accept now the *	 value 0, which has no effect. It is usefull for multiple instance *	 SETs. *	 *	Revision 1.37  1998/11/20 08:02:04  mhaveman *	-Fixed: Ports were compared with MAX_SENSORS *	-Fixed: Crash in GetTrapEntry with MEMSET macro *	-Fixed: Conversions between physical, logical port index and instance *	 *	Revision 1.36  1998/11/16 07:48:53  mhaveman *	Casted SK_DRIVER_SENDEVENT with (void) to eleminate compiler warnings *	on Solaris. *	 *	Revision 1.35  1998/11/16 07:45:34  mhaveman *	SkAddrOverride now returns value and will be checked. * *	Revision 1.34  1998/11/10 13:40:37  mhaveman *	Needed to change interface, because NT driver needs a return value *	of needed buffer space on TOO_SHORT errors. Therefore all *	SkPnmiGet/Preset/Set functions now have a pointer to the length *	parameter, where the needed space on error is returned. *	 *	Revision 1.33  1998/11/03 13:52:46  mhaveman *	Made file lint conform. *	 *	Revision 1.32  1998/11/03 13:19:07  mhaveman *	The events SK_HWEV_SET_LMODE and SK_HWEV_SET_FLOWMODE pass now in *	Para32[0] the physical MAC index and in Para32[1] the new mode. *	 *	Revision 1.31  1998/11/03 12:30:40  gklug *	fix: compiler warning memset * *	Revision 1.30  1998/11/03 12:04:46  mhaveman *	Fixed problem in SENSOR_VALUE, which wrote beyond the buffer end *	Fixed alignment problem with CHIPSET. * *	Revision 1.29  1998/11/02 11:23:54  mhaveman *	Corrected SK_ERROR_LOG to SK_ERR_LOG. Sorry. *	 *	Revision 1.28  1998/11/02 10:47:16  mhaveman *	Added syslog messages for internal errors. *	 *	Revision 1.27  1998/10/30 15:48:06  mhaveman *	Fixed problems after simulation of SK_PNMI_EVT_CHG_EST_TIMER and *	RlmtChangeThreshold calculation. *	 *	Revision 1.26  1998/10/29 15:36:55  mhaveman *	-Fixed bug in trap buffer handling. *	-OID_SKGE_DRIVER_DESCR, OID_SKGE_DRIVER_VERSION, OID_SKGE_HW_DESCR, *	 OID_SKGE_HW_VERSION, OID_SKGE_VPD_ENTRIES_LIST, OID_SKGE_VPD_KEY, *	 OID_SKGE_VPD_VALUE, and OID_SKGE_SENSOR_DESCR return values with *	 a leading octet before each string storing the string length. *	-Perform a RlmtUpdate during SK_PNMI_EVT_XMAC_RESET to minimize *	 RlmtUpdate calls in GetStatVal. *	-Inserted SK_PNMI_CHECKFLAGS macro increase readability. *	 *	Revision 1.25  1998/10/29 08:50:36  mhaveman *	Fixed problems after second event simulation. *	 *	Revision 1.24  1998/10/28 08:44:37  mhaveman *	-Fixed alignment problem *	-Fixed problems during event simulation *	-Fixed sequence of error return code (INSTANCE -> ACCESS -> SHORT) *	-Changed type of parameter Instance back to SK_U32 because of VPD *	-Updated new VPD function calls * *	Revision 1.23  1998/10/23 10:16:37  mhaveman *	Fixed bugs after buffer test simulation. *	 *	Revision 1.22  1998/10/21 13:23:52  mhaveman *	-Call syntax of SkOsGetTime() changed to SkOsGetTime(pAc). *	-Changed calculation of hundrets of seconds. * *	Revision 1.20  1998/10/20 07:30:45  mhaveman *	Made type changes to unsigned integer where possible. *	 *	Revision 1.19  1998/10/19 10:51:30  mhaveman *	-Made Bug fixes after simulation run *	-Renamed RlmtMAC... to RlmtPort... *	-Marked workarounds with Errata comments *	 *	Revision 1.18  1998/10/14 07:50:08  mhaveman *	-For OID_SKGE_LINK_STATUS the link down detection has moved from RLMT *	 to HWACCESS. *	-Provided all MEMCPY/MEMSET macros with (char *) pointers, because *	 Solaris throwed warnings when mapping to bcopy/bset. * *	Revision 1.17  1998/10/13 07:42:01  mhaveman *	-Added OIDs OID_SKGE_TRAP_NUMBER and OID_SKGE_ALL_DATA *	-Removed old cvs history entries *	-Renamed MacNumber to PortNumber * *	Revision 1.16  1998/10/07 10:52:49  mhaveman *	-Inserted handling of some OID_GEN_ Ids for windows *	-Fixed problem with 803.2 statistic. *	 *	Revision 1.15  1998/10/01 09:16:29  mhaveman *	Added Debug messages for function call and UpdateFlag tracing. *	 *	Revision 1.14  1998/09/30 13:39:09  mhaveman *	-Reduced namings of 'MAC' by replacing them with 'PORT'. *	-Completed counting of OID_SKGE_RX_HW_ERROR_CTS, *       OID_SKGE_TX_HW_ERROR_CTS, *	 OID_SKGE_IN_ERRORS_CTS, and OID_SKGE_OUT_ERROR_CTS. *	-SET check for RlmtMode *	 *	Revision 1.13  1998/09/28 13:13:08  mhaveman *	Hide strcmp, strlen, and strncpy behind macros SK_STRCMP, SK_STRLEN, *	and SK_STRNCPY. (Same reasons as for mem.. and MEM..) *	 *	Revision 1.12  1998/09/16 08:18:36  cgoos *	Fix: XM_INxx and XM_OUTxx called with different parameter order: *      sometimes IoC,Mac,...  sometimes Mac,IoC,... Now always first variant. *	Fix: inserted "Pnmi." into some pAC->pDriverDescription / Version. *	Change: memset, memcpy to makros SK_MEMSET, SK_MEMCPY * *	Revision 1.11  1998/09/04 17:01:45  mhaveman *	Added SyncCounter as macro and OID_SKGE_.._NO_DESCR_CTS to *	OID_SKGE_RX_NO_BUF_CTS. *	 *	Revision 1.10  1998/09/04 14:35:35  mhaveman *	Added macro counters, that are counted by driver. *	 ****************************************************************************/static const char SysKonnectFileId[] =	"@(#) $Id: skgepnmi.c,v 1.87 2001/04/06 13:35:09 mkunz Exp $"	" (C) SysKonnect.";#include "h/skdrv1st.h"#include "h/sktypes.h"#include "h/xmac_ii.h"#include "h/skdebug.h"#include "h/skqueue.h"#include "h/skgepnmi.h"#include "h/skgesirq.h"#include "h/skcsum.h"#include "h/skvpd.h"#include "h/skgehw.h"#include "h/skgeinit.h"#include "h/skdrv2nd.h"#include "h/skgepnm2.h"/* * Public Function prototypes */int SkPnmiInit(SK_AC *pAC, SK_IOC IoC, int level);int SkPnmiGetVar(SK_AC *pAC, SK_IOC IoC, SK_U32 Id, void *pBuf,	unsigned int *pLen, SK_U32 Instance, SK_U32 NetIndex);int SkPnmiPreSetVar(SK_AC *pAC, SK_IOC IoC, SK_U32 Id, void *pBuf,	unsigned int *pLen, SK_U32 Instance, SK_U32 NetIndex);int SkPnmiSetVar(SK_AC *pAC, SK_IOC IoC, SK_U32 Id, void *pBuf,	unsigned int *pLen, SK_U32 Instance, SK_U32 NetIndex);int SkPnmiGetStruct(SK_AC *pAC, SK_IOC IoC, void *pBuf,	unsigned int *pLen, SK_U32 NetIndex);int SkPnmiPreSetStruct(SK_AC *pAC, SK_IOC IoC, void *pBuf, 	unsigned int *pLen, SK_U32 NetIndex);int SkPnmiSetStruct(SK_AC *pAC, SK_IOC IoC, void *pBuf, 	unsigned int *pLen, SK_U32 NetIndex);int SkPnmiEvent(SK_AC *pAC, SK_IOC IoC, SK_U32 Event, SK_EVPARA Param);/* * Private Function prototypes */static int Addr(SK_AC *pAC, SK_IOC IoC, int action,	SK_U32 Id, char *pBuf, unsigned int *pLen, SK_U32 Instance,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -