mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 12:49:18 +00:00
bgpd: raise default & max r/w quanta to 64
Vectored writes are more efficient with a higher quantum. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
parent
093279cd02
commit
8fa7732f5d
@ -22,7 +22,7 @@
|
|||||||
#ifndef _FRR_BGP_IO_H
|
#ifndef _FRR_BGP_IO_H
|
||||||
#define _FRR_BGP_IO_H
|
#define _FRR_BGP_IO_H
|
||||||
|
|
||||||
#define BGP_WRITE_PACKET_MAX 10U
|
#define BGP_WRITE_PACKET_MAX 64U
|
||||||
#define BGP_READ_PACKET_MAX 10U
|
#define BGP_READ_PACKET_MAX 10U
|
||||||
|
|
||||||
#include "bgpd/bgpd.h"
|
#include "bgpd/bgpd.h"
|
||||||
|
@ -1586,36 +1586,24 @@ DEFUN (no_bgp_update_delay,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int bgp_wpkt_quanta_config_vty(struct vty *vty, const char *num,
|
static int bgp_wpkt_quanta_config_vty(struct vty *vty, uint32_t quanta,
|
||||||
char set)
|
bool set)
|
||||||
{
|
{
|
||||||
VTY_DECLVAR_CONTEXT(bgp, bgp);
|
VTY_DECLVAR_CONTEXT(bgp, bgp);
|
||||||
|
|
||||||
if (set) {
|
quanta = set ? quanta : BGP_WRITE_PACKET_MAX;
|
||||||
uint32_t quanta = strtoul(num, NULL, 10);
|
atomic_store_explicit(&bgp->wpkt_quanta, quanta, memory_order_relaxed);
|
||||||
atomic_store_explicit(&bgp->wpkt_quanta, quanta,
|
|
||||||
memory_order_relaxed);
|
|
||||||
} else {
|
|
||||||
atomic_store_explicit(&bgp->wpkt_quanta, BGP_WRITE_PACKET_MAX,
|
|
||||||
memory_order_relaxed);
|
|
||||||
}
|
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bgp_rpkt_quanta_config_vty(struct vty *vty, const char *num,
|
static int bgp_rpkt_quanta_config_vty(struct vty *vty, uint32_t quanta,
|
||||||
char set)
|
bool set)
|
||||||
{
|
{
|
||||||
VTY_DECLVAR_CONTEXT(bgp, bgp);
|
VTY_DECLVAR_CONTEXT(bgp, bgp);
|
||||||
|
|
||||||
if (set) {
|
quanta = set ? quanta : BGP_READ_PACKET_MAX;
|
||||||
uint32_t quanta = strtoul(num, NULL, 10);
|
atomic_store_explicit(&bgp->rpkt_quanta, quanta, memory_order_relaxed);
|
||||||
atomic_store_explicit(&bgp->rpkt_quanta, quanta,
|
|
||||||
memory_order_relaxed);
|
|
||||||
} else {
|
|
||||||
atomic_store_explicit(&bgp->rpkt_quanta, BGP_READ_PACKET_MAX,
|
|
||||||
memory_order_relaxed);
|
|
||||||
}
|
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -1636,47 +1624,32 @@ void bgp_config_write_rpkt_quanta(struct vty *vty, struct bgp *bgp)
|
|||||||
vty_out(vty, " read-quanta %d\n", quanta);
|
vty_out(vty, " read-quanta %d\n", quanta);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Packet quanta configuration */
|
/* Packet quanta configuration
|
||||||
DEFUN (bgp_wpkt_quanta,
|
*
|
||||||
|
* XXX: The value set here controls the size of a stack buffer in the IO
|
||||||
|
* thread. When changing these limits be careful to prevent stack overflow.
|
||||||
|
*
|
||||||
|
* Furthermore, the maximums used here should correspond to
|
||||||
|
* BGP_WRITE_PACKET_MAX and BGP_READ_PACKET_MAX.
|
||||||
|
*/
|
||||||
|
DEFPY (bgp_wpkt_quanta,
|
||||||
bgp_wpkt_quanta_cmd,
|
bgp_wpkt_quanta_cmd,
|
||||||
"write-quanta (1-10)",
|
"[no] write-quanta (1-64)$quanta",
|
||||||
|
NO_STR
|
||||||
"How many packets to write to peer socket per run\n"
|
"How many packets to write to peer socket per run\n"
|
||||||
"Number of packets\n")
|
"Number of packets\n")
|
||||||
{
|
{
|
||||||
int idx_number = 1;
|
return bgp_wpkt_quanta_config_vty(vty, quanta, !no);
|
||||||
return bgp_wpkt_quanta_config_vty(vty, argv[idx_number]->arg, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (no_bgp_wpkt_quanta,
|
DEFPY (bgp_rpkt_quanta,
|
||||||
no_bgp_wpkt_quanta_cmd,
|
|
||||||
"no write-quanta (1-10)",
|
|
||||||
NO_STR
|
|
||||||
"How many packets to write to peer socket per I/O cycle\n"
|
|
||||||
"Number of packets\n")
|
|
||||||
{
|
|
||||||
int idx_number = 2;
|
|
||||||
return bgp_wpkt_quanta_config_vty(vty, argv[idx_number]->arg, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUN (bgp_rpkt_quanta,
|
|
||||||
bgp_rpkt_quanta_cmd,
|
bgp_rpkt_quanta_cmd,
|
||||||
"read-quanta (1-10)",
|
"[no] read-quanta (1-10)$quanta",
|
||||||
"How many packets to read from peer socket per I/O cycle\n"
|
|
||||||
"Number of packets\n")
|
|
||||||
{
|
|
||||||
int idx_number = 1;
|
|
||||||
return bgp_rpkt_quanta_config_vty(vty, argv[idx_number]->arg, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUN (no_bgp_rpkt_quanta,
|
|
||||||
no_bgp_rpkt_quanta_cmd,
|
|
||||||
"no read-quanta (1-10)",
|
|
||||||
NO_STR
|
NO_STR
|
||||||
"How many packets to read from peer socket per I/O cycle\n"
|
"How many packets to read from peer socket per I/O cycle\n"
|
||||||
"Number of packets\n")
|
"Number of packets\n")
|
||||||
{
|
{
|
||||||
int idx_number = 2;
|
return bgp_rpkt_quanta_config_vty(vty, quanta, !no);
|
||||||
return bgp_rpkt_quanta_config_vty(vty, argv[idx_number]->arg, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void bgp_config_write_coalesce_time(struct vty *vty, struct bgp *bgp)
|
void bgp_config_write_coalesce_time(struct vty *vty, struct bgp *bgp)
|
||||||
@ -13072,9 +13045,7 @@ void bgp_vty_init(void)
|
|||||||
install_element(BGP_NODE, &bgp_update_delay_establish_wait_cmd);
|
install_element(BGP_NODE, &bgp_update_delay_establish_wait_cmd);
|
||||||
|
|
||||||
install_element(BGP_NODE, &bgp_wpkt_quanta_cmd);
|
install_element(BGP_NODE, &bgp_wpkt_quanta_cmd);
|
||||||
install_element(BGP_NODE, &no_bgp_wpkt_quanta_cmd);
|
|
||||||
install_element(BGP_NODE, &bgp_rpkt_quanta_cmd);
|
install_element(BGP_NODE, &bgp_rpkt_quanta_cmd);
|
||||||
install_element(BGP_NODE, &no_bgp_rpkt_quanta_cmd);
|
|
||||||
|
|
||||||
install_element(BGP_NODE, &bgp_coalesce_time_cmd);
|
install_element(BGP_NODE, &bgp_coalesce_time_cmd);
|
||||||
install_element(BGP_NODE, &no_bgp_coalesce_time_cmd);
|
install_element(BGP_NODE, &no_bgp_coalesce_time_cmd);
|
||||||
|
Loading…
Reference in New Issue
Block a user