diff options
author | Quentin Young <qlyoung@nvidia.com> | 2021-04-27 00:42:12 +0200 |
---|---|---|
committer | Quentin Young <qlyoung@nvidia.com> | 2021-04-29 18:12:32 +0200 |
commit | fe2e3bae6a2207f97437c84f8a7525a7b31f38d6 (patch) | |
tree | 05331b11b47a0972142038c3dbf0ed37ef3a8797 | |
parent | Merge pull request #8110 from rgirada/rmap_nb (diff) | |
download | frr-fe2e3bae6a2207f97437c84f8a7525a7b31f38d6.tar.xz frr-fe2e3bae6a2207f97437c84f8a7525a7b31f38d6.zip |
Revert "bgpd: improve socket read performance"
This reverts commit 97a16e648115919aab3784a6511807e35c20ee20.
Diffstat (limited to '')
-rw-r--r-- | bgpd/bgp_io.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/bgpd/bgp_io.c b/bgpd/bgp_io.c index c2d8cae58..fec96700d 100644 --- a/bgpd/bgp_io.c +++ b/bgpd/bgp_io.c @@ -462,10 +462,13 @@ done : { */ static uint16_t bgp_read(struct peer *peer, int *code_p) { + size_t readsize; // how many bytes we want to read ssize_t nbytes; // how many bytes we actually read uint16_t status = 0; + uint8_t ibw[peer->max_packet_size * BGP_READ_PACKET_MAX]; - nbytes = ringbuf_read(peer->ibuf_work, peer->fd); + readsize = MIN(ringbuf_space(peer->ibuf_work), sizeof(ibw)); + nbytes = read(peer->fd, ibw, readsize); /* EAGAIN or EWOULDBLOCK; come back later */ if (nbytes < 0 && ERRNO_IO_RETRY(errno)) { @@ -493,6 +496,9 @@ static uint16_t bgp_read(struct peer *peer, int *code_p) *code_p = TCP_connection_closed; SET_FLAG(status, BGP_IO_FATAL_ERR); + } else { + assert(ringbuf_put(peer->ibuf_work, ibw, nbytes) + == (size_t)nbytes); } return status; |