1 --- linux-2.6.23.12/drivers/net/via-rhine.c 2007-12-18 22:55:57.000000000 +0100
2 +++ linux-2.6.23.12.new/drivers/net/via-rhine.c 2008-01-11 08:58:58.000000000 +0100
4 #define DRV_VERSION "1.4.3"
5 #define DRV_RELDATE "2007-03-06"
10 /* A few user-configurable values.
11 These may be modified when a driver module is loaded. */
13 static int debug = 1; /* 1 normal messages, 0 quiet .. 7 verbose. */
14 static int max_interrupt_work = 20;
17 /* Set the copy breakpoint for the copy-only-tiny-frames scheme.
18 Setting to > 1518 effectively disables this feature. */
19 #if defined(__alpha__) || defined(__arm__) || defined(__hppa__) \
22 static int rx_copybreak;
24 +#endif /* PKT_ALIGN */
26 /* Work-around for broken BIOSes: they are unable to get the chip back out of
27 power state D3 so PXE booting fails. bootparam(7): via-rhine.avoid_D3=1 */
31 #include <asm/uaccess.h>
32 +#include <asm/unaligned.h>
33 #include <linux/dmi.h>
35 /* These identify the driver base version and may not be removed. */
38 module_param(max_interrupt_work, int, 0);
39 module_param(debug, int, 0);
40 -module_param(rx_copybreak, int, 0);
41 module_param(avoid_D3, bool, 0);
42 MODULE_PARM_DESC(max_interrupt_work, "VIA Rhine maximum events handled per interrupt");
43 MODULE_PARM_DESC(debug, "VIA Rhine debug level (0-7)");
44 -MODULE_PARM_DESC(rx_copybreak, "VIA Rhine copy breakpoint for copy-only-tiny-frames");
45 MODULE_PARM_DESC(avoid_D3, "Avoid power state D3 (work-around for broken BIOSes)");
47 +module_param(rx_copybreak, int, 0);
48 +MODULE_PARM_DESC(rx_copybreak, "VIA Rhine copy breakpoint for copy-only-tiny-frames");
55 /* Fill in the Rx buffers. Handle allocation failure gracefully. */
56 for (i = 0; i < RX_RING_SIZE; i++) {
57 - struct sk_buff *skb = dev_alloc_skb(rp->rx_buf_sz);
58 + struct sk_buff *skb = dev_alloc_skb(rp->rx_buf_sz + 4);
59 rp->rx_skbuff[i] = skb;
64 /* Length should omit the CRC */
65 int pkt_len = data_size - 4;
70 /* Check if the packet is long enough to accept without
71 copying to a minimally-sized skbuff. */
72 if (pkt_len < rx_copybreak &&
74 rp->rx_skbuff_dma[entry],
81 skb = rp->rx_skbuff[entry];
83 printk(KERN_ERR "%s: Inconsistent Rx "
84 @@ -1517,6 +1528,14 @@
85 rp->rx_skbuff_dma[entry],
89 + /* align the data to the ip header - should be faster than copying the entire packet */
90 + for (i = pkt_len - (pkt_len % 4); i >= 0; i -= 4) {
91 + put_unaligned(*((u32 *) (skb->data + i)), (u32 *) (skb->data + i + 2));
97 skb->protocol = eth_type_trans(skb, dev);
98 #ifdef CONFIG_VIA_RHINE_NAPI