bgpd: Remove peer->obuf_work

This is never used.  Free up another 65k of stream data
never used per peer.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2023-07-21 12:23:23 -04:00
parent b157af0ac1
commit acf4defcd8
5 changed files with 0 additions and 28 deletions

View File

@ -1517,8 +1517,6 @@ enum bgp_fsm_state_progress bgp_stop(struct peer *peer)
if (peer->ibuf_work)
ringbuf_wipe(peer->ibuf_work);
if (peer->obuf_work)
stream_reset(peer->obuf_work);
if (peer->curr) {
stream_free(peer->curr);

View File

@ -1415,20 +1415,6 @@ struct peer *peer_new(struct bgp *bgp)
peer->obuf = stream_fifo_new();
pthread_mutex_init(&peer->io_mtx, NULL);
/* We use a larger buffer for peer->obuf_work in the event that:
* - We RX a BGP_UPDATE where the attributes alone are just
* under BGP_EXTENDED_MESSAGE_MAX_PACKET_SIZE.
* - The user configures an outbound route-map that does many as-path
* prepends or adds many communities. At most they can have
* CMD_ARGC_MAX args in a route-map so there is a finite limit on how
* large they can make the attributes.
*
* Having a buffer with BGP_MAX_PACKET_SIZE_OVERFLOW allows us to avoid
* bounds checking for every single attribute as we construct an
* UPDATE.
*/
peer->obuf_work =
stream_new(BGP_MAX_PACKET_SIZE + BGP_MAX_PACKET_SIZE_OVERFLOW);
peer->ibuf_work =
ringbuf_new(BGP_MAX_PACKET_SIZE * BGP_READ_PACKET_MAX);
@ -2622,11 +2608,6 @@ int peer_delete(struct peer *peer)
peer->ibuf_work = NULL;
}
if (peer->obuf_work) {
stream_free(peer->obuf_work);
peer->obuf_work = NULL;
}
/* Local and remote addresses. */
if (peer->su_local) {
sockunion_free(peer->su_local);

View File

@ -1167,7 +1167,6 @@ struct peer {
uint8_t ibuf_scratch[BGP_EXTENDED_MESSAGE_MAX_PACKET_SIZE
* BGP_READ_PACKET_MAX];
struct ringbuf *ibuf_work; // WiP buffer used by bgp_read() only
struct stream *obuf_work; // WiP buffer used to construct packets
struct stream *curr; // the current packet being parsed

View File

@ -1252,12 +1252,9 @@ static int rfapi_open_inner(struct rfapi_descriptor *rfd, struct bgp *bgp,
if (rfd->peer->ibuf_work)
ringbuf_del(rfd->peer->ibuf_work);
if (rfd->peer->obuf_work)
stream_free(rfd->peer->obuf_work);
rfd->peer->ibuf = NULL;
rfd->peer->obuf = NULL;
rfd->peer->obuf_work = NULL;
rfd->peer->ibuf_work = NULL;
}

View File

@ -189,12 +189,9 @@ static void vnc_redistribute_add(struct prefix *p, uint32_t metric,
if (vncHD1VR.peer->ibuf_work)
ringbuf_del(vncHD1VR.peer->ibuf_work);
if (vncHD1VR.peer->obuf_work)
stream_free(vncHD1VR.peer->obuf_work);
vncHD1VR.peer->ibuf = NULL;
vncHD1VR.peer->obuf = NULL;
vncHD1VR.peer->obuf_work = NULL;
vncHD1VR.peer->ibuf_work = NULL;
}