From 6cf888b821cffb75c5723ee76b7103e54b8fa2b5 Mon Sep 17 00:00:00 2001 From: "bschanmu@redhat.com" Date: Mon, 13 Jun 2016 14:00:19 +0530 Subject: [PATCH] netdev-linux: Add new QoS type linux-noop. 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 Signed-off-by: Ben Pfaff --- NEWS | 3 +++ lib/netdev-linux.c | 49 +++++++++++++++++++++++++++++++++++++++++++- vswitchd/vswitch.xml | 26 +++++++++++++---------- 3 files changed, 66 insertions(+), 12 deletions(-) diff --git a/NEWS b/NEWS index 9c56c687a..d7f17834c 100644 --- a/NEWS +++ b/NEWS @@ -23,6 +23,9 @@ Post-v2.5.0 * New option "--color" to produce colorized output for some commands. * New commands "dump-ipfix-bridge" and "dump-ipfix-flow" to dump bridge IPFIX statistics and flow based IPFIX statistics. + - Linux: + * New QoS type "linux-noop" that prevents Open vSwitch from trying to + manage QoS for a given port (useful when other software manages QoS). - DPDK: * New option "n_rxq" for PMD interfaces. Old 'other_config:n-dpdk-rxqs' is no longer supported. diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index 82813badc..8a5661d12 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 6e0ee80c1..7ae0b5131 100644 --- a/vswitchd/vswitch.xml +++ b/vswitchd/vswitch.xml @@ -3350,16 +3350,14 @@ (http://luxik.cdi.cz/~devik/qos/htb/manual/userg.htm) for information on how this classifier works and how to configure it. - -
+
linux-hfsc
Linux "Hierarchical Fair Service Curve" classifier. See http://linux-ip.net/articles/hfsc.en/ for information on how this classifier works.
-
-
+
linux-sfq
Linux ``Stochastic Fairness Queueing'' classifier. See @@ -3367,8 +3365,7 @@ http://linux.die.net/man/8/tc-sfq) for information on how this classifier works.
-
-
+
linux-codel
Linux ``Controlled Delay'' classifier. See tc-codel(8) @@ -3376,8 +3373,7 @@ http://man7.org/linux/man-pages/man8/tc-codel.8.html) for information on how this classifier works.
-
-
+
linux-fq_codel
Linux ``Fair Queuing with Controlled Delay'' classifier. See @@ -3385,11 +3381,19 @@ http://man7.org/linux/man-pages/man8/tc-fq_codel.8.html) for information on how this classifier works.
-
-
+ +
linux-noop
+
+ Linux ``No operation.'' By default, Open vSwitch manages quality of + service on all of its configured ports. This can be helpful, but + sometimes administrators prefer to use other software to manage QoS. + This prevents Open vSwitch from changing the QoS + configuration for a port. +
+
egress-policer
- An egress policer algorithm. This implementation uses the DPDK + A DPDK egress policer algorithm using the DPDK rte_meter library. The rte_meter library provides an implementation which allows the metering and policing of traffic. The implementation in OVS essentially creates a single token bucket used to police