This is a preliminary patch to rework OVN QoS implementation in order to configure it through OVS QoS table instead of running tc command directly bypassing OVS.
Signed-off-by: Lorenzo Bianconi <[email protected]> --- controller/binding.c | 7 ++++++- northd/northd.c | 8 ++++++++ ovn-sb.xml | 5 +++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/controller/binding.c b/controller/binding.c index b9bcb5389..6854a162d 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -142,6 +142,7 @@ static void update_lport_tracking(const struct sbrec_port_binding *pb, struct qos_queue { struct hmap_node node; + char *network; char *port; bool stale; @@ -210,6 +211,7 @@ qos_queue_gc(const struct sbrec_port_binding *pb, struct hmap *queue_map) HMAP_FOR_EACH_SAFE (q, node, queue_map) { if (q->stale) { hmap_remove(queue_map, &q->node); + free(q->network); free(q->port); free(q); } @@ -221,6 +223,7 @@ destroy_qos_map(struct hmap *qos_map) { struct qos_queue *q; HMAP_FOR_EACH_POP (q, node, qos_map) { + free(q->network); free(q->port); free(q); } @@ -234,8 +237,9 @@ get_qos_queue(const struct sbrec_port_binding *pb, struct hmap *queue_map) uint32_t max_rate = smap_get_int(&pb->options, "qos_max_rate", 0); uint32_t burst = smap_get_int(&pb->options, "qos_burst", 0); uint32_t queue_id = smap_get_int(&pb->options, "qdisc_queue_id", 0); + const char *network = smap_get(&pb->options, "qos_physical_network"); - if ((!min_rate && !max_rate && !burst) || !queue_id) { + if ((!min_rate && !max_rate && !burst) || !queue_id || !network) { /* Qos is not configured for this port. */ return; } @@ -246,6 +250,7 @@ get_qos_queue(const struct sbrec_port_binding *pb, struct hmap *queue_map) if (!q) { q = xzalloc(sizeof *q); hmap_insert(queue_map, &q->node, hash); + q->network = xstrdup(network); q->port = xstrdup(pb->logical_port); q->min_rate = min_rate; q->max_rate = max_rate; diff --git a/northd/northd.c b/northd/northd.c index 25df0957e..53217347d 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -3505,7 +3505,15 @@ ovn_port_update_sbrec(struct ovsdb_idl_txn *ovnsb_txn, } smap_clone(&options, &op->nbsp->options); + if (queue_id) { + if (op->od->n_localnet_ports) { + struct ovn_port *port = op->od->localnet_ports[0]; + const char *physical_network = smap_get( + &port->nbsp->options, "network_name"); + smap_add(&options, "qos_physical_network", + physical_network); + } smap_add_format(&options, "qdisc_queue_id", "%d", queue_id); } diff --git a/ovn-sb.xml b/ovn-sb.xml index 8ca206109..d8c726dfa 100644 --- a/ovn-sb.xml +++ b/ovn-sb.xml @@ -3654,6 +3654,11 @@ tcp.flags = RST; interface, in bits. </column> + <column name="options" key="qos_physical_network"> + If set, indicates the name of the egress network name where traffic + shaping will be applied. + </column> + <column name="options" key="qdisc_queue_id" type='{"type": "integer", "minInteger": 1, "maxInteger": 61440}'> Indicates the queue number on the physical device. This is same as the -- 2.40.1 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
