X-Git-Url: http://bbs.cooldavid.org/git/?p=jme.git;a=blobdiff_plain;f=jme.h;h=9300dcae32bb4bddca0a35356a6756cf4dd183ba;hp=c7a4b19a6c8d58c1421b0b86a00dec88f34b1d58;hb=98ef18f11c5307de7b507746effc514f5f990f7c;hpb=0ede469cae20a61d6fdf59e7b1b7e81a26354016 diff --git a/jme.h b/jme.h index c7a4b19..9300dca 100644 --- a/jme.h +++ b/jme.h @@ -3,6 +3,7 @@ * * Copyright 2008 JMicron Technology Corporation * http://www.jmicron.com/ + * Copyright (c) 2009 - 2010 Guo-Fu Tseng * * Author: Guo-Fu Tseng * @@ -25,7 +26,7 @@ #define __JME_H_INCLUDED__ #define DRV_NAME "jme" -#define DRV_VERSION "1.0.5" +#define DRV_VERSION "1.0.7-jmmod" #define PFX DRV_NAME ": " #define PCI_DEVICE_ID_JMICRON_JMC250 0x0250 @@ -41,16 +42,27 @@ NETIF_MSG_TX_ERR | \ NETIF_MSG_HW) -#define jeprintk(pdev, fmt, args...) \ - printk(KERN_ERR PFX fmt, ## args) +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,23) +#define pr_err(fmt, arg...) \ + printk(KERN_ERR fmt, ##arg) +#endif +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,33) +#define netdev_err(netdev, fmt, arg...) \ + pr_err(fmt, ##arg) +#endif #ifdef TX_DEBUG -#define tx_dbg(priv, fmt, args...) \ - printk(KERN_DEBUG "%s: " fmt, (priv)->dev->name, ## args) +#define tx_dbg(priv, fmt, args...) \ + printk(KERN_DEBUG "%s: " fmt, (priv)->dev->name, ##args) #else -#define tx_dbg(priv, fmt, args...) +#define tx_dbg(priv, fmt, args...) \ +do { \ + if (0) \ + printk(KERN_DEBUG "%s: " fmt, (priv)->dev->name, ##args); \ +} while (0) #endif +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,33) #define jme_msg(msglvl, type, priv, fmt, args...) \ if (netif_msg_##type(priv)) \ printk(msglvl "%s: " fmt, (priv)->dev->name, ## args) @@ -82,6 +94,19 @@ #define msg_hw(priv, fmt, args...) \ jme_msg(KERN_ERR, hw, priv, fmt, ## args) +#define netif_info(priv, type, dev, fmt, args...) \ + msg_ ## type(priv, fmt, ## args) +#define netif_err(priv, type, dev, fmt, args...) \ + msg_ ## type(priv, fmt, ## args) +#endif + +#ifndef NETIF_F_TSO6 +#define NETIF_F_TSO6 0 +#endif +#ifndef NETIF_F_IPV6_CSUM +#define NETIF_F_IPV6_CSUM 0 +#endif + /* * Extra PCI Configuration space interface */ @@ -386,7 +411,6 @@ struct jme_ring { atomic_t nr_free; }; -#include #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,18) #define false 0 #define true 0 @@ -405,6 +429,23 @@ struct jme_ring { #define NETDEV_GET_STATS(netdev, fun_ptr) \ netdev->get_stats = fun_ptr #define DECLARE_NET_DEVICE_STATS struct net_device_stats stats; +/* + * CentOS 5.5 have *_hdr helpers back-ported + */ +#ifdef RHEL_RELEASE_CODE +#if RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(5,5) +#define __DEFINE_IPHDR_HELPERS__ +#endif +#else +#define __DEFINE_IPHDR_HELPERS__ +#endif +#else +#define NET_STAT(priv) (priv->dev->stats) +#define NETDEV_GET_STATS(netdev, fun_ptr) +#define DECLARE_NET_DEVICE_STATS +#endif + +#ifdef __DEFINE_IPHDR_HELPERS__ static inline struct iphdr *ip_hdr(const struct sk_buff *skb) { return skb->nh.iph; @@ -419,10 +460,6 @@ static inline struct tcphdr *tcp_hdr(const struct sk_buff *skb) { return skb->h.th; } -#else -#define NET_STAT(priv) (priv->dev->stats) -#define NETDEV_GET_STATS(netdev, fun_ptr) -#define DECLARE_NET_DEVICE_STATS #endif #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,23) @@ -495,8 +532,10 @@ struct jme_adapter { u32 rx_ring_mask; u8 mrrs; unsigned int fpgaver; - unsigned int chiprev; - u8 rev; + u8 chiprev; + u8 chip_main_rev; + u8 chip_sub_rev; + u8 pcirev; u32 msg_enable; struct ethtool_cmd old_ecmd; unsigned int old_mtu; @@ -1287,7 +1326,7 @@ enum jme_phy_reg17_vals { /* * Workaround */ -static inline int is_buggy250(unsigned short device, unsigned int chiprev) +static inline int is_buggy250(unsigned short device, u8 chiprev) { return device == PCI_DEVICE_ID_JMICRON_JMC250 && chiprev == 0x11; } @@ -1300,3 +1339,4 @@ static int jme_set_settings(struct net_device *netdev, static void jme_set_multi(struct net_device *netdev); #endif +