Merge pull request #14081 from donaldsharp/bgp_ringbuf_cleanup

Bgp ringbuf cleanup
This commit is contained in:
Russ White 2023-07-25 10:24:12 -04:00 committed by GitHub
commit 0095023cc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 7 deletions

View File

@ -218,7 +218,6 @@ static void bgp_process_reads(struct event *thread)
bool fatal = false; /* whether fatal error occurred */
bool added_pkt = false; /* whether we pushed onto ->ibuf */
int code = 0; /* FSM code if error occurred */
bool ibuf_full = false; /* Is peer fifo IN Buffer full */
static bool ibuf_full_logged; /* Have we logged full already */
int ret = 1;
/* clang-format on */
@ -265,7 +264,6 @@ static void bgp_process_reads(struct event *thread)
fatal = true;
break;
case -ENOMEM:
ibuf_full = true;
if (!ibuf_full_logged) {
if (bgp_debug_neighbor_events(peer))
zlog_debug(
@ -288,10 +286,6 @@ done:
return;
}
/* ringbuf should be fully drained unless ibuf is full */
if (!ibuf_full)
assert(ringbuf_space(peer->ibuf_work) >= peer->max_packet_size);
event_add_read(fpt->master, bgp_process_reads, peer, peer->fd,
&peer->t_read);
if (added_pkt)

View File

@ -1416,7 +1416,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");