Some adm5120-hcd cleanups
[openwrt.git] / target / linux / rb532-2.6 / patches / 240-via_rhine_performance.patch
1 diff -ur linux.old/drivers/net/via-rhine.c linux.dev/drivers/net/via-rhine.c
2 --- linux.old/drivers/net/via-rhine.c 2006-11-29 22:57:37.000000000 +0100
3 +++ linux.dev/drivers/net/via-rhine.c 2006-12-14 03:39:01.000000000 +0100
4 @@ -33,6 +33,7 @@
5 #define DRV_VERSION "1.4.3"
6 #define DRV_RELDATE "2007-03-06"
7
8 +#define PKT_ALIGN 1
9
10 /* A few user-configurable values.
11 These may be modified when a driver module is loaded. */
12 @@ -40,9 +41,11 @@
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 static int rx_copybreak;
20 +#endif
21
22 /* Work-around for broken BIOSes: they are unable to get the chip back out of
23 power state D3 so PXE booting fails. bootparam(7): via-rhine.avoid_D3=1 */
24 @@ -105,6 +108,7 @@
25 #include <asm/io.h>
26 #include <asm/irq.h>
27 #include <asm/uaccess.h>
28 +#include <asm/unaligned.h>
29 #include <linux/dmi.h>
30
31 /* These identify the driver base version and may not be removed. */
32 @@ -124,12 +128,14 @@
33
34 module_param(max_interrupt_work, int, 0);
35 module_param(debug, int, 0);
36 -module_param(rx_copybreak, int, 0);
37 module_param(avoid_D3, bool, 0);
38 MODULE_PARM_DESC(max_interrupt_work, "VIA Rhine maximum events handled per interrupt");
39 MODULE_PARM_DESC(debug, "VIA Rhine debug level (0-7)");
40 -MODULE_PARM_DESC(rx_copybreak, "VIA Rhine copy breakpoint for copy-only-tiny-frames");
41 MODULE_PARM_DESC(avoid_D3, "Avoid power state D3 (work-around for broken BIOSes)");
42 +#ifndef PKT_ALIGN
43 +module_param(rx_copybreak, int, 0);
44 +MODULE_PARM_DESC(rx_copybreak, "VIA Rhine copy breakpoint for copy-only-tiny-frames");
45 +#endif
46
47 /*
48 Theory of Operation
49 @@ -924,7 +930,7 @@
50
51 /* Fill in the Rx buffers. Handle allocation failure gracefully. */
52 for (i = 0; i < RX_RING_SIZE; i++) {
53 - struct sk_buff *skb = dev_alloc_skb(rp->rx_buf_sz);
54 + struct sk_buff *skb = dev_alloc_skb(rp->rx_buf_sz + 4);
55 rp->rx_skbuff[i] = skb;
56 if (skb == NULL)
57 break;
58 @@ -1482,6 +1488,9 @@
59 /* Length should omit the CRC */
60 int pkt_len = data_size - 4;
61
62 +#ifdef PKT_ALIGN
63 + int i;
64 +#else
65 /* Check if the packet is long enough to accept without
66 copying to a minimally-sized skbuff. */
67 if (pkt_len < rx_copybreak &&
68 @@ -1501,7 +1510,9 @@
69 rp->rx_skbuff_dma[entry],
70 rp->rx_buf_sz,
71 PCI_DMA_FROMDEVICE);
72 - } else {
73 + } else
74 +#endif
75 + {
76 skb = rp->rx_skbuff[entry];
77 if (skb == NULL) {
78 printk(KERN_ERR "%s: Inconsistent Rx "
79 @@ -1515,6 +1526,14 @@
80 rp->rx_skbuff_dma[entry],
81 rp->rx_buf_sz,
82 PCI_DMA_FROMDEVICE);
83 +#ifdef PKT_ALIGN
84 + /* align the data to the ip header - should be faster than copying the entire packet */
85 + for (i = pkt_len - (pkt_len % 4); i >= 0; i -= 4) {
86 + put_unaligned(*((u32 *) (skb->data + i)), (u32 *) (skb->data + i + 2));
87 + }
88 + skb->data += 2;
89 + skb->tail += 2;
90 +#endif
91 }
92 skb->protocol = eth_type_trans(skb, dev);
93 #ifdef CONFIG_VIA_RHINE_NAPI
94
This page took 0.056967 seconds and 5 git commands to generate.