Skip to content

Commit

Permalink
TODO4
Browse files Browse the repository at this point in the history
Signed-off-by: Dumitru Ceara <[email protected]>
  • Loading branch information
dceara committed Oct 25, 2023
1 parent 0bd32e6 commit 73cf55d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
2 changes: 2 additions & 0 deletions controller/ofctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -677,11 +677,13 @@ run_S_CLEAR_FLOWS(void)
/* Clear existing groups, to match the state of the switch. */
if (groups) {
ovn_extend_table_clear(groups, true);
ovn_extend_table_reinit(groups, ovs_feature_max_select_groups_get());
}

/* Clear existing meters, to match the state of the switch. */
if (meters) {
ovn_extend_table_clear(meters, true);
ovn_extend_table_reinit(meters, ovs_feature_max_meters_get());
ofctrl_meter_bands_clear();
}

Expand Down
4 changes: 2 additions & 2 deletions controller/ovn-controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -3948,8 +3948,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, "group-table", OFPG_MAX);
ovn_extend_table_init(&data->meter_table, "meter-table", OFPM13_MAX);
ovn_extend_table_init(&data->group_table, "group-table", 0);
ovn_extend_table_init(&data->meter_table, "meter-table", 0);
objdep_mgr_init(&data->lflow_deps_mgr);
lflow_conj_ids_init(&data->conj_ids);
uuidset_init(&data->objs_processed);
Expand Down
13 changes: 13 additions & 0 deletions lib/extend-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ ovn_extend_table_init(struct ovn_extend_table *table, const char *table_name,
{
*table = (struct ovn_extend_table) {
.name = table_name,
.max_id = max_id,
/* Table id 0 is invalid, set id-pool base to 1. */
.table_ids = id_pool_create(1, max_id),
.desired = HMAP_INITIALIZER(&table->desired),
Expand All @@ -43,6 +44,18 @@ ovn_extend_table_init(struct ovn_extend_table *table, const char *table_name,
};
}

void
ovn_extend_table_reinit(struct ovn_extend_table *table, uint32_t max_id)
{
ovn_extend_table_clear(table, true);
if (max_id != table->max_id) {
table->max_id = max_id;
//TODO: function?
id_pool_destroy(table->table_ids);
table->table_ids = id_pool_create(1, max_id);
}
}

static struct ovn_extend_table_info *
ovn_extend_table_info_alloc(const char *name, uint32_t id,
struct ovn_extend_table_info *peer,
Expand Down
2 changes: 2 additions & 0 deletions lib/extend-table.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ struct id_pool;
struct ovn_extend_table {
const char *name; /* Used to identify this table in a user friendly way,
* e.g., for logging. */
uint32_t max_id; //TODO: comment
struct id_pool *table_ids; /* Used to allocate ids in either desired or
* existing (or both). If the same "name"
* exists in both desired and existing tables,
Expand Down Expand Up @@ -85,6 +86,7 @@ struct ovn_extend_table_lflow_ref {

void ovn_extend_table_init(struct ovn_extend_table *, const char *table_name,
uint32_t max_id);
void ovn_extend_table_reinit(struct ovn_extend_table *table, uint32_t max_id);

void ovn_extend_table_destroy(struct ovn_extend_table *);

Expand Down

0 comments on commit 73cf55d

Please sign in to comment.