-#if LINUX_VERSION_CODE < 0x2051e
-#define local_irq_save(flags) do{__save_flags(flags) ; \
- __cli();} while(0)
-#define local_irq_restore(flags) __restore_flags(flags)
-#endif
-
-#if (LINUX_VERSION_CODE < 0x02030d)
-#define pci_resource_start(dev, bar) dev->base_address[bar]
-#elif (LINUX_VERSION_CODE < 0x02032c)
-#define pci_resource_start(dev, bar) dev->resource[bar].start
-#endif
-
-#if (LINUX_VERSION_CODE < 0x02030e)
-#define net_device device
-#endif
-
-
-#if (LINUX_VERSION_CODE < 0x02032a)
-typedef u32 dma_addr_t;
-
-static inline void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
- dma_addr_t *dma_handle)
-{
- void *virt_ptr;
-
- virt_ptr = kmalloc(size, GFP_KERNEL);
- if (!virt_ptr)
- return NULL;
- *dma_handle = virt_to_bus(virt_ptr);
- return virt_ptr;
-}
-
-#define pci_free_consistent(cookie, size, ptr, dma_ptr) kfree(ptr)
-#define pci_map_page(cookie, page, off, size, dir) \
- virt_to_bus(page_address(page)+(off))
-#define pci_unmap_page(cookie, address, size, dir)
-#define pci_set_dma_mask(dev, mask) \
- (((u64)(mask) & 0xffffffff00000000) == 0 ? 0 : -EIO)
-#define pci_dma_supported(dev, mask) \
- (((u64)(mask) & 0xffffffff00000000) == 0 ? 1 : 0)
-
-#elif (LINUX_VERSION_CODE < 0x02040d)
-
-/*
- * 2.4.13 introduced pci_map_page()/pci_unmap_page() - for 2.4.12 and prior,
- * fall back on pci_map_single()/pci_unnmap_single().
- *
- * We are guaranteed that the page is mapped at this point since
- * pci_map_page() is only used upon valid struct skb's.
- */
-static inline dma_addr_t
-pci_map_page(struct pci_dev *cookie, struct page *page, unsigned long off,
- size_t size, int dir)
-{
- void *page_virt;
-
- page_virt = page_address(page);
- if (!page_virt)
- BUG();
- return pci_map_single(cookie, (page_virt + off), size, dir);
-}
-#define pci_unmap_page(cookie, dma_addr, size, dir) \
- pci_unmap_single(cookie, dma_addr, size, dir)
-#endif
-
-#if (LINUX_VERSION_CODE < 0x020412)
-#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
-#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
-#define pci_unmap_addr(PTR, ADDR_NAME) 0
-#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do{} while(0)
-#define pci_unmap_len(PTR, LEN_NAME) 0
-#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do{} while(0)
-#endif
-
-
-#if (LINUX_VERSION_CODE < 0x02032b)
-/*
- * SoftNet
- *
- * For pre-softnet kernels we need to tell the upper layer not to
- * re-enter start_xmit() while we are in there. However softnet
- * guarantees not to enter while we are in there so there is no need
- * to do the netif_stop_queue() dance unless the transmit queue really
- * gets stuck. This should also improve performance according to tests
- * done by Aman Singla.
- */
-#define dev_kfree_skb_irq(a) dev_kfree_skb(a)
-#define netif_wake_queue(dev) clear_bit(0, &dev->tbusy)
-#define netif_stop_queue(dev) set_bit(0, &dev->tbusy)
-#define late_stop_netif_stop_queue(dev) do{} while(0)
-#define early_stop_netif_stop_queue(dev) test_and_set_bit(0,&dev->tbusy)
-#define early_stop_netif_wake_queue(dev) netif_wake_queue(dev)
-
-static inline void netif_start_queue(struct net_device *dev)
-{
- dev->tbusy = 0;
- dev->interrupt = 0;
- dev->start = 1;
-}
-
-#define ace_mark_net_bh() mark_bh(NET_BH)
-#define netif_queue_stopped(dev) dev->tbusy
-#define netif_running(dev) dev->start
-#define ace_if_down(dev) do{dev->start = 0;} while(0)
-
-#define tasklet_struct tq_struct
-static inline void tasklet_schedule(struct tasklet_struct *tasklet)
-{
- queue_task(tasklet, &tq_immediate);
- mark_bh(IMMEDIATE_BH);
-}
-
-static inline void tasklet_init(struct tasklet_struct *tasklet,
- void (*func)(unsigned long),
- unsigned long data)
-{
- tasklet->next = NULL;
- tasklet->sync = 0;
- tasklet->routine = (void (*)(void *))func;
- tasklet->data = (void *)data;
-}
-#define tasklet_kill(tasklet) do{} while(0)
-#else
-#define late_stop_netif_stop_queue(dev) netif_stop_queue(dev)
-#define early_stop_netif_stop_queue(dev) 0
-#define early_stop_netif_wake_queue(dev) do{} while(0)
-#define ace_mark_net_bh() do{} while(0)
-#define ace_if_down(dev) do{} while(0)
-#endif
-
-#if (LINUX_VERSION_CODE >= 0x02031b)
-#define NEW_NETINIT
-#define ACE_PROBE_ARG void
-#else
-#define ACE_PROBE_ARG struct net_device *dev
-#endif
-
-#ifndef min_t
-#define min_t(type,a,b) (((a)<(b))?(a):(b))
-#endif
-
-#ifndef ARCH_HAS_PREFETCHW
-#ifndef prefetchw
-#define prefetchw(x) do{} while(0)
-#endif