mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 14:34:22 +00:00
In the "write" direction added a command to ensure that Quagga
is able to send out K (=3 by default) packets per thread-write. Signed-off-by: Ayan Banerjee <ayan@cumulusnetworks.com> Reviewed-by: JR Rivers <jrrivers@cumulusnetworks.com>
This commit is contained in:
parent
a78d75b04c
commit
2f8f370e35
@ -217,6 +217,13 @@ ospf_fifo_flush (struct ospf_fifo *fifo)
|
||||
fifo->count = 0;
|
||||
}
|
||||
|
||||
/* Return the current fifo count */
|
||||
static int
|
||||
ospf_fifo_count (struct ospf_fifo *fifo)
|
||||
{
|
||||
return (fifo->count);
|
||||
}
|
||||
|
||||
/* Free ospf packet fifo. */
|
||||
void
|
||||
ospf_fifo_free (struct ospf_fifo *fifo)
|
||||
@ -647,6 +654,7 @@ ospf_write (struct thread *thread)
|
||||
#endif /* WANT_OSPF_WRITE_FRAGMENT */
|
||||
u_int16_t maxdatasize;
|
||||
#define OSPF_WRITE_IPHL_SHIFT 2
|
||||
int pkt_count = 0;
|
||||
|
||||
ospf->t_write = NULL;
|
||||
|
||||
@ -668,6 +676,9 @@ ospf_write (struct thread *thread)
|
||||
maxdatasize = MIN (oi->ifp->mtu, ospf->maxsndbuflen) -
|
||||
sizeof (struct ip);
|
||||
|
||||
while ((pkt_count < ospf->write_multiplier) && ospf_fifo_count(oi->obuf))
|
||||
{
|
||||
pkt_count++;
|
||||
/* Get one packet from queue. */
|
||||
op = ospf_fifo_head (oi->obuf);
|
||||
assert (op);
|
||||
@ -793,6 +804,7 @@ ospf_write (struct thread *thread)
|
||||
|
||||
/* Now delete packet from queue. */
|
||||
ospf_packet_delete (oi);
|
||||
}
|
||||
|
||||
/* Move this interface to the tail of write_q to
|
||||
serve everyone in a round robin fashion */
|
||||
|
@ -2531,6 +2531,37 @@ DEFUN (no_ospf_auto_cost_reference_bandwidth,
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN (ospf_write_multiplier,
|
||||
ospf_write_multiplier_cmd,
|
||||
"write-multiplier <1-50>",
|
||||
"Number of writes per thread callback\n")
|
||||
{
|
||||
struct ospf *ospf = vty->index;
|
||||
u_int32_t write_multiplier;
|
||||
|
||||
write_multiplier = strtol (argv[0], NULL, 10);
|
||||
if (write_multiplier < 1 || write_multiplier > 50)
|
||||
{
|
||||
vty_out (vty, "write-multiplier value is invalid%s", VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
}
|
||||
|
||||
ospf->write_multiplier = write_multiplier;
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN (no_ospf_write_multiplier,
|
||||
no_ospf_write_multiplier_cmd,
|
||||
"no write-multiplier",
|
||||
NO_STR
|
||||
"Number of writes per thread callback\n")
|
||||
{
|
||||
struct ospf *ospf = vty->index;
|
||||
|
||||
ospf->write_multiplier = OSPF_WRITE_MULTIPLIER_DEFAULT;
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
const char *ospf_abr_type_descr_str[] =
|
||||
{
|
||||
"Unknown",
|
||||
@ -2760,6 +2791,10 @@ DEFUN (show_ip_ospf,
|
||||
ospf_timer_dump (ospf->t_spf_calc, timebuf, sizeof (timebuf)),
|
||||
VTY_NEWLINE);
|
||||
|
||||
/* Show write multiplier values */
|
||||
vty_out (vty, " Write Multiplier set to %d %s",
|
||||
ospf->write_multiplier, VTY_NEWLINE);
|
||||
|
||||
/* Show refresh parameters. */
|
||||
vty_out (vty, " Refresh timer %d secs%s",
|
||||
ospf->lsa_refresh_interval, VTY_NEWLINE);
|
||||
@ -7287,6 +7322,11 @@ ospf_config_write (struct vty *vty)
|
||||
ospf->spf_delay, ospf->spf_holdtime,
|
||||
ospf->spf_max_holdtime, VTY_NEWLINE);
|
||||
|
||||
/* Write multiplier print. */
|
||||
if (ospf->write_multiplier != OSPF_WRITE_MULTIPLIER_DEFAULT)
|
||||
vty_out (vty, " ospf write-multiplier %d%s",
|
||||
ospf->write_multiplier, VTY_NEWLINE);
|
||||
|
||||
/* Max-metric router-lsa print */
|
||||
config_write_stub_router (vty, ospf);
|
||||
|
||||
@ -7723,6 +7763,10 @@ ospf_vty_init (void)
|
||||
install_element (OSPF_NODE, &no_ospf_neighbor_priority_cmd);
|
||||
install_element (OSPF_NODE, &no_ospf_neighbor_poll_interval_cmd);
|
||||
|
||||
/* write multiplier commands */
|
||||
install_element (OSPF_NODE, &ospf_write_multiplier_cmd);
|
||||
install_element (OSPF_NODE, &no_ospf_write_multiplier_cmd);
|
||||
|
||||
/* Init interface related vty commands. */
|
||||
ospf_vty_if_init ();
|
||||
|
||||
|
@ -233,6 +233,7 @@ ospf_new (void)
|
||||
}
|
||||
new->t_read = thread_add_read (master, ospf_read, new, new->fd);
|
||||
new->oi_write_q = list_new ();
|
||||
new->write_multiplier = OSPF_WRITE_MULTIPLIER_DEFAULT;
|
||||
|
||||
return new;
|
||||
}
|
||||
|
@ -219,6 +219,8 @@ struct ospf
|
||||
struct thread *t_deferred_shutdown; /* deferred/stub-router shutdown timer*/
|
||||
|
||||
struct thread *t_write;
|
||||
#define OSPF_WRITE_MULTIPLIER_DEFAULT 3
|
||||
int write_multiplier; /* Num of packets sent per thread invocation */
|
||||
struct thread *t_read;
|
||||
int fd;
|
||||
unsigned int maxsndbuflen;
|
||||
|
Loading…
Reference in New Issue
Block a user