bcm47xx: Remove FIXME
[openwrt.git] / target / linux / rb532 / patches / 240-via_rhine_performance.patch
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
3 @@ -33,6 +33,8 @@
4 #define DRV_VERSION "1.4.3"
5 #define DRV_RELDATE "2007-03-06"
6
7 +#define PKT_ALIGN 1
8 +
9
10 /* A few user-configurable values.
11 These may be modified when a driver module is loaded. */
12 @@ -40,6 +42,7 @@
13 static int debug = 1; /* 1 normal messages, 0 quiet .. 7 verbose. */
14 static int max_interrupt_work = 20;
15
16 +#ifndef PKT_ALIGN
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 @@
21 #else
22 static int rx_copybreak;
23 #endif
24 +#endif /* PKT_ALIGN */
25
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 @@
29 #include <asm/io.h>
30 #include <asm/irq.h>
31 #include <asm/uaccess.h>
32 +#include <asm/unaligned.h>
33 #include <linux/dmi.h>
34
35 /* These identify the driver base version and may not be removed. */
36 @@ -130,12 +135,14 @@
37
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)");
46 +#ifndef PKT_ALIGN
47 +module_param(rx_copybreak, int, 0);
48 +MODULE_PARM_DESC(rx_copybreak, "VIA Rhine copy breakpoint for copy-only-tiny-frames");
49 +#endif
50
51 /*
52 Theory of Operation
53 @@ -927,7 +934,7 @@
54
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;
60 if (skb == NULL)
61 break;
62 @@ -1484,7 +1491,9 @@
63 struct sk_buff *skb;
64 /* Length should omit the CRC */
65 int pkt_len = data_size - 4;
66 -
67 +#ifdef PKT_ALIGN
68 + int i;
69 +#else
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 @@ -1503,7 +1512,9 @@
74 rp->rx_skbuff_dma[entry],
75 rp->rx_buf_sz,
76 PCI_DMA_FROMDEVICE);
77 - } else {
78 + } else
79 +#endif
80 + {
81 skb = rp->rx_skbuff[entry];
82 if (skb == NULL) {
83 printk(KERN_ERR "%s: Inconsistent Rx "
84 @@ -1517,6 +1528,14 @@
85 rp->rx_skbuff_dma[entry],
86 rp->rx_buf_sz,
87 PCI_DMA_FROMDEVICE);
88 +#ifdef PKT_ALIGN
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));
92 + }
93 + skb->data += 2;
94 + skb->tail += 2;
95 +#endif
96 }
97 skb->protocol = eth_type_trans(skb, dev);
98 #ifdef CONFIG_VIA_RHINE_NAPI
This page took 0.076287 seconds and 5 git commands to generate.