|
|
bbaaef |
From 82e377ad94ff84f3b1fd82e9aa8ea8edbd5b9337 Mon Sep 17 00:00:00 2001
|
|
|
bbaaef |
Message-Id: <82e377ad94ff84f3b1fd82e9aa8ea8edbd5b9337.1569932887.git.lorenzo.bianconi@redhat.com>
|
|
|
bbaaef |
In-Reply-To: <9c04a4b62484895dc301875ad9da7c77c17a99c7.1569932887.git.lorenzo.bianconi@redhat.com>
|
|
|
bbaaef |
References: <9c04a4b62484895dc301875ad9da7c77c17a99c7.1569932887.git.lorenzo.bianconi@redhat.com>
|
|
|
bbaaef |
From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
|
|
|
bbaaef |
Date: Tue, 24 Sep 2019 18:39:55 +0200
|
|
|
bbaaef |
Subject: [PATCH ovn 2/3] northd: add the possibility to define localnet as qos
|
|
|
bbaaef |
capable port
|
|
|
bbaaef |
|
|
|
bbaaef |
Refactor allocate_chassis_queueid and free_chassis_queueid in order
|
|
|
bbaaef |
to get an unused queue_id even for localnet ports and add the
|
|
|
bbaaef |
the possibility to define localnet as qos capable port
|
|
|
bbaaef |
|
|
|
bbaaef |
Acked-by: Dumitru Ceara <dceara@redhat.com>
|
|
|
bbaaef |
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
|
|
|
bbaaef |
Signed-off-by: Mark Michelson <mmichels@redhat.com>
|
|
|
bbaaef |
Acked-by: Mark Michelson <mmichels@redhat.com>
|
|
|
bbaaef |
---
|
|
|
bbaaef |
ovn/northd/ovn-northd.c | 45 ++++++++++++++++++++++++++++++---------------
|
|
|
bbaaef |
1 file changed, 30 insertions(+), 15 deletions(-)
|
|
|
bbaaef |
|
|
|
bbaaef |
--- a/ovn/northd/ovn-northd.c
|
|
|
bbaaef |
+++ b/ovn/northd/ovn-northd.c
|
|
|
bbaaef |
@@ -357,7 +357,7 @@ destroy_chassis_queues(struct hmap *set)
|
|
|
bbaaef |
}
|
|
|
bbaaef |
|
|
|
bbaaef |
static void
|
|
|
bbaaef |
-add_chassis_queue(struct hmap *set, struct uuid *chassis_uuid,
|
|
|
bbaaef |
+add_chassis_queue(struct hmap *set, const struct uuid *chassis_uuid,
|
|
|
bbaaef |
uint32_t queue_id)
|
|
|
bbaaef |
{
|
|
|
bbaaef |
struct ovn_chassis_qdisc_queues *node = xmalloc(sizeof *node);
|
|
|
bbaaef |
@@ -368,7 +368,7 @@ add_chassis_queue(struct hmap *set, stru
|
|
|
bbaaef |
}
|
|
|
bbaaef |
|
|
|
bbaaef |
static bool
|
|
|
bbaaef |
-chassis_queueid_in_use(const struct hmap *set, struct uuid *chassis_uuid,
|
|
|
bbaaef |
+chassis_queueid_in_use(const struct hmap *set, const struct uuid *chassis_uuid,
|
|
|
bbaaef |
uint32_t queue_id)
|
|
|
bbaaef |
{
|
|
|
bbaaef |
const struct ovn_chassis_qdisc_queues *node;
|
|
|
bbaaef |
@@ -383,31 +383,38 @@ chassis_queueid_in_use(const struct hmap
|
|
|
bbaaef |
}
|
|
|
bbaaef |
|
|
|
bbaaef |
static uint32_t
|
|
|
bbaaef |
-allocate_chassis_queueid(struct hmap *set, struct sbrec_chassis *chassis)
|
|
|
bbaaef |
+allocate_chassis_queueid(struct hmap *set, const struct uuid *uuid, char *name)
|
|
|
bbaaef |
{
|
|
|
bbaaef |
+ if (!uuid) {
|
|
|
bbaaef |
+ return 0;
|
|
|
bbaaef |
+ }
|
|
|
bbaaef |
+
|
|
|
bbaaef |
for (uint32_t queue_id = QDISC_MIN_QUEUE_ID + 1;
|
|
|
bbaaef |
queue_id <= QDISC_MAX_QUEUE_ID;
|
|
|
bbaaef |
queue_id++) {
|
|
|
bbaaef |
- if (!chassis_queueid_in_use(set, &chassis->header_.uuid, queue_id)) {
|
|
|
bbaaef |
- add_chassis_queue(set, &chassis->header_.uuid, queue_id);
|
|
|
bbaaef |
+ if (!chassis_queueid_in_use(set, uuid, queue_id)) {
|
|
|
bbaaef |
+ add_chassis_queue(set, uuid, queue_id);
|
|
|
bbaaef |
return queue_id;
|
|
|
bbaaef |
}
|
|
|
bbaaef |
}
|
|
|
bbaaef |
|
|
|
bbaaef |
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1);
|
|
|
bbaaef |
- VLOG_WARN_RL(&rl, "all %s queue ids exhausted", chassis->name);
|
|
|
bbaaef |
+ VLOG_WARN_RL(&rl, "all %s queue ids exhausted", name);
|
|
|
bbaaef |
return 0;
|
|
|
bbaaef |
}
|
|
|
bbaaef |
|
|
|
bbaaef |
static void
|
|
|
bbaaef |
-free_chassis_queueid(struct hmap *set, struct sbrec_chassis *chassis,
|
|
|
bbaaef |
+free_chassis_queueid(struct hmap *set, const struct uuid *uuid,
|
|
|
bbaaef |
uint32_t queue_id)
|
|
|
bbaaef |
{
|
|
|
bbaaef |
- const struct uuid *chassis_uuid = &chassis->header_.uuid;
|
|
|
bbaaef |
+ if (!uuid) {
|
|
|
bbaaef |
+ return;
|
|
|
bbaaef |
+ }
|
|
|
bbaaef |
+
|
|
|
bbaaef |
struct ovn_chassis_qdisc_queues *node;
|
|
|
bbaaef |
HMAP_FOR_EACH_WITH_HASH (node, key_node,
|
|
|
bbaaef |
- hash_chassis_queue(chassis_uuid, queue_id), set) {
|
|
|
bbaaef |
- if (uuid_equals(chassis_uuid, &node->chassis_uuid)
|
|
|
bbaaef |
+ hash_chassis_queue(uuid, queue_id), set) {
|
|
|
bbaaef |
+ if (uuid_equals(uuid, &node->chassis_uuid)
|
|
|
bbaaef |
&& node->queue_id == queue_id) {
|
|
|
bbaaef |
hmap_remove(set, &node->key_node);
|
|
|
bbaaef |
free(node);
|
|
|
bbaaef |
@@ -2568,15 +2575,23 @@ ovn_port_update_sbrec(struct northd_cont
|
|
|
bbaaef |
uint32_t queue_id = smap_get_int(
|
|
|
bbaaef |
&op->sb->options, "qdisc_queue_id", 0);
|
|
|
bbaaef |
bool has_qos = port_has_qos_params(&op->nbsp->options);
|
|
|
bbaaef |
+ const struct uuid *uuid = NULL;
|
|
|
bbaaef |
struct smap options;
|
|
|
bbaaef |
+ char *name = "";
|
|
|
bbaaef |
+
|
|
|
bbaaef |
+ if (!strcmp(op->nbsp->type, "localnet")) {
|
|
|
bbaaef |
+ uuid = &op->sb->header_.uuid;
|
|
|
bbaaef |
+ name = "localnet";
|
|
|
bbaaef |
+ } else if (op->sb->chassis) {
|
|
|
bbaaef |
+ uuid = &op->sb->chassis->header_.uuid;
|
|
|
bbaaef |
+ name = op->sb->chassis->name;
|
|
|
bbaaef |
+ }
|
|
|
bbaaef |
|
|
|
bbaaef |
- if (op->sb->chassis && has_qos && !queue_id) {
|
|
|
bbaaef |
+ if (has_qos && !queue_id) {
|
|
|
bbaaef |
queue_id = allocate_chassis_queueid(chassis_qdisc_queues,
|
|
|
bbaaef |
- op->sb->chassis);
|
|
|
bbaaef |
+ uuid, name);
|
|
|
bbaaef |
} else if (!has_qos && queue_id) {
|
|
|
bbaaef |
- free_chassis_queueid(chassis_qdisc_queues,
|
|
|
bbaaef |
- op->sb->chassis,
|
|
|
bbaaef |
- queue_id);
|
|
|
bbaaef |
+ free_chassis_queueid(chassis_qdisc_queues, uuid, queue_id);
|
|
|
bbaaef |
queue_id = 0;
|
|
|
bbaaef |
}
|
|
|
bbaaef |
|