Nest: Keep route ordering during route updates
Put new non-best routes to the end of list instead of the second position. Put updated routes to their old position. Position is changed just by best route selection.
This commit is contained in:
parent
c26c6bc2d7
commit
c0e1f534c9
1 changed files with 12 additions and 6 deletions
|
@ -1133,6 +1133,9 @@ rte_recalculate(struct channel *c, net *net, rte *new, struct rte_src *src)
|
||||||
before_old = old;
|
before_old = old;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Save the last accessed position */
|
||||||
|
rte **pos = k;
|
||||||
|
|
||||||
if (!old)
|
if (!old)
|
||||||
before_old = NULL;
|
before_old = NULL;
|
||||||
|
|
||||||
|
@ -1229,6 +1232,7 @@ rte_recalculate(struct channel *c, net *net, rte *new, struct rte_src *src)
|
||||||
|
|
||||||
new->next = *k;
|
new->next = *k;
|
||||||
*k = new;
|
*k = new;
|
||||||
|
|
||||||
table->rt_count++;
|
table->rt_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1247,6 +1251,7 @@ rte_recalculate(struct channel *c, net *net, rte *new, struct rte_src *src)
|
||||||
|
|
||||||
new->next = net->routes;
|
new->next = net->routes;
|
||||||
net->routes = new;
|
net->routes = new;
|
||||||
|
|
||||||
table->rt_count++;
|
table->rt_count++;
|
||||||
}
|
}
|
||||||
else if (old == old_best)
|
else if (old == old_best)
|
||||||
|
@ -1261,8 +1266,9 @@ rte_recalculate(struct channel *c, net *net, rte *new, struct rte_src *src)
|
||||||
/* Add the new route to the list */
|
/* Add the new route to the list */
|
||||||
if (new)
|
if (new)
|
||||||
{
|
{
|
||||||
new->next = net->routes;
|
new->next = *pos;
|
||||||
net->routes = new;
|
*pos = new;
|
||||||
|
|
||||||
table->rt_count++;
|
table->rt_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1286,11 +1292,11 @@ rte_recalculate(struct channel *c, net *net, rte *new, struct rte_src *src)
|
||||||
/* The third case - the new route is not better than the old
|
/* The third case - the new route is not better than the old
|
||||||
best route (therefore old_best != NULL) and the old best
|
best route (therefore old_best != NULL) and the old best
|
||||||
route was not removed (therefore old_best == net->routes).
|
route was not removed (therefore old_best == net->routes).
|
||||||
We just link the new route after the old best route. */
|
We just link the new route to the old/last position. */
|
||||||
|
|
||||||
|
new->next = *pos;
|
||||||
|
*pos = new;
|
||||||
|
|
||||||
ASSERT(net->routes != NULL);
|
|
||||||
new->next = net->routes->next;
|
|
||||||
net->routes->next = new;
|
|
||||||
table->rt_count++;
|
table->rt_count++;
|
||||||
}
|
}
|
||||||
/* The fourth (empty) case - suboptimal route was removed, nothing to do */
|
/* The fourth (empty) case - suboptimal route was removed, nothing to do */
|
||||||
|
|
Loading…
Reference in a new issue