[Xorp-hackers] heavy CPU use for xorp_fea on startup

Ben Greear greearb at candelatech.com
Wed Mar 5 10:15:56 PST 2008


Pavlin Radoslavov wrote:

> The ifname and the vifname cannot change, because they are the
> unique ID of an interface/vif. If they change, this will be

It may never actually happen in practice, but this code makes it look like it
might be possible...  Either way, since I update the hash here, it shouldn't
matter...

     // From ifconfig_parse_netlink-socket.cc, with my patch applied.

     //
     // Set the physical interface index for the interface
     //
     if (is_newlink || (if_index != ifp->pif_index())) {
	ifp->set_pif_index(if_index);
	iftree.updateIfCache(if_index, if_name);
     }


> translated into delete/add sequence to the the IfTree and that
> should take care of the ifindex update.
> The ifindex is also unique per interface/vif so there shouldn't be
> more than one interface/vif with the same ifindex (modulo ifindex of
> 0 which is invalid index).

A quick test of my patch this morning shows that it significantly improves
performance for my scenario...but I'm regressing to linear searches for
some VIF lookups.

I think I can simplify my code a bit, but I need to verify some things:

1)  Is there ever a case where a vif has a different pif_index than
   the parent device?  If not, I can remove the _vifindexes hash entirely
   and not worry about add/delete vif (only add_interface, delete_interface),
   since the lookup methods use pif_index and not the vif_index as far as
   I can tell.

2)  How is the _vif_index used?

Thanks,
Ben

-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



More information about the Xorp-hackers mailing list