From 6d85b15bbb2fd3c263d5d4b402c88ff348af877b Mon Sep 17 00:00:00 2001 From: "Jorge Boncompte [DTI2]" Date: Mon, 7 May 2012 16:52:54 +0000 Subject: bgpd: remove calls to peer_sort() from fast-path peer_sort() it's called so much as to be annoying. In the assumption that the 'sort' of the peer doesn't change during an established session, I have changed all calls to peer_sort() in the 'fast-path' to only check the 'sort'. All the calls from the vty and such still recalculate the sort and store it in the peer. There's a lot of other calls to peer_sort() that could be changed but some maube tricky, someone more knowledgeable may try to reduce them. This hits peer_sort() from 5th out of the stadium^H^H list on a full internet table loading profiling session. Signed-off-by: Jorge Boncompte [DTI2] Signed-off-by: David Lamparter --- bgpd/bgpd.h | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'bgpd/bgpd.h') diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index d1e4f8e9..03a998b9 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -259,6 +259,16 @@ struct bgp_filter } usmap; }; +/* IBGP/EBGP identifier. We also have a CONFED peer, which is to say, + a peer who's AS is part of our Confederation. */ +typedef enum +{ + BGP_PEER_IBGP = 1, + BGP_PEER_EBGP, + BGP_PEER_INTERNAL, + BGP_PEER_CONFED, +} bgp_peer_sort_t; + /* BGP neighbor structure. */ struct peer { @@ -282,6 +292,8 @@ struct peer /* Peer's local AS number. */ as_t local_as; + bgp_peer_sort_t sort; + /* Peer's Change local AS number. */ as_t change_local_as; @@ -749,16 +761,6 @@ struct bgp_nlri /* Check AS path loop when we send NLRI. */ /* #define BGP_SEND_ASPATH_CHECK */ -/* IBGP/EBGP identifier. We also have a CONFED peer, which is to say, - a peer who's AS is part of our Confederation. */ -enum -{ - BGP_PEER_IBGP, - BGP_PEER_EBGP, - BGP_PEER_INTERNAL, - BGP_PEER_CONFED -}; - /* Flag for peer_clear_soft(). */ enum bgp_clear_type { @@ -833,7 +835,7 @@ extern struct peer *peer_lookup_with_open (union sockunion *, as_t, struct in_ad int *); extern struct peer *peer_lock (struct peer *); extern struct peer *peer_unlock (struct peer *); -extern int peer_sort (struct peer *peer); +extern bgp_peer_sort_t peer_sort (struct peer *peer); extern int peer_active (struct peer *); extern int peer_active_nego (struct peer *); extern struct peer *peer_create_accept (struct bgp *); -- cgit v1.2.1