The ringbuf is 650k in size. This is obscenely large and
in practical experimentation FRR never even approaches
that size at all. Let's reduce this to 1.5 max packet sizes.
If a BGP_MAX_PACKET_SIZE packet is ever received having a bit
of extra space ensures that we can read at least 1 packet.
This also will significantly reduce memory usage when the
operator has a lot of peers.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit
fe1c72a57315a7c9fc3c63dd2fbf3a10dafbc10b)
pthread_mutex_init(&peer->io_mtx, NULL);
peer->ibuf_work =
- ringbuf_new(BGP_MAX_PACKET_SIZE * BGP_READ_PACKET_MAX);
+ ringbuf_new(BGP_MAX_PACKET_SIZE + BGP_MAX_PACKET_SIZE/2);
/* Get service port number. */
sp = getservbyname("bgp", "tcp");