[ovs-dev] [PATCH v3 1/3] New qos type linux-noop

bschanmu at redhat.com bschanmu at redhat.com
Mon Jun 13 08:30:19 UTC 2016


Linux ``No operation'' qos type is used to inform the vswitch that the
traffic control for the port is managed externally. Any configuration values
set for this type will have no effect.

This patch provides a solution suggested in this mail -
http://openvswitch.org/pipermail/discuss/2015-May/017687.html

Signed-off-by: Babu Shanmugam <bschanmu at redhat.com>
---
 lib/netdev-linux.c   | 49 ++++++++++++++++++++++++++++++++++++++++++++++++-
 vswitchd/vswitch.xml |  8 ++++++++
 2 files changed, 56 insertions(+), 1 deletion(-)

diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index 82813ba..8a5661d 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -418,6 +418,7 @@ static const struct tc_ops tc_ops_codel;
 static const struct tc_ops tc_ops_fqcodel;
 static const struct tc_ops tc_ops_sfq;
 static const struct tc_ops tc_ops_default;
+static const struct tc_ops tc_ops_noop;
 static const struct tc_ops tc_ops_other;
 
 static const struct tc_ops *const tcs[] = {
@@ -426,6 +427,7 @@ static const struct tc_ops *const tcs[] = {
     &tc_ops_codel,              /* Controlled delay */
     &tc_ops_fqcodel,            /* Fair queue controlled delay */
     &tc_ops_sfq,                /* Stochastic fair queueing */
+    &tc_ops_noop,               /* Non operating qos type. */
     &tc_ops_default,            /* Default qdisc (see tc-pfifo_fast(8)). */
     &tc_ops_other,              /* Some other qdisc. */
     NULL
@@ -2101,7 +2103,6 @@ netdev_linux_get_qos_types(const struct netdev *netdev OVS_UNUSED,
                            struct sset *types)
 {
     const struct tc_ops *const *opsp;
-
     for (opsp = tcs; *opsp != NULL; opsp++) {
         const struct tc_ops *ops = *opsp;
         if (ops->tc_install && ops->ovs_name[0] != '\0') {
@@ -2206,6 +2207,10 @@ netdev_linux_set_qos(struct netdev *netdev_,
         return EOPNOTSUPP;
     }
 
+    if (new_ops == &tc_ops_noop) {
+        return new_ops->tc_install(netdev_, details);
+    }
+
     ovs_mutex_lock(&netdev->mutex);
     error = tc_query_qdisc(netdev_);
     if (error) {
@@ -4489,6 +4494,48 @@ static const struct tc_ops tc_ops_hfsc = {
     hfsc_class_dump_stats       /* class_dump_stats */
 };
 
+/* "linux-noop" traffic control class. */
+
+static void
+noop_install__(struct netdev *netdev_)
+{
+    struct netdev_linux *netdev = netdev_linux_cast(netdev_);
+    static const struct tc tc = TC_INITIALIZER(&tc, &tc_ops_default);
+
+    netdev->tc = CONST_CAST(struct tc *, &tc);
+}
+
+static int
+noop_tc_install(struct netdev *netdev,
+                   const struct smap *details OVS_UNUSED)
+{
+    noop_install__(netdev);
+    return 0;
+}
+
+static int
+noop_tc_load(struct netdev *netdev, struct ofpbuf *nlmsg OVS_UNUSED)
+{
+    noop_install__(netdev);
+    return 0;
+}
+
+static const struct tc_ops tc_ops_noop = {
+    NULL,                       /* linux_name */
+    "linux-noop",               /* ovs_name */
+    0,                          /* n_queues */
+    noop_tc_install,
+    noop_tc_load,
+    NULL,                       /* tc_destroy */
+    NULL,                       /* qdisc_get */
+    NULL,                       /* qdisc_set */
+    NULL,                       /* class_get */
+    NULL,                       /* class_set */
+    NULL,                       /* class_delete */
+    NULL,                       /* class_get_stats */
+    NULL                        /* class_dump_stats */
+};
+
 /* "linux-default" traffic control class.
  *
  * This class represents the default, unnamed Linux qdisc.  It corresponds to
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index 5cf1ee1..b09119c 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -3387,6 +3387,14 @@
         </dd>
       </dl>
       <dl>
+        <dt><code>linux-noop</code></dt>
+        <dd>
+          Linux ``No operation'' qos type is used to inform the vswitch that the
+          traffic control for the port is managed externally. Any configuration values
+          set for this type will have no effect.
+        </dd>
+      </dl>
+      <dl>
         <dt><code>egress-policer</code></dt>
         <dd>
           An egress policer algorithm. This implementation uses the DPDK
-- 
2.5.0




More information about the dev mailing list