Add support for an in-memory routing table cache in order to improve performance when the routing table is retained in a file. The cache holds the most recently used routing table entries and so can eliminate some file access.

Squashed commit of the following:

    net/route:  Flush in cache when any entry is deleted from the routing table.  When a router matching an IP address is found, add the routing table entry to the cache.

    net/route:  Add utility functions to manage an in-memory cache to improve performance when use a file-based routing table.
This commit is contained in:
Gregory Nutt
2017-09-29 12:04:45 -06:00
parent 44d88abb83
commit ae78a925eb
13 changed files with 1180 additions and 52 deletions
+17
View File
@@ -51,6 +51,7 @@
#include <nuttx/net/ip.h>
#include "route/fileroute.h"
#include "route/cacheroute.h"
#include "route/route.h"
#if defined(CONFIG_ROUTE_IPv4_FILEROUTE) || defined(CONFIG_ROUTE_IPv6_FILEROUTE)
@@ -276,6 +277,14 @@ int net_delroute_ipv4(in_addr_t target, in_addr_t netmask)
goto errout_with_lock;
}
#ifdef CONFIG_ROUTE_IPv4_CACHEROUTE
/* We are committed to modifying the routing table. Flush the in-memory
* routing table cache.
*/
net_flushcache_ipv4();
#endif
/* Loop, copying each entry, to the previous entry thus removing the entry
* to be deleted.
*/
@@ -420,6 +429,14 @@ int net_delroute_ipv6(net_ipv6addr_t target, net_ipv6addr_t netmask)
goto errout_with_lock;
}
#ifdef CONFIG_ROUTE_IPv6_CACHEROUTE
/* We are committed to modifying the routing table. Flush the in-memory
* routing table cache.
*/
net_flushcache_ipv6();
#endif
/* Loop, copying each entry, to the previous entry thus removing the entry
* to be deleted.
*/