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

Ben Greear greearb at candelatech.com
Fri Mar 7 10:03:48 PST 2008

Pavlin Radoslavov wrote:
> Ben Greear <greearb at candelatech.com> wrote:
>> 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);
>>      }
> The interface cache should be internal to IfTree and we don't want
> to manipulate it outside IfTree.

The problem for me was that when the iface was added to the
tree, it didn't have it's index set.  But, with some refactoring,
that could be resolved.

Also, with my patch, I was not catching whatever code adds ifaces
to the tree that the fea rx packet logic searches.  I had the
linear search to back it up and fix up the hash, but it would of
course be best to figure out how those interfaces were being added
and update the cache immediately.

> I started working on that, but it turned out to be more complicated
> than I originally anticipated.
> Hopefully very soon I will have it finished.
>> 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.
> Yes. The vlan vifs have their own pif_index. If they are attached to
> the parent (physical) interface, then the pif_index of the interface
> and the vif are different.

Ok, you'll probably need two hashes as I had in my original
patch:  one to search for IFs, and another to search for the VIFs (or,
iface by vif-index and then hash the iface lookup of a VIF as well).

> I will let you know when I am done with the patch and will ask you
> to test it.

Sounds good.  I am running into OSPF issues where not all of the
routers get to 'Full' state.  I'm not sure if this is related to my
patches or not, and it's a slow slog to debug this...hopefully
I'll make some progress today.

 From what I have been able to test, it seems the hashing
is more important for performance than the per-interface
sockets, btw.


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

More information about the Xorp-hackers mailing list