2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-03 07:45:30 +00:00

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 <bschanmu@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
bschanmu@redhat.com
2016-06-13 14:00:19 +05:30
committed by Ben Pfaff
parent 4f94601a9a
commit 6cf888b821
3 changed files with 66 additions and 12 deletions

View File

@@ -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