Thread (3 messages) flat view 3 messages, 3 authors, 2012-07-07

Re: [PATCH net-next] asix: avoid copies in tx path

From: Ming Lei <hidden>
Date: 2012-07-06 01:16:35

On Thu, Jul 5, 2012 at 10:31 PM, Eric Dumazet [off-list ref] wrote:
From: Eric Dumazet <edumazet@google.com>

I noticed excess calls to skb_copy_expand() or memmove() in asix driver.

This driver needs to push 4 bytes in front of frame (packet_len)
and maybe add 4 bytes after the end (if padlen is 4)

So it should set needed_headroom & needed_tailroom to avoid
copies. But its not enough, because many packets are cloned
before entering asix_tx_fixup() and this driver use skb_cloned()
as a lazy way to check if it can push and put additional bytes in frame.

Avoid skb_copy_expand() expensive call, using following rules :

- We are allowed to push 4 bytes in headroom if skb_header_cloned()
  is false (and if we have 4 bytes of headroom)

- We are allowed to put 4 bytes at tail if skb_cloned()
  is false (and if we have 4 bytes of tailroom)

TCP packets for example are cloned, but skb_header_release()
was called in tcp stack, allowing us to use headroom for our needs.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Allan Chou <redacted>
Cc: Trond Wuellner <redacted>
Cc: Grant Grundler <redacted>
Cc: Paul Stewart <redacted>
Cc: Ming Lei <tom.leiming@gmail.com>
After testing the patch on beagle-xm with external DLINK DUB-E100 NIC,
the transmit performance is increased from ~75Mbps to ~91Mbps when
DEBUG_SLAB is enabled, follows the test command and result:

[root@root]#iperf -c 192.168.0.103 -w 131072 -t 10
------------------------------------------------------------
Client connecting to 192.168.0.103, TCP port 5001
TCP window size:   256 KByte (WARNING: requested   128 KByte)
------------------------------------------------------------
[  3] local 192.168.0.102 port 57888 connected with 192.168.0.103 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec    109 MBytes  91.6 Mbits/sec

Tested-by: Ming Lei <redacted>

Thanks,
--
Ming Lei
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help