diff options
| author | Michael Brown | 2012-07-09 10:55:26 +0200 |
|---|---|---|
| committer | Michael Brown | 2012-07-09 11:08:38 +0200 |
| commit | 024247317d50ffc4c44dd041aae19ae23b72788e (patch) | |
| tree | c059ac8afb0a71f79ba3795b2ff2d954f70cd0ce /src/net | |
| parent | [malloc] Discard cached items less aggressively (diff) | |
| download | ipxe-024247317d50ffc4c44dd041aae19ae23b72788e.tar.gz ipxe-024247317d50ffc4c44dd041aae19ae23b72788e.tar.xz ipxe-024247317d50ffc4c44dd041aae19ae23b72788e.zip | |
[arp] Try to avoid discarding ARP cache entries
Discarding the active ARP cache entry in the middle of a download will
substantially disrupt the TCP stream. Try to minimise any such
disruption by treating ARP cache entries as expensive, and discarding
them only when nothing else is available to discard.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net')
| -rw-r--r-- | src/net/arp.c | 9 | ||||
| -rw-r--r-- | src/net/tcp.c | 2 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/net/arp.c b/src/net/arp.c index d6b4e731a..7cec73d5f 100644 --- a/src/net/arp.c +++ b/src/net/arp.c @@ -525,7 +525,12 @@ static unsigned int arp_discard ( void ) { return 0; } -/** ARP cache discarder */ -struct cache_discarder arp_cache_discarder __cache_discarder = { +/** ARP cache discarder + * + * ARP cache entries are deemed to have a high replacement cost, since + * flushing an active ARP cache entry midway through a TCP transfer + * will cause substantial disruption. + */ +struct cache_discarder arp_discarder __cache_discarder ( CACHE_EXPENSIVE ) = { .discard = arp_discard, }; diff --git a/src/net/tcp.c b/src/net/tcp.c index 7a1272605..e98d8b17d 100644 --- a/src/net/tcp.c +++ b/src/net/tcp.c @@ -1315,7 +1315,7 @@ static unsigned int tcp_discard ( void ) { } /** TCP cache discarder */ -struct cache_discarder tcp_cache_discarder __cache_discarder = { +struct cache_discarder tcp_discarder __cache_discarder ( CACHE_NORMAL ) = { .discard = tcp_discard, }; |
