1 /****************************************************************************
2 * Driver for Solarflare network controllers -
3 * resource management for Xen backend, OpenOnload, etc
4 * (including support for SFE4001 10GBT NIC)
6 * This file provides version-independent Linux kernel API for efhw library.
7 * Only kernels >=2.6.9 are supported.
9 * Copyright 2005-2007: Solarflare Communications Inc,
10 * 9501 Jeronimo Road, Suite 250,
11 * Irvine, CA 92618, USA
13 * Developed and maintained by Solarflare Communications:
14 * <linux-xen-drivers@solarflare.com>
15 * <onload-dev@solarflare.com>
17 * Certain parts of the driver were implemented by
18 * Alexandra Kossovsky <Alexandra.Kossovsky@oktetlabs.ru>
19 * OKTET Labs Ltd, Russia,
20 * http://oktetlabs.ru, <info@oktetlabs.ru>
21 * by request of Solarflare Communications
24 * This program is free software; you can redistribute it and/or modify it
25 * under the terms of the GNU General Public License version 2 as published
26 * by the Free Software Foundation, incorporated herein by reference.
28 * This program is distributed in the hope that it will be useful,
29 * but WITHOUT ANY WARRANTY; without even the implied warranty of
30 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31 * GNU General Public License for more details.
33 * You should have received a copy of the GNU General Public License
34 * along with this program; if not, write to the Free Software
35 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
36 ****************************************************************************
39 #ifndef __CI_EFHW_SYSDEP_LINUX_H__
40 #define __CI_EFHW_SYSDEP_LINUX_H__
42 #include <linux/version.h>
43 #include <linux/module.h>
44 #include <linux/spinlock.h>
45 #include <linux/delay.h>
46 #include <linux/if_ether.h>
48 #include <linux/netdevice.h> /* necessary for etherdevice.h on some kernels */
49 #include <linux/etherdevice.h>
51 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,21)
52 static inline int is_local_ether_addr(const u8 *addr)
54 return (0x02 & addr[0]);
58 typedef unsigned long irq_flags_t;
60 #define spin_lock_destroy(l_) do {} while (0)
62 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
63 #define HAS_NET_NAMESPACE
66 /* Funny, but linux has round_up for x86 only, defined in
67 * x86-specific header */
69 #define round_up(x, y) (((x) + (y) - 1) & ~((y)-1))
72 #endif /* __CI_EFHW_SYSDEP_LINUX_H__ */