diff options
author | Donatas Abraitis <donatas@opensourcerouting.org> | 2024-02-09 16:29:35 +0100 |
---|---|---|
committer | Donatas Abraitis <donatas@opensourcerouting.org> | 2024-02-09 16:29:35 +0100 |
commit | 4dccc31884b8540d6e553dc19145d4ea3dd97bb2 (patch) | |
tree | 678ae802a52bfdbc3d73a4c7e30d735dee4594e3 /bgpd | |
parent | bgpd: Optimize memory for bgp_nexthop_cache struct (diff) | |
download | frr-4dccc31884b8540d6e553dc19145d4ea3dd97bb2.tar.xz frr-4dccc31884b8540d6e553dc19145d4ea3dd97bb2.zip |
bgpd: Optimize memory for peer_connection struct
```
struct peer_connection {
struct peer * peer; /* 0 8 */
enum bgp_fsm_status status; /* 8 4 */
enum bgp_fsm_status ostatus; /* 12 4 */
int fd; /* 16 4 */
uint32_t thread_flags; /* 20 4 */
pthread_mutex_t io_mtx; /* 24 40 */
/* --- cacheline 1 boundary (64 bytes) --- */
struct stream_fifo * ibuf; /* 64 8 */
struct stream_fifo * obuf; /* 72 8 */
struct ringbuf * ibuf_work; /* 80 8 */
struct event * t_read; /* 88 8 */
struct event * t_write; /* 96 8 */
struct event * t_connect; /* 104 8 */
struct event * t_delayopen; /* 112 8 */
struct event * t_start; /* 120 8 */
/* --- cacheline 2 boundary (128 bytes) --- */
struct event * t_holdtime; /* 128 8 */
struct event * t_connect_check_r; /* 136 8 */
struct event * t_connect_check_w; /* 144 8 */
struct event * t_gr_restart; /* 152 8 */
struct event * t_gr_stale; /* 160 8 */
struct event * t_generate_updgrp_packets; /* 168 8 */
struct event * t_pmax_restart; /* 176 8 */
struct event * t_routeadv; /* 184 8 */
/* --- cacheline 3 boundary (192 bytes) --- */
struct event * t_process_packet; /* 192 8 */
struct event * t_process_packet_error; /* 200 8 */
union sockunion su; /* 208 128 */
/* size: 336, cachelines: 6, members: 25 */
/* last cacheline: 16 bytes */
}; /* saved 8 bytes! */
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'bgpd')
-rw-r--r-- | bgpd/bgpd.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index a0360525a..2c30385f6 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -1149,6 +1149,11 @@ struct peer_connection { int fd; + /* Thread flags */ + _Atomic uint32_t thread_flags; +#define PEER_THREAD_WRITES_ON (1U << 0) +#define PEER_THREAD_READS_ON (1U << 1) + /* Packet receive and send buffer. */ pthread_mutex_t io_mtx; // guards ibuf, obuf struct stream_fifo *ibuf; // packets waiting to be processed @@ -1179,11 +1184,6 @@ struct peer_connection { union sockunion su; #define BGP_CONNECTION_SU_UNSPEC(connection) \ (connection->su.sa.sa_family == AF_UNSPEC) - - /* Thread flags */ - _Atomic uint32_t thread_flags; -#define PEER_THREAD_WRITES_ON (1U << 0) -#define PEER_THREAD_READS_ON (1U << 1) }; extern struct peer_connection *bgp_peer_connection_new(struct peer *peer); extern void bgp_peer_connection_free(struct peer_connection **connection); |