summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDave Wallace <dwallacelf@gmail.com>2020-01-21 16:56:19 +0000
committerDave Wallace <dwallacelf@gmail.com>2020-01-22 06:57:53 +0000
commitc0c4eec3bc309bcc656eade82f17754875f9ed7c (patch)
tree5d3a1e9c27e8557bd0cd91d0bc5e422b102105a6 /src
parent54eda4bcb80cfbaee16b26fad521d6ead5e0a518 (diff)
nsim: enable output scheduling on main thread
Type: fix Change-Id: I5d47cb9bc7eb7f3c8485e3b42f0701e81d87ba2a Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/nsim/nsim.c30
-rw-r--r--src/plugins/nsim/nsim.h1
2 files changed, 29 insertions, 2 deletions
diff --git a/src/plugins/nsim/nsim.c b/src/plugins/nsim/nsim.c
index 5bc9eaecdd6..c6414905018 100644
--- a/src/plugins/nsim/nsim.c
+++ b/src/plugins/nsim/nsim.c
@@ -182,7 +182,8 @@ nsim_configure (nsim_main_t * nsm, f64 bandwidth, f64 delay, f64 packet_size,
vec_validate (nsm->wheel_by_thread, num_workers);
/* Initialize the output scheduler wheels */
- for (i = num_workers ? 1 : 0; i < num_workers + 1; i++)
+ i = (!nsm->poll_main_thread && num_workers) ? 1 : 0;
+ for (; i < num_workers + 1; i++)
{
nsim_wheel_t *wp;
@@ -205,7 +206,8 @@ nsim_configure (nsim_main_t * nsm, f64 bandwidth, f64 delay, f64 packet_size,
vlib_worker_thread_barrier_sync (vm);
/* turn on the ring scrapers */
- for (i = num_workers ? 1 : 0; i < num_workers + 1; i++)
+ i = (!nsm->poll_main_thread && num_workers) ? 1 : 0;
+ for (; i < num_workers + 1; i++)
{
vlib_main_t *this_vm = vlib_mains[i];
@@ -287,6 +289,28 @@ nsim_cross_connect_enable_disable_command_fn (vlib_main_t * vm,
return 0;
}
+static clib_error_t *
+nsim_config (vlib_main_t * vm, unformat_input_t * input)
+{
+ nsim_main_t *nsm = &nsim_main;
+
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "poll-main-thread"))
+ {
+ nsm->poll_main_thread = 1;
+ }
+ else
+ {
+ return clib_error_return (0, "unknown input '%U'",
+ format_unformat_error, input);
+ }
+ }
+ return 0;
+}
+
+VLIB_CONFIG_FUNCTION (nsim_config, "nsim");
+
/*?
* Enable or disable network simulation cross-connect on two interfaces
* The network simulator must have already been configured, see
@@ -584,6 +608,8 @@ set_nsim_command_fn (vlib_main_t * vm,
return clib_error_return
(0, "drop fraction must be between zero and 1");
}
+ else if (unformat (input, "poll-main-thread"))
+ nsm->poll_main_thread = 1;
else
break;
}
diff --git a/src/plugins/nsim/nsim.h b/src/plugins/nsim/nsim.h
index 6afe32dc7f7..0ed9b251fbc 100644
--- a/src/plugins/nsim/nsim.h
+++ b/src/plugins/nsim/nsim.h
@@ -68,6 +68,7 @@ typedef struct
f64 bandwidth;
f64 packet_size;
f64 drop_fraction;
+ u32 poll_main_thread;
u64 mmap_size;
x */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2017 Cisco and/or its affiliates.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at:
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <!-- Cannot have parent , to break cycle, its used in build -->
    <modelVersion>4.0.0</modelVersion>

    <groupId>io.fd.honeycomb.yang</groupId>
    <artifactId>yang-whitelist-api</artifactId>
    <version>1.18.01-SNAPSHOT</version>
    <packaging>jar</packaging>
    <name>${project.artifactId}</name>

    <properties>
        <jaxb-api.version>2.2.12</jaxb-api.version>
    </properties>

    <!-- workaround for HONEYCOMB-393 -->
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-site-plugin</artifactId>
                    <configuration>
                        <skip>true</skip>
                        <skipDeploy>true</skipDeploy>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <dependencies>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>${jaxb-api.version}</version>
        </dependency>
    </dependencies>

</project>