OSPF performance/SPF calculations

Ondrej Zajicek santiago at crfreenet.org
Fri Apr 23 18:46:19 CEST 2010


On Fri, Apr 23, 2010 at 05:29:09PM +0200, Joakim Tjernlund wrote:
> > But you also need LSAs in host endianity when doing SPF calculation.
> > Although it would be probably possible to change SPF calculation to
> > use directly BE values it would be huge work and it is questionable
> > whether it wouldn't just move endianity swaps deeper in the code.
> 
> But how do you know when swap endian or not?
> It seems to me that swapping endian back and forth for some LSAs and not
> for others is more work.

In BIRD, we do net->host 4B endianity swap when receiving every LSA and
do host->net 4B endianity swap when transmitting every LSA.

If LSA contains for example 2x u16 fields, we have such field swapped
in structure declaration on little endian systems (see ospf.h for example
struct ospf_lsa_rt).

When we do some LSA processing (for example in SPF), we can assume that
everything is in host endianity.

> Meanwhile, perhaps you could add something like this so only LE CPU suffer:
> 

I would make some ifdefs to lsalib.c / lsalib.h to make htonlsah() (and others)
an empty operation on big endians.

-- 
Elen sila lumenn' omentielvo

Ondrej 'SanTiago' Zajicek (email: santiago at crfreenet.org)
OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
"To err is human -- to blame it on a computer is even more so."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20100423/e301cc12/attachment-0001.asc>


More information about the Bird-users mailing list