bgpd: Reduce size of ibuf_work ringbuf

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 fe1c72a573)
This commit is contained in:
Donald Sharp 2023-07-24 10:33:21 -04:00 committed by Mergify
parent e0d98cbb88
commit 91e95112e8

View File

@ -1414,7 +1414,7 @@ struct peer *peer_new(struct bgp *bgp)
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");