[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
ODP: [lwip-devel] Fast ARP for a "mini" system
From: |
Małowidzki , Marek |
Subject: |
ODP: [lwip-devel] Fast ARP for a "mini" system |
Date: |
Wed, 14 Jan 2009 14:54:07 +0100 |
Dear Jacob,
thank you for your feedback.
> An Ethernet bridge maps MAC -> interface. I use a fixed size cache table
> with the number of entries a power of 2. To look up a MAC address I
> calculate two hash values: an initial entry number, and a stride. My
> lookup function is as follows: (C++, sorry)
C++ is OK :) I was thinking about a hash table but the implementation would be
more complex (this is an important factor as the IP stack is just one of
multiple development tasks for us). For example, if we wanted to implement
repeating ARP queries (and, freeing resources, i.e., buffered packets), we
would need to keep an additional list (of pending entries). Now, in case when
we have to remove an last-recent-used entry (the table is full), we would also
need to update somehow the ARP pending queries list (or, guard somehow against
the existing, obsolete entries).
Our device has just 2 interfaces, it is a kind of a simple router. We can
afford memory overhead for 2 ARP tables. The least significant byte of an IP
address would give us a "perfect hash" value - a unique one and of a value from
a known range, unlike MAC addresses in your example, which are far more complex
to handle. Our task is simpler here and thus the idea of using the simplest
data structure, an fixed-size array.
Marek
<<winmail.dat>>