OSPF performance/SPF calculations

Joakim Tjernlund joakim.tjernlund at transmode.se
Fri Apr 23 13:06:20 CEST 2010


>
> Ondrej Zajicek <santiago at crfreenet.org> wrote on 2010/04/23 12:01:29:
> >
> > On Fri, Apr 23, 2010 at 11:37:56AM +0200, Joakim Tjernlund wrote:
> > > > realloc() is used only for a persistent buffer to grow it sufficiently
> > > > large. So it is called only small number of times during the run of
> > > > the program and not in subsequent LSA originations. Therefore it is
> > > > not an issue.
> > >
> > > It would be better if you used the same (linear space) as you do
> > > for received LSA's. I guess the received LSA's has a MAX size?
> > > Then you could allocate space as big as the MAX received LSAs size,
> > > add data to it and, if you want to, realloc the the whole
> > > LSA to a smaller size.
> >
> > Received LSAs are copied from RX buffer to the space allocated for
> > them. Originated LSAs are prepared in the persistent buffer and then
> > copied to the space allocated for them. In both cases the final
> > space for the LSA is allocated once (not reallocated) for the final
> > size of the LSA.
>
> I must be missing something then(not surprising as I just started looking
> at BIRD). Why do you need the separate allocation for the body of the LSA then?
> Why not just adding entries to the allocated LSA header?

Ahh, I am starting to get a clue I think. It is the struct top_hash_entry
that has this separation of LSA header and body.
Would it be feasible to move struct ospf_lsa_header lsa into
void *lsa_body, that is, merge them into one so
there is just one struct ospf_lsa_header *lsa instead?

     Jocke




More information about the Bird-users mailing list