1 --- a/drivers/net/via-rhine.c
2 +++ b/drivers/net/via-rhine.c
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__) \
20 @@ -49,6 +52,7 @@ static int rx_copybreak = 1518;
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 */
28 @@ -111,6 +115,7 @@ static const int multicast_filter_limit
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. */
36 @@ -130,12 +135,14 @@ MODULE_LICENSE("GPL");
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");
53 @@ -922,7 +929,7 @@ static void alloc_rbufs(struct net_devic
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;
62 @@ -1485,7 +1492,9 @@ static int rhine_rx(struct net_device *d
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 &&
73 @@ -1504,7 +1513,9 @@ static int rhine_rx(struct net_device *d
74 rp->rx_skbuff_dma[entry],
81 skb = rp->rx_skbuff[entry];
83 printk(KERN_ERR "%s: Inconsistent Rx "
84 @@ -1518,6 +1529,14 @@ static int rhine_rx(struct net_device *d
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