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

📄 kcompat.h

📁 e100最新的源码驱动
💻 H
📖 第 1 页 / 共 3 页
字号:
/*******************************************************************************  Intel PRO/100 Linux driver  Copyright(c) 1999 - 2006 Intel Corporation.  This program is free software; you can redistribute it and/or modify it  under the terms and conditions of the GNU General Public License,  version 2, as published by the Free Software Foundation.  This program is distributed in the hope 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.,  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.  The full GNU General Public License is included in this distribution in  the file called "COPYING".  Contact Information:  Linux NICS <linux.nics@intel.com>  e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497*******************************************************************************/#ifndef _KCOMPAT_H_#define _KCOMPAT_H_#include <linux/version.h>#ifdef E100_NAPI#undef CONFIG_E100_NAPI#define CONFIG_E100_NAPI#endif#ifdef E100_NO_NAPI#undef CONFIG_E100_NAPI#endif#ifdef DISABLE_PM#undef CONFIG_PM#endif#if ( LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15) )#define E100_USE_PCI_ERS#endif#ifndef PMSG_SUSPEND#define PMSG_SUSPEND 3#endif#ifndef module_param#define module_param(v,t,p) MODULE_PARM(v, "i");#endif#ifndef DMA_64BIT_MASK#define DMA_64BIT_MASK  0xffffffffffffffffULL#endif#ifndef DMA_32BIT_MASK#define DMA_32BIT_MASK  0x00000000ffffffffULL#endif/*****************************************************************************/#ifndef unlikely#define unlikely(_x) _x#define likely(_x) _x#endif/*****************************************************************************//*****************************************************************************//* Installations with ethtool version without eeprom, adapter id, or statistics * support */#ifndef ETH_GSTRING_LEN#define ETH_GSTRING_LEN 32#endif#ifndef ETHTOOL_GSTATS#define ETHTOOL_GSTATS 0x1d#undef ethtool_drvinfo#define ethtool_drvinfo k_ethtool_drvinfostruct k_ethtool_drvinfo {	uint32_t cmd;	char	 driver[32];	char	 version[32];	char	 fw_version[32];	char	 bus_info[32];	char	 reserved1[32];	char	 reserved2[16];	uint32_t n_stats;	uint32_t testinfo_len;	uint32_t eedump_len;	uint32_t regdump_len;};struct ethtool_stats {	uint32_t cmd;	uint32_t n_stats;	uint64_t data[0];};#ifndef ETHTOOL_PHYS_ID#define ETHTOOL_PHYS_ID 0x1c#ifndef ETHTOOL_GSTRINGS#define ETHTOOL_GSTRINGS 0x1benum ethtool_stringset {	ETH_SS_TEST             = 0,	ETH_SS_STATS,};struct 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 ETHTOOL_TEST#define ETHTOOL_TEST 0x1aenum ethtool_test_flags {	ETH_TEST_FL_OFFLINE	= (1 << 0),	ETH_TEST_FL_FAILED	= (1 << 1),};struct ethtool_test {	uint32_t cmd;	uint32_t flags;	uint32_t reserved;	uint32_t len;	uint64_t data[0];};#ifndef ETHTOOL_GEEPROM#define ETHTOOL_GEEPROM 0xb#undef ETHTOOL_GREGSstruct ethtool_eeprom {	uint32_t cmd;	uint32_t magic;	uint32_t offset;	uint32_t len;	uint8_t	 data[0];};struct ethtool_value {	uint32_t cmd;	uint32_t data;};#ifndef ETHTOOL_GLINK#define ETHTOOL_GLINK 0xa#endif /* Ethtool version without link support */#endif /* Ethtool version without eeprom support */#endif /* Ethtool version without test support */#endif /* Ethtool version without strings support */#endif /* Ethtool version wihtout adapter id support */#endif /* Ethtool version without statistics support */#ifndef ETHTOOL_GREGS#define ETHTOOL_GREGS		0x00000004 /* Get NIC registers */#define ethtool_regs _kc_ethtool_regs/* for passing big chunks of data */struct _kc_ethtool_regs {	u32	cmd;	u32	version; /* driver-specific, indicates different chips/revs */	u32	len; /* bytes */	u8	data[0];};#endif#ifndef ETHTOOL_GMSGLVL#define ETHTOOL_GMSGLVL		0x00000007 /* Get driver message level */#endif#ifndef ETHTOOL_SMSGLVL#define ETHTOOL_SMSGLVL		0x00000008 /* Set driver msg level, priv. */#endif#ifndef ETHTOOL_NWAY_RST#define ETHTOOL_NWAY_RST	0x00000009 /* Restart autonegotiation, priv */#endif#ifndef ETHTOOL_GLINK#define ETHTOOL_GLINK		0x0000000a /* Get link status */#endif#ifndef ETHTOOL_GEEPROM#define ETHTOOL_GEEPROM		0x0000000b /* Get EEPROM data */#endif#ifndef ETHTOOL_SEEPROM#define ETHTOOL_SEEPROM		0x0000000c /* Set EEPROM data */#endif#ifndef ETHTOOL_GCOALESCE#define ETHTOOL_GCOALESCE	0x0000000e /* Get coalesce config *//* for configuring coalescing parameters of chip */#define ethtool_coalesce _kc_ethtool_coalescestruct _kc_ethtool_coalesce {	u32	cmd;	/* ETHTOOL_{G,S}COALESCE */	/* How many usecs to delay an RX interrupt after	 * a packet arrives.  If 0, only rx_max_coalesced_frames	 * is used.	 */	u32	rx_coalesce_usecs;	/* How many packets to delay an RX interrupt after	 * a packet arrives.  If 0, only rx_coalesce_usecs is	 * used.  It is illegal to set both usecs and max frames	 * to zero as this would cause RX interrupts to never be	 * generated.	 */	u32	rx_max_coalesced_frames;	/* Same as above two parameters, except that these values	 * apply while an IRQ is being serviced by the host.  Not	 * all cards support this feature and the values are ignored	 * in that case.	 */	u32	rx_coalesce_usecs_irq;	u32	rx_max_coalesced_frames_irq;	/* How many usecs to delay a TX interrupt after	 * a packet is sent.  If 0, only tx_max_coalesced_frames	 * is used.	 */	u32	tx_coalesce_usecs;	/* How many packets to delay a TX interrupt after	 * a packet is sent.  If 0, only tx_coalesce_usecs is	 * used.  It is illegal to set both usecs and max frames	 * to zero as this would cause TX interrupts to never be	 * generated.	 */	u32	tx_max_coalesced_frames;	/* Same as above two parameters, except that these values	 * apply while an IRQ is being serviced by the host.  Not	 * all cards support this feature and the values are ignored	 * in that case.	 */	u32	tx_coalesce_usecs_irq;	u32	tx_max_coalesced_frames_irq;	/* How many usecs to delay in-memory statistics	 * block updates.  Some drivers do not have an in-memory	 * statistic block, and in such cases this value is ignored.	 * This value must not be zero.	 */	u32	stats_block_coalesce_usecs;	/* Adaptive RX/TX coalescing is an algorithm implemented by	 * some drivers to improve latency under low packet rates and	 * improve throughput under high packet rates.  Some drivers	 * only implement one of RX or TX adaptive coalescing.  Anything	 * not implemented by the driver causes these values to be	 * silently ignored.	 */	u32	use_adaptive_rx_coalesce;	u32	use_adaptive_tx_coalesce;	/* When the packet rate (measured in packets per second)	 * is below pkt_rate_low, the {rx,tx}_*_low parameters are	 * used.	 */	u32	pkt_rate_low;	u32	rx_coalesce_usecs_low;	u32	rx_max_coalesced_frames_low;	u32	tx_coalesce_usecs_low;	u32	tx_max_coalesced_frames_low;	/* When the packet rate is below pkt_rate_high but above	 * pkt_rate_low (both measured in packets per second) the	 * normal {rx,tx}_* coalescing parameters are used.	 */	/* When the packet rate is (measured in packets per second)	 * is above pkt_rate_high, the {rx,tx}_*_high parameters are	 * used.	 */	u32	pkt_rate_high;	u32	rx_coalesce_usecs_high;	u32	rx_max_coalesced_frames_high;	u32	tx_coalesce_usecs_high;	u32	tx_max_coalesced_frames_high;	/* How often to do adaptive coalescing packet rate sampling,	 * measured in seconds.  Must not be zero.	 */	u32	rate_sample_interval;};#endif#ifndef ETHTOOL_SCOALESCE#define ETHTOOL_SCOALESCE	0x0000000f /* Set coalesce config. */#endif#ifndef ETHTOOL_GRINGPARAM#define ETHTOOL_GRINGPARAM	0x00000010 /* Get ring parameters *//* for configuring RX/TX ring parameters */#define ethtool_ringparam _kc_ethtool_ringparamstruct _kc_ethtool_ringparam {	u32	cmd;	/* ETHTOOL_{G,S}RINGPARAM */	/* Read only attributes.  These indicate the maximum number	 * of pending RX/TX ring entries the driver will allow the	 * user to set.	 */	u32	rx_max_pending;	u32	rx_mini_max_pending;	u32	rx_jumbo_max_pending;	u32	tx_max_pending;	/* Values changeable by the user.  The valid values are	 * in the range 1 to the "*_max_pending" counterpart above.	 */	u32	rx_pending;	u32	rx_mini_pending;	u32	rx_jumbo_pending;	u32	tx_pending;};#endif#ifndef ETHTOOL_SRINGPARAM#define ETHTOOL_SRINGPARAM	0x00000011 /* Set ring parameters, priv. */#endif#ifndef ETHTOOL_GPAUSEPARAM#define ETHTOOL_GPAUSEPARAM	0x00000012 /* Get pause parameters *//* for configuring link flow control parameters */#define ethtool_pauseparam _kc_ethtool_pauseparamstruct _kc_ethtool_pauseparam {	u32	cmd;	/* ETHTOOL_{G,S}PAUSEPARAM */	/* If the link is being auto-negotiated (via ethtool_cmd.autoneg	 * being true) the user may set 'autonet' here non-zero to have the	 * pause parameters be auto-negotiated too.  In such a case, the	 * {rx,tx}_pause values below determine what capabilities are	 * advertised.	 *	 * If 'autoneg' is zero or the link is not being auto-negotiated,	 * then {rx,tx}_pause force the driver to use/not-use pause	 * flow control.	 */	u32	autoneg;	u32	rx_pause;	u32	tx_pause;};#endif#ifndef ETHTOOL_SPAUSEPARAM#define ETHTOOL_SPAUSEPARAM	0x00000013 /* Set pause parameters. */#endif#ifndef ETHTOOL_GRXCSUM#define ETHTOOL_GRXCSUM		0x00000014 /* Get RX hw csum enable (ethtool_value) */#endif#ifndef ETHTOOL_SRXCSUM#define ETHTOOL_SRXCSUM		0x00000015 /* Set RX hw csum enable (ethtool_value) */#endif#ifndef ETHTOOL_GTXCSUM#define ETHTOOL_GTXCSUM		0x00000016 /* Get TX hw csum enable (ethtool_value) */#endif#ifndef ETHTOOL_STXCSUM#define ETHTOOL_STXCSUM		0x00000017 /* Set TX hw csum enable (ethtool_value) */#endif#ifndef ETHTOOL_GSG#define ETHTOOL_GSG		0x00000018 /* Get scatter-gather enable					    * (ethtool_value) */#endif#ifndef ETHTOOL_SSG#define ETHTOOL_SSG		0x00000019 /* Set scatter-gather enable					    * (ethtool_value). */#endif#ifndef ETHTOOL_TEST#define ETHTOOL_TEST		0x0000001a /* execute NIC self-test, priv. */#endif#ifndef ETHTOOL_GSTRINGS#define ETHTOOL_GSTRINGS	0x0000001b /* get specified string set */#endif#ifndef ETHTOOL_PHYS_ID#define ETHTOOL_PHYS_ID		0x0000001c /* identify the NIC */#endif#ifndef ETHTOOL_GSTATS#define ETHTOOL_GSTATS		0x0000001d /* get NIC-specific statistics */#endif#ifndef ETHTOOL_GTSO#define ETHTOOL_GTSO		0x0000001e /* Get TSO enable (ethtool_value) */#endif#ifndef ETHTOOL_STSO#define ETHTOOL_STSO		0x0000001f /* Set TSO enable (ethtool_value) */#endif/* 2.4.0 => 2.2.0 */#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) )/**************************************//* MODULE API */#ifndef __init	#define __init#endif#ifndef __exit	#define __exit#endif#ifndef __devinit	#define __devinit#endif#ifndef __devexit	#define __devexit#endif#ifndef __devinitdata	#define __devinitdata#endif#ifndef module_init	#define module_init(f) int init_module() { return f(); }#endif#ifndef module_exit	#define module_exit(f) void cleanup_module() { return f(); }#endif#ifndef MODULE_DEVICE_TABLE	#define MODULE_DEVICE_TABLE(bus, table)#endif#ifndef SET_MODULE_OWNER	#define SET_MODULE_OWNER(X)#else	#undef MOD_INC_USE_COUNT	#undef MOD_DEC_USE_COUNT	#define MOD_INC_USE_COUNT	#define MOD_DEC_USE_COUNT#endif/**************************************//* PCI DRIVER API */#ifndef pci_device_id#define pci_device_id _kc_pci_device_idstruct _kc_pci_device_id {	unsigned int vendor, device;	unsigned int subvendor, subdevice;	unsigned int class, classmask;	unsigned long driver_data;};#endif#ifndef pci_driver#define pci_driver _kc_pci_driverstruct _kc_pci_driver {	char *name;	struct pci_device_id *id_table;	int (*probe)(struct pci_dev *dev, const struct pci_device_id *id);	void (*remove)(struct pci_dev *dev);	int (*save_state)(struct pci_dev *dev, u32 state);	int (*suspend)(struct pci_dev *dev, u32 state);	int (*resume)(struct pci_dev *dev);	int (*enable_wake)(struct pci_dev *dev, u32 state, int enable);};#endif#ifndef PCI_ANY_ID	#define PCI_ANY_ID (~0U)#endif#ifndef pci_module_init#define pci_module_init _kc_pci_module_initextern int _kc_pci_module_init(struct pci_driver *drv);#endif#ifndef pci_unregister_driver#define pci_unregister_driver _kc_pci_unregister_driverextern void _kc_pci_unregister_driver(struct pci_driver *drv);#endif#ifndef pci_set_drvdata#define pci_set_drvdata _kc_pci_set_drvdataextern void _kc_pci_set_drvdata(struct pci_dev *dev, void *data);#endif#ifndef pci_get_drvdata#define pci_get_drvdata _kc_pci_get_drvdataextern void * _kc_pci_get_drvdata(struct pci_dev *dev);#endif#ifndef pci_enable_device#define pci_enable_device _kc_pci_enable_deviceextern int _kc_pci_enable_device(struct pci_dev *dev);#endif#ifndef pci_resource_start#define pci_resource_start _kc_pci_resource_startextern int _kc_pci_resource_start(struct pci_dev *dev, int bar);#endif#ifndef pci_resource_len#define pci_resource_len _kc_pci_resource_lenextern unsigned long _kc_pci_resource_len(struct pci_dev *dev, int bar);#endif#undef IORESOURCE_IO#define IORESOURCE_IO PCI_BASE_ADDRESS_SPACE_IO#undef pci_resource_flags#define pci_resource_flags(dev, i) (dev->base_address[i] & IORESOURCE_IO)/**************************************//* PCI DMA MAPPING */#ifndef PCI_DMA_TODEVICE	#define PCI_DMA_TODEVICE 1#endif#ifndef PCI_DMA_FROMDEVICE	#define PCI_DMA_FROMDEVICE 2#endif#ifndef dma_addr_t#define dma_addr_t _kc_dma_addr_ttypedef u64 _kc_dma_addr_t;#endif#ifndef pci_alloc_consistent#define pci_alloc_consistent _kc_pci_alloc_consistentextern void * _kc_pci_alloc_consistent(struct pci_dev *dev, size_t size, u64 *dma_handle);#endif#ifndef pci_free_consistent#define pci_free_consistent _kc_pci_free_consistentextern void _kc_pci_free_consistent(struct pci_dev *dev, size_t size, void *vaddr, u64 dma_handle);#endif#ifndef pci_map_single#define pci_map_single _kc_pci_map_singleextern u64 _kc_pci_map_single(struct pci_dev *dev, void *addr, size_t size, int direction);#endif#ifndef pci_unmap_single#define pci_unmap_single _kc_pci_unmap_singleextern void _kc_pci_unmap_single(struct pci_dev *dev, u64 dma_addr, size_t size, int direction);#endif#ifndef pci_dma_sync_single#define pci_dma_sync_single _kc_pci_dma_sync_singleextern void _kc_pci_dma_sync_single(struct pci_dev *dev, u64 dma_addr, size_t size, int direction);#endif/**************************************//* NETWORK DRIVER API */#ifndef net_device	#define net_device device#endif#ifndef dev_kfree_skb_irq	#define dev_kfree_skb_irq dev_kfree_skb#endif#ifndef dev_kfree_skb_any	#define dev_kfree_skb_any dev_kfree_skb#endif#ifndef netif_running	#define netif_running(dev) (!!(int)(dev->flags & IFF_RUNNING))#endif#ifndef netif_start_queue	#define netif_start_queue(dev) clear_bit(0, &dev->tbusy)#endif#ifndef netif_stop_queue	#define netif_stop_queue(dev) set_bit(0, &dev->tbusy)#endif#ifndef netif_wake_queue	#define netif_wake_queue(dev) do { clear_bit(0, &dev->tbusy); \		                           mark_bh(NET_BH); } while(0)#endif#ifndef netif_queue_stopped	#define netif_queue_stopped(dev) (dev->tbusy)#endif#ifndef netif_device_attach#define netif_device_attach _kc_netif_device_attachextern void _kc_netif_device_attach(struct net_device *dev);

⌨️ 快捷键说明

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