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

📄 e100_kcompat.h

📁 Linux* Base Driver for the Intel(R) PRO/100 Family of Adapters
💻 H
📖 第 1 页 / 共 2 页
字号:
/*******************************************************************************    Copyright(c) 1999 - 2004 Intel Corporation. All rights reserved.    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.    This program 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  this program; if not, write to the Free Software Foundation, Inc., 59   Temple Place - Suite 330, Boston, MA  02111-1307, USA.    The full GNU General Public License is included in this distribution in the  file called LICENSE.    Contact Information:  Linux NICS <linux.nics@intel.com>  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497*******************************************************************************//* Macros to make drivers compatible with 2.4 Linux kernels * * In order to make a single network driver work with all 2.4 kernels * these compatibility macros can be used. * They are backwards compatible implementations of the latest APIs. * The idea is that these macros will let you use the newest driver with old * kernels, but can be removed when working with the latest and greatest. */#ifndef __E100_KCOMPAT_H__#define __E100_KCOMPAT_H__#include <linux/version.h>#include <linux/types.h>/****************************************************************** *################################################################# *# *# General definitions, not related to a specific kernel version. *# *################################################################# ******************************************************************/#ifndef __init#define __init#endif#ifndef __devinit#define __devinit#endif#ifndef __exit#define __exit#endif#ifndef __devexit#define __devexit#endif#ifndef __devinitdata#define __devinitdata#endif#ifndef __devexit_p#define __devexit_p(x) x#endif#ifndef MODULE_LICENSE#define MODULE_LICENSE(license)#endif#ifndef SET_NETDEV_DEV#define SET_NETDEV_DEV(net, pdev)#endif#ifndef IRQ_HANDLED#define irqreturn_t void#define IRQ_HANDLED#define IRQ_NONE#endif#ifndef HAVE_FREE_NETDEV#define free_netdev(x)	kfree(x)#endif#ifndef MOD_INC_USE_COUNT#define MOD_INC_USE_COUNT do {} while (0)#endif#ifndef MOD_DEC_USE_COUNT#define MOD_DEC_USE_COUNT do {} while (0)#endif#ifdef HAVE_POLL_CONTROLLER#define CONFIG_NET_POLL_CONTROLLER#endif#ifndef min_t#define min_t(type,x,y) \        ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; })#endif#ifndef max_t#define max_t(type,x,y) \        ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; })#endif#ifndef cpu_relax#define cpu_relax() do {} while (0)#endif#ifndef ETHTOOL_GWOL/* Wake-On-Lan options. */#define WAKE_PHY                (1 << 0)#define WAKE_UCAST              (1 << 1)#define WAKE_ARP                (1 << 4)#define WAKE_MAGIC              (1 << 5)#endif/* Installations with ethtool version < 1.6 */#ifndef ETHTOOL_GLINK#define ETHTOOL_GLINK		0x0000000a /* Get link status */#endif#ifndef ETH_TEST_FL_OFFLINE#define ETH_TEST_FL_OFFLINE	(1 << 0)#endif#ifndef ETH_TEST_FL_FAILED#define ETH_TEST_FL_FAILED	(1 << 1)#endif#ifndef ETHTOOL_TEST#define ETHTOOL_TEST		0x0000001a /* execute NIC self-test, priv. */#endif#undef ethtool_test#define ethtool_test _kc_ethtool_test/* for requesting NIC test and getting results*/struct _kc_ethtool_test {	u32	cmd;		/* ETHTOOL_TEST */	u32	flags;		/* ETH_TEST_FL_xxx */	u32	reserved;	u32	len;		/* result length, in number of u64 elements */	u64	data[0];};#ifndef ETH_GSTRING_LEN#define ETH_GSTRING_LEN         32#endif#ifndef ETHTOOL_GSTRINGS#define ETHTOOL_GSTRINGS	0x0000001b /* get specified string set */#endif#undef ethtool_gstrings#define ethtool_gstrings _kc_ethtool_gstrings/* for passing string sets for data tagging */struct _kc_ethtool_gstrings {	u32	cmd;		/* ETHTOOL_GSTRINGS */	u32	string_set;	/* string set id e.c. ETH_SS_TEST, etc*/	u32	len;		/* number of strings in the string set */	u8	data[0];};#ifndef ETH_SS_TEST#define ETH_SS_TEST		0#endif#ifndef ETH_SS_STATS#define ETH_SS_STATS		1#endif#ifndef ETHTOOL_GSTATS#define ETHTOOL_GSTATS		0x0000001d /* get NIC-specific statistics */#endif#undef ethtool_stats#define ethtool_stats _kc_ethtool_stats/* for dumping NIC-specific statistics */struct _kc_ethtool_stats {	u32	cmd;		/* ETHTOOL_GSTATS */	u32	n_stats;	/* number of u64's being returned */	u64	data[0];};#ifndef ETHTOOL_BUSINFO_LEN#define ETHTOOL_BUSINFO_LEN	32#endif#undef ethtool_drvinfo#define ethtool_drvinfo k_ethtool_drvinfostruct k_ethtool_drvinfo {	u32	cmd;	char	driver[32];	/* driver short name, "tulip", "eepro100" */	char	version[32];	/* driver version string */	char	fw_version[32];	/* firmware version string, if applicable */	char	bus_info[ETHTOOL_BUSINFO_LEN];	/* Bus info for this IF. */				/* For PCI devices, use pci_dev->slot_name. */	char	reserved1[32];	char	reserved2[16];	u32	n_stats;	/* number of u64's from ETHTOOL_GSTATS */	u32	testinfo_len;	u32	eedump_len;	/* Size of data from ETHTOOL_GEEPROM (bytes) */	u32	regdump_len;	/* Size of data from ETHTOOL_GREGS (bytes) */};#ifndef ETHTOOL_GEEPROM#define ETHTOOL_GEEPROM 0xb#define ETHTOOL_SEEPROM 0xc#undef ETHTOOL_GREGSstruct ethtool_eeprom {	u32	cmd;	u32	magic;	u32	offset;	u32	len;	u8	data[0];};#endif /* ETHTOOL_GEEPROM */#ifndef ETHTOOL_PHYS_ID#define ETHTOOL_PHYS_ID 0x1c#undef ethtool_value#define ethtool_value k_ethtool_valuestruct k_ethtool_value {	u32     cmd;	u32     data;};#endif /* ETHTOOL_PHYS_ID */ /****************************************************************** *################################################################# *# *# Kernels before 2.4.3 *# *################################################################# ******************************************************************/#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,3)#include <linux/pci.h>#include <linux/netdevice.h>#include <linux/ioport.h>#ifndef pci_request_regions#define pci_request_regions e100_pci_request_regionsextern int e100_pci_request_regions(struct pci_dev *pdev, char *res_name);#endif#ifndef pci_release_regions#define pci_release_regions e100_pci_release_regionsextern void e100_pci_release_regions(struct pci_dev *pdev);#endif#ifndef is_valid_ether_addr#define is_valid_ether_addr _kc_is_valid_ether_addrextern int _kc_is_valid_ether_addr(u8 *addr);#endif #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,4,3) *//****************************************************************** *################################################################# *# *# Kernels before 2.4.4 *# *################################################################# ******************************************************************/#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,4)#define pci_disable_device(dev) do{} while(0)#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,4,4) *//****************************************************************** *################################################################# *# *# Kernels before 2.4.5 *# *################################################################# ******************************************************************/#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,5)#define skb_linearize(skb, gfp_mask) ({     \    struct sk_buff *tmp_skb;                \    tmp_skb = skb;                          \    skb = skb_copy(tmp_skb, gfp_mask);      \    dev_kfree_skb_any(tmp_skb); })/* MII constants *//* MDI register set*/#ifndef MII_BMCR#define MII_BMCR		0x00	/* MDI control register */#endif#ifndef MII_BMSR

⌨️ 快捷键说明

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