📄 skge.c
字号:
/******************************************************************************* ** Copyright 2005 University of Cambridge Computer Laboratory. ** ** This file is part of Nprobe. ** ** Nprobe 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. ** ** Nprobe is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with Nprobe; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ** *******************************************************************************//****************************************************************************** * * Name: skge.c * Project: GEnesis, PCI Gigabit Ethernet Adapter * Version: $Revision: 1.11 $ * Date: $Date: 2003/08/26 16:05:19 $ * Purpose: The main driver source module * ******************************************************************************//****************************************************************************** * * (C)Copyright 1998-2003 SysKonnect GmbH. * * Driver for SysKonnect Gigabit Ethernet Server Adapters: * * SK-9871 (single link 1000Base-ZX) * SK-9872 (dual link 1000Base-ZX) * SK-9861 (single link 1000Base-SX, VF45 Volition Plug) * SK-9862 (dual link 1000Base-SX, VF45 Volition Plug) * SK-9841 (single link 1000Base-LX) * SK-9842 (dual link 1000Base-LX) * SK-9843 (single link 1000Base-SX) * SK-9844 (dual link 1000Base-SX) * SK-9821 (single link 1000Base-T) * SK-9822 (dual link 1000Base-T) * SK-9881 (single link 1000Base-SX V2 LC) * SK-9871 (single link 1000Base-ZX V2) * SK-9861 (single link 1000Base-SX V2, VF45 Volition Plug) * SK-9841 (single link 1000Base-LX V2) * SK-9843 (single link 1000Base-SX V2) * SK-9821 (single link 1000Base-T V2) * * Created 10-Feb-1999, based on Linux' acenic.c, 3c59x.c and * SysKonnects GEnesis Solaris driver * Author: Christoph Goos (cgoos@syskonnect.de) * Mirko Lindner (mlindner@syskonnect.de) * * Address all question to: linux@syskonnect.de * * The technical manual for the adapters is available from SysKonnect's * web pages: www.syskonnect.com * Goto "Support" and search Knowledge Base for "manual". * * 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: skge.c,v $ * Revision 1.16 2003/09/23 11:07:35 mlindner * Fix: IO-control return race condition * Fix: Interrupt moderation value check * * Revision 1.15 2003/09/22 08:40:05 mlindner * Add: Added DRIVER_FILE_NAME and DRIVER_REL_DATE * * Revision 1.14 2003/09/22 08:11:10 mlindner * Add: New function for PCI initialization (SkGeInitPCI) * Add: Yukon Plus changes (ChipID, PCI...) * Fix: TCP and UDP Checksum calculation * * Revision 1.11 2003/08/26 16:05:19 mlindner * Fix: Compiler warnings (void *) * * Revision 1.10 2003/08/25 09:24:08 mlindner * Add: Dynamic Interrupt Moderation (DIM) port up message * * Revision 1.9 2003/08/21 14:09:43 mlindner * Fix: Disable Half Duplex with Gigabit-Speed (Yukon). Enable Full Duplex. * * Revision 1.8 2003/08/19 15:09:18 mlindner * Fix: Ignore ConType parameter if empty value * * Revision 1.7 2003/08/13 12:00:35 mlindner * Fix: Removed useless defines * * Revision 1.6 2003/08/12 16:49:41 mlindner * Fix: UDP and TCP HW-CSum calculation (Kernel 2.5/2.6) * Fix: UDP and TCP Proto checks * Fix: Build without ProcFS * Fix: Kernel 2.6 editorial changes * * Revision 1.5 2003/08/07 12:25:07 mlindner * Fix: ConType parameter check and error detection * Fix: Insert various fixes applied to the kernel tree * * Revision 1.4 2003/08/07 10:50:21 mlindner * Add: Speed and HW-Csum support for Yukon Lite chipset * * Revision 1.3 2003/08/06 11:24:08 mlindner * Add: Kernel updates * * Revision 1.2 2003/07/21 08:28:47 rroesler * Fix: Handle padded bytes using skb_put() * * Revision 1.63 2003/07/15 09:26:23 rroesler * Fix: Removed memory leak when sending short padded frames * * Revision 1.62 2003/07/09 11:11:16 rroesler * Fix: Call of ReceiveIrq() performed with parameter SK_FALSE in * order not to hang the system with multiple spinlocks * * Revision 1.61 2003/07/08 07:32:41 rroesler * Fix: Correct Kernel-version * * Revision 1.60 2003/07/07 15:42:30 rroesler * Fix: Removed function pci_present() for 2.5/2.6 kernels (deprecated) * Fix: Corrected warning in GetConfiguration() * * Revision 1.59 2003/07/07 09:44:32 rroesler * Add: HW checksumming on kernel 2.5/2.6 * Add: padding of short frames (<60 bytes) with 0x00 instead of 0xaa * Add: ConType parameter combining multiple other parameters into one * Fix: Corrected bugreport #10721 (warning when changing MTU size) * Fix: Removed obsolete function SetQueueSize() * Fix: Function ChangeMtuSize() returns new MTU size in kernel 2.5/2.6 * * Revision 1.58 2003/06/17 07:14:29 mlindner * Add: Disable checksum functionality * Fix: Unload module (Kernel 2.5) * * Revision 1.57 2003/06/05 14:55:27 mlindner * Fix: ProcFS creation (Kernel 2.2.x) * Fix: ProcFS OWNER (Kernel 2.2.x) * * Revision 1.56 2003/06/03 14:34:29 mlindner * Add: Additions for SK_SLIM * Fix: SkGeIoctl SK_IOCTL_GEN * * Revision 1.55 2003/05/26 13:00:52 mlindner * Add: Support for Kernel 2.5/2.6 * Add: Support for new IO-control MIB data structure * Add: New SkOsGetTime function * Fix: Race condition with broken LM80 chip * Fix: Race condition with padded frames * * Revision 1.54 2003/04/28 13:07:27 mlindner * Fix: Delay race condition with some server machines * * Revision 1.53 2003/04/28 12:49:49 mlindner * Fix: Code optimization * * Revision 1.52 2003/04/28 12:24:32 mlindner * Fix: Disabled HW Error IRQ on 32-bit Yukon if sensor IRQ occurs * * Revision 1.51 2003/04/16 08:31:14 mlindner * Fix: Kernel 2.2 compilation * * Revision 1.49 2003/04/10 09:08:51 mlindner * Add: Blink mode verification * Fix: Checksum calculation * * Revision 1.48 2003/03/21 14:48:38 rroesler * Added code for interrupt moderation * * Revision 1.47 2003/03/12 13:56:15 mlindner * Fix: Mac update during SK_DRV_NET_UP * * Revision 1.46 2003/02/25 14:16:36 mlindner * Fix: Copyright statement * * Revision 1.45 2003/02/25 13:25:55 mlindner * Add: Performance improvements * Add: Support for various vendors * Fix: Init function * * Revision 1.44 2003/01/09 09:25:26 mlindner * Fix: Remove useless init_module/cleanup_module forward declarations * * Revision 1.43 2002/11/29 08:42:41 mlindner * Fix: Boot message * * Revision 1.42 2002/11/28 13:30:23 mlindner * Add: New frame check * * Revision 1.41 2002/11/27 13:55:18 mlindner * Fix: Drop wrong csum packets * Fix: Initialize proc_entry after hw check * * Revision 1.40 2002/10/31 07:50:37 tschilli * Function SkGeInitAssignRamToQueues() from common module inserted. * Autonegotiation is set to ON for all adapters. * LinkSpeedUsed is used in link up status report. * Role parameter will show up for 1000 Mbps links only. * GetConfiguration() inserted after init level 1 in SkGeChangeMtu(). * All return values of SkGeInit() and SkGeInitPort() are checked. * * Revision 1.39 2002/10/02 12:56:05 mlindner * Add: Support for Yukon * Add: Support for ZEROCOPY, scatter-gather and hw checksum * Add: New transmit ring function (use SG and TCP/UDP hardware checksumming) * Add: New init function * Add: Speed check and setup * Add: Merge source for kernel 2.2.x and 2.4.x * Add: Opcode check for tcp * Add: Frame length check * Fix: Transmit complete interrupt * Fix: Interrupt moderation * * Revision 1.29.2.13 2002/01/14 12:44:52 mlindner * Fix: Rlmt modes * * Revision 1.29.2.12 2001/12/07 12:06:18 mlindner * Fix: malloc -> slab changes * * Revision 1.29.2.11 2001/12/06 15:19:20 mlindner * Add: DMA attributes * Fix: Module initialisation * Fix: pci_map_single and pci_unmap_single replaced * * Revision 1.29.2.10 2001/12/06 09:56:50 mlindner * Corrected some printk's * * Revision 1.29.2.9 2001/09/05 12:15:34 mlindner * Add: LBFO Changes * Fix: Counter Errors (Jumbo == to long errors) * Fix: Changed pAC->PciDev declaration * Fix: too short counters * * Revision 1.29.2.8 2001/06/25 12:10:44 mlindner * fix: ReceiveIrq() changed. * * Revision 1.29.2.7 2001/06/25 08:07:05 mlindner * fix: RLMT locking in ReceiveIrq() changed. * * Revision 1.29.2.6 2001/05/21 07:59:29 mlindner * fix: MTU init problems * * Revision 1.29.2.5 2001/05/08 11:25:08 mlindner * fix: removed VLAN error message * * Revision 1.29.2.4 2001/05/04 13:31:43 gklug * fix: do not handle eth_copy on bad fragments received. * * Revision 1.29.2.3 2001/04/23 08:06:43 mlindner * Fix: error handling * * Revision 1.29.2.2 2001/03/15 12:04:54 mlindner * Fixed memory problem * * Revision 1.29.2.1 2001/03/12 16:41:44 mlindner * add: procfs function * add: dual-net function * add: RLMT networks * add: extended PNMI features * * Kernel 2.4.x specific: * Revision 1.xx 2000/09/12 13:31:56 cgoos * Fixed missign "dev=NULL in skge_probe. * Added counting for jumbo frames (corrects error statistic). * Removed VLAN tag check (enables VLAN support). * * Kernel 2.2.x specific: * Revision 1.29 2000/02/21 13:31:56 cgoos * Fixed "unused" warning for UltraSPARC change. * * Partially kernel 2.2.x specific: * Revision 1.28 2000/02/21 10:32:36 cgoos * Added fixes for UltraSPARC. * Now printing RlmtMode and PrefPort setting at startup. * Changed XmitFrame return value. * Fixed rx checksum calculation for BIG ENDIAN systems. * Fixed rx jumbo frames counted as ierrors. * * * Revision 1.27 1999/11/25 09:06:28 cgoos * Changed base_addr to unsigned long. * * Revision 1.26 1999/11/22 13:29:16 cgoos * Changed license header to GPL. * Changes for inclusion in linux kernel (2.2.13). * Removed 2.0.x defines. * Changed SkGeProbe to skge_probe. * Added checks in SkGeIoctl. * * Revision 1.25 1999/10/07 14:47:52 cgoos * Changed 984x to 98xx. * * Revision 1.24 1999/09/30 07:21:01 cgoos * Removed SK_RLMT_SLOW_LOOKAHEAD option. * Giving spanning tree packets also to OS now. * * Revision 1.23 1999/09/29 07:36:50 cgoos * Changed assignment for IsBc/IsMc. * * Revision 1.22 1999/09/28 12:57:09 cgoos * Added CheckQueue also to Single-Port-ISR. * * Revision 1.21 1999/09/28 12:42:41 cgoos * Changed parameter strings for RlmtMode. * * Revision 1.20 1999/09/28 12:37:57 cgoos * Added CheckQueue for fast delivery of RLMT frames. * * Revision 1.19 1999/09/16 07:57:25 cgoos * Copperfield changes. * * Revision 1.18 1999/09/03 13:06:30 cgoos * Fixed RlmtMode=CheckSeg bug: wrong DEV_KFREE_SKB in RLMT_SEND caused * double allocated skb's. * FrameStat in ReceiveIrq was accessed via wrong Rxd. * Queue size for async. standby Tx queue was zero. * FillRxLimit of 0 could cause problems with ReQueue, changed to 1. * Removed debug output of checksum statistic. * * Revision 1.17 1999/08/11 13:55:27 cgoos * Transmit descriptor polling was not reenabled after SkGePortInit. * * Revision 1.16 1999/07/27 15:17:29 cgoos * Added some "\n" in output strings (removed while debuging...). * * Revision 1.15 1999/07/23 12:09:30 cgoos * Performance optimization, rx checksumming, large frame support. * * Revision 1.14 1999/07/14 11:26:27 cgoos * Removed Link LED settings (now in RLMT). * Added status output at NET UP. * Fixed SMP problems with Tx and SWITCH running in parallel. * Fixed return code problem at RLMT_SEND event. * * Revision 1.13 1999/04/07 10:11:42 cgoos * Fixed Single Port problems. * Fixed Multi-Adapter problems. * Always display startup string. * * Revision 1.12 1999/03/29 12:26:37 cgoos * Reversed locking to fine granularity. * Fixed skb double alloc problem (caused by incorrect xmit return code). * Enhanced function descriptions. * * Revision 1.11 1999/03/15 13:10:51 cgoos * Changed device identifier in output string to ethX. * * Revision 1.10 1999/03/15 12:12:34 cgoos * Changed copyright notice. * * Revision 1.9 1999/03/15 12:10:17 cgoos * Changed locking to one driver lock. * Added check of SK_AC-size (for consistency with library). * * Revision 1.8 1999/03/08 11:44:02 cgoos * Fixed missing dev->tbusy in SkGeXmit. * Changed large frame (jumbo) buffer number. * Added copying of short frames. * * Revision 1.7 1999/03/04 13:26:57 cgoos * Fixed spinlock calls for SMP. * * Revision 1.6 1999/03/02 09:53:51 cgoos * Added descriptor revertion for big endian machines. * * Revision 1.5 1999/03/01 08:50:59 cgoos * Fixed SkGeChangeMtu. * Fixed pci config space accesses. * * Revision 1.4 1999/02/18 15:48:44 cgoos * Corrected some printk's. * * Revision 1.3 1999/02/18 12:45:55 cgoos * Changed SK_MAX_CARD_PARAM to default 16 * * Revision 1.2 1999/02/18 10:55:32 cgoos * Removed SkGeDrvTimeStamp function. * Printing "ethX:" before adapter type at adapter init. * * * 10-Feb-1999 cg Created, based on Linux' acenic.c, 3c59x.c and * SysKonnects GEnesis Solaris driver * ******************************************************************************//****************************************************************************** * * Possible compiler options (#define xxx / -Dxxx): * * debugging can be enable by changing SK_DEBUG_CHKMOD and * SK_DEBUG_CHKCAT in makefile (described there). * ******************************************************************************//****************************************************************************** * * Description: * * This is the main module of the Linux GE driver. * * All source files except skge.c, skdrv1st.h, skdrv2nd.h and sktypes.h * are part of SysKonnect's COMMON MODULES for the SK-98xx adapters. * Those are used for drivers on multiple OS', so some thing may seem * unnecessary complicated on Linux. Please do not try to 'clean up' * them without VERY good reasons, because this will make it more * difficult to keep the Linux driver in synchronisation with the * other versions. * * Include file hierarchy: * * <linux/module.h> * * "h/skdrv1st.h" * <linux/version.h> * <linux/types.h> * <linux/kernel.h> * <linux/string.h> * <linux/errno.h> * <linux/ioport.h> * <linux/slab.h> * <linux/interrupt.h> * <linux/pci.h> * <asm/byteorder.h> * <asm/bitops.h> * <asm/io.h> * <linux/netdevice.h> * <linux/etherdevice.h> * <linux/skbuff.h>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -