summaryrefslogtreecommitdiffstats
path: root/ospf6d
diff options
context:
space:
mode:
authorPat Ruddy <pat@voltanet.io>2021-05-06 12:39:58 +0200
committerPat Ruddy <pat@voltanet.io>2021-06-18 10:40:42 +0200
commit78156066b9aae203d7346f5ff3250a1ff40839be (patch)
treef2fe2ffd5dd40fd8e3b70d6221d809d88fb9e26e /ospf6d
parentospf6d: add warning log for late hello packets (diff)
downloadfrr-78156066b9aae203d7346f5ff3250a1ff40839be.tar.xz
frr-78156066b9aae203d7346f5ff3250a1ff40839be.zip
ospf6d: add write-multiplier configuration
allow amount of work done by read and write threads in a single invocation to be tuned to between 1 and 100 packets (default 20) Signed-off-by: Pat Ruddy <pat@voltanet.io>
Diffstat (limited to 'ospf6d')
-rw-r--r--ospf6d/ospf6_interface.c35
-rw-r--r--ospf6d/ospf6_message.c4
-rw-r--r--ospf6d/ospf6_top.c6
-rw-r--r--ospf6d/ospf6_top.h1
4 files changed, 44 insertions, 2 deletions
diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c
index 57b7348bc..0651b3188 100644
--- a/ospf6d/ospf6_interface.c
+++ b/ospf6d/ospf6_interface.c
@@ -1985,6 +1985,38 @@ DEFUN (no_auto_cost_reference_bandwidth,
}
+DEFUN (ospf6_write_multiplier,
+ ospf6_write_multiplier_cmd,
+ "write-multiplier (1-100)",
+ "Write multiplier\n"
+ "Maximum number of interface serviced per write\n")
+{
+ VTY_DECLVAR_CONTEXT(ospf6, o);
+ uint32_t write_oi_count;
+
+ write_oi_count = strtol(argv[1]->arg, NULL, 10);
+ if (write_oi_count < 1 || write_oi_count > 100) {
+ vty_out(vty, "write-multiplier value is invalid\n");
+ return CMD_WARNING_CONFIG_FAILED;
+ }
+
+ o->write_oi_count = write_oi_count;
+ return CMD_SUCCESS;
+}
+
+DEFUN (no_ospf6_write_multiplier,
+ no_ospf6_write_multiplier_cmd,
+ "no write-multiplier (1-100)",
+ NO_STR
+ "Write multiplier\n"
+ "Maximum number of interface serviced per write\n")
+{
+ VTY_DECLVAR_CONTEXT(ospf6, o);
+
+ o->write_oi_count = OSPF6_WRITE_INTERFACE_COUNT_DEFAULT;
+ return CMD_SUCCESS;
+}
+
DEFUN (ipv6_ospf6_hellointerval,
ipv6_ospf6_hellointerval_cmd,
"ipv6 ospf6 hello-interval (1-65535)",
@@ -2657,6 +2689,9 @@ void ospf6_interface_init(void)
/* reference bandwidth commands */
install_element(OSPF6_NODE, &auto_cost_reference_bandwidth_cmd);
install_element(OSPF6_NODE, &no_auto_cost_reference_bandwidth_cmd);
+ /* write-multiplier commands */
+ install_element(OSPF6_NODE, &ospf6_write_multiplier_cmd);
+ install_element(OSPF6_NODE, &no_ospf6_write_multiplier_cmd);
}
/* Clear the specified interface structure */
diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c
index 95ea4b5c1..a5470917e 100644
--- a/ospf6d/ospf6_message.c
+++ b/ospf6d/ospf6_message.c
@@ -1848,7 +1848,7 @@ int ospf6_receive(struct thread *thread)
thread_add_read(master, ospf6_receive, ospf6, ospf6->fd,
&ospf6->t_ospf6_receive);
- while (count < OSPF6_WRITE_INTERFACE_COUNT_DEFAULT) {
+ while (count < ospf6->write_oi_count) {
count++;
switch (ospf6_read_helper(sockfd, ospf6)) {
case OSPF6_READ_ERROR:
@@ -1966,7 +1966,7 @@ static int ospf6_write(struct thread *thread)
assert(node);
oi = listgetdata(node);
- while ((pkt_count < OSPF6_WRITE_INTERFACE_COUNT_DEFAULT) && oi
+ while ((pkt_count < ospf6->write_oi_count) && oi
&& (last_serviced_oi != oi)) {
op = ospf6_fifo_head(oi->obuf);
diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c
index adfedcc49..193ee4800 100644
--- a/ospf6d/ospf6_top.c
+++ b/ospf6d/ospf6_top.c
@@ -406,6 +406,7 @@ static struct ospf6 *ospf6_create(const char *name)
o->external_id_table = route_table_init();
+ o->write_oi_count = OSPF6_WRITE_INTERFACE_COUNT_DEFAULT;
o->ref_bandwidth = OSPF6_REFERENCE_BANDWIDTH;
o->distance_table = route_table_init();
@@ -1668,6 +1669,11 @@ static int config_write_ospf6(struct vty *vty)
vty_out(vty, " auto-cost reference-bandwidth %d\n",
ospf6->ref_bandwidth);
+ if (ospf6->write_oi_count
+ != OSPF6_WRITE_INTERFACE_COUNT_DEFAULT)
+ vty_out(vty, " write-multiplier %d\n",
+ ospf6->write_oi_count);
+
/* LSA timers print. */
if (ospf6->lsa_minarrival != OSPF_MIN_LS_ARRIVAL)
vty_out(vty, " timers lsa min-arrival %d\n",
diff --git a/ospf6d/ospf6_top.h b/ospf6d/ospf6_top.h
index dfd689398..5b739ac76 100644
--- a/ospf6d/ospf6_top.h
+++ b/ospf6d/ospf6_top.h
@@ -131,6 +131,7 @@ struct ospf6 {
#define OSPF6_WRITE_INTERFACE_COUNT_DEFAULT 20
struct thread *t_write;
+ int write_oi_count; /* Num of packets sent per thread invocation */
uint32_t ref_bandwidth;
/* Distance parameters */