summaryrefslogtreecommitdiff
path: root/bgpd/bgpd.h
diff options
context:
space:
mode:
authorJorge Boncompte [DTI2] <jorge@dti2.net>2012-05-07 16:52:54 +0000
committerDavid Lamparter <equinox@opensourcerouting.org>2012-05-22 20:25:10 +0200
commit6d85b15bbb2fd3c263d5d4b402c88ff348af877b (patch)
treec8be5e782f4425840ee93e167eb8d7c1ed3f4e4c /bgpd/bgpd.h
parent14542f3edaa43113880e8bb69612c553f02bdf22 (diff)
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] <jorge@dti2.net> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'bgpd/bgpd.h')
-rw-r--r--bgpd/bgpd.h24
1 files changed, 13 insertions, 11 deletions
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 *);