Re: [ovs-dev] [PATCH] ovn: add qos function.

2017-07-11 Thread Ben Pfaff
On Mon, Jun 26, 2017 at 10:06:17AM +0800, wang.qia...@zte.com.cn wrote:
> The current qos function is used for geneve
> tunnel to control the traffic out the ovs. And have no to-port qos 
> control.
> 
> This patch do the modification as follow
> 1. change the qos configuration with direction to consistent with neutron
> qos rule. Add qos_ingress_max_rate, qos_ingress_burst, qos_egress_max_rate
> and qos_egress_burst to instead old qos_max_rate and qos_burst.
> 
> 2. By configure the interface table field of ingress_policing_rate and
> ingress_policing_bust to implement the ingress qos control.
> 
> 3. Add qos configuration to qos field of port table to implement egress 
> qos
> control.
> 
> 4. Add dpdk qos support.
> 
> Change-Id: Ie90364cb5bee7f6b7e3086e0867997f7edab7038

Thanks for working on OVN.

The patch is wordwrapped, so it cannot be applied.

I believe that this patch breaks backward compatibility with existing
Neutron and other CMSes that run on top of OVN, as well as between
ovn-northd and ovn-controller of different versions.  Backward
compatibility is important to us, so it would be better to preserve it.
I think that this could be done by simply keeping the existing names for
qos_max_rate and qos_burst.  I understand the desire to have systematic
names; this could be done by supporting the old names as synonyms for
the equivalent new ones.

The patch needs a Signed-off-by.  Please read the OVS contribution info
for a description of how to add one and what it means (the meaning is
important).

Please add an item to NEWS.

I'll look forward to the next version of the patch.

Thanks,

Ben.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] ovn: add qos function.

2017-06-25 Thread wang . qianyu
The current qos function is used for geneve
tunnel to control the traffic out the ovs. And have no to-port qos 
control.

This patch do the modification as follow
1. change the qos configuration with direction to consistent with neutron
qos rule. Add qos_ingress_max_rate, qos_ingress_burst, qos_egress_max_rate
and qos_egress_burst to instead old qos_max_rate and qos_burst.

2. By configure the interface table field of ingress_policing_rate and
ingress_policing_bust to implement the ingress qos control.

3. Add qos configuration to qos field of port table to implement egress 
qos
control.

4. Add dpdk qos support.

Change-Id: Ie90364cb5bee7f6b7e3086e0867997f7edab7038
---
 ovn/controller/binding.c | 525 
---
 ovn/northd/ovn-northd.c  |  17 +-
 ovn/ovn-nb.xml   |  18 +-
 ovn/ovn-sb.xml   |  18 +-
 4 files changed, 360 insertions(+), 218 deletions(-)

diff --git a/ovn/controller/binding.c b/ovn/controller/binding.c
index bb76608..f40273f 100644
--- a/ovn/controller/binding.c
+++ b/ovn/controller/binding.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015, 2016, 2017 Nicira, Inc.
+/* Copyright (c) 2015, 2016, 2017 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -33,13 +33,26 @@ VLOG_DEFINE_THIS_MODULE(binding);
 
 #define OVN_QOS_TYPE "linux-htb"
 
+#define IS_SUB_PORT(PB)  (PB->parent_port && \
+PB->parent_port[0])
+
 struct qos_queue {
 struct hmap_node node;
 uint32_t queue_id;
-uint32_t max_rate;
-uint32_t burst;
+uint32_t ingress_max_rate;
+uint32_t ingress_burst;
+uint32_t egress_max_rate;
+uint32_t egress_burst;
 };
 
+static void
+add_column_noalert(struct ovsdb_idl *idl,
+   const struct ovsdb_idl_column *column)
+{
+ovsdb_idl_add_column(idl, column);
+ovsdb_idl_omit_alert(idl, column);
+}
+
 void
 binding_register_ovs_idl(struct ovsdb_idl *ovs_idl)
 {
@@ -59,16 +72,28 @@ binding_register_ovs_idl(struct ovsdb_idl *ovs_idl)
 ovsdb_idl_add_column(ovs_idl, _interface_col_name);
 ovsdb_idl_add_column(ovs_idl, _interface_col_external_ids);
 ovsdb_idl_add_column(ovs_idl, _interface_col_status);
+add_column_noalert(ovs_idl, 
_interface_col_ingress_policing_rate);
+add_column_noalert(ovs_idl, 
_interface_col_ingress_policing_burst);
+add_column_noalert(ovs_idl, _port_col_qos);
 
 ovsdb_idl_add_table(ovs_idl, _table_qos);
-ovsdb_idl_add_column(ovs_idl, _qos_col_type);
+add_column_noalert(ovs_idl, _qos_col_external_ids);
+add_column_noalert(ovs_idl, _qos_col_other_config);
+add_column_noalert(ovs_idl, _qos_col_type);
+add_column_noalert(ovs_idl, _qos_col_queues);
+
+ovsdb_idl_add_table(ovs_idl, _table_queue);
+add_column_noalert(ovs_idl, _queue_col_external_ids);
+add_column_noalert(ovs_idl, _queue_col_other_config);
+add_column_noalert(ovs_idl, _queue_col_dscp);
 }
 
 static void
 get_local_iface_ids(const struct ovsrec_bridge *br_int,
 struct shash *lport_to_iface,
 struct sset *local_lports,
-struct sset *egress_ifaces)
+struct sset *egress_ifaces,
+struct shash *lport_to_pport)
 {
 int i;
 
@@ -90,6 +115,7 @@ get_local_iface_ids(const struct ovsrec_bridge *br_int,
 
 if (iface_id && ofport > 0) {
 shash_add(lport_to_iface, iface_id, iface_rec);
+shash_add(lport_to_pport, iface_id, port_rec);
 sset_add(local_lports, iface_id);
 }
 
@@ -163,206 +189,39 @@ add_local_datapath(const struct ldatapath_index 
*ldatapaths,
  local_datapaths);
 }
 
-static void
-get_qos_params(const struct sbrec_port_binding *pb, struct hmap 
*queue_map)
+static  bool
+get_qos_params(const struct sbrec_port_binding *pb, struct qos_queue 
*queue)
 {
-uint32_t max_rate = smap_get_int(>options, "qos_max_rate", 0);
-uint32_t burst = smap_get_int(>options, "qos_burst", 0);
+uint32_t ingress_max_rate = smap_get_int(>options, 
"qos_ingress_max_rate", 0);
+uint32_t ingress_burst = smap_get_int(>options, 
"qos_ingress_burst", 0);
+uint32_t egress_max_rate = smap_get_int(>options, 
"qos_egress_max_rate", 0);
+uint32_t egress_burst = smap_get_int(>options, 
"qos_egress_burst", 0);
 uint32_t queue_id = smap_get_int(>options, "qdisc_queue_id", 0);
-
-if ((!max_rate && !burst) || !queue_id) {
+ 
+if (!queue_id) {
 /* Qos is not configured for this port. */
-return;
-}
-
-struct qos_queue *node = xzalloc(sizeof *node);
-hmap_insert(queue_map, >node, hash_int(queue_id, 0));
-node->max_rate = max_rate;
-node->burst = burst;
-node->queue_id = queue_id;
-}
-
-static const struct ovsrec_qos *
-get_noop_qos(struct controller_ctx *ctx)
-{
-const struct ovsrec_qos *qos;
-OVSREC_QOS_FOR_EACH (qos,