ath9k: optimize waking tx queues, slightly improves performance under load
[openwrt.git] / package / mac80211 / patches / 606-rt2x00_no_realign.patch
1 [RFC] rt2x00: For drivers that only need L2 padding don't realign frames
2
3 Signed-off-by: Helmut Schaa <helmut.schaa@...>
4 ---
5
6 Ivo, Gertjan, do you remeber by any chance why this alignment stuff was added
7 in the first place? Was it because of DMA restrictions?
8
9 While doing some profiling on the rt3052 SoC I noticed that 30-40% time was
10 spent in memmove calls. And the culprit is the memmove aligning the payload
11 to a 4byte boundary since that has to move a whole bunch of data.
12
13 Interesstingly the legacy drivers insert an l2pad between the header and the
14 payload but doesn't realign the payload itself to a 4-byte boundary. Hence,
15 I came up with this patch and indeed CPU usage improves impressively.
16
17 Only tested on rt2800pci!
18
19 Thanks,
20 Helmut
21
22 drivers/net/wireless/rt2x00/rt2x00queue.c | 30 +++-------------------------
23 1 files changed, 4 insertions(+), 26 deletions(-)
24
25 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c
26 +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
27 @@ -151,36 +151,14 @@ void rt2x00queue_align_frame(struct sk_b
28 void rt2x00queue_insert_l2pad(struct sk_buff *skb, unsigned int header_length)
29 {
30 unsigned int payload_length = skb->len - header_length;
31 - unsigned int header_align = ALIGN_SIZE(skb, 0);
32 - unsigned int payload_align = ALIGN_SIZE(skb, header_length);
33 unsigned int l2pad = payload_length ? L2PAD_SIZE(header_length) : 0;
34
35 - /*
36 - * Adjust the header alignment if the payload needs to be moved more
37 - * than the header.
38 - */
39 - if (payload_align > header_align)
40 - header_align += 4;
41 -
42 - /* There is nothing to do if no alignment is needed */
43 - if (!header_align)
44 + if (!l2pad)
45 return;
46
47 - /* Reserve the amount of space needed in front of the frame */
48 - skb_push(skb, header_align);
49 -
50 - /*
51 - * Move the header.
52 - */
53 - memmove(skb->data, skb->data + header_align, header_length);
54 -
55 - /* Move the payload, if present and if required */
56 - if (payload_length && payload_align)
57 - memmove(skb->data + header_length + l2pad,
58 - skb->data + header_length + l2pad + payload_align,
59 - payload_length);
60 -
61 - /* Trim the skb to the correct size */
62 + /* insert l2pad -> Move header */
63 + skb_push(skb, l2pad);
64 + memmove(skb->data, skb->data + l2pad, header_length);
65 skb_trim(skb, header_length + l2pad + payload_length);
66 }
67
This page took 0.05206 seconds and 5 git commands to generate.