* [PATCH] Micro optimization in eth_header()
@ 2005-06-22 8:31 Denis Vlasenko
0 siblings, 0 replies; only message in thread
From: Denis Vlasenko @ 2005-06-22 8:31 UTC (permalink / raw)
To: davem; +Cc: netdev
[-- Attachment #1: Type: text/plain, Size: 28 bytes --]
Compile tested only.
--
vda
[-- Attachment #2: eth.c.diff --]
[-- Type: text/x-diff, Size: 2557 bytes --]
Micro optimization in eth_header().
Changes in asm code (new on the right):
...
50: shl $0x8,%edx 50: shl $0x8,%edx
53: shr $0x8,%eax 53: shr $0x8,%eax
56: or %eax,%edx 56: or %eax,%edx
58: mov %dx,0xc(%ebx) + 58: test %esi,%esi
5c: mov 0xc(%ebp),%edx + 5a: mov %dx,0xc(%ebx)
5f: test %esi,%esi + 5e: jne 69 <eth_header+0x69>
61: mov 0xb0(%edx),%al + 60: mov 0xc(%ebp),%esi
67: je 71 <eth_header+0x71> + 63: add $0x90,%esi
69: movzbl %al,%eax + 69: mov 0xc(%ebp),%edx
6c: lea 0x6(%ebx),%edi + 6c: movzbl 0xb0(%edx),%eax
6f: jmp 80 <eth_header+0x80> + 73: mov %eax,%ecx
71: mov 0xc(%ebp),%edx + 75: lea 0x6(%ebx),%edi
74: movzbl %al,%eax + 78: shr $0x2,%ecx
77: lea 0x6(%ebx),%edi + 7b: repz movsl %ds:(%esi),%es:(%edi)
7a: lea 0x90(%edx),%esi + 7d: mov %eax,%ecx
80: mov %eax,%ecx + 7f: and $0x3,%ecx
82: shr $0x2,%ecx + 82: je 86 <eth_header+0x86>
85: repz movsl %ds:(%esi),%es:(%edi) + 84: repz movsb %ds:(%esi),%es:(%edi)
87: mov %eax,%ecx + 86: testb $0x88,0x58(%edx)
89: and $0x3,%ecx + 8a: je b1 <eth_header+0xb1>
8c: je 90 <eth_header+0x90> + 8c: movzbl 0xb0(%edx),%esi
8e: repz movsb %ds:(%esi),%es:(%edi) + 93: mov %esi,%ecx
90: mov 0xc(%ebp),%eax + 95: shr $0x2,%ecx
93: testb $0x88,0x58(%eax) + 98: mov %ebx,%edi
97: je bc <eth_header+0xbc> + 9a: xor %eax,%eax
99: movzbl 0xb0(%eax),%edx + 9c: mov %esi,%edx
a0: mov %edx,%ecx + 9e: repz stos %eax,%es:(%edi)
a2: xor %eax,%eax
a4: shr $0x2,%ecx
a7: mov %ebx,%edi
a9: repz stos %eax,%es:(%edi)
..
--- linux-2.6.12-rc2.src/net/ethernet/eth.c.orig Thu Mar 3 09:31:21 2005
+++ linux-2.6.12-rc2.src/net/ethernet/eth.c Wed Jun 22 11:13:54 2005
@@ -92,10 +92,9 @@ int eth_header(struct sk_buff *skb, stru
* Set the source hardware address.
*/
- if(saddr)
- memcpy(eth->h_source,saddr,dev->addr_len);
- else
- memcpy(eth->h_source,dev->dev_addr,dev->addr_len);
+ if(!saddr)
+ saddr = dev->dev_addr;
+ memcpy(eth->h_source,saddr,dev->addr_len);
/*
* Anyway, the loopback-device should never use this function...
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-06-22 8:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-22 8:31 [PATCH] Micro optimization in eth_header() Denis Vlasenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).