Vitezslav Samel <vitezslav(a)samel.cz> writes:
Kill aligned_buf micro-optimization: doing memmove() instead
of mis-aligned access to the packet is not-a-win.
Signed-off-by: Vitezslav Samel <vitezslav(a)samel.cz>
---
src/packet.c | 36 ++----------------------------------
1 files changed, 2 insertions(+), 34 deletions(-)
diff --git a/src/packet.c b/src/packet.c
index 4fd3934..290e2ba 100644
--- a/src/packet.c
+++ b/src/packet.c
@@ -58,26 +57,11 @@ static void adjustpacket(char *tpacket, struct sockaddr_ll
*fromaddr,
/* 0x8100 802.1Q VLAN Extended Header */
*packet = tpacket + VLAN_ETH_HLEN;
readlen -= VLAN_ETH_HLEN;
- /*
- * Move IP datagram into an aligned buffer.
- */
- memmove(aligned_buf, *packet,
- min(SNAPSHOT_LEN, *readlen));
remove #define SNAPSHOT_LEN too
@@ -189,8 +159,6 @@ int processpacket(char *tpacket, char **packet,
unsigned int *br,
unsigned short *linktype, struct filterstate *filter,
int match_opposite, char *ifname, char *ifptr)
{
- static char aligned_buf[ALIGNED_BUF_LEN];
ditto, #define ALIGNED_BUF_LEN
Better question is, is it faster with aligned buffer? How much? Could we
use __attribute__((aligned(<some-number>)))?
Incorporate these two small changes and than I will apply patch.
--
Nikola