1 /*******************************************************************************
2 
3   Intel PRO/1000 Linux driver
4   Copyright(c) 1999 - 2006 Intel Corporation.
5 
6   This program is free software; you can redistribute it and/or modify it
7   under the terms and conditions of the GNU General Public License,
8   version 2, as published by the Free Software Foundation.
9 
10   This program is distributed in the hope it will be useful, but WITHOUT
11   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13   more details.
14 
15   You should have received a copy of the GNU General Public License along with
16   this program; if not, write to the Free Software Foundation, Inc.,
17   51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18 
19   The full GNU General Public License is included in this distribution in
20   the file called "COPYING".
21 
22   Contact Information:
23   Linux NICS <linux.nics@intel.com>
24   e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
25   Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
26 
27 *******************************************************************************/
28 
29 #include "kcompat.h"
30 
31 /*****************************************************************************/
32 #if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) )
_kc_skb_fill_page_desc(struct sk_buff * skb,int i,struct page * page,int off,int size)33 void _kc_skb_fill_page_desc(struct sk_buff *skb, int i, struct page *page, int off, int size)
34 {
35 	skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
36 	frag->page = page;
37 	frag->page_offset = off;
38 	frag->size = size;
39 	skb_shinfo(skb)->nr_frags = i + 1;
40 }
41 
42 #endif /* 2.6.0 => 2.4.6 */
43 
44 /*****************************************************************************/
45 #if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14) )
_kc_kzalloc(size_t size,int flags)46 void *_kc_kzalloc(size_t size, int flags)
47 {
48 	void *ret = kmalloc(size, flags);
49 	if (ret)
50 		memset(ret, 0, size);
51 	return ret;
52 }
53 #endif /* <= 2.6.13 */
54 
55 /*****************************************************************************/
56 #if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) )
_kc_netdev_alloc_skb(struct net_device * dev,unsigned int length)57 struct sk_buff *_kc_netdev_alloc_skb(struct net_device *dev,
58                                      unsigned int length)
59 {
60 	/* 16 == NET_PAD_SKB */
61 	struct sk_buff *skb;
62 	skb = alloc_skb(length + 16, GFP_ATOMIC);
63 	if (likely(skb != NULL)) {
64 		skb_reserve(skb, 16);
65 		skb->dev = dev;
66 	}
67 	return skb;
68 }
69 #endif /* <= 2.6.17 */
70