mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-29 16:57:04 +00:00
isisd: remove refcount from the isis_nexthop structure
isisd implements an optimization that allows multiple routes to share the same nexthop (using a refcount) in order to save memory. Now that SR support is coming, however, it will be necessary to embed additional SR-related information inside the isis_nexthop structure. But this can only be done if the nexthops aren't shared among routes anymore. Removing this memory optimization should have minimal impact since the isis_nexthop structure is really small. On large networks with thousands of routes, the memory saving would be in the order of a few kilobytes. Not something we should be concerned about nowadays. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
This commit is contained in:
parent
9cd06cd7b9
commit
885e241337
@ -65,32 +65,18 @@ static struct isis_nexthop *isis_nexthop_create(int family, union g_addr *ip,
|
|||||||
{
|
{
|
||||||
struct isis_nexthop *nexthop;
|
struct isis_nexthop *nexthop;
|
||||||
|
|
||||||
nexthop = nexthoplookup(isis->nexthops, family, ip, ifindex);
|
|
||||||
if (nexthop) {
|
|
||||||
nexthop->lock++;
|
|
||||||
return nexthop;
|
|
||||||
}
|
|
||||||
|
|
||||||
nexthop = XCALLOC(MTYPE_ISIS_NEXTHOP, sizeof(struct isis_nexthop));
|
nexthop = XCALLOC(MTYPE_ISIS_NEXTHOP, sizeof(struct isis_nexthop));
|
||||||
|
|
||||||
nexthop->family = family;
|
nexthop->family = family;
|
||||||
nexthop->ifindex = ifindex;
|
nexthop->ifindex = ifindex;
|
||||||
nexthop->ip = *ip;
|
nexthop->ip = *ip;
|
||||||
listnode_add(isis->nexthops, nexthop);
|
|
||||||
nexthop->lock++;
|
|
||||||
|
|
||||||
return nexthop;
|
return nexthop;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void isis_nexthop_delete(struct isis_nexthop *nexthop)
|
static void isis_nexthop_delete(struct isis_nexthop *nexthop)
|
||||||
{
|
{
|
||||||
nexthop->lock--;
|
XFREE(MTYPE_ISIS_NEXTHOP, nexthop);
|
||||||
if (nexthop->lock == 0) {
|
|
||||||
listnode_delete(isis->nexthops, nexthop);
|
|
||||||
XFREE(MTYPE_ISIS_NEXTHOP, nexthop);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct isis_nexthop *nexthoplookup(struct list *nexthops, int family,
|
static struct isis_nexthop *nexthoplookup(struct list *nexthops, int family,
|
||||||
|
@ -31,7 +31,6 @@ struct isis_nexthop {
|
|||||||
ifindex_t ifindex;
|
ifindex_t ifindex;
|
||||||
int family;
|
int family;
|
||||||
union g_addr ip;
|
union g_addr ip;
|
||||||
unsigned int lock;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct isis_route_info {
|
struct isis_route_info {
|
||||||
|
@ -88,7 +88,6 @@ void isis_new(unsigned long process_id, vrf_id_t vrf_id)
|
|||||||
isis->area_list = list_new();
|
isis->area_list = list_new();
|
||||||
isis->init_circ_list = list_new();
|
isis->init_circ_list = list_new();
|
||||||
isis->uptime = time(NULL);
|
isis->uptime = time(NULL);
|
||||||
isis->nexthops = list_new();
|
|
||||||
dyn_cache_init();
|
dyn_cache_init();
|
||||||
/*
|
/*
|
||||||
* uncomment the next line for full debugs
|
* uncomment the next line for full debugs
|
||||||
|
@ -69,7 +69,6 @@ struct isis {
|
|||||||
uint32_t router_id; /* Router ID from zebra */
|
uint32_t router_id; /* Router ID from zebra */
|
||||||
struct list *area_list; /* list of IS-IS areas */
|
struct list *area_list; /* list of IS-IS areas */
|
||||||
struct list *init_circ_list;
|
struct list *init_circ_list;
|
||||||
struct list *nexthops; /* IP next hops from this IS */
|
|
||||||
uint8_t max_area_addrs; /* maximumAreaAdresses */
|
uint8_t max_area_addrs; /* maximumAreaAdresses */
|
||||||
struct area_addr *man_area_addrs; /* manualAreaAddresses */
|
struct area_addr *man_area_addrs; /* manualAreaAddresses */
|
||||||
uint32_t debugs; /* bitmap for debug */
|
uint32_t debugs; /* bitmap for debug */
|
||||||
|
Loading…
Reference in New Issue
Block a user