On 7/17/23 11:13, Ales Musil wrote:
> On Tue, Jun 20, 2023 at 3:59 PM Xavier Simonart <[email protected]> wrote:
> 
>> Before this patch, if iface did not exist when qos I+P was run the first
>> time
>> a qos queue was still created and qos I+P was not applying qos to OVS.
>> qos was potentially applied later, if/when (for any reason) runtime_data
>> had to be recomputed.
>>
>> Fixes: 7d1d111ff213 ("controller: configure qos through ovs qos table and
>> do not run tc directly")
>> Signed-off-by: Xavier Simonart <[email protected]>
>>
>> ---
>> v2: - handled Lorenzo's comments
>>     - updated test case to also test null network (as referenced by
>> Lorenzo)
>>     - rebased on origin/main
>> ---
>>  controller/binding.c | 26 ++++++++++++--------------
>>  tests/ovn.at         |  8 ++++++++
>>  2 files changed, 20 insertions(+), 14 deletions(-)
>>
>> diff --git a/controller/binding.c b/controller/binding.c
>> index 8069a2e0d..355b73070 100644
>> --- a/controller/binding.c
>> +++ b/controller/binding.c
>> @@ -362,7 +362,7 @@ configure_qos(const struct sbrec_port_binding *pb,
>>      struct qos_queue *q = find_qos_queue(b_ctx_out->qos_map, hash,
>>                                           pb->logical_port);
>>      if (!q || q->min_rate != min_rate || q->max_rate != max_rate ||
>> -        q->burst != burst) {
>> +        q->burst != burst || (network && strcmp(network, q->network))) {
>>          struct shash bridge_mappings =
>> SHASH_INITIALIZER(&bridge_mappings);
>>          add_ovs_bridge_mappings(b_ctx_in->ovs_table,
>> b_ctx_in->bridge_table,
>>                                  &bridge_mappings);
>> @@ -378,22 +378,20 @@ configure_qos(const struct sbrec_port_binding *pb,
>>              add_ovs_qos_table_entry(b_ctx_in->ovs_idl_txn, port, min_rate,
>>                                      max_rate, burst, queue_id,
>>                                      pb->logical_port);
>> +            if (!q) {
>> +                q = xzalloc(sizeof *q);
>> +                hmap_insert(b_ctx_out->qos_map, &q->node, hash);
>> +                q->port = xstrdup(pb->logical_port);
>> +                q->queue_id = queue_id;
>> +            }
>> +            free(q->network);
>> +            q->network = network ? xstrdup(network) : NULL;
>> +            q->min_rate = min_rate;
>> +            q->max_rate = max_rate;
>> +            q->burst = burst;
>>          }
>>          shash_destroy(&bridge_mappings);
>>      }
>> -
>> -    if (!q) {
>> -        q = xzalloc(sizeof *q);
>> -        hmap_insert(b_ctx_out->qos_map, &q->node, hash);
>> -        q->port = xstrdup(pb->logical_port);
>> -        q->queue_id = queue_id;
>> -    }
>> -
>> -    free(q->network);
>> -    q->network = network ? xstrdup(network) : NULL;
>> -    q->min_rate = min_rate;
>> -    q->max_rate = max_rate;
>> -    q->burst = burst;
>>  }
>>
>>  static const struct ovsrec_queue *
>> diff --git a/tests/ovn.at b/tests/ovn.at
>> index 2c221a05c..8d69c35d9 100644
>> --- a/tests/ovn.at
>> +++ b/tests/ovn.at
>> @@ -36235,6 +36235,7 @@ check ovn-nbctl ls-add ls1
>>  check ovn-nbctl lsp-add ls1 public1
>>  check ovn-nbctl lsp-set-addresses public1 unknown
>>  check ovn-nbctl lsp-set-type public1 localnet
>> +check ovn-nbctl lsp-set-options public1 network_name=phys
>>
>>  check ovn-nbctl lsp-add ls1 lsp5
>>  check ovn-nbctl lsp-set-addresses lsp5 f0:00:00:00:00:05
>> @@ -36244,6 +36245,12 @@ ovs-vsctl add-port br-int vif5 -- \
>>      ofport-request=5
>>  OVS_WAIT_UNTIL([test x`ovn-nbctl lsp-get-up lsp5` = xup])
>>
>> +# Delete and add back public1
>> +check ovn-nbctl --wait=hv lsp-del public1
>> +check ovn-nbctl lsp-add ls1 public1
>> +check ovn-nbctl lsp-set-addresses public1 unknown
>> +check ovn-nbctl lsp-set-type public1 localnet
>> +
>>  check ovn-nbctl set Logical_Switch_Port public1
>> options:qos_min_rate=6000000000
>>  check ovn-nbctl set Logical_Switch_Port public1
>> options:qos_max_rate=7000000000
>>  check ovn-nbctl set Logical_Switch_Port public1
>> options:qos_burst=8000000000
>> @@ -36509,6 +36516,7 @@ check ovn-nbctl lsp-add ls2 public2
>>  check ovn-nbctl lsp-set-addresses public2 unknown
>>  check ovn-nbctl lsp-set-type public2 localnet
>>  check ovn-nbctl --wait=sb set Logical_Switch_Port public2
>> options:qos_min_rate=6000000000 options:qos_max_rate=7000000000
>> options:qos_burst=8000000000 options:network_name=phys
>> +check ovn-nbctl --wait=sb lsp-set-options public2 qos_min_rate=6000000000
>> qos_max_rate=7000000000 qos_burst=8000000000
>>
>>  # Let's now send ovn controller to sleep, so it will receive both ofport
>> notification and ls deletion simultaneously
>>  sleep_controller hv-1
>> --
>> 2.31.1
>>
>> _______________________________________________
>> dev mailing list
>> [email protected]
>> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>>
>>
> Looks good to me, thanks.
> 
> Acked-by: Ales Musil <[email protected]>
> 

Thanks, Xavier and Ales!

I applied this to main and backported it to 23.06.

Regards,
Dumitru

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to