On 10/4/23 18:18, Ilya Maximets wrote:
> On 10/4/23 16:40, Dumitru Ceara wrote:
>> OVS actually supports way more.  Use the real numbers instead.
>> To avoid preallocating huge bitmaps for the group/meter IDs, switch to
>> id-pool instead (as suggested by Ilya).
>>
>> Reported-at: https://issues.redhat.com/browse/FDP-70
>> Suggested-by: Ilya Maximets <i.maxim...@ovn.org>
>> Signed-off-by: Dumitru Ceara <dce...@redhat.com>
>> ---
>>  controller/ovn-controller.c |  4 ++--
>>  lib/extend-table.c          | 28 ++++++++++++----------------
>>  lib/extend-table.h          |  7 +++----
>>  tests/test-ovn.c            |  4 ++--
>>  4 files changed, 19 insertions(+), 24 deletions(-)
>>
>> diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c
>> index 9a81f1a80f..50a101f0e8 100644
>> --- a/controller/ovn-controller.c
>> +++ b/controller/ovn-controller.c
>> @@ -3936,8 +3936,8 @@ en_lflow_output_init(struct engine_node *node 
>> OVS_UNUSED,
>>  {
>>      struct ed_type_lflow_output *data = xzalloc(sizeof *data);
>>      ovn_desired_flow_table_init(&data->flow_table);
>> -    ovn_extend_table_init(&data->group_table);
>> -    ovn_extend_table_init(&data->meter_table);
>> +    ovn_extend_table_init(&data->group_table, OFPG_MAX);
>> +    ovn_extend_table_init(&data->meter_table, OFPM13_MAX);
>>      objdep_mgr_init(&data->lflow_deps_mgr);
>>      lflow_conj_ids_init(&data->conj_ids);
>>      uuidset_init(&data->objs_processed);
>> diff --git a/lib/extend-table.c b/lib/extend-table.c
>> index ebb1a054cb..8fbe69508f 100644
>> --- a/lib/extend-table.c
>> +++ b/lib/extend-table.c
>> @@ -17,7 +17,6 @@
>>  #include <config.h>
>>  #include <string.h>
>>  
>> -#include "bitmap.h"
>>  #include "extend-table.h"
>>  #include "hash.h"
>>  #include "lib/uuid.h"
>> @@ -30,10 +29,10 @@ ovn_extend_table_delete_desired(struct ovn_extend_table 
>> *table,
>>                                  struct ovn_extend_table_lflow_to_desired 
>> *l);
>>  
>>  void
>> -ovn_extend_table_init(struct ovn_extend_table *table)
>> +ovn_extend_table_init(struct ovn_extend_table *table, uint32_t max_size)
>>  {
>> -    table->table_ids = bitmap_allocate(MAX_EXT_TABLE_ID);
>> -    bitmap_set1(table->table_ids, 0); /* table id 0 is invalid. */
>> +    /* Table id 0 is invalid, set id-pool base to 1. */
>> +    table->table_ids = id_pool_create(1, max_size + 1);
> 
> The second parameter is a total number of IDs.  Initialized like this
> we will have IDs in the range [1, max_size + 2), i.e. 'max_size + 1'
> will be a valid ID, which is not correct.
> 

Good catch!  I'll fix it in v2.

Thanks!

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

Reply via email to