struct peer *peer;
peer = EVENT_ARG(thread);
- assert(!CHECK_FLAG(peer->thread_flags, PEER_THREAD_READS_ON));
- assert(!CHECK_FLAG(peer->thread_flags, PEER_THREAD_WRITES_ON));
+ assert(!CHECK_FLAG(peer->connection.thread_flags,
+ PEER_THREAD_READS_ON));
+ assert(!CHECK_FLAG(peer->connection.thread_flags,
+ PEER_THREAD_WRITES_ON));
assert(!peer->connection.t_read);
assert(!peer->connection.t_write);
assert(!peer->connection.t_write);
assert(!peer->connection.t_read);
- assert(!CHECK_FLAG(peer->thread_flags, PEER_THREAD_WRITES_ON));
- assert(!CHECK_FLAG(peer->thread_flags, PEER_THREAD_READS_ON));
+ assert(!CHECK_FLAG(peer->connection.thread_flags,
+ PEER_THREAD_WRITES_ON));
+ assert(!CHECK_FLAG(peer->connection.thread_flags,
+ PEER_THREAD_READS_ON));
status = bgp_connect(peer);
switch (status) {
event_add_write(fpt->master, bgp_process_writes, connection,
connection->fd, &connection->t_write);
- SET_FLAG(peer->thread_flags, PEER_THREAD_WRITES_ON);
+ SET_FLAG(connection->thread_flags, PEER_THREAD_WRITES_ON);
}
void bgp_writes_off(struct peer_connection *connection)
event_cancel_async(fpt->master, &connection->t_write, NULL);
EVENT_OFF(peer->t_generate_updgrp_packets);
- UNSET_FLAG(peer->thread_flags, PEER_THREAD_WRITES_ON);
+ UNSET_FLAG(peer->connection.thread_flags, PEER_THREAD_WRITES_ON);
}
void bgp_reads_on(struct peer_connection *connection)
event_add_read(fpt->master, bgp_process_reads, connection,
connection->fd, &connection->t_read);
- SET_FLAG(peer->thread_flags, PEER_THREAD_READS_ON);
+ SET_FLAG(connection->thread_flags, PEER_THREAD_READS_ON);
}
void bgp_reads_off(struct peer_connection *connection)
EVENT_OFF(peer->t_process_packet);
EVENT_OFF(peer->t_process_packet_error);
- UNSET_FLAG(peer->thread_flags, PEER_THREAD_READS_ON);
+ UNSET_FLAG(connection->thread_flags, PEER_THREAD_READS_ON);
}
/* Thread internal functions ----------------------------------------------- */
/* BGP try to connect to the peer. */
int bgp_connect(struct peer *peer)
{
- assert(!CHECK_FLAG(peer->thread_flags, PEER_THREAD_WRITES_ON));
- assert(!CHECK_FLAG(peer->thread_flags, PEER_THREAD_READS_ON));
+ assert(!CHECK_FLAG(peer->connection.thread_flags,
+ PEER_THREAD_WRITES_ON));
+ assert(!CHECK_FLAG(peer->connection.thread_flags,
+ PEER_THREAD_READS_ON));
ifindex_t ifindex = 0;
if (peer->conf_if && BGP_PEER_SU_UNSPEC(peer)) {
else
json_object_string_add(json_neigh, "readThread", "off");
- if (CHECK_FLAG(p->thread_flags, PEER_THREAD_WRITES_ON))
+ if (CHECK_FLAG(p->connection.thread_flags,
+ PEER_THREAD_WRITES_ON))
json_object_string_add(json_neigh, "writeThread", "on");
else
json_object_string_add(json_neigh, "writeThread",
vty_out(vty, "Read thread: %s Write thread: %s FD used: %d\n",
p->connection.t_read ? "on" : "off",
- CHECK_FLAG(p->thread_flags, PEER_THREAD_WRITES_ON)
+ CHECK_FLAG(p->connection.thread_flags,
+ PEER_THREAD_WRITES_ON)
? "on"
: "off",
p->connection.fd);
event_cancel_event_ready(bm->master, peer);
FOREACH_AFI_SAFI (afi, safi)
EVENT_OFF(peer->t_revalidate_all[afi][safi]);
- assert(!CHECK_FLAG(peer->thread_flags, PEER_THREAD_WRITES_ON));
- assert(!CHECK_FLAG(peer->thread_flags, PEER_THREAD_READS_ON));
+ assert(!CHECK_FLAG(peer->connection.thread_flags,
+ PEER_THREAD_WRITES_ON));
+ assert(!CHECK_FLAG(peer->connection.thread_flags,
+ PEER_THREAD_READS_ON));
assert(!CHECK_FLAG(peer->thread_flags, PEER_THREAD_KEEPALIVES_ON));
if (CHECK_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT))
struct event *t_read;
struct event *t_write;
+
+ /* Thread flags */
+ _Atomic uint32_t thread_flags;
+#define PEER_THREAD_WRITES_ON (1U << 0)
+#define PEER_THREAD_READS_ON (1U << 1)
};
extern void bgp_peer_connection_buffers_free(struct peer_connection *connection);
/* Thread flags. */
_Atomic uint32_t thread_flags;
-#define PEER_THREAD_WRITES_ON (1U << 0)
-#define PEER_THREAD_READS_ON (1U << 1)
-#define PEER_THREAD_KEEPALIVES_ON (1U << 2)
-#define PEER_THREAD_SUBGRP_ADV_DELAY (1U << 3)
+#define PEER_THREAD_KEEPALIVES_ON (1U << 0)
+#define PEER_THREAD_SUBGRP_ADV_DELAY (1U << 1)
/* workqueues */
struct work_queue *clear_node_queue;