ia64/linux-2.6.18-xen.hg

view drivers/net/sfc/kernel_compat.c @ 847:ad4d307bf9ce

net sfc: Update sfc and sfc_resource driver to latest release

...and update sfc_netfront, sfc_netback, sfc_netutil for any API changes

sfc_netback: Fix asymmetric use of SFC buffer table alloc and free
sfc_netback: Clean up if no SFC accel device found
sfc_netback: Gracefully handle case where page grant fails
sfc_netback: Disable net acceleration if the physical link goes down
sfc_netfront: Less verbose error messages, more verbose counters for
rx discard errors
sfc_netfront: Gracefully handle case where SFC netfront fails during
initialisation

Signed-off-by: Kieran Mansley <kmansley@solarflare.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Mar 31 11:59:10 2009 +0100 (2009-03-31)
parents fc90e9b2c12b
children
line source
1 /****************************************************************************
2 * Driver for Solarflare network controllers
3 * (including support for SFE4001 10GBT NIC)
4 *
5 * Copyright 2005-2006: Fen Systems Ltd.
6 * Copyright 2006: Solarflare Communications Inc,
7 * 9501 Jeronimo Road, Suite 250,
8 * Irvine, CA 92618, USA
9 *
10 * Initially developed by Michael Brown <mbrown@fensystems.co.uk>
11 * Maintained by Solarflare Communications <linux-net-drivers@solarflare.com>
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License version 2 as published
15 * by the Free Software Foundation, incorporated herein by reference.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 ****************************************************************************
26 */
28 #include "net_driver.h"
29 #include <linux/mii.h>
30 #include <linux/ethtool.h>
31 #include <linux/random.h>
32 #include <linux/pci.h>
33 #include <linux/spinlock.h>
34 #include <linux/rtnetlink.h>
35 #include <linux/bootmem.h>
36 #include <asm/uaccess.h>
37 #include "gmii.h"
38 #include "ethtool.h"
40 /*
41 * Kernel backwards compatibility
42 *
43 * This file provides functionality missing from earlier kernels.
44 */
46 /**************************************************************************
47 *
48 * print_mac, from net/ethernet/eth.c in v2.6.24
49 *
50 **************************************************************************
51 *
52 */
53 char *print_mac(char *buf, const u8 *addr)
54 {
55 sprintf(buf, "%02x:%02x:%02x:%02x:%02x:%02x",
56 addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
57 return buf;
58 }
60 #ifdef EFX_NEED_CSUM_TCPUDP_NOFOLD
61 __wsum
62 csum_tcpudp_nofold (unsigned long saddr, unsigned long daddr,
63 unsigned short len, unsigned short proto, __wsum sum)
64 {
65 unsigned long result;
67 result = (__force u64)saddr + (__force u64)daddr +
68 (__force u64)sum + ((len + proto) << 8);
70 /* Fold down to 32-bits so we don't lose in the typedef-less network stack. */
71 /* 64 to 33 */
72 result = (result & 0xffffffff) + (result >> 32);
73 /* 33 to 32 */
74 result = (result & 0xffffffff) + (result >> 32);
75 return (__force __wsum)result;
77 }
78 #endif /* EFX_NEED_CSUM_TCPUDP_NOFOLD */