summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2017-03-27 19:47:23 +0000
committerQuentin Young <qlyoung@cumulusnetworks.com>2017-11-30 16:17:58 -0500
commit49507a6f6ae42e4e9b29e0b7e996d58d6eb4c477 (patch)
treed376648d5a82b7a14e7c337643c8af7271137405
parent2d4ee77490a1a0b93b5e6945af2210bb0836baa1 (diff)
bgpd: remove unused `struct thread` from peer
* Remove t_write * Remove t_keepalive These have been replaced by pthreads and are no longer needed. Since some code looks at these values to determine if the threads are scheduled, also add a new bitfield to store the same information. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
-rw-r--r--bgpd/bgp_keepalives.c3
-rw-r--r--bgpd/bgp_packet.c4
-rw-r--r--bgpd/bgp_vty.c8
-rw-r--r--bgpd/bgpd.h6
4 files changed, 17 insertions, 4 deletions
diff --git a/bgpd/bgp_keepalives.c b/bgpd/bgp_keepalives.c
index d142e31af1..4944e3ea23 100644
--- a/bgpd/bgp_keepalives.c
+++ b/bgpd/bgp_keepalives.c
@@ -215,6 +215,7 @@ void peer_keepalives_on(struct peer *peer)
pkat = pkat_new(peer);
listnode_add(peerlist, pkat);
peer_lock(peer);
+ SET_FLAG(peer->thread_flags, PEER_THREAD_KEEPALIVES_ON);
}
pthread_mutex_unlock(&peerlist_mtx);
peer_keepalives_wake();
@@ -233,6 +234,8 @@ void peer_keepalives_off(struct peer *peer)
list_delete_node(peerlist, ln);
peer_unlock(peer);
}
+
+ UNSET_FLAG(peer->thread_flags, PEER_THREAD_KEEPALIVES_ON);
}
pthread_mutex_unlock(&peerlist_mtx);
}
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index 6e80c41914..7d9d2426d0 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -2362,6 +2362,8 @@ void peer_writes_on(struct peer *peer)
peer_lock(peer);
listnode_add(plist, peer);
+
+ SET_FLAG(peer->thread_flags, PEER_THREAD_WRITES_ON);
}
pthread_mutex_unlock(&plist_mtx);
peer_writes_wake();
@@ -2382,6 +2384,8 @@ void peer_writes_off(struct peer *peer)
peer_unlock(peer);
break;
}
+
+ UNSET_FLAG(peer->thread_flags, PEER_THREAD_WRITES_ON);
}
pthread_mutex_unlock(&plist_mtx);
}
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 9159bc683d..af702ac853 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -9657,7 +9657,8 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, u_char use_json,
json_object_string_add(json_neigh, "readThread", "on");
else
json_object_string_add(json_neigh, "readThread", "off");
- if (p->t_write)
+
+ if (CHECK_FLAG(p->thread_flags, PEER_THREAD_WRITES_ON))
json_object_string_add(json_neigh, "writeThread", "on");
else
json_object_string_add(json_neigh, "writeThread",
@@ -9683,7 +9684,10 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, u_char use_json,
vty_out(vty, "Peer Authentication Enabled\n");
vty_out(vty, "Read thread: %s Write thread: %s\n",
- p->t_read ? "on" : "off", p->t_write ? "on" : "off");
+ p->t_read ? "on" : "off",
+ CHECK_FLAG(p->thread_flags, PEER_THREAD_WRITES_ON)
+ ? "on"
+ : "off");
}
if (p->notify.code == BGP_NOTIFY_OPEN_ERR
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index 2022d47ace..70a1d386c6 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -799,16 +799,18 @@ struct peer {
/* Threads. */
struct thread *t_read;
- struct thread *t_write;
struct thread *t_start;
struct thread *t_connect;
struct thread *t_holdtime;
- struct thread *t_keepalive;
struct thread *t_routeadv;
struct thread *t_pmax_restart;
struct thread *t_gr_restart;
struct thread *t_gr_stale;
+ /* Thread flags. */
+ u_int16_t thread_flags;
+#define PEER_THREAD_WRITES_ON (1 << 0)
+#define PEER_THREAD_KEEPALIVES_ON (1 << 1)
/* workqueues */
struct work_queue *clear_node_queue;